diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000000000..3634cc1369cdec --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,213 @@ +# +# This is free software, lisence use MIT. +# +# Copyright (C) 2019 P3TERX +# Copyright (C) 2019 KFERMercer +# +# +# + +name: OpenWrt-CI + +on: + push: + branches: + - master + # schedule: + # - cron: 0 20 * * * + # release: + # types: [published] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + + - name: Checkout + uses: actions/checkout@master + with: + ref: master + + - name: Space cleanup + env: + DEBIAN_FRONTEND: noninteractive + run: | + docker rmi `docker images -q` + sudo rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/apt/sources.list.d + sudo -E apt-get -y purge azure-cli ghc* zulu* hhvm llvm* firefox google* dotnet* powershell openjdk* mysql* php* + sudo -E apt-get update + sudo -E apt-get -y install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler + sudo -E apt-get -y autoremove --purge + sudo -E apt-get clean + sudo mkdir -p -m 777 /mnt/openwrt/bin /mnt/openwrt/build_dir/host /mnt/openwrt/build_dir/hostpkg /mnt/openwrt/dl /mnt/openwrt/feeds /mnt/openwrt/staging_dir + ln -s /mnt/openwrt/bin ./bin + mkdir -p ./build_dir/host && ln -s /mnt/openwrt/build_dir/host ./build_dir/host + mkdir -p ./build_dir/host && ln -s /mnt/openwrt/build_dir/hostpkg ./build_dir/hostpkg + ln -s /mnt/openwrt/dl ./dl + ln -s /mnt/openwrt/feeds ./feeds + ln -s /mnt/openwrt/staging_dir ./staging_dir + df -h + - name: Own Package and Theme + run: | + cd package + mkdir openwrt-packages + cd openwrt-packages + git clone https://github.com/openwrt-develop/luci-theme-atmaterial.git + git clone https://github.com/rosywrt/luci-theme-rosy + - name: Update feeds + run: | + ./scripts/feeds update -a + ./scripts/feeds install -a + - name: Generate configuration file + run: | + rm -f ./.config* + touch ./.config + # + # ========================固件定制部分======================== + # + # + # 如果不对本区块做出任何编辑, 则生成默认配置固件. + # + # 以下为定制化固件选项和说明: + # + # + # 有些插件/选项是默认开启的, 如果想要关闭, 请参照以下示例进行编写: + # + # ========================================= + # | # 取消编译VMware镜像: | + # | cat >> .config <> .config <> .config <> .config <> .config <> .config <> .config <> .config <> .config <> .config <> .config </dev/null)) + $(call opkg_package_files,$(foreach pkg,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(pkg)$(call GetABISuffix,$(pkg)))) @for file in $(PACKAGE_INSTALL_FILES); do \ [ -s $$file.flags ] || continue; \ for flag in `cat $$file.flags`; do \ @@ -84,8 +84,12 @@ $(curdir)/index: FORCE mkdir -p $$d; \ cd $$d || continue; \ $(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages.manifest; \ - grep -avE '^(Maintainer|LicenseFiles|Source|Require)' Packages.manifest > Packages && \ - gzip -9nc Packages > Packages.gz; \ + grep -vE '^(Maintainer|LicenseFiles|Source|SourceName|Require)' Packages.manifest > Packages; \ + case "$$(((64 + $$(stat -L -c%s Packages)) % 128))" in 110|111) \ + $(call ERROR_MESSAGE,WARNING: Applying padding in $$d/Packages to workaround usign SHA-512 bug!); \ + { echo ""; echo ""; } >> Packages;; \ + esac; \ + gzip -9nc Packages > Packages.gz; \ ); done ifdef CONFIG_SIGNED_PACKAGES @echo Signing package index... diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 04a863a8c50e6f..fcc87bdeea1be0 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -12,11 +12,11 @@ include $(INCLUDE_DIR)/version.mk include $(INCLUDE_DIR)/feeds.mk PKG_NAME:=base-files -PKG_RELEASE:=194 +PKG_RELEASE:=199 PKG_FLAGS:=nonshared PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/ -PKG_BUILD_DEPENDS:=usign/host +PKG_BUILD_DEPENDS:=usign/host ucert/host PKG_LICENSE:=GPL-2.0 # Extend depends from version.mk @@ -49,6 +49,7 @@ define Package/base-files/conffiles /etc/config/system /etc/crontabs/ /etc/dropbear/ +/etc/ethers /etc/group /etc/hosts /etc/inittab @@ -102,6 +103,9 @@ ifdef CONFIG_SIGNED_PACKAGES [ -s $(BUILD_KEY) -a -s $(BUILD_KEY).pub ] || \ $(STAGING_DIR_HOST)/bin/usign -G -s $(BUILD_KEY) -p $(BUILD_KEY).pub -c "Local build key" + [ -s $(BUILD_KEY).ucert ] || \ + $(STAGING_DIR_HOST)/bin/ucert -I -c $(BUILD_KEY).ucert -p $(BUILD_KEY).pub -s $(BUILD_KEY) + endef define Package/base-files/install-key diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate index fa148685ccc6de..ea04d17d0b9a50 100755 --- a/package/base-files/files/bin/config_generate +++ b/package/base-files/files/bin/config_generate @@ -15,10 +15,14 @@ generate_static_network() { set network.loopback.proto='static' set network.loopback.ipaddr='127.0.0.1' set network.loopback.netmask='255.0.0.0' - delete network.globals - set network.globals='globals' - set network.globals.ula_prefix='auto' EOF + [ -e /proc/sys/net/ipv6 ] && { + uci -q batch <<-EOF + delete network.globals + set network.globals='globals' + set network.globals.ula_prefix='auto' + EOF + } if json_is_a dsl object; then json_select dsl @@ -102,21 +106,23 @@ generate_network() { set network.$1.proto='static' set network.$1.ipaddr='$ipad' set network.$1.netmask='$netm' - set network.$1.ip6assign='60' EOF + [ -e /proc/sys/net/ipv6 ] && uci set network.$1.ip6assign='60' ;; dhcp) # fixup IPv6 slave interface if parent is a bridge [ "$type" = "bridge" ] && ifname="br-$1" - uci -q batch <<-EOF - set network.$1.proto='dhcp' - delete network.${1}6 - set network.${1}6='interface' - set network.${1}6.ifname='$ifname' - set network.${1}6.proto='dhcpv6' - EOF + uci set network.$1.proto='dhcp' + [ -e /proc/sys/net/ipv6 ] && { + uci -q batch <<-EOF + delete network.${1}6 + set network.${1}6='interface' + set network.${1}6.ifname='$ifname' + set network.${1}6.proto='dhcpv6' + EOF + } ;; pppoe) @@ -124,12 +130,16 @@ generate_network() { set network.$1.proto='pppoe' set network.$1.username='username' set network.$1.password='password' - set network.$1.ipv6='1' - delete network.${1}6 - set network.${1}6='interface' - set network.${1}6.ifname='@${1}' - set network.${1}6.proto='dhcpv6' EOF + [ -e /proc/sys/net/ipv6 ] && { + uci -q batch <<-EOF + set network.$1.ipv6='1' + delete network.${1}6 + set network.${1}6='interface' + set network.${1}6.ifname='@${1}' + set network.${1}6.proto='dhcpv6' + EOF + } ;; esac } @@ -234,10 +244,10 @@ generate_static_system() { set system.ntp='timeserver' set system.ntp.enabled='1' set system.ntp.enable_server='0' - add_list system.ntp.server='0.openwrt.pool.ntp.org' - add_list system.ntp.server='1.openwrt.pool.ntp.org' - add_list system.ntp.server='2.openwrt.pool.ntp.org' - add_list system.ntp.server='3.openwrt.pool.ntp.org' + add_list system.ntp.server='ntp1.aliyun.com' + add_list system.ntp.server='time1.cloud.tencent.com' + add_list system.ntp.server='time.ustc.edu.cn' + add_list system.ntp.server='pool.ntp.org' EOF if json_is_a system object; then @@ -356,11 +366,12 @@ generate_led() { ;; switch) - local port_mask speed_mask - json_get_vars port_mask speed_mask + local port_mask speed_mask mode + json_get_vars port_mask speed_mask mode uci -q batch <<-EOF set system.$cfg.port_mask='$port_mask' set system.$cfg.speed_mask='$speed_mask' + set system.$cfg.mode='$mode' EOF ;; diff --git a/package/base-files/files/etc/diag.sh b/package/base-files/files/etc/diag.sh index 8726a4398bed53..8eb36c6feb17f0 100644 --- a/package/base-files/files/etc/diag.sh +++ b/package/base-files/files/etc/diag.sh @@ -1,4 +1,50 @@ #!/bin/sh -# Copyright (C) 2006-2009 OpenWrt.org +# Copyright (C) 2006-2019 OpenWrt.org -set_state() { :; } +. /lib/functions/leds.sh + +boot="$(get_dt_led boot)" +failsafe="$(get_dt_led failsafe)" +running="$(get_dt_led running)" +upgrade="$(get_dt_led upgrade)" + +set_led_state() { + status_led="$boot" + + case "$1" in + preinit) + status_led_blink_preinit + ;; + failsafe) + status_led_off + [ -n "$running" ] && { + status_led="$running" + status_led_off + } + status_led="$failsafe" + status_led_blink_failsafe + ;; + preinit_regular) + status_led_blink_preinit_regular + ;; + upgrade) + [ -n "$running" ] && { + status_led="$running" + status_led_off + } + status_led="$upgrade" + status_led_blink_preinit_regular + ;; + done) + status_led_off + [ -n "$running" ] && { + status_led="$running" + status_led_on + } + ;; + esac +} + +set_state() { + [ -n "$boot" -o -n "$failsafe" -o -n "$running" -o -n "$upgrade" ] && set_led_state "$1" +} diff --git a/package/base-files/files/etc/ethers b/package/base-files/files/etc/ethers new file mode 100644 index 00000000000000..b92c200a4bb5ea --- /dev/null +++ b/package/base-files/files/etc/ethers @@ -0,0 +1,6 @@ +# +# Lookup man 5 ethers for syntax documentation +# +# Examples : +# 02:00:11:22:33:44 OpenWrt.lan +# 02:00:11:22:33:44 192.168.1.1 diff --git a/package/base-files/files/etc/init.d/led b/package/base-files/files/etc/init.d/led index c790e3e181f5c9..932a69a82be5f0 100755 --- a/package/base-files/files/etc/init.d/led +++ b/package/base-files/files/etc/init.d/led @@ -20,7 +20,7 @@ load_led() { config_get trigger $1 trigger "none" config_get dev $1 dev config_get ports $1 port - config_get mode $1 mode "link" + config_get mode $1 mode config_get_bool default $1 default "nil" config_get delayon $1 delayon config_get delayoff $1 delayoff @@ -71,7 +71,10 @@ load_led() { "netdev") [ -n "$dev" ] && { echo $dev > /sys/class/leds/${sysfs}/device_name - echo $mode > /sys/class/leds/${sysfs}/mode + for m in $mode; do + [ -e "/sys/class/leds/${sysfs}/$m" ] && \ + echo 1 > /sys/class/leds/${sysfs}/$m + done echo $interval > /sys/class/leds/${sysfs}/interval } ;; @@ -110,6 +113,8 @@ load_led() { config_get speed_mask $1 speed_mask [ -n "$speed_mask" ] && \ echo $speed_mask > /sys/class/leds/${sysfs}/speed_mask + [ -n "$mode" ] && \ + echo "$mode" > /sys/class/leds/${sysfs}/mode ;; esac } diff --git a/package/base-files/files/etc/iproute2/ematch_map b/package/base-files/files/etc/iproute2/ematch_map new file mode 100644 index 00000000000000..4d6bb2f039789d --- /dev/null +++ b/package/base-files/files/etc/iproute2/ematch_map @@ -0,0 +1,8 @@ +# lookup table for ematch kinds +1 cmp +2 nbyte +3 u32 +4 meta +7 canid +8 ipset +9 ipt diff --git a/package/base-files/files/etc/profile b/package/base-files/files/etc/profile index e9936fb36a9a93..9a3ac069a20ecb 100644 --- a/package/base-files/files/etc/profile +++ b/package/base-files/files/etc/profile @@ -14,7 +14,11 @@ export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6) export HOME=${HOME:-/root} export PS1='\u@\h:\w\$ ' -[ "$TERM" = "xterm" ] && export PS1='\[\e]0;\u@\h: \w\a\]'$PS1 +case "$TERM" in + xterm*|rxvt*) + export PS1='\[\e]0;\u@\h: \w\a\]'$PS1 + ;; +esac [ -x /bin/more ] || alias more=less [ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi diff --git a/package/base-files/files/etc/rc.common b/package/base-files/files/etc/rc.common index 3e237170b4cb08..d9773a0c5aaec0 100755 --- a/package/base-files/files/etc/rc.common +++ b/package/base-files/files/etc/rc.common @@ -23,6 +23,7 @@ reload() { restart() { trap '' TERM stop "$@" + trap - TERM start "$@" } diff --git a/package/base-files/files/etc/services b/package/base-files/files/etc/services index 8ff914ecf25931..968f9e78be7917 100644 --- a/package/base-files/files/etc/services +++ b/package/base-files/files/etc/services @@ -29,8 +29,8 @@ kerberos 88/tcp kerberos5 krb5 kerberos-sec kerberos 88/udp kerberos5 krb5 kerberos-sec pop3 110/tcp pop3 110/udp -sunrpc 111/tcp -sunrpc 111/udp +sunrpc 111/tcp rpcbind +sunrpc 111/udp rpcbind auth 113/tcp ident sftp 115/tcp nntp 119/tcp diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh index 318e91856b451e..50a7b408698cbf 100755 --- a/package/base-files/files/lib/functions.sh +++ b/package/base-files/files/lib/functions.sh @@ -152,22 +152,27 @@ config_list_foreach() { default_prerm() { local root="${IPKG_INSTROOT}" - local name + local pkgname="$(basename ${1%.*})" + local ret=0 - name=$(basename ${1%.*}) - [ -f "$root/usr/lib/opkg/info/${name}.prerm-pkg" ] && . "$root/usr/lib/opkg/info/${name}.prerm-pkg" + if [ -f "$root/usr/lib/opkg/info/${pkgname}.prerm-pkg" ]; then + ( . "$root/usr/lib/opkg/info/${pkgname}.prerm-pkg" ) + ret=$? + fi local shell="$(which bash)" - for i in `cat "$root/usr/lib/opkg/info/${name}.list" | grep "^/etc/init.d/"`; do + for i in $(grep -s "^/etc/init.d/" "$root/usr/lib/opkg/info/${pkgname}.list"); do if [ -n "$root" ]; then ${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" disable else if [ "$PKG_UPGRADE" != "1" ]; then "$i" disable fi - "$i" stop || /bin/true + "$i" stop fi done + + return $ret } add_group_and_user() { @@ -229,10 +234,9 @@ default_postinst() { if [ -z "$root" ] && grep -q -s "^/etc/uci-defaults/" "/usr/lib/opkg/info/${pkgname}.list"; then . /lib/functions/system.sh [ -d /tmp/.uci ] || mkdir -p /tmp/.uci - for i in $(sed -ne 's!^/etc/uci-defaults/!!p' "/usr/lib/opkg/info/${pkgname}.list"); do ( - cd /etc/uci-defaults - [ -f "$i" ] && . ./"$i" && rm -f "$i" - ) done + for i in $(grep -s "^/etc/uci-defaults/" "/usr/lib/opkg/info/${pkgname}.list"); do + ( [ -f "$i" ] && cd "$(dirname $i)" && . "$i" ) && rm -f "$i" + done uci commit fi diff --git a/package/base-files/files/lib/functions/network.sh b/package/base-files/files/lib/functions/network.sh index d7fd2dea573087..4fdcb66302a1e6 100644 --- a/package/base-files/files/lib/functions/network.sh +++ b/package/base-files/files/lib/functions/network.sh @@ -271,6 +271,11 @@ network_is_up() # 2: interface network_get_protocol() { __network_ifstatus "$1" "$2" ".proto"; } +# determine the metric of the given logical interface +# 1: destination variable +# 2: interface +network_get_metric() { __network_ifstatus "$1" "$2" ".metric"; } + # determine the layer 3 linux network device of the given logical interface # 1: destination variable # 2: interface diff --git a/package/base-files/files/lib/functions/system.sh b/package/base-files/files/lib/functions/system.sh index d4402c3a148ae1..7ed62804a081fc 100644 --- a/package/base-files/files/lib/functions/system.sh +++ b/package/base-files/files/lib/functions/system.sh @@ -20,8 +20,7 @@ find_mtd_chardev() { echo "${INDEX:+$PREFIX$INDEX}" } -mtd_get_mac_ascii() -{ +mtd_get_mac_ascii() { local mtdname="$1" local key="$2" local part @@ -39,6 +38,29 @@ mtd_get_mac_ascii() [ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty" } +mtd_get_mac_text() { + local mtdname=$1 + local offset=$2 + local part + local mac_dirty + + part=$(find_mtd_part "$mtdname") + if [ -z "$part" ]; then + echo "mtd_get_mac_text: partition $mtdname not found!" >&2 + return + fi + + if [ -z "$offset" ]; then + echo "mtd_get_mac_text: offset missing!" >&2 + return + fi + + mac_dirty=$(dd if="$part" bs=1 skip="$offset" count=17 2>/dev/null) + + # "canonicalize" mac + [ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty" +} + mtd_get_mac_binary() { local mtdname="$1" local offset="$2" @@ -87,22 +109,19 @@ macaddr_add() { echo $oui:$nic } -macaddr_setbit_la() -{ +macaddr_setbit_la() { local mac=$1 printf "%02x:%s" $((0x${mac%%:*} | 0x02)) ${mac#*:} } -macaddr_2bin() -{ +macaddr_2bin() { local mac=$1 echo -ne \\x${mac//:/\\x} } -macaddr_canonicalize() -{ +macaddr_canonicalize() { local mac="$1" local canon="" diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh index 3126fe65101e33..315df7b70821f5 100755 --- a/package/base-files/files/lib/functions/uci-defaults.sh +++ b/package/base-files/files/lib/functions/uci-defaults.sh @@ -27,30 +27,33 @@ json_select_object() { json_select "$1" } -_ucidef_set_interface() { - local name="$1" - local iface="$2" - local proto="$3" +ucidef_set_interface() { + local network=$1; shift - json_select_object "$name" - json_add_string ifname "$iface" - - if ! json_is_a protocol string || [ -n "$proto" ]; then - case "$proto" in - static|dhcp|none|pppoe) : ;; - *) - case "$name" in - lan) proto="static" ;; - wan) proto="dhcp" ;; - *) proto="none" ;; - esac - ;; - esac + [ -z "$network" ] && return - json_add_string protocol "$proto" + json_select_object network + json_select_object "$network" + + while [ -n "$1" ]; do + local opt=$1; shift + local val=$1; shift + + [ -n "$opt" -a -n "$val" ] || break + + json_add_string "$opt" "$val" + done + + if ! json_is_a protocol string; then + case "$network" in + lan) json_add_string protocol static ;; + wan) json_add_string protocol dhcp ;; + *) json_add_string protocol none ;; + esac fi json_select .. + json_select .. } ucidef_set_board_id() { @@ -66,31 +69,19 @@ ucidef_set_model_name() { } ucidef_set_interface_lan() { - json_select_object network - _ucidef_set_interface lan "$@" - json_select .. + ucidef_set_interface "lan" ifname "$1" protocol "${2:-static}" } ucidef_set_interface_wan() { - json_select_object network - _ucidef_set_interface wan "$@" - json_select .. + ucidef_set_interface "wan" ifname "$1" protocol "${2:-dhcp}" } ucidef_set_interfaces_lan_wan() { local lan_if="$1" local wan_if="$2" - json_select_object network - _ucidef_set_interface lan "$lan_if" - _ucidef_set_interface wan "$wan_if" - json_select .. -} - -ucidef_set_interface_raw() { - json_select_object network - _ucidef_set_interface "$@" - json_select .. + ucidef_set_interface_lan "$lan_if" + ucidef_set_interface_wan "$wan_if" } _ucidef_add_switch_port() { @@ -185,9 +176,9 @@ _ucidef_finish_switch_roles() { devices="${devices:+$devices }$device" fi json_select .. - - _ucidef_set_interface "$role" "$devices" json_select .. + + ucidef_set_interface "$role" ifname "$devices" done } @@ -300,18 +291,7 @@ ucidef_set_interface_macaddr() { local network="$1" local macaddr="$2" - json_select_object network - - json_select "$network" - [ $? -eq 0 ] || { - json_select .. - return - } - - json_add_string macaddr "$macaddr" - json_select .. - - json_select .. + ucidef_set_interface "$network" macaddr "$macaddr" } ucidef_add_atm_bridge() { @@ -462,11 +442,13 @@ ucidef_set_led_switch() { local trigger_name="$4" local port_mask="$5" local speed_mask="$6" + local mode="$7" _ucidef_set_led_common "$1" "$2" "$3" json_add_string trigger "$trigger_name" json_add_string type switch + json_add_string mode "$mode" json_add_string port_mask "$port_mask" json_add_string speed_mask "$speed_mask" json_select .. diff --git a/package/base-files/files/lib/preinit/30_failsafe_wait b/package/base-files/files/lib/preinit/30_failsafe_wait index 9a34f2de4cb39a..dd9c7e2b59449b 100644 --- a/package/base-files/files/lib/preinit/30_failsafe_wait +++ b/package/base-files/files/lib/preinit/30_failsafe_wait @@ -82,7 +82,7 @@ fs_wait_for_key () { failsafe_wait() { FAILSAFE= - [ "$pi_preinit_no_failsafe" == "y" ] && { + [ "$pi_preinit_no_failsafe" = "y" ] && { fs_wait_for_key "" "" $fs_failsafe_wait_timeout return } diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index 38056fd346b1cf..f43c7db3c14be0 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -117,6 +117,24 @@ export_bootdevice() { esac case "$disk" in + PARTUUID=[A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9]-[A-F0-9][A-F0-9][A-F0-9][A-F0-9]-[A-F0-9][A-F0-9][A-F0-9][A-F0-9]-[A-F0-9][A-F0-9][A-F0-9][A-F0-9]-[A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9]0002) + uuid="${disk#PARTUUID=}" + uuid="${uuid%0002}0002" + for disk in $(find /dev -type b); do + set -- $(dd if=$disk bs=1 skip=$((2*512+256+128+16)) count=16 2>/dev/null | hexdump -v -e '4/1 "%02x"' | awk '{ \ + for(i=1;i<9;i=i+2) first=substr($0,i,1) substr($0,i+1,1) first; \ + for(i=9;i<13;i=i+2) second=substr($0,i,1) substr($0,i+1,1) second; \ + for(i=13;i<16;i=i+2) third=substr($0,i,1) substr($0,i+1,1) third; \ + fourth = substr($0,17,4); \ + five = substr($0,21,12); \ + } END { print toupper(first"-"second"-"third"-"fourth"-"five) }') + if [ "$1" = "$uuid" ]; then + uevent="/sys/class/block/${disk##*/}/uevent" + export SAVE_PARTITIONS=0 + break + fi + done + ;; PARTUUID=[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]-02) uuid="${disk#PARTUUID=}" uuid="${uuid%-02}" @@ -164,7 +182,7 @@ export_partdevice() { } hex_le32_to_cpu() { - [ "$(echo 01 | hexdump -v -n 2 -e '/2 "%x"')" == "3031" ] && { + [ "$(echo 01 | hexdump -v -n 2 -e '/2 "%x"')" = "3031" ] && { echo "${1:0:2}${1:8:2}${1:6:2}${1:4:2}${1:2:2}" return } @@ -211,6 +229,11 @@ jffs2_copy_config() { fi } +indicate_upgrade() { + . /etc/diag.sh + set_state upgrade +} + # Flash firmware to MTD partition # # $(1): path to image @@ -222,6 +245,7 @@ default_do_upgrade() { else get_image "$1" "$2" | mtd write - "${PART_NAME:-image}" fi + [ $? -ne 0 ] && exit 1 } do_upgrade_stage2() { diff --git a/package/base-files/files/lib/upgrade/fwtool.sh b/package/base-files/files/lib/upgrade/fwtool.sh index aa2ac79d137902..3f28fccd904dc0 100644 --- a/package/base-files/files/lib/upgrade/fwtool.sh +++ b/package/base-files/files/lib/upgrade/fwtool.sh @@ -1,3 +1,28 @@ +fwtool_check_signature() { + [ $# -gt 1 ] && return 1 + + [ ! -x /usr/bin/ucert ] && { + if [ "$REQUIRE_IMAGE_SIGNATURE" = 1 ]; then + return 1 + else + return 0 + fi + } + + if ! fwtool -q -t -s /tmp/sysupgrade.ucert "$1"; then + echo "Image signature not found" + [ "$REQUIRE_IMAGE_SIGNATURE" = 1 -a "$FORCE" != 1 ] && { + echo "Use sysupgrade -F to override this check when downgrading or flashing to vendor firmware" + } + [ "$REQUIRE_IMAGE_SIGNATURE" = 1 ] && return 1 + return 0 + fi + + ucert -V -m "$1" -c "/tmp/sysupgrade.ucert" -P /etc/opkg/keys + + return $? +} + fwtool_check_image() { [ $# -gt 1 ] && return 1 diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh index 42f488c118fab5..99916a4e96fc1c 100644 --- a/package/base-files/files/lib/upgrade/nand.sh +++ b/package/base-files/files/lib/upgrade/nand.sh @@ -10,6 +10,9 @@ CI_KERNPART="${CI_KERNPART:-kernel}" # 'ubi' partition on NAND contains UBI CI_UBIPART="${CI_UBIPART:-ubi}" +# 'rootfs' partition on NAND contains the rootfs +CI_ROOTPART="${CI_ROOTPART:-rootfs}" + ubi_mknod() { local dir="$1" local dev="/dev/$(basename $dir)" @@ -99,7 +102,7 @@ nand_restore_config() { local ubidev=$( nand_find_ubi $CI_UBIPART ) local ubivol="$( nand_find_volume $ubidev rootfs_data )" [ ! "$ubivol" ] && - ubivol="$( nand_find_volume $ubidev rootfs )" + ubivol="$( nand_find_volume $ubidev $CI_ROOTPART )" mkdir /tmp/new_root if ! mount -t ubifs /dev/$ubivol /tmp/new_root; then echo "mounting ubifs $ubivol failed" @@ -143,7 +146,7 @@ nand_upgrade_prepare_ubi() { fi local kern_ubivol="$( nand_find_volume $ubidev $CI_KERNPART )" - local root_ubivol="$( nand_find_volume $ubidev rootfs )" + local root_ubivol="$( nand_find_volume $ubidev $CI_ROOTPART )" local data_ubivol="$( nand_find_volume $ubidev rootfs_data )" # remove ubiblock device of rootfs @@ -158,7 +161,7 @@ nand_upgrade_prepare_ubi() { # kill volumes [ "$kern_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_KERNPART || true - [ "$root_ubivol" ] && ubirmvol /dev/$ubidev -N rootfs || true + [ "$root_ubivol" ] && ubirmvol /dev/$ubidev -N $CI_ROOTPART || true [ "$data_ubivol" ] && ubirmvol /dev/$ubidev -N rootfs_data || true # update kernel @@ -176,7 +179,7 @@ nand_upgrade_prepare_ubi() { else root_size_param="-s $rootfs_length" fi - if ! ubimkvol /dev/$ubidev -N rootfs $root_size_param; then + if ! ubimkvol /dev/$ubidev -N $CI_ROOTPART $root_size_param; then echo "cannot create rootfs volume" return 1; fi @@ -233,7 +236,7 @@ nand_upgrade_ubifs() { nand_upgrade_prepare_ubi "$rootfs_length" "ubifs" "0" "0" local ubidev="$( nand_find_ubi "$CI_UBIPART" )" - local root_ubivol="$(nand_find_volume $ubidev rootfs)" + local root_ubivol="$(nand_find_volume $ubidev $CI_ROOTPART)" ubiupdatevol /dev/$root_ubivol -s $rootfs_length $1 nand_do_upgrade_success @@ -268,7 +271,7 @@ nand_upgrade_tar() { ubiupdatevol /dev/$kern_ubivol -s $kernel_length - } - local root_ubivol="$(nand_find_volume $ubidev rootfs)" + local root_ubivol="$(nand_find_volume $ubidev $CI_ROOTPART)" tar xf $tar_file ${board_dir}/root -O | \ ubiupdatevol /dev/$root_ubivol -s $rootfs_length - diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2 index 3985d8fd7eca9d..bdc12c742609e1 100755 --- a/package/base-files/files/lib/upgrade/stage2 +++ b/package/base-files/files/lib/upgrade/stage2 @@ -122,6 +122,7 @@ kill_remaining() { # [ [ ] ] echo } +indicate_upgrade killall -9 telnetd killall -9 dropbear diff --git a/package/base-files/files/sbin/hotplug-call b/package/base-files/files/sbin/hotplug-call index 28e957c3982ae0..829fdbd75b4ed2 100755 --- a/package/base-files/files/sbin/hotplug-call +++ b/package/base-files/files/sbin/hotplug-call @@ -11,8 +11,8 @@ USER=root export PATH LOGNAME USER export DEVICENAME="${DEVPATH##*/}" -[ \! -z "$1" -a -d /etc/hotplug.d/$1 ] && { +if [ \! -z "$1" -a -d /etc/hotplug.d/$1 ]; then for script in $(ls /etc/hotplug.d/$1/* 2>&-); do ( [ -f $script ] && . $script ); done -} +fi \ No newline at end of file diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade index a378b029500ac5..3a5087a0c898fe 100755 --- a/package/base-files/files/sbin/sysupgrade +++ b/package/base-files/files/sbin/sysupgrade @@ -9,7 +9,10 @@ export INTERACTIVE=0 export VERBOSE=1 export SAVE_CONFIG=1 export SAVE_OVERLAY=0 +export SAVE_OVERLAY_PATH= export SAVE_PARTITIONS=1 +export SAVE_INSTALLED_PKGS=0 +export SKIP_UNCHANGED=0 export CONF_IMAGE= export CONF_BACKUP_LIST=0 export CONF_BACKUP= @@ -18,6 +21,7 @@ export NEED_IMAGE= export HELP=0 export FORCE=0 export TEST=0 +export UMOUNT_ETCBACKUP_DIR=0 # parse options while [ -n "$1" ]; do @@ -26,17 +30,20 @@ while [ -n "$1" ]; do -v) export VERBOSE="$(($VERBOSE + 1))";; -q) export VERBOSE="$(($VERBOSE - 1))";; -n) export SAVE_CONFIG=0;; - -c) export SAVE_OVERLAY=1;; + -c) export SAVE_OVERLAY=1 SAVE_OVERLAY_PATH=/etc;; + -o) export SAVE_OVERLAY=1 SAVE_OVERLAY_PATH=/;; -p) export SAVE_PARTITIONS=0;; + -k) export SAVE_INSTALLED_PKGS=1;; + -u) export SKIP_UNCHANGED=1;; -b|--create-backup) export CONF_BACKUP="$2" NEED_IMAGE=1; shift;; -r|--restore-backup) export CONF_RESTORE="$2" NEED_IMAGE=1; shift;; - -l|--list-backup) export CONF_BACKUP_LIST=1; break;; + -l|--list-backup) export CONF_BACKUP_LIST=1;; -f) export CONF_IMAGE="$2"; shift;; -F|--force) export FORCE=1;; -T|--test) export TEST=1;; -h|--help) export HELP=1; break;; -*) - echo "Invalid option: $1" + echo "Invalid option: $1" >&2 exit 1 ;; *) break;; @@ -46,20 +53,27 @@ done export CONFFILES=/tmp/sysupgrade.conffiles export CONF_TAR=/tmp/sysupgrade.tgz +export ETCBACKUP_DIR=/etc/backup +export INSTALLED_PACKAGES=${ETCBACKUP_DIR}/installed_packages.txt IMAGE="$1" -[ -z "$IMAGE" -a -z "$NEED_IMAGE" -o $HELP -gt 0 ] && { +[ -z "$IMAGE" -a -z "$NEED_IMAGE" -a $CONF_BACKUP_LIST -eq 0 -o $HELP -gt 0 ] && { cat <...] - $0 [-q] [-i] + $0 [-q] [-i] [-c] [-u] [-o] [-k] upgrade-option: -f restore configuration from .tar.gz (file or url) -i interactive mode -c attempt to preserve all changed files in /etc/ + -o attempt to preserve all changed files in /, except those + from packages but including changed confs. + -u skip from backup files that are equal to those in /rom -n do not save configuration over reflash -p do not attempt to restore the partition table after flash. + -k include in backup a list of current installed packages at + $INSTALLED_PACKAGES -T | --test Verify image and config .tar.gz but do not actually flash. -F | --force @@ -115,46 +129,96 @@ list_changed_conffiles() { done } -add_uci_conffiles() { +add_conffiles() { local file="$1" ( find $(sed -ne '/^[[:space:]]*$/d; /^#/d; p' \ /etc/sysupgrade.conf /lib/upgrade/keep.d/* 2>/dev/null) \ - -type f -o -type l 2>/dev/null; + \( -type f -o -type l \) $find_filter 2>/dev/null; list_changed_conffiles ) | sort -u > "$file" return 0 } add_overlayfiles() { local file="$1" - find /overlay/upper/etc/ -type f -o -type l | sed \ - -e 's,^/overlay\/upper/,/,' \ - -e '\,/META_[a-zA-Z0-9]*$,d' \ - -e '\,/functions.sh$,d' \ + + local packagesfiles=$1.packagesfiles + touch "$packagesfiles" + + if [ "$SAVE_OVERLAY_PATH" = / ]; then + local conffiles=$1.conffiles + local keepfiles=$1.keepfiles + + list_conffiles | cut -f2 -d ' ' | sort -u > "$conffiles" + + # backup files from /etc/sysupgrade.conf and /lib/upgrade/keep.d, but + # ignore those aready controlled by opkg conffiles + find $(sed -ne '/^[[:space:]]*$/d; /^#/d; p' \ + /etc/sysupgrade.conf /lib/upgrade/keep.d/* 2>/dev/null) \ + \( -type f -o -type l \) 2>/dev/null | sort -u | + grep -h -v -x -F -f $conffiles > "$keepfiles" + + # backup conffiles, but only those changed if '-u' + [ $SKIP_UNCHANGED = 1 ] && + list_changed_conffiles | sort -u > "$conffiles" + + # do not backup files from packages, except those listed + # in conffiles and keep.d + { + find /usr/lib/opkg/info -type f -name "*.list" -exec cat {} \; + find /usr/lib/opkg/info -type f -name "*.control" -exec sed \ + -ne '/^Alternatives/{s/^Alternatives: //;s/, /\n/g;p}' {} \; | + cut -f2 -d: + } | grep -v -x -F -f $conffiles | + grep -v -x -F -f $keepfiles | sort -u > "$packagesfiles" + rm -f "$keepfiles" "$conffiles" + fi + + # busybox grep bug when file is empty + [ -s "$packagesfiles" ] || echo > $packagesfiles + + ( cd /overlay/upper/; find .$SAVE_OVERLAY_PATH \( -type f -o -type l \) $find_filter | sed \ + -e 's,^\.,,' \ + -e '\,^/etc/board.json$,d' \ -e '\,/[^/]*-opkg$,d' \ - > "$file" + -e '\,^/etc/urandom.seed$,d' \ + -e "\,^$INSTALLED_PACKAGES$,d" \ + -e '\,^/usr/lib/opkg/.*,d' \ + ) | grep -v -x -F -f $packagesfiles > "$file" + + rm -f "$packagesfiles" + return 0 } # hooks -sysupgrade_image_check="fwtool_check_image platform_check_image" +sysupgrade_image_check="fwtool_check_signature fwtool_check_image platform_check_image" if [ $SAVE_OVERLAY = 1 ]; then [ ! -d /overlay/upper/etc ] && { - echo "Cannot find '/overlay/upper/etc', required for '-c'" + echo "Cannot find '/overlay/upper/etc', required for '-c'" >&2 exit 1 } sysupgrade_init_conffiles="add_overlayfiles" else - sysupgrade_init_conffiles="add_uci_conffiles" + sysupgrade_init_conffiles="add_conffiles" +fi + +find_filter="" +if [ $SKIP_UNCHANGED = 1 ]; then + [ ! -d /rom/ ] && { + echo "'/rom/' is required by '-u'" + exit 1 + } + find_filter='( ( -exec test -e /rom/{} ; -exec cmp -s /{} /rom/{} ; ) -o -print )' fi include /lib/upgrade do_save_conffiles() { - local conf_tar="${1:-$CONF_TAR}" + local conf_tar="$1" [ -z "$(rootfs_type)" ] && { - echo "Cannot save config while running from ramdisk." + echo "Cannot save config while running from ramdisk." >&2 ask_bool 0 "Abort" && exit rm -f "$conf_tar" return 0 @@ -162,15 +226,46 @@ do_save_conffiles() { run_hooks "$CONFFILES" $sysupgrade_init_conffiles ask_bool 0 "Edit config file list" && vi "$CONFFILES" + if [ "$SAVE_INSTALLED_PKGS" -eq 1 ]; then + echo "${INSTALLED_PACKAGES}" >> "$CONFFILES" + mkdir -p "$ETCBACKUP_DIR" + # Avoid touching filesystem on each backup + RAMFS="$(mktemp -d -t sysupgrade.XXXXXX)" + mkdir -p "$RAMFS/upper" "$RAMFS/work" + mount -t overlay overlay -o lowerdir=$ETCBACKUP_DIR,upperdir=$RAMFS/upper,workdir=$RAMFS/work $ETCBACKUP_DIR && + UMOUNT_ETCBACKUP_DIR=1 || { + echo "Cannot mount '$ETCBACKUP_DIR' as tmpfs to avoid touching disk while saving the list of installed packages." >&2 + ask_bool 0 "Abort" && exit + } + + # Format: pkg-name{rom,overlay,unkown} + # rom is used for pkgs in /rom, even if updated later + find /usr/lib/opkg/info -name "*.control" \( \ + \( -exec test -f /rom/{} \; -exec echo {} rom \; \) -o \ + \( -exec test -f /overlay/upper/{} \; -exec echo {} overlay \; \) -o \ + \( -exec echo {} unknown \; \) \ + \) | sed -e 's,.*/,,;s/\.control /\t/' > ${INSTALLED_PACKAGES} + fi + v "Saving config files..." [ "$VERBOSE" -gt 1 ] && TAR_V="v" || TAR_V="" - tar c${TAR_V}zf "$conf_tar" -T "$CONFFILES" 2>/dev/null + tar c${TAR_V}zpf "$conf_tar" -T "$CONFFILES" 2>/dev/null + if [ "$?" -ne 0 ]; then + echo "Failed to create the configuration backup." + rm -f "$conf_tar" + exit 1 + fi + [ "$UMOUNT_ETCBACKUP_DIR" -eq 1 ] && { + umount "$ETCBACKUP_DIR" + rm -rf "$RAMFS" + } rm -f "$CONFFILES" } if [ $CONF_BACKUP_LIST -eq 1 ]; then run_hooks "$CONFFILES" $sysupgrade_init_conffiles + [ "$SAVE_INSTALLED_PKGS" -eq 1 ] && echo ${INSTALLED_PACKAGES} >> "$CONFFILES" cat "$CONFFILES" rm -f "$CONFFILES" exit 0 @@ -183,7 +278,7 @@ fi if [ -n "$CONF_RESTORE" ]; then if [ "$CONF_RESTORE" != "-" ] && [ ! -f "$CONF_RESTORE" ]; then - echo "Backup archive '$CONF_RESTORE' not found." + echo "Backup archive '$CONF_RESTORE' not found." >&2 exit 1 fi @@ -193,12 +288,13 @@ if [ -n "$CONF_RESTORE" ]; then fi type platform_check_image >/dev/null 2>/dev/null || { - echo "Firmware upgrade is not implemented for this platform." + echo "Firmware upgrade is not implemented for this platform." >&2 exit 1 } case "$IMAGE" in - http://*) + http://*|\ + https://*) wget -O/tmp/sysupgrade.img "$IMAGE" IMAGE=/tmp/sysupgrade.img ;; @@ -208,7 +304,7 @@ IMAGE="$(readlink -f "$IMAGE")" case "$IMAGE" in '') - echo "Image file not found." + echo "Image file not found." >&2 exit 1 ;; /tmp/*) ;; @@ -225,10 +321,10 @@ export ARGC=1 for check in $sysupgrade_image_check; do ( $check "$IMAGE" ) || { if [ $FORCE -eq 1 ]; then - echo "Image check '$check' failed but --force given - will update anyway!" + echo "Image check '$check' failed but --force given - will update anyway!" >&2 break else - echo "Image check '$check' failed." + echo "Image check '$check' failed." >&2 exit 1 fi } @@ -239,14 +335,14 @@ if [ -n "$CONF_IMAGE" ]; then # .gz files 1f8b) ;; *) - echo "Invalid config file. Please use only .tar.gz files" + echo "Invalid config file. Please use only .tar.gz files" >&2 exit 1 ;; esac get_image "$CONF_IMAGE" "cat" > "$CONF_TAR" export SAVE_CONFIG=1 elif ask_bool $SAVE_CONFIG "Keep config files over reflash"; then - [ $TEST -eq 1 ] || do_save_conffiles + [ $TEST -eq 1 ] || do_save_conffiles "$CONF_TAR" export SAVE_CONFIG=1 else [ $TEST -eq 1 ] || rm -f "$CONF_TAR" diff --git a/package/base-files/files/sbin/wifi b/package/base-files/files/sbin/wifi index 3738caa86cf5db..261d2fb500b9f4 100755 --- a/package/base-files/files/sbin/wifi +++ b/package/base-files/files/sbin/wifi @@ -6,7 +6,7 @@ usage() { cat <&2 + echo "$device($iftype): Interface type not supported" fi ); done } @@ -130,6 +130,10 @@ wifi_updown() { scan_wifi cmd=up } + [ reconf = "$1" ] && { + scan_wifi + cmd=reconf + } ubus_wifi_cmd "$cmd" "$2" _wifi_updown "$@" } @@ -241,5 +245,7 @@ case "$1" in reload) wifi_reload "$2";; reload_legacy) wifi_reload_legacy "$2";; --help|help) usage;; - *) ubus call network reload; wifi_updown "enable" "$2";; + reconf) ubus call network reload; wifi_updown "reconf" "$2";; + ''|up) ubus call network reload; wifi_updown "enable" "$2";; + *) usage; exit 1;; esac diff --git a/package/base-files/files/usr/lib/os-release b/package/base-files/files/usr/lib/os-release index 82ade5940639bb..c39913d54fd3e1 100644 --- a/package/base-files/files/usr/lib/os-release +++ b/package/base-files/files/usr/lib/os-release @@ -4,15 +4,15 @@ ID="%d" ID_LIKE="lede openwrt" PRETTY_NAME="%D %V" VERSION_ID="%v" -HOME_URL="%m" +HOME_URL="%u" BUG_URL="%b" SUPPORT_URL="%s" BUILD_ID="%R" -LEDE_BOARD="%S" -LEDE_ARCH="%A" -LEDE_TAINTS="%t" -LEDE_DEVICE_MANUFACTURER="%M" -LEDE_DEVICE_MANUFACTURER_URL="%m" -LEDE_DEVICE_PRODUCT="%P" -LEDE_DEVICE_REVISION="%h" -LEDE_RELEASE="%D %V %C" +OPENWRT_BOARD="%S" +OPENWRT_ARCH="%A" +OPENWRT_TAINTS="%t" +OPENWRT_DEVICE_MANUFACTURER="%M" +OPENWRT_DEVICE_MANUFACTURER_URL="%m" +OPENWRT_DEVICE_PRODUCT="%P" +OPENWRT_DEVICE_REVISION="%h" +OPENWRT_RELEASE="%D %V %C" diff --git a/package/base-files/files/usr/libexec/login.sh b/package/base-files/files/usr/libexec/login.sh index 3c8bb509c02860..1fff39c6a069e4 100755 --- a/package/base-files/files/usr/libexec/login.sh +++ b/package/base-files/files/usr/libexec/login.sh @@ -1,5 +1,5 @@ #!/bin/sh -[ "$(uci -q get system.@system[0].ttylogin)" == 1 ] || exec /bin/ash --login +[ "$(uci -q get system.@system[0].ttylogin)" = 1 ] || exec /bin/ash --login exec /bin/login diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index 4ea8d55f75b45f..3432db525a14c4 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -183,7 +183,7 @@ if VERSIONOPT config VERSION_REPO string prompt "Release repository" - default "http://downloads.openwrt.org/releases/18.06.1" + default "http://downloads.openwrt.org/snapshots" help This is the repository address embedded in the image, it defaults to the trunk snapshot repo; the url may contain the following placeholders: @@ -202,6 +202,12 @@ if VERSIONOPT %P .. Product name or "Generic" %h .. Hardware revision or "v0" + config VERSION_HOME_URL + string + prompt "Release Homepage" + help + This is the release version homepage + config VERSION_MANUFACTURER string prompt "Manufacturer name" @@ -253,7 +259,7 @@ if VERSIONOPT config VERSION_CODE_FILENAMES bool prompt "Revision code in filenames" - default n + default y help Enable this to include the revision identifier or the configured version code into the firmware image, SDK- and Image Builder archive diff --git a/package/boot/apex/Makefile b/package/boot/apex/Makefile deleted file mode 100644 index d90df8e58c8633..00000000000000 --- a/package/boot/apex/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# -# Copyright (C) 2006-2011 OpenWrt.org -# -# 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:=apex -PKG_VERSION:=1.6.9 -PKG_RELEASE:=1 - -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=http://downloads.openwrt.org/sources/ -PKG_HASH:=1d2bc04c2c6bb3d2d6c1916b6dc559cda2b1ecb045d7801fd49af6af4234abeb -PKG_TARGETS:=bin - -include $(INCLUDE_DIR)/package.mk - -export GCC_HONOUR_COPTS=s - -define Package/apex - SECTION:=boot - CATEGORY:=Boot Loaders - DEPENDS:=@TARGET_ixp4xx - DEFAULT:=y - TITLE:=Boot loader for NSLU2, FSG3, NAS100D and others - URL:=http://wiki.buici.com/wiki/Apex_Bootloader -endef - -define build_apex - $(MAKE) -C $(PKG_BUILD_DIR) \ - ARCH=arm \ - $(1)_config - $(MAKE) -C $(PKG_BUILD_DIR) \ - $(TARGET_CONFIGURE_OPTS) \ - KBUILD_HAVE_NLS=no \ - ARCH=arm \ - clean all - $(INSTALL_BIN) $(PKG_BUILD_DIR)/apex.bin $(PKG_BUILD_DIR)/out/apex-$(2).bin -endef - -define Build/Compile - $(INSTALL_DIR) $(PKG_BUILD_DIR)/out - $(call build_apex,slugos-nslu2-armeb,nslu2-armeb) - $(call build_apex,slugos-nslu2-16mb-armeb,nslu2-16mb-armeb) - $(call build_apex,slugos-fsg3-armeb,fsg3-armeb) - $(call build_apex,slugos-nas100d-armeb,nas100d-armeb) -endef - -define Package/apex/install - $(INSTALL_DIR) $(STAGING_DIR)/apex - $(CP) $(PKG_BUILD_DIR)/out/*.bin $(1)/ -endef - -define Build/InstallDev - $(INSTALL_DIR) $(STAGING_DIR_IMAGE) - $(CP) $(PKG_BUILD_DIR)/out/*.bin $(STAGING_DIR_IMAGE)/ -endef - -$(eval $(call BuildPackage,apex)) diff --git a/package/boot/apex/patches/001-compile_fix.patch b/package/boot/apex/patches/001-compile_fix.patch deleted file mode 100644 index 8a25de65709310..00000000000000 --- a/package/boot/apex/patches/001-compile_fix.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/Makefile -+++ b/Makefile -@@ -444,7 +444,7 @@ ifeq ($(config-targets),1) - include $(srctree)/src/arch-$(SRCARCH)/Makefile - export KBUILD_DEFCONFIG - --config %config: scripts_basic outputmakefile FORCE -+%config: scripts_basic outputmakefile FORCE - $(Q)mkdir -p include/linux include/config - $(Q)$(MAKE) $(build)=scripts/kconfig $@ - -@@ -1585,7 +1585,7 @@ endif - $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) - - # Modules --/ %/: prepare scripts FORCE -+%/: prepare scripts FORCE - $(cmd_crmodverdir) - $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ - $(build)=$(build-dir) diff --git a/package/boot/apex/patches/100-openwrt_nslu2_armeb_config.patch b/package/boot/apex/patches/100-openwrt_nslu2_armeb_config.patch deleted file mode 100644 index d598ff32879241..00000000000000 --- a/package/boot/apex/patches/100-openwrt_nslu2_armeb_config.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/src/mach-ixp42x/slugos-nslu2-armeb_config -+++ b/src/mach-ixp42x/slugos-nslu2-armeb_config -@@ -19,7 +19,7 @@ CONFIG_EXPERIMENTAL=y - # - # General Setup - # --CONFIG_TARGET_DESCRIPTION="SlugOS NSLU2 (bigendian)" -+CONFIG_TARGET_DESCRIPTION="OpenWrt NSLU2 (8MiB Flash)" - CONFIG_CROSS_COMPILE="" - CONFIG_AEABI=y - # CONFIG_DRIVER_LONG_LONG_SIZE is not set -@@ -163,9 +163,9 @@ CONFIG_ENV_REGION_KERNEL_ALT="fis://kern - # Overrides - # - CONFIG_ENV_DEFAULT_CMDLINE_OVERRIDE=y --CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/mtdblock4 rootfstype=jffs2 console=ttyS0,115200 init=/linuxrc" -+CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/mtdblock4 rootfstype=squashfs,jffs2 console=ttyS0,115200 init=/etc/preinit noinitrd" - CONFIG_ENV_DEFAULT_CMDLINE_ALT_P=y --CONFIG_ENV_DEFAULT_CMDLINE_ALT="root=/dev/mtdblock4 rootfstype=jffs2 console=ttyS0,115200 init=/linuxrc" -+CONFIG_ENV_DEFAULT_CMDLINE_ALT="root=/dev/mtdblock4 rootfstype=squashfs,jffs2 console=ttyS0,115200 init=/etc/preinit noinitrd" - # CONFIG_ENV_DEFAULT_STARTUP_OVERRIDE is not set - # CONFIG_ENV_DEFAULT_STARTUP_ALT_P is not set - CONFIG_USES_NOR_BOOTFLASH=y diff --git a/package/boot/apex/patches/120-openwrt_nslu2_16mb_armeb_config.patch b/package/boot/apex/patches/120-openwrt_nslu2_16mb_armeb_config.patch deleted file mode 100644 index 5e7ecee27cd65e..00000000000000 --- a/package/boot/apex/patches/120-openwrt_nslu2_16mb_armeb_config.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/src/mach-ixp42x/slugos-nslu2-16mb-armeb_config -+++ b/src/mach-ixp42x/slugos-nslu2-16mb-armeb_config -@@ -19,7 +19,7 @@ CONFIG_EXPERIMENTAL=y - # - # General Setup - # --CONFIG_TARGET_DESCRIPTION="SlugOS NSLU2/BE (16MiB Flash)" -+CONFIG_TARGET_DESCRIPTION="OpenWrt NSLU2 (16MiB Flash)" - CONFIG_CROSS_COMPILE="" - CONFIG_AEABI=y - # CONFIG_DRIVER_LONG_LONG_SIZE is not set -@@ -163,9 +163,9 @@ CONFIG_ENV_REGION_KERNEL_ALT="fis://kern - # Overrides - # - CONFIG_ENV_DEFAULT_CMDLINE_OVERRIDE=y --CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/mtdblock4 rootfstype=jffs2 console=ttyS0,115200 init=/linuxrc" -+CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/mtdblock4 rootfstype=squashfs,jffs2 console=ttyS0,115200 init=/etc/preinit noinitrd" - CONFIG_ENV_DEFAULT_CMDLINE_ALT_P=y --CONFIG_ENV_DEFAULT_CMDLINE_ALT="root=/dev/mtdblock4 rootfstype=jffs2 console=ttyS0,115200 init=/linuxrc" -+CONFIG_ENV_DEFAULT_CMDLINE_ALT="root=/dev/mtdblock4 rootfstype=squashfs,jffs2 console=ttyS0,115200 init=/etc/preinit noinitrd" - # CONFIG_ENV_DEFAULT_STARTUP_OVERRIDE is not set - # CONFIG_ENV_DEFAULT_STARTUP_ALT_P is not set - CONFIG_USES_NOR_BOOTFLASH=y diff --git a/package/boot/apex/patches/140-openwrt_fsg3_armeb_config.patch b/package/boot/apex/patches/140-openwrt_fsg3_armeb_config.patch deleted file mode 100644 index fc0e8b9f3d1de6..00000000000000 --- a/package/boot/apex/patches/140-openwrt_fsg3_armeb_config.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/src/mach-ixp42x/slugos-fsg3-armeb_config -+++ b/src/mach-ixp42x/slugos-fsg3-armeb_config -@@ -17,7 +17,7 @@ CONFIG_EXPERIMENTAL=y - # - # General Setup - # --CONFIG_TARGET_DESCRIPTION="SlugOS FSG3/BE" -+CONFIG_TARGET_DESCRIPTION="OpenWrt FSG3" - CONFIG_CROSS_COMPILE="" - CONFIG_AEABI=y - CONFIG_CC_OPTIMIZE_FOR_SIZE=y -@@ -148,9 +148,9 @@ CONFIG_ENV_REGION_KERNEL_ALT="fis://kern - # Overrides - # - CONFIG_ENV_DEFAULT_CMDLINE_OVERRIDE=y --CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/sda1 rootdelay=10 console=ttyS0,115200" -+CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/sda1 rootdelay=10 console=ttyS0,115200 init=/etc/preinit noinitrd" - CONFIG_ENV_DEFAULT_CMDLINE_ALT_P=y --CONFIG_ENV_DEFAULT_CMDLINE_ALT="root=/dev/sda2 rootdelay=10 console=ttyS0,115200" -+CONFIG_ENV_DEFAULT_CMDLINE_ALT="root=/dev/mtdblock2 rootfstype=squashfs console=ttyS0,115200 init=/etc/preinit noinitrd" - # CONFIG_ENV_DEFAULT_STARTUP_OVERRIDE is not set - # CONFIG_ENV_DEFAULT_STARTUP_ALT_P is not set - CONFIG_USES_NOR_BOOTFLASH=y diff --git a/package/boot/apex/patches/150-limit_ram_to_64mb.patch b/package/boot/apex/patches/150-limit_ram_to_64mb.patch deleted file mode 100644 index 3e178166e172df..00000000000000 --- a/package/boot/apex/patches/150-limit_ram_to_64mb.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/src/mach-ixp42x/slugos-nslu2-armeb_config -+++ b/src/mach-ixp42x/slugos-nslu2-armeb_config -@@ -137,7 +137,7 @@ CONFIG_AUTOBOOT_DELAY=10 - CONFIG_ENV_STARTUP_KERNEL_COPY=y - # CONFIG_ENV_REGION_KERNEL_SWAP is not set - CONFIG_ENV_STARTUP_PREFIX_P=y --CONFIG_ENV_STARTUP_PREFIX="sdram-init; memscan -u 0+256m" -+CONFIG_ENV_STARTUP_PREFIX="sdram-init; memscan -u 0+64m" - - # - # Regions ---- a/src/mach-ixp42x/slugos-nslu2-16mb-armeb_config -+++ b/src/mach-ixp42x/slugos-nslu2-16mb-armeb_config -@@ -137,7 +137,7 @@ CONFIG_AUTOBOOT_DELAY=10 - CONFIG_ENV_STARTUP_KERNEL_COPY=y - # CONFIG_ENV_REGION_KERNEL_SWAP is not set - CONFIG_ENV_STARTUP_PREFIX_P=y --CONFIG_ENV_STARTUP_PREFIX="sdram-init; memscan -u 0+256m" -+CONFIG_ENV_STARTUP_PREFIX="sdram-init; memscan -u 0+64m" - - # - # Regions diff --git a/package/boot/apex/patches/160-openwrt_nas100d_armeb_config.patch b/package/boot/apex/patches/160-openwrt_nas100d_armeb_config.patch deleted file mode 100644 index e190964857062f..00000000000000 --- a/package/boot/apex/patches/160-openwrt_nas100d_armeb_config.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/src/mach-ixp42x/slugos-nas100d-armeb_config -+++ b/src/mach-ixp42x/slugos-nas100d-armeb_config -@@ -19,7 +19,7 @@ CONFIG_EXPERIMENTAL=y - # - # General Setup - # --CONFIG_TARGET_DESCRIPTION="SlugOS NAS100D/BE" -+CONFIG_TARGET_DESCRIPTION="OpenWrt NAS100D" - CONFIG_CROSS_COMPILE="" - CONFIG_AEABI=y - # CONFIG_DRIVER_LONG_LONG_SIZE is not set -@@ -158,7 +158,7 @@ CONFIG_ENV_REGION_KERNEL="fis://kernel" - # Overrides - # - CONFIG_ENV_DEFAULT_CMDLINE_OVERRIDE=y --CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/mtdblock2 rootfstype=jffs2 console=ttyS0,115200 init=/linuxrc" -+CONFIG_ENV_DEFAULT_CMDLINE="root=/dev/mtdblock2 rootfstype=squashfs,jffs2 console=ttyS0,115200 init=/etc/preinit noinitrd" - # CONFIG_ENV_DEFAULT_STARTUP_OVERRIDE is not set - CONFIG_USES_NOR_BOOTFLASH=y - CONFIG_RELOCATE_SIMPLE=y diff --git a/package/boot/arm-trusted-firmware-mvebu/Makefile b/package/boot/arm-trusted-firmware-mvebu/Makefile new file mode 100644 index 00000000000000..a2b34555a66dca --- /dev/null +++ b/package/boot/arm-trusted-firmware-mvebu/Makefile @@ -0,0 +1,112 @@ +# +# Copyright (C) 2019 Sartura Ltd. +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=arm-trusted-firmware-mvebu +PKG_VERSION:=2.2 +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE:=$(PKG_NAME)-$(PKG_RELEASE).tar.xz +PKG_SOURCE_URL:=https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git +PKG_SOURCE_DATE:=2019-10-22 +PKG_SOURCE_VERSION:=a04808c16cfc126d9fe572ae7c4b5a3d39de5796 +PKG_MIRROR_HASH:=ff93aad67227ca96db54e92288f61b4ff3abbaad291fc88ad95c29cd3dd3588c + +PKG_MAINTAINER:=Vladimir Vid + +include $(INCLUDE_DIR)/package.mk + +define Package/arm-trusted-firmware-mvebu + SECTION:=boot + CATEGORY:=Boot Loaders + TITLE:=ARM Trusted Firmware for mvebu devices +endef + +define Package/arm-trusted-firmware-mvebu/uDPU +$(call Package/arm-trusted-firmware-mvebu) + BOARDNAME:=uDPU + TITLE:=ARM Trusted Firmware for Methode uDPU + DEPENDS:=+u-boot-uDPU + UBOOT:=uDPU + CLOCKSPRESET:=CPU_1000_DDR_800 + PLAT:=a3700 +endef + +A3700_UTILS_NAME:=a3700-utils +A3700_UTILS_RELEASE:=18.12.1 +A3700_UTILS_SOURCE=$(A3700_UTILS_NAME)-$(A3700_UTILS_RELEASE).tar.bz2 + +define Download/a3700-utils + FILE:=$(A3700_UTILS_SOURCE) + PROTO:=git + URL:=https://github.com/MarvellEmbeddedProcessors/A3700-utils-marvell.git + VERSION:=e6bb176fb9936d9160e53ae09275000dc6440686 + MIRROR_HASH:=c3edf71cbf1fc2e5482d36e36a34c79d682d2c87fdfb909b4dc6327a171e7bd4 + SUBDIR:=$(A3700_UTILS_NAME) +endef + +MV_DDR_NAME:=mv-ddr-marvell +MV_DDR_RELEASE:=mainline +MV_DDR_SOURCE:=$(MV_DDR_NAME)-$(MV_DDR_RELEASE).tar.bz2 + +define Download/mv-ddr-marvell + FILE:=$(MV_DDR_SOURCE) + PROTO:=git + URL:=https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git + VERSION:=a881467ef0f0185e6570dd0483023fde93cbb5f5 + MIRROR_HASH:=19f34817616c583b2b5f2612705857cf2120f6c2132355217899b1403c3fd336 + SUBDIR:=$(MV_DDR_NAME) +endef + +LINARO_NAME:=gcc-linaro +LINARO_RELEASE:=6 +LINARO_VERSION:=5.0-2018.12-$(HOST_ARCH)_arm-linux-gnueabi +LINARO_SOURCE=$(LINARO_NAME)-$(LINARO_RELEASE).$(LINARO_VERSION).tar.xz + +define Download/gcc-linaro + FILE:=$(LINARO_SOURCE) + URL:=https://releases.linaro.org/components/toolchain/binaries/latest-$(LINARO_RELEASE)/arm-linux-gnueabi/ + HASH:=2d4a92d6c8b384ae404b2e02c1c412e3ec18f9b714135acf046b2b1b510e9ace +endef + +define Build/Prepare + # Download sources + $(eval $(call Download,a3700-utils)) + $(eval $(call Download,mv-ddr-marvell)) + $(eval $(call Download,gcc-linaro)) + + rm -rf $(PKG_BUILD_DIR) + $(TAR) -C $(BUILD_DIR) -xf $(DL_DIR)/$(PKG_SOURCE) + + mkdir -p $(STAGING_DIR_IMAGE) + $(TAR) -C $(STAGING_DIR_IMAGE) -xf $(DL_DIR)/$(A3700_UTILS_SOURCE) + $(TAR) -C $(STAGING_DIR_IMAGE) -xf $(DL_DIR)/$(MV_DDR_SOURCE) + $(TAR) -C $(STAGING_DIR_IMAGE) -xf $(DL_DIR)/$(LINARO_SOURCE) +endef + +TARGET_CFLAGS = "" + +MAKE_VARS= \ + CROSS_COMPILE="$(TARGET_CROSS)" + +MAKE_FLAGS = \ + CROSS_CM3=$(STAGING_DIR_IMAGE)/$(LINARO_NAME)-$(LINARO_RELEASE).$(LINARO_VERSION)/bin/arm-linux-gnueabi- \ + BL33=$(STAGING_DIR_IMAGE)/$(UBOOT)-u-boot.bin \ + MV_DDR_PATH=$(STAGING_DIR_IMAGE)/$(MV_DDR_NAME) \ + WTP=$(STAGING_DIR_IMAGE)/$(A3700_UTILS_NAME) \ + CLOCKSPRESET=$(CLOCKSPRESET) \ + PLAT=$(PLAT) \ + all \ + fip + +define Build/InstallDev + $(CP) $(PKG_BUILD_DIR)/build/$(PLAT)/release/flash-image.bin $(BIN_DIR)/u-boot-$(BOARDNAME)/ +endef + +$(eval $(call BuildPackage,arm-trusted-firmware-mvebu/uDPU)) diff --git a/package/boot/arm-trusted-firmware-sunxi/Makefile b/package/boot/arm-trusted-firmware-sunxi/Makefile index d2554f4ebc3291..0211e5e0304981 100644 --- a/package/boot/arm-trusted-firmware-sunxi/Makefile +++ b/package/boot/arm-trusted-firmware-sunxi/Makefile @@ -11,10 +11,10 @@ PKG_NAME:=arm-trusted-firmware-sunxi PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL=https://github.com/apritzel/arm-trusted-firmware -PKG_SOURCE_DATE:=2018-02-04 -PKG_SOURCE_VERSION:=ae78724247a01560164d607ed66db111c74d8df0 -PKG_MIRROR_HASH:=e4ddc3294f86c1e163d683a2322427bbdd5b63762ead4b1792b34df75d7bda28 +PKG_SOURCE_URL=https://github.com/ARM-software/arm-trusted-firmware +PKG_SOURCE_DATE:=2018-10-02 +PKG_SOURCE_VERSION:=dbc8d9496ead9ecdd7c2a276b542a4fbbbf64027 +PKG_MIRROR_HASH:=c81521a27b86f606e927b4e346286540b862828c8d49292eae1f5c6adfc24001 PKG_LICENSE:=BSD-3-Clause PKG_LICENSE_FILES:=license.md @@ -37,12 +37,12 @@ MAKE_VARS = \ CROSS_COMPILE="$(TARGET_CROSS)" MAKE_FLAGS += \ - PLAT=sun50iw1p1 \ + PLAT=sun50i_a64 \ bl31 define Build/InstallDev $(INSTALL_DIR) $(STAGING_DIR_IMAGE) - $(CP) $(PKG_BUILD_DIR)/build/sun50iw1p1/release/bl31.bin $(STAGING_DIR_IMAGE)/bl31.bin + $(CP) $(PKG_BUILD_DIR)/build/sun50i_a64/release/bl31.bin $(STAGING_DIR_IMAGE)/bl31.bin endef define Package/arm-trusted-firmware-sunxi/install diff --git a/package/boot/at91bootstrap/Makefile b/package/boot/at91bootstrap/Makefile index 22afd1ec41cd1f..c4edddf848292e 100644 --- a/package/boot/at91bootstrap/Makefile +++ b/package/boot/at91bootstrap/Makefile @@ -9,13 +9,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=at91bootstrap -PKG_VERSION:=v3.8.10 +PKG_VERSION:=v3.8.12 PKG_RELEASE:= PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/linux4sam/at91bootstrap.git -PKG_SOURCE_VERSION:=04efa5500d60a0211d14b6ee60df7ce0a828704d - +PKG_SOURCE_VERSION:=28e15d07e9f24efb04b87bb0baa211a0c5640ef1 PKG_BUILD_DIR = \ $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) @@ -28,85 +27,99 @@ define AT91Bootstrap/Default AT91BOOTSTRAP_IMAGE:=at91bootstrap.bin endef +define AT91Bootstrap/at91sam9x5eknf_uboot + NAME:=AT91Bootstrap for AT91SAM9X5-EK board (NandFlash) + BUILD_SUBTARGET:=sam9x + BUILD_DEVICES:=at91sam9x25ek at91sam9x35ek +endef + +define AT91Bootstrap/at91sam9x5eksd_uboot + NAME:=AT91Bootstrap for AT91SAM9X5-EK board (SDcard) + BUILD_SUBTARGET:=sam9x + BUILD_DEVICES:=at91sam9x25ek at91sam9x35ek +endef + define AT91Bootstrap/sama5d2_xplaineddf_uboot TITLE:=AT91Bootstrap for SAMA5D2 Xplained board (SPI Flash) - BUILD_SUBTARGET:=sama5d2 + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d2_xplained endef define AT91Bootstrap/sama5d2_xplaineddf_qspi_uboot TITLE:=AT91Bootstrap for SAMA5D2 Xplained board (QSPI Flash) - BUILD_SUBTARGET:=sama5d2 + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d2_xplained endef define AT91Bootstrap/sama5d2_xplainedsd_uboot TITLE:=AT91Bootstrap for SAMA5D2 Xplained board (SDcard/EMMC) - BUILD_SUBTARGET:=sama5d2 + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d2_xplained endef define AT91Bootstrap/sama5d3_xplainednf_uboot TITLE:=AT91Bootstrap for SAMA5D3 Xplained board (Nand Flash) - BUILD_SUBTARGET:=sama5d3 + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d3_xplained endef define AT91Bootstrap/sama5d3_xplainedsd_uboot TITLE:=AT91Bootstrap for SAMA5D3 Xplained board (SDcard) - BUILD_SUBTARGET:=sama5d3 + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d3_xplained endef define AT91Bootstrap/sama5d4_xplainednf_uboot_secure TITLE:=AT91Bootstrap for SAMA5D4 Xplained board (Nand Flash) - BUILD_SUBTARGET:=sama5d4 + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d4_xplained endef define AT91Bootstrap/sama5d4_xplaineddf_uboot_secure TITLE:=AT91Bootstrap for SAMA5D4 Xplained board (SPI Flash) - BUILD_SUBTARGET:=sama5d4 + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d4_xplained endef define AT91Bootstrap/sama5d4_xplainedsd_uboot_secure TITLE:=AT91Bootstrap for SAMA5D4 Xplained board (SDcard) - BUILD_SUBTARGET:=sama5d4 + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d4_xplained endef define AT91Bootstrap/sama5d27_som1_eksd_uboot TITLE:=AT91Bootstrap for SAMA5D27 SOM1 Ek (SDcard0) - BUILD_SUBTARGET:=sama5d2 + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d27_som1_ek endef define AT91Bootstrap/sama5d27_som1_eksd1_uboot TITLE:=AT91Bootstrap for SAMA5D27 SOM1 Ek (SDcard1) - BUILD_SUBTARGET:=sama5d2 + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d27_som1_ek endef define AT91Bootstrap/sama5d27_som1_ekqspi_uboot TITLE:=AT91Bootstrap for SAMA5D27 SOM1 Ek (QSPI Flash) - BUILD_SUBTARGET:=sama5d2 + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d27_som1_ek endef define AT91Bootstrap/sama5d2_ptc_eknf_uboot TITLE:=AT91Bootstrap for SAMA5D2 PTC EK (Nand Flash) - BUILD_SUBTARGET:=sama5d2 + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d2_ptc_ek endef define AT91Bootstrap/sama5d2_ptc_eksd_uboot TITLE:=AT91Bootstrap for SAMA5D2 PTC EK (SDCard) - BUILD_SUBTARGET:=sama5d2 + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d2_ptc_ek endef AT91BOOTSTRAP_TARGETS := \ + at91sam9x5eknf_uboot \ + at91sam9x5eksd_uboot \ sama5d2_xplaineddf_uboot \ sama5d2_xplaineddf_qspi_uboot \ sama5d2_xplainedsd_uboot \ @@ -115,9 +128,9 @@ AT91BOOTSTRAP_TARGETS := \ sama5d4_xplainednf_uboot_secure \ sama5d4_xplaineddf_uboot_secure \ sama5d4_xplainedsd_uboot_secure \ - sama5d27_som1_eksd_uboot \ - sama5d27_som1_ekqspi_uboot \ - sama5d2_ptc_eknf_uboot \ + sama5d27_som1_eksd1_uboot \ + sama5d27_som1_ekqspi_uboot \ + sama5d2_ptc_eknf_uboot \ sama5d2_ptc_eksd_uboot define Build/Compile diff --git a/package/boot/fconfig/Makefile b/package/boot/fconfig/Makefile index 3c33d73c692047..9b806fe97cd0ff 100644 --- a/package/boot/fconfig/Makefile +++ b/package/boot/fconfig/Makefile @@ -12,7 +12,7 @@ PKG_VERSION:=20080329 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=http://andrzejekiert.ovh.org/software/fconfig/ +PKG_SOURCE_URL:=https://downloads.openwrt.org/sources PKG_HASH:=4ff0e8f07e35e46b705c0dbe9d9544ede01ea092a69e3f7db03e55a3f2bb8eb7 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) @@ -24,20 +24,12 @@ define Package/fconfig CATEGORY:=Utilities SUBMENU:=Boot Loaders TITLE:=RedBoot configuration editor - URL:=http://andrzejekiert.ovh.org/software.html.en endef define Package/fconfig/description displays and (if writable) also edits the RedBoot configuration. endef -define Build/Configure -endef - -define Build/Compile - $(call Build/Compile/Default) -endef - define Package/fconfig/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/fconfig $(1)/usr/sbin/ diff --git a/package/boot/grub2/Makefile b/package/boot/grub2/Makefile deleted file mode 100644 index b2ae1715692fc7..00000000000000 --- a/package/boot/grub2/Makefile +++ /dev/null @@ -1,93 +0,0 @@ -# -# Copyright (C) 2006-2015 OpenWrt.org -# -# 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:=grub -PKG_CPE_ID:=cpe:/a:gnu:grub2 -PKG_VERSION:=2.02 -PKG_RELEASE:=1 - -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_URL:=@GNU/grub -PKG_HASH:=810b3798d316394f94096ec2797909dbf23c858e48f7b3830826b8daa06b7b0f - -PKG_FIXUP:=autoreconf -HOST_BUILD_PARALLEL:=1 -PKG_BUILD_DEPENDS:=grub2/host - -PKG_SSP:=0 - -PKG_FLAGS:=nonshared - -include $(INCLUDE_DIR)/host-build.mk -include $(INCLUDE_DIR)/package.mk - -define Package/grub2 - CATEGORY:=Boot Loaders - SECTION:=boot - TITLE:=GRand Unified Bootloader - URL:=http://www.gnu.org/software/grub/ - DEPENDS:=@TARGET_x86||TARGET_x86_64 -endef - -define Package/grub2-editenv - CATEGORY:=Utilities - SECTION:=utils - SUBMENU:=Boot Loaders - TITLE:=Grub2 Environment editor - URL:=http://www.gnu.org/software/grub/ - DEPENDS:=@TARGET_x86||TARGET_x86_64 -endef - -define Package/grub2-editenv/description - Edit grub2 environment files. -endef - -HOST_BUILD_PREFIX := $(STAGING_DIR_HOST) - -CONFIGURE_VARS += \ - grub_build_mkfont_excuse="don't want fonts" - -CONFIGURE_ARGS += \ - --target=$(REAL_GNU_TARGET_NAME) \ - --disable-werror \ - --disable-nls \ - --disable-device-mapper \ - --disable-libzfs \ - --disable-grub-mkfont \ - --with-platform=none - -HOST_CONFIGURE_VARS += \ - grub_build_mkfont_excuse="don't want fonts" - -HOST_CONFIGURE_ARGS += \ - --disable-grub-mkfont \ - --target=$(REAL_GNU_TARGET_NAME) \ - --sbindir="$(STAGING_DIR_HOST)/bin" \ - --disable-werror \ - --disable-libzfs \ - --disable-nls - -HOST_MAKE_FLAGS += \ - TARGET_RANLIB=$(TARGET_RANLIB) \ - LIBLZMA=$(STAGING_DIR_HOST)/lib/liblzma.a - -define Host/Configure - $(SED) 's,(RANLIB),(TARGET_RANLIB),' $(HOST_BUILD_DIR)/grub-core/Makefile.in - $(Host/Configure/Default) -endef - -define Package/grub2-editenv/install - $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/grub-editenv $(1)/usr/sbin/ -endef - -$(eval $(call HostBuild)) -$(eval $(call BuildPackage,grub2)) -$(eval $(call BuildPackage,grub2-editenv)) diff --git a/package/boot/grub2/common.mk b/package/boot/grub2/common.mk new file mode 100644 index 00000000000000..03e97c12142ccb --- /dev/null +++ b/package/boot/grub2/common.mk @@ -0,0 +1,73 @@ +# +# Copyright (C) 2006-2015 OpenWrt.org +# +# 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_CPE_ID:=cpe:/a:gnu:grub2 +PKG_VERSION:=2.04 +PKG_RELEASE:=1 + +PKG_SOURCE:=grub-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@GNU/grub +PKG_HASH:=e5292496995ad42dabe843a0192cf2a2c502e7ffcc7479398232b10a472df77d + +HOST_BUILD_PARALLEL:=1 + +PKG_SSP:=0 + +PKG_FLAGS:=nonshared + +PATCH_DIR := ../patches +HOST_PATCH_DIR := ../patches +HOST_BUILD_DIR := $(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/package.mk + +define Package/grub2/Default + CATEGORY:=Boot Loaders + SECTION:=boot + TITLE:=GRand Unified Bootloader + URL:=http://www.gnu.org/software/grub/ + DEPENDS:=@TARGET_x86||TARGET_x86_64 +endef + +HOST_BUILD_PREFIX := $(STAGING_DIR_HOST) + +CONFIGURE_VARS += \ + grub_build_mkfont_excuse="don't want fonts" + +CONFIGURE_ARGS += \ + --target=$(REAL_GNU_TARGET_NAME) \ + --disable-werror \ + --disable-nls \ + --disable-device-mapper \ + --disable-libzfs \ + --disable-grub-mkfont \ + --with-platform=none + +HOST_CONFIGURE_VARS += \ + grub_build_mkfont_excuse="don't want fonts" + +HOST_CONFIGURE_ARGS += \ + --disable-grub-mkfont \ + --target=$(REAL_GNU_TARGET_NAME) \ + --sbindir="$(STAGING_DIR_HOST)/bin" \ + --disable-werror \ + --disable-libzfs \ + --disable-nls + +HOST_MAKE_FLAGS += \ + TARGET_RANLIB=$(TARGET_RANLIB) \ + LIBLZMA=$(STAGING_DIR_HOST)/lib/liblzma.a + +define Host/Configure + $(SED) 's,(RANLIB),(TARGET_RANLIB),' $(HOST_BUILD_DIR)/grub-core/Makefile.in + $(Host/Configure/Default) +endef + diff --git a/package/boot/grub2/grub2-efi/Makefile b/package/boot/grub2/grub2-efi/Makefile new file mode 100644 index 00000000000000..035bfc33366f31 --- /dev/null +++ b/package/boot/grub2/grub2-efi/Makefile @@ -0,0 +1,23 @@ +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=grub-efi + +include ../common.mk + +TAR_OPTIONS:= --transform 's/grub-${PKG_VERSION}/${PKG_NAME}-${PKG_VERSION}/' $(TAR_OPTIONS) + +PKG_BUILD_DEPENDS:=grub2-efi/host + +CONFIGURE_ARGS += --with-platform=efi +HOST_CONFIGURE_ARGS += --with-platform=efi --program-suffix=-efi +HOST_BUILD_DIR := $(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION) + +define Package/grub2-efi +$(call Package/grub2/Default) +HIDDEN:=1 +TITLE += (with EFI support) +endef + +$(eval $(call HostBuild)) +$(eval $(call BuildPackage,grub2-efi)) diff --git a/package/boot/grub2/grub2/Makefile b/package/boot/grub2/grub2/Makefile new file mode 100644 index 00000000000000..c00797662b7cb9 --- /dev/null +++ b/package/boot/grub2/grub2/Makefile @@ -0,0 +1,33 @@ +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=grub + +include ../common.mk + +PKG_BUILD_DEPENDS:=grub2/host + +define Package/grub2 +$(call Package/grub2/Default) +endef + +define Package/grub2-editenv + CATEGORY:=Utilities + SECTION:=utils + TITLE:=Grub2 Environment editor + URL:=http://www.gnu.org/software/grub/ + DEPENDS:=@TARGET_x86||TARGET_x86_64 +endef + +define Package/grub2-editenv/description + Edit grub2 environment files. +endef + +define Package/grub2-editenv/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/grub-editenv $(1)/usr/sbin/ +endef + +$(eval $(call HostBuild)) +$(eval $(call BuildPackage,grub2)) +$(eval $(call BuildPackage,grub2-editenv)) diff --git a/package/boot/grub2/patches/100-grub_setup_root.patch b/package/boot/grub2/patches/100-grub_setup_root.patch index f053ba95e2287b..1b1bb34f7480e2 100644 --- a/package/boot/grub2/patches/100-grub_setup_root.patch +++ b/package/boot/grub2/patches/100-grub_setup_root.patch @@ -17,7 +17,7 @@ int force; int fs_probe; int allow_floppy; -@@ -178,6 +181,13 @@ argp_parser (int key, char *arg, struct argp_state *state) +@@ -178,6 +181,13 @@ argp_parser (int key, char *arg, struct arguments->dev_map = xstrdup (arg); break; @@ -42,7 +42,7 @@ --- a/util/setup.c +++ b/util/setup.c -@@ -247,13 +247,12 @@ identify_partmap (grub_disk_t disk __attribute__ ((unused)), +@@ -247,13 +247,12 @@ identify_partmap (grub_disk_t disk __att void SETUP (const char *dir, const char *boot_file, const char *core_file, @@ -55,8 +55,8 @@ char *boot_img, *core_img, *boot_path; - char *root = 0; size_t boot_size, core_size; - #ifdef GRUB_SETUP_BIOS grub_uint16_t core_sectors; + grub_device_t root_dev = 0, dest_dev, core_dev; @@ -307,7 +306,10 @@ SETUP (const char *dir, core_dev = dest_dev; @@ -80,7 +80,7 @@ continue; --- a/include/grub/util/install.h +++ b/include/grub/util/install.h -@@ -184,13 +184,13 @@ grub_install_get_image_target (const char *arg); +@@ -191,13 +191,13 @@ grub_install_get_image_target (const cha void grub_util_bios_setup (const char *dir, const char *boot_file, const char *core_file, @@ -98,7 +98,7 @@ --- a/util/grub-install.c +++ b/util/grub-install.c -@@ -1673,7 +1673,7 @@ main (int argc, char *argv[]) +@@ -1712,7 +1712,7 @@ main (int argc, char *argv[]) /* Now perform the installation. */ if (install_bootsector) grub_util_bios_setup (platdir, "boot.img", "core.img", @@ -107,7 +107,7 @@ fs_probe, allow_floppy, add_rs_codes); break; } -@@ -1699,7 +1699,7 @@ main (int argc, char *argv[]) +@@ -1738,7 +1738,7 @@ main (int argc, char *argv[]) /* Now perform the installation. */ if (install_bootsector) grub_util_sparc_setup (platdir, "boot.img", "core.img", diff --git a/package/boot/grub2/patches/101-disable-gettext-check-macro-version.patch b/package/boot/grub2/patches/101-disable-gettext-check-macro-version.patch deleted file mode 100644 index 4b850ed2a118c1..00000000000000 --- a/package/boot/grub2/patches/101-disable-gettext-check-macro-version.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/po/Makefile.in.in b/po/Makefile.in.in -index 3619458..060e0db 100644 ---- a/po/Makefile.in.in -+++ b/po/Makefile.in.in -@@ -97,7 +97,7 @@ CATALOGS = @CATALOGS@ - mv t-$@ $@ - - --all: check-macro-version all-@USE_NLS@ -+all: all-@USE_NLS@ - - all-yes: stamp-po - all-no: diff --git a/package/boot/grub2/patches/200-fix-gets-removal.patch b/package/boot/grub2/patches/200-fix-gets-removal.patch deleted file mode 100644 index 737fb975bf7196..00000000000000 --- a/package/boot/grub2/patches/200-fix-gets-removal.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/grub-core/gnulib/stdio.in.h -+++ b/grub-core/gnulib/stdio.in.h -@@ -695,13 +695,6 @@ _GL_WARN_ON_USE (getline, "getline is un - # endif - #endif - --/* It is very rare that the developer ever has full control of stdin, -- so any use of gets warrants an unconditional warning; besides, C11 -- removed it. */ --#undef gets --#if HAVE_RAW_DECL_GETS --#endif -- - - #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ - struct obstack; diff --git a/package/boot/grub2/patches/300-CVE-2015-8370.patch b/package/boot/grub2/patches/300-CVE-2015-8370.patch new file mode 100644 index 00000000000000..f6b8a93d397da4 --- /dev/null +++ b/package/boot/grub2/patches/300-CVE-2015-8370.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hector Marco-Gisbert +Date: Fri, 13 Nov 2015 16:21:09 +0100 +Subject: [PATCH] Fix security issue when reading username and password + + This patch fixes two integer underflows at: + * grub-core/lib/crypto.c + * grub-core/normal/auth.c + +Resolves: CVE-2015-8370 + +Signed-off-by: Hector Marco-Gisbert +Signed-off-by: Ismael Ripoll-Ripoll +--- + grub-core/lib/crypto.c | 2 +- + grub-core/normal/auth.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/grub-core/lib/crypto.c ++++ b/grub-core/lib/crypto.c +@@ -468,7 +468,7 @@ grub_password_get (char buf[], unsigned + break; + } + +- if (key == '\b') ++ if (key == '\b' && cur_len) + { + if (cur_len) + cur_len--; +--- a/grub-core/normal/auth.c ++++ b/grub-core/normal/auth.c +@@ -172,7 +172,7 @@ grub_username_get (char buf[], unsigned + break; + } + +- if (key == GRUB_TERM_BACKSPACE) ++ if (key == GRUB_TERM_BACKSPACE && cur_len) + { + if (cur_len) + { diff --git a/package/boot/kexec-tools/Makefile b/package/boot/kexec-tools/Makefile index 76ea46f10f353d..269345aa9db8f7 100644 --- a/package/boot/kexec-tools/Makefile +++ b/package/boot/kexec-tools/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=kexec-tools PKG_VERSION:=2.0.16 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/kernel/kexec @@ -25,7 +25,6 @@ define Package/kexec-tools/Default SECTION:=utils CATEGORY:=Utilities URL:=http://kernel.org/pub/linux/kernel/people/horms/kexec-tools/ - MAINTAINER:=Florian Fainelli endef define Package/kexec-tools @@ -44,7 +43,7 @@ define Package/kexec $(call Package/kexec-tools/Default) TITLE:=Kernel boots kernel DEPENDS:=\ - @armeb||@arm||@i386||@x86_64||@powerpc64||@mipsel||@mips \ + @(armeb||arm||i386||x86_64||powerpc64||mipsel||mips) \ +KEXEC_ZLIB:zlib +KEXEC_LZMA:liblzma @KERNEL_KEXEC endef @@ -55,7 +54,7 @@ endef define Package/kdump $(call Package/kexec-tools/Default) TITLE:=Kernel crash analysis - DEPENDS:=+kexec @i386||@x86_64||@arm @KERNEL_CRASH_DUMP + DEPENDS:=+kexec @(i386||x86_64||arm) @KERNEL_CRASH_DUMP endef define Package/kdump/description diff --git a/package/boot/kexec-tools/files/kdump.init b/package/boot/kexec-tools/files/kdump.init index 6a6a94c07e330c..09550471565b36 100755 --- a/package/boot/kexec-tools/files/kdump.init +++ b/package/boot/kexec-tools/files/kdump.init @@ -1,7 +1,7 @@ #!/bin/sh /etc/rc.common START=41 -STOP=98 +STOP=90 EXTRA_COMMANDS="status" EXTRA_HELP=" status Print crashkernel status" diff --git a/package/boot/rbcfg/Makefile b/package/boot/rbcfg/Makefile index 9d9b97524a195c..55e0ea7490d22e 100644 --- a/package/boot/rbcfg/Makefile +++ b/package/boot/rbcfg/Makefile @@ -21,7 +21,7 @@ define Package/rbcfg CATEGORY:=Utilities SUBMENU:=Boot Loaders TITLE:=RouterBOOT configuration tool - DEPENDS:=@TARGET_ar71xx + DEPENDS:=@(TARGET_ar71xx||TARGET_ath79) endef define Package/rbcfg/description diff --git a/package/boot/tfa-layerscape/Makefile b/package/boot/tfa-layerscape/Makefile new file mode 100644 index 00000000000000..a34c52bc3b5ace --- /dev/null +++ b/package/boot/tfa-layerscape/Makefile @@ -0,0 +1,161 @@ +# +# Copyright 2019 NXP +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=tfa-layerscape +PKG_VERSION:=lsdk-1903 +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://source.codeaurora.org/external/qoriq/qoriq-components/atf +PKG_SOURCE_VERSION:=7e34aebe658c7c3439d2d68b0ce6b9776e8e6996 +PKG_MIRROR_HASH:=9cf0bc32fa589a0ee7c48c87898679e645341f29da1253d0ba5d2e82c6ea074d +PKG_BUILD_DEPENDS:=uboot-layerscape tfa-layerscape/host + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/package.mk + +define Package/tfa-layerscape/Config + define Package/tfa-$(1) + SECTION:=boot + CATEGORY:=Boot Loaders + TITLE:=$(2) + DEPENDS:=@TARGET_layerscape_armv8_64b +layerscape-rcw-$(1) + HIDDEN:=1 + VARIANT:=$(1) + BIN_BL2:=$(3) + BIN_FIP:=$(4) + endef +endef + +define Package/tfa-layerscape/Install + define Package/tfa-$(1)/install + $(INSTALL_DIR) $(STAGING_DIR_IMAGE) + $(CP) $(PKG_BUILD_DIR)/$(BIN_BL2) $(STAGING_DIR_IMAGE)/$(1)-bl2.pbl + $(CP) $(PKG_BUILD_DIR)/$(BIN_FIP) $(STAGING_DIR_IMAGE)/$(1)-fip.bin + endef +endef + +define Build/Compile + $(eval $(Package/tfa-layerscape/$(BUILD_VARIANT))) \ + $(MAKE) -C $(PKG_BUILD_DIR) CROSS_COMPILE=$(TARGET_CROSS) \ + fip pbl PLAT=$(PLAT) BOOT_MODE=$(BOOT_MODE) \ + RCW=$(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-rcw.bin \ + BL33=$(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-uboot.bin \ + FIPTOOL=$(STAGING_DIR_HOST)/bin/tfa-fiptool \ + CREATE_PBL=$(STAGING_DIR_HOST)/bin/tfa-create-pbl \ + BYTE_SWAP=$(STAGING_DIR_HOST)/bin/tfa-byte-swap +endef + +HOST_CFLAGS += -Wall -Werror -pedantic -std=c99 +define Host/Compile + $(MAKE) -C \ + $(HOST_BUILD_DIR)/tools/fiptool \ + CFLAGS="$(HOST_CFLAGS)" \ + LDFLAGS="$(HOST_LDFLAGS)" + $(MAKE) -C \ + $(HOST_BUILD_DIR)/plat/nxp/tools \ + CFLAGS="$(HOST_CFLAGS)" +endef + +define Host/Install + $(INSTALL_BIN) $(HOST_BUILD_DIR)/tools/fiptool/fiptool $(STAGING_DIR_HOST)/bin/tfa-fiptool + $(INSTALL_BIN) $(HOST_BUILD_DIR)/plat/nxp/tools/create_pbl $(STAGING_DIR_HOST)/bin/tfa-create-pbl + $(INSTALL_BIN) $(HOST_BUILD_DIR)/plat/nxp/tools/byte_swap $(STAGING_DIR_HOST)/bin/tfa-byte-swap +endef + +define Package/tfa-layerscape/ls1012ardb + TITLE:=NXP LS1012ARDB Trusted Firmware + PLAT:=ls1012ardb + BOOT_MODE:=qspi + BIN_BL2:=build/ls1012ardb/release/bl2_qspi.pbl + BIN_FIP:=build/ls1012ardb/release/fip.bin +endef + +define Package/tfa-layerscape/ls1012afrwy + TITLE:=NXP LS1012AFRWY Trusted Firmware + PLAT:=ls1012afrwy + BOOT_MODE:=qspi + BIN_BL2:=build/ls1012afrwy/release/bl2_qspi.pbl + BIN_FIP:=build/ls1012afrwy/release/fip.bin +endef + +define Package/tfa-layerscape/ls1043ardb + TITLE:=NXP LS1043ARDB Trusted Firmware + PLAT:=ls1043ardb + BOOT_MODE:=nor + BIN_BL2:=build/ls1043ardb/release/bl2_nor.pbl + BIN_FIP:=build/ls1043ardb/release/fip.bin +endef + +define Package/tfa-layerscape/ls1043ardb-sdboot + TITLE:=NXP LS1043ARDB SD Boot Trusted Firmware + PLAT:=ls1043ardb + BOOT_MODE:=sd + BIN_BL2:=build/ls1043ardb/release/bl2_sd.pbl + BIN_FIP:=build/ls1043ardb/release/fip.bin +endef + +define Package/tfa-layerscape/ls1046ardb + TITLE:=NXP LS1046ARDB Trusted Firmware + PLAT:=ls1046ardb + BOOT_MODE:=qspi + BIN_BL2:=build/ls1046ardb/release/bl2_qspi.pbl + BIN_FIP:=build/ls1046ardb/release/fip.bin +endef + +define Package/tfa-layerscape/ls1046ardb-sdboot + TITLE:=NXP LS1046ARDB SD Boot Trusted Firmware + PLAT:=ls1046ardb + BOOT_MODE:=sd + BIN_BL2:=build/ls1046ardb/release/bl2_sd.pbl + BIN_FIP:=build/ls1046ardb/release/fip.bin +endef + +define Package/tfa-layerscape/ls1088ardb + TITLE:=NXP LS1088ARDB Trusted Firmware + PLAT:=ls1088ardb + BOOT_MODE:=qspi + BIN_BL2:=build/ls1088ardb/release/bl2_qspi.pbl + BIN_FIP:=build/ls1088ardb/release/fip.bin +endef + +define Package/tfa-layerscape/ls1088ardb-sdboot + TITLE:=NXP LS1088ARDB SD Boot Trusted Firmware + PLAT:=ls1088ardb + BOOT_MODE:=sd + BIN_BL2:=build/ls1088ardb/release/bl2_sd.pbl + BIN_FIP:=build/ls1088ardb/release/fip.bin +endef + +define Package/tfa-layerscape/ls2088ardb + TITLE:=NXP LS2088ARDB Trusted Firmware + PLAT:=ls2088ardb + BOOT_MODE:=nor + BIN_BL2:=build/ls2088ardb/release/bl2_nor.pbl + BIN_FIP:=build/ls2088ardb/release/fip.bin +endef + +TFAS := \ + ls1012ardb \ + ls1012afrwy \ + ls1043ardb \ + ls1043ardb-sdboot \ + ls1046ardb \ + ls1046ardb-sdboot \ + ls1088ardb \ + ls1088ardb-sdboot \ + ls2088ardb + +$(eval $(call HostBuild)) +$(foreach tfa,$(TFAS), \ + $(eval $(Package/tfa-layerscape/$(tfa))) \ + $(eval $(call Package/tfa-layerscape/Config,$(tfa),$(TITLE),$(BIN_BL2),$(BIN_FIP))) \ + $(eval $(call Package/tfa-layerscape/Install,$(tfa))) \ + $(eval $(call BuildPackage,tfa-$(tfa))) \ +) diff --git a/package/boot/tfa-layerscape/patches/001-fiptool-hostbuild-fixes.patch b/package/boot/tfa-layerscape/patches/001-fiptool-hostbuild-fixes.patch new file mode 100644 index 00000000000000..0567e5869be933 --- /dev/null +++ b/package/boot/tfa-layerscape/patches/001-fiptool-hostbuild-fixes.patch @@ -0,0 +1,71 @@ +--- a/Makefile ++++ b/Makefile +@@ -448,10 +448,6 @@ endif + CRTTOOLPATH ?= tools/cert_create + CRTTOOL ?= ${CRTTOOLPATH}/cert_create${BIN_EXT} + +-# Variables for use with Firmware Image Package +-FIPTOOLPATH ?= tools/fiptool +-FIPTOOL ?= ${FIPTOOLPATH}/fiptool${BIN_EXT} +- + ################################################################################ + # Include BL specific makefiles + ################################################################################ +@@ -661,14 +657,12 @@ endif + clean: + @echo " CLEAN" + $(call SHELL_REMOVE_DIR,${BUILD_PLAT}) +- ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean + ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean + + realclean distclean: + @echo " REALCLEAN" + $(call SHELL_REMOVE_DIR,${BUILD_BASE}) + $(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*) +- ${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean + ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean + + checkcodebase: locate-checkpatch +@@ -717,7 +711,7 @@ certificates: ${CRT_DEPS} ${CRTTOOL} + @${ECHO_BLANK_LINE} + endif + +-${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} ${FIPTOOL} ++${BUILD_PLAT}/${FIP_NAME}: ${FIP_DEPS} + ${Q}${FIPTOOL} create ${FIP_ARGS} $@ + ${Q}${FIPTOOL} info $@ + @${ECHO_BLANK_LINE} +@@ -733,21 +727,16 @@ fwu_certificates: ${FWU_CRT_DEPS} ${CRTT + @${ECHO_BLANK_LINE} + endif + +-${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} ${FIPTOOL} ++${BUILD_PLAT}/${FWU_FIP_NAME}: ${FWU_FIP_DEPS} + ${Q}${FIPTOOL} create ${FWU_FIP_ARGS} $@ + ${Q}${FIPTOOL} info $@ + @${ECHO_BLANK_LINE} + @echo "Built $@ successfully" + @${ECHO_BLANK_LINE} + +-fiptool: ${FIPTOOL} + fip: ${BUILD_PLAT}/${FIP_NAME} + fwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME} + +-.PHONY: ${FIPTOOL} +-${FIPTOOL}: +- ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${FIPTOOLPATH} +- + cscope: + @echo " CSCOPE" + ${Q}find ${CURDIR} -name "*.[chsS]" > cscope.files +--- a/tools/fiptool/Makefile ++++ b/tools/fiptool/Makefile +@@ -37,7 +37,7 @@ all: ${PROJECT} fip_create + + ${PROJECT}: ${OBJECTS} Makefile + @echo " LD $@" +- ${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS} ++ ${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS} $(LDFLAGS) + @${ECHO_BLANK_LINE} + @echo "Built $@ successfully" + @${ECHO_BLANK_LINE} diff --git a/package/boot/tfa-layerscape/patches/002-plat-nxp-tools-fix-a-makefile-bug-that-will-use-defa.patch b/package/boot/tfa-layerscape/patches/002-plat-nxp-tools-fix-a-makefile-bug-that-will-use-defa.patch new file mode 100644 index 00000000000000..92825310e03647 --- /dev/null +++ b/package/boot/tfa-layerscape/patches/002-plat-nxp-tools-fix-a-makefile-bug-that-will-use-defa.patch @@ -0,0 +1,30 @@ +From 65e9a722b44bf28b98fe25b3b174761b47ec7dbd Mon Sep 17 00:00:00 2001 +From: Biwen Li +Date: Mon, 1 Apr 2019 13:41:55 +0800 +Subject: [PATCH 2/3] plat/nxp/tools: fix a makefile bug that will use default + implicit rules + +The patch fix a makefile bug that will use default implicit rules, +because do not have explicit rules for the destination files. + +Signed-off-by: Biwen Li +--- + plat/nxp/tools/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/plat/nxp/tools/Makefile b/plat/nxp/tools/Makefile +index 2095294b..0082a0be 100644 +--- a/plat/nxp/tools/Makefile ++++ b/plat/nxp/tools/Makefile +@@ -53,7 +53,7 @@ ${PROJECT_2}: ${OBJECTS_2} Makefile + @echo "Built $@ successfully" + @${ECHO_BLANK_LINE} + +-%.o: %.c %.h Makefile ++%.o: %.c Makefile + @echo " CC $<" + ${Q}${HOSTCC} -c ${CPPFLAGS} ${CFLAGS} ${INCLUDE_PATHS} $< -o $@ + +-- +2.17.1 + diff --git a/package/boot/tfa-layerscape/patches/003-plat-nxp-tools-fix-create_pbl-and-byte_swap-host-bui.patch b/package/boot/tfa-layerscape/patches/003-plat-nxp-tools-fix-create_pbl-and-byte_swap-host-bui.patch new file mode 100644 index 00000000000000..ce4d9c48bf3ebf --- /dev/null +++ b/package/boot/tfa-layerscape/patches/003-plat-nxp-tools-fix-create_pbl-and-byte_swap-host-bui.patch @@ -0,0 +1,60 @@ +From 8a458876013991fe2f288bbe4694264b16c3b9e9 Mon Sep 17 00:00:00 2001 +From: Biwen Li +Date: Fri, 26 Jul 2019 15:44:10 +0800 +Subject: [PATCH 3/3] plat/nxp/tools: fix create_pbl and byte_swap host build + +Not compile create_pbl and byte_swap in the process of cross compilation + +Signed-off-by: Biwen Li +--- + plat/nxp/tools/pbl_ch2.mk | 3 --- + plat/nxp/tools/pbl_ch3.mk | 5 ----- + 2 files changed, 8 deletions(-) + +diff --git a/plat/nxp/tools/pbl_ch2.mk b/plat/nxp/tools/pbl_ch2.mk +index afa43520..ff624dd9 100644 +--- a/plat/nxp/tools/pbl_ch2.mk ++++ b/plat/nxp/tools/pbl_ch2.mk +@@ -20,8 +20,6 @@ ifeq ($(RCW),"") + else + # Generate header for bl2.bin + $(Q)$(CST_DIR)/create_hdr_isbc --in ${BUILD_PLAT}/bl2.bin --out ${BUILD_PLAT}/hdr_bl2 ${BL2_INPUT_FILE} +- # Compile create_pbl tool +- ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${PLAT_TOOL_PATH};\ + # Add bl2.bin to RCW + ${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE}\ + -o ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl ;\ +@@ -43,7 +41,6 @@ ifeq ($(RCW),"") + ${Q}echo "Platform ${PLAT} requires rcw file. Please set RCW to point to the right RCW file for boot mode ${BOOT_MODE}" + else + # -a option appends the image for Chassis 3 devices in case of non secure boot +- ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${PLAT_TOOL_PATH}; + ${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE} \ + -o ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl ; + # Swapping of RCW is required for QSPi Chassis 2 devices +diff --git a/plat/nxp/tools/pbl_ch3.mk b/plat/nxp/tools/pbl_ch3.mk +index 944ae3bb..9aa8f635 100644 +--- a/plat/nxp/tools/pbl_ch3.mk ++++ b/plat/nxp/tools/pbl_ch3.mk +@@ -27,9 +27,6 @@ else + # Generate header for bl2.bin + $(Q)$(CST_DIR)/create_hdr_isbc --in ${BUILD_PLAT}/bl2.bin --out ${BUILD_PLAT}/hdr_bl2 ${BL2_INPUT_FILE} + +- # Compile create_pbl tool +- ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${PLAT_TOOL_PATH};\ +- + # Add Block Copy command for bl2.bin to RCW + ${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE}\ + -o ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl -f ${BL2_SRC_OFFSET};\ +@@ -57,8 +54,6 @@ else #SECURE_BOOT + ifeq ($(RCW),"") + ${Q}echo "Platform ${PLAT} requires rcw file. Please set RCW to point to the right RCW file for boot mode ${BOOT_MODE}" + else +- ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" --no-print-directory -C ${PLAT_TOOL_PATH}; +- + # Add Block Copy command and populate boot loc ptrfor bl2.bin to RCW + ${CREATE_PBL} -r ${RCW} -i ${BUILD_PLAT}/bl2.bin -b ${BOOT_MODE} -c ${SOC_NUM} -d ${BL2_BASE} -e ${BL2_BASE} \ + -o ${BUILD_PLAT}/bl2_${BOOT_MODE}.pbl -f ${BL2_SRC_OFFSET}; +-- +2.17.1 + diff --git a/package/boot/uboot-ar71xx/patches/023-musl-compat.patch b/package/boot/uboot-ar71xx/patches/023-musl-compat.patch new file mode 100644 index 00000000000000..1dacc993e7a86a --- /dev/null +++ b/package/boot/uboot-ar71xx/patches/023-musl-compat.patch @@ -0,0 +1,13 @@ +--- a/include/compiler.h 2018-08-29 ++++ b/include/compiler.h 2018-08-29 +@@ -46,6 +46,10 @@ extern int errno; + #ifdef __linux__ + # include + # include ++#ifndef __GLIBC__ ++typedef unsigned long ulong; ++typedef unsigned int uint; ++#endif + #elif defined(__MACH__) || defined(__FreeBSD__) + # include + typedef unsigned long ulong; diff --git a/package/boot/uboot-at91/Makefile b/package/boot/uboot-at91/Makefile index f0a4ba56c25cbe..547b72f8d9b2c6 100644 --- a/package/boot/uboot-at91/Makefile +++ b/package/boot/uboot-at91/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk -PKG_VERSION:=linux4sam_5.8 +PKG_VERSION:=linux4sam_6.0 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/linux4sam/u-boot-at91.git -PKG_SOURCE_VERSION:=59f202622154f82e708a6ca2bf86350a5c1b2d33 +PKG_SOURCE_VERSION:=1e7d2e5973c1fb780e55e28a801c6c574158ac14 include $(INCLUDE_DIR)/u-boot.mk include $(INCLUDE_DIR)/package.mk @@ -26,13 +26,21 @@ endef define U-Boot/at91sam9m10g45ek_nandflash NAME:=AT91SAM9M10G45-EK board (NandFlash) - BUILD_SUBTARGET:=legacy + BUILD_SUBTARGET:=sam9x BUILD_DEVICES:=at91sam9m10g45ek endef define U-Boot/at91sam9x5ek_nandflash NAME:=AT91SAM9X5-EK board (NandFlash) - BUILD_SUBTARGET:=legacy + BUILD_SUBTARGET:=sam9x + BUILD_DEVICES:=at91sam9g15ek at91sam9g25ek \ + at91sam9g35ek at91sam9x25ek \ + at91sam9x35ek +endef + +define U-Boot/at91sam9x5ek_mmc + NAME:=AT91SAM9X5-EK board (SDcard) + BUILD_SUBTARGET:=sam9x BUILD_DEVICES:=at91sam9g15ek at91sam9g25ek \ at91sam9g35ek at91sam9x25ek \ at91sam9x35ek @@ -40,73 +48,74 @@ endef define U-Boot/sama5d3_xplained_nandflash NAME:=SAMA5D3 Xplained board (NandFlash) - BUILD_SUBTARGET:=sama5d3 + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d3_xplained endef define U-Boot/sama5d3_xplained_mmc NAME:=SAMA5D3 Xplained board (SDcard) - BUILD_SUBTARGET:=sama5d3 + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d3_xplained endef define U-Boot/sama5d2_xplained_spiflash NAME:=SAMA5D2 Xplained board (SPI Flash) - BUILD_SUBTARGET:=sama5d2 + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d2_xplained endef define U-Boot/sama5d2_xplained_mmc NAME:=SAMA5D2 Xplained board (SDcard/EMMC) - BUILD_SUBTARGET:=sama5d2 + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d2_xplained endef define U-Boot/sama5d4_xplained_spiflash NAME:=SAMA5D4 Xplained board (SPI Flash) - BUILD_SUBTARGET:=sama5d4 + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d4_xplained endef define U-Boot/sama5d4_xplained_mmc NAME:=SAMA5D4 Xplained board (SDcard) - BUILD_SUBTARGET:=sama5d4 + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d4_xplained endef define U-Boot/sama5d4_xplained_nandflash NAME:=SAMA5D4 Xplained board (NandFlash) - BUILD_SUBTARGET:=sama5d4 + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d4_xplained endef -define U-Boot/sama5d27_som1_ek_mmc - NAME:=SAMA5D27 SOM1 Ek (SDCard) - BUILD_SUBTARGET:=sama5d2 +define U-Boot/sama5d27_som1_ek_mmc1 + NAME:=SAMA5D27 SOM1 Ek (SDCard1) + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d27_som1_ek endef -define U-Boot/sama5d27_som1_ek_spiflash +define U-Boot/sama5d27_som1_ek_qspiflash NAME:=SAMA5D27 SOM1 Ek (QSPI Flash) - BUILD_SUBTARGET:=sama5d2 + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d27_som1_ek endef define U-Boot/sama5d2_ptc_ek_nandflash NAME:=SAMA5D2 PTC Ek (Nand Flash) - BUILD_SUBTARGET:=sama5d2 + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d2_ptc_ek endef define U-Boot/sama5d2_ptc_ek_mmc NAME:=SAMA5D2 PTC Ek (SDCard) - BUILD_SUBTARGET:=sama5d2 + BUILD_SUBTARGET:=sama5 BUILD_DEVICES:=at91-sama5d2_ptc_ek endef UBOOT_TARGETS := \ at91sam9m10g45ek_nandflash \ at91sam9x5ek_nandflash \ + at91sam9x5ek_mmc \ sama5d3_xplained_nandflash \ sama5d3_xplained_mmc \ sama5d2_xplained_mmc \ @@ -114,15 +123,15 @@ UBOOT_TARGETS := \ sama5d4_xplained_mmc \ sama5d4_xplained_spiflash \ sama5d4_xplained_nandflash\ - sama5d27_som1_ek_mmc \ - sama5d27_som1_ek_spiflash \ + sama5d27_som1_ek_mmc1 \ + sama5d27_som1_ek_qspiflash \ sama5d2_ptc_ek_nandflash \ sama5d2_ptc_ek_mmc define Build/Compile +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ CROSS_COMPILE=$(TARGET_CROSS) \ - DTC=$(LINUX_DIR)/scripts/dtc/dtc \ + DTC=$(PKG_BUILD_DIR)/scripts/dtc/dtc \ KCFLAGS="$(filter-out -fstack-protector \ -mfloat-abi=hard, $(TARGET_CFLAGS)) -mfloat-abi=soft" endef diff --git a/package/boot/uboot-at91/patches/001-fix-Wformat-security.patch b/package/boot/uboot-at91/patches/001-fix-Wformat-security.patch new file mode 100644 index 00000000000000..18f9af742c663b --- /dev/null +++ b/package/boot/uboot-at91/patches/001-fix-Wformat-security.patch @@ -0,0 +1,13 @@ +diff --git a/cmd/version.c b/cmd/version.c +index b2fffe9..bcbbeb1 100644 +--- a/cmd/version.c ++++ b/cmd/version.c +@@ -18,7 +18,7 @@ static int do_version(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) + { + char buf[DISPLAY_OPTIONS_BANNER_LENGTH]; + +- printf(display_options_get_banner(false, buf, sizeof(buf))); ++ printf("%s",display_options_get_banner(false, buf, sizeof(buf))); + #ifdef CC_VERSION_STRING + puts(CC_VERSION_STRING "\n"); + #endif diff --git a/package/boot/uboot-envtools/Makefile b/package/boot/uboot-envtools/Makefile index 2f8dd0ae64ffb2..1c6b7897161404 100644 --- a/package/boot/uboot-envtools/Makefile +++ b/package/boot/uboot-envtools/Makefile @@ -9,16 +9,16 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uboot-envtools PKG_DISTNAME:=u-boot -PKG_VERSION:=2018.03 -PKG_RELEASE:=1 +PKG_VERSION:=2019.07 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_SUBDIR:=$(PKG_DISTNAME)-$(PKG_VERSION) PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_DISTNAME)-$(PKG_VERSION) PKG_SOURCE_URL:=https://git.denx.de/u-boot.git -PKG_SOURCE_VERSION:=f95ab1fb6e37f0601f397091bb011edf7a98b890 -PKG_MIRROR_HASH:=b50d8b6fe0d90b92c8c147457b1b4c2ed1cdb03191085cfc57fdad77c0bfffab +PKG_SOURCE_VERSION:=e5aee22e4be75e75a854ab64503fc80598bc2004 +PKG_MIRROR_HASH:=58c1ecaf901b6bf65c5e872b5449b642694ae5acebf61f91f0d4bc20b4c654b7 PKG_BUILD_DEPENDS:=fstools @@ -51,16 +51,11 @@ define Build/Configure touch $(PKG_BUILD_DIR)/include/generated/autoconf.h endef -TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include - -define Build/Compile - $(MAKE) -C $(PKG_BUILD_DIR) \ - CROSS_COMPILE="$(TARGET_CROSS)" \ - TARGET_CFLAGS="$(TARGET_CFLAGS)" \ - HOSTLDFLAGS= \ - no-dot-config-targets=envtools \ - envtools -endef +MAKE_FLAGS += \ + TARGET_CFLAGS="$(TARGET_CFLAGS)" \ + TARGET_LDFLAGS="$(TARGET_LDFLAGS)" \ + no-dot-config-targets=envtools \ + envtools define Package/uboot-envtools/conffiles /etc/config/ubootenv diff --git a/package/boot/uboot-envtools/files/apm821xx b/package/boot/uboot-envtools/files/apm821xx new file mode 100644 index 00000000000000..6bcc3ad62f122e --- /dev/null +++ b/package/boot/uboot-envtools/files/apm821xx @@ -0,0 +1,29 @@ +#!/bin/sh + +[ -e /etc/config/ubootenv ] && exit 0 + +touch /etc/config/ubootenv + +. /lib/uboot-envtools.sh +. /lib/functions.sh + +board=$(board_name) + +case "$board" in +meraki,mr24) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x4000" "0x4000" "4" + ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x4000" "0x4000" "4" + ;; +meraki,mx60) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" "4" + ;; +netgear,wndap620|\ +netgear,wndap660) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x4000" "0x4000" "4" + ;; +esac + +config_load ubootenv +config_foreach ubootenv_add_app_config ubootenv + +exit 0 diff --git a/package/boot/uboot-envtools/files/ar71xx b/package/boot/uboot-envtools/files/ar71xx index 2d9fcea1ac2f0b..9625c6bdd11556 100644 --- a/package/boot/uboot-envtools/files/ar71xx +++ b/package/boot/uboot-envtools/files/ar71xx @@ -28,6 +28,7 @@ cpe830|\ cpe870|\ cr3000|\ cr5000|\ +dw33d|\ e1700ac-v2|\ e600g-v2|\ e600gac-v2|\ @@ -57,7 +58,10 @@ sr3200|\ t830|\ tube2h|\ wam250|\ -wndr3700|\ +wnr1000-v2|\ +wnr2000-v3|\ +wnr2200|\ +wnr612-v2|\ xd3200) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000" ;; @@ -81,6 +85,11 @@ dr342|\ dr531) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0xf800" "0x10000" ;; +gl-ar150|\ +gl-domino|\ +gl-mifi) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x8000" "0x10000" + ;; rambutan) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" ubootenv_add_uci_config "/dev/mtd1" "0x100000" "0x20000" "0x20000" @@ -91,6 +100,12 @@ qihoo-c301) wi2a-ac200i) ubootenv_add_uci_config "/dev/mtd4" "0x0" "0x8000" "0x10000" ;; +wndr3700) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x10000" + ;; +wndr4300) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x20000" + ;; esac config_load ubootenv diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 new file mode 100644 index 00000000000000..15bd9ffb6eeefa --- /dev/null +++ b/package/boot/uboot-envtools/files/ath79 @@ -0,0 +1,66 @@ +#!/bin/sh +# +# Copyright (C) 2011-2014 OpenWrt.org +# + +[ -e /etc/config/ubootenv ] && exit 0 + +touch /etc/config/ubootenv + +. /lib/uboot-envtools.sh +. /lib/functions.sh + +board=$(board_name) + +case "$board" in +alfa-network,ap121f|\ +buffalo,bhr-4grv2|\ +engenius,ecb1750|\ +etactica,eg200|\ +glinet,gl-ar300m-lite|\ +glinet,gl-ar300m-nand|\ +glinet,gl-ar300m-nor|\ +glinet,gl-ar300m16|\ +glinet,gl-ar750s-nor|\ +glinet,gl-ar750s-nor-nand|\ +librerouter,librerouter-v1|\ +netgear,ex6400|\ +netgear,ex7300|\ +netgear,wndr4300-v2|\ +netgear,wndr4500-v3|\ +netgear,wnr1000-v2|\ +netgear,wnr2000-v3|\ +netgear,wnr2200-8m|\ +netgear,wnr2200-16m|\ +netgear,wnr612-v2|\ +ocedo,koala|\ +ocedo,raccoon|\ +openmesh,om5p-ac-v2|\ +yuncore,a770|\ +yuncore,a782|\ +yuncore,xd4200) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000" + ;; +buffalo,wzr-hp-ag300h) + ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000" "0x10000" + ;; +glinet,gl-ar150) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x8000" "0x10000" + ;; +netgear,wndr3700|\ +netgear,wndr3700-v2) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x10000" + ;; +netgear,wndr3700-v4|\ +netgear,wndr4300) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x20000" + ;; +qihoo,c301) + ubootenv_add_uci_config "/dev/mtd9" "0x0" "0x10000" "0x10000" + ;; +esac + +config_load ubootenv +config_foreach ubootenv_add_app_config ubootenv + +exit 0 diff --git a/package/boot/uboot-envtools/files/imx6 b/package/boot/uboot-envtools/files/imx6 index fec8ce0aa4f558..330efb2833562b 100644 --- a/package/boot/uboot-envtools/files/imx6 +++ b/package/boot/uboot-envtools/files/imx6 @@ -7,12 +7,16 @@ touch /etc/config/ubootenv +. /lib/imx6.sh . /lib/uboot-envtools.sh . /lib/functions.sh board=$(board_name) case "$board" in +apalis*) + ubootenv_add_uci_config $(bootdev_from_uuid)boot0 -0x2200 0x2000 0x200 10 + ;; *gw5*) if [ -c /dev/mtd1 ]; then # board boots from NAND @@ -20,8 +24,8 @@ case "$board" in ubootenv_add_uci_config /dev/mtd1 0x80000 0x20000 0x40000 else # board boots from microSD - ubootenv_add_uci_config /dev/mmcblk0 0xb1400 0x20000 0x20000 - ubootenv_add_uci_config /dev/mmcblk0 0xd1400 0x20000 0x20000 + ubootenv_add_uci_config /dev/mmcblk0 0xb1400 0x20000 + ubootenv_add_uci_config /dev/mmcblk0 0xd1400 0x20000 fi ;; wandboard) diff --git a/package/boot/uboot-envtools/files/ipq40xx b/package/boot/uboot-envtools/files/ipq40xx index d475e566299416..7bcad00b010bfe 100644 --- a/package/boot/uboot-envtools/files/ipq40xx +++ b/package/boot/uboot-envtools/files/ipq40xx @@ -31,10 +31,21 @@ ubootenv_mtdinfo () { } case "$board" in +alfa-network,ap120c-ac |\ +glinet,gl-b1300 |\ openmesh,a42 |\ openmesh,a62) ubootenv_add_uci_config "/dev/mtd5" "0x0" "0x10000" "0x10000" ;; +linksys,ea6350v3) + ubootenv_add_uci_config "/dev/mtd7" "0x0" "0x20000" "0x20000" + ;; +linksys,ea8300) + ubootenv_add_uci_config "/dev/mtd7" "0x0" "0x40000" "0x20000" + ;; +zyxel,nbg6617) + ubootenv_add_uci_config "/dev/mtd6" "0x0" "0x10000" "0x10000" + ;; esac config_load ubootenv diff --git a/package/boot/uboot-envtools/files/ipq806x b/package/boot/uboot-envtools/files/ipq806x index 4618aac892d98b..c27bea71c15676 100644 --- a/package/boot/uboot-envtools/files/ipq806x +++ b/package/boot/uboot-envtools/files/ipq806x @@ -34,6 +34,9 @@ case "$board" in linksys,ea8500) ubootenv_add_uci_config "/dev/mtd10" "0x0" "0x20000" "0x20000" ;; +netgear,r7800) + ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x040000" "0x20000" + ;; qcom,ipq8064-ap148 |\ qcom,ipq8064-db149) ubootenv_add_uci_config $(ubootenv_mtdinfo) diff --git a/package/boot/uboot-envtools/files/kirkwood b/package/boot/uboot-envtools/files/kirkwood index 16123846cc01c3..b5f7ddccb754a1 100644 --- a/package/boot/uboot-envtools/files/kirkwood +++ b/package/boot/uboot-envtools/files/kirkwood @@ -15,6 +15,7 @@ board=$(board_name) case "$board" in cloudengines,pogoe02|\ cloudengines,pogoplugv4|\ +iom,ix2-200|\ linksys,viper|\ raidsonic,ib-nas62x0|\ seagate,dockstar|\ diff --git a/package/boot/uboot-envtools/files/layerscape b/package/boot/uboot-envtools/files/layerscape new file mode 100644 index 00000000000000..732f1484542b7c --- /dev/null +++ b/package/boot/uboot-envtools/files/layerscape @@ -0,0 +1,25 @@ +#!/bin/sh +# +# Copyright (C) 2016 LEDE +# + +[ -f /etc/config/ubootenv ] && exit 0 + +touch /etc/config/ubootenv + +. /lib/uboot-envtools.sh +. /lib/functions.sh + +board=$(board_name) + +case "$board" in + traverse,ls1043v | \ + traverse,ls1043s) + ubootenv_add_uci_config "/dev/mtd1" "0x40000" "0x2000" "0x20000" + ;; +esac + +config_load ubootenv +config_foreach ubootenv_add_app_config ubootenv + +exit 0 diff --git a/package/boot/uboot-envtools/files/mpc85xx b/package/boot/uboot-envtools/files/mpc85xx new file mode 100644 index 00000000000000..d219b57cb18569 --- /dev/null +++ b/package/boot/uboot-envtools/files/mpc85xx @@ -0,0 +1,22 @@ +#!/bin/sh + +[ -e /etc/config/ubootenv ] && exit 0 + +touch /etc/config/ubootenv + +. /lib/uboot-envtools.sh +. /lib/functions.sh + +board=$(board_name) + +case "$board" in +ocedo,panda) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" + ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x20000" "0x20000" + ;; +esac + +config_load ubootenv +config_foreach ubootenv_add_app_config ubootenv + +exit 0 diff --git a/package/boot/uboot-envtools/files/mvebu b/package/boot/uboot-envtools/files/mvebu index 7d16a59666b0b1..7902384a37a4dd 100644 --- a/package/boot/uboot-envtools/files/mvebu +++ b/package/boot/uboot-envtools/files/mvebu @@ -14,25 +14,31 @@ touch /etc/config/ubootenv board=$(board_name) case "$board" in -armada-385-linksys-caiman|\ -armada-385-linksys-cobra|\ -armada-385-linksys-shelby) - ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x40000" - ;; -armada-385-linksys-rango|\ -armada-385-linksys-venom) - ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" - ;; -armada-385-turris-omnia) +cznic,turris-omnia) ubootenv_add_uci_config "/dev/mtd0" "0xC0000" "0x10000" "0x40000" ;; -armada-xp-linksys-mamba) - ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x20000" - ;; globalscale,espressobin|\ +globalscale,espressobin-emmc|\ +globalscale,espressobin-v7|\ +globalscale,espressobin-v7-emmc|\ marvell,armada8040-mcbin) ubootenv_add_uci_config "/dev/mtd0" "0x3f0000" "0x10000" "0x10000" "1" ;; +linksys,caiman|\ +linksys,cobra|\ +linksys,shelby) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x40000" + ;; +linksys,mamba) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x20000" + ;; +linksys,rango|\ +linksys,venom) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" + ;; +methode,udpu) + ubootenv_add_uci_config "/dev/mtd0" "0x180000" "0x10000" "0x10000" + ;; esac config_load ubootenv diff --git a/package/boot/uboot-envtools/files/mxs b/package/boot/uboot-envtools/files/mxs index 37d3c96ed47dd0..ecfb5de1621ff7 100644 --- a/package/boot/uboot-envtools/files/mxs +++ b/package/boot/uboot-envtools/files/mxs @@ -13,7 +13,7 @@ touch /etc/config/ubootenv board=$(board_name) case "$board" in -duckbill) +i2se,duckbill) ubootenv_add_uci_config "/dev/mmcblk0" "0x20000" "0x20000" ubootenv_add_uci_config "/dev/mmcblk0" "0x40000" "0x20000" ;; diff --git a/package/boot/uboot-envtools/files/oxnas b/package/boot/uboot-envtools/files/oxnas index 70b0f1663a8f18..4427bb50c97859 100644 --- a/package/boot/uboot-envtools/files/oxnas +++ b/package/boot/uboot-envtools/files/oxnas @@ -13,11 +13,12 @@ touch /etc/config/ubootenv board=$(board_name) case "$board" in -akitio|\ -kd20|\ -stg212) - ubootenv_add_uci_config "/dev/ubi0_0" "0x0" "0x4000" "0x1F000" "1" - ubootenv_add_uci_config "/dev/ubi0_1" "0x0" "0x4000" "0x1F000" "1" +"cloudengines,pogoplug"* | \ +"shuttle,kd20") + ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x2000" "0x2000" "1" + ;; +"mitrastar,stg-212") + ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x20000" "0x20000" "1" ;; esac diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index f992f41bc89fde..ade55dd1cb1426 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -14,24 +14,27 @@ board=$(board_name) case "$board" in alfa-network,ac1200rm|\ -alfa-network,awusfree1) +alfa-network,awusfree1|\ +alfa-network,quad-e4g|\ +alfa-network,r36m-e4g|\ +alfa-network,tube-e4g) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1000" ;; -all0239-3g|\ -all0256n-4M|\ -all0256n-8M|\ -all5002) +allnet,all0256n-4m|\ +allnet,all0256n-8m|\ +allnet,all5002) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000" ;; -linkits7688|\ -miwifi-nano|\ -sk-wb8|\ -wsr-1166|\ -wsr-600|\ -zbt-wg2626) +buffalo,wsr-1166dhp|\ +buffalo,wsr-600dhp|\ +mediatek,linkit-smart-7688|\ +samknows,whitebox-v8|\ +xiaomi,miwifi-nano|\ +zbtlink,zbt-wg2626) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000" ;; -mir3g) +xiaomi,mir3p|\ +xiaomi,mir3g) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x20000" ;; esac diff --git a/package/boot/uboot-envtools/files/uboot-envtools.sh b/package/boot/uboot-envtools/files/uboot-envtools.sh index e21b28367751fd..9218bc4e391297 100644 --- a/package/boot/uboot-envtools/files/uboot-envtools.sh +++ b/package/boot/uboot-envtools/files/uboot-envtools.sh @@ -31,6 +31,6 @@ ubootenv_add_app_config() { config_get envsize "$1" envsize config_get secsize "$1" secsize config_get numsec "$1" numsec - echo "$dev $offset $envsize $secsize $numsec" >>/etc/fw_env.config + grep -q "^[[:space:]]*${dev}[[:space:]]*${offset}" /etc/fw_env.config || echo "$dev $offset $envsize $secsize $numsec" >>/etc/fw_env.config } diff --git a/package/boot/uboot-envtools/patches/001-compile.patch b/package/boot/uboot-envtools/patches/001-compile.patch index f7ec9130d6f49a..5413aa4a415383 100644 --- a/package/boot/uboot-envtools/patches/001-compile.patch +++ b/package/boot/uboot-envtools/patches/001-compile.patch @@ -1,13 +1,16 @@ --- a/tools/env/Makefile +++ b/tools/env/Makefile -@@ -10,6 +10,10 @@ +@@ -8,6 +8,13 @@ # with "CC" here for the maximum code reuse of scripts/Makefile.host. override HOSTCC = $(CC) +ifneq ($(TARGET_CFLAGS),) +HOSTCFLAGS = $(TARGET_CFLAGS) +endif ++ifneq ($(TARGET_LDFLAGS),) ++HOSTLDFLAGS = $(TARGET_LDFLAGS) ++endif + # Compile for a hosted environment on the target - HOST_EXTRACFLAGS = $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \ - -idirafter $(srctree)/tools/env \ + HOST_EXTRACFLAGS = -I$(srctree)/tools \ + $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \ diff --git a/package/boot/uboot-fritz4040/Makefile b/package/boot/uboot-fritz4040/Makefile index 77d6fdc3b8bba3..21305817656e40 100644 --- a/package/boot/uboot-fritz4040/Makefile +++ b/package/boot/uboot-fritz4040/Makefile @@ -10,9 +10,9 @@ include $(INCLUDE_DIR)/kernel.mk PKG_SOURCE_URL:=https://github.com/chunkeey/FritzBox-4040-UBOOT PKG_SOURCE_PROTO:=git -PKG_SOURCE_VERSION:=6946ebbaf7b12a4a092d763c8f0c87a25984f103 -PKG_SOURCE_DATE:=2017-01-29 -PKG_MIRROR_HASH:=5c2394f51a083dca2a2bf9cb36fa717f252112fc792c9eeae64f6383ad08987b +PKG_SOURCE_VERSION:=f92be9d783b1210c020d5d6129e210a94bb7e290 +PKG_SOURCE_DATE:=2019-10-19 +PKG_MIRROR_HASH:=e40a7f624b1758b276f81c765ef1da568c595b8bd54568b9cceca7d170ebc612 PKG_RELEASE:=1 @@ -21,11 +21,29 @@ include $(INCLUDE_DIR)/package.mk define U-Boot/Default BUILD_TARGET:=ipq40xx - UBOOT_IMAGE:=uboot-fritz4040.bin + BUILD_SUBTARGET:=generic + UBOOT_BOARD:=$(1) + UBOOT_IMAGE:=uboot-$(1).bin +endef + +define U-Boot/fritz1200 + NAME:=FritzRepeater 1200 + BUILD_DEVICES:=avm_fritzrepeater-1200 +endef + +define U-Boot/fritz3000 + NAME:=FritzRepeater 3000 + BUILD_DEVICES:=avm_fritzrepeater-3000 endef define U-Boot/fritz4040 NAME:=FritzBox 4040 + BUILD_DEVICES:=avm_fritzbox-4040 +endef + +define U-Boot/fritz7530 + NAME:=FritzBox 7530 + BUILD_DEVICES:=avm_fritzbox-7530 endef UBOOT_CONFIGURE_VARS += USE_PRIVATE_LIBGCC=yes @@ -34,22 +52,26 @@ export DTC define Build/Configure $(Build/Configure/U-Boot) - $(HOSTCC) -o $(PKG_BUILD_DIR)/fritz/lzma2eva $(PKG_BUILD_DIR)/fritz/src/lzma2eva.c -lz - $(HOSTCC) -o $(PKG_BUILD_DIR)/fritz/tichksum $(PKG_BUILD_DIR)/fritz/src/tichksum.c + $(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $(PKG_BUILD_DIR)/fritz/lzma2eva $(PKG_BUILD_DIR)/fritz/src/lzma2eva.c -lz + $(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $(PKG_BUILD_DIR)/fritz/tichksum $(PKG_BUILD_DIR)/fritz/src/tichksum.c ln -sf $(STAGING_DIR_HOST)/bin/lzma $(PKG_BUILD_DIR)/fritz - ln -sf compiler-gcc5.h $(PKG_BUILD_DIR)/include/linux/compiler-gcc7.h endef define Build/Compile $(Build/Compile/U-Boot) - (cd $(PKG_BUILD_DIR); ./fritz/fritzcreator.sh;) + (cd $(PKG_BUILD_DIR); ./fritz/fritzcreator.sh $(UBOOT_BOARD);) +endef + +define Build/InstallDev + $(INSTALL_DIR) $(STAGING_DIR_IMAGE) + $(CP) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(UBOOT_IMAGE) endef define Package/u-boot/install $(Package/u-boot/install/default) - $(INSTALL_BIN) ./files/upload-to-f4040.sh $(1)/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/upload-to-f4040.sh $(1)/ endef -UBOOT_TARGETS := fritz4040 +UBOOT_TARGETS := fritz1200 fritz3000 fritz4040 fritz7530 $(eval $(call BuildPackage/U-Boot)) diff --git a/package/boot/uboot-fritz4040/files/upload-to-f4040.sh b/package/boot/uboot-fritz4040/files/upload-to-f4040.sh deleted file mode 100755 index 64f493190ee9c3..00000000000000 --- a/package/boot/uboot-fritz4040/files/upload-to-f4040.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -die() { - echo $1 - exit 1 -} - -FRITZBOX='192.168.178.1' -USER='adam2' -PASSWD='adam2' -FILE='uboot-fritz4040.bin' - -ping -q -4 -w 1 -c 1 "$FRITZBOX" &> /dev/null || die "Fritzbox at $FRITZBOX is not reachable. aborting" - -cat << EOS - -This will take ages (2 minutes)! If you want a -status bar: Attach a serial to the device and look there. - -Note: If this fails, you need to use AVM\' recover -utility to get your box back. However this step -should not damage your box.... - -Also it doesn't terminate.. :/ - -(Note: Make sure that you connected the router on -the yellow LAN ports and not the blue WAN). - -EOS - -ftp -n -4 "$FRITZBOX" << END_SCRIPT -quote USER $USER -quote PASS $PASSWD -quote MEDIA FLSH -binary -passive -put $FILE mtd1 -quote check mtd1 -bye -END_SCRIPT -exit 0 diff --git a/package/boot/uboot-fritz4040/patches/100-private-libgcc.patch b/package/boot/uboot-fritz4040/patches/100-private-libgcc.patch deleted file mode 100644 index 6fec563da4a97e..00000000000000 --- a/package/boot/uboot-fritz4040/patches/100-private-libgcc.patch +++ /dev/null @@ -1,274 +0,0 @@ ---- a/arch/arm/lib/Makefile -+++ b/arch/arm/lib/Makefile -@@ -26,7 +26,6 @@ include $(TOPDIR)/config.mk - LIB = $(obj)lib$(ARCH).o - LIBGCC = $(obj)libgcc.o - --ifndef CONFIG_SPL_BUILD - GLSOBJS += _ashldi3.o - GLSOBJS += _ashrdi3.o - GLSOBJS += _divsi3.o -@@ -34,9 +33,11 @@ GLSOBJS += _lshrdi3.o - GLSOBJS += _modsi3.o - GLSOBJS += _udivsi3.o - GLSOBJS += _umodsi3.o -+GLSOBJS += uldivmod.o - - GLCOBJS += div0.o - -+ifndef CONFIG_SPL_BUILD - COBJS-y += board.o - COBJS-y += bootm.o - COBJS-$(CONFIG_SYS_L2_PL310) += cache-pl310.o ---- /dev/null -+++ b/arch/arm/lib/uldivmod.S -@@ -0,0 +1,249 @@ -+/* -+ * Copyright 2010, Google Inc. -+ * -+ * Brought in from coreboot uldivmod.S -+ * -+ * SPDX-License-Identifier: GPL-2.0 -+ */ -+ -+#include -+#include -+ -+/* -+ * A, Q = r0 + (r1 << 32) -+ * B, R = r2 + (r3 << 32) -+ * A / B = Q ... R -+ */ -+ -+#define ARM(x...) x -+#define THUMB(x...) -+ -+A_0 .req r0 -+A_1 .req r1 -+B_0 .req r2 -+B_1 .req r3 -+C_0 .req r4 -+C_1 .req r5 -+D_0 .req r6 -+D_1 .req r7 -+ -+Q_0 .req r0 -+Q_1 .req r1 -+R_0 .req r2 -+R_1 .req r3 -+ -+THUMB( -+TMP .req r8 -+) -+ -+.pushsection .text.__aeabi_uldivmod, "ax" -+ENTRY(__aeabi_uldivmod) -+ -+ stmfd sp!, {r4, r5, r6, r7, THUMB(TMP,) lr} -+ @ Test if B == 0 -+ orrs ip, B_0, B_1 @ Z set -> B == 0 -+ beq L_div_by_0 -+ @ Test if B is power of 2: (B & (B - 1)) == 0 -+ subs C_0, B_0, #1 -+ sbc C_1, B_1, #0 -+ tst C_0, B_0 -+ tsteq B_1, C_1 -+ beq L_pow2 -+ @ Test if A_1 == B_1 == 0 -+ orrs ip, A_1, B_1 -+ beq L_div_32_32 -+ -+L_div_64_64: -+/* CLZ only exists in ARM architecture version 5 and above. */ -+#ifdef HAVE_CLZ -+ mov C_0, #1 -+ mov C_1, #0 -+ @ D_0 = clz A -+ teq A_1, #0 -+ clz D_0, A_1 -+ clzeq ip, A_0 -+ addeq D_0, D_0, ip -+ @ D_1 = clz B -+ teq B_1, #0 -+ clz D_1, B_1 -+ clzeq ip, B_0 -+ addeq D_1, D_1, ip -+ @ if clz B - clz A > 0 -+ subs D_0, D_1, D_0 -+ bls L_done_shift -+ @ B <<= (clz B - clz A) -+ subs D_1, D_0, #32 -+ rsb ip, D_0, #32 -+ movmi B_1, B_1, lsl D_0 -+ARM( orrmi B_1, B_1, B_0, lsr ip ) -+THUMB( lsrmi TMP, B_0, ip ) -+THUMB( orrmi B_1, B_1, TMP ) -+ movpl B_1, B_0, lsl D_1 -+ mov B_0, B_0, lsl D_0 -+ @ C = 1 << (clz B - clz A) -+ movmi C_1, C_1, lsl D_0 -+ARM( orrmi C_1, C_1, C_0, lsr ip ) -+THUMB( lsrmi TMP, C_0, ip ) -+THUMB( orrmi C_1, C_1, TMP ) -+ movpl C_1, C_0, lsl D_1 -+ mov C_0, C_0, lsl D_0 -+L_done_shift: -+ mov D_0, #0 -+ mov D_1, #0 -+ @ C: current bit; D: result -+#else -+ @ C: current bit; D: result -+ mov C_0, #1 -+ mov C_1, #0 -+ mov D_0, #0 -+ mov D_1, #0 -+L_lsl_4: -+ cmp B_1, #0x10000000 -+ cmpcc B_1, A_1 -+ cmpeq B_0, A_0 -+ bcs L_lsl_1 -+ @ B <<= 4 -+ mov B_1, B_1, lsl #4 -+ orr B_1, B_1, B_0, lsr #28 -+ mov B_0, B_0, lsl #4 -+ @ C <<= 4 -+ mov C_1, C_1, lsl #4 -+ orr C_1, C_1, C_0, lsr #28 -+ mov C_0, C_0, lsl #4 -+ b L_lsl_4 -+L_lsl_1: -+ cmp B_1, #0x80000000 -+ cmpcc B_1, A_1 -+ cmpeq B_0, A_0 -+ bcs L_subtract -+ @ B <<= 1 -+ mov B_1, B_1, lsl #1 -+ orr B_1, B_1, B_0, lsr #31 -+ mov B_0, B_0, lsl #1 -+ @ C <<= 1 -+ mov C_1, C_1, lsl #1 -+ orr C_1, C_1, C_0, lsr #31 -+ mov C_0, C_0, lsl #1 -+ b L_lsl_1 -+#endif -+L_subtract: -+ @ if A >= B -+ cmp A_1, B_1 -+ cmpeq A_0, B_0 -+ bcc L_update -+ @ A -= B -+ subs A_0, A_0, B_0 -+ sbc A_1, A_1, B_1 -+ @ D |= C -+ orr D_0, D_0, C_0 -+ orr D_1, D_1, C_1 -+L_update: -+ @ if A == 0: break -+ orrs ip, A_1, A_0 -+ beq L_exit -+ @ C >>= 1 -+ movs C_1, C_1, lsr #1 -+ movs C_0, C_0, rrx -+ @ if C == 0: break -+ orrs ip, C_1, C_0 -+ beq L_exit -+ @ B >>= 1 -+ movs B_1, B_1, lsr #1 -+ mov B_0, B_0, rrx -+ b L_subtract -+L_exit: -+ @ Note: A, B & Q, R are aliases -+ mov R_0, A_0 -+ mov R_1, A_1 -+ mov Q_0, D_0 -+ mov Q_1, D_1 -+ ldmfd sp!, {r4, r5, r6, r7, THUMB(TMP,) pc} -+ -+L_div_32_32: -+ @ Note: A_0 & r0 are aliases -+ @ Q_1 r1 -+ mov r1, B_0 -+ bl __aeabi_uidivmod -+ mov R_0, r1 -+ mov R_1, #0 -+ mov Q_1, #0 -+ ldmfd sp!, {r4, r5, r6, r7, THUMB(TMP,) pc} -+ -+L_pow2: -+#ifdef HAVE_CLZ -+ @ Note: A, B and Q, R are aliases -+ @ R = A & (B - 1) -+ and C_0, A_0, C_0 -+ and C_1, A_1, C_1 -+ @ Q = A >> log2(B) -+ @ Note: B must not be 0 here! -+ clz D_0, B_0 -+ add D_1, D_0, #1 -+ rsbs D_0, D_0, #31 -+ bpl L_1 -+ clz D_0, B_1 -+ rsb D_0, D_0, #31 -+ mov A_0, A_1, lsr D_0 -+ add D_0, D_0, #32 -+L_1: -+ movpl A_0, A_0, lsr D_0 -+ARM( orrpl A_0, A_0, A_1, lsl D_1 ) -+THUMB( lslpl TMP, A_1, D_1 ) -+THUMB( orrpl A_0, A_0, TMP ) -+ mov A_1, A_1, lsr D_0 -+ @ Mov back C to R -+ mov R_0, C_0 -+ mov R_1, C_1 -+ ldmfd sp!, {r4, r5, r6, r7, THUMB(TMP,) pc} -+#else -+ @ Note: A, B and Q, R are aliases -+ @ R = A & (B - 1) -+ and C_0, A_0, C_0 -+ and C_1, A_1, C_1 -+ @ Q = A >> log2(B) -+ @ Note: B must not be 0 here! -+ @ Count the leading zeroes in B. -+ mov D_0, #0 -+ orrs B_0, B_0, B_0 -+ @ If B is greater than 1 << 31, divide A and B by 1 << 32. -+ moveq A_0, A_1 -+ moveq A_1, #0 -+ moveq B_0, B_1 -+ @ Count the remaining leading zeroes in B. -+ movs B_1, B_0, lsl #16 -+ addeq D_0, #16 -+ moveq B_0, B_0, lsr #16 -+ tst B_0, #0xff -+ addeq D_0, #8 -+ moveq B_0, B_0, lsr #8 -+ tst B_0, #0xf -+ addeq D_0, #4 -+ moveq B_0, B_0, lsr #4 -+ tst B_0, #0x3 -+ addeq D_0, #2 -+ moveq B_0, B_0, lsr #2 -+ tst B_0, #0x1 -+ addeq D_0, #1 -+ @ Shift A to the right by the appropriate amount. -+ rsb D_1, D_0, #32 -+ mov Q_0, A_0, lsr D_0 -+ ARM( orr Q_0, Q_0, A_1, lsl D_1 ) -+ THUMB( lsl A_1, D_1 ) -+ THUMB( orr Q_0, A_1 ) -+ mov Q_1, A_1, lsr D_0 -+ @ Move C to R -+ mov R_0, C_0 -+ mov R_1, C_1 -+ ldmfd sp!, {r4, r5, r6, r7, THUMB(TMP,) pc} -+#endif -+ -+L_div_by_0: -+ bl __div0 -+ @ As wrong as it could be -+ mov Q_0, #0 -+ mov Q_1, #0 -+ mov R_0, #0 -+ mov R_1, #0 -+ ldmfd sp!, {r4, r5, r6, r7, THUMB(TMP,) pc} -+ENDPROC(__aeabi_uldivmod) -+.popsection diff --git a/package/boot/uboot-fritz4040/patches/110-portability.patch b/package/boot/uboot-fritz4040/patches/110-portability.patch deleted file mode 100644 index 08ab88912477b0..00000000000000 --- a/package/boot/uboot-fritz4040/patches/110-portability.patch +++ /dev/null @@ -1,32 +0,0 @@ -Index: u-boot-2017-01-29-6946ebba/fritz/fritzcreator.sh -=================================================================== ---- u-boot-2017-01-29-6946ebba.orig/fritz/fritzcreator.sh -+++ u-boot-2017-01-29-6946ebba/fritz/fritzcreator.sh -@@ -1,4 +1,4 @@ --#!/bin/sh -xe -+#!/bin/bash -xe - - # A helpful - # -@@ -11,6 +11,7 @@ UBOOT_FRITZ4040="uboot-fritz4040.bin" - FRITZ_DTS="fritz/fritz4040.dts" - FRITZ_DTB="fritz4040.dtb" - UBOOT_LOADADDR=0x841FFFF8 -+DTC="${DTC:-dtc}" - - rm -f "$UBOOT_FRITZ4040" - -@@ -44,11 +45,11 @@ printf "\x00\x00\x00\xea\xf8\x01\x33\xc4 - cat "$UBOOT_BIN" >> "$UBOOT_FRITZ4040" - - # Pad file to 1M --dd if="$UBOOT_FRITZ4040" of="$UBOOT_FRITZ4040.new" bs=1M count=1 conv=sync -+dd if="$UBOOT_FRITZ4040" of="$UBOOT_FRITZ4040.new" bs=1024k count=1 conv=sync - mv "$UBOOT_FRITZ4040.new" "$UBOOT_FRITZ4040" - - # Compile DTS --dtc "$FRITZ_DTS" -o "$FRITZ_DTB" --space 49152 -+$DTC "$FRITZ_DTS" -o "$FRITZ_DTB" --space 49152 - - # Append the compiled DTBs - cat "$FRITZ_DTB" "$FRITZ_DTB" "$FRITZ_DTB" "$FRITZ_DTB" >> $UBOOT_FRITZ4040 diff --git a/package/boot/uboot-imx6/Makefile b/package/boot/uboot-imx6/Makefile index 8d422758dd8037..193a35d27cb0c4 100644 --- a/package/boot/uboot-imx6/Makefile +++ b/package/boot/uboot-imx6/Makefile @@ -7,10 +7,10 @@ include $(TOPDIR)/rules.mk -PKG_VERSION:=2014.04 +PKG_VERSION:=2019.04 PKG_RELEASE:=1 -PKG_HASH:=7b6444bd23eb61068c43bd1d44ec7e7bfdbce5cadeca20c833eee186b4d3fd31 +PKG_HASH:=76b7772d156b3ddd7644c8a1736081e55b78828537ff714065d21dbade229bef include $(INCLUDE_DIR)/u-boot.mk include $(INCLUDE_DIR)/package.mk @@ -20,7 +20,21 @@ define U-Boot/Default UBOOT_IMAGE:=u-boot.imx endef -define U-Boot/mx6qsabresd +define U-Boot/apalis_imx6 + NAME:=Toradex Apalis + UBOOT_IMAGE:=SPL u-boot.img u-boot-with-spl.imx + UBOOT_MAKE_FLAGS:=SPL u-boot.img u-boot-with-spl.imx +endef + +define U-Boot/mx6cuboxi + NAME:=SolidRun Cubox-i boards + UBOOT_IMAGE:=SPL u-boot.img + UBOOT_MAKE_FLAGS:=SPL u-boot.img + BUILD_DEVICES:=cubox-i + HIDDEN:=1 +endef + +define U-Boot/mx6sabresd NAME:=SABRE i.MX6Quad board endef @@ -48,31 +62,30 @@ define U-Boot/nitrogen6s1g NAME:=Nitrogen6x i.MX6Solo 1GB board endef -define U-Boot/wandboard_dl - NAME:=Wandboard Dual Lite - BUILD_DEVICES:=wandboard -endef - -define U-Boot/wandboard_quad - NAME:=Wandboard Quad - BUILD_DEVICES:=wandboard -endef - -define U-Boot/wandboard_solo - NAME:=Wandboard Solo +define U-Boot/wandboard + NAME:=Wandboard Dual Lite/Quad/Solo BUILD_DEVICES:=wandboard endef UBOOT_TARGETS := \ - mx6qsabresd \ + apalis_imx6 \ + mx6cuboxi \ + mx6sabresd \ nitrogen6dl \ nitrogen6dl2g \ nitrogen6q \ nitrogen6q2g \ nitrogen6s \ nitrogen6s1g \ - wandboard_dl \ - wandboard_quad \ - wandboard_solo + wandboard + +UBOOT_MAKE_FLAGS += u-boot.imx + +define Build/InstallDev + $(INSTALL_DIR) $(STAGING_DIR_IMAGE) + $(foreach img,$(UBOOT_IMAGE), \ + $(CP) $(PKG_BUILD_DIR)/$(img) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-$(img); \ + ) +endef $(eval $(call BuildPackage/U-Boot)) diff --git a/package/boot/uboot-imx6/patches/0001-imx6-apalis-Make-the-boot-process-more-generic.patch b/package/boot/uboot-imx6/patches/0001-imx6-apalis-Make-the-boot-process-more-generic.patch new file mode 100644 index 00000000000000..4de8ede39f74ec --- /dev/null +++ b/package/boot/uboot-imx6/patches/0001-imx6-apalis-Make-the-boot-process-more-generic.patch @@ -0,0 +1,123 @@ +From 42cc2cffb6d550fbb21dad033d2564d4da571015 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20=C5=A0tetiar?= +Date: Sat, 1 Dec 2018 12:46:37 +0100 +Subject: [PATCH] imx6: apalis: Make the boot process more generic +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +I'm preparing support for Apalis imx6 boards in OpenWrt and I've ended +up with quite huge patchset against upstream U-Boot 2018.03, so I'm +trying to propose more generic way of boot process handling. + +In OpenWrt we usually have kernel, dtbs and U-Boot boot script in boot +partition with ext4fs, so for some use cases it would be handy to be +able to replace some of the files in the boot partion, that's why I've +added write support to the ext4. + +I've added `set_blkcnt` environment variable which is needed for every +`mmc write` command as we need to always specify size in block count. +This is copy&pasted from official Toradex's flashing scripts, so all the +credits for this work belongs to them. + +Currently the rootfs location is passed via mmcblk number and the +problem with this approach is that the mmcblk number for the boot device +changes depending on the kernel version and imx6 SoC type. In order to +avoid such issues, use the UUID method to specify the rootfs location. + +I've added new boot sequence, where we first try to load and run boot +script defined in the new `script` variable, so the boot process could +be more generic and overridden by the distro. When the boot script isn't +loaded, it will use the previous boot sequence so it should be backward +compatible. + +For the recovery purposes and better end user experience I've added boot +from SDP as the last boot command if every other boot option fails. I +plan to use SDP as official flashing/recovery procedure in OpenWrt for +Apalis imx6 boards. + +I've copy&pasted almost everything from the `f086812a mx6sxsabresd: Use +PARTUUID to specify the rootfs location` commit, so credits for the rest +of this patch belongs to Fabio. + +Cc: Stefan Agner +Cc: Max Krummenacher +Signed-off-by: Petr Štetiar +--- + configs/apalis_imx6_defconfig | 2 ++ + include/configs/apalis_imx6.h | 26 +++++++++++++++++++++----- + 2 files changed, 23 insertions(+), 5 deletions(-) + +--- a/configs/apalis_imx6_defconfig ++++ b/configs/apalis_imx6_defconfig +@@ -40,6 +40,7 @@ CONFIG_CMD_DFU=y + CONFIG_CMD_GPIO=y + CONFIG_CMD_I2C=y + CONFIG_CMD_MMC=y ++CONFIG_CMD_PART=y + CONFIG_CMD_USB=y + CONFIG_CMD_USB_SDP=y + CONFIG_CMD_USB_MASS_STORAGE=y +@@ -49,6 +50,7 @@ CONFIG_CMD_PING=y + CONFIG_CMD_BMP=y + CONFIG_CMD_CACHE=y + CONFIG_CMD_EXT4=y ++CONFIG_CMD_EXT4_WRITE=y + CONFIG_CMD_FAT=y + CONFIG_CMD_FS_GENERIC=y + CONFIG_ENV_IS_IN_MMC=y +--- a/include/configs/apalis_imx6.h ++++ b/include/configs/apalis_imx6.h +@@ -138,9 +138,9 @@ + "imx6q-colibri-cam-eval-v3.dtb fat 0 1" + + #define EMMC_BOOTCMD \ +- "emmcargs=ip=off root=/dev/mmcblk0p2 rw,noatime rootfstype=ext3 " \ ++ "emmcargs=ip=off root=PARTUUID=${uuid} rw,noatime rootfstype=ext3 " \ + "rootwait\0" \ +- "emmcboot=run setup; " \ ++ "emmcboot=run setup; run finduuid;" \ + "setenv bootargs ${defargs} ${emmcargs} ${setupargs} " \ + "${vidargs}; echo Booting from internal eMMC chip...; " \ + "run emmcdtbload; load mmc 0:1 ${kernel_addr_r} " \ +@@ -197,10 +197,17 @@ + #define FDT_FILE "imx6q-apalis_v1_0-eval.dtb" + #endif + #define CONFIG_EXTRA_ENV_SETTINGS \ +- "bootcmd=run emmcboot ; echo ; echo emmcboot failed ; " \ ++ "script=boot.scr\0" \ ++ "finduuid=part uuid mmc 0:2 uuid\0" \ ++ "loadbootscript=" \ ++ "load mmc 0:1 ${loadaddr} ${script};\0" \ ++ "bootscript=echo Running bootscript from mmc ...; " \ ++ "source\0" \ ++ "bootcmd_default=run emmcboot ; echo ; echo emmcboot failed ; " \ + "run nfsboot ; echo ; echo nfsboot failed ; " \ + "usb start ;" \ +- "setenv stdout serial,vga ; setenv stdin serial,usbkbd\0" \ ++ "setenv stdout serial,vga ; setenv stdin serial,usbkbd;" \ ++ "sdp 0\0" \ + "boot_file=uImage\0" \ + "console=ttymxc0\0" \ + "defargs=enable_wait_mode=off vmalloc=400M\0" \ +@@ -228,7 +235,16 @@ + "vidargs=mxc_hdmi.only_cea=1 " \ + "video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24 " \ + "video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off " \ +- "fbmem=32M\0 " ++ "fbmem=32M\0 " \ ++ "set_blkcnt=setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200\0" ++ ++#define CONFIG_BOOTCOMMAND \ ++ "mmc dev 0;" \ ++ "if run loadbootscript; then " \ ++ "run bootscript; " \ ++ "else " \ ++ "run bootcmd_default; " \ ++ "fi; " + + /* Miscellaneous configurable options */ + #undef CONFIG_SYS_CBSIZE +-- +1.9.1 + diff --git a/package/boot/uboot-imx6/patches/002-use-static-inline.patch b/package/boot/uboot-imx6/patches/002-use-static-inline.patch deleted file mode 100644 index ca7748291078ac..00000000000000 --- a/package/boot/uboot-imx6/patches/002-use-static-inline.patch +++ /dev/null @@ -1,72 +0,0 @@ -From: Jeroen Hofstee -Date: Sun, 22 Jun 2014 21:10:39 +0000 (+0200) -Subject: ARM:asm:io.h use static inline -X-Git-Tag: v2014.10-rc2~47 -X-Git-Url: http://git.denx.de/?p=u-boot.git;a=commitdiff_plain;h=8863aa5c984460ce1112d8db895cbf8b13a6ac9d - -ARM:asm:io.h use static inline - -When compiling u-boot with W=1 the extern inline void for -read* is likely causing the most noise. gcc / clang will -warn there is never a actual declaration for these functions. -Instead of declaring these extern make them static inline so -it is actually declared. - -cc: Albert ARIBAUD -Signed-off-by: Jeroen Hofstee ---- - ---- a/arch/arm/include/asm/io.h -+++ b/arch/arm/include/asm/io.h -@@ -75,7 +75,7 @@ static inline phys_addr_t virt_to_phys(v - #define __arch_putw(v,a) (*(volatile unsigned short *)(a) = (v)) - #define __arch_putl(v,a) (*(volatile unsigned int *)(a) = (v)) - --extern inline void __raw_writesb(unsigned long addr, const void *data, -+static inline void __raw_writesb(unsigned long addr, const void *data, - int bytelen) - { - uint8_t *buf = (uint8_t *)data; -@@ -83,7 +83,7 @@ extern inline void __raw_writesb(unsigne - __arch_putb(*buf++, addr); - } - --extern inline void __raw_writesw(unsigned long addr, const void *data, -+static inline void __raw_writesw(unsigned long addr, const void *data, - int wordlen) - { - uint16_t *buf = (uint16_t *)data; -@@ -91,7 +91,7 @@ extern inline void __raw_writesw(unsigne - __arch_putw(*buf++, addr); - } - --extern inline void __raw_writesl(unsigned long addr, const void *data, -+static inline void __raw_writesl(unsigned long addr, const void *data, - int longlen) - { - uint32_t *buf = (uint32_t *)data; -@@ -99,21 +99,21 @@ extern inline void __raw_writesl(unsigne - __arch_putl(*buf++, addr); - } - --extern inline void __raw_readsb(unsigned long addr, void *data, int bytelen) -+static inline void __raw_readsb(unsigned long addr, void *data, int bytelen) - { - uint8_t *buf = (uint8_t *)data; - while(bytelen--) - *buf++ = __arch_getb(addr); - } - --extern inline void __raw_readsw(unsigned long addr, void *data, int wordlen) -+static inline void __raw_readsw(unsigned long addr, void *data, int wordlen) - { - uint16_t *buf = (uint16_t *)data; - while(wordlen--) - *buf++ = __arch_getw(addr); - } - --extern inline void __raw_readsl(unsigned long addr, void *data, int longlen) -+static inline void __raw_readsl(unsigned long addr, void *data, int longlen) - { - uint32_t *buf = (uint32_t *)data; - while(longlen--) diff --git a/package/boot/uboot-imx6/patches/003-use-weak-in-board.patch b/package/boot/uboot-imx6/patches/003-use-weak-in-board.patch deleted file mode 100644 index afb8c96e5b25df..00000000000000 --- a/package/boot/uboot-imx6/patches/003-use-weak-in-board.patch +++ /dev/null @@ -1,80 +0,0 @@ -From: Jeroen Hofstee -Date: Wed, 8 Oct 2014 20:57:21 +0000 (+0200) -Subject: arm: board: use __weak -X-Git-Tag: v2015.01-rc1~176 -X-Git-Url: http://git.denx.de/?p=u-boot.git;a=commitdiff_plain;h=8590c800ee60e46f15d6085e3c1fed0d6881fc62 - -arm: board: use __weak - -Signed-off-by: Jeroen Hofstee -Acked-by: Albert ARIBAUD ---- - ---- a/arch/arm/lib/board.c -+++ b/arch/arm/lib/board.c -@@ -63,25 +63,15 @@ extern void dataflash_print_info(void); - ************************************************************************ - * May be supplied by boards if desired - */ --inline void __coloured_LED_init(void) {} --void coloured_LED_init(void) -- __attribute__((weak, alias("__coloured_LED_init"))); --inline void __red_led_on(void) {} --void red_led_on(void) __attribute__((weak, alias("__red_led_on"))); --inline void __red_led_off(void) {} --void red_led_off(void) __attribute__((weak, alias("__red_led_off"))); --inline void __green_led_on(void) {} --void green_led_on(void) __attribute__((weak, alias("__green_led_on"))); --inline void __green_led_off(void) {} --void green_led_off(void) __attribute__((weak, alias("__green_led_off"))); --inline void __yellow_led_on(void) {} --void yellow_led_on(void) __attribute__((weak, alias("__yellow_led_on"))); --inline void __yellow_led_off(void) {} --void yellow_led_off(void) __attribute__((weak, alias("__yellow_led_off"))); --inline void __blue_led_on(void) {} --void blue_led_on(void) __attribute__((weak, alias("__blue_led_on"))); --inline void __blue_led_off(void) {} --void blue_led_off(void) __attribute__((weak, alias("__blue_led_off"))); -+__weak void coloured_LED_init(void) {} -+__weak void red_led_on(void) {} -+__weak void red_led_off(void) {} -+__weak void green_led_on(void) {} -+__weak void green_led_off(void) {} -+__weak void yellow_led_on(void) {} -+__weak void yellow_led_off(void) {} -+__weak void blue_led_on(void) {} -+__weak void blue_led_off(void) {} - - /* - ************************************************************************ -@@ -198,27 +188,21 @@ static int arm_pci_init(void) - */ - typedef int (init_fnc_t) (void); - --void __dram_init_banksize(void) -+__weak void dram_init_banksize(void) - { - gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; - gd->bd->bi_dram[0].size = gd->ram_size; - } --void dram_init_banksize(void) -- __attribute__((weak, alias("__dram_init_banksize"))); - --int __arch_cpu_init(void) -+__weak int arch_cpu_init(void) - { - return 0; - } --int arch_cpu_init(void) -- __attribute__((weak, alias("__arch_cpu_init"))); - --int __power_init_board(void) -+__weak int power_init_board(void) - { - return 0; - } --int power_init_board(void) -- __attribute__((weak, alias("__power_init_board"))); - - /* Record the board_init_f() bootstage (after arch_cpu_init()) */ - static int mark_bootstage(void) diff --git a/package/boot/uboot-imx6/patches/004-use-weak-in-main.patch b/package/boot/uboot-imx6/patches/004-use-weak-in-main.patch deleted file mode 100644 index 07c197fc17ccce..00000000000000 --- a/package/boot/uboot-imx6/patches/004-use-weak-in-main.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: Jeroen Hofstee -Date: Thu, 26 Jun 2014 18:18:31 +0000 (+0200) -Subject: common: main.c: make show_boot_progress __weak -X-Git-Tag: v2014.10-rc1~130 -X-Git-Url: http://git.denx.de/?p=u-boot.git;a=commitdiff_plain;h=3422299dc28fa8257677d03cc1253e3c9bf17e9f - -common: main.c: make show_boot_progress __weak - -This not only looks a bit better it also prevents a -warning with W=1 (no previous prototype). - -Signed-off-by: Jeroen Hofstee -Acked-by: Simon Glass ---- - ---- a/common/main.c -+++ b/common/main.c -@@ -27,8 +27,7 @@ DECLARE_GLOBAL_DATA_PTR; - /* - * Board-specific Platform code can reimplement show_boot_progress () if needed - */ --void inline __show_boot_progress (int val) {} --void show_boot_progress (int val) __attribute__((weak, alias("__show_boot_progress"))); -+__weak void show_boot_progress(int val) {} - - #define MAX_DELAY_STOP_STR 32 - diff --git a/package/boot/uboot-imx6/patches/100-wandboard-enable-fit.patch b/package/boot/uboot-imx6/patches/100-wandboard-enable-fit.patch index 894ccf0084790d..2fd207e11c8705 100644 --- a/package/boot/uboot-imx6/patches/100-wandboard-enable-fit.patch +++ b/package/boot/uboot-imx6/patches/100-wandboard-enable-fit.patch @@ -1,10 +1,17 @@ ---- a/include/configs/wandboard.h -+++ b/include/configs/wandboard.h -@@ -238,4 +238,7 @@ - #define CONFIG_CMD_CACHE - #endif - -+#define CONFIG_FIT -+#define CONFIG_FIT_VERBOSE -+ - #endif /* __CONFIG_H * */ +--- a/configs/wandboard_defconfig ++++ b/configs/wandboard_defconfig +@@ -30,7 +30,7 @@ CONFIG_CMD_I2C=y + CONFIG_CMD_MMC=y + CONFIG_CMD_SATA=y + CONFIG_CMD_USB=y +-CONFIG_CMD_CACHE=y ++# CONFIG_CMD_CACHE is not set + CONFIG_CMD_EXT4_WRITE=y + CONFIG_ENV_IS_IN_MMC=y + CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y +@@ -44,3 +44,5 @@ CONFIG_USB=y + CONFIG_VIDEO=y + # CONFIG_VIDEO_SW_CURSOR is not set + CONFIG_OF_LIBFDT=y ++CONFIG_FIT=y ++CONFIG_FIT_VERBOSE=y diff --git a/package/boot/uboot-imx6/patches/101-gcc-compiler-linux-3-16.patch b/package/boot/uboot-imx6/patches/101-gcc-compiler-linux-3-16.patch deleted file mode 100644 index 7bc65b47fb161b..00000000000000 --- a/package/boot/uboot-imx6/patches/101-gcc-compiler-linux-3-16.patch +++ /dev/null @@ -1,480 +0,0 @@ -From fb8ffd7cfc68b3dc44e182356a207d784cb30b34 Mon Sep 17 00:00:00 2001 -From: Masahiro Yamada -Date: Thu, 4 Sep 2014 02:40:58 +0900 -Subject: compiler*.h: sync include/linux/compiler*.h with Linux 3.16 - -Copy them from Linux v3.16 tag. -My main motivation of this commit is to add compiler-clang.h. - -Signed-off-by: Masahiro Yamada -Cc: Jeroen Hofstee ---- - include/linux/compiler-clang.h | 12 ++++++ - include/linux/compiler-gcc.h | 57 ++++++++++++++++++-------- - include/linux/compiler-gcc3.h | 20 ++++----- - include/linux/compiler-gcc4.h | 59 +++++++++++++++++++-------- - include/linux/compiler-intel.h | 40 ++++++++++++++++++ - include/linux/compiler.h | 92 +++++++++++++++++++++++++++++++++++++++++- - 6 files changed, 236 insertions(+), 44 deletions(-) - create mode 100644 include/linux/compiler-clang.h - create mode 100644 include/linux/compiler-intel.h - ---- /dev/null -+++ b/include/linux/compiler-clang.h -@@ -0,0 +1,12 @@ -+#ifndef __LINUX_COMPILER_H -+#error "Please don't include directly, include instead." -+#endif -+ -+/* Some compiler specific definitions are overwritten here -+ * for Clang compiler -+ */ -+ -+#ifdef uninitialized_var -+#undef uninitialized_var -+#define uninitialized_var(x) x = *(&(x)) -+#endif ---- a/include/linux/compiler-gcc.h -+++ b/include/linux/compiler-gcc.h -@@ -5,6 +5,9 @@ - /* - * Common definitions for all gcc versions go here. - */ -+#define GCC_VERSION (__GNUC__ * 10000 \ -+ + __GNUC_MINOR__ * 100 \ -+ + __GNUC_PATCHLEVEL__) - - - /* Optimization barrier */ -@@ -34,9 +37,15 @@ - __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ - (typeof(ptr)) (__ptr + (off)); }) - -+/* Make the optimizer believe the variable can be manipulated arbitrarily. */ -+#define OPTIMIZER_HIDE_VAR(var) __asm__ ("" : "=r" (var) : "0" (var)) -+ -+#ifdef __CHECKER__ -+#define __must_be_array(arr) 0 -+#else - /* &a[0] degrades to a pointer: a different type from an array */ --#define __must_be_array(a) \ -- BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0]))) -+#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) -+#endif - - /* - * Force always-inline if the user requests it so via the .config, -@@ -44,15 +53,18 @@ - */ - #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ - !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) --# define inline inline __attribute__((always_inline)) --# define __inline__ __inline__ __attribute__((always_inline)) --# define __inline __inline __attribute__((always_inline)) -+# define inline inline __attribute__((always_inline)) notrace -+# define __inline__ __inline__ __attribute__((always_inline)) notrace -+# define __inline __inline __attribute__((always_inline)) notrace -+#else -+/* A lot of inline functions can cause havoc with function tracing */ -+# define inline inline notrace -+# define __inline__ __inline__ notrace -+# define __inline __inline notrace - #endif - - #define __deprecated __attribute__((deprecated)) --#ifndef __packed --# define __packed __attribute__((packed)) --#endif -+#define __packed __attribute__((packed)) - #define __weak __attribute__((weak)) - - /* -@@ -60,8 +72,12 @@ - * naked functions because then mcount is called without stack and frame pointer - * being set up and there is no chance to restore the lr register to the value - * before mcount was called. -+ * -+ * The asm() bodies of naked functions often depend on standard calling conventions, -+ * therefore they must be noinline and noclone. GCC 4.[56] currently fail to enforce -+ * this, so we must do so ourselves. See GCC PR44290. - */ --#define __naked __attribute__((naked)) notrace -+#define __naked __attribute__((naked)) noinline __noclone notrace - - #define __noreturn __attribute__((noreturn)) - -@@ -75,13 +91,10 @@ - * would be. - * [...] - */ --#ifndef __pure --# define __pure __attribute__((pure)) --#endif --#ifndef __aligned --# define __aligned(x) __attribute__((aligned(x))) --#endif --#define __printf(a,b) __attribute__((format(printf,a,b))) -+#define __pure __attribute__((pure)) -+#define __aligned(x) __attribute__((aligned(x))) -+#define __printf(a, b) __attribute__((format(printf, a, b))) -+#define __scanf(a, b) __attribute__((format(scanf, a, b))) - #define noinline __attribute__((noinline)) - #define __attribute_const__ __attribute__((__const__)) - #define __maybe_unused __attribute__((unused)) -@@ -91,3 +104,15 @@ - #define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h) - #define gcc_header(x) _gcc_header(x) - #include gcc_header(__GNUC__) -+ -+#if !defined(__noclone) -+#define __noclone /* not needed */ -+#endif -+ -+/* -+ * A trick to suppress uninitialized variable warning without generating any -+ * code -+ */ -+#define uninitialized_var(x) x = x -+ -+#define __always_inline inline __attribute__((always_inline)) ---- a/include/linux/compiler-gcc3.h -+++ b/include/linux/compiler-gcc3.h -@@ -2,20 +2,22 @@ - #error "Please don't include directly, include instead." - #endif - --#if __GNUC_MINOR__ >= 3 -+#if GCC_VERSION < 30200 -+# error Sorry, your compiler is too old - please upgrade it. -+#endif -+ -+#if GCC_VERSION >= 30300 - # define __used __attribute__((__used__)) - #else - # define __used __attribute__((__unused__)) - #endif - --#if __GNUC_MINOR__ >= 4 -+#if GCC_VERSION >= 30400 - #define __must_check __attribute__((warn_unused_result)) - #endif - --/* -- * A trick to suppress uninitialized variable warning without generating any -- * code -- */ --#define uninitialized_var(x) x = x -- --#define __always_inline inline __attribute__((always_inline)) -+#ifdef CONFIG_GCOV_KERNEL -+# if GCC_VERSION < 30400 -+# error "GCOV profiling support for gcc versions below 3.4 not included" -+# endif /* __GNUC_MINOR__ */ -+#endif /* CONFIG_GCOV_KERNEL */ ---- a/include/linux/compiler-gcc4.h -+++ b/include/linux/compiler-gcc4.h -@@ -4,7 +4,7 @@ - - /* GCC 4.1.[01] miscompiles __weak */ - #ifdef __KERNEL__ --# if __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ <= 1 -+# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101 - # error Your version of gcc miscompiles the __weak directive - # endif - #endif -@@ -12,17 +12,12 @@ - #define __used __attribute__((__used__)) - #define __must_check __attribute__((warn_unused_result)) - #define __compiler_offsetof(a,b) __builtin_offsetof(a,b) --#ifndef __always_inline --# define __always_inline inline __attribute__((always_inline)) --#endif - --/* -- * A trick to suppress uninitialized variable warning without generating any -- * code -- */ --#define uninitialized_var(x) x = x -+#if GCC_VERSION >= 40100 && GCC_VERSION < 40600 -+# define __compiletime_object_size(obj) __builtin_object_size(obj, 0) -+#endif - --#if __GNUC_MINOR__ >= 3 -+#if GCC_VERSION >= 40300 - /* Mark functions as cold. gcc will assume any path leading to a call - to them will be unlikely. This means a lot of manual unlikely()s - are unnecessary now for any paths leading to the usual suspects -@@ -38,8 +33,15 @@ - the kernel context */ - #define __cold __attribute__((__cold__)) - -+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) - --#if __GNUC_MINOR__ >= 5 -+#ifndef __CHECKER__ -+# define __compiletime_warning(message) __attribute__((warning(message))) -+# define __compiletime_error(message) __attribute__((error(message))) -+#endif /* __CHECKER__ */ -+#endif /* GCC_VERSION >= 40300 */ -+ -+#if GCC_VERSION >= 40500 - /* - * Mark a position in code as unreachable. This can be used to - * suppress control flow warnings after asm blocks that transfer -@@ -50,14 +52,37 @@ - * unreleased. Really, we need to have autoconf for the kernel. - */ - #define unreachable() __builtin_unreachable() --#endif - -+/* Mark a function definition as prohibited from being cloned. */ -+#define __noclone __attribute__((__noclone__)) -+ -+#endif /* GCC_VERSION >= 40500 */ -+ -+#if GCC_VERSION >= 40600 -+/* -+ * Tell the optimizer that something else uses this function or variable. -+ */ -+#define __visible __attribute__((externally_visible)) - #endif - --#if __GNUC_MINOR__ > 0 --#define __compiletime_object_size(obj) __builtin_object_size(obj, 0) -+/* -+ * GCC 'asm goto' miscompiles certain code sequences: -+ * -+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 -+ * -+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. -+ * Fixed in GCC 4.8.2 and later versions. -+ * -+ * (asm goto is automatically volatile - the naming reflects this.) -+ */ -+#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) -+ -+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP -+#if GCC_VERSION >= 40400 -+#define __HAVE_BUILTIN_BSWAP32__ -+#define __HAVE_BUILTIN_BSWAP64__ - #endif --#if __GNUC_MINOR__ >= 4 --#define __compiletime_warning(message) __attribute__((warning(message))) --#define __compiletime_error(message) __attribute__((error(message))) -+#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600) -+#define __HAVE_BUILTIN_BSWAP16__ - #endif -+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ ---- /dev/null -+++ b/include/linux/compiler-intel.h -@@ -0,0 +1,40 @@ -+#ifndef __LINUX_COMPILER_H -+#error "Please don't include directly, include instead." -+#endif -+ -+#ifdef __ECC -+ -+/* Some compiler specific definitions are overwritten here -+ * for Intel ECC compiler -+ */ -+ -+#include -+ -+/* Intel ECC compiler doesn't support gcc specific asm stmts. -+ * It uses intrinsics to do the equivalent things. -+ */ -+#undef RELOC_HIDE -+#undef OPTIMIZER_HIDE_VAR -+ -+#define RELOC_HIDE(ptr, off) \ -+ ({ unsigned long __ptr; \ -+ __ptr = (unsigned long) (ptr); \ -+ (typeof(ptr)) (__ptr + (off)); }) -+ -+/* This should act as an optimization barrier on var. -+ * Given that this compiler does not have inline assembly, a compiler barrier -+ * is the best we can do. -+ */ -+#define OPTIMIZER_HIDE_VAR(var) barrier() -+ -+/* Intel ECC compiler doesn't support __builtin_types_compatible_p() */ -+#define __must_be_array(a) 0 -+ -+#endif -+ -+#ifndef __HAVE_BUILTIN_BSWAP16__ -+/* icc has this, but it's called _bswap16 */ -+#define __HAVE_BUILTIN_BSWAP16__ -+#define __builtin_bswap16 _bswap16 -+#endif -+ ---- a/include/linux/compiler.h -+++ b/include/linux/compiler.h -@@ -5,16 +5,23 @@ - - #ifdef __CHECKER__ - # define __user __attribute__((noderef, address_space(1))) --# define __kernel /* default address space */ -+# define __kernel __attribute__((address_space(0))) - # define __safe __attribute__((safe)) - # define __force __attribute__((force)) - # define __nocast __attribute__((nocast)) - # define __iomem __attribute__((noderef, address_space(2))) -+# define __must_hold(x) __attribute__((context(x,1,1))) - # define __acquires(x) __attribute__((context(x,0,1))) - # define __releases(x) __attribute__((context(x,1,0))) - # define __acquire(x) __context__(x,1) - # define __release(x) __context__(x,-1) - # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) -+# define __percpu __attribute__((noderef, address_space(3))) -+#ifdef CONFIG_SPARSE_RCU_POINTER -+# define __rcu __attribute__((noderef, address_space(4))) -+#else -+# define __rcu -+#endif - extern void __chk_user_ptr(const volatile void __user *); - extern void __chk_io_ptr(const volatile void __iomem *); - #else -@@ -27,13 +34,20 @@ extern void __chk_io_ptr(const volatile - # define __chk_user_ptr(x) (void)0 - # define __chk_io_ptr(x) (void)0 - # define __builtin_warning(x, y...) (1) -+# define __must_hold(x) - # define __acquires(x) - # define __releases(x) - # define __acquire(x) (void)0 - # define __release(x) (void)0 - # define __cond_lock(x,c) (c) -+# define __percpu -+# define __rcu - #endif - -+/* Indirect macros required for expanded argument pasting, eg. __LINE__. */ -+#define ___PASTE(a,b) a##b -+#define __PASTE(a,b) ___PASTE(a,b) -+ - #ifdef __KERNEL__ - - #ifdef __GNUC__ -@@ -49,6 +63,13 @@ extern void __chk_io_ptr(const volatile - # include - #endif - -+/* Clang compiler defines __GNUC__. So we will overwrite implementations -+ * coming from above header files here -+ */ -+#ifdef __clang__ -+#include -+#endif -+ - /* - * Generic compiler-dependent macros required for kernel - * build go below this comment. Actual compiler/compiler version -@@ -156,6 +177,15 @@ void ftrace_likely_update(struct ftrace_ - (typeof(ptr)) (__ptr + (off)); }) - #endif - -+#ifndef OPTIMIZER_HIDE_VAR -+#define OPTIMIZER_HIDE_VAR(var) barrier() -+#endif -+ -+/* Not-quite-unique ID. */ -+#ifndef __UNIQUE_ID -+# define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__) -+#endif -+ - #endif /* __KERNEL__ */ - - #endif /* __ASSEMBLY__ */ -@@ -228,7 +258,7 @@ void ftrace_likely_update(struct ftrace_ - - /* - * Rather then using noinline to prevent stack consumption, use -- * noinline_for_stack instead. For documentaiton reasons. -+ * noinline_for_stack instead. For documentation reasons. - */ - #define noinline_for_stack noinline - -@@ -270,11 +300,20 @@ void ftrace_likely_update(struct ftrace_ - # define __section(S) __attribute__ ((__section__(#S))) - #endif - -+#ifndef __visible -+#define __visible -+#endif -+ - /* Are two types/vars the same type (ignoring qualifiers)? */ - #ifndef __same_type - # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) - #endif - -+/* Is this type a native word size -- useful for atomic operations */ -+#ifndef __native_word -+# define __native_word(t) (sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) -+#endif -+ - /* Compile time object size, -1 for unknown */ - #ifndef __compiletime_object_size - # define __compiletime_object_size(obj) -1 -@@ -284,7 +323,48 @@ void ftrace_likely_update(struct ftrace_ - #endif - #ifndef __compiletime_error - # define __compiletime_error(message) -+/* -+ * Sparse complains of variable sized arrays due to the temporary variable in -+ * __compiletime_assert. Unfortunately we can't just expand it out to make -+ * sparse see a constant array size without breaking compiletime_assert on old -+ * versions of GCC (e.g. 4.2.4), so hide the array from sparse altogether. -+ */ -+# ifndef __CHECKER__ -+# define __compiletime_error_fallback(condition) \ -+ do { ((void)sizeof(char[1 - 2 * condition])); } while (0) -+# endif - #endif -+#ifndef __compiletime_error_fallback -+# define __compiletime_error_fallback(condition) do { } while (0) -+#endif -+ -+#define __compiletime_assert(condition, msg, prefix, suffix) \ -+ do { \ -+ bool __cond = !(condition); \ -+ extern void prefix ## suffix(void) __compiletime_error(msg); \ -+ if (__cond) \ -+ prefix ## suffix(); \ -+ __compiletime_error_fallback(__cond); \ -+ } while (0) -+ -+#define _compiletime_assert(condition, msg, prefix, suffix) \ -+ __compiletime_assert(condition, msg, prefix, suffix) -+ -+/** -+ * compiletime_assert - break build and emit msg if condition is false -+ * @condition: a compile-time constant condition to check -+ * @msg: a message to emit if condition is false -+ * -+ * In tradition of POSIX assert, this macro will break the build if the -+ * supplied condition is *false*, emitting the supplied error message if the -+ * compiler has support to do so. -+ */ -+#define compiletime_assert(condition, msg) \ -+ _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) -+ -+#define compiletime_assert_atomic_type(t) \ -+ compiletime_assert(__native_word(t), \ -+ "Need native word sized stores/loads for atomicity.") - - /* - * Prevent the compiler from merging or refetching accesses. The compiler -@@ -300,4 +380,12 @@ void ftrace_likely_update(struct ftrace_ - */ - #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) - -+/* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */ -+#ifdef CONFIG_KPROBES -+# define __kprobes __attribute__((__section__(".kprobes.text"))) -+# define nokprobe_inline __always_inline -+#else -+# define __kprobes -+# define nokprobe_inline inline -+#endif - #endif /* __LINUX_COMPILER_H */ diff --git a/package/boot/uboot-imx6/patches/102-compiler_gcc-prevent-redefining-attributes.patch b/package/boot/uboot-imx6/patches/102-compiler_gcc-prevent-redefining-attributes.patch deleted file mode 100644 index 0a6219c2b4a563..00000000000000 --- a/package/boot/uboot-imx6/patches/102-compiler_gcc-prevent-redefining-attributes.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 0a5051ce6ebd5f6fad58fd50d6922493d8447f14 Mon Sep 17 00:00:00 2001 -From: Jeroen Hofstee -Date: Thu, 18 Sep 2014 20:10:27 +0200 -Subject: compiler_gcc: prevent redefining attributes - -The libc headers on FreeBSD and likely related projects as well contain an -header file, cdefs.h which provides similiar functionality as linux/compiler.h. -It provides compiler independent defines like __weak __packed, to allow -compiling with multiple compilers which might have a different syntax for such -extension. - -Since that header file is included in multiple standard headers, like stddef.h -and stdarg.h, multiple definitions of those defines will be present if both are -included. When compiling u-boot the compiler will warn about it hundreds of -times since e.g. common.h will include both files indirectly. - -commit 7ea50d52849fe8ffa5b5b74c979b60b1045d6fc9 "compiler_gcc: do not redefine -__gnu_attributes" prevented such redefinitions, but this was undone by commit -fb8ffd7cfc68b3dc44e182356a207d784cb30b34 "compiler*.h: sync -include/linux/compiler*.h with Linux 3.16". - -Add the checks back where necessary to prevent such warnings. - -As the original patch this checkpatch warning is ignored: -"WARNING: Adding new packed members is to be done with care" - -Cc: Masahiro Yamada -Cc: Tom Rini -Signed-off-by: Jeroen Hofstee -Acked-by: Masahiro Yamada ---- - include/linux/compiler-gcc.h | 10 ++++++++++ - 1 file changed, 10 insertions(+) - ---- a/include/linux/compiler-gcc.h -+++ b/include/linux/compiler-gcc.h -@@ -64,8 +64,12 @@ - #endif - - #define __deprecated __attribute__((deprecated)) -+#ifndef __packed - #define __packed __attribute__((packed)) -+#endif -+#ifndef __weak - #define __weak __attribute__((weak)) -+#endif - - /* - * it doesn't make sense on ARM (currently the only user of __naked) to trace -@@ -91,8 +95,12 @@ - * would be. - * [...] - */ -+#ifndef __pure - #define __pure __attribute__((pure)) -+#endif -+#ifndef __aligned - #define __aligned(x) __attribute__((aligned(x))) -+#endif - #define __printf(a, b) __attribute__((format(printf, a, b))) - #define __scanf(a, b) __attribute__((format(scanf, a, b))) - #define noinline __attribute__((noinline)) -@@ -115,4 +123,6 @@ - */ - #define uninitialized_var(x) x = x - -+#ifndef __always_inline - #define __always_inline inline __attribute__((always_inline)) -+#endif diff --git a/package/boot/uboot-imx6/patches/103-Add-linux-compiler-gcc5.h-to-fix-builds-with-gcc5.patch b/package/boot/uboot-imx6/patches/103-Add-linux-compiler-gcc5.h-to-fix-builds-with-gcc5.patch deleted file mode 100644 index 6861674061e96a..00000000000000 --- a/package/boot/uboot-imx6/patches/103-Add-linux-compiler-gcc5.h-to-fix-builds-with-gcc5.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 478b02f1a7043b673565075ea5016376f3293b23 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Sat, 7 Feb 2015 22:52:40 +0100 -Subject: Add linux/compiler-gcc5.h to fix builds with gcc5 - -Add linux/compiler-gcc5/h from the kernel sources at: - -commit 5631b8fba640a4ab2f8a954f63a603fa34eda96b -Author: Steven Noonan -Date: Sat Oct 25 15:09:42 2014 -0700 - - compiler/gcc4+: Remove inaccurate comment about 'asm goto' miscompiles - -Signed-off-by: Hans de Goede ---- - include/linux/compiler-gcc5.h | 65 +++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 65 insertions(+) - create mode 100644 include/linux/compiler-gcc5.h - ---- /dev/null -+++ b/include/linux/compiler-gcc5.h -@@ -0,0 +1,65 @@ -+#ifndef __LINUX_COMPILER_H -+#error "Please don't include directly, include instead." -+#endif -+ -+#define __used __attribute__((__used__)) -+#define __must_check __attribute__((warn_unused_result)) -+#define __compiler_offsetof(a, b) __builtin_offsetof(a, b) -+ -+/* Mark functions as cold. gcc will assume any path leading to a call -+ to them will be unlikely. This means a lot of manual unlikely()s -+ are unnecessary now for any paths leading to the usual suspects -+ like BUG(), printk(), panic() etc. [but let's keep them for now for -+ older compilers] -+ -+ Early snapshots of gcc 4.3 don't support this and we can't detect this -+ in the preprocessor, but we can live with this because they're unreleased. -+ Maketime probing would be overkill here. -+ -+ gcc also has a __attribute__((__hot__)) to move hot functions into -+ a special section, but I don't see any sense in this right now in -+ the kernel context */ -+#define __cold __attribute__((__cold__)) -+ -+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) -+ -+#ifndef __CHECKER__ -+# define __compiletime_warning(message) __attribute__((warning(message))) -+# define __compiletime_error(message) __attribute__((error(message))) -+#endif /* __CHECKER__ */ -+ -+/* -+ * Mark a position in code as unreachable. This can be used to -+ * suppress control flow warnings after asm blocks that transfer -+ * control elsewhere. -+ * -+ * Early snapshots of gcc 4.5 don't support this and we can't detect -+ * this in the preprocessor, but we can live with this because they're -+ * unreleased. Really, we need to have autoconf for the kernel. -+ */ -+#define unreachable() __builtin_unreachable() -+ -+/* Mark a function definition as prohibited from being cloned. */ -+#define __noclone __attribute__((__noclone__)) -+ -+/* -+ * Tell the optimizer that something else uses this function or variable. -+ */ -+#define __visible __attribute__((externally_visible)) -+ -+/* -+ * GCC 'asm goto' miscompiles certain code sequences: -+ * -+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 -+ * -+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. -+ * -+ * (asm goto is automatically volatile - the naming reflects this.) -+ */ -+#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) -+ -+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP -+#define __HAVE_BUILTIN_BSWAP32__ -+#define __HAVE_BUILTIN_BSWAP64__ -+#define __HAVE_BUILTIN_BSWAP16__ -+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ diff --git a/package/boot/uboot-imx6/patches/104-gcc-compiler-linux-4-5.patch b/package/boot/uboot-imx6/patches/104-gcc-compiler-linux-4-5.patch deleted file mode 100644 index af4da8e6945d1c..00000000000000 --- a/package/boot/uboot-imx6/patches/104-gcc-compiler-linux-4-5.patch +++ /dev/null @@ -1,790 +0,0 @@ -From 9b2c282b348dfe966bbba967dc7a45ce817cce50 Mon Sep 17 00:00:00 2001 -From: Tom Rini -Date: Mon, 29 Feb 2016 11:34:15 -0500 -Subject: compiler*.h: sync include/linux/compiler*.h with Linux 4.5-rc6 - -Copy these from Linux v4.5-rc6 tag. - -This is needed so that we can keep up with newer gcc versions. Note -that we don't have the uapi/ hierarchy from the kernel so continue to -use - -Signed-off-by: Tom Rini ---- - include/linux/compiler-gcc.h | 259 ++++++++++++++++++++++++++++++++--------- - include/linux/compiler-gcc3.h | 23 ---- - include/linux/compiler-gcc4.h | 88 -------------- - include/linux/compiler-gcc5.h | 65 ----------- - include/linux/compiler-intel.h | 5 + - include/linux/compiler.h | 178 ++++++++++++++++++++++++++-- - 6 files changed, 383 insertions(+), 235 deletions(-) - delete mode 100644 include/linux/compiler-gcc3.h - delete mode 100644 include/linux/compiler-gcc4.h - delete mode 100644 include/linux/compiler-gcc5.h - ---- a/include/linux/compiler-gcc.h -+++ b/include/linux/compiler-gcc.h -@@ -5,14 +5,28 @@ - /* - * Common definitions for all gcc versions go here. - */ --#define GCC_VERSION (__GNUC__ * 10000 \ -- + __GNUC_MINOR__ * 100 \ -- + __GNUC_PATCHLEVEL__) -- -+#define GCC_VERSION (__GNUC__ * 10000 \ -+ + __GNUC_MINOR__ * 100 \ -+ + __GNUC_PATCHLEVEL__) - - /* Optimization barrier */ -+ - /* The "volatile" is due to gcc bugs */ - #define barrier() __asm__ __volatile__("": : :"memory") -+/* -+ * This version is i.e. to prevent dead stores elimination on @ptr -+ * where gcc and llvm may behave differently when otherwise using -+ * normal barrier(): while gcc behavior gets along with a normal -+ * barrier(), llvm needs an explicit input variable to be assumed -+ * clobbered. The issue is as follows: while the inline asm might -+ * access any memory it wants, the compiler could have fit all of -+ * @ptr into memory registers instead, and since @ptr never escaped -+ * from that, it proofed that the inline asm wasn't touching any of -+ * it. This version works well with both compilers, i.e. we're telling -+ * the compiler that the inline asm absolutely may see the contents -+ * of @ptr. See also: https://llvm.org/bugs/show_bug.cgi?id=15495 -+ */ -+#define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory") - - /* - * This macro obfuscates arithmetic on a variable address so that gcc -@@ -32,58 +46,63 @@ - * the inline assembly constraint from =g to =r, in this particular - * case either is valid. - */ --#define RELOC_HIDE(ptr, off) \ -- ({ unsigned long __ptr; \ -- __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ -- (typeof(ptr)) (__ptr + (off)); }) -+#define RELOC_HIDE(ptr, off) \ -+({ \ -+ unsigned long __ptr; \ -+ __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ -+ (typeof(ptr)) (__ptr + (off)); \ -+}) - - /* Make the optimizer believe the variable can be manipulated arbitrarily. */ --#define OPTIMIZER_HIDE_VAR(var) __asm__ ("" : "=r" (var) : "0" (var)) -+#define OPTIMIZER_HIDE_VAR(var) \ -+ __asm__ ("" : "=r" (var) : "0" (var)) - - #ifdef __CHECKER__ --#define __must_be_array(arr) 0 -+#define __must_be_array(a) 0 - #else - /* &a[0] degrades to a pointer: a different type from an array */ --#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) -+#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) - #endif - - /* - * Force always-inline if the user requests it so via the .config, - * or if gcc is too old: - */ --#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ -+#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ - !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) --# define inline inline __attribute__((always_inline)) notrace --# define __inline__ __inline__ __attribute__((always_inline)) notrace --# define __inline __inline __attribute__((always_inline)) notrace -+#define inline inline __attribute__((always_inline)) notrace -+#define __inline__ __inline__ __attribute__((always_inline)) notrace -+#define __inline __inline __attribute__((always_inline)) notrace - #else - /* A lot of inline functions can cause havoc with function tracing */ --# define inline inline notrace --# define __inline__ __inline__ notrace --# define __inline __inline notrace -+#define inline inline notrace -+#define __inline__ __inline__ notrace -+#define __inline __inline notrace - #endif - --#define __deprecated __attribute__((deprecated)) --#ifndef __packed --#define __packed __attribute__((packed)) --#endif --#ifndef __weak --#define __weak __attribute__((weak)) --#endif -+#define __always_inline inline __attribute__((always_inline)) -+#define noinline __attribute__((noinline)) -+ -+#define __deprecated __attribute__((deprecated)) -+#define __packed __attribute__((packed)) -+#define __weak __attribute__((weak)) -+#define __alias(symbol) __attribute__((alias(#symbol))) - - /* -- * it doesn't make sense on ARM (currently the only user of __naked) to trace -- * naked functions because then mcount is called without stack and frame pointer -- * being set up and there is no chance to restore the lr register to the value -- * before mcount was called. -+ * it doesn't make sense on ARM (currently the only user of __naked) -+ * to trace naked functions because then mcount is called without -+ * stack and frame pointer being set up and there is no chance to -+ * restore the lr register to the value before mcount was called. -+ * -+ * The asm() bodies of naked functions often depend on standard calling -+ * conventions, therefore they must be noinline and noclone. - * -- * The asm() bodies of naked functions often depend on standard calling conventions, -- * therefore they must be noinline and noclone. GCC 4.[56] currently fail to enforce -- * this, so we must do so ourselves. See GCC PR44290. -+ * GCC 4.[56] currently fail to enforce this, so we must do so ourselves. -+ * See GCC PR44290. - */ --#define __naked __attribute__((naked)) noinline __noclone notrace -+#define __naked __attribute__((naked)) noinline __noclone notrace - --#define __noreturn __attribute__((noreturn)) -+#define __noreturn __attribute__((noreturn)) - - /* - * From the GCC manual: -@@ -95,34 +114,170 @@ - * would be. - * [...] - */ --#ifndef __pure --#define __pure __attribute__((pure)) -+#define __pure __attribute__((pure)) -+#define __aligned(x) __attribute__((aligned(x))) -+#define __printf(a, b) __attribute__((format(printf, a, b))) -+#define __scanf(a, b) __attribute__((format(scanf, a, b))) -+#define __attribute_const__ __attribute__((__const__)) -+#define __maybe_unused __attribute__((unused)) -+#define __always_unused __attribute__((unused)) -+ -+/* gcc version specific checks */ -+ -+#if GCC_VERSION < 30200 -+# error Sorry, your compiler is too old - please upgrade it. -+#endif -+ -+#if GCC_VERSION < 30300 -+# define __used __attribute__((__unused__)) -+#else -+# define __used __attribute__((__used__)) -+#endif -+ -+#ifdef CONFIG_GCOV_KERNEL -+# if GCC_VERSION < 30400 -+# error "GCOV profiling support for gcc versions below 3.4 not included" -+# endif /* __GNUC_MINOR__ */ -+#endif /* CONFIG_GCOV_KERNEL */ -+ -+#if GCC_VERSION >= 30400 -+#define __must_check __attribute__((warn_unused_result)) - #endif --#ifndef __aligned --#define __aligned(x) __attribute__((aligned(x))) -+ -+#if GCC_VERSION >= 40000 -+ -+/* GCC 4.1.[01] miscompiles __weak */ -+#ifdef __KERNEL__ -+# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101 -+# error Your version of gcc miscompiles the __weak directive -+# endif -+#endif -+ -+#define __used __attribute__((__used__)) -+#define __compiler_offsetof(a, b) \ -+ __builtin_offsetof(a, b) -+ -+#if GCC_VERSION >= 40100 && GCC_VERSION < 40600 -+# define __compiletime_object_size(obj) __builtin_object_size(obj, 0) - #endif --#define __printf(a, b) __attribute__((format(printf, a, b))) --#define __scanf(a, b) __attribute__((format(scanf, a, b))) --#define noinline __attribute__((noinline)) --#define __attribute_const__ __attribute__((__const__)) --#define __maybe_unused __attribute__((unused)) --#define __always_unused __attribute__((unused)) -- --#define __gcc_header(x) #x --#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h) --#define gcc_header(x) _gcc_header(x) --#include gcc_header(__GNUC__) -+ -+#if GCC_VERSION >= 40300 -+/* Mark functions as cold. gcc will assume any path leading to a call -+ * to them will be unlikely. This means a lot of manual unlikely()s -+ * are unnecessary now for any paths leading to the usual suspects -+ * like BUG(), printk(), panic() etc. [but let's keep them for now for -+ * older compilers] -+ * -+ * Early snapshots of gcc 4.3 don't support this and we can't detect this -+ * in the preprocessor, but we can live with this because they're unreleased. -+ * Maketime probing would be overkill here. -+ * -+ * gcc also has a __attribute__((__hot__)) to move hot functions into -+ * a special section, but I don't see any sense in this right now in -+ * the kernel context -+ */ -+#define __cold __attribute__((__cold__)) -+ -+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) -+ -+#ifndef __CHECKER__ -+# define __compiletime_warning(message) __attribute__((warning(message))) -+# define __compiletime_error(message) __attribute__((error(message))) -+#endif /* __CHECKER__ */ -+#endif /* GCC_VERSION >= 40300 */ -+ -+#if GCC_VERSION >= 40500 -+/* -+ * Mark a position in code as unreachable. This can be used to -+ * suppress control flow warnings after asm blocks that transfer -+ * control elsewhere. -+ * -+ * Early snapshots of gcc 4.5 don't support this and we can't detect -+ * this in the preprocessor, but we can live with this because they're -+ * unreleased. Really, we need to have autoconf for the kernel. -+ */ -+#define unreachable() __builtin_unreachable() -+ -+/* Mark a function definition as prohibited from being cloned. */ -+#define __noclone __attribute__((__noclone__)) -+ -+#endif /* GCC_VERSION >= 40500 */ -+ -+#if GCC_VERSION >= 40600 -+/* -+ * When used with Link Time Optimization, gcc can optimize away C functions or -+ * variables which are referenced only from assembly code. __visible tells the -+ * optimizer that something else uses this function or variable, thus preventing -+ * this. -+ */ -+#define __visible __attribute__((externally_visible)) -+#endif -+ -+ -+#if GCC_VERSION >= 40900 && !defined(__CHECKER__) -+/* -+ * __assume_aligned(n, k): Tell the optimizer that the returned -+ * pointer can be assumed to be k modulo n. The second argument is -+ * optional (default 0), so we use a variadic macro to make the -+ * shorthand. -+ * -+ * Beware: Do not apply this to functions which may return -+ * ERR_PTRs. Also, it is probably unwise to apply it to functions -+ * returning extra information in the low bits (but in that case the -+ * compiler should see some alignment anyway, when the return value is -+ * massaged by 'flags = ptr & 3; ptr &= ~3;'). -+ */ -+#define __assume_aligned(a, ...) __attribute__((__assume_aligned__(a, ## __VA_ARGS__))) -+#endif -+ -+/* -+ * GCC 'asm goto' miscompiles certain code sequences: -+ * -+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 -+ * -+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. -+ * -+ * (asm goto is automatically volatile - the naming reflects this.) -+ */ -+#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) -+ -+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP -+#if GCC_VERSION >= 40400 -+#define __HAVE_BUILTIN_BSWAP32__ -+#define __HAVE_BUILTIN_BSWAP64__ -+#endif -+#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600) -+#define __HAVE_BUILTIN_BSWAP16__ -+#endif -+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ -+ -+#if GCC_VERSION >= 50000 -+#define KASAN_ABI_VERSION 4 -+#elif GCC_VERSION >= 40902 -+#define KASAN_ABI_VERSION 3 -+#endif -+ -+#if GCC_VERSION >= 40902 -+/* -+ * Tell the compiler that address safety instrumentation (KASAN) -+ * should not be applied to that function. -+ * Conflicts with inlining: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 -+ */ -+#define __no_sanitize_address __attribute__((no_sanitize_address)) -+#endif -+ -+#endif /* gcc version >= 40000 specific checks */ - - #if !defined(__noclone) - #define __noclone /* not needed */ - #endif - -+#if !defined(__no_sanitize_address) -+#define __no_sanitize_address -+#endif -+ - /* - * A trick to suppress uninitialized variable warning without generating any - * code - */ - #define uninitialized_var(x) x = x -- --#ifndef __always_inline --#define __always_inline inline __attribute__((always_inline)) --#endif ---- a/include/linux/compiler-gcc3.h -+++ /dev/null -@@ -1,23 +0,0 @@ --#ifndef __LINUX_COMPILER_H --#error "Please don't include directly, include instead." --#endif -- --#if GCC_VERSION < 30200 --# error Sorry, your compiler is too old - please upgrade it. --#endif -- --#if GCC_VERSION >= 30300 --# define __used __attribute__((__used__)) --#else --# define __used __attribute__((__unused__)) --#endif -- --#if GCC_VERSION >= 30400 --#define __must_check __attribute__((warn_unused_result)) --#endif -- --#ifdef CONFIG_GCOV_KERNEL --# if GCC_VERSION < 30400 --# error "GCOV profiling support for gcc versions below 3.4 not included" --# endif /* __GNUC_MINOR__ */ --#endif /* CONFIG_GCOV_KERNEL */ ---- a/include/linux/compiler-gcc4.h -+++ /dev/null -@@ -1,88 +0,0 @@ --#ifndef __LINUX_COMPILER_H --#error "Please don't include directly, include instead." --#endif -- --/* GCC 4.1.[01] miscompiles __weak */ --#ifdef __KERNEL__ --# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101 --# error Your version of gcc miscompiles the __weak directive --# endif --#endif -- --#define __used __attribute__((__used__)) --#define __must_check __attribute__((warn_unused_result)) --#define __compiler_offsetof(a,b) __builtin_offsetof(a,b) -- --#if GCC_VERSION >= 40100 && GCC_VERSION < 40600 --# define __compiletime_object_size(obj) __builtin_object_size(obj, 0) --#endif -- --#if GCC_VERSION >= 40300 --/* Mark functions as cold. gcc will assume any path leading to a call -- to them will be unlikely. This means a lot of manual unlikely()s -- are unnecessary now for any paths leading to the usual suspects -- like BUG(), printk(), panic() etc. [but let's keep them for now for -- older compilers] -- -- Early snapshots of gcc 4.3 don't support this and we can't detect this -- in the preprocessor, but we can live with this because they're unreleased. -- Maketime probing would be overkill here. -- -- gcc also has a __attribute__((__hot__)) to move hot functions into -- a special section, but I don't see any sense in this right now in -- the kernel context */ --#define __cold __attribute__((__cold__)) -- --#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) -- --#ifndef __CHECKER__ --# define __compiletime_warning(message) __attribute__((warning(message))) --# define __compiletime_error(message) __attribute__((error(message))) --#endif /* __CHECKER__ */ --#endif /* GCC_VERSION >= 40300 */ -- --#if GCC_VERSION >= 40500 --/* -- * Mark a position in code as unreachable. This can be used to -- * suppress control flow warnings after asm blocks that transfer -- * control elsewhere. -- * -- * Early snapshots of gcc 4.5 don't support this and we can't detect -- * this in the preprocessor, but we can live with this because they're -- * unreleased. Really, we need to have autoconf for the kernel. -- */ --#define unreachable() __builtin_unreachable() -- --/* Mark a function definition as prohibited from being cloned. */ --#define __noclone __attribute__((__noclone__)) -- --#endif /* GCC_VERSION >= 40500 */ -- --#if GCC_VERSION >= 40600 --/* -- * Tell the optimizer that something else uses this function or variable. -- */ --#define __visible __attribute__((externally_visible)) --#endif -- --/* -- * GCC 'asm goto' miscompiles certain code sequences: -- * -- * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 -- * -- * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. -- * Fixed in GCC 4.8.2 and later versions. -- * -- * (asm goto is automatically volatile - the naming reflects this.) -- */ --#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) -- --#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP --#if GCC_VERSION >= 40400 --#define __HAVE_BUILTIN_BSWAP32__ --#define __HAVE_BUILTIN_BSWAP64__ --#endif --#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600) --#define __HAVE_BUILTIN_BSWAP16__ --#endif --#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ ---- a/include/linux/compiler-gcc5.h -+++ /dev/null -@@ -1,65 +0,0 @@ --#ifndef __LINUX_COMPILER_H --#error "Please don't include directly, include instead." --#endif -- --#define __used __attribute__((__used__)) --#define __must_check __attribute__((warn_unused_result)) --#define __compiler_offsetof(a, b) __builtin_offsetof(a, b) -- --/* Mark functions as cold. gcc will assume any path leading to a call -- to them will be unlikely. This means a lot of manual unlikely()s -- are unnecessary now for any paths leading to the usual suspects -- like BUG(), printk(), panic() etc. [but let's keep them for now for -- older compilers] -- -- Early snapshots of gcc 4.3 don't support this and we can't detect this -- in the preprocessor, but we can live with this because they're unreleased. -- Maketime probing would be overkill here. -- -- gcc also has a __attribute__((__hot__)) to move hot functions into -- a special section, but I don't see any sense in this right now in -- the kernel context */ --#define __cold __attribute__((__cold__)) -- --#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) -- --#ifndef __CHECKER__ --# define __compiletime_warning(message) __attribute__((warning(message))) --# define __compiletime_error(message) __attribute__((error(message))) --#endif /* __CHECKER__ */ -- --/* -- * Mark a position in code as unreachable. This can be used to -- * suppress control flow warnings after asm blocks that transfer -- * control elsewhere. -- * -- * Early snapshots of gcc 4.5 don't support this and we can't detect -- * this in the preprocessor, but we can live with this because they're -- * unreleased. Really, we need to have autoconf for the kernel. -- */ --#define unreachable() __builtin_unreachable() -- --/* Mark a function definition as prohibited from being cloned. */ --#define __noclone __attribute__((__noclone__)) -- --/* -- * Tell the optimizer that something else uses this function or variable. -- */ --#define __visible __attribute__((externally_visible)) -- --/* -- * GCC 'asm goto' miscompiles certain code sequences: -- * -- * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 -- * -- * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. -- * -- * (asm goto is automatically volatile - the naming reflects this.) -- */ --#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) -- --#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP --#define __HAVE_BUILTIN_BSWAP32__ --#define __HAVE_BUILTIN_BSWAP64__ --#define __HAVE_BUILTIN_BSWAP16__ --#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ ---- a/include/linux/compiler-intel.h -+++ b/include/linux/compiler-intel.h -@@ -13,9 +13,14 @@ - /* Intel ECC compiler doesn't support gcc specific asm stmts. - * It uses intrinsics to do the equivalent things. - */ -+#undef barrier -+#undef barrier_data - #undef RELOC_HIDE - #undef OPTIMIZER_HIDE_VAR - -+#define barrier() __memory_barrier() -+#define barrier_data(ptr) barrier() -+ - #define RELOC_HIDE(ptr, off) \ - ({ unsigned long __ptr; \ - __ptr = (unsigned long) (ptr); \ ---- a/include/linux/compiler.h -+++ b/include/linux/compiler.h -@@ -17,6 +17,7 @@ - # define __release(x) __context__(x,-1) - # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) - # define __percpu __attribute__((noderef, address_space(3))) -+# define __pmem __attribute__((noderef, address_space(5))) - #ifdef CONFIG_SPARSE_RCU_POINTER - # define __rcu __attribute__((noderef, address_space(4))) - #else -@@ -42,6 +43,7 @@ extern void __chk_io_ptr(const volatile - # define __cond_lock(x,c) (c) - # define __percpu - # define __rcu -+# define __pmem - #endif - - /* Indirect macros required for expanded argument pasting, eg. __LINE__. */ -@@ -54,7 +56,11 @@ extern void __chk_io_ptr(const volatile - #include - #endif - -+#if defined(CC_USING_HOTPATCH) && !defined(__CHECKER__) -+#define notrace __attribute__((hotpatch(0,0))) -+#else - #define notrace __attribute__((no_instrument_function)) -+#endif - - /* Intel compiler defines __GNUC__. So we will overwrite implementations - * coming from above header files here -@@ -138,7 +144,7 @@ void ftrace_likely_update(struct ftrace_ - */ - #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) ) - #define __trace_if(cond) \ -- if (__builtin_constant_p((cond)) ? !!(cond) : \ -+ if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ - ({ \ - int ______r; \ - static struct ftrace_branch_data \ -@@ -165,6 +171,10 @@ void ftrace_likely_update(struct ftrace_ - # define barrier() __memory_barrier() - #endif - -+#ifndef barrier_data -+# define barrier_data(ptr) barrier() -+#endif -+ - /* Unreachable code */ - #ifndef unreachable - # define unreachable() do { } while (1) -@@ -186,6 +196,126 @@ void ftrace_likely_update(struct ftrace_ - # define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__) - #endif - -+#include -+ -+#define __READ_ONCE_SIZE \ -+({ \ -+ switch (size) { \ -+ case 1: *(__u8 *)res = *(volatile __u8 *)p; break; \ -+ case 2: *(__u16 *)res = *(volatile __u16 *)p; break; \ -+ case 4: *(__u32 *)res = *(volatile __u32 *)p; break; \ -+ case 8: *(__u64 *)res = *(volatile __u64 *)p; break; \ -+ default: \ -+ barrier(); \ -+ __builtin_memcpy((void *)res, (const void *)p, size); \ -+ barrier(); \ -+ } \ -+}) -+ -+static __always_inline -+void __read_once_size(const volatile void *p, void *res, int size) -+{ -+ __READ_ONCE_SIZE; -+} -+ -+#ifdef CONFIG_KASAN -+/* -+ * This function is not 'inline' because __no_sanitize_address confilcts -+ * with inlining. Attempt to inline it may cause a build failure. -+ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 -+ * '__maybe_unused' allows us to avoid defined-but-not-used warnings. -+ */ -+static __no_sanitize_address __maybe_unused -+void __read_once_size_nocheck(const volatile void *p, void *res, int size) -+{ -+ __READ_ONCE_SIZE; -+} -+#else -+static __always_inline -+void __read_once_size_nocheck(const volatile void *p, void *res, int size) -+{ -+ __READ_ONCE_SIZE; -+} -+#endif -+ -+static __always_inline void __write_once_size(volatile void *p, void *res, int size) -+{ -+ switch (size) { -+ case 1: *(volatile __u8 *)p = *(__u8 *)res; break; -+ case 2: *(volatile __u16 *)p = *(__u16 *)res; break; -+ case 4: *(volatile __u32 *)p = *(__u32 *)res; break; -+ case 8: *(volatile __u64 *)p = *(__u64 *)res; break; -+ default: -+ barrier(); -+ __builtin_memcpy((void *)p, (const void *)res, size); -+ barrier(); -+ } -+} -+ -+/* -+ * Prevent the compiler from merging or refetching reads or writes. The -+ * compiler is also forbidden from reordering successive instances of -+ * READ_ONCE, WRITE_ONCE and ACCESS_ONCE (see below), but only when the -+ * compiler is aware of some particular ordering. One way to make the -+ * compiler aware of ordering is to put the two invocations of READ_ONCE, -+ * WRITE_ONCE or ACCESS_ONCE() in different C statements. -+ * -+ * In contrast to ACCESS_ONCE these two macros will also work on aggregate -+ * data types like structs or unions. If the size of the accessed data -+ * type exceeds the word size of the machine (e.g., 32 bits or 64 bits) -+ * READ_ONCE() and WRITE_ONCE() will fall back to memcpy and print a -+ * compile-time warning. -+ * -+ * Their two major use cases are: (1) Mediating communication between -+ * process-level code and irq/NMI handlers, all running on the same CPU, -+ * and (2) Ensuring that the compiler does not fold, spindle, or otherwise -+ * mutilate accesses that either do not require ordering or that interact -+ * with an explicit memory barrier or atomic instruction that provides the -+ * required ordering. -+ */ -+ -+#define __READ_ONCE(x, check) \ -+({ \ -+ union { typeof(x) __val; char __c[1]; } __u; \ -+ if (check) \ -+ __read_once_size(&(x), __u.__c, sizeof(x)); \ -+ else \ -+ __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \ -+ __u.__val; \ -+}) -+#define READ_ONCE(x) __READ_ONCE(x, 1) -+ -+/* -+ * Use READ_ONCE_NOCHECK() instead of READ_ONCE() if you need -+ * to hide memory access from KASAN. -+ */ -+#define READ_ONCE_NOCHECK(x) __READ_ONCE(x, 0) -+ -+#define WRITE_ONCE(x, val) \ -+({ \ -+ union { typeof(x) __val; char __c[1]; } __u = \ -+ { .__val = (__force typeof(x)) (val) }; \ -+ __write_once_size(&(x), __u.__c, sizeof(x)); \ -+ __u.__val; \ -+}) -+ -+/** -+ * smp_cond_acquire() - Spin wait for cond with ACQUIRE ordering -+ * @cond: boolean expression to wait for -+ * -+ * Equivalent to using smp_load_acquire() on the condition variable but employs -+ * the control dependency of the wait to reduce the barrier on many platforms. -+ * -+ * The control dependency provides a LOAD->STORE order, the additional RMB -+ * provides LOAD->LOAD order, together they provide LOAD->{LOAD,STORE} order, -+ * aka. ACQUIRE. -+ */ -+#define smp_cond_acquire(cond) do { \ -+ while (!(cond)) \ -+ cpu_relax(); \ -+ smp_rmb(); /* ctrl + rmb := acquire */ \ -+} while (0) -+ - #endif /* __KERNEL__ */ - - #endif /* __ASSEMBLY__ */ -@@ -304,6 +434,14 @@ void ftrace_likely_update(struct ftrace_ - #define __visible - #endif - -+/* -+ * Assume alignment of return value. -+ */ -+#ifndef __assume_aligned -+#define __assume_aligned(a, ...) -+#endif -+ -+ - /* Are two types/vars the same type (ignoring qualifiers)? */ - #ifndef __same_type - # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) -@@ -311,7 +449,7 @@ void ftrace_likely_update(struct ftrace_ - - /* Is this type a native word size -- useful for atomic operations */ - #ifndef __native_word --# define __native_word(t) (sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) -+# define __native_word(t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) - #endif - - /* Compile time object size, -1 for unknown */ -@@ -373,12 +511,38 @@ void ftrace_likely_update(struct ftrace_ - * to make the compiler aware of ordering is to put the two invocations of - * ACCESS_ONCE() in different C statements. - * -- * This macro does absolutely -nothing- to prevent the CPU from reordering, -- * merging, or refetching absolutely anything at any time. Its main intended -- * use is to mediate communication between process-level code and irq/NMI -- * handlers, all running on the same CPU. -+ * ACCESS_ONCE will only work on scalar types. For union types, ACCESS_ONCE -+ * on a union member will work as long as the size of the member matches the -+ * size of the union and the size is smaller than word size. -+ * -+ * The major use cases of ACCESS_ONCE used to be (1) Mediating communication -+ * between process-level code and irq/NMI handlers, all running on the same CPU, -+ * and (2) Ensuring that the compiler does not fold, spindle, or otherwise -+ * mutilate accesses that either do not require ordering or that interact -+ * with an explicit memory barrier or atomic instruction that provides the -+ * required ordering. -+ * -+ * If possible use READ_ONCE()/WRITE_ONCE() instead. - */ --#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) -+#define __ACCESS_ONCE(x) ({ \ -+ __maybe_unused typeof(x) __var = (__force typeof(x)) 0; \ -+ (volatile typeof(x) *)&(x); }) -+#define ACCESS_ONCE(x) (*__ACCESS_ONCE(x)) -+ -+/** -+ * lockless_dereference() - safely load a pointer for later dereference -+ * @p: The pointer to load -+ * -+ * Similar to rcu_dereference(), but for situations where the pointed-to -+ * object's lifetime is managed by something other than RCU. That -+ * "something other" might be reference counting or simple immortality. -+ */ -+#define lockless_dereference(p) \ -+({ \ -+ typeof(p) _________p1 = READ_ONCE(p); \ -+ smp_read_barrier_depends(); /* Dependency order vs. p above. */ \ -+ (_________p1); \ -+}) - - /* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */ - #ifdef CONFIG_KPROBES diff --git a/package/boot/uboot-imx6/patches/110-mx6cuboxi-mmc-fallback.patch b/package/boot/uboot-imx6/patches/110-mx6cuboxi-mmc-fallback.patch new file mode 100644 index 00000000000000..2b2fde5ec9a698 --- /dev/null +++ b/package/boot/uboot-imx6/patches/110-mx6cuboxi-mmc-fallback.patch @@ -0,0 +1,26 @@ +--- a/board/solidrun/mx6cuboxi/mx6cuboxi.c ++++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c +@@ -290,6 +290,12 @@ static void setup_iomux_enet(void) + udelay(100); + } + ++void board_boot_order(u32 *spl_boot_list) ++{ ++ spl_boot_list[0] = spl_boot_device(); ++ spl_boot_list[1] = BOOT_DEVICE_MMC1; ++} ++ + int board_phy_config(struct phy_device *phydev) + { + if (phydev->drv->config) +--- a/arch/arm/mach-imx/spl.c ++++ b/arch/arm/mach-imx/spl.c +@@ -176,7 +176,7 @@ int g_dnl_bind_fixup(struct usb_device_d + /* called from spl_mmc to see type of boot mode for storage (RAW or FAT) */ + u32 spl_boot_mode(const u32 boot_device) + { +- switch (spl_boot_device()) { ++ switch (boot_device) { + /* for MMC return either RAW or FAT mode */ + case BOOT_DEVICE_MMC1: + case BOOT_DEVICE_MMC2: diff --git a/package/boot/uboot-imx6/patches/110-wandboard-owrt-env.patch b/package/boot/uboot-imx6/patches/110-wandboard-owrt-env.patch deleted file mode 100644 index 7bef453cb55ccd..00000000000000 --- a/package/boot/uboot-imx6/patches/110-wandboard-owrt-env.patch +++ /dev/null @@ -1,89 +0,0 @@ ---- a/include/configs/wandboard.h -+++ b/include/configs/wandboard.h -@@ -49,7 +49,7 @@ - #define CONFIG_CMD_BMODE - #define CONFIG_CMD_SETEXPR - --#define CONFIG_BOOTDELAY 5 -+#define CONFIG_BOOTDELAY 3 - - #define CONFIG_SYS_MEMTEST_START 0x10000000 - #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 500 * SZ_1M) -@@ -102,13 +102,15 @@ - - #if defined(CONFIG_MX6DL) || defined(CONFIG_MX6S) - #define CONFIG_DEFAULT_FDT_FILE "imx6dl-wandboard.dtb" -+#define CONFIG_OWRT_NAME "openwrt-imx6-imx6dl-wandboard-fit-uImage.itb" - #elif defined(CONFIG_MX6Q) - #define CONFIG_DEFAULT_FDT_FILE "imx6q-wandboard.dtb" -+#define CONFIG_OWRT_NAME "openwrt-imx6-imx6q-wandboard-fit-uImage.itb" - #endif - - #define CONFIG_EXTRA_ENV_SETTINGS \ - "script=boot.scr\0" \ -- "image=zImage\0" \ -+ "image=" CONFIG_OWRT_NAME "\0" \ - "console=ttymxc0\0" \ - "splashpos=m,m\0" \ - "fdt_high=0xffffffff\0" \ -@@ -137,11 +139,11 @@ - "mmcargs=setenv bootargs console=${console},${baudrate} " \ - "root=${mmcroot}\0" \ - "loadbootscript=" \ -- "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ -+ "ext2load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ - "bootscript=echo Running bootscript from mmc ...; " \ - "source\0" \ -- "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ -- "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ -+ "loaduimage=ext2load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \ -+ "loadfdt=ext2load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ - "mmcboot=echo Booting from mmc ...; " \ - "run mmcargs; " \ - "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ -@@ -155,31 +157,7 @@ - "fi; " \ - "fi; " \ - "else " \ -- "bootz; " \ -- "fi;\0" \ -- "netargs=setenv bootargs console=${console},${baudrate} " \ -- "root=/dev/nfs " \ -- "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ -- "netboot=echo Booting from net ...; " \ -- "run netargs; " \ -- "if test ${ip_dyn} = yes; then " \ -- "setenv get_cmd dhcp; " \ -- "else " \ -- "setenv get_cmd tftp; " \ -- "fi; " \ -- "${get_cmd} ${image}; " \ -- "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ -- "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ -- "bootz ${loadaddr} - ${fdt_addr}; " \ -- "else " \ -- "if test ${boot_fdt} = try; then " \ -- "bootz; " \ -- "else " \ -- "echo WARN: Cannot load the DT; " \ -- "fi; " \ -- "fi; " \ -- "else " \ -- "bootz; " \ -+ "bootm; " \ - "fi;\0" - - #define CONFIG_BOOTCOMMAND \ -@@ -189,10 +167,10 @@ - "else " \ - "if run loadimage; then " \ - "run mmcboot; " \ -- "else run netboot; " \ -+ "else echo WARN: Can not boot the image; " \ - "fi; " \ - "fi; " \ -- "else run netboot; fi" -+ "fi" - - /* Miscellaneous configurable options */ - #define CONFIG_SYS_LONGHELP diff --git a/package/boot/uboot-kirkwood/Makefile b/package/boot/uboot-kirkwood/Makefile index e724bdf614cfab..4ce1485a134dce 100644 --- a/package/boot/uboot-kirkwood/Makefile +++ b/package/boot/uboot-kirkwood/Makefile @@ -7,10 +7,10 @@ include $(TOPDIR)/rules.mk -PKG_VERSION:=2018.03 +PKG_VERSION:=2019.01 PKG_RELEASE:=1 -PKG_HASH:=7e7477534409d5368eb1371ffde6820f0f79780a1a1f676161c48442cb303dfd +PKG_HASH:=50bd7e5a466ab828914d080d5f6a432345b500e8fba1ad3b7b61e95e60d51c22 include $(INCLUDE_DIR)/u-boot.mk include $(INCLUDE_DIR)/package.mk diff --git a/package/boot/uboot-kirkwood/patches/007-nsa310-uboot-generic.patch b/package/boot/uboot-kirkwood/patches/007-nsa310-uboot-generic.patch index f90842cadaf0f0..25d252d13fd5ea 100644 --- a/package/boot/uboot-kirkwood/patches/007-nsa310-uboot-generic.patch +++ b/package/boot/uboot-kirkwood/patches/007-nsa310-uboot-generic.patch @@ -28,21 +28,21 @@ NOTE: this patch is ready for upstream, LEDE-specific parts are in @@ -56,6 +56,9 @@ config TARGET_GOFLEXHOME config TARGET_NAS220 bool "BlackArmor NAS220" - + +config TARGET_NSA310 + bool "Zyxel NSA310 Board" + config TARGET_NSA310S bool "Zyxel NSA310S" - -@@ -80,6 +83,7 @@ source "board/raidsonic/ib62x0/Kconfig" + +@@ -86,6 +89,7 @@ source "board/raidsonic/ib62x0/Kconfig" source "board/Seagate/dockstar/Kconfig" source "board/Seagate/goflexhome/Kconfig" source "board/Seagate/nas220/Kconfig" +source "board/zyxel/nsa310/Kconfig" source "board/zyxel/nsa310s/Kconfig" - - endif + source "board/alliedtelesis/SBx81LIFKW/Kconfig" + source "board/alliedtelesis/SBx81LIFXCAT/Kconfig" --- /dev/null +++ b/board/zyxel/nsa310/Kconfig @@ -0,0 +1,12 @@ @@ -505,16 +505,19 @@ NOTE: this patch is ready for upstream, LEDE-specific parts are in +#endif /* __NSA310_H */ --- /dev/null +++ b/configs/nsa310_defconfig -@@ -0,0 +1,37 @@ +@@ -0,0 +1,40 @@ +CONFIG_ARM=y +CONFIG_KIRKWOOD=y +CONFIG_SYS_TEXT_BASE=0x600000 +CONFIG_TARGET_NSA310=y +CONFIG_IDENT_STRING="\nZyXEL NSA310 1-Bay Power Media Server" ++CONFIG_NR_DRAM_BANKS=2 +CONFIG_BOOTDELAY=3 +CONFIG_SYS_PROMPT="NSA310> " +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_FLASH is not set ++CONFIG_MVGBE=y ++CONFIG_MII=y +CONFIG_SYS_NS16550=y +CONFIG_CMD_FDT=y +CONFIG_OF_LIBFDT=y @@ -545,7 +548,7 @@ NOTE: this patch is ready for upstream, LEDE-specific parts are in +CONFIG_SYS_LONGHELP=y --- /dev/null +++ b/include/configs/nsa310.h -@@ -0,0 +1,119 @@ +@@ -0,0 +1,117 @@ +/* Copyright (C) 2015-2016 bodhi + * + * Based on @@ -654,8 +657,6 @@ NOTE: this patch is ready for upstream, LEDE-specific parts are in + */ +#define CONFIG_JFFS2_NAND +#define CONFIG_JFFS2_LZO -+#define CONFIG_MTD_DEVICE /* needed for mtdparts commands */ -+#define CONFIG_MTD_PARTITIONS + +/* + * Date Time diff --git a/package/boot/uboot-kirkwood/patches/008-nsa325-uboot-generic.patch b/package/boot/uboot-kirkwood/patches/008-nsa325-uboot-generic.patch index 27144221327d1e..d0bef45f88bd64 100644 --- a/package/boot/uboot-kirkwood/patches/008-nsa325-uboot-generic.patch +++ b/package/boot/uboot-kirkwood/patches/008-nsa325-uboot-generic.patch @@ -1,8 +1,8 @@ --- a/arch/arm/mach-kirkwood/Kconfig +++ b/arch/arm/mach-kirkwood/Kconfig -@@ -62,6 +62,9 @@ config TARGET_NSA310 - config TARGET_NSA310S - bool "Zyxel NSA310S" +@@ -68,6 +68,9 @@ config TARGET_SBx81LIFKW + config TARGET_SBx81LIFXCAT + bool "Allied Telesis SBx81GP24/SBx81GT24" +config TARGET_NSA325 + bool "Zyxel NSA325 board" @@ -10,13 +10,14 @@ endchoice config SYS_SOC -@@ -85,5 +88,6 @@ source "board/Seagate/goflexhome/Kconfig +@@ -91,6 +94,7 @@ source "board/Seagate/goflexhome/Kconfig source "board/Seagate/nas220/Kconfig" source "board/zyxel/nsa310/Kconfig" source "board/zyxel/nsa310s/Kconfig" +source "board/zyxel/nsa325/Kconfig" + source "board/alliedtelesis/SBx81LIFKW/Kconfig" + source "board/alliedtelesis/SBx81LIFXCAT/Kconfig" - endif --- /dev/null +++ b/board/zyxel/nsa325/Kconfig @@ -0,0 +1,12 @@ @@ -488,16 +489,19 @@ +#endif /* __NSA325_H */ --- /dev/null +++ b/configs/nsa325_defconfig -@@ -0,0 +1,37 @@ +@@ -0,0 +1,40 @@ +CONFIG_ARM=y +CONFIG_KIRKWOOD=y +CONFIG_SYS_TEXT_BASE=0x600000 +CONFIG_TARGET_NSA325=y +CONFIG_IDENT_STRING="\nZyXEL NSA325 2-Bay Power Media Server" ++CONFIG_NR_DRAM_BANKS=2 +CONFIG_BOOTDELAY=3 +CONFIG_SYS_PROMPT="NSA325> " +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_FLASH is not set ++CONFIG_MVGBE=y ++CONFIG_MII=y +CONFIG_SYS_NS16550=y +CONFIG_CMD_FDT=y +CONFIG_OF_LIBFDT=y @@ -528,7 +532,7 @@ +CONFIG_SYS_LONGHELP=y --- /dev/null +++ b/include/configs/nsa325.h -@@ -0,0 +1,122 @@ +@@ -0,0 +1,120 @@ +/* + * (C) Copyright 2016 bodhi + * @@ -638,8 +642,6 @@ + */ +#define CONFIG_JFFS2_NAND +#define CONFIG_JFFS2_LZO -+#define CONFIG_MTD_DEVICE /* needed for mtdparts commands */ -+#define CONFIG_MTD_PARTITIONS + +/* + * Date Time diff --git a/package/boot/uboot-kirkwood/patches/010-pogoplug_v4.patch b/package/boot/uboot-kirkwood/patches/010-pogoplug_v4.patch index 1508a98c1c878e..8aed96ad18c862 100644 --- a/package/boot/uboot-kirkwood/patches/010-pogoplug_v4.patch +++ b/package/boot/uboot-kirkwood/patches/010-pogoplug_v4.patch @@ -3,14 +3,14 @@ @@ -25,6 +25,9 @@ config TARGET_LSXL config TARGET_POGO_E02 bool "pogo_e02 Board" - + +config TARGET_POGOPLUGV4 + bool "Pogoplug V4 Board" + config TARGET_DNS325 bool "dns325 Board" - -@@ -77,6 +80,7 @@ source "board/Marvell/guruplug/Kconfig" + +@@ -83,6 +86,7 @@ source "board/Marvell/guruplug/Kconfig" source "board/Marvell/sheevaplug/Kconfig" source "board/buffalo/lsxl/Kconfig" source "board/cloudengines/pogo_e02/Kconfig" @@ -20,27 +20,27 @@ source "board/keymile/km_arm/Kconfig" --- a/arch/arm/mach-kirkwood/include/mach/kw88f6192.h +++ b/arch/arm/mach-kirkwood/include/mach/kw88f6192.h -@@ -16,6 +16,6 @@ +@@ -15,6 +15,6 @@ #define KW_REGS_PHY_BASE KW88F6192_REGS_PHYS_BASE - + /* TCLK Core Clock defination */ -#define CONFIG_SYS_TCLK 166000000 /* 166MHz */ +#define CONFIG_SYS_TCLK 166666667 /* 166MHz */ - + #endif /* _CONFIG_KW88F6192_H */ --- a/arch/arm/mach-kirkwood/include/mach/mpp.h +++ b/arch/arm/mach-kirkwood/include/mach/mpp.h -@@ -217,10 +217,12 @@ +@@ -216,10 +216,12 @@ #define MPP33_GPIO MPP( 33, 0x0, 1, 1, 0, 1, 1, 1 ) #define MPP33_TDM_DTX MPP( 33, 0x2, 0, 1, 0, 0, 1, 1 ) #define MPP33_GE1_13 MPP( 33, 0x3, 0, 0, 0, 1, 1, 1 ) +#define MPP33_SATA1_ACTn MPP( 33, 0x5, 0, 1, 0, 1, 1, 1 ) - + #define MPP34_GPIO MPP( 34, 0x0, 1, 1, 0, 1, 1, 1 ) #define MPP34_TDM_SPI_CS1 MPP( 34, 0x2, 0, 1, 0, 0, 1, 1 ) #define MPP34_GE1_14 MPP( 34, 0x3, 0, 0, 0, 1, 1, 1 ) +#define MPP34_SATA1_ACTn MPP( 34, 0x5, 0, 1, 0, 1, 1, 1 ) - + #define MPP35_GPIO MPP( 35, 0x0, 1, 1, 1, 1, 1, 1 ) #define MPP35_TDM_CH0_TX_QL MPP( 35, 0x2, 0, 1, 0, 0, 1, 1 ) --- /dev/null @@ -532,16 +532,19 @@ +#endif /* __POGOPLUGV4_H */ --- /dev/null +++ b/configs/pogoplugv4_defconfig -@@ -0,0 +1,40 @@ +@@ -0,0 +1,43 @@ +CONFIG_ARM=y +CONFIG_KIRKWOOD=y +CONFIG_SYS_TEXT_BASE=0x600000 +CONFIG_TARGET_POGOPLUGV4=y +CONFIG_SYS_PROMPT="pogoplugv4> " +CONFIG_IDENT_STRING="\nPogoplug V4" ++CONFIG_NR_DRAM_BANKS=2 +CONFIG_BOOTDELAY=3 +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_FLASH is not set ++CONFIG_MVGBE=y ++CONFIG_MII=y +CONFIG_SYS_NS16550=y +CONFIG_CMD_FDT=y +CONFIG_OF_LIBFDT=y @@ -575,7 +578,7 @@ +CONFIG_SYS_LONGHELP=y --- a/drivers/gpio/kw_gpio.c +++ b/drivers/gpio/kw_gpio.c -@@ -148,3 +148,36 @@ void kw_gpio_set_blink(unsigned pin, int +@@ -147,3 +147,36 @@ void kw_gpio_set_blink(unsigned pin, int /* Set blinking. */ __set_blinking(pin, blink); } @@ -619,9 +622,9 @@ obj-$(CONFIG_MMC_SDHCI_XENON) += xenon_sdhci.o obj-$(CONFIG_MMC_SDHCI_ZYNQ) += zynq_sdhci.o +obj-$(CONFIG_KIRKWOOD_MMC) += kirkwood_mmc.o - + obj-$(CONFIG_MMC_SUNXI) += sunxi_mmc.o - obj-$(CONFIG_MMC_UNIPHIER) += uniphier-sd.o + obj-$(CONFIG_MMC_UNIPHIER) += tmio-common.o uniphier-sd.o --- /dev/null +++ b/drivers/mmc/kirkwood_mmc.c @@ -0,0 +1,482 @@ @@ -1109,10 +1112,10 @@ +} --- a/include/configs/mv-common.h +++ b/include/configs/mv-common.h -@@ -117,4 +117,10 @@ - #define CONFIG_MTD_PARTITIONS +@@ -77,4 +77,10 @@ + #define CONFIG_SYS_MAX_NAND_DEVICE 1 #endif - + +/* + * Kirkwood MMC + */ @@ -1122,7 +1125,7 @@ #endif /* _MV_COMMON_H */ --- /dev/null +++ b/include/configs/pogoplugv4.h -@@ -0,0 +1,129 @@ +@@ -0,0 +1,127 @@ +/* + * Copyright (C) 2014-2016 bodhi + * Based on @@ -1229,8 +1232,6 @@ + */ +#define CONFIG_JFFS2_NAND +#define CONFIG_JFFS2_LZO -+#define CONFIG_MTD_DEVICE /* needed for mtdparts commands */ -+#define CONFIG_MTD_PARTITIONS + +/* + * SATA diff --git a/package/boot/uboot-kirkwood/patches/110-dockstar.patch b/package/boot/uboot-kirkwood/patches/110-dockstar.patch index e67a888a4833a3..f060c33c6322c7 100644 --- a/package/boot/uboot-kirkwood/patches/110-dockstar.patch +++ b/package/boot/uboot-kirkwood/patches/110-dockstar.patch @@ -1,21 +1,21 @@ --- a/include/configs/dockstar.h +++ b/include/configs/dockstar.h -@@ -18,6 +18,7 @@ +@@ -17,6 +17,7 @@ #define CONFIG_FEROCEON_88FR131 1 /* CPU Core subversion */ #define CONFIG_KW88F6281 1 /* SOC Name */ #define CONFIG_SKIP_LOWLEVEL_INIT /* disable board lowlevel_init */ +#define CONFIG_SYS_MVFS - + /* * mv-common.h should be defined after CMD configs since it used them -@@ -36,27 +37,22 @@ +@@ -35,27 +36,22 @@ * it has to be rounded to sector size */ #define CONFIG_ENV_SIZE 0x20000 /* 128k */ -#define CONFIG_ENV_ADDR 0x80000 -#define CONFIG_ENV_OFFSET 0x80000 /* env starts here */ +#define CONFIG_ENV_OFFSET 0xe0000 /* env starts here */ - + /* * Default environment variables */ @@ -29,7 +29,7 @@ + "ubi part ubi; " \ + "ubi read 0x800000 kernel; " \ + "bootm 0x800000" - + #define CONFIG_EXTRA_ENV_SETTINGS \ - "console=console=ttyS0,115200\0" \ - "mtdids=nand0=orion_nand\0" \ @@ -41,17 +41,17 @@ + "mtdids=nand0=orion_nand\0" \ + "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ + "bootargs_root=\0" - + /* * Ethernet Driver configuration --- a/configs/dockstar_defconfig +++ b/configs/dockstar_defconfig -@@ -16,7 +16,7 @@ CONFIG_CMD_PING=y - CONFIG_CMD_EXT2=y +@@ -18,7 +18,7 @@ CONFIG_CMD_PING=y CONFIG_CMD_FAT=y CONFIG_CMD_JFFS2=y + CONFIG_CMD_MTDPARTS=y -CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:1m(uboot),-(root)" +CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:0xe0000@0x0(uboot),0x20000@0xe0000(uboot_env),0x100000@0x100000(second_stage_uboot),-@0x200000(ubi)" CONFIG_CMD_UBI=y CONFIG_ISO_PARTITION=y - CONFIG_ENV_IS_IN_NAND=y + CONFIG_OF_CONTROL=y diff --git a/package/boot/uboot-kirkwood/patches/120-iconnect.patch b/package/boot/uboot-kirkwood/patches/120-iconnect.patch index 7ff721218f5184..e7acf1a27f9577 100644 --- a/package/boot/uboot-kirkwood/patches/120-iconnect.patch +++ b/package/boot/uboot-kirkwood/patches/120-iconnect.patch @@ -1,12 +1,12 @@ --- a/include/configs/iconnect.h +++ b/include/configs/iconnect.h -@@ -44,24 +44,22 @@ +@@ -42,24 +42,22 @@ #define CONFIG_ENV_SECT_SIZE 0x20000 #endif #define CONFIG_ENV_SIZE 0x20000 -#define CONFIG_ENV_OFFSET 0x80000 +#define CONFIG_ENV_OFFSET 0xe0000 - + /* * Default environment variables */ @@ -18,7 +18,7 @@ + "ubi part ubi; " \ + "ubi read 0x800000 kernel; " \ "bootm 0x800000" - + #define CONFIG_EXTRA_ENV_SETTINGS \ "console=console=ttyS0,115200\0" \ "mtdids=nand0=orion_nand\0" \ @@ -27,12 +27,12 @@ - "bootargs_root=noinitrd ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs\0" + "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ + "bootargs_root=\0" - + /* * Ethernet driver configuration --- a/configs/iconnect_defconfig +++ b/configs/iconnect_defconfig -@@ -10,12 +10,13 @@ CONFIG_SYS_PROMPT="iconnect => " +@@ -11,13 +11,14 @@ CONFIG_SYS_PROMPT="iconnect => " CONFIG_CMD_NAND=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set @@ -42,8 +42,9 @@ CONFIG_CMD_EXT2=y CONFIG_CMD_FAT=y CONFIG_CMD_JFFS2=y + CONFIG_CMD_MTDPARTS=y -CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:0x80000@0x0(uboot),0x20000@0x80000(uboot_env),-@0xa0000(rootfs)" +CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:0xe0000@0x0(uboot),0x20000@0xe0000(uboot_env),0x100000@0x100000(second_stage_uboot),-@0x200000(ubi)" CONFIG_CMD_UBI=y CONFIG_ISO_PARTITION=y - CONFIG_ENV_IS_IN_NAND=y + CONFIG_OF_CONTROL=y diff --git a/package/boot/uboot-kirkwood/patches/130-ib62x0.patch b/package/boot/uboot-kirkwood/patches/130-ib62x0.patch index fcb0a88a059e3c..2327c4a910ba46 100644 --- a/package/boot/uboot-kirkwood/patches/130-ib62x0.patch +++ b/package/boot/uboot-kirkwood/patches/130-ib62x0.patch @@ -1,6 +1,6 @@ --- a/include/configs/ib62x0.h +++ b/include/configs/ib62x0.h -@@ -49,21 +49,15 @@ +@@ -47,21 +47,15 @@ */ #define CONFIG_BOOTCOMMAND \ "setenv bootargs ${console} ${mtdparts} ${bootargs_root}; " \ @@ -14,7 +14,7 @@ + "ubi part ubi; " \ + "ubi read 0x800000 kernel; " \ + "bootm 0x800000" - + #define CONFIG_EXTRA_ENV_SETTINGS \ "console=console=ttyS0,115200\0" \ "mtdids=nand0=orion_nand\0" \ @@ -24,17 +24,17 @@ - "bootargs_root=ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs rw\0" + "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ + "bootargs_root=\0" - + /* * Ethernet driver configuration --- a/configs/ib62x0_defconfig +++ b/configs/ib62x0_defconfig -@@ -19,7 +19,7 @@ CONFIG_CMD_PING=y - CONFIG_CMD_EXT2=y +@@ -21,7 +21,7 @@ CONFIG_CMD_PING=y CONFIG_CMD_FAT=y CONFIG_CMD_JFFS2=y + CONFIG_CMD_MTDPARTS=y -CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:0xe0000@0x0(uboot),0x20000@0xe0000(uboot_env),-@0x100000(root)" +CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:0xe0000@0x0(uboot),0x20000@0xe0000(uboot_env),0x100000@0x100000(second_stage_uboot),-@0x200000(ubi)" CONFIG_CMD_UBI=y CONFIG_ISO_PARTITION=y - CONFIG_ENV_IS_IN_NAND=y + CONFIG_OF_CONTROL=y diff --git a/package/boot/uboot-kirkwood/patches/140-pogoplug_e02.patch b/package/boot/uboot-kirkwood/patches/140-pogoplug_e02.patch index 93adad6aa29124..69e21e60f7e356 100644 --- a/package/boot/uboot-kirkwood/patches/140-pogoplug_e02.patch +++ b/package/boot/uboot-kirkwood/patches/140-pogoplug_e02.patch @@ -1,12 +1,12 @@ --- a/include/configs/pogo_e02.h +++ b/include/configs/pogo_e02.h -@@ -44,23 +44,23 @@ +@@ -42,23 +42,23 @@ #endif - + #define CONFIG_ENV_SIZE 0x20000 /* 128k */ -#define CONFIG_ENV_OFFSET 0x60000 /* env starts here */ +#define CONFIG_ENV_OFFSET 0xe0000 /* env starts here */ - + /* * Default environment variables */ @@ -19,7 +19,7 @@ + "ubifsmount ubi:rootfs; " \ + "ubi read 0x800000 kernel; " \ + "bootm 0x800000" - + #define CONFIG_EXTRA_ENV_SETTINGS \ - "mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage)," \ - "32M(rootfs),-(data)\0"\ @@ -31,16 +31,16 @@ + "mtdids=nand0=orion_nand\0" \ + "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ + "bootargs_root=\0" - + /* * Ethernet Driver configuration --- a/configs/pogo_e02_defconfig +++ b/configs/pogo_e02_defconfig -@@ -16,6 +16,7 @@ CONFIG_CMD_PING=y - CONFIG_CMD_EXT2=y +@@ -18,6 +18,7 @@ CONFIG_CMD_PING=y CONFIG_CMD_FAT=y CONFIG_CMD_JFFS2=y + CONFIG_CMD_MTDPARTS=y +CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:0xe0000@0x0(uboot),0x20000@0xe0000(uboot_env),0x100000@0x100000(second_stage_uboot),-@0x200000(ubi)" CONFIG_CMD_UBI=y CONFIG_ISO_PARTITION=y - CONFIG_ENV_IS_IN_NAND=y + CONFIG_OF_CONTROL=y diff --git a/package/boot/uboot-kirkwood/patches/150-goflexhome.patch b/package/boot/uboot-kirkwood/patches/150-goflexhome.patch index 540c0f50708d33..854a1800c33a6e 100644 --- a/package/boot/uboot-kirkwood/patches/150-goflexhome.patch +++ b/package/boot/uboot-kirkwood/patches/150-goflexhome.patch @@ -1,6 +1,6 @@ --- a/include/configs/goflexhome.h +++ b/include/configs/goflexhome.h -@@ -69,17 +69,15 @@ +@@ -66,17 +66,15 @@ */ #define CONFIG_BOOTCOMMAND \ "setenv bootargs ${console} ${mtdparts} ${bootargs_root}; " \ @@ -10,7 +10,7 @@ + "ubi part ubi; " \ + "ubi read 0x800000 kernel; " \ "bootm 0x800000" - + #define CONFIG_EXTRA_ENV_SETTINGS \ "console=console=ttyS0,115200\0" \ "mtdids=nand0=orion_nand\0" \ @@ -19,17 +19,17 @@ - "bootargs_root=ubi.mtd=root root=ubi0:root rootfstype=ubifs ro\0" + "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ + "bootargs_root=\0" - + /* * Ethernet Driver configuration --- a/configs/goflexhome_defconfig +++ b/configs/goflexhome_defconfig -@@ -21,7 +21,7 @@ CONFIG_CMD_EXT4=y - CONFIG_CMD_FAT=y +@@ -23,7 +23,7 @@ CONFIG_CMD_EXT4=y CONFIG_CMD_JFFS2=y + CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nand0=orion_nand" -CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:1m(uboot),6M(uImage),-(root)" +CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:1m(uboot),255m(ubi)" CONFIG_CMD_UBI=y CONFIG_ISO_PARTITION=y - CONFIG_ENV_IS_IN_NAND=y + CONFIG_OF_CONTROL=y diff --git a/package/boot/uboot-kirkwood/patches/200-openwrt-config.patch b/package/boot/uboot-kirkwood/patches/200-openwrt-config.patch index 6400e5bb699808..f26675182abaad 100644 --- a/package/boot/uboot-kirkwood/patches/200-openwrt-config.patch +++ b/package/boot/uboot-kirkwood/patches/200-openwrt-config.patch @@ -1,8 +1,8 @@ --- a/arch/arm/mach-kirkwood/Kconfig +++ b/arch/arm/mach-kirkwood/Kconfig -@@ -94,4 +94,7 @@ source "board/zyxel/nsa310/Kconfig" - source "board/zyxel/nsa310s/Kconfig" - source "board/zyxel/nsa325/Kconfig" +@@ -102,4 +102,7 @@ source "board/zyxel/nsa310/Kconfig" + source "board/alliedtelesis/SBx81LIFKW/Kconfig" + source "board/alliedtelesis/SBx81LIFXCAT/Kconfig" +config SECOND_STAGE + bool "OpenWrt second stage hack" @@ -10,16 +10,16 @@ endif --- a/include/configs/dockstar.h +++ b/include/configs/dockstar.h -@@ -68,4 +68,6 @@ - #define CONFIG_MTD_DEVICE /* needed for mtdparts commands */ - #define CONFIG_MTD_PARTITIONS +@@ -65,4 +65,6 @@ + * File system + */ +#include "openwrt-kirkwood-common.h" + #endif /* _CONFIG_DOCKSTAR_H */ --- a/include/configs/ib62x0.h +++ b/include/configs/ib62x0.h -@@ -87,4 +87,6 @@ +@@ -85,4 +85,6 @@ #define CONFIG_RTC_MV #endif /* CONFIG_CMD_DATE */ @@ -28,9 +28,9 @@ #endif /* _CONFIG_IB62x0_H */ --- a/include/configs/iconnect.h +++ b/include/configs/iconnect.h -@@ -76,4 +76,6 @@ - #define CONFIG_MTD_DEVICE - #define CONFIG_MTD_PARTITIONS +@@ -72,4 +72,6 @@ + * File system + */ +#include "openwrt-kirkwood-common.h" + @@ -71,25 +71,25 @@ +#endif /* __OPENWRT_KIRKWOOD_COMMON_H */ --- a/include/configs/pogo_e02.h +++ b/include/configs/pogo_e02.h -@@ -76,4 +76,6 @@ - #define CONFIG_MTD_DEVICE /* needed for mtdparts commands */ - #define CONFIG_MTD_PARTITIONS +@@ -72,4 +72,6 @@ + * File system + */ +#include "openwrt-kirkwood-common.h" + #endif /* _CONFIG_POGO_E02_H */ --- a/include/configs/goflexhome.h +++ b/include/configs/goflexhome.h -@@ -101,4 +101,6 @@ - #define CONFIG_RTC_MV - #endif /* CONFIG_CMD_DATE */ +@@ -91,4 +91,6 @@ + #define CONFIG_SYS_ATA_IDE0_OFFSET MV_SATA_PORT0_OFFSET + #endif /*CONFIG_MVSATA_IDE*/ +#include "openwrt-kirkwood-common.h" + #endif /* _CONFIG_GOFLEXHOME_H */ --- a/include/configs/nsa310.h +++ b/include/configs/nsa310.h -@@ -116,4 +116,6 @@ +@@ -114,4 +114,6 @@ #define CONFIG_RTC_MV #endif /* CONFIG_CMD_DATE */ @@ -98,10 +98,10 @@ #endif /* _CONFIG_NSA310_H */ --- a/configs/dockstar_defconfig +++ b/configs/dockstar_defconfig -@@ -26,3 +26,8 @@ CONFIG_USB=y +@@ -31,3 +31,8 @@ CONFIG_USB=y + CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y - CONFIG_OF_LIBFDT=y +CONFIG_CMD_BOOTZ=y +CONFIG_FIT=y +CONFIG_FIT_VERBOSE=y @@ -109,10 +109,10 @@ +CONFIG_LZO=y --- a/configs/goflexhome_defconfig +++ b/configs/goflexhome_defconfig -@@ -32,3 +32,8 @@ CONFIG_USB=y +@@ -40,3 +40,8 @@ CONFIG_USB=y + CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y - CONFIG_OF_LIBFDT=y +CONFIG_CMD_BOOTZ=y +CONFIG_FIT=y +CONFIG_FIT_VERBOSE=y @@ -120,24 +120,22 @@ +CONFIG_LZO=y --- a/configs/ib62x0_defconfig +++ b/configs/ib62x0_defconfig -@@ -29,5 +29,8 @@ CONFIG_SYS_NS16550=y +@@ -35,4 +35,7 @@ CONFIG_SYS_NS16550=y CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y -CONFIG_LZMA=y - CONFIG_OF_LIBFDT=y +CONFIG_FIT=y +CONFIG_FIT_VERBOSE=y +CONFIG_LZMA=y +CONFIG_LZO=y --- a/configs/iconnect_defconfig +++ b/configs/iconnect_defconfig -@@ -25,5 +25,9 @@ CONFIG_SYS_NS16550=y +@@ -31,4 +31,8 @@ CONFIG_SYS_NS16550=y CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y -CONFIG_LZMA=y - CONFIG_OF_LIBFDT=y +CONFIG_CMD_BOOTZ=y +CONFIG_FIT=y +CONFIG_FIT_VERBOSE=y @@ -145,7 +143,7 @@ +CONFIG_LZO=y --- a/configs/nsa310_defconfig +++ b/configs/nsa310_defconfig -@@ -32,6 +32,9 @@ CONFIG_CMD_UBI=y +@@ -35,6 +35,9 @@ CONFIG_CMD_UBI=y CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y @@ -157,10 +155,10 @@ CONFIG_SYS_LONGHELP=y --- a/configs/pogo_e02_defconfig +++ b/configs/pogo_e02_defconfig -@@ -26,3 +26,8 @@ CONFIG_USB=y +@@ -31,3 +31,8 @@ CONFIG_USB=y + CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y - CONFIG_OF_LIBFDT=y +CONFIG_CMD_BOOTZ=y +CONFIG_FIT=y +CONFIG_FIT_VERBOSE=y diff --git a/package/boot/uboot-lantiq/patches/0029-net-Use_packed_structures-for_networking.patch b/package/boot/uboot-lantiq/patches/0029-net-Use_packed_structures-for_networking.patch new file mode 100644 index 00000000000000..f2f77364e32389 --- /dev/null +++ b/package/boot/uboot-lantiq/patches/0029-net-Use_packed_structures-for_networking.patch @@ -0,0 +1,142 @@ +From 704f3acfcf55343043bbed01c5fb0a0094a68e8a Mon Sep 17 00:00:00 2001 +From: Denis Pynkin +Date: Fri, 21 Jul 2017 19:28:42 +0300 +Subject: [PATCH] net: Use packed structures for networking + +PXE boot is broken with GCC 7.1 due option '-fstore-merging' enabled +by default for '-O2': + +BOOTP broadcast 1 +data abort +pc : [<8ff8bb30>] lr : [<00004f1f>] +reloc pc : [<17832b30>] lr : [<878abf1f>] +sp : 8f558bc0 ip : 00000000 fp : 8ffef5a4 +r10: 8ffed248 r9 : 8f558ee0 r8 : 8ffef594 +r7 : 0000000e r6 : 8ffed700 r5 : 00000000 r4 : 8ffed74e +r3 : 00060101 r2 : 8ffed230 r1 : 8ffed706 r0 : 00000ddd +Flags: nzcv IRQs off FIQs off Mode SVC_32 +Resetting CPU ... + +Core reason is usage of structures for network headers without packed +attribute. + +Reviewed-by: Yauheni Kaliuta +Signed-off-by: Denis Pynkin +Acked-by: Joe Hershberger +--- + include/net.h | 14 +++++++------- + net/bootp.h | 2 +- + net/dns.h | 2 +- + net/nfs.h | 2 +- + net/sntp.h | 2 +- + 5 files changed, 11 insertions(+), 11 deletions(-) + +--- a/include/net.h ++++ b/include/net.h +@@ -203,7 +203,7 @@ struct ethernet_hdr { + uchar et_dest[6]; /* Destination node */ + uchar et_src[6]; /* Source node */ + ushort et_protlen; /* Protocol or length */ +-}; ++} __attribute__((packed)); + + /* Ethernet header size */ + #define ETHER_HDR_SIZE (sizeof(struct ethernet_hdr)) +@@ -219,7 +219,7 @@ struct e802_hdr { + uchar et_snap2; + uchar et_snap3; + ushort et_prot; /* 802 protocol */ +-}; ++} __attribute__((packed)); + + /* 802 + SNAP + ethernet header size */ + #define E802_HDR_SIZE (sizeof(struct e802_hdr)) +@@ -233,7 +233,7 @@ struct vlan_ethernet_hdr { + ushort vet_vlan_type; /* PROT_VLAN */ + ushort vet_tag; /* TAG of VLAN */ + ushort vet_type; /* protocol type */ +-}; ++} __attribute__((packed)); + + /* VLAN Ethernet header size */ + #define VLAN_ETHER_HDR_SIZE (sizeof(struct vlan_ethernet_hdr)) +@@ -260,7 +260,7 @@ struct ip_hdr { + ushort ip_sum; /* checksum */ + IPaddr_t ip_src; /* Source IP address */ + IPaddr_t ip_dst; /* Destination IP address */ +-}; ++} __attribute__((packed)); + + #define IP_OFFS 0x1fff /* ip offset *= 8 */ + #define IP_FLAGS 0xe000 /* first 3 bits */ +@@ -288,7 +288,7 @@ struct ip_udp_hdr { + ushort udp_dst; /* UDP destination port */ + ushort udp_len; /* Length of UDP packet */ + ushort udp_xsum; /* Checksum */ +-}; ++} __attribute__((packed)); + + #define IP_UDP_HDR_SIZE (sizeof(struct ip_udp_hdr)) + #define UDP_HDR_SIZE (IP_UDP_HDR_SIZE - IP_HDR_SIZE) +@@ -327,7 +327,7 @@ struct arp_hdr { + uchar ar_tha[]; /* Target hardware address */ + uchar ar_tpa[]; /* Target protocol address */ + #endif /* 0 */ +-}; ++} __attribute__((packed)); + + #define ARP_HDR_SIZE (8+20) /* Size assuming ethernet */ + +@@ -362,7 +362,7 @@ struct icmp_hdr { + } frag; + uchar data[0]; + } un; +-}; ++} __attribute__((packed)); + + #define ICMP_HDR_SIZE (sizeof(struct icmp_hdr)) + #define IP_ICMP_HDR_SIZE (IP_HDR_SIZE + ICMP_HDR_SIZE) +--- a/net/bootp.h ++++ b/net/bootp.h +@@ -49,7 +49,7 @@ struct Bootp_t { + char bp_sname[64]; /* Server host name */ + char bp_file[128]; /* Boot file name */ + char bp_vend[OPT_FIELD_SIZE]; /* Vendor information */ +-}; ++} __attribute__((packed)); + + #define BOOTP_HDR_SIZE sizeof(struct Bootp_t) + +--- a/net/dns.h ++++ b/net/dns.h +@@ -29,7 +29,7 @@ struct header { + uint16_t nauth; /* Authority PRs */ + uint16_t nother; /* Other PRs */ + unsigned char data[1]; /* Data, variable length */ +-}; ++} __attribute__((packed)); + + extern void DnsStart(void); /* Begin DNS */ + +--- a/net/sntp.h ++++ b/net/sntp.h +@@ -51,7 +51,7 @@ struct sntp_pkt_t { + unsigned long long originate_timestamp; + unsigned long long receive_timestamp; + unsigned long long transmit_timestamp; +-}; ++} __attribute__((packed)); + + extern void SntpStart(void); /* Begin SNTP */ + +--- a/net/nfs.h ++++ b/net/nfs.h +@@ -68,7 +68,7 @@ struct rpc_t { + uint32_t data[19]; + } reply; + } u; +-}; ++} __attribute__((packed)); + extern void NfsStart(void); /* Begin NFS */ + + diff --git a/package/boot/uboot-lantiq/patches/200-fix-dtc-header-guard.patch b/package/boot/uboot-lantiq/patches/200-fix-dtc-header-guard.patch new file mode 100644 index 00000000000000..88d914b1f5a30d --- /dev/null +++ b/package/boot/uboot-lantiq/patches/200-fix-dtc-header-guard.patch @@ -0,0 +1,19 @@ +--- a/include/libfdt_env.h ++++ b/include/libfdt_env.h +@@ -8,6 +8,7 @@ + + #ifndef _LIBFDT_ENV_H + #define _LIBFDT_ENV_H ++#define LIBFDT_ENV_H + + #include "compiler.h" + #include "linux/types.h" +--- a/include/libfdt.h ++++ b/include/libfdt.h +@@ -1,5 +1,6 @@ + #ifndef _LIBFDT_H + #define _LIBFDT_H ++#define LIBFDT_H + /* + * libfdt - Flat Device Tree manipulation + * Copyright (C) 2006 David Gibson, IBM Corporation. diff --git a/package/boot/uboot-layerscape-armv8_32b/Makefile b/package/boot/uboot-layerscape-armv8_32b/Makefile deleted file mode 100644 index 3d3b684dc1be62..00000000000000 --- a/package/boot/uboot-layerscape-armv8_32b/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -# -# Copyright (C) 2016 Jiang Yutang -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=uboot-layerscape-armv8_32b -PKG_SOURCE_DATE:=2018-01-22 -PKG_RELEASE:=1 - -# Layerscape ARMv8 platforms use 64-bit u-boot to support both 32-bit and 64-bit -# kernel/rootfs. Since OpenWrt could only provide 32-bit toolchain for 32-bit targets, -# 64-bit u-boot images git tree is provided here whose source code actually is -# uboot-layerscape's source code. -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/yangbolu1991/u-boot-lede.git -PKG_SOURCE_VERSION:=40a40dfd8136fcc314dd442a3b24a41b1e5652dd -PKG_MIRROR_HASH:=3dde5a33d19c573cbdce74f5d7edb6c5ca2a26a39d503c3efe5d5ad06f01e9f5 - -PKG_MAINTAINER:=Yangbo Lu - -include $(INCLUDE_DIR)/package.mk -include $(INCLUDE_DIR)/kernel.mk - -define Package/uboot-layerscape-armv8_32b - SECTION:=boot - CATEGORY:=Boot Loaders - DEPENDS:=@TARGET_layerscape_armv8_32b - TITLE:=U-Boot for ARMv8 32-bit based Layerscape boards - DEFAULT:=y - HIDDEN:=1 -endef - -define Build/Configure - -endef - -define Build/Compile - -endef - -define Build/InstallDev - $(INSTALL_DIR) $(STAGING_DIR_IMAGE) - $(CP) $(PKG_BUILD_DIR)/ls1043ardb-uboot.bin $(STAGING_DIR_IMAGE)/ls1043ardb-armv8_32b-uboot.bin - $(CP) $(PKG_BUILD_DIR)/ls1046ardb-uboot.bin $(STAGING_DIR_IMAGE)/ls1046ardb-armv8_32b-uboot.bin - $(CP) $(PKG_BUILD_DIR)/ls1012ardb-uboot.bin $(STAGING_DIR_IMAGE)/ls1012ardb-armv8_32b-uboot.bin - $(CP) $(PKG_BUILD_DIR)/ls1012afrdm-uboot.bin $(STAGING_DIR_IMAGE)/ls1012afrdm-armv8_32b-uboot.bin -endef - -$(eval $(call BuildPackage,uboot-layerscape-armv8_32b)) diff --git a/package/boot/uboot-layerscape/Makefile b/package/boot/uboot-layerscape/Makefile index 1805c1f0d356d2..ddf71bd986b948 100644 --- a/package/boot/uboot-layerscape/Makefile +++ b/package/boot/uboot-layerscape/Makefile @@ -6,16 +6,15 @@ # include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=uboot-layerscape -PKG_SOURCE_DATE:=2017-12-07 +PKG_VERSION:=lsdk-1903 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/qoriq-open-source/u-boot.git -PKG_SOURCE_VERSION:=9f7df1b406ff11409021cd2112beedd6b57bb600 -PKG_MIRROR_HASH:=b3756f814b731af2d03b0582ece90b2de564955b778f341fbfc34fa9bd849819 +PKG_SOURCE_URL:=https://source.codeaurora.org/external/qoriq/qoriq-components/u-boot +PKG_SOURCE_VERSION:=80b2d2bc4cab0a8363c9b7eba8064b1795f12670 +PKG_MIRROR_HASH:=5c467af40b4479f0ea16697ab54602bed815a23212293184943dca8a3a406d5c include $(INCLUDE_DIR)/u-boot.mk include $(INCLUDE_DIR)/package.mk @@ -25,49 +24,104 @@ define U-Boot/Default BUILD_SUBTARGET:=armv8_64b BUILD_DEVICES:=$(1) UBOOT_IMAGE:=u-boot-dtb.bin - HIDDEN:=y + ENV_SIZE:=0x2000 +endef + +define U-Boot/ls1012ardb + NAME:=NXP LS1012ARDB + UBOOT_CONFIG:=ls1012ardb_tfa + ENV_SIZE:=0x40000 +endef + +define U-Boot/ls1012afrwy + NAME:=NXP LS1012AFRWY + UBOOT_CONFIG:=ls1012afrwy_tfa + ENV_SIZE:=0x10000 endef define U-Boot/ls1043ardb - NAME:=NXP ls1043ardb 64b Dev Board + NAME:=NXP LS1043ARDB + UBOOT_CONFIG:=ls1043ardb_tfa endef +define U-Boot/ls1043ardb-sdboot + NAME:=NXP LS1043ARDB SD Card Boot + UBOOT_CONFIG:=ls1043ardb_tfa +endef + + define U-Boot/ls1046ardb - NAME:=NXP ls1046ardb 64b Dev Board - UBOOT_CONFIG:=ls1046ardb_qspi + NAME:=NXP LS1046ARDB + UBOOT_CONFIG:=ls1046ardb_tfa endef -define U-Boot/ls1012ardb - NAME:=NXP ls1012ardb 64b Dev Board - UBOOT_CONFIG:=ls1012ardb_qspi +define U-Boot/ls1046ardb-sdboot + NAME:=NXP LS1046ARDB SD Card Boot + UBOOT_CONFIG:=ls1046ardb_tfa endef + define U-Boot/ls1088ardb - NAME:=NXP ls1088ardb 64b Dev Board - UBOOT_CONFIG:=ls1088ardb_qspi + NAME:=NXP LS1088ARDB + UBOOT_CONFIG:=ls1088ardb_tfa +endef + + +define U-Boot/ls1088ardb-sdboot + NAME:=NXP LS1088ARDB SD Card Boot + UBOOT_CONFIG:=ls1088ardb_tfa endef define U-Boot/ls2088ardb - NAME:=NXP ls2088ardb 64b Dev Board - UBOOT_CONFIG:=ls2080ardb + NAME:=NXP LS2088ARDB + UBOOT_CONFIG:=ls2088ardb_tfa endef -define U-Boot/ls1012afrdm - NAME:=NXP ls1012afrdm 64b Dev Board - UBOOT_CONFIG:=ls1012afrdm_qspi +define U-Boot/ls1021atwr + NAME:=NXP LS1021ATWR + BUILD_SUBTARGET:=armv7 + UBOOT_CONFIG:=ls1021atwr_nor + ENV_SIZE:=0x20000 endef +define U-Boot/ls1021atwr-sdboot + NAME:=NXP LS1021ATWR SD Card Boot + BUILD_SUBTARGET:=armv7 + UBOOT_CONFIG:=ls1021atwr_sdcard_ifc + UBOOT_IMAGE:=u-boot-with-spl-pbl.bin + ENV_SIZE:=0x20000 +endef + +define U-Boot/ls1021aiot-sdboot + NAME:=NXP LS1021AIOT SD Card Boot + BUILD_SUBTARGET:=armv7 + UBOOT_CONFIG:=ls1021aiot_sdcard + UBOOT_IMAGE:=u-boot-with-spl-pbl.bin + ENV_SIZE:=0x2000 +endef + + UBOOT_TARGETS := \ - ls1043ardb \ - ls1046ardb \ - ls1012ardb \ - ls1088ardb \ - ls2088ardb \ - ls1012afrdm + ls1012ardb \ + ls1012afrwy \ + ls1043ardb \ + ls1043ardb-sdboot \ + ls1046ardb \ + ls1046ardb-sdboot \ + ls1088ardb \ + ls1088ardb-sdboot \ + ls2088ardb \ + ls1021atwr \ + ls1021atwr-sdboot \ + ls1021aiot-sdboot define Build/InstallDev $(INSTALL_DIR) $(STAGING_DIR_IMAGE) - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-$(BUILD_SUBTARGET)-uboot.bin + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) \ + $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-uboot.bin + $(PKG_BUILD_DIR)/tools/mkenvimage -s $(ENV_SIZE) \ + -o $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-uboot-env.bin \ + files/$(BUILD_VARIANT)-uEnv.txt endef define Package/u-boot/install/default diff --git a/package/boot/uboot-layerscape/files/ls1012afrwy-uEnv.txt b/package/boot/uboot-layerscape/files/ls1012afrwy-uEnv.txt new file mode 100644 index 00000000000000..31178df6909ca2 --- /dev/null +++ b/package/boot/uboot-layerscape/files/ls1012afrwy-uEnv.txt @@ -0,0 +1,8 @@ +fdtaddr=0x8f000000 +loadaddr=0x81000000 +fdt_high=0xffffffffffffffff +initrd_high=0xffffffffffffffff +sd_boot=mmc read $fdtaddr 7800 800;mmc read $loadaddr 8000 8000;bootm $loadaddr - $fdtaddr +bootargs=root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 +bootcmd=echo starting openwrt ...;pfe stop;run sd_boot +bootdelay=3 diff --git a/package/boot/uboot-layerscape/files/ls1012ardb-uEnv.txt b/package/boot/uboot-layerscape/files/ls1012ardb-uEnv.txt new file mode 100644 index 00000000000000..b5faeb255a95ad --- /dev/null +++ b/package/boot/uboot-layerscape/files/ls1012ardb-uEnv.txt @@ -0,0 +1,8 @@ +fdtaddr=0x8f000000 +loadaddr=0x81000000 +fdt_high=0xffffffffffffffff +initrd_high=0xffffffffffffffff +qspi_boot=sf probe 0:0;sf read $fdtaddr f00000 100000;sf read $loadaddr 1000000 1000000;bootm $loadaddr - $fdtaddr +bootargs=ubi.mtd=8 root=ubi0:rootfs rw rootfstype=ubifs noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 mtdparts=1550000.quadspi:1m(bl2),4m(fip),1m(u-boot-env),4m(reserved-1),3m(pfe),2m(reserved-2),1m(dtb),16m(kernel),32m(ubifs) +bootcmd=echo starting openwrt ...;pfe stop;run qspi_boot +bootdelay=3 diff --git a/package/boot/uboot-layerscape/files/ls1021aiot-sdboot-uEnv.txt b/package/boot/uboot-layerscape/files/ls1021aiot-sdboot-uEnv.txt new file mode 100644 index 00000000000000..7772daa1000183 --- /dev/null +++ b/package/boot/uboot-layerscape/files/ls1021aiot-sdboot-uEnv.txt @@ -0,0 +1,8 @@ +fdtaddr=0x8f000000 +loadaddr=0x81000000 +fdt_high=0xffffffff +initrd_high=0xffffffff +sd_boot=mmc read ${fdtaddr} 7800 800;mmc read ${loadaddr} 8000 8000;bootm ${loadaddr} - ${fdtaddr} +bootargs=root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 +bootcmd=echo starting openwrt ...;run sd_boot +bootdelay=3 diff --git a/package/boot/uboot-layerscape/files/ls1021atwr-sdboot-uEnv.txt b/package/boot/uboot-layerscape/files/ls1021atwr-sdboot-uEnv.txt new file mode 100644 index 00000000000000..0a1a6bdd1b8bfe --- /dev/null +++ b/package/boot/uboot-layerscape/files/ls1021atwr-sdboot-uEnv.txt @@ -0,0 +1,8 @@ +fdtaddr=0x8f000000 +loadaddr=0x81000000 +fdt_high=0xffffffff +initrd_high=0xffffffff +sd_boot=mmc read $fdtaddr 7800 800;mmc read $loadaddr 8000 8000;bootm $loadaddr - $fdtaddr +bootargs=root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 +bootcmd=echo starting openwrt ...;run sd_boot +bootdelay=3 diff --git a/package/boot/uboot-layerscape/files/ls1021atwr-uEnv.txt b/package/boot/uboot-layerscape/files/ls1021atwr-uEnv.txt new file mode 100644 index 00000000000000..f29904e0ade812 --- /dev/null +++ b/package/boot/uboot-layerscape/files/ls1021atwr-uEnv.txt @@ -0,0 +1,8 @@ +fdtaddr=0x8f000000 +loadaddr=0x81000000 +fdt_high=0xffffffff +initrd_high=0xffffffff +nor_boot=cp.b 60f00000 $fdtaddr 100000;cp.b 61000000 $loadaddr 1000000;bootm $loadaddr - $fdtaddr +bootargs=root=/dev/mtdblock6 rootfstype=squashfs,jffs2 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 mtdparts=60000000.nor:1m(rcw),2m(u-boot),1m(u-boot-env),11m(reserved-1),1m(dtb),16m(kernel),32m(rootfs) +bootcmd=echo starting openwrt ...;run nor_boot +bootdelay=3 diff --git a/package/boot/uboot-layerscape/files/ls1043ardb-sdboot-uEnv.txt b/package/boot/uboot-layerscape/files/ls1043ardb-sdboot-uEnv.txt new file mode 100644 index 00000000000000..c1596b506a02ad --- /dev/null +++ b/package/boot/uboot-layerscape/files/ls1043ardb-sdboot-uEnv.txt @@ -0,0 +1,9 @@ +fdtaddr=0x8f000000 +loadaddr=0x81000000 +fdt_high=0xffffffffffffffff +initrd_high=0xffffffffffffffff +hwconfig=fsl_ddr:bank_intlv=auto +sd_boot=mmc read $fdtaddr 7800 800;mmc read $loadaddr 8000 8000;bootm $loadaddr - $fdtaddr +bootargs=root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 +bootcmd=echo starting openwrt ...;run sd_boot +bootdelay=3 diff --git a/package/boot/uboot-layerscape/files/ls1043ardb-uEnv.txt b/package/boot/uboot-layerscape/files/ls1043ardb-uEnv.txt new file mode 100644 index 00000000000000..b040cffdbf8e71 --- /dev/null +++ b/package/boot/uboot-layerscape/files/ls1043ardb-uEnv.txt @@ -0,0 +1,9 @@ +fdtaddr=0x8f000000 +loadaddr=0x81000000 +fdt_high=0xffffffffffffffff +initrd_high=0xffffffffffffffff +hwconfig=fsl_ddr:bank_intlv=auto +nor_boot=cp.b 60f00000 $fdtaddr 100000;cp.b 61000000 $loadaddr 1000000;bootm $loadaddr - $fdtaddr +bootargs=root=/dev/mtdblock8 rootfstype=squashfs,jffs2 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 mtdparts=60000000.nor:1m(bl2),4m(fip),1m(u-boot-env),3m(reserved-1),256k(fman),5888k(reserved-2),1m(dtb),16m(kernel),32m(rootfs) +bootcmd=echo starting openwrt ...;run nor_boot +bootdelay=3 diff --git a/package/boot/uboot-layerscape/files/ls1046ardb-sdboot-uEnv.txt b/package/boot/uboot-layerscape/files/ls1046ardb-sdboot-uEnv.txt new file mode 100644 index 00000000000000..c1596b506a02ad --- /dev/null +++ b/package/boot/uboot-layerscape/files/ls1046ardb-sdboot-uEnv.txt @@ -0,0 +1,9 @@ +fdtaddr=0x8f000000 +loadaddr=0x81000000 +fdt_high=0xffffffffffffffff +initrd_high=0xffffffffffffffff +hwconfig=fsl_ddr:bank_intlv=auto +sd_boot=mmc read $fdtaddr 7800 800;mmc read $loadaddr 8000 8000;bootm $loadaddr - $fdtaddr +bootargs=root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 +bootcmd=echo starting openwrt ...;run sd_boot +bootdelay=3 diff --git a/package/boot/uboot-layerscape/files/ls1046ardb-uEnv.txt b/package/boot/uboot-layerscape/files/ls1046ardb-uEnv.txt new file mode 100644 index 00000000000000..ad3a3d6c375a17 --- /dev/null +++ b/package/boot/uboot-layerscape/files/ls1046ardb-uEnv.txt @@ -0,0 +1,9 @@ +fdtaddr=0x8f000000 +loadaddr=0x81000000 +fdt_high=0xffffffffffffffff +initrd_high=0xffffffffffffffff +hwconfig=fsl_ddr:bank_intlv=auto +qspi_boot=sf probe 0:0;sf read $fdtaddr f00000 100000;sf read $loadaddr 1000000 1000000;bootm $loadaddr - $fdtaddr +bootargs=ubi.mtd=9 root=ubi0:rootfs rw rootfstype=ubifs noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 mtdparts=1550000.quadspi:1m(bl2),4m(fip),1m(u-boot-env),3m(reserved-1),256k(fman),5888k(reserved-2),1m(dtb),16m(kernel),32m(ubifs) +bootcmd=echo starting openwrt ...;run qspi_boot +bootdelay=3 diff --git a/package/boot/uboot-layerscape/files/ls1088ardb-sdboot-uEnv.txt b/package/boot/uboot-layerscape/files/ls1088ardb-sdboot-uEnv.txt new file mode 100644 index 00000000000000..2d27f7eb05279b --- /dev/null +++ b/package/boot/uboot-layerscape/files/ls1088ardb-sdboot-uEnv.txt @@ -0,0 +1,10 @@ +fdtaddr=0x8f000000 +loadaddr=0x81000000 +fdt_high=0xa0000000 +initrd_high=0xffffffffffffffff +hwconfig=fsl_ddr:bank_intlv=auto +mc_init=mmc read 80000000 5000 1800;mmc read 80300000 7000 800;fsl_mc start mc 80000000 80300000;mmc read 80400000 6800 800;fsl_mc apply dpl 80400000 +sd_boot=mmc read $fdtaddr 7800 800;mmc read $loadaddr 8000 8000;bootm $loadaddr - $fdtaddr +bootargs=root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 +bootcmd=echo starting openwrt ...;run mc_init;run sd_boot +bootdelay=3 diff --git a/package/boot/uboot-layerscape/files/ls1088ardb-uEnv.txt b/package/boot/uboot-layerscape/files/ls1088ardb-uEnv.txt new file mode 100644 index 00000000000000..eb2c443b39e858 --- /dev/null +++ b/package/boot/uboot-layerscape/files/ls1088ardb-uEnv.txt @@ -0,0 +1,10 @@ +fdtaddr=0x8f000000 +loadaddr=0x81000000 +fdt_high=0xa0000000 +initrd_high=0xffffffffffffffff +hwconfig=fsl_ddr:bank_intlv=auto +mc_init=sf probe 0:0;sf read 80000000 a00000 300000;sf read 80300000 e00000 100000;fsl_mc start mc 80000000 80300000;sf read 80400000 d00000 100000;fsl_mc apply dpl 80400000 +qspi_boot=sf probe 0:0;sf read $fdtaddr f00000 100000;sf read $loadaddr 1000000 1000000;bootm $loadaddr - $fdtaddr +bootargs=ubi.mtd=10 root=ubi0:rootfs rw rootfstype=ubifs noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 mtdparts=20c0000.quadspi:1m(bl2),4m(fip),1m(u-boot-env),4m(reserved-1),3m(mc),1m(dpl),1m(dpc),1m(dtb),16m(kernel),32m(ubifs) +bootcmd=echo starting openwrt ...;run mc_init;run qspi_boot +bootdelay=3 diff --git a/package/boot/uboot-layerscape/files/ls2088ardb-uEnv.txt b/package/boot/uboot-layerscape/files/ls2088ardb-uEnv.txt new file mode 100644 index 00000000000000..31e937ffcb6659 --- /dev/null +++ b/package/boot/uboot-layerscape/files/ls2088ardb-uEnv.txt @@ -0,0 +1,10 @@ +fdtaddr=0x8f000000 +loadaddr=0x81000000 +fdt_high=0xa0000000 +initrd_high=0xffffffffffffffff +hwconfig=fsl_ddr:bank_intlv=auto +mc_init=fsl_mc start mc 580a00000 580e00000;fsl_mc apply dpl 580d00000 +nor_boot=cp.b 580f00000 $fdtaddr 100000;cp.b 581000000 $loadaddr 1000000;bootm $loadaddr - $fdtaddr +bootargs=root=/dev/mtdblock9 rootfstype=squashfs,jffs2 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS1,115200 mtdparts=580000000.nor:1m(bl2),4m(fip),1m(u-boot-env),4m(reserved-1),3m(mc),1m(dpl),1m(dpc),1m(dtb),16m(kernel),32m(rootfs) +bootcmd=echo starting openwrt ...;run mc_init;run nor_boot +bootdelay=3 diff --git a/package/boot/uboot-layerscape/patches/0001-armv8-ls1043a-add-LEDE-boot-support-in-environment.patch b/package/boot/uboot-layerscape/patches/0001-armv8-ls1043a-add-LEDE-boot-support-in-environment.patch deleted file mode 100644 index b5adca6202fbc1..00000000000000 --- a/package/boot/uboot-layerscape/patches/0001-armv8-ls1043a-add-LEDE-boot-support-in-environment.patch +++ /dev/null @@ -1,51 +0,0 @@ -From d1b42455f62baefe7fb782d0d7100715b0fdb41f Mon Sep 17 00:00:00 2001 -From: Yangbo Lu -Date: Fri, 19 Jan 2018 10:16:57 +0800 -Subject: [PATCH] armv8: ls1043a: add LEDE boot support in environment - -Signed-off-by: Yangbo Lu ---- - include/configs/ls1043a_common.h | 20 +++++++++++++++++++- - 1 files changed, 19 insertions(+), 1 deletions(-) - -diff --git a/include/configs/ls1043a_common.h b/include/configs/ls1043a_common.h -index c437ce5..48ecff5 100644 ---- a/include/configs/ls1043a_common.h -+++ b/include/configs/ls1043a_common.h -@@ -341,7 +341,19 @@ - "env exists secureboot && mmc read $kernelheader_addr_r " \ - "$kernelhdr_addr_sd $kernelhdr_size_sd " \ - " && esbc_validate ${kernelheader_addr_r};" \ -- " bootm $load_addr#$board\0" -+ " bootm $load_addr#$board\0" \ -+ "lede_setenv=setenv loadaddr 82000000 && " \ -+ "setenv fdtaddr 8f000000 && " \ -+ "setenv bootargs root=/dev/mtdblock8 " \ -+ "rootfstype=squashfs,jffs2 noinitrd " \ -+ "earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 " \ -+ "mtdparts=60000000.nor:1M(rcw),2M(u-boot),1M(u-boot-env)," \ -+ "5M(reserved-1),256k(fman),5888k(reserved-2),1M(dtb)," \ -+ "16M(kernel),32M(rootfs),64M(otherbank)\0" \ -+ "lede_run=cp.b 60f00000 $fdtaddr 100000 && " \ -+ "cp.b 61000000 $loadaddr 1000000 && " \ -+ "bootm $loadaddr - $fdtaddr\0" \ -+ "lede_boot=run lede_setenv;run lede_run\0" - - - #undef CONFIG_BOOTCOMMAND -@@ -356,6 +368,12 @@ - "env exists secureboot && esbc_halt;" - #endif - -+#undef CONFIG_BOOTCOMMAND -+#define CONFIG_BOOTCOMMAND "run lede_boot" -+ -+#undef CONFIG_BOOTDELAY -+#define CONFIG_BOOTDELAY 3 -+ - #define CONFIG_BOOTARGS "console=ttyS0,115200 root=/dev/ram0 " \ - "earlycon=uart8250,mmio,0x21c0500 " \ - MTDPARTS_DEFAULT --- -1.7.1 - diff --git a/package/boot/uboot-layerscape/patches/0001-modify-macro-QSPI_NOR_BOOTCOMMAND-of-ls1046ardb-for-.patch b/package/boot/uboot-layerscape/patches/0001-modify-macro-QSPI_NOR_BOOTCOMMAND-of-ls1046ardb-for-.patch new file mode 100644 index 00000000000000..d315c08f30c190 --- /dev/null +++ b/package/boot/uboot-layerscape/patches/0001-modify-macro-QSPI_NOR_BOOTCOMMAND-of-ls1046ardb-for-.patch @@ -0,0 +1,28 @@ +From 51f860f8293d834497c6f7f810fa4650cd82f9ac Mon Sep 17 00:00:00 2001 +From: Biwen Li +Date: Sat, 13 Apr 2019 14:21:47 +0800 +Subject: [PATCH] modify macro QSPI_NOR_BOOTCOMMAND of ls1046ardb for openwrt + +Signed-off-by: Biwen Li +--- + include/configs/ls1046ardb.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/configs/ls1046ardb.h b/include/configs/ls1046ardb.h +index cc1f5f5f55..925e717e4b 100644 +--- a/include/configs/ls1046ardb.h ++++ b/include/configs/ls1046ardb.h +@@ -217,8 +217,8 @@ + #ifndef SPL_NO_MISC + #undef CONFIG_BOOTCOMMAND + #ifdef CONFIG_TFABOOT +-#define QSPI_NOR_BOOTCOMMAND "run distro_bootcmd; run qspi_bootcmd; " \ +- "env exists secureboot && esbc_halt;;" ++#define QSPI_NOR_BOOTCOMMAND "echo (from QSPI_NOR_BOOTCOMMAND) starting openwrt; " \ ++ "run qspi_boot;" + #define SD_BOOTCOMMAND "run distro_bootcmd;run sd_bootcmd; " \ + "env exists secureboot && esbc_halt;" + #else +-- +2.17.1 + diff --git a/package/boot/uboot-layerscape/patches/0002-armv8-ls1046ardb-add-LEDE-boot-support-in-environmen.patch b/package/boot/uboot-layerscape/patches/0002-armv8-ls1046ardb-add-LEDE-boot-support-in-environmen.patch deleted file mode 100644 index f2e72870e756a9..00000000000000 --- a/package/boot/uboot-layerscape/patches/0002-armv8-ls1046ardb-add-LEDE-boot-support-in-environmen.patch +++ /dev/null @@ -1,57 +0,0 @@ -From a5293c6d5fdacf84fdd4772d0532aa5478df4d3c Mon Sep 17 00:00:00 2001 -From: Yangbo Lu -Date: Fri, 19 Jan 2018 10:18:47 +0800 -Subject: [PATCH] armv8: ls1046ardb: add LEDE boot support in environment - -Signed-off-by: Yangbo Lu ---- - include/configs/ls1046a_common.h | 15 ++++++++++++++- - include/configs/ls1046ardb.h | 6 ++++++ - 2 files changed, 20 insertions(+), 1 deletions(-) - -diff --git a/include/configs/ls1046a_common.h b/include/configs/ls1046a_common.h -index d163347..d26147b 100644 ---- a/include/configs/ls1046a_common.h -+++ b/include/configs/ls1046a_common.h -@@ -281,7 +281,20 @@ - "env exists secureboot && mmc read $kernelheader_addr_r " \ - "$kernelhdr_addr_sd $kernelhdr_size_sd " \ - " && esbc_validate ${kernelheader_addr_r};" \ -- " bootm $load_addr#$board\0" -+ " bootm $load_addr#$board\0" \ -+ "lede_setenv=setenv loadaddr 82000000 && " \ -+ "setenv fdtaddr 8f000000 && " \ -+ "setenv bootargs ubi.mtd=9 root=ubi0:rootfs rw " \ -+ "rootfstype=ubifs noinitrd " \ -+ "earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 " \ -+ "mtdparts=1550000.quadspi:1M(rcw),2M(u-boot),1M(u-boot-env)," \ -+ "5M(reserved-1),256k(fman),5888k(reserved-2),1M(dtb)," \ -+ "16M(kernel),32M(ubifs)\0" \ -+ "lede_run=sf probe 0:0 && " \ -+ "sf read $fdtaddr f00000 100000 && " \ -+ "sf read $loadaddr 1000000 1000000 && " \ -+ "bootm $loadaddr - $fdtaddr\0" \ -+ "lede_boot=run lede_setenv;run lede_run\0" - - - #define CONFIG_BOOTARGS "console=ttyS0,115200 root=/dev/ram0 " \ -diff --git a/include/configs/ls1046ardb.h b/include/configs/ls1046ardb.h -index 4475ac7..15e7858 100644 ---- a/include/configs/ls1046ardb.h -+++ b/include/configs/ls1046ardb.h -@@ -253,6 +253,12 @@ - "env exists secureboot && esbc_halt;" - #endif - -+#undef CONFIG_BOOTCOMMAND -+#define CONFIG_BOOTCOMMAND "run lede_boot" -+ -+#undef CONFIG_BOOTDELAY -+#define CONFIG_BOOTDELAY 3 -+ - #define MTDPARTS_DEFAULT "mtdparts=1550000.quadspi:1m(rcw)," \ - "15m(u-boot),48m(kernel.itb);" \ - "7e800000.flash:16m(nand_uboot)," \ --- -1.7.1 - diff --git a/package/boot/uboot-layerscape/patches/0002-modify-macro-QSPI_NOR_BOOTCOMMAND-of-ls1012afrwy-for.patch b/package/boot/uboot-layerscape/patches/0002-modify-macro-QSPI_NOR_BOOTCOMMAND-of-ls1012afrwy-for.patch new file mode 100644 index 00000000000000..cb75d0e1aafd1b --- /dev/null +++ b/package/boot/uboot-layerscape/patches/0002-modify-macro-QSPI_NOR_BOOTCOMMAND-of-ls1012afrwy-for.patch @@ -0,0 +1,28 @@ +From 2999d128bef554da5ca7a553dfe1c31061df9c5c Mon Sep 17 00:00:00 2001 +From: Biwen Li +Date: Sun, 14 Apr 2019 13:36:52 +0800 +Subject: [PATCH] modify macro QSPI_NOR_BOOTCOMMAND of ls1012afrwy for openwrt + +Signed-off-by: Biwen Li +--- + include/configs/ls1012afrwy.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/configs/ls1012afrwy.h b/include/configs/ls1012afrwy.h +index 12e6437a05..900752970e 100644 +--- a/include/configs/ls1012afrwy.h ++++ b/include/configs/ls1012afrwy.h +@@ -122,8 +122,8 @@ + #undef CONFIG_BOOTCOMMAND + #ifdef CONFIG_TFABOOT + #undef QSPI_NOR_BOOTCOMMAND +-#define QSPI_NOR_BOOTCOMMAND "pfe stop; run distro_bootcmd; run sd_bootcmd; "\ +- "env exists secureboot && esbc_halt;" ++#define QSPI_NOR_BOOTCOMMAND "echo (from QSPI_NOR_BOOTCOMMAND) starting openwrt ...; "\ ++ "pfe stop; run sd_boot;" + #else + #define CONFIG_BOOTCOMMAND "pfe stop; run distro_bootcmd; run sd_bootcmd; "\ + "env exists secureboot && esbc_halt;" +-- +2.17.1 + diff --git a/package/boot/uboot-layerscape/patches/0003-armv8-ls1012ardb-add-LEDE-boot-support-in-environmen.patch b/package/boot/uboot-layerscape/patches/0003-armv8-ls1012ardb-add-LEDE-boot-support-in-environmen.patch deleted file mode 100644 index f9f1ed41a486af..00000000000000 --- a/package/boot/uboot-layerscape/patches/0003-armv8-ls1012ardb-add-LEDE-boot-support-in-environmen.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 8d6efca7eb2de012b98493206c87f31ee9b9e967 Mon Sep 17 00:00:00 2001 -From: Yangbo Lu -Date: Thu, 28 Sep 2017 11:25:58 +0800 -Subject: [PATCH 3/3] armv8: ls1012ardb: add LEDE boot support in environment - -Signed-off-by: Yangbo Lu ---- - include/configs/ls1012ardb.h | 21 ++++++++++++++++++++- - 1 file changed, 20 insertions(+), 1 deletion(-) - -diff --git a/include/configs/ls1012ardb.h b/include/configs/ls1012ardb.h -index 5fe3218..242cdf0 100644 ---- a/include/configs/ls1012ardb.h -+++ b/include/configs/ls1012ardb.h -@@ -127,13 +127,32 @@ - "$kernel_addr $kernel_size; env exists secureboot " \ - "&& sf read $kernelheader_addr_r $kernelheader_addr " \ - "$kernelheader_size && esbc_validate ${kernelheader_addr_r}; " \ -- "bootm $load_addr#$board\0" -+ "bootm $load_addr#$board\0" \ -+ "lede_setenv=setenv loadaddr 82000000 && " \ -+ "setenv fdtaddr 8f000000 && " \ -+ "setenv bootargs ubi.mtd=8 root=ubi0:rootfs rw " \ -+ "rootfstype=ubifs noinitrd " \ -+ "earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 " \ -+ "mtdparts=1550000.quadspi:1M(rcw),2M(u-boot),1M(u-boot-env)," \ -+ "5M(reserved-1),256k(fman),5888k(reserved-2),1M(dtb)," \ -+ "16M(kernel),32M(ubifs)\0" \ -+ "lede_run=pfe stop && sf probe 0:0 && " \ -+ "sf read $fdtaddr f00000 100000 && " \ -+ "sf read $loadaddr 1000000 1000000 && " \ -+ "bootm $loadaddr - $fdtaddr\0" \ -+ "lede_boot=run lede_setenv;run lede_run\0" - - #undef CONFIG_BOOTCOMMAND - #if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI) - #define CONFIG_BOOTCOMMAND "run distro_bootcmd; run qspi_bootcmd; " \ - "env exists secureboot && esbc_halt;" - #endif -+#undef CONFIG_BOOTCOMMAND -+#define CONFIG_BOOTCOMMAND "run lede_boot" -+ -+#undef CONFIG_BOOTDELAY -+#define CONFIG_BOOTDELAY 3 -+ - - #include - --- -2.7.4 - diff --git a/package/boot/uboot-layerscape/patches/0003-modify-macro-QSPI_NOR_BOOTCOMMAND-of-ls1012ardb-for-.patch b/package/boot/uboot-layerscape/patches/0003-modify-macro-QSPI_NOR_BOOTCOMMAND-of-ls1012ardb-for-.patch new file mode 100644 index 00000000000000..a4f21dfba86965 --- /dev/null +++ b/package/boot/uboot-layerscape/patches/0003-modify-macro-QSPI_NOR_BOOTCOMMAND-of-ls1012ardb-for-.patch @@ -0,0 +1,28 @@ +From 805c60e930a946560b52dfa83dd8e5fbdf2da15b Mon Sep 17 00:00:00 2001 +From: Biwen Li +Date: Sun, 14 Apr 2019 13:39:13 +0800 +Subject: [PATCH] modify macro QSPI_NOR_BOOTCOMMAND of ls1012ardb for openwrt + +Signed-off-by: Biwen Li +--- + include/configs/ls1012ardb.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/configs/ls1012ardb.h b/include/configs/ls1012ardb.h +index f6640fa499..51a2192c56 100644 +--- a/include/configs/ls1012ardb.h ++++ b/include/configs/ls1012ardb.h +@@ -115,8 +115,8 @@ + #undef CONFIG_BOOTCOMMAND + #ifdef CONFIG_TFABOOT + #undef QSPI_NOR_BOOTCOMMAND +-#define QSPI_NOR_BOOTCOMMAND "pfe stop; run distro_bootcmd; run qspi_bootcmd; "\ +- "env exists secureboot && esbc_halt;" ++#define QSPI_NOR_BOOTCOMMAND "echo (from QSPI_NOR_BOOTCOMMAND) starting openwrt ...; "\ ++ "pfe stop; run qspi_boot;" + #else + #define CONFIG_BOOTCOMMAND "pfe stop; run distro_bootcmd; run qspi_bootcmd; "\ + "env exists secureboot && esbc_halt;" +-- +2.17.1 + diff --git a/package/boot/uboot-layerscape/patches/0004-armv8-ls1088ardb-add-LEDE-boot-support-in-environmen.patch b/package/boot/uboot-layerscape/patches/0004-armv8-ls1088ardb-add-LEDE-boot-support-in-environmen.patch deleted file mode 100644 index 6ce71f2c667d4c..00000000000000 --- a/package/boot/uboot-layerscape/patches/0004-armv8-ls1088ardb-add-LEDE-boot-support-in-environmen.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 479bf0c0bec2e99442214facf0f414c2c737ac7b Mon Sep 17 00:00:00 2001 -From: Yangbo Lu -Date: Mon, 16 Oct 2017 11:57:36 +0800 -Subject: [PATCH] armv8: ls1088ardb: add LEDE boot support in environment - -Signed-off-by: Yangbo Lu ---- - include/configs/ls1088ardb.h | 27 ++++++++++++++++++++++++++- - 1 file changed, 26 insertions(+), 1 deletion(-) - -diff --git a/include/configs/ls1088ardb.h b/include/configs/ls1088ardb.h -index 7bd152d..4cefa40 100644 ---- a/include/configs/ls1088ardb.h -+++ b/include/configs/ls1088ardb.h -@@ -404,7 +404,20 @@ - "env exists secureboot && mmc read $kernelheader_addr_r " \ - "$kernelhdr_addr_sd $kernelhdr_size_sd " \ - " && esbc_validate ${kernelheader_addr_r};" \ -- "bootm $load_addr#$BOARD\0" -+ "bootm $load_addr#$BOARD\0" \ -+ "lede_setenv=setenv loadaddr 82000000 && " \ -+ "setenv fdtaddr 8f000000 && " \ -+ "setenv bootargs ubi.mtd=10 root=ubi0:rootfs rw " \ -+ "rootfstype=ubifs noinitrd " \ -+ "earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 " \ -+ "mtdparts=20c0000.quadspi:1M(rcw),2M(u-boot),1M(u-boot-env)," \ -+ "6M(reserved-1),3M(mc),1M(dpl),1M(dpc),1M(dtb)," \ -+ "16M(kernel),32M(ubifs)\0" \ -+ "lede_run=sf probe 0:0 && " \ -+ "sf read $fdtaddr f00000 100000 && " \ -+ "sf read $loadaddr 1000000 1000000 && " \ -+ "bootm $loadaddr - $fdtaddr\0" \ -+ "lede_boot=run lede_setenv;run lede_run\0" - - #undef CONFIG_BOOTCOMMAND - #if defined(CONFIG_QSPI_BOOT) -@@ -429,6 +442,18 @@ - "run distro_bootcmd;run sd_bootcmd;" \ - "env exists secureboot && esbc_halt;" - #endif -+ -+#undef CONFIG_BOOTCOMMAND -+#define CONFIG_BOOTCOMMAND \ -+ "sf probe 0:0;sf read 0x80000000 0xA00000 0x300000;" \ -+ "sf read 0x80300000 0xE00000 0x100000;" \ -+ "fsl_mc start mc 0x80000000 0x80300000;" \ -+ "sf read 0x80400000 0xd00000 0x100000;" \ -+ "fsl_mc apply dpl 0x80400000;" \ -+ "run lede_boot;" -+#undef CONFIG_BOOTDELAY -+#define CONFIG_BOOTDELAY 3 -+ - /* MAC/PHY configuration */ - #ifdef CONFIG_FSL_MC_ENET - #define CONFIG_PHYLIB_10G --- -2.7.4 - diff --git a/package/boot/uboot-layerscape/patches/0005-armv8-ls2088ardb-add-LEDE-boot-support-in-environmen.patch b/package/boot/uboot-layerscape/patches/0005-armv8-ls2088ardb-add-LEDE-boot-support-in-environmen.patch deleted file mode 100644 index 6da256ab068e50..00000000000000 --- a/package/boot/uboot-layerscape/patches/0005-armv8-ls2088ardb-add-LEDE-boot-support-in-environmen.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 20f270670d1d5e14f3fd128f359535300a955ac8 Mon Sep 17 00:00:00 2001 -From: Yangbo Lu -Date: Mon, 16 Oct 2017 12:37:05 +0800 -Subject: [PATCH] armv8: ls2088ardb: add LEDE boot support in environment - -Signed-off-by: Yangbo Lu ---- - include/configs/ls2080ardb.h | 23 ++++++++++++++++++++++- - 1 file changed, 22 insertions(+), 1 deletion(-) - -diff --git a/include/configs/ls2080ardb.h b/include/configs/ls2080ardb.h -index 8a34990..8ae3944 100644 ---- a/include/configs/ls2080ardb.h -+++ b/include/configs/ls2080ardb.h -@@ -432,7 +432,19 @@ unsigned long get_board_sys_clk(void); - "env exists secureboot && mmc read $kernelheader_addr_r " \ - "$kernelhdr_addr_sd $kernelhdr_size_sd " \ - " && esbc_validate ${kernelheader_addr_r};" \ -- "bootm $load_addr#$board\0" -+ "bootm $load_addr#$board\0" \ -+ "lede_setenv=setenv loadaddr 82000000 && " \ -+ "setenv fdtaddr 8f000000 && " \ -+ "setenv bootargs root=/dev/mtdblock9 " \ -+ "rootfstype=squashfs,jffs2 noinitrd " \ -+ "earlycon=uart8250,mmio,0x21c0500 console=ttyS1,115200 " \ -+ "mtdparts=580000000.nor:1M(rcw),2M(u-boot),1M(u-boot-env)," \ -+ "6M(reserved-1),3M(mc),1M(dpl),1M(dpc),1M(dtb)," \ -+ "16M(kernel),32M(rootfs),64M(otherbank)\0" \ -+ "lede_run=cp.b 580f00000 $fdtaddr 100000 && " \ -+ "cp.b 581000000 $loadaddr 1000000 && " \ -+ "bootm $loadaddr - $fdtaddr\0" \ -+ "lede_boot=run lede_setenv;run lede_run\0" - - #undef CONFIG_BOOTCOMMAND - #ifdef CONFIG_QSPI_BOOT -@@ -463,6 +475,15 @@ unsigned long get_board_sys_clk(void); - "env exists secureboot && esbc_halt;" - #endif - -+#undef CONFIG_BOOTCOMMAND -+#define CONFIG_BOOTCOMMAND \ -+ "fsl_mc start mc 0x580a00000 0x580e00000;" \ -+ "fsl_mc apply dpl 0x580d00000;" \ -+ "run lede_boot;" -+ -+#undef CONFIG_BOOTDELAY -+#define CONFIG_BOOTDELAY 3 -+ - #undef CONFIG_BOOTARGS - #define CONFIG_BOOTARGS "console=ttyS1,115200 root=/dev/ram0 " \ - "earlycon=uart8250,mmio,0x21c0600 " \ --- -2.7.4 - diff --git a/package/boot/uboot-layerscape/patches/0006-armv8-ls1012afrdm-add-LEDE-boot-support-in-environme.patch b/package/boot/uboot-layerscape/patches/0006-armv8-ls1012afrdm-add-LEDE-boot-support-in-environme.patch deleted file mode 100644 index 524b7f45062c09..00000000000000 --- a/package/boot/uboot-layerscape/patches/0006-armv8-ls1012afrdm-add-LEDE-boot-support-in-environme.patch +++ /dev/null @@ -1,49 +0,0 @@ -From a5e454a3bb33a456655f08592606e4df34e40110 Mon Sep 17 00:00:00 2001 -From: Yangbo Lu -Date: Tue, 24 Oct 2017 17:48:08 +0800 -Subject: [PATCH] armv8: ls1012afrdm: add LEDE boot support in environment - -Signed-off-by: Yangbo Lu ---- - include/configs/ls1012afrdm.h | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -diff --git a/include/configs/ls1012afrdm.h b/include/configs/ls1012afrdm.h -index a3f8824d27..36dff19bdd 100644 ---- a/include/configs/ls1012afrdm.h -+++ b/include/configs/ls1012afrdm.h -@@ -73,12 +73,31 @@ - "qspi_bootcmd=echo Trying load from qspi..;" \ - "sf probe && sf read $load_addr " \ - "$kernel_addr $kernel_size && bootm $load_addr#$board\0" \ -+ "lede_setenv=setenv loadaddr 82000000 && " \ -+ "setenv fdtaddr 8f000000 && " \ -+ "setenv bootargs ubi.mtd=8 root=ubi0:rootfs rw " \ -+ "rootfstype=ubifs noinitrd " \ -+ "earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 " \ -+ "mtdparts=1550000.quadspi:1M(rcw),2M(u-boot),1M(u-boot-env)," \ -+ "5M(reserved-1),256k(fman),5888k(reserved-2),1M(dtb)," \ -+ "16M(kernel),32M(ubifs)\0" \ -+ "lede_run=pfe stop && sf probe 0:0 && " \ -+ "sf read $fdtaddr f00000 100000 && " \ -+ "sf read $loadaddr 1000000 1000000 && " \ -+ "bootm $loadaddr - $fdtaddr\0" \ -+ "lede_boot=run lede_setenv;run lede_run\0" - - #undef CONFIG_BOOTCOMMAND - #if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI) - #define CONFIG_BOOTCOMMAND "run distro_bootcmd;run qspi_bootcmd" - #endif - -+#undef CONFIG_BOOTCOMMAND -+#define CONFIG_BOOTCOMMAND "run lede_boot" -+ -+#undef CONFIG_BOOTDELAY -+#define CONFIG_BOOTDELAY 3 -+ - /* - * USB - */ --- -2.14.1 - diff --git a/package/boot/uboot-mvebu/Makefile b/package/boot/uboot-mvebu/Makefile index 61547acb27cf9e..d171daa71730ea 100644 --- a/package/boot/uboot-mvebu/Makefile +++ b/package/boot/uboot-mvebu/Makefile @@ -8,10 +8,10 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk -PKG_VERSION:=2018.03 +PKG_VERSION:=2019.04 PKG_RELEASE:=1 -PKG_HASH:=7e7477534409d5368eb1371ffde6820f0f79780a1a1f676161c48442cb303dfd +PKG_HASH:=76b7772d156b3ddd7644c8a1736081e55b78828537ff714065d21dbade229bef include $(INCLUDE_DIR)/u-boot.mk include $(INCLUDE_DIR)/package.mk @@ -24,13 +24,20 @@ endef define U-Boot/clearfog NAME:=SolidRun ClearFog A1 - BUILD_DEVICES:=armada-388-clearfog-base armada-388-clearfog-pro + BUILD_DEVICES:=solidrun_clearfog-base-a1 solidrun_clearfog-pro-a1 BUILD_SUBTARGET:=cortexa9 UBOOT_IMAGE:=u-boot-spl.kwb endef +define U-Boot/uDPU + NAME:=Methode uDPU + BUILD_DEVICES:=methode_udpu + BUILD_SUBTARGET:=cortexa53 +endef + UBOOT_TARGETS:= \ - clearfog + clearfog \ + uDPU Build/Exports:=$(Host/Exports) @@ -44,7 +51,7 @@ endef define Build/InstallDev $(INSTALL_DIR) $(STAGING_DIR_IMAGE) - $(CP) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-u-boot-spl.kwb + $(CP) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-$(UBOOT_IMAGE) endef $(eval $(call BuildPackage/U-Boot)) diff --git a/package/boot/uboot-mvebu/patches/100-add_support_for_macronix_mx25u12835f.patch b/package/boot/uboot-mvebu/patches/100-add_support_for_macronix_mx25u12835f.patch new file mode 100644 index 00000000000000..79b1b66e7650b2 --- /dev/null +++ b/package/boot/uboot-mvebu/patches/100-add_support_for_macronix_mx25u12835f.patch @@ -0,0 +1,10 @@ +--- a/drivers/mtd/spi/spi-nor-ids.c ++++ b/drivers/mtd/spi/spi-nor-ids.c +@@ -136,6 +136,7 @@ const struct flash_info spi_nor_ids[] = + { INFO("mx25u1635e", 0xc22535, 0, 64 * 1024, 32, SECT_4K) }, + { INFO("mx25u6435f", 0xc22537, 0, 64 * 1024, 128, SECT_4K) }, + { INFO("mx25l12805d", 0xc22018, 0, 64 * 1024, 256, 0) }, ++ { INFO("mx25u12835f", 0xc22538, 0, 64 * 1024, 256, SECT_4K) }, + { INFO("mx25l12855e", 0xc22618, 0, 64 * 1024, 256, 0) }, + { INFO("mx25l25635e", 0xc22019, 0, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, + { INFO("mx25u25635f", 0xc22539, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_4B_OPCODES) }, diff --git a/package/boot/uboot-mvebu/patches/120-mvebu_armada-37xx.h_increase_max_gunzip_size.patch b/package/boot/uboot-mvebu/patches/120-mvebu_armada-37xx.h_increase_max_gunzip_size.patch new file mode 100644 index 00000000000000..580270a70fc381 --- /dev/null +++ b/package/boot/uboot-mvebu/patches/120-mvebu_armada-37xx.h_increase_max_gunzip_size.patch @@ -0,0 +1,13 @@ +Increase max gunzip size in mvebu_armada-37xx.h. +This is required in order to boot itb images. + +--- a/include/configs/mvebu_armada-37xx.h ++++ b/include/configs/mvebu_armada-37xx.h +@@ -12,6 +12,7 @@ + + /* additions for new ARM relocation support */ + #define CONFIG_SYS_SDRAM_BASE 0x00000000 ++#define CONFIG_SYS_BOOTM_LEN (64 << 20) /* Increase max gunzip size */ + + #define CONFIG_NR_DRAM_BANKS 1 + diff --git a/package/boot/uboot-mxs/Makefile b/package/boot/uboot-mxs/Makefile index 5636dcfbb46dda..04d3f15f95b8ff 100644 --- a/package/boot/uboot-mxs/Makefile +++ b/package/boot/uboot-mxs/Makefile @@ -8,10 +8,10 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk -PKG_VERSION:=2017.11 +PKG_VERSION:=2019.10 PKG_RELEASE:=1 -PKG_HASH:=6a018fd3caf58f3dcfa23ee989a82bd35df03af71872b9dca8c6d758a0d26c05 +PKG_HASH:=8d6d6070739522dd236cba7055b8736bfe92b4fac0ea18ad809829ca79667014 include $(INCLUDE_DIR)/u-boot.mk include $(INCLUDE_DIR)/package.mk diff --git a/package/boot/uboot-mxs/patches/001-add-i2se-duckbill.patch b/package/boot/uboot-mxs/patches/001-add-i2se-duckbill.patch index 1ad67fbba8297f..c7b8fd63eae360 100644 --- a/package/boot/uboot-mxs/patches/001-add-i2se-duckbill.patch +++ b/package/boot/uboot-mxs/patches/001-add-i2se-duckbill.patch @@ -1,6 +1,6 @@ -From 25de6430219d3f3698d709c10358fbea17b24cf1 Mon Sep 17 00:00:00 2001 +From 821d083ae4cfb795eab385eda43a20cdc8c3cacd Mon Sep 17 00:00:00 2001 From: Michael Heimpold -Date: Fri, 21 Apr 2017 11:08:19 +0200 +Date: Sun, 3 Nov 2019 00:50:21 +0100 Subject: [PATCH] arm: mxs: add support for I2SE's Duckbill boards The Duckbill devices are small, pen-drive sized boards based on @@ -8,7 +8,7 @@ NXP's i.MX28 SoC. While the initial variants (Duckbill series) were equipped with a micro SD card slot only, the latest generation (Duckbill 2 series) have an additional internal eMMC onboard. -Both device generations consists of four "family members": +Both device generations consist of four "family members": - Duckbill/Duckbill 2: generic board, intended to be used as baseboard for custom designs and/or as development board @@ -26,15 +26,15 @@ Both device generations consists of four "family members": Signed-off-by: Michael Heimpold Signed-off-by: Stefan Wahren --- - arch/arm/Kconfig | 9 +- + arch/arm/mach-imx/mxs/Kconfig | 5 + board/i2se/duckbill/Kconfig | 15 +++ board/i2se/duckbill/MAINTAINERS | 6 ++ - board/i2se/duckbill/Makefile | 12 +++ - board/i2se/duckbill/duckbill.c | 181 ++++++++++++++++++++++++++++++++++++ - board/i2se/duckbill/iomux.c | 157 +++++++++++++++++++++++++++++++ - configs/duckbill_defconfig | 31 +++++++ - include/configs/duckbill.h | 199 ++++++++++++++++++++++++++++++++++++++++ - 8 files changed, 609 insertions(+), 1 deletion(-) + board/i2se/duckbill/Makefile | 10 ++ + board/i2se/duckbill/duckbill.c | 186 ++++++++++++++++++++++++++++++++ + board/i2se/duckbill/iomux.c | 156 +++++++++++++++++++++++++++ + configs/duckbill_defconfig | 40 +++++++ + include/configs/duckbill.h | 179 ++++++++++++++++++++++++++++++ + 8 files changed, 597 insertions(+) create mode 100644 board/i2se/duckbill/Kconfig create mode 100644 board/i2se/duckbill/MAINTAINERS create mode 100644 board/i2se/duckbill/Makefile @@ -43,38 +43,32 @@ Signed-off-by: Stefan Wahren create mode 100644 configs/duckbill_defconfig create mode 100644 include/configs/duckbill.h ---- a/arch/arm/Kconfig -+++ b/arch/arm/Kconfig -@@ -373,6 +373,12 @@ config TARGET_MX28EVK - select SUPPORT_SPL - select BOARD_EARLY_INIT_F +diff --git a/arch/arm/mach-imx/mxs/Kconfig b/arch/arm/mach-imx/mxs/Kconfig +index 68072d5a1f..82aaa3ef76 100644 +--- a/arch/arm/mach-imx/mxs/Kconfig ++++ b/arch/arm/mach-imx/mxs/Kconfig +@@ -50,6 +50,10 @@ config TARGET_APX4DEVKIT + config TARGET_BG0900 + bool "Support bg0900" +config TARGET_DUCKBILL + bool "Support duckbill" -+ select CPU_ARM926EJS -+ select SUPPORT_SPL + select BOARD_EARLY_INIT_F + - config TARGET_MX23_OLINUXINO - bool "Support mx23_olinuxino" - select CPU_ARM926EJS -@@ -1250,6 +1256,7 @@ source "board/gumstix/pepper/Kconfig" - source "board/h2200/Kconfig" - source "board/hisilicon/hikey/Kconfig" - source "board/hisilicon/poplar/Kconfig" -+source "board/i2se/duckbill/Kconfig" - source "board/imx31_phycore/Kconfig" - source "board/isee/igep003x/Kconfig" - source "board/olimex/mx23_olinuxino/Kconfig" -@@ -1279,7 +1286,7 @@ source "arch/arm/Kconfig.debug" - endmenu - - config SPL_LDSCRIPT -- default "arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds" if TARGET_APX4DEVKIT || TARGET_BG0900 || TARGET_M28EVK || TARGET_MX23_OLINUXINO || TARGET_MX23EVK || TARGET_MX28EVK || TARGET_SANSA_FUZE_PLUS || TARGET_SC_SPS_1 || TARGET_TS4600 || TARGET_XFI3 -+ default "arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds" if TARGET_APX4DEVKIT || TARGET_BG0900 || TARGET_M28EVK || TARGET_MX23_OLINUXINO || TARGET_MX23EVK || TARGET_MX28EVK || TARGET_DUCKBILL || TARGET_SANSA_FUZE_PLUS || TARGET_SC_SPS_1 || TARGET_TS4600 || TARGET_XFI3 - default "arch/arm/cpu/arm1136/u-boot-spl.lds" if CPU_ARM1136 - default "arch/arm/cpu/armv8/u-boot-spl.lds" if ARM64 + config TARGET_MX28EVK + bool "Support mx28evk" + select BOARD_EARLY_INIT_F +@@ -67,6 +71,7 @@ config SYS_SOC + source "board/bluegiga/apx4devkit/Kconfig" + source "board/freescale/mx28evk/Kconfig" ++source "board/i2se/duckbill/Kconfig" + source "board/ppcag/bg0900/Kconfig" + source "board/schulercontrol/sc_sps_1/Kconfig" + source "board/technologic/ts4600/Kconfig" +diff --git a/board/i2se/duckbill/Kconfig b/board/i2se/duckbill/Kconfig +new file mode 100644 +index 0000000000..98c1e4689f --- /dev/null +++ b/board/i2se/duckbill/Kconfig @@ -0,0 +1,15 @@ @@ -93,6 +87,9 @@ Signed-off-by: Stefan Wahren + default "duckbill" + +endif +diff --git a/board/i2se/duckbill/MAINTAINERS b/board/i2se/duckbill/MAINTAINERS +new file mode 100644 +index 0000000000..5496baa330 --- /dev/null +++ b/board/i2se/duckbill/MAINTAINERS @@ -0,0 +1,6 @@ @@ -102,30 +99,33 @@ Signed-off-by: Stefan Wahren +F: board/i2se/duckbill/ +F: include/configs/duckbill.h +F: configs/duckbill_defconfig +diff --git a/board/i2se/duckbill/Makefile b/board/i2se/duckbill/Makefile +new file mode 100644 +index 0000000000..0079eb413c --- /dev/null +++ b/board/i2se/duckbill/Makefile -@@ -0,0 +1,12 @@ +@@ -0,0 +1,10 @@ ++# SPDX-License-Identifier: GPL-2.0+ +# -+# (C) Copyright 2014-2017 ++# (C) Copyright 2014-2019 +# Michael Heimpold, mhei@heimpold.de. -+# -+# SPDX-License-Identifier: GPL-2.0+ -+# + +ifndef CONFIG_SPL_BUILD +obj-y := duckbill.o +else +obj-y := iomux.o +endif +diff --git a/board/i2se/duckbill/duckbill.c b/board/i2se/duckbill/duckbill.c +new file mode 100644 +index 0000000000..f93c372611 --- /dev/null +++ b/board/i2se/duckbill/duckbill.c -@@ -0,0 +1,181 @@ +@@ -0,0 +1,186 @@ ++// SPDX-License-Identifier: GPL-2.0+ +/* + * I2SE Duckbill board + * -+ * (C) Copyright 2014-2017 Michael Heimpold -+ * -+ * SPDX-License-Identifier: GPL-2.0+ ++ * (C) Copyright 2014-2019 Michael Heimpold + */ + +#include @@ -205,7 +205,7 @@ Signed-off-by: Stefan Wahren + /* give PHY some time to get out of the reset */ + udelay(10000); + -+ ret = fecmxc_initialize(bis); ++ ret = fecmxc_initialize_multi(bis, 0, 0, MXS_ENET0_BASE); + if (ret) { + puts("FEC MXS: Unable to init FEC\n"); + return ret; @@ -228,22 +228,20 @@ Signed-off-by: Stefan Wahren + uint8_t enetaddr[6]; + u32 mac = 0; + -+ enetaddr[0] = 0x00; -+ enetaddr[1] = 0x01; -+ enetaddr[2] = 0x87; -+ +#ifdef CONFIG_MXS_OCOTP + /* only Duckbill SPI has a MAC for the QCA7k */ + fuse_read(0, 1, &mac); +#endif + + if (mac != 0) { ++ enetaddr[0] = 0x00; ++ enetaddr[1] = 0x01; ++ enetaddr[2] = 0x87; + enetaddr[3] = (mac >> 16) & 0xff; + enetaddr[4] = (mac >> 8) & 0xff; + enetaddr[5] = mac & 0xff; + -+ fdt_find_and_setprop(blob, -+ "/apb@80000000/apbh@80000000/ssp@80014000/ethernet@0", ++ fdt_find_and_setprop(blob, "spi1/ethernet@0", + "local-mac-address", enetaddr, 6, 1); + } + @@ -279,6 +277,14 @@ Signed-off-by: Stefan Wahren + gpio_get_value(MX28_PAD_LCD_D17__GPIO_1_17); + system_rev += 1; + ++ /* guess DT blob if not set in environment */ ++ if (!env_get("fdt_file")) { ++ if (system_rev == 1) ++ env_set("fdt_file", "imx28-duckbill.dtb"); ++ else ++ env_set("fdt_file", "imx28-duckbill-2.dtb"); ++ } ++ + /* enable red LED to indicate a running bootloader */ + if (system_rev == 1) + led_red_gpio = MX28_PAD_AUART1_RX__GPIO_3_4; @@ -301,15 +307,17 @@ Signed-off-by: Stefan Wahren + + return 0; +} +diff --git a/board/i2se/duckbill/iomux.c b/board/i2se/duckbill/iomux.c +new file mode 100644 +index 0000000000..1db3c52c34 --- /dev/null +++ b/board/i2se/duckbill/iomux.c -@@ -0,0 +1,157 @@ +@@ -0,0 +1,156 @@ ++// SPDX-License-Identifier: GPL-2.0+ +/* + * I2SE Duckbill IOMUX setup + * -+ * Copyright (C) 2013-2017 Michael Heimpold -+ * -+ * SPDX-License-Identifier: GPL-2.0+ ++ * Copyright (C) 2013-2019 Michael Heimpold + */ + +#include @@ -461,65 +469,74 @@ Signed-off-by: Stefan Wahren + else + mxs_iomux_setup_multiple_pads(iomux_setup_v1, ARRAY_SIZE(iomux_setup_v1)); +} +diff --git a/configs/duckbill_defconfig b/configs/duckbill_defconfig +new file mode 100644 +index 0000000000..5a8c561b4e --- /dev/null +++ b/configs/duckbill_defconfig -@@ -0,0 +1,31 @@ +@@ -0,0 +1,40 @@ +CONFIG_ARM=y -+CONFIG_TARGET_DUCKBILL=y ++CONFIG_ARCH_MX28=y ++CONFIG_SYS_TEXT_BASE=0x40002000 +CONFIG_SPL_GPIO_SUPPORT=y +CONFIG_SPL_LIBCOMMON_SUPPORT=y +CONFIG_SPL_LIBGENERIC_SUPPORT=y ++CONFIG_TARGET_DUCKBILL=y +CONFIG_SPL_SERIAL_SUPPORT=y ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_SPL=y ++CONFIG_SPL_TEXT_BASE=0x00001000 +CONFIG_BOOTDELAY=1 -+# CONFIG_CONSOLE_MUX is not set +CONFIG_SYS_CONSOLE_IS_IN_ENV=y +CONFIG_VERSION_VARIABLE=y +# CONFIG_DISPLAY_BOARDINFO is not set -+# CONFIG_EFI_LOADER is not set +CONFIG_ARCH_MISC_INIT=y -+CONFIG_SPL=y ++# CONFIG_SPL_FRAMEWORK is not set +CONFIG_HUSH_PARSER=y +CONFIG_CMD_BOOTZ=y -+# CONFIG_CMD_IMLS is not set ++# CONFIG_CMD_ELF is not set ++CONFIG_CMD_UNZIP=y +# CONFIG_CMD_FLASH is not set -+CONFIG_CMD_MMC=y ++CONFIG_CMD_FUSE=y +CONFIG_CMD_GPIO=y ++CONFIG_CMD_MMC=y ++CONFIG_CMD_MMC_SWRITE=y +CONFIG_CMD_DHCP=y +CONFIG_CMD_MII=y +CONFIG_CMD_PING=y -+CONFIG_CMD_CACHE=y +CONFIG_CMD_EXT4=y +CONFIG_CMD_EXT4_WRITE=y -+CONFIG_CMD_FAT=y +CONFIG_CMD_FS_GENERIC=y ++CONFIG_DOS_PARTITION=y +CONFIG_ENV_IS_IN_MMC=y ++CONFIG_MXS_GPIO=y +CONFIG_MMC_MXS=y ++CONFIG_MII=y ++CONFIG_CONS_INDEX=0 +CONFIG_OF_LIBFDT=y ++# CONFIG_EFI_LOADER is not set +diff --git a/include/configs/duckbill.h b/include/configs/duckbill.h +new file mode 100644 +index 0000000000..e7fce8843e --- /dev/null +++ b/include/configs/duckbill.h -@@ -0,0 +1,199 @@ +@@ -0,0 +1,179 @@ ++/* SPDX-License-Identifier: GPL-2.0+ */ +/* -+ * Copyright (C) 2014-2015 Michael Heimpold ++ * Copyright (C) 2014-2019 Michael Heimpold + * -+ * SPDX-License-Identifier: GPL-2.0+ + */ +#ifndef __CONFIGS_DUCKBILL_H__ +#define __CONFIGS_DUCKBILL_H__ + +/* System configurations */ -+#define CONFIG_MX28 /* i.MX28 SoC */ +#define CONFIG_MACH_TYPE MACH_TYPE_DUCKBILL + +#define CONFIG_MISC_INIT_R + +#define CONFIG_SYS_MXS_VDD5V_ONLY + -+/* U-Boot Commands */ -+#define CONFIG_CMD_FUSE -+#define CONFIG_CMD_UNZIP -+ +/* Memory configuration */ -+#define CONFIG_NR_DRAM_BANKS 1 /* 1 bank of DRAM */ +#define PHYS_SDRAM_1 0x40000000 /* Base address */ +#define PHYS_SDRAM_1_SIZE 0x40000000 /* Max 1 GB RAM */ +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 @@ -533,12 +550,10 @@ Signed-off-by: Stefan Wahren +#define CONFIG_SYS_REDUNDAND_ENVIRONMENT + +/* FEC Ethernet on SoC */ -+#ifdef CONFIG_CMD_NET ++#ifdef CONFIG_CMD_NET +#define CONFIG_FEC_MXC -+#define CONFIG_NET_MULTI +#define CONFIG_MX28_FEC_MAC_IN_OCOTP -+#define CONFIG_FEC_MXC_PHYADDR 1 -+#define IMX_FEC_BASE MXS_ENET0_BASE ++#define CONFIG_FEC_MXC_MDIO_BASE MXS_ENET0_BASE +#endif + +#define CONFIG_IPADDR 192.168.1.10 @@ -546,17 +561,6 @@ Signed-off-by: Stefan Wahren +#define CONFIG_NETMASK 255.255.255.0 +#define CONFIG_GATEWAYIP 192.168.1.254 + -+/* BOOTP options */ -+#define CONFIG_BOOTP_SUBNETMASK -+#define CONFIG_BOOTP_GATEWAY -+#define CONFIG_BOOTP_HOSTNAME -+ -+/* SPI */ -+#ifdef CONFIG_CMD_SPI -+#define CONFIG_DEFAULT_SPI_BUS 2 -+#define CONFIG_DEFAULT_SPI_MODE SPI_MODE_0 -+#endif -+ +/* Boot Linux */ +#define CONFIG_BOOTDELAY 1 +#define CONFIG_BOOTFILE "zImage" @@ -596,7 +600,7 @@ Signed-off-by: Stefan Wahren + "setexpr i ${update_fw_parts}; setexpr error 0; " \ + "while itest ${i} -gt 0; do " \ + "echo Transfering firmware image part ${i} of ${update_fw_parts}; " \ -+ "if itest ${i} -le 9; then " \ ++ "if itest ${i} -le f; then " \ + "setenv j 0${i}; " \ + "else " \ + "setenv j ${i}; " \ @@ -625,7 +629,6 @@ Signed-off-by: Stefan Wahren + "erase_env2=mmc erase 200 100\0" \ + "image=zImage\0" \ + "console=ttyAMA0\0" \ -+ "fdt_file=imx28-duckbill-2.dtb\0" \ + "fdt_addr=0x41000000\0" \ + "boot_fdt=try\0" \ + "ip_dyn=yes\0" \ @@ -635,7 +638,7 @@ Signed-off-by: Stefan Wahren + "mmcroot=/dev/mmcblk0p2\0" \ + "mmcargs=setenv bootargs console=${console},${baudrate} " \ + "root=${mmcroot} " \ -+ "rootwait bootsys=${bootsys} panic=1\0" \ ++ "rootwait bootsys=${bootsys} panic=1 ${extraargs}\0" \ + "loadimage=ext4load mmc ${mmcdev}:${mmcpart} ${loadaddr} /boot/${image}\0" \ + "loadfdt=ext4load mmc ${mmcdev}:${mmcpart} ${fdt_addr} /boot/${fdt_file}\0" \ + "mmcboot=echo Booting from mmc ...; " \ @@ -658,7 +661,7 @@ Signed-off-by: Stefan Wahren + "nfsroot=/\0" \ + "netargs=setenv bootargs console=${console},${baudrate} " \ + "root=/dev/nfs " \ -+ "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ ++ "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp ${extraargs}\0" \ + "netboot=echo Booting from net ...; " \ + "run netargs; " \ + "if test ${ip_dyn} = yes; then " \ @@ -697,3 +700,6 @@ Signed-off-by: Stefan Wahren +#include + +#endif /* __CONFIGS_DUCKBILL_H__ */ +-- +2.17.1 + diff --git a/package/boot/uboot-mxs/patches/002-tools-mxsimage-Support-building-with-LibreSSL.patch b/package/boot/uboot-mxs/patches/002-tools-mxsimage-Support-building-with-LibreSSL.patch deleted file mode 100644 index aa7285ebcefd66..00000000000000 --- a/package/boot/uboot-mxs/patches/002-tools-mxsimage-Support-building-with-LibreSSL.patch +++ /dev/null @@ -1,36 +0,0 @@ -From c5b0bca4c3ca5c3d1d8ee99fdbf3b494a3986dbd Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sun, 18 Mar 2018 16:03:47 +0100 -Subject: [PATCH] tools/mxsimage: Support building with LibreSSL - -The mxsimage utility fails to compile against LibreSSL version < 2.7.0 -because LibreSSL says it is OpenSSL 2.0, but it does not support the -complete OpenSSL 1.1 interface. - -LibreSSL defines OPENSSL_VERSION_NUMBER with 0x20000000L and therefor -claims to have an API compatible with OpenSSL 2.0, but it implements -EVP_MD_CTX_new(), EVP_MD_CTX_free() and EVP_CIPHER_CTX_reset() only -starting with version 2.7.0, which is not yet released. OpenSSL -implements this function since version 1.1.0. - -This commit will activate the compatibility code meant for -OpenSSL < 1.1.0 also for LibreSSL version < 2.7.0. - -Signed-off-by: Hauke Mehrtens -Reviewed-by: Jonathan Gray ---- - tools/mxsimage.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/tools/mxsimage.c -+++ b/tools/mxsimage.c -@@ -26,7 +26,8 @@ - * OpenSSL 1.1.0 and newer compatibility functions: - * https://wiki.openssl.org/index.php/1.1_API_Changes - */ --#if OPENSSL_VERSION_NUMBER < 0x10100000L -+#if OPENSSL_VERSION_NUMBER < 0x10100000L || \ -+ (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2070000fL) - static void *OPENSSL_zalloc(size_t num) - { - void *ret = OPENSSL_malloc(num); diff --git a/package/boot/uboot-mxs/patches/210-link-libcrypto-static.patch b/package/boot/uboot-mxs/patches/210-link-libcrypto-static.patch index 87b70ccea4ff1b..022e798f194be6 100644 --- a/package/boot/uboot-mxs/patches/210-link-libcrypto-static.patch +++ b/package/boot/uboot-mxs/patches/210-link-libcrypto-static.patch @@ -3,7 +3,7 @@ needed dependencies are added too. --- a/tools/Makefile +++ b/tools/Makefile -@@ -163,7 +163,7 @@ endif +@@ -147,7 +147,7 @@ endif # MXSImage needs LibSSL ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X)$(CONFIG_FIT_SIGNATURE),) HOSTLOADLIBES_mkimage += \ diff --git a/package/boot/uboot-omap/Makefile b/package/boot/uboot-omap/Makefile index 0d5260d121779d..70c8af1dc4ea2c 100644 --- a/package/boot/uboot-omap/Makefile +++ b/package/boot/uboot-omap/Makefile @@ -8,10 +8,10 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk -PKG_VERSION:=2017.01 -PKG_RELEASE:=2 +PKG_VERSION:=2019.10 +PKG_RELEASE:=1 -PKG_HASH:=6c425175f93a4bcf2ec9faf5658ef279633dbd7856a293d95bd1ff516528ecf2 +PKG_HASH:=8d6d6070739522dd236cba7055b8736bfe92b4fac0ea18ad809829ca79667014 include $(INCLUDE_DIR)/u-boot.mk include $(INCLUDE_DIR)/package.mk @@ -19,22 +19,16 @@ include $(INCLUDE_DIR)/package.mk define U-Boot/Default BUILD_TARGET:=omap UBOOT_IMAGE:=u-boot.img MLO - UENV:=default endef define U-Boot/omap4_panda NAME:=Pandaboard - BUILD_DEVICES:=omap4-panda -endef - -define U-Boot/am335x_boneblack - NAME:=TI AM335x BeagleBone Black - BUILD_DEVICES:=am335x-boneblack + BUILD_DEVICES:=ti_omap4-panda endef define U-Boot/am335x_evm NAME:=AM335x EVM - BUILD_DEVICES:=am335x-evm + BUILD_DEVICES:=ti_am335x-evm ti_am335x-bone-black endef define U-Boot/omap3_overo @@ -43,15 +37,22 @@ endef define U-Boot/omap3_beagle NAME:=BeagleBoard - BUILD_DEVICES:=omap3-beagle + BUILD_DEVICES:=ti_omap3-beagle endef -UBOOT_TARGETS:=omap4_panda am335x_evm omap3_overo omap3_beagle am335x_boneblack +UBOOT_TARGETS:=omap4_panda am335x_evm omap3_overo omap3_beagle define Build/InstallDev - $(INSTALL_DIR) $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES) - $(CP) $(patsubst %,$(PKG_BUILD_DIR)/%,$(UBOOT_IMAGE)) $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)/ - $(CP) ./files/uEnv-$(UENV).txt $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)/uEnv.txt + $(foreach device,$(BUILD_DEVICES), \ + $(INSTALL_DIR) $(STAGING_DIR_IMAGE)/$(device) + ) + $(foreach device,$(BUILD_DEVICES), \ + $(CP) $(patsubst %,$(PKG_BUILD_DIR)/%,$(UBOOT_IMAGE)) $(STAGING_DIR_IMAGE)/$(device)/ + ) + $(foreach device,$(BUILD_DEVICES), \ + mkimage -C none -A arm -T script -d ./files/boot.scr.txt \ + $(STAGING_DIR_IMAGE)/$(device)/boot.scr + ) endef $(eval $(call BuildPackage/U-Boot)) diff --git a/package/boot/uboot-omap/files/boot.scr.txt b/package/boot/uboot-omap/files/boot.scr.txt new file mode 100644 index 00000000000000..a97684b0e62102 --- /dev/null +++ b/package/boot/uboot-omap/files/boot.scr.txt @@ -0,0 +1,9 @@ +if test -z "${devnum}"; then + setenv devnum 0 +fi + +setenv bootargs console=${console} root=/dev/mmcblk${devnum}p2 rootwait + +load mmc ${devnum}:1 ${loadaddr} /zImage \ +&& load mmc ${devnum}:1 ${fdtaddr} /dtbs/${fdtfile} \ +&& bootz ${loadaddr} - ${fdtaddr} diff --git a/package/boot/uboot-omap/files/uEnv-default.txt b/package/boot/uboot-omap/files/uEnv-default.txt deleted file mode 100644 index 3584e4379b9f1f..00000000000000 --- a/package/boot/uboot-omap/files/uEnv-default.txt +++ /dev/null @@ -1,8 +0,0 @@ -bootpart=0:1 -bootdir=/ -bootfile=zImage -fdtdir=/dtbs -uenvcmd=run loadfdt; run loadimage; run uenvbootargs ; bootz ${loadaddr} - ${fdtaddr} -loadfdt=load mmc ${bootpart} ${fdtaddr} ${fdtdir}/${fdtfile} -devtype=mmc -uenvbootargs=setenv bootargs console=${console} root=/dev/mmcblk0p2 diff --git a/package/boot/uboot-omap/patches/101-disable-thumb-omap3.patch b/package/boot/uboot-omap/patches/101-disable-thumb-omap3.patch deleted file mode 100644 index 8a3b024fe45fec..00000000000000 --- a/package/boot/uboot-omap/patches/101-disable-thumb-omap3.patch +++ /dev/null @@ -1,14 +0,0 @@ -Index: u-boot-2017.01/include/configs/ti_omap3_common.h -=================================================================== ---- u-boot-2017.01.orig/include/configs/ti_omap3_common.h -+++ u-boot-2017.01/include/configs/ti_omap3_common.h -@@ -80,4 +80,9 @@ - /* Now bring in the rest of the common code. */ - #include - -+/* beagleboard doesnt boot with thumb */ -+#ifdef CONFIG_SYS_THUMB_BUILD -+#undef CONFIG_SYS_THUMB_BUILD -+#endif -+ - #endif /* __CONFIG_TI_OMAP3_COMMON_H__ */ diff --git a/package/boot/uboot-omap/patches/102-minify-spl.patch b/package/boot/uboot-omap/patches/102-minify-spl.patch deleted file mode 100644 index 66f6b6b59f17d7..00000000000000 --- a/package/boot/uboot-omap/patches/102-minify-spl.patch +++ /dev/null @@ -1,44 +0,0 @@ -Index: u-boot-2017.01/configs/omap3_beagle_defconfig -=================================================================== ---- u-boot-2017.01.orig/configs/omap3_beagle_defconfig -+++ u-boot-2017.01/configs/omap3_beagle_defconfig -@@ -7,7 +7,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y - CONFIG_VERSION_VARIABLE=y - CONFIG_SPL=y - CONFIG_SPL_MTD_SUPPORT=y --CONFIG_SPL_OS_BOOT=y -+# CONFIG_SPL_EXT_SUPPORT is not set - # CONFIG_CMD_IMLS is not set - CONFIG_CMD_ASKENV=y - # CONFIG_CMD_FLASH is not set -Index: u-boot-2017.01/common/Makefile -=================================================================== ---- u-boot-2017.01.orig/common/Makefile -+++ u-boot-2017.01/common/Makefile -@@ -174,8 +174,11 @@ obj-$(CONFIG_CMDLINE) += cli_simple.o - obj-y += cli.o - obj-$(CONFIG_CMDLINE) += cli_readline.o - obj-$(CONFIG_CMD_DFU) += dfu.o -+ -+ifndef CONFIG_SPL_BUILD - obj-y += command.o - obj-y += s_record.o - obj-y += xyzModem.o -+endif - - CFLAGS_env_embedded.o := -Wa,--no-warn -DENV_CRC=$(shell tools/envcrc 2>/dev/null) -Index: u-boot-2017.01/cmd/Makefile -=================================================================== ---- u-boot-2017.01.orig/cmd/Makefile -+++ u-boot-2017.01/cmd/Makefile -@@ -161,7 +161,10 @@ endif # !CONFIG_SPL_BUILD - - obj-$(CONFIG_CMD_BLOB) += blob.o - -+ -+# ifndef CONFIG_SPL_BUILD - # core command - obj-y += nvedit.o -+# endif # !CONFIG_SPL_BUILD - - obj-$(CONFIG_ARCH_MVEBU) += mvebu/ diff --git a/package/boot/uboot-omap/patches/103-disable-fat-write-spl.patch b/package/boot/uboot-omap/patches/103-disable-fat-write-spl.patch deleted file mode 100644 index 89b02044dc9ace..00000000000000 --- a/package/boot/uboot-omap/patches/103-disable-fat-write-spl.patch +++ /dev/null @@ -1,27 +0,0 @@ -Index: u-boot-2017.01/fs/fat/Makefile -=================================================================== ---- u-boot-2017.01.orig/fs/fat/Makefile -+++ u-boot-2017.01/fs/fat/Makefile -@@ -4,8 +4,8 @@ - # - - obj-$(CONFIG_FS_FAT) := fat.o --obj-$(CONFIG_FAT_WRITE):= fat_write.o - - ifndef CONFIG_SPL_BUILD -+obj-$(CONFIG_FAT_WRITE):= fat_write.o - obj-$(CONFIG_FS_FAT) += file.o - endif -Index: u-boot-2017.01/fs/fat/fat.c -=================================================================== ---- u-boot-2017.01.orig/fs/fat/fat.c -+++ u-boot-2017.01/fs/fat/fat.c -@@ -163,7 +163,7 @@ static void get_name(dir_entry *dirent, - } - - static int flush_dirty_fat_buffer(fsdata *mydata); --#if !defined(CONFIG_FAT_WRITE) -+#if !defined(CONFIG_FAT_WRITE) || defined(CONFIG_SPL_BUILD) - /* Stub for read only operation */ - int flush_dirty_fat_buffer(fsdata *mydata) - { diff --git a/package/boot/uboot-omap/patches/104-omap3-overo-enable-thumb.patch b/package/boot/uboot-omap/patches/104-omap3-overo-enable-thumb.patch deleted file mode 100644 index ca928c996c1299..00000000000000 --- a/package/boot/uboot-omap/patches/104-omap3-overo-enable-thumb.patch +++ /dev/null @@ -1,18 +0,0 @@ -Index: u-boot-2017.01/include/configs/omap3_overo.h -=================================================================== ---- u-boot-2017.01.orig/include/configs/omap3_overo.h -+++ u-boot-2017.01/include/configs/omap3_overo.h -@@ -11,6 +11,13 @@ - #define CONFIG_NAND - - #include -+ -+/* try to enable thumb - unknown if it's working -+ * but otherwise it's too big for spl */ -+#ifndef CONFIG_SYS_THUMB_BUILD -+#define CONFIG_SYS_THUMB_BUILD -+#endif -+ - /* - * We are only ever GP parts and will utilize all of the "downloaded image" - * area in SRAM which starts at 0x40200000 and ends at 0x4020FFFF (64KB). diff --git a/package/boot/uboot-omap/patches/105-serial-ns16550-bugfix-ns16550-fifo-not-enabled.patch b/package/boot/uboot-omap/patches/105-serial-ns16550-bugfix-ns16550-fifo-not-enabled.patch deleted file mode 100644 index 513efaf74db261..00000000000000 --- a/package/boot/uboot-omap/patches/105-serial-ns16550-bugfix-ns16550-fifo-not-enabled.patch +++ /dev/null @@ -1,309 +0,0 @@ -From 17fa032671f7981628fe16b30399638842a4b1bb Mon Sep 17 00:00:00 2001 -From: Heiko Schocher -Date: Wed, 18 Jan 2017 08:05:49 +0100 -Subject: [PATCH] serial, ns16550: bugfix: ns16550 fifo not enabled - -commit: 65f83802b7a5b "serial: 16550: Add getfcr accessor" -breaks u-boot commandline working with long commands -sending to the board. - -Since the above patch, you have to setup the fcr register. - -For board/archs which enable OF_PLATDATA, the new field -fcr in struct ns16550_platdata is not filled with a -default value ... - -This leads in not setting up the uarts fifo, which ends -in problems, when you send long commands to u-boots -commandline. - -Detected this issue with automated tbot tests on am335x -based shc board. - -The error does not popup, if you type commands. You need -to copy&paste a long command to u-boots commandshell -(or send a long command with tbot) - -Possible boards/plattforms with problems: -./arch/arm/cpu/arm926ejs/lpc32xx/devices.c -./arch/arm/mach-tegra/board.c -./board/overo/overo.c -./board/quipos/cairo/cairo.c -./board/logicpd/omap3som/omap3logic.c -./board/logicpd/zoom1/zoom1.c -./board/timll/devkit8000/devkit8000.c -./board/lg/sniper/sniper.c -./board/ti/beagle/beagle.c -./drivers/serial/serial_rockchip.c - -Signed-off-by: Heiko Schocher -Signed-off-by: Ladislav Michl -Tested-by: Adam Ford -Reviewed-by: Tom Rini ---- - arch/arm/cpu/arm926ejs/lpc32xx/devices.c | 12 ++++++++---- - arch/arm/mach-omap2/am33xx/board.c | 18 ++++++++++++------ - arch/arm/mach-tegra/board.c | 1 + - board/isee/igep00x0/igep00x0.c | 3 ++- - board/lg/sniper/sniper.c | 3 ++- - board/logicpd/omap3som/omap3logic.c | 3 ++- - board/logicpd/zoom1/zoom1.c | 3 ++- - board/overo/overo.c | 3 ++- - board/quipos/cairo/cairo.c | 3 ++- - board/ti/beagle/beagle.c | 3 ++- - board/timll/devkit8000/devkit8000.c | 3 ++- - drivers/serial/ns16550.c | 9 +++------ - drivers/serial/serial_rockchip.c | 1 + - include/ns16550.h | 5 +++++ - 14 files changed, 46 insertions(+), 24 deletions(-) - -diff --git a/arch/arm/cpu/arm926ejs/lpc32xx/devices.c b/arch/arm/cpu/arm926ejs/lpc32xx/devices.c -index 399b07c5420a..f744398ca7ad 100644 ---- a/arch/arm/cpu/arm926ejs/lpc32xx/devices.c -+++ b/arch/arm/cpu/arm926ejs/lpc32xx/devices.c -@@ -45,10 +45,14 @@ void lpc32xx_uart_init(unsigned int uart_id) - - #if !CONFIG_IS_ENABLED(OF_CONTROL) - static const struct ns16550_platdata lpc32xx_uart[] = { -- { .base = UART3_BASE, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK }, -- { .base = UART4_BASE, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK }, -- { .base = UART5_BASE, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK }, -- { .base = UART6_BASE, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK }, -+ { .base = UART3_BASE, .reg_shift = 2, -+ .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, }, -+ { .base = UART4_BASE, .reg_shift = 2, -+ .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, }, -+ { .base = UART5_BASE, .reg_shift = 2, -+ .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, }, -+ { .base = UART6_BASE, .reg_shift = 2, -+ .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, }, - }; - - #if defined(CONFIG_LPC32XX_HSUART) -diff --git a/arch/arm/mach-omap2/am33xx/board.c b/arch/arm/mach-omap2/am33xx/board.c -index 73824df18fa7..190310fd0079 100644 ---- a/arch/arm/mach-omap2/am33xx/board.c -+++ b/arch/arm/mach-omap2/am33xx/board.c -@@ -40,14 +40,20 @@ DECLARE_GLOBAL_DATA_PTR; - - #if !CONFIG_IS_ENABLED(OF_CONTROL) - static const struct ns16550_platdata am33xx_serial[] = { -- { .base = CONFIG_SYS_NS16550_COM1, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK }, -+ { .base = CONFIG_SYS_NS16550_COM1, .reg_shift = 2, -+ .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, }, - # ifdef CONFIG_SYS_NS16550_COM2 -- { .base = CONFIG_SYS_NS16550_COM2, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK }, -+ { .base = CONFIG_SYS_NS16550_COM2, .reg_shift = 2, -+ .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, }, - # ifdef CONFIG_SYS_NS16550_COM3 -- { .base = CONFIG_SYS_NS16550_COM3, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK }, -- { .base = CONFIG_SYS_NS16550_COM4, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK }, -- { .base = CONFIG_SYS_NS16550_COM5, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK }, -- { .base = CONFIG_SYS_NS16550_COM6, .reg_shift = 2, .clock = CONFIG_SYS_NS16550_CLK }, -+ { .base = CONFIG_SYS_NS16550_COM3, .reg_shift = 2, -+ .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, }, -+ { .base = CONFIG_SYS_NS16550_COM4, .reg_shift = 2, -+ .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, }, -+ { .base = CONFIG_SYS_NS16550_COM5, .reg_shift = 2, -+ .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, }, -+ { .base = CONFIG_SYS_NS16550_COM6, .reg_shift = 2, -+ .clock = CONFIG_SYS_NS16550_CLK, .fcr = UART_FCR_DEFVAL, }, - # endif - # endif - }; -diff --git a/arch/arm/mach-tegra/board.c b/arch/arm/mach-tegra/board.c -index 3d1d26d13d13..b3a041b539af 100644 ---- a/arch/arm/mach-tegra/board.c -+++ b/arch/arm/mach-tegra/board.c -@@ -219,6 +219,7 @@ static struct ns16550_platdata ns16550_com1_pdata = { - .base = CONFIG_SYS_NS16550_COM1, - .reg_shift = 2, - .clock = CONFIG_SYS_NS16550_CLK, -+ .fcr = UART_FCR_DEFVAL, - }; - - U_BOOT_DEVICE(ns16550_com1) = { -diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c -index ae7959b1eb6e..5a3498f570a6 100644 ---- a/board/isee/igep00x0/igep00x0.c -+++ b/board/isee/igep00x0/igep00x0.c -@@ -32,7 +32,8 @@ DECLARE_GLOBAL_DATA_PTR; - static const struct ns16550_platdata igep_serial = { - .base = OMAP34XX_UART3, - .reg_shift = 2, -- .clock = V_NS16550_CLK -+ .clock = V_NS16550_CLK, -+ .fcr = UART_FCR_DEFVAL, - }; - - U_BOOT_DEVICE(igep_uart) = { -diff --git a/board/lg/sniper/sniper.c b/board/lg/sniper/sniper.c -index 0662449c3875..b2b8f8861f11 100644 ---- a/board/lg/sniper/sniper.c -+++ b/board/lg/sniper/sniper.c -@@ -31,7 +31,8 @@ const omap3_sysinfo sysinfo = { - static const struct ns16550_platdata serial_omap_platdata = { - .base = OMAP34XX_UART3, - .reg_shift = 2, -- .clock = V_NS16550_CLK -+ .clock = V_NS16550_CLK, -+ .fcr = UART_FCR_DEFVAL, - }; - - U_BOOT_DEVICE(sniper_serial) = { -diff --git a/board/logicpd/omap3som/omap3logic.c b/board/logicpd/omap3som/omap3logic.c -index 21b3fdcf49cf..b2fcc28f8b4b 100644 ---- a/board/logicpd/omap3som/omap3logic.c -+++ b/board/logicpd/omap3som/omap3logic.c -@@ -49,7 +49,8 @@ DECLARE_GLOBAL_DATA_PTR; - static const struct ns16550_platdata omap3logic_serial = { - .base = OMAP34XX_UART1, - .reg_shift = 2, -- .clock = V_NS16550_CLK -+ .clock = V_NS16550_CLK, -+ .fcr = UART_FCR_DEFVAL, - }; - - U_BOOT_DEVICE(omap3logic_uart) = { -diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c -index 2821ee22674f..0fad23af62f6 100644 ---- a/board/logicpd/zoom1/zoom1.c -+++ b/board/logicpd/zoom1/zoom1.c -@@ -47,7 +47,8 @@ static const u32 gpmc_lab_enet[] = { - static const struct ns16550_platdata zoom1_serial = { - .base = OMAP34XX_UART3, - .reg_shift = 2, -- .clock = V_NS16550_CLK -+ .clock = V_NS16550_CLK, -+ .fcr = UART_FCR_DEFVAL, - }; - - U_BOOT_DEVICE(zoom1_uart) = { -diff --git a/board/overo/overo.c b/board/overo/overo.c -index 40f13e5876cc..5e447262bcfd 100644 ---- a/board/overo/overo.c -+++ b/board/overo/overo.c -@@ -70,7 +70,8 @@ static struct { - static const struct ns16550_platdata overo_serial = { - .base = OMAP34XX_UART3, - .reg_shift = 2, -- .clock = V_NS16550_CLK -+ .clock = V_NS16550_CLK, -+ .fcr = UART_FCR_DEFVAL, - }; - - U_BOOT_DEVICE(overo_uart) = { -diff --git a/board/quipos/cairo/cairo.c b/board/quipos/cairo/cairo.c -index 77e4482906f0..793aa9023150 100644 ---- a/board/quipos/cairo/cairo.c -+++ b/board/quipos/cairo/cairo.c -@@ -93,7 +93,8 @@ void get_board_mem_timings(struct board_sdrc_timings *timings) - static const struct ns16550_platdata cairo_serial = { - .base = OMAP34XX_UART2, - .reg_shift = 2, -- .clock = V_NS16550_CLK -+ .clock = V_NS16550_CLK, -+ .fcr = UART_FCR_DEFVAL, - }; - - U_BOOT_DEVICE(cairo_uart) = { -diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c -index cfdab3e34253..23c79333a223 100644 ---- a/board/ti/beagle/beagle.c -+++ b/board/ti/beagle/beagle.c -@@ -75,7 +75,8 @@ static struct { - static const struct ns16550_platdata beagle_serial = { - .base = OMAP34XX_UART3, - .reg_shift = 2, -- .clock = V_NS16550_CLK -+ .clock = V_NS16550_CLK, -+ .fcr = UART_FCR_DEFVAL, - }; - - U_BOOT_DEVICE(beagle_uart) = { -diff --git a/board/timll/devkit8000/devkit8000.c b/board/timll/devkit8000/devkit8000.c -index f785dbe6d732..b2f060b2ddbf 100644 ---- a/board/timll/devkit8000/devkit8000.c -+++ b/board/timll/devkit8000/devkit8000.c -@@ -48,7 +48,8 @@ static u32 gpmc_net_config[GPMC_MAX_REG] = { - static const struct ns16550_platdata devkit8000_serial = { - .base = OMAP34XX_UART3, - .reg_shift = 2, -- .clock = V_NS16550_CLK -+ .clock = V_NS16550_CLK, -+ .fcr = UART_FCR_DEFVAL, - }; - - U_BOOT_DEVICE(devkit8000_uart) = { -diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c -index 9b423a591d8a..2df4a1f04fe5 100644 ---- a/drivers/serial/ns16550.c -+++ b/drivers/serial/ns16550.c -@@ -20,9 +20,6 @@ DECLARE_GLOBAL_DATA_PTR; - #define UART_LCRVAL UART_LCR_8N1 /* 8 data, 1 stop, no parity */ - #define UART_MCRVAL (UART_MCR_DTR | \ - UART_MCR_RTS) /* RTS/DTR */ --#define UART_FCRVAL (UART_FCR_FIFO_EN | \ -- UART_FCR_RXSR | \ -- UART_FCR_TXSR) /* Clear & enable FIFOs */ - - #ifndef CONFIG_DM_SERIAL - #ifdef CONFIG_SYS_NS16550_PORT_MAPPED -@@ -138,7 +135,7 @@ static u32 ns16550_getfcr(NS16550_t port) - #else - static u32 ns16550_getfcr(NS16550_t port) - { -- return UART_FCRVAL; -+ return UART_FCR_DEFVAL; - } - #endif - -@@ -275,7 +272,7 @@ static inline void _debug_uart_init(void) - CONFIG_BAUDRATE); - serial_dout(&com_port->ier, CONFIG_SYS_NS16550_IER); - serial_dout(&com_port->mcr, UART_MCRVAL); -- serial_dout(&com_port->fcr, UART_FCRVAL); -+ serial_dout(&com_port->fcr, UART_FCR_DEFVAL); - - serial_dout(&com_port->lcr, UART_LCR_BKSE | UART_LCRVAL); - serial_dout(&com_port->dll, baud_divisor & 0xff); -@@ -440,7 +437,7 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev) - return -EINVAL; - } - -- plat->fcr = UART_FCRVAL; -+ plat->fcr = UART_FCR_DEFVAL; - if (port_type == PORT_JZ4780) - plat->fcr |= UART_FCR_UME; - -diff --git a/drivers/serial/serial_rockchip.c b/drivers/serial/serial_rockchip.c -index 6bac95a414ce..c06afc58f7ea 100644 ---- a/drivers/serial/serial_rockchip.c -+++ b/drivers/serial/serial_rockchip.c -@@ -27,6 +27,7 @@ static int rockchip_serial_probe(struct udevice *dev) - plat->plat.base = plat->dtplat.reg[0]; - plat->plat.reg_shift = plat->dtplat.reg_shift; - plat->plat.clock = plat->dtplat.clock_frequency; -+ plat->plat.fcr = UART_FCR_DEFVAL; - dev->platdata = &plat->plat; - - return ns16550_serial_probe(dev); -diff --git a/include/ns16550.h b/include/ns16550.h -index 7c9703683109..5fcbcd2e74e3 100644 ---- a/include/ns16550.h -+++ b/include/ns16550.h -@@ -121,6 +121,11 @@ typedef struct NS16550 *NS16550_t; - /* Ingenic JZ47xx specific UART-enable bit. */ - #define UART_FCR_UME 0x10 - -+/* Clear & enable FIFOs */ -+#define UART_FCR_DEFVAL (UART_FCR_FIFO_EN | \ -+ UART_FCR_RXSR | \ -+ UART_FCR_TXSR) -+ - /* - * These are the definitions for the Modem Control Register - */ --- -2.17.0 - diff --git a/package/boot/uboot-oxnas/src/tools/mkox820crc.c b/package/boot/uboot-oxnas/src/tools/mkox820crc.c index d100191f2dc969..873706245bc52c 100644 --- a/package/boot/uboot-oxnas/src/tools/mkox820crc.c +++ b/package/boot/uboot-oxnas/src/tools/mkox820crc.c @@ -84,6 +84,7 @@ int main(int argc, char **argv) if (status != file_length) { printf("Failed to load image\n"); + free(executable); return -ENOENT; } @@ -111,6 +112,7 @@ int main(int argc, char **argv) status = lseek(in_file, 0, SEEK_SET); if (status != 0) { printf("failed to rewind\n"); + free(executable); return 1; } len = write(in_file, &img_header, sizeof(img_header)); @@ -118,6 +120,7 @@ int main(int argc, char **argv) len = write(in_file, executable, file_length); assert(len == file_length); close(in_file); + free(executable); return 0; } diff --git a/package/boot/uboot-sunxi/Makefile b/package/boot/uboot-sunxi/Makefile index 5257a41ad24075..eef4c56f532124 100644 --- a/package/boot/uboot-sunxi/Makefile +++ b/package/boot/uboot-sunxi/Makefile @@ -9,9 +9,9 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk -PKG_VERSION:=2017.11 +PKG_VERSION:=2019.01 -PKG_HASH:=6a018fd3caf58f3dcfa23ee989a82bd35df03af71872b9dca8c6d758a0d26c05 +PKG_HASH:=50bd7e5a466ab828914d080d5f6a432345b500e8fba1ad3b7b61e95e60d51c22 PKG_MAINTAINER:=Zoltan HERPAI @@ -28,67 +28,67 @@ endef define U-Boot/A10-OLinuXino-Lime BUILD_SUBTARGET:=cortexa8 NAME:=A10 OLinuXino LIME - BUILD_DEVICES:=sun4i-a10-olinuxino-lime + BUILD_DEVICES:=olimex_a10-olinuxino-lime endef define U-Boot/A13-OLinuXino BUILD_SUBTARGET:=cortexa8 NAME:=A13 OlinuXino - BUILD_DEVICES:=sun5i-a13-olinuxino + BUILD_DEVICES:=olimex_a13-olinuxino endef define U-Boot/A20-OLinuXino-Lime BUILD_SUBTARGET:=cortexa7 NAME:=A20 OLinuXino LIME - BUILD_DEVICES:=sun7i-a20-olinuxino-lime + BUILD_DEVICES:=olimex_a20-olinuxino-lime endef define U-Boot/A20-OLinuXino-Lime2 BUILD_SUBTARGET:=cortexa7 NAME:=A20 OLinuXino LIME2 - BUILD_DEVICES:=sun7i-a20-olinuxino-lime2 + BUILD_DEVICES:=olimex_a20-olinuxino-lime2 endef define U-Boot/A20-OLinuXino-Lime2-eMMC BUILD_SUBTARGET:=cortexa7 NAME:=A20 OLinuXino LIME2 eMMC - BUILD_DEVICES:=sun7i-a20-olinuxino-lime2-emmc + BUILD_DEVICES:=olimex_a20-olinuxino-lime2-emmc endef define U-Boot/A20-OLinuXino_MICRO BUILD_SUBTARGET:=cortexa7 NAME:=A20 OLinuXino MICRO - BUILD_DEVICES:=sun7i-a20-olinuxino-micro + BUILD_DEVICES:=olimex_a20-olinuxino-micro endef define U-Boot/Bananapi BUILD_SUBTARGET:=cortexa7 NAME:=Bananapi - BUILD_DEVICES:=sun7i-a20-bananapi + BUILD_DEVICES:=lemaker_bananapi endef define U-Boot/Bananapro BUILD_SUBTARGET:=cortexa7 NAME:=Bananapro - BUILD_DEVICES:=sun7i-a20-bananapro + BUILD_DEVICES:=lemaker_bananapro endef define U-Boot/Cubieboard BUILD_SUBTARGET:=cortexa8 NAME:=Cubieboard - BUILD_DEVICES:=sun4i-a10-cubieboard + BUILD_DEVICES:=cubietech_a10-cubieboard endef define U-Boot/Cubieboard2 BUILD_SUBTARGET:=cortexa7 NAME:=Cubieboard2 - BUILD_DEVICES:=sun7i-a20-cubieboard2 + BUILD_DEVICES:=cubietech_cubieboard2 endef define U-Boot/Cubietruck BUILD_SUBTARGET:=cortexa7 NAME:=Cubietruck - BUILD_DEVICES:=sun7i-a20-cubietruck + BUILD_DEVICES:=cubietech_cubietruck endef define U-Boot/Hummingbird_A31 @@ -99,73 +99,97 @@ endef define U-Boot/Marsboard_A10 BUILD_SUBTARGET:=cortexa8 NAME:=Marsboard - BUILD_DEVICES:=sun4i-a10-marsboard + BUILD_DEVICES:=marsboard_a10-marsboard endef define U-Boot/Mele_M9 BUILD_SUBTARGET:=cortexa7 NAME:=Mele M9 (A31) - BUILD_DEVICES:=sun6i-a31-m9 + BUILD_DEVICES:=mele_m9 endef define U-Boot/OLIMEX_A13_SOM BUILD_SUBTARGET:=cortexa8 NAME:=Olimex A13 SOM - BUILD_DEVICES:=sun5i-a13-olimex-som + BUILD_DEVICES:=olimex_a13-olimex-som endef define U-Boot/Linksprite_pcDuino BUILD_SUBTARGET:=cortexa8 NAME:=Linksprite pcDuino - BUILD_DEVICES:=sun4i-a10-pcduino + BUILD_DEVICES:=linksprite_a10-pcduino endef define U-Boot/Linksprite_pcDuino3 BUILD_SUBTARGET:=cortexa7 NAME:=Linksprite pcDuino3 - BUILD_DEVICES:=sun7i-a20-pcduino3 + BUILD_DEVICES:=linksprite_pcduino3 endef define U-Boot/Lamobo_R1 BUILD_SUBTARGET:=cortexa7 NAME:=Lamobo R1 - BUILD_DEVICES:=sun7i-a20-lamobo-r1 + BUILD_DEVICES:=lamobo_lamobo-r1 endef define U-Boot/nanopi_m1_plus BUILD_SUBTARGET:=cortexa7 NAME:=NanoPi M1 Plus (H3) - BUILD_DEVICES:=sun8i-h3-nanopi-m1-plus + BUILD_DEVICES:=friendlyarm_nanopi-m1-plus +endef + +define U-Boot/nanopi_neo_air + BUILD_SUBTARGET:=cortexa7 + NAME:=U-Boot for NanoPi NEO Air (H3) + BUILD_DEVICES:=friendlyarm_nanopi-neo-air endef define U-Boot/nanopi_neo BUILD_SUBTARGET:=cortexa7 NAME:=U-Boot for NanoPi NEO (H3) - BUILD_DEVICES:=sun8i-h3-nanopi-neo + BUILD_DEVICES:=friendlyarm_nanopi-neo endef define U-Boot/orangepi_r1 BUILD_SUBTARGET:=cortexa7 NAME:=Orange Pi R1 (H2+) - BUILD_DEVICES:=sun8i-h2-plus-orangepi-r1 + BUILD_DEVICES:=xunlong_orangepi-r1 +endef + +define U-Boot/orangepi_zero + BUILD_SUBTARGET:=cortexa7 + NAME:=Orange Pi Zero (H2+) + BUILD_DEVICES:=xunlong_orangepi-zero +endef + +define U-Boot/orangepi_one + BUILD_SUBTARGET:=cortexa7 + NAME:=Orange Pi One (H3) + BUILD_DEVICES:=xunlong_orangepi-one endef define U-Boot/orangepi_pc BUILD_SUBTARGET:=cortexa7 NAME:=Orange Pi PC (H3) - BUILD_DEVICES:=sun8i-h3-orangepi-pc + BUILD_DEVICES:=xunlong_orangepi-pc +endef + +define U-Boot/orangepi_pc_plus + BUILD_SUBTARGET:=cortexa7 + NAME:=Orange Pi PC Plus (H3) + BUILD_DEVICES:=xunlong_orangepi-pc-plus endef define U-Boot/orangepi_plus BUILD_SUBTARGET:=cortexa7 NAME:=Orange Pi Plus (H3) - BUILD_DEVICES:=sun8i-h3-orangepi-plus + BUILD_DEVICES:=xunlong_orangepi-plus endef define U-Boot/orangepi_2 BUILD_SUBTARGET:=cortexa7 NAME:=Orange Pi 2 (H3) - BUILD_DEVICES:=sun8i-h3-orangepi-2 + BUILD_DEVICES:=xunlong_orangepi-2 endef define U-Boot/pangolin @@ -177,23 +201,37 @@ endef define U-Boot/nanopi_neo_plus2 BUILD_SUBTARGET:=cortexa53 NAME:=NanoPi NEO Plus2 (H5) - BUILD_DEVICES:=sun50i-h5-nanopi-neo-plus2 + BUILD_DEVICES:=friendlyarm_nanopi-neo-plus2 DEPENDS:=+PACKAGE_u-boot-nanopi_neo_plus2:arm-trusted-firmware-sunxi UENV:=a64 endef +define U-Boot/nanopi_neo2 + BUILD_SUBTARGET:=cortexa53 + NAME:=NanoPi NEO2 (H5) + BUILD_DEVICES:=friendlyarm_nanopi-neo2 + DEPENDS:=+PACKAGE_u-boot-nanopi_neo2:arm-trusted-firmware-sunxi + UENV:=a64 +endef + define U-Boot/pine64_plus BUILD_SUBTARGET:=cortexa53 NAME:=Pine64 Plus A64 - BUILD_DEVICES:=sun50i-a64-pine64-plus + BUILD_DEVICES:=pine64_pine64-plus DEPENDS:=+PACKAGE_u-boot-pine64_plus:arm-trusted-firmware-sunxi UENV:=a64 endef +define U-Boot/Sinovoip_BPI_M2_Plus + BUILD_SUBTARGET:=cortexa7 + NAME:=Bananapi M2 Plus + BUILD_DEVICES:=sinovoip_bananapi-m2-plus +endef + define U-Boot/sopine_baseboard BUILD_SUBTARGET:=cortexa53 NAME:=Sopine Baseboard - BUILD_DEVICES:=sun50i-a64-sopine-baseboard + BUILD_DEVICES:=pine64_sopine-baseboard DEPENDS:=+PACKAGE_u-boot-sopine_baseboard:arm-trusted-firmware-sunxi UENV:=a64 endef @@ -202,11 +240,25 @@ endef define U-Boot/orangepi_zero_plus BUILD_SUBTARGET:=cortexa53 NAME:=Xunlong Orange Pi Zero Plus - BUILD_DEVICES:=sun50i-h5-orangepi-zero-plus + BUILD_DEVICES:=xunlong_orangepi-zero-plus DEPENDS:=+PACKAGE_u-boot-orangepi_zero_plus:arm-trusted-firmware-sunxi UENV:=a64 endef +define U-Boot/orangepi_pc2 + BUILD_SUBTARGET:=cortexa53 + NAME:=Xunlong Orange Pi PC2 + BUILD_DEVICES:=xunlong_orangepi-pc2 + DEPENDS:=+PACKAGE_u-boot-orangepi_pc2:arm-trusted-firmware-sunxi + UENV:=a64 +endef + +define U-Boot/Sinovoip_BPI_M2_Ultra + BUILD_SUBTARGET:=cortexa7 + NAME:=Bananapi M2 Ultra + BUILD_DEVICES:=lemaker_bananapi-m2-ultra +endef + UBOOT_TARGETS := \ A10-OLinuXino-Lime \ A13-OLinuXino \ @@ -228,13 +280,21 @@ UBOOT_TARGETS := \ Lamobo_R1 \ nanopi_m1_plus \ nanopi_neo \ + nanopi_neo_air \ nanopi_neo_plus2 \ + nanopi_neo2 \ + orangepi_zero \ orangepi_r1 \ + orangepi_one \ orangepi_pc \ + orangepi_pc_plus \ orangepi_plus \ orangepi_2 \ + orangepi_pc2 \ pangolin \ pine64_plus \ + Sinovoip_BPI_M2_Plus \ + Sinovoip_BPI_M2_Ultra \ sopine_baseboard \ orangepi_zero_plus @@ -245,11 +305,7 @@ UBOOT_MAKE_FLAGS += \ define Build/InstallDev $(INSTALL_DIR) $(STAGING_DIR_IMAGE) -ifeq ($(SUBTARGET),cortexa53) - cat $(PKG_BUILD_DIR)/spl/sunxi-spl.bin $(PKG_BUILD_DIR)/u-boot.itb > $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)-u-boot-with-spl.bin -else $(CP) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)-u-boot-with-spl.bin -endif mkimage -C none -A arm -T script -d uEnv-$(UENV).txt \ $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)-boot.scr endef diff --git a/package/boot/uboot-sunxi/patches/003-add-theobroma-a31-pangolin.patch b/package/boot/uboot-sunxi/patches/003-add-theobroma-a31-pangolin.patch index 4458d514c242c5..899bcb12994c24 100644 --- a/package/boot/uboot-sunxi/patches/003-add-theobroma-a31-pangolin.patch +++ b/package/boot/uboot-sunxi/patches/003-add-theobroma-a31-pangolin.patch @@ -1,6 +1,6 @@ --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile -@@ -261,6 +261,7 @@ dtb-$(CONFIG_MACH_SUN6I) += \ +@@ -313,6 +313,7 @@ dtb-$(CONFIG_MACH_SUN6I) += \ sun6i-a31-m9.dtb \ sun6i-a31-mele-a1000g-quad.dtb \ sun6i-a31-mixtile-loftq.dtb \ @@ -10,19 +10,17 @@ sun6i-a31s-inet-q972.dtb \ --- a/arch/arm/dts/sun6i-a31.dtsi +++ b/arch/arm/dts/sun6i-a31.dtsi -@@ -679,6 +679,13 @@ - allwinner,pull = ; +@@ -641,6 +641,11 @@ + function = "lcd0"; }; + i2c3_pins_a: i2c3@0 { + allwinner,pins = "PB5", "PB6"; + allwinner,function = "i2c3"; -+ allwinner,drive = ; -+ allwinner,pull = ; + }; + mmc0_pins_a: mmc0@0 { - allwinner,pins = "PF0", "PF1", "PF2", + pins = "PF0", "PF1", "PF2", "PF3", "PF4", "PF5"; --- /dev/null +++ b/arch/arm/dts/sun6i-a31-pangolin.dts @@ -360,7 +358,7 @@ +CONFIG_SUNXI_SPI=y --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig -@@ -752,6 +752,14 @@ config VIDEO_LCD_PANEL_I2C_SCL +@@ -875,6 +875,14 @@ config VIDEO_LCD_PANEL_I2C_SCL Set the SCL pin for the LCD i2c interface. This takes a string in the format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. diff --git a/package/boot/uboot-sunxi/patches/062-A20-improve-gmac-upload.patch b/package/boot/uboot-sunxi/patches/062-A20-improve-gmac-upload.patch index 679649c3f80349..a1caf18a184a54 100644 --- a/package/boot/uboot-sunxi/patches/062-A20-improve-gmac-upload.patch +++ b/package/boot/uboot-sunxi/patches/062-A20-improve-gmac-upload.patch @@ -2,11 +2,11 @@ --- a/configs/A20-OLinuXino-Lime2_defconfig +++ b/configs/A20-OLinuXino-Lime2_defconfig -@@ -24,6 +24,7 @@ CONFIG_DFU_RAM=y - CONFIG_ETH_DESIGNWARE=y +@@ -25,6 +25,7 @@ CONFIG_ETH_DESIGNWARE=y CONFIG_RGMII=y + CONFIG_MII=y CONFIG_SUN7I_GMAC=y +CONFIG_GMAC_TX_DELAY=1 CONFIG_AXP_ALDO3_VOLT=2800 - CONFIG_AXP_ALDO4_VOLT=2800 - CONFIG_SCSI=y + CONFIG_AXP_ALDO3_VOLT_SLOPE_08=y + CONFIG_AXP_ALDO3_INRUSH_QUIRK=y diff --git a/package/boot/uboot-sunxi/patches/063-fix-lime2-revK-add-micrel-PHY.patch b/package/boot/uboot-sunxi/patches/063-fix-lime2-revK-add-micrel-PHY.patch new file mode 100644 index 00000000000000..9ea0642537b7df --- /dev/null +++ b/package/boot/uboot-sunxi/patches/063-fix-lime2-revK-add-micrel-PHY.patch @@ -0,0 +1,44 @@ +--- a/configs/A20-OLinuXino-Lime2-eMMC_defconfig ++++ b/configs/A20-OLinuXino-Lime2-eMMC_defconfig +@@ -8,6 +8,8 @@ CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + CONFIG_USB0_VBUS_PIN="PC17" + CONFIG_USB0_VBUS_DET="PH5" + CONFIG_I2C1_ENABLE=y ++CONFIG_PHY_MICREL=y ++CONFIG_PHY_MICREL_KSZ90X1=y + CONFIG_SATAPWR="PC3" + CONFIG_AHCI=y + CONFIG_NR_DRAM_BANKS=1 +--- a/configs/A20-OLinuXino-Lime2_defconfig ++++ b/configs/A20-OLinuXino-Lime2_defconfig +@@ -7,6 +7,8 @@ CONFIG_MMC0_CD_PIN="PH1" + CONFIG_USB0_VBUS_PIN="PC17" + CONFIG_USB0_VBUS_DET="PH5" + CONFIG_I2C1_ENABLE=y ++CONFIG_PHY_MICREL=y ++CONFIG_PHY_MICREL_KSZ90X1=y + CONFIG_SATAPWR="PC3" + CONFIG_AHCI=y + CONFIG_NR_DRAM_BANKS=1 +--- a/drivers/net/phy/micrel_ksz90x1.c ++++ b/drivers/net/phy/micrel_ksz90x1.c +@@ -13,6 +13,8 @@ + #include + #include + #include ++#include ++#include + + /* + * KSZ9021 - KSZ9031 common +@@ -329,6 +331,10 @@ static int ksz9031_phy_extwrite(struct p + static int ksz9031_config(struct phy_device *phydev) + { + int ret; ++ struct sunxi_ccm_reg *const ccm = ++ (struct sunxi_ccm_reg *)SUNXI_CCM_BASE; ++ ++ setbits_le32(&ccm->gmac_clk_cfg, CCM_GMAC_CTRL_TX_CLK_DELAY(4)); + + ret = ksz9031_of_config(phydev); + if (ret) diff --git a/package/boot/uboot-sunxi/patches/091-sun6i-sync-PLL1-multdiv-with-Boot1.patch b/package/boot/uboot-sunxi/patches/091-sun6i-sync-PLL1-multdiv-with-Boot1.patch index cf41c4f1f12cfa..bcf2faa186dd16 100644 --- a/package/boot/uboot-sunxi/patches/091-sun6i-sync-PLL1-multdiv-with-Boot1.patch +++ b/package/boot/uboot-sunxi/patches/091-sun6i-sync-PLL1-multdiv-with-Boot1.patch @@ -14,7 +14,7 @@ More specifically, the following settings are now used: --- a/arch/arm/mach-sunxi/clock_sun6i.c +++ b/arch/arm/mach-sunxi/clock_sun6i.c -@@ -113,11 +113,12 @@ void clock_set_pll1(unsigned int clk) +@@ -112,11 +112,12 @@ void clock_set_pll1(unsigned int clk) struct sunxi_ccm_reg * const ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE; const int p = 0; diff --git a/package/boot/uboot-sunxi/patches/093-sun6i-fix-PLL-LDO-voltselect.patch b/package/boot/uboot-sunxi/patches/093-sun6i-fix-PLL-LDO-voltselect.patch index a8e03e2fb2ccf9..b62209e1dcb96b 100644 --- a/package/boot/uboot-sunxi/patches/093-sun6i-fix-PLL-LDO-voltselect.patch +++ b/package/boot/uboot-sunxi/patches/093-sun6i-fix-PLL-LDO-voltselect.patch @@ -18,7 +18,7 @@ required setting for the PLL LDO is 1.37v as per the A31 manual. --- a/arch/arm/mach-sunxi/clock_sun6i.c +++ b/arch/arm/mach-sunxi/clock_sun6i.c -@@ -26,13 +26,26 @@ void clock_init_safe(void) +@@ -25,13 +25,26 @@ void clock_init_safe(void) struct sunxi_prcm_reg * const prcm = (struct sunxi_prcm_reg *)SUNXI_PRCM_BASE; @@ -49,7 +49,7 @@ required setting for the PLL LDO is 1.37v as per the A31 manual. #if defined(CONFIG_MACH_SUN8I_R40) || defined(CONFIG_MACH_SUN50I) --- a/arch/arm/include/asm/arch-sunxi/prcm.h +++ b/arch/arm/include/asm/arch-sunxi/prcm.h -@@ -111,13 +111,13 @@ +@@ -110,13 +110,13 @@ #define PRCM_PLL_CTRL_LDO_OUT_MASK \ __PRCM_PLL_CTRL_LDO_OUT(0x7) /* When using the low voltage 20 mV steps, and high voltage 30 mV steps */ diff --git a/package/boot/uboot-sunxi/patches/101-sun6i-support-console-on-UART2.patch b/package/boot/uboot-sunxi/patches/101-sun6i-support-console-on-UART2.patch index c1ba07eec58ec4..b9226908454924 100644 --- a/package/boot/uboot-sunxi/patches/101-sun6i-support-console-on-UART2.patch +++ b/package/boot/uboot-sunxi/patches/101-sun6i-support-console-on-UART2.patch @@ -6,7 +6,7 @@ Subject: ARM: sun6i: Support console on UART2 (GPG6/GPG7) --- a/arch/arm/mach-sunxi/board.c +++ b/arch/arm/mach-sunxi/board.c -@@ -124,6 +124,10 @@ static int gpio_init(void) +@@ -127,6 +127,10 @@ static int gpio_init(void) sunxi_gpio_set_cfgpin(SUNXI_GPG(3), SUN5I_GPG_UART1); sunxi_gpio_set_cfgpin(SUNXI_GPG(4), SUN5I_GPG_UART1); sunxi_gpio_set_pull(SUNXI_GPG(4), SUNXI_GPIO_PULL_UP); @@ -19,7 +19,7 @@ Subject: ARM: sun6i: Support console on UART2 (GPG6/GPG7) sunxi_gpio_set_cfgpin(SUNXI_GPB(1), SUN8I_GPB_UART2); --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h -@@ -256,6 +256,8 @@ extern int soft_i2c_gpio_scl; +@@ -258,6 +258,8 @@ extern int soft_i2c_gpio_scl; #endif #elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUN5I) #define OF_STDOUT_PATH "/soc@01c00000/serial@01c28400:115200" diff --git a/package/boot/uboot-sunxi/patches/102-sunxi-make_CONS_INDEX-configurable.patch b/package/boot/uboot-sunxi/patches/102-sunxi-make_CONS_INDEX-configurable.patch index 7a0ff9744317ca..4e35d582fafd52 100644 --- a/package/boot/uboot-sunxi/patches/102-sunxi-make_CONS_INDEX-configurable.patch +++ b/package/boot/uboot-sunxi/patches/102-sunxi-make_CONS_INDEX-configurable.patch @@ -6,7 +6,7 @@ Subject: ARM: sunxi: Make CONS_INDEX configurable --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig -@@ -416,6 +416,14 @@ config SYS_BOARD +@@ -538,6 +538,14 @@ config SYS_BOARD config SYS_SOC default "sunxi" diff --git a/package/boot/uboot-sunxi/patches/200-mkimage-check-environment-for-dtc-binary-location.patch b/package/boot/uboot-sunxi/patches/200-mkimage-check-environment-for-dtc-binary-location.patch index 249157958b6f5e..12f47259c323ec 100644 --- a/package/boot/uboot-sunxi/patches/200-mkimage-check-environment-for-dtc-binary-location.patch +++ b/package/boot/uboot-sunxi/patches/200-mkimage-check-environment-for-dtc-binary-location.patch @@ -17,7 +17,7 @@ Cc: Simon Glass --- a/tools/fit_image.c +++ b/tools/fit_image.c -@@ -650,9 +650,14 @@ static int fit_handle_file(struct image_ +@@ -656,9 +656,14 @@ static int fit_handle_file(struct image_ } *cmd = '\0'; } else if (params->datafile) { @@ -26,10 +26,10 @@ Cc: Simon Glass + if (!dtc) + dtc = MKIMAGE_DTC; + - /* dtc -I dts -O dtb -p 500 datafile > tmpfile */ - snprintf(cmd, sizeof(cmd), "%s %s \"%s\" > \"%s\"", -- MKIMAGE_DTC, params->dtc, params->datafile, tmpfile); -+ dtc, params->dtc, params->datafile, tmpfile); + /* dtc -I dts -O dtb -p 500 -o tmpfile datafile */ + snprintf(cmd, sizeof(cmd), "%s %s -o \"%s\" \"%s\"", +- MKIMAGE_DTC, params->dtc, tmpfile, params->datafile); ++ dtc, params->dtc, tmpfile, params->datafile); debug("Trying to execute \"%s\"\n", cmd); } else { snprintf(cmd, sizeof(cmd), "cp \"%s\" \"%s\"", diff --git a/package/boot/uboot-sunxi/patches/210-sunxi-deactivate-binman.patch b/package/boot/uboot-sunxi/patches/210-sunxi-deactivate-binman.patch index b9cd9c7ac0084e..d86097858aa89d 100644 --- a/package/boot/uboot-sunxi/patches/210-sunxi-deactivate-binman.patch +++ b/package/boot/uboot-sunxi/patches/210-sunxi-deactivate-binman.patch @@ -12,17 +12,26 @@ old way of generating images. --- a/Makefile +++ b/Makefile -@@ -1144,9 +1144,10 @@ u-boot-x86-16bit.bin: u-boot FORCE - endif +@@ -1344,8 +1344,10 @@ endif ifneq ($(CONFIG_ARCH_SUNXI),) --u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img u-boot.dtb \ -- checkbinman FORCE + ifeq ($(CONFIG_ARM64),) +-u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img u-boot.dtb FORCE - $(call if_changed,binman) +OBJCOPYFLAGS_u-boot-sunxi-with-spl.bin = -I binary -O binary \ + --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff +u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img FORCE + $(call if_changed,pad_cat) - endif + else + u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.itb FORCE + $(call if_changed,cat) +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -842,7 +842,6 @@ config ARCH_SOCFPGA - ifneq ($(CONFIG_TEGRA),) + config ARCH_SUNXI + bool "Support sunxi (Allwinner) SoCs" +- select BINMAN + select CMD_GPIO + select CMD_MMC if MMC + select CMD_USB if DISTRO_DEFAULTS diff --git a/package/boot/uboot-sunxi/patches/220-add-sunxi50i-nanopi-neo-plus2.patch b/package/boot/uboot-sunxi/patches/220-add-sunxi50i-nanopi-neo-plus2.patch deleted file mode 100644 index aeee5b49759abf..00000000000000 --- a/package/boot/uboot-sunxi/patches/220-add-sunxi50i-nanopi-neo-plus2.patch +++ /dev/null @@ -1,165 +0,0 @@ -From 77f54e8698001d8a987f2aa4870f71b65dc089eb Mon Sep 17 00:00:00 2001 -In-Reply-To: <20170921152217.4011-1-antony@phenome.org> -References: <20170921152217.4011-1-antony@phenome.org> -From: Antony Antony -Date: Thu, 21 Sep 2017 13:34:07 +0200 -Subject: [PATCH v5 1/2] sun50i: h5: Add NanoPi Neo Plus2 DT initial support - -Add initial DT for NanoPi NEO Plus2 by FriendlyARM -- Allwinner quad core H5 Cortex A53 with an ARM Mali-450MP GPU -- 1 GB DDR3 RAM -- 8GB eMMC flash (Samsung KLM8G1WEPD-B031) -- micro SD card slot -- Gigabit Ethernet (external RTL8211E-VB-CG chip) -- 802.11 b/g/n WiFi, Bluetooth 4.0 (Ampak AP6212A module) -- 2x USB 2.0 host ports - -Signed-off-by: Antony Antony ---- - arch/arm/dts/Makefile | 1 + - arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts | 106 ++++++++++++++++++++++++++++ - configs/nanopi_neo_plus2_defconfig | 18 +++++ - 3 files changed, 125 insertions(+) - create mode 100644 arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts - create mode 100644 configs/nanopi_neo_plus2_defconfig - ---- a/arch/arm/dts/Makefile -+++ b/arch/arm/dts/Makefile -@@ -337,6 +337,7 @@ dtb-$(CONFIG_MACH_SUN8I_V3S) += \ - sun8i-v3s-licheepi-zero.dtb - dtb-$(CONFIG_MACH_SUN50I_H5) += \ - sun50i-h5-nanopi-neo2.dtb \ -+ sun50i-h5-nanopi-neo-plus2.dtb \ - sun50i-h5-orangepi-pc2.dtb \ - sun50i-h5-orangepi-prime.dtb \ - sun50i-h5-orangepi-zero-plus2.dtb ---- /dev/null -+++ b/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts -@@ -0,0 +1,106 @@ -+/* -+ * Copyright (C) 2017 Antony Antony -+ * Copyright (c) 2016 ARM Ltd. -+ * -+ * This file is dual-licensed: you can use it either under the terms -+ * of the GPL or the X11 license, at your option. Note that this dual -+ * licensing only applies to this file, and not this project as a -+ * whole. -+ * -+ * a) This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of the -+ * License, or (at your option) any later version. -+ * -+ * This library 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. -+ * -+ * Or, alternatively, -+ * -+ * b) Permission is hereby granted, free of charge, to any person -+ * obtaining a copy of this software and associated documentation -+ * files (the "Software"), to deal in the Software without -+ * restriction, including without limitation the rights to use, -+ * copy, modify, merge, publish, distribute, sublicense, and/or -+ * sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following -+ * conditions: -+ * -+ * The above copyright notice and this permission notice shall be -+ * included in all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -+ * OTHER DEALINGS IN THE SOFTWARE. -+ */ -+ -+/dts-v1/; -+ -+#include "sun50i-h5.dtsi" -+ -+#include -+ -+/ { -+ model = "FriendlyARM NanoPi NEO Plus 2"; -+ compatible = "friendlyarm,nanopi-neo-plus2", "allwinner,sun50i-h5"; -+ -+ aliases { -+ serial0 = &uart0; -+ }; -+ -+ chosen { -+ stdout-path = "serial0:115200n8"; -+ }; -+ -+ reg_vcc3v3: vcc3v3 { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc3v3"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ }; -+}; -+ -+&ehci1 { -+ status = "okay"; -+}; -+ -+&mmc0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>; -+ vmmc-supply = <®_vcc3v3>; -+ bus-width = <4>; -+ cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; -+ cd-inverted; -+ status = "okay"; -+}; -+ -+&mmc2 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mmc2_8bit_pins>; -+ vmmc-supply = <®_vcc3v3>; -+ bus-width = <8>; -+ non-removable; -+ cap-mmc-hw-reset; -+ status = "okay"; -+}; -+ -+&ohci1 { -+ status = "okay"; -+}; -+ -+&uart0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart0_pins_a>; -+ status = "okay"; -+}; -+ -+&usbphy { -+ status = "okay"; -+}; ---- /dev/null -+++ b/configs/nanopi_neo_plus2_defconfig -@@ -0,0 +1,18 @@ -+CONFIG_ARM=y -+CONFIG_ARCH_SUNXI=y -+CONFIG_MACH_SUN50I_H5=y -+CONFIG_DRAM_CLK=408 -+CONFIG_DRAM_ZQ=3881977 -+CONFIG_MACPWR="PD6" -+CONFIG_DEFAULT_DEVICE_TREE="sun50i-h5-nanopi-neo-plus2" -+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set -+CONFIG_SPL=y -+# CONFIG_CMD_IMLS is not set -+# CONFIG_CMD_FLASH is not set -+# CONFIG_CMD_FPGA is not set -+# CONFIG_SPL_DOS_PARTITION is not set -+# CONFIG_SPL_ISO_PARTITION is not set -+# CONFIG_SPL_EFI_PARTITION is not set -+CONFIG_SUN8I_EMAC=y -+CONFIG_USB_EHCI_HCD=y -+CONFIG_MMC_SUNXI_SLOT_EXTRA=2 diff --git a/package/boot/uboot-sunxi/patches/221-compatible-old-dtc.patch b/package/boot/uboot-sunxi/patches/221-compatible-old-dtc.patch index 1b88de3e2a196b..4056d9800894fe 100644 --- a/package/boot/uboot-sunxi/patches/221-compatible-old-dtc.patch +++ b/package/boot/uboot-sunxi/patches/221-compatible-old-dtc.patch @@ -7,7 +7,7 @@ dtc from kernel 4.9. --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include -@@ -172,6 +172,11 @@ ld-version = $(shell $(LD) --version | $ +@@ -173,6 +173,11 @@ ld-version = $(shell $(LD) --version | $ # Usage: $(call ld-ifversion, -ge, 22252, y) ld-ifversion = $(shell [ $(ld-version) $(1) $(2) ] && echo $(3) || echo $(4)) @@ -21,7 +21,7 @@ dtc from kernel 4.9. ### --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn -@@ -58,8 +58,8 @@ endif +@@ -56,8 +56,8 @@ endif KBUILD_CFLAGS += $(warning) @@ -32,7 +32,7 @@ dtc from kernel 4.9. dtc-warning := $(dtc-warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) dtc-warning += $(dtc-warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS))) -@@ -70,11 +70,11 @@ DTC_FLAGS += $(dtc-warning) +@@ -68,11 +68,11 @@ DTC_FLAGS += $(dtc-warning) else # Disable noisy checks by default diff --git a/package/boot/uboot-sunxi/patches/230-disable-axp209-on-a13-olinuxino.diff b/package/boot/uboot-sunxi/patches/230-disable-axp209-on-a13-olinuxino.diff new file mode 100644 index 00000000000000..9ce6adeb352da7 --- /dev/null +++ b/package/boot/uboot-sunxi/patches/230-disable-axp209-on-a13-olinuxino.diff @@ -0,0 +1,19 @@ +--- a/configs/A13-OLinuXino_defconfig ++++ b/configs/A13-OLinuXino_defconfig +@@ -7,7 +7,6 @@ CONFIG_DRAM_EMR1=0 + CONFIG_MMC0_CD_PIN="PG0" + CONFIG_USB0_VBUS_DET="PG1" + CONFIG_USB1_VBUS_PIN="PG11" +-CONFIG_AXP_GPIO=y + # CONFIG_VIDEO_HDMI is not set + CONFIG_VIDEO_VGA_VIA_LCD=y + CONFIG_VIDEO_VGA_VIA_LCD_FORCE_SYNC_ACTIVE_HIGH=y +@@ -24,7 +23,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y + CONFIG_DEFAULT_DEVICE_TREE="sun5i-a13-olinuxino" + CONFIG_DFU_RAM=y + CONFIG_FASTBOOT_CMD_OEM_FORMAT=y +-CONFIG_AXP_ALDO3_VOLT=3300 ++CONFIG_SUNXI_NO_PMIC=y + CONFIG_CONS_INDEX=2 + CONFIG_USB_EHCI_HCD=y + CONFIG_USB_MUSB_GADGET=y diff --git a/package/boot/uboot-sunxi/patches/240-sun50i-h5-Orange-Pi-Zero-Plus-Fix-SdCard-detection.patch b/package/boot/uboot-sunxi/patches/240-sun50i-h5-Orange-Pi-Zero-Plus-Fix-SdCard-detection.patch new file mode 100644 index 00000000000000..2feab76754eb4d --- /dev/null +++ b/package/boot/uboot-sunxi/patches/240-sun50i-h5-Orange-Pi-Zero-Plus-Fix-SdCard-detection.patch @@ -0,0 +1,28 @@ +From ad320d4d6ad03af5ff730546113d53a47ef6a22e Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Sun, 13 Jan 2019 17:05:09 +0100 +Subject: [PATCH] sun50i: h5: Orange Pi Zero Plus: Fix SdCard detection + +The Detection pin is at PF6 and not at PH13 like defined before. I +checked the schematics and now I am am not seeing this error message any +more: +Loading Environment from FAT... Card did not respond to voltage select! + +Fixes: 76d69eb01de ("sun50i: h5: Add initial Orange Pi Zero Plus support") +Signed-off-by: Hauke Mehrtens +--- + configs/orangepi_zero_plus_defconfig | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/configs/orangepi_zero_plus_defconfig ++++ b/configs/orangepi_zero_plus_defconfig +@@ -4,8 +4,7 @@ CONFIG_SPL=y + CONFIG_MACH_SUN50I_H5=y + CONFIG_DRAM_CLK=624 + CONFIG_DRAM_ZQ=3881977 +-CONFIG_MMC0_CD_PIN="PH13" +-CONFIG_MMC_SUNXI_SLOT_EXTRA=2 ++CONFIG_MMC0_CD_PIN="PF6" + CONFIG_NR_DRAM_BANKS=1 + # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set + # CONFIG_CMD_FLASH is not set diff --git a/package/boot/uboot-sunxi/patches/250-Sinovoip-BPI-M2-Ultra-defconfig.patch b/package/boot/uboot-sunxi/patches/250-Sinovoip-BPI-M2-Ultra-defconfig.patch new file mode 100644 index 00000000000000..94606aa8461157 --- /dev/null +++ b/package/boot/uboot-sunxi/patches/250-Sinovoip-BPI-M2-Ultra-defconfig.patch @@ -0,0 +1,25 @@ +--- /dev/null ++++ b/configs/Sinovoip_BPI_M2_Ultra_defconfig +@@ -0,0 +1,22 @@ ++CONFIG_ARM=y ++CONFIG_ARCH_SUNXI=y ++CONFIG_SPL=y ++CONFIG_MACH_SUN8I_R40=y ++CONFIG_DRAM_CLK=576 ++CONFIG_DRAM_ZQ=3881979 ++CONFIG_MACPWR="PA17" ++CONFIG_MMC0_CD_PIN="PH13" ++CONFIG_MMC_SUNXI_SLOT_EXTRA=2 ++CONFIG_AHCI=y ++CONFIG_NR_DRAM_BANKS=1 ++# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set ++CONFIG_SPL_I2C_SUPPORT=y ++# CONFIG_CMD_FLASH is not set ++CONFIG_DEFAULT_DEVICE_TREE="sun8i-r40-bananapi-m2-ultra" ++CONFIG_SCSI_AHCI=y ++CONFIG_RGMII=y ++CONFIG_SUN8I_EMAC=y ++CONFIG_AXP_DLDO4_VOLT=2500 ++CONFIG_AXP_ELDO3_VOLT=1200 ++CONFIG_SCSI=y ++CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y diff --git a/package/boot/uboot-sunxi/patches/320-sunxi-Add-support-for-Orange-Pi-R1.patch b/package/boot/uboot-sunxi/patches/320-sunxi-Add-support-for-Orange-Pi-R1.patch deleted file mode 100644 index 1181a44e8088ba..00000000000000 --- a/package/boot/uboot-sunxi/patches/320-sunxi-Add-support-for-Orange-Pi-R1.patch +++ /dev/null @@ -1,157 +0,0 @@ -From 068fb0d5728c5ec93cb961718d59e7c718886edd Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Tue, 26 Sep 2017 22:16:59 +0200 -Subject: sunxi: Add support for Orange Pi R1 - -The device tree files are also submitted for inclusion into the Linux -kernel. - -Signed-off-by: Hauke Mehrtens ---- - arch/arm/dts/Makefile | 1 + - arch/arm/dts/sun8i-h2-plus-orangepi-r1.dts | 77 ++++++++++++++++++++++++++++++ - board/sunxi/MAINTAINERS | 5 ++ - configs/orangepi_r1_defconfig | 26 ++++++++++ - 4 files changed, 109 insertions(+) - create mode 100644 arch/arm/dts/sun8i-h2-plus-orangepi-r1.dts - create mode 100644 configs/orangepi_r1_defconfig - ---- a/arch/arm/dts/Makefile -+++ b/arch/arm/dts/Makefile -@@ -318,6 +318,7 @@ dtb-$(CONFIG_MACH_SUN8I_A83T) += \ - sun8i-a83t-bananapi-m3.dtb \ - sun8i-a83t-cubietruck-plus.dtb - dtb-$(CONFIG_MACH_SUN8I_H3) += \ -+ sun8i-h2-plus-orangepi-r1.dtb \ - sun8i-h2-plus-orangepi-zero.dtb \ - sun8i-h3-bananapi-m2-plus.dtb \ - sun8i-h3-orangepi-2.dtb \ ---- /dev/null -+++ b/arch/arm/dts/sun8i-h2-plus-orangepi-r1.dts -@@ -0,0 +1,91 @@ -+/* -+ * Copyright (C) 2017 Icenowy Zheng -+ * -+ * This file is dual-licensed: you can use it either under the terms -+ * of the GPL or the X11 license, at your option. Note that this dual -+ * licensing only applies to this file, and not this project as a -+ * whole. -+ * -+ * a) This file is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of the -+ * License, or (at your option) any later version. -+ * -+ * This file 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. -+ * -+ * Or, alternatively, -+ * -+ * b) Permission is hereby granted, free of charge, to any person -+ * obtaining a copy of this software and associated documentation -+ * files (the "Software"), to deal in the Software without -+ * restriction, including without limitation the rights to use, -+ * copy, modify, merge, publish, distribute, sublicense, and/or -+ * sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following -+ * conditions: -+ * -+ * The above copyright notice and this permission notice shall be -+ * included in all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -+ * OTHER DEALINGS IN THE SOFTWARE. -+ */ -+ -+/* Orange Pi R1 is based on Orange Pi Zero design */ -+#include "sun8i-h2-plus-orangepi-zero.dts" -+ -+/ { -+ model = "Xunlong Orange Pi R1"; -+ compatible = "xunlong,orangepi-r1", "allwinner,sun8i-h2-plus"; -+ -+ /delete-node/ reg_vcc_wifi; -+ -+ /* -+ * Ths pin of this regulator is the same with the Wi-Fi extra -+ * regulator on the original Zero. However it's used for USB -+ * Ethernet rather than the Wi-Fi now. -+ */ -+ reg_vcc_usb_eth: reg-vcc-usb-ethernet { -+ compatible = "regulator-fixed"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ regulator-name = "vcc-usb-ethernet"; -+ enable-active-high; -+ gpio = <&pio 0 20 GPIO_ACTIVE_HIGH>; -+ }; -+ -+ aliases { -+ ethernet1 = &rtl8189etv; -+ }; -+}; -+ -+&ohci1 { -+ /* -+ * RTL8152B USB-Ethernet adapter is connected to USB1, -+ * and it's a USB 2.0 device. So the OHCI1 controller -+ * can be left disabled. -+ */ -+ status = "disabled"; -+}; -+ -+&mmc1 { -+ vmmc-supply = <®_vcc3v3>; -+ vqmmc-supply = <®_vcc3v3>; -+ -+ rtl8189etv: sdio_wifi@1 { -+ reg = <1>; -+ }; -+}; -+ -+&usbphy { -+ usb1_vbus-supply = <®_vcc_usb_eth>; -+}; ---- a/board/sunxi/MAINTAINERS -+++ b/board/sunxi/MAINTAINERS -@@ -326,6 +326,11 @@ M: Jagan Teki -+S: Maintained -+F: configs/orangepi_r1_defconfig -+ - PINE64 BOARDS - M: Andre Przywara - S: Maintained ---- /dev/null -+++ b/configs/orangepi_r1_defconfig -@@ -0,0 +1,18 @@ -+CONFIG_ARM=y -+CONFIG_ARCH_SUNXI=y -+CONFIG_SPL_SPI_FLASH_SUPPORT=y -+CONFIG_MACH_SUN8I_H3=y -+CONFIG_DRAM_CLK=624 -+CONFIG_DRAM_ZQ=3881979 -+CONFIG_DRAM_ODT_EN=y -+# CONFIG_VIDEO_DE2 is not set -+CONFIG_DEFAULT_DEVICE_TREE="sun8i-h2-plus-orangepi-r1" -+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set -+CONFIG_CONSOLE_MUX=y -+CONFIG_SPL=y -+# CONFIG_CMD_IMLS is not set -+# CONFIG_CMD_FLASH is not set -+# CONFIG_CMD_FPGA is not set -+CONFIG_SPL_SPI_SUNXI=y -+CONFIG_SUN8I_EMAC=y -+CONFIG_USB_EHCI_HCD=y diff --git a/package/boot/uboot-sunxi/patches/400-ARM-dts-orange-pi-zero-plus.patch b/package/boot/uboot-sunxi/patches/400-ARM-dts-orange-pi-zero-plus.patch deleted file mode 100644 index 4363b5ee2bde67..00000000000000 --- a/package/boot/uboot-sunxi/patches/400-ARM-dts-orange-pi-zero-plus.patch +++ /dev/null @@ -1,148 +0,0 @@ ---- a/arch/arm/dts/Makefile -+++ b/arch/arm/dts/Makefile -@@ -339,6 +339,7 @@ dtb-$(CONFIG_MACH_SUN8I_V3S) += \ - dtb-$(CONFIG_MACH_SUN50I_H5) += \ - sun50i-h5-nanopi-neo2.dtb \ - sun50i-h5-nanopi-neo-plus2.dtb \ -+ sun50i-h5-orangepi-zero-plus.dtb \ - sun50i-h5-orangepi-pc2.dtb \ - sun50i-h5-orangepi-prime.dtb \ - sun50i-h5-orangepi-zero-plus2.dtb ---- /dev/null -+++ b/configs/orangepi_zero_plus_defconfig -@@ -0,0 +1,19 @@ -+CONFIG_ARM=y -+CONFIG_ARCH_SUNXI=y -+CONFIG_MACH_SUN50I_H5=y -+CONFIG_DRAM_CLK=624 -+CONFIG_DRAM_ZQ=3881977 -+CONFIG_MACPWR="PD6" -+CONFIG_MMC_SUNXI_SLOT_EXTRA=2 -+CONFIG_DEFAULT_DEVICE_TREE="sun50i-h5-orangepi-zero-plus" -+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set -+CONFIG_SPL=y -+# CONFIG_CMD_IMLS is not set -+# CONFIG_CMD_FLASH is not set -+# CONFIG_CMD_FPGA is not set -+# CONFIG_SPL_DOS_PARTITION is not set -+# CONFIG_SPL_ISO_PARTITION is not set -+# CONFIG_SPL_EFI_PARTITION is not set -+CONFIG_SPL_SPI_SUNXI=y -+CONFIG_SUN8I_EMAC=y -+CONFIG_USB_EHCI_HCD=y ---- /dev/null -+++ b/arch/arm/dts/sun50i-h5-orangepi-zero-plus.dts -@@ -0,0 +1,113 @@ -+/* -+ * Copyright (C) 2017 Antony Antony -+ * Copyright (c) 2016 ARM Ltd. -+ * -+ * This file is dual-licensed: you can use it either under the terms -+ * of the GPL or the X11 license, at your option. Note that this dual -+ * licensing only applies to this file, and not this project as a -+ * whole. -+ * -+ * a) This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of the -+ * License, or (at your option) any later version. -+ * -+ * This library 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. -+ * -+ * Or, alternatively, -+ * -+ * b) Permission is hereby granted, free of charge, to any person -+ * obtaining a copy of this software and associated documentation -+ * files (the "Software"), to deal in the Software without -+ * restriction, including without limitation the rights to use, -+ * copy, modify, merge, publish, distribute, sublicense, and/or -+ * sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following -+ * conditions: -+ * -+ * The above copyright notice and this permission notice shall be -+ * included in all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -+ * OTHER DEALINGS IN THE SOFTWARE. -+ */ -+ -+/dts-v1/; -+ -+#include "sun50i-h5.dtsi" -+ -+#include -+ -+/ { -+ model = "Xunlong Orange Pi Zero Plus"; -+ compatible = "xunlong,orangepizero-zero-plus", "allwinner,sun50i-h5"; -+ -+ aliases { -+ serial0 = &uart0; -+ }; -+ -+ chosen { -+ stdout-path = "serial0:115200n8"; -+ }; -+ -+ memory { -+ reg = <0x40000000 0x40000000>; -+ }; -+ -+ reg_vcc3v3: vcc3v3 { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc3v3"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ }; -+}; -+ -+&ehci1 { -+ status = "okay"; -+}; -+ -+&mmc0 { -+ compatible = "allwinner,sun50i-h5-mmc", -+ "allwinner,sun50i-a64-mmc", -+ "allwinner,sun5i-a13-mmc"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>; -+ vmmc-supply = <®_vcc3v3>; -+ bus-width = <4>; -+ cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; -+ cd-inverted; -+ status = "okay"; -+}; -+ -+&mmc2 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mmc2_8bit_pins>; -+ vmmc-supply = <®_vcc3v3>; -+ bus-width = <8>; -+ non-removable; -+ cap-mmc-hw-reset; -+ status = "okay"; -+}; -+ -+&ohci1 { -+ status = "okay"; -+}; -+ -+&uart0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart0_pins_a>; -+ status = "okay"; -+}; -+ -+&usbphy { -+ status = "okay"; -+}; diff --git a/package/boot/uboot-tegra/Makefile b/package/boot/uboot-tegra/Makefile new file mode 100644 index 00000000000000..4b9f7876f80e4d --- /dev/null +++ b/package/boot/uboot-tegra/Makefile @@ -0,0 +1,64 @@ +# +# Copyright (C) 2017-2019 Tomasz Maciej Nowak +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +PKG_VERSION := 2019.04 +PKG_RELEASE := 1 + +PKG_HASH := 76b7772d156b3ddd7644c8a1736081e55b78828537ff714065d21dbade229bef + +PKG_MAINTAINER := Tomasz Maciej Nowak + +include $(INCLUDE_DIR)/u-boot.mk +include $(INCLUDE_DIR)/package.mk + +define U-Boot/Default + BUILD_TARGET := tegra + HIDDEN := y +endef + +define U-Boot/trimslice + NAME := CompuLab TrimSlice + BUILD_DEVICES := compulab_trimslice + UBOOT_IMAGE := trimslice-mmc.img trimslice-spi.img + SOC := tegra20 + VENDOR := compulab +endef + +UBOOT_TARGETS := trimslice + +define Build/bct-image + $(CP) $(PKG_BUILD_DIR)/u-boot-dtb-tegra.bin $(PKG_BUILD_DIR)/u-boot.bin + $(foreach bct,$(basename $(UBOOT_IMAGE)), \ + cd $(PKG_BUILD_DIR); \ + cbootimage -s $(SOC) -gbct \ + $(STAGING_DIR_HOST)/share/cbootimage-configs/$(SOC)/$(VENDOR)/$(VARIANT)/$(bct).bct.cfg \ + $(bct).bct; \ + cbootimage -s $(SOC) \ + $(STAGING_DIR_HOST)/share/cbootimage-configs/$(SOC)/$(VENDOR)/$(VARIANT)/$(bct).img.cfg \ + $(PKG_BUILD_DIR)/$(bct).img; \ + rm -f $(bct).bct; \ + ) +endef + +define Build/Configure + sed '/select BINMAN/d' -i $(PKG_BUILD_DIR)/arch/arm/mach-tegra/Kconfig + $(call Build/Configure/U-Boot) +endef + +define Build/Compile + $(call Build/Compile/U-Boot) + $(call Build/bct-image) +endef + +define Build/InstallDev + $(INSTALL_DIR) $(STAGING_DIR_IMAGE) + $(foreach img,$(UBOOT_IMAGE), \ + $(CP) $(PKG_BUILD_DIR)/$(img) $(STAGING_DIR_IMAGE)/;) +endef + +$(eval $(call BuildPackage/U-Boot)) diff --git a/package/boot/uboot-xburst/Makefile b/package/boot/uboot-xburst/Makefile deleted file mode 100644 index 413289a7f9384f..00000000000000 --- a/package/boot/uboot-xburst/Makefile +++ /dev/null @@ -1,88 +0,0 @@ -# -# Copyright (C) 2010 OpenWrt.org -# -# 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:=u-boot -PKG_VERSION:=2012.10-rc2 -PKG_RELEASE:=1 - -PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 -PKG_SOURCE_URL:= \ - http://mirror2.openwrt.org/sources \ - ftp://ftp.denx.de/pub/u-boot -PKG_HASH:=6d094cafa7ecea8b671fbdcd21130b6a4f5744fc47dd263e101ed5d3629dffd4 -PKG_TARGETS:=bin - -PKG_LICENSE:=GPL-2.0 GPL-2.0+ -PKG_LICENSE_FILES:=Licenses/README - -include $(INCLUDE_DIR)/package.mk - -define uboot/Default - TITLE:= - CONFIG:= - IMAGE:= -endef - -define uboot/qi_lb60 - TITLE:=U-boot for the qi_lb60 board -endef - -UBOOTS:=qi_lb60 - -define Package/uboot/template -define Package/uboot-xburst-$(1) - SECTION:=boot - CATEGORY:=Boot Loaders - DEPENDS:=@TARGET_xburst - TITLE:=$(2) - URL:=http://www.denx.de/wiki/UBoot/WebHome - VARIANT:=$(1) -endef -endef - -define BuildUbootPackage - $(eval $(uboot/Default)) - $(eval $(uboot/$(1))) - $(call Package/uboot/template,$(1),$(TITLE)) -endef - - -ifdef BUILD_VARIANT -$(eval $(call uboot/$(BUILD_VARIANT))) -UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT)) -UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin) -endif - -define Build/Configure - $(MAKE) -C $(PKG_BUILD_DIR) \ - $(UBOOT_CONFIG)_config -endef - -define Build/Compile - $(MAKE) -C $(PKG_BUILD_DIR) \ - CROSS_COMPILE=$(TARGET_CROSS) -endef - -define Package/uboot/install/template -define Package/uboot-xburst-$(1)/install - $(CP) $(PKG_BUILD_DIR)/u-boot-xburst.bin $(BIN_DIR)/$(2) - rmdir $$(1) -endef -endef - -$(foreach u,$(UBOOTS), \ - $(eval $(call Package/uboot/install/template,$(u),openwrt-$(BOARD)-$(u)-u-boot.bin)) \ -) - -$(foreach u,$(UBOOTS), \ - $(eval $(call BuildUbootPackage,$(u))) \ - $(eval $(call BuildPackage,uboot-xburst-$(u))) \ -) diff --git a/package/boot/uboot-xburst/patches/0001-qi_lb60-add-nand-spl-support.patch b/package/boot/uboot-xburst/patches/0001-qi_lb60-add-nand-spl-support.patch deleted file mode 100644 index e7702435289b92..00000000000000 --- a/package/boot/uboot-xburst/patches/0001-qi_lb60-add-nand-spl-support.patch +++ /dev/null @@ -1,894 +0,0 @@ -From 0329cf7965956a5a7044827e0ce88ae8d5150e54 Mon Sep 17 00:00:00 2001 -From: Xiangfu -Date: Fri, 12 Oct 2012 09:46:58 +0800 -Subject: [PATCH 1/6] qi_lb60: add nand spl support - - The JZ4740 CPU can load 8KB from two different addresses: - 1. the normal area up to 8KB starting from NAND flash address 0x00000000 - 2. the backup area up to 8KB starting from NAND flash address 0x00002000 - -Signed-off-by: Xiangfu ---- - Makefile | 12 +++ - arch/mips/cpu/xburst/Makefile | 7 +- - arch/mips/cpu/xburst/cpu.c | 4 + - arch/mips/cpu/xburst/jz4740.c | 82 +++++++---------- - arch/mips/cpu/xburst/spl/Makefile | 47 ++++++++++ - arch/mips/cpu/xburst/spl/start.S | 63 +++++++++++++ - board/qi/qi_lb60/Makefile | 4 + - board/qi/qi_lb60/qi_lb60-spl.c | 30 +++++++ - board/qi/qi_lb60/qi_lb60.c | 8 +- - board/qi/qi_lb60/u-boot-spl.lds | 61 +++++++++++++ - drivers/mtd/nand/jz4740_nand.c | 39 ++++++++- - include/configs/qi_lb60.h | 175 ++++++++++++++++++------------------- - 12 files changed, 386 insertions(+), 146 deletions(-) - create mode 100644 arch/mips/cpu/xburst/spl/Makefile - create mode 100644 arch/mips/cpu/xburst/spl/start.S - create mode 100644 board/qi/qi_lb60/qi_lb60-spl.c - create mode 100644 board/qi/qi_lb60/u-boot-spl.lds - -diff --git a/Makefile b/Makefile -index 34d9075..a22778e 100644 ---- a/Makefile -+++ b/Makefile -@@ -393,6 +393,10 @@ ALL-y += $(obj)u-boot-nodtb-tegra.bin - endif - endif - -+ifeq ($(CPU),xburst) -+ALL-y += $(obj)u-boot-xburst.bin -+endif -+ - all: $(ALL-y) $(SUBDIR_EXAMPLES) - - $(obj)u-boot.dtb: $(obj)u-boot -@@ -506,6 +510,14 @@ $(obj)u-boot-nodtb-tegra.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin - endif - endif - -+ifeq ($(CPU),xburst) -+$(obj)u-boot-xburst.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin -+ dd if=$(obj)spl/u-boot-spl.bin of=$(obj)spl/u-boot-pad.bin conv=sync bs=8192 count=1 -+ dd if=$(obj)spl/u-boot-spl.bin of=$(obj)spl/u-boot-pad.bin conv=sync,notrunc oflag=append bs=8192 count=1 -+ tr '\0' '\377' < /dev/zero | dd of=$(obj)spl/u-boot-pad.bin conv=sync,notrunc oflag=append bs=16384 count=1 -+ cat $(obj)spl/u-boot-pad.bin u-boot.bin > $@ -+endif -+ - ifeq ($(CONFIG_SANDBOX),y) - GEN_UBOOT = \ - cd $(LNDIR) && $(CC) $(SYMS) -T $(obj)u-boot.lds \ -diff --git a/arch/mips/cpu/xburst/Makefile b/arch/mips/cpu/xburst/Makefile -index b1f2ae4..ec35e55 100644 ---- a/arch/mips/cpu/xburst/Makefile -+++ b/arch/mips/cpu/xburst/Makefile -@@ -24,9 +24,12 @@ include $(TOPDIR)/config.mk - - LIB = $(obj)lib$(CPU).o - -+COBJS-y = cpu.o jz_serial.o -+ -+ifneq ($(CONFIG_SPL_BUILD),y) - START = start.o --SOBJS-y = --COBJS-y = cpu.o timer.o jz_serial.o -+COBJS-y += timer.o -+endif - - COBJS-$(CONFIG_JZ4740) += jz4740.o - -diff --git a/arch/mips/cpu/xburst/cpu.c b/arch/mips/cpu/xburst/cpu.c -index ddcbfaa..1432838 100644 ---- a/arch/mips/cpu/xburst/cpu.c -+++ b/arch/mips/cpu/xburst/cpu.c -@@ -42,6 +42,8 @@ - : \ - : "i" (op), "R" (*(unsigned char *)(addr))) - -+#ifndef CONFIG_SPL_BUILD -+ - void __attribute__((weak)) _machine_restart(void) - { - struct jz4740_wdt *wdt = (struct jz4740_wdt *)JZ4740_WDT_BASE; -@@ -109,6 +111,8 @@ void invalidate_dcache_range(ulong start_addr, ulong stop) - cache_op(Hit_Invalidate_D, addr); - } - -+#endif -+ - void flush_icache_all(void) - { - u32 addr, t = 0; -diff --git a/arch/mips/cpu/xburst/jz4740.c b/arch/mips/cpu/xburst/jz4740.c -index c0b9817..8816aa3 100644 ---- a/arch/mips/cpu/xburst/jz4740.c -+++ b/arch/mips/cpu/xburst/jz4740.c -@@ -32,31 +32,19 @@ int disable_interrupts(void) - return 0; - } - --/* -- * PLL output clock = EXTAL * NF / (NR * NO) -- * NF = FD + 2, NR = RD + 2 -- * NO = 1 (if OD = 0), NO = 2 (if OD = 1 or 2), NO = 4 (if OD = 3) -- */ - void pll_init(void) - { - struct jz4740_cpm *cpm = (struct jz4740_cpm *)JZ4740_CPM_BASE; - -- register unsigned int cfcr, plcr1; -- int n2FR[33] = { -- 0, 0, 1, 2, 3, 0, 4, 0, 5, 0, 0, 0, 6, 0, 0, 0, -- 7, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, -- 9 -- }; -- int div[5] = {1, 3, 3, 3, 3}; /* divisors of I:S:P:L:M */ -- int nf, pllout2; -+ register unsigned int cfcr, plcr; -+ unsigned int nf, pllout2; - - cfcr = CPM_CPCCR_CLKOEN | -- CPM_CPCCR_PCS | -- (n2FR[div[0]] << CPM_CPCCR_CDIV_BIT) | -- (n2FR[div[1]] << CPM_CPCCR_HDIV_BIT) | -- (n2FR[div[2]] << CPM_CPCCR_PDIV_BIT) | -- (n2FR[div[3]] << CPM_CPCCR_MDIV_BIT) | -- (n2FR[div[4]] << CPM_CPCCR_LDIV_BIT); -+ (0 << CPM_CPCCR_CDIV_BIT) | -+ (2 << CPM_CPCCR_HDIV_BIT) | -+ (2 << CPM_CPCCR_PDIV_BIT) | -+ (2 << CPM_CPCCR_MDIV_BIT) | -+ (2 << CPM_CPCCR_LDIV_BIT); - - pllout2 = (cfcr & CPM_CPCCR_PCS) ? - CONFIG_SYS_CPU_SPEED : (CONFIG_SYS_CPU_SPEED / 2); -@@ -65,15 +53,18 @@ void pll_init(void) - writel(pllout2 / 48000000 - 1, &cpm->uhccdr); - - nf = CONFIG_SYS_CPU_SPEED * 2 / CONFIG_SYS_EXTAL; -- plcr1 = ((nf - 2) << CPM_CPPCR_PLLM_BIT) | /* FD */ -+ plcr = ((nf - 2) << CPM_CPPCR_PLLM_BIT) | /* FD */ - (0 << CPM_CPPCR_PLLN_BIT) | /* RD=0, NR=2 */ - (0 << CPM_CPPCR_PLLOD_BIT) | /* OD=0, NO=1 */ -- (0x20 << CPM_CPPCR_PLLST_BIT) | /* PLL stable time */ -+ (0x32 << CPM_CPPCR_PLLST_BIT) | /* PLL stable time */ - CPM_CPPCR_PLLEN; /* enable PLL */ - - /* init PLL */ - writel(cfcr, &cpm->cpccr); -- writel(plcr1, &cpm->cppcr); -+ writel(plcr, &cpm->cppcr); -+ -+ while (!(readl(&cpm->cppcr) & CPM_CPPCR_PLLS)) -+ ; - } - - void sdram_init(void) -@@ -92,26 +83,12 @@ void sdram_init(void) - 2 << EMC_DMCR_TCL_BIT /* CAS latency is 3 */ - }; - -- int div[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32}; -- - cpu_clk = CONFIG_SYS_CPU_SPEED; -- mem_clk = cpu_clk * div[__cpm_get_cdiv()] / div[__cpm_get_mdiv()]; -+ mem_clk = 84000000; - - writel(0, &emc->bcr); /* Disable bus release */ - writew(0, &emc->rtcsr); /* Disable clock for counting */ - -- /* Fault DMCR value for mode register setting*/ --#define SDRAM_ROW0 11 --#define SDRAM_COL0 8 --#define SDRAM_BANK40 0 -- -- dmcr0 = ((SDRAM_ROW0 - 11) << EMC_DMCR_RA_BIT) | -- ((SDRAM_COL0 - 8) << EMC_DMCR_CA_BIT) | -- (SDRAM_BANK40 << EMC_DMCR_BA_BIT) | -- (SDRAM_BW16 << EMC_DMCR_BW_BIT) | -- EMC_DMCR_EPIN | -- cas_latency_dmcr[((SDRAM_CASL == 3) ? 1 : 0)]; -- - /* Basic DMCR value */ - dmcr = ((SDRAM_ROW - 11) << EMC_DMCR_RA_BIT) | - ((SDRAM_COL - 8) << EMC_DMCR_CA_BIT) | -@@ -128,31 +105,31 @@ void sdram_init(void) - if (tmp > 11) - tmp = 11; - dmcr |= (tmp - 4) << EMC_DMCR_TRAS_BIT; -- tmp = SDRAM_RCD / ns; - -+ tmp = SDRAM_RCD / ns; - if (tmp > 3) - tmp = 3; - dmcr |= tmp << EMC_DMCR_RCD_BIT; -- tmp = SDRAM_TPC / ns; - -+ tmp = SDRAM_TPC / ns; - if (tmp > 7) - tmp = 7; - dmcr |= tmp << EMC_DMCR_TPC_BIT; -- tmp = SDRAM_TRWL / ns; - -+ tmp = SDRAM_TRWL / ns; - if (tmp > 3) - tmp = 3; - dmcr |= tmp << EMC_DMCR_TRWL_BIT; -- tmp = (SDRAM_TRAS + SDRAM_TPC) / ns; - -+ tmp = (SDRAM_TRAS + SDRAM_TPC) / ns; - if (tmp > 14) - tmp = 14; - dmcr |= ((tmp + 1) >> 1) << EMC_DMCR_TRC_BIT; - - /* SDRAM mode value */ -- sdmode = EMC_SDMR_BT_SEQ | -- EMC_SDMR_OM_NORMAL | -- EMC_SDMR_BL_4 | -+ sdmode = EMC_SDMR_BT_SEQ | -+ EMC_SDMR_OM_NORMAL | -+ EMC_SDMR_BL_4 | - cas_latency_sdmr[((SDRAM_CASL == 3) ? 1 : 0)]; - - /* Stage 1. Precharge all banks by writing SDMR with DMCR.MRSET=0 */ -@@ -172,8 +149,8 @@ void sdram_init(void) - if (tmp > 0xff) - tmp = 0xff; - writew(tmp, &emc->rtcor); -+ - writew(0, &emc->rtcnt); -- /* Divisor is 64, CKO/64 */ - writew(EMC_RTCSR_CKS_64, &emc->rtcsr); - - /* Wait for number of auto-refresh cycles */ -@@ -182,13 +159,17 @@ void sdram_init(void) - ; - - /* Stage 3. Mode Register Set */ -+ dmcr0 = (11 << EMC_DMCR_RA_BIT) | -+ (8 << EMC_DMCR_CA_BIT) | -+ (0 << EMC_DMCR_BA_BIT) | -+ EMC_DMCR_EPIN | -+ (SDRAM_BW16 << EMC_DMCR_BW_BIT) | -+ cas_latency_dmcr[((SDRAM_CASL == 3) ? 1 : 0)]; - writel(dmcr0 | EMC_DMCR_RFSH | EMC_DMCR_MRSET, &emc->dmcr); - writeb(0, JZ4740_EMC_SDMR0 | sdmode); - - /* Set back to basic DMCR value */ - writel(dmcr | EMC_DMCR_RFSH | EMC_DMCR_MRSET, &emc->dmcr); -- -- /* everything is ok now */ - } - - DECLARE_GLOBAL_DATA_PTR; -@@ -232,9 +213,10 @@ void rtc_init(void) - phys_size_t initdram(int board_type) - { - struct jz4740_emc *emc = (struct jz4740_emc *)JZ4740_EMC_BASE; -- u32 dmcr; -- u32 rows, cols, dw, banks; -- ulong size; -+ -+ unsigned int dmcr; -+ unsigned int rows, cols, dw, banks; -+ unsigned long size; - - dmcr = readl(&emc->dmcr); - rows = 11 + ((dmcr & EMC_DMCR_RA_MASK) >> EMC_DMCR_RA_BIT); -diff --git a/arch/mips/cpu/xburst/spl/Makefile b/arch/mips/cpu/xburst/spl/Makefile -new file mode 100644 -index 0000000..f45e8c8 ---- /dev/null -+++ b/arch/mips/cpu/xburst/spl/Makefile -@@ -0,0 +1,47 @@ -+# -+# Copyright (C) 2011 Xiangfu Liu -+# -+# See file CREDITS for list of people who contributed to this -+# project. -+# -+# This program is free software; you can redistribute it and/or -+# modify it under the terms of the GNU General Public License as -+# published by the Free Software Foundation; either version 2 of -+# the License, or (at your option) any later version. -+# -+# 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. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+# MA 02111-1307 USA -+# -+ -+include $(TOPDIR)/config.mk -+ -+LIB = $(obj)lib$(CPU).o -+ -+START = start.o -+SOBJS-y = -+COBJS-y = -+ -+SRCS := $(START:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) -+OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y)) -+START := $(addprefix $(obj),$(START)) -+ -+all: $(obj).depend $(START) $(LIB) -+ -+$(LIB): $(OBJS) -+ $(call cmd_link_o_target, $(OBJS)) -+ -+######################################################################### -+ -+# defines $(obj).depend target -+include $(SRCTREE)/rules.mk -+ -+sinclude $(obj).depend -+ -+######################################################################### -diff --git a/arch/mips/cpu/xburst/spl/start.S b/arch/mips/cpu/xburst/spl/start.S -new file mode 100644 -index 0000000..e31c4c8 ---- /dev/null -+++ b/arch/mips/cpu/xburst/spl/start.S -@@ -0,0 +1,63 @@ -+/* -+ * Copyright (c) 2010 Xiangfu Liu -+ * -+ * See file CREDITS for list of people who contributed to this -+ * project. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 3 of -+ * the License, or (at your option) any later version. -+ * -+ * 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+ .set noreorder -+ -+ .globl _start -+ .text -+_start: -+ .word JZ4740_NANDBOOT_CFG /* fetched during NAND Boot */ -+reset: -+ /* -+ * STATUS register -+ * CU0=UM=EXL=IE=0, BEV=ERL=1, IP2~7=1 -+ */ -+ li t0, 0x0040FC04 -+ mtc0 t0, CP0_STATUS -+ /* -+ * CAUSE register -+ * IV=1, use the specical interrupt vector (0x200) -+ */ -+ li t1, 0x00800000 -+ mtc0 t1, CP0_CAUSE -+ -+ bal 1f -+ nop -+ .word _GLOBAL_OFFSET_TABLE_ -+1: -+ move gp, ra -+ lw t1, 0(ra) -+ move gp, t1 -+ -+ la sp, 0x80004000 -+ la t9, nand_spl_boot -+ j t9 -+ nop -diff --git a/board/qi/qi_lb60/Makefile b/board/qi/qi_lb60/Makefile -index 5dae11b..e399246 100644 ---- a/board/qi/qi_lb60/Makefile -+++ b/board/qi/qi_lb60/Makefile -@@ -22,7 +22,11 @@ include $(TOPDIR)/config.mk - - LIB = $(obj)lib$(BOARD).o - -+ifeq ($(CONFIG_SPL_BUILD),y) -+COBJS := $(BOARD)-spl.o -+else - COBJS := $(BOARD).o -+endif - - SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) - OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) -diff --git a/board/qi/qi_lb60/qi_lb60-spl.c b/board/qi/qi_lb60/qi_lb60-spl.c -new file mode 100644 -index 0000000..3fe3fa3 ---- /dev/null -+++ b/board/qi/qi_lb60/qi_lb60-spl.c -@@ -0,0 +1,30 @@ -+/* -+ * Authors: Xiangfu Liu -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * as published by the Free Software Foundation; either version -+ * 3 of the License, or (at your option) any later version. -+ */ -+ -+#include -+#include -+#include -+#include -+ -+void nand_spl_boot(void) -+{ -+ __gpio_as_sdram_16bit_4720(); -+ __gpio_as_uart0(); -+ __gpio_jtag_to_uart0(); -+ -+ serial_init(); -+ -+ pll_init(); -+ sdram_init(); -+ -+ nand_init(); -+ -+ puts("\nQi LB60 SPL: Starting U-Boot ...\n"); -+ nand_boot(); -+} -diff --git a/board/qi/qi_lb60/qi_lb60.c b/board/qi/qi_lb60/qi_lb60.c -index d975209..3bd4e2f 100644 ---- a/board/qi/qi_lb60/qi_lb60.c -+++ b/board/qi/qi_lb60/qi_lb60.c -@@ -1,5 +1,5 @@ - /* -- * Authors: Xiangfu Liu -+ * Authors: Xiangfu Liu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License -@@ -97,8 +97,10 @@ int board_early_init_f(void) - /* U-Boot common routines */ - int checkboard(void) - { -- printf("Board: Qi LB60 (Ingenic XBurst Jz4740 SoC, Speed %ld MHz)\n", -- gd->cpu_clk / 1000000); -+ printf("Board: Qi LB60 (Ingenic XBurst Jz4740 SoC)\n"); -+ printf(" CPU: %ld\n", gd->cpu_clk); -+ printf(" MEM: %ld\n", gd->mem_clk); -+ printf(" DEV: %ld\n", gd->dev_clk); - - return 0; - } -diff --git a/board/qi/qi_lb60/u-boot-spl.lds b/board/qi/qi_lb60/u-boot-spl.lds -new file mode 100644 -index 0000000..930537f ---- /dev/null -+++ b/board/qi/qi_lb60/u-boot-spl.lds -@@ -0,0 +1,61 @@ -+/* -+ * (C) Copyright 2012 Xiangfu Liu -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ * -+ * 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+ -+OUTPUT_FORMAT("elf32-tradlittlemips", "elf32-tradlittlemips", "elf32-tradlittlemips") -+ -+OUTPUT_ARCH(mips) -+ENTRY(_start) -+SECTIONS -+{ -+ . = 0x80000000; -+ . = ALIGN(4); -+ .text : -+ { -+ *(.text) -+ } -+ -+ . = ALIGN(4); -+ .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } -+ -+ . = ALIGN(4); -+ .data : { *(.data) } -+ -+ . = ALIGN(4); -+ .sdata : { *(.sdata) } -+ -+ _gp = ALIGN(16); -+ -+ __got_start = .; -+ .got : { *(.got) } -+ __got_end = .; -+ -+ . = .; -+ __u_boot_cmd_start = .; -+ .u_boot_cmd : { *(.u_boot_cmd) } -+ __u_boot_cmd_end = .; -+ -+ uboot_end_data = .; -+ num_got_entries = (__got_end - __got_start) >> 2; -+ -+ . = ALIGN(4); -+ .sbss : { *(.sbss) } -+ .bss : { *(.bss) } -+ uboot_end = .; -+} -+ASSERT(uboot_end <= 0x80002000, "NAND bootstrap too big"); -diff --git a/drivers/mtd/nand/jz4740_nand.c b/drivers/mtd/nand/jz4740_nand.c -index 3ec34f3..24a4921 100644 ---- a/drivers/mtd/nand/jz4740_nand.c -+++ b/drivers/mtd/nand/jz4740_nand.c -@@ -15,6 +15,9 @@ - #include - #include - -+#ifdef CONFIG_SPL_BUILD -+#define printf(s) puts(s) -+#endif - #define JZ_NAND_DATA_ADDR ((void __iomem *)0xB8000000) - #define JZ_NAND_CMD_ADDR (JZ_NAND_DATA_ADDR + 0x8000) - #define JZ_NAND_ADDR_ADDR (JZ_NAND_DATA_ADDR + 0x10000) -@@ -176,7 +179,7 @@ static int jz_nand_rs_correct_data(struct mtd_info *mtd, u_char *dat, - for (k = 0; k < 9; k++) - writeb(read_ecc[k], &emc->nfpar[k]); - } -- /* Set PRDY */ -+ - writel(readl(&emc->nfecr) | EMC_NFECR_PRDY, &emc->nfecr); - - /* Wait for completion */ -@@ -184,7 +187,7 @@ static int jz_nand_rs_correct_data(struct mtd_info *mtd, u_char *dat, - status = readl(&emc->nfints); - } while (!(status & EMC_NFINTS_DECF)); - -- /* disable ecc */ -+ /* Disable ECC */ - writel(readl(&emc->nfecr) & ~EMC_NFECR_ECCE, &emc->nfecr); - - /* Check decoding */ -@@ -192,7 +195,7 @@ static int jz_nand_rs_correct_data(struct mtd_info *mtd, u_char *dat, - return 0; - - if (status & EMC_NFINTS_UNCOR) { -- printf("uncorrectable ecc\n"); -+ printf("JZ4740 uncorrectable ECC\n"); - return -1; - } - -@@ -230,6 +233,32 @@ static int jz_nand_rs_correct_data(struct mtd_info *mtd, u_char *dat, - return errcnt; - } - -+#ifdef CONFIG_SPL_BUILD -+static void jz_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) -+{ -+ int i; -+ struct nand_chip *this = mtd->priv; -+ -+#if (JZ4740_NANDBOOT_CFG == JZ4740_NANDBOOT_B16R3) || \ -+ (JZ4740_NANDBOOT_CFG == JZ4740_NANDBOOT_B16R2) -+ for (i = 0; i < len; i += 2) -+ buf[i] = readw(this->IO_ADDR_R); -+#elif (JZ4740_NANDBOOT_CFG == JZ4740_NANDBOOT_B8R3) || \ -+ (JZ4740_NANDBOOT_CFG == JZ4740_NANDBOOT_B8R2) -+ for (i = 0; i < len; i++) -+ buf[i] = readb(this->IO_ADDR_R); -+#else -+ #error JZ4740_NANDBOOT_CFG not defined or wrong -+#endif -+} -+ -+static uint8_t jz_nand_read_byte(struct mtd_info *mtd) -+{ -+ struct nand_chip *this = mtd->priv; -+ return readb(this->IO_ADDR_R); -+} -+#endif -+ - /* - * Main initialization routine - */ -@@ -254,6 +283,10 @@ int board_nand_init(struct nand_chip *nand) - nand->ecc.size = CONFIG_SYS_NAND_ECCSIZE; - nand->ecc.bytes = CONFIG_SYS_NAND_ECCBYTES; - nand->ecc.layout = &qi_lb60_ecclayout_2gb; -+#ifdef CONFIG_SPL_BUILD -+ nand->read_byte = jz_nand_read_byte; -+ nand->read_buf = jz_nand_read_buf; -+#endif - nand->chip_delay = 50; - nand->options = NAND_USE_FLASH_BBT; - -diff --git a/include/configs/qi_lb60.h b/include/configs/qi_lb60.h -index 4bb5bbc..7bff444 100644 ---- a/include/configs/qi_lb60.h -+++ b/include/configs/qi_lb60.h -@@ -1,5 +1,5 @@ - /* -- * Authors: Xiangfu Liu -+ * Authors: Xiangfu Liu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License -@@ -14,7 +14,6 @@ - #define CONFIG_SYS_LITTLE_ENDIAN - #define CONFIG_JZSOC /* Jz SoC */ - #define CONFIG_JZ4740 /* Jz4740 SoC */ --#define CONFIG_NAND_JZ4740 - - #define CONFIG_SYS_CPU_SPEED 336000000 /* CPU clock: 336 MHz */ - #define CONFIG_SYS_EXTAL 12000000 /* EXTAL freq: 12 MHz */ -@@ -24,24 +23,43 @@ - #define CONFIG_SYS_UART_BASE JZ4740_UART0_BASE /* Base of the UART channel */ - #define CONFIG_BAUDRATE 57600 - -+#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAUL) -+#define CONFIG_BOOTDELAY 0 -+#define CONFIG_BOOTARGS "mem=32M console=tty0 console=ttyS0,57600n8 ubi.mtd=2 rootfstype=ubifs root=ubi0:rootfs rw rootwait" -+#define CONFIG_BOOTCOMMAND "nand read 0x80600000 0x400000 0x280000;bootm" -+ -+/* -+ * Miscellaneous configurable options -+ */ -+#define CONFIG_SYS_SDRAM_BASE 0x80000000 /* Cached addr */ -+#define CONFIG_SYS_INIT_SP_OFFSET 0x400000 -+#define CONFIG_SYS_LOAD_ADDR 0x80600000 -+#define CONFIG_SYS_MEMTEST_START 0x80100000 -+#define CONFIG_SYS_MEMTEST_END 0x80A00000 -+#define CONFIG_SYS_TEXT_BASE 0x80100000 -+#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE -+ -+#define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024) -+#define CONFIG_SYS_BOOTPARAMS_LEN (128 * 1024) -+ -+#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ -+#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) -+ -+#define CONFIG_SYS_LONGHELP -+#define CONFIG_SYS_MAXARGS 16 -+#define CONFIG_SYS_PROMPT "NanoNote# " -+ - #define CONFIG_SKIP_LOWLEVEL_INIT - #define CONFIG_BOARD_EARLY_INIT_F - #define CONFIG_SYS_NO_FLASH - #define CONFIG_SYS_FLASH_BASE 0 /* init flash_base as 0 */ --#define CONFIG_ENV_OVERWRITE -- --#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAUL) --#define CONFIG_BOOTDELAY 0 --#define CONFIG_BOOTARGS "mem=32M console=tty0 console=ttyS0,57600n8 ubi.mtd=2 rootfstype=ubifs root=ubi0:rootfs rw rootwait" --#define CONFIG_BOOTCOMMAND "nand read 0x80600000 0x400000 0x200000;bootm" - - /* -- * Command line configuration. -+ * Command line configuration - */ - #define CONFIG_CMD_BOOTD /* bootd */ - #define CONFIG_CMD_CONSOLE /* coninfo */ - #define CONFIG_CMD_ECHO /* echo arguments */ -- - #define CONFIG_CMD_LOADB /* loadb */ - #define CONFIG_CMD_LOADS /* loads */ - #define CONFIG_CMD_MEMORY /* md mm nm mw cp cmp crc base loop mtest */ -@@ -58,45 +76,16 @@ - #define CONFIG_LOADS_ECHO 1 /* echo on for serial download */ - - /* -- * Miscellaneous configurable options -- */ --#define CONFIG_SYS_MAXARGS 16 --#define CONFIG_SYS_LONGHELP --#define CONFIG_SYS_PROMPT "NanoNote# " --#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ --#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) -- --#define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024) --#define CONFIG_SYS_BOOTPARAMS_LEN (128 * 1024) -- --#define CONFIG_SYS_SDRAM_BASE 0x80000000 /* Cached addr */ --#define CONFIG_SYS_INIT_SP_OFFSET 0x400000 --#define CONFIG_SYS_LOAD_ADDR 0x80600000 --#define CONFIG_SYS_MEMTEST_START 0x80100000 --#define CONFIG_SYS_MEMTEST_END 0x80800000 -- --/* -- * Environment -+ * NAND driver configuration - */ --#define CONFIG_ENV_IS_IN_NAND /* use NAND for environment vars */ -- --#define CONFIG_SYS_NAND_5_ADDR_CYCLE --/* -- * if board nand flash is 1GB, set to 1 -- * if board nand flash is 2GB, set to 2 -- * for change the PAGE_SIZE and BLOCK_SIZE -- * will delete when there is no 1GB flash -- */ --#define NANONOTE_NAND_SIZE 2 -- --#define CONFIG_SYS_NAND_PAGE_SIZE (2048 * NANONOTE_NAND_SIZE) --#define CONFIG_SYS_NAND_BLOCK_SIZE (256 * NANONOTE_NAND_SIZE << 10) --/* nand bad block was marked at this page in a block, start from 0 */ -+#define CONFIG_NAND_JZ4740 -+#define CONFIG_SYS_NAND_PAGE_SIZE 4096 -+#define CONFIG_SYS_NAND_BLOCK_SIZE (512 << 10) -+/* NAND bad block was marked at this page in a block, start from 0 */ - #define CONFIG_SYS_NAND_BADBLOCK_PAGE 127 - #define CONFIG_SYS_NAND_PAGE_COUNT 128 - #define CONFIG_SYS_NAND_BAD_BLOCK_POS 0 --/* ECC offset position in oob area, default value is 6 if it isn't defined */ --#define CONFIG_SYS_NAND_ECC_POS (6 * NANONOTE_NAND_SIZE) -+#define CONFIG_SYS_NAND_ECC_POS 12 - #define CONFIG_SYS_NAND_ECCSIZE 512 - #define CONFIG_SYS_NAND_ECCBYTES 9 - #define CONFIG_SYS_NAND_ECCPOS \ -@@ -115,10 +104,9 @@ - #define CONFIG_SYS_ONENAND_BASE CONFIG_SYS_NAND_BASE - #define CONFIG_SYS_MAX_NAND_DEVICE 1 - #define CONFIG_SYS_NAND_SELECT_DEVICE 1 /* nand driver supports mutipl.*/ --#define CONFIG_NAND_SPL_TEXT_BASE 0x80000000 - - /* -- * IPL (Initial Program Loader, integrated inside CPU) -+ * IPL (Initial Program Loader, integrated inside Ingenic Xburst JZ4740 CPU) - * Will load first 8k from NAND (SPL) into cache and execute it from there. - * - * SPL (Secondary Program Loader) -@@ -130,77 +118,88 @@ - * NUB (NAND U-Boot) - * This NAND U-Boot (NUB) is a special U-Boot version which can be started - * from RAM. Therefore it mustn't (re-)configure the SDRAM controller. -- * - */ -+ -+/* -+ * NAND SPL configuration -+ */ -+#define CONFIG_SPL -+#define CONFIG_SPL_LIBGENERIC_SUPPORT -+#define CONFIG_SPL_LIBCOMMON_SUPPORT -+#define CONFIG_SPL_NAND_LOAD -+#define CONFIG_SPL_NAND_SIMPLE -+#define CONFIG_SPL_NAND_SUPPORT -+#define CONFIG_SPL_TEXT_BASE 0x80000000 -+#define CONFIG_SPL_START_S_PATH "arch/mips/cpu/xburst/spl" -+ -+#define CONFIG_SYS_NAND_5_ADDR_CYCLE -+#define CONFIG_SYS_NAND_HW_ECC_OOBFIRST -+#define JZ4740_NANDBOOT_CFG JZ4740_NANDBOOT_B8R3 -+ - #define CONFIG_SYS_NAND_U_BOOT_DST 0x80100000 /* Load NUB to this addr */ - #define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_NAND_U_BOOT_DST --/* Start NUB from this addr*/ -+ /* Start NUB from this addr */ -+#define CONFIG_SYS_NAND_U_BOOT_OFFS (32 << 10) /* Offset of NUB */ -+#define CONFIG_SYS_NAND_U_BOOT_SIZE (256 << 10) /* Size of NUB */ - - /* -- * Define the partitioning of the NAND chip (only RAM U-Boot is needed here) -+ * Environment configuration - */ --#define CONFIG_SYS_NAND_U_BOOT_OFFS (256 << 10) /* Offset to RAM U-Boot image */ --#define CONFIG_SYS_NAND_U_BOOT_SIZE (512 << 10) /* Size of RAM U-Boot image */ -- -+#define CONFIG_ENV_OVERWRITE -+#define CONFIG_ENV_IS_IN_NAND - #define CONFIG_ENV_SIZE (4 << 10) - #define CONFIG_ENV_OFFSET \ - (CONFIG_SYS_NAND_BLOCK_SIZE + CONFIG_SYS_NAND_U_BOOT_SIZE) - #define CONFIG_ENV_OFFSET_REDUND \ - (CONFIG_ENV_OFFSET + CONFIG_SYS_NAND_BLOCK_SIZE) - --#define CONFIG_SYS_TEXT_BASE 0x80100000 --#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE -- - /* -- * SDRAM Info. -+ * CPU cache configuration - */ --#define CONFIG_NR_DRAM_BANKS 1 -+#define CONFIG_SYS_DCACHE_SIZE 16384 -+#define CONFIG_SYS_ICACHE_SIZE 16384 -+#define CONFIG_SYS_CACHELINE_SIZE 32 - - /* -- * Cache Configuration -+ * SDRAM configuration - */ --#define CONFIG_SYS_DCACHE_SIZE 16384 --#define CONFIG_SYS_ICACHE_SIZE 16384 --#define CONFIG_SYS_CACHELINE_SIZE 32 -+#define CONFIG_NR_DRAM_BANKS 1 -+ -+#define SDRAM_BW16 1 /* Data bus width: 0-32bit, 1-16bit */ -+#define SDRAM_BANK4 1 /* Banks each chip: 0-2bank, 1-4bank */ -+#define SDRAM_ROW 13 /* Row address: 11 to 13 */ -+#define SDRAM_COL 9 /* Column address: 8 to 12 */ -+#define SDRAM_CASL 2 /* CAS latency: 2 or 3 */ -+#define SDRAM_TRAS 45 /* RAS# Active Time */ -+#define SDRAM_RCD 20 /* RAS# to CAS# Delay */ -+#define SDRAM_TPC 20 /* RAS# Precharge Time */ -+#define SDRAM_TRWL 7 /* Write Latency Time */ -+#define SDRAM_TREF 15625 /* Refresh period: 8192 cycles/64ms */ - - /* -- * GPIO definition -+ * GPIO configuration - */ --#define GPIO_LCD_CS (2 * 32 + 21) --#define GPIO_AMP_EN (3 * 32 + 4) -+#define GPIO_LCD_CS (2 * 32 + 21) -+#define GPIO_AMP_EN (3 * 32 + 4) - --#define GPIO_SDPW_EN (3 * 32 + 2) --#define GPIO_SD_DETECT (3 * 32 + 0) -+#define GPIO_SDPW_EN (3 * 32 + 2) -+#define GPIO_SD_DETECT (3 * 32 + 0) - --#define GPIO_BUZZ_PWM (3 * 32 + 27) --#define GPIO_USB_DETECT (3 * 32 + 28) -+#define GPIO_BUZZ_PWM (3 * 32 + 27) -+#define GPIO_USB_DETECT (3 * 32 + 28) - --#define GPIO_AUDIO_POP (1 * 32 + 29) --#define GPIO_COB_TEST (1 * 32 + 30) -+#define GPIO_AUDIO_POP (1 * 32 + 29) -+#define GPIO_COB_TEST (1 * 32 + 30) - - #define GPIO_KEYOUT_BASE (2 * 32 + 10) --#define GPIO_KEYIN_BASE (3 * 32 + 18) --#define GPIO_KEYIN_8 (3 * 32 + 26) -+#define GPIO_KEYIN_BASE (3 * 32 + 18) -+#define GPIO_KEYIN_8 (3 * 32 + 26) - --#define GPIO_SD_CD_N GPIO_SD_DETECT /* SD Card insert detect */ -+#define GPIO_SD_CD_N GPIO_SD_DETECT /* SD Card insert detect */ - #define GPIO_SD_VCC_EN_N GPIO_SDPW_EN /* SD Card Power Enable */ - - #define SPEN GPIO_LCD_CS /* LCDCS :Serial command enable */ - #define SPDA (2 * 32 + 22) /* LCDSCL:Serial command clock input */ - #define SPCK (2 * 32 + 23) /* LCDSDA:Serial command data input */ - --/* SDRAM paramters */ --#define SDRAM_BW16 1 /* Data bus width: 0-32bit, 1-16bit */ --#define SDRAM_BANK4 1 /* Banks each chip: 0-2bank, 1-4bank */ --#define SDRAM_ROW 13 /* Row address: 11 to 13 */ --#define SDRAM_COL 9 /* Column address: 8 to 12 */ --#define SDRAM_CASL 2 /* CAS latency: 2 or 3 */ -- --/* SDRAM Timings, unit: ns */ --#define SDRAM_TRAS 45 /* RAS# Active Time */ --#define SDRAM_RCD 20 /* RAS# to CAS# Delay */ --#define SDRAM_TPC 20 /* RAS# Precharge Time */ --#define SDRAM_TRWL 7 /* Write Latency Time */ --#define SDRAM_TREF 15625 /* Refresh period: 8192 cycles/64ms */ -- - #endif --- -1.7.9.5 - diff --git a/package/boot/uboot-xburst/patches/0002-qi_lb60-add-software-usbboot-support.patch b/package/boot/uboot-xburst/patches/0002-qi_lb60-add-software-usbboot-support.patch deleted file mode 100644 index feaf297b7c5195..00000000000000 --- a/package/boot/uboot-xburst/patches/0002-qi_lb60-add-software-usbboot-support.patch +++ /dev/null @@ -1,916 +0,0 @@ -From fa51192b912d296b8eec10f7d44c6c17eb1dd368 Mon Sep 17 00:00:00 2001 -From: Xiangfu -Date: Fri, 12 Oct 2012 09:47:39 +0800 -Subject: [PATCH 2/6] qi_lb60: add software usbboot support - - JZ4740 CPU have a internal ROM have such kind of code, that make - JZ4740 can boot from USB - - usbboot.S can downloads user program from the USB port to internal - SRAM and branches to the internal SRAM to execute the program - -Signed-off-by: Xiangfu ---- - board/qi/qi_lb60/Makefile | 1 + - board/qi/qi_lb60/qi_lb60-spl.c | 20 + - board/qi/qi_lb60/usbboot.S | 838 ++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 859 insertions(+) - create mode 100644 board/qi/qi_lb60/usbboot.S - -diff --git a/board/qi/qi_lb60/Makefile b/board/qi/qi_lb60/Makefile -index e399246..6dd8c6f 100644 ---- a/board/qi/qi_lb60/Makefile -+++ b/board/qi/qi_lb60/Makefile -@@ -23,6 +23,7 @@ include $(TOPDIR)/config.mk - LIB = $(obj)lib$(BOARD).o - - ifeq ($(CONFIG_SPL_BUILD),y) -+SOBJS := usbboot.o - COBJS := $(BOARD)-spl.o - else - COBJS := $(BOARD).o -diff --git a/board/qi/qi_lb60/qi_lb60-spl.c b/board/qi/qi_lb60/qi_lb60-spl.c -index 3fe3fa3..aea459c 100644 ---- a/board/qi/qi_lb60/qi_lb60-spl.c -+++ b/board/qi/qi_lb60/qi_lb60-spl.c -@@ -12,6 +12,24 @@ - #include - #include - -+#define KEY_U_OUT (32 * 2 + 16) -+#define KEY_U_IN (32 * 3 + 19) -+ -+extern void usb_boot(void); -+ -+static void check_usb_boot(void) -+{ -+ __gpio_as_input(KEY_U_IN); -+ __gpio_enable_pull(KEY_U_IN); -+ __gpio_as_output(KEY_U_OUT); -+ __gpio_clear_pin(KEY_U_OUT); -+ -+ if (!__gpio_get_pin(KEY_U_IN)) { -+ puts("[U] pressed, goto USBBOOT mode\n"); -+ usb_boot(); -+ } -+} -+ - void nand_spl_boot(void) - { - __gpio_as_sdram_16bit_4720(); -@@ -23,6 +41,8 @@ void nand_spl_boot(void) - pll_init(); - sdram_init(); - -+ check_usb_boot(); -+ - nand_init(); - - puts("\nQi LB60 SPL: Starting U-Boot ...\n"); -diff --git a/board/qi/qi_lb60/usbboot.S b/board/qi/qi_lb60/usbboot.S -new file mode 100644 -index 0000000..c872266 ---- /dev/null -+++ b/board/qi/qi_lb60/usbboot.S -@@ -0,0 +1,838 @@ -+/* -+ * for jz4740 usb boot -+ * -+ * Copyright (c) 2009 Author: -+ * -+ * See file CREDITS for list of people who contributed to this -+ * project. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ * -+ * 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+ .set noreorder -+ .globl usb_boot -+ .text -+ -+/* -+ * Both NAND and USB boot load data to D-Cache first, then transfer -+ * data from D-Cache to I-Cache, and jump to execute the code in I-Cache. -+ * So init caches first and then dispatch to a proper boot routine. -+ */ -+ -+.macro load_addr reg addr -+ li \reg, 0x80000000 -+ addiu \reg, \reg, \addr -+ la $2, usbboot_begin -+ subu \reg, \reg, $2 -+.endm -+ -+usb_boot: -+ /* Initialize PLL: set ICLK to 84MHz and HCLK to 42MHz. */ -+ la $9, 0xB0000000 /* CPCCR: Clock Control Register */ -+ la $8, 0x42041110 /* I:S:M:P=1:2:2:2 */ -+ sw $8, 0($9) -+ -+ la $9, 0xB0000010 /* CPPCR: PLL Control Register */ -+ la $8, 0x06000120 /* M=12 N=0 D=0 CLK=12*(M+2)/(N+2) */ -+ sw $8, 0($9) -+ -+ mtc0 $0, $26 /* CP0_ERRCTL, restore WST reset state */ -+ nop -+ -+ mtc0 $0, $16 /* CP0_CONFIG */ -+ nop -+ -+ /* Relocate code to beginning of the ram */ -+ -+ la $2, usbboot_begin -+ la $3, usbboot_end -+ li $4, 0x80000000 -+ -+1: -+ lw $5, 0($2) -+ sw $5, 0($4) -+ addiu $2, $2, 4 -+ bne $2, $3, 1b -+ addiu $4, $4, 4 -+ -+ li $2, 0x80000000 -+ ori $3, $2, 0 -+ addiu $3, $3, usbboot_end -+ la $4, usbboot_begin -+ subu $3, $3, $4 -+ -+ -+2: -+ cache 0x0, 0($2) /* Index_Invalidate_I */ -+ cache 0x1, 0($2) /* Index_Writeback_Inv_D */ -+ addiu $2, $2, 32 -+ subu $4, $3, $2 -+ bgtz $4, 2b -+ nop -+ -+ load_addr $3, usb_boot_return -+ -+ jr $3 -+ -+usbboot_begin: -+ -+init_caches: -+ li $2, 3 /* cacheable for kseg0 access */ -+ mtc0 $2, $16 /* CP0_CONFIG */ -+ nop -+ -+ li $2, 0x20000000 /* enable idx-store-data cache insn */ -+ mtc0 $2, $26 /* CP0_ERRCTL */ -+ -+ ori $2, $28, 0 /* start address */ -+ ori $3, $2, 0x3fe0 /* end address, total 16KB */ -+ mtc0 $0, $28, 0 /* CP0_TAGLO */ -+ mtc0 $0, $28, 1 /* CP0_DATALO */ -+cache_clear_a_line: -+ cache 0x8, 0($2) /* Index_Store_Tag_I */ -+ cache 0x9, 0($2) /* Index_Store_Tag_D */ -+ bne $2, $3, cache_clear_a_line -+ addiu $2, $2, 32 /* increment CACHE_LINE_SIZE */ -+ -+ ori $2, $28, 0 /* start address */ -+ ori $3, $2, 0x3fe0 /* end address, total 16KB */ -+ la $4, 0x1ffff000 /* physical address and 4KB page mask */ -+cache_alloc_a_line: -+ and $5, $2, $4 -+ ori $5, $5, 1 /* V bit of the physical tag */ -+ mtc0 $5, $28, 0 /* CP0_TAGLO */ -+ cache 0x8, 0($2) /* Index_Store_Tag_I */ -+ cache 0x9, 0($2) /* Index_Store_Tag_D */ -+ bne $2, $3, cache_alloc_a_line -+ addiu $2, $2, 32 /* increment CACHE_LINE_SIZE */ -+ -+ nop -+ nop -+ nop -+ /* -+ * Transfer data from dcache to icache, then jump to icache. -+ * Input parameters: -+ * $19: data length in bytes -+ * $20: jump target address -+ */ -+xfer_d2i: -+ -+ ori $8, $20, 0 -+ addu $9, $8, $19 /* total 16KB */ -+ -+1: -+ cache 0x0, 0($8) /* Index_Invalidate_I */ -+ cache 0x1, 0($8) /* Index_Writeback_Inv_D */ -+ bne $8, $9, 1b -+ addiu $8, $8, 32 -+ -+ /* flush write-buffer */ -+ sync -+ -+ /* Invalidate BTB */ -+ mfc0 $8, $16, 7 /* CP0_CONFIG */ -+ nop -+ ori $8, 2 -+ mtc0 $8, $16, 7 -+ nop -+ -+ /* Overwrite config to disable ram initalisation */ -+ li $2, 0xff -+ sb $2, 20($20) -+ -+ jalr $20 -+ nop -+ -+icache_return: -+ /* User code can return to here after executing itself in -+ icache, by jumping to $31. */ -+ b usb_boot_return -+ nop -+ -+ -+usb_boot_return: -+ /* Enable the USB PHY */ -+ la $9, 0xB0000024 /* CPM_SCR */ -+ lw $8, 0($9) -+ ori $8, 0x40 /* USBPHY_ENABLE */ -+ sw $8, 0($9) -+ -+ /* Initialize USB registers */ -+ la $27, 0xb3040000 /* USB registers base address */ -+ -+ sb $0, 0x0b($27) /* INTRUSBE: disable common USB interrupts */ -+ sh $0, 0x06($27) /* INTRINE: disable EPIN interrutps */ -+ sh $0, 0x08($27) /* INTROUTE: disable EPOUT interrutps */ -+ -+ li $9, 0x61 -+ sb $9, 0x01($27) /* POWER: HSENAB | SUSPENDM | SOFTCONN */ -+ -+ /* Initialize USB states */ -+ li $22, 0 /* set EP0 to IDLE state */ -+ li $23, 1 /* no data stage */ -+ -+ /* Main loop of polling the usb commands */ -+usb_command_loop: -+ lbu $9, 0x0a($27) /* read INTRUSB */ -+ andi $9, 0x04 /* check USB_INTR_RESET */ -+ beqz $9, check_intr_ep0in -+ nop -+ -+ /* 1. Handle USB reset interrupt */ -+handle_reset_intr: -+ lbu $9, 0x01($27) /* read POWER */ -+ andi $9, 0x10 /* test HS_MODE */ -+ bnez $9, _usb_set_maxpktsize -+ li $9, 512 /* max packet size of HS mode */ -+ li $9, 64 /* max packet size of FS mode */ -+ -+_usb_set_maxpktsize: -+ li $8, 1 -+ sb $8, 0x0e($27) /* set INDEX 1 */ -+ -+ sh $9, 0x10($27) /* INMAXP */ -+ sb $0, 0x13($27) /* INCSRH */ -+ sh $9, 0x14($27) /* OUTMAXP */ -+ sb $0, 0x17($27) /* OUTCSRH */ -+ -+_usb_flush_fifo: -+ li $8, 0x48 /* INCSR_CDT && INCSR_FF */ -+ sb $8, 0x12($27) /* INCSR */ -+ li $8, 0x90 /* OUTCSR_CDT && OUTCSR_FF */ -+ sb $8, 0x16($27) /* OUTCSR */ -+ -+ li $22, 0 /* set EP0 to IDLE state */ -+ li $23, 1 /* no data stage */ -+ -+ /* 2. Check and handle EP0 interrupt */ -+check_intr_ep0in: -+ lhu $10, 0x02($27) /* read INTRIN */ -+ andi $9, $10, 0x1 /* check EP0 interrupt */ -+ beqz $9, check_intr_ep1in -+ nop -+ -+handle_ep0_intr: -+ sb $0, 0x0e($27) /* set INDEX 0 */ -+ lbu $11, 0x12($27) /* read CSR0 */ -+ -+ andi $9, $11, 0x04 /* check SENTSTALL */ -+ beqz $9, _ep0_setupend -+ nop -+ -+_ep0_sentstall: -+ andi $9, $11, 0xdb -+ sb $9, 0x12($27) /* clear SENDSTALL and SENTSTALL */ -+ li $22, 0 /* set EP0 to IDLE state */ -+ -+_ep0_setupend: -+ andi $9, $11, 0x10 /* check SETUPEND */ -+ beqz $9, ep0_idle_state -+ nop -+ -+ ori $9, $11, 0x80 -+ sb $9, 0x12($27) /* set SVDSETUPEND */ -+ li $22, 0 /* set EP0 to IDLE state */ -+ -+ep0_idle_state: -+ bnez $22, ep0_tx_state -+ nop -+ -+ /* 2.1 Handle EP0 IDLE state interrupt */ -+ andi $9, $11, 0x01 /* check OUTPKTRDY */ -+ beqz $9, check_intr_ep1in -+ nop -+ -+ /* Read 8-bytes setup packet from the FIFO */ -+ lw $25, 0x20($27) /* first word of setup packet */ -+ lw $26, 0x20($27) /* second word of setup packet */ -+ -+ andi $9, $25, 0x60 /* bRequestType & USB_TYPE_MASK */ -+ beqz $9, _ep0_std_req -+ nop -+ -+ /* 2.1.1 Vendor-specific setup request */ -+_ep0_vend_req: -+ li $22, 0 /* set EP0 to IDLE state */ -+ li $23, 1 /* NoData = 1 */ -+ -+ andi $9, $25, 0xff00 /* check bRequest */ -+ srl $9, $9, 8 -+ beqz $9, __ep0_get_cpu_info -+ sub $8, $9, 0x1 -+ beqz $8, __ep0_set_data_address -+ sub $8, $9, 0x2 -+ beqz $8, __ep0_set_data_length -+ sub $8, $9, 0x3 -+ beqz $8, __ep0_flush_caches -+ sub $8, $9, 0x4 -+ beqz $8, __ep0_prog_start1 -+ sub $8, $9, 0x5 -+ beqz $8, __ep0_prog_start2 -+ nop -+ b _ep0_idle_state_fini /* invalid request */ -+ nop -+ -+__ep0_get_cpu_info: -+ load_addr $20, cpu_info_data /* data pointer to transfer */ -+ li $21, 8 /* bytes left to transfer */ -+ li $22, 1 /* set EP0 to TX state */ -+ li $23, 0 /* NoData = 0 */ -+ -+ b _ep0_idle_state_fini -+ nop -+ -+__ep0_set_data_address: -+ li $9, 0xffff0000 -+ and $9, $25, $9 -+ andi $8, $26, 0xffff -+ or $20, $9, $8 /* data address of next transfer */ -+ -+ b _ep0_idle_state_fini -+ nop -+ -+__ep0_set_data_length: -+ li $9, 0xffff0000 -+ and $9, $25, $9 -+ andi $8, $26, 0xffff -+ or $21, $9, $8 /* data length of next transfer */ -+ -+ li $9, 0x48 /* SVDOUTPKTRDY and DATAEND */ -+ sb $9, 0x12($27) /* CSR0 */ -+ -+ /* We must write packet to FIFO before EP1-IN interrupt here. */ -+ b handle_epin1_intr -+ nop -+ -+__ep0_flush_caches: -+ /* Flush dcache and invalidate icache. */ -+ li $8, 0x80000000 -+ addi $9, $8, 0x3fe0 /* total 16KB */ -+ -+1: -+ cache 0x0, 0($8) /* Index_Invalidate_I */ -+ cache 0x1, 0($8) /* Index_Writeback_Inv_D */ -+ bne $8, $9, 1b -+ addiu $8, $8, 32 -+ -+ /* flush write-buffer */ -+ sync -+ -+ /* Invalidate BTB */ -+ mfc0 $8, $16, 7 /* CP0_CONFIG */ -+ nop -+ ori $8, 2 -+ mtc0 $8, $16, 7 -+ nop -+ -+ b _ep0_idle_state_fini -+ nop -+ -+__ep0_prog_start1: -+ li $9, 0x48 /* SVDOUTPKTRDY and DATAEND */ -+ sb $9, 0x12($27) /* CSR0 */ -+ -+ li $9, 0xffff0000 -+ and $9, $25, $9 -+ andi $8, $26, 0xffff -+ or $20, $9, $8 /* target address */ -+ -+ b xfer_d2i -+ li $19, 0x2000 /* 16KB data length */ -+ -+__ep0_prog_start2: -+ li $9, 0x48 /* SVDOUTPKTRDY and DATAEND */ -+ sb $9, 0x12($27) /* CSR0 */ -+ -+ li $9, 0xffff0000 -+ and $9, $25, $9 -+ andi $8, $26, 0xffff -+ or $20, $9, $8 /* target address */ -+ -+ jalr $20 /* jump, and place the return address in $31 */ -+ nop -+ -+__ep0_prog_start2_return: -+/* User code can return to here after executing itself, by jumping to $31 */ -+ b usb_boot_return -+ nop -+ -+ /* 2.1.2 Standard setup request */ -+_ep0_std_req: -+ andi $12, $25, 0xff00 /* check bRequest */ -+ srl $12, $12, 8 -+ sub $9, $12, 0x05 /* check USB_REQ_SET_ADDRESS */ -+ bnez $9, __ep0_req_set_config -+ nop -+ -+ /* Handle USB_REQ_SET_ADDRESS */ -+__ep0_req_set_addr: -+ srl $9, $25, 16 /* get wValue */ -+ sb $9, 0x0($27) /* set FADDR */ -+ li $23, 1 /* NoData = 1 */ -+ b _ep0_idle_state_fini -+ nop -+ -+__ep0_req_set_config: -+ sub $9, $12, 0x09 /* check USB_REQ_SET_CONFIGURATION */ -+ bnez $9, __ep0_req_get_desc -+ nop -+ -+ /* Handle USB_REQ_SET_CONFIGURATION */ -+ li $23, 1 /* NoData = 1 */ -+ b _ep0_idle_state_fini -+ nop -+ -+__ep0_req_get_desc: -+ sub $9, $12, 0x06 /* check USB_REQ_GET_DESCRIPTOR */ -+ bnez $9, _ep0_idle_state_fini -+ li $23, 1 /* NoData = 1 */ -+ -+ /* Handle USB_REQ_GET_DESCRIPTOR */ -+ li $23, 0 /* NoData = 0 */ -+ -+ srl $9, $25, 24 /* wValue >> 8 */ -+ sub $8, $9, 0x01 /* check USB_DT_DEVICE */ -+ beqz $8, ___ep0_get_dev_desc -+ srl $21, $26, 16 /* get wLength */ -+ sub $8, $9, 0x02 /* check USB_DT_CONFIG */ -+ beqz $8, ___ep0_get_conf_desc -+ sub $8, $9, 0x03 /* check USB_DT_STRING */ -+ beqz $8, ___ep0_get_string_desc -+ sub $8, $9, 0x06 /* check USB_DT_DEVICE_QUALIFIER */ -+ beqz $8, ___ep0_get_dev_qualifier -+ nop -+ b _ep0_idle_state_fini -+ nop -+ -+___ep0_get_dev_desc: -+ load_addr $20, device_desc /* data pointer */ -+ li $22, 1 /* set EP0 to TX state */ -+ sub $8, $21, 18 -+ blez $8, _ep0_idle_state_fini /* wLength <= 18 */ -+ nop -+ li $21, 18 /* max length of device_desc */ -+ b _ep0_idle_state_fini -+ nop -+ -+___ep0_get_dev_qualifier: -+ load_addr $20, dev_qualifier /* data pointer */ -+ li $22, 1 /* set EP0 to TX state */ -+ sub $8, $21, 10 -+ blez $8, _ep0_idle_state_fini /* wLength <= 10 */ -+ nop -+ li $21, 10 /* max length of dev_qualifier */ -+ b _ep0_idle_state_fini -+ nop -+ -+___ep0_get_conf_desc: -+ load_addr $20, config_desc_fs /* data pointer of FS mode */ -+ lbu $8, 0x01($27) /* read POWER */ -+ andi $8, 0x10 /* test HS_MODE */ -+ beqz $8, ___ep0_get_conf_desc2 -+ nop -+ load_addr $20, config_desc_hs /* data pointer of HS mode */ -+ -+___ep0_get_conf_desc2: -+ li $22, 1 /* set EP0 to TX state */ -+ sub $8, $21, 32 -+ blez $8, _ep0_idle_state_fini /* wLength <= 32 */ -+ nop -+ li $21, 32 /* max length of config_desc */ -+ b _ep0_idle_state_fini -+ nop -+ -+___ep0_get_string_desc: -+ li $22, 1 /* set EP0 to TX state */ -+ -+ srl $9, $25, 16 /* wValue & 0xff */ -+ andi $9, 0xff -+ -+ sub $8, $9, 1 -+ beqz $8, ___ep0_get_string_manufacture -+ sub $8, $9, 2 -+ beqz $8, ___ep0_get_string_product -+ nop -+ -+___ep0_get_string_lang_ids: -+ load_addr $20, string_lang_ids /* data pointer */ -+ b _ep0_idle_state_fini -+ li $21, 4 /* data length */ -+ -+___ep0_get_string_manufacture: -+ load_addr $20, string_manufacture /* data pointer */ -+ b _ep0_idle_state_fini -+ li $21, 16 /* data length */ -+ -+___ep0_get_string_product: -+ load_addr $20, string_product /* data pointer */ -+ b _ep0_idle_state_fini -+ li $21, 46 /* data length */ -+ -+_ep0_idle_state_fini: -+ li $9, 0x40 /* SVDOUTPKTRDY */ -+ beqz $23, _ep0_idle_state_fini2 -+ nop -+ ori $9, $9, 0x08 /* DATAEND */ -+_ep0_idle_state_fini2: -+ sb $9, 0x12($27) /* CSR0 */ -+ beqz $22, check_intr_ep1in -+ nop -+ -+ /* 2.2 Handle EP0 TX state interrupt */ -+ep0_tx_state: -+ sub $9, $22, 1 -+ bnez $9, check_intr_ep1in -+ nop -+ -+ sub $9, $21, 64 /* max packetsize */ -+ blez $9, _ep0_tx_state2 /* data count <= 64 */ -+ ori $19, $21, 0 -+ li $19, 64 -+ -+_ep0_tx_state2: -+ beqz $19, _ep0_tx_state3 /* send ZLP */ -+ ori $18, $19, 0 /* record bytes to be transferred */ -+ sub $21, $21, $19 /* decrement data count */ -+ -+_ep0_fifo_write_loop: -+ lbu $9, 0($20) /* read data */ -+ sb $9, 0x20($27) /* load FIFO */ -+ sub $19, $19, 1 /* decrement counter */ -+ bnez $19, _ep0_fifo_write_loop -+ addi $20, $20, 1 /* increment data pointer */ -+ -+ sub $9, $18, 64 /* max packetsize */ -+ beqz $9, _ep0_tx_state4 -+ nop -+ -+_ep0_tx_state3: -+ /* transferred bytes < max packetsize */ -+ li $9, 0x0a /* set INPKTRDY and DATAEND */ -+ sb $9, 0x12($27) /* CSR0 */ -+ li $22, 0 /* set EP0 to IDLE state */ -+ b check_intr_ep1in -+ nop -+ -+_ep0_tx_state4: -+ /* transferred bytes == max packetsize */ -+ li $9, 0x02 /* set INPKTRDY */ -+ sb $9, 0x12($27) /* CSR0 */ -+ b check_intr_ep1in -+ nop -+ -+ /* 3. Check and handle EP1 BULK-IN interrupt */ -+check_intr_ep1in: -+ andi $9, $10, 0x2 /* check EP1 IN interrupt */ -+ beqz $9, check_intr_ep1out -+ nop -+ -+handle_epin1_intr: -+ li $9, 1 -+ sb $9, 0x0e($27) /* set INDEX 1 */ -+ lbu $9, 0x12($27) /* read INCSR */ -+ -+ andi $8, $9, 0x2 /* check INCSR_FFNOTEMPT */ -+ bnez $8, _epin1_tx_state4 -+ nop -+ -+_epin1_write_fifo: -+ lhu $9, 0x10($27) /* get INMAXP */ -+ sub $8, $21, $9 -+ blez $8, _epin1_tx_state1 /* bytes left <= INMAXP */ -+ ori $19, $21, 0 -+ ori $19, $9, 0 -+ -+_epin1_tx_state1: -+ beqz $19, _epin1_tx_state4 /* No data */ -+ nop -+ -+ sub $21, $21, $19 /* decrement data count */ -+ -+ srl $5, $19, 2 /* # of word */ -+ andi $6, $19, 0x3 /* # of byte */ -+ beqz $5, _epin1_tx_state2 -+ nop -+ -+_epin1_fifo_write_word: -+ lw $9, 0($20) /* read data from source address */ -+ sw $9, 0x24($27) /* write FIFO */ -+ sub $5, $5, 1 /* decrement counter */ -+ bnez $5, _epin1_fifo_write_word -+ addiu $20, $20, 4 /* increment dest address */ -+ -+_epin1_tx_state2: -+ beqz $6, _epin1_tx_state3 -+ nop -+ -+_epin1_fifo_write_byte: -+ lbu $9, 0($20) /* read data from source address */ -+ sb $9, 0x24($27) /* write FIFO */ -+ sub $6, $6, 1 /* decrement counter */ -+ bnez $6, _epin1_fifo_write_byte -+ addiu $20, $20, 1 /* increment dest address */ -+ -+_epin1_tx_state3: -+ li $9, 0x1 -+ sb $9, 0x12($27) /* INCSR, set INPKTRDY */ -+ -+_epin1_tx_state4: -+ /* 4. Check and handle EP1 BULK-OUT interrupt */ -+check_intr_ep1out: -+ lhu $9, 0x04($27) /* read INTROUT */ -+ andi $9, 0x2 -+ beqz $9, check_status_next -+ nop -+ -+handle_epout1_intr: -+ li $9, 1 -+ sb $9, 0x0e($27) /* set INDEX 1 */ -+ -+ lbu $9, 0x16($27) /* read OUTCSR */ -+ andi $9, 0x1 /* check OUTPKTRDY */ -+ beqz $9, check_status_next -+ nop -+ -+_epout1_read_fifo: -+ lhu $19, 0x18($27) /* read OUTCOUNT */ -+ srl $5, $19, 2 /* # of word */ -+ andi $6, $19, 0x3 /* # of byte */ -+ beqz $5, _epout1_rx_state1 -+ nop -+ -+_epout1_fifo_read_word: -+ lw $9, 0x24($27) /* read FIFO */ -+ sw $9, 0($20) /* store to dest address */ -+ sub $5, $5, 1 /* decrement counter */ -+ bnez $5, _epout1_fifo_read_word -+ addiu $20, $20, 4 /* increment dest address */ -+ -+_epout1_rx_state1: -+ beqz $6, _epout1_rx_state2 -+ nop -+ -+_epout1_fifo_read_byte: -+ lbu $9, 0x24($27) /* read FIFO */ -+ sb $9, 0($20) /* store to dest address */ -+ sub $6, $6, 1 /* decrement counter */ -+ bnez $6, _epout1_fifo_read_byte -+ addiu $20, $20, 1 /* increment dest address */ -+ -+_epout1_rx_state2: -+ sb $0, 0x16($27) /* clear OUTPKTRDY */ -+ -+check_status_next: -+ b usb_command_loop -+ nop -+ -+/* Device/Configuration/Interface/Endpoint/String Descriptors */ -+ -+ .align 2 -+device_desc: -+ .byte 0x12 /* bLength */ -+ .byte 0x01 /* bDescriptorType */ -+ .byte 0x00 /* bcdUSB */ -+ .byte 0x02 /* bcdUSB */ -+ .byte 0x00 /* bDeviceClass */ -+ .byte 0x00 /* bDeviceSubClass */ -+ .byte 0x00 /* bDeviceProtocol */ -+ .byte 0x40 /* bMaxPacketSize0 */ -+ .byte 0x1a /* idVendor */ -+ .byte 0x60 /* idVendor */ -+ .byte 0x40 /* idProduct */ -+ .byte 0x47 /* idProduct */ -+ .byte 0x00 /* bcdDevice */ -+ .byte 0x01 /* bcdDevice */ -+ .byte 0x01 /* iManufacturer */ -+ .byte 0x02 /* iProduct */ -+ .byte 0x00 /* iSerialNumber */ -+ .byte 0x01 /* bNumConfigurations */ -+ -+ .align 2 -+dev_qualifier: -+ .byte 0x0a /* bLength */ -+ .byte 0x06 /* bDescriptorType */ -+ .byte 0x00 /* bcdUSB */ -+ .byte 0x02 /* bcdUSB */ -+ .byte 0x00 /* bDeviceClass */ -+ .byte 0x00 /* bDeviceSubClass */ -+ .byte 0x00 /* bDeviceProtocol */ -+ .byte 0x40 /* bMaxPacketSize0 */ -+ .byte 0x01 /* bNumConfigurations */ -+ .byte 0x00 /* bRESERVED */ -+ -+ .align 2 -+config_desc_hs: -+ .byte 0x09 /* bLength */ -+ .byte 0x02 /* bDescriptorType */ -+ .byte 0x20 /* wTotalLength */ -+ .byte 0x00 /* wTotalLength */ -+ .byte 0x01 /* bNumInterfaces */ -+ .byte 0x01 /* bConfigurationValue */ -+ .byte 0x00 /* iConfiguration */ -+ .byte 0xc0 /* bmAttributes */ -+ .byte 0x01 /* MaxPower */ -+intf_desc_hs: -+ .byte 0x09 /* bLength */ -+ .byte 0x04 /* bDescriptorType */ -+ .byte 0x00 /* bInterfaceNumber */ -+ .byte 0x00 /* bAlternateSetting */ -+ .byte 0x02 /* bNumEndpoints */ -+ .byte 0xff /* bInterfaceClass */ -+ .byte 0x00 /* bInterfaceSubClass */ -+ .byte 0x50 /* bInterfaceProtocol */ -+ .byte 0x00 /* iInterface */ -+ep1_desc_hs: -+ .byte 0x07 /* bLength */ -+ .byte 0x05 /* bDescriptorType */ -+ .byte 0x01 /* bEndpointAddress */ -+ .byte 0x02 /* bmAttributes */ -+ .byte 0x00 /* wMaxPacketSize */ -+ .byte 0x02 /* wMaxPacketSize */ -+ .byte 0x00 /* bInterval */ -+ep2_desc_hs: -+ .byte 0x07 /* bLength */ -+ .byte 0x05 /* bDescriptorType */ -+ .byte 0x81 /* bEndpointAddress */ -+ .byte 0x02 /* bmAttributes */ -+ .byte 0x00 /* wMaxPacketSize */ -+ .byte 0x02 /* wMaxPacketSize */ -+ .byte 0x00 /* bInterval */ -+ -+ .align 2 -+config_desc_fs: -+ .byte 0x09 /* bLength */ -+ .byte 0x02 /* bDescriptorType */ -+ .byte 0x20 /* wTotalLength */ -+ .byte 0x00 /* wTotalLength */ -+ .byte 0x01 /* bNumInterfaces */ -+ .byte 0x01 /* bConfigurationValue */ -+ .byte 0x00 /* iConfiguration */ -+ .byte 0xc0 /* bmAttributes */ -+ .byte 0x01 /* MaxPower */ -+intf_desc_fs: -+ .byte 0x09 /* bLength */ -+ .byte 0x04 /* bDescriptorType */ -+ .byte 0x00 /* bInterfaceNumber */ -+ .byte 0x00 /* bAlternateSetting */ -+ .byte 0x02 /* bNumEndpoints */ -+ .byte 0xff /* bInterfaceClass */ -+ .byte 0x00 /* bInterfaceSubClass */ -+ .byte 0x50 /* bInterfaceProtocol */ -+ .byte 0x00 /* iInterface */ -+ep1_desc_fs: -+ .byte 0x07 /* bLength */ -+ .byte 0x05 /* bDescriptorType */ -+ .byte 0x01 /* bEndpointAddress */ -+ .byte 0x02 /* bmAttributes */ -+ .byte 0x40 /* wMaxPacketSize */ -+ .byte 0x00 /* wMaxPacketSize */ -+ .byte 0x00 /* bInterval */ -+ep2_desc_fs: -+ .byte 0x07 /* bLength */ -+ .byte 0x05 /* bDescriptorType */ -+ .byte 0x81 /* bEndpointAddress */ -+ .byte 0x02 /* bmAttributes */ -+ .byte 0x40 /* wMaxPacketSize */ -+ .byte 0x00 /* wMaxPacketSize */ -+ .byte 0x00 /* bInterval */ -+ -+ .align 2 -+string_lang_ids: -+ .byte 0x04 -+ .byte 0x03 -+ .byte 0x09 -+ .byte 0x04 -+ -+ .align 2 -+string_manufacture: -+ .byte 0x10 -+ .byte 0x03 -+ .byte 0x49 -+ .byte 0x00 -+ .byte 0x6e -+ .byte 0x00 -+ .byte 0x67 -+ .byte 0x00 -+ .byte 0x65 -+ .byte 0x00 -+ .byte 0x6e -+ .byte 0x00 -+ .byte 0x69 -+ .byte 0x00 -+ .byte 0x63 -+ .byte 0x00 -+ -+ .align 2 -+string_product: -+ .byte 0x2e -+ .byte 0x03 -+ .byte 0x4a -+ .byte 0x00 -+ .byte 0x5a -+ .byte 0x00 -+ .byte 0x34 -+ .byte 0x00 -+ .byte 0x37 -+ .byte 0x00 -+ .byte 0x34 -+ .byte 0x00 -+ .byte 0x30 -+ .byte 0x00 -+ .byte 0x20 -+ .byte 0x00 -+ .byte 0x55 -+ .byte 0x00 -+ .byte 0x53 -+ .byte 0x00 -+ .byte 0x42 -+ .byte 0x00 -+ .byte 0x20 -+ .byte 0x00 -+ .byte 0x42 -+ .byte 0x00 -+ .byte 0x6f -+ .byte 0x00 -+ .byte 0x6f -+ .byte 0x00 -+ .byte 0x74 -+ .byte 0x00 -+ .byte 0x20 -+ .byte 0x00 -+ .byte 0x44 -+ .byte 0x00 -+ .byte 0x65 -+ .byte 0x00 -+ .byte 0x76 -+ .byte 0x00 -+ .byte 0x69 -+ .byte 0x00 -+ .byte 0x63 -+ .byte 0x00 -+ .byte 0x65 -+ .byte 0x00 -+ -+ .align 2 -+cpu_info_data: -+ .byte 0x4a -+ .byte 0x5a -+ .byte 0x34 -+ .byte 0x37 -+ .byte 0x34 -+ .byte 0x30 -+ .byte 0x56 -+ .byte 0x31 -+usbboot_end: -+ -+ .set reorder --- -1.7.9.5 - diff --git a/package/boot/uboot-xburst/patches/0003-add-mmc-support.patch b/package/boot/uboot-xburst/patches/0003-add-mmc-support.patch deleted file mode 100644 index e9baa7c373b9cc..00000000000000 --- a/package/boot/uboot-xburst/patches/0003-add-mmc-support.patch +++ /dev/null @@ -1,1664 +0,0 @@ -From bd36739e77669e8df45c38f6acfe2cea511534d9 Mon Sep 17 00:00:00 2001 -From: Xiangfu -Date: Wed, 10 Oct 2012 18:19:41 +0800 -Subject: [PATCH 3/6] add mmc support - ---- - arch/mips/include/asm/jz4740.h | 166 ++++++ - board/qi/qi_lb60/qi_lb60.c | 9 +- - drivers/mmc/Makefile | 1 + - drivers/mmc/jz_mmc.c | 1179 ++++++++++++++++++++++++++++++++++++++++ - drivers/mmc/jz_mmc.h | 176 ++++++ - include/configs/qi_lb60.h | 9 + - include/mmc.h | 40 ++ - 7 files changed, 1578 insertions(+), 2 deletions(-) - create mode 100644 drivers/mmc/jz_mmc.c - create mode 100644 drivers/mmc/jz_mmc.h - -diff --git a/arch/mips/include/asm/jz4740.h b/arch/mips/include/asm/jz4740.h -index 7a7cfff..68287fb 100644 ---- a/arch/mips/include/asm/jz4740.h -+++ b/arch/mips/include/asm/jz4740.h -@@ -1146,5 +1146,171 @@ extern void sdram_init(void); - extern void calc_clocks(void); - extern void rtc_init(void); - -+/************************************************************************* -+ * MSC -+ *************************************************************************/ -+#define REG8(addr) *((volatile u8 *)(addr)) -+#define REG16(addr) *((volatile u16 *)(addr)) -+#define REG32(addr) *((volatile u32 *)(addr)) -+ -+#define CPM_BASE 0xB0000000 -+#define CPM_CPCCR (CPM_BASE+0x00) -+#define CPM_MSCCDR (CPM_BASE+0x68) -+#define REG_CPM_MSCCDR REG32(CPM_MSCCDR) -+#define REG_CPM_CPCCR REG32(CPM_CPCCR) -+ -+#define MSC_BASE 0xB0021000 -+ -+#define MSC_STRPCL (MSC_BASE + 0x000) -+#define MSC_STAT (MSC_BASE + 0x004) -+#define MSC_CLKRT (MSC_BASE + 0x008) -+#define MSC_CMDAT (MSC_BASE + 0x00C) -+#define MSC_RESTO (MSC_BASE + 0x010) -+#define MSC_RDTO (MSC_BASE + 0x014) -+#define MSC_BLKLEN (MSC_BASE + 0x018) -+#define MSC_NOB (MSC_BASE + 0x01C) -+#define MSC_SNOB (MSC_BASE + 0x020) -+#define MSC_IMASK (MSC_BASE + 0x024) -+#define MSC_IREG (MSC_BASE + 0x028) -+#define MSC_CMD (MSC_BASE + 0x02C) -+#define MSC_ARG (MSC_BASE + 0x030) -+#define MSC_RES (MSC_BASE + 0x034) -+#define MSC_RXFIFO (MSC_BASE + 0x038) -+#define MSC_TXFIFO (MSC_BASE + 0x03C) -+ -+#define REG_MSC_STRPCL REG16(MSC_STRPCL) -+#define REG_MSC_STAT REG32(MSC_STAT) -+#define REG_MSC_CLKRT REG16(MSC_CLKRT) -+#define REG_MSC_CMDAT REG32(MSC_CMDAT) -+#define REG_MSC_RESTO REG16(MSC_RESTO) -+#define REG_MSC_RDTO REG16(MSC_RDTO) -+#define REG_MSC_BLKLEN REG16(MSC_BLKLEN) -+#define REG_MSC_NOB REG16(MSC_NOB) -+#define REG_MSC_SNOB REG16(MSC_SNOB) -+#define REG_MSC_IMASK REG16(MSC_IMASK) -+#define REG_MSC_IREG REG16(MSC_IREG) -+#define REG_MSC_CMD REG8(MSC_CMD) -+#define REG_MSC_ARG REG32(MSC_ARG) -+#define REG_MSC_RES REG16(MSC_RES) -+#define REG_MSC_RXFIFO REG32(MSC_RXFIFO) -+#define REG_MSC_TXFIFO REG32(MSC_TXFIFO) -+ -+/* MSC Clock and Control Register (MSC_STRPCL) */ -+ -+#define MSC_STRPCL_EXIT_MULTIPLE (1 << 7) -+#define MSC_STRPCL_EXIT_TRANSFER (1 << 6) -+#define MSC_STRPCL_START_READWAIT (1 << 5) -+#define MSC_STRPCL_STOP_READWAIT (1 << 4) -+#define MSC_STRPCL_RESET (1 << 3) -+#define MSC_STRPCL_START_OP (1 << 2) -+#define MSC_STRPCL_CLOCK_CONTROL_BIT 0 -+#define MSC_STRPCL_CLOCK_CONTROL_MASK (0x3 << MSC_STRPCL_CLOCK_CONTROL_BIT) -+ #define MSC_STRPCL_CLOCK_CONTROL_STOP (0x1 << MSC_STRPCL_CLOCK_CONTROL_BIT) /* Stop MMC/SD clock */ -+ #define MSC_STRPCL_CLOCK_CONTROL_START (0x2 << MSC_STRPCL_CLOCK_CONTROL_BIT) /* Start MMC/SD clock */ -+ -+/* MSC Status Register (MSC_STAT) */ -+ -+#define MSC_STAT_IS_RESETTING (1 << 15) -+#define MSC_STAT_SDIO_INT_ACTIVE (1 << 14) -+#define MSC_STAT_PRG_DONE (1 << 13) -+#define MSC_STAT_DATA_TRAN_DONE (1 << 12) -+#define MSC_STAT_END_CMD_RES (1 << 11) -+#define MSC_STAT_DATA_FIFO_AFULL (1 << 10) -+#define MSC_STAT_IS_READWAIT (1 << 9) -+#define MSC_STAT_CLK_EN (1 << 8) -+#define MSC_STAT_DATA_FIFO_FULL (1 << 7) -+#define MSC_STAT_DATA_FIFO_EMPTY (1 << 6) -+#define MSC_STAT_CRC_RES_ERR (1 << 5) -+#define MSC_STAT_CRC_READ_ERROR (1 << 4) -+#define MSC_STAT_CRC_WRITE_ERROR_BIT 2 -+#define MSC_STAT_CRC_WRITE_ERROR_MASK (0x3 << MSC_STAT_CRC_WRITE_ERROR_BIT) -+ #define MSC_STAT_CRC_WRITE_ERROR_NO (0 << MSC_STAT_CRC_WRITE_ERROR_BIT) /* No error on transmission of data */ -+ #define MSC_STAT_CRC_WRITE_ERROR (1 << MSC_STAT_CRC_WRITE_ERROR_BIT) /* Card observed erroneous transmission of data */ -+ #define MSC_STAT_CRC_WRITE_ERROR_NOSTS (2 << MSC_STAT_CRC_WRITE_ERROR_BIT) /* No CRC status is sent back */ -+#define MSC_STAT_TIME_OUT_RES (1 << 1) -+#define MSC_STAT_TIME_OUT_READ (1 << 0) -+ -+/* MSC Bus Clock Control Register (MSC_CLKRT) */ -+ -+#define MSC_CLKRT_CLK_RATE_BIT 0 -+#define MSC_CLKRT_CLK_RATE_MASK (0x7 << MSC_CLKRT_CLK_RATE_BIT) -+ #define MSC_CLKRT_CLK_RATE_DIV_1 (0x0 << MSC_CLKRT_CLK_RATE_BIT) /* CLK_SRC */ -+ #define MSC_CLKRT_CLK_RATE_DIV_2 (0x1 << MSC_CLKRT_CLK_RATE_BIT) /* 1/2 of CLK_SRC */ -+ #define MSC_CLKRT_CLK_RATE_DIV_4 (0x2 << MSC_CLKRT_CLK_RATE_BIT) /* 1/4 of CLK_SRC */ -+ #define MSC_CLKRT_CLK_RATE_DIV_8 (0x3 << MSC_CLKRT_CLK_RATE_BIT) /* 1/8 of CLK_SRC */ -+ #define MSC_CLKRT_CLK_RATE_DIV_16 (0x4 << MSC_CLKRT_CLK_RATE_BIT) /* 1/16 of CLK_SRC */ -+ #define MSC_CLKRT_CLK_RATE_DIV_32 (0x5 << MSC_CLKRT_CLK_RATE_BIT) /* 1/32 of CLK_SRC */ -+ #define MSC_CLKRT_CLK_RATE_DIV_64 (0x6 << MSC_CLKRT_CLK_RATE_BIT) /* 1/64 of CLK_SRC */ -+ #define MSC_CLKRT_CLK_RATE_DIV_128 (0x7 << MSC_CLKRT_CLK_RATE_BIT) /* 1/128 of CLK_SRC */ -+ -+/* MSC Command Sequence Control Register (MSC_CMDAT) */ -+ -+#define MSC_CMDAT_IO_ABORT (1 << 11) -+#define MSC_CMDAT_BUS_WIDTH_BIT 9 -+#define MSC_CMDAT_BUS_WIDTH_MASK (0x3 << MSC_CMDAT_BUS_WIDTH_BIT) -+#define MSC_CMDAT_BUS_WIDTH_1BIT (0x0 << MSC_CMDAT_BUS_WIDTH_BIT) -+#define MSC_CMDAT_BUS_WIDTH_4BIT (0x2 << MSC_CMDAT_BUS_WIDTH_BIT) -+#define MSC_CMDAT_DMA_EN (1 << 8) -+#define MSC_CMDAT_INIT (1 << 7) -+#define MSC_CMDAT_BUSY (1 << 6) -+#define MSC_CMDAT_STREAM_BLOCK (1 << 5) -+#define MSC_CMDAT_WRITE (1 << 4) -+#define MSC_CMDAT_READ (0 << 4) -+#define MSC_CMDAT_DATA_EN (1 << 3) -+#define MSC_CMDAT_RESPONSE_BIT 0 -+#define MSC_CMDAT_RESPONSE_MASK (0x7 << MSC_CMDAT_RESPONSE_BIT) -+#define MSC_CMDAT_RESPONSE_NONE (0x0 << MSC_CMDAT_RESPONSE_BIT) -+#define MSC_CMDAT_RESPONSE_R1 (0x1 << MSC_CMDAT_RESPONSE_BIT) -+#define MSC_CMDAT_RESPONSE_R2 (0x2 << MSC_CMDAT_RESPONSE_BIT) -+#define MSC_CMDAT_RESPONSE_R3 (0x3 << MSC_CMDAT_RESPONSE_BIT) -+#define MSC_CMDAT_RESPONSE_R4 (0x4 << MSC_CMDAT_RESPONSE_BIT) -+#define MSC_CMDAT_RESPONSE_R5 (0x5 << MSC_CMDAT_RESPONSE_BIT) -+#define MSC_CMDAT_RESPONSE_R6 (0x6 << MSC_CMDAT_RESPONSE_BIT) -+ -+/* MSC Interrupts Mask Register (MSC_IMASK) */ -+#define MSC_IMASK_SDIO (1 << 7) -+#define MSC_IMASK_TXFIFO_WR_REQ (1 << 6) -+#define MSC_IMASK_RXFIFO_RD_REQ (1 << 5) -+#define MSC_IMASK_END_CMD_RES (1 << 2) -+#define MSC_IMASK_PRG_DONE (1 << 1) -+#define MSC_IMASK_DATA_TRAN_DONE (1 << 0) -+ -+ -+/* MSC Interrupts Status Register (MSC_IREG) */ -+#define MSC_IREG_SDIO (1 << 7) -+#define MSC_IREG_TXFIFO_WR_REQ (1 << 6) -+#define MSC_IREG_RXFIFO_RD_REQ (1 << 5) -+#define MSC_IREG_END_CMD_RES (1 << 2) -+#define MSC_IREG_PRG_DONE (1 << 1) -+#define MSC_IREG_DATA_TRAN_DONE (1 << 0) -+ -+static __inline__ unsigned int __cpm_get_pllout2(void) -+{ -+ if (REG_CPM_CPCCR & CPM_CPCCR_PCS) -+ return __cpm_get_pllout(); -+ else -+ return __cpm_get_pllout()/2; -+} -+ -+static inline void __cpm_select_msc_clk(int sd) -+{ -+ unsigned int pllout2 = __cpm_get_pllout2(); -+ unsigned int div = 0; -+ -+ if (sd) { -+ div = pllout2 / 24000000; -+ } -+ else { -+ div = pllout2 / 16000000; -+ } -+ -+ REG_CPM_MSCCDR = div - 1; -+} -+#define __msc_reset() \ -+do { \ -+ REG_MSC_STRPCL = MSC_STRPCL_RESET; \ -+ while (REG_MSC_STAT & MSC_STAT_IS_RESETTING); \ -+} while (0) -+ - #endif /* !__ASSEMBLY__ */ - #endif /* __JZ4740_H__ */ -diff --git a/board/qi/qi_lb60/qi_lb60.c b/board/qi/qi_lb60/qi_lb60.c -index 3bd4e2f..a2ba648 100644 ---- a/board/qi/qi_lb60/qi_lb60.c -+++ b/board/qi/qi_lb60/qi_lb60.c -@@ -40,8 +40,13 @@ static void gpio_init(void) - __gpio_clear_pin(GPIO_KEYOUT_BASE + i); - } - -- __gpio_as_input(GPIO_KEYIN_8); -- __gpio_enable_pull(GPIO_KEYIN_8); -+ if (__gpio_get_pin(GPIO_KEYIN_BASE + 2) == 0){ -+ printf("[S] pressed, enable UART0\n"); -+ __gpio_as_uart0(); -+ } else { -+ __gpio_as_input(GPIO_KEYIN_8); -+ __gpio_enable_pull(GPIO_KEYIN_8); -+ } - - /* enable the TP4, TP5 as UART0 */ - __gpio_jtag_to_uart0(); -diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile -index 565ba6a..3c717b1 100644 ---- a/drivers/mmc/Makefile -+++ b/drivers/mmc/Makefile -@@ -47,6 +47,7 @@ COBJS-$(CONFIG_SDHCI) += sdhci.o - COBJS-$(CONFIG_S5P_SDHCI) += s5p_sdhci.o - COBJS-$(CONFIG_SH_MMCIF) += sh_mmcif.o - COBJS-$(CONFIG_TEGRA_MMC) += tegra_mmc.o -+COBJS-$(CONFIG_JZ4740_MMC) += jz_mmc.o - - COBJS := $(COBJS-y) - SRCS := $(COBJS:.o=.c) -diff --git a/drivers/mmc/jz_mmc.c b/drivers/mmc/jz_mmc.c -new file mode 100644 -index 0000000..642cecc ---- /dev/null -+++ b/drivers/mmc/jz_mmc.c -@@ -0,0 +1,1179 @@ -+/* -+ * (C) Copyright 2003 -+ * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net -+ * -+ * See file CREDITS for list of people who contributed to this -+ * project. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ * -+ * 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include "jz_mmc.h" -+ -+static int sd2_0 = 0; -+static int mmc_ready = 0; -+static int use_4bit; /* Use 4-bit data bus */ -+/* -+ * MMC Events -+ */ -+#define MMC_EVENT_NONE 0x00 /* No events */ -+#define MMC_EVENT_RX_DATA_DONE 0x01 /* Rx data done */ -+#define MMC_EVENT_TX_DATA_DONE 0x02 /* Tx data done */ -+#define MMC_EVENT_PROG_DONE 0x04 /* Programming is done */ -+ -+ -+#define MMC_IRQ_MASK() \ -+do { \ -+ REG_MSC_IMASK = 0xffff; \ -+ REG_MSC_IREG = 0xffff; \ -+} while (0) -+ -+/* -+ * GPIO definition -+ */ -+#if defined(CONFIG_SAKC) -+ -+#define __msc_init_io() \ -+do { \ -+ __gpio_as_input(GPIO_SD_CD_N); \ -+} while (0) -+ -+#else -+#define __msc_init_io() \ -+do { \ -+ __gpio_as_output(GPIO_SD_VCC_EN_N); \ -+ __gpio_as_input(GPIO_SD_CD_N); \ -+} while (0) -+ -+#define __msc_enable_power() \ -+do { \ -+ __gpio_clear_pin(GPIO_SD_VCC_EN_N); \ -+} while (0) -+ -+#define __msc_disable_power() \ -+do { \ -+ __gpio_set_pin(GPIO_SD_VCC_EN_N); \ -+} while (0) -+ -+#endif /* CONFIG_SAKE */ -+ -+#define __msc_card_detected() \ -+({ \ -+ int detected = 1; \ -+ __gpio_as_input(GPIO_SD_CD_N); \ -+ __gpio_disable_pull(GPIO_SD_CD_N); \ -+ if (!__gpio_get_pin(GPIO_SD_CD_N)) \ -+ detected = 0; \ -+ detected; \ -+}) -+ -+/* -+ * Local functions -+ */ -+ -+extern int -+fat_register_device(block_dev_desc_t *dev_desc, int part_no); -+ -+static block_dev_desc_t mmc_dev; -+ -+block_dev_desc_t * mmc_get_dev(int dev) -+{ -+ return ((block_dev_desc_t *)&mmc_dev); -+} -+ -+/* Stop the MMC clock and wait while it happens */ -+static inline int jz_mmc_stop_clock(void) -+{ -+ int timeout = 1000; -+ -+ REG_MSC_STRPCL = MSC_STRPCL_CLOCK_CONTROL_STOP; -+ -+ while (timeout && (REG_MSC_STAT & MSC_STAT_CLK_EN)) { -+ timeout--; -+ if (timeout == 0) -+ return MMC_ERROR_TIMEOUT; -+ udelay(1); -+ } -+ return MMC_NO_ERROR; -+} -+ -+/* Start the MMC clock and operation */ -+static inline int jz_mmc_start_clock(void) -+{ -+ REG_MSC_STRPCL = MSC_STRPCL_CLOCK_CONTROL_START | MSC_STRPCL_START_OP; -+ return MMC_NO_ERROR; -+} -+ -+static inline u32 jz_mmc_calc_clkrt(int is_sd, u32 rate) -+{ -+ u32 clkrt = 0; -+ u32 clk_src = is_sd ? 24000000 : 16000000; -+ -+ while (rate < clk_src) { -+ clkrt ++; -+ clk_src >>= 1; -+ } -+ -+ return clkrt; -+} -+ -+/* Set the MMC clock frequency */ -+void jz_mmc_set_clock(int sd, u32 rate) -+{ -+ jz_mmc_stop_clock(); -+ -+ /* Select clock source of MSC */ -+ __cpm_select_msc_clk(sd); -+ -+ /* Set clock dividor of MSC */ -+ REG_MSC_CLKRT = jz_mmc_calc_clkrt(sd, rate); -+} -+ -+static int jz_mmc_check_status(struct mmc_request *request) -+{ -+ u32 status = REG_MSC_STAT; -+ -+ /* Checking for response or data timeout */ -+ if (status & (MSC_STAT_TIME_OUT_RES | MSC_STAT_TIME_OUT_READ)) { -+ printf("MMC/SD timeout, MMC_STAT 0x%x CMD %d\n", status, request->cmd); -+ return MMC_ERROR_TIMEOUT; -+ } -+ -+ /* Checking for CRC error */ -+ if (status & (MSC_STAT_CRC_READ_ERROR | MSC_STAT_CRC_WRITE_ERROR | MSC_STAT_CRC_RES_ERR)) { -+ printf("MMC/CD CRC error, MMC_STAT 0x%x\n", status); -+ return MMC_ERROR_CRC; -+ } -+ -+ return MMC_NO_ERROR; -+} -+ -+/* Obtain response to the command and store it to response buffer */ -+static void jz_mmc_get_response(struct mmc_request *request) -+{ -+ int i; -+ u8 *buf; -+ u32 data; -+ -+ debug("fetch response for request %d, cmd %d\n", -+ request->rtype, request->cmd); -+ -+ buf = request->response; -+ request->result = MMC_NO_ERROR; -+ -+ switch (request->rtype) { -+ case RESPONSE_R1: case RESPONSE_R1B: case RESPONSE_R6: -+ case RESPONSE_R3: case RESPONSE_R4: case RESPONSE_R5: -+ { -+ data = REG_MSC_RES; -+ buf[0] = (data >> 8) & 0xff; -+ buf[1] = data & 0xff; -+ data = REG_MSC_RES; -+ buf[2] = (data >> 8) & 0xff; -+ buf[3] = data & 0xff; -+ data = REG_MSC_RES; -+ buf[4] = data & 0xff; -+ -+ debug("request %d, response [%02x %02x %02x %02x %02x]\n", -+ request->rtype, buf[0], buf[1], buf[2], buf[3], buf[4]); -+ break; -+ } -+ case RESPONSE_R2_CID: case RESPONSE_R2_CSD: -+ { -+ for (i = 0; i < 16; i += 2) { -+ data = REG_MSC_RES; -+ buf[i] = (data >> 8) & 0xff; -+ buf[i+1] = data & 0xff; -+ } -+ debug("request %d, response [", request->rtype); -+#if CONFIG_MMC_DEBUG_VERBOSE > 2 -+ if (g_mmc_debug >= 3) { -+ int n; -+ for (n = 0; n < 17; n++) -+ printk("%02x ", buf[n]); -+ printk("]\n"); -+ } -+#endif -+ break; -+ } -+ case RESPONSE_NONE: -+ debug("No response\n"); -+ break; -+ -+ default: -+ debug("unhandled response type for request %d\n", request->rtype); -+ break; -+ } -+} -+ -+static int jz_mmc_receive_data(struct mmc_request *req) -+{ -+ u32 stat, timeout, data, cnt; -+ u8 *buf = req->buffer; -+ u32 wblocklen = (u32)(req->block_len + 3) >> 2; /* length in word */ -+ -+ timeout = 0x3ffffff; -+ -+ while (timeout) { -+ timeout--; -+ stat = REG_MSC_STAT; -+ -+ if (stat & MSC_STAT_TIME_OUT_READ) -+ return MMC_ERROR_TIMEOUT; -+ else if (stat & MSC_STAT_CRC_READ_ERROR) -+ return MMC_ERROR_CRC; -+ else if (!(stat & MSC_STAT_DATA_FIFO_EMPTY) -+ || (stat & MSC_STAT_DATA_FIFO_AFULL)) { -+ /* Ready to read data */ -+ break; -+ } -+ udelay(1); -+ } -+ if (!timeout) -+ return MMC_ERROR_TIMEOUT; -+ -+ /* Read data from RXFIFO. It could be FULL or PARTIAL FULL */ -+ cnt = wblocklen; -+ while (cnt) { -+ data = REG_MSC_RXFIFO; -+ { -+ *buf++ = (u8)(data >> 0); -+ *buf++ = (u8)(data >> 8); -+ *buf++ = (u8)(data >> 16); -+ *buf++ = (u8)(data >> 24); -+ } -+ cnt --; -+ while (cnt && (REG_MSC_STAT & MSC_STAT_DATA_FIFO_EMPTY)) -+ ; -+ } -+ return MMC_NO_ERROR; -+} -+ -+static int jz_mmc_transmit_data(struct mmc_request *req) -+{ -+#if 0 -+ u32 nob = req->nob; -+ u32 wblocklen = (u32)(req->block_len + 3) >> 2; /* length in word */ -+ u8 *buf = req->buffer; -+ u32 *wbuf = (u32 *)buf; -+ u32 waligned = (((u32)buf & 0x3) == 0); /* word aligned ? */ -+ u32 stat, timeout, data, cnt; -+ -+ for (nob; nob >= 1; nob--) { -+ timeout = 0x3FFFFFF; -+ -+ while (timeout) { -+ timeout--; -+ stat = REG_MSC_STAT; -+ -+ if (stat & (MSC_STAT_CRC_WRITE_ERROR | MSC_STAT_CRC_WRITE_ERROR_NOSTS)) -+ return MMC_ERROR_CRC; -+ else if (!(stat & MSC_STAT_DATA_FIFO_FULL)) { -+ /* Ready to write data */ -+ break; -+ } -+ -+ udelay(1); -+ } -+ -+ if (!timeout) -+ return MMC_ERROR_TIMEOUT; -+ -+ /* Write data to TXFIFO */ -+ cnt = wblocklen; -+ while (cnt) { -+ while (REG_MSC_STAT & MSC_STAT_DATA_FIFO_FULL) -+ ; -+ -+ if (waligned) { -+ REG_MSC_TXFIFO = *wbuf++; -+ } -+ else { -+ data = *buf++ | (*buf++ << 8) | (*buf++ << 16) | (*buf++ << 24); -+ REG_MSC_TXFIFO = data; -+ } -+ -+ cnt--; -+ } -+ } -+#endif -+ return MMC_NO_ERROR; -+} -+ -+ -+/* -+ * Name: int jz_mmc_exec_cmd() -+ * Function: send command to the card, and get a response -+ * Input: struct mmc_request *req : MMC/SD request -+ * Output: 0: right >0: error code -+ */ -+int jz_mmc_exec_cmd(struct mmc_request *request) -+{ -+ u32 cmdat = 0, events = 0; -+ int retval, timeout = 0x3fffff; -+ -+ /* Indicate we have no result yet */ -+ request->result = MMC_NO_RESPONSE; -+ if (request->cmd == MMC_CIM_RESET) { -+ /* On reset, 1-bit bus width */ -+ use_4bit = 0; -+ -+ /* Reset MMC/SD controller */ -+ __msc_reset(); -+ -+ /* On reset, drop MMC clock down */ -+ jz_mmc_set_clock(0, MMC_CLOCK_SLOW); -+ -+ /* On reset, stop MMC clock */ -+ jz_mmc_stop_clock(); -+ } -+ if (request->cmd == MMC_CMD_SEND_OP_COND) { -+ debug("Have an MMC card\n"); -+ /* always use 1bit for MMC */ -+ use_4bit = 0; -+ } -+ if (request->cmd == SET_BUS_WIDTH) { -+ if (request->arg == 0x2) { -+ printf("Use 4-bit bus width\n"); -+ use_4bit = 1; -+ } else { -+ printf("Use 1-bit bus width\n"); -+ use_4bit = 0; -+ } -+ } -+ -+ /* stop clock */ -+ jz_mmc_stop_clock(); -+ -+ /* mask all interrupts */ -+ REG_MSC_IMASK = 0xffff; -+ -+ /* clear status */ -+ REG_MSC_IREG = 0xffff; -+ -+ /* use 4-bit bus width when possible */ -+ if (use_4bit) -+ cmdat |= MSC_CMDAT_BUS_WIDTH_4BIT; -+ -+ /* Set command type and events */ -+ switch (request->cmd) { -+ /* MMC core extra command */ -+ case MMC_CIM_RESET: -+ cmdat |= MSC_CMDAT_INIT; /* Initialization sequence sent prior to command */ -+ break; -+ -+ /* bc - broadcast - no response */ -+ case MMC_CMD_GO_IDLE_STATE: -+ case MMC_CMD_SET_DSR: -+ break; -+ -+ /* bcr - broadcast with response */ -+ case MMC_CMD_SEND_OP_COND: -+ case MMC_CMD_ALL_SEND_CID: -+ case MMC_GO_IRQ_STATE: -+ break; -+ -+ /* adtc - addressed with data transfer */ -+ case MMC_READ_DAT_UNTIL_STOP: -+ case MMC_CMD_READ_SINGLE_BLOCK: -+ case MMC_CMD_READ_MULTIPLE_BLOCK: -+ case SD_CMD_APP_SEND_SCR: -+ cmdat |= MSC_CMDAT_DATA_EN | MSC_CMDAT_READ; -+ events = MMC_EVENT_RX_DATA_DONE; -+ break; -+ -+ case MMC_WRITE_DAT_UNTIL_STOP: -+ case MMC_CMD_WRITE_SINGLE_BLOCK: -+ case MMC_CMD_WRITE_MULTIPLE_BLOCK: -+ case MMC_PROGRAM_CID: -+ case MMC_PROGRAM_CSD: -+ case MMC_SEND_WRITE_PROT: -+ case MMC_GEN_CMD: -+ case MMC_LOCK_UNLOCK: -+ cmdat |= MSC_CMDAT_DATA_EN | MSC_CMDAT_WRITE; -+ events = MMC_EVENT_TX_DATA_DONE | MMC_EVENT_PROG_DONE; -+ -+ break; -+ -+ case MMC_CMD_STOP_TRANSMISSION: -+ events = MMC_EVENT_PROG_DONE; -+ break; -+ -+ /* ac - no data transfer */ -+ default: -+ break; -+ } -+ -+ /* Set response type */ -+ switch (request->rtype) { -+ case RESPONSE_NONE: -+ break; -+ -+ case RESPONSE_R1B: -+ cmdat |= MSC_CMDAT_BUSY; -+ /*FALLTHRU*/ -+ case RESPONSE_R1: -+ cmdat |= MSC_CMDAT_RESPONSE_R1; -+ break; -+ case RESPONSE_R2_CID: -+ case RESPONSE_R2_CSD: -+ cmdat |= MSC_CMDAT_RESPONSE_R2; -+ break; -+ case RESPONSE_R3: -+ cmdat |= MSC_CMDAT_RESPONSE_R3; -+ break; -+ case RESPONSE_R4: -+ cmdat |= MSC_CMDAT_RESPONSE_R4; -+ break; -+ case RESPONSE_R5: -+ cmdat |= MSC_CMDAT_RESPONSE_R5; -+ break; -+ case RESPONSE_R6: -+ cmdat |= MSC_CMDAT_RESPONSE_R6; -+ break; -+ default: -+ break; -+ } -+ -+ /* Set command index */ -+ if (request->cmd == MMC_CIM_RESET) { -+ REG_MSC_CMD = MMC_CMD_GO_IDLE_STATE; -+ } else { -+ REG_MSC_CMD = request->cmd; -+ } -+ -+ /* Set argument */ -+ REG_MSC_ARG = request->arg; -+ -+ /* Set block length and nob */ -+ if (request->cmd == SD_CMD_APP_SEND_SCR) { /* get SCR from DataFIFO */ -+ REG_MSC_BLKLEN = 8; -+ REG_MSC_NOB = 1; -+ } else { -+ REG_MSC_BLKLEN = request->block_len; -+ REG_MSC_NOB = request->nob; -+ } -+ -+ /* Set command */ -+ REG_MSC_CMDAT = cmdat; -+ -+ debug("Send cmd %d cmdat: %x arg: %x resp %d\n", request->cmd, -+ cmdat, request->arg, request->rtype); -+ -+ /* Start MMC/SD clock and send command to card */ -+ jz_mmc_start_clock(); -+ -+ /* Wait for command completion */ -+ while (timeout-- && !(REG_MSC_STAT & MSC_STAT_END_CMD_RES)) -+ ; -+ -+ if (timeout == 0) -+ return MMC_ERROR_TIMEOUT; -+ -+ REG_MSC_IREG = MSC_IREG_END_CMD_RES; /* clear flag */ -+ -+ /* Check for status */ -+ retval = jz_mmc_check_status(request); -+ if (retval) { -+ return retval; -+ } -+ -+ /* Complete command with no response */ -+ if (request->rtype == RESPONSE_NONE) { -+ return MMC_NO_ERROR; -+ } -+ -+ /* Get response */ -+ jz_mmc_get_response(request); -+ -+ /* Start data operation */ -+ if (events & (MMC_EVENT_RX_DATA_DONE | MMC_EVENT_TX_DATA_DONE)) { -+ if (events & MMC_EVENT_RX_DATA_DONE) { -+ if (request->cmd == SD_CMD_APP_SEND_SCR) { -+ /* SD card returns SCR register as data. -+ MMC core expect it in the response buffer, -+ after normal response. */ -+ request->buffer = (u8 *)((u32)request->response + 5); -+ } -+ jz_mmc_receive_data(request); -+ } -+ -+ if (events & MMC_EVENT_TX_DATA_DONE) { -+ jz_mmc_transmit_data(request); -+ } -+ -+ /* Wait for Data Done */ -+ while (!(REG_MSC_IREG & MSC_IREG_DATA_TRAN_DONE)) -+ ; -+ REG_MSC_IREG = MSC_IREG_DATA_TRAN_DONE; /* clear status */ -+ } -+ -+ /* Wait for Prog Done event */ -+ if (events & MMC_EVENT_PROG_DONE) { -+ while (!(REG_MSC_IREG & MSC_IREG_PRG_DONE)) -+ ; -+ REG_MSC_IREG = MSC_IREG_PRG_DONE; /* clear status */ -+ } -+ -+ /* Command completed */ -+ -+ return MMC_NO_ERROR; /* return successfully */ -+} -+ -+int mmc_block_read(u8 *dst, ulong src, ulong len) -+{ -+ -+ struct mmc_request request; -+ struct mmc_response_r1 r1; -+ int retval = 0; -+ -+ if (len == 0) -+ goto exit; -+ -+ mmc_simple_cmd(&request, MMC_CMD_SEND_STATUS, mmcinfo.rca, RESPONSE_R1); -+ retval = mmc_unpack_r1(&request, &r1, 0); -+ if (retval && (retval != MMC_ERROR_STATE_MISMATCH)) -+ goto exit; -+ -+ mmc_simple_cmd(&request, MMC_CMD_SET_BLOCKLEN, len, RESPONSE_R1); -+ if (retval = mmc_unpack_r1(&request, &r1, 0)) -+ goto exit; -+ -+ if (!sd2_0) -+ src *= mmcinfo.block_len; -+ -+ mmc_send_cmd(&request, MMC_CMD_READ_SINGLE_BLOCK, src, 1, len, RESPONSE_R1, dst); -+ if (retval = mmc_unpack_r1(&request, &r1, 0)) -+ goto exit; -+ -+exit: -+ return retval; -+} -+ -+ulong mmc_bread(int dev_num, ulong blkstart, ulong blkcnt, ulong *dst) -+{ -+ if (!mmc_ready) { -+ printf("Please initial the MMC first\n"); -+ return -1; -+ } -+ -+ int i = 0; -+ ulong dst_tmp = dst; -+ -+ for (i = 0; i < blkcnt; i++) { -+ if ((mmc_block_read((uchar *)(dst_tmp), blkstart, mmcinfo.block_len)) < 0) -+ return -1; -+ -+ dst_tmp += mmcinfo.block_len; -+ blkstart++; -+ } -+ -+ return i; -+} -+ -+int mmc_select_card(void) -+{ -+ struct mmc_request request; -+ struct mmc_response_r1 r1; -+ int retval; -+ -+ mmc_simple_cmd(&request, MMC_CMD_SELECT_CARD, mmcinfo.rca, RESPONSE_R1B); -+ retval = mmc_unpack_r1(&request, &r1, 0); -+ if (retval) { -+ return retval; -+ } -+ -+ if (mmcinfo.sd) { -+ mmc_simple_cmd(&request, MMC_CMD_APP_CMD, mmcinfo.rca, RESPONSE_R1); -+ retval = mmc_unpack_r1(&request,&r1,0); -+ if (retval) { -+ return retval; -+ } -+#if defined(MMC_BUS_WIDTH_1BIT) -+ mmc_simple_cmd(&request, SET_BUS_WIDTH, 1, RESPONSE_R1); -+#else -+ mmc_simple_cmd(&request, SET_BUS_WIDTH, 2, RESPONSE_R1); -+#endif -+ retval = mmc_unpack_r1(&request,&r1,0); -+ if (retval) { -+ return retval; -+ } -+ } -+ return 0; -+} -+ -+/* -+ * Configure card -+ */ -+static void mmc_configure_card(void) -+{ -+ u32 rate; -+ -+ /* Get card info */ -+ if (sd2_0) -+ mmcinfo.block_num = (mmcinfo.csd.c_size + 1) << 10; -+ else -+ mmcinfo.block_num = (mmcinfo.csd.c_size + 1) * (1 << (mmcinfo.csd.c_size_mult + 2)); -+ -+ mmcinfo.block_len = 1 << mmcinfo.csd.read_bl_len; -+ -+ mmc_dev.if_type = IF_TYPE_SD; -+ mmc_dev.part_type = PART_TYPE_DOS; -+ mmc_dev.dev = 0; -+ mmc_dev.lun = 0; -+ mmc_dev.type = 0; -+ mmc_dev.blksz = mmcinfo.block_len; -+ mmc_dev.lba = mmcinfo.block_num; -+ mmc_dev.removable = 0; -+ -+ printf("%s Detected: %lu blocks of %lu bytes\n", -+ sd2_0 == 1 ? "SDHC" : "SD", -+ mmc_dev.lba, -+ mmc_dev.blksz); -+ -+ /* Fix the clock rate */ -+ rate = mmc_tran_speed(mmcinfo.csd.tran_speed); -+ if (rate < MMC_CLOCK_SLOW) -+ rate = MMC_CLOCK_SLOW; -+ if ((mmcinfo.sd == 0) && (rate > MMC_CLOCK_FAST)) -+ rate = MMC_CLOCK_FAST; -+ if ((mmcinfo.sd) && (rate > SD_CLOCK_FAST)) -+ rate = SD_CLOCK_FAST; -+ -+ debug("%s: block_len=%d block_num=%d rate=%d\n", -+ __func__, mmcinfo.block_len, mmcinfo.block_num, rate); -+ -+ jz_mmc_set_clock(mmcinfo.sd, rate); -+} -+ -+/* -+ * State machine routines to initialize card(s) -+ */ -+ -+/* -+ CIM_SINGLE_CARD_ACQ (frequency at 400 kHz) -+ --- Must enter from GO_IDLE_STATE --- -+ 1. SD_SEND_OP_COND (SD Card) [CMD55] + [CMD41] -+ 2. SEND_OP_COND (Full Range) [CMD1] {optional} -+ 3. SEND_OP_COND (Set Range ) [CMD1] -+ If busy, delay and repeat step 2 -+ 4. ALL_SEND_CID [CMD2] -+ If timeout, set an error (no cards found) -+ 5. SET_RELATIVE_ADDR [CMD3] -+ 6. SEND_CSD [CMD9] -+ 7. SET_DSR [CMD4] Only call this if (csd.dsr_imp). -+ 8. Set clock frequency (check available in csd.tran_speed) -+ */ -+ -+#define MMC_INIT_DOING 0 -+#define MMC_INIT_PASSED 1 -+#define MMC_INIT_FAILED 2 -+ -+static int mmc_init_card_state(struct mmc_request *request) -+{ -+ struct mmc_response_r1 r1; -+ struct mmc_response_r3 r3; -+ int retval; -+ int ocr = 0x40300000; -+ int limit_41 = 0; -+ -+ switch (request->cmd) { -+ case MMC_CMD_GO_IDLE_STATE: /* No response to parse */ -+ if (mmcinfo.sd) -+ mmc_simple_cmd(request, 8, 0x1aa, RESPONSE_R1); -+ else -+ mmc_simple_cmd(request, MMC_CMD_SEND_OP_COND, MMC_OCR_ARG, RESPONSE_R3); -+ break; -+ -+ case 8: -+ retval = mmc_unpack_r1(request,&r1,mmcinfo.state); -+ mmc_simple_cmd(request, MMC_CMD_APP_CMD, 0, RESPONSE_R1); -+ break; -+ -+ case MMC_CMD_APP_CMD: -+ retval = mmc_unpack_r1(request,&r1,mmcinfo.state); -+ if (retval & (limit_41 < 100)) { -+ debug("%s: unable to MMC_APP_CMD error=%d (%s)\n", -+ __func__, retval, mmc_result_to_string(retval)); -+ limit_41++; -+ mmc_simple_cmd(request, SD_CMD_APP_SEND_OP_COND, ocr, RESPONSE_R3); -+ } else if (limit_41 < 100) { -+ limit_41++; -+ mmc_simple_cmd(request, SD_CMD_APP_SEND_OP_COND, ocr, RESPONSE_R3); -+ } else{ -+ /* reset the card to idle*/ -+ mmc_simple_cmd(request, MMC_CMD_GO_IDLE_STATE, 0, RESPONSE_NONE); -+ mmcinfo.sd = 0; -+ } -+ break; -+ -+ case SD_CMD_APP_SEND_OP_COND: -+ retval = mmc_unpack_r3(request, &r3); -+ if (retval) { -+ debug("%s: try MMC card\n", __func__); -+ mmc_simple_cmd(request, SD_CMD_APP_SEND_OP_COND, MMC_OCR_ARG, RESPONSE_R3); -+ break; -+ } -+ -+ debug("%s: read ocr value = 0x%08x\n", __func__, r3.ocr); -+ -+ if(!(r3.ocr & MMC_CARD_BUSY || ocr == 0)){ -+ udelay(50000); -+ mmc_simple_cmd(request, MMC_CMD_APP_CMD, 0, RESPONSE_R1); -+ } else { -+ mmcinfo.sd = 1; /* SD Card ready */ -+ mmcinfo.state = CARD_STATE_READY; -+ mmc_simple_cmd(request, MMC_CMD_ALL_SEND_CID, 0, RESPONSE_R2_CID); -+ } -+ break; -+ -+ case MMC_CMD_SEND_OP_COND: -+ retval = mmc_unpack_r3(request, &r3); -+ if (retval) { -+ debug("%s: failed SEND_OP_COND error=%d (%s)\n", -+ __func__, retval, mmc_result_to_string(retval)); -+ return MMC_INIT_FAILED; -+ } -+ -+ debug("%s: read ocr value = 0x%08x\n", __func__, r3.ocr); -+ if (!(r3.ocr & MMC_CARD_BUSY)) { -+ mmc_simple_cmd(request, MMC_CMD_SEND_OP_COND, MMC_OCR_ARG, RESPONSE_R3); -+ } else { -+ mmcinfo.sd = 0; /* MMC Card ready */ -+ mmcinfo.state = CARD_STATE_READY; -+ mmc_simple_cmd(request, MMC_CMD_ALL_SEND_CID, 0, RESPONSE_R2_CID); -+ } -+ break; -+ -+ case MMC_CMD_ALL_SEND_CID: -+ retval = mmc_unpack_cid( request, &mmcinfo.cid ); -+ /*FIXME:ignore CRC error for CMD2/CMD9/CMD10 */ -+ if ( retval && (retval != MMC_ERROR_CRC)) { -+ debug("mmc_init_card_state: unable to ALL_SEND_CID error=%d (%s)\n", -+ retval, mmc_result_to_string(retval)); -+ return MMC_INIT_FAILED; -+ } -+ mmcinfo.state = CARD_STATE_IDENT; -+ if(mmcinfo.sd) -+ mmc_simple_cmd(request, MMC_CMD_SET_RELATIVE_ADDR, 0, RESPONSE_R6); -+ else -+ mmc_simple_cmd(request, MMC_CMD_SET_RELATIVE_ADDR, ID_TO_RCA(mmcinfo.id) << 16, RESPONSE_R1); -+ break; -+ -+ case MMC_CMD_SET_RELATIVE_ADDR: -+ if (mmcinfo.sd) { -+ retval = mmc_unpack_r6(request, &r1, mmcinfo.state, &mmcinfo.rca); -+ mmcinfo.rca = mmcinfo.rca << 16; -+ debug("%s: Get RCA from SD: 0x%04x Status: %x\n", -+ __func__, mmcinfo.rca, r1.status); -+ } else { -+ retval = mmc_unpack_r1(request,&r1,mmcinfo.state); -+ mmcinfo.rca = ID_TO_RCA(mmcinfo.id) << 16; -+ } -+ if (retval) { -+ debug("%s: unable to SET_RELATIVE_ADDR error=%d (%s)\n", -+ __func__, retval, mmc_result_to_string(retval)); -+ return MMC_INIT_FAILED; -+ } -+ -+ mmcinfo.state = CARD_STATE_STBY; -+ mmc_simple_cmd(request, MMC_CMD_SEND_CSD, mmcinfo.rca, RESPONSE_R2_CSD); -+ -+ break; -+ -+ case MMC_CMD_SEND_CSD: -+ retval = mmc_unpack_csd(request, &mmcinfo.csd); -+ mmc_ready = 1; -+ /*FIXME:ignore CRC error for CMD2/CMD9/CMD10 */ -+ if (retval && (retval != MMC_ERROR_CRC)) { -+ debug("%s: unable to SEND_CSD error=%d (%s)\n", -+ __func__, retval, mmc_result_to_string(retval)); -+ return MMC_INIT_FAILED; -+ } -+ if (mmcinfo.csd.dsr_imp) { -+ debug("%s: driver doesn't support setting DSR\n", __func__); -+ } -+ mmc_configure_card(); -+ return MMC_INIT_PASSED; -+ -+ default: -+ debug("%s: error! Illegal last cmd %d\n", __func__, request->cmd); -+ return MMC_INIT_FAILED; -+ } -+ -+ return MMC_INIT_DOING; -+} -+ -+int mmc_init_card(void) -+{ -+ struct mmc_request request; -+ int retval; -+ -+ mmc_simple_cmd(&request, MMC_CIM_RESET, 0, RESPONSE_NONE); /* reset card */ -+ mmc_simple_cmd(&request, MMC_CMD_GO_IDLE_STATE, 0, RESPONSE_NONE); -+ mmcinfo.sd = 1; /* assuming a SD card */ -+ -+ while ((retval = mmc_init_card_state(&request)) == MMC_INIT_DOING) -+ ; -+ -+ if (retval == MMC_INIT_PASSED) -+ return MMC_NO_ERROR; -+ else -+ return MMC_NO_RESPONSE; -+} -+ -+int mmc_legacy_init(int verbose) -+{ -+ if (!__msc_card_detected()) -+ return 1; -+ -+ /* Step-1: init GPIO */ -+ __gpio_as_msc(); -+ __msc_init_io(); -+ -+ /* Step-2: turn on power of card */ -+#if !defined(CONFIG_SAKC) -+ __msc_enable_power(); -+#endif -+ -+ /* Step-3: Reset MSC Controller. */ -+ __msc_reset(); -+ -+ /* Step-3: mask all IRQs. */ -+ MMC_IRQ_MASK(); -+ -+ /* Step-4: stop MMC/SD clock */ -+ jz_mmc_stop_clock(); -+ mmc_init_card(); -+ mmc_select_card(); -+ -+ mmc_dev.block_read = mmc_bread; -+ fat_register_device(&mmc_dev,1); /* partitions start counting with 1 */ -+ -+ return 0; -+} -+ -+/* -+ * Debugging functions -+ */ -+static char * mmc_result_strings[] = { -+ "NO_RESPONSE", -+ "NO_ERROR", -+ "ERROR_OUT_OF_RANGE", -+ "ERROR_ADDRESS", -+ "ERROR_BLOCK_LEN", -+ "ERROR_ERASE_SEQ", -+ "ERROR_ERASE_PARAM", -+ "ERROR_WP_VIOLATION", -+ "ERROR_CARD_IS_LOCKED", -+ "ERROR_LOCK_UNLOCK_FAILED", -+ "ERROR_COM_CRC", -+ "ERROR_ILLEGAL_COMMAND", -+ "ERROR_CARD_ECC_FAILED", -+ "ERROR_CC", -+ "ERROR_GENERAL", -+ "ERROR_UNDERRUN", -+ "ERROR_OVERRUN", -+ "ERROR_CID_CSD_OVERWRITE", -+ "ERROR_STATE_MISMATCH", -+ "ERROR_HEADER_MISMATCH", -+ "ERROR_TIMEOUT", -+ "ERROR_CRC", -+ "ERROR_DRIVER_FAILURE", -+}; -+ -+char * mmc_result_to_string(int i) -+{ -+ return mmc_result_strings[i+1]; -+} -+ -+static char * card_state_strings[] = { -+ "empty", -+ "idle", -+ "ready", -+ "ident", -+ "stby", -+ "tran", -+ "data", -+ "rcv", -+ "prg", -+ "dis", -+}; -+ -+static inline char * card_state_to_string(int i) -+{ -+ return card_state_strings[i+1]; -+} -+ -+/* -+ * Utility functions -+ */ -+ -+#define PARSE_U32(_buf,_index) \ -+ (((u32)_buf[_index]) << 24) | (((u32)_buf[_index+1]) << 16) | \ -+ (((u32)_buf[_index+2]) << 8) | ((u32)_buf[_index+3]); -+ -+#define PARSE_U16(_buf,_index) \ -+ (((u16)_buf[_index]) << 8) | ((u16)_buf[_index+1]); -+ -+int mmc_unpack_csd(struct mmc_request *request, struct mmc_csd *csd) -+{ -+ u8 *buf = request->response; -+ int num = 0; -+ -+ if (request->result) -+ return request->result; -+ -+ if (buf[0] != 0x3f) -+ return MMC_ERROR_HEADER_MISMATCH; -+ -+ csd->csd_structure = (buf[1] & 0xc0) >> 6; -+ if (csd->csd_structure) -+ sd2_0 = 1; -+ else -+ sd2_0 = 0; -+ -+ switch (csd->csd_structure) { -+ case 0 :/* Version 1.01-1.10 -+ * Version 2.00/Standard Capacity */ -+ csd->taac = buf[2]; -+ csd->nsac = buf[3]; -+ csd->tran_speed = buf[4]; -+ csd->ccc = (((u16)buf[5]) << 4) | ((buf[6] & 0xf0) >> 4); -+ csd->read_bl_len = buf[6] & 0x0f; -+ /* for support 2GB card*/ -+ if (csd->read_bl_len >= 10) -+ { -+ num = csd->read_bl_len - 9; -+ csd->read_bl_len = 9; -+ } -+ -+ csd->read_bl_partial = (buf[7] & 0x80) ? 1 : 0; -+ csd->write_blk_misalign = (buf[7] & 0x40) ? 1 : 0; -+ csd->read_blk_misalign = (buf[7] & 0x20) ? 1 : 0; -+ csd->dsr_imp = (buf[7] & 0x10) ? 1 : 0; -+ csd->c_size = ((((u16)buf[7]) & 0x03) << 10) | (((u16)buf[8]) << 2) | (((u16)buf[9]) & 0xc0) >> 6; -+ -+ if (num) -+ csd->c_size = csd->c_size << num; -+ -+ -+ csd->vdd_r_curr_min = (buf[9] & 0x38) >> 3; -+ csd->vdd_r_curr_max = buf[9] & 0x07; -+ csd->vdd_w_curr_min = (buf[10] & 0xe0) >> 5; -+ csd->vdd_w_curr_max = (buf[10] & 0x1c) >> 2; -+ csd->c_size_mult = ((buf[10] & 0x03) << 1) | ((buf[11] & 0x80) >> 7); -+ csd->sector_size = (buf[11] & 0x7c) >> 2; -+ csd->erase_grp_size = ((buf[11] & 0x03) << 3) | ((buf[12] & 0xe0) >> 5); -+ csd->wp_grp_size = buf[12] & 0x1f; -+ csd->wp_grp_enable = (buf[13] & 0x80) ? 1 : 0; -+ csd->default_ecc = (buf[13] & 0x60) >> 5; -+ csd->r2w_factor = (buf[13] & 0x1c) >> 2; -+ csd->write_bl_len = ((buf[13] & 0x03) << 2) | ((buf[14] & 0xc0) >> 6); -+ if (csd->write_bl_len >= 10) -+ csd->write_bl_len = 9; -+ -+ csd->write_bl_partial = (buf[14] & 0x20) ? 1 : 0; -+ csd->file_format_grp = (buf[15] & 0x80) ? 1 : 0; -+ csd->copy = (buf[15] & 0x40) ? 1 : 0; -+ csd->perm_write_protect = (buf[15] & 0x20) ? 1 : 0; -+ csd->tmp_write_protect = (buf[15] & 0x10) ? 1 : 0; -+ csd->file_format = (buf[15] & 0x0c) >> 2; -+ csd->ecc = buf[15] & 0x03; -+ break; -+ case 1 : /* Version 2.00/High Capacity */ -+ csd->taac = 0; -+ csd->nsac = 0; -+ csd->tran_speed = buf[4]; -+ csd->ccc = (((u16)buf[5]) << 4) | ((buf[6] & 0xf0) >> 4); -+ -+ csd->read_bl_len = 9; -+ csd->read_bl_partial = 0; -+ csd->write_blk_misalign = 0; -+ csd->read_blk_misalign = 0; -+ csd->dsr_imp = (buf[7] & 0x10) ? 1 : 0; -+ csd->c_size = ((((u16)buf[8]) & 0x3f) << 16) | (((u16)buf[9]) << 8) | ((u16)buf[10]) ; -+ csd->sector_size = 0x7f; -+ csd->erase_grp_size = 0; -+ csd->wp_grp_size = 0; -+ csd->wp_grp_enable = 0; -+ csd->default_ecc = (buf[13] & 0x60) >> 5; -+ csd->r2w_factor = 4;/* Unused */ -+ csd->write_bl_len = 9; -+ -+ csd->write_bl_partial = 0; -+ csd->file_format_grp = 0; -+ csd->copy = (buf[15] & 0x40) ? 1 : 0; -+ csd->perm_write_protect = (buf[15] & 0x20) ? 1 : 0; -+ csd->tmp_write_protect = (buf[15] & 0x10) ? 1 : 0; -+ csd->file_format = 0; -+ csd->ecc = buf[15] & 0x03; -+ } -+ -+ return 0; -+} -+ -+int mmc_unpack_r1(struct mmc_request *request, struct mmc_response_r1 *r1, enum card_state state) -+{ -+ u8 *buf = request->response; -+ -+ if (request->result) -+ return request->result; -+ -+ r1->cmd = buf[0]; -+ r1->status = PARSE_U32(buf,1); -+ -+ debug("mmc_unpack_r1: cmd=%d status=%08x\n", r1->cmd, r1->status); -+ -+ if (R1_STATUS(r1->status)) { -+ if (r1->status & R1_OUT_OF_RANGE) return MMC_ERROR_OUT_OF_RANGE; -+ if (r1->status & R1_ADDRESS_ERROR) return MMC_ERROR_ADDRESS; -+ if (r1->status & R1_BLOCK_LEN_ERROR) return MMC_ERROR_BLOCK_LEN; -+ if (r1->status & R1_ERASE_SEQ_ERROR) return MMC_ERROR_ERASE_SEQ; -+ if (r1->status & R1_ERASE_PARAM) return MMC_ERROR_ERASE_PARAM; -+ if (r1->status & R1_WP_VIOLATION) return MMC_ERROR_WP_VIOLATION; -+ /*if (r1->status & R1_CARD_IS_LOCKED) return MMC_ERROR_CARD_IS_LOCKED; */ -+ if (r1->status & R1_LOCK_UNLOCK_FAILED) return MMC_ERROR_LOCK_UNLOCK_FAILED; -+ if (r1->status & R1_COM_CRC_ERROR) return MMC_ERROR_COM_CRC; -+ if (r1->status & R1_ILLEGAL_COMMAND) return MMC_ERROR_ILLEGAL_COMMAND; -+ if (r1->status & R1_CARD_ECC_FAILED) return MMC_ERROR_CARD_ECC_FAILED; -+ if (r1->status & R1_CC_ERROR) return MMC_ERROR_CC; -+ if (r1->status & R1_ERROR) return MMC_ERROR_GENERAL; -+ if (r1->status & R1_UNDERRUN) return MMC_ERROR_UNDERRUN; -+ if (r1->status & R1_OVERRUN) return MMC_ERROR_OVERRUN; -+ if (r1->status & R1_CID_CSD_OVERWRITE) return MMC_ERROR_CID_CSD_OVERWRITE; -+ } -+ -+ if (buf[0] != request->cmd) -+ return MMC_ERROR_HEADER_MISMATCH; -+ -+ /* This should be last - it's the least dangerous error */ -+ -+ return 0; -+} -+ -+int mmc_unpack_scr(struct mmc_request *request, struct mmc_response_r1 *r1, enum card_state state, u32 *scr) -+{ -+ u8 *buf = request->response; -+ if (request->result) -+ return request->result; -+ -+ *scr = PARSE_U32(buf, 5); /* Save SCR returned by the SD Card */ -+ return mmc_unpack_r1(request, r1, state); -+ -+} -+ -+int mmc_unpack_r6(struct mmc_request *request, struct mmc_response_r1 *r1, enum card_state state, int *rca) -+{ -+ u8 *buf = request->response; -+ -+ if (request->result) -+ return request->result; -+ -+ *rca = PARSE_U16(buf,1); /* Save RCA returned by the SD Card */ -+ -+ *(buf+1) = 0; -+ *(buf+2) = 0; -+ -+ return mmc_unpack_r1(request, r1, state); -+} -+ -+int mmc_unpack_cid(struct mmc_request *request, struct mmc_cid *cid) -+{ -+ int i; -+ u8 *buf = request->response; -+ -+ if (request->result) -+ return request->result; -+ -+ cid->mid = buf[1]; -+ cid->oid = PARSE_U16(buf,2); -+ for (i = 0 ; i < 5 ; i++) -+ cid->pnm[i] = buf[4+i]; -+ cid->pnm[6] = 0; -+ cid->prv = buf[10]; -+ cid->psn = PARSE_U32(buf,10); -+ cid->mdt = buf[15]; -+ -+ printf("Man %02x OEM 0x%04x \"%s\" %d.%d 0x%08x " -+ "Date %02u/%04u\n", -+ cid->mid, -+ cid->oid, -+ cid->pnm, -+ cid->prv >> 4, -+ cid->prv & 0xf, -+ cid->psn, -+ cid->mdt & 0xf, -+ (cid->mdt >> 4) + 2000); -+ -+ if (buf[0] != 0x3f) -+ return MMC_ERROR_HEADER_MISMATCH; -+ return 0; -+} -+ -+int mmc_unpack_r3(struct mmc_request *request, struct mmc_response_r3 *r3) -+{ -+ u8 *buf = request->response; -+ -+ if (request->result) -+ return request->result; -+ -+ r3->ocr = PARSE_U32(buf,1); -+ debug("mmc_unpack_r3: ocr=%08x\n", r3->ocr); -+ -+ if (buf[0] != 0x3f) return MMC_ERROR_HEADER_MISMATCH; -+ return 0; -+} -+ -+#define KBPS 1 -+#define MBPS 1000 -+ -+static u32 ts_exp[] = { 100*KBPS, 1*MBPS, 10*MBPS, 100*MBPS, 0, 0, 0, 0 }; -+static u32 ts_mul[] = { 0, 1000, 1200, 1300, 1500, 2000, 2500, 3000, -+ 3500, 4000, 4500, 5000, 5500, 6000, 7000, 8000 }; -+ -+u32 mmc_tran_speed(u8 ts) -+{ -+ u32 rate = ts_exp[(ts & 0x7)] * ts_mul[(ts & 0x78) >> 3]; -+ -+ if (rate <= 0) { -+ debug("%s: error - unrecognized speed 0x%02x\n", __func__, ts); -+ return 1; -+ } -+ -+ return rate; -+} -+ -+void mmc_send_cmd(struct mmc_request *request, int cmd, u32 arg, -+ u16 nob, u16 block_len, enum mmc_rsp_t rtype, u8 *buffer) -+{ -+ request->cmd = cmd; -+ request->arg = arg; -+ request->rtype = rtype; -+ request->nob = nob; -+ request->block_len = block_len; -+ request->buffer = buffer; -+ request->cnt = nob * block_len; -+ -+ jz_mmc_exec_cmd(request); -+} -diff --git a/drivers/mmc/jz_mmc.h b/drivers/mmc/jz_mmc.h -new file mode 100644 -index 0000000..936c514 ---- /dev/null -+++ b/drivers/mmc/jz_mmc.h -@@ -0,0 +1,176 @@ -+/* -+ * linux/drivers/mmc/jz_mmc.h -+ * -+ * Author: Vladimir Shebordaev, Igor Oblakov -+ * Copyright: MontaVista Software Inc. -+ * -+ * $Id: jz_mmc.h,v 1.3 2007-06-15 08:04:20 jlwei Exp $ -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ */ -+#ifndef __MMC_JZMMC_H__ -+#define __MMC_JZMMC_H__ -+ -+#define ID_TO_RCA(x) ((x)+1) -+#define MMC_OCR_ARG 0x00ff8000 /* Argument of OCR */ -+ -+/* Standard MMC/SD clock speeds */ -+#define MMC_CLOCK_SLOW 400000 /* 400 kHz for initial setup */ -+#define MMC_CLOCK_FAST 20000000 /* 20 MHz for maximum for normal operation */ -+#define SD_CLOCK_FAST 24000000 /* 24 MHz for SD Cards */ -+ -+/* Use negative numbers to disambiguate */ -+#define MMC_CIM_RESET -1 -+#define SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */ -+ -+#define R1_OUT_OF_RANGE (1 << 31) /* er, c */ -+#define R1_ADDRESS_ERROR (1 << 30) /* erx, c */ -+#define R1_BLOCK_LEN_ERROR (1 << 29) /* er, c */ -+#define R1_ERASE_SEQ_ERROR (1 << 28) /* er, c */ -+#define R1_ERASE_PARAM (1 << 27) /* ex, c */ -+#define R1_WP_VIOLATION (1 << 26) /* erx, c */ -+#define R1_CARD_IS_LOCKED (1 << 25) /* sx, a */ -+#define R1_LOCK_UNLOCK_FAILED (1 << 24) /* erx, c */ -+#define R1_COM_CRC_ERROR (1 << 23) /* er, b */ -+#define R1_ILLEGAL_COMMAND (1 << 22) /* er, b */ -+#define R1_CARD_ECC_FAILED (1 << 21) /* ex, c */ -+#define R1_CC_ERROR (1 << 20) /* erx, c */ -+#define R1_ERROR (1 << 19) /* erx, c */ -+#define R1_UNDERRUN (1 << 18) /* ex, c */ -+#define R1_OVERRUN (1 << 17) /* ex, c */ -+#define R1_CID_CSD_OVERWRITE (1 << 16) /* erx, c, CID/CSD overwrite */ -+#define R1_WP_ERASE_SKIP (1 << 15) /* sx, c */ -+#define R1_CARD_ECC_DISABLED (1 << 14) /* sx, a */ -+#define R1_ERASE_RESET (1 << 13) /* sr, c */ -+#define R1_STATUS(x) (x & 0xFFFFE000) -+ -+#define MMC_CARD_BUSY 0x80000000 /* Card Power up status bit */ -+ -+#define MMC_PROGRAM_CID 26 /* adtc R1 */ -+#define MMC_PROGRAM_CSD 27 /* adtc R1 */ -+ -+#define MMC_GO_IRQ_STATE 40 /* bcr R5 */ -+#define MMC_GEN_CMD 56 /* adtc [0] RD/WR R1b */ -+#define MMC_LOCK_UNLOCK 42 /* adtc R1b */ -+#define MMC_WRITE_DAT_UNTIL_STOP 20 /* adtc [31:0] data addr R1 */ -+#define MMC_READ_DAT_UNTIL_STOP 11 /* adtc [31:0] dadr R1 */ -+#define MMC_SEND_WRITE_PROT 30 /* adtc [31:0] wpdata addr R1 */ -+ -+ -+enum mmc_result_t { -+ MMC_NO_RESPONSE = -1, -+ MMC_NO_ERROR = 0, -+ MMC_ERROR_OUT_OF_RANGE, -+ MMC_ERROR_ADDRESS, -+ MMC_ERROR_BLOCK_LEN, -+ MMC_ERROR_ERASE_SEQ, -+ MMC_ERROR_ERASE_PARAM, -+ MMC_ERROR_WP_VIOLATION, -+ MMC_ERROR_CARD_IS_LOCKED, -+ MMC_ERROR_LOCK_UNLOCK_FAILED, -+ MMC_ERROR_COM_CRC, -+ MMC_ERROR_ILLEGAL_COMMAND, -+ MMC_ERROR_CARD_ECC_FAILED, -+ MMC_ERROR_CC, -+ MMC_ERROR_GENERAL, -+ MMC_ERROR_UNDERRUN, -+ MMC_ERROR_OVERRUN, -+ MMC_ERROR_CID_CSD_OVERWRITE, -+ MMC_ERROR_STATE_MISMATCH, -+ MMC_ERROR_HEADER_MISMATCH, -+ MMC_ERROR_TIMEOUT, -+ MMC_ERROR_CRC, -+ MMC_ERROR_DRIVER_FAILURE, -+}; -+ -+enum card_state { -+ CARD_STATE_EMPTY = -1, -+ CARD_STATE_IDLE = 0, -+ CARD_STATE_READY = 1, -+ CARD_STATE_IDENT = 2, -+ CARD_STATE_STBY = 3, -+ CARD_STATE_TRAN = 4, -+ CARD_STATE_DATA = 5, -+ CARD_STATE_RCV = 6, -+ CARD_STATE_PRG = 7, -+ CARD_STATE_DIS = 8, -+}; -+ -+enum mmc_rsp_t { -+ RESPONSE_NONE = 0, -+ RESPONSE_R1 = 1, -+ RESPONSE_R1B = 2, -+ RESPONSE_R2_CID = 3, -+ RESPONSE_R2_CSD = 4, -+ RESPONSE_R3 = 5, -+ RESPONSE_R4 = 6, -+ RESPONSE_R5 = 7, -+ RESPONSE_R6 = 8, -+}; -+ -+struct mmc_response_r1 { -+ u8 cmd; -+ u32 status; -+}; -+ -+struct mmc_response_r3 { -+ u32 ocr; -+}; -+ -+/* the information structure of MMC/SD Card */ -+struct mmc_info { -+ int id; /* Card index */ -+ int sd; /* MMC or SD card */ -+ int rca; /* RCA */ -+ u32 scr; /* SCR 63:32*/ -+ int flags; /* Ejected, inserted */ -+ enum card_state state; /* empty, ident, ready, whatever */ -+ -+ /* Card specific information */ -+ struct mmc_cid cid; -+ struct mmc_csd csd; -+ u32 block_num; -+ u32 block_len; -+ u32 erase_unit; -+}; -+ -+struct mmc_info mmcinfo; -+ -+struct mmc_request { -+ int index; /* Slot index - used for CS lines */ -+ int cmd; /* Command to send */ -+ u32 arg; /* Argument to send */ -+ enum mmc_rsp_t rtype; /* Response type expected */ -+ -+ /* Data transfer (these may be modified at the low level) */ -+ u16 nob; /* Number of blocks to transfer*/ -+ u16 block_len; /* Block length */ -+ u8 *buffer; /* Data buffer */ -+ u32 cnt; /* Data length, for PIO */ -+ -+ /* Results */ -+ u8 response[18]; /* Buffer to store response - CRC is optional */ -+ enum mmc_result_t result; -+}; -+ -+char * mmc_result_to_string(int); -+int mmc_unpack_csd(struct mmc_request *request, struct mmc_csd *csd); -+int mmc_unpack_r1(struct mmc_request *request, struct mmc_response_r1 *r1, enum card_state state); -+int mmc_unpack_r6(struct mmc_request *request, struct mmc_response_r1 *r1, enum card_state state, int *rca); -+int mmc_unpack_scr(struct mmc_request *request, struct mmc_response_r1 *r1, enum card_state state, u32 *scr); -+int mmc_unpack_cid(struct mmc_request *request, struct mmc_cid *cid); -+int mmc_unpack_r3(struct mmc_request *request, struct mmc_response_r3 *r3); -+ -+void mmc_send_cmd(struct mmc_request *request, int cmd, u32 arg, -+ u16 nob, u16 block_len, enum mmc_rsp_t rtype, u8 *buffer); -+u32 mmc_tran_speed(u8 ts); -+void jz_mmc_set_clock(int sd, u32 rate); -+ -+static inline void mmc_simple_cmd(struct mmc_request *request, int cmd, u32 arg, enum mmc_rsp_t rtype) -+{ -+ mmc_send_cmd( request, cmd, arg, 0, 0, rtype, 0); -+} -+ -+#endif /* __MMC_JZMMC_H__ */ -diff --git a/include/configs/qi_lb60.h b/include/configs/qi_lb60.h -index 7bff444..7b33be0 100644 ---- a/include/configs/qi_lb60.h -+++ b/include/configs/qi_lb60.h -@@ -31,6 +31,15 @@ - /* - * Miscellaneous configurable options - */ -+#define CONFIG_JZ4740_MMC -+#define CONFIG_MMC 1 -+#define CONFIG_FAT 1 -+#define CONFIG_DOS_PARTITION 1 -+#define CONFIG_CMD_MMC -+#define CONFIG_CMD_FAT -+#define CONFIG_CMD_EXT2 -+ -+ - #define CONFIG_SYS_SDRAM_BASE 0x80000000 /* Cached addr */ - #define CONFIG_SYS_INIT_SP_OFFSET 0x400000 - #define CONFIG_SYS_LOAD_ADDR 0x80600000 -diff --git a/include/mmc.h b/include/mmc.h -index a13e2bd..3c4761c 100644 ---- a/include/mmc.h -+++ b/include/mmc.h -@@ -283,4 +283,44 @@ struct mmc *mmc_spi_init(uint bus, uint cs, uint speed, uint mode); - int mmc_legacy_init(int verbose); - #endif - -+struct mmc_csd -+{ -+ u8 csd_structure:2, -+ spec_vers:4, -+ rsvd1:2; -+ u8 taac; -+ u8 nsac; -+ u8 tran_speed; -+ u16 ccc:12, -+ read_bl_len:4; -+ u32 c_size:22; -+ u64 read_bl_partial:1, -+ write_blk_misalign:1, -+ read_blk_misalign:1, -+ dsr_imp:1, -+ rsvd2:2, -+ vdd_r_curr_min:3, -+ vdd_r_curr_max:3, -+ vdd_w_curr_min:3, -+ vdd_w_curr_max:3, -+ c_size_mult:3, -+ sector_size:5, -+ erase_grp_size:5, -+ wp_grp_size:5, -+ wp_grp_enable:1, -+ default_ecc:2, -+ r2w_factor:3, -+ write_bl_len:4, -+ write_bl_partial:1, -+ rsvd3:5; -+ u8 file_format_grp:1, -+ copy:1, -+ perm_write_protect:1, -+ tmp_write_protect:1, -+ file_format:2, -+ ecc:2; -+ u8 crc:7; -+ u8 one:1; -+}; -+ - #endif /* _MMC_H_ */ --- -1.7.9.5 - diff --git a/package/boot/uboot-xburst/patches/0004-add-more-boot-options-F1-F2-F3-F4-M-S.patch b/package/boot/uboot-xburst/patches/0004-add-more-boot-options-F1-F2-F3-F4-M-S.patch deleted file mode 100644 index 73e03243c37a3b..00000000000000 --- a/package/boot/uboot-xburst/patches/0004-add-more-boot-options-F1-F2-F3-F4-M-S.patch +++ /dev/null @@ -1,200 +0,0 @@ -From c52b6168979d03fc31205444c3278c537787472a Mon Sep 17 00:00:00 2001 -From: Xiangfu -Date: Wed, 10 Oct 2012 18:39:55 +0800 -Subject: [PATCH 4/6] add more boot options(F1/F2/F3/F4/M/S) - ---- - arch/mips/include/asm/global_data.h | 3 +++ - arch/mips/lib/bootm.c | 17 ++++++++++++++++- - board/qi/qi_lb60/qi_lb60.c | 26 +++++++++++++++++++++++--- - common/main.c | 21 +++++++++++++++++++-- - include/configs/qi_lb60.h | 32 ++++++++++++++++++++++++++++++++ - 5 files changed, 93 insertions(+), 6 deletions(-) - -diff --git a/arch/mips/include/asm/global_data.h b/arch/mips/include/asm/global_data.h -index 6e2cdc7..cd03d7e 100644 ---- a/arch/mips/include/asm/global_data.h -+++ b/arch/mips/include/asm/global_data.h -@@ -59,6 +59,9 @@ typedef struct global_data { - unsigned long env_valid; /* Checksum of Environment valid? */ - void **jt; /* jump table */ - char env_buf[32]; /* buffer for getenv() before reloc. */ -+#if defined(CONFIG_NANONOTE) -+ unsigned long boot_option; -+#endif - } gd_t; - - #include -diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c -index 608c1a7..e00416b 100644 ---- a/arch/mips/lib/bootm.c -+++ b/arch/mips/lib/bootm.c -@@ -47,10 +47,25 @@ int do_bootm_linux(int flag, int argc, char * const argv[], - bootm_headers_t *images) - { - void (*theKernel) (int, char **, char **, int *); -- char *commandline = getenv("bootargs"); -+ char *commandline; - char env_buf[12]; - char *cp; - -+#if defined(CONFIG_NANONOTE) -+ if (gd->boot_option & BOOT_FROM_MEMCARD) -+ commandline = getenv ("bootargsfromsd"); -+ else if (gd->boot_option & BOOT_WITH_F1) -+ commandline = getenv ("bootargsf1"); -+ else if (gd->boot_option & BOOT_WITH_F2) -+ commandline = getenv ("bootargsf2"); -+ else if (gd->boot_option & BOOT_WITH_F3) -+ commandline = getenv ("bootargsf3"); -+ else if (gd->boot_option & BOOT_WITH_F4) -+ commandline = getenv ("bootargsf4"); -+ else -+#endif -+ commandline = getenv ("bootargs"); -+ - if ((flag != 0) && (flag != BOOTM_STATE_OS_GO)) - return 1; - -diff --git a/board/qi/qi_lb60/qi_lb60.c b/board/qi/qi_lb60/qi_lb60.c -index a2ba648..d622219 100644 ---- a/board/qi/qi_lb60/qi_lb60.c -+++ b/board/qi/qi_lb60/qi_lb60.c -@@ -15,7 +15,7 @@ DECLARE_GLOBAL_DATA_PTR; - - static void gpio_init(void) - { -- unsigned int i; -+ unsigned int i, j; - - /* Initialize NAND Flash Pins */ - __gpio_as_nand(); -@@ -42,14 +42,34 @@ static void gpio_init(void) - - if (__gpio_get_pin(GPIO_KEYIN_BASE + 2) == 0){ - printf("[S] pressed, enable UART0\n"); -+ gd->boot_option |= BOOT_WITH_ENABLE_UART; - __gpio_as_uart0(); - } else { - __gpio_as_input(GPIO_KEYIN_8); - __gpio_enable_pull(GPIO_KEYIN_8); - } - -- /* enable the TP4, TP5 as UART0 */ -- __gpio_jtag_to_uart0(); -+ if (__gpio_get_pin(GPIO_KEYIN_BASE + 3) == 0) { -+ printf("[M] pressed, boot from memory card\n"); -+ gd->boot_option |= BOOT_FROM_MEMCARD; -+ __gpio_jtag_to_uart0(); -+ } -+ -+ for (j = 0; j < 4; j++) { -+ for (i = 0; i < 4; i++) -+ __gpio_set_pin(GPIO_KEYOUT_BASE + i); -+ -+ __gpio_clear_pin(GPIO_KEYOUT_BASE + j); -+ -+ if (__gpio_get_pin(GPIO_KEYIN_BASE) == 0) { -+ printf("[F%d] pressed", (j + 1)); -+ gd->boot_option |= (1 << (j + 2)); -+ /* BOOT_WITH_F1 (1 << 2) */ -+ /* BOOT_WITH_F2 (1 << 3) */ -+ /* BOOT_WITH_F3 (1 << 4) */ -+ /* BOOT_WITH_F4 (1 << 5) */ -+ } -+ } - - __gpio_as_output(GPIO_AUDIO_POP); - __gpio_set_pin(GPIO_AUDIO_POP); -diff --git a/common/main.c b/common/main.c -index 9507cec..dbfb7ca 100644 ---- a/common/main.c -+++ b/common/main.c -@@ -355,7 +355,11 @@ void main_loop (void) - #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) - s = getenv ("bootdelay"); - bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY; -- -+#if defined(CONFIG_NANONOTE) -+ DECLARE_GLOBAL_DATA_PTR; -+ if (gd->boot_option & BOOT_WITH_ENABLE_UART) -+ bootdelay = 3; -+# endif - debug ("### main_loop entered: bootdelay=%d\n\n", bootdelay); - - #if defined(CONFIG_MENU_SHOW) -@@ -379,7 +383,20 @@ void main_loop (void) - } - else - #endif /* CONFIG_BOOTCOUNT_LIMIT */ -- s = getenv ("bootcmd"); -+#if defined(CONFIG_NANONOTE) -+ if (gd->boot_option & BOOT_FROM_MEMCARD) -+ s = getenv ("bootcmdfromsd"); -+ else if (gd->boot_option & BOOT_WITH_F1) -+ s = getenv ("bootcmdf1"); -+ else if (gd->boot_option & BOOT_WITH_F2) -+ s = getenv ("bootcmdf2"); -+ else if (gd->boot_option & BOOT_WITH_F3) -+ s = getenv ("bootcmdf3"); -+ else if (gd->boot_option & BOOT_WITH_F4) -+ s = getenv ("bootcmdf4"); -+ else -+#endif -+ s = getenv ("bootcmd"); - - debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : ""); - -diff --git a/include/configs/qi_lb60.h b/include/configs/qi_lb60.h -index 7b33be0..52b370c 100644 ---- a/include/configs/qi_lb60.h -+++ b/include/configs/qi_lb60.h -@@ -31,6 +31,7 @@ - /* - * Miscellaneous configurable options - */ -+#define CONFIG_NANONOTE - #define CONFIG_JZ4740_MMC - #define CONFIG_MMC 1 - #define CONFIG_FAT 1 -@@ -39,6 +40,37 @@ - #define CONFIG_CMD_FAT - #define CONFIG_CMD_EXT2 - -+#define CONFIG_CMD_UBIFS -+#define CONFIG_CMD_UBI -+#define CONFIG_MTD_PARTITIONS -+#define CONFIG_MTD_DEVICE -+#define CONFIG_CMD_MTDPARTS -+#define CONFIG_CMD_UBI -+#define CONFIG_CMD_UBIFS -+#define CONFIG_LZO -+#define CONFIG_RBTREE -+ -+#define MTDIDS_DEFAULT "nand0=jz4740-nand" -+#define MTDPARTS_DEFAULT "mtdparts=jz4740-nand:4M@0(uboot)ro,4M@4M(kernel)ro,512M@8M(rootfs)ro,-(data)ro" -+ -+#define BOOT_FROM_MEMCARD 1 -+#define BOOT_WITH_ENABLE_UART (1 << 1) /* Vaule for global_data.h gd->boot_option */ -+#define BOOT_WITH_F1 (1 << 2) -+#define BOOT_WITH_F2 (1 << 3) -+#define BOOT_WITH_F3 (1 << 4) -+#define BOOT_WITH_F4 (1 << 5) -+ -+#define CONFIG_EXTRA_ENV_SETTINGS \ -+ "bootcmdfromsd=mmc init; ext2load mmc 0 0x80600000 /boot/uImage; bootm;\0" \ -+ "bootargsfromsd=mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p1 rw rootwait\0" \ -+ "bootcmdf1=mmc init; ext2load mmc 0:1 0x80600000 /boot/uImage; bootm;\0" \ -+ "bootargsf1=mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p1 rw rootwait\0" \ -+ "bootcmdf2=mmc init; ext2load mmc 0:2 0x80600000 /boot/uImage; bootm;\0" \ -+ "bootargsf2=mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p2 rw rootwait\0" \ -+ "bootcmdf3=mmc init; ext2load mmc 0:3 0x80600000 /boot/uImage; bootm;\0" \ -+ "bootargsf3=mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p3 rw rootwait\0" \ -+ "bootcmdf4=mtdparts default;ubi part rootfs;ubifsmount rootfs;ubifsload 0x80600000 /boot/uImage; bootm;\0" \ -+ "bootargsf4=mem=32M console=tty0 console=ttyS0,57600n8 ubi.mtd=2 rootfstype=ubifs root=ubi0:rootfs rw rootwait" - - #define CONFIG_SYS_SDRAM_BASE 0x80000000 /* Cached addr */ - #define CONFIG_SYS_INIT_SP_OFFSET 0x400000 --- -1.7.9.5 - diff --git a/package/boot/uboot-xburst/patches/0005-add-nanonote-lcd-support.patch b/package/boot/uboot-xburst/patches/0005-add-nanonote-lcd-support.patch deleted file mode 100644 index 2c550f720555f8..00000000000000 --- a/package/boot/uboot-xburst/patches/0005-add-nanonote-lcd-support.patch +++ /dev/null @@ -1,847 +0,0 @@ -From ca8c5216cfd3ad3fda9867ed2d157ae5a209834b Mon Sep 17 00:00:00 2001 -From: Xiangfu -Date: Wed, 10 Oct 2012 22:05:27 +0800 -Subject: [PATCH 5/6] add nanonote lcd support - ---- - arch/mips/include/asm/global_data.h | 1 + - arch/mips/include/asm/jz4740.h | 90 ++++++++ - arch/mips/lib/board.c | 6 + - common/lcd.c | 9 +- - drivers/video/Makefile | 1 + - drivers/video/nanonote_gpm940b0.c | 400 +++++++++++++++++++++++++++++++++++ - drivers/video/nanonote_gpm940b0.h | 135 ++++++++++++ - include/configs/qi_lb60.h | 7 + - include/lcd.h | 52 ++++- - 9 files changed, 697 insertions(+), 4 deletions(-) - create mode 100644 drivers/video/nanonote_gpm940b0.c - create mode 100644 drivers/video/nanonote_gpm940b0.h - -diff --git a/arch/mips/include/asm/global_data.h b/arch/mips/include/asm/global_data.h -index cd03d7e..7cec2de 100644 ---- a/arch/mips/include/asm/global_data.h -+++ b/arch/mips/include/asm/global_data.h -@@ -44,6 +44,7 @@ typedef struct global_data { - unsigned long per_clk; /* Peripheral bus clock */ - unsigned long mem_clk; /* Memory bus clock */ - unsigned long dev_clk; /* Device clock */ -+ unsigned long fb_base; /* base address of framebuffer */ - /* "static data" needed by most of timer.c */ - unsigned long tbl; - unsigned long lastinc; -diff --git a/arch/mips/include/asm/jz4740.h b/arch/mips/include/asm/jz4740.h -index 68287fb..13724a2 100644 ---- a/arch/mips/include/asm/jz4740.h -+++ b/arch/mips/include/asm/jz4740.h -@@ -1312,5 +1312,95 @@ do { \ - while (REG_MSC_STAT & MSC_STAT_IS_RESETTING); \ - } while (0) - -+/************************************************************************* -+ * LCD (LCD Controller) -+ *************************************************************************/ -+#define REG32(addr) *((volatile u32 *)(addr)) -+ -+#define CPM_BASE 0xB0000000 -+#define CPM_CPCCR (CPM_BASE+0x00) -+#define REG_CPM_CPCCR REG32(CPM_CPCCR) -+ -+#define LCD_BASE 0xB3050000 -+#define LCD_CFG (LCD_BASE + 0x00) /* LCD Configure Register */ -+#define LCD_VSYNC (LCD_BASE + 0x04) /* Vertical Synchronize Register */ -+#define LCD_HSYNC (LCD_BASE + 0x08) /* Horizontal Synchronize Register */ -+#define LCD_VAT (LCD_BASE + 0x0c) /* Virtual Area Setting Register */ -+#define LCD_DAH (LCD_BASE + 0x10) /* Display Area Horizontal Start/End Point */ -+#define LCD_DAV (LCD_BASE + 0x14) /* Display Area Vertical Start/End Point */ -+#define LCD_PS (LCD_BASE + 0x18) /* PS Signal Setting */ -+#define LCD_CLS (LCD_BASE + 0x1c) /* CLS Signal Setting */ -+#define LCD_SPL (LCD_BASE + 0x20) /* SPL Signal Setting */ -+#define LCD_REV (LCD_BASE + 0x24) /* REV Signal Setting */ -+#define LCD_CTRL (LCD_BASE + 0x30) /* LCD Control Register */ -+#define LCD_STATE (LCD_BASE + 0x34) /* LCD Status Register */ -+#define LCD_IID (LCD_BASE + 0x38) /* Interrupt ID Register */ -+#define LCD_DA0 (LCD_BASE + 0x40) /* Descriptor Address Register 0 */ -+#define LCD_SA0 (LCD_BASE + 0x44) /* Source Address Register 0 */ -+#define LCD_FID0 (LCD_BASE + 0x48) /* Frame ID Register 0 */ -+#define LCD_CMD0 (LCD_BASE + 0x4c) /* DMA Command Register 0 */ -+#define LCD_DA1 (LCD_BASE + 0x50) /* Descriptor Address Register 1 */ -+#define LCD_SA1 (LCD_BASE + 0x54) /* Source Address Register 1 */ -+#define LCD_FID1 (LCD_BASE + 0x58) /* Frame ID Register 1 */ -+#define LCD_CMD1 (LCD_BASE + 0x5c) /* DMA Command Register 1 */ -+ -+#define REG_LCD_CFG REG32(LCD_CFG) -+#define REG_LCD_VSYNC REG32(LCD_VSYNC) -+#define REG_LCD_HSYNC REG32(LCD_HSYNC) -+#define REG_LCD_VAT REG32(LCD_VAT) -+#define REG_LCD_DAH REG32(LCD_DAH) -+#define REG_LCD_DAV REG32(LCD_DAV) -+#define REG_LCD_PS REG32(LCD_PS) -+#define REG_LCD_CLS REG32(LCD_CLS) -+#define REG_LCD_SPL REG32(LCD_SPL) -+#define REG_LCD_REV REG32(LCD_REV) -+#define REG_LCD_CTRL REG32(LCD_CTRL) -+#define REG_LCD_STATE REG32(LCD_STATE) -+#define REG_LCD_IID REG32(LCD_IID) -+#define REG_LCD_DA0 REG32(LCD_DA0) -+#define REG_LCD_SA0 REG32(LCD_SA0) -+#define REG_LCD_FID0 REG32(LCD_FID0) -+#define REG_LCD_CMD0 REG32(LCD_CMD0) -+#define REG_LCD_DA1 REG32(LCD_DA1) -+#define REG_LCD_SA1 REG32(LCD_SA1) -+#define REG_LCD_FID1 REG32(LCD_FID1) -+#define REG_LCD_CMD1 REG32(LCD_CMD1) -+ -+#define LCD_CTRL_BPP_BIT 0 /* Bits Per Pixel */ -+#define LCD_CTRL_BPP_MASK (0x07 << LCD_CTRL_BPP_BIT) -+ #define LCD_CTRL_BPP_1 (0 << LCD_CTRL_BPP_BIT) /* 1 bpp */ -+ #define LCD_CTRL_BPP_2 (1 << LCD_CTRL_BPP_BIT) /* 2 bpp */ -+ #define LCD_CTRL_BPP_4 (2 << LCD_CTRL_BPP_BIT) /* 4 bpp */ -+ #define LCD_CTRL_BPP_8 (3 << LCD_CTRL_BPP_BIT) /* 8 bpp */ -+ #define LCD_CTRL_BPP_16 (4 << LCD_CTRL_BPP_BIT) /* 15/16 bpp */ -+ #define LCD_CTRL_BPP_18_24 (5 << LCD_CTRL_BPP_BIT) /* 18/24/32 bpp */ -+ -+#define LCD_CTRL_BST_BIT 28 /* Burst Length Selection */ -+#define LCD_CTRL_BST_MASK (0x03 << LCD_CTRL_BST_BIT) -+ #define LCD_CTRL_BST_4 (0 << LCD_CTRL_BST_BIT) /* 4-word */ -+ #define LCD_CTRL_BST_8 (1 << LCD_CTRL_BST_BIT) /* 8-word */ -+ #define LCD_CTRL_BST_16 (2 << LCD_CTRL_BST_BIT) /* 16-word */ -+#define LCD_CTRL_RGB565 (0 << 27) /* RGB565 mode */ -+#define LCD_CTRL_RGB555 (1 << 27) /* RGB555 mode */ -+#define LCD_CTRL_OFUP (1 << 26) /* Output FIFO underrun protection enable */ -+#define LCD_CTRL_FRC_BIT 24 /* STN FRC Algorithm Selection */ -+#define LCD_CTRL_FRC_MASK (0x03 << LCD_CTRL_FRC_BIT) -+ #define LCD_CTRL_FRC_16 (0 << LCD_CTRL_FRC_BIT) /* 16 grayscale */ -+ #define LCD_CTRL_FRC_4 (1 << LCD_CTRL_FRC_BIT) /* 4 grayscale */ -+ #define LCD_CTRL_FRC_2 (2 << LCD_CTRL_FRC_BIT) /* 2 grayscale */ -+ -+#define CPM_LPCDR (CPM_BASE+0x64) -+#define CPM_CLKGR (CPM_BASE+0x20) -+#define REG_CPM_LPCDR REG32(CPM_LPCDR) -+#define REG_CPM_CLKGR REG32(CPM_CLKGR) -+ -+#define __cpm_start_tcu() (REG_CPM_CLKGR &= ~CPM_CLKGR_TCU) -+#define __cpm_stop_lcd() (REG_CPM_CLKGR |= CPM_CLKGR_LCD) -+#define __cpm_set_pixdiv(v) \ -+ (REG_CPM_LPCDR = (REG_CPM_LPCDR & ~CPM_LPCDR_PIXDIV_MASK) | ((v) << (CPM_LPCDR_PIXDIV_BIT))) -+#define __cpm_set_ldiv(v) \ -+ (REG_CPM_CPCCR = (REG_CPM_CPCCR & ~CPM_CPCCR_LDIV_MASK) | ((v) << (CPM_CPCCR_LDIV_BIT))) -+#define __cpm_start_lcd() (REG_CPM_CLKGR &= ~CPM_CLKGR_LCD) -+ - #endif /* !__ASSEMBLY__ */ - #endif /* __JZ4740_H__ */ -diff --git a/arch/mips/lib/board.c b/arch/mips/lib/board.c -index b14b33e..c2e64d9 100644 ---- a/arch/mips/lib/board.c -+++ b/arch/mips/lib/board.c -@@ -172,6 +172,12 @@ void board_init_f(ulong bootflag) - addr &= ~(4096 - 1); - debug("Top of RAM usable for U-Boot at: %08lx\n", addr); - -+#ifdef CONFIG_LCD -+ /* reserve memory for LCD display (always full pages) */ -+ addr = lcd_setmem (addr); -+ gd->fb_base = addr; -+#endif /* CONFIG_LCD */ -+ - /* Reserve memory for U-Boot code, data & bss - * round down to next 16 kB limit - */ -diff --git a/common/lcd.c b/common/lcd.c -index b6be800..af1281a 100644 ---- a/common/lcd.c -+++ b/common/lcd.c -@@ -263,6 +263,13 @@ static void lcd_drawchars(ushort x, ushort y, uchar *str, int count) - lcd_color_fg : lcd_color_bg; - bits <<= 1; - } -+#elif LCD_BPP == LCD_COLOR32 -+ uint *m = (uint *)d; -+ for (c=0; c<32; ++c) { -+ *m++ = (bits & 0x80) ? -+ lcd_color_fg : lcd_color_bg; -+ bits <<= 1; -+ } - #endif - } - #if LCD_BPP == LCD_MONOCHROME -@@ -509,7 +516,7 @@ static inline ushort *configuration_get_cmap(void) - return (ushort *)&(cp->lcd_cmap[255 * sizeof(ushort)]); - #elif defined(CONFIG_ATMEL_LCD) - return (ushort *)(panel_info.mmio + ATMEL_LCDC_LUT(0)); --#elif !defined(CONFIG_ATMEL_HLCD) && !defined(CONFIG_EXYNOS_FB) -+#elif !defined(CONFIG_ATMEL_HLCD) && !defined(CONFIG_EXYNOS_FB) && !defined(CONFIG_VIDEO_GPM940B0) - return panel_info.cmap; - #else - #if defined(CONFIG_LCD_LOGO) -diff --git a/drivers/video/Makefile b/drivers/video/Makefile -index ebb6da8..03625bc 100644 ---- a/drivers/video/Makefile -+++ b/drivers/video/Makefile -@@ -50,6 +50,7 @@ COBJS-$(CONFIG_VIDEO_SED13806) += sed13806.o - COBJS-$(CONFIG_VIDEO_SM501) += sm501.o - COBJS-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o videomodes.o - COBJS-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o -+COBJS-$(CONFIG_VIDEO_GPM940B0) += nanonote_gpm940b0.o - - COBJS := $(sort $(COBJS-y)) - SRCS := $(COBJS:.o=.c) -diff --git a/drivers/video/nanonote_gpm940b0.c b/drivers/video/nanonote_gpm940b0.c -new file mode 100644 -index 0000000..11efb72 ---- /dev/null -+++ b/drivers/video/nanonote_gpm940b0.c -@@ -0,0 +1,400 @@ -+/* -+ * JzRISC lcd controller -+ * -+ * Xiangfu Liu -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ * -+ * 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+ -+#include -+#include -+#include -+ -+#include /* virt_to_phys() */ -+#include -+ -+#include "nanonote_gpm940b0.h" -+ -+#define align2(n) (n)=((((n)+1)>>1)<<1) -+#define align4(n) (n)=((((n)+3)>>2)<<2) -+#define align8(n) (n)=((((n)+7)>>3)<<3) -+ -+struct jzfb_info { -+ unsigned int cfg; /* panel mode and pin usage etc. */ -+ unsigned int w; -+ unsigned int h; -+ unsigned int bpp; /* bit per pixel */ -+ unsigned int fclk; /* frame clk */ -+ unsigned int hsw; /* hsync width, in pclk */ -+ unsigned int vsw; /* vsync width, in line count */ -+ unsigned int elw; /* end of line, in pclk */ -+ unsigned int blw; /* begin of line, in pclk */ -+ unsigned int efw; /* end of frame, in line count */ -+ unsigned int bfw; /* begin of frame, in line count */ -+}; -+ -+static struct jzfb_info jzfb = { -+ MODE_8BIT_SERIAL_TFT | PCLK_N | HSYNC_N | VSYNC_N, -+ 320, 240, 32, 70, 1, 1, 273, 140, 1, 20 -+}; -+ -+vidinfo_t panel_info = { -+ 320, 240, LCD_BPP, -+}; -+ -+void *lcd_base; -+void *lcd_console_address; -+int lcd_line_length; -+int lcd_color_fg; -+int lcd_color_bg; -+short console_col; -+short console_row; -+ -+static int jz_lcd_init_mem(void *lcdbase, vidinfo_t *vid) -+{ -+ u_long palette_mem_size; -+ struct jz_fb_info *fbi = &vid->jz_fb; -+ int fb_size = vid->vl_row * (vid->vl_col * NBITS (vid->vl_bpix)) / 8; -+ -+ fbi->screen = (u_long)lcdbase; -+ fbi->palette_size = 256; -+ palette_mem_size = fbi->palette_size * sizeof(u16); -+ -+ debug("jz_lcd.c palette_mem_size = 0x%08lx\n", (u_long) palette_mem_size); -+ /* locate palette and descs at end of page following fb */ -+ fbi->palette = (u_long)lcdbase + fb_size + PAGE_SIZE - palette_mem_size; -+ -+ return 0; -+} -+ -+static void jz_lcd_desc_init(vidinfo_t *vid) -+{ -+ struct jz_fb_info * fbi; -+ fbi = &vid->jz_fb; -+ fbi->dmadesc_fblow = (struct jz_fb_dma_descriptor *)((unsigned int)fbi->palette - 3*16); -+ fbi->dmadesc_fbhigh = (struct jz_fb_dma_descriptor *)((unsigned int)fbi->palette - 2*16); -+ fbi->dmadesc_palette = (struct jz_fb_dma_descriptor *)((unsigned int)fbi->palette - 1*16); -+ -+ #define BYTES_PER_PANEL (vid->vl_col * vid->vl_row * NBITS(vid->vl_bpix) / 8) -+ -+ /* populate descriptors */ -+ fbi->dmadesc_fblow->fdadr = virt_to_phys(fbi->dmadesc_fblow); -+ fbi->dmadesc_fblow->fsadr = virt_to_phys((void *)(fbi->screen + BYTES_PER_PANEL)); -+ fbi->dmadesc_fblow->fidr = 0; -+ fbi->dmadesc_fblow->ldcmd = BYTES_PER_PANEL / 4 ; -+ -+ fbi->fdadr1 = virt_to_phys(fbi->dmadesc_fblow); /* only used in dual-panel mode */ -+ -+ fbi->dmadesc_fbhigh->fsadr = virt_to_phys((void *)fbi->screen); -+ fbi->dmadesc_fbhigh->fidr = 0; -+ fbi->dmadesc_fbhigh->ldcmd = BYTES_PER_PANEL / 4; /* length in word */ -+ -+ fbi->dmadesc_palette->fsadr = virt_to_phys((void *)fbi->palette); -+ fbi->dmadesc_palette->fidr = 0; -+ fbi->dmadesc_palette->ldcmd = (fbi->palette_size * 2)/4 | (1<<28); -+ -+ if(NBITS(vid->vl_bpix) < 12) { -+ /* assume any mode with <12 bpp is palette driven */ -+ fbi->dmadesc_palette->fdadr = virt_to_phys(fbi->dmadesc_fbhigh); -+ fbi->dmadesc_fbhigh->fdadr = virt_to_phys(fbi->dmadesc_palette); -+ /* flips back and forth between pal and fbhigh */ -+ fbi->fdadr0 = virt_to_phys(fbi->dmadesc_palette); -+ } else { -+ /* palette shouldn't be loaded in true-color mode */ -+ fbi->dmadesc_fbhigh->fdadr = virt_to_phys((void *)fbi->dmadesc_fbhigh); -+ fbi->fdadr0 = virt_to_phys(fbi->dmadesc_fbhigh); /* no pal just fbhigh */ -+ } -+} -+ -+static int jz_lcd_hw_init(vidinfo_t *vid) -+{ -+ struct jz_fb_info *fbi = &vid->jz_fb; -+ unsigned int val = 0; -+ unsigned int pclk; -+ unsigned int stnH; -+ int pll_div; -+ -+ /* Setting Control register */ -+ switch (jzfb.bpp) { -+ case 1: -+ val |= LCD_CTRL_BPP_1; -+ break; -+ case 2: -+ val |= LCD_CTRL_BPP_2; -+ break; -+ case 4: -+ val |= LCD_CTRL_BPP_4; -+ break; -+ case 8: -+ val |= LCD_CTRL_BPP_8; -+ break; -+ case 15: -+ val |= LCD_CTRL_RGB555; -+ case 16: -+ val |= LCD_CTRL_BPP_16; -+ break; -+ case 17 ... 32: -+ val |= LCD_CTRL_BPP_18_24; /* target is 4bytes/pixel */ -+ break; -+ -+ default: -+ printf("jz_lcd.c The BPP %d is not supported\n", jzfb.bpp); -+ val |= LCD_CTRL_BPP_16; -+ break; -+ } -+ -+ switch (jzfb.cfg & MODE_MASK) { -+ case MODE_STN_MONO_DUAL: -+ case MODE_STN_COLOR_DUAL: -+ case MODE_STN_MONO_SINGLE: -+ case MODE_STN_COLOR_SINGLE: -+ switch (jzfb.bpp) { -+ case 1: -+ /* val |= LCD_CTRL_PEDN; */ -+ case 2: -+ val |= LCD_CTRL_FRC_2; -+ break; -+ case 4: -+ val |= LCD_CTRL_FRC_4; -+ break; -+ case 8: -+ default: -+ val |= LCD_CTRL_FRC_16; -+ break; -+ } -+ break; -+ } -+ -+ val |= LCD_CTRL_BST_16; /* Burst Length is 16WORD=64Byte */ -+ val |= LCD_CTRL_OFUP; /* OutFIFO underrun protect */ -+ -+ switch (jzfb.cfg & MODE_MASK) { -+ case MODE_STN_MONO_DUAL: -+ case MODE_STN_COLOR_DUAL: -+ case MODE_STN_MONO_SINGLE: -+ case MODE_STN_COLOR_SINGLE: -+ switch (jzfb.cfg & STN_DAT_PINMASK) { -+ case STN_DAT_PIN1: -+ /* Do not adjust the hori-param value. */ -+ break; -+ case STN_DAT_PIN2: -+ align2(jzfb.hsw); -+ align2(jzfb.elw); -+ align2(jzfb.blw); -+ break; -+ case STN_DAT_PIN4: -+ align4(jzfb.hsw); -+ align4(jzfb.elw); -+ align4(jzfb.blw); -+ break; -+ case STN_DAT_PIN8: -+ align8(jzfb.hsw); -+ align8(jzfb.elw); -+ align8(jzfb.blw); -+ break; -+ } -+ break; -+ } -+ -+ REG_LCD_CTRL = val; -+ -+ switch (jzfb.cfg & MODE_MASK) { -+ case MODE_STN_MONO_DUAL: -+ case MODE_STN_COLOR_DUAL: -+ case MODE_STN_MONO_SINGLE: -+ case MODE_STN_COLOR_SINGLE: -+ if (((jzfb.cfg & MODE_MASK) == MODE_STN_MONO_DUAL) || -+ ((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_DUAL)) -+ stnH = jzfb.h >> 1; -+ else -+ stnH = jzfb.h; -+ -+ REG_LCD_VSYNC = (0 << 16) | jzfb.vsw; -+ REG_LCD_HSYNC = ((jzfb.blw+jzfb.w) << 16) | (jzfb.blw+jzfb.w+jzfb.hsw); -+ -+ /* Screen setting */ -+ REG_LCD_VAT = ((jzfb.blw + jzfb.w + jzfb.hsw + jzfb.elw) << 16) | (stnH + jzfb.vsw + jzfb.bfw + jzfb.efw); -+ REG_LCD_DAH = (jzfb.blw << 16) | (jzfb.blw + jzfb.w); -+ REG_LCD_DAV = (0 << 16) | (stnH); -+ -+ /* AC BIAs signal */ -+ REG_LCD_PS = (0 << 16) | (stnH+jzfb.vsw+jzfb.efw+jzfb.bfw); -+ -+ break; -+ -+ case MODE_TFT_GEN: -+ case MODE_TFT_SHARP: -+ case MODE_TFT_CASIO: -+ case MODE_TFT_SAMSUNG: -+ case MODE_8BIT_SERIAL_TFT: -+ case MODE_TFT_18BIT: -+ REG_LCD_VSYNC = (0 << 16) | jzfb.vsw; -+ REG_LCD_HSYNC = (0 << 16) | jzfb.hsw; -+ REG_LCD_DAV =((jzfb.vsw+jzfb.bfw) << 16) | (jzfb.vsw +jzfb.bfw+jzfb.h); -+ REG_LCD_DAH = ((jzfb.hsw + jzfb.blw) << 16) | (jzfb.hsw + jzfb.blw + jzfb.w ); -+ REG_LCD_VAT = (((jzfb.blw + jzfb.w + jzfb.elw + jzfb.hsw)) << 16) \ -+ | (jzfb.vsw + jzfb.bfw + jzfb.h + jzfb.efw); -+ break; -+ } -+ -+ switch (jzfb.cfg & MODE_MASK) { -+ case MODE_TFT_SAMSUNG: -+ { -+ unsigned int total, tp_s, tp_e, ckv_s, ckv_e; -+ unsigned int rev_s, rev_e, inv_s, inv_e; -+ -+ pclk = val * (jzfb.w + jzfb.hsw + jzfb.elw + jzfb.blw) * -+ (jzfb.h + jzfb.vsw + jzfb.efw + jzfb.bfw); /* Pixclk */ -+ -+ total = jzfb.blw + jzfb.w + jzfb.elw + jzfb.hsw; -+ tp_s = jzfb.blw + jzfb.w + 1; -+ tp_e = tp_s + 1; -+ ckv_s = tp_s - pclk/(1000000000/4100); -+ ckv_e = tp_s + total; -+ rev_s = tp_s - 11; /* -11.5 clk */ -+ rev_e = rev_s + total; -+ inv_s = tp_s; -+ inv_e = inv_s + total; -+ REG_LCD_CLS = (tp_s << 16) | tp_e; -+ REG_LCD_PS = (ckv_s << 16) | ckv_e; -+ REG_LCD_SPL = (rev_s << 16) | rev_e; -+ REG_LCD_REV = (inv_s << 16) | inv_e; -+ jzfb.cfg |= STFT_REVHI | STFT_SPLHI; -+ break; -+ } -+ case MODE_TFT_SHARP: -+ { -+ unsigned int total, cls_s, cls_e, ps_s, ps_e; -+ unsigned int spl_s, spl_e, rev_s, rev_e; -+ total = jzfb.blw + jzfb.w + jzfb.elw + jzfb.hsw; -+ spl_s = 1; -+ spl_e = spl_s + 1; -+ cls_s = 0; -+ cls_e = total - 60; /* > 4us (pclk = 80ns) */ -+ ps_s = cls_s; -+ ps_e = cls_e; -+ rev_s = total - 40; /* > 3us (pclk = 80ns) */ -+ rev_e = rev_s + total; -+ jzfb.cfg |= STFT_PSHI; -+ REG_LCD_SPL = (spl_s << 16) | spl_e; -+ REG_LCD_CLS = (cls_s << 16) | cls_e; -+ REG_LCD_PS = (ps_s << 16) | ps_e; -+ REG_LCD_REV = (rev_s << 16) | rev_e; -+ break; -+ } -+ case MODE_TFT_CASIO: -+ break; -+ } -+ -+ /* Configure the LCD panel */ -+ REG_LCD_CFG = jzfb.cfg; -+ -+ /* Timing setting */ -+ __cpm_stop_lcd(); -+ -+ val = jzfb.fclk; /* frame clk */ -+ if ( (jzfb.cfg & MODE_MASK) != MODE_8BIT_SERIAL_TFT) { -+ pclk = val * (jzfb.w + jzfb.hsw + jzfb.elw + jzfb.blw) * -+ (jzfb.h + jzfb.vsw + jzfb.efw + jzfb.bfw); /* Pixclk */ -+ } else { -+ /* serial mode: Hsync period = 3*Width_Pixel */ -+ pclk = val * (jzfb.w*3 + jzfb.hsw + jzfb.elw + jzfb.blw) * -+ (jzfb.h + jzfb.vsw + jzfb.efw + jzfb.bfw); /* Pixclk */ -+ } -+ -+ if (((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_SINGLE) || -+ ((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_DUAL)) -+ pclk = (pclk * 3); -+ -+ if (((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_SINGLE) || -+ ((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_DUAL) || -+ ((jzfb.cfg & MODE_MASK) == MODE_STN_MONO_SINGLE) || -+ ((jzfb.cfg & MODE_MASK) == MODE_STN_MONO_DUAL)) -+ pclk = pclk >> ((jzfb.cfg & STN_DAT_PINMASK) >> 4); -+ -+ if (((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_DUAL) || -+ ((jzfb.cfg & MODE_MASK) == MODE_STN_MONO_DUAL)) -+ pclk >>= 1; -+ -+ pll_div = (REG_CPM_CPCCR & CPM_CPCCR_PCS); /* clock source,0:pllout/2 1: pllout */ -+ pll_div = pll_div ? 1 : 2; -+ val = (__cpm_get_pllout() / pll_div) / pclk; -+ val--; -+ if (val > 0x1ff) { -+ printf("CPM_LPCDR too large, set it to 0x1ff\n"); -+ val = 0x1ff; -+ } -+ __cpm_set_pixdiv(val); -+ -+ val = pclk * 3 ; /* LCDClock > 2.5*Pixclock */ -+ if (val > 150000000) { -+ printf("Warning: LCDClock=%d\n, LCDClock must less or equal to 150MHz.\n", val); -+ printf("Change LCDClock to 150MHz\n"); -+ val = 150000000; -+ } -+ val = (__cpm_get_pllout() / pll_div) / val; -+ val--; -+ if (val > 0x1f) { -+ printf("CPM_CPCCR.LDIV too large, set it to 0x1f\n"); -+ val = 0x1f; -+ } -+ __cpm_set_ldiv( val ); -+ REG_CPM_CPCCR |= CPM_CPCCR_CE ; /* update divide */ -+ -+ __cpm_start_lcd(); -+ udelay(1000); -+ -+ REG_LCD_DA0 = fbi->fdadr0; /* frame descripter*/ -+ -+ if (((jzfb.cfg & MODE_MASK) == MODE_STN_COLOR_DUAL) || -+ ((jzfb.cfg & MODE_MASK) == MODE_STN_MONO_DUAL)) -+ REG_LCD_DA1 = fbi->fdadr1; /* frame descripter*/ -+ -+ return 0; -+} -+ -+void lcd_ctrl_init (void *lcdbase) -+{ -+ __lcd_display_pin_init(); -+ __lcd_display_on() ; -+ -+ jz_lcd_init_mem(lcdbase, &panel_info); -+ jz_lcd_desc_init(&panel_info); -+ jz_lcd_hw_init(&panel_info); -+ -+} -+ -+/* -+ * Before enabled lcd controller, lcd registers should be configured correctly. -+ */ -+void lcd_enable (void) -+{ -+ REG_LCD_CTRL &= ~(1<<4); /* LCDCTRL.DIS */ -+ REG_LCD_CTRL |= 1<<3; /* LCDCTRL.ENA*/ -+} -+ -+void lcd_disable (void) -+{ -+ REG_LCD_CTRL |= (1<<4); -+} -+ -+void lcd_setcolreg (ushort regno, ushort red, ushort green, ushort blue) -+{ -+} -+ -+void lcd_initcolregs (void) -+{ -+} -diff --git a/drivers/video/nanonote_gpm940b0.h b/drivers/video/nanonote_gpm940b0.h -new file mode 100644 -index 0000000..efe491e ---- /dev/null -+++ b/drivers/video/nanonote_gpm940b0.h -@@ -0,0 +1,135 @@ -+/* -+ * JzRISC lcd controller -+ * -+ * Xiangfu Liu -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ * -+ * 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. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+ -+#ifndef __QI_LB60_GPM940B0_H__ -+#define __QI_LB60_GPM940B0_H__ -+ -+struct lcd_desc{ -+ unsigned int next_desc; /* LCDDAx */ -+ unsigned int databuf; /* LCDSAx */ -+ unsigned int frame_id; /* LCDFIDx */ -+ unsigned int cmd; /* LCDCMDx */ -+}; -+ -+#define MODE_MASK 0x0f -+#define MODE_TFT_GEN 0x00 -+#define MODE_TFT_SHARP 0x01 -+#define MODE_TFT_CASIO 0x02 -+#define MODE_TFT_SAMSUNG 0x03 -+#define MODE_CCIR656_NONINT 0x04 -+#define MODE_CCIR656_INT 0x05 -+#define MODE_STN_COLOR_SINGLE 0x08 -+#define MODE_STN_MONO_SINGLE 0x09 -+#define MODE_STN_COLOR_DUAL 0x0a -+#define MODE_STN_MONO_DUAL 0x0b -+#define MODE_8BIT_SERIAL_TFT 0x0c -+ -+#define MODE_TFT_18BIT (1<<7) -+ -+#define STN_DAT_PIN1 (0x00 << 4) -+#define STN_DAT_PIN2 (0x01 << 4) -+#define STN_DAT_PIN4 (0x02 << 4) -+#define STN_DAT_PIN8 (0x03 << 4) -+#define STN_DAT_PINMASK STN_DAT_PIN8 -+ -+#define STFT_PSHI (1 << 15) -+#define STFT_CLSHI (1 << 14) -+#define STFT_SPLHI (1 << 13) -+#define STFT_REVHI (1 << 12) -+ -+#define SYNC_MASTER (0 << 16) -+#define SYNC_SLAVE (1 << 16) -+ -+#define DE_P (0 << 9) -+#define DE_N (1 << 9) -+ -+#define PCLK_P (0 << 10) -+#define PCLK_N (1 << 10) -+ -+#define HSYNC_P (0 << 11) -+#define HSYNC_N (1 << 11) -+ -+#define VSYNC_P (0 << 8) -+#define VSYNC_N (1 << 8) -+ -+#define DATA_NORMAL (0 << 17) -+#define DATA_INVERSE (1 << 17) -+ -+ -+/* Jz LCDFB supported I/O controls. */ -+#define FBIOSETBACKLIGHT 0x4688 -+#define FBIODISPON 0x4689 -+#define FBIODISPOFF 0x468a -+#define FBIORESET 0x468b -+#define FBIOPRINT_REG 0x468c -+ -+/* -+ * LCD panel specific definition -+ */ -+#define MODE (0xc9) /* 8bit serial RGB */ -+ -+#define __spi_write_reg1(reg, val) \ -+do { \ -+ unsigned char no; \ -+ unsigned short value; \ -+ unsigned char a=reg; \ -+ unsigned char b=val; \ -+ __gpio_set_pin(SPEN); \ -+ __gpio_set_pin(SPCK); \ -+ __gpio_clear_pin(SPDA); \ -+ __gpio_clear_pin(SPEN); \ -+ value=((a<<8)|(b&0xFF)); \ -+ for(no=0;no<16;no++) \ -+ { \ -+ __gpio_clear_pin(SPCK); \ -+ if((value&0x8000)==0x8000) \ -+ __gpio_set_pin(SPDA); \ -+ else \ -+ __gpio_clear_pin(SPDA); \ -+ __gpio_set_pin(SPCK); \ -+ value=(value<<1); \ -+ } \ -+ __gpio_set_pin(SPEN); \ -+} while (0) -+ -+#define __lcd_display_pin_init() \ -+do { \ -+ __cpm_start_tcu(); \ -+ __gpio_as_output(SPEN); /* use SPDA */ \ -+ __gpio_as_output(SPCK); /* use SPCK */ \ -+ __gpio_as_output(SPDA); /* use SPDA */ \ -+} while (0) -+ -+#define __lcd_display_on() \ -+do { \ -+ __spi_write_reg1(0x05, 0x1e); \ -+ __spi_write_reg1(0x05, 0x5e); \ -+ __spi_write_reg1(0x07, 0x8d); \ -+ __spi_write_reg1(0x13, 0x01); \ -+ __spi_write_reg1(0x05, 0x5f); \ -+} while (0) -+ -+#define __lcd_display_off() \ -+do { \ -+ __spi_write_reg1(0x05, 0x5e); \ -+} while (0) -+ -+#endif /* __QI_LB60_GPM940B0_H__ */ -diff --git a/include/configs/qi_lb60.h b/include/configs/qi_lb60.h -index 52b370c..d3e78ad 100644 ---- a/include/configs/qi_lb60.h -+++ b/include/configs/qi_lb60.h -@@ -32,6 +32,13 @@ - * Miscellaneous configurable options - */ - #define CONFIG_NANONOTE -+ -+#define CONFIG_LCD -+#define CONFIG_SYS_WHITE_ON_BLACK -+#define LCD_BPP LCD_COLOR32 -+#define CONFIG_VIDEO_GPM940B0 -+ -+ - #define CONFIG_JZ4740_MMC - #define CONFIG_MMC 1 - #define CONFIG_FAT 1 -diff --git a/include/lcd.h b/include/lcd.h -index 42070d7..6de5482 100644 ---- a/include/lcd.h -+++ b/include/lcd.h -@@ -263,8 +263,44 @@ typedef struct vidinfo { - - void init_panel_info(vidinfo_t *vid); - --#else -+#elif defined(CONFIG_JZSOC) -+/* -+ * LCD controller stucture for JZSOC: JZ4740 -+ */ -+struct jz_fb_dma_descriptor { -+ u_long fdadr; /* Frame descriptor address register */ -+ u_long fsadr; /* Frame source address register */ -+ u_long fidr; /* Frame ID register */ -+ u_long ldcmd; /* Command register */ -+}; -+ -+/* -+ * Jz LCD info -+ */ -+struct jz_fb_info { -+ -+ u_long fdadr0; /* physical address of frame/palette descriptor */ -+ u_long fdadr1; /* physical address of frame descriptor */ -+ -+ /* DMA descriptors */ -+ struct jz_fb_dma_descriptor * dmadesc_fblow; -+ struct jz_fb_dma_descriptor * dmadesc_fbhigh; -+ struct jz_fb_dma_descriptor * dmadesc_palette; -+ u_long screen; /* address of frame buffer */ -+ u_long palette; /* address of palette memory */ -+ u_int palette_size; -+}; -+typedef struct vidinfo { -+ ushort vl_col; /* Number of columns (i.e. 640) */ -+ ushort vl_row; /* Number of rows (i.e. 480) */ -+ u_char vl_bpix; /* Bits per pixel, 0 = 1, 1 = 2, 2 = 4, 3 = 8 */ -+ -+ struct jz_fb_info jz_fb; -+} vidinfo_t; -+ -+extern vidinfo_t panel_info; - -+#else - typedef struct vidinfo { - ushort vl_col; /* Number of columns (i.e. 160) */ - ushort vl_row; /* Number of rows (i.e. 100) */ -@@ -318,6 +354,7 @@ void lcd_show_board_info(void); - #define LCD_COLOR4 2 - #define LCD_COLOR8 3 - #define LCD_COLOR16 4 -+#define LCD_COLOR32 5 - - /*----------------------------------------------------------------------*/ - #if defined(CONFIG_LCD_INFO_BELOW_LOGO) -@@ -369,7 +406,7 @@ void lcd_show_board_info(void); - # define CONSOLE_COLOR_GREY 14 - # define CONSOLE_COLOR_WHITE 15 /* Must remain last / highest */ - --#else -+#elif LCD_BPP == LCD_COLOR16 - - /* - * 16bpp color definitions -@@ -377,6 +414,15 @@ void lcd_show_board_info(void); - # define CONSOLE_COLOR_BLACK 0x0000 - # define CONSOLE_COLOR_WHITE 0xffff /* Must remain last / highest */ - -+#elif LCD_BPP == LCD_COLOR32 -+/* -+ * 18,24,32 bpp color definitions -+ */ -+# define CONSOLE_COLOR_BLACK 0x00000000 -+# define CONSOLE_COLOR_WHITE 0xffffffff /* Must remain last / highest */ -+ -+#else -+ - #endif /* color definitions */ - - /************************************************************************/ -@@ -406,7 +452,7 @@ void lcd_show_board_info(void); - #if LCD_BPP == LCD_MONOCHROME - # define COLOR_MASK(c) ((c) | (c) << 1 | (c) << 2 | (c) << 3 | \ - (c) << 4 | (c) << 5 | (c) << 6 | (c) << 7) --#elif (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16) -+#elif (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16) || (LCD_BPP == LCD_COLOR32) - # define COLOR_MASK(c) (c) - #else - # error Unsupported LCD BPP. --- -1.7.9.5 - diff --git a/package/boot/uboot-xburst/patches/0006-enable-silent-console.patch b/package/boot/uboot-xburst/patches/0006-enable-silent-console.patch deleted file mode 100644 index ebd6a6a7bfed09..00000000000000 --- a/package/boot/uboot-xburst/patches/0006-enable-silent-console.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 5eb4d4c598f2806bd1b3d1140e917bfead7851ad Mon Sep 17 00:00:00 2001 -From: Xiangfu -Date: Wed, 10 Oct 2012 23:51:26 +0800 -Subject: [PATCH 6/6] enable silent console - ---- - common/console.c | 16 ++++++++++++++++ - include/configs/qi_lb60.h | 2 ++ - 2 files changed, 18 insertions(+) - -diff --git a/common/console.c b/common/console.c -index 1177f7d..e8a2078 100644 ---- a/common/console.c -+++ b/common/console.c -@@ -685,6 +685,14 @@ done: - - gd->flags |= GD_FLG_DEVINIT; /* device initialization completed */ - -+#ifdef CONFIG_SILENT_CONSOLE -+ /* Check one more time the contents of the silent environment -+ * variable, because if the environment is loaded from NAND it was -+ * not available when console_init_f() was called */ -+ if (getenv("silent") != NULL) -+ gd->flags |= GD_FLG_SILENT; -+#endif -+ - stdio_print_current_devices(); - - #ifdef CONFIG_SYS_CONSOLE_ENV_OVERWRITE -@@ -760,6 +768,14 @@ int console_init_r(void) - - gd->flags |= GD_FLG_DEVINIT; /* device initialization completed */ - -+#ifdef CONFIG_SILENT_CONSOLE -+ /* Check one more time the contents of the silent environment -+ * variable, because if the environment is loaded from NAND it was -+ * not available when console_init_f() was called */ -+ if (getenv("silent") != NULL) -+ gd->flags |= GD_FLG_SILENT; -+#endif -+ - stdio_print_current_devices(); - - /* Setting environment variables */ -diff --git a/include/configs/qi_lb60.h b/include/configs/qi_lb60.h -index d3e78ad..a3534ff 100644 ---- a/include/configs/qi_lb60.h -+++ b/include/configs/qi_lb60.h -@@ -102,6 +102,8 @@ - #define CONFIG_SYS_NO_FLASH - #define CONFIG_SYS_FLASH_BASE 0 /* init flash_base as 0 */ - -+#define CONFIG_SILENT_CONSOLE 1 /* Enable silent console */ -+ - /* - * Command line configuration - */ --- -1.7.9.5 - diff --git a/package/boot/uboot-zynq/Makefile b/package/boot/uboot-zynq/Makefile index 736ebd26daedde..b6b1dc8b85ff32 100644 --- a/package/boot/uboot-zynq/Makefile +++ b/package/boot/uboot-zynq/Makefile @@ -7,9 +7,9 @@ include $(TOPDIR)/rules.mk -PKG_VERSION:=2016.03 +PKG_VERSION:=2019.07 -PKG_HASH:=e49337262ecac44dbdeac140f2c6ebd1eba345e0162b0464172e7f05583ed7bb +PKG_HASH:=bff4fa77e8da17521c030ca4c5b947a056c1b1be4d3e6ee8637020b8d50251d0 include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/u-boot.mk @@ -18,30 +18,47 @@ include $(INCLUDE_DIR)/host-build.mk define U-Boot/Default BUILD_TARGET:=zynq - UBOOT_IMAGE:=u-boot u-boot-dtb.bin u-boot.dtb u-boot-dtb.img spl/boot.bin spl/u-boot-spl spl/u-boot-spl-dtb.bin + UBOOT_IMAGE:=spl/boot.bin u-boot.img UBOOT_CONFIG:=zynq_$(1) + UENV:=default + HIDDEN:=1 endef define U-Boot/zc702 NAME:=Xilinx ZC702 Dev Board -endef - -define U-Boot/zc706 - NAME:=Xilinx ZC706 Dev Board + BUILD_DEVICES:=xlnx_zynq-zc702 endef define U-Boot/zed NAME:=Avnet Digilent ZedBoard Dev Board + BUILD_DEVICES:=avnet_zynq-zed endef define U-Boot/zybo NAME:=Digilent Zybo Dev Board + BUILD_DEVICES:=digilent_zynq-zybo +endef + +define U-Boot/zybo_z7 + NAME:=Digilent Zybo Z7 board + BUILD_DEVICES:=digilent_zynq-zybo-z7 endef UBOOT_TARGETS := \ zc702 \ zed \ - zybo + zybo \ + zybo_z7 + +define Build/InstallDev + $(INSTALL_DIR) $(STAGING_DIR_IMAGE) + $(CP) $(PKG_BUILD_DIR)/spl/boot.bin $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)-boot.bin + $(CP) $(PKG_BUILD_DIR)/u-boot.img $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)-u-boot.img + $(CP) ./files/uEnv-$(UENV).txt $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)-uEnv.txt +endef + +define Package/u-boot/install/default +endef Build/Exports:=$(Host/Exports) diff --git a/package/boot/uboot-zynq/files/uEnv-default.txt b/package/boot/uboot-zynq/files/uEnv-default.txt new file mode 100644 index 00000000000000..5030b077842d06 --- /dev/null +++ b/package/boot/uboot-zynq/files/uEnv-default.txt @@ -0,0 +1 @@ +bootargs=console=ttyPS0,115200n8 root=/dev/mmcblk0p2 rootwait earlyprintk diff --git a/package/boot/uboot-zynq/patches/110-zybo-z7-read-mac-address-from-SPI-flash-memory.patch b/package/boot/uboot-zynq/patches/110-zybo-z7-read-mac-address-from-SPI-flash-memory.patch new file mode 100644 index 00000000000000..00dce9a02e9b7c --- /dev/null +++ b/package/boot/uboot-zynq/patches/110-zybo-z7-read-mac-address-from-SPI-flash-memory.patch @@ -0,0 +1,103 @@ +From 67db0da72eb7ed87ebaaeb8a26891cb2cf916500 Mon Sep 17 00:00:00 2001 +From: Luis Araneda +Date: Sun, 21 Jul 2019 23:24:12 -0400 +Subject: [U-Boot] [PATCH] arm: zynq: read mac address from SPI flash memory + +Implement a method for reading the MAC address from an +SPI flash memory. +In particular, this method is used by the Zybo Z7 board +to read the MAC address from the OTP region in the SPI NOR +memory + +Signed-off-by: Luis Araneda +--- +As of 2019-08-18, this patch has not been accepted by upstream U-Boot. +Keep this patch until an alternative is accepted by upstream. +--- + board/xilinx/common/board.c | 28 ++++++++++++++++++++++++++++ + configs/zynq_zybo_z7_defconfig | 3 +++ + drivers/misc/Kconfig | 17 +++++++++++++++++ + 3 files changed, 48 insertions(+) + +--- a/board/xilinx/common/board.c ++++ b/board/xilinx/common/board.c +@@ -6,7 +6,10 @@ + + #include + #include ++#include ++#include + #include ++#include + + int zynq_board_read_rom_ethaddr(unsigned char *ethaddr) + { +@@ -34,5 +37,30 @@ int zynq_board_read_rom_ethaddr(unsigned + debug("%s: I2C EEPROM MAC %pM\n", __func__, ethaddr); + #endif + ++#if defined(CONFIG_MAC_ADDR_IN_SPI_FLASH) ++ struct spi_flash *flash; ++ struct udevice *dev; ++ ++ ret = spi_flash_probe_bus_cs(CONFIG_SF_DEFAULT_BUS, ++ CONFIG_SF_DEFAULT_CS, ++ 0, 0, &dev); ++ if (ret) { ++ printf("SPI(bus:%u cs:%u) probe failed\n", ++ CONFIG_SF_DEFAULT_BUS, ++ CONFIG_SF_DEFAULT_CS); ++ return 0; ++ } ++ ++ flash = dev_get_uclass_priv(dev); ++ flash->read_opcode = CONFIG_MAC_ADDR_SPI_FLASH_READ_CMD; ++ ++ if (spi_flash_read_dm(dev, ++ CONFIG_MAC_ADDR_SPI_FLASH_DATA_OFFSET, ++ 6, ethaddr)) ++ printf("SPI MAC address read failed\n"); ++ ++ device_remove(dev, DM_REMOVE_NORMAL); ++#endif ++ + return ret; + } +--- a/configs/zynq_zybo_z7_defconfig ++++ b/configs/zynq_zybo_z7_defconfig +@@ -42,6 +42,9 @@ CONFIG_DFU_RAM=y + CONFIG_FPGA_XILINX=y + CONFIG_FPGA_ZYNQPL=y + CONFIG_DM_GPIO=y ++CONFIG_MAC_ADDR_IN_SPI_FLASH=y ++CONFIG_MAC_ADDR_SPI_FLASH_READ_CMD=0x4b ++CONFIG_MAC_ADDR_SPI_FLASH_DATA_OFFSET=0x20 + CONFIG_MMC_SDHCI=y + CONFIG_MMC_SDHCI_ZYNQ=y + CONFIG_SPI_FLASH=y +--- a/drivers/misc/Kconfig ++++ b/drivers/misc/Kconfig +@@ -366,6 +366,23 @@ config SYS_I2C_EEPROM_ADDR_OVERFLOW + + endif + ++config MAC_ADDR_IN_SPI_FLASH ++ bool "MAC address in SPI flash" ++ help ++ Read MAC address from an SPI flash memory ++ ++if MAC_ADDR_IN_SPI_FLASH ++ ++config MAC_ADDR_SPI_FLASH_READ_CMD ++ hex "Read command for the SPI flash memory" ++ default 0 ++ ++config MAC_ADDR_SPI_FLASH_DATA_OFFSET ++ hex "Offset of MAC data in SPI flash memory" ++ default 0 ++ ++endif ++ + config GDSYS_RXAUI_CTRL + bool "Enable gdsys RXAUI control driver" + depends on MISC diff --git a/package/boot/uboot-zynq/patches/210-link-libcrypto-static.patch b/package/boot/uboot-zynq/patches/210-link-libcrypto-static.patch index a260e84e805653..d2e7bf168dd54d 100644 --- a/package/boot/uboot-zynq/patches/210-link-libcrypto-static.patch +++ b/package/boot/uboot-zynq/patches/210-link-libcrypto-static.patch @@ -3,9 +3,9 @@ needed dependencies are added too. --- a/tools/Makefile +++ b/tools/Makefile -@@ -128,7 +128,7 @@ endif - # MXSImage needs LibSSL - ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_FIT_SIGNATURE),) +@@ -151,7 +151,7 @@ ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CON + HOSTCFLAGS_kwbimage.o += \ + $(shell pkg-config --cflags libssl libcrypto 2> /dev/null || echo "") HOSTLOADLIBES_mkimage += \ - $(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto") + $(shell pkg-config --libs --static libssl libcrypto 2> /dev/null || echo "-lssl -lpthread -lcrypto") diff --git a/package/boot/yamonenv/Makefile b/package/boot/yamonenv/Makefile deleted file mode 100644 index 011d39acd66551..00000000000000 --- a/package/boot/yamonenv/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# Copyright (C) 2006 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:=yamonenv -PKG_VERSION:=20051022 -PKG_RELEASE:=1 - -PKG_SOURCE:=$(PKG_NAME)_gruen.4g__$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=http://downloads.openwrt.org/sources/ -PKG_HASH:=466eca9cdad2c15e957fb9ce7d0b6927ecd17d85c4cc2dff37e97a3e6b209c67 - -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) - -PKG_FLAGS:=nonshared - -include $(INCLUDE_DIR)/package.mk - -define Package/yamonenv - SECTION:=utils - CATEGORY:=Utilities - SUBMENU:=Boot Loaders - DEPENDS:=@TARGET_au1000 - TITLE:=YAMON configuration utility - URL:=http://meshcube.org/nylon/stable/sources/ - MAINTAINER:=Florian Fainelli -endef - -define Build/Configure -endef - -define Package/yamonenv/install - $(INSTALL_DIR) $(1)/usr/sbin - $(CP) $(PKG_BUILD_DIR)/src/$(PKG_NAME) $(1)/usr/sbin/ -endef - -$(eval $(call BuildPackage,yamonenv)) diff --git a/package/boot/yamonenv/patches/001-yamonenv_mtd_partition.patch b/package/boot/yamonenv/patches/001-yamonenv_mtd_partition.patch deleted file mode 100644 index e1def28af569b7..00000000000000 --- a/package/boot/yamonenv/patches/001-yamonenv_mtd_partition.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/src/yamonenv.c -+++ b/src/yamonenv.c -@@ -12,7 +12,7 @@ - #include - #include - --#define DEFAULT_YAMON_ENV_FILE "/dev/mtd/3" -+#define DEFAULT_YAMON_ENV_FILE "/dev/mtd3" - - - // control byte definitions: diff --git a/package/devel/gdb/Makefile b/package/devel/gdb/Makefile index 4cf2aaa87fc964..9e816697c12a2b 100644 --- a/package/devel/gdb/Makefile +++ b/package/devel/gdb/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gdb -PKG_VERSION:=8.0.1 +PKG_VERSION:=8.2 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/gdb -PKG_HASH:=3dbd5f93e36ba2815ad0efab030dcd0c7b211d7b353a40a53f4c02d7d56295e3 +PKG_HASH:=c3a441a29c7c89720b734e5a9c6289c0a06be7e0c76ef538f7bbcef389347c39 PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 diff --git a/package/devel/gdb/patches/100-musl_fix.patch b/package/devel/gdb/patches/100-musl_fix.patch index b167fe6ecd7ff5..356d8c41116d95 100644 --- a/package/devel/gdb/patches/100-musl_fix.patch +++ b/package/devel/gdb/patches/100-musl_fix.patch @@ -49,5 +49,5 @@ #include +#undef pt_regs - #include "nat/ppc-linux.h" - #include "linux-ppc-tdesc.h" + #include "arch/ppc-linux-common.h" + #include "arch/ppc-linux-tdesc.h" diff --git a/package/devel/gdb/patches/110-shared_libgcc.patch b/package/devel/gdb/patches/110-shared_libgcc.patch index 929a5ae9771925..c8ddfde5cca908 100644 --- a/package/devel/gdb/patches/110-shared_libgcc.patch +++ b/package/devel/gdb/patches/110-shared_libgcc.patch @@ -1,6 +1,6 @@ --- a/configure.ac +++ b/configure.ac -@@ -1300,13 +1300,13 @@ if test -z "$LD"; then +@@ -1277,13 +1277,13 @@ if test -z "$LD"; then fi fi @@ -15,9 +15,9 @@ + LDFLAGS="$LDFLAGS -static-libstdc++" + AC_MSG_CHECKING([whether g++ accepts -static-libstdc++]) AC_LANG_PUSH(C++) - AC_LINK_IFELSE([ + AC_LINK_IFELSE([AC_LANG_SOURCE([ #if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) -@@ -1632,7 +1632,7 @@ AC_ARG_WITH(stage1-ldflags, +@@ -1609,7 +1609,7 @@ AC_ARG_WITH(stage1-ldflags, # if supported. But if the user explicitly specified the libraries to use, # trust that they are doing what they want. if test "$stage1_libs" = "" -a "$have_static_libs" = yes; then @@ -26,7 +26,7 @@ fi]) AC_SUBST(stage1_ldflags) -@@ -1661,7 +1661,7 @@ AC_ARG_WITH(boot-ldflags, +@@ -1638,7 +1638,7 @@ AC_ARG_WITH(boot-ldflags, # statically. But if the user explicitly specified the libraries to # use, trust that they are doing what they want. if test "$poststage1_libs" = ""; then @@ -37,7 +37,7 @@ --- a/configure +++ b/configure -@@ -5005,14 +5005,14 @@ if test -z "$LD"; then +@@ -5043,14 +5043,14 @@ if test -z "$LD"; then fi fi @@ -56,7 +56,7 @@ ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -@@ -5795,7 +5795,7 @@ else +@@ -5833,7 +5833,7 @@ else # if supported. But if the user explicitly specified the libraries to use, # trust that they are doing what they want. if test "$stage1_libs" = "" -a "$have_static_libs" = yes; then @@ -65,7 +65,7 @@ fi fi -@@ -5831,7 +5831,7 @@ else +@@ -5869,7 +5869,7 @@ else # statically. But if the user explicitly specified the libraries to # use, trust that they are doing what they want. if test "$poststage1_libs" = ""; then diff --git a/package/devel/gdb/patches/120-sigprocmask-invalid-call.patch b/package/devel/gdb/patches/120-sigprocmask-invalid-call.patch index 8afa8ccf811685..7cb050c75134ab 100644 --- a/package/devel/gdb/patches/120-sigprocmask-invalid-call.patch +++ b/package/devel/gdb/patches/120-sigprocmask-invalid-call.patch @@ -27,7 +27,7 @@ gdb/ChangeLog: --- a/gdb/common/signals-state-save-restore.c +++ b/gdb/common/signals-state-save-restore.c -@@ -41,7 +41,7 @@ save_original_signals_state (void) +@@ -41,7 +41,7 @@ save_original_signals_state (bool quiet) int i; int res; diff --git a/package/devel/perf/Makefile b/package/devel/perf/Makefile index 61388580d56f3d..aa5fb16f60c737 100644 --- a/package/devel/perf/Makefile +++ b/package/devel/perf/Makefile @@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=perf PKG_VERSION:=$(LINUX_VERSION) -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_USE_MIPS16:=0 PKG_BUILD_PARALLEL:=1 @@ -26,7 +26,7 @@ include $(INCLUDE_DIR)/package.mk define Package/perf SECTION:=devel CATEGORY:=Development - DEPENDS:= +libelf1 +libdw +(mips||mipsel||powerpc||i386||x86_64||arm||aarch64):libunwind +libpthread +librt +objdump @!LINUX_3_18 @!IN_SDK @!TARGET_arc770 @KERNEL_PERF_EVENTS + DEPENDS:= +libelf +libdw +PACKAGE_libunwind:libunwind +libpthread +librt +objdump @!IN_SDK @!TARGET_arc770 @KERNEL_PERF_EVENTS TITLE:=Linux performance monitoring tool VERSION:=$(LINUX_VERSION)-$(PKG_RELEASE) URL:=http://www.kernel.org @@ -36,10 +36,6 @@ define Package/perf/description perf is the Linux performance monitoring tool endef -define Build/Prepare - $(CP) $(LINUX_DIR)/tools/perf/* $(PKG_BUILD_DIR)/ -endef - MAKE_FLAGS = \ ARCH="$(LINUX_KARCH)" \ NO_LIBPERL=1 \ @@ -59,19 +55,13 @@ MAKE_FLAGS = \ LDFLAGS="$(TARGET_LDFLAGS)" \ $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \ WERROR=0 \ + O=$(PKG_BUILD_DIR) \ prefix=/usr -ifdef CONFIG_LINUX_4_4 -ifdef CONFIG_USE_MUSL - MAKE_FLAGS += EXTRA_CFLAGS="-I$(CURDIR)/musl-include -include $(CURDIR)/musl-compat.h -D__UCLIBC__" -endif -endif - define Build/Compile +$(MAKE_FLAGS) $(MAKE) $(PKG_JOBS) \ - -C $(PKG_BUILD_DIR) \ - -f Makefile.perf \ - --no-print-directory + --no-print-directory \ + -C $(LINUX_DIR)/tools/perf endef define Package/perf/install diff --git a/package/devel/perf/musl-compat.h b/package/devel/perf/musl-compat.h deleted file mode 100644 index 83aa00a7c8f643..00000000000000 --- a/package/devel/perf/musl-compat.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef __PERF_MUSL_COMPAT_H -#define __PERF_MUSL_COMPAT_H - -#ifndef __ASSEMBLER__ - -#include -#include -#include -#include - -#undef _IOWR -#undef _IOR -#undef _IOW -#undef _IOC -#undef _IO - -#define _SC_LEVEL1_DCACHE_LINESIZE -1 - -static inline long sysconf_wrap(int name) -{ - FILE *f; - int val; - - switch (name) { - case _SC_LEVEL1_DCACHE_LINESIZE: - f = fopen("/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size", "r"); - if (!f) - return 0; - - if (fscanf(f, "%d", &val) != 1) - return 0; - - fclose(f); - return val; - default: - return sysconf(name); - } -} - -#define sysconf(_n) sysconf_wrap(_n) - -#endif -#endif diff --git a/package/devel/perf/musl-include/asm/errno.h b/package/devel/perf/musl-include/asm/errno.h deleted file mode 100644 index 8c4b1beb5289a4..00000000000000 --- a/package/devel/perf/musl-include/asm/errno.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __MUSL_COMPAT_ASM_ERRNO_H -#define __MUSL_COMPAT_ASM_ERRNO_H - -/* Avoid including different versions of errno.h, the defines (incorrectly) - * cause a redefinition error on PowerPC */ -#include - -#endif diff --git a/package/devel/perf/musl-include/string.h b/package/devel/perf/musl-include/string.h deleted file mode 100644 index 65dc2f1e8f3fc3..00000000000000 --- a/package/devel/perf/musl-include/string.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __MUSL_COMPAT_STRING_H -#define __MUSL_COMPAT_STRING_H - -#include_next - -/* Change XSI compliant version into GNU extension hackery */ -static inline char * -gnu_strerror_r(int err, char *buf, size_t buflen) -{ - if (strerror_r(err, buf, buflen)) - return NULL; - return buf; -} -#ifdef _GNU_SOURCE -#define strerror_r gnu_strerror_r -#endif - -#endif diff --git a/package/devel/strace/Makefile b/package/devel/strace/Makefile index 6209dc5a638f87..cdf4067ad2b20c 100644 --- a/package/devel/strace/Makefile +++ b/package/devel/strace/Makefile @@ -9,27 +9,33 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=strace -PKG_VERSION:=4.20 +PKG_VERSION:=5.5 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_URL:=@SF/$(PKG_NAME) -PKG_HASH:=5bf3148dd17306a42566f7da17368fdd781afa147db05ea63a4ca2b50f58c523 - -PKG_LICENSE:=BSD-3c -PKG_LICENSE_FILES:=COPYRIGHT -PKG_CPE_ID:=cpe:/a:paul_kranenburg:strace +PKG_SOURCE_URL:=https://strace.io/files/$(PKG_VERSION) +PKG_HASH:=9f58958c8e59ea62293d907d10572e352b582bd7948ed21aa28ebb47e5bf30ff PKG_MAINTAINER:=Felix Fietkau +PKG_LICENSE:=LGPL-2.1-or-later +PKG_LICENSE_FILES:=COPYING +PKG_CPE_ID:=cpe:/a:paul_kranenburg:strace PKG_FIXUP:=autoreconf -PKG_CONFIG_DEPENDS:=CONFIG_PACKAGE_strace_libunwind PKG_INSTALL:=1 +PKG_CONFIG_DEPENDS := \ + CONFIG_STRACE_LIBDW \ + CONFIG_STRACE_LIBUNWIND + include $(INCLUDE_DIR)/package.mk HOST_CFLAGS += -I$(LINUX_DIR)/user_headers/include +ifeq ($(ARCH),aarch64) + CONFIGURE_ARGS += --enable-mpers=check +endif + CONFIGURE_VARS+= \ LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \ CPPFLAGS_FOR_BUILD="$(HOST_CPPFLAGS)" \ @@ -40,22 +46,35 @@ define Package/strace SECTION:=utils CATEGORY:=Utilities TITLE:=System call tracer - DEPENDS:=+PACKAGE_strace_libunwind:libunwind - URL:=http://strace.sourceforge.net/ + URL:=https://strace.io/ + DEPENDS:=+STRACE_LIBDW:libdw +STRACE_LIBUNWIND:libunwind endef define Package/strace/description -A useful diagnostic, instructional, and debugging tool. Allows you to track what -system calls a program makes while it is running. + A useful diagnostic, instructional, and debugging tool. Allows you to track what + system calls a program makes while it is running. endef define Package/strace/config -config PACKAGE_strace_libunwind - bool "Enable stack tracing support using libunwind (experimental)" - default n +choice + prompt "stack tracing support" + default STRACE_NONE + + config STRACE_NONE + bool "None" + + config STRACE_LIBDW + bool "libdw" + + config STRACE_LIBUNWIND + bool "libunwind (experimental)" +endchoice endef -CONFIGURE_ARGS += --with-libunwind=$(if $(CONFIG_PACKAGE_strace_libunwind),yes,no) +CONFIGURE_ARGS += \ + --with-libdw=$(if $(CONFIG_STRACE_LIBDW),yes,no) \ + --with-libunwind=$(if $(CONFIG_STRACE_LIBUNWIND),yes,no) + MAKE_FLAGS := \ CCOPT="$(TARGET_CFLAGS)" diff --git a/package/devel/strace/patches/100-workaround--pt-reg-collisions-ppc.patch b/package/devel/strace/patches/100-workaround--pt-reg-collisions-ppc.patch deleted file mode 100644 index 3f183065e12c75..00000000000000 --- a/package/devel/strace/patches/100-workaround--pt-reg-collisions-ppc.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/ptrace.h -+++ b/ptrace.h -@@ -48,7 +48,14 @@ - # define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args - #endif - -+#if POWERPC -+#include -+#define __ASSEMBLY__ -+#endif - #include -+#if POWERPC -+#undef __ASSEMBLY__ -+#endif - - #ifdef HAVE_STRUCT_IA64_FPREG - # undef ia64_fpreg diff --git a/package/devel/valgrind/Makefile b/package/devel/valgrind/Makefile index dd300b6d9fe3e2..a670ba51b59359 100644 --- a/package/devel/valgrind/Makefile +++ b/package/devel/valgrind/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=valgrind -PKG_VERSION:=3.13.0 +PKG_VERSION:=3.14.0 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=http://sourceware.org/pub/valgrind/ -PKG_HASH:=d76680ef03f00cd5e970bbdcd4e57fb1f6df7d2e2c071635ef2be74790190c3b +PKG_HASH:=037c11bfefd477cc6e9ebe8f193bb237fe397f7ce791b4a4ce3fa1c6a520baa5 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0+ @@ -105,6 +105,7 @@ CONFIGURE_ARGS += \ --disable-valgrindtk \ --without-included-gettext \ --with-pagesize=4 \ + --enable-lto define Package/valgrind/install $(INSTALL_DIR) $(1)/usr/bin diff --git a/package/devel/valgrind/patches/100-fix_configure_check.patch b/package/devel/valgrind/patches/100-fix_configure_check.patch index 6ba5fdf1d72722..270181ae376a2e 100644 --- a/package/devel/valgrind/patches/100-fix_configure_check.patch +++ b/package/devel/valgrind/patches/100-fix_configure_check.patch @@ -1,6 +1,6 @@ --- a/configure.ac +++ b/configure.ac -@@ -323,7 +323,7 @@ case "${host_os}" in +@@ -341,7 +341,7 @@ case "${host_os}" in # Ok, this is linux. Check the kernel version AC_MSG_CHECKING([for the kernel version]) diff --git a/package/devel/valgrind/patches/130-fix_arm_arch_detection.patch b/package/devel/valgrind/patches/130-fix_arm_arch_detection.patch index c8d203390c8344..26291f777bb7b7 100644 --- a/package/devel/valgrind/patches/130-fix_arm_arch_detection.patch +++ b/package/devel/valgrind/patches/130-fix_arm_arch_detection.patch @@ -6,7 +6,7 @@ Last-Update: 2013-11-30 --- a/configure.ac +++ b/configure.ac -@@ -234,7 +234,7 @@ case "${host_cpu}" in +@@ -252,7 +252,7 @@ case "${host_cpu}" in ARCH_MAX="s390x" ;; diff --git a/package/firmware/am33x-cm3/Makefile b/package/firmware/am33x-cm3/Makefile deleted file mode 100644 index e3923581bf06c4..00000000000000 --- a/package/firmware/am33x-cm3/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# Copyright (C) 2014 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:=am33x-cm3 -PKG_VERSION:=20130304 -PKG_RELEASE:=1 - -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=http://arago-project.org/git/projects/am33x-cm3.git -PKG_SOURCE_VERSION:=32cf44e25b5828b87af6dceebc3a49fed5d858ac -PKG_MIRROR_HASH:=71d4029eed4ef58a1e0beb299d5c876bf0b9a790ecac52aacf1d510f5841d959 - -PKG_MAINTAINER:=Imre Kaloz - -PKG_FLAGS:=nonshared - -include $(INCLUDE_DIR)/package.mk - -define Package/am33x-cm3 - SECTION:=firmware - CATEGORY:=Firmware - URL:=http://arago-project.org/git/projects/?p=am33x-cm3.git - TITLE:=TI AM335x PM firmware - DEPENDS:=@TARGET_omap -endef - -define Build/Compile - $(MAKE) CROSS_COMPILE=$(TARGET_CROSS) -C $(PKG_BUILD_DIR) -endef - -define Package/am33x-cm3/install - $(INSTALL_DIR) $(1)/lib/firmware - $(CP) $(PKG_BUILD_DIR)/bin/am335x-pm-firmware.bin $(1)/lib/firmware -endef - -$(eval $(call BuildPackage,am33x-cm3)) diff --git a/package/firmware/ath10k-firmware/Makefile b/package/firmware/ath10k-firmware/Makefile index 6b81e1a00bbc93..1c4c9ef01624e3 100644 --- a/package/firmware/ath10k-firmware/Makefile +++ b/package/firmware/ath10k-firmware/Makefile @@ -8,9 +8,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ath10k-firmware -PKG_SOURCE_DATE:=2018-04-19 -PKG_SOURCE_VERSION:=71e50312b54cc972657a7b08c470088447cb9676 -PKG_MIRROR_HASH:=726e7bce9917532e3b39ced6a17ca2d4c39fdf4c9bec4a3f8f2ea3e5defa6a54 +PKG_SOURCE_DATE:=2019-10-03 +PKG_SOURCE_VERSION:=d622d160e9f552ead68d9ae81b715422892dc2ef +PKG_MIRROR_HASH:=2e504e071c3f896d629c4cfffe7ff4b5f1acdb4fecd3f01e8ff8c73e87a67cc7 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git @@ -64,92 +64,92 @@ define Download/ct-firmware-htt URL_FILE:=$($(1)_FIRMWARE_FILE_CT_HTT) endef -QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-21.bin.lede.001 +QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.015 define Download/ath10k-firmware-qca988x-ct $(call Download/ct-firmware,QCA988X,) - HASH:=a3d029c46a77be265e33bb57f827a59f01969f157825d66ecf42a9d327127578 + HASH:=a3a760d0d72707feffa496b6d2266bd9195f09806553b36420b60c0f12b8b87e endef $(eval $(call Download,ath10k-firmware-qca988x-ct)) -QCA988X_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-21.bin.lede.001 +QCA988X_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.015 define Download/ath10k-firmware-qca988x-ct-htt $(call Download/ct-firmware-htt,QCA988X,) - HASH:=8666523a6271c4aa6409880d2efd52643258c21464d6bf5948507bcb72d3e350 + HASH:=3114a54103d2b492fa1ef903769721f59953c829020d62502a1ec411ab4146d5 endef $(eval $(call Download,ath10k-firmware-qca988x-ct-htt)) -QCA9887_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-21.bin.lede.001 +QCA9887_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-22.bin.lede.015 define Download/ath10k-firmware-qca9887-ct $(call Download/ct-firmware,QCA9887,ath10k-9887) - HASH:=ab8ef9afae5117f1cf71bbf80abde225f9f104620ba04a9734da51268e139803 + HASH:=71e8b76dfd7c786d2f57bb7df207dcd13a91d3b492cfbd28916f084d0d1bb5e7 endef $(eval $(call Download,ath10k-firmware-qca9887-ct)) -QCA9887_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-21.bin.lede.001 +QCA9887_FIRMWARE_FILE_CT_HTT:=firmware-2-ct-full-htt-mgt-community-22.bin.lede.015 define Download/ath10k-firmware-qca9887-ct-htt $(call Download/ct-firmware-htt,QCA9887,ath10k-9887) - HASH:=bb16a90ec8e7f80539ad016ebf5e3542bfc95a0e1a58c9f1b91e408a130ac058 + HASH:=b085e5d2239727b72bc647a76864431b8ac48438e6a33b1d55edc2222468f6ff endef $(eval $(call Download,ath10k-firmware-qca9887-ct-htt)) -QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-11.bin-lede.001 +QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.015 define Download/ath10k-firmware-qca99x0-ct - $(call Download/ct-firmware,QCA99X0,ath10k-10-4) - HASH:=f5c1caaf5a7fb8a07d0e292bab853311a1e826b5de7e76a06e4d801e33827a49 + $(call Download/ct-firmware,QCA99X0,ath10k-10-4b) + HASH:=edebe2f6f169cdd05c81a8a78156fb3426a66f415e7946af2ae4b7310fca5fe3 endef $(eval $(call Download,ath10k-firmware-qca99x0-ct)) -QCA99X0_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-11.bin-lede.001 +QCA99X0_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.015 define Download/ath10k-firmware-qca99x0-ct-htt - $(call Download/ct-firmware-htt,QCA99X0,ath10k-10-4) - HASH:=a78a457a76f28e2ef34a7a3b1beef06064f7512680e14beafe02625d94d11619 + $(call Download/ct-firmware-htt,QCA99X0,ath10k-10-4b) + HASH:=1ef67fb07da9082886e4dd554dfc19256e10b500faf9e4b2a5774d0238130bae endef $(eval $(call Download,ath10k-firmware-qca99x0-ct-htt)) -QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-11.bin-lede.001 +QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.015 define Download/ath10k-firmware-qca9984-ct - $(call Download/ct-firmware,QCA9984,ath10k-9984-10-4) - HASH:=204dde43a107911cd48ac04f6450365722fba6121487e49d4ef36b8aaa83339b + $(call Download/ct-firmware,QCA9984,ath10k-9984-10-4b) + HASH:=c2f04da3285aad37baef9c37c9905a31927175dd234cd4378fd56c106e5c9379 endef $(eval $(call Download,ath10k-firmware-qca9984-ct)) -QCA9984_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-11.bin-lede.001 +QCA9984_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.015 define Download/ath10k-firmware-qca9984-ct-htt - $(call Download/ct-firmware-htt,QCA9984,ath10k-9984-10-4) - HASH:=e60b6033e96a9b14f43aae360e6a35e1217f3e94a4578821ccdb3e2da8521fae + $(call Download/ct-firmware-htt,QCA9984,ath10k-9984-10-4b) + HASH:=0c9ede1036750d68885e6481fa84f3cb72192b8440b47719344f7327a030f05d endef $(eval $(call Download,ath10k-firmware-qca9984-ct-htt)) -QCA4019_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-11.bin-lede.001 +QCA4019_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.015 define Download/ath10k-firmware-qca4019-ct - $(call Download/ct-firmware,QCA4019,ath10k-4019-10-4) - HASH:=3daa439104806b1796c90e65bcafb18164358f0bd9e4d444302f7caf1c220dad + $(call Download/ct-firmware,QCA4019,ath10k-4019-10-4b) + HASH:=1acbb7e7a6300091715a3dfe1b248c7833734961de52cc3465c1ed231a4d84f1 endef $(eval $(call Download,ath10k-firmware-qca4019-ct)) -QCA4019_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-11.bin-lede.001 +QCA4019_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.015 define Download/ath10k-firmware-qca4019-ct-htt - $(call Download/ct-firmware-htt,QCA4019,ath10k-4019-10-4) - HASH:=eaf64c2942dac4d4718c5f7178be0676aee86b0293443d7b414e3f88290e2d15 + $(call Download/ct-firmware-htt,QCA4019,ath10k-4019-10-4b) + HASH:=1065e4d3e55da84ec9e69268a4c5dba55ea33827c48a7c14bb8f0c167eb11b4c endef $(eval $(call Download,ath10k-firmware-qca4019-ct-htt)) -QCA9888_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-11.bin-lede.001 +QCA9888_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-12.bin-lede.015 define Download/ath10k-firmware-qca9888-ct - $(call Download/ct-firmware,QCA9888,ath10k-9888-10-4) - HASH:=8d4415a77745259bbac4fc821c85f4001e58e49d9797a2e23585c44a03505678 + $(call Download/ct-firmware,QCA9888,ath10k-9888-10-4b) + HASH:=559ebd16872a8b43443c51bb4b7d021e5b75e65893d333d9393f3f6012f4ac79 endef $(eval $(call Download,ath10k-firmware-qca9888-ct)) -QCA9888_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-11.bin-lede.001 +QCA9888_FIRMWARE_FILE_CT_HTT:=firmware-5-ct-full-htt-mgt-community-12.bin-lede.015 define Download/ath10k-firmware-qca9888-ct-htt - $(call Download/ct-firmware-htt,QCA9888,ath10k-9888-10-4) - HASH:=2a1bf2c7b4122469c40d70c48f155a53bd5d30a2900c01fe5ff896abc67acc9c + $(call Download/ct-firmware-htt,QCA9888,ath10k-9888-10-4b) + HASH:=4feaf5e7c4c1745f499ba8c3125db41675800ebedaea455c418c117805c5b372 endef $(eval $(call Download,ath10k-firmware-qca9888-ct-htt)) @@ -174,7 +174,7 @@ $(Package/ath10k-firmware-default) SECTION:=firmware CATEGORY:=Firmware PROVIDES:=ath10k-firmware-qca988x - DEPENDS:=+kmod-ath10k-ct + DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct endef define Package/ath10k-firmware-qca9887-ct @@ -190,7 +190,7 @@ $(Package/ath10k-firmware-default) SECTION:=firmware CATEGORY:=Firmware PROVIDES:=ath10k-firmware-qca9887 - DEPENDS:=+kmod-ath10k-ct + DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct endef define Package/ath10k-firmware-qca988x-ct/description @@ -308,7 +308,7 @@ $(Package/ath10k-firmware-default) SECTION:=firmware CATEGORY:=Firmware PROVIDES:=ath10k-firmware-qca99x0 - DEPENDS:=+kmod-ath10k-ct + DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct endef define Package/ath10k-firmware-qca9984-ct @@ -324,7 +324,7 @@ $(Package/ath10k-firmware-default) SECTION:=firmware CATEGORY:=Firmware PROVIDES:=ath10k-firmware-qca9984 - DEPENDS:=+kmod-ath10k-ct + DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct endef define Package/ath10k-firmware-qca4019-ct @@ -340,7 +340,7 @@ $(Package/ath10k-firmware-default) SECTION:=firmware CATEGORY:=Firmware PROVIDES:=ath10k-firmware-qca4019 - DEPENDS:=+kmod-ath10k-ct + DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct endef define Package/ath10k-firmware-qca9888-ct @@ -356,11 +356,9 @@ $(Package/ath10k-firmware-default) SECTION:=firmware CATEGORY:=Firmware PROVIDES:=ath10k-firmware-qca9888 - DEPENDS:=+kmod-ath10k-ct + DEPENDS:=+!PACKAGE_kmod-ath10k-ct-smallbuffers:kmod-ath10k-ct endef - - define Package/ath10k-firmware-qca9984 $(Package/ath10k-firmware-default) TITLE:=ath10k firmware for QCA9984 devices @@ -403,14 +401,14 @@ define Package/ath10k-firmware-qca4019/install $(PKG_BUILD_DIR)/QCA4019/hw1.0/board-2.bin \ $(1)/lib/firmware/ath10k/QCA4019/hw1.0/ $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/QCA4019/hw1.0/3.4/firmware-5.bin_10.4-3.4-00104 \ + $(PKG_BUILD_DIR)/QCA4019/hw1.0/3.6/firmware-5.bin_10.4-3.6-00140 \ $(1)/lib/firmware/ath10k/QCA4019/hw1.0/firmware-5.bin endef define Package/ath10k-firmware-qca9887/install $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9887/hw1.0 $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/QCA9887/hw1.0/10.2.4-1.0/firmware-5.bin_10.2.4-1.0-00033 \ + $(PKG_BUILD_DIR)/QCA9887/hw1.0/10.2.4-1.0/firmware-5.bin_10.2.4-1.0-00047 \ $(1)/lib/firmware/ath10k/QCA9887/hw1.0/firmware-5.bin $(INSTALL_DATA) \ $(PKG_BUILD_DIR)/QCA9887/hw1.0/board.bin \ @@ -433,13 +431,25 @@ define Package/ath10k-firmware-qca988x/install $(PKG_BUILD_DIR)/QCA988X/hw2.0/board.bin \ $(1)/lib/firmware/ath10k/QCA988X/hw2.0/ $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/QCA988X/hw2.0/10.2.4-1.0/firmware-5.bin_10.2.4-1.0-00033 \ + $(PKG_BUILD_DIR)/QCA988X/hw2.0/10.2.4-1.0/firmware-5.bin_10.2.4-1.0-00047 \ $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin endef define Package/ath10k-firmware-qca6174/install - $(INSTALL_DIR) $(1)/lib/firmware/ath10k - $(CP) $(PKG_BUILD_DIR)/QCA6174 $(1)/lib/firmware/ath10k/ + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA6174/hw2.1 + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/QCA6174/hw2.1/board-2.bin \ + $(1)/lib/firmware/ath10k/QCA6174/hw2.1/ + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/QCA6174/hw2.1/firmware-5.bin_SW_RM.1.1.1-00157-QCARMSWPZ-1 \ + $(1)/lib/firmware/ath10k/QCA6174/hw2.1/firmware-5.bin + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA6174/hw3.0 + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/QCA6174/hw3.0/board-2.bin \ + $(1)/lib/firmware/ath10k/QCA6174/hw3.0/ + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/QCA6174/hw3.0/4.4.1.c1/firmware-6.bin_RM.4.4.1.c1-00042-QCARMSWP-1 \ + $(1)/lib/firmware/ath10k/QCA6174/hw3.0/firmware-6.bin endef define Package/ath10k-firmware-qca99x0/install @@ -595,11 +605,11 @@ define Package/ath10k-firmware-qca9888-ct-htt/install endef $(eval $(call BuildPackage,ath10k-firmware-qca9887)) -$(eval $(call BuildPackage,ath10k-firmware-qca9888)) +#$(eval $(call BuildPackage,ath10k-firmware-qca9888)) $(eval $(call BuildPackage,ath10k-firmware-qca988x)) -$(eval $(call BuildPackage,ath10k-firmware-qca99x0)) -$(eval $(call BuildPackage,ath10k-firmware-qca6174)) -$(eval $(call BuildPackage,ath10k-firmware-qca9984)) +#$(eval $(call BuildPackage,ath10k-firmware-qca99x0)) +#$(eval $(call BuildPackage,ath10k-firmware-qca6174)) +#$(eval $(call BuildPackage,ath10k-firmware-qca9984)) $(eval $(call BuildPackage,ath10k-firmware-qca4019)) $(eval $(call BuildPackage,ath10k-firmware-qca9887-ct)) diff --git a/package/firmware/cypress-firmware/Makefile b/package/firmware/cypress-firmware/Makefile new file mode 100644 index 00000000000000..6325086ae26798 --- /dev/null +++ b/package/firmware/cypress-firmware/Makefile @@ -0,0 +1,293 @@ +# +# Copyright (C) 2019-2020 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +UNPACK_CMD=unzip -q -p $(DL_DIR)/$(PKG_SOURCE) $(PKG_SOURCE_UNZIP) | gzip -dc | $(HOST_TAR) -C $(1) $(TAR_OPTIONS) + +PKG_NAME:=cypress-firmware +PKG_VERSION:=v4.14.77-2020_0115 + +PKG_SOURCE_UNZIP:=cypress-firmware-$(PKG_VERSION).tar.gz +PKG_SOURCE:=cypress-fmac-$(PKG_VERSION).zip +PKG_SOURCE_URL:=https://community.cypress.com/servlet/JiveServlet/download/19000-1-51721/ +PKG_HASH:=a5510f82aacf585b5d29732b6d6777d4a4b26a667154d91cfcfc0d6d5dc4fef5 + +PKG_MAINTAINER:=Álvaro Fernández Rojas + +include $(INCLUDE_DIR)/package.mk + +define Package/cypress-firmware-default + SECTION:=firmware + CATEGORY:=Firmware + URL:=https://community.cypress.com/community/linux +endef + +define Build/Compile + true +endef + +# Cypress 43012 SDIO Firmware +define Package/cypress-firmware-43012-sdio + $(Package/cypress-firmware-default) + TITLE:=CYW43012 FullMac SDIO firmware +endef + +define Package/cypress-firmware-43012-sdio/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac43012-sdio.bin \ + $(1)/lib/firmware/brcm/brcmfmac43012-sdio.bin + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac43012-sdio.clm_blob \ + $(1)/lib/firmware/brcm/brcmfmac43012-sdio.clm_blob +endef + +$(eval $(call BuildPackage,cypress-firmware-43012-sdio)) + +# Cypress 43340 SDIO Firmware +define Package/cypress-firmware-43340-sdio + $(Package/cypress-firmware-default) + TITLE:=CYW43340 FullMac SDIO firmware +endef + +define Package/cypress-firmware-43340-sdio/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac43340-sdio.bin \ + $(1)/lib/firmware/brcm/brcmfmac43340-sdio.bin +endef + +$(eval $(call BuildPackage,cypress-firmware-43340-sdio)) + +# Cypress 43362 SDIO Firmware +define Package/cypress-firmware-43362-sdio + $(Package/cypress-firmware-default) + TITLE:=CYW43362 FullMac SDIO firmware +endef + +define Package/cypress-firmware-43362-sdio/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac43362-sdio.bin \ + $(1)/lib/firmware/brcm/brcmfmac43362-sdio.bin +endef + +$(eval $(call BuildPackage,cypress-firmware-43362-sdio)) + +# Cypress 4339 SDIO Firmware +define Package/cypress-firmware-4339-sdio + $(Package/cypress-firmware-default) + TITLE:=CYW4339 FullMac SDIO firmware +endef + +define Package/cypress-firmware-4339-sdio/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac4339-sdio.bin \ + $(1)/lib/firmware/brcm/brcmfmac4339-sdio.bin +endef + +$(eval $(call BuildPackage,cypress-firmware-4339-sdio)) + +# Cypress 43430 SDIO Firmware +define Package/cypress-firmware-43430-sdio + $(Package/cypress-firmware-default) + TITLE:=CYW43430 FullMac SDIO firmware +endef + +define Package/cypress-firmware-43430-sdio/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac43430-sdio.bin \ + $(1)/lib/firmware/brcm/brcmfmac43430-sdio.bin + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac43430-sdio.clm_blob \ + $(1)/lib/firmware/brcm/brcmfmac43430-sdio.clm_blob +endef + +$(eval $(call BuildPackage,cypress-firmware-43430-sdio)) + +# Cypress 43455 SDIO Firmware +define Package/cypress-firmware-43455-sdio + $(Package/cypress-firmware-default) + TITLE:=CYW43455 FullMac SDIO firmware +endef + +define Package/cypress-firmware-43455-sdio/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac43455-sdio.bin \ + $(1)/lib/firmware/brcm/brcmfmac43455-sdio.bin + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac43455-sdio.clm_blob \ + $(1)/lib/firmware/brcm/brcmfmac43455-sdio.clm_blob +endef + +$(eval $(call BuildPackage,cypress-firmware-43455-sdio)) + +# Cypress 4354 SDIO Firmware +define Package/cypress-firmware-4354-sdio + $(Package/cypress-firmware-default) + TITLE:=CYW4354 FullMac SDIO firmware +endef + +define Package/cypress-firmware-4354-sdio/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac4354-sdio.bin \ + $(1)/lib/firmware/brcm/brcmfmac4354-sdio.bin + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac4354-sdio.clm_blob \ + $(1)/lib/firmware/brcm/brcmfmac4354-sdio.clm_blob +endef + +$(eval $(call BuildPackage,cypress-firmware-4354-sdio)) + +# Cypress 4356 PCIe Firmware +define Package/cypress-firmware-4356-pcie + $(Package/cypress-firmware-default) + TITLE:=CYW4356 FullMac PCIe firmware +endef + +define Package/cypress-firmware-4356-pcie/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac4356-pcie.bin \ + $(1)/lib/firmware/brcm/brcmfmac4356-pcie.bin + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac4356-pcie.clm_blob \ + $(1)/lib/firmware/brcm/brcmfmac4356-pcie.clm_blob +endef + +$(eval $(call BuildPackage,cypress-firmware-4356-pcie)) + +# Cypress 4356 SDIO Firmware +define Package/cypress-firmware-4356-sdio + $(Package/cypress-firmware-default) + TITLE:=CYW4356 FullMac SDIO firmware +endef + +define Package/cypress-firmware-4356-sdio/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac4356-sdio.bin \ + $(1)/lib/firmware/brcm/brcmfmac4356-sdio.bin + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac4356-sdio.clm_blob \ + $(1)/lib/firmware/brcm/brcmfmac4356-sdio.clm_blob +endef + +$(eval $(call BuildPackage,cypress-firmware-4356-sdio)) + +# Cypress 43570 PCIe Firmware +define Package/cypress-firmware-43570-pcie + $(Package/cypress-firmware-default) + TITLE:=CYW43570 FullMac PCIe firmware +endef + +define Package/cypress-firmware-43570-pcie/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac43570-pcie.bin \ + $(1)/lib/firmware/brcm/brcmfmac43570-pcie.bin + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac43570-pcie.clm_blob \ + $(1)/lib/firmware/brcm/brcmfmac43570-pcie.clm_blob +endef + +$(eval $(call BuildPackage,cypress-firmware-43570-pcie)) + +# Cypress 4359 PCIe Firmware +define Package/cypress-firmware-4359-pcie + $(Package/cypress-firmware-default) + TITLE:=CYW4359 FullMac PCIe firmware +endef + +define Package/cypress-firmware-4359-pcie/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac4359-pcie.bin \ + $(1)/lib/firmware/brcm/brcmfmac4359-pcie.bin + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac4359-pcie.clm_blob \ + $(1)/lib/firmware/brcm/brcmfmac4359-pcie.clm_blob +endef + +$(eval $(call BuildPackage,cypress-firmware-4359-pcie)) + +# Cypress 4359 SDIO Firmware +define Package/cypress-firmware-4359-sdio + $(Package/cypress-firmware-default) + TITLE:=CYW4359 FullMac SDIO firmware +endef + +define Package/cypress-firmware-4359-sdio/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac4359-sdio.bin \ + $(1)/lib/firmware/brcm/brcmfmac4359-sdio.bin + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac4359-sdio.clm_blob \ + $(1)/lib/firmware/brcm/brcmfmac4359-sdio.clm_blob +endef + +$(eval $(call BuildPackage,cypress-firmware-4359-sdio)) + +# Cypress 4373 SDIO Firmware +define Package/cypress-firmware-4373-sdio + $(Package/cypress-firmware-default) + TITLE:=CYW4373 FullMac SDIO firmware +endef + +define Package/cypress-firmware-4373-sdio/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac4373-sdio.bin \ + $(1)/lib/firmware/brcm/brcmfmac4373-sdio.bin + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac4373-sdio.clm_blob \ + $(1)/lib/firmware/brcm/brcmfmac4373-sdio.clm_blob +endef + +$(eval $(call BuildPackage,cypress-firmware-4373-sdio)) + +# Cypress 4373 USB Firmware +define Package/cypress-firmware-4373-usb + $(Package/cypress-firmware-default) + TITLE:=CYW4373 FullMac USB firmware +endef + +define Package/cypress-firmware-4373-usb/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac4373-usb.bin \ + $(1)/lib/firmware/brcm/brcmfmac4373-usb.bin + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac4373.clm_blob \ + $(1)/lib/firmware/brcm/brcmfmac4373.clm_blob +endef + +$(eval $(call BuildPackage,cypress-firmware-4373-usb)) + +# Cypress 89459 PCIe Firmware +define Package/cypress-firmware-89459-pcie + $(Package/cypress-firmware-default) + TITLE:=CYW89459 FullMac PCIe firmware +endef + +define Package/cypress-firmware-89459-pcie/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac89459-pcie.bin \ + $(1)/lib/firmware/brcm/brcmfmac89459-pcie.bin + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/firmware/brcmfmac89459-pcie.clm_blob \ + $(1)/lib/firmware/brcm/brcmfmac89459-pcie.clm_blob +endef + +$(eval $(call BuildPackage,cypress-firmware-89459-pcie)) diff --git a/package/firmware/cypress-nvram/Makefile b/package/firmware/cypress-nvram/Makefile new file mode 100644 index 00000000000000..ef4044c6d0b178 --- /dev/null +++ b/package/firmware/cypress-nvram/Makefile @@ -0,0 +1,95 @@ +# +# Copyright (C) 2019 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:=cypress-nvram +PKG_SOURCE_DATE:=2019-09-03 +PKG_SOURCE_VERSION:=e7b78df22f2a0c5f56abb7b5880661611de35e5f +PKG_MIRROR_HASH:=1cb20a749696852be0a512d51961365dd9c031362af0af1a2b9f5a3fb894885f +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/openwrt/cypress-nvram.git + +PKG_MAINTAINER:=Álvaro Fernández Rojas + +include $(INCLUDE_DIR)/package.mk + +define Package/cypress-nvram-default + SECTION:=firmware + CATEGORY:=Firmware + URL:=https://community.cypress.com/community/linux +endef + +define Build/Compile + true +endef + +# Cypress 43430 SDIO Raspberry Pi 3B NVRAM +define Package/cypress-nvram-43430-sdio-rpi-3b + $(Package/cypress-nvram-default) + TITLE:=CYW43430 NVRAM for Raspberry Pi 3B + DEPENDS:=@TARGET_bcm27xx +endef + +define Package/cypress-nvram-43430-sdio-rpi-3b/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/brcmfmac43430-sdio.raspberrypi,3-model-b.txt \ + $(1)/lib/firmware/brcm/brcmfmac43430-sdio.raspberrypi,3-model-b.txt +endef + +$(eval $(call BuildPackage,cypress-nvram-43430-sdio-rpi-3b)) + +# Cypress 43430 SDIO Raspberry Pi Zero W NVRAM +define Package/cypress-nvram-43430-sdio-rpi-zero-w + $(Package/cypress-nvram-default) + TITLE:=CYW43430 NVRAM for Raspberry Pi Zero W + DEPENDS:=@TARGET_bcm27xx +endef + +define Package/cypress-nvram-43430-sdio-rpi-zero-w/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/brcmfmac43430-sdio.raspberrypi,model-zero-w.txt \ + $(1)/lib/firmware/brcm/brcmfmac43430-sdio.raspberrypi,model-zero-w.txt +endef + +$(eval $(call BuildPackage,cypress-nvram-43430-sdio-rpi-zero-w)) + +# Cypress 43455 SDIO Raspberry Pi 3B+ NVRAM +define Package/cypress-nvram-43455-sdio-rpi-3b-plus + $(Package/cypress-nvram-default) + TITLE:=CYW43455 NVRAM for Raspberry Pi 3B+ + DEPENDS:=@TARGET_bcm27xx +endef + +define Package/cypress-nvram-43455-sdio-rpi-3b-plus/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt \ + $(1)/lib/firmware/brcm/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt +endef + +$(eval $(call BuildPackage,cypress-nvram-43455-sdio-rpi-3b-plus)) + +# Cypress 43455 SDIO Raspberry Pi 4B NVRAM +define Package/cypress-nvram-43455-sdio-rpi-4b + $(Package/cypress-nvram-default) + TITLE:=CYW43455 NVRAM for Raspberry Pi 4B + DEPENDS:=@TARGET_bcm27xx +endef + +define Package/cypress-nvram-43455-sdio-rpi-4b/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/brcmfmac43455-sdio.raspberrypi,4-model-b.txt \ + $(1)/lib/firmware/brcm/brcmfmac43455-sdio.raspberrypi,4-model-b.txt +endef + +$(eval $(call BuildPackage,cypress-nvram-43455-sdio-rpi-4b)) diff --git a/package/firmware/intel-microcode/Makefile b/package/firmware/intel-microcode/Makefile index 9571feed932abd..de501622de978c 100644 --- a/package/firmware/intel-microcode/Makefile +++ b/package/firmware/intel-microcode/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=intel-microcode -PKG_VERSION:=20180703 -PKG_RELEASE:=2 +PKG_VERSION:=20190918 +PKG_RELEASE:=1 PKG_SOURCE:=intel-microcode_3.$(PKG_VERSION).$(PKG_RELEASE).tar.xz PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/non-free/i/intel-microcode/ -PKG_HASH:=26dfaa47100ce3d06f968edefa7539da10de7b96d5d8e26ee8174a040ee5cdae +PKG_HASH:=b7ecb5dd30d71e9b3c2ab184693a876171392e0d80d138c3560c662e5f2a2247 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-3.$(PKG_VERSION).$(PKG_RELEASE) PKG_BUILD_DEPENDS:=iucode-tool/host @@ -30,7 +30,7 @@ define Package/intel-microcode SECTION:=firmware CATEGORY:=Firmware URL:=$(PKG_SOURCE_URL) - DEPENDS:=@TARGET_x86 +iucode-tool + DEPENDS:=@TARGET_x86 TITLE:=Intel x86 CPU microcode endef diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 1cfcc33de3af58..c098667c981c31 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -14,7 +14,17 @@ define Build/Compile endef #ALLWIFIBOARDS:= -ALLWIFIBOARDS:=zyxel_wre6606 +# Please send a mail with your device-specific board files upstream. +# You can find instructions and examples on the linux-wireless wiki: +# +ALLWIFIBOARDS:= \ + engenius_eap1300 \ + hugo_ac1200 \ + linksys_ea6350v3 \ + mobipromo_cm520-79f \ + p2w_r619ac \ + rt-acrh17 + ALLWIFIPACKAGES:=$(foreach BOARD,$(ALLWIFIBOARDS),ipq-wifi-$(BOARD)) define Package/ipq-wifi-default @@ -48,7 +58,12 @@ Don't install it for any other device! PREV_BOARD+=ipq-wifi-$(1) endef -$(eval $(call generate-ipq-wifi-package,zyxel_wre6606,board-zyxel_wre6606.bin,ZyXEL WRE6606)) #$(eval $(call generate-ipq-wifi-package,,,)) +$(eval $(call generate-ipq-wifi-package,engenius_eap1300,board-engenius_eap1300.bin,EnGenius EAP1300)) +$(eval $(call generate-ipq-wifi-package,hugo_ac1200,board-hugo_ac1200.bin,Hugo AC1200)) +$(eval $(call generate-ipq-wifi-package,linksys_ea6350v3,board-linksys_ea6350v3.bin,Linksys EA6350v3)) +$(eval $(call generate-ipq-wifi-package,mobipromo_cm520-79f,board-mobipromo_cm520-79f.qca4019,MobiPromo CM520-79F)) +$(eval $(call generate-ipq-wifi-package,p2w_r619ac,board-p2w_r619ac.qca4019,P&W R619AC)) +$(eval $(call generate-ipq-wifi-package,rt-acrh17,board-rt-acrh17.bin,ASUS RT-ACRH17/RT-AC82U/RT-AC42U)) $(foreach PACKAGE,$(ALLWIFIPACKAGES),$(eval $(call BuildPackage,$(PACKAGE)))) diff --git a/package/firmware/ipq-wifi/board-engenius_eap1300.bin b/package/firmware/ipq-wifi/board-engenius_eap1300.bin new file mode 100644 index 00000000000000..eb4328cd95a6fb Binary files /dev/null and b/package/firmware/ipq-wifi/board-engenius_eap1300.bin differ diff --git a/package/firmware/ipq-wifi/board-hugo_ac1200.bin b/package/firmware/ipq-wifi/board-hugo_ac1200.bin new file mode 100644 index 00000000000000..4061deb93f3937 Binary files /dev/null and b/package/firmware/ipq-wifi/board-hugo_ac1200.bin differ diff --git a/package/firmware/ipq-wifi/board-linksys_ea6350v3.bin b/package/firmware/ipq-wifi/board-linksys_ea6350v3.bin new file mode 100644 index 00000000000000..dbc85bfe1dca9c Binary files /dev/null and b/package/firmware/ipq-wifi/board-linksys_ea6350v3.bin differ diff --git a/package/firmware/ipq-wifi/board-mobipromo_cm520-79f.qca4019 b/package/firmware/ipq-wifi/board-mobipromo_cm520-79f.qca4019 new file mode 100644 index 00000000000000..d717af12fe24a0 Binary files /dev/null and b/package/firmware/ipq-wifi/board-mobipromo_cm520-79f.qca4019 differ diff --git a/package/firmware/ipq-wifi/board-p2w_r619ac.qca4019 b/package/firmware/ipq-wifi/board-p2w_r619ac.qca4019 new file mode 100644 index 00000000000000..a1b1166f6f9dd7 Binary files /dev/null and b/package/firmware/ipq-wifi/board-p2w_r619ac.qca4019 differ diff --git a/package/firmware/ipq-wifi/board-rt-acrh17.bin b/package/firmware/ipq-wifi/board-rt-acrh17.bin new file mode 100644 index 00000000000000..00421bef239e27 Binary files /dev/null and b/package/firmware/ipq-wifi/board-rt-acrh17.bin differ diff --git a/package/firmware/ipq-wifi/board-zyxel_wre6606.bin b/package/firmware/ipq-wifi/board-zyxel_wre6606.bin deleted file mode 100644 index 262c07b04a898e..00000000000000 Binary files a/package/firmware/ipq-wifi/board-zyxel_wre6606.bin and /dev/null differ diff --git a/package/firmware/layerscape/fman-ucode/Makefile b/package/firmware/layerscape/fman-ucode/Makefile index 495aee99e7be7d..9561fbc0b369c6 100644 --- a/package/firmware/layerscape/fman-ucode/Makefile +++ b/package/firmware/layerscape/fman-ucode/Makefile @@ -6,84 +6,46 @@ # include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/image.mk PKG_NAME:=fman-ucode -PKG_SOURCE_DATE:=2017-02-13 +PKG_VERSION:=lsdk-1903 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/NXP/qoriq-fm-ucode.git PKG_SOURCE_VERSION:=c275e91392e2adab1ed22f3867b8269ca3c54014 -PKG_MIRROR_HASH:=1a4611d528f67f3acfa88aefdec9a9a67d96a3139ac5fe1089f599272e6c4a52 - -PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) - -PKG_FLAGS:=nonshared +PKG_MIRROR_HASH:=a630f1a86e4a67a0e390312291702560e3f64dd74fe6ccb8f3be4584d00c7f80 include $(INCLUDE_DIR)/package.mk -define fman/Default - TITLE:= - CONFIG:= -endef - -define fman/ls1043ardb - TITLE=FMAN UCODE $(PKG_NAME)-$(PKG_VERSION) for NXP ls1043ardb 64b/32b Dev Board - CONFIG=fsl_fman_ucode_ls1043_r1.1_106_4_18.bin -endef - -define fman/ls1046ardb - TITLE=FMAN UCODE $(PKG_NAME)-$(PKG_VERSION) for NXP ls1046ardb 64b/32b Dev Board - CONFIG=fsl_fman_ucode_ls1046_r1.0_106_4_18.bin -endef - -FMANS := \ - ls1043ardb \ - ls1046ardb - -define Package/fman/template -define Package/fman-layerscape-$(1) - SECTION:=firmware - CATEGORY:=Firmware - DEPENDS:=@TARGET_layerscape - TITLE:=$(2) - URL:=https://github.com/qoriq-open-source/fm-ucode.git - VARIANT:=$(1) - MAINTAINER:=Jiang Yutang -endef +define Package/layerscape-fman-ls1043ardb + SECTION:=firmware + CATEGORY:=Firmware + TITLE:=NXP LS1043ARDB FMan ucode + DEPENDS:=@TARGET_layerscape + CONFIG:=fsl_fman_ucode_ls1043_r1.1_106_4_18.bin endef -define BuildFMANPackage - $(eval $(fman/Default)) - $(eval $(fman/$(1))) - $(call Package/fman/template,$(1),$(TITLE)) +define Package/layerscape-fman-ls1046ardb + SECTION:=firmware + CATEGORY:=Firmware + TITLE:=NXP LS1046ARDB FMan ucode + DEPENDS:=@TARGET_layerscape + CONFIG:=fsl_fman_ucode_ls1046_r1.0_106_4_18.bin endef -ifdef BUILD_VARIANT -$(eval $(call fman/$(BUILD_VARIANT))) -FMAN_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT)) -endif - define Build/Compile endef -define Package/fman/install/default +define Package/layerscape-fman-ls1043ardb/install $(INSTALL_DIR) $(STAGING_DIR_IMAGE) - $(CP) $(PKG_BUILD_DIR)/$(FMAN_CONFIG) $(STAGING_DIR_IMAGE)/$(1)-fman.bin + $(CP) $(PKG_BUILD_DIR)/$(CONFIG) $(STAGING_DIR_IMAGE)/ls1043ardb-fman.bin endef -define Package/fman/install/template -define Package/fman-layerscape-$(1)/install - $(call Package/fman/install/default,$(2)) -endef +define Package/layerscape-fman-ls1046ardb/install + $(INSTALL_DIR) $(STAGING_DIR_IMAGE) + $(CP) $(PKG_BUILD_DIR)/$(CONFIG) $(STAGING_DIR_IMAGE)/ls1046ardb-fman.bin endef -$(foreach f,$(FMANS), \ - $(eval $(call Package/fman/install/template,$(f),$(f))) \ -) - -$(foreach f,$(FMANS), \ - $(eval $(call BuildFMANPackage,$(f))) \ - $(eval $(call BuildPackage,fman-layerscape-$(f))) \ -) +$(eval $(call BuildPackage,layerscape-fman-ls1043ardb)) +$(eval $(call BuildPackage,layerscape-fman-ls1046ardb)) diff --git a/package/firmware/layerscape/ls-dpl/Makefile b/package/firmware/layerscape/ls-dpl/Makefile index 86483cab89f68b..8d2ab965c69bf0 100644 --- a/package/firmware/layerscape/ls-dpl/Makefile +++ b/package/firmware/layerscape/ls-dpl/Makefile @@ -8,40 +8,39 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ls-dpl -PKG_SOURCE_DATE:=2017-09-07 +PKG_VERSION:=lsdk-1903 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/qoriq-open-source/dpl-examples.git -PKG_SOURCE_VERSION:=a6c83759c0d9c02822eec89e86357a0998ef51d4 -PKG_MIRROR_HASH:=d0311591843fbf9faebc7e2f0d53cba47d42ef21c4407c5881f354df6c458ce5 - -PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) - -PKG_FLAGS:=nonshared +PKG_SOURCE_URL:=https://source.codeaurora.org/external/qoriq/qoriq-components/mc-utils +PKG_SOURCE_VERSION:=eeb8972a3d4137c87a54c2795452b17f254a68c7 +PKG_MIRROR_HASH:=e96e72793fb9fea1d4f5112d318059ea4c836d65c02852d207407edf13fc92af include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/kernel.mk define Package/layerscape-dpl-ls1088ardb SECTION:=firmware CATEGORY:=Firmware - DEPENDS:=@TARGET_layerscape TITLE:=NXP LS1088ARDB DPL firmware - VARIANT:=ls1088ardb - DPC_CONFIG:=ls1088a/RDB/dpc.0x1D-0x0D.dtb - DPL_CONFIG:=ls1088a/RDB/dpl-eth.0x1D_0x0D.dtb + DEPENDS:=@TARGET_layerscape + DPC_CONFIG:=config/ls1088a/RDB/dpc.0x1D-0x0D.dtb + DPL_CONFIG:=config/ls1088a/RDB/dpl-eth.0x1D_0x0D.dtb endef define Package/layerscape-dpl-ls2088ardb SECTION:=firmware CATEGORY:=Firmware - DEPENDS:=@TARGET_layerscape TITLE:=NXP LS2088ARDB DPL firmware - VARIANT:=ls2088ardb - DPC_CONFIG:=ls2088a/RDB/dpc.0x2A_0x41.dtb - DPL_CONFIG:=ls2088a/RDB/dpl-eth.0x2A_0x41.dtb + DEPENDS:=@TARGET_layerscape + DPC_CONFIG:=config/ls2088a/RDB/dpc.0x2A_0x41.dtb + DPL_CONFIG:=config/ls2088a/RDB/dpl-eth.0x2A_0x41.dtb endef +MAKE_PATH:=config +MAKE_VARS+= \ + PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) + define Package/layerscape-dpl-ls1088ardb/install $(INSTALL_DIR) $(STAGING_DIR_IMAGE) $(CP) $(PKG_BUILD_DIR)/$(DPL_CONFIG) $(STAGING_DIR_IMAGE)/ls1088ardb-dpl.dtb diff --git a/package/firmware/layerscape/ls-mc/Makefile b/package/firmware/layerscape/ls-mc/Makefile index 86683d5a4c83bd..657b3b33b76411 100644 --- a/package/firmware/layerscape/ls-mc/Makefile +++ b/package/firmware/layerscape/ls-mc/Makefile @@ -8,36 +8,30 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ls-mc -PKG_SOURCE_DATE:=2014-07-02 +PKG_VERSION:=lsdk-1903 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/NXP/qoriq-mc-binary.git -PKG_SOURCE_VERSION:=40b0c8b7edfd2d8f989619b12d6352472455c696 -PKG_MIRROR_HASH:=b3c8db70de8617e5bc033951b5ad3824f98353303870d6035668075daf93382e - -PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) - -PKG_FLAGS:=nonshared +PKG_SOURCE_VERSION:=bd64d1824681b009fd83b0a3699e45b117b72695 +PKG_MIRROR_HASH:=17ecfd780b8d884b3843d2b8fbcaf29410fdacdc03ab3fe81ae7ade994d7fc0a include $(INCLUDE_DIR)/package.mk define Package/layerscape-mc-ls1088ardb SECTION:=firmware CATEGORY:=Firmware - DEPENDS:=@TARGET_layerscape TITLE:=NXP LS1088ARDB MC firmware - VARIANT:=ls1088ardb - CONFIG:=ls1088a/mc_10.4.0_ls1088a_20171101.itb + DEPENDS:=@TARGET_layerscape + CONFIG:=ls1088a/mc_10.14.3_ls1088a.itb endef define Package/layerscape-mc-ls2088ardb SECTION:=firmware CATEGORY:=Firmware - DEPENDS:=@TARGET_layerscape TITLE:=NXP LS2088ARDB MC firmware - VARIANT:=ls2088ardb - CONFIG:=ls2088a/mc_10.4.0_ls2088a_20171101.itb + DEPENDS:=@TARGET_layerscape + CONFIG:=ls2088a/mc_10.14.3_ls2088a.itb endef define Build/Compile diff --git a/package/firmware/layerscape/ls-ppa/Makefile b/package/firmware/layerscape/ls-ppa/Makefile deleted file mode 100644 index 89d653077ec703..00000000000000 --- a/package/firmware/layerscape/ls-ppa/Makefile +++ /dev/null @@ -1,111 +0,0 @@ -# -# Copyright 2017 NXP -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/image.mk - -PKG_NAME:=ls-ppa -PKG_SOURCE_DATE:=2018-01-18 -PKG_RELEASE:=1 - -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/yangbolu1991/ppa-binary.git -PKG_SOURCE_VERSION:=cd295be24cadae51741154f3b1c935c7b9064230 -PKG_MIRROR_HASH:=743ca493f640d5fb2e99ad7b1da030f9088546f1ad70b5d1e61eb98a969c00c5 - -PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) - -PKG_FLAGS:=nonshared - -include $(INCLUDE_DIR)/package.mk - -define ppa/Default - TITLE:= - CONFIG:= -endef - -define ppa/ls1043ardb - TITLE=PPA firmware $(PKG_VERSION) for NXP ls1043ardb 64b/32b Dev Board - CONFIG=ppa-ls1043a.itb -endef - -define ppa/ls1046ardb - TITLE=PPA firmware $(PKG_VERSION) for NXP ls1046ardb 64b/32b Dev Board - CONFIG=ppa-ls1046a.itb -endef - -define ppa/ls1012ardb - TITLE=PPA firmware $(PKG_VERSION) for NXP ls1012ardb 64b/32b Dev Board - CONFIG=ppa-ls1012a.itb -endef - -define ppa/ls1088ardb - TITLE=PPA firmware $(PKG_VERSION) for NXP ls1088ardb 64b/32b Dev Board - CONFIG=ppa-ls1088a.itb -endef - -define ppa/ls2088ardb - TITLE=PPA firmware $(PKG_VERSION) for NXP ls2088ardb 64b/32b Dev Board - CONFIG=ppa-ls2088a.itb -endef - -define ppa/ls1012afrdm - TITLE=PPA firmware $(PKG_VERSION) for NXP ls1012afrdm 64b/32b Dev Board - CONFIG=ppa-ls1012a.itb -endef - -PPAS := \ - ls1043ardb \ - ls1046ardb \ - ls1012ardb \ - ls1088ardb \ - ls2088ardb \ - ls1012afrdm - -define Package/ppa/template -define Package/layerscape-ppa-$(1) - SECTION:=firmware - CATEGORY:=Firmware - DEPENDS:= @TARGET_layerscape - TITLE:=$(2) - VARIANT:=$(1) -endef -endef - -define BuildPPAPackage - $(eval $(ppa/Default)) - $(eval $(ppa/$(1))) - $(call Package/ppa/template,$(1),$(TITLE)) -endef - -ifdef BUILD_VARIANT -$(eval $(call ppa/$(BUILD_VARIANT))) -PPA_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT)) -endif - -define Build/Compile -endef - -define Package/ppa/install/default - $(INSTALL_DIR) $(STAGING_DIR_IMAGE) - $(CP) $(PKG_BUILD_DIR)/$(PPA_CONFIG) $(STAGING_DIR_IMAGE)/$(1)-ppa.itb -endef - -define Package/ppa/install/template -define Package/layerscape-ppa-$(1)/install - $(call Package/ppa/install/default,$(2)) -endef -endef - -$(foreach r,$(PPAS), \ - $(eval $(call Package/ppa/install/template,$(r),$(r))) \ -) - -$(foreach r,$(PPAS), \ - $(eval $(call BuildPPAPackage,$(r))) \ - $(eval $(call BuildPackage,layerscape-ppa-$(r))) \ -) diff --git a/package/firmware/layerscape/ls-rcw-bin/Makefile b/package/firmware/layerscape/ls-rcw-bin/Makefile deleted file mode 100644 index 589124e448591c..00000000000000 --- a/package/firmware/layerscape/ls-rcw-bin/Makefile +++ /dev/null @@ -1,99 +0,0 @@ -# -# Copyright 2017 NXP -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/image.mk - -PKG_NAME:=ls-rcw-bin -PKG_SOURCE_DATE:=2017-11-19 -PKG_RELEASE:=1 - -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/NXP/qoriq-rcw-bin.git -PKG_SOURCE_VERSION:=bf3ae3cb15829876007c553509501cdaa16745e7 -PKG_MIRROR_HASH:=dc14a47e9529578c63d9ad2bf4e27ef565a055e4121ce2d1324c019f69074314 - -PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) - -PKG_FLAGS:=nonshared - -include $(INCLUDE_DIR)/package.mk - -define rcw-bin/Default - TITLE:= - CONFIG:= -endef - -define rcw-bin/ls1012ardb - TITLE=NXP LS1012ARDB RCW Binary - CONFIG=ls1012ardb/R_SPNH_3508/PBL_0x35_0x08_1000_250_1000_default.bin -endef - -define rcw-bin/ls1088ardb - TITLE=NXP LS1088ARDB RCW Binary - CONFIG=ls1088ardb/FCQQQQQQQQ_PPP_H_0x1d_0x0d/PBL_QSPI_1600_700_2100_0x1d_0x0d.bin -endef - -define rcw-bin/ls2088ardb - TITLE=NXP LS2088ARDB RCW Binary - CONFIG=ls2088ardb/FFFFFFFF_PP_HH_0x2a_0x41/PBL_0x2a_0x41_1800_700_1866_1600.bin -endef - -define rcw-bin/ls1012afrdm - TITLE=NXP LS1012AFRDM RCW Binary - CONFIG=ls1012afrdm/N_SSNP_3305/PBL_0x33_0x05_800_250_1000_default.bin -endef - -RCWS := \ - ls1012ardb \ - ls1088ardb \ - ls2088ardb \ - ls1012afrdm - -define Package/rcw-bin/template -define Package/rcw-layerscape-$(1) - SECTION:=firmware - CATEGORY:=Firmware - DEPENDS:=@TARGET_layerscape - TITLE:=$(2) - VARIANT:=$(1) -endef -endef - -define BuildRCWPackage - $(eval $(rcw-bin/Default)) - $(eval $(rcw-bin/$(1))) - $(call Package/rcw-bin/template,$(1),$(TITLE)) -endef - -ifdef BUILD_VARIANT -$(eval $(call rcw-bin/$(BUILD_VARIANT))) -RCW_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT)) -endif - -define Build/Compile -endef - -define Package/rcw-bin/install/default - $(INSTALL_DIR) $(STAGING_DIR_IMAGE) - $(CP) $(PKG_BUILD_DIR)/$(RCW_CONFIG) $(STAGING_DIR_IMAGE)/$(1)-rcw.bin -endef - -define Package/rcw-bin/install/template -define Package/rcw-layerscape-$(1)/install - $(call Package/rcw-bin/install/default,$(2)) -endef -endef - -$(foreach r,$(RCWS), \ - $(eval $(call Package/rcw-bin/install/template,$(r),$(r))) \ -) - -$(foreach r,$(RCWS), \ - $(eval $(call BuildRCWPackage,$(r))) \ - $(eval $(call BuildPackage,rcw-layerscape-$(r))) \ -) diff --git a/package/firmware/layerscape/ls-rcw/Makefile b/package/firmware/layerscape/ls-rcw/Makefile index a3326abfb167f4..5bcbff5bc46e3d 100644 --- a/package/firmware/layerscape/ls-rcw/Makefile +++ b/package/firmware/layerscape/ls-rcw/Makefile @@ -6,87 +6,100 @@ # include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/image.mk PKG_NAME:=ls-rcw -PKG_SOURCE_DATE:=2017-12-01 +PKG_VERSION:=lsdk-1903 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/qoriq-open-source/rcw.git -PKG_SOURCE_VERSION:=cbd5e66fcb850e821c8632578410ceba5733a49e -PKG_MIRROR_HASH:=4caad5e0ae2018a0a594f36e46e4a96698420956c64bb73656f380fd46733c3d - -PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) - -PKG_LICENSE:=BSD-3-Clause -PKG_LICENSE_FILES:=LICENSE - -PKG_FLAGS:=nonshared +PKG_SOURCE_URL:=https://source.codeaurora.org/external/qoriq/qoriq-components/rcw +PKG_SOURCE_VERSION:=f1377876cc06a87ec8afa8a3412ca7c8455861f2 +PKG_MIRROR_HASH:=a9c97755809994a668ee5f0e535cef9f344fc5523c4299ac76f26c63976c80bc include $(INCLUDE_DIR)/package.mk -define rcw/Default - TITLE:= - CONFIG:= +define Package/layerscape-rcw/Config + define Package/layerscape-rcw-$(1) + SECTION:=firmware + CATEGORY:=Firmware + TITLE:=$(2) + DEPENDS:=@TARGET_layerscape + CONFIG:=$(3) + endef endef -define rcw/ls1043ardb - TITLE=RCW binary $(PKG_VERSION) for NXP ls1043ardb 64b/32b Dev Board - CONFIG=ls1043ardb/RR_FQPP_1455/rcw_1600.bin +define Package/layerscape-rcw/ls1012ardb + TITLE:=NXP LS1012ARDB RCW binary + CONFIG:=ls1012ardb/R_SPNH_3508/rcw_1000_default.bin endef -define rcw/ls1046ardb - TITLE=RCW binary $(PKG_VERSION) for NXP ls1046ardb 64b/32b Dev Board - CONFIG=ls1046ardb/RR_FFSSPPPH_1133_5559/rcw_1800_qspiboot.bin.swap +define Package/layerscape-rcw/ls1012afrwy + TITLE:=NXP LS1012AFRWY RCW binary + CONFIG:=ls1012afrwy/N_SSNP_3305/rcw_1000_default.bin endef -RCWS := \ - ls1043ardb \ - ls1046ardb - -define Package/rcw/template -define Package/rcw-layerscape-$(1) - SECTION:=firmware - CATEGORY:=Firmware - DEPENDS:= @TARGET_layerscape - TITLE:=$(2) - URL:=http://git.freescale.com/git/cgit.cgi/ppc/sdk/rcw.git - VARIANT:=$(1) - MAINTAINER:=Jiang Yutang +define Package/layerscape-rcw/ls1043ardb + TITLE:=NXP LS1043ARDB RCW binary + CONFIG:=ls1043ardb/RR_FQPP_1455/rcw_1600.bin endef + +define Package/layerscape-rcw/ls1043ardb-sdboot + TITLE:=NXP LS1043ARDB SD card boot RCW binary + CONFIG:=ls1043ardb/RR_FQPP_1455/rcw_1600_sdboot.bin endef -define BuildRCWPackage - $(eval $(rcw/Default)) - $(eval $(rcw/$(1))) - $(call Package/rcw/template,$(1),$(TITLE)) +define Package/layerscape-rcw/ls1046ardb + TITLE:=NXP LS1046ARDB RCW binary + CONFIG:=ls1046ardb/RR_FFSSPPPH_1133_5559/rcw_1800_qspiboot.bin endef -ifdef BUILD_VARIANT -$(eval $(call rcw/$(BUILD_VARIANT))) -RCW_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT)) -endif +define Package/layerscape-rcw/ls1046ardb-sdboot + TITLE:=NXP LS1046ARDB SD card boot RCW binary + CONFIG:=ls1046ardb/RR_FFSSPPPH_1133_5559/rcw_1800_sdboot.bin +endef -define Build/Configure +define Package/layerscape-rcw/ls1088ardb + TITLE:=NXP LS1088ARDB RCW binary + CONFIG:=ls1088ardb/FCQQQQQQQQ_PPP_H_0x1d_0x0d/rcw_1600_qspi.bin endef -define Package/rcw/install/default - $(INSTALL_DIR) $(STAGING_DIR_IMAGE) - $(CP) $(PKG_BUILD_DIR)/$(RCW_CONFIG) $(STAGING_DIR_IMAGE)/$(1)-rcw.bin +define Package/layerscape-rcw/ls1088ardb-sdboot + TITLE:=NXP LS1088ARDB SD card boot RCW binary + CONFIG:=ls1088ardb/FCQQQQQQQQ_PPP_H_0x1d_0x0d/rcw_1600_sd.bin endef -define Package/rcw/install/template -define Package/rcw-layerscape-$(1)/install - $(call Package/rcw/install/default,$(2)) +define Package/layerscape-rcw/ls2088ardb + TITLE:=NXP LS2088ARDB RCW binary + CONFIG:=ls2088ardb/FFFFFFFF_PP_HH_0x2a_0x41/rcw_1800.bin endef + +define Package/layerscape-rcw/ls1021atwr + TITLE:=NXP LS1021ATWR RCW binary + CONFIG:=ls1021atwr/SSR_PNS_30/rcw_1200.bin endef -$(foreach r,$(RCWS), \ - $(eval $(call Package/rcw/install/template,$(r),$(r))) \ -) +define Package/layerscape-rcw/Install + define Package/layerscape-rcw-$(1)/install + $(INSTALL_DIR) $(STAGING_DIR_IMAGE) + $(CP) $(PKG_BUILD_DIR)/$(CONFIG) $(STAGING_DIR_IMAGE)/$(1)-rcw.bin + endef +endef -$(foreach r,$(RCWS), \ - $(eval $(call BuildRCWPackage,$(r))) \ - $(eval $(call BuildPackage,rcw-layerscape-$(r))) \ +RCWS := \ + ls1012ardb \ + ls1012afrwy \ + ls1043ardb \ + ls1043ardb-sdboot \ + ls1046ardb \ + ls1046ardb-sdboot \ + ls1088ardb \ + ls1088ardb-sdboot \ + ls2088ardb \ + ls1021atwr + +$(foreach rcw,$(RCWS), \ + $(eval $(Package/layerscape-rcw/$(rcw))) \ + $(eval $(call Package/layerscape-rcw/Config,$(rcw),$(TITLE),$(CONFIG))) \ + $(eval $(call Package/layerscape-rcw/Install,$(rcw))) \ + $(eval $(call BuildPackage,layerscape-rcw-$(rcw))) \ ) diff --git a/package/firmware/layerscape/ls-rcw/patches/0001-rcw-add-a-python-script-for-byte-swapping.patch b/package/firmware/layerscape/ls-rcw/patches/0001-rcw-add-a-python-script-for-byte-swapping.patch deleted file mode 100644 index a2b7140654a0d4..00000000000000 --- a/package/firmware/layerscape/ls-rcw/patches/0001-rcw-add-a-python-script-for-byte-swapping.patch +++ /dev/null @@ -1,66 +0,0 @@ -From ebded197f9c12168d61973043fd9ebd5d49528a8 Mon Sep 17 00:00:00 2001 -From: Yangbo Lu -Date: Mon, 25 Dec 2017 14:11:02 +0800 -Subject: [PATCH] rcw: add a python script for byte swapping - -Signed-off-by: Yangbo Lu ---- - Makefile | 2 ++ - byte_swap.py | 32 ++++++++++++++++++++++++++++++++ - 2 files changed, 34 insertions(+) - create mode 100755 byte_swap.py - -diff --git a/Makefile b/Makefile -index fb55c8b..27e3ba2 100644 ---- a/Makefile -+++ b/Makefile -@@ -11,6 +11,8 @@ all install clean: - @for board in $(BOARDS); do \ - $(MAKE) -C $$board $@ DESTDIR=$(DESTDIR)/$$board; \ - done -+ chmod 755 ./byte_swap.py; \ -+ ./byte_swap.py ls1046ardb/RR_FFSSPPPH_1133_5559/rcw_1800_qspiboot.bin 8 - - release: $(foreach board,$(BOARDS),rcw-$(board)-$(VER).tar.gz) - -diff --git a/byte_swap.py b/byte_swap.py -new file mode 100755 -index 0000000..7ee4129 ---- /dev/null -+++ b/byte_swap.py -@@ -0,0 +1,32 @@ -+#!/usr/bin/env python -+""" -+Swap the 4/8 bytes endian except for PBI CRC -+2016-10-9: Initial version -+ -+Usage: -+ ./byte_swap.py -+""" -+import sys -+ -+try: -+ file_name = sys.argv[1] -+ byte = int(sys.argv[2]) -+except: -+ print("Usage: ./byte_swap.py ") -+ print("E.g.: ./byte_swap.py rcw_1600.bin 8\n") -+ exit -+ -+with open(file_name,'rb') as file: -+ tmp = file.read() -+file.close() -+ -+with open(file_name + '.swap','wb') as file: -+ for i in range(0, len(tmp) - 1, byte): -+ if(tmp[i:i+4].encode('hex')) == "08610040": -+ #print("PBI CRC command") -+ file.write(tmp[i:i+8]) -+ break -+ file.write(tmp[i:i+byte][::-1]) -+file.close() -+ -+print("Swapped file: " + file_name + '.swap') --- -2.7.4 - diff --git a/package/firmware/layerscape/ls-rcw/patches/0001-rcw-support-byte-swapping-without-tclsh-tool.patch b/package/firmware/layerscape/ls-rcw/patches/0001-rcw-support-byte-swapping-without-tclsh-tool.patch new file mode 100644 index 00000000000000..08492dd479a8db --- /dev/null +++ b/package/firmware/layerscape/ls-rcw/patches/0001-rcw-support-byte-swapping-without-tclsh-tool.patch @@ -0,0 +1,82 @@ +From c87a500c45f36ad248b1298d63e590d1d7e74f12 Mon Sep 17 00:00:00 2001 +From: Yangbo Lu +Date: Tue, 3 Jul 2018 11:06:47 +0800 +Subject: [PATCH] rcw: support byte swapping without tclsh tool + +Signed-off-by: Yangbo Lu +--- + Makefile | 4 ---- + byte_swap.py | 32 ++++++++++++++++++++++++++++++++ + qspi_swap.sh | 2 +- + 3 files changed, 33 insertions(+), 5 deletions(-) + create mode 100755 byte_swap.py + +diff --git a/Makefile b/Makefile +index 9f0587e..393bb2c 100644 +--- a/Makefile ++++ b/Makefile +@@ -13,10 +13,6 @@ TCLSH := $(shell command -v tclsh 2> /dev/null) + VER = $(shell git describe --tags) + + all install clean: +-ifndef TCLSH +- $(error "tclsh is not available. please install it.") +- exit 1 +-endif + @for board in $(BOARDS); do \ + $(MAKE) -C $$board $@ DESTDIR=$(DESTDIR)/$$board; \ + done +diff --git a/byte_swap.py b/byte_swap.py +new file mode 100755 +index 0000000..386310e +--- /dev/null ++++ b/byte_swap.py +@@ -0,0 +1,32 @@ ++#!/usr/bin/env python ++""" ++Swap the 4/8 bytes endian except for PBI CRC ++2016-10-9: Initial version ++ ++Usage: ++ ./byte_swap.py ++""" ++import sys ++ ++try: ++ file_name = sys.argv[1] ++ byte = int(sys.argv[2]) ++except: ++ print("Usage: ./byte_swap.py ") ++ print("E.g.: ./byte_swap.py rcw_1600.bin 8\n") ++ exit ++ ++with open(file_name,'rb') as file: ++ tmp = file.read() ++file.close() ++ ++with open(file_name + '.swapped','wb') as file: ++ for i in range(0, len(tmp) - 1, byte): ++ if(tmp[i:i+4].encode('hex')) == "08610040": ++ #print("PBI CRC command") ++ file.write(tmp[i:i+8]) ++ break ++ file.write(tmp[i:i+byte][::-1]) ++file.close() ++ ++print("Swapped file: " + file_name + '.swapped') +diff --git a/qspi_swap.sh b/qspi_swap.sh +index 0b58e44..d23fd8b 100755 +--- a/qspi_swap.sh ++++ b/qspi_swap.sh +@@ -9,7 +9,7 @@ do + if [ "$board_name" = "$current_dir" ]; then + if [ -e $filename ]; then + swapped_file="$filename.swapped" +- tclsh ../tools/byte_swap.tcl $filename $swapped_file 8 ++ ../byte_swap.py $filename 8 + fi + fi + done < $1 +-- +1.7.1 + diff --git a/package/firmware/layerscape/ppfe-firmware/Makefile b/package/firmware/layerscape/ppfe-firmware/Makefile index dc73f9397bc6b8..662fa237343563 100644 --- a/package/firmware/layerscape/ppfe-firmware/Makefile +++ b/package/firmware/layerscape/ppfe-firmware/Makefile @@ -8,15 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ppfe -PKG_SOURCE_DATE:=2017-12-05 +PKG_VERSION:=lsdk-1903 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/NXP/qoriq-engine-pfe-bin.git -PKG_SOURCE_VERSION:=848002fe4e0e3efb8d13a813e5c123bbc87aa95b -PKG_MIRROR_HASH:=b6867be2f5826e807db15256996e11303ca7bbe06ac18448cbf68827d9a59ae2 - -PKG_FLAGS:=nonshared +PKG_SOURCE_VERSION:=58aa0cac630528ed91fe5639700d6b571c0c07b5 +PKG_MIRROR_HASH:=1234a86e879f2eecd3ac4852bb39e4189b03bb659bec228a1d1ccae5ac0229e6 include $(INCLUDE_DIR)/package.mk @@ -26,8 +24,8 @@ STRIP:=: define Package/layerscape-ppfe SECTION:=firmware CATEGORY:=Firmware - DEPENDS:=@TARGET_layerscape TITLE:=NXP Layerscape PPFE firmware + DEPENDS:=@TARGET_layerscape CONFIG_FW:=ls1012a/u-boot/pfe_fw_sbl.itb CONFIG_BIN1:=ls1012a/slow_path/ppfe_class_ls1012a.elf CONFIG_BIN2:=ls1012a/slow_path/ppfe_tmu_ls1012a.elf diff --git a/package/firmware/linux-firmware/Makefile b/package/firmware/linux-firmware/Makefile index e42874af76faa0..085cce422da3b7 100644 --- a/package/firmware/linux-firmware/Makefile +++ b/package/firmware/linux-firmware/Makefile @@ -8,13 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=linux-firmware +PKG_VERSION:=20191215 PKG_RELEASE:=1 -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git -PKG_SOURCE_DATE:=2017-09-06 -PKG_SOURCE_VERSION:=a61ac5cf8374edbfe692d12f805a1b194f7fead2 -PKG_MIRROR_HASH:=b827bf760de57b907df159c8d38d7c3fb5b4a691781114c47739e20bffb3a312 +PKG_SOURCE_URL:=@KERNEL/linux/kernel/firmware +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_HASH:=c2068ff4a797c0f2c3edbb9488f82a48bca8a995855ea21310a8346195c0ae56 PKG_MAINTAINER:=Felix Fietkau diff --git a/package/firmware/linux-firmware/amdgpu.mk b/package/firmware/linux-firmware/amdgpu.mk new file mode 100644 index 00000000000000..89f11e7c3931a1 --- /dev/null +++ b/package/firmware/linux-firmware/amdgpu.mk @@ -0,0 +1,9 @@ +Package/amdgpu-firmware = $(call Package/firmware-default,AMDGPU Video Driver firmware) +define Package/amdgpu-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/amdgpu + $(CP) \ + $(PKG_BUILD_DIR)/amdgpu/*.bin \ + $(1)/lib/firmware/amdgpu +endef + +$(eval $(call BuildPackage,amdgpu-firmware)) diff --git a/package/firmware/linux-firmware/broadcom.mk b/package/firmware/linux-firmware/broadcom.mk index c0ad19cd690938..4f7492a2d8353e 100644 --- a/package/firmware/linux-firmware/broadcom.mk +++ b/package/firmware/linux-firmware/broadcom.mk @@ -16,6 +16,15 @@ define Package/brcmfmac-firmware-4366b1-pcie/install endef $(eval $(call BuildPackage,brcmfmac-firmware-4366b1-pcie)) +Package/brcmfmac-firmware-4366c0-pcie = $(call Package/firmware-default,Broadcom 4366c0 FullMAC PCIe firmware) +define Package/brcmfmac-firmware-4366c0-pcie/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/brcm/brcmfmac4366c-pcie.bin \ + $(1)/lib/firmware/brcm/ +endef +$(eval $(call BuildPackage,brcmfmac-firmware-4366c0-pcie)) + Package/brcmfmac-firmware-4329-sdio = $(call Package/firmware-default,Broadcom BCM4329 FullMac SDIO firmware) define Package/brcmfmac-firmware-4329-sdio/install $(INSTALL_DIR) $(1)/lib/firmware/brcm @@ -43,6 +52,62 @@ define Package/brcmfmac-firmware-43430-sdio/install endef $(eval $(call BuildPackage,brcmfmac-firmware-43430-sdio)) +Package/brcmfmac-firmware-43430-sdio-rpi-3b = $(call Package/firmware-default,Broadcom BCM43430 NVRAM for Raspberry Pi 3B) +define Package/brcmfmac-firmware-43430-sdio-rpi-3b/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/brcm/brcmfmac43430-sdio.raspberrypi,3-model-b.txt \ + $(1)/lib/firmware/brcm/brcmfmac43430-sdio.raspberrypi,3-model-b.txt +endef +$(eval $(call BuildPackage,brcmfmac-firmware-43430-sdio-rpi-3b)) + +Package/brcmfmac-firmware-43430-sdio-rpi-zero-w = $(call Package/firmware-default,Broadcom BCM43430 NVRAM for Raspberry Pi Zero W) +define Package/brcmfmac-firmware-43430-sdio-rpi-zero-w/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/brcm/brcmfmac43430-sdio.raspberrypi,3-model-b.txt \ + $(1)/lib/firmware/brcm/brcmfmac43430-sdio.raspberrypi,model-zero-w.txt +endef +$(eval $(call BuildPackage,brcmfmac-firmware-43430-sdio-rpi-zero-w)) + +Package/brcmfmac-firmware-43430a0-sdio = $(call Package/firmware-default,Broadcom BCM43430a0 FullMac SDIO firmware) +define Package/brcmfmac-firmware-43430a0-sdio/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/brcm/brcmfmac43430a0-sdio.bin \ + $(1)/lib/firmware/brcm/brcmfmac43430a0-sdio.bin +endef +$(eval $(call BuildPackage,brcmfmac-firmware-43430a0-sdio)) + +Package/brcmfmac-firmware-43455-sdio = $(call Package/firmware-default,Broadcom BCM43455 FullMac SDIO firmware) +define Package/brcmfmac-firmware-43455-sdio/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/brcm/brcmfmac43455-sdio.bin \ + $(1)/lib/firmware/brcm/brcmfmac43455-sdio.bin +endef +$(eval $(call BuildPackage,brcmfmac-firmware-43455-sdio)) + +Package/brcmfmac-firmware-43455-sdio-rpi-3b-plus = $(call Package/firmware-default,Broadcom BCM43455 NVRAM for Raspberry Pi 3B+) +define Package/brcmfmac-firmware-43455-sdio-rpi-3b-plus/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/brcm/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt \ + $(1)/lib/firmware/brcm/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt +endef +$(eval $(call BuildPackage,brcmfmac-firmware-43455-sdio-rpi-3b-plus)) + +Package/brcmfmac-firmware-43455-sdio-rpi-4b = $(call Package/firmware-default,Broadcom BCM43455 NVRAM for Raspberry Pi 4B) +define Package/brcmfmac-firmware-43455-sdio-rpi-4b/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/brcm/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt \ + $(1)/lib/firmware/brcm/brcmfmac43455-sdio.raspberrypi,4-model-b.txt + $(SED) 's/boardflags3=.*/boardflags3=0x44200100/g' \ + $(1)/lib/firmware/brcm/brcmfmac43455-sdio.raspberrypi,4-model-b.txt +endef +$(eval $(call BuildPackage,brcmfmac-firmware-43455-sdio-rpi-4b)) + Package/brcmfmac-firmware-usb = $(call Package/firmware-default,Broadcom BCM43xx fullmac USB firmware) define Package/brcmfmac-firmware-usb/install $(INSTALL_DIR) $(1)/lib/firmware/brcm @@ -73,3 +138,12 @@ define Package/bnx2-firmware/install $(1)/lib/firmware/bnx2/ endef $(eval $(call BuildPackage,bnx2-firmware)) + +Package/bnx2x-firmware = $(call Package/firmware-default,=QLogic 5771x/578xx firmware) +define Package/bnx2x-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/bnx2x + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/bnx2x/* \ + $(1)/lib/firmware/bnx2x/ +endef +$(eval $(call BuildPackage,bnx2x-firmware)) diff --git a/package/firmware/linux-firmware/intel.mk b/package/firmware/linux-firmware/intel.mk index 684513e5a6c9d1..923701c703d4da 100644 --- a/package/firmware/linux-firmware/intel.mk +++ b/package/firmware/linux-firmware/intel.mk @@ -73,7 +73,7 @@ $(eval $(call BuildPackage,iwlwifi-firmware-iwl3160)) Package/iwlwifi-firmware-iwl3168 = $(call Package/firmware-default,Intel Wireless 3168 firmware) define Package/iwlwifi-firmware-iwl3168/install $(INSTALL_DIR) $(1)/lib/firmware - $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-3168-27.ucode $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-3168-29.ucode $(1)/lib/firmware endef $(eval $(call BuildPackage,iwlwifi-firmware-iwl3168)) @@ -136,24 +136,38 @@ $(eval $(call BuildPackage,iwlwifi-firmware-iwl7265)) Package/iwlwifi-firmware-iwl7265d = $(call Package/firmware-default,Intel Wireless 7265D and 3165 firmware) define Package/iwlwifi-firmware-iwl7265d/install $(INSTALL_DIR) $(1)/lib/firmware - $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-7265D-27.ucode $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-7265D-29.ucode $(1)/lib/firmware endef $(eval $(call BuildPackage,iwlwifi-firmware-iwl7265d)) Package/iwlwifi-firmware-iwl8260c = $(call Package/firmware-default,Intel Wireless 8260 and 4165 firmware) define Package/iwlwifi-firmware-iwl8260c/install $(INSTALL_DIR) $(1)/lib/firmware - $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-8000C-31.ucode $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-8000C-36.ucode $(1)/lib/firmware endef $(eval $(call BuildPackage,iwlwifi-firmware-iwl8260c)) Package/iwlwifi-firmware-iwl8265 = $(call Package/firmware-default,Intel Wireless 8265 firmware) define Package/iwlwifi-firmware-iwl8265/install $(INSTALL_DIR) $(1)/lib/firmware - $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-8265-27.ucode $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-8265-36.ucode $(1)/lib/firmware endef $(eval $(call BuildPackage,iwlwifi-firmware-iwl8265)) +Package/iwlwifi-firmware-iwl9000 = $(call Package/firmware-default,Intel Wireless 9000 firmware) +define Package/iwlwifi-firmware-iwl9000/install + $(INSTALL_DIR) $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-9000-pu-b0-jf-b0-46.ucode $(1)/lib/firmware +endef +$(eval $(call BuildPackage,iwlwifi-firmware-iwl9000)) + +Package/iwlwifi-firmware-iwl9260 = $(call Package/firmware-default,Intel Wireless 9260 firmware) +define Package/iwlwifi-firmware-iwl9260/install + $(INSTALL_DIR) $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-9260-th-b0-jf-b0-46.ucode $(1)/lib/firmware +endef +$(eval $(call BuildPackage,iwlwifi-firmware-iwl9260)) + Package/e100-firmware = $(call Package/firmware-default,Intel e100) define Package/e100-firmware/install $(INSTALL_DIR) $(1)/lib/firmware/e100 diff --git a/package/firmware/linux-firmware/marvell.mk b/package/firmware/linux-firmware/marvell.mk index 1b99d7ae020862..6c3f171216cc74 100644 --- a/package/firmware/linux-firmware/marvell.mk +++ b/package/firmware/linux-firmware/marvell.mk @@ -47,9 +47,14 @@ define Package/libertas-sdio-firmware/install $(PKG_BUILD_DIR)/libertas/sd8385.bin \ $(PKG_BUILD_DIR)/libertas/sd8686_v9_helper.bin \ $(PKG_BUILD_DIR)/libertas/sd8686_v9.bin \ - $(PKG_BUILD_DIR)/libertas/sd8688_helper.bin \ - $(PKG_BUILD_DIR)/libertas/sd8688.bin \ $(1)/lib/firmware/libertas + $(INSTALL_DIR) $(1)/lib/firmware/mrvl + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/mrvl/sd8688_helper.bin \ + $(PKG_BUILD_DIR)/mrvl/sd8688.bin \ + $(1)/lib/firmware/mrvl + ln -s ../mrvl/sd8688_helper.bin $(1)/lib/firmware/libertas/sd8688_helper.bin + ln -s ../mrvl/sd8688.bin $(1)/lib/firmware/libertas/sd8688.bin endef $(eval $(call BuildPackage,libertas-sdio-firmware)) diff --git a/package/firmware/linux-firmware/mediatek.mk b/package/firmware/linux-firmware/mediatek.mk index b258551a005e9c..18677bc748d18b 100644 --- a/package/firmware/linux-firmware/mediatek.mk +++ b/package/firmware/linux-firmware/mediatek.mk @@ -41,3 +41,12 @@ define Package/rt73-usb-firmware/install $(INSTALL_DATA) $(PKG_BUILD_DIR)/rt73.bin $(1)/lib/firmware/ endef $(eval $(call BuildPackage,rt73-usb-firmware)) + +Package/mt7622bt-firmware = $(call Package/firmware-default,mt7622bt firmware) +define Package/mt7622bt-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/mediatek + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/mediatek/mt7622pr2h.bin \ + $(1)/lib/firmware/mediatek +endef +$(eval $(call BuildPackage,mt7622bt-firmware)) diff --git a/package/firmware/linux-firmware/qca.mk b/package/firmware/linux-firmware/qca.mk index 0a809d1a2196c7..23fcc0905a28b4 100644 --- a/package/firmware/linux-firmware/qca.mk +++ b/package/firmware/linux-firmware/qca.mk @@ -4,6 +4,10 @@ define Package/ar3k-firmware/install $(CP) \ $(PKG_BUILD_DIR)/ar3k/*.dfu \ $(1)/lib/firmware/ar3k + $(INSTALL_DIR) $(1)/lib/firmware/qca + $(CP) \ + $(PKG_BUILD_DIR)/qca/*.bin \ + $(1)/lib/firmware/qca endef $(eval $(call BuildPackage,ar3k-firmware)) diff --git a/package/firmware/linux-firmware/qca_ath10k.mk b/package/firmware/linux-firmware/qca_ath10k.mk new file mode 100644 index 00000000000000..6019ce26ec5f50 --- /dev/null +++ b/package/firmware/linux-firmware/qca_ath10k.mk @@ -0,0 +1,105 @@ +QCA99X0_BOARD_REV:=ddcec9efd245da9365c474f513a855a55f3ac7fe +QCA99X0_BOARD_FILE:=board-2.bin.$(QCA99X0_BOARD_REV) + +define Download/qca99x0-board + URL:=https://source.codeaurora.org/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0 + URL_FILE:=board-2.bin?id=$(QCA99X0_BOARD_REV) + FILE:=$(QCA99X0_BOARD_FILE) + HASH:=03711ac21e60ef59d3815e235eb721c0c22851b5410299411085aa6f2af45401 +endef +$(eval $(call Download,qca99x0-board)) + +Package/ath10k-firmware-qca4019 = $(call Package/firmware-default,ath10k qca4019 firmware) +define Package/ath10k-firmware-qca4019/install + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA4019/hw1.0 + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/ath10k/QCA4019/hw1.0/board-2.bin \ + $(1)/lib/firmware/ath10k/QCA4019/hw1.0/ + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/ath10k/QCA4019/hw1.0/firmware-5.bin \ + $(1)/lib/firmware/ath10k/QCA4019/hw1.0/firmware-5.bin +endef +# $(eval $(call BuildPackage,ath10k-firmware-qca4019)) + +Package/ath10k-firmware-qca9887 = $(call Package/firmware-default,ath10k qca9887 firmware) +define Package/ath10k-firmware-qca9887/install + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9887/hw1.0 + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/ath10k/QCA9887/hw1.0/firmware-5.bin \ + $(1)/lib/firmware/ath10k/QCA9887/hw1.0/firmware-5.bin + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/ath10k/QCA9887/hw1.0/board.bin \ + $(1)/lib/firmware/ath10k/QCA9887/hw1.0/board.bin +endef +# $(eval $(call BuildPackage,ath10k-firmware-qca9887)) + +Package/ath10k-firmware-qca9888 = $(call Package/firmware-default,ath10k qca9888 firmware) +define Package/ath10k-firmware-qca9888/install + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9888/hw2.0 + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/ath10k/QCA9888/hw2.0/board-2.bin \ + $(1)/lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/ath10k/QCA9888/hw2.0/firmware-5.bin \ + $(1)/lib/firmware/ath10k/QCA9888/hw2.0/firmware-5.bin +endef +$(eval $(call BuildPackage,ath10k-firmware-qca9888)) + +Package/ath10k-firmware-qca988x = $(call Package/firmware-default,ath10k qca988x firmware) +define Package/ath10k-firmware-qca988x/install + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0 + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/ath10k/QCA988X/hw2.0/board.bin \ + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/ + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/ath10k/QCA988X/hw2.0/firmware-5.bin \ + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin +endef +# $(eval $(call BuildPackage,ath10k-firmware-qca988x)) + +Package/ath10k-firmware-qca6174 = $(call Package/firmware-default,ath10k qca6174 firmware) +define Package/ath10k-firmware-qca6174/install + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA6174/hw2.1 + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/ath10k/QCA6174/hw2.1/board-2.bin \ + $(1)/lib/firmware/ath10k/QCA6174/hw2.1/ + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/ath10k/QCA6174/hw2.1/firmware-5.bin \ + $(1)/lib/firmware/ath10k/QCA6174/hw2.1/firmware-5.bin + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA6174/hw3.0 + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/ath10k/QCA6174/hw3.0/board-2.bin \ + $(1)/lib/firmware/ath10k/QCA6174/hw3.0/ + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/ath10k/QCA6174/hw3.0/firmware-6.bin \ + $(1)/lib/firmware/ath10k/QCA6174/hw3.0/firmware-6.bin +endef +$(eval $(call BuildPackage,ath10k-firmware-qca6174)) + +Package/ath10k-firmware-qca99x0 = $(call Package/firmware-default,ath10k qca99x0 firmware) +define Package/ath10k-firmware-qca99x0/install + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0 + $(INSTALL_DATA) \ + $(DL_DIR)/$(QCA99X0_BOARD_FILE) \ + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/ath10k/QCA99X0/hw2.0/board.bin \ + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/ath10k/QCA99X0/hw2.0/firmware-5.bin \ + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin +endef +$(eval $(call BuildPackage,ath10k-firmware-qca99x0)) + +Package/ath10k-firmware-qca9984 = $(call Package/firmware-default,ath10k qca9984 firmware) +define Package/ath10k-firmware-qca9984/install + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0 + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/ath10k/QCA9984/hw1.0/board-2.bin \ + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/ath10k/QCA9984/hw1.0/firmware-5.bin \ + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin +endef +$(eval $(call BuildPackage,ath10k-firmware-qca9984)) + diff --git a/package/firmware/linux-firmware/radeon.mk b/package/firmware/linux-firmware/radeon.mk new file mode 100644 index 00000000000000..b750efbfce630c --- /dev/null +++ b/package/firmware/linux-firmware/radeon.mk @@ -0,0 +1,9 @@ +Package/radeon-firmware = $(call Package/firmware-default,Radeon Video Driver firmware) +define Package/radeon-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/radeon + $(CP) \ + $(PKG_BUILD_DIR)/radeon/*.bin \ + $(1)/lib/firmware/radeon +endef + +$(eval $(call BuildPackage,radeon-firmware)) diff --git a/package/firmware/linux-firmware/realtek.mk b/package/firmware/linux-firmware/realtek.mk index fdd92c9a425fc7..87a11c0779afb2 100644 --- a/package/firmware/linux-firmware/realtek.mk +++ b/package/firmware/linux-firmware/realtek.mk @@ -42,6 +42,13 @@ define Package/rtl8192de-firmware/install endef $(eval $(call BuildPackage,rtl8192de-firmware)) +Package/rtl8192eu-firmware = $(call Package/firmware-default,RealTek RTL8192EU firmware) +define Package/rtl8192eu-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192eu_nic.bin $(1)/lib/firmware/rtlwifi +endef +$(eval $(call BuildPackage,rtl8192eu-firmware)) + Package/rtl8192se-firmware = $(call Package/firmware-default,RealTek RTL8192SE firmware) define Package/rtl8192se-firmware/install $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi @@ -56,6 +63,22 @@ define Package/rtl8192su-firmware/install endef $(eval $(call BuildPackage,rtl8192su-firmware)) +Package/rtl8723au-firmware = $(call Package/firmware-default,RealTek RTL8723AU firmware) +define Package/rtl8723au-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8723aufw_A.bin $(1)/lib/firmware/rtlwifi + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8723aufw_B.bin $(1)/lib/firmware/rtlwifi + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8723aufw_B_NoBT.bin $(1)/lib/firmware/rtlwifi +endef +$(eval $(call BuildPackage,rtl8723au-firmware)) + +Package/rtl8723bu-firmware = $(call Package/firmware-default,RealTek RTL8723BU firmware) +define Package/rtl8723bu-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8723bu_nic.bin $(1)/lib/firmware/rtlwifi +endef +$(eval $(call BuildPackage,rtl8723bu-firmware)) + Package/rtl8821ae-firmware = $(call Package/firmware-default,RealTek RTL8821AE firmware) define Package/rtl8821ae-firmware/install $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi @@ -63,3 +86,18 @@ define Package/rtl8821ae-firmware/install $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8821aefw_wowlan.bin $(1)/lib/firmware/rtlwifi endef $(eval $(call BuildPackage,rtl8821ae-firmware)) + +Package/rtl8822be-firmware = $(call Package/firmware-default,RealTek RTL8822BE firmware) +define Package/rtl8822be-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/rtw88 + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtw88/rtw8822b_fw.bin $(1)/lib/firmware/rtw88 +endef +$(eval $(call BuildPackage,rtl8822be-firmware)) + +Package/rtl8822ce-firmware = $(call Package/firmware-default,RealTek RTL8822CE firmware) +define Package/rtl8822ce-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/rtw88 + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtw88/rtw8822c_fw.bin $(1)/lib/firmware/rtw88 + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtw88/rtw8822c_wow_fw.bin $(1)/lib/firmware/rtw88 +endef +$(eval $(call BuildPackage,rtl8822ce-firmware)) diff --git a/package/firmware/linux-firmware/ti.mk b/package/firmware/linux-firmware/ti.mk index ba1baa9793a603..2b9710706bbeed 100644 --- a/package/firmware/linux-firmware/ti.mk +++ b/package/firmware/linux-firmware/ti.mk @@ -5,12 +5,13 @@ define Package/wl12xx-firmware/install $(PKG_BUILD_DIR)/ti-connectivity/wl127x-fw-5-mr.bin \ $(PKG_BUILD_DIR)/ti-connectivity/wl127x-fw-5-plt.bin \ $(PKG_BUILD_DIR)/ti-connectivity/wl127x-fw-5-sr.bin \ - $(PKG_BUILD_DIR)/ti-connectivity/wl1271-nvs.bin \ + $(PKG_BUILD_DIR)/ti-connectivity/wl127x-nvs.bin \ $(PKG_BUILD_DIR)/ti-connectivity/wl128x-fw-5-mr.bin \ $(PKG_BUILD_DIR)/ti-connectivity/wl128x-fw-5-plt.bin \ $(PKG_BUILD_DIR)/ti-connectivity/wl128x-fw-5-sr.bin \ $(PKG_BUILD_DIR)/ti-connectivity/wl128x-nvs.bin \ $(1)/lib/firmware/ti-connectivity + ln -s wl127x-nvs.bin $(1)/lib/firmware/ti-connectivity/wl1271-nvs.bin endef $(eval $(call BuildPackage,wl12xx-firmware)) diff --git a/package/firmware/wireless-regdb/Makefile b/package/firmware/wireless-regdb/Makefile index d06da2c7083de7..47d36ea66b6d68 100644 --- a/package/firmware/wireless-regdb/Makefile +++ b/package/firmware/wireless-regdb/Makefile @@ -20,7 +20,7 @@ define Package/wireless-regdb endef define Build/Compile - python $(PKG_BUILD_DIR)/db2fw.py $(PKG_BUILD_DIR)/regulatory.db $(PKG_BUILD_DIR)/db.txt + $(STAGING_DIR_HOST)/bin/$(PYTHON) $(PKG_BUILD_DIR)/db2fw.py $(PKG_BUILD_DIR)/regulatory.db $(PKG_BUILD_DIR)/db.txt endef define Package/wireless-regdb/install diff --git a/package/firmware/wireless-regdb/patches/100-regdb-write-firmware-file-format-version-code-20.patch b/package/firmware/wireless-regdb/patches/100-regdb-write-firmware-file-format-version-code-20.patch index 0c5c63fc5f6a78..0a2f6c8fa67a43 100644 --- a/package/firmware/wireless-regdb/patches/100-regdb-write-firmware-file-format-version-code-20.patch +++ b/package/firmware/wireless-regdb/patches/100-regdb-write-firmware-file-format-version-code-20.patch @@ -112,140 +112,4 @@ Signed-off-by: Johannes Berg +that compile the database to its binary formats. For more information, please see the CRDA git repository: - ---- /dev/null -+++ b/db2fw.py -@@ -0,0 +1,133 @@ -+#!/usr/bin/env python -+ -+from cStringIO import StringIO -+import struct -+import hashlib -+from dbparse import DBParser -+import sys -+ -+MAGIC = 0x52474442 -+VERSION = 20 -+ -+if len(sys.argv) < 3: -+ print 'Usage: %s output-file input-file' % sys.argv[0] -+ sys.exit(2) -+ -+def create_rules(countries): -+ result = {} -+ for c in countries.itervalues(): -+ for rule in c.permissions: -+ result[rule] = 1 -+ return result.keys() -+ -+def create_collections(countries): -+ result = {} -+ for c in countries.itervalues(): -+ result[(c.permissions, c.dfs_region)] = 1 -+ return result.keys() -+ -+ -+def be32(output, val): -+ output.write(struct.pack('>I', val)) -+def be16(output, val): -+ output.write(struct.pack('>H', val)) -+ -+class PTR(object): -+ def __init__(self, output): -+ self._output = output -+ self._pos = output.tell() -+ be16(output, 0) -+ self._written = False -+ -+ def set(self, val=None): -+ if val is None: -+ val = self._output.tell() -+ assert val & 3 == 0 -+ self._offset = val -+ pos = self._output.tell() -+ self._output.seek(self._pos) -+ be16(self._output, val >> 2) -+ self._output.seek(pos) -+ self._written = True -+ -+ def get(self): -+ return self._offset -+ -+ @property -+ def written(self): -+ return self._written -+ -+p = DBParser() -+countries = p.parse(file(sys.argv[2])) -+rules = create_rules(countries) -+rules.sort(cmp=lambda x, y: cmp(x.freqband, y.freqband)) -+collections = create_collections(countries) -+collections.sort(cmp=lambda x, y: cmp(x[0][0].freqband, y[0][0].freqband)) -+ -+output = StringIO() -+ -+# struct regdb_file_header -+be32(output, MAGIC) -+be32(output, VERSION) -+ -+country_ptrs = {} -+countrynames = countries.keys() -+countrynames.sort() -+for alpha2 in countrynames: -+ coll = countries[alpha2] -+ output.write(struct.pack('>cc', str(alpha2[0]), str(alpha2[1]))) -+ country_ptrs[alpha2] = PTR(output) -+output.write('\x00' * 4) -+ -+reg_rules = {} -+flags = 0 -+for reg_rule in rules: -+ freq_range, power_rule = reg_rule.freqband, reg_rule.power -+ reg_rules[reg_rule] = output.tell() -+ assert power_rule.max_ant_gain == 0 -+ flags = 0 -+ # convert to new rule flags -+ assert reg_rule.flags & ~0x899 == 0 -+ if reg_rule.flags & 1<<0: -+ flags |= 1<<0 -+ if reg_rule.flags & 1<<3: -+ flags |= 1<<1 -+ if reg_rule.flags & 1<<4: -+ flags |= 1<<2 -+ if reg_rule.flags & 1<<7: -+ flags |= 1<<3 -+ if reg_rule.flags & 1<<11: -+ flags |= 1<<4 -+ rule_len = 16 -+ cac_timeout = 0 # TODO -+ if not (flags & 1<<2): -+ cac_timeout = 0 -+ if cac_timeout: -+ rule_len += 2 -+ output.write(struct.pack('>BBHIII', rule_len, flags, power_rule.max_eirp * 100, -+ freq_range.start * 1000, freq_range.end * 1000, freq_range.maxbw * 1000, -+ )) -+ if cac_timeout: -+ output.write(struct.pack('>H', cac_timeout)) -+ while rule_len % 4: -+ output.write('\0') -+ rule_len += 1 -+ -+for coll in collections: -+ for alpha2 in countrynames: -+ if (countries[alpha2].permissions, countries[alpha2].dfs_region) == coll: -+ assert not country_ptrs[alpha2].written -+ country_ptrs[alpha2].set() -+ slen = 3 -+ output.write(struct.pack('>BBBx', slen, len(list(coll[0])), coll[1])) -+ coll = list(coll[0]) -+ for regrule in coll: -+ be16(output, reg_rules[regrule] >> 2) -+ if len(coll) % 2: -+ be16(output, 0) -+ -+for alpha2 in countrynames: -+ assert country_ptrs[alpha2].written -+ -+outfile = open(sys.argv[1], 'w') -+outfile.write(output.getvalue()) + \ No newline at end of file diff --git a/package/firmware/wireless-regdb/patches/600-custom-fix-txpower-and-dfs.patch b/package/firmware/wireless-regdb/patches/600-custom-fix-txpower-and-dfs.patch new file mode 100644 index 00000000000000..b1c9124449eb94 --- /dev/null +++ b/package/firmware/wireless-regdb/patches/600-custom-fix-txpower-and-dfs.patch @@ -0,0 +1,42 @@ +From 7eb6313910023f1be6015a8cd9e1b380ae01af64 Mon Sep 17 00:00:00 2001 +From: Chen Minqiang +Date: Sun, 7 Jan 2018 14:38:36 +0800 +Subject: [PATCH] custom fix txpower and dfs + +--- + db.txt | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/db.txt b/db.txt +index 75dc0a3..24989ad 100644 +--- a/db.txt ++++ b/db.txt +@@ -277,9 +277,9 @@ country CL: DFS-JP + (5735 - 5835 @ 80), (20) + + country CN: DFS-FCC +- (2402 - 2482 @ 40), (20) +- (5170 - 5250 @ 80), (23), AUTO-BW +- (5250 - 5330 @ 80), (23), DFS, AUTO-BW ++ (2402 - 2482 @ 40), (30) ++ (5170 - 5250 @ 80), (30), AUTO-BW ++ (5250 - 5330 @ 80), (30), AUTO-BW + (5735 - 5835 @ 80), (30) + # 60 GHz band channels 1,4: 28dBm, channels 2,3: 44dBm + # ref: http://www.miit.gov.cn/n11293472/n11505629/n11506593/n11960250/n11960606/n11960700/n12330791.files/n12330790.pdf +@@ -1238,9 +1238,9 @@ country UG: DFS-FCC + country US: DFS-FCC + (2402 - 2472 @ 40), (30) + # 5.15 ~ 5.25 GHz: 30 dBm for master mode, 23 dBm for clients +- (5170 - 5250 @ 80), (23), AUTO-BW +- (5250 - 5330 @ 80), (23), DFS, AUTO-BW +- (5490 - 5730 @ 160), (23), DFS ++ (5170 - 5250 @ 80), (30), AUTO-BW ++ (5250 - 5330 @ 80), (30), AUTO-BW ++ (5490 - 5730 @ 160), (30) + (5735 - 5835 @ 80), (30) + # 60g band + # reference: http://cfr.regstoday.com/47cfr15.aspx#47_CFR_15p255 +-- +2.7.4 + diff --git a/package/firmware/wireless-regdb/patches/700-regdb-fix-compatibility-with-python.patch b/package/firmware/wireless-regdb/patches/700-regdb-fix-compatibility-with-python.patch new file mode 100644 index 00000000000000..6e72a9ed1bf8a1 --- /dev/null +++ b/package/firmware/wireless-regdb/patches/700-regdb-fix-compatibility-with-python.patch @@ -0,0 +1,615 @@ +diff --git a/db2bin.py b/db2bin.py +--- a/db2bin.py ++++ b/db2bin.py +@@ -1,6 +1,6 @@ + #!/usr/bin/env python + +-from cStringIO import StringIO ++from io import BytesIO, open + import struct + import hashlib + from dbparse import DBParser +@@ -10,21 +10,21 @@ + VERSION = 19 + + if len(sys.argv) < 3: +- print 'Usage: %s output-file input-file [key-file]' % sys.argv[0] ++ print('Usage: %s output-file input-file [key-file]' % sys.argv[0]) + sys.exit(2) + + def create_rules(countries): + result = {} +- for c in countries.itervalues(): ++ for c in countries.values(): + for rule in c.permissions: + result[rule] = 1 +- return result.keys() ++ return list(result) + + def create_collections(countries): + result = {} +- for c in countries.itervalues(): ++ for c in countries.values(): + result[c.permissions] = 1 +- return result.keys() ++ return list(result) + + + def be32(output, val): +@@ -49,21 +49,25 @@ + return self._offset + + p = DBParser() +-countries = p.parse(file(sys.argv[2])) ++countries = p.parse(open(sys.argv[2], 'r', encoding='utf-8')) ++ ++countrynames = list(countries) ++countrynames.sort() ++ + power = [] + bands = [] +-for c in countries.itervalues(): +- for perm in c.permissions: ++for alpha2 in countrynames: ++ for perm in countries[alpha2].permissions: + if not perm.freqband in bands: + bands.append(perm.freqband) + if not perm.power in power: + power.append(perm.power) + rules = create_rules(countries) +-rules.sort(cmp=lambda x, y: cmp(x.freqband, y.freqband)) ++rules.sort() + collections = create_collections(countries) +-collections.sort(cmp=lambda x, y: cmp(x[0].freqband, y[0].freqband)) ++collections.sort() + +-output = StringIO() ++output = BytesIO() + + # struct regdb_file_header + be32(output, MAGIC) +@@ -104,19 +108,17 @@ + # struct regdb_file_reg_rules_collection + coll = list(coll) + be32(output, len(coll)) +- coll.sort(cmp=lambda x, y: cmp(x.freqband, y.freqband)) ++ coll.sort() + for regrule in coll: + be32(output, reg_rules[regrule]) + + # update country pointer now! + reg_country_ptr.set() + +-countrynames = countries.keys() +-countrynames.sort() + for alpha2 in countrynames: + coll = countries[alpha2] + # struct regdb_file_reg_country +- output.write(struct.pack('>ccxBI', str(alpha2[0]), str(alpha2[1]), coll.dfs_region, reg_rules_collections[coll.permissions])) ++ output.write(struct.pack('>2sxBI', alpha2, coll.dfs_region, reg_rules_collections[coll.permissions])) + + + if len(sys.argv) > 3: +@@ -141,5 +143,5 @@ + else: + siglen.set(0) + +-outfile = open(sys.argv[1], 'w') ++outfile = open(sys.argv[1], 'wb') + outfile.write(output.getvalue()) +diff --git a/dbparse.py b/dbparse.py +--- a/dbparse.py ++++ b/dbparse.py +@@ -1,6 +1,9 @@ + #!/usr/bin/env python + ++from functools import total_ordering + import sys, math ++from math import ceil, log ++from collections import defaultdict, OrderedDict + + # must match enum nl80211_reg_rule_flags + +@@ -25,6 +28,40 @@ + 'DFS-JP': 3, + } + ++@total_ordering ++ ++class WmmRule(object): ++ ++ def __init__(self, vo_c, vi_c, be_c, bk_c, vo_ap, vi_ap, be_ap, bk_ap): ++ self.vo_c = vo_c ++ self.vi_c = vi_c ++ self.be_c = be_c ++ self.bk_c = bk_c ++ self.vo_ap = vo_ap ++ self.vi_ap = vi_ap ++ self.be_ap = be_ap ++ self.bk_ap = bk_ap ++ ++ def _as_tuple(self): ++ return (self.vo_c, self.vi_c, self.be_c, self.bk_c, ++ self.vo_ap, self.vi_ap, self.be_ap, self.bk_ap) ++ ++ def __eq__(self, other): ++ if other is None: ++ return False ++ return (self._as_tuple() == other._as_tuple()) ++ ++ def __ne__(self, other): ++ return not (self == other) ++ ++ def __lt__(self, other): ++ if other is None: ++ return False ++ return (self._as_tuple() < other._as_tuple()) ++ ++ def __hash__(self): ++ return hash(self._as_tuple()) ++ + class FreqBand(object): + def __init__(self, start, end, bw, comments=None): + self.start = start +@@ -32,41 +69,49 @@ + self.maxbw = bw + self.comments = comments or [] + +- def __cmp__(self, other): +- s = self +- o = other +- if not isinstance(o, FreqBand): +- return False +- return cmp((s.start, s.end, s.maxbw), (o.start, o.end, o.maxbw)) ++ def _as_tuple(self): ++ return (self.start, self.end, self.maxbw) ++ ++ def __eq__(self, other): ++ return (self._as_tuple() == other._as_tuple()) ++ ++ def __ne__(self, other): ++ return not (self == other) ++ ++ def __lt__(self, other): ++ return (self._as_tuple() < other._as_tuple()) + + def __hash__(self): +- s = self +- return hash((s.start, s.end, s.maxbw)) ++ return hash(self._as_tuple()) + + def __str__(self): + return '' % ( + self.start, self.end, self.maxbw) + ++@total_ordering + class PowerRestriction(object): + def __init__(self, max_ant_gain, max_eirp, comments = None): + self.max_ant_gain = max_ant_gain + self.max_eirp = max_eirp + self.comments = comments or [] + +- def __cmp__(self, other): +- s = self +- o = other +- if not isinstance(o, PowerRestriction): +- return False +- return cmp((s.max_ant_gain, s.max_eirp), +- (o.max_ant_gain, o.max_eirp)) ++ def _as_tuple(self): ++ return (self.max_ant_gain, self.max_eirp) + +- def __str__(self): +- return '' ++ def __eq__(self, other): ++ return (self._as_tuple() == other._as_tuple()) ++ ++ def __ne__(self, other): ++ return not (self == other) ++ ++ def __lt__(self, other): ++ return (self._as_tuple() < other._as_tuple()) + + def __hash__(self): +- s = self +- return hash((s.max_ant_gain, s.max_eirp)) ++ return hash(self._as_tuple()) ++ ++ def __str__(self): ++ return '' + + class DFSRegionError(Exception): + def __init__(self, dfs_region): +@@ -76,12 +121,15 @@ + def __init__(self, flag): + self.flag = flag + ++@total_ordering + class Permission(object): +- def __init__(self, freqband, power, flags): ++ def __init__(self, freqband, power, flags, wmmrule): + assert isinstance(freqband, FreqBand) + assert isinstance(power, PowerRestriction) ++ assert isinstance(wmmrule, WmmRule) or wmmrule is None + self.freqband = freqband + self.power = power ++ self.wmmrule = wmmrule + self.flags = 0 + for flag in flags: + if not flag in flag_definitions: +@@ -90,26 +138,33 @@ + self.textflags = flags + + def _as_tuple(self): +- return (self.freqband, self.power, self.flags) ++ return (self.freqband, self.power, self.flags, self.wmmrule) + +- def __cmp__(self, other): +- if not isinstance(other, Permission): +- return False +- return cmp(self._as_tuple(), other._as_tuple()) ++ def __eq__(self, other): ++ return (self._as_tuple() == other._as_tuple()) ++ ++ def __ne__(self, other): ++ return not (self == other) ++ ++ def __lt__(self, other): ++ return (self._as_tuple() < other._as_tuple()) + + def __hash__(self): + return hash(self._as_tuple()) + ++ def __str__(self): ++ return str(self.freqband) + str(self.power) + str(self.wmmrule) ++ + class Country(object): + def __init__(self, dfs_region, permissions=None, comments=None): + self._permissions = permissions or [] + self.comments = comments or [] +- self.dfs_region = 0 ++ self.dfs_region = 0 + +- if dfs_region: +- if not dfs_region in dfs_regions: +- raise DFSRegionError(dfs_region) +- self.dfs_region = dfs_regions[dfs_region] ++ if dfs_region: ++ if not dfs_region in dfs_regions: ++ raise DFSRegionError(dfs_region) ++ self.dfs_region = dfs_regions[dfs_region] + + def add(self, perm): + assert isinstance(perm, Permission) +@@ -233,6 +288,61 @@ + self._powerrev[p] = pname + self._powerline[pname] = self._lineno + ++ def _parse_wmmrule(self, line): ++ regions = line[:-1].strip() ++ if not regions: ++ self._syntax_error("'wmmrule' keyword must be followed by region") ++ ++ regions = regions.split(',') ++ ++ self._current_regions = {} ++ for region in regions: ++ if region in self._wmm_rules: ++ self._warn("region %s was added already to wmm rules" % region) ++ self._current_regions[region] = 1 ++ self._comments = [] ++ ++ def _validate_input(self, cw_min, cw_max, aifsn, cot): ++ if cw_min < 1: ++ self._syntax_error("Invalid cw_min value (%d)" % cw_min) ++ if cw_max < 1: ++ self._syntax_error("Invalid cw_max value (%d)" % cw_max) ++ if cw_min > cw_max: ++ self._syntax_error("Inverted contention window (%d - %d)" % ++ (cw_min, cw_max)) ++ if not (bin(cw_min + 1).count('1') == 1 and cw_min < 2**15): ++ self._syntax_error("Invalid cw_min value should be power of 2 - 1 (%d)" ++ % cw_min) ++ if not (bin(cw_max + 1).count('1') == 1 and cw_max < 2**15): ++ self._syntax_error("Invalid cw_max value should be power of 2 - 1 (%d)" ++ % cw_max) ++ if aifsn < 1: ++ self._syntax_error("Invalid aifsn value (%d)" % aifsn) ++ if cot < 0: ++ self._syntax_error("Invalid cot value (%d)" % cot) ++ ++ ++ def _validate_size(self, var, bytcnt): ++ return bytcnt < ceil(len(bin(var)[2:]) / 8.0) ++ ++ def _parse_wmmrule_item(self, line): ++ bytcnt = (2.0, 2.0, 1.0, 2.0) ++ try: ++ ac, cval = line.split(':') ++ if not ac: ++ self._syntax_error("wmm item must have ac prefix") ++ except ValueError: ++ self._syntax_error("access category must be followed by colon") ++ p = tuple([int(v.split('=', 1)[1]) for v in cval.split(',')]) ++ self._validate_input(*p) ++ for v, b in zip(p, bytcnt): ++ if self._validate_size(v, b): ++ self._syntax_error("unexpected input size expect %d got %d" ++ % (b, v)) ++ ++ for r in self._current_regions: ++ self._wmm_rules[r][ac] = p ++ + def _parse_country(self, line): + try: + cname, cvals= line.split(':', 1) +@@ -248,6 +358,7 @@ + for cname in cnames: + if len(cname) != 2: + self._warn("country '%s' not alpha2" % cname) ++ cname = cname.encode('ascii') + if not cname in self._countries: + self._countries[cname] = Country(dfs_region, comments=self._comments) + self._current_countries[cname] = self._countries[cname] +@@ -290,6 +401,15 @@ + line = line.split(',') + pname = line[0] + flags = line[1:] ++ w = None ++ if flags and 'wmmrule' in flags[-1]: ++ try: ++ region = flags.pop().split('=', 1)[1] ++ if region not in self._wmm_rules.keys(): ++ self._syntax_error("No wmm rule for %s" % region) ++ except IndexError: ++ self._syntax_error("flags is empty list or no region was found") ++ w = WmmRule(*self._wmm_rules[region].values()) + + if not bname in self._bands: + self._syntax_error("band does not exist") +@@ -303,10 +423,10 @@ + b = self._bands[bname] + p = self._power[pname] + try: +- perm = Permission(b, p, flags) +- except FlagError, e: ++ perm = Permission(b, p, flags, w) ++ except FlagError as e: + self._syntax_error("Invalid flag '%s'" % e.flag) +- for cname, c in self._current_countries.iteritems(): ++ for cname, c in self._current_countries.items(): + if perm in c: + self._warn('Rule "%s, %s" added to "%s" twice' % ( + bname, pname, cname)) +@@ -315,6 +435,7 @@ + + def parse(self, f): + self._current_countries = None ++ self._current_regions = None + self._bands = {} + self._power = {} + self._countries = {} +@@ -326,6 +447,7 @@ + self._powerdup = {} + self._bandline = {} + self._powerline = {} ++ self._wmm_rules = defaultdict(lambda: OrderedDict()) + + self._comments = [] + +@@ -337,6 +459,7 @@ + self._comments.append(line[1:].strip()) + line = line.replace(' ', '').replace('\t', '') + if not line: ++ self._current_regions = None + self._comments = [] + line = line.split('#')[0] + if not line: +@@ -344,23 +467,35 @@ + if line[0:4] == 'band': + self._parse_band(line[4:]) + self._current_countries = None ++ self._current_regions = None + self._comments = [] + elif line[0:5] == 'power': + self._parse_power(line[5:]) + self._current_countries = None ++ self._current_regions = None + self._comments = [] + elif line[0:7] == 'country': + self._parse_country(line[7:]) + self._comments = [] ++ self._current_regions = None + elif self._current_countries is not None: ++ self._current_regions = None + self._parse_country_item(line) + self._comments = [] ++ elif line[0:7] == 'wmmrule': ++ self._parse_wmmrule(line[7:]) ++ self._current_countries = None ++ self._comments = [] ++ elif self._current_regions is not None: ++ self._parse_wmmrule_item(line) ++ self._current_countries = None ++ self._comments = [] + else: + self._syntax_error("Expected band, power or country definition") + + countries = self._countries + bands = {} +- for k, v in self._bands.iteritems(): ++ for k, v in self._bands.items(): + if k in self._bands_used: + bands[self._banddup[k]] = v + continue +@@ -369,7 +504,7 @@ + self._lineno = self._bandline[k] + self._warn('Unused band definition "%s"' % k) + power = {} +- for k, v in self._power.iteritems(): ++ for k, v in self._power.items(): + if k in self._power_used: + power[self._powerdup[k]] = v + continue +diff --git /dev/null b/db2fw.py +--- /dev/null ++++ b/db2fw.py +@@ -0,0 +1,158 @@ ++#!/usr/bin/env python ++ ++from io import BytesIO, open ++import struct ++import hashlib ++from dbparse import DBParser ++import sys ++from math import log ++ ++MAGIC = 0x52474442 ++VERSION = 20 ++ ++if len(sys.argv) < 3: ++ print('Usage: %s output-file input-file' % sys.argv[0]) ++ sys.exit(2) ++ ++def create_rules(countries): ++ result = {} ++ for c in countries.values(): ++ for rule in c.permissions: ++ result[rule] = 1 ++ return list(result) ++ ++def create_collections(countries): ++ result = {} ++ for c in countries.values(): ++ result[(c.permissions, c.dfs_region)] = 1 ++ return list(result) ++ ++def create_wmms(countries): ++ result = {} ++ for c in countries.values(): ++ for rule in c.permissions: ++ if rule.wmmrule is not None: ++ result[rule.wmmrule] = 1 ++ return list(result) ++ ++def be32(output, val): ++ output.write(struct.pack('>I', val)) ++def be16(output, val): ++ output.write(struct.pack('>H', val)) ++ ++class PTR(object): ++ def __init__(self, output): ++ self._output = output ++ self._pos = output.tell() ++ be16(output, 0) ++ self._written = False ++ ++ def set(self, val=None): ++ if val is None: ++ val = self._output.tell() ++ assert val & 3 == 0 ++ self._offset = val ++ pos = self._output.tell() ++ self._output.seek(self._pos) ++ be16(self._output, val >> 2) ++ self._output.seek(pos) ++ self._written = True ++ ++ def get(self): ++ return self._offset ++ ++ @property ++ def written(self): ++ return self._written ++ ++p = DBParser() ++countries = p.parse(open(sys.argv[2], 'r', encoding='utf-8')) ++rules = create_rules(countries) ++rules.sort() ++collections = create_collections(countries) ++collections.sort() ++wmms = create_wmms(countries) ++wmms.sort() ++ ++output = BytesIO() ++ ++# struct regdb_file_header ++be32(output, MAGIC) ++be32(output, VERSION) ++ ++country_ptrs = {} ++countrynames = list(countries) ++countrynames.sort() ++for alpha2 in countrynames: ++ coll = countries[alpha2] ++ output.write(struct.pack('>2s', alpha2)) ++ country_ptrs[alpha2] = PTR(output) ++output.write(b'\x00' * 4) ++ ++wmmdb = {} ++for w in wmms: ++ assert output.tell() & 3 == 0 ++ wmmdb[w] = output.tell() >> 2 ++ for r in w._as_tuple(): ++ ecw = int(log(r[0] + 1, 2)) << 4 | int(log(r[1] + 1, 2)) ++ ac = (ecw, r[2],r[3]) ++ output.write(struct.pack('>BBH', *ac)) ++ ++reg_rules = {} ++flags = 0 ++for reg_rule in rules: ++ freq_range, power_rule, wmm_rule = reg_rule.freqband, reg_rule.power, reg_rule.wmmrule ++ reg_rules[reg_rule] = output.tell() ++ assert power_rule.max_ant_gain == 0 ++ flags = 0 ++ # convert to new rule flags ++ assert reg_rule.flags & ~0x899 == 0 ++ if reg_rule.flags & 1<<0: ++ flags |= 1<<0 ++ if reg_rule.flags & 1<<3: ++ flags |= 1<<1 ++ if reg_rule.flags & 1<<4: ++ flags |= 1<<2 ++ if reg_rule.flags & 1<<7: ++ flags |= 1<<3 ++ if reg_rule.flags & 1<<11: ++ flags |= 1<<4 ++ rule_len = 16 ++ cac_timeout = 0 # TODO ++ if not (flags & 1<<2): ++ cac_timeout = 0 ++ if cac_timeout or wmm_rule: ++ rule_len += 2 ++ if wmm_rule is not None: ++ rule_len += 2 ++ output.write(struct.pack('>BBHIII', rule_len, flags, int(power_rule.max_eirp * 100), ++ int(freq_range.start * 1000), int(freq_range.end * 1000), int(freq_range.maxbw * 1000), ++ )) ++ if rule_len > 16: ++ output.write(struct.pack('>H', cac_timeout)) ++ ++ if rule_len > 18: ++ be16(output, wmmdb[wmm_rule]) ++ ++ while rule_len % 4: ++ output.write('\0') ++ rule_len += 1 ++ ++for coll in collections: ++ for alpha2 in countrynames: ++ if (countries[alpha2].permissions, countries[alpha2].dfs_region) == coll: ++ assert not country_ptrs[alpha2].written ++ country_ptrs[alpha2].set() ++ slen = 3 ++ output.write(struct.pack('>BBBx', slen, len(list(coll[0])), coll[1])) ++ coll = list(coll[0]) ++ for regrule in coll: ++ be16(output, reg_rules[regrule] >> 2) ++ if len(coll) % 2: ++ be16(output, 0) ++ ++for alpha2 in countrynames: ++ assert country_ptrs[alpha2].written ++ ++outfile = open(sys.argv[1], 'wb') ++outfile.write(output.getvalue()) diff --git a/package/kernel/ath10k-ct/Makefile b/package/kernel/ath10k-ct/Makefile index 097500ebb79167..fb60f5d94c375e 100644 --- a/package/kernel/ath10k-ct/Makefile +++ b/package/kernel/ath10k-ct/Makefile @@ -1,21 +1,21 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ath10k-ct -PKG_RELEASE=3 +PKG_RELEASE=1 PKG_LICENSE:=GPLv2 PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/greearb/ath10k-ct.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2018-03-16 -PKG_SOURCE_VERSION:=30827f7d5b9841905c4efe918da2d95fc518c921 -PKG_MIRROR_HASH:=aac023d7f9b09becf27058b1d09ae6d068b14bb6f10c5b5a248c7ee5ecff04dc +PKG_SOURCE_DATE:=2020-01-29 +PKG_SOURCE_VERSION:=3e3d0adb3cc6c6cf56a05ff661796948f09c5aa8 +PKG_MIRROR_HASH:=6341de2d3b19b2a32205a1633bf9556815943a2cff38acbbe5f61c6c0164fdcc -# Build the 4.13 ath10k-ct driver version. Other options are "-4.9", or -# leave un-defined for 4.7 kernel. Probably this should match as closely as +# Build the 4.19 ath10k-ct driver version. Other option is "-4.16". +# Probably this should match as closely as # possible to whatever mac80211 backports version is being used. -CT_KVER="-4.13" +CT_KVER="-4.19" PKG_MAINTAINER:=Ben Greear PKG_BUILD_PARALLEL:=1 @@ -35,6 +35,21 @@ define KernelPackage/ath10k-ct $(PKG_BUILD_DIR)/ath10k$(CT_KVER)/ath10k_core.ko AUTOLOAD:=$(call AutoProbe,ath10k_pci) PROVIDES:=kmod-ath10k + VARIANT:=regular +endef + +define KernelPackage/ath10k-ct/config + + config ATH10K-CT_LEDS + bool "Enable LED support" + default y + depends on PACKAGE_kmod-ath10k-ct || PACKAGE_kmod-ath10k-ct-smallbuffers +endef + +define KernelPackage/ath10k-ct-smallbuffers +$(call KernelPackage/ath10k-ct) + TITLE+= (small buffers for low-RAM devices) + VARIANT:=smallbuffers endef NOSTDINC_FLAGS = \ @@ -50,7 +65,7 @@ ifdef CONFIG_PACKAGE_MAC80211_MESH NOSTDINC_FLAGS += -DCONFIG_MAC80211_MESH endif -CT_MAKEDEFS += CONFIG_ATH10K=m CONFIG_ATH10K_PCI=m +CT_MAKEDEFS += CONFIG_ATH10K=m CONFIG_ATH10K_PCI=m CONFIG_ATH10K_CE=y # This AHB logic is needed for IPQ4019 radios CT_MAKEDEFS += CONFIG_ATH10K_AHB=m @@ -77,6 +92,15 @@ ifdef CONFIG_PACKAGE_ATH_SPECTRAL NOSTDINC_FLAGS += -DCONFIG_ATH10K_SPECTRAL endif +ifeq ($(CONFIG_ATH10K-CT_LEDS),y) + CT_MAKEDEFS += CONFIG_ATH10K_LEDS=y + NOSTDINC_FLAGS += -DCONFIG_ATH10K_LEDS +endif + +ifeq ($(BUILD_VARIANT),smallbuffers) + NOSTDINC_FLAGS += -DCONFIG_ATH10K_SMALLBUFFERS +endif + define Build/Configure cp $(STAGING_DIR)/usr/include/mac80211/ath/*.h $(PKG_BUILD_DIR) endef @@ -94,3 +118,4 @@ define Build/Compile endef $(eval $(call KernelPackage,ath10k-ct)) +$(eval $(call KernelPackage,ath10k-ct-smallbuffers)) diff --git a/package/kernel/ath10k-ct/patches/081-ath10k-calibration-variant.patch b/package/kernel/ath10k-ct/patches/081-ath10k-calibration-variant.patch deleted file mode 100644 index d51451b5964837..00000000000000 --- a/package/kernel/ath10k-ct/patches/081-ath10k-calibration-variant.patch +++ /dev/null @@ -1,113 +0,0 @@ -From d06f26c5c8a41f246a9c40862a77a55725cedbd3 Mon Sep 17 00:00:00 2001 -From: Sven Eckelmann -Date: Fri, 8 Dec 2017 11:37:42 +0100 -Subject: ath10k: search DT for qcom,ath10k-calibration-variant - -Board Data File (BDF) is loaded upon driver boot-up procedure. The right -board data file is identified on QCA4019 using bus, bmi-chip-id and -bmi-board-id. - -The problem, however, can occur when the (default) board data file cannot -fulfill with the vendor requirements and it is necessary to use a different -board data file. - -This problem was solved for SMBIOS by adding a special SMBIOS type 0xF8. -Something similar has to be provided for systems without SMBIOS but with -device trees. No solution was specified by QCA and therefore a new one has -to be found for ath10k. - -The device tree requires addition strings to define the variant name - - wifi@a000000 { - status = "okay"; - qcom,ath10k-calibration-variant = "RT-AC58U"; - }; - - wifi@a800000 { - status = "okay"; - qcom,ath10k-calibration-variant = "RT-AC58U"; - }; - -This would create the boarddata identifiers for the board-2.bin search - - * bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=RT-AC58U - * bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=RT-AC58U - -Signed-off-by: Sven Eckelmann -Signed-off-by: Kalle Valo - -Origin: upstream, https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d06f26c5c8a41f246a9c40862a77a55725cedbd3 ---- - ath10k-4.13/core.c | 40 ++++++++++++++++++++++++++++------ - 1 file changed, 33 insertions(+), 7 deletions(-) - ---- a/ath10k-4.13/core.c -+++ b/ath10k-4.13/core.c -@@ -889,6 +889,28 @@ static int ath10k_core_check_smbios(stru - return 0; - } - -+static int ath10k_core_check_dt(struct ath10k *ar) -+{ -+ struct device_node *node; -+ const char *variant = NULL; -+ -+ node = ar->dev->of_node; -+ if (!node) -+ return -ENOENT; -+ -+ of_property_read_string(node, "qcom,ath10k-calibration-variant", -+ &variant); -+ if (!variant) -+ return -ENODATA; -+ -+ if (strscpy(ar->id.bdf_ext, variant, sizeof(ar->id.bdf_ext)) < 0) -+ ath10k_dbg(ar, ATH10K_DBG_BOOT, -+ "bdf variant string is longer than the buffer can accommodate (variant: %s)\n", -+ variant); -+ -+ return 0; -+} -+ - static int ath10k_download_and_run_otp(struct ath10k *ar) - { - u32 result, address = ar->hw_params.patch_load_addr; -@@ -1522,19 +1544,19 @@ static int ath10k_core_create_board_name - /* strlen(',variant=') + strlen(ar->id.bdf_ext) */ - char variant[9 + ATH10K_SMBIOS_BDF_EXT_STR_LENGTH] = { 0 }; - -+ if (ar->id.bdf_ext[0] != '\0') -+ scnprintf(variant, sizeof(variant), ",variant=%s", -+ ar->id.bdf_ext); -+ - if (ar->id.bmi_ids_valid) { - scnprintf(name, name_len, -- "bus=%s,bmi-chip-id=%d,bmi-board-id=%d", -+ "bus=%s,bmi-chip-id=%d,bmi-board-id=%d%s", - ath10k_bus_str(ar->hif.bus), - ar->id.bmi_chip_id, -- ar->id.bmi_board_id); -+ ar->id.bmi_board_id, variant); - goto out; - } - -- if (ar->id.bdf_ext[0] != '\0') -- scnprintf(variant, sizeof(variant), ",variant=%s", -- ar->id.bdf_ext); -- - scnprintf(name, name_len, - "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x%s", - ath10k_bus_str(ar->hif.bus), -@@ -2964,7 +2986,11 @@ static int ath10k_core_probe_fw(struct a - - ret = ath10k_core_check_smbios(ar); - if (ret) -- ath10k_dbg(ar, ATH10K_DBG_BOOT, "bdf variant name not set.\n"); -+ ath10k_dbg(ar, ATH10K_DBG_BOOT, "SMBIOS bdf variant name not set.\n"); -+ -+ ret = ath10k_core_check_dt(ar); -+ if (ret) -+ ath10k_dbg(ar, ATH10K_DBG_BOOT, "DT bdf variant name not set.\n"); - - ret = ath10k_core_fetch_board_file(ar); - if (ret) { diff --git a/package/kernel/ath10k-ct/patches/100-kernel_compat.patch b/package/kernel/ath10k-ct/patches/100-kernel_compat.patch deleted file mode 100644 index beb0abf6d12b4d..00000000000000 --- a/package/kernel/ath10k-ct/patches/100-kernel_compat.patch +++ /dev/null @@ -1,97 +0,0 @@ ---- a/ath10k/debug.c -+++ b/ath10k/debug.c -@@ -166,11 +166,11 @@ void ath10k_debug_print_hwfw_info(struct - ar->id.subsystem_vendor, ar->id.subsystem_device); - - ath10k_info(ar, "kconfig debug %d debugfs %d tracing %d dfs %d testmode %d\n", -- config_enabled(CONFIG_ATH10K_DEBUG), -- config_enabled(CONFIG_ATH10K_DEBUGFS), -- config_enabled(CONFIG_ATH10K_TRACING), -- config_enabled(CONFIG_ATH10K_DFS_CERTIFIED), -- config_enabled(CONFIG_NL80211_TESTMODE)); -+ IS_ENABLED(CONFIG_ATH10K_DEBUG), -+ IS_ENABLED(CONFIG_ATH10K_DEBUGFS), -+ IS_ENABLED(CONFIG_ATH10K_TRACING), -+ IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED), -+ IS_ENABLED(CONFIG_NL80211_TESTMODE)); - - firmware = ar->normal_mode_fw.fw_file.firmware; - if (firmware) -@@ -3422,7 +3422,7 @@ int ath10k_debug_register(struct ath10k - debugfs_create_file("nf_cal_period", S_IRUSR | S_IWUSR, - ar->debug.debugfs_phy, ar, &fops_nf_cal_period); - -- if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED)) { -+ if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED)) { - debugfs_create_file("dfs_simulate_radar", S_IWUSR, - ar->debug.debugfs_phy, ar, - &fops_simulate_radar); ---- a/ath10k/mac.c -+++ b/ath10k/mac.c -@@ -3604,7 +3604,7 @@ static void ath10k_regd_update(struct at - - regpair = ar->ath_common.regulatory.regpair; - -- if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) { -+ if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) { - nl_dfs_reg = ar->dfs_detector->region; - wmi_dfs_reg = ath10k_mac_get_dfs_region(nl_dfs_reg); - ath10k_dbg(ar, ATH10K_DBG_REGULATORY, -@@ -3638,7 +3638,7 @@ static void ath10k_reg_notifier(struct w - - ath_reg_notifier_apply(wiphy, request, &ar->ath_common.regulatory); - -- if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) { -+ if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) { - ath10k_dbg(ar, ATH10K_DBG_REGULATORY, "reg-notifier: dfs region 0x%x\n", - request->dfs_region); - result = ar->dfs_detector->set_dfs_domain(ar->dfs_detector, -@@ -8938,7 +8938,7 @@ int ath10k_mac_register(struct ath10k *a - if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags)) - ar->hw->netdev_features = NETIF_F_HW_CSUM; - -- if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED)) { -+ if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED)) { - /* Init ath dfs pattern detector */ - ar->ath_common.debug_mask = ATH_DBG_DFS; - ar->dfs_detector = dfs_pattern_detector_init(&ar->ath_common, -@@ -8983,7 +8983,7 @@ err_unregister: - ieee80211_unregister_hw(ar->hw); - - err_dfs_detector_exit: -- if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) -+ if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) - ar->dfs_detector->exit(ar->dfs_detector); - - err_free: -@@ -8998,7 +8998,7 @@ void ath10k_mac_unregister(struct ath10k - { - ieee80211_unregister_hw(ar->hw); - -- if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) -+ if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector) - ar->dfs_detector->exit(ar->dfs_detector); - - kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); ---- a/ath10k/thermal.c -+++ b/ath10k/thermal.c -@@ -192,7 +192,7 @@ int ath10k_thermal_register(struct ath10 - - /* Avoid linking error on devm_hwmon_device_register_with_groups, I - * guess linux/hwmon.h is missing proper stubs. */ -- if (!config_enabled(CONFIG_HWMON)) -+ if (!IS_ENABLED(CONFIG_HWMON)) - return 0; - - hwmon_dev = devm_hwmon_device_register_with_groups(ar->dev, ---- a/ath10k/wmi.c -+++ b/ath10k/wmi.c -@@ -3883,7 +3883,7 @@ void ath10k_wmi_event_dfs(struct ath10k - phyerr->tsf_timestamp, tsf, buf_len); - - /* Skip event if DFS disabled */ -- if (!config_enabled(CONFIG_ATH10K_DFS_CERTIFIED)) -+ if (!IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED)) - return; - - ATH10K_DFS_STAT_INC(ar, pulses_total); diff --git a/package/kernel/ath10k-ct/patches/110-api_fix.patch b/package/kernel/ath10k-ct/patches/110-api_fix.patch deleted file mode 100644 index 9439dd79edc666..00000000000000 --- a/package/kernel/ath10k-ct/patches/110-api_fix.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/ath10k/htt_rx.c -+++ b/ath10k/htt_rx.c -@@ -2514,7 +2514,7 @@ bool ath10k_htt_t2h_msg_handler(struct a - u32 freq = __le32_to_cpu(resp->chan_change.freq); - - ar->tgt_oper_chan = -- __ieee80211_get_channel(ar->hw->wiphy, freq); -+ ieee80211_get_channel(ar->hw->wiphy, freq); - ath10k_dbg(ar, ATH10K_DBG_HTT, - "htt chan change freq %u phymode %s\n", - freq, ath10k_wmi_phymode_str(phymode)); diff --git a/package/kernel/ath10k-ct/patches/120-mac80211-4-14-api.patch b/package/kernel/ath10k-ct/patches/120-mac80211-4-14-api.patch deleted file mode 100644 index d587632692183a..00000000000000 --- a/package/kernel/ath10k-ct/patches/120-mac80211-4-14-api.patch +++ /dev/null @@ -1,104 +0,0 @@ ---- a/ath10k/htt_rx.c -+++ b/ath10k/htt_rx.c -@@ -642,11 +642,11 @@ static void ath10k_htt_rx_h_rates(struct - sgi = (info3 >> 7) & 1; - - status->rate_idx = mcs; -- status->flag |= RX_FLAG_HT; -+ status->encoding = RX_ENC_HT; - if (sgi) -- status->flag |= RX_FLAG_SHORT_GI; -+ status->enc_flags |= RX_ENC_FLAG_SHORT_GI; - if (bw) -- status->flag |= RX_FLAG_40MHZ; -+ status->bw = RATE_INFO_BW_40; - break; - case HTT_RX_VHT: - case HTT_RX_VHT_WITH_TXBF: -@@ -698,10 +698,10 @@ static void ath10k_htt_rx_h_rates(struct - } - - status->rate_idx = mcs; -- status->vht_nss = nss; -+ status->nss = nss; - - if (sgi) -- status->flag |= RX_FLAG_SHORT_GI; -+ status->enc_flags |= RX_ENC_FLAG_SHORT_GI; - - switch (bw) { - /* 20MHZ */ -@@ -709,18 +709,18 @@ static void ath10k_htt_rx_h_rates(struct - break; - /* 40MHZ */ - case 1: -- status->flag |= RX_FLAG_40MHZ; -+ status->bw = RATE_INFO_BW_40; - break; - /* 80MHZ */ - case 2: -- status->vht_flag |= RX_VHT_FLAG_80MHZ; -+ status->bw = RATE_INFO_BW_80; - break; - case 3: -- status->vht_flag |= RX_VHT_FLAG_160MHZ; -+ status->bw = RATE_INFO_BW_160; - break; - } - -- status->flag |= RX_FLAG_VHT; -+ status->encoding = RX_ENC_VHT; - break; - default: - break; -@@ -900,13 +900,10 @@ static void ath10k_htt_rx_h_ppdu(struct - /* New PPDU starts so clear out the old per-PPDU status. */ - status->freq = 0; - status->rate_idx = 0; -- status->vht_nss = 0; -- status->vht_flag &= ~RX_VHT_FLAG_80MHZ; -- status->flag &= ~(RX_FLAG_HT | -- RX_FLAG_VHT | -- RX_FLAG_SHORT_GI | -- RX_FLAG_40MHZ | -- RX_FLAG_MACTIME_END); -+ status->nss = 0; -+ status->encoding = RX_ENC_LEGACY; -+ status->bw = RATE_INFO_BW_20; -+ status->flag &= ~RX_FLAG_MACTIME_END; - status->flag |= RX_FLAG_NO_SIGNAL_VAL; - - ath10k_htt_rx_h_signal(ar, status, rxd); -@@ -959,7 +956,7 @@ static void ath10k_process_rx(struct ath - *status = *rx_status; - - ath10k_dbg(ar, ATH10K_DBG_DATA, -- "rx skb %p len %u peer %pM %s %s sn %u %s%s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u flag 0x%llx fcs-err %i mic-err %i amsdu-more %i\n", -+ "rx skb %p len %u peer %pM %s %s sn %u %s%s%s%s%s%s %srate_idx %u vht_nss %u freq %u band %u flag 0x%x fcs-err %i mic-err %i amsdu-more %i\n", - skb, - skb->len, - ieee80211_get_SA(hdr), -@@ -967,15 +964,15 @@ static void ath10k_process_rx(struct ath - is_multicast_ether_addr(ieee80211_get_DA(hdr)) ? - "mcast" : "ucast", - (__le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4, -- status->flag == 0 ? "legacy" : "", -- status->flag & RX_FLAG_HT ? "ht" : "", -- status->flag & RX_FLAG_VHT ? "vht" : "", -- status->flag & RX_FLAG_40MHZ ? "40" : "", -- status->vht_flag & RX_VHT_FLAG_80MHZ ? "80" : "", -- status->vht_flag & RX_VHT_FLAG_160MHZ ? "160" : "", -- status->flag & RX_FLAG_SHORT_GI ? "sgi " : "", -+ (status->encoding == RX_ENC_LEGACY) ? "legacy" : "", -+ (status->encoding == RX_ENC_HT) ? "ht" : "", -+ (status->encoding == RX_ENC_VHT) ? "vht" : "", -+ (status->bw == RATE_INFO_BW_40) ? "40" : "", -+ (status->bw == RATE_INFO_BW_80) ? "80" : "", -+ (status->bw == RATE_INFO_BW_160) ? "160" : "", -+ status->enc_flags & RX_ENC_FLAG_SHORT_GI ? "sgi " : "", - status->rate_idx, -- status->vht_nss, -+ status->nss, - status->freq, - status->band, status->flag, - !!(status->flag & RX_FLAG_FAILED_FCS_CRC), diff --git a/package/kernel/ath10k-ct/patches/160-ath10k-search-all-IEs-for-variant-before-falling-back.patch b/package/kernel/ath10k-ct/patches/160-ath10k-search-all-IEs-for-variant-before-falling-back.patch deleted file mode 100644 index a82bbda3cc884e..00000000000000 --- a/package/kernel/ath10k-ct/patches/160-ath10k-search-all-IEs-for-variant-before-falling-back.patch +++ /dev/null @@ -1,249 +0,0 @@ -From: Thomas Hebb -Date: Fri, 13 Apr 2018 17:40:26 +0300 -Subject: [PATCH] ath10k: search all IEs for variant before falling back - -commit f2593cb1b291 ("ath10k: Search SMBIOS for OEM board file -extension") added a feature to ath10k that allows Board Data File -(BDF) conflicts between multiple devices that use the same device IDs -but have different calibration requirements to be resolved by allowing -a "variant" string to be stored in SMBIOS [and later device tree, added -by commit d06f26c5c8a4 ("ath10k: search DT for qcom,ath10k-calibration- -variant")] that gets appended to the ID stored in board-2.bin. - -This original patch had a regression, however. Namely that devices with -a variant present in SMBIOS that didn't need custom BDFs could no longer -find the default BDF, which has no variant appended. The patch was -reverted and re-applied with a fix for this issue in commit 1657b8f84ed9 -("search SMBIOS for OEM board file extension"). - -But the fix to fall back to a default BDF introduced another issue: the -driver currently parses IEs in board-2.bin one by one, and for each one -it first checks to see if it matches the ID with the variant appended. -If it doesn't, it checks to see if it matches the "fallback" ID with no -variant. If a matching BDF is found at any point during this search, the -search is terminated and that BDF is used. The issue is that it's very -possible (and is currently the case for board-2.bin files present in the -ath10k-firmware repository) for the default BDF to occur in an earlier -IE than the variant-specific BDF. In this case, the current code will -happily choose the default BDF even though a better-matching BDF is -present later in the file. - -This patch fixes the issue by first searching the entire file for the ID -with variant, and searching for the fallback ID only if that search -fails. It also includes some code cleanup in the area, as -ath10k_core_fetch_board_data_api_n() no longer does its own string -mangling to remove the variant from an ID, instead leaving that job to a -new flag passed to ath10k_core_create_board_name(). - -I've tested this patch on a QCA4019 and verified that the driver behaves -correctly for 1) both fallback and variant BDFs present, 2) only fallback -BDF present, and 3) no matching BDFs present. - -Fixes: 1657b8f84ed9 ("ath10k: search SMBIOS for OEM board file extension") -Signed-off-by: Thomas Hebb -Signed-off-by: Kalle Valo - -Origin: backport, https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c8489668065a283d3027e86e877b103a87f99d22 ---- - ath10k-4.13/core.c | 134 ++++++++++++++++++--------------- - 1 file changed, 72 insertions(+), 62 deletions(-) - ---- a/ath10k-4.13/core.c -+++ b/ath10k-4.13/core.c -@@ -1419,14 +1419,61 @@ out: - return ret; - } - -+static int ath10k_core_search_bd(struct ath10k *ar, -+ const char *boardname, -+ const u8 *data, -+ size_t len) -+{ -+ size_t ie_len; -+ struct ath10k_fw_ie *hdr; -+ int ret = -ENOENT, ie_id; -+ -+ while (len > sizeof(struct ath10k_fw_ie)) { -+ hdr = (struct ath10k_fw_ie *)data; -+ ie_id = le32_to_cpu(hdr->id); -+ ie_len = le32_to_cpu(hdr->len); -+ -+ len -= sizeof(*hdr); -+ data = hdr->data; -+ -+ if (len < ALIGN(ie_len, 4)) { -+ ath10k_err(ar, "invalid length for board ie_id %d ie_len %zu len %zu\n", -+ ie_id, ie_len, len); -+ return -EINVAL; -+ } -+ -+ switch (ie_id) { -+ case ATH10K_BD_IE_BOARD: -+ ret = ath10k_core_parse_bd_ie_board(ar, data, ie_len, -+ boardname); -+ if (ret == -ENOENT) -+ /* no match found, continue */ -+ break; -+ -+ /* either found or error, so stop searching */ -+ goto out; -+ } -+ -+ /* jump over the padding */ -+ ie_len = ALIGN(ie_len, 4); -+ -+ len -= ie_len; -+ data += ie_len; -+ } -+ -+out: -+ /* return result of parse_bd_ie_board() or -ENOENT */ -+ return ret; -+} -+ - static int ath10k_core_fetch_board_data_api_n(struct ath10k *ar, - const char *boardname, -+ const char *fallback_boardname, - const char *filename) - { -- size_t len, magic_len, ie_len; -- struct ath10k_fw_ie *hdr; -+ size_t len, magic_len; - const u8 *data; -- int ret, ie_id; -+ int ret; - - ar->normal_mode_fw.board = ath10k_fetch_fw_file(ar, - ar->hw_params.fw.dir, -@@ -1464,73 +1511,28 @@ static int ath10k_core_fetch_board_data_ - data += magic_len; - len -= magic_len; - -- while (len > sizeof(struct ath10k_fw_ie)) { -- hdr = (struct ath10k_fw_ie *)data; -- ie_id = le32_to_cpu(hdr->id); -- ie_len = le32_to_cpu(hdr->len); -- -- len -= sizeof(*hdr); -- data = hdr->data; -- -- if (len < ALIGN(ie_len, 4)) { -- ath10k_err(ar, "invalid length for board ie_id %d ie_len %zu len %zu\n", -- ie_id, ie_len, len); -- ret = -EINVAL; -- goto err; -- } -- -- switch (ie_id) { -- case ATH10K_BD_IE_BOARD: -- ret = ath10k_core_parse_bd_ie_board(ar, data, ie_len, -- boardname); -- if (ret == -ENOENT && ar->id.bdf_ext[0] != '\0') { -- /* try default bdf if variant was not found */ -- char *s, *v = ",variant="; -- char boardname2[100]; -- -- strlcpy(boardname2, boardname, -- sizeof(boardname2)); -- -- s = strstr(boardname2, v); -- if (s) -- *s = '\0'; /* strip ",variant=%s" */ -- -- ret = ath10k_core_parse_bd_ie_board(ar, data, -- ie_len, -- boardname2); -- } -- -- if (ret == -ENOENT) -- /* no match found, continue */ -- break; -- else if (ret) -- /* there was an error, bail out */ -- goto err; -- -- /* board data found */ -- goto out; -- } -+ /* attempt to find boardname in the IE list */ -+ ret = ath10k_core_search_bd(ar, boardname, data, len); - -- /* jump over the padding */ -- ie_len = ALIGN(ie_len, 4); -- -- len -= ie_len; -- data += ie_len; -- } -+ /* if we didn't find it and have a fallback name, try that */ -+ if (ret == -ENOENT && fallback_boardname) -+ ret = ath10k_core_search_bd(ar, fallback_boardname, data, len); - - out: -- if (!ar->normal_mode_fw.board_data || !ar->normal_mode_fw.board_len) { -+ if (ret == -ENOENT) { - ath10k_err(ar, - "failed to fetch board data for %s from %s/%s\n", - boardname, ar->hw_params.fw.dir, filename); - ret = -ENODATA; -- goto err; - } - - /* Save firmware board name so we can display it later. */ - strlcpy(ar->normal_mode_fw.fw_file.fw_board_name, filename, - sizeof(ar->normal_mode_fw.fw_file.fw_board_name)); - -+ if (ret) -+ goto err; -+ - return 0; - - err: -@@ -1539,12 +1541,12 @@ err: - } - - static int ath10k_core_create_board_name(struct ath10k *ar, char *name, -- size_t name_len) -+ size_t name_len, bool with_variant) - { - /* strlen(',variant=') + strlen(ar->id.bdf_ext) */ - char variant[9 + ATH10K_SMBIOS_BDF_EXT_STR_LENGTH] = { 0 }; - -- if (ar->id.bdf_ext[0] != '\0') -+ if (with_variant && ar->id.bdf_ext[0] != '\0') - scnprintf(variant, sizeof(variant), ",variant=%s", - ar->id.bdf_ext); - -@@ -1570,21 +1572,31 @@ out: - - static int ath10k_core_fetch_board_file(struct ath10k *ar) - { -- char boardname[100]; -+ char boardname[100], fallback_boardname[100]; - int ret; - -- ret = ath10k_core_create_board_name(ar, boardname, sizeof(boardname)); -+ ret = ath10k_core_create_board_name(ar, boardname, -+ sizeof(boardname), true); - if (ret) { - ath10k_err(ar, "failed to create board name: %d", ret); - return ret; - } - -+ ret = ath10k_core_create_board_name(ar, fallback_boardname, -+ sizeof(boardname), false); -+ if (ret) { -+ ath10k_err(ar, "failed to create fallback board name: %d", ret); -+ return ret; -+ } -+ - ar->bd_api = 2; - if (ar->fwcfg.bname[0]) - ret = ath10k_core_fetch_board_data_api_n(ar, boardname, -+ fallback_boardname, - ar->fwcfg.bname); - else - ret = ath10k_core_fetch_board_data_api_n(ar, boardname, -+ fallback_boardname, - ATH10K_BOARD_API2_FILE); - if (!ret) - goto success; diff --git a/package/kernel/ath10k-ct/patches/161-ath10k-add-support-for-configuring-management-packet.patch b/package/kernel/ath10k-ct/patches/161-ath10k-add-support-for-configuring-management-packet.patch new file mode 100644 index 00000000000000..f18afae32722c8 --- /dev/null +++ b/package/kernel/ath10k-ct/patches/161-ath10k-add-support-for-configuring-management-packet.patch @@ -0,0 +1,89 @@ +From: Sriram R +Date: Mon, 10 Sep 2018 11:09:40 +0530 +Subject: [PATCH] ath10k: add support for configuring management packet rate + +By default the firmware uses 1Mbps and 6Mbps rate for management packets +in 2G and 5G bands respectively. But when the user selects different +basic rates from the userspace, we need to send the management +packets at the lowest basic rate selected by the user. + +This change makes use of WMI_VDEV_PARAM_MGMT_RATE param for configuring the +management packets rate to the firmware. + +Chipsets Tested : QCA988X, QCA9887, QCA9984 +FW Tested : 10.2.4-1.0-41, 10.4-3.6.104 + +Signed-off-by: Sriram R +Signed-off-by: Kalle Valo + +Origin: backport, https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f279294e9ee22a8f306fdc8e4181cf555e6f0f70 +--- +--- a/ath10k-4.19/mac.c ++++ b/ath10k-4.19/mac.c +@@ -157,6 +157,22 @@ u8 ath10k_mac_bitrate_to_idx(const struc + return 0; + } + ++static int ath10k_mac_get_rate_hw_value(int bitrate) ++{ ++ int i; ++ u8 hw_value_prefix = 0; ++ ++ if (ath10k_mac_bitrate_is_cck(bitrate)) ++ hw_value_prefix = WMI_RATE_PREAMBLE_CCK << 6; ++ ++ for (i = 0; i < sizeof(ath10k_rates); i++) { ++ if (ath10k_rates[i].bitrate == bitrate) ++ return hw_value_prefix | ath10k_rates[i].hw_value; ++ } ++ ++ return -EINVAL; ++} ++ + static int ath10k_mac_get_max_vht_mcs_map(u16 mcs_map, int nss) + { + switch ((mcs_map >> (2 * nss)) & 0x3) { +@@ -6413,9 +6429,10 @@ static void ath10k_bss_info_changed(stru + struct cfg80211_chan_def def; + u32 vdev_param, pdev_param, slottime, preamble; + u16 bitrate, hw_value; +- u8 rate; +- int rateidx, ret = 0; ++ u8 rate, basic_rate_idx; ++ int rateidx, ret = 0, hw_rate_code; + enum nl80211_band band; ++ const struct ieee80211_supported_band *sband; + + mutex_lock(&ar->conf_mutex); + +@@ -6621,6 +6638,30 @@ static void ath10k_bss_info_changed(stru + arvif->vdev_id, ret); + } + ++ if (changed & BSS_CHANGED_BASIC_RATES) { ++ if (WARN_ON(ath10k_mac_vif_chan(vif, &def))) { ++ mutex_unlock(&ar->conf_mutex); ++ return; ++ } ++ ++ sband = ar->hw->wiphy->bands[def.chan->band]; ++ basic_rate_idx = ffs(vif->bss_conf.basic_rates) - 1; ++ bitrate = sband->bitrates[basic_rate_idx].bitrate; ++ ++ hw_rate_code = ath10k_mac_get_rate_hw_value(bitrate); ++ if (hw_rate_code < 0) { ++ ath10k_warn(ar, "bitrate not supported %d\n", bitrate); ++ mutex_unlock(&ar->conf_mutex); ++ return; ++ } ++ ++ vdev_param = ar->wmi.vdev_param->mgmt_rate; ++ ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, ++ hw_rate_code); ++ if (ret) ++ ath10k_warn(ar, "failed to set mgmt tx rate %d\n", ret); ++ } ++ + mutex_unlock(&ar->conf_mutex); + } + diff --git a/package/kernel/ath10k-ct/patches/162-ath10k-fix-possible-out-of-bound-access-of-ath10k_ra.patch b/package/kernel/ath10k-ct/patches/162-ath10k-fix-possible-out-of-bound-access-of-ath10k_ra.patch new file mode 100644 index 00000000000000..aa473e8feae68c --- /dev/null +++ b/package/kernel/ath10k-ct/patches/162-ath10k-fix-possible-out-of-bound-access-of-ath10k_ra.patch @@ -0,0 +1,66 @@ +From: Sriram R +Date: Wed, 3 Oct 2018 08:43:50 +0530 +Subject: [PATCH] ath10k: fix possible out of bound access of ath10k_rates array + +While using 'ath10k_mac_get_rate_hw_value()' to obtain the hw value +from the passed bitrate, there is a chance of out of bound array access +when wrong bitrate is passed. This is fixed by comparing the bitrates +within the correct size of the ath10k_rates array. + +Fixes commit f279294e9ee2 ("ath10k: add support for configuring management +packet rate"). Also correction made to some indents used in the above commit. + +Signed-off-by: Sriram R +Signed-off-by: Kalle Valo + +Origin: backport, https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=34e141eea7dd8525dd1ef7a925459e455b4d307f +--- +--- a/ath10k-4.19/mac.c ++++ b/ath10k-4.19/mac.c +@@ -165,7 +165,7 @@ static int ath10k_mac_get_rate_hw_value( + if (ath10k_mac_bitrate_is_cck(bitrate)) + hw_value_prefix = WMI_RATE_PREAMBLE_CCK << 6; + +- for (i = 0; i < sizeof(ath10k_rates); i++) { ++ for (i = 0; i < ARRAY_SIZE(ath10k_rates); i++) { + if (ath10k_rates[i].bitrate == bitrate) + return hw_value_prefix | ath10k_rates[i].hw_value; + } +@@ -6644,22 +6644,22 @@ static void ath10k_bss_info_changed(stru + return; + } + +- sband = ar->hw->wiphy->bands[def.chan->band]; +- basic_rate_idx = ffs(vif->bss_conf.basic_rates) - 1; +- bitrate = sband->bitrates[basic_rate_idx].bitrate; +- +- hw_rate_code = ath10k_mac_get_rate_hw_value(bitrate); +- if (hw_rate_code < 0) { +- ath10k_warn(ar, "bitrate not supported %d\n", bitrate); +- mutex_unlock(&ar->conf_mutex); +- return; +- } ++ sband = ar->hw->wiphy->bands[def.chan->band]; ++ basic_rate_idx = ffs(vif->bss_conf.basic_rates) - 1; ++ bitrate = sband->bitrates[basic_rate_idx].bitrate; ++ ++ hw_rate_code = ath10k_mac_get_rate_hw_value(bitrate); ++ if (hw_rate_code < 0) { ++ ath10k_warn(ar, "bitrate not supported %d\n", bitrate); ++ mutex_unlock(&ar->conf_mutex); ++ return; ++ } + +- vdev_param = ar->wmi.vdev_param->mgmt_rate; +- ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, +- hw_rate_code); +- if (ret) +- ath10k_warn(ar, "failed to set mgmt tx rate %d\n", ret); ++ vdev_param = ar->wmi.vdev_param->mgmt_rate; ++ ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, ++ hw_rate_code); ++ if (ret) ++ ath10k_warn(ar, "failed to set mgmt tx rate %d\n", ret); + } + + mutex_unlock(&ar->conf_mutex); diff --git a/package/kernel/ath10k-ct/patches/163-ath10k-fix-incorrect-multicast-broadcast-rate-settin.patch b/package/kernel/ath10k-ct/patches/163-ath10k-fix-incorrect-multicast-broadcast-rate-settin.patch new file mode 100644 index 00000000000000..fc866f49b5db1a --- /dev/null +++ b/package/kernel/ath10k-ct/patches/163-ath10k-fix-incorrect-multicast-broadcast-rate-settin.patch @@ -0,0 +1,43 @@ +From: Pradeep kumar Chitrapu +Date: Mon, 10 Dec 2018 20:56:11 -0800 +Subject: ath10k: fix incorrect multicast/broadcast rate setting + +Invalid rate code is sent to firmware when multicast rate value of 0 is +sent to driver indicating disabled case, causing broken mesh path. +so fix that. + +Tested on QCA9984 with firmware 10.4-3.6.1-00827 + +Fixes: cd93b83ad92 ("ath10k: support for multicast rate control") +Co-developed-by: Zhi Chen +Signed-off-by: Zhi Chen +Signed-off-by: Pradeep Kumar Chitrapu + +Origin: other, https://patchwork.kernel.org/patch/10723033/ + +--- a/ath10k-4.19/mac.c ++++ b/ath10k-4.19/mac.c +@@ -6429,8 +6429,8 @@ static void ath10k_bss_info_changed(stru + struct cfg80211_chan_def def; + u32 vdev_param, pdev_param, slottime, preamble; + u16 bitrate, hw_value; +- u8 rate, basic_rate_idx; +- int rateidx, ret = 0, hw_rate_code; ++ u8 rate, basic_rate_idx, rateidx; ++ int ret = 0, hw_rate_code, mcast_rate; + enum nl80211_band band; + const struct ieee80211_supported_band *sband; + +@@ -6603,7 +6603,11 @@ static void ath10k_bss_info_changed(stru + if (changed & BSS_CHANGED_MCAST_RATE && + !WARN_ON(ath10k_mac_vif_chan(arvif->vif, &def))) { + band = def.chan->band; +- rateidx = vif->bss_conf.mcast_rate[band] - 1; ++ mcast_rate = vif->bss_conf.mcast_rate[band]; ++ if (mcast_rate > 0) ++ rateidx = mcast_rate - 1; ++ else ++ rateidx = ffs(vif->bss_conf.basic_rates) - 1; + + if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) + rateidx += ATH10K_MAC_FIRST_OFDM_RATE_IDX; diff --git a/package/kernel/ath10k-ct/patches/164-ath10k-commit-rates-from-mac80211.patch b/package/kernel/ath10k-ct/patches/164-ath10k-commit-rates-from-mac80211.patch new file mode 100644 index 00000000000000..617d3570b0e90e --- /dev/null +++ b/package/kernel/ath10k-ct/patches/164-ath10k-commit-rates-from-mac80211.patch @@ -0,0 +1,37 @@ +From: Sven Eckelmann +Date: Tue, 26 Feb 2019 08:06:35 +0100 +Subject: ath10k-ct: apply mac80211 rates to ath10k-ct rate state + +The rates from mac80211 have to be copied to the state of ath10k-ct or +otherwise the ath10k_check_apply_special_rates function overwrites +them again with some default values. This breaks for example the +mcast_rate set for a wifi-iface. + +Signed-off-by: Sven Eckelmann + +--- a/ath10k-4.19/mac.c ++++ b/ath10k-4.19/mac.c +@@ -6625,6 +6625,7 @@ static void ath10k_bss_info_changed(stru + "mac vdev %d mcast_rate %x\n", + arvif->vdev_id, rate); + ++ arvif->mcast_rate[band] = rate; + vdev_param = ar->wmi.vdev_param->mcast_data_rate; + ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, + vdev_param, rate); +@@ -6633,6 +6634,7 @@ static void ath10k_bss_info_changed(stru + "failed to set mcast rate on vdev %i: %d\n", + arvif->vdev_id, ret); + ++ arvif->bcast_rate[band] = rate; + vdev_param = ar->wmi.vdev_param->bcast_data_rate; + ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, + vdev_param, rate); +@@ -6659,6 +6661,7 @@ static void ath10k_bss_info_changed(stru + return; + } + ++ arvif->mgt_rate[def.chan->band] = hw_rate_code; + vdev_param = ar->wmi.vdev_param->mgmt_rate; + ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, + hw_rate_code); diff --git a/package/kernel/ath10k-ct/patches/200-ath10k-move-spectral-scan-support-under-a-separate-c.patch b/package/kernel/ath10k-ct/patches/200-ath10k-move-spectral-scan-support-under-a-separate-c.patch deleted file mode 100644 index bdc82f006701d6..00000000000000 --- a/package/kernel/ath10k-ct/patches/200-ath10k-move-spectral-scan-support-under-a-separate-c.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 42e01cb9cb109fb0bb4743f6c54d6aa67ac39b61 Mon Sep 17 00:00:00 2001 -Message-Id: <42e01cb9cb109fb0bb4743f6c54d6aa67ac39b61.1515610034.git.mschiffer@universe-factory.net> -In-Reply-To: <9df7ddc3ed25b7d3473f117a0680b9418adb5753.1515610034.git.mschiffer@universe-factory.net> -References: <9df7ddc3ed25b7d3473f117a0680b9418adb5753.1515610034.git.mschiffer@universe-factory.net> -From: Matthias Schiffer -Date: Mon, 27 Nov 2017 18:56:23 +0100 -Subject: [PATCH 2/2] ath10k: move spectral scan support under a separate - config symbol - -At the moment, spectral scan support, and with it RELAY, is always enabled -with ATH10K_DEBUGFS. Spectral scan support is currently the only user of -RELAY in ath10k, and it unconditionally reserves a relay channel. - -Having debugfs support in ath10k is often useful even on very small -embedded routers, where we'd rather like to avoid the code size and RAM -usage of the relay support. While ath10k-based devices usually have more -resources than ath9k-based ones, it makes sense to keep the configuration -symmetric to ath9k, so the same base kernel without RELAY can be used for -both ath9k and ath10k hardware. - -Signed-off-by: Matthias Schiffer -Signed-off-by: Kalle Valo ---- - ath10k-4.13/Kconfig | 9 ++++++++- - ath10k-4.13/Makefile | 2 +- - ath10k-4.13/spectral.h | 4 ++-- - 3 files changed, 11 insertions(+), 4 deletions(-) - ---- a/ath10k-4.13/Kconfig -+++ b/ath10k-4.13/Kconfig -@@ -40,12 +40,19 @@ config ATH10K_DEBUG - config ATH10K_DEBUGFS - bool "Atheros ath10k debugfs support" - depends on ATH10K && DEBUG_FS -- select RELAY - ---help--- - Enabled debugfs support - - If unsure, say Y to make it easier to debug problems. - -+config ATH10K_SPECTRAL -+ bool "Atheros ath10k spectral scan support" -+ depends on ATH10K_DEBUGFS -+ select RELAY -+ default n -+ ---help--- -+ Say Y to enable access to the FFT/spectral data via debugfs. -+ - config ATH10K_TRACING - bool "Atheros ath10k tracing support" - depends on ATH10K ---- a/ath10k-4.13/Makefile -+++ b/ath10k-4.13/Makefile -@@ -14,7 +14,7 @@ ath10k_core-y += mac.o \ - p2p.o \ - swap.o - --ath10k_core-$(CONFIG_ATH10K_DEBUGFS) += spectral.o -+ath10k_core-$(CONFIG_ATH10K_SPECTRAL) += spectral.o - ath10k_core-$(CONFIG_NL80211_TESTMODE) += testmode.o - ath10k_core-$(CONFIG_ATH10K_TRACING) += trace.o - ath10k_core-$(CONFIG_THERMAL) += thermal.o ---- a/ath10k-4.13/spectral.h -+++ b/ath10k-4.13/spectral.h -@@ -44,7 +44,7 @@ enum ath10k_spectral_mode { - SPECTRAL_MANUAL, - }; - --#ifdef CONFIG_ATH10K_DEBUGFS -+#ifdef CONFIG_ATH10K_SPECTRAL - - int ath10k_spectral_process_fft(struct ath10k *ar, - struct wmi_phyerr_ev_arg *phyerr, -@@ -85,6 +85,6 @@ static inline void ath10k_spectral_destr - { - } - --#endif /* CONFIG_ATH10K_DEBUGFS */ -+#endif /* CONFIG_ATH10K_SPECTRAL */ - - #endif /* SPECTRAL_H */ diff --git a/package/kernel/ath10k-ct/patches/201-ath10k-4.16_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch b/package/kernel/ath10k-ct/patches/201-ath10k-4.16_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch new file mode 100644 index 00000000000000..311bd22d4e5431 --- /dev/null +++ b/package/kernel/ath10k-ct/patches/201-ath10k-4.16_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch @@ -0,0 +1,606 @@ +From: Sebastian Gottschall + +Adds LED and GPIO Control support for 988x, 9887, 9888, 99x0, 9984 based +chipsets with on chipset connected led's using WMI Firmware API. The LED +device will get available named as "ath10k-phyX" at sysfs and can be controlled +with various triggers. adds also debugfs interface for gpio control. + +This patch is specific for OpenWRt base, as is use old backported package +with old wireless source. Support for QCA9984 is removed. +Reworked to use ath10k-ct custom source + + +Signed-off-by: Sebastian Gottschall +Reviewed-by: Steve deRosier +[kvalo: major reorg and cleanup] +Signed-off-by: Kalle Valo +Signed-off-by: Ansuel Smith +--- + +v13: + +* only compile tested! + +* fix all checkpatch warnings + +* fix commit log + +* sizeof(struct ath10k_gpiocontrol) -> sizeof(*gpio) + +* unsigned -> unsigned int + +* remove GPIOLIB code, that should be added in a separate patch + +* rename gpio.c to leds.c + +* add leds.h + +* rename some functions: + + ath10k_attach_led() -> ath10k_leds_register() + ath10k_unregister_led() -> ath10k_leds_unregister() + ath10k_reset_led_pin() -> ath10k_leds_start() + +* call ath10k_leds_unregister() before ath10k_thermal_unregister() to preserve ordering + +* call ath10k_leds_start() only from ath10k_core_start() and not from mac.c + +* rename struct ath10k_gpiocontrol as anonymous function under struct + ath10k::leds, no need for memory allocation + +* merge ath10k_add_led() to ath10k_attach_led(), which is it's only caller + +* remove #if IS_ENABLED() checks from most of places, memory savings from those were not worth it + +* Kconfig help text improvement and move it lower in the menu, also don't enable it by default + +* switch to set_brightness_blocking() so that the callback can sleep, + then no need to use ath10k_wmi_cmd_send_nowait() and can take mutex + to access ar->state + +* don't touch ath10k_wmi_pdev_get_temperature() + +* as QCA6174/QCA9377 are not (yet) supported don't add the command to WMI-TLV interface + +* remove debugfs interface, that should be added in another patch + +* cleanup includes + + + ath10k-4.16/Kconfig | 10 +++ + ath10k-4.16/Makefile | 1 + + ath10k-4.16/core.c | 22 +++++++ + ath10k-4.16/core.h | 9 ++- + ath10k-4.16/hw.h | 1 + + ath10k-4.16/leds.c | 103 ++++++++++++++++++++++++++++++ + ath10k-4.16/leds.h | 45 +++++++++++++ + ath10k-4.16/mac.c | 1 + + ath10k-4.16/wmi-ops.h | 32 ++++++++++ + ath10k-4.16/wmi-tlv.c | 2 + + ath10k-4.16/wmi.c | 54 ++++++++++++++++ + ath10k-4.16/wmi.h | 35 ++++++++++ + 12 files changed, 314 insertions(+), 1 deletion(-) + create mode 100644 ath10k-4.16/leds.c + create mode 100644 ath10k-4.16/leds.h +--- a/ath10k-4.19/Kconfig ++++ b/ath10k-4.19/Kconfig +@@ -64,6 +64,16 @@ config ATH10K_DEBUGFS + + If unsure, say Y to make it easier to debug problems. + ++config ATH10K_LEDS ++ bool "Atheros ath10k LED support" ++ depends on ATH10K ++ select MAC80211_LEDS ++ select LEDS_CLASS ++ select NEW_LEDS ++ default y ++ ---help--- ++ This option is necessary, if you want LED support for chipset connected led pins. If unsure, say N. ++ + config ATH10K_SPECTRAL + bool "Atheros ath10k spectral scan support" + depends on ATH10K_DEBUGFS +--- a/ath10k-4.19/Makefile ++++ b/ath10k-4.19/Makefile +@@ -19,6 +19,7 @@ ath10k_core-$(CONFIG_ATH10K_SPECTRAL) += + ath10k_core-$(CONFIG_NL80211_TESTMODE) += testmode.o + ath10k_core-$(CONFIG_ATH10K_TRACING) += trace.o + ath10k_core-$(CONFIG_THERMAL) += thermal.o ++ath10k_core-$(CONFIG_ATH10K_LEDS) += leds.o + ath10k_core-$(CONFIG_MAC80211_DEBUGFS) += debugfs_sta.o + ath10k_core-$(CONFIG_PM) += wow.o + ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o +--- a/ath10k-4.19/core.c ++++ b/ath10k-4.19/core.c +@@ -35,6 +35,7 @@ + #include "testmode.h" + #include "wmi-ops.h" + #include "coredump.h" ++#include "leds.h" + + /* Disable ath10k-ct DBGLOG output by default */ + unsigned int ath10k_debug_mask = ATH10K_DBG_NO_DBGLOG; +@@ -72,6 +73,7 @@ static const struct ath10k_hw_params ath + .id = QCA988X_HW_2_0_VERSION, + .dev_id = QCA988X_2_0_DEVICE_ID, + .name = "qca988x hw2.0", ++ .led_pin = 1, + .patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR, + .uart_pin = 7, + .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, +@@ -137,6 +139,7 @@ static const struct ath10k_hw_params ath + .id = QCA9887_HW_1_0_VERSION, + .dev_id = QCA9887_1_0_DEVICE_ID, + .name = "qca9887 hw1.0", ++ .led_pin = 1, + .patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR, + .uart_pin = 7, + .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, +@@ -301,6 +304,7 @@ static const struct ath10k_hw_params ath + .id = QCA99X0_HW_2_0_DEV_VERSION, + .dev_id = QCA99X0_2_0_DEVICE_ID, + .name = "qca99x0 hw2.0", ++ .led_pin = 17, + .patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR, + .uart_pin = 7, + .otp_exe_param = 0x00000700, +@@ -339,6 +343,7 @@ static const struct ath10k_hw_params ath + .id = QCA9984_HW_1_0_DEV_VERSION, + .dev_id = QCA9984_1_0_DEVICE_ID, + .name = "qca9984/qca9994 hw1.0", ++ .led_pin = 17, + .patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR, + .uart_pin = 7, + .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, +@@ -382,6 +387,7 @@ static const struct ath10k_hw_params ath + .id = QCA9888_HW_2_0_DEV_VERSION, + .dev_id = QCA9888_2_0_DEVICE_ID, + .name = "qca9888 hw2.0", ++ .led_pin = 17, + .patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR, + .uart_pin = 7, + .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, +@@ -3170,6 +3176,10 @@ int ath10k_core_start(struct ath10k *ar, + ath10k_wmi_check_apply_board_power_ctl_table(ar); + } + ++ status = ath10k_leds_start(ar); ++ if (status) ++ goto err_hif_stop; ++ + return 0; + + err_hif_stop: +@@ -3424,9 +3434,18 @@ static void ath10k_core_register_work(st + goto err_spectral_destroy; + } + ++ status = ath10k_leds_register(ar); ++ if (status) { ++ ath10k_err(ar, "could not register leds: %d\n", ++ status); ++ goto err_thermal_unregister; ++ } ++ + set_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags); + return; + ++err_thermal_unregister: ++ ath10k_thermal_unregister(ar); + err_spectral_destroy: + ath10k_spectral_destroy(ar); + err_debug_destroy: +@@ -3484,6 +3503,8 @@ void ath10k_core_unregister(struct ath10 + if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags)) + return; + ++ ath10k_leds_unregister(ar); ++ + ath10k_thermal_unregister(ar); + /* Stop spectral before unregistering from mac80211 to remove the + * relayfs debugfs file cleanly. Otherwise the parent debugfs tree +--- a/ath10k-4.19/core.h ++++ b/ath10k-4.19/core.h +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + #include "htt.h" + #include "htc.h" +@@ -1138,7 +1139,6 @@ struct ath10k { + u32 low_5ghz_chan; + u32 high_5ghz_chan; + bool ani_enabled; +- + bool p2p; + bool ct_all_pkts_htt; /* CT firmware only: native-wifi for all pkts */ + +@@ -1389,6 +1389,13 @@ struct ath10k { + } testmode; + + struct { ++ struct gpio_led wifi_led; ++ struct led_classdev cdev; ++ char label[48]; ++ u32 gpio_state_pin; ++ } leds; ++ ++ struct { + /* protected by data_lock */ + u32 fw_crash_counter; + u32 fw_warm_reset_counter; +--- a/ath10k-4.19/hw.h ++++ b/ath10k-4.19/hw.h +@@ -508,6 +508,7 @@ struct ath10k_hw_params { + const char *name; + u32 patch_load_addr; + int uart_pin; ++ int led_pin; + u32 otp_exe_param; + + /* Type of hw cycle counter wraparound logic, for more info +--- /dev/null ++++ b/ath10k-4.19/leds.c +@@ -0,0 +1,103 @@ ++/* ++ * Copyright (c) 2005-2011 Atheros Communications Inc. ++ * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. ++ * Copyright (c) 2018 Sebastian Gottschall ++ * Copyright (c) 2018, 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 ++ ++#include "core.h" ++#include "wmi.h" ++#include "wmi-ops.h" ++ ++#include "leds.h" ++ ++static int ath10k_leds_set_brightness_blocking(struct led_classdev *led_cdev, ++ enum led_brightness brightness) ++{ ++ struct ath10k *ar = container_of(led_cdev, struct ath10k, ++ leds.cdev); ++ struct gpio_led *led = &ar->leds.wifi_led; ++ ++ mutex_lock(&ar->conf_mutex); ++ ++ if (ar->state != ATH10K_STATE_ON) ++ goto out; ++ ++ ar->leds.gpio_state_pin = (brightness != LED_OFF) ^ led->active_low; ++ ath10k_wmi_gpio_output(ar, led->gpio, ar->leds.gpio_state_pin); ++ ++out: ++ mutex_unlock(&ar->conf_mutex); ++ ++ return 0; ++} ++ ++int ath10k_leds_start(struct ath10k *ar) ++{ ++ if (ar->hw_params.led_pin == 0) ++ /* leds not supported */ ++ return 0; ++ ++ /* under some circumstances, the gpio pin gets reconfigured ++ * to default state by the firmware, so we need to ++ * reconfigure it this behaviour has only ben seen on ++ * QCA9984 and QCA99XX devices so far ++ */ ++ ath10k_wmi_gpio_config(ar, ar->hw_params.led_pin, 0, ++ WMI_GPIO_PULL_NONE, WMI_GPIO_INTTYPE_DISABLE); ++ ath10k_wmi_gpio_output(ar, ar->hw_params.led_pin, 1); ++ ++ return 0; ++} ++ ++int ath10k_leds_register(struct ath10k *ar) ++{ ++ int ret; ++ ++ if (ar->hw_params.led_pin == 0) ++ /* leds not supported */ ++ return 0; ++ ++ snprintf(ar->leds.label, sizeof(ar->leds.label), "ath10k-%s", ++ wiphy_name(ar->hw->wiphy)); ++ ar->leds.wifi_led.active_low = 1; ++ ar->leds.wifi_led.gpio = ar->hw_params.led_pin; ++ ar->leds.wifi_led.name = ar->leds.label; ++ ar->leds.wifi_led.default_state = LEDS_GPIO_DEFSTATE_KEEP; ++ ++ ar->leds.cdev.name = ar->leds.label; ++ ar->leds.cdev.brightness_set_blocking = ath10k_leds_set_brightness_blocking; ++ ++ /* FIXME: this assignment doesn't make sense as it's NULL, remove it? */ ++ ar->leds.cdev.default_trigger = ar->leds.wifi_led.default_trigger; ++ ++ ret = led_classdev_register(wiphy_dev(ar->hw->wiphy), &ar->leds.cdev); ++ if (ret) ++ return ret; ++ ++ return 0; ++} ++ ++void ath10k_leds_unregister(struct ath10k *ar) ++{ ++ if (ar->hw_params.led_pin == 0) ++ /* leds not supported */ ++ return; ++ ++ led_classdev_unregister(&ar->leds.cdev); ++} ++ +--- /dev/null ++++ b/ath10k-4.19/leds.h +@@ -0,0 +1,41 @@ ++/* ++ * Copyright (c) 2018, 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. ++ */ ++#ifndef _LEDS_H_ ++#define _LEDS_H_ ++ ++#include "core.h" ++ ++#ifdef CONFIG_ATH10K_LEDS ++void ath10k_leds_unregister(struct ath10k *ar); ++int ath10k_leds_start(struct ath10k *ar); ++int ath10k_leds_register(struct ath10k *ar); ++#else ++static inline void ath10k_leds_unregister(struct ath10k *ar) ++{ ++} ++ ++static inline int ath10k_leds_start(struct ath10k *ar) ++{ ++ return 0; ++} ++ ++static inline int ath10k_leds_register(struct ath10k *ar) ++{ ++ return 0; ++} ++ ++#endif ++#endif /* _LEDS_H_ */ +--- a/ath10k-4.19/mac.c ++++ b/ath10k-4.19/mac.c +@@ -34,6 +34,7 @@ + #include "wmi-tlv.h" + #include "wmi-ops.h" + #include "wow.h" ++#include "leds.h" + + /*********/ + /* Rates */ +--- a/ath10k-4.19/wmi-ops.h ++++ b/ath10k-4.19/wmi-ops.h +@@ -218,7 +218,10 @@ struct wmi_ops { + struct sk_buff *(*gen_echo)(struct ath10k *ar, u32 value); + struct sk_buff *(*gen_pdev_get_tpc_table_cmdid)(struct ath10k *ar, + u32 param); ++ struct sk_buff *(*gen_gpio_config)(struct ath10k *ar, u32 gpio_num, ++ u32 input, u32 pull_type, u32 intr_mode); + ++ struct sk_buff *(*gen_gpio_output)(struct ath10k *ar, u32 gpio_num, u32 set); + }; + + int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id); +@@ -1079,6 +1082,35 @@ ath10k_wmi_force_fw_hang(struct ath10k * + return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->force_fw_hang_cmdid); + } + ++static inline int ath10k_wmi_gpio_config(struct ath10k *ar, u32 gpio_num, ++ u32 input, u32 pull_type, u32 intr_mode) ++{ ++ struct sk_buff *skb; ++ ++ if (!ar->wmi.ops->gen_gpio_config) ++ return -EOPNOTSUPP; ++ ++ skb = ar->wmi.ops->gen_gpio_config(ar, gpio_num, input, pull_type, intr_mode); ++ if (IS_ERR(skb)) ++ return PTR_ERR(skb); ++ ++ return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->gpio_config_cmdid); ++} ++ ++static inline int ath10k_wmi_gpio_output(struct ath10k *ar, u32 gpio_num, u32 set) ++{ ++ struct sk_buff *skb; ++ ++ if (!ar->wmi.ops->gen_gpio_config) ++ return -EOPNOTSUPP; ++ ++ skb = ar->wmi.ops->gen_gpio_output(ar, gpio_num, set); ++ if (IS_ERR(skb)) ++ return PTR_ERR(skb); ++ ++ return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->gpio_output_cmdid); ++} ++ + static inline int + ath10k_wmi_dbglog_cfg(struct ath10k *ar, u64 module_enable, u32 log_level) + { +--- a/ath10k-4.19/wmi-tlv.c ++++ b/ath10k-4.19/wmi-tlv.c +@@ -3976,6 +3976,8 @@ static const struct wmi_ops wmi_tlv_ops + .gen_echo = ath10k_wmi_tlv_op_gen_echo, + .gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf, + .gen_vdev_spectral_enable = ath10k_wmi_tlv_op_gen_vdev_spectral_enable, ++ /* .gen_gpio_config not implemented */ ++ /* .gen_gpio_output not implemented */ + }; + + static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = { +--- a/ath10k-4.19/wmi.c ++++ b/ath10k-4.19/wmi.c +@@ -8071,6 +8071,49 @@ ath10k_wmi_op_gen_peer_set_param(struct + return skb; + } + ++static struct sk_buff *ath10k_wmi_op_gen_gpio_config(struct ath10k *ar, ++ u32 gpio_num, u32 input, ++ u32 pull_type, u32 intr_mode) ++{ ++ struct wmi_gpio_config_cmd *cmd; ++ struct sk_buff *skb; ++ ++ skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); ++ if (!skb) ++ return ERR_PTR(-ENOMEM); ++ ++ cmd = (struct wmi_gpio_config_cmd *)skb->data; ++ cmd->pull_type = __cpu_to_le32(pull_type); ++ cmd->gpio_num = __cpu_to_le32(gpio_num); ++ cmd->input = __cpu_to_le32(input); ++ cmd->intr_mode = __cpu_to_le32(intr_mode); ++ ++ ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi gpio_config gpio_num 0x%08x input 0x%08x pull_type 0x%08x intr_mode 0x%08x\n", ++ gpio_num, input, pull_type, intr_mode); ++ ++ return skb; ++} ++ ++static struct sk_buff *ath10k_wmi_op_gen_gpio_output(struct ath10k *ar, ++ u32 gpio_num, u32 set) ++{ ++ struct wmi_gpio_output_cmd *cmd; ++ struct sk_buff *skb; ++ ++ skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); ++ if (!skb) ++ return ERR_PTR(-ENOMEM); ++ ++ cmd = (struct wmi_gpio_output_cmd *)skb->data; ++ cmd->gpio_num = __cpu_to_le32(gpio_num); ++ cmd->set = __cpu_to_le32(set); ++ ++ ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi gpio_output gpio_num 0x%08x set 0x%08x\n", ++ gpio_num, set); ++ ++ return skb; ++} ++ + static struct sk_buff * + ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id, + enum wmi_sta_ps_mode psmode) +@@ -9822,6 +9865,9 @@ static const struct wmi_ops wmi_ops = { + .fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill, + .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, + .gen_echo = ath10k_wmi_op_gen_echo, ++ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config, ++ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output, ++ + /* .gen_bcn_tmpl not implemented */ + /* .gen_prb_tmpl not implemented */ + /* .gen_p2p_go_bcn_ie not implemented */ +@@ -9892,6 +9938,8 @@ static const struct wmi_ops wmi_10_1_ops + .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, + .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, + .gen_echo = ath10k_wmi_op_gen_echo, ++ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config, ++ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output, + /* .gen_bcn_tmpl not implemented */ + /* .gen_prb_tmpl not implemented */ + /* .gen_p2p_go_bcn_ie not implemented */ +@@ -9970,6 +10018,8 @@ static const struct wmi_ops wmi_10_2_ops + .gen_delba_send = ath10k_wmi_op_gen_delba_send, + .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, + .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, ++ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config, ++ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output, + /* .gen_pdev_enable_adaptive_cca not implemented */ + }; + +@@ -10040,6 +10090,8 @@ static const struct wmi_ops wmi_10_2_4_o + .gen_pdev_enable_adaptive_cca = + ath10k_wmi_op_gen_pdev_enable_adaptive_cca, + .get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype, ++ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config, ++ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output, + /* .gen_bcn_tmpl not implemented */ + /* .gen_prb_tmpl not implemented */ + /* .gen_p2p_go_bcn_ie not implemented */ +@@ -10120,6 +10172,8 @@ static const struct wmi_ops wmi_10_4_ops + .gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info, + .gen_echo = ath10k_wmi_op_gen_echo, + .gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config, ++ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config, ++ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output, + }; + + int ath10k_wmi_attach(struct ath10k *ar) +--- a/ath10k-4.19/wmi.h ++++ b/ath10k-4.19/wmi.h +@@ -3084,6 +3084,41 @@ enum wmi_10_4_feature_mask { + + }; + ++/* WMI_GPIO_CONFIG_CMDID */ ++enum { ++ WMI_GPIO_PULL_NONE, ++ WMI_GPIO_PULL_UP, ++ WMI_GPIO_PULL_DOWN, ++}; ++ ++enum { ++ WMI_GPIO_INTTYPE_DISABLE, ++ WMI_GPIO_INTTYPE_RISING_EDGE, ++ WMI_GPIO_INTTYPE_FALLING_EDGE, ++ WMI_GPIO_INTTYPE_BOTH_EDGE, ++ WMI_GPIO_INTTYPE_LEVEL_LOW, ++ WMI_GPIO_INTTYPE_LEVEL_HIGH ++}; ++ ++/* WMI_GPIO_CONFIG_CMDID */ ++struct wmi_gpio_config_cmd { ++ __le32 gpio_num; /* GPIO number to be setup */ ++ __le32 input; /* 0 - Output/ 1 - Input */ ++ __le32 pull_type; /* Pull type defined above */ ++ __le32 intr_mode; /* Interrupt mode defined above (Input) */ ++} __packed; ++ ++/* WMI_GPIO_OUTPUT_CMDID */ ++struct wmi_gpio_output_cmd { ++ __le32 gpio_num; /* GPIO number to be setup */ ++ __le32 set; /* Set the GPIO pin*/ ++} __packed; ++ ++/* WMI_GPIO_INPUT_EVENTID */ ++struct wmi_gpio_input_event { ++ __le32 gpio_num; /* GPIO number which changed state */ ++} __packed; ++ + struct wmi_ext_resource_config_10_4_cmd { + /* contains enum wmi_host_platform_type */ + __le32 host_platform_config; diff --git a/package/kernel/ath10k-ct/patches/202-ath10k-4.16-use-tpt-trigger-by-default.patch b/package/kernel/ath10k-ct/patches/202-ath10k-4.16-use-tpt-trigger-by-default.patch new file mode 100644 index 00000000000000..3f9c6dc397747d --- /dev/null +++ b/package/kernel/ath10k-ct/patches/202-ath10k-4.16-use-tpt-trigger-by-default.patch @@ -0,0 +1,53 @@ +From 79c9d7aabae1d1da9eea97d83b61e1517a8a2221 Mon Sep 17 00:00:00 2001 +From: Mathias Kresin +Date: Fri, 22 Jun 2018 18:59:44 +0200 +Subject: [PATCH] ath10k: use tpt LED trigger by default + +Use the tpt LED trigger for each created phy led. Ths way LEDs attached +to the ath10k GPIO pins are indicating the phy status and blink on +traffic. + +Signed-off-by: Mathias Kresin +--- + ath10k-4.16/core.h | 4 ++++ + ath10k-4.16/leds.c | 4 +--- + ath10k-4.16/mac.c | 2 +- + 3 files changed, 6 insertions(+), 4 deletions(-) + +--- a/ath10k-4.19/core.h ++++ b/ath10k-4.19/core.h +@@ -1489,6 +1489,10 @@ struct ath10k { + u8 csi_data[4096]; + u16 csi_data_len; + ++#ifdef CPTCFG_MAC80211_LEDS ++ const char *led_default_trigger; ++#endif ++ + /* must be last */ + u8 drv_priv[0] __aligned(sizeof(void *)); + }; +--- a/ath10k-4.19/leds.c ++++ b/ath10k-4.19/leds.c +@@ -81,9 +81,7 @@ int ath10k_leds_register(struct ath10k * + + ar->leds.cdev.name = ar->leds.label; + ar->leds.cdev.brightness_set_blocking = ath10k_leds_set_brightness_blocking; +- +- /* FIXME: this assignment doesn't make sense as it's NULL, remove it? */ +- ar->leds.cdev.default_trigger = ar->leds.wifi_led.default_trigger; ++ ar->leds.cdev.default_trigger = ar->led_default_trigger; + + ret = led_classdev_register(wiphy_dev(ar->hw->wiphy), &ar->leds.cdev); + if (ret) +--- a/ath10k-4.19/mac.c ++++ b/ath10k-4.19/mac.c +@@ -9987,7 +9987,7 @@ int ath10k_mac_register(struct ath10k *a + wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); + + #ifdef CPTCFG_MAC80211_LEDS +- ieee80211_create_tpt_led_trigger(ar->hw, ++ ar->led_default_trigger = ieee80211_create_tpt_led_trigger(ar->hw, + IEEE80211_TPT_LEDTRIG_FL_RADIO, ath10k_tpt_blink, + ARRAY_SIZE(ath10k_tpt_blink)); + #endif diff --git a/package/kernel/ath10k-ct/patches/203-ath10k-Limit-available-channels-via-DT-ieee80211-fre.patch b/package/kernel/ath10k-ct/patches/203-ath10k-Limit-available-channels-via-DT-ieee80211-fre.patch new file mode 100644 index 00000000000000..f47e9d64c0dfc6 --- /dev/null +++ b/package/kernel/ath10k-ct/patches/203-ath10k-Limit-available-channels-via-DT-ieee80211-fre.patch @@ -0,0 +1,39 @@ +From bbf0a8af2261bc7ae39b227ff6a1e9f45a008c27 Mon Sep 17 00:00:00 2001 +From: Sven Eckelmann +Date: Mon, 30 Jul 2018 17:31:41 +0200 +Subject: [PATCH] ath10k: Limit available channels via DT ieee80211-freq-limit + +Tri-band devices (1x 2.4GHz + 2x 5GHz) often incorporate special filters in +the RX and TX path. These filtered channel can in theory still be used by +the hardware but the signal strength is reduced so much that it makes no +sense. + +There is already a DT property to limit the available channels but ath10k +has to manually call this functionality to limit the currrently set wiphy +channels further. + +Signed-off-by: Sven Eckelmann + +Forwarded: https://patchwork.kernel.org/patch/10549245/ +--- + drivers/net/wireless/ath/ath10k/mac.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/ath10k-4.19/mac.c ++++ b/ath10k-4.19/mac.c +@@ -18,6 +18,7 @@ + + #include "mac.h" + ++#include + #include + #include + #include +@@ -9711,6 +9712,7 @@ int ath10k_mac_register(struct ath10k *a + ar->hw->wiphy->bands[NL80211_BAND_5GHZ] = band; + } + ++ wiphy_read_of_freq_limits(ar->hw->wiphy); + ath10k_mac_setup_ht_vht_cap(ar); + + ar->hw->wiphy->interface_modes = diff --git a/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch b/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch new file mode 100644 index 00000000000000..a62d9b791c6e54 --- /dev/null +++ b/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch @@ -0,0 +1,14 @@ +--- a/ath10k-4.19/htt.h ++++ b/ath10k-4.19/htt.h +@@ -237,7 +237,11 @@ enum htt_rx_ring_flags { + }; + + #define HTT_RX_RING_SIZE_MIN 128 ++#ifndef CONFIG_ATH10K_SMALLBUFFERS + #define HTT_RX_RING_SIZE_MAX 2048 ++#else ++#define HTT_RX_RING_SIZE_MAX 512 ++#endif + #define HTT_RX_RING_SIZE HTT_RX_RING_SIZE_MAX + #define HTT_RX_RING_FILL_LEVEL (((HTT_RX_RING_SIZE) / 2) - 1) + #define HTT_RX_RING_FILL_LEVEL_DUAL_MAC (HTT_RX_RING_SIZE - 1) diff --git a/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch b/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch new file mode 100644 index 00000000000000..2cbcb08af9b509 --- /dev/null +++ b/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch @@ -0,0 +1,50 @@ +--- a/ath10k-4.19/pci.c ++++ b/ath10k-4.19/pci.c +@@ -142,7 +142,11 @@ static struct ce_attr host_ce_config_wla + .flags = CE_ATTR_FLAGS, + .src_nentries = 0, + .src_sz_max = 2048, ++#ifndef CONFIG_ATH10K_SMALLBUFFERS + .dest_nentries = 512, ++#else ++ .dest_nentries = 128, ++#endif + .recv_cb = ath10k_pci_htt_htc_rx_cb, + }, + +@@ -151,7 +155,11 @@ static struct ce_attr host_ce_config_wla + .flags = CE_ATTR_FLAGS, + .src_nentries = 0, + .src_sz_max = 2048, ++#ifndef CONFIG_ATH10K_SMALLBUFFERS + .dest_nentries = 128, ++#else ++ .dest_nentries = 64, ++#endif + .recv_cb = ath10k_pci_htc_rx_cb, + }, + +@@ -178,7 +186,11 @@ static struct ce_attr host_ce_config_wla + .flags = CE_ATTR_FLAGS, + .src_nentries = 0, + .src_sz_max = 512, ++#ifndef CONFIG_ATH10K_SMALLBUFFERS + .dest_nentries = 512, ++#else ++ .dest_nentries = 128, ++#endif + .recv_cb = ath10k_pci_htt_rx_cb, + }, + +@@ -203,7 +215,11 @@ static struct ce_attr host_ce_config_wla + .flags = CE_ATTR_FLAGS, + .src_nentries = 0, + .src_sz_max = 2048, ++#ifndef CONFIG_ATH10K_SMALLBUFFERS + .dest_nentries = 128, ++#else ++ .dest_nentries = 96, ++#endif + .recv_cb = ath10k_pci_pktlog_rx_cb, + }, + diff --git a/package/kernel/bcm27xx-gpu-fw/Makefile b/package/kernel/bcm27xx-gpu-fw/Makefile new file mode 100644 index 00000000000000..cbbebfdf54dff6 --- /dev/null +++ b/package/kernel/bcm27xx-gpu-fw/Makefile @@ -0,0 +1,192 @@ +# +# Copyright (C) 2012-2020 OpenWrt.org +# Copyright (C) 2017 LEDE project +# +# 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:=bcm27xx-gpu-fw +PKG_VERSION:=2020-02-28 +PKG_RELEASE:=bf83b506b4a6f9e592e711d02871a278fad5bd1e + +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)/rpi-firmware-$(PKG_RELEASE) + +PKG_FLAGS:=nonshared + +include $(INCLUDE_DIR)/package.mk + +RPI_FIRMWARE_URL:=@GITHUB/raspberrypi/firmware/$(PKG_RELEASE)/boot/ +RPI_FIRMWARE_FILE:=rpi-firmware-$(PKG_RELEASE) + +define Download/LICENCE_broadcom + FILE:=$(RPI_FIRMWARE_FILE)-LICENCE.broadcom + URL:=$(RPI_FIRMWARE_URL) + URL_FILE:=LICENCE.broadcom + HASH:=c7283ff51f863d93a275c66e3b4cb08021a5dd4d8c1e7acc47d872fbe52d3d6b +endef +$(eval $(call Download,LICENCE_broadcom)) + +define Download/bootcode_bin + FILE:=$(RPI_FIRMWARE_FILE)-bootcode.bin + URL:=$(RPI_FIRMWARE_URL) + URL_FILE:=bootcode.bin + HASH:=6505bbc8798698bd8f1dff30789b22289ebb865ccba7833b87705264525cbe46 +endef +$(eval $(call Download,bootcode_bin)) + +define Download/fixup_dat + FILE:=$(RPI_FIRMWARE_FILE)-fixup.dat + URL:=$(RPI_FIRMWARE_URL) + URL_FILE:=fixup.dat + HASH:=3157bb56f162ed215fba9ed101c5c59abfce25d2723b687d4b6da5d527d4da74 +endef +$(eval $(call Download,fixup_dat)) + +define Download/fixup_cd_dat + FILE:=$(RPI_FIRMWARE_FILE)-fixup_cd.dat + URL:=$(RPI_FIRMWARE_URL) + URL_FILE:=fixup_cd.dat + HASH:=1ba8140ee21c61e3c86a0b864530e58de067139b4c93ddd258c12f2f0851796a +endef +$(eval $(call Download,fixup_cd_dat)) + +define Download/fixup_x_dat + FILE:=$(RPI_FIRMWARE_FILE)-fixup_x.dat + URL:=$(RPI_FIRMWARE_URL) + URL_FILE:=fixup_x.dat + HASH:=f0bcb0b9bebceaae272a86f8af5b789a2f1f51548ee428b04bd8f63f8d05dd56 +endef +$(eval $(call Download,fixup_x_dat)) + +define Download/fixup4_dat + FILE:=$(RPI_FIRMWARE_FILE)-fixup4.dat + URL:=$(RPI_FIRMWARE_URL) + URL_FILE:=fixup4.dat + HASH:=02534602e0310d3c101820d87e8a33423d541ad9be1874f918fa03af18aaa6c2 +endef +$(eval $(call Download,fixup4_dat)) + +define Download/fixup4cd_dat + FILE:=$(RPI_FIRMWARE_FILE)-fixup4cd.dat + URL:=$(RPI_FIRMWARE_URL) + URL_FILE:=fixup4cd.dat + HASH:=b5e82f7f932d618ff36e7f089f0350bbc0b1c7830f3c44eec87603becf47c47e +endef +$(eval $(call Download,fixup4cd_dat)) + +define Download/fixup4x_dat + FILE:=$(RPI_FIRMWARE_FILE)-fixup4x.dat + URL:=$(RPI_FIRMWARE_URL) + URL_FILE:=fixup4x.dat + HASH:=2078b1241cbbd2b7e6e5d77240b266a71afd9617a9c6ffc223fb19bcd8b177cf +endef +$(eval $(call Download,fixup4x_dat)) + +define Download/start_elf + FILE:=$(RPI_FIRMWARE_FILE)-start.elf + URL:=$(RPI_FIRMWARE_URL) + URL_FILE:=start.elf + HASH:=ea2dac517aa5c99eae864a1653fde467f481ccf34bd16ec6776595b8520c4ade +endef +$(eval $(call Download,start_elf)) + +define Download/start_cd_elf + FILE:=$(RPI_FIRMWARE_FILE)-start_cd.elf + URL:=$(RPI_FIRMWARE_URL) + URL_FILE:=start_cd.elf + HASH:=f31559dde1c8984a2c681078b4a243c718383c481e5fd3dc8feafa8f8bc98113 +endef +$(eval $(call Download,start_cd_elf)) + +define Download/start_x_elf + FILE:=$(RPI_FIRMWARE_FILE)-start_x.elf + URL:=$(RPI_FIRMWARE_URL) + URL_FILE:=start_x.elf + HASH:=9a18f7d063f9d721a779b23f189681f74b6ea04327bc0c7b5b868df974cf74f0 +endef +$(eval $(call Download,start_x_elf)) + +define Download/start4_elf + FILE:=$(RPI_FIRMWARE_FILE)-start4.elf + URL:=$(RPI_FIRMWARE_URL) + URL_FILE:=start4.elf + HASH:=88017c1e66ce10749540866bba331b6684f84eab333bf579b43ce7eea91140f7 +endef +$(eval $(call Download,start4_elf)) + +define Download/start4cd_elf + FILE:=$(RPI_FIRMWARE_FILE)-start4cd.elf + URL:=$(RPI_FIRMWARE_URL) + URL_FILE:=start4cd.elf + HASH:=7c658a86c42a86ffdb083294f21342c2cffe18fcef1bc457736173efbe71f419 +endef +$(eval $(call Download,start4cd_elf)) + +define Download/start4x_elf + FILE:=$(RPI_FIRMWARE_FILE)-start4x.elf + URL:=$(RPI_FIRMWARE_URL) + URL_FILE:=start4x.elf + HASH:=4a93c4ab29ad5e2aa537ef0a6b1ce0ed77d8283a44b443bc785af4c856ab20f5 +endef +$(eval $(call Download,start4x_elf)) + +define Package/bcm27xx-gpu-fw + SECTION:=boot + CATEGORY:=Boot Loaders + DEPENDS:=@TARGET_bcm27xx + TITLE:=bcm27xx-gpu-fw + DEFAULT:=y if TARGET_bcm27xx +endef + +define Package/bcm27xx-gpu-fw/description + GPU and kernel boot firmware for bcm27xx. +endef + +define Build/Prepare + rm -rf $(PKG_BUILD_DIR) + mkdir -p $(PKG_BUILD_DIR) + cp $(DL_DIR)/$(RPI_FIRMWARE_FILE)-LICENCE.broadcom $(PKG_BUILD_DIR)/LICENCE.broadcom + cp $(DL_DIR)/$(RPI_FIRMWARE_FILE)-bootcode.bin $(PKG_BUILD_DIR)/bootcode.bin + cp $(DL_DIR)/$(RPI_FIRMWARE_FILE)-fixup.dat $(PKG_BUILD_DIR)/fixup.dat + cp $(DL_DIR)/$(RPI_FIRMWARE_FILE)-fixup_cd.dat $(PKG_BUILD_DIR)/fixup_cd.dat + cp $(DL_DIR)/$(RPI_FIRMWARE_FILE)-fixup_x.dat $(PKG_BUILD_DIR)/fixup_x.dat + cp $(DL_DIR)/$(RPI_FIRMWARE_FILE)-fixup4.dat $(PKG_BUILD_DIR)/fixup4.dat + cp $(DL_DIR)/$(RPI_FIRMWARE_FILE)-fixup4cd.dat $(PKG_BUILD_DIR)/fixup4cd.dat + cp $(DL_DIR)/$(RPI_FIRMWARE_FILE)-fixup4x.dat $(PKG_BUILD_DIR)/fixup4x.dat + cp $(DL_DIR)/$(RPI_FIRMWARE_FILE)-start.elf $(PKG_BUILD_DIR)/start.elf + cp $(DL_DIR)/$(RPI_FIRMWARE_FILE)-start_cd.elf $(PKG_BUILD_DIR)/start_cd.elf + cp $(DL_DIR)/$(RPI_FIRMWARE_FILE)-start_x.elf $(PKG_BUILD_DIR)/start_x.elf + cp $(DL_DIR)/$(RPI_FIRMWARE_FILE)-start4.elf $(PKG_BUILD_DIR)/start4.elf + cp $(DL_DIR)/$(RPI_FIRMWARE_FILE)-start4cd.elf $(PKG_BUILD_DIR)/start4cd.elf + cp $(DL_DIR)/$(RPI_FIRMWARE_FILE)-start4x.elf $(PKG_BUILD_DIR)/start4x.elf +endef + +define Build/Compile + true +endef + +define Package/bcm27xx-gpu-fw/install + true +endef + +define Build/InstallDev + $(CP) $(PKG_BUILD_DIR)/bootcode.bin $(KERNEL_BUILD_DIR) + $(CP) $(PKG_BUILD_DIR)/LICENCE.broadcom $(KERNEL_BUILD_DIR) + $(CP) $(PKG_BUILD_DIR)/start.elf $(KERNEL_BUILD_DIR) + $(CP) $(PKG_BUILD_DIR)/start_cd.elf $(KERNEL_BUILD_DIR) + $(CP) $(PKG_BUILD_DIR)/start_x.elf $(KERNEL_BUILD_DIR) + $(CP) $(PKG_BUILD_DIR)/start4.elf $(KERNEL_BUILD_DIR) + $(CP) $(PKG_BUILD_DIR)/start4cd.elf $(KERNEL_BUILD_DIR) + $(CP) $(PKG_BUILD_DIR)/start4x.elf $(KERNEL_BUILD_DIR) + $(CP) $(PKG_BUILD_DIR)/fixup.dat $(KERNEL_BUILD_DIR) + $(CP) $(PKG_BUILD_DIR)/fixup_cd.dat $(KERNEL_BUILD_DIR) + $(CP) $(PKG_BUILD_DIR)/fixup_x.dat $(KERNEL_BUILD_DIR) + $(CP) $(PKG_BUILD_DIR)/fixup4.dat $(KERNEL_BUILD_DIR) + $(CP) $(PKG_BUILD_DIR)/fixup4cd.dat $(KERNEL_BUILD_DIR) + $(CP) $(PKG_BUILD_DIR)/fixup4x.dat $(KERNEL_BUILD_DIR) +endef + +$(eval $(call BuildPackage,bcm27xx-gpu-fw)) diff --git a/package/kernel/brcm2708-gpu-fw/Makefile b/package/kernel/brcm2708-gpu-fw/Makefile deleted file mode 100644 index 9f3d7d3092f3d0..00000000000000 --- a/package/kernel/brcm2708-gpu-fw/Makefile +++ /dev/null @@ -1,112 +0,0 @@ -# -# Copyright (C) 2012-2016 OpenWrt.org -# Copyright (C) 2017 LEDE project -# -# 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:=brcm2708-gpu-fw -PKG_VERSION:=2017-08-08 -PKG_RELEASE:=e7ba7ab135f5a68b2c00a919ea9ac8d5528a5d5b - -PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)/rpi-firmware-$(PKG_RELEASE) - -PKG_FLAGS:=nonshared - -include $(INCLUDE_DIR)/package.mk - -RPI_FIRMWARE_URL:=@GITHUB/raspberrypi/firmware/$(PKG_RELEASE)/boot/ -RPI_FIRMWARE_FILE:=rpi-firmware-$(PKG_RELEASE) - -define Download/LICENCE_broadcom - FILE:=$(RPI_FIRMWARE_FILE)-LICENCE.broadcom - URL:=$(RPI_FIRMWARE_URL) - URL_FILE:=LICENCE.broadcom - HASH:=ba76edfc10a248166d965b8eaf320771c44f4f432d4fce2fd31fd272e7038add -endef -$(eval $(call Download,LICENCE_broadcom)) - -define Download/bootcode_bin - FILE:=$(RPI_FIRMWARE_FILE)-bootcode.bin - URL:=$(RPI_FIRMWARE_URL) - URL_FILE:=bootcode.bin - HASH:=b5928ef5253774362014f9e7de856397a932514fe1bc5d7f7817a73c0e10e863 -endef -$(eval $(call Download,bootcode_bin)) - -define Download/fixup_dat - FILE:=$(RPI_FIRMWARE_FILE)-fixup.dat - URL:=$(RPI_FIRMWARE_URL) - URL_FILE:=fixup.dat - HASH:=d95fcac57de7ab71e863a115fd60444f6099cb2ea100f4a68b2c606f79e775ed -endef -$(eval $(call Download,fixup_dat)) - -define Download/fixup_cd_dat - FILE:=$(RPI_FIRMWARE_FILE)-fixup_cd.dat - URL:=$(RPI_FIRMWARE_URL) - URL_FILE:=fixup_cd.dat - HASH:=28f3ec8388df4e0c47489f8370a29ca81dbc536fe7db9978342865b5d093ec36 -endef -$(eval $(call Download,fixup_cd_dat)) - -define Download/start_elf - FILE:=$(RPI_FIRMWARE_FILE)-start.elf - URL:=$(RPI_FIRMWARE_URL) - URL_FILE:=start.elf - HASH:=8712fb4e241a22f7a33de0f1d420e0fdfff237952aa685c907b91e59c8d487fa -endef -$(eval $(call Download,start_elf)) - -define Download/start_cd_elf - FILE:=$(RPI_FIRMWARE_FILE)-start_cd.elf - URL:=$(RPI_FIRMWARE_URL) - URL_FILE:=start_cd.elf - HASH:=c600ab34bea389da10aac541bf2f9c62e5f774093b7e1f2f72c4637f9cf3a83c -endef -$(eval $(call Download,start_cd_elf)) - -define Package/brcm2708-gpu-fw - SECTION:=boot - CATEGORY:=Boot Loaders - DEPENDS:=@TARGET_brcm2708 - TITLE:=brcm2708-gpu-fw - DEFAULT:=y if TARGET_brcm2708 -endef - -define Package/brcm2708-gpu-fw/description - GPU and kernel boot firmware for brcm2708. -endef - -define Build/Prepare - rm -rf $(PKG_BUILD_DIR) - mkdir -p $(PKG_BUILD_DIR) - cp $(DL_DIR)/$(RPI_FIRMWARE_FILE)-LICENCE.broadcom $(PKG_BUILD_DIR)/LICENCE.broadcom - cp $(DL_DIR)/$(RPI_FIRMWARE_FILE)-bootcode.bin $(PKG_BUILD_DIR)/bootcode.bin - cp $(DL_DIR)/$(RPI_FIRMWARE_FILE)-fixup.dat $(PKG_BUILD_DIR)/fixup.dat - cp $(DL_DIR)/$(RPI_FIRMWARE_FILE)-fixup_cd.dat $(PKG_BUILD_DIR)/fixup_cd.dat - cp $(DL_DIR)/$(RPI_FIRMWARE_FILE)-start.elf $(PKG_BUILD_DIR)/start.elf - cp $(DL_DIR)/$(RPI_FIRMWARE_FILE)-start_cd.elf $(PKG_BUILD_DIR)/start_cd.elf -endef - -define Build/Compile - true -endef - -define Package/brcm2708-gpu-fw/install - true -endef - -define Build/InstallDev - $(CP) $(PKG_BUILD_DIR)/bootcode.bin $(KERNEL_BUILD_DIR) - $(CP) $(PKG_BUILD_DIR)/LICENCE.broadcom $(KERNEL_BUILD_DIR) - $(CP) $(PKG_BUILD_DIR)/start.elf $(KERNEL_BUILD_DIR) - $(CP) $(PKG_BUILD_DIR)/start_cd.elf $(KERNEL_BUILD_DIR) - $(CP) $(PKG_BUILD_DIR)/fixup.dat $(KERNEL_BUILD_DIR) - $(CP) $(PKG_BUILD_DIR)/fixup_cd.dat $(KERNEL_BUILD_DIR) -endef - -$(eval $(call BuildPackage,brcm2708-gpu-fw)) diff --git a/package/kernel/broadcom-wl/Makefile b/package/kernel/broadcom-wl/Makefile index d1d060451900d4..140107df177f52 100644 --- a/package/kernel/broadcom-wl/Makefile +++ b/package/kernel/broadcom-wl/Makefile @@ -32,15 +32,15 @@ include $(INCLUDE_DIR)/package.mk define Package/broadcom-wl/Default SECTION:=kernel CATEGORY:=Kernel modules - DEPENDS:=@PACKAGE_kmod-brcm-wl||PACKAGE_kmod-brcm-wl-mini + DEPENDS:=@(PACKAGE_kmod-brcm-wl||PACKAGE_kmod-brcm-wl-mini) SUBMENU:=Proprietary BCM43xx WiFi driver - SUBMENUDEP:=@TARGET_brcm47xx||TARGET_brcm63xx + SUBMENUDEP:=(TARGET_brcm47xx||TARGET_brcm63xx) endef define KernelPackage/brcm-wl/Default $(call Package/broadcom-wl/Default) SECTION:=kernel - DEPENDS:=@TARGET_brcm47xx||TARGET_brcm63xx +wireless-tools + DEPENDS:=@(TARGET_brcm47xx||TARGET_brcm63xx) +wireless-tools TITLE:=Kernel driver for BCM43xx chipsets FILES:=$(PKG_BUILD_DIR)/driver$(1)/wl.ko $(PKG_BUILD_DIR)/glue/wl_glue.ko AUTOLOAD:=$(call AutoProbe,wl) diff --git a/package/kernel/cryptodev-linux/Makefile b/package/kernel/cryptodev-linux/Makefile new file mode 100644 index 00000000000000..2a8890286d367b --- /dev/null +++ b/package/kernel/cryptodev-linux/Makefile @@ -0,0 +1,59 @@ +# +# Copyright (C) 2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=cryptodev-linux +PKG_VERSION:=1.10 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=https://codeload.github.com/$(PKG_NAME)/$(PKG_NAME)/tar.gz/$(PKG_NAME)-$(PKG_VERSION)? +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_HASH:=833ab7c5c88d2b700a7c702a151254c089a3058886a63cc7d12630e364b8ea83 +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_MAINTAINER:=Ansuel Smith + +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/cryptodev + SUBMENU:=Cryptographic API modules + DEFAULT:=m if ALL + TITLE:=Driver for cryptographic acceleration + URL:=http://cryptodev-linux.org/ + VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE) + DEPENDS:=+kmod-crypto-authenc +kmod-crypto-hash + FILES:=$(PKG_BUILD_DIR)/cryptodev.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoLoad,50,cryptodev) + MODPARAMS.cryptodev:=cryptodev_verbosity=-1 +endef + +define KernelPackage/cryptodev/description + This is a driver for that allows to use the Linux kernel supported + hardware ciphers by user-space applications. +endef + +define Build/Configure +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(KERNEL_MAKE_FLAGS) \ + KERNEL_DIR="$(LINUX_DIR)" +endef + +define Build/InstallDev + $(INSTALL_DIR) $(STAGING_DIR)/usr/include/crypto + $(CP) $(PKG_BUILD_DIR)/crypto/cryptodev.h $(STAGING_DIR)/usr/include/crypto/ +endef + +$(eval $(call KernelPackage,cryptodev)) diff --git a/package/kernel/i2c-gpio-custom/Makefile b/package/kernel/i2c-gpio-custom/Makefile index d1123cc3fb529c..a0b86cc7ef992b 100644 --- a/package/kernel/i2c-gpio-custom/Makefile +++ b/package/kernel/i2c-gpio-custom/Makefile @@ -16,7 +16,7 @@ include $(INCLUDE_DIR)/package.mk define KernelPackage/i2c-gpio-custom SUBMENU:=I2C support TITLE:=Custom GPIO-based I2C device - DEPENDS:=@GPIO_SUPPORT +kmod-i2c-core +kmod-i2c-gpio + DEPENDS:=@GPIO_SUPPORT +kmod-i2c-core +kmod-i2c-gpio @!LINUX_4_19 FILES:=$(PKG_BUILD_DIR)/i2c-gpio-custom.ko KCONFIG:= endef diff --git a/package/kernel/i2c-gpio-custom/src/i2c-gpio-custom.c b/package/kernel/i2c-gpio-custom/src/i2c-gpio-custom.c index 921d290d5206cd..f9917e52fd649f 100644 --- a/package/kernel/i2c-gpio-custom/src/i2c-gpio-custom.c +++ b/package/kernel/i2c-gpio-custom/src/i2c-gpio-custom.c @@ -47,7 +47,12 @@ #include #include +#include +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0) #include +#else +#include +#endif #define DRV_NAME "i2c-gpio-custom" #define DRV_DESC "Custom GPIO-based I2C driver" diff --git a/package/kernel/kmod-sched-cake/Makefile b/package/kernel/kmod-sched-cake/Makefile index 6ec9c03bd255a2..35446641ab9e1d 100644 --- a/package/kernel/kmod-sched-cake/Makefile +++ b/package/kernel/kmod-sched-cake/Makefile @@ -13,9 +13,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/dtaht/sch_cake.git -PKG_SOURCE_DATE:=2018-07-16 -PKG_SOURCE_VERSION:=f39ab9a402ad51d7c17d4cde18ca15b2b7022030 -PKG_MIRROR_HASH:=fc22fc6eb7a24f4595c2777f33758ebcf9a2a404c16d00aa37ae389cd7f9c78f +PKG_SOURCE_DATE:=2019-03-12 +PKG_SOURCE_VERSION:=057c738801e9dc64e8dd72a3fc4f50734214433c +PKG_MIRROR_HASH:=5bf06a804824db36ae393fc174aeec7b12633176e05a765c0931b39df5bd34df PKG_MAINTAINER:=Kevin Darbyshire-Bryant include $(INCLUDE_DIR)/package.mk @@ -26,7 +26,7 @@ define KernelPackage/sched-cake URL:=https://github.com/dtaht/sch_cake FILES:=$(PKG_BUILD_DIR)/sch_cake.ko AUTOLOAD:=$(call AutoLoad,75,sch_cake) - DEPENDS:=+kmod-ipt-conntrack @!LINUX_3_18 + DEPENDS:=+kmod-ipt-conntrack endef include $(INCLUDE_DIR)/kernel-defaults.mk diff --git a/package/kernel/lantiq/ltq-atm/src/ltq_atm.c b/package/kernel/lantiq/ltq-atm/src/ltq_atm.c index a8f787fdca68c4..b7ac81ca80ed71 100644 --- a/package/kernel/lantiq/ltq-atm/src/ltq_atm.c +++ b/package/kernel/lantiq/ltq-atm/src/ltq_atm.c @@ -187,7 +187,6 @@ static inline void u64_add_u32(ppe_u64_t, unsigned int, ppe_u64_t *); */ static inline struct sk_buff* alloc_skb_rx(void); static inline struct sk_buff* alloc_skb_tx(unsigned int); -struct sk_buff* atm_alloc_tx(struct atm_vcc *, unsigned int); static inline void atm_free_tx_skb_vcc(struct sk_buff *, struct atm_vcc *); static inline struct sk_buff *get_skb_rx_pointer(unsigned int); static inline int get_tx_desc(unsigned int); @@ -261,8 +260,6 @@ EXPORT_SYMBOL(ifx_mei_atm_showtime_exit); #endif -static struct sk_buff* (*ifx_atm_alloc_tx)(struct atm_vcc *, unsigned int) = NULL; - static struct atm_priv_data g_atm_priv_data; static struct atmdev_ops g_ifx_atm_ops = { @@ -430,8 +427,6 @@ static int ppe_open(struct atm_vcc *vcc) /* enable irq */ if ( f_enable_irq ) { - ifx_atm_alloc_tx = atm_alloc_tx; - *MBOX_IGU1_ISRC = (1 << RX_DMA_CH_AAL) | (1 << RX_DMA_CH_OAM); *MBOX_IGU1_IER = (1 << RX_DMA_CH_AAL) | (1 << RX_DMA_CH_OAM); @@ -480,10 +475,8 @@ static void ppe_close(struct atm_vcc *vcc) clear_bit(conn, &g_atm_priv_data.conn_table); /* disable irq */ - if ( g_atm_priv_data.conn_table == 0 ) { + if ( g_atm_priv_data.conn_table == 0 ) disable_irq(PPE_MAILBOX_IGU1_INT); - ifx_atm_alloc_tx = NULL; - } /* release bandwidth */ switch ( vcc->qos.txtp.traffic_class ) @@ -785,42 +778,6 @@ static inline struct sk_buff* alloc_skb_tx(unsigned int size) return skb; } -struct sk_buff* atm_alloc_tx(struct atm_vcc *vcc, unsigned int size) -{ - int conn; - struct sk_buff *skb; - - /* oversize packet */ - if ( size > aal5s_max_packet_size ) { - pr_err("atm_alloc_tx: oversize packet\n"); - return NULL; - } - /* send buffer overflow */ - if ( sk_wmem_alloc_get(sk_atm(vcc)) && !atm_may_send(vcc, size) ) { - pr_err("atm_alloc_tx: send buffer overflow\n"); - return NULL; - } - conn = find_vcc(vcc); - if ( conn < 0 ) { - pr_err("atm_alloc_tx: unknown VCC\n"); - return NULL; - } - - skb = dev_alloc_skb(size); - if ( skb == NULL ) { - pr_err("atm_alloc_tx: sk buffer is used up\n"); - return NULL; - } - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,13,0)) - refcount_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); -#else - atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); -#endif - - return skb; -} - static inline void atm_free_tx_skb_vcc(struct sk_buff *skb, struct atm_vcc *vcc) { if ( vcc->pop != NULL ) diff --git a/package/kernel/lantiq/ltq-vdsl-fw/Makefile b/package/kernel/lantiq/ltq-vdsl-fw/Makefile new file mode 100644 index 00000000000000..8186e657e747a1 --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-fw/Makefile @@ -0,0 +1,42 @@ +# Copyright (C) 2012 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:=ltq-vdsl-fw +PKG_VERSION:=6.8.6 +PKG_RELEASE:=1 + +PKG_MAINTAINER:=Daniel Golle + +PKG_FLAGS:=nonshared + +include $(INCLUDE_DIR)/package.mk + +define Package/ltq-vdsl-vr9-vectoring-fw-installer + TITLE:=VDSL2 Vectoring Firmware installer + SECTION:=net + CATEGORY:=Network + DEPENDS:=@TARGET_lantiq_xrx200 +kmod-ltq-vdsl-vr9 +endef + +define Build/Prepare + $(INSTALL_DIR) $(PKG_BUILD_DIR) + $(CP) ./src/* $(PKG_BUILD_DIR) +endef + +define Build/Compile + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ + $(MAKE) -C $(PKG_BUILD_DIR) +endef + +define Package/ltq-vdsl-vr9-vectoring-fw-installer/install + $(INSTALL_DIR) $(1)/sbin + $(CP) $(PKG_BUILD_DIR)/w921v_fw_cutter $(PKG_BUILD_DIR)/vdsl_fw_install.sh $(1)/sbin/ +endef + +$(eval $(call BuildPackage,ltq-vdsl-vr9-vectoring-fw-installer)) diff --git a/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaDecode.c b/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaDecode.c new file mode 100644 index 00000000000000..cb8345377ea8a0 --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaDecode.c @@ -0,0 +1,584 @@ +/* + LzmaDecode.c + LZMA Decoder (optimized for Speed version) + + LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) + http://www.7-zip.org/ + + LZMA SDK is licensed under two licenses: + 1) GNU Lesser General Public License (GNU LGPL) + 2) Common Public License (CPL) + It means that you can select one of these two licenses and + follow rules of that license. + + SPECIAL EXCEPTION: + Igor Pavlov, as the author of this Code, expressly permits you to + statically or dynamically link your Code (or bind by name) to the + interfaces of this file without subjecting your linked Code to the + terms of the CPL or GNU LGPL. Any modifications or additions + to this file, however, are subject to the LGPL or CPL terms. +*/ + +#include "LzmaDecode.h" + +#define kNumTopBits 24 +#define kTopValue ((UInt32)1 << kNumTopBits) + +#define kNumBitModelTotalBits 11 +#define kBitModelTotal (1 << kNumBitModelTotalBits) +#define kNumMoveBits 5 + +#define RC_READ_BYTE (*Buffer++) + +#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \ + { int i; for(i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) | RC_READ_BYTE; }} + +#ifdef _LZMA_IN_CB + +#define RC_TEST { if (Buffer == BufferLim) \ + { SizeT size; int result = InCallback->Read(InCallback, &Buffer, &size); if (result != LZMA_RESULT_OK) return result; \ + BufferLim = Buffer + size; if (size == 0) return LZMA_RESULT_DATA_ERROR; }} + +#define RC_INIT Buffer = BufferLim = 0; RC_INIT2 + +#else + +#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; } + +#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2 + +#endif + +#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; } + +#define IfBit0(p) RC_NORMALIZE; bound = (Range >> kNumBitModelTotalBits) * *(p); if (Code < bound) +#define UpdateBit0(p) Range = bound; *(p) += (kBitModelTotal - *(p)) >> kNumMoveBits; +#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits; + +#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \ + { UpdateBit0(p); mi <<= 1; A0; } else \ + { UpdateBit1(p); mi = (mi + mi) + 1; A1; } + +#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;) + +#define RangeDecoderBitTreeDecode(probs, numLevels, res) \ + { int i = numLevels; res = 1; \ + do { CProb *p = probs + res; RC_GET_BIT(p, res) } while(--i != 0); \ + res -= (1 << numLevels); } + + +#define kNumPosBitsMax 4 +#define kNumPosStatesMax (1 << kNumPosBitsMax) + +#define kLenNumLowBits 3 +#define kLenNumLowSymbols (1 << kLenNumLowBits) +#define kLenNumMidBits 3 +#define kLenNumMidSymbols (1 << kLenNumMidBits) +#define kLenNumHighBits 8 +#define kLenNumHighSymbols (1 << kLenNumHighBits) + +#define LenChoice 0 +#define LenChoice2 (LenChoice + 1) +#define LenLow (LenChoice2 + 1) +#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) +#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) +#define kNumLenProbs (LenHigh + kLenNumHighSymbols) + + +#define kNumStates 12 +#define kNumLitStates 7 + +#define kStartPosModelIndex 4 +#define kEndPosModelIndex 14 +#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) + +#define kNumPosSlotBits 6 +#define kNumLenToPosStates 4 + +#define kNumAlignBits 4 +#define kAlignTableSize (1 << kNumAlignBits) + +#define kMatchMinLen 2 + +#define IsMatch 0 +#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) +#define IsRepG0 (IsRep + kNumStates) +#define IsRepG1 (IsRepG0 + kNumStates) +#define IsRepG2 (IsRepG1 + kNumStates) +#define IsRep0Long (IsRepG2 + kNumStates) +#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) +#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) +#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) +#define LenCoder (Align + kAlignTableSize) +#define RepLenCoder (LenCoder + kNumLenProbs) +#define Literal (RepLenCoder + kNumLenProbs) + +#if Literal != LZMA_BASE_SIZE +StopCompilingDueBUG +#endif + +int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size) +{ + unsigned char prop0; + if (size < LZMA_PROPERTIES_SIZE) + return LZMA_RESULT_DATA_ERROR; + prop0 = propsData[0]; + if (prop0 >= (9 * 5 * 5)) + return LZMA_RESULT_DATA_ERROR; + { + for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5)); + for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9); + propsRes->lc = prop0; + /* + unsigned char remainder = (unsigned char)(prop0 / 9); + propsRes->lc = prop0 % 9; + propsRes->pb = remainder / 5; + propsRes->lp = remainder % 5; + */ + } + + #ifdef _LZMA_OUT_READ + { + int i; + propsRes->DictionarySize = 0; + for (i = 0; i < 4; i++) + propsRes->DictionarySize += (UInt32)(propsData[1 + i]) << (i * 8); + if (propsRes->DictionarySize == 0) + propsRes->DictionarySize = 1; + } + #endif + return LZMA_RESULT_OK; +} + +#define kLzmaStreamWasFinishedId (-1) + +int LzmaDecode(CLzmaDecoderState *vs, + #ifdef _LZMA_IN_CB + ILzmaInCallback *InCallback, + #else + const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, + #endif + unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed) +{ + CProb *p = vs->Probs; + SizeT nowPos = 0; + Byte previousByte = 0; + UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1; + UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1; + int lc = vs->Properties.lc; + + #ifdef _LZMA_OUT_READ + + UInt32 Range = vs->Range; + UInt32 Code = vs->Code; + #ifdef _LZMA_IN_CB + const Byte *Buffer = vs->Buffer; + const Byte *BufferLim = vs->BufferLim; + #else + const Byte *Buffer = inStream; + const Byte *BufferLim = inStream + inSize; + #endif + int state = vs->State; + UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3]; + int len = vs->RemainLen; + UInt32 globalPos = vs->GlobalPos; + UInt32 distanceLimit = vs->DistanceLimit; + + Byte *dictionary = vs->Dictionary; + UInt32 dictionarySize = vs->Properties.DictionarySize; + UInt32 dictionaryPos = vs->DictionaryPos; + + Byte tempDictionary[4]; + + #ifndef _LZMA_IN_CB + *inSizeProcessed = 0; + #endif + *outSizeProcessed = 0; + if (len == kLzmaStreamWasFinishedId) + return LZMA_RESULT_OK; + + if (dictionarySize == 0) + { + dictionary = tempDictionary; + dictionarySize = 1; + tempDictionary[0] = vs->TempDictionary[0]; + } + + if (len == kLzmaNeedInitId) + { + { + UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); + UInt32 i; + for (i = 0; i < numProbs; i++) + p[i] = kBitModelTotal >> 1; + rep0 = rep1 = rep2 = rep3 = 1; + state = 0; + globalPos = 0; + distanceLimit = 0; + dictionaryPos = 0; + dictionary[dictionarySize - 1] = 0; + #ifdef _LZMA_IN_CB + RC_INIT; + #else + RC_INIT(inStream, inSize); + #endif + } + len = 0; + } + while(len != 0 && nowPos < outSize) + { + UInt32 pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos]; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + len--; + } + if (dictionaryPos == 0) + previousByte = dictionary[dictionarySize - 1]; + else + previousByte = dictionary[dictionaryPos - 1]; + + #else /* if !_LZMA_OUT_READ */ + + int state = 0; + UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1; + int len = 0; + const Byte *Buffer; + const Byte *BufferLim; + UInt32 Range; + UInt32 Code; + + #ifndef _LZMA_IN_CB + *inSizeProcessed = 0; + #endif + *outSizeProcessed = 0; + + { + UInt32 i; + UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); + for (i = 0; i < numProbs; i++) + p[i] = kBitModelTotal >> 1; + } + + #ifdef _LZMA_IN_CB + RC_INIT; + #else + RC_INIT(inStream, inSize); + #endif + + #endif /* _LZMA_OUT_READ */ + + while(nowPos < outSize) + { + CProb *prob; + UInt32 bound; + int posState = (int)( + (nowPos + #ifdef _LZMA_OUT_READ + + globalPos + #endif + ) + & posStateMask); + + prob = p + IsMatch + (state << kNumPosBitsMax) + posState; + IfBit0(prob) + { + int symbol = 1; + UpdateBit0(prob) + prob = p + Literal + (LZMA_LIT_SIZE * + ((( + (nowPos + #ifdef _LZMA_OUT_READ + + globalPos + #endif + ) + & literalPosMask) << lc) + (previousByte >> (8 - lc)))); + + if (state >= kNumLitStates) + { + int matchByte; + #ifdef _LZMA_OUT_READ + UInt32 pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + matchByte = dictionary[pos]; + #else + matchByte = outStream[nowPos - rep0]; + #endif + do + { + int bit; + CProb *probLit; + matchByte <<= 1; + bit = (matchByte & 0x100); + probLit = prob + 0x100 + bit + symbol; + RC_GET_BIT2(probLit, symbol, if (bit != 0) break, if (bit == 0) break) + } + while (symbol < 0x100); + } + while (symbol < 0x100) + { + CProb *probLit = prob + symbol; + RC_GET_BIT(probLit, symbol) + } + previousByte = (Byte)symbol; + + outStream[nowPos++] = previousByte; + #ifdef _LZMA_OUT_READ + if (distanceLimit < dictionarySize) + distanceLimit++; + + dictionary[dictionaryPos] = previousByte; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + #endif + if (state < 4) state = 0; + else if (state < 10) state -= 3; + else state -= 6; + } + else + { + UpdateBit1(prob); + prob = p + IsRep + state; + IfBit0(prob) + { + UpdateBit0(prob); + rep3 = rep2; + rep2 = rep1; + rep1 = rep0; + state = state < kNumLitStates ? 0 : 3; + prob = p + LenCoder; + } + else + { + UpdateBit1(prob); + prob = p + IsRepG0 + state; + IfBit0(prob) + { + UpdateBit0(prob); + prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState; + IfBit0(prob) + { + #ifdef _LZMA_OUT_READ + UInt32 pos; + #endif + UpdateBit0(prob); + + #ifdef _LZMA_OUT_READ + if (distanceLimit == 0) + #else + if (nowPos == 0) + #endif + return LZMA_RESULT_DATA_ERROR; + + state = state < kNumLitStates ? 9 : 11; + #ifdef _LZMA_OUT_READ + pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + previousByte = dictionary[pos]; + dictionary[dictionaryPos] = previousByte; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + #else + previousByte = outStream[nowPos - rep0]; + #endif + outStream[nowPos++] = previousByte; + #ifdef _LZMA_OUT_READ + if (distanceLimit < dictionarySize) + distanceLimit++; + #endif + + continue; + } + else + { + UpdateBit1(prob); + } + } + else + { + UInt32 distance; + UpdateBit1(prob); + prob = p + IsRepG1 + state; + IfBit0(prob) + { + UpdateBit0(prob); + distance = rep1; + } + else + { + UpdateBit1(prob); + prob = p + IsRepG2 + state; + IfBit0(prob) + { + UpdateBit0(prob); + distance = rep2; + } + else + { + UpdateBit1(prob); + distance = rep3; + rep3 = rep2; + } + rep2 = rep1; + } + rep1 = rep0; + rep0 = distance; + } + state = state < kNumLitStates ? 8 : 11; + prob = p + RepLenCoder; + } + { + int numBits, offset; + CProb *probLen = prob + LenChoice; + IfBit0(probLen) + { + UpdateBit0(probLen); + probLen = prob + LenLow + (posState << kLenNumLowBits); + offset = 0; + numBits = kLenNumLowBits; + } + else + { + UpdateBit1(probLen); + probLen = prob + LenChoice2; + IfBit0(probLen) + { + UpdateBit0(probLen); + probLen = prob + LenMid + (posState << kLenNumMidBits); + offset = kLenNumLowSymbols; + numBits = kLenNumMidBits; + } + else + { + UpdateBit1(probLen); + probLen = prob + LenHigh; + offset = kLenNumLowSymbols + kLenNumMidSymbols; + numBits = kLenNumHighBits; + } + } + RangeDecoderBitTreeDecode(probLen, numBits, len); + len += offset; + } + + if (state < 4) + { + int posSlot; + state += kNumLitStates; + prob = p + PosSlot + + ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << + kNumPosSlotBits); + RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot); + if (posSlot >= kStartPosModelIndex) + { + int numDirectBits = ((posSlot >> 1) - 1); + rep0 = (2 | ((UInt32)posSlot & 1)); + if (posSlot < kEndPosModelIndex) + { + rep0 <<= numDirectBits; + prob = p + SpecPos + rep0 - posSlot - 1; + } + else + { + numDirectBits -= kNumAlignBits; + do + { + RC_NORMALIZE + Range >>= 1; + rep0 <<= 1; + if (Code >= Range) + { + Code -= Range; + rep0 |= 1; + } + } + while (--numDirectBits != 0); + prob = p + Align; + rep0 <<= kNumAlignBits; + numDirectBits = kNumAlignBits; + } + { + int i = 1; + int mi = 1; + do + { + CProb *prob3 = prob + mi; + RC_GET_BIT2(prob3, mi, ; , rep0 |= i); + i <<= 1; + } + while(--numDirectBits != 0); + } + } + else + rep0 = posSlot; + if (++rep0 == (UInt32)(0)) + { + /* it's for stream version */ + len = kLzmaStreamWasFinishedId; + break; + } + } + + len += kMatchMinLen; + #ifdef _LZMA_OUT_READ + if (rep0 > distanceLimit) + #else + if (rep0 > nowPos) + #endif + return LZMA_RESULT_DATA_ERROR; + + #ifdef _LZMA_OUT_READ + if (dictionarySize - distanceLimit > (UInt32)len) + distanceLimit += len; + else + distanceLimit = dictionarySize; + #endif + + do + { + #ifdef _LZMA_OUT_READ + UInt32 pos = dictionaryPos - rep0; + if (pos >= dictionarySize) + pos += dictionarySize; + previousByte = dictionary[pos]; + dictionary[dictionaryPos] = previousByte; + if (++dictionaryPos == dictionarySize) + dictionaryPos = 0; + #else + previousByte = outStream[nowPos - rep0]; + #endif + len--; + outStream[nowPos++] = previousByte; + } + while(len != 0 && nowPos < outSize); + } + } + RC_NORMALIZE; + + #ifdef _LZMA_OUT_READ + vs->Range = Range; + vs->Code = Code; + vs->DictionaryPos = dictionaryPos; + vs->GlobalPos = globalPos + (UInt32)nowPos; + vs->DistanceLimit = distanceLimit; + vs->Reps[0] = rep0; + vs->Reps[1] = rep1; + vs->Reps[2] = rep2; + vs->Reps[3] = rep3; + vs->State = state; + vs->RemainLen = len; + vs->TempDictionary[0] = tempDictionary[0]; + #endif + + #ifdef _LZMA_IN_CB + vs->Buffer = Buffer; + vs->BufferLim = BufferLim; + #else + *inSizeProcessed = (SizeT)(Buffer - inStream); + #endif + *outSizeProcessed = nowPos; + return LZMA_RESULT_OK; +} diff --git a/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaDecode.h b/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaDecode.h new file mode 100644 index 00000000000000..2870eeb9c9c115 --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaDecode.h @@ -0,0 +1,113 @@ +/* + LzmaDecode.h + LZMA Decoder interface + + LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) + http://www.7-zip.org/ + + LZMA SDK is licensed under two licenses: + 1) GNU Lesser General Public License (GNU LGPL) + 2) Common Public License (CPL) + It means that you can select one of these two licenses and + follow rules of that license. + + SPECIAL EXCEPTION: + Igor Pavlov, as the author of this code, expressly permits you to + statically or dynamically link your code (or bind by name) to the + interfaces of this file without subjecting your linked code to the + terms of the CPL or GNU LGPL. Any modifications or additions + to this file, however, are subject to the LGPL or CPL terms. +*/ + +#ifndef __LZMADECODE_H +#define __LZMADECODE_H + +#include "LzmaTypes.h" + +/* #define _LZMA_IN_CB */ +/* Use callback for input data */ + +/* #define _LZMA_OUT_READ */ +/* Use read function for output data */ + +/* #define _LZMA_PROB32 */ +/* It can increase speed on some 32-bit CPUs, + but memory usage will be doubled in that case */ + +/* #define _LZMA_LOC_OPT */ +/* Enable local speed optimizations inside code */ + +#ifdef _LZMA_PROB32 +#define CProb UInt32 +#else +#define CProb UInt16 +#endif + +#define LZMA_RESULT_OK 0 +#define LZMA_RESULT_DATA_ERROR 1 + +#ifdef _LZMA_IN_CB +typedef struct _ILzmaInCallback +{ + int (*Read)(void *object, const unsigned char **buffer, SizeT *bufferSize); +} ILzmaInCallback; +#endif + +#define LZMA_BASE_SIZE 1846 +#define LZMA_LIT_SIZE 768 + +#define LZMA_PROPERTIES_SIZE 5 + +typedef struct _CLzmaProperties +{ + int lc; + int lp; + int pb; + #ifdef _LZMA_OUT_READ + UInt32 DictionarySize; + #endif +}CLzmaProperties; + +int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size); + +#define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Properties)->lc + (Properties)->lp))) + +#define kLzmaNeedInitId (-2) + +typedef struct _CLzmaDecoderState +{ + CLzmaProperties Properties; + CProb *Probs; + + #ifdef _LZMA_IN_CB + const unsigned char *Buffer; + const unsigned char *BufferLim; + #endif + + #ifdef _LZMA_OUT_READ + unsigned char *Dictionary; + UInt32 Range; + UInt32 Code; + UInt32 DictionaryPos; + UInt32 GlobalPos; + UInt32 DistanceLimit; + UInt32 Reps[4]; + int State; + int RemainLen; + unsigned char TempDictionary[4]; + #endif +} CLzmaDecoderState; + +#ifdef _LZMA_OUT_READ +#define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; } +#endif + +int LzmaDecode(CLzmaDecoderState *vs, + #ifdef _LZMA_IN_CB + ILzmaInCallback *inCallback, + #else + const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, + #endif + unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed); + +#endif diff --git a/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaTypes.h b/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaTypes.h new file mode 100644 index 00000000000000..9c27290757c4f7 --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaTypes.h @@ -0,0 +1,45 @@ +/* +LzmaTypes.h + +Types for LZMA Decoder + +This file written and distributed to public domain by Igor Pavlov. +This file is part of LZMA SDK 4.40 (2006-05-01) +*/ + +#ifndef __LZMATYPES_H +#define __LZMATYPES_H + +#ifndef _7ZIP_BYTE_DEFINED +#define _7ZIP_BYTE_DEFINED +typedef unsigned char Byte; +#endif + +#ifndef _7ZIP_UINT16_DEFINED +#define _7ZIP_UINT16_DEFINED +typedef unsigned short UInt16; +#endif + +#ifndef _7ZIP_UINT32_DEFINED +#define _7ZIP_UINT32_DEFINED +#ifdef _LZMA_UINT32_IS_ULONG +typedef unsigned long UInt32; +#else +typedef unsigned int UInt32; +#endif +#endif + +/* #define _LZMA_NO_SYSTEM_SIZE_T */ +/* You can use it, if you don't want */ + +#ifndef _7ZIP_SIZET_DEFINED +#define _7ZIP_SIZET_DEFINED +#ifdef _LZMA_NO_SYSTEM_SIZE_T +typedef UInt32 SizeT; +#else +#include +typedef size_t SizeT; +#endif +#endif + +#endif diff --git a/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaWrapper.c b/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaWrapper.c new file mode 100644 index 00000000000000..7dce05666ced86 --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaWrapper.c @@ -0,0 +1,206 @@ +/****************************************************************************** +** +** FILE NAME : LzmaWrapper.c +** PROJECT : bootloader +** MODULES : U-boot +** +** DATE : 2 Nov 2006 +** AUTHOR : Lin Mars +** DESCRIPTION : LZMA decoder support for U-boot 1.1.5 +** COPYRIGHT : Copyright (c) 2006 +** Infineon Technologies AG +** Am Campeon 1-12, 85579 Neubiberg, Germany +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** HISTORY +** $Date $Author $Comment +** 2 Nov 2006 Lin Mars init version which derived from LzmaTest.c from +** LZMA v4.43 SDK +** 24 May 2007 Lin Mars Fix issue for multiple lzma_inflate involved +*******************************************************************************/ +#include +#include +#include + +#include "LzmaDecode.h" +#include "LzmaWrapper.h" + +#if defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) || !defined(CFG_BOOTSTRAP_CODE) +static const char *kCantReadMessage = "Can not read from source buffer"; +static const char *kCantAllocateMessage = "Not enough buffer for decompression"; +#endif + +static size_t rpos=0, dpos=0; + +static int MyReadFileAndCheck(unsigned char *src, void *dest, size_t size) +{ + if (size == 0) + return 0; + memcpy(dest, src + rpos, size); + rpos += size; + return 1; +} + +int lzma_inflate(unsigned char *source, int s_len, unsigned char *dest, int *d_len) +{ + /* We use two 32-bit integers to construct 64-bit integer for file size. + You can remove outSizeHigh, if you don't need >= 4GB supporting, + or you can use UInt64 outSize, if your compiler supports 64-bit integers*/ + UInt32 outSize = 0; + UInt32 outSizeHigh = 0; + SizeT outSizeFull; + unsigned char *outStream; + + int waitEOS = 1; + /* waitEOS = 1, if there is no uncompressed size in headers, + so decoder will wait EOS (End of Stream Marker) in compressed stream */ + + SizeT compressedSize; + unsigned char *inStream; + + CLzmaDecoderState state; /* it's about 24-80 bytes structure, if int is 32-bit */ + unsigned char properties[LZMA_PROPERTIES_SIZE]; + + int res; + + rpos=0; dpos=0; + + if (sizeof(UInt32) < 4) + { +#if defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) || !defined(CFG_BOOTSTRAP_CODE) + printf("LZMA decoder needs correct UInt32\n"); +#endif + return LZMA_RESULT_DATA_ERROR; + } + + { + long length=s_len; + if ((long)(SizeT)length != length) + { +#if defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) || !defined(CFG_BOOTSTRAP_CODE) + printf("Too big compressed stream\n"); +#endif + return LZMA_RESULT_DATA_ERROR; + } + compressedSize = (SizeT)(length - (LZMA_PROPERTIES_SIZE + 8)); + } + + /* Read LZMA properties for compressed stream */ + + if (!MyReadFileAndCheck(source, properties, sizeof(properties))) + { +#if defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) || !defined(CFG_BOOTSTRAP_CODE) + printf("%s\n", kCantReadMessage); +#endif + return LZMA_RESULT_DATA_ERROR; + } + + /* Read uncompressed size */ + { + int i; + for (i = 0; i < 8; i++) + { + unsigned char b; + if (!MyReadFileAndCheck(source, &b, 1)) + { +#if defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) || !defined(CFG_BOOTSTRAP_CODE) + printf("%s\n", kCantReadMessage); +#endif + return LZMA_RESULT_DATA_ERROR; + } + if (b != 0xFF) + waitEOS = 0; + if (i < 4) + outSize += (UInt32)(b) << (i * 8); + else + outSizeHigh += (UInt32)(b) << ((i - 4) * 8); + } + + if (waitEOS) + { +#if defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) || !defined(CFG_BOOTSTRAP_CODE) + printf("Stream with EOS marker is not supported"); +#endif + return LZMA_RESULT_DATA_ERROR; + } + outSizeFull = (SizeT)outSize; + if (sizeof(SizeT) >= 8) + outSizeFull |= (((SizeT)outSizeHigh << 16) << 16); + else if (outSizeHigh != 0 || (UInt32)(SizeT)outSize != outSize) + { +#if defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) || !defined(CFG_BOOTSTRAP_CODE) + printf("Too big uncompressed stream"); +#endif + return LZMA_RESULT_DATA_ERROR; + } + } + + /* Decode LZMA properties and allocate memory */ + if (LzmaDecodeProperties(&state.Properties, properties, LZMA_PROPERTIES_SIZE) != LZMA_RESULT_OK) + { +#if defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) || !defined(CFG_BOOTSTRAP_CODE) + printf("Incorrect stream properties"); +#endif + return LZMA_RESULT_DATA_ERROR; + } + state.Probs = (CProb *)malloc(LzmaGetNumProbs(&state.Properties) * sizeof(CProb)); + + if (outSizeFull == 0) + outStream = 0; + else + { + if (outSizeFull > d_len) + outStream = 0; + else + outStream = dest; + } + + if (compressedSize == 0) + inStream = 0; + else + { + if ((compressedSize+rpos) > s_len ) + inStream = 0; + else + inStream = source + rpos; + } + + if (state.Probs == 0 + || (outStream == 0 && outSizeFull != 0) + || (inStream == 0 && compressedSize != 0) + ) + { + free(state.Probs); +#if defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) || !defined(CFG_BOOTSTRAP_CODE) + printf("%s\n", kCantAllocateMessage); +#endif + return LZMA_RESULT_DATA_ERROR; + } + + /* Decompress */ + { + SizeT inProcessed; + SizeT outProcessed; + res = LzmaDecode(&state, + inStream, compressedSize, &inProcessed, + outStream, outSizeFull, &outProcessed); + if (res != 0) + { +#if defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) || !defined(CFG_BOOTSTRAP_CODE) + printf("\nDecoding error = %d\n", res); +#endif + res = 1; + } + else + { + *d_len = outProcessed; + } + } + + free(state.Probs); + return res; +} diff --git a/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaWrapper.h b/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaWrapper.h new file mode 100644 index 00000000000000..2f9a3ffbbb2201 --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-fw/src/LzmaWrapper.h @@ -0,0 +1,36 @@ +/****************************************************************************** +** +** FILE NAME : LzmaWrapper.h +** PROJECT : bootloader +** MODULES : U-boot +** +** DATE : 2 Nov 2006 +** AUTHOR : Lin Mars +** DESCRIPTION : LZMA decoder support for U-boot 1.1.5 +** COPYRIGHT : Copyright (c) 2006 +** Infineon Technologies AG +** Am Campeon 1-12, 85579 Neubiberg, Germany +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** HISTORY +** $Date $Author $Comment +** 2 Nov 2006 Lin Mars init version which derived from LzmaTest.c from +** LZMA v4.43 SDK +*******************************************************************************/ +#ifndef __LZMA_WRAPPER_H__ +#define __LZMA_WRAPPER_H__ + +#ifndef LZMA_RESULT_OK +#define LZMA_RESULT_OK 0 +#endif +#ifndef LZMA_RESULT_DATA_ERROR +#define LZMA_RESULT_DATA_ERROR 1 +#endif + +extern int lzma_inflate(unsigned char *source, int s_len, unsigned char *dest, int *d_len); + +#endif /*__LZMA_WRAPPER_H__*/ diff --git a/package/kernel/lantiq/ltq-vdsl-fw/src/Makefile b/package/kernel/lantiq/ltq-vdsl-fw/src/Makefile new file mode 100644 index 00000000000000..2d50aaf023a13a --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-fw/src/Makefile @@ -0,0 +1,13 @@ +PROG=w921v_fw_cutter +OBJS=w921v_fw_cutter.c LzmaDecode.c LzmaWrapper.c + +all: $(PROG) + +$(PROG): $(OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ + +clean: + rm *.o $(PROG) + +%.o: %.c + $(CC) $(CFLAGS) -c $^ -o $@ diff --git a/package/kernel/lantiq/ltq-vdsl-fw/src/vdsl_fw_install.sh b/package/kernel/lantiq/ltq-vdsl-fw/src/vdsl_fw_install.sh new file mode 100644 index 00000000000000..9242e175c08518 --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-fw/src/vdsl_fw_install.sh @@ -0,0 +1,48 @@ +#!/bin/sh +FW="/tmp/firmware-speedport-w921v-1.44.000.bin" +URL="https://www.telekom.de/hilfe/downloads/firmware-speedport-w921v-1.44.000.bin" +FW_TAPI="vr9_tapi_fw.bin" +FW_DSL="vr9_dsl_fw_annex_b.bin" +MD5_FW="cefbeb7073e02e0fa4ddb6b31ecb3d1e" +MD5_TAPI="57f2d07f59e11250ce1219bad99c1eda" +MD5_DSL="655442e31deaa42c9c68944869361ec0" + +[ -f /lib/firmware/vdsl.bin ] && exit 0 + +[ -z "$1" ] || URL=$1 + +[ -f "${FW}" ] || { + echo "${FW} does not exist. Try to Download it ? (y/N)" + read -n 1 R + echo "" + [ "$R" = "y" ] || { + echo "Please manually download the firmware from ${URL} and copy the file to ${FW}" + echo "See also https://xdarklight.github.io/lantiq-xdsl-firmware-info/ for alternatives" + exit 1 + } + echo "Download w921v Firmware" + wget "${URL}" -O "${FW}" + [ $? -eq 0 -a -f "${FW}" ] || exit 1 +} + +F=`md5sum -b ${FW} | cut -d" " -f1` +[ "$F" = "${MD5_FW}" ] || { + echo "Failed to verify Firmware MD5" + exit 1 +} + +cd /tmp +echo "Unpack and decompress w921v Firmware" + +w921v_fw_cutter +[ $? -eq 0 ] || exit 1 + +T=`md5sum -b ${FW_TAPI} | cut -d" " -f1` +D=`md5sum -b ${FW_DSL} | cut -d" " -f1` + +[ "$T" = "${MD5_TAPI}" -a "$D" = "${MD5_DSL}" ] || { + echo "Failed to verify MD5" + exit 1 +} + +cp ${FW_TAPI} ${FW_DSL} /lib/firmware/ diff --git a/package/kernel/lantiq/ltq-vdsl-fw/src/w921v_fw_cutter.c b/package/kernel/lantiq/ltq-vdsl-fw/src/w921v_fw_cutter.c new file mode 100644 index 00000000000000..6082bdadb6e381 --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-fw/src/w921v_fw_cutter.c @@ -0,0 +1,165 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + * + * Copyright (C) 2012 John Crispin + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "LzmaWrapper.h" + +#define FW_NAME "/tmp/firmware-speedport-w921v-1.44.000.bin" + +#define MAGIC 0x50 +#define MAGIC_SZ 0x3FFC00 +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define MAGIC_PART 0x12345678 +#define MAGIC_LZMA 0x8000005D +#define MAGIC_ANNEX_B 0x3C +#define MAGIC_TAPI 0x5A +#else +#define MAGIC_PART 0x78563412 +#define MAGIC_LZMA 0x5D000080 +#define MAGIC_ANNEX_B 0x3C000000 +#define MAGIC_TAPI 0x5A000000 +#endif + + +const char* part_type(unsigned int id) +{ + switch(id) { + case MAGIC_ANNEX_B: + return "/tmp/vr9_dsl_fw_annex_b.bin"; + case MAGIC_TAPI: + return "/tmp/vr9_tapi_fw.bin"; + } + printf("\tUnknown lzma type 0x%02X\n", id); + return "/tmp/unknown.lzma"; +} + +int main(int argc, char **argv) +{ + struct stat s; + unsigned char *buf_orig; + unsigned int *buf; + int buflen; + int fd; + int i; + int err; + int start = 0, end = 0; + + printf("Arcadyan Firmware cutter v0.1\n"); + printf("-----------------------------\n"); + printf("This tool extracts the different parts of an arcadyan firmware update file\n"); + printf("This tool is for private use only. The Firmware that gets extracted has a license that forbids redistribution\n"); + printf("Please only run this if you understand the risks\n\n"); + printf("I understand the risks ? (y/N)\n"); + + if (getchar() != 'y') + return -1; + + if (stat(FW_NAME, &s) != 0) { + printf("Failed to find %s\n", FW_NAME); + printf("Ask Google or try https://www.telekom.de/hilfe/downloads/firmware-speedport-w921v-1.44.000.bin\n"); + return -1; + } + + buf_orig = malloc(s.st_size); + buf = malloc(s.st_size); + if (!buf_orig || !buf) { + printf("Failed to alloc %d bytes\n", s.st_size); + return -1; + } + + fd = open(FW_NAME, O_RDONLY); + if (fd < 0) { + printf("Unable to open %s\n", FW_NAME); + return -1; + } + + + buflen = read(fd, buf_orig, s.st_size); + close(fd); + if (buflen != s.st_size) { + printf("Loaded %d instead of %d bytes inside %s\n", buflen, s.st_size, FW_NAME); + return -1; + } + + /* */ + buf_orig++; + buflen -= 1; + for (i = 0; i < MAGIC_SZ; i++) { + if ((i % 16) < 3) + buf_orig[i] = buf_orig[i + 16] ^ MAGIC; + else + buf_orig[i] = buf_orig[i] ^ MAGIC; + } + buflen -= 3; + memmove(&buf_orig[MAGIC_SZ], &buf_orig[MAGIC_SZ + 3], buflen - MAGIC_SZ); + memcpy(buf, buf_orig, s.st_size); + + /* */ + do { + if (buf[end] == MAGIC_PART) { + end += 2; + printf("Found partition at 0x%08X with size %d\n", + start * sizeof(unsigned int), + (end - start) * sizeof(unsigned int)); + if (buf[start] == MAGIC_LZMA) { + int dest_len = 1024 * 1024; + int len = buf[end - 3]; + unsigned int id = buf[end - 6]; + const char *type = part_type(id); + unsigned char *dest; + + dest = malloc(dest_len); + if (!dest) { + printf("Failed to alloc dest buffer\n"); + return -1; + } + + if (lzma_inflate((unsigned char*)&buf[start], len, dest, &dest_len)) { + printf("Failed to decompress data\n"); + return -1; + } + + fd = creat(type, S_IRUSR | S_IWUSR); + if (fd != -1) { + if (write(fd, dest, dest_len) != dest_len) + printf("\tFailed to write %d bytes\n", dest_len); + else + printf("\tWrote %d bytes to %s\n", dest_len, type); + close(fd); + } else { + printf("\tFailed to open %s\n", type); + } + free(dest); + } else { + printf("\tThis is not lzma\n"); + } + start = end; + } else { + end++; + } + } while(end < buflen / sizeof(unsigned int)); + + return 0; +} diff --git a/package/kernel/linux/files/sysctl-br-netfilter.conf b/package/kernel/linux/files/sysctl-br-netfilter.conf index b10ddc0874b6d3..22c24a4bfec1d4 100644 --- a/package/kernel/linux/files/sysctl-br-netfilter.conf +++ b/package/kernel/linux/files/sysctl-br-netfilter.conf @@ -2,6 +2,6 @@ # /etc/sysctl.conf can be used to customize sysctl settings # disable bridge firewalling by default -net.bridge.bridge-nf-call-arptables=0 -net.bridge.bridge-nf-call-ip6tables=0 -net.bridge.bridge-nf-call-iptables=0 +net.bridge.bridge-nf-call-arptables=1 +net.bridge.bridge-nf-call-ip6tables=1 +net.bridge.bridge-nf-call-iptables=1 diff --git a/package/kernel/linux/files/sysctl-nf-conntrack.conf b/package/kernel/linux/files/sysctl-nf-conntrack.conf index 37baf5fd6ff9d9..2af8cfb8cb1c2c 100644 --- a/package/kernel/linux/files/sysctl-nf-conntrack.conf +++ b/package/kernel/linux/files/sysctl-nf-conntrack.conf @@ -3,7 +3,8 @@ net.netfilter.nf_conntrack_acct=1 net.netfilter.nf_conntrack_checksum=0 -net.netfilter.nf_conntrack_max=16384 +net.netfilter.nf_conntrack_max=65535 net.netfilter.nf_conntrack_tcp_timeout_established=7440 net.netfilter.nf_conntrack_udp_timeout=60 net.netfilter.nf_conntrack_udp_timeout_stream=180 +net.netfilter.nf_conntrack_helper=1 diff --git a/package/kernel/linux/files/sysctl-tcp-bbr-k4_9.conf b/package/kernel/linux/files/sysctl-tcp-bbr-k4_9.conf new file mode 100644 index 00000000000000..2f63b728881362 --- /dev/null +++ b/package/kernel/linux/files/sysctl-tcp-bbr-k4_9.conf @@ -0,0 +1,5 @@ +# Do not edit, changes to this file will be lost on upgrades +# /etc/sysctl.conf can be used to customize sysctl settings + +net.ipv4.tcp_congestion_control=bbr +net.core.default_qdisc=fq diff --git a/package/kernel/linux/files/sysctl-tcp-bbr.conf b/package/kernel/linux/files/sysctl-tcp-bbr.conf new file mode 100644 index 00000000000000..3a7dba2f0b2b4d --- /dev/null +++ b/package/kernel/linux/files/sysctl-tcp-bbr.conf @@ -0,0 +1,4 @@ +# Do not edit, changes to this file will be lost on upgrades +# /etc/sysctl.conf can be used to customize sysctl settings + +net.ipv4.tcp_congestion_control=bbr diff --git a/package/kernel/linux/modules/block.mk b/package/kernel/linux/modules/block.mk index ab9d7af8ca97d3..c486a433c2ee06 100644 --- a/package/kernel/linux/modules/block.mk +++ b/package/kernel/linux/modules/block.mk @@ -209,7 +209,7 @@ $(eval $(call KernelPackage,block2mtd)) define KernelPackage/dax SUBMENU:=$(BLOCK_MENU) TITLE:=DAX: direct access to differentiated memory - DEPENDS:=@LINUX_4_14 + DEPENDS:=@!LINUX_4_9 KCONFIG:=CONFIG_DAX FILES:=$(LINUX_DIR)/drivers/dax/dax.ko endef @@ -220,7 +220,7 @@ $(eval $(call KernelPackage,dax)) define KernelPackage/dm SUBMENU:=$(BLOCK_MENU) TITLE:=Device Mapper - DEPENDS:=+kmod-crypto-manager +LINUX_4_14:kmod-dax + DEPENDS:=+kmod-crypto-manager +!LINUX_4_9:kmod-dax # All the "=n" are unnecessary, they're only there # to stop the config from asking the question. # MIRROR is M because I've needed it for pvmove. @@ -239,7 +239,12 @@ define KernelPackage/dm CONFIG_BLK_DEV_DM \ CONFIG_DM_CRYPT \ CONFIG_DM_MIRROR - FILES:=$(LINUX_DIR)/drivers/md/dm-*.ko + FILES:= \ + $(LINUX_DIR)/drivers/md/dm-mod.ko \ + $(LINUX_DIR)/drivers/md/dm-crypt.ko \ + $(LINUX_DIR)/drivers/md/dm-log.ko \ + $(LINUX_DIR)/drivers/md/dm-mirror.ko \ + $(LINUX_DIR)/drivers/md/dm-region-hash.ko AUTOLOAD:=$(call AutoLoad,30,dm-mod dm-log dm-region-hash dm-mirror dm-crypt) endef @@ -249,6 +254,23 @@ endef $(eval $(call KernelPackage,dm)) +define KernelPackage/dm-raid + SUBMENU:=$(BLOCK_MENU) + TITLE:=LVM2 raid support + DEPENDS:=+kmod-dm +kmod-md-mod \ + +kmod-md-raid0 +kmod-md-raid1 +kmod-md-raid10 +kmod-md-raid456 + KCONFIG:= \ + CONFIG_DM_RAID + FILES:=$(LINUX_DIR)/drivers/md/dm-raid.ko + AUTOLOAD:=$(call AutoLoad,31,dm-raid) +endef + +define KernelPackage/dm-raid/description + Kernel module necessary for LVM2 raid support +endef + +$(eval $(call KernelPackage,dm-raid)) + define KernelPackage/md-mod SUBMENU:=$(BLOCK_MENU) @@ -337,7 +359,7 @@ $(eval $(call KernelPackage,md-raid10)) define KernelPackage/md-raid456 -$(call KernelPackage/md/Depends,+kmod-lib-raid6 +kmod-lib-xor +!LINUX_3_18:kmod-lib-crc32c) +$(call KernelPackage/md/Depends,+kmod-lib-raid6 +kmod-lib-xor +kmod-lib-crc32c) TITLE:=RAID Level 456 Driver KCONFIG:= \ CONFIG_ASYNC_CORE \ diff --git a/package/kernel/linux/modules/can.mk b/package/kernel/linux/modules/can.mk index 925de4d8a5b322..c2c7411c6e88bc 100644 --- a/package/kernel/linux/modules/can.mk +++ b/package/kernel/linux/modules/can.mk @@ -26,7 +26,6 @@ define KernelPackage/can CONFIG_CAN_MSCAN=n \ CONFIG_CAN_SJA1000=n \ CONFIG_CAN_SOFTING=n \ - CONFIG_CAN_XILINXCAN=n \ CONFIG_NET_EMATCH_CANID=n \ CONFIG_CAN_DEBUG_DEVICES=n FILES:=$(LINUX_DIR)/drivers/net/can/can-dev.ko \ @@ -99,7 +98,7 @@ $(eval $(call KernelPackage,can-c-can-pci)) define KernelPackage/can-c-can-platform TITLE:=Platform Bus based BOSCH C_CAN/D_CAN driver KCONFIG:=CONFIG_CAN_C_CAN_PLATFORM - DEPENDS:=kmod-can-c-can +!LINUX_3_18:kmod-regmap + DEPENDS:=kmod-can-c-can +kmod-regmap-core FILES:=$(LINUX_DIR)/drivers/net/can/c_can/c_can_platform.ko AUTOLOAD:=$(call AutoProbe,c_can_platform) $(call AddDepends/can) @@ -231,7 +230,9 @@ $(eval $(call KernelPackage,can-usb-esd)) define KernelPackage/can-usb-kvaser TITLE:=Kvaser CAN/USB interface KCONFIG:=CONFIG_CAN_KVASER_USB - FILES:=$(LINUX_DIR)/drivers/net/can/usb/kvaser_usb.ko + FILES:= \ + $(LINUX_DIR)/drivers/net/can/usb/kvaser_usb.ko@lt4.19 \ + $(LINUX_DIR)/drivers/net/can/usb/kvaser_usb/kvaser_usb.ko@ge4.19 AUTOLOAD:=$(call AutoProbe,kvaser_usb) $(call AddDepends/can,+kmod-usb-core) endef @@ -275,4 +276,17 @@ endef $(eval $(call KernelPackage,can-vcan)) +define KernelPackage/can-xilinx-can + TITLE:=Xilinx CAN IP + KCONFIG:=CONFIG_CAN_XILINXCAN + FILES:=$(LINUX_DIR)/drivers/net/can/xilinx_can.ko + AUTOLOAD:=$(call AutoProbe,xilinx_can) + $(call AddDepends/can,@TARGET_zynq) +endef + +define KernelPackage/can-xilinx-can/description + Xilinx CAN driver. This driver supports both + soft AXI CAN IP and Zynq CANPS IP. +endef +$(eval $(call KernelPackage,can-xilinx-can)) diff --git a/package/kernel/linux/modules/crypto.mk b/package/kernel/linux/modules/crypto.mk index 2ea2d2c0e75166..dc7eb77986780a 100644 --- a/package/kernel/linux/modules/crypto.mk +++ b/package/kernel/linux/modules/crypto.mk @@ -40,15 +40,26 @@ define KernelPackage/crypto-aead CONFIG_CRYPTO_AEAD2 FILES:=$(LINUX_DIR)/crypto/aead.ko AUTOLOAD:=$(call AutoLoad,09,aead,1) - $(call AddDepends/crypto, +!LINUX_3_18:kmod-crypto-null) + $(call AddDepends/crypto, +kmod-crypto-null) endef $(eval $(call KernelPackage,crypto-aead)) +define KernelPackage/crypto-arc4 + TITLE:=ARC4 cipher CryptoAPI module + KCONFIG:=CONFIG_CRYPTO_ARC4 + FILES:=$(LINUX_DIR)/crypto/arc4.ko + AUTOLOAD:=$(call AutoLoad,09,arc4) + $(call AddDepends/crypto) +endef + +$(eval $(call KernelPackage,crypto-arc4)) + + define KernelPackage/crypto-authenc TITLE:=Combined mode wrapper for IPsec - DEPENDS:=+kmod-crypto-manager +!LINUX_3_18:kmod-crypto-null + DEPENDS:=+kmod-crypto-manager +kmod-crypto-null KCONFIG:=CONFIG_CRYPTO_AUTHENC FILES:=$(LINUX_DIR)/crypto/authenc.ko AUTOLOAD:=$(call AutoLoad,09,authenc) @@ -145,7 +156,7 @@ $(eval $(call KernelPackage,crypto-cts)) define KernelPackage/crypto-deflate TITLE:=Deflate compression CryptoAPI module - DEPENDS:=+kmod-lib-zlib-inflate +kmod-lib-zlib-deflate +LINUX_4_14:kmod-crypto-acompress + DEPENDS:=+kmod-lib-zlib-inflate +kmod-lib-zlib-deflate +!LINUX_4_9:kmod-crypto-acompress KCONFIG:=CONFIG_CRYPTO_DEFLATE FILES:=$(LINUX_DIR)/crypto/deflate.ko AUTOLOAD:=$(call AutoLoad,09,deflate) @@ -180,7 +191,7 @@ $(eval $(call KernelPackage,crypto-ecb)) define KernelPackage/crypto-ecdh TITLE:=ECDH algorithm - DEPENDS:=@!(LINUX_3_18||LINUX_4_4) +kmod-crypto-kpp + DEPENDS:=+kmod-crypto-kpp KCONFIG:= CONFIG_CRYPTO_ECDH FILES:= \ $(LINUX_DIR)/crypto/ecdh_generic.ko @@ -226,6 +237,18 @@ endef $(eval $(call KernelPackage,crypto-gcm)) +define KernelPackage/crypto-xcbc + TITLE:=XCBC CryptoAPI module + DEPENDS:=+kmod-crypto-hash +kmod-crypto-manager + KCONFIG:=CONFIG_CRYPTO_XCBC + FILES:=$(LINUX_DIR)/crypto/xcbc.ko + AUTOLOAD:=$(call AutoLoad,09,xcbc) + $(call AddDepends/crypto) +endef + +$(eval $(call KernelPackage,crypto-xcbc)) + + define KernelPackage/crypto-gf128 TITLE:=GF(2^128) multiplication functions CryptoAPI module KCONFIG:=CONFIG_CRYPTO_GF128MUL @@ -274,7 +297,7 @@ $(eval $(call KernelPackage,crypto-hmac)) define KernelPackage/crypto-hw-ccp TITLE:=AMD Cryptographic Coprocessor - DEPENDS:=+kmod-crypto-authenc +kmod-crypto-hash +kmod-crypto-manager +kmod-random-core +kmod-crypto-sha1 +kmod-crypto-sha256 +LINUX_4_14:kmod-crypto-rsa + DEPENDS:=+kmod-crypto-authenc +kmod-crypto-hash +kmod-crypto-manager +kmod-random-core +kmod-crypto-sha1 +kmod-crypto-sha256 +!LINUX_4_9:kmod-crypto-rsa KCONFIG:= \ CONFIG_CRYPTO_HW=y \ CONFIG_CRYPTO_DEV_CCP=y \ @@ -338,6 +361,31 @@ endef $(eval $(call KernelPackage,crypto-hw-padlock)) +define KernelPackage/crypto-hw-safexcel + TITLE:= MVEBU SafeXcel Crypto Engine module + DEPENDS:=@!LINUX_4_14 @(TARGET_mvebu_cortexa53||TARGET_mvebu_cortexa72) \ + +kmod-crypto-authenc +kmod-crypto-md5 +kmod-crypto-hmac +kmod-crypto-sha256 +kmod-crypto-sha512 + KCONFIG:= \ + CONFIG_CRYPTO_HW=y \ + CONFIG_CRYPTO_DEV_SAFEXCEL + FILES:=$(LINUX_DIR)/drivers/crypto/inside-secure/crypto_safexcel.ko + AUTOLOAD:=$(call AutoLoad,90,crypto_safexcel) + $(call AddDepends/crypto) +endef + +define KernelPackage/crypto-hw-safexcel/description +MVEBU's EIP97 and EIP197 Cryptographic Engine driver designed by +Inside Secure. This is found on Marvell Armada 37xx/7k/8k SoCs. + +Particular version of these IP (EIP197B and EIP197D) require firmware. +Unfortunately it's not freely available and needs signed Non-Disclosure +Agreement (NDA) with Marvell. For those who have signed NDA the firmware can be +obtained at https://extranet.marvell.com. +endef + +$(eval $(call KernelPackage,crypto-hw-safexcel)) + + define KernelPackage/crypto-hw-talitos TITLE:=Freescale integrated security engine (SEC) driver DEPENDS:=+kmod-crypto-manager +kmod-crypto-hash +kmod-random-core +kmod-crypto-authenc +kmod-crypto-des @@ -441,8 +489,21 @@ $(eval $(call KernelPackage,crypto-michael-mic)) define KernelPackage/crypto-misc TITLE:=Other CryptoAPI modules - DEPENDS:=+kmod-crypto-manager + DEPENDS:=+kmod-crypto-xts KCONFIG:= \ + CONFIG_CRYPTO_CAMELLIA_X86_64 \ + CONFIG_CRYPTO_BLOWFISH_X86_64 \ + CONFIG_CRYPTO_TWOFISH_X86_64 \ + CONFIG_CRYPTO_TWOFISH_X86_64_3WAY \ + CONFIG_CRYPTO_SERPENT_SSE2_X86_64 \ + CONFIG_CRYPTO_CAMELLIA_AESNI_AVX_X86_64 \ + CONFIG_CRYPTO_CAST5_AVX_X86_64 \ + CONFIG_CRYPTO_CAST6_AVX_X86_64 \ + CONFIG_CRYPTO_TWOFISH_AVX_X86_64 \ + CONFIG_CRYPTO_SERPENT_AVX_X86_64 \ + CONFIG_CRYPTO_CAMELLIA_AESNI_AVX2_X86_64 \ + CONFIG_CRYPTO_SERPENT_AVX2_X86_64 \ + CONFIG_CRYPTO_SERPENT_SSE2_586 \ CONFIG_CRYPTO_ANUBIS \ CONFIG_CRYPTO_BLOWFISH \ CONFIG_CRYPTO_CAMELLIA \ @@ -472,15 +533,51 @@ define KernelPackage/crypto-misc $(LINUX_DIR)/crypto/blowfish_common.ko \ $(LINUX_DIR)/crypto/blowfish_generic.ko \ $(LINUX_DIR)/crypto/serpent_generic.ko + AUTOLOAD:=$(call AutoLoad,10,anubis camellia_generic cast_common \ + cast5_generic cast6_generic khazad tea tgr192 twofish_common \ + wp512 blowfish_common serpent_generic) + ifndef CONFIG_TARGET_x86 + AUTOLOAD+= $(call AutoLoad,10,twofish_generic blowfish_generic) + endif $(call AddDepends/crypto) endef ifndef CONFIG_TARGET_x86_64 define KernelPackage/crypto-misc/x86 - FILES+=$(LINUX_DIR)/arch/x86/crypto/twofish-i586.ko + FILES+= \ + $(LINUX_DIR)/arch/x86/crypto/twofish-i586.ko \ + $(LINUX_DIR)/arch/x86/crypto/serpent-sse2-i586.ko \ + $(LINUX_DIR)/arch/x86/crypto/glue_helper.ko \ + $(LINUX_DIR)/crypto/ablk_helper.ko@lt4.17 \ + $(LINUX_DIR)/crypto/cryptd.ko \ + $(LINUX_DIR)/crypto/lrw.ko@lt4.17 \ + $(LINUX_DIR)/crypto/crypto_simd.ko@ge4.17 + AUTOLOAD+= $(call AutoLoad,10,cryptd glue_helper \ + serpent-sse2-i586 twofish-i586 blowfish_generic) endef endif +define KernelPackage/crypto-misc/x86/64 + FILES+= \ + $(LINUX_DIR)/arch/x86/crypto/camellia-x86_64.ko \ + $(LINUX_DIR)/arch/x86/crypto/blowfish-x86_64.ko \ + $(LINUX_DIR)/arch/x86/crypto/twofish-x86_64.ko \ + $(LINUX_DIR)/arch/x86/crypto/twofish-x86_64-3way.ko \ + $(LINUX_DIR)/arch/x86/crypto/serpent-sse2-x86_64.ko \ + $(LINUX_DIR)/arch/x86/crypto/camellia-aesni-avx-x86_64.ko \ + $(LINUX_DIR)/arch/x86/crypto/cast5-avx-x86_64.ko \ + $(LINUX_DIR)/arch/x86/crypto/cast6-avx-x86_64.ko \ + $(LINUX_DIR)/arch/x86/crypto/twofish-avx-x86_64.ko \ + $(LINUX_DIR)/arch/x86/crypto/serpent-avx-x86_64.ko \ + $(LINUX_DIR)/arch/x86/crypto/camellia-aesni-avx2.ko \ + $(LINUX_DIR)/arch/x86/crypto/serpent-avx2.ko \ + $(LINUX_DIR)/crypto/ablk_helper.ko@lt4.17 + AUTOLOAD+= $(call AutoLoad,10,camellia-x86_64 \ + camellia-aesni-avx-x86_64 camellia-aesni-avx2 cast5-avx-x86_64 \ + cast6-avx-x86_64 twofish-x86_64 twofish-x86_64-3way \ + twofish-avx-x86_64 blowfish-x86_64 serpent-avx-x86_64 serpent-avx2) +endef + $(eval $(call KernelPackage,crypto-misc)) @@ -522,11 +619,10 @@ $(eval $(call KernelPackage,crypto-pcompress)) define KernelPackage/crypto-rsa TITLE:=RSA algorithm - DEPENDS:=@!LINUX_3_18 +kmod-crypto-manager + DEPENDS:=+kmod-crypto-manager +kmod-asn1-decoder KCONFIG:= CONFIG_CRYPTO_RSA HIDDEN:=1 FILES:= \ - $(LINUX_DIR)/lib/asn1_decoder.ko \ $(LINUX_DIR)/lib/mpi/mpi.ko \ $(LINUX_DIR)/crypto/akcipher.ko \ $(LINUX_DIR)/crypto/rsa_generic.ko @@ -537,6 +633,18 @@ endef $(eval $(call KernelPackage,crypto-rsa)) +define KernelPackage/crypto-rmd160 + TITLE:=RIPEMD160 digest CryptoAPI module + DEPENDS:=+kmod-crypto-hash + KCONFIG:=CONFIG_CRYPTO_RMD160 + FILES:=$(LINUX_DIR)/crypto/rmd160.ko + AUTOLOAD:=$(call AutoLoad,09,rmd160) + $(call AddDepends/crypto) +endef + +$(eval $(call KernelPackage,crypto-rmd160)) + + define KernelPackage/crypto-rng TITLE:=CryptoAPI random number generation DEPENDS:=+kmod-crypto-hash +kmod-crypto-hmac +kmod-crypto-sha256 @@ -661,13 +769,17 @@ define KernelPackage/crypto-user DEPENDS:=+kmod-crypto-hash +kmod-crypto-manager KCONFIG:= \ CONFIG_CRYPTO_USER_API \ + CONFIG_CRYPTO_USER_API_AEAD \ CONFIG_CRYPTO_USER_API_HASH \ + CONFIG_CRYPTO_USER_API_RNG \ CONFIG_CRYPTO_USER_API_SKCIPHER FILES:= \ $(LINUX_DIR)/crypto/af_alg.ko \ + $(LINUX_DIR)/crypto/algif_aead.ko \ $(LINUX_DIR)/crypto/algif_hash.ko \ + $(LINUX_DIR)/crypto/algif_rng.ko \ $(LINUX_DIR)/crypto/algif_skcipher.ko - AUTOLOAD:=$(call AutoLoad,09,af_alg algif_hash algif_skcipher) + AUTOLOAD:=$(call AutoLoad,09,af_alg algif_aead algif_hash algif_rng algif_skcipher) $(call AddDepends/crypto) endef diff --git a/package/kernel/linux/modules/fs.mk b/package/kernel/linux/modules/fs.mk index 19524df73413e7..3ffe82cbe8e5fd 100644 --- a/package/kernel/linux/modules/fs.mk +++ b/package/kernel/linux/modules/fs.mk @@ -49,8 +49,12 @@ $(eval $(call KernelPackage,fs-afs)) define KernelPackage/fs-autofs4 SUBMENU:=$(FS_MENU) TITLE:=AUTOFS4 filesystem support - KCONFIG:=CONFIG_AUTOFS4_FS - FILES:=$(LINUX_DIR)/fs/autofs4/autofs4.ko + KCONFIG:= \ + CONFIG_AUTOFS4_FS \ + CONFIG_AUTOFS_FS + FILES:= \ + $(LINUX_DIR)/fs/autofs4/autofs4.ko@lt4.18 \ + $(LINUX_DIR)/fs/autofs/autofs4.ko@ge4.18 AUTOLOAD:=$(call AutoLoad,30,autofs4) endef @@ -64,7 +68,7 @@ $(eval $(call KernelPackage,fs-autofs4)) define KernelPackage/fs-btrfs SUBMENU:=$(FS_MENU) TITLE:=BTRFS filesystem support - DEPENDS:=+kmod-lib-crc32c +kmod-lib-lzo +kmod-lib-zlib-inflate +kmod-lib-zlib-deflate +kmod-lib-raid6 +kmod-lib-xor +LINUX_4_14:kmod-lib-zstd + DEPENDS:=+kmod-lib-crc32c +kmod-lib-lzo +kmod-lib-zlib-inflate +kmod-lib-zlib-deflate +kmod-lib-raid6 +kmod-lib-xor +!LINUX_4_9:kmod-lib-zstd KCONFIG:=\ CONFIG_BTRFS_FS \ CONFIG_BTRFS_FS_POSIX_ACL=n \ @@ -94,6 +98,7 @@ define KernelPackage/fs-cifs AUTOLOAD:=$(call AutoLoad,30,cifs) $(call AddDepends/nls) DEPENDS+= \ + +kmod-crypto-arc4 \ +kmod-crypto-hmac \ +kmod-crypto-md5 \ +kmod-crypto-md4 \ @@ -384,7 +389,8 @@ define KernelPackage/fs-nfs-common-rpcsec +kmod-crypto-md5 \ +kmod-crypto-sha1 \ +kmod-crypto-hmac \ - +kmod-crypto-ecb + +kmod-crypto-ecb \ + +kmod-crypto-arc4 KCONFIG:= \ CONFIG_SUNRPC_GSS \ CONFIG_RPCSEC_GSS_KRB5 @@ -439,9 +445,14 @@ $(eval $(call KernelPackage,fs-nfs-v4)) define KernelPackage/fs-nfsd SUBMENU:=$(FS_MENU) TITLE:=NFS kernel server support - DEPENDS:=+kmod-fs-nfs-common +kmod-fs-exportfs + DEPENDS:=+kmod-fs-nfs-common +kmod-fs-exportfs +kmod-fs-nfs-common-rpcsec KCONFIG:= \ CONFIG_NFSD \ + CONFIG_NFSD_V4=y \ + CONFIG_NFSD_V4_SECURITY_LABEL=n \ + CONFIG_NFSD_BLOCKLAYOUT=n \ + CONFIG_NFSD_SCSILAYOUT=n \ + CONFIG_NFSD_FLEXFILELAYOUT=n \ CONFIG_NFSD_FAULT_INJECTION=n FILES:=$(LINUX_DIR)/fs/nfsd/nfsd.ko AUTOLOAD:=$(call AutoLoad,40,nfsd) diff --git a/package/kernel/linux/modules/hwmon.mk b/package/kernel/linux/modules/hwmon.mk index e6dfa73decc502..c0a477856e9d74 100644 --- a/package/kernel/linux/modules/hwmon.mk +++ b/package/kernel/linux/modules/hwmon.mk @@ -29,6 +29,20 @@ define AddDepends/hwmon DEPENDS:=kmod-hwmon-core $(1) endef +define KernelPackage/hwmon-ads1015 + TITLE:=Texas Instruments ADS1015 + KCONFIG:= CONFIG_SENSORS_ADS1015 + FILES:= $(LINUX_DIR)/drivers/hwmon/ads1015.ko + AUTOLOAD:=$(call AutoLoad,60,ads1015) + $(call AddDepends/hwmon,+kmod-i2c-core) +endef + +define KernelPackage/hwmon-ads1015/description + Kernel module for Texas Instruments ADS1015 Analog-to-Digital converter +endef + +$(eval $(call KernelPackage,hwmon-ads1015)) + define KernelPackage/hwmon-adt7410 TITLE:=ADT7410 monitoring support KCONFIG:= \ @@ -98,7 +112,7 @@ define KernelPackage/hwmon-ina2xx KCONFIG:=CONFIG_SENSORS_INA2XX FILES:=$(LINUX_DIR)/drivers/hwmon/ina2xx.ko AUTOLOAD:=$(call AutoProbe,ina2xx) - $(call AddDepends/hwmon,+kmod-i2c-core +!LINUX_3_18:kmod-regmap) + $(call AddDepends/hwmon,+kmod-i2c-core +kmod-regmap-i2c) endef define KernelPackage/hwmon-ina2xx/description @@ -128,7 +142,7 @@ define KernelPackage/hwmon-lm63 KCONFIG:=CONFIG_SENSORS_LM63 FILES:=$(LINUX_DIR)/drivers/hwmon/lm63.ko AUTOLOAD:=$(call AutoProbe,lm63) - $(call AddDepends/hwmon,+kmod-i2c-core +kmod-regmap) + $(call AddDepends/hwmon,+kmod-i2c-core +kmod-regmap-i2c) endef define KernelPackage/hwmon-lm63/description @@ -143,7 +157,7 @@ define KernelPackage/hwmon-lm75 KCONFIG:=CONFIG_SENSORS_LM75 FILES:=$(LINUX_DIR)/drivers/hwmon/lm75.ko AUTOLOAD:=$(call AutoProbe,lm75) - $(call AddDepends/hwmon,+kmod-i2c-core +PACKAGE_kmod-thermal:kmod-thermal +kmod-regmap) + $(call AddDepends/hwmon,+kmod-i2c-core +PACKAGE_kmod-thermal:kmod-thermal +kmod-regmap-i2c) endef define KernelPackage/hwmon-lm75/description @@ -243,6 +257,21 @@ endef $(eval $(call KernelPackage,hwmon-ltc4151)) +define KernelPackage/hwmon-mcp3021 + TITLE:=MCP3021/3221 monitoring support + KCONFIG:=CONFIG_SENSORS_MCP3021 + FILES:=$(LINUX_DIR)/drivers/hwmon/mcp3021.ko + AUTOLOAD:=$(call AutoProbe,mcp3021) + $(call AddDepends/hwmon,+kmod-i2c-core) +endef + +define KernelPackage/hwmon-mcp3021/description + Kernel module for Linear Technology MCP3021/3221 current and voltage monitor chip +endef + +$(eval $(call KernelPackage,hwmon-mcp3021)) + + define KernelPackage/hwmon-nct6775 TITLE:=NCT6106D/6775F/6776F/6779D/6791D/6792D/6793D and compatibles monitoring support KCONFIG:=CONFIG_SENSORS_NCT6775 @@ -273,6 +302,36 @@ endef $(eval $(call KernelPackage,hwmon-pc87360)) +define KernelPackage/pmbus-core + TITLE:=PMBus support + KCONFIG:= CONFIG_PMBUS + FILES:=$(LINUX_DIR)/drivers/hwmon/pmbus/pmbus_core.ko + $(call AddDepends/hwmon,+kmod-i2c-core) +endef + +define KernelPackage/pmbus-core/description + Kernel modules for Power Management Bus +endef + +$(eval $(call KernelPackage,pmbus-core)) + + +define KernelPackage/pmbus-zl6100 + TITLE:=Intersil / Zilker Labs ZL6100 hardware monitoring + KCONFIG:=CONFIG_SENSORS_ZL6100 + FILES:=$(LINUX_DIR)/drivers/hwmon/pmbus/zl6100.ko + AUTOLOAD:=$(call AutoProbe,zl6100) + $(call AddDepends/hwmon, +kmod-pmbus-core) +endef + +define KernelPackage/pmbus-zl6100/description + Kernel module for Intersil / Zilker Labs ZL6100 and +compatible digital DC-DC controllers +endef + +$(eval $(call KernelPackage,pmbus-zl6100)) + + define KernelPackage/hwmon-pwmfan TITLE:=Generic PWM FAN support KCONFIG:=CONFIG_SENSORS_PWM_FAN @@ -325,7 +384,7 @@ define KernelPackage/hwmon-tmp102 KCONFIG:=CONFIG_SENSORS_TMP102 FILES:=$(LINUX_DIR)/drivers/hwmon/tmp102.ko AUTOLOAD:=$(call AutoProbe,tmp102) - $(call AddDepends/hwmon,+kmod-i2c-core +PACKAGE_kmod-thermal:kmod-thermal +kmod-regmap) + $(call AddDepends/hwmon,+kmod-i2c-core +PACKAGE_kmod-thermal:kmod-thermal +kmod-regmap-i2c) endef define KernelPackage/hwmon-tmp102/description @@ -340,7 +399,7 @@ define KernelPackage/hwmon-tmp103 KCONFIG:=CONFIG_SENSORS_TMP103 FILES:=$(LINUX_DIR)/drivers/hwmon/tmp103.ko AUTOLOAD:=$(call AutoProbe,tmp103) - $(call AddDepends/hwmon,+kmod-i2c-core +kmod-regmap) + $(call AddDepends/hwmon,+kmod-i2c-core +kmod-regmap-i2c) endef define KernelPackage/hwmon-tmp103/description @@ -427,3 +486,25 @@ endef $(eval $(call KernelPackage,hwmon-w83793)) +define KernelPackage/hwmon-adcxx + TITLE:=ADCxx monitoring support + KCONFIG:=CONFIG_SENSORS_ADCXX + FILES:=$(LINUX_DIR)/drivers/hwmon/adcxx.ko + AUTOLOAD:=$(call AutoLoad,60,adcxx) + $(call AddDepends/hwmon,) +endef + +define KernelPackage/hwmon-adcxx/description + Kernel module for the National Semiconductor + ADCS chip family, where + * bb is the resolution in number of bits (8, 10, 12) + * c is the number of channels (1, 2, 4, 8) + * sss is the maximum conversion speed (021 for 200 kSPS, 051 for 500 + kSPS and 101 for 1 MSPS) + + Examples : ADC081S101, ADC124S501, ... +endef + +$(eval $(call KernelPackage,hwmon-adcxx)) + + diff --git a/package/kernel/linux/modules/i2c.mk b/package/kernel/linux/modules/i2c.mk index 4cf37dae077b6a..0b23b2439cb60a 100644 --- a/package/kernel/linux/modules/i2c.mk +++ b/package/kernel/linux/modules/i2c.mk @@ -209,6 +209,23 @@ endef $(eval $(call KernelPackage,i2c-piix4)) +I2C_PXA_MODULES:= \ + CONFIG_I2C_PXA_SLAVE=y \ + CONFIG_I2C_PXA:drivers/i2c/busses/i2c-pxa + +define KernelPackage/i2c-pxa + $(call i2c_defaults,$(I2C_PXA_MODULES),50) + TITLE:=Intel PXA I2C bus driver + DEPENDS:=kmod-i2c-core +endef + +define KernelPackage/i2c-pxa/description + Kernel module for Intel PXA2XX I2C adapter +endef + +$(eval $(call KernelPackage,i2c-pxa)) + + I2C_SMBUS_MODULES:= \ CONFIG_I2C_SMBUS:drivers/i2c/i2c-smbus diff --git a/package/kernel/linux/modules/iio.mk b/package/kernel/linux/modules/iio.mk index c35ccca1bb722f..1ec3c968d3ddfd 100644 --- a/package/kernel/linux/modules/iio.mk +++ b/package/kernel/linux/modules/iio.mk @@ -52,6 +52,49 @@ endef $(eval $(call KernelPackage,iio-ad799x)) +define KernelPackage/iio-hmc5843 + SUBMENU:=$(IIO_MENU) + DEPENDS:=+kmod-i2c-core +kmod-iio-core +kmod-regmap-i2c + TITLE:=Honeywell HMC58x3 Magnetometer + KCONFIG:= CONFIG_SENSORS_HMC5843_I2C + FILES:= \ + $(LINUX_DIR)/drivers/iio/magnetometer/hmc5843_i2c.ko \ + $(LINUX_DIR)/drivers/iio/magnetometer/hmc5843_core.ko + AUTOLOAD:=$(call AutoLoad,56,hmc5843) +endef + +define KernelPackage/iio-hmc5843/description + Honeywell HMC5843/5883/5883L 3-Axis Magnetometer +endef + +$(eval $(call KernelPackage,iio-hmc5843)) + +define KernelPackage/iio-bh1750 + SUBMENU:=$(IIO_MENU) + DEPENDS:=+kmod-i2c-core +kmod-iio-core + TITLE:=ROHM BH1750 ambient light sensor + KCONFIG:= CONFIG_BH1750 + FILES:=$(LINUX_DIR)/drivers/iio/light/bh1750.ko + AUTOLOAD:=$(call AutoLoad,56,bh1750) +endef +define KernelPackage/iio-bh1750/description + ROHM BH1750 ambient light sensor (i2c bus) +endef +$(eval $(call KernelPackage,iio-bh1750)) + +define KernelPackage/iio-am2315 + SUBMENU:=$(IIO_MENU) + DEPENDS:=+kmod-i2c-core +kmod-iio-core + TITLE:=Asong AM2315 humidity/temperature sensor + KCONFIG:= CONFIG_AM2315 + FILES:=$(LINUX_DIR)/drivers/iio/humidity/am2315.ko + AUTOLOAD:=$(call AutoLoad,56,am2315) +endef +define KernelPackage/iio-am2315/description + Aosong AM2315 humidity/temperature sensor (I2C bus) +endef +$(eval $(call KernelPackage,iio-am2315)) + define KernelPackage/iio-mxs-lradc SUBMENU:=$(IIO_MENU) DEPENDS:=@TARGET_mxs +kmod-iio-core @@ -86,10 +129,55 @@ endef $(eval $(call KernelPackage,iio-dht11)) + +define KernelPackage/iio-bme680 + SUBMENU:=$(IIO_MENU) + TITLE:=BME680 gas/humidity/pressure/temperature sensor + DEPENDS:=@LINUX_4_19 +kmod-iio-core +kmod-regmap-core + KCONFIG:=CONFIG_BME680 + FILES:=$(LINUX_DIR)/drivers/iio/chemical/bme680_core.ko +endef + +define KernelPackage/iio-bme680/description + This driver adds support for Bosch Sensortec BME680 sensor with gas, + humidity, pressure and temperatue sensing capability. +endef + +$(eval $(call KernelPackage,iio-bme680)) + +define KernelPackage/iio-bme680-i2c + SUBMENU:=$(IIO_MENU) + TITLE:=BME680 gas/humidity/pressure/temperature sensor (I2C) + DEPENDS:=+kmod-iio-bme680 +kmod-regmap-i2c + KCONFIG:=CONFIG_BME680_I2C + FILES:=$(LINUX_DIR)/drivers/iio/chemical/bme680_i2c.ko + AUTOLOAD:=$(call AutoProbe,bme680-i2c) +endef +define KernelPackage/iio-bme680-i2c/description + This driver adds support for Bosch Sensortec's BME680 connected via I2C. +endef + +$(eval $(call KernelPackage,iio-bme680-i2c)) + +define KernelPackage/iio-bme680-spi + SUBMENU:=$(IIO_MENU) + TITLE:=BME680 gas/humidity/pressure/temperature sensor (SPI) + DEPENDS:=+kmod-iio-bme680 +kmod-regmap-spi + KCONFIG:=CONFIG_BME680_SPI + FILES:=$(LINUX_DIR)/drivers/iio/chemical/bme680_spi.ko + AUTOLOAD:=$(call AutoProbe,bme680-spi) +endef +define KernelPackage/iio-bme680-spi/description + This driver adds support for Bosch Sensortec's BME680 connected via SPI. +endef + +$(eval $(call KernelPackage,iio-bme680-spi)) + + define KernelPackage/iio-bmp280 SUBMENU:=$(IIO_MENU) TITLE:=BMP180/BMP280/BME280 pressure/temperatur sensor - DEPENDS:=@(LINUX_4_9||LINUX_4_14) +kmod-iio-core +kmod-regmap + DEPENDS:=+kmod-iio-core +kmod-regmap-core KCONFIG:=CONFIG_BMP280 FILES:=$(LINUX_DIR)/drivers/iio/pressure/bmp280.ko endef @@ -106,10 +194,10 @@ $(eval $(call KernelPackage,iio-bmp280)) define KernelPackage/iio-bmp280-i2c SUBMENU:=$(IIO_MENU) TITLE:=BMP180/BMP280/BME280 pressure/temperatur sensor (I2C) - DEPENDS:=+kmod-iio-bmp280 +kmod-i2c-core + DEPENDS:=+kmod-iio-bmp280 +kmod-i2c-core +kmod-regmap-i2c KCONFIG:=CONFIG_BMP280_I2C FILES:=$(LINUX_DIR)/drivers/iio/pressure/bmp280-i2c.ko - AUTOLOAD:=$(call AutoProbe,iio-bmp280-i2c) + AUTOLOAD:=$(call AutoProbe,bmp280-i2c) endef define KernelPackage/iio-bmp280-i2c/description This driver adds support for Bosch Sensortec's digital pressure and @@ -125,7 +213,7 @@ define KernelPackage/iio-bmp280-spi DEPENDS:=+kmod-iio-bmp280 +kmod-spi-bitbang KCONFIG:=CONFIG_BMP280_SPI FILES:=$(LINUX_DIR)/drivers/iio/pressure/bmp280-spi.ko - AUTOLOAD:=$(call AutoProbe,iio-bmp280-spi) + AUTOLOAD:=$(call AutoProbe,bmp280-spi) endef define KernelPackage/iio-bmp280-spi/description This driver adds support for Bosch Sensortec's digital pressure and @@ -133,3 +221,78 @@ define KernelPackage/iio-bmp280-spi/description endef $(eval $(call KernelPackage,iio-bmp280-spi)) + +define KernelPackage/iio-htu21 + SUBMENU:=$(IIO_MENU) + DEPENDS:=+kmod-i2c-core +kmod-iio-core + TITLE:=HTU21 humidity & temperature sensor + KCONFIG:= \ + CONFIG_HTU21 \ + CONFIG_IIO_MS_SENSORS_I2C + FILES:= \ + $(LINUX_DIR)/drivers/iio/humidity/htu21.ko \ + $(LINUX_DIR)/drivers/iio/common/ms_sensors/ms_sensors_i2c.ko + AUTOLOAD:=$(call AutoLoad,56,htu21) +endef + +define KernelPackage/iio-htu21/description + support for the Measurement Specialties HTU21 humidity and + temperature sensor. + This driver is also used for MS8607 temperature, pressure & humidity + sensor +endef + +$(eval $(call KernelPackage,iio-htu21)) + + +define KernelPackage/iio-ccs811 + SUBMENU:=$(IIO_MENU) + DEPENDS:=+kmod-i2c-core +kmod-iio-core + TITLE:=AMS CCS811 VOC sensor + KCONFIG:= \ + CONFIG_CCS811 + FILES:= $(LINUX_DIR)/drivers/iio/chemical/ccs811.ko + AUTOLOAD:=$(call AutoLoad,56,ccs811) +endef + +define KernelPackage/iio-ccs811/description + Support for the AMS CCS811 VOC (Volatile Organic Compounds) sensor +endef + +$(eval $(call KernelPackage,iio-ccs811)) + + +define KernelPackage/iio-si7020 + SUBMENU:=$(IIO_MENU) + DEPENDS:=+kmod-i2c-core +kmod-iio-core + TITLE:=Silicon Labs Si7020 sensor + KCONFIG:= CONFIG_SI7020 + FILES:=$(LINUX_DIR)/drivers/iio/humidity/si7020.ko + AUTOLOAD:=$(call AutoLoad,56,si7020) +endef + +define KernelPackage/iio-si7020/description + Support for Silicon Labs Si7020 family of relative humidity and + temperature sensors connected via I2C. Following models are usable: + Si7013, Si7020, Si7021, Hoperf TH06. +endef + +$(eval $(call KernelPackage,iio-si7020)) + + +define KernelPackage/iio-tsl4531 + SUBMENU:=$(IIO_MENU) + DEPENDS:=+kmod-i2c-core +kmod-iio-core + TITLE:=TAOS TSL4531 ambient light sensor + KCONFIG:= CONFIG_TSL4531 + FILES:=$(LINUX_DIR)/drivers/iio/light/tsl4531.ko + AUTOLOAD:=$(call AutoLoad,56,tsl4531) +endef + +define KernelPackage/iio-tsl4531/description + Support for TAOS TSL4531x family of ambient light sensors + connected via I2C. Following models are usable: + TSL45311, TSL45313, TSL45315, TSL45317. +endef + +$(eval $(call KernelPackage,iio-tsl4531)) diff --git a/package/kernel/linux/modules/input.mk b/package/kernel/linux/modules/input.mk index e410fe8d0c19e9..8c5eaf55497762 100644 --- a/package/kernel/linux/modules/input.mk +++ b/package/kernel/linux/modules/input.mk @@ -119,7 +119,7 @@ define KernelPackage/input-gpio-encoder AUTOLOAD:=$(call AutoProbe,rotary_encoder) endef -define KernelPackage/gpio-encoder/description +define KernelPackage/input-gpio-encoder/description Kernel module to use rotary encoders connected to GPIO pins endef @@ -166,13 +166,32 @@ define KernelPackage/input-matrixkmap AUTOLOAD:=$(call AutoProbe,matrix-keymap) endef -define KernelPackage/input-matrix/description +define KernelPackage/input-matrixkmap/description Kernel module support for input matrix devices endef $(eval $(call KernelPackage,input-matrixkmap)) +define KernelPackage/input-touchscreen-ads7846 + SUBMENU:=$(INPUT_MODULES_MENU) + TITLE:=ADS7846/TSC2046/AD7873 and AD(S)7843 based touchscreens + DEPENDS:=+kmod-hwmon-core +kmod-input-core +kmod-spi-bitbang + KCONFIG:= \ + CONFIG_INPUT_TOUCHSCREEN=y \ + CONFIG_TOUCHSCREEN_PROPERTIES=y \ + CONFIG_TOUCHSCREEN_ADS7846 + FILES:=$(LINUX_DIR)/drivers/input/touchscreen/ads7846.ko + AUTOLOAD:=$(call AutoProbe,ads7846) +endef + +define KernelPackage/input-touchscreen-ads7846/description + Kernel module for ADS7846/TSC2046/AD7873 and AD(S)7843 based touchscreens +endef + +$(eval $(call KernelPackage,input-touchscreen-ads7846)) + + define KernelPackage/keyboard-imx SUBMENU:=$(INPUT_MODULES_MENU) TITLE:=IMX keypad support diff --git a/package/kernel/linux/modules/leds.mk b/package/kernel/linux/modules/leds.mk index 7019f047798606..59ea6edbcdf083 100644 --- a/package/kernel/linux/modules/leds.mk +++ b/package/kernel/linux/modules/leds.mk @@ -58,7 +58,7 @@ define KernelPackage/ledtrig-netdev SUBMENU:=$(LEDS_MENU) TITLE:=LED NETDEV Trigger KCONFIG:=CONFIG_LEDS_TRIGGER_NETDEV - FILES:=$(LINUX_DIR)/drivers/leds/ledtrig-netdev.ko + FILES:=$(LINUX_DIR)/drivers/leds/trigger/ledtrig-netdev.ko AUTOLOAD:=$(call AutoLoad,50,ledtrig-netdev) endef diff --git a/package/kernel/linux/modules/lib.mk b/package/kernel/linux/modules/lib.mk index 6d7e0dc996e69f..3e5a12e9267274 100644 --- a/package/kernel/linux/modules/lib.mk +++ b/package/kernel/linux/modules/lib.mk @@ -101,7 +101,7 @@ $(eval $(call KernelPackage,lib-crc32c)) define KernelPackage/lib-lzo SUBMENU:=$(LIB_MENU) TITLE:=LZO support - DEPENDS:=+LINUX_4_14:kmod-crypto-acompress + DEPENDS:=+!LINUX_4_9:kmod-crypto-acompress KCONFIG:= \ CONFIG_CRYPTO_LZO@ge4.9 \ CONFIG_LZO_COMPRESS \ @@ -146,7 +146,7 @@ $(eval $(call KernelPackage,lib-zstd)) define KernelPackage/lib-lz4 SUBMENU:=$(LIB_MENU) TITLE:=LZ4 support - DEPENDS:=+LINUX_4_14:kmod-crypto-acompress + DEPENDS:=+!LINUX_4_9:kmod-crypto-acompress HIDDEN:=1 KCONFIG:= \ CONFIG_CRYPTO_LZ4@ge4.9 \ @@ -260,3 +260,14 @@ define KernelPackage/lib-cordic/description endef $(eval $(call KernelPackage,lib-cordic)) + + +define KernelPackage/asn1-decoder + SUBMENU:=$(LIB_MENU) + TITLE:=Simple ASN1 decoder + KCONFIG:= CONFIG_ASN1 + HIDDEN:=1 + FILES:=$(LINUX_DIR)/lib/asn1_decoder.ko +endef + +$(eval $(call KernelPackage,asn1-decoder)) diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index 0da8bcdf5679c1..c0ab09230bbc8e 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -33,6 +33,18 @@ endef $(eval $(call KernelPackage,skge)) +define KernelPackage/alx + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Qualcomm Atheros AR816x/AR817x PCI-E Ethernet Network Driver + DEPENDS:=@PCI_SUPPORT +kmod-mdio + KCONFIG:=CONFIG_ALX + FILES:=$(LINUX_DIR)/drivers/net/ethernet/atheros/alx/alx.ko + AUTOLOAD:=$(call AutoProbe,alx) +endef + +$(eval $(call KernelPackage,alx)) + + define KernelPackage/atl2 SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Atheros L2 Fast Ethernet support @@ -110,6 +122,26 @@ endef $(eval $(call KernelPackage,mii)) +define KernelPackage/mdio-gpio + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:= Supports GPIO lib-based MDIO busses + DEPENDS:=+kmod-libphy @GPIO_SUPPORT +(TARGET_armvirt||TARGET_bcm27xx_bcm2708||TARGET_samsung||TARGET_tegra):kmod-of-mdio + KCONFIG:= \ + CONFIG_MDIO_BITBANG \ + CONFIG_MDIO_GPIO + FILES:= \ + $(LINUX_DIR)/drivers/net/phy/mdio-gpio.ko \ + $(LINUX_DIR)/drivers/net/phy/mdio-bitbang.ko + AUTOLOAD:=$(call AutoProbe,mdio-gpio) +endef + +define KernelPackage/mdio-gpio/description + Supports GPIO lib-based MDIO busses +endef + +$(eval $(call KernelPackage,mdio-gpio)) + + define KernelPackage/et131x SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Agere ET131x Gigabit Ethernet driver @@ -149,7 +181,7 @@ define KernelPackage/phy-broadcom KCONFIG:=CONFIG_BROADCOM_PHY DEPENDS:=+kmod-libphy +kmod-phylib-broadcom FILES:=$(LINUX_DIR)/drivers/net/phy/broadcom.ko - AUTOLOAD:=$(call AutoLoad,18,broadcom) + AUTOLOAD:=$(call AutoLoad,18,broadcom,1) endef define KernelPackage/phy-broadcom/description @@ -160,6 +192,22 @@ endef $(eval $(call KernelPackage,phy-broadcom)) +define KernelPackage/phy-realtek + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Realtek Ethernet PHY driver + KCONFIG:=CONFIG_REALTEK_PHY + DEPENDS:=+kmod-libphy + FILES:=$(LINUX_DIR)/drivers/net/phy/realtek.ko + AUTOLOAD:=$(call AutoLoad,18,realtek,1) +endef + +define KernelPackage/phy-realtek/description + Supports the Realtek 821x PHY. +endef + +$(eval $(call KernelPackage,phy-realtek)) + + define KernelPackage/swconfig SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=switch configuration API @@ -206,16 +254,32 @@ endef $(eval $(call KernelPackage,switch-ip17xx)) +define KernelPackage/switch-rtl8306 + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Realtek RTL8306S switch support + DEPENDS:=+kmod-swconfig + KCONFIG:=CONFIG_RTL8306_PHY + FILES:=$(LINUX_DIR)/drivers/net/phy/rtl8306.ko + AUTOLOAD:=$(call AutoLoad,43,rtl8306) +endef + +define KernelPackage/switch-rtl8306/description + Realtek RTL8306S switch support +endef + +$(eval $(call KernelPackage,switch-rtl8306)) + + define KernelPackage/switch-rtl8366-smi SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Realtek RTL8366 SMI switch interface support - DEPENDS:=@GPIO_SUPPORT +kmod-swconfig +(TARGET_armvirt||TARGET_brcm2708_bcm2708):kmod-of-mdio + DEPENDS:=@GPIO_SUPPORT +kmod-swconfig +(TARGET_armvirt||TARGET_bcm27xx_bcm2708||TARGET_samsung||TARGET_tegra):kmod-of-mdio KCONFIG:=CONFIG_RTL8366_SMI FILES:=$(LINUX_DIR)/drivers/net/phy/rtl8366_smi.ko AUTOLOAD:=$(call AutoLoad,42,rtl8366_smi) endef -define KernelPackage/switch-rtl8366_smi/description +define KernelPackage/switch-rtl8366-smi/description Realtek RTL8366 series SMI switch interface support endef @@ -430,7 +494,7 @@ $(eval $(call KernelPackage,8139cp)) define KernelPackage/r8169 SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=RealTek RTL-8169 PCI Gigabit Ethernet Adapter kernel support - DEPENDS:=@PCI_SUPPORT +kmod-mii +r8169-firmware + DEPENDS:=@PCI_SUPPORT +kmod-mii +r8169-firmware +LINUX_4_19:kmod-phy-realtek KCONFIG:=CONFIG_R8169 \ CONFIG_R8169_NAPI=y \ CONFIG_R8169_VLAN=n @@ -589,6 +653,38 @@ endef $(eval $(call KernelPackage,ixgbevf)) +define KernelPackage/i40e + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Intel(R) Ethernet Controller XL710 Family support + DEPENDS:=@PCI_SUPPORT +kmod-mdio +kmod-ptp +kmod-hwmon-core + KCONFIG:=CONFIG_I40E \ + CONFIG_I40E_DCB=n + FILES:=$(LINUX_DIR)/drivers/net/ethernet/intel/i40e/i40e.ko + AUTOLOAD:=$(call AutoProbe,i40e) +endef + +define KernelPackage/i40e/description + Kernel modules for Intel(R) Ethernet Controller XL710 Family 40 Gigabit Ethernet adapters. +endef + +$(eval $(call KernelPackage,i40e)) + + +define KernelPackage/i40evf + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Intel(R) Ethernet Adaptive Virtual Function support + DEPENDS:=@PCI_SUPPORT +kmod-i40e + KCONFIG:=CONFIG_I40EVF + FILES:=$(LINUX_DIR)/drivers/net/ethernet/intel/i40evf/i40evf.ko + AUTOLOAD:=$(call AutoProbe,i40evf) +endef + +define KernelPackage/i40evf/description + Kernel modules for Intel(R) Ethernet Controller XL710 Family Virtual Function Ethernet adapters. +endef + +$(eval $(call KernelPackage,i40evf)) + define KernelPackage/b44 TITLE:=Broadcom 44xx driver @@ -648,7 +744,7 @@ define KernelPackage/tg3 TITLE:=Broadcom Tigon3 Gigabit Ethernet KCONFIG:=CONFIG_TIGON3 \ CONFIG_TIGON3_HWMON=n - DEPENDS:=+!TARGET_brcm47xx:kmod-libphy +!LINUX_4_14:kmod-hwmon-core +kmod-ptp + DEPENDS:=+!TARGET_brcm47xx:kmod-libphy +LINUX_4_9:kmod-hwmon-core +kmod-ptp SUBMENU:=$(NETWORK_DEVICES_MENU) FILES:=$(LINUX_DIR)/drivers/net/ethernet/broadcom/tg3.ko AUTOLOAD:=$(call AutoLoad,19,tg3,1) @@ -878,7 +974,7 @@ $(eval $(call KernelPackage,of-mdio)) define KernelPackage/vmxnet3 SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=VMware VMXNET3 ethernet driver + TITLE:=VMware VMXNET3 ethernet driver DEPENDS:=@PCI_SUPPORT KCONFIG:=CONFIG_VMXNET3 FILES:=$(LINUX_DIR)/drivers/net/vmxnet3/vmxnet3.ko @@ -939,3 +1035,42 @@ define KernelPackage/bnx2/description endef $(eval $(call KernelPackage,bnx2)) + + +define KernelPackage/bnx2x + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=QLogic 5771x/578xx 10/20-Gigabit ethernet adapter driver + DEPENDS:=@PCI_SUPPORT +bnx2x-firmware +kmod-lib-crc32c +kmod-mdio +kmod-ptp +kmod-lib-zlib-inflate + FILES:=$(LINUX_DIR)/drivers/net/ethernet/broadcom/bnx2x/bnx2x.ko + KCONFIG:= \ + CONFIG_BNX2X \ + CONFIG_BNX2X_SRIOV=y + AUTOLOAD:=$(call AutoProbe,bnx2x) +endef + +define KernelPackage/bnx2x/description + QLogic BCM57710/57711/57711E/57712/57712_MF/57800/57800_MF/57810/57810_MF/57840/57840_MF Driver +endef + +$(eval $(call KernelPackage,bnx2x)) + +define KernelPackage/be2net + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Broadcom Emulex OneConnect 10Gbps NIC + DEPENDS:=@PCI_SUPPORT +kmod-hwmon-core + FILES:=$(LINUX_DIR)/drivers/net/ethernet/emulex/benet/be2net.ko + KCONFIG:= \ + CONFIG_BE2NET \ + CONFIG_BE2NET_BE2=y \ + CONFIG_BE2NET_BE3=y \ + CONFIG_BE2NET_LANCER=y \ + CONFIG_BE2NET_SKYHAWK=y \ + CONFIG_BE2NET_HWMON=y + AUTOLOAD:=$(call AutoProbe,be2net) +endef + +define KernelPackage/be2net/description + Broadcom Emulex OneConnect 10Gbit SFP+ support, OneConnect OCe10xxx OCe11xxx OCe14xxx, LightPulse LPe12xxx +endef + +$(eval $(call KernelPackage,be2net)) diff --git a/package/kernel/linux/modules/netfilter.mk b/package/kernel/linux/modules/netfilter.mk index 51f3544ed6d040..cc4c5ecb2a3880 100644 --- a/package/kernel/linux/modules/netfilter.mk +++ b/package/kernel/linux/modules/netfilter.mk @@ -152,7 +152,7 @@ define KernelPackage/nf-flow CONFIG_NETFILTER_INGRESS=y \ CONFIG_NF_FLOW_TABLE \ CONFIG_NF_FLOW_TABLE_HW - DEPENDS:=+kmod-nf-conntrack @!LINUX_3_18 @!LINUX_4_4 @!LINUX_4_9 + DEPENDS:=+kmod-nf-conntrack @!LINUX_4_9 FILES:= \ $(LINUX_DIR)/net/netfilter/nf_flow_table.ko \ $(LINUX_DIR)/net/netfilter/nf_flow_table_hw.ko @@ -237,6 +237,7 @@ define KernelPackage/ipt-filter/description Netfilter (IPv4) kernel modules for packet content inspection Includes: - string + - bpf endef $(eval $(call KernelPackage,ipt-filter)) @@ -244,7 +245,7 @@ $(eval $(call KernelPackage,ipt-filter)) define KernelPackage/ipt-offload TITLE:=Netfilter routing/NAT offload support - KCONFIG:=CONFIG_NETFILTER_XT_TARGET_FLOWOFFLOAD + KCONFIG:=$(KCONFIG_IPT_FLOW) FILES:=$(foreach mod,$(IPT_FLOW-m),$(LINUX_DIR)/net/$(mod).ko) AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_FLOW-m))) $(call AddDepends/ipt,+kmod-nf-flow) @@ -329,6 +330,7 @@ define KernelPackage/ipt-ipset CONFIG_IP_SET_BITMAP_IPMAC \ CONFIG_IP_SET_BITMAP_PORT \ CONFIG_IP_SET_HASH_IP \ + CONFIG_IP_SET_HASH_IPMAC \ CONFIG_IP_SET_HASH_IPMARK \ CONFIG_IP_SET_HASH_IPPORT \ CONFIG_IP_SET_HASH_IPPORTIP \ @@ -347,6 +349,98 @@ endef $(eval $(call KernelPackage,ipt-ipset)) +IPVS_MODULES:= \ + ipvs/ip_vs \ + ipvs/ip_vs_lc \ + ipvs/ip_vs_wlc \ + ipvs/ip_vs_rr \ + ipvs/ip_vs_wrr \ + ipvs/ip_vs_lblc \ + ipvs/ip_vs_lblcr \ + ipvs/ip_vs_dh \ + ipvs/ip_vs_sh \ + ipvs/ip_vs_fo \ + ipvs/ip_vs_ovf \ + ipvs/ip_vs_nq \ + ipvs/ip_vs_sed \ + xt_ipvs + +define KernelPackage/nf-ipvs + SUBMENU:=Netfilter Extensions + TITLE:=IP Virtual Server modules + DEPENDS:=@IPV6 +kmod-lib-crc32c +kmod-ipt-conntrack +kmod-nf-conntrack +LINUX_4_14:kmod-nf-conntrack6 + KCONFIG:= \ + CONFIG_IP_VS \ + CONFIG_IP_VS_IPV6=y \ + CONFIG_IP_VS_DEBUG=n \ + CONFIG_IP_VS_PROTO_TCP=y \ + CONFIG_IP_VS_PROTO_UDP=y \ + CONFIG_IP_VS_PROTO_AH_ESP=y \ + CONFIG_IP_VS_PROTO_ESP=y \ + CONFIG_IP_VS_PROTO_AH=y \ + CONFIG_IP_VS_PROTO_SCTP=y \ + CONFIG_IP_VS_TAB_BITS=12 \ + CONFIG_IP_VS_RR \ + CONFIG_IP_VS_WRR \ + CONFIG_IP_VS_LC \ + CONFIG_IP_VS_WLC \ + CONFIG_IP_VS_FO \ + CONFIG_IP_VS_OVF \ + CONFIG_IP_VS_LBLC \ + CONFIG_IP_VS_LBLCR \ + CONFIG_IP_VS_DH \ + CONFIG_IP_VS_SH \ + CONFIG_IP_VS_SED \ + CONFIG_IP_VS_NQ \ + CONFIG_IP_VS_SH_TAB_BITS=8 \ + CONFIG_IP_VS_NFCT=y \ + CONFIG_NETFILTER_XT_MATCH_IPVS + FILES:=$(foreach mod,$(IPVS_MODULES),$(LINUX_DIR)/net/netfilter/$(mod).ko) + $(call AddDepends/ipt,+kmod-ipt-conntrack,+kmod-nf-conntrack) +endef + +define KernelPackage/nf-ipvs/description + IPVS (IP Virtual Server) implements transport-layer load balancing inside + the Linux kernel so called Layer-4 switching. +endef + +$(eval $(call KernelPackage,nf-ipvs)) + + +define KernelPackage/nf-ipvs-ftp + SUBMENU:=$(NF_MENU) + TITLE:=Virtual Server FTP protocol support + KCONFIG:=CONFIG_IP_VS_FTP + DEPENDS:=kmod-nf-ipvs +kmod-nf-nat +kmod-nf-nathelper + FILES:=$(LINUX_DIR)/net/netfilter/ipvs/ip_vs_ftp.ko +endef + +define KernelPackage/nf-ipvs-ftp/description + In the virtual server via Network Address Translation, + the IP address and port number of real servers cannot be sent to + clients in ftp connections directly, so FTP protocol helper is + required for tracking the connection and mangling it back to that of + virtual service. +endef + +$(eval $(call KernelPackage,nf-ipvs-ftp)) + + +define KernelPackage/nf-ipvs-sip + SUBMENU:=$(NF_MENU) + TITLE:=Virtual Server SIP protocol support + KCONFIG:=CONFIG_IP_VS_PE_SIP + DEPENDS:=kmod-nf-ipvs +kmod-nf-nathelper-extra + FILES:=$(LINUX_DIR)/net/netfilter/ipvs/ip_vs_pe_sip.ko +endef + +define KernelPackage/nf-ipvs-sip/description + Allow persistence based on the SIP Call-ID +endef + +$(eval $(call KernelPackage,nf-ipvs-sip)) + + define KernelPackage/ipt-nat TITLE:=Basic NAT targets KCONFIG:=$(KCONFIG_IPT_NAT) @@ -446,7 +540,7 @@ define KernelPackage/nf-nathelper-extra KCONFIG:=$(KCONFIG_NF_NATHELPER_EXTRA) FILES:=$(foreach mod,$(NF_NATHELPER_EXTRA-m),$(LINUX_DIR)/net/$(mod).ko) AUTOLOAD:=$(call AutoProbe,$(notdir $(NF_NATHELPER_EXTRA-m))) - DEPENDS:=+kmod-nf-nat +kmod-lib-textsearch + DEPENDS:=+kmod-nf-nat +kmod-lib-textsearch +kmod-ipt-raw +LINUX_4_19:kmod-asn1-decoder endef define KernelPackage/nf-nathelper-extra/description @@ -552,11 +646,8 @@ $(eval $(call KernelPackage,ipt-led)) define KernelPackage/ipt-tproxy TITLE:=Transparent proxying support DEPENDS+=+kmod-ipt-conntrack +IPV6:kmod-nf-conntrack6 +IPV6:kmod-ip6tables - KCONFIG:= \ - CONFIG_NETFILTER_XT_MATCH_SOCKET \ - CONFIG_NETFILTER_XT_TARGET_TPROXY - FILES:= \ - $(foreach mod,$(IPT_TPROXY-m),$(LINUX_DIR)/net/$(mod).ko) + KCONFIG:=$(KCONFIG_IPT_TPROXY) + FILES:=$(foreach mod,$(IPT_TPROXY-m),$(LINUX_DIR)/net/$(mod).ko) AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_TPROXY-m))) $(call AddDepends/ipt) endef @@ -570,11 +661,8 @@ $(eval $(call KernelPackage,ipt-tproxy)) define KernelPackage/ipt-tee TITLE:=TEE support DEPENDS:=+kmod-ipt-conntrack - KCONFIG:= \ - CONFIG_NETFILTER_XT_TARGET_TEE - FILES:= \ - $(LINUX_DIR)/net/netfilter/xt_TEE.ko \ - $(foreach mod,$(IPT_TEE-m),$(LINUX_DIR)/net/$(mod).ko) + KCONFIG:=$(KCONFIG_IPT_TEE) + FILES:=$(foreach mod,$(IPT_TEE-m),$(LINUX_DIR)/net/$(mod).ko) AUTOLOAD:=$(call AutoProbe,$(notdir nf_tee $(IPT_TEE-m))) $(call AddDepends/ipt) endef @@ -588,11 +676,8 @@ $(eval $(call KernelPackage,ipt-tee)) define KernelPackage/ipt-u32 TITLE:=U32 support - KCONFIG:= \ - CONFIG_NETFILTER_XT_MATCH_U32 - FILES:= \ - $(LINUX_DIR)/net/netfilter/xt_u32.ko \ - $(foreach mod,$(IPT_U32-m),$(LINUX_DIR)/net/$(mod).ko) + KCONFIG:=$(KCONFIG_IPT_U32) + FILES:=$(foreach mod,$(IPT_U32-m),$(LINUX_DIR)/net/$(mod).ko) AUTOLOAD:=$(call AutoProbe,$(notdir nf_tee $(IPT_U32-m))) $(call AddDepends/ipt) endef @@ -605,11 +690,8 @@ $(eval $(call KernelPackage,ipt-u32)) define KernelPackage/ipt-checksum TITLE:=CHECKSUM support - KCONFIG:= \ - CONFIG_NETFILTER_XT_TARGET_CHECKSUM - FILES:= \ - $(LINUX_DIR)/net/netfilter/xt_CHECKSUM.ko \ - $(foreach mod,$(IPT_CHECKSUM-m),$(LINUX_DIR)/net/$(mod).ko) + KCONFIG:=$(KCONFIG_IPT_CHECKSUM) + FILES:=$(foreach mod,$(IPT_CHECKSUM-m),$(LINUX_DIR)/net/$(mod).ko) AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_CHECKSUM-m))) $(call AddDepends/ipt) endef @@ -642,7 +724,7 @@ define KernelPackage/ipt-cluster KCONFIG:=$(KCONFIG_IPT_CLUSTER) FILES:=$(foreach mod,$(IPT_CLUSTER-m),$(LINUX_DIR)/net/$(mod).ko) AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_CLUSTER-m))) - $(call AddDepends/ipt) + $(call AddDepends/ipt,+kmod-nf-conntrack) endef define KernelPackage/ipt-cluster/description @@ -1051,3 +1133,35 @@ define KernelPackage/nft-nat6 endef $(eval $(call KernelPackage,nft-nat6)) + +define KernelPackage/nft-netdev + SUBMENU:=$(NF_MENU) + TITLE:=Netfilter nf_tables netdev support + DEPENDS:=+kmod-nft-core + KCONFIG:= \ + CONFIG_NETFILTER_INGRESS=y \ + CONFIG_NF_TABLES_NETDEV \ + CONFIG_NF_DUP_NETDEV \ + CONFIG_NFT_DUP_NETDEV \ + CONFIG_NFT_FWD_NETDEV + FILES:= \ + $(LINUX_DIR)/net/netfilter/nf_tables_netdev.ko@lt4.17 \ + $(LINUX_DIR)/net/netfilter/nf_dup_netdev.ko \ + $(LINUX_DIR)/net/netfilter/nft_dup_netdev.ko \ + $(LINUX_DIR)/net/netfilter/nft_fwd_netdev.ko + AUTOLOAD:=$(call AutoProbe,nf_tables_netdev nf_dup_netdev nft_dup_netdev nft_fwd_netdev) +endef + +$(eval $(call KernelPackage,nft-netdev)) + + +define KernelPackage/nft-fib + SUBMENU:=$(NF_MENU) + TITLE:=Netfilter nf_tables fib support + DEPENDS:=+kmod-nft-core + FILES:=$(foreach mod,$(NFT_FIB-m),$(LINUX_DIR)/net/$(mod).ko) + AUTOLOAD:=$(call AutoProbe,$(notdir $(NFT_FIB-m))) + KCONFIG:=$(KCONFIG_NFT_FIB) +endef + +$(eval $(call KernelPackage,nft-fib)) diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk index ff7672063688c7..44408a720b54c5 100644 --- a/package/kernel/linux/modules/netsupport.mk +++ b/package/kernel/linux/modules/netsupport.mk @@ -128,6 +128,23 @@ endef $(eval $(call KernelPackage,geneve)) +define KernelPackage/nsh + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=Network Service Header (NSH) protocol + DEPENDS:= + KCONFIG:=CONFIG_NET_NSH + FILES:=$(LINUX_DIR)/net/nsh/nsh.ko@ge4.14 + AUTOLOAD:=$(call AutoLoad,13,nsh) +endef + +define KernelPackage/nsh/description + Network Service Header is an implementation of Service Function + Chaining (RFC 7665). Requires kernel 4.14 or newer +endef + +$(eval $(call KernelPackage,nsh)) + + define KernelPackage/capi SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=CAPI (ISDN) Support @@ -383,6 +400,22 @@ endef $(eval $(call KernelPackage,ip6-vti)) +define KernelPackage/xfrm-interface + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=IPsec XFRM Interface + DEPENDS:=+kmod-ipsec4 +kmod-ipsec6 @!LINUX_4_14 @!LINUX_4_9 + KCONFIG:=CONFIG_XFRM_INTERFACE + FILES:=$(LINUX_DIR)/net/xfrm/xfrm_interface.ko + AUTOLOAD:=$(call AutoProbe,xfrm_interface) +endef + +define KernelPackage/xfrm-interface/description + Kernel module for XFRM interface support +endef + +$(eval $(call KernelPackage,xfrm-interface)) + + define KernelPackage/iptunnel4 SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=IPv4 tunneling @@ -457,6 +490,27 @@ endef $(eval $(call KernelPackage,fou)) +define KernelPackage/fou6 + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=FOU and GUE decapsulation over IPv6 + DEPENDS:= @IPV6 \ + +kmod-fou \ + +kmod-ip6-tunnel + KCONFIG:= \ + CONFIG_IPV6_FOU \ + CONFIG_IPV6_FOU_TUNNEL + FILES:=$(LINUX_DIR)/net/ipv6/fou6.ko + AUTOLOAD:=$(call AutoProbe,fou6) +endef + +define KernelPackage/fou6/description + Kernel module for FOU (Foo over UDP) and GUE (Generic UDP Encapsulation) tunnelling over IPv6. + Requires Kernel 3.18 or newer. +endef + +$(eval $(call KernelPackage,fou6)) + + define KernelPackage/ip6-tunnel SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=IP-in-IPv6 tunnelling @@ -679,7 +733,7 @@ $(eval $(call KernelPackage,ipoa)) define KernelPackage/mppe SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=Microsoft PPP compression/encryption - DEPENDS:=kmod-ppp +kmod-crypto-sha1 +kmod-crypto-ecb + DEPENDS:=kmod-ppp +kmod-crypto-arc4 +kmod-crypto-sha1 +kmod-crypto-ecb KCONFIG:= \ CONFIG_PPP_MPPE_MPPC \ CONFIG_PPP_MPPE @@ -695,8 +749,8 @@ $(eval $(call KernelPackage,mppe)) SCHED_MODULES = $(patsubst $(LINUX_DIR)/net/sched/%.ko,%,$(wildcard $(LINUX_DIR)/net/sched/*.ko)) -SCHED_MODULES_CORE = sch_ingress sch_fq_codel sch_hfsc sch_htb sch_tbf cls_fw cls_route cls_flow cls_tcindex cls_u32 em_u32 act_mirred act_skbedit -SCHED_MODULES_FILTER = $(SCHED_MODULES_CORE) act_connmark sch_netem +SCHED_MODULES_CORE = sch_ingress sch_fq_codel sch_hfsc sch_htb sch_tbf cls_basic cls_fw cls_route cls_flow cls_tcindex cls_u32 em_u32 act_mirred act_skbedit cls_matchall +SCHED_MODULES_FILTER = $(SCHED_MODULES_CORE) act_connmark act_ctinfo sch_netem sch_mqprio em_ipset cls_bpf cls_flower act_bpf act_vlan SCHED_MODULES_EXTRA = $(filter-out $(SCHED_MODULES_FILTER),$(SCHED_MODULES)) SCHED_FILES = $(patsubst %,$(LINUX_DIR)/net/sched/%.ko,$(filter $(SCHED_MODULES_CORE),$(SCHED_MODULES))) SCHED_FILES_EXTRA = $(patsubst %,$(LINUX_DIR)/net/sched/%.ko,$(SCHED_MODULES_EXTRA)) @@ -713,6 +767,7 @@ define KernelPackage/sched-core CONFIG_NET_SCH_FQ_CODEL \ CONFIG_NET_CLS=y \ CONFIG_NET_CLS_ACT=y \ + CONFIG_NET_CLS_BASIC \ CONFIG_NET_CLS_FLOW \ CONFIG_NET_CLS_FW \ CONFIG_NET_CLS_ROUTE4 \ @@ -720,6 +775,7 @@ define KernelPackage/sched-core CONFIG_NET_CLS_U32 \ CONFIG_NET_ACT_MIRRED \ CONFIG_NET_ACT_SKBEDIT \ + CONFIG_NET_CLS_MATCHALL \ CONFIG_NET_EMATCH=y \ CONFIG_NET_EMATCH_U32 FILES:=$(SCHED_FILES) @@ -733,6 +789,53 @@ endef $(eval $(call KernelPackage,sched-core)) +define KernelPackage/sched-flower + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=Flower traffic classifier + DEPENDS:=+kmod-sched-core + KCONFIG:=CONFIG_NET_CLS_FLOWER + FILES:=$(LINUX_DIR)/net/sched/cls_flower.ko + AUTOLOAD:=$(call AutoProbe, cls_flower) +endef + +define KernelPackage/sched-flower/description + Allows to classify packets based on a configurable combination of packet keys and masks. +endef + +$(eval $(call KernelPackage,sched-flower)) + + +define KernelPackage/sched-act-vlan + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=Traffic VLAN manipulation + DEPENDS:=+kmod-sched-core + KCONFIG:=CONFIG_NET_ACT_VLAN + FILES:=$(LINUX_DIR)/net/sched/act_vlan.ko + AUTOLOAD:=$(call AutoProbe, act_vlan) +endef + +define KernelPackage/sched-act-vlan/description + Allows to configure rules to push or pop vlan headers. +endef + +$(eval $(call KernelPackage,sched-act-vlan)) + + +define KernelPackage/sched-mqprio + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=Multi-queue priority scheduler (MQPRIO) + DEPENDS:=+kmod-sched-core + KCONFIG:=CONFIG_NET_SCH_MQPRIO + FILES:=$(LINUX_DIR)/net/sched/sch_mqprio.ko + AUTOLOAD:=$(call AutoProbe, sch_mqprio) +endef + +define KernelPackage/sched-mqprio/description + This scheduler allows QOS to be offloaded on NICs that have support for offloading QOS schedulers. +endef + +$(eval $(call KernelPackage,sched-mqprio)) + define KernelPackage/sched-connmark SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=Traffic shaper conntrack mark support @@ -743,10 +846,59 @@ define KernelPackage/sched-connmark endef $(eval $(call KernelPackage,sched-connmark)) +define KernelPackage/sched-ctinfo + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=Traffic shaper ctinfo support + DEPENDS:=+kmod-sched-core +kmod-ipt-core +kmod-ipt-conntrack-extra + KCONFIG:=CONFIG_NET_ACT_CTINFO + FILES:=$(LINUX_DIR)/net/sched/act_ctinfo.ko + AUTOLOAD:=$(call AutoLoad,71, act_ctinfo) +endef +$(eval $(call KernelPackage,sched-ctinfo)) + +define KernelPackage/sched-ipset + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=Traffic shaper ipset support + DEPENDS:=+kmod-sched-core +kmod-ipt-ipset + KCONFIG:= \ + CONFIG_NET_EMATCH_IPSET + FILES:= \ + $(LINUX_DIR)/net/sched/em_ipset.ko + AUTOLOAD:=$(call AutoLoad,72,em_ipset) +endef + +$(eval $(call KernelPackage,sched-ipset)) + + +define KernelPackage/sched-bpf + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=Traffic shaper support for Berkeley Packet Filter + KCONFIG:= \ + CONFIG_NET_CLS_BPF \ + CONFIG_NET_ACT_BPF + FILES:= \ + $(LINUX_DIR)/net/sched/cls_bpf.ko \ + $(LINUX_DIR)/net/sched/act_bpf.ko + AUTOLOAD:=$(call AutoLoad,72,cls_bpf act_bpf) +endef + +$(eval $(call KernelPackage,sched-bpf)) + + +define KernelPackage/bpf-test + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=Test Berkeley Packet Filter functionality + KCONFIG:=CONFIG_TEST_BPF + FILES:=$(LINUX_DIR)/lib/test_bpf.ko +endef + +$(eval $(call KernelPackage,bpf-test)) + + define KernelPackage/sched SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=Extra traffic schedulers - DEPENDS:=+kmod-sched-core +kmod-ipt-core + DEPENDS:=+kmod-sched-core +kmod-ipt-core +kmod-lib-crc32c KCONFIG:= \ CONFIG_NET_SCH_CODEL \ CONFIG_NET_SCH_DSMARK \ @@ -759,9 +911,12 @@ define KernelPackage/sched CONFIG_NET_SCH_TEQL \ CONFIG_NET_SCH_FQ \ CONFIG_NET_SCH_PIE \ - CONFIG_NET_CLS_BASIC \ CONFIG_NET_ACT_POLICE \ + CONFIG_NET_ACT_GACT \ CONFIG_NET_ACT_IPT \ + CONFIG_NET_ACT_PEDIT \ + CONFIG_NET_ACT_SIMP \ + CONFIG_NET_ACT_CSUM \ CONFIG_NET_EMATCH_CMP \ CONFIG_NET_EMATCH_NBYTE \ CONFIG_NET_EMATCH_META \ @@ -777,6 +932,37 @@ endef $(eval $(call KernelPackage,sched)) +define KernelPackage/tcp-bbr + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=BBR TCP congestion control + DEPENDS:=+LINUX_4_9:kmod-sched + KCONFIG:= \ + CONFIG_TCP_CONG_ADVANCED=y \ + CONFIG_TCP_CONG_BBR=m + FILES:=$(LINUX_DIR)/net/ipv4/tcp_bbr.ko + AUTOLOAD:=$(call AutoLoad,74,tcp_bbr) +endef + +define KernelPackage/tcp-bbr/description + Kernel module for BBR (Bottleneck Bandwidth and RTT) TCP congestion + control. It requires the fq ("Fair Queue") pacing packet scheduler. + For kernel 4.13+, TCP internal pacing is implemented as fallback. +endef + +ifdef CONFIG_LINUX_4_9 + TCP_BBR_SYSCTL_CONF:=sysctl-tcp-bbr-k4_9.conf +else + TCP_BBR_SYSCTL_CONF:=sysctl-tcp-bbr.conf +endif + +define KernelPackage/tcp-bbr/install + $(INSTALL_DIR) $(1)/etc/sysctl.d + $(INSTALL_DATA) ./files/$(TCP_BBR_SYSCTL_CONF) $(1)/etc/sysctl.d/12-tcp-bbr.conf +endef + +$(eval $(call KernelPackage,tcp-bbr)) + + define KernelPackage/ax25 SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=AX25 support @@ -965,7 +1151,7 @@ $(eval $(call KernelPackage,rxrpc)) define KernelPackage/mpls SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=MPLS support - DEPENDS:=@!(LINUX_3_18||LINUX_4_1) + DEPENDS:=+LINUX_4_19:kmod-iptunnel KCONFIG:= \ CONFIG_MPLS=y \ CONFIG_LWTUNNEL=y \ @@ -1042,7 +1228,7 @@ $(eval $(call KernelPackage,mdio)) define KernelPackage/macsec SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=IEEE 802.1AE MAC-level encryption (MAC) - DEPENDS:=+kmod-crypto-gcm @!LINUX_3_18 @!LINUX_4_1 @!LINUX_4_4 + DEPENDS:=+kmod-crypto-gcm KCONFIG:=CONFIG_MACSEC FILES:=$(LINUX_DIR)/drivers/net/macsec.ko AUTOLOAD:=$(call AutoLoad,13,macsec) diff --git a/package/kernel/linux/modules/other.mk b/package/kernel/linux/modules/other.mk index eb26a8ba081e25..deff3a6f66e9f0 100644 --- a/package/kernel/linux/modules/other.mk +++ b/package/kernel/linux/modules/other.mk @@ -30,34 +30,22 @@ $(eval $(call KernelPackage,6lowpan)) define KernelPackage/bluetooth SUBMENU:=$(OTHER_MENU) TITLE:=Bluetooth support - DEPENDS:=@USB_SUPPORT +kmod-usb-core +kmod-crypto-hash +kmod-crypto-ecb +kmod-lib-crc16 +kmod-hid +!LINUX_3_18:kmod-crypto-cmac +!LINUX_3_18:kmod-regmap +LINUX_4_14:kmod-crypto-ecdh + DEPENDS:=@USB_SUPPORT +kmod-usb-core +kmod-crypto-hash +kmod-crypto-ecb +kmod-lib-crc16 +kmod-hid +kmod-crypto-cmac +kmod-regmap-core +!LINUX_4_9:kmod-crypto-ecdh KCONFIG:= \ - CONFIG_BLUEZ \ - CONFIG_BLUEZ_L2CAP \ - CONFIG_BLUEZ_SCO \ - CONFIG_BLUEZ_RFCOMM \ - CONFIG_BLUEZ_BNEP \ - CONFIG_BLUEZ_HCIUART \ - CONFIG_BLUEZ_HCIUSB \ - CONFIG_BLUEZ_HIDP \ CONFIG_BT \ CONFIG_BT_BREDR=y \ CONFIG_BT_DEBUGFS=n \ - CONFIG_BT_L2CAP=y \ CONFIG_BT_LE=y \ - CONFIG_BT_SCO=y \ CONFIG_BT_RFCOMM \ CONFIG_BT_BNEP \ CONFIG_BT_HCIBTUSB \ CONFIG_BT_HCIBTUSB_BCM=n \ - CONFIG_BT_HCIUSB \ CONFIG_BT_HCIUART \ CONFIG_BT_HCIUART_BCM=n \ CONFIG_BT_HCIUART_INTEL=n \ CONFIG_BT_HCIUART_H4 \ CONFIG_BT_HCIUART_NOKIA=n \ - CONFIG_BT_HIDP \ - CONFIG_HID_SUPPORT=y + CONFIG_BT_HIDP $(call AddDepends/rfkill) FILES:= \ $(LINUX_DIR)/net/bluetooth/bluetooth.ko \ @@ -141,7 +129,11 @@ define KernelPackage/dma-buf TITLE:=DMA shared buffer support HIDDEN:=1 KCONFIG:=CONFIG_DMA_SHARED_BUFFER - FILES:=$(LINUX_DIR)/drivers/dma-buf/dma-shared-buffer.ko + ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"") + ifeq ($(strip $(CONFIG_KERNEL_GIT_CLONE_URI)),"") + FILES:=$(LINUX_DIR)/drivers/dma-buf/dma-shared-buffer.ko + endif + endif AUTOLOAD:=$(call AutoLoad,20,dma-shared-buffer) endef $(eval $(call KernelPackage,dma-buf)) @@ -180,7 +172,7 @@ define KernelPackage/eeprom-at24 SUBMENU:=$(OTHER_MENU) TITLE:=EEPROM AT24 support KCONFIG:=CONFIG_EEPROM_AT24 - DEPENDS:=+kmod-i2c-core +kmod-nvmem + DEPENDS:=+kmod-i2c-core +kmod-nvmem +LINUX_4_19:kmod-regmap-i2c FILES:=$(LINUX_DIR)/drivers/misc/eeprom/at24.ko AUTOLOAD:=$(call AutoProbe,at24) endef @@ -227,10 +219,14 @@ $(eval $(call KernelPackage,gpio-dev)) define KernelPackage/gpio-mcp23s08 SUBMENU:=$(OTHER_MENU) TITLE:=Microchip MCP23xxx I/O expander - DEPENDS:=@GPIO_SUPPORT +kmod-i2c-core - KCONFIG:=CONFIG_GPIO_MCP23S08 - FILES:=$(LINUX_DIR)/drivers/gpio/gpio-mcp23s08.ko - AUTOLOAD:=$(call AutoLoad,40,gpio-mcp23s08) + DEPENDS:=@GPIO_SUPPORT +kmod-i2c-core +!LINUX_4_9:kmod-regmap-i2c + KCONFIG:= \ + CONFIG_GPIO_MCP23S08 \ + CONFIG_PINCTRL_MCP23S08 + FILES:= \ + $(LINUX_DIR)/drivers/gpio/gpio-mcp23s08.ko@lt4.13 \ + $(LINUX_DIR)/drivers/pinctrl/pinctrl-mcp23s08.ko@ge4.13 + AUTOLOAD:=$(call AutoLoad,40,gpio-mcp23s08@lt4.13 pinctrl-mcp23s08@ge4.13) endef define KernelPackage/gpio-mcp23s08/description @@ -480,7 +476,7 @@ define KernelPackage/rtc-ds1307 SUBMENU:=$(OTHER_MENU) TITLE:=Dallas/Maxim DS1307 (and compatible) RTC support DEFAULT:=m if ALL_KMODS && RTC_SUPPORT - DEPENDS:=+kmod-i2c-core +LINUX_4_14:kmod-regmap + DEPENDS:=+kmod-i2c-core +!LINUX_4_9:kmod-regmap-i2c +!LINUX_4_9:kmod-hwmon-core KCONFIG:=CONFIG_RTC_DRV_DS1307 \ CONFIG_RTC_CLASS=y FILES:=$(LINUX_DIR)/drivers/rtc/rtc-ds1307.ko @@ -532,6 +528,24 @@ endef $(eval $(call KernelPackage,rtc-ds1672)) +define KernelPackage/rtc-em3027 + SUBMENU:=$(OTHER_MENU) + TITLE:=Microelectronic EM3027 RTC support + DEFAULT:=m if ALL_KMODS && RTC_SUPPORT + DEPENDS:=+kmod-i2c-core + KCONFIG:=CONFIG_RTC_DRV_EM3027 \ + CONFIG_RTC_CLASS=y + FILES:=$(LINUX_DIR)/drivers/rtc/rtc-em3027.ko + AUTOLOAD:=$(call AutoProbe,rtc-em3027) +endef + +define KernelPackage/rtc-em3027/description + Kernel module for Microelectronic EM3027 RTC. +endef + +$(eval $(call KernelPackage,rtc-em3027)) + + define KernelPackage/rtc-isl1208 SUBMENU:=$(OTHER_MENU) TITLE:=Intersil ISL1208 RTC support @@ -585,6 +599,23 @@ endef $(eval $(call KernelPackage,rtc-pcf2123)) +define KernelPackage/rtc-pcf2127 + SUBMENU:=$(OTHER_MENU) + TITLE:=NXP PCF2127 and PCF2129 RTC support + DEFAULT:=m if ALL_KMODS && RTC_SUPPORT + DEPENDS:=+kmod-i2c-core +kmod-regmap-spi + KCONFIG:=CONFIG_RTC_DRV_PCF2127 \ + CONFIG_RTC_CLASS=y + FILES:=$(LINUX_DIR)/drivers/rtc/rtc-pcf2127.ko + AUTOLOAD:=$(call AutoProbe,rtc-pcf2127) +endef + +define KernelPackage/rtc-pcf2127/description + Kernel module for NXP PCF2127 and PCF2129 RTC chip +endef + +$(eval $(call KernelPackage,rtc-pcf2127)) + define KernelPackage/rtc-pt7c4338 SUBMENU:=$(OTHER_MENU) TITLE:=Pericom PT7C4338 RTC support @@ -619,6 +650,23 @@ endef $(eval $(call KernelPackage,rtc-rs5c372a)) +define KernelPackage/rtc-rx8025 + SUBMENU:=$(OTHER_MENU) + TITLE:=Epson RX-8025 / RX-8035 + DEFAULT:=m if ALL_KMODS && RTC_SUPPORT + DEPENDS:=+kmod-i2c-core + KCONFIG:=CONFIG_RTC_DRV_RX8025 \ + CONFIG_RTC_CLASS=y + FILES:=$(LINUX_DIR)/drivers/rtc/rtc-rx8025.ko + AUTOLOAD:=$(call AutoLoad,50,rtc-rx8025,1) +endef + +define KernelPackage/rtc-rx8025/description + Kernel module for Epson RX-8025 and RX-8035 I2C RTC chip +endef + +$(eval $(call KernelPackage,rtc-rx8025)) + define KernelPackage/mtdtests SUBMENU:=$(OTHER_MENU) @@ -698,32 +746,87 @@ endef $(eval $(call KernelPackage,serial-8250)) -define KernelPackage/regmap +define KernelPackage/serial-8250-exar + SUBMENU:=$(OTHER_MENU) + TITLE:=Exar 8250 UARTs + KCONFIG:= CONFIG_SERIAL_8250_EXAR + FILES:=$(LINUX_DIR)/drivers/tty/serial/8250/8250_exar.ko + AUTOLOAD:=$(call AutoProbe,8250 8250_base 8250_exar) + DEPENDS:=+kmod-serial-8250 +endef + +define KernelPackage/serial-8250-exar/description + Kernel module for Exar serial ports +endef + +$(eval $(call KernelPackage,serial-8250-exar)) + + +define KernelPackage/regmap-core SUBMENU:=$(OTHER_MENU) TITLE:=Generic register map support - DEPENDS:=+kmod-lib-lzo +kmod-i2c-core - KCONFIG:=CONFIG_REGMAP \ - CONFIG_REGMAP_MMIO \ - CONFIG_REGMAP_SPI \ - CONFIG_REGMAP_I2C \ - CONFIG_SPI=y - FILES:= \ - $(LINUX_DIR)/drivers/base/regmap/regmap-i2c.ko \ - $(LINUX_DIR)/drivers/base/regmap/regmap-mmio.ko \ - $(if $(CONFIG_SPI),$(LINUX_DIR)/drivers/base/regmap/regmap-spi.ko) - AUTOLOAD:=$(call AutoLoad,21,regmap-core regmap-i2c regmap-mmio regmap-spi) - ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"") - ifeq ($(strip $(CONFIG_KERNEL_GIT_CLONE_URI)),"") - FILES += $(LINUX_DIR)/drivers/base/regmap/regmap-core.ko - endif - endif + HIDDEN:=1 + KCONFIG:=CONFIG_REGMAP +ifneq ($(wildcard $(LINUX_DIR)/drivers/base/regmap/regmap-core.ko),) + FILES:=$(LINUX_DIR)/drivers/base/regmap/regmap-core.ko +endif endef -define KernelPackage/regmap/description +define KernelPackage/regmap-core/description Generic register map support endef -$(eval $(call KernelPackage,regmap)) +$(eval $(call KernelPackage,regmap-core)) + + +define KernelPackage/regmap-spi + SUBMENU:=$(OTHER_MENU) + TITLE:=SPI register map support + DEPENDS:=+kmod-regmap-core + HIDDEN:=1 + KCONFIG:=CONFIG_REGMAP_SPI \ + CONFIG_SPI=y + FILES:=$(LINUX_DIR)/drivers/base/regmap/regmap-spi.ko +endef + +define KernelPackage/regmap-spi/description + SPI register map support +endef + +$(eval $(call KernelPackage,regmap-spi)) + + +define KernelPackage/regmap-i2c + SUBMENU:=$(OTHER_MENU) + TITLE:=I2C register map support + DEPENDS:=+kmod-regmap-core +kmod-i2c-core + HIDDEN:=1 + KCONFIG:=CONFIG_REGMAP_I2C + FILES:=$(LINUX_DIR)/drivers/base/regmap/regmap-i2c.ko +endef + +define KernelPackage/regmap-i2c/description + I2C register map support +endef + +$(eval $(call KernelPackage,regmap-i2c)) + + +define KernelPackage/regmap-mmio + SUBMENU:=$(OTHER_MENU) + TITLE:=MMIO register map support + DEPENDS:=+kmod-regmap-core + HIDDEN:=1 + KCONFIG:=CONFIG_REGMAP_MMIO + FILES:=$(LINUX_DIR)/drivers/base/regmap/regmap-mmio.ko +endef + +define KernelPackage/regmap-mmio/description + MMIO register map support +endef + +$(eval $(call KernelPackage,regmap-mmio)) + define KernelPackage/ikconfig SUBMENU:=$(OTHER_MENU) @@ -840,7 +943,7 @@ $(eval $(call KernelPackage,ptp)) define KernelPackage/ptp-gianfar SUBMENU:=$(OTHER_MENU) TITLE:=Freescale Gianfar PTP support - DEPENDS:=@TARGET_mpc85xx +kmod-ptp + DEPENDS:=@TARGET_mpc85xx +kmod-ptp @!LINUX_4_19 KCONFIG:=CONFIG_PTP_1588_CLOCK_GIANFAR FILES:=$(LINUX_DIR)/drivers/net/ethernet/freescale/gianfar_ptp.ko AUTOLOAD:=$(call AutoProbe,gianfar_ptp) @@ -853,6 +956,22 @@ endef $(eval $(call KernelPackage,ptp-gianfar)) +define KernelPackage/ptp-qoriq + SUBMENU:=$(OTHER_MENU) + TITLE:=Freescale QorIQ PTP support + DEPENDS:=@TARGET_mpc85xx +kmod-ptp @LINUX_4_19 + KCONFIG:=CONFIG_PTP_1588_CLOCK_QORIQ + FILES:=$(LINUX_DIR)/drivers/ptp/ptp_qoriq.o + AUTOLOAD:=$(call AutoProbe,ptp_qoriq) +endef + + +define KernelPackage/ptp-qoriq/description + Kernel module for IEEE 1588 support for Freescale + QorIQ Ethernet drivers +endef + +$(eval $(call KernelPackage,ptp-qoriq)) define KernelPackage/random-core SUBMENU:=$(OTHER_MENU) @@ -867,21 +986,22 @@ endef $(eval $(call KernelPackage,random-core)) -define KernelPackage/random-omap + +define KernelPackage/random-tpm SUBMENU:=$(OTHER_MENU) - TITLE:=Hardware Random Number Generator OMAP support - KCONFIG:=CONFIG_HW_RANDOM_OMAP - FILES:=$(LINUX_DIR)/drivers/char/hw_random/omap-rng.ko - DEPENDS:=@TARGET_omap24xx +kmod-random-core - AUTOLOAD:=$(call AutoProbe,random-omap) + TITLE:=Hardware Random Number Generator TPM support + KCONFIG:=CONFIG_HW_RANDOM_TPM + FILES:=$(LINUX_DIR)/drivers/char/hw_random/tpm-rng.ko + DEPENDS:= +kmod-random-core +kmod-tpm @!LINUX_4_19 + AUTOLOAD:=$(call AutoProbe,tpm-rng) endef -define KernelPackage/random-omap/description - Kernel module for the OMAP Random Number Generator - found on OMAP16xx, OMAP2/3/4/5 and AM33xx/AM43xx multimedia processors. +define KernelPackage/random-tpm/description + Kernel module for the Random Number Generator + in the Trusted Platform Module. endef -$(eval $(call KernelPackage,random-omap)) +$(eval $(call KernelPackage,random-tpm)) define KernelPackage/thermal SUBMENU:=$(OTHER_MENU) @@ -895,6 +1015,7 @@ define KernelPackage/thermal CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y \ CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE=n \ CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE=n \ + CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 \ CONFIG_THERMAL_GOV_FAIR_SHARE=n \ CONFIG_THERMAL_GOV_STEP_WISE=y \ CONFIG_THERMAL_GOV_USER_SPACE=n \ @@ -951,7 +1072,7 @@ $(eval $(call KernelPackage,echo)) define KernelPackage/bmp085 SUBMENU:=$(OTHER_MENU) TITLE:=BMP085/BMP18x pressure sensor - DEPENDS:= +kmod-regmap @!LINUX_3_18 @!LINUX_4_1 + DEPENDS:= +kmod-regmap-core KCONFIG:= CONFIG_BMP085 FILES:= $(LINUX_DIR)/drivers/misc/bmp085.ko endef @@ -998,6 +1119,7 @@ $(eval $(call KernelPackage,bmp085-spi)) define KernelPackage/tpm SUBMENU:=$(OTHER_MENU) TITLE:=TPM Hardware Support + DEPENDS:= +!LINUX_4_14:kmod-random-core KCONFIG:= CONFIG_TCG_TPM FILES:= $(LINUX_DIR)/drivers/char/tpm/tpm.ko AUTOLOAD:=$(call AutoLoad,10,tpm,1) @@ -1108,3 +1230,18 @@ define KernelPackage/it87-wdt/description endef $(eval $(call KernelPackage,it87-wdt)) + + +define KernelPackage/pinctrl-sx150x + SUBMENU:=$(OTHER_MENU) + TITLE:=Semtech SX150x-series I2C GPIO expanders + DEPENDS:= +kmod-i2c-core @!LINUX_4_9 + KCONFIG:=CONFIG_PINCTRL_SX150X=y + AUTOLOAD:=$(call AutoLoad,40,pinctrl-sx150x) +endef + +define KernelPackage/pinctrl-sx150x/description + This driver adds support for Semtech SX150x-series I2C GPIO expanders. +endef + +$(eval $(call KernelPackage,pinctrl-sx150x)) diff --git a/package/kernel/linux/modules/sound.mk b/package/kernel/linux/modules/sound.mk index 177140e0fc181d..8d63ddfc53acd6 100644 --- a/package/kernel/linux/modules/sound.mk +++ b/package/kernel/linux/modules/sound.mk @@ -188,9 +188,10 @@ $(eval $(call KernelPackage,sound-via82xx)) define KernelPackage/sound-soc-core TITLE:=SoC sound support - DEPENDS:=+kmod-regmap +kmod-ac97 + DEPENDS:=+kmod-regmap-core +kmod-ac97 KCONFIG:= \ CONFIG_SND_SOC \ + CONFIG_SND_SOC_ADI=n \ CONFIG_SND_SOC_DMAENGINE_PCM=y \ CONFIG_SND_SOC_ALL_CODECS=n FILES:=$(LINUX_DIR)/sound/soc/snd-soc-core.ko @@ -300,7 +301,7 @@ define KernelPackage/sound-dummy AUTOLOAD:=$(call AutoLoad,32,snd-dummy) endef -define KernelPackage/sound_dummy/description +define KernelPackage/sound-dummy/description Dummy sound device for Alsa when no hardware present endef @@ -321,7 +322,7 @@ define KernelPackage/sound-hda-core $(LINUX_DIR)/sound/pci/hda/snd-hda-codec.ko \ $(LINUX_DIR)/sound/pci/hda/snd-hda-codec-generic.ko AUTOLOAD:=$(call AutoProbe,snd-hda-core@ge4.1 snd-hda-codec snd-hda-codec-generic) - $(call AddDepends/sound,+kmod-regmap) + $(call AddDepends/sound,+kmod-regmap-core) endef define KernelPackage/sound-hda-core/description diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk index 0c5bb33f3897cf..fb804b6fe9969e 100644 --- a/package/kernel/linux/modules/usb.mk +++ b/package/kernel/linux/modules/usb.mk @@ -39,7 +39,6 @@ endef define KernelPackage/usb-ledtrig-usbport TITLE:=LED trigger for USB ports KCONFIG:=CONFIG_USB_LEDS_TRIGGER_USBPORT - DEPENDS:=@!LINUX_3_18 FILES:=$(LINUX_DIR)/drivers/usb/core/ledtrig-usbport.ko AUTOLOAD:=$(call AutoLoad,50,ledtrig-usbport) $(call AddDepends/usb) @@ -73,7 +72,7 @@ $(eval $(call KernelPackage,usb-phy-nop)) define KernelPackage/usb-phy-qcom-dwc3 TITLE:=DWC3 USB QCOM PHY driver - DEPENDS:=@TARGET_ipq40xx||@TARGET_ipq806x +kmod-usb-dwc3-of-simple + DEPENDS:=@(TARGET_ipq40xx||TARGET_ipq806x) +kmod-usb-dwc3-of-simple KCONFIG:= CONFIG_PHY_QCOM_DWC3 FILES:= \ $(LINUX_DIR)/drivers/phy/phy-qcom-dwc3.ko@lt4.13 \ @@ -142,6 +141,23 @@ endef $(eval $(call KernelPackage,usb-lib-composite)) +define KernelPackage/usb-gadget-hid + TITLE:=USB HID Gadget Support + KCONFIG:=CONFIG_USB_G_HID + DEPENDS:=+kmod-usb-gadget +kmod-usb-lib-composite + FILES:= \ + $(LINUX_DIR)/drivers/usb/gadget/legacy/g_hid.ko \ + $(LINUX_DIR)/drivers/usb/gadget/function/usb_f_hid.ko + AUTOLOAD:=$(call AutoLoad,52,usb_f_hid) + $(call AddDepends/usb) +endef + +define KernelPackage/usb-gadget-hid/description + Kernel support for USB HID Gadget. +endef + +$(eval $(call KernelPackage,usb-gadget-hid)) + define KernelPackage/usb-gadget-ehci-debug TITLE:=USB EHCI debug port Gadget support KCONFIG:=\ @@ -220,6 +236,22 @@ endef $(eval $(call KernelPackage,usb-gadget-mass-storage)) +define KernelPackage/usb-gadget-cdc-composite + TITLE:= USB CDC Composite (Ethernet + ACM) + KCONFIG:=CONFIG_USB_CDC_COMPOSITE + DEPENDS:=+kmod-usb-gadget +kmod-usb-lib-composite \ + +kmod-usb-gadget-eth +kmod-usb-gadget-serial + FILES:= $(LINUX_DIR)/drivers/usb/gadget/legacy/g_cdc.ko + $(call AddDepends/usb) +endef + +define KernelPackage/usb-gadget-cdc-composite/description + Kernel support for the USB CDC Composite gadget. + This appears as an ethernet + ACM serial gadget. +endef + +$(eval $(call KernelPackage,usb-gadget-cdc-composite)) + define KernelPackage/usb-uhci TITLE:=Support for UHCI controllers @@ -301,6 +333,17 @@ define KernelPackage/usb-bcma endef $(eval $(call KernelPackage,usb-bcma)) +define KernelPackage/usb-fotg210 + TITLE:=Support for FOTG210 USB host controllers + DEPENDS:=@USB_SUPPORT @TARGET_gemini + KCONFIG:=CONFIG_USB_FOTG210_HCD + FILES:= \ + $(if $(CONFIG_USB_FOTG210_HCD),$(LINUX_DIR)/drivers/usb/host/fotg210-hcd.ko) + AUTOLOAD:=$(call AutoLoad,50,fotg210-hcd,1) + $(call AddDepends/usb) +endef +$(eval $(call KernelPackage,usb-fotg210)) + define KernelPackage/usb-ssb TITLE:=Support for SSB USB controllers DEPENDS:=@USB_SUPPORT @TARGET_brcm47xx @@ -351,7 +394,13 @@ define KernelPackage/usb2 ifneq ($(wildcard $(LINUX_DIR)/drivers/usb/host/ehci-atmel.ko),) FILES+=$(LINUX_DIR)/drivers/usb/host/ehci-atmel.ko endif - AUTOLOAD:=$(call AutoLoad,40,ehci-hcd ehci-platform ehci-orion ehci-atmel,1) + ifneq ($(wildcard $(LINUX_DIR)/drivers/usb/host/ehci-fsl.ko),) + FILES+=$(LINUX_DIR)/drivers/usb/host/ehci-fsl.ko + endif + ifneq ($(wildcard $(LINUX_DIR)/drivers/usb/host/fsl-mph-dr-of.ko),) + FILES+=$(LINUX_DIR)/drivers/usb/host/fsl-mph-dr-of.ko + endif + AUTOLOAD:=$(call AutoLoad,40,ehci-hcd ehci-platform ehci-orion ehci-atmel ehci-fsl fsl-mph-dr-of,1) $(call AddDepends/usb) endef @@ -431,7 +480,7 @@ $(eval $(call KernelPackage,usb-dwc3)) define KernelPackage/usb-dwc3-of-simple TITLE:=DWC3 USB simple OF driver - DEPENDS:=@TARGET_ipq40xx||@TARGET_ipq806x +kmod-usb-dwc3 + DEPENDS:=@!LINUX_4_19 @(TARGET_ipq40xx||TARGET_ipq806x) +kmod-usb-dwc3 KCONFIG:= CONFIG_USB_DWC3_OF_SIMPLE FILES:= $(LINUX_DIR)/drivers/usb/dwc3/dwc3-of-simple.ko AUTOLOAD:=$(call AutoLoad,53,dwc3-of-simple,1) @@ -446,6 +495,26 @@ endef $(eval $(call KernelPackage,usb-dwc3-of-simple)) + +define KernelPackage/usb-dwc3-qcom + TITLE:=DWC3 Qualcomm USB driver + DEPENDS:=@LINUX_4_19 @(TARGET_ipq40xx||TARGET_ipq806x) +kmod-usb-dwc3 + KCONFIG:= CONFIG_USB_DWC3_QCOM + FILES:= $(LINUX_DIR)/drivers/usb/dwc3/dwc3-qcom.ko + AUTOLOAD:=$(call AutoLoad,53,dwc3-qcom,1) + $(call AddDepends/usb) +endef + +define KernelPackage/usb-dwc3-qcom/description + Some Qualcomm SoCs use DesignWare Core IP for USB2/3 functionality. + This driver also handles Qscratch wrapper which is needed for + peripheral mode support. +endef + + +$(eval $(call KernelPackage,usb-dwc3-qcom)) + + define KernelPackage/usb-acm TITLE:=Support for modems/isdn controllers KCONFIG:=CONFIG_USB_ACM @@ -710,6 +779,21 @@ endef $(eval $(call KernelPackage,usb-serial-mos7720)) +define KernelPackage/usb-serial-mos7840 + TITLE:=Support for Moschip MOS7840 devices + KCONFIG:=CONFIG_USB_SERIAL_MOS7840 + FILES:=$(LINUX_DIR)/drivers/usb/serial/mos7840.ko + AUTOLOAD:=$(call AutoProbe,mos7840) + $(call AddDepends/usb-serial) +endef + +define KernelPackage/usb-serial-mos7840/description + Kernel support for Moschip MOS7840 USB-to-Serial converters +endef + +$(eval $(call KernelPackage,usb-serial-mos7840)) + + define KernelPackage/usb-serial-pl2303 TITLE:=Support for Prolific PL2303 devices KCONFIG:=CONFIG_USB_SERIAL_PL2303 @@ -852,6 +936,7 @@ define KernelPackage/usb-serial-wwan TITLE:=Support for GSM and CDMA modems KCONFIG:=CONFIG_USB_SERIAL_WWAN FILES:=$(LINUX_DIR)/drivers/usb/serial/usb_wwan.ko + HIDDEN:=1 AUTOLOAD:=$(call AutoProbe,usb_wwan) $(call AddDepends/usb-serial) endef @@ -865,11 +950,10 @@ $(eval $(call KernelPackage,usb-serial-wwan)) define KernelPackage/usb-serial-option TITLE:=Support for Option HSDPA modems - DEPENDS:=+kmod-usb-serial-wwan KCONFIG:=CONFIG_USB_SERIAL_OPTION FILES:=$(LINUX_DIR)/drivers/usb/serial/option.ko AUTOLOAD:=$(call AutoProbe,option) - $(call AddDepends/usb-serial) + $(call AddDepends/usb-serial,+kmod-usb-serial-wwan) endef define KernelPackage/usb-serial-option/description @@ -1259,21 +1343,6 @@ endef $(eval $(call KernelPackage,usb-net-rtl8150)) -define KernelPackage/usb-net-rtl8152 - TITLE:=Kernel module for USB-to-Ethernet Realtek convertors - KCONFIG:=CONFIG_USB_RTL8152 - FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/r8152.ko - AUTOLOAD:=$(call AutoProbe,r8152) - $(call AddDepends/usb-net) -endef - -define KernelPackage/usb-net-rtl8152/description - Kernel module for USB-to-Ethernet Realtek 8152 USB2.0/3.0 convertors -endef - -$(eval $(call KernelPackage,usb-net-rtl8152)) - - define KernelPackage/usb-net-sr9700 TITLE:=Support for CoreChip SR9700 ethernet devices KCONFIG:=CONFIG_USB_NET_SR9700 @@ -1315,7 +1384,7 @@ define KernelPackage/usb-net-cdc-mbim endef define KernelPackage/usb-net-cdc-mbim/description - Kernel module for Option USB High Speed Mobile Devices + Kernel module for CDC MBIM (Mobile Broadband Interface Model) devices endef $(eval $(call KernelPackage,usb-net-cdc-mbim)) @@ -1522,7 +1591,8 @@ define KernelPackage/usb-chipidea FILES:= \ $(LINUX_DIR)/drivers/extcon/extcon.ko@lt4.9 \ $(LINUX_DIR)/drivers/extcon/extcon-core.ko@ge4.9 \ - $(LINUX_DIR)/drivers/usb/chipidea/ci_hdrc.ko + $(LINUX_DIR)/drivers/usb/chipidea/ci_hdrc.ko \ + $(LINUX_DIR)/drivers/usb/common/ulpi.ko@ge4.18 AUTOLOAD:=$(call AutoLoad,39,ci_hdrc,1) $(call AddDepends/usb) endef @@ -1589,7 +1659,6 @@ define KernelPackage/usb3 CONFIG_USB_XHCI_HCD \ CONFIG_USB_XHCI_PCI \ CONFIG_USB_XHCI_PLATFORM \ - CONFIG_USB_XHCI_MVEBU=y \ CONFIG_USB_XHCI_MTK \ CONFIG_USB_XHCI_HCD_DEBUGGING=n FILES:= \ @@ -1622,3 +1691,19 @@ endef $(eval $(call KernelPackage,usb-net2280)) +define KernelPackage/chaoskey + SUBMENU:=$(USB_MENU) + TITLE:=Chaoskey hardware RNG support + DEPENDS:=+kmod-random-core + KCONFIG:=CONFIG_USB_CHAOSKEY + FILES:=$(LINUX_DIR)/drivers/usb/misc/chaoskey.ko + AUTOLOAD:=$(call AutoProbe,chaoskey) + $(call AddDepends/usb) +endef + +define KernelPackage/chaoskey/description + Kernel module for chaoskey, USB attached true random number generator +endef + +$(eval $(call KernelPackage,chaoskey)) + diff --git a/package/kernel/linux/modules/video.mk b/package/kernel/linux/modules/video.mk index f76618055f96ff..5e2484cec5b1c0 100644 --- a/package/kernel/linux/modules/video.mk +++ b/package/kernel/linux/modules/video.mk @@ -56,34 +56,13 @@ $(eval $(call KernelPackage,backlight-pwm)) define KernelPackage/fb SUBMENU:=$(VIDEO_MENU) - TITLE:=Framebuffer support + TITLE:=Framebuffer and framebuffer console support DEPENDS:=@DISPLAY_SUPPORT KCONFIG:= \ CONFIG_FB \ CONFIG_FB_MXS=n \ - CONFIG_FB_SM750=n - FILES:=$(LINUX_DIR)/drivers/video/fbdev/core/fb.ko - AUTOLOAD:=$(call AutoLoad,06,fb) -endef - -define KernelPackage/fb/description - Kernel support for framebuffers -endef - -define KernelPackage/fb/x86 - FILES+=$(LINUX_DIR)/arch/x86/video/fbdev.ko - AUTOLOAD+=$(call AutoLoad,06,fbdev fb) -endef - -$(eval $(call KernelPackage,fb)) - - -define KernelPackage/fbcon - SUBMENU:=$(VIDEO_MENU) - TITLE:=Framebuffer Console support - DEPENDS:=+kmod-fb @!LINUX_4_14 - KCONFIG:= \ - CONFIG_FRAMEBUFFER_CONSOLE \ + CONFIG_FB_SM750=n \ + CONFIG_FRAMEBUFFER_CONSOLE=y \ CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y \ CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y \ CONFIG_FONTS=y \ @@ -102,23 +81,22 @@ define KernelPackage/fbcon CONFIG_CONSOLE_TRANSLATIONS=y \ CONFIG_VT_CONSOLE=y \ CONFIG_VT_HW_CONSOLE_BINDING=y - FILES:= \ - $(LINUX_DIR)/drivers/video/console/bitblit.ko \ - $(LINUX_DIR)/drivers/video/console/softcursor.ko \ - $(LINUX_DIR)/drivers/video/console/fbcon.ko \ - $(LINUX_DIR)/drivers/video/console/fbcon_rotate.ko \ - $(LINUX_DIR)/drivers/video/console/fbcon_cw.ko \ - $(LINUX_DIR)/drivers/video/console/fbcon_ud.ko \ - $(LINUX_DIR)/drivers/video/console/fbcon_ccw.ko \ + FILES:=$(LINUX_DIR)/drivers/video/fbdev/core/fb.ko \ $(LINUX_DIR)/lib/fonts/font.ko - AUTOLOAD:=$(call AutoLoad,94,font softcursor tileblit fbcon_cw fbcon_ud fbcon_ccw fbcon_rotate bitblit fbcon) + AUTOLOAD:=$(call AutoLoad,06,fb font) +endef + +define KernelPackage/fb/description + Kernel support for framebuffers and framebuffer console. endef -define KernelPackage/fbcon/description - Kernel support for framebuffer console +define KernelPackage/fb/x86 + FILES+=$(LINUX_DIR)/arch/x86/video/fbdev.ko + AUTOLOAD:=$(call AutoLoad,06,fbdev fb font) endef -$(eval $(call KernelPackage,fbcon)) +$(eval $(call KernelPackage,fb)) + define KernelPackage/fb-cfb-fillrect SUBMENU:=$(VIDEO_MENU) @@ -182,13 +160,76 @@ endef $(eval $(call KernelPackage,fb-sys-fops)) + +define KernelPackage/fb-sys-ram + SUBMENU:=$(VIDEO_MENU) + TITLE:=Framebuffer in system RAM support + DEPENDS:=+kmod-fb + KCONFIG:= \ + CONFIG_FB_SYS_COPYAREA \ + CONFIG_FB_SYS_FILLRECT \ + CONFIG_FB_SYS_IMAGEBLIT + FILES:= \ + $(LINUX_DIR)/drivers/video/fbdev/core/syscopyarea.ko \ + $(LINUX_DIR)/drivers/video/fbdev/core/sysfillrect.ko \ + $(LINUX_DIR)/drivers/video/fbdev/core/sysimgblt.ko + AUTOLOAD:=$(call AutoLoad,07,syscopyarea sysfillrect sysimgblt) +endef + +define KernelPackage/fb-sys-ram/description + Kernel support for framebuffers in system RAM +endef + +$(eval $(call KernelPackage,fb-sys-ram)) + + +define KernelPackage/fb-tft + SUBMENU:=$(VIDEO_MENU) + TITLE:=Support for small TFT LCD display modules + DEPENDS:= \ + @GPIO_SUPPORT @!LINUX_4_9 +kmod-backlight \ + +kmod-fb +kmod-fb-sys-fops +kmod-fb-sys-ram +kmod-spi-bitbang + KCONFIG:= \ + CONFIG_FB_BACKLIGHT=y \ + CONFIG_FB_DEFERRED_IO=y \ + CONFIG_FB_TFT + FILES:= \ + $(LINUX_DIR)/drivers/staging/fbtft/fbtft.ko + AUTOLOAD:=$(call AutoLoad,08,fbtft) +endef + +define KernelPackage/fb-tft/description + Support for small TFT LCD display modules +endef + +$(eval $(call KernelPackage,fb-tft)) + + +define KernelPackage/fb-tft-ili9486 + SUBMENU:=$(VIDEO_MENU) + TITLE:=FB driver for the ILI9486 LCD Controller + DEPENDS:=+kmod-fb-tft + KCONFIG:=CONFIG_FB_TFT_ILI9486 + FILES:=$(LINUX_DIR)/drivers/staging/fbtft/fb_ili9486.ko + AUTOLOAD:=$(call AutoLoad,09,fb_ili9486) +endef + +define KernelPackage/fb-tft-ili9486/description + FB driver for the ILI9486 LCD Controller +endef + +$(eval $(call KernelPackage,fb-tft-ili9486)) + + define KernelPackage/drm SUBMENU:=$(VIDEO_MENU) TITLE:=Direct Rendering Manager (DRM) support HIDDEN:=1 DEPENDS:=+kmod-dma-buf +kmod-i2c-core KCONFIG:=CONFIG_DRM - FILES:=$(LINUX_DIR)/drivers/gpu/drm/drm.ko + FILES:= \ + $(LINUX_DIR)/drivers/gpu/drm/drm.ko \ + $(LINUX_DIR)/drivers/gpu/drm/drm_panel_orientation_quirks.ko@ge4.15 AUTOLOAD:=$(call AutoLoad,05,drm) endef @@ -198,10 +239,67 @@ endef $(eval $(call KernelPackage,drm)) +define KernelPackage/drm-ttm + SUBMENU:=$(VIDEO_MENU) + TITLE:=GPU memory management subsystem + DEPENDS:=@DISPLAY_SUPPORT +kmod-drm + KCONFIG:=CONFIG_DRM_TTM + FILES:=$(LINUX_DIR)/drivers/gpu/drm/ttm/ttm.ko + AUTOLOAD:=$(call AutoProbe,ttm) +endef + +define KernelPackage/drm-ttm/description + GPU memory management subsystem for devices with multiple GPU memory types. + Will be enabled automatically if a device driver uses it. +endef + +$(eval $(call KernelPackage,drm-ttm)) + +define KernelPackage/drm-kms-helper + SUBMENU:=$(VIDEO_MENU) + TITLE:=CRTC helpers for KMS drivers + DEPENDS:=@DISPLAY_SUPPORT +kmod-drm +kmod-fb +kmod-fb-sys-fops +kmod-fb-cfb-copyarea \ + +kmod-fb-cfb-fillrect +kmod-fb-cfb-imgblt +kmod-fb-sys-ram + KCONFIG:= \ + CONFIG_DRM_KMS_HELPER \ + CONFIG_DRM_KMS_FB_HELPER=y + FILES:=$(LINUX_DIR)/drivers/gpu/drm/drm_kms_helper.ko + AUTOLOAD:=$(call AutoProbe,drm_kms_helper) +endef + +define KernelPackage/drm-kms-helper/description + CRTC helpers for KMS drivers. +endef + +$(eval $(call KernelPackage,drm-kms-helper)) + +define KernelPackage/drm-amdgpu + SUBMENU:=$(VIDEO_MENU) + TITLE:=AMDGPU DRM support + DEPENDS:=@TARGET_x86 @DISPLAY_SUPPORT +kmod-backlight +kmod-drm-ttm \ + +kmod-drm-kms-helper +kmod-i2c-algo-bit +amdgpu-firmware + KCONFIG:=CONFIG_DRM_AMDGPU \ + CONFIG_DRM_AMDGPU_SI=y \ + CONFIG_DRM_AMDGPU_CIK=y \ + CONFIG_DRM_AMD_DC=y \ + CONFIG_DEBUG_KERNEL_DC=n + FILES:=$(LINUX_DIR)/drivers/gpu/drm/amd/amdgpu/amdgpu.ko \ + $(LINUX_DIR)/drivers/gpu/drm/scheduler/gpu-sched.ko@ge4.15 \ + $(LINUX_DIR)/drivers/gpu/drm/amd/lib/chash.ko@ge4.15 + AUTOLOAD:=$(call AutoProbe,amdgpu) +endef + +define KernelPackage/drm-amdgpu/description + Direct Rendering Manager (DRM) support for AMDGPU Cards +endef + +$(eval $(call KernelPackage,drm-amdgpu)) + + define KernelPackage/drm-imx SUBMENU:=$(VIDEO_MENU) TITLE:=Freescale i.MX DRM support - DEPENDS:=@TARGET_imx6 +kmod-drm +kmod-fb +kmod-fb-cfb-copyarea +kmod-fb-cfb-imgblt +kmod-fb-cfb-fillrect +kmod-fb-sys-fops + DEPENDS:=@TARGET_imx6 +kmod-drm-kms-helper KCONFIG:=CONFIG_DRM_IMX \ CONFIG_DRM_FBDEV_EMULATION=y \ CONFIG_DRM_FBDEV_OVERALLOC=100 \ @@ -209,11 +307,6 @@ define KernelPackage/drm-imx CONFIG_RESET_CONTROLLER=y \ CONFIG_DRM_IMX_IPUV3 \ CONFIG_IMX_IPUV3 \ - CONFIG_DRM_KMS_HELPER \ - CONFIG_FB_SYS_FILLRECT \ - CONFIG_FB_SYS_COPYAREA \ - CONFIG_FB_SYS_IMAGEBLIT \ - CONFIG_DRM_KMS_FB_HELPER=y \ CONFIG_DRM_GEM_CMA_HELPER=y \ CONFIG_DRM_KMS_CMA_HELPER=y \ CONFIG_DRM_IMX_FB_HELPER \ @@ -223,12 +316,8 @@ define KernelPackage/drm-imx CONFIG_DRM_IMX_HDMI=n FILES:= \ $(LINUX_DIR)/drivers/gpu/drm/imx/imxdrm.ko \ - $(LINUX_DIR)/drivers/gpu/ipu-v3/imx-ipu-v3.ko \ - $(LINUX_DIR)/drivers/video/fbdev/core/syscopyarea.ko \ - $(LINUX_DIR)/drivers/video/fbdev/core/sysfillrect.ko \ - $(LINUX_DIR)/drivers/video/fbdev/core/sysimgblt.ko \ - $(LINUX_DIR)/drivers/gpu/drm/drm_kms_helper.ko - AUTOLOAD:=$(call AutoLoad,05,imxdrm imx-ipu-v3 imx-ipuv3-crtc) + $(LINUX_DIR)/drivers/gpu/ipu-v3/imx-ipu-v3.ko + AUTOLOAD:=$(call AutoLoad,08,imxdrm imx-ipu-v3 imx-ipuv3-crtc) endef define KernelPackage/drm-imx/description @@ -248,7 +337,7 @@ define KernelPackage/drm-imx-hdmi $(LINUX_DIR)/drivers/gpu/drm/bridge/synopsys/dw-hdmi.ko \ $(LINUX_DIR)/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.ko \ $(LINUX_DIR)/drivers/gpu/drm/imx/dw_hdmi-imx.ko - AUTOLOAD:=$(call AutoLoad,05,dw-hdmi dw-hdmi-ahb-audio.ko dw_hdmi-imx) + AUTOLOAD:=$(call AutoLoad,08,dw-hdmi dw-hdmi-ahb-audio.ko dw_hdmi-imx) endef define KernelPackage/drm-imx-hdmi/description @@ -273,7 +362,7 @@ define KernelPackage/drm-imx-ldb CONFIG_DRM_PANEL_SITRONIX_ST7789V=n FILES:=$(LINUX_DIR)/drivers/gpu/drm/imx/imx-ldb.ko \ $(LINUX_DIR)/drivers/gpu/drm/panel/panel-simple.ko - AUTOLOAD:=$(call AutoLoad,05,imx-ldb) + AUTOLOAD:=$(call AutoLoad,08,imx-ldb) endef define KernelPackage/drm-imx-ldb/description @@ -282,6 +371,21 @@ endef $(eval $(call KernelPackage,drm-imx-ldb)) +define KernelPackage/drm-radeon + SUBMENU:=$(VIDEO_MENU) + TITLE:=Radeon DRM support + DEPENDS:=@TARGET_x86 @DISPLAY_SUPPORT +kmod-backlight +kmod-drm-kms-helper \ + +kmod-drm-ttm +kmod-i2c-algo-bit +radeon-firmware + KCONFIG:=CONFIG_DRM_RADEON + FILES:=$(LINUX_DIR)/drivers/gpu/drm/radeon/radeon.ko + AUTOLOAD:=$(call AutoProbe,radeon) +endef + +define KernelPackage/drm-radeon/description + Direct Rendering Manager (DRM) support for Radeon Cards +endef + +$(eval $(call KernelPackage,drm-radeon)) # # Video Capture @@ -335,10 +439,14 @@ define KernelPackage/video-videobuf2 CONFIG_VIDEOBUF2_MEMOPS \ CONFIG_VIDEOBUF2_VMALLOC FILES:= \ - $(LINUX_DIR)/drivers/media/$(V4L2_DIR)/videobuf2-core.ko \ - $(LINUX_DIR)/drivers/media/$(V4L2_DIR)/videobuf2-v4l2.ko@ge4.4 \ - $(LINUX_DIR)/drivers/media/$(V4L2_DIR)/videobuf2-memops.ko \ - $(LINUX_DIR)/drivers/media/$(V4L2_DIR)/videobuf2-vmalloc.ko + $(LINUX_DIR)/drivers/media/$(V4L2_DIR)/videobuf2-core.ko@lt4.16 \ + $(LINUX_DIR)/drivers/media/$(V4L2_DIR)/videobuf2-v4l2.ko@lt4.16 \ + $(LINUX_DIR)/drivers/media/$(V4L2_DIR)/videobuf2-memops.ko@lt4.16 \ + $(LINUX_DIR)/drivers/media/$(V4L2_DIR)/videobuf2-vmalloc.ko@lt4.16 \ + $(LINUX_DIR)/drivers/media/common/videobuf2/videobuf2-common.ko@ge4.16 \ + $(LINUX_DIR)/drivers/media/common/videobuf2/videobuf2-v4l2.ko@ge4.16 \ + $(LINUX_DIR)/drivers/media/common/videobuf2/videobuf2-memops.ko@ge4.16 \ + $(LINUX_DIR)/drivers/media/common/videobuf2/videobuf2-vmalloc.ko@ge4.16 AUTOLOAD:=$(call AutoLoad,65,videobuf2-core videobuf-v4l2@ge4.4 videobuf2-memops videobuf2-vmalloc) $(call AddDepends/video) endef @@ -403,7 +511,7 @@ $(eval $(call KernelPackage,video-uvc)) define KernelPackage/video-gspca-core MENU:=1 TITLE:=GSPCA webcam core support framework - DEPENDS:=@USB_SUPPORT +kmod-usb-core +kmod-input-core + DEPENDS:=@USB_SUPPORT +kmod-usb-core +kmod-input-core +LINUX_4_19:kmod-video-videobuf2 KCONFIG:=CONFIG_USB_GSPCA FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/gspca/gspca_main.ko AUTOLOAD:=$(call AutoProbe,gspca_main) @@ -882,7 +990,7 @@ define KernelPackage/video-gspca-gl860 $(call AddDepends/camera-gspca) endef -define KernelPackage/video-gspca-gl800/description +define KernelPackage/video-gspca-gl860/description The GL860 USB Camera Driver (gl860) kernel module endef diff --git a/package/kernel/linux/modules/w1.mk b/package/kernel/linux/modules/w1.mk index e936a281453425..5055d78a18ccdf 100644 --- a/package/kernel/linux/modules/w1.mk +++ b/package/kernel/linux/modules/w1.mk @@ -14,7 +14,7 @@ define KernelPackage/w1 TITLE:=Dallas's 1-wire support KCONFIG:=CONFIG_W1 FILES:=$(LINUX_DIR)/drivers/w1/wire.ko - DEPENDS:=+LINUX_4_14:kmod-hwmon-core + DEPENDS:=+!LINUX_4_9:kmod-hwmon-core endef define KernelPackage/w1/description diff --git a/package/kernel/linux/modules/wpan.mk b/package/kernel/linux/modules/wpan.mk index 199044fc33451f..1e986ee0ca8ebe 100644 --- a/package/kernel/linux/modules/wpan.mk +++ b/package/kernel/linux/modules/wpan.mk @@ -9,7 +9,6 @@ WPAN_MENU:=WPAN 802.15.4 Support define KernelPackage/ieee802154 SUBMENU:=$(WPAN_MENU) TITLE:=IEEE-802.15.4 support - DEPENDS:=@!LINUX_3_18 KCONFIG:= \ CONFIG_IEEE802154 \ CONFIG_IEEE802154_SOCKET=y \ @@ -33,7 +32,7 @@ $(eval $(call KernelPackage,ieee802154)) define KernelPackage/mac802154 SUBMENU:=$(WPAN_MENU) TITLE:=MAC-802.15.4 support - DEPENDS:=+kmod-ieee802154 +kmod-crypto-aead +kmod-lib-crc-ccitt @!LINUX_3_18 + DEPENDS:=+kmod-ieee802154 +kmod-crypto-aead +kmod-lib-crc-ccitt KCONFIG:= \ CONFIG_MAC802154 \ CONFIG_IEEE802154_DRIVERS=y @@ -56,7 +55,7 @@ $(eval $(call KernelPackage,mac802154)) define KernelPackage/fakelb SUBMENU:=$(WPAN_MENU) TITLE:=Fake LR-WPAN driver - DEPENDS:=+kmod-mac802154 @!LINUX_3_18 + DEPENDS:=+kmod-mac802154 KCONFIG:=CONFIG_IEEE802154_FAKELB FILES:=$(LINUX_DIR)/drivers/net/ieee802154/fakelb.ko AUTOLOAD:=$(call AutoLoad,92,fakelb) @@ -69,10 +68,21 @@ endef $(eval $(call KernelPackage,fakelb)) +define KernelPackage/atusb + SUBMENU:=$(WPAN_MENU) + TITLE:=ATUSB transceiver driver + DEPENDS:=@USB_SUPPORT +kmod-usb-core +kmod-mac802154 + KCONFIG:=CONFIG_IEEE802154_ATUSB + FILES:=$(LINUX_DIR)/drivers/net/ieee802154/atusb.ko + AUTOLOAD:=$(call AutoProbe,atusb) +endef + +$(eval $(call KernelPackage,atusb)) + define KernelPackage/at86rf230 SUBMENU:=$(WPAN_MENU) TITLE:=AT86RF230 transceiver driver - DEPENDS:=+kmod-mac802154 +kmod-regmap + DEPENDS:=+kmod-mac802154 +kmod-regmap-spi KCONFIG:=CONFIG_IEEE802154_AT86RF230 \ CONFIG_IEEE802154_AT86RF230_DEBUGFS=n \ CONFIG_SPI=y \ @@ -85,7 +95,7 @@ $(eval $(call KernelPackage,at86rf230)) define KernelPackage/mrf24j40 SUBMENU:=$(WPAN_MENU) TITLE:=MRF24J40 transceiver driver - DEPENDS:=+kmod-mac802154 +kmod-regmap + DEPENDS:=+kmod-mac802154 +kmod-regmap-spi KCONFIG:=CONFIG_IEEE802154_MRF24J40 \ CONFIG_SPI=y \ CONFIG_SPI_MASTER=y @@ -109,7 +119,7 @@ $(eval $(call KernelPackage,cc2520)) define KernelPackage/ieee802154_6lowpan SUBMENU:=$(WPAN_MENU) TITLE:= 6LoWPAN support over IEEE-802.15.4 - DEPENDS:=@!LINUX_3_18 +kmod-6lowpan +kmod-ieee802154 + DEPENDS:=+kmod-6lowpan +kmod-ieee802154 KCONFIG:=CONFIG_IEEE802154_6LOWPAN FILES:= \ $(LINUX_DIR)/net/ieee802154/6lowpan/ieee802154_6lowpan.ko@ge4.0 \ diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 91c08fdb7e02a4..d26bcb813ec99b 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -10,10 +10,10 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=2017-11-01 -PKG_RELEASE:=9 -PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources -PKG_HASH:=8437ab7886b988c8152e7a4db30b7f41009e49a3b2cb863edd05da1ecd7eb05a +PKG_VERSION:=4.19.98-1 +PKG_RELEASE:=1 +PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v4.19.98/ +PKG_HASH:=256d77e9cd3918d6a361e029850aba4568e8a00167ab3ed55495a359511c5bd2 PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) @@ -24,58 +24,23 @@ PKG_MAINTAINER:=Felix Fietkau PKG_DRIVERS = \ adm8211 \ airo \ - ath ath5k ath6kl ath6kl-sdio ath6kl-usb ath9k ath9k-common ath9k-htc ath10k \ - b43 b43legacy \ - carl9170 \ hermes hermes-pci hermes-pcmcia hermes-plx\ - iwl-legacy iwl3945 iwl4965 iwlwifi \ lib80211 \ - libipw ipw2100 ipw2200 \ - libertas-sdio libertas-usb libertas-spi \ mac80211-hwsim \ mt7601u \ - mwl8k mwifiex-pcie mwifiex-sdio \ - p54-common p54-pci p54-spi p54-usb \ + p54-common p54-pci p54-usb \ rsi91x rsi91x-usb rsi91x-sdio\ - rt2x00-lib rt2x00-pci rt2x00-usb \ - rt2400-pci rt2500-pci rt2500-usb \ - rt2800-lib rt2800-mmio rt2800-pci rt2800-soc rt2800-usb \ - rt61-pci rt73-usb \ - rtl8180 rtl8187 \ - rtlwifi rtlwifi-pci rtlwifi-btcoexist rtlwifi-usb rtl8192c-common \ - rtl8192ce rtl8192se rtl8192de rtl8192cu rtl8821ae \ - rtl8xxxu \ wlcore wl12xx wl18xx \ zd1211rw PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_kmod-mac80211 \ - $(patsubst %,CONFIG_PACKAGE_kmod-%,$(PKG_DRIVERS)) \ CONFIG_PACKAGE_MAC80211_DEBUGFS \ CONFIG_PACKAGE_MAC80211_MESH \ CONFIG_PACKAGE_MAC80211_TRACING \ - CONFIG_PACKAGE_ATH_DEBUG \ - CONFIG_PACKAGE_ATH_DFS \ - CONFIG_PACKAGE_ATH_SPECTRAL \ - CONFIG_PACKAGE_ATH_DYNACK \ - CONFIG_PACKAGE_B43_DEBUG \ - CONFIG_PACKAGE_B43_PIO \ - CONFIG_PACKAGE_B43_PHY_G \ - CONFIG_PACKAGE_B43_PHY_N \ - CONFIG_PACKAGE_B43_PHY_LP \ - CONFIG_PACKAGE_B43_PHY_HT \ - CONFIG_PACKAGE_B43_BUSES_BCMA_AND_SSB \ - CONFIG_PACKAGE_B43_BUSES_BCMA \ - CONFIG_PACKAGE_B43_BUSES_SSB \ - CONFIG_PACKAGE_BRCM80211_DEBUG \ CONFIG_PACKAGE_IWLWIFI_DEBUG \ CONFIG_PACKAGE_IWLWIFI_DEBUGFS \ - CONFIG_PACKAGE_RT2X00_LIB_DEBUGFS \ - CONFIG_PACKAGE_RT2X00_DEBUG \ CONFIG_PACKAGE_RTLWIFI_DEBUG \ - CONFIG_ATH9K_SUPPORT_PCOEM \ - CONFIG_ATH9K_TX99 \ - CONFIG_ATH_USER_REGD \ include $(INCLUDE_DIR)/package.mk @@ -87,10 +52,53 @@ define KernelPackage/mac80211/Default MAINTAINER:=Felix Fietkau endef +config_package=$(if $(CONFIG_PACKAGE_kmod-$(1)),m) + +config-y:= \ + WLAN \ + NL80211_TESTMODE \ + CFG80211_WEXT \ + CFG80211_CERTIFICATION_ONUS \ + MAC80211_RC_MINSTREL \ + MAC80211_RC_MINSTREL_HT \ + MAC80211_RC_MINSTREL_VHT \ + MAC80211_RC_DEFAULT_MINSTREL \ + WLAN_VENDOR_ADMTEK \ + WLAN_VENDOR_ATH \ + WLAN_VENDOR_ATMEL \ + WLAN_VENDOR_BROADCOM \ + WLAN_VENDOR_CISCO \ + WLAN_VENDOR_INTEL \ + WLAN_VENDOR_INTERSIL \ + WLAN_VENDOR_MARVELL \ + WLAN_VENDOR_MEDIATEK \ + WLAN_VENDOR_RALINK \ + WLAN_VENDOR_REALTEK \ + WLAN_VENDOR_RSI \ + WLAN_VENDOR_ST \ + WLAN_VENDOR_TI \ + WLAN_VENDOR_ZYDAS \ + +config-$(call config_package,cfg80211) += CFG80211 + +config-$(call config_package,mac80211) += MAC80211 +config-$(CONFIG_PACKAGE_MAC80211_MESH) += MAC80211_MESH + +include ath.mk +include broadcom.mk +include intel.mk +include marvell.mk +include ralink.mk +include realtek.mk + +PKG_CONFIG_DEPENDS += \ + $(patsubst %,CONFIG_PACKAGE_kmod-%,$(PKG_DRIVERS)) + define KernelPackage/cfg80211 $(call KernelPackage/mac80211/Default) TITLE:=cfg80211 - wireless configuration API DEPENDS+= +iw +wireless-regdb + ABI_VERSION:=$(PKG_VERSION)-$(PKG_RELEASE) FILES:= \ $(PKG_BUILD_DIR)/compat/compat.ko \ $(PKG_BUILD_DIR)/net/wireless/cfg80211.ko @@ -108,6 +116,7 @@ define KernelPackage/mac80211 KCONFIG:=\ CONFIG_AVERAGE=y FILES:= $(PKG_BUILD_DIR)/net/mac80211/mac80211.ko + ABI_VERSION:=$(PKG_VERSION)-$(PKG_RELEASE) MENU:=1 endef @@ -153,7 +162,7 @@ endef define KernelPackage/airo $(call KernelPackage/mac80211/Default) TITLE:=Cisco Aironet driver - DEPENDS+=@PCI_SUPPORT +@DRIVER_WEXT_SUPPORT +kmod-cfg80211 @TARGET_x86 + DEPENDS+=@PCI_SUPPORT +@DRIVER_WEXT_SUPPORT +kmod-cfg80211 @TARGET_x86 @BROKEN FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/cisco/airo.ko AUTOLOAD:=$(call AutoProbe,airo) endef @@ -162,645 +171,6 @@ define KernelPackage/airo/description Kernel support for Cisco Aironet cards endef -define KernelPackage/ath/config - if PACKAGE_kmod-ath - config ATH_USER_REGD - bool "Force Atheros drivers to respect the user's regdomain settings" - default y - help - Atheros' idea of regulatory handling is that the EEPROM of the card defines - the regulatory limits and the user is only allowed to restrict the settings - even further, even if the country allows frequencies or power levels that - are forbidden by the EEPROM settings. - - Select this option if you want the driver to respect the user's decision about - regulatory settings. - - config PACKAGE_ATH_DEBUG - bool "Atheros wireless debugging" - help - Say Y, if you want to debug atheros wireless drivers. - Only ath9k & ath10k make use of this. - - config PACKAGE_ATH_DFS - bool "Enable DFS support" - default y - help - Dynamic frequency selection (DFS) is required for most of the 5 GHz band - channels in Europe, US, and Japan. - - Select this option if you want to use such channels. - - config PACKAGE_ATH_SPECTRAL - bool "Atheros spectral scan support" - depends on PACKAGE_ATH_DEBUG - select KERNEL_RELAY - help - Say Y to enable access to the FFT/spectral data via debugfs. - - config PACKAGE_ATH_DYNACK - bool "Enable Dynack support" - depends on PACKAGE_kmod-ath9k-common - help - Enables support for Dynamic ACK estimation, which allows the fastest possible speed - at any distance automatically by increasing/decreasing the max frame ACK time for - the most remote station detected. It can be enabled by using iw (iw phy0 set distance auto), - or by sending the NL80211_ATTR_WIPHY_DYN_ACK flag to mac80211 driver using netlink. - - Select this option if you want to enable this feature - - endif -endef - -define KernelPackage/ath - $(call KernelPackage/mac80211/Default) - TITLE:=Atheros common driver part - DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx||TARGET_ath25 +kmod-mac80211 - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath.ko - MENU:=1 -endef - -define KernelPackage/ath/description - This module contains some common parts needed by Atheros Wireless drivers. -endef - -define KernelPackage/ath5k - $(call KernelPackage/mac80211/Default) - TITLE:=Atheros 5xxx wireless cards support - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath5k - DEPENDS+= @PCI_SUPPORT||@TARGET_ath25 +kmod-ath +@DRIVER_11W_SUPPORT - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath5k/ath5k.ko - AUTOLOAD:=$(call AutoProbe,ath5k) -endef - -define KernelPackage/ath5k/description - This module adds support for wireless adapters based on - Atheros 5xxx chipset. -endef - -define KernelPackage/ath6kl - $(call KernelPackage/mac80211/Default) - TITLE:=Atheros FullMAC wireless devices (common code for ath6kl_sdio and ath6kl_usb) - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath6kl - HIDDEN:=1 - DEPENDS+= +kmod-ath +@DRIVER_11N_SUPPORT - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath6kl/ath6kl_core.ko -endef - -define KernelPackage/ath6kl-sdio - $(call KernelPackage/mac80211/Default) - TITLE:=Atheros 802.11n SDIO wireless cards support - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath6kl - DEPENDS+= +kmod-mmc +kmod-ath6kl - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath6kl/ath6kl_sdio.ko - AUTOLOAD:=$(call AutoProbe,ath6kl_sdio) -endef - -define KernelPackage/ath6kl-sdio/description -This module adds support for wireless adapters based on -Atheros IEEE 802.11n AR6003 and AR6004 family of chipsets. -endef - -define KernelPackage/ath6kl-usb - $(call KernelPackage/mac80211/Default) - TITLE:=Atheros 802.11n USB wireless cards support - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath6kl - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-ath6kl - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath6kl/ath6kl_usb.ko - AUTOLOAD:=$(call AutoProbe,ath6kl_usb) -endef - -define KernelPackage/ath6kl-usb/description -This module adds support for wireless adapters based on the -Atheros IEEE 802.11n AR6004 chipset. -endef - -define KernelPackage/ath9k-common - $(call KernelPackage/mac80211/Default) - TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc) - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k - HIDDEN:=1 - DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT - FILES:= \ - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.ko -endef - -define KernelPackage/ath9k - $(call KernelPackage/mac80211/Default) - TITLE:=Atheros 802.11n PCI wireless cards support - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k - DEPENDS+= @PCI_SUPPORT||TARGET_ar71xx +kmod-ath9k-common - FILES:= \ - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k.ko - AUTOLOAD:=$(call AutoProbe,ath9k) -endef - -define KernelPackage/ath9k/description -This module adds support for wireless adapters based on -Atheros IEEE 802.11n AR5008 and AR9001 family of chipsets. -endef - -define KernelPackage/ath9k/config - - config ATH9K_SUPPORT_PCOEM - bool "Support chips used in PC OEM cards" - depends on PACKAGE_kmod-ath9k - - config ATH9K_TX99 - bool "Enable TX99 support (WARNING: testing only, breaks normal operation!)" - depends on PACKAGE_kmod-ath9k - - config ATH9K_UBNTHSR - bool "Support for Ubiquiti UniFi Outdoor+ access point" - depends on PACKAGE_kmod-ath9k && TARGET_ar71xx_generic - default y - -endef - -define KernelPackage/ath9k-htc - $(call KernelPackage/mac80211/Default) - TITLE:=Atheros 802.11n USB device support - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k - DEPENDS+= @USB_SUPPORT +kmod-ath9k-common +kmod-usb-core +ath9k-htc-firmware - FILES:= \ - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_htc.ko - AUTOLOAD:=$(call AutoProbe,ath9k_htc) -endef - -define KernelPackage/ath9k-htc/description -This module adds support for wireless adapters based on -Atheros USB AR9271 and AR7010 family of chipsets. -endef - -define KernelPackage/ath10k - $(call KernelPackage/mac80211/Default) - TITLE:=Atheros 802.11ac wireless cards support - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath10k - DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11W_SUPPORT - FILES:= \ - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko - AUTOLOAD:=$(call AutoProbe,ath10k_pci) -endef - -define KernelPackage/ath10k/description -This module adds support for wireless adapters based on -Atheros IEEE 802.11ac family of chipsets. For now only -PCI is supported. -endef - -#Broadcom firmware -ifneq ($(CONFIG_B43_FW_6_30),) - PKG_B43_FWV4_NAME:=broadcom-wl - PKG_B43_FWV4_VERSION:=6.30.163.46 - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).wl_apsta.o - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2 - PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/ - PKG_B43_FWV4_HASH:=a07c3b6b277833c7dbe61daa511f908cd66c5e2763eb7a0859abc36cd9335c2d -else -ifneq ($(CONFIG_B43_FW_5_10),) - PKG_B43_FWV4_NAME:=broadcom-wl - PKG_B43_FWV4_VERSION:=5.10.56.27.3 - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta/wl_prebuilt.o - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)_mipsel.tar.bz2 - PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/ - PKG_B43_FWV4_HASH:=26a8c370f48fc129d0731cfd751c36cae1419b0bc8ca35781126744e60eae009 -else -ifneq ($(CONFIG_B43_FW_4_178),) - PKG_B43_FWV4_NAME:=broadcom-wl - PKG_B43_FWV4_VERSION:=4.178.10.4 - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2 - PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/ - PKG_B43_FWV4_HASH:=32f6ad98facbb9045646fdc8b54bb03086d204153253f9c65d0234a5d90ae53f -else -ifneq ($(CONFIG_B43_FW_5_100_138),) - PKG_B43_FWV4_NAME:=broadcom-wl - PKG_B43_FWV4_VERSION:=5.100.138 - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2 - PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/ - PKG_B43_FWV4_HASH:=f1e7067aac5b62b67b8b6e4c517990277804339ac16065eb13c731ff909ae46f -else - PKG_B43_FWV4_NAME:=broadcom-wl - PKG_B43_FWV4_VERSION:=4.150.10.5 - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta_mimo.o - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2 - PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/ - PKG_B43_FWV4_HASH:=a9f4e276a4d8d3a1cd0f2eb87080ae89b77f0a7140f06d4e9e2135fc44fdd533 -endif -endif -endif -endif -ifneq ($(CONFIG_B43_OPENFIRMWARE),) - PKG_B43_FWV4_NAME:=broadcom-wl - PKG_B43_FWV4_VERSION:=5.2 - PKG_B43_FWV4_OBJECT:=openfwwf-$(PKG_B43_FWV4_VERSION) - PKG_B43_FWV4_SOURCE:=openfwwf-$(PKG_B43_FWV4_VERSION).tar.gz - PKG_B43_FWV4_SOURCE_URL:=http://netweb.ing.unibs.it/~openfwwf/firmware - PKG_B43_FWV4_HASH:=9de03320083201080b2e94b81637ac07a159cf4e6f3481383e1a217e627bc0dc -endif - - -define Download/b43 - FILE:=$(PKG_B43_FWV4_SOURCE) - URL:=$(PKG_B43_FWV4_SOURCE_URL) - HASH:=$(PKG_B43_FWV4_HASH) -endef -$(eval $(call Download,b43)) - -define KernelPackage/b43 - $(call KernelPackage/mac80211/Default) - TITLE:=Broadcom 43xx wireless support - URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43 - KCONFIG:= \ - CONFIG_HW_RANDOM=y - # Depend on PCI_SUPPORT to make sure we can select kmod-bcma or kmod-ssb - DEPENDS += \ - @PCI_SUPPORT +kmod-mac80211 \ - $(if $(CONFIG_PACKAGE_B43_USE_SSB),+kmod-ssb) \ - $(if $(CONFIG_PACKAGE_B43_USE_BCMA),+kmod-bcma) - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/b43/b43.ko - AUTOLOAD:=$(call AutoProbe,b43) - MENU:=1 -endef - -define KernelPackage/b43/config - -config PACKAGE_B43_USE_SSB - select PACKAGE_kmod-ssb - tristate - depends on !TARGET_brcm47xx && !TARGET_brcm63xx - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_SSB - -config PACKAGE_B43_USE_BCMA - select PACKAGE_kmod-bcma - tristate - depends on !TARGET_brcm47xx && !TARGET_bcm53xx - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA - - if PACKAGE_kmod-b43 - - choice - prompt "b43 firmware version" - default B43_FW_5_100_138 - help - This option allows you to select the version of the b43 firmware. - - config B43_FW_4_150 - bool "Firmware 410.2160 from driver 4.150.10.5 (old stable)" - help - Old stable firmware for BCM43xx devices. - - If unsure, select this. - - config B43_FW_4_178 - bool "Firmware 478.104 from driver 4.178.10.4" - help - Older firmware for BCM43xx devices. - - If unsure, select the "stable" firmware. - - config B43_FW_5_10 - bool "Firmware 508.1084 from driver 5.10.56.27" - help - Older firmware for BCM43xx devices. - - If unsure, select the "stable" firmware. - - config B43_FW_5_100_138 - bool "Firmware 666.2 from driver 5.100.138 (stable)" - help - The currently default firmware for BCM43xx devices. - - This firmware currently gets most of the testing and is needed for some N-PHY devices. - - If unsure, select the this firmware. - - config B43_FW_6_30 - bool "Firmware 784.2 from driver 6.30.163.46 (experimental)" - help - Newer experimental firmware for BCM43xx devices. - - This firmware is mostly untested. - - If unsure, select the "stable" firmware. - - config B43_OPENFIRMWARE - bool "Open FirmWare for WiFi networks" - help - Opensource firmware for BCM43xx devices. - - Do _not_ select this, unless you know what you are doing. - The Opensource firmware is not suitable for embedded devices, yet. - It does not support QoS, which is bad for AccessPoints. - It does not support hardware crypto acceleration, which is a showstopper - for embedded devices with low CPU resources. - - If unsure, select the "stable" firmware. - - endchoice - - config B43_FW_SQUASH - bool "Remove unnecessary firmware files" - depends on !B43_OPENFIRMWARE - default y - help - This options allows you to remove unnecessary b43 firmware files - from the final rootfs image. This can reduce the rootfs size by - up to 200k. - - If unsure, say Y. - - config B43_FW_SQUASH_COREREVS - string "Core revisions to include" - depends on B43_FW_SQUASH - default "5,6,7,8,9,10,11,13,15" if TARGET_brcm47xx_legacy - default "16,28,29,30" if TARGET_brcm47xx_mips74k - default "5,6,7,8,9,10,11,13,15,16,28,29,30" - help - This is a comma seperated list of core revision numbers. - - Example (keep files for rev5 only): - 5 - - Example (keep files for rev5 and rev11): - 5,11 - - config B43_FW_SQUASH_PHYTYPES - string "PHY types to include" - depends on B43_FW_SQUASH - default "G,N,LP" if TARGET_brcm47xx_legacy - default "N,HT" if TARGET_brcm47xx_mips74k - default "G,N,LP,HT" - help - This is a comma seperated list of PHY types: - A => A-PHY - AG => Dual A-PHY G-PHY - G => G-PHY - LP => LP-PHY - N => N-PHY - HT => HT-PHY - LCN => LCN-PHY - LCN40 => LCN40-PHY - AC => AC-PHY - - Example (keep files for G-PHY only): - G - - Example (keep files for G-PHY and N-PHY): - G,N - - choice - prompt "Supported buses" - default PACKAGE_B43_BUSES_BCMA_AND_SSB - help - This allows choosing buses that b43 should support. - - config PACKAGE_B43_BUSES_BCMA_AND_SSB - depends on !TARGET_brcm47xx_legacy && !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx - bool "BCMA and SSB" - - config PACKAGE_B43_BUSES_BCMA - depends on !TARGET_brcm47xx_legacy - bool "BCMA only" - - config PACKAGE_B43_BUSES_SSB - depends on !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx - bool "SSB only" - - endchoice - - config PACKAGE_B43_DEBUG - bool "Enable debug output and debugfs for b43" - default n - help - Enable additional debug output and runtime sanity checks for b43 - and enables the debugfs interface. - - If unsure, say N. - - config PACKAGE_B43_PIO - bool "Enable support for PIO transfer mode" - default n - help - Enable support for using PIO instead of DMA. Unless you have DMA - transfer problems you don't need this. - - If unsure, say N. - - config PACKAGE_B43_PHY_G - bool "Enable support for G-PHYs" - default n if TARGET_brcm47xx_mips74k - default y - help - Enable support for G-PHY. This includes support for the following devices: - PCI: BCM4306, BCM4311, BCM4318 - SoC: BCM5352E, BCM4712 - - If unsure, say Y. - - config PACKAGE_B43_PHY_N - bool "Enable support for N-PHYs" - default y - help - Enable support for N-PHY. This includes support for the following devices: - PCI: BCM4321, BCM4322, BCM43222, BCM43224, BCM43225 - SoC: BCM4716, BCM4717, BCM4718 - - Currently only 11g speed is available. - - If unsure, say Y. - - config PACKAGE_B43_PHY_LP - bool "Enable support for LP-PHYs" - default n if TARGET_brcm47xx_mips74k - default y - help - Enable support for LP-PHY. This includes support for the following devices: - PCI: BCM4312 - SoC: BCM5354 - - If unsure, say Y. - - config PACKAGE_B43_PHY_HT - bool "Enable support for HT-PHYs" - default n if TARGET_brcm47xx_legacy - default y - help - Enable support for HT-PHY. This includes support for the following devices: - PCI: BCM4331 - - Currently only 11g speed is available. - - If unsure, say Y. - - config PACKAGE_B43_PHY_LCN - bool "Enable support for LCN-PHYs" - depends on BROKEN - default n - help - Currently broken. - - If unsure, say N. - - endif -endef - -define KernelPackage/b43/description -Kernel module for Broadcom 43xx wireless support (mac80211 stack) new -endef - -define KernelPackage/b43legacy - $(call KernelPackage/mac80211/Default) - TITLE:=Broadcom 43xx-legacy wireless support - URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43 - KCONFIG:= \ - CONFIG_HW_RANDOM=y - DEPENDS+= +kmod-mac80211 +!(TARGET_brcm47xx||TARGET_brcm63xx):kmod-ssb +b43legacy-firmware - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/b43legacy/b43legacy.ko - AUTOLOAD:=$(call AutoProbe,b43legacy) - MENU:=1 -endef - -define KernelPackage/b43legacy/description -Kernel module for Broadcom 43xx-legacy wireless support (mac80211 stack) new -endef - - -define KernelPackage/brcmutil - $(call KernelPackage/mac80211/Default) - TITLE:=Broadcom IEEE802.11n common driver parts - URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211 - DEPENDS+=@PCI_SUPPORT||USB_SUPPORT - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/brcm80211/brcmutil/brcmutil.ko - AUTOLOAD:=$(call AutoProbe,brcmutil) - MENU:=1 -endef - -define KernelPackage/brcmutil/description - This module contains some common parts needed by Broadcom Wireless drivers brcmsmac and brcmfmac. -endef - -define KernelPackage/brcmutil/config - if PACKAGE_kmod-brcmutil - - config PACKAGE_BRCM80211_DEBUG - bool "Broadcom wireless driver debugging" - help - Say Y, if you want to debug brcmsmac and brcmfmac wireless driver. - - endif -endef - -PKG_BRCMSMAC_FW_NAME:=broadcom-wl -PKG_BRCMSMAC_FW_VERSION:=5.100.138 -PKG_BRCMSMAC_FW_OBJECT:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION)/linux/wl_apsta.o -PKG_BRCMSMAC_FW_SOURCE:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION).tar.bz2 -PKG_BRCMSMAC_FW_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/ -PKG_BRCMSMAC_FW_HASH:=f1e7067aac5b62b67b8b6e4c517990277804339ac16065eb13c731ff909ae46f - -define Download/brcmsmac - FILE:=$(PKG_BRCMSMAC_FW_SOURCE) - URL:=$(PKG_BRCMSMAC_FW_SOURCE_URL) - HASH:=$(PKG_BRCMSMAC_FW_HASH) -endef -$(eval $(call Download,brcmsmac)) - -define KernelPackage/brcmsmac - $(call KernelPackage/mac80211/Default) - TITLE:=Broadcom IEEE802.11n PCIe SoftMAC WLAN driver - URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211 - DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT +!TARGET_brcm47xx:kmod-bcma +kmod-lib-cordic +kmod-lib-crc8 +kmod-brcmutil +!BRCMSMAC_USE_FW_FROM_WL:brcmsmac-firmware - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcmsmac.ko - AUTOLOAD:=$(call AutoProbe,brcmsmac) - MENU:=1 -endef - -define KernelPackage/brcmsmac/description - Kernel module for Broadcom IEEE802.11n PCIe Wireless cards -endef - -define KernelPackage/brcmsmac/config - if PACKAGE_kmod-brcmsmac - - config BRCMSMAC_USE_FW_FROM_WL - bool "Use firmware extracted from broadcom proprietary driver" - default y - help - Instead of using the official brcmsmac firmware a firmware - version 666.2 extracted from the proprietary Broadcom driver - is used. This is needed to get core rev 17 used in bcm4716 - to work. - - If unsure, say Y. - - endif -endef - - -define KernelPackage/brcmfmac - $(call KernelPackage/mac80211/Default) - TITLE:=Broadcom IEEE802.11n USB FullMAC WLAN driver - URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211 - DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +kmod-brcmutil \ - +BRCMFMAC_SDIO:kmod-mmc @!TARGET_uml \ - +BRCMFMAC_USB:kmod-usb-core +BRCMFMAC_USB:brcmfmac-firmware-usb - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko - AUTOLOAD:=$(call AutoProbe,brcmfmac) -endef - -define KernelPackage/brcmfmac/description - Kernel module for Broadcom IEEE802.11n USB Wireless cards -endef - -define KernelPackage/brcmfmac/config - if PACKAGE_kmod-brcmfmac - - config BRCMFMAC_SDIO - bool "Enable SDIO bus interface support" - default y if TARGET_brcm2708 - default y if TARGET_sunxi - default n - help - Enable support for cards attached to an SDIO bus. - Select this option only if you are sure that your - board has a Broadcom wireless chip atacched to - that bus. - - config BRCMFMAC_USB - bool "Enable USB bus interface support" - depends on USB_SUPPORT - default y - help - Supported USB connected chipsets: - BCM43235, BCM43236, BCM43238 (all in revision 3 only) - BCM43143, BCM43242, BCM43566, BCM43569 - - config BRCMFMAC_PCIE - bool "Enable PCIE bus interface support" - depends on PCI_SUPPORT - default y - help - Supported PCIe connected chipsets: - BCM4354, BCM4356, BCM43567, BCM43570, BCM43602 - - endif -endef - - -define KernelPackage/carl9170 - $(call KernelPackage/mac80211/Default) - TITLE:=Driver for Atheros AR9170 USB sticks - DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core +@DRIVER_11N_SUPPORT +carl9170-firmware - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170/carl9170.ko - AUTOLOAD:=$(call AutoProbe,carl9170) -endef - - define KernelPackage/hermes $(call KernelPackage/mac80211/Default) TITLE:=Hermes 802.11b chipset support @@ -840,7 +210,7 @@ endef define KernelPackage/hermes-pcmcia $(call KernelPackage/mac80211/Default) TITLE:=Hermes based PCMCIA adaptors - DEPENDS:=@PCMCIA_SUPPORT +kmod-hermes @BROKEN + DEPENDS:=@PCMCIA_SUPPORT +kmod-hermes +kmod-pcmcia-core FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/orinoco/orinoco_cs.ko AUTOLOAD:=$(call AutoProbe,orinoco_cs) endef @@ -850,118 +220,10 @@ define KernelPackage/hermes-pcmcia/description endef -define KernelPackage/iwlwifi - $(call KernelPackage/mac80211/Default) - DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT @!LINUX_3_18 - TITLE:=Intel AGN Wireless support - FILES:= \ - $(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/dvm/iwldvm.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/mvm/iwlmvm.ko - AUTOLOAD:=$(call AutoProbe,iwlwifi iwldvm iwlmvm) - MENU:=1 -endef - -define KernelPackage/iwlwifi/description - iwlwifi kernel module for - Intel Wireless WiFi Link 6250AGN Adapter - Intel 6000 Series Wi-Fi Adapters (6200AGN and 6300AGN) - Intel WiFi Link 1000BGN - Intel Wireless WiFi 5150AGN - Intel Wireless WiFi 5100AGN, 5300AGN, and 5350AGN - Intel 6005 Series Wi-Fi Adapters - Intel 6030 Series Wi-Fi Adapters - Intel Wireless WiFi Link 6150BGN 2 Adapter - Intel 100 Series Wi-Fi Adapters (100BGN and 130BGN) - Intel 2000 Series Wi-Fi Adapters - Intel 7260 Wi-Fi Adapter - Intel 3160 Wi-Fi Adapter - Intel 7265 Wi-Fi Adapter - Intel 8260 Wi-Fi Adapter - Intel 3165 Wi-Fi Adapter -endef - -define KernelPackage/iwlwifi/config - if PACKAGE_kmod-iwlwifi - - config PACKAGE_IWLWIFI_DEBUG - bool "Enable full debugging output in the iwlwifi driver" - default n - help - This option will enable debug tracing output for the iwlwifi drivers - - This will result in the kernel module being ~100k larger. You can - control which debug output is sent to the kernel log by setting the - value in - - /sys/module/iwlwifi/parameters/debug - - This entry will only exist if this option is enabled. - - To set a value, simply echo an 8-byte hex value to the same file: - - % echo 0x43fff > /sys/module/iwlwifi/parameters/debug - - You can find the list of debug mask values in: - drivers/net/wireless/intel/iwlwifi/iwl-debug.h - - If this is your first time using this driver, you should say Y here - as the debug information can assist others in helping you resolve - any problems you may encounter. - - config PACKAGE_IWLWIFI_DEBUGFS - bool "iwlwifi debugfs support" - depends on PACKAGE_MAC80211_DEBUGFS - default n - help - Enable creation of debugfs files for the iwlwifi drivers. This - is a low-impact option that allows getting insight into the - driver's state at runtime. - - endif -endef - -define KernelPackage/iwl-legacy - $(call KernelPackage/mac80211/Default) - DEPENDS:= +kmod-mac80211 @PCI_SUPPORT - TITLE:=Intel legacy Wireless support - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlegacy/iwlegacy.ko - AUTOLOAD:=$(call AutoProbe,iwlegacy) -endef - -define KernelPackage/iwl-legacy/description - iwl-legacy kernel module for legacy Intel wireless support -endef - -define KernelPackage/iwl3945 - $(call KernelPackage/mac80211/Default) - DEPENDS:= +kmod-mac80211 +kmod-iwl-legacy +iwl3945-firmware - TITLE:=Intel iwl3945 Wireless support - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlegacy/iwl3945.ko - AUTOLOAD:=$(call AutoProbe,iwl3945) -endef - -define KernelPackage/iwl3945/description - iwl3945 kernel module for Intel 3945 support -endef - -define KernelPackage/iwl4965 - $(call KernelPackage/mac80211/Default) - DEPENDS:= +kmod-mac80211 +kmod-iwl-legacy +@DRIVER_11N_SUPPORT +iwl4965-firmware - TITLE:=Intel iwl4965 Wireless support - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlegacy/iwl4965.ko - AUTOLOAD:=$(call AutoProbe,iwl4965) -endef - -define KernelPackage/iwl4965/description - iwl4965 kernel module for Intel 4965 support -endef - - define KernelPackage/lib80211 $(call KernelPackage/mac80211/Default) TITLE:=802.11 Networking stack - DEPENDS:=+kmod-cfg80211 +kmod-crypto-hash + DEPENDS:=+kmod-cfg80211 +kmod-crypto-hash +kmod-crypto-ccm FILES:= \ $(PKG_BUILD_DIR)/net/wireless/lib80211.ko \ $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \ @@ -985,109 +247,6 @@ define KernelPackage/lib80211/description endef -define KernelPackage/libipw - $(call KernelPackage/mac80211/Default) - TITLE:=libipw for ipw2100 and ipw2200 - DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-crypto-ecb +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN @!LINUX_3_18 - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/libipw.ko - AUTOLOAD:=$(call AutoProbe,libipw) -endef - -define KernelPackage/libipw/description - Hardware independent IEEE 802.11 networking stack for ipw2100 and ipw2200. -endef - -IPW2100_NAME:=ipw2100-fw -IPW2100_VERSION:=1.3 - -define Download/ipw2100 - URL:= \ - https://src.fedoraproject.org/repo/pkgs/ipw2100-firmware/ipw2100-fw-1.3.tgz/46aa75bcda1a00efa841f9707bbbd113/ \ - https://archlinux.mirror.pkern.at/other/packages/ipw2100-fw/ \ - http://mirror.ox.ac.uk/sites/ftp.openbsd.org/pub/OpenBSD/distfiles/firmware/ \ - http://firmware.openbsd.org/firmware-dist/ - FILE:=$(IPW2100_NAME)-$(IPW2100_VERSION).tgz - HASH:=e1107c455e48d324a616b47a622593bc8413dcce72026f72731c0b03dae3a7a2 -endef -$(eval $(call Download,ipw2100)) - -define KernelPackage/ipw2100 - $(call KernelPackage/mac80211/Default) - TITLE:=Intel IPW2100 driver - DEPENDS:=@PCI_SUPPORT +kmod-libipw - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/ipw2100.ko - AUTOLOAD:=$(call AutoProbe,ipw2100) -endef - -define KernelPackage/ipw2100/description - Kernel support for Intel IPW2100 - Includes: - - ipw2100 -endef - -IPW2200_NAME:=ipw2200-fw -IPW2200_VERSION:=3.1 - -define Download/ipw2200 - URL:= \ - https://src.fedoraproject.org/repo/pkgs/ipw2200-firmware/ipw2200-fw-3.1.tgz/eaba788643c7cc7483dd67ace70f6e99/ \ - https://archlinux.mirror.pkern.at/other/packages/ipw2200-fw/ \ - http://mirror.ox.ac.uk/sites/ftp.openbsd.org/pub/OpenBSD/distfiles/firmware/ \ - http://firmware.openbsd.org/firmware-dist/ - FILE:=$(IPW2200_NAME)-$(IPW2200_VERSION).tgz - HASH:=c6818c11c18cc030d55ff83f64b2bad8feef485e7742f84f94a61d811a6258bd -endef -$(eval $(call Download,ipw2200)) - -define KernelPackage/ipw2200 - $(call KernelPackage/mac80211/Default) - TITLE:=Intel IPW2200 driver - DEPENDS:=@PCI_SUPPORT +kmod-libipw - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/ipw2200.ko - AUTOLOAD:=$(call AutoProbe,ipw2200) -endef - -define KernelPackage/ipw2200/description - Kernel support for Intel IPW2200 - Includes: - - ipw2200 -endef - - -define KernelPackage/libertas-usb - $(call KernelPackage/mac80211/Default) - DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +kmod-usb-core +kmod-lib80211 +@DRIVER_WEXT_SUPPORT +libertas-usb-firmware @!LINUX_3_18 - TITLE:=Marvell 88W8015 Wireless Driver - FILES:= \ - $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/usb8xxx.ko - AUTOLOAD:=$(call AutoProbe,libertas usb8xxx) -endef - -define KernelPackage/libertas-sdio - $(call KernelPackage/mac80211/Default) - DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +kmod-mmc +@DRIVER_WEXT_SUPPORT @!TARGET_uml +libertas-sdio-firmware @!LINUX_3_18 - TITLE:=Marvell 88W8686 Wireless Driver - FILES:= \ - $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas_sdio.ko - AUTOLOAD:=$(call AutoProbe,libertas libertas_sdio) -endef - -define KernelPackage/libertas-spi - $(call KernelPackage/mac80211/Default) - SUBMENU:=Wireless Drivers - DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT @!TARGET_uml +libertas-spi-firmware @!LINUX_3_18 - KCONFIG := \ - CONFIG_SPI=y \ - CONFIG_SPI_MASTER=y - TITLE:=Marvell 88W8686 SPI Wireless Driver - FILES:= \ - $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas_spi.ko - AUTOLOAD:=$(call AutoProbe,libertas libertas_spi) -endef - define KernelPackage/mac80211-hwsim $(call KernelPackage/mac80211/Default) TITLE:=mac80211 HW simulation device @@ -1100,56 +259,11 @@ endef define KernelPackage/mt7601u $(call KernelPackage/mac80211/Default) TITLE:=MT7601U-based USB dongles Wireless Driver - DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT @USB_SUPPORT +kmod-usb-core +mt7601u-firmware + DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT @USB_SUPPORT +kmod-usb-core +mt7601u-firmware FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mediatek/mt7601u/mt7601u.ko AUTOLOAD:=$(call AutoProbe,mt7601u) endef - -define KernelPackage/mwl8k - $(call KernelPackage/mac80211/Default) - TITLE:=Driver for Marvell TOPDOG 802.11 Wireless cards - URL:=https://wireless.wiki.kernel.org/en/users/drivers/mwl8k - DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT +mwl8k-firmware - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwl8k.ko - AUTOLOAD:=$(call AutoProbe,mwl8k) -endef - -define KernelPackage/mwl8k/description - Kernel modules for Marvell TOPDOG 802.11 Wireless cards -endef - - -define KernelPackage/mwifiex-pcie - $(call KernelPackage/mac80211/Default) - TITLE:=Driver for Marvell 802.11n/802.11ac PCIe Wireless cards - URL:=https://wireless.wiki.kernel.org/en/users/drivers/mwifiex - DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +mwifiex-pcie-firmware - FILES:= \ - $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwifiex/mwifiex.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwifiex/mwifiex_pcie.ko - AUTOLOAD:=$(call AutoProbe,mwifiex_pcie) -endef - -define KernelPackage/mwifiex-pcie/description - Kernel modules for Marvell 802.11n/802.11ac PCIe Wireless cards -endef - -define KernelPackage/mwifiex-sdio - $(call KernelPackage/mac80211/Default) - TITLE:=Driver for Marvell 802.11n/802.11ac SDIO Wireless cards - URL:=https://wireless.wiki.kernel.org/en/users/drivers/mwifiex - DEPENDS+= +kmod-mmc +kmod-mac80211 +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +mwifiex-sdio-firmware - FILES:= \ - $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwifiex/mwifiex.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwifiex/mwifiex_sdio.ko - AUTOLOAD:=$(call AutoProbe,mwifiex_sdio) -endef - -define KernelPackage/mwifiex-sdio/description - Kernel modules for Marvell 802.11n/802.11ac SDIO Wireless cards -endef - define KernelPackage/p54/Default $(call KernelPackage/mac80211/Default) TITLE:=Prism54 Drivers @@ -1161,7 +275,7 @@ endef define KernelPackage/p54-common $(call KernelPackage/p54/Default) - DEPENDS+= @PCI_SUPPORT||@USB_SUPPORT||@TARGET_omap24xx +kmod-mac80211 +kmod-lib-crc-ccitt + DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT) +kmod-mac80211 +kmod-lib-crc-ccitt +@DRIVER_11W_SUPPORT TITLE+= (COMMON) FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54common.ko endef @@ -1182,25 +296,17 @@ define KernelPackage/p54-usb AUTOLOAD:=$(call AutoProbe,p54usb) endef -define KernelPackage/p54-spi - $(call KernelPackage/p54/Default) - TITLE+= (SPI) - DEPENDS+= @TARGET_omap24xx +kmod-p54-common +p54-spi-firmware - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54spi.ko - AUTOLOAD:=$(call AutoProbe,p54spi) -endef - define KernelPackage/rsi91x $(call KernelPackage/mac80211/Default) TITLE:=Redpine Signals Inc 91x WLAN driver support - DEPENDS+= +kmod-mac80211 +rs9113-firmware + DEPENDS+= +kmod-mac80211 +rs9113-firmware +@DRIVER_11N_SUPPORT FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rsi/rsi_91x.ko endef define KernelPackage/rsi91x-usb $(call KernelPackage/mac80211/Default) TITLE:=Redpine Signals USB bus support - DEPENDS+= +kmod-mac80211 +kmod-usb2 +kmod-rsi91x +rs9113-firmware + DEPENDS+=@USB_SUPPORT +kmod-usb-core +kmod-mac80211 +kmod-rsi91x +rs9113-firmware FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rsi/rsi_usb.ko AUTOLOAD:=$(call AutoProbe,rsi_usb) endef @@ -1214,297 +320,6 @@ define KernelPackage/rsi91x-sdio endef - -define KernelPackage/rt2x00/Default - $(call KernelPackage/mac80211/Default) - TITLE:=Ralink Drivers for RT2x00 cards -endef - -define KernelPackage/rt2x00-lib -$(call KernelPackage/rt2x00/Default) - DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-mac80211 +kmod-lib-crc-itu-t - TITLE+= (LIB) - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2x00lib.ko - MENU:=1 -endef - -define KernelPackage/rt2x00-lib/config - if PACKAGE_kmod-rt2x00-lib - - config PACKAGE_RT2X00_LIB_DEBUGFS - bool "Enable rt2x00 debugfs support" - depends on PACKAGE_MAC80211_DEBUGFS - help - Enable creation of debugfs files for the rt2x00 drivers. - These debugfs files support both reading and writing of the - most important register types of the rt2x00 hardware. - - config PACKAGE_RT2X00_DEBUG - bool "Enable rt2x00 debug output" - help - Enable debugging output for all rt2x00 modules - - endif -endef - -define KernelPackage/rt2x00-mmio -$(call KernelPackage/rt2x00/Default) - DEPENDS+= @(PCI_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-eeprom-93cx6 - HIDDEN:=1 - TITLE+= (MMIO) - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2x00mmio.ko -endef - -define KernelPackage/rt2x00-pci -$(call KernelPackage/rt2x00/Default) - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-mmio +kmod-rt2x00-lib - HIDDEN:=1 - TITLE+= (PCI) - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2x00pci.ko - AUTOLOAD:=$(call AutoProbe,rt2x00pci) -endef - -define KernelPackage/rt2x00-usb -$(call KernelPackage/rt2x00/Default) - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-lib +kmod-usb-core - HIDDEN:=1 - TITLE+= (USB) - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2x00usb.ko - AUTOLOAD:=$(call AutoProbe,rt2x00usb) -endef - -define KernelPackage/rt2800-lib -$(call KernelPackage/rt2x00/Default) - DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-lib-crc-ccitt +@DRIVER_11N_SUPPORT - HIDDEN:=1 - TITLE+= (rt2800 LIB) - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800lib.ko -endef - -define KernelPackage/rt2400-pci -$(call KernelPackage/rt2x00/Default) - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci - TITLE+= (RT2400 PCI) - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2400pci.ko - AUTOLOAD:=$(call AutoProbe,rt2400pci) -endef - -define KernelPackage/rt2500-pci -$(call KernelPackage/rt2x00/Default) - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci - TITLE+= (RT2500 PCI) - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2500pci.ko - AUTOLOAD:=$(call AutoProbe,rt2500pci) -endef - -define KernelPackage/rt2500-usb -$(call KernelPackage/rt2x00/Default) - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb - TITLE+= (RT2500 USB) - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2500usb.ko - AUTOLOAD:=$(call AutoProbe,rt2500usb) -endef - -define KernelPackage/rt2800-mmio -$(call KernelPackage/rt2x00/Default) - TITLE += (RT28xx/RT3xxx MMIO) - DEPENDS += +kmod-rt2800-lib +kmod-rt2x00-mmio - HIDDEN:=1 - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800mmio.ko -endef - -define KernelPackage/rt2800-soc -$(call KernelPackage/rt2x00/Default) - DEPENDS += @(TARGET_ramips_rt288x||TARGET_ramips_rt305x||TARGET_ramips_rt3883||TARGET_ramips_mt7620) +kmod-rt2800-mmio +kmod-rt2800-lib - TITLE += (RT28xx/RT3xxx SoC) - FILES := \ - $(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2x00soc.ko \ - $(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800soc.ko - AUTOLOAD:=$(call AutoProbe,rt2800soc) -endef - -define KernelPackage/rt2800-pci -$(call KernelPackage/rt2x00/Default) - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci +kmod-rt2800-lib +kmod-rt2800-mmio +rt2800-pci-firmware - TITLE+= (RT2860 PCI) - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800pci.ko - AUTOLOAD:=$(call AutoProbe,rt2800pci) -endef - -define KernelPackage/rt2800-usb -$(call KernelPackage/rt2x00/Default) - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb +kmod-rt2800-lib +kmod-lib-crc-ccitt +rt2800-usb-firmware - TITLE+= (RT2870 USB) - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800usb.ko - AUTOLOAD:=$(call AutoProbe,rt2800usb) -endef - - -define KernelPackage/rt61-pci -$(call KernelPackage/rt2x00/Default) - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci +rt61-pci-firmware - TITLE+= (RT2x61 PCI) - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt61pci.ko - AUTOLOAD:=$(call AutoProbe,rt61pci) -endef - -define KernelPackage/rt73-usb - $(call KernelPackage/rt2x00/Default) - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb +rt73-usb-firmware - TITLE+= (RT73 USB) - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt73usb.ko - AUTOLOAD:=$(call AutoProbe,rt73usb) -endef - - -define KernelPackage/rtl818x/Default - $(call KernelPackage/mac80211/Default) - TITLE:=Realtek Drivers for RTL818x devices - URL:=https://wireless.wiki.kernel.org/en/users/drivers/rtl8187 - DEPENDS+= +kmod-eeprom-93cx6 +kmod-mac80211 -endef - -define KernelPackage/rtl8180 - $(call KernelPackage/rtl818x/Default) - DEPENDS+= @PCI_SUPPORT - TITLE+= (RTL8180 PCI) - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtl818x/rtl8180/rtl818x_pci.ko - AUTOLOAD:=$(call AutoProbe,rtl818x_pci) -endef - -define KernelPackage/rtl8187 -$(call KernelPackage/rtl818x/Default) - DEPENDS+= @USB_SUPPORT +kmod-usb-core - TITLE+= (RTL8187 USB) - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8187.ko - AUTOLOAD:=$(call AutoProbe,rtl8187) -endef - -define KernelPackage/rtlwifi/config - config PACKAGE_RTLWIFI_DEBUG - bool "Realtek wireless debugging" - depends on PACKAGE_kmod-rtlwifi - help - Say Y, if you want to debug realtek wireless drivers. - -endef - -define KernelPackage/rtlwifi - $(call KernelPackage/mac80211/Default) - TITLE:=Realtek common driver part - DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT) +kmod-mac80211 +@DRIVER_11N_SUPPORT - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtlwifi.ko - HIDDEN:=1 -endef - -define KernelPackage/rtlwifi-pci - $(call KernelPackage/mac80211/Default) - TITLE:=Realtek common driver part (PCI support) - DEPENDS+= @PCI_SUPPORT +kmod-rtlwifi - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl_pci.ko - AUTOLOAD:=$(call AutoProbe,rtl_pci) - HIDDEN:=1 -endef - -define KernelPackage/rtlwifi-btcoexist - $(call KernelPackage/mac80211/Default) - TITLE:=Realtek BT coexist support - DEPENDS+= +kmod-rtlwifi - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/btcoexist/btcoexist.ko - AUTOLOAD:=$(call AutoProbe,btcoexist) - HIDDEN:=1 -endef - -define KernelPackage/rtlwifi-usb - $(call KernelPackage/mac80211/Default) - TITLE:=Realtek common driver part (USB support) - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-rtlwifi - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl_usb.ko - AUTOLOAD:=$(call AutoProbe,rtl_usb) - HIDDEN:=1 -endef - -define KernelPackage/rtl8192c-common - $(call KernelPackage/mac80211/Default) - TITLE:=Realtek RTL8192CE/RTL8192CU common support module - DEPENDS+= +kmod-rtlwifi - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8192c/rtl8192c-common.ko - HIDDEN:=1 -endef - -define KernelPackage/rtl8192ce - $(call KernelPackage/mac80211/Default) - TITLE:=Realtek RTL8192CE/RTL8188CE support - DEPENDS+= +kmod-rtlwifi-pci +kmod-rtl8192c-common +rtl8192ce-firmware - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/rtl8192ce.ko - AUTOLOAD:=$(call AutoProbe,rtl8192ce) -endef - -define KernelPackage/rtl8192se - $(call KernelPackage/mac80211/Default) - TITLE:=Realtek RTL8192SE/RTL8191SE support - DEPENDS+= +kmod-rtlwifi-pci +rtl8192se-firmware - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8192se/rtl8192se.ko - AUTOLOAD:=$(call AutoProbe,rtl8192se) -endef - -define KernelPackage/rtl8192de - $(call KernelPackage/mac80211/Default) - TITLE:=Realtek RTL8192DE/RTL8188DE support - DEPENDS+= +kmod-rtlwifi-pci +rtl8192de-firmware - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8192de/rtl8192de.ko - AUTOLOAD:=$(call AutoProbe,rtl8192de) -endef - -define KernelPackage/rtl8192cu - $(call KernelPackage/mac80211/Default) - TITLE:=Realtek RTL8192CU/RTL8188CU support - DEPENDS+= +kmod-rtlwifi-usb +kmod-rtl8192c-common +rtl8192cu-firmware - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/rtl8192cu.ko - AUTOLOAD:=$(call AutoProbe,rtl8192cu) -endef - -define KernelPackage/rtl8821ae - $(call KernelPackage/mac80211/Default) - TITLE:=Realtek RTL8821AE support - DEPENDS+= +kmod-rtlwifi-btcoexist +kmod-rtlwifi-pci +rtl8821ae-firmware - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/rtl8821ae.ko - AUTOLOAD:=$(call AutoProbe,rtl8821ae) -endef - -define KernelPackage/rtl8xxxu - $(call KernelPackage/mac80211/Default) - TITLE:=alternative Realtek RTL8XXXU support - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-mac80211 - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.ko - AUTOLOAD:=$(call AutoProbe,rtl8xxxu) -endef - -define KernelPackage/rtl8xxxu/description - This is an alternative driver for various Realtek RTL8XXX - parts written to utilize the Linux mac80211 stack. - The driver is known to work with a number of RTL8723AU, - RL8188CU, RTL8188RU, RTL8191CU, and RTL8192CU devices - - This driver is under development and has a limited feature - set. In particular it does not yet support 40MHz channels - and power management. However it should have a smaller - memory footprint than the vendor drivers and benetifs - from the in kernel mac80211 stack. - - It can coexist with drivers from drivers/staging/rtl8723au, - drivers/staging/rtl8192u, and drivers/net/wireless/rtlwifi, - but you will need to control which module you wish to load. - - RTL8XXXU_UNTESTED is enabled - This option enables detection of Realtek 8723/8188/8191/8192 WiFi - USB devices which have not been tested directly by the driver - author or reported to be working by third parties. - - Please report your results! -endef - - define KernelPackage/wlcore $(call KernelPackage/mac80211/Default) TITLE:=TI common driver part @@ -1558,63 +373,19 @@ $(eval $(call Download,zd1211rw)) define KernelPackage/zd1211rw $(call KernelPackage/mac80211/Default) TITLE:=Zydas ZD1211 support - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-mac80211 + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-mac80211 +@DRIVER_11W_SUPPORT FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/zydas/zd1211rw/zd1211rw.ko AUTOLOAD:=$(call AutoProbe,zd1211rw) endef - - -config_package=$(if $(CONFIG_PACKAGE_kmod-$(1)),m) - -config-y:= \ - WLAN \ - NL80211_TESTMODE \ - CFG80211_WEXT \ - CFG80211_CERTIFICATION_ONUS \ - MAC80211_RC_MINSTREL \ - MAC80211_RC_MINSTREL_HT \ - MAC80211_RC_MINSTREL_VHT \ - MAC80211_RC_DEFAULT_MINSTREL \ - WLAN_VENDOR_ADMTEK \ - WLAN_VENDOR_ATH \ - WLAN_VENDOR_ATMEL \ - WLAN_VENDOR_BROADCOM \ - WLAN_VENDOR_CISCO \ - WLAN_VENDOR_INTEL \ - WLAN_VENDOR_INTERSIL \ - WLAN_VENDOR_MARVELL \ - WLAN_VENDOR_MEDIATEK \ - WLAN_VENDOR_RALINK \ - WLAN_VENDOR_REALTEK \ - WLAN_VENDOR_RSI \ - WLAN_VENDOR_ST \ - WLAN_VENDOR_TI \ - WLAN_VENDOR_ZYDAS \ - -config-$(call config_package,cfg80211) += CFG80211 - -config-$(call config_package,mac80211) += MAC80211 -config-$(CONFIG_PACKAGE_MAC80211_MESH) += MAC80211_MESH ifdef CONFIG_PACKAGE_MAC80211_DEBUGFS config-y += \ CFG80211_DEBUGFS \ - MAC80211_DEBUGFS \ - ATH9K_DEBUGFS \ - ATH9K_HTC_DEBUGFS \ - ATH10K_DEBUGFS \ - CARL9170_DEBUGFS \ - ATH5K_DEBUG \ - ATH6KL_DEBUG + MAC80211_DEBUGFS endif ifdef CONFIG_PACKAGE_MAC80211_TRACING config-y += \ - ATH10K_TRACING \ - ATH6KL_TRACING \ - ATH_TRACEPOINTS \ - WIL6210_TRACING \ - ATH5K_TRACER \ IWLWIFI_DEVICE_TRACING endif @@ -1622,100 +393,13 @@ config-$(call config_package,lib80211) += LIB80211 LIB80211_CRYPT_WEP LIB80211_C config-$(call config_package,airo) += AIRO -config-$(call config_package,ath) += ATH_CARDS ATH_COMMON ATH_REG_DYNAMIC_USER_REG_HINTS -config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH10K_DEBUG ATH9K_STATION_STATISTICS -config-$(CONFIG_PACKAGE_ATH_DFS) += ATH9K_DFS_CERTIFIED ATH10K_DFS_CERTIFIED -config-$(CONFIG_PACKAGE_ATH_SPECTRAL) += ATH9K_COMMON_SPECTRAL ATH10K_SPECTRAL -config-$(CONFIG_PACKAGE_ATH_DYNACK) += ATH9K_DYNACK -config-$(call config_package,ath9k) += ATH9K -config-$(call config_package,ath9k-common) += ATH9K_COMMON -config-$(CONFIG_TARGET_ar71xx) += ATH9K_AHB -config-$(CONFIG_TARGET_ipq40xx) += ATH10K_AHB -config-$(CONFIG_PCI) += ATH9K_PCI -config-$(CONFIG_ATH_USER_REGD) += ATH_USER_REGD -config-$(CONFIG_ATH9K_SUPPORT_PCOEM) += ATH9K_PCOEM -config-$(CONFIG_ATH9K_TX99) += ATH9K_TX99 -config-$(CONFIG_ATH9K_UBNTHSR) += ATH9K_UBNTHSR - -config-$(call config_package,ath9k-htc) += ATH9K_HTC -config-$(call config_package,ath10k) += ATH10K ATH10K_PCI - -config-$(call config_package,ath5k) += ATH5K -ifdef CONFIG_TARGET_ath25 - config-y += ATH5K_AHB -else - config-y += ATH5K_PCI -endif - -config-$(call config_package,ath6kl) += ATH6KL -config-$(call config_package,ath6kl-sdio) += ATH6KL_SDIO -config-$(call config_package,ath6kl-usb) += ATH6KL_USB - -config-$(call config_package,carl9170) += CARL9170 - -config-$(call config_package,b43) += B43 -config-$(CONFIG_PACKAGE_B43_BUSES_BCMA_AND_SSB) += B43_BUSES_BCMA_AND_SSB -config-$(CONFIG_PACKAGE_B43_BUSES_BCMA) += B43_BUSES_BCMA -config-$(CONFIG_PACKAGE_B43_BUSES_SSB) += B43_BUSES_SSB -config-$(CONFIG_PACKAGE_B43_PHY_G) += B43_PHY_G -config-$(CONFIG_PACKAGE_B43_PHY_N) += B43_PHY_N -config-$(CONFIG_PACKAGE_B43_PHY_LP) += B43_PHY_LP -config-$(CONFIG_PACKAGE_B43_PHY_HT) += B43_PHY_HT -config-$(CONFIG_PACKAGE_B43_PIO) += B43_PIO -config-$(CONFIG_PACKAGE_B43_DEBUG) += B43_DEBUG - -config-$(call config_package,b43legacy) += B43LEGACY -config-y += B43LEGACY_DMA_MODE - -config-$(call config_package,brcmutil) += BRCMUTIL -config-$(call config_package,brcmsmac) += BRCMSMAC -config-$(call config_package,brcmfmac) += BRCMFMAC -config-$(CONFIG_BRCMFMAC_SDIO) += BRCMFMAC_SDIO -config-$(CONFIG_BRCMFMAC_USB) += BRCMFMAC_USB -config-$(CONFIG_BRCMFMAC_PCIE) += BRCMFMAC_PCIE -config-$(CONFIG_PACKAGE_BRCM80211_DEBUG) += BRCMDBG - config-$(call config_package,mac80211-hwsim) += MAC80211_HWSIM config-$(call config_package,mt7601u) += MT7601U config-y += WL_MEDIATEK -config-$(call config_package,rt2x00-lib) += RT2X00 RT2X00_LIB -config-$(call config_package,rt2x00-pci) += RT2X00_LIB_PCI -config-$(call config_package,rt2x00-mmio) += RT2X00_LIB_MMIO -config-$(call config_package,rt2x00-usb) += RT2X00_LIB_USB -config-$(CONFIG_PACKAGE_RT2X00_LIB_DEBUGFS) += RT2X00_LIB_DEBUGFS -config-$(CONFIG_PACKAGE_RT2X00_DEBUG) += RT2X00_DEBUG - -config-$(call config_package,rt2400-pci) += RT2400PCI -config-$(call config_package,rt2500-pci) += RT2500PCI -config-$(call config_package,rt2500-usb) += RT2500USB -config-$(call config_package,rt61-pci) += RT61PCI -config-$(call config_package,rt73-usb) += RT73USB - -config-$(call config_package,rt2800-lib) += RT2800_LIB - -config-$(call config_package,rt2800-soc) += RT2800SOC -config-$(call config_package,rt2800-pci) += RT2800PCI -config-y += RT2800PCI_RT33XX RT2800PCI_RT35XX RT2800PCI_RT53XX RT2800PCI_RT3290 - -config-$(call config_package,rt2800-usb) += RT2800USB -config-y += RT2800USB_RT33XX RT2800USB_RT35XX RT2800USB_RT3573 RT2800USB_RT53XX RT2800USB_RT55XX RT2800USB_UNKNOWN - -config-$(call config_package,iwl-legacy) += IWLEGACY -config-$(call config_package,iwl3945) += IWL3945 -config-$(call config_package,iwl4965) += IWL4965 -config-$(call config_package,iwlwifi) += IWLWIFI IWLDVM IWLMVM -config-$(CONFIG_PACKAGE_IWLWIFI_DEBUG)+= IWLWIFI_DEBUG -config-$(CONFIG_PACKAGE_IWLWIFI_DEBUGFS)+= IWLWIFI_DEBUGFS - -config-$(call config_package,libipw) += LIBIPW -config-$(call config_package,ipw2100) += IPW2100 -config-$(call config_package,ipw2200) += IPW2200 - config-$(call config_package,p54-common) += P54_COMMON config-$(call config_package,p54-pci) += P54_PCI config-$(call config_package,p54-usb) += P54_USB -config-$(call config_package,p54-spi) += P54_SPI config-$(call config_package,hermes) += HERMES config-$(call config_package,hermes-pci) += PCI_HERMES @@ -1724,14 +408,6 @@ config-$(call config_package,hermes-pcmcia) += PCMCIA_HERMES config-y += HERMES_PRISM config-$(call config_package,adm8211) += ADM8211 -config-$(call config_package,libertas-sdio) += LIBERTAS LIBERTAS_SDIO -config-$(call config_package,libertas-usb) += LIBERTAS LIBERTAS_USB -config-$(call config_package,libertas-spi) += LIBERTAS LIBERTAS_SPI -config-$(call config_package,mwl8k) += MWL8K -config-$(call config_package,mwifiex-pcie) += MWIFIEX MWIFIEX_PCIE -config-$(call config_package,mwifiex-sdio) += MWIFIEX MWIFIEX_SDIO -config-$(call config_package,rtl8180) += RTL8180 -config-$(call config_package,rtl8187) += RTL8187 config-$(call config_package,wlcore) += WLCORE WLCORE_SDIO config-$(call config_package,wl12xx) += WL12XX config-$(call config_package,wl18xx) += WL18XX @@ -1741,22 +417,7 @@ config-$(call config_package,rsi91x) += RSI_91X config-$(call config_package,rsi91x-usb) += RSI_USB config-$(call config_package,rsi91x-sdio) += RSI_SDIO -config-$(call config_package,rtlwifi) += RTL_CARDS RTLWIFI -config-$(call config_package,rtlwifi-pci) += RTLWIFI_PCI -config-$(call config_package,rtlwifi-btcoexist) += RTLBTCOEXIST -config-$(call config_package,rtlwifi-usb) += RTLWIFI_USB -config-$(call config_package,rtl8192c-common) += RTL8192C_COMMON -config-$(call config_package,rtl8192ce) += RTL8192CE -config-$(call config_package,rtl8192se) += RTL8192SE -config-$(call config_package,rtl8192de) += RTL8192DE -config-$(call config_package,rtl8192cu) += RTL8192CU -config-$(call config_package,rtl8821ae) += RTL8821AE -config-$(CONFIG_PACKAGE_RTLWIFI_DEBUG) += RTLWIFI_DEBUG - -config-$(call config_package,rtl8xxxu) += RTL8XXXU -config-y += RTL8XXXU_UNTESTED - -config-$(CONFIG_LEDS_TRIGGERS) += MAC80211_LEDS B43_LEDS B43LEGACY_LEDS +config-$(CONFIG_LEDS_TRIGGERS) += MAC80211_LEDS MAKE_OPTS:= -C "$(PKG_BUILD_DIR)" \ $(KERNEL_MAKE_FLAGS) \ @@ -1820,6 +481,26 @@ ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"") endif endif +define Build/Patch + $(if $(QUILT),rm -rf $(PKG_BUILD_DIR)/patches; mkdir -p $(PKG_BUILD_DIR)/patches) + $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/build,build/) + $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/subsys,subsys/) + $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath,ath/) + $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rt2x00,rt2x00/) + $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/mwl,mwl/) + $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/brcm,brcm/) + $(if $(QUILT),touch $(PKG_BUILD_DIR)/.quilt_used) +endef + +define Quilt/Refresh/Package + $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/build,build/) + $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/subsys,subsys/) + $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath,ath/) + $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rt2x00,rt2x00/) + $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/mwl,mwl/) + $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/brcm,brcm/) +endef + define Build/Compile $(SH_FUNC) var2file "$(call shvar,mac80211_config)" $(PKG_BUILD_DIR)/.config $(MAKE) $(MAKE_OPTS) allnoconfig @@ -1862,14 +543,6 @@ ifneq ($(CONFIG_B43_FW_SQUASH),) endif endef -define KernelPackage/brcmsmac/install - $(INSTALL_DIR) $(1)/lib/firmware/brcm -ifeq ($(CONFIG_BRCMSMAC_USE_FW_FROM_WL),y) - tar xjf "$(DL_DIR)/$(PKG_BRCMSMAC_FW_SOURCE)" -C "$(PKG_BUILD_DIR)" - b43-fwcutter --brcmsmac -w $(1)/lib/firmware/ $(PKG_BUILD_DIR)/$(PKG_BRCMSMAC_FW_OBJECT) -endif -endef - define KernelPackage/cfg80211/install $(INSTALL_DIR) $(1)/lib/wifi $(1)/lib/netifd/wireless $(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi @@ -1878,96 +551,11 @@ define KernelPackage/cfg80211/install $(INSTALL_DATA) ./files/mac80211.hotplug $(1)/etc/hotplug.d/ieee80211/10-wifi-detect endef -define KernelPackage/ipw2100/install - $(INSTALL_DIR) $(1)/lib/firmware - $(INSTALL_DATA) $(PKG_BUILD_DIR)/ipw2100-$(IPW2100_VERSION)*.fw $(1)/lib/firmware -endef - -define KernelPackage/ipw2200/install - $(INSTALL_DIR) $(1)/lib/firmware - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION)/ipw2200*.fw $(1)/lib/firmware -endef - define KernelPackage/zd1211rw/install $(INSTALL_DIR) $(1)/lib/firmware/zd1211 $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(ZD1211FW_NAME)/zd1211* $(1)/lib/firmware/zd1211 endef - -$(eval $(call KernelPackage,adm8211)) -$(eval $(call KernelPackage,airo)) -$(eval $(call KernelPackage,ath)) -$(eval $(call KernelPackage,ath10k)) -$(eval $(call KernelPackage,ath5k)) -$(eval $(call KernelPackage,ath6kl)) -$(eval $(call KernelPackage,ath6kl-sdio)) -$(eval $(call KernelPackage,ath6kl-usb)) -$(eval $(call KernelPackage,ath9k)) -$(eval $(call KernelPackage,ath9k-common)) -$(eval $(call KernelPackage,ath9k-htc)) -$(eval $(call KernelPackage,b43)) -$(eval $(call KernelPackage,b43legacy)) -$(eval $(call KernelPackage,brcmsmac)) -$(eval $(call KernelPackage,brcmfmac)) -$(eval $(call KernelPackage,brcmutil)) -$(eval $(call KernelPackage,carl9170)) +$(eval $(foreach drv,$(PKG_DRIVERS),$(call KernelPackage,$(drv)))) $(eval $(call KernelPackage,cfg80211)) -$(eval $(call KernelPackage,hermes)) -$(eval $(call KernelPackage,hermes-pci)) -$(eval $(call KernelPackage,hermes-plx)) -$(eval $(call KernelPackage,hermes-pcmcia)) -$(eval $(call KernelPackage,iwlwifi)) -$(eval $(call KernelPackage,iwl-legacy)) -$(eval $(call KernelPackage,iwl4965)) -$(eval $(call KernelPackage,iwl3945)) -$(eval $(call KernelPackage,lib80211)) -$(eval $(call KernelPackage,libertas-usb)) -$(eval $(call KernelPackage,libertas-sdio)) -$(eval $(call KernelPackage,libertas-spi)) -$(eval $(call KernelPackage,libipw)) -$(eval $(call KernelPackage,ipw2100)) -$(eval $(call KernelPackage,ipw2200)) $(eval $(call KernelPackage,mac80211)) -$(eval $(call KernelPackage,mac80211-hwsim)) -$(eval $(call KernelPackage,mt7601u)) -$(eval $(call KernelPackage,mwl8k)) -$(eval $(call KernelPackage,mwifiex-pcie)) -$(eval $(call KernelPackage,mwifiex-sdio)) -$(eval $(call KernelPackage,p54-common)) -$(eval $(call KernelPackage,p54-pci)) -$(eval $(call KernelPackage,p54-usb)) -$(eval $(call KernelPackage,p54-spi)) -$(eval $(call KernelPackage,rsi91x)) -$(eval $(call KernelPackage,rsi91x-usb)) -$(eval $(call KernelPackage,rsi91x-sdio)) -$(eval $(call KernelPackage,rt2x00-lib)) -$(eval $(call KernelPackage,rt2x00-mmio)) -$(eval $(call KernelPackage,rt2x00-pci)) -$(eval $(call KernelPackage,rt2x00-usb)) -$(eval $(call KernelPackage,rt2800-lib)) -$(eval $(call KernelPackage,rt2400-pci)) -$(eval $(call KernelPackage,rt2500-pci)) -$(eval $(call KernelPackage,rt2500-usb)) -$(eval $(call KernelPackage,rt2800-mmio)) -$(eval $(call KernelPackage,rt2800-soc)) -$(eval $(call KernelPackage,rt2800-pci)) -$(eval $(call KernelPackage,rt2800-usb)) -$(eval $(call KernelPackage,rt61-pci)) -$(eval $(call KernelPackage,rt73-usb)) -$(eval $(call KernelPackage,rtl8180)) -$(eval $(call KernelPackage,rtl8187)) -$(eval $(call KernelPackage,rtlwifi)) -$(eval $(call KernelPackage,rtlwifi-pci)) -$(eval $(call KernelPackage,rtlwifi-btcoexist)) -$(eval $(call KernelPackage,rtlwifi-usb)) -$(eval $(call KernelPackage,rtl8192c-common)) -$(eval $(call KernelPackage,rtl8192ce)) -$(eval $(call KernelPackage,rtl8192se)) -$(eval $(call KernelPackage,rtl8192de)) -$(eval $(call KernelPackage,rtl8192cu)) -$(eval $(call KernelPackage,rtl8821ae)) -$(eval $(call KernelPackage,rtl8xxxu)) -$(eval $(call KernelPackage,wlcore)) -$(eval $(call KernelPackage,wl12xx)) -$(eval $(call KernelPackage,wl18xx)) -$(eval $(call KernelPackage,zd1211rw)) diff --git a/package/kernel/mac80211/ath.mk b/package/kernel/mac80211/ath.mk new file mode 100644 index 00000000000000..fb2b4b301061f6 --- /dev/null +++ b/package/kernel/mac80211/ath.mk @@ -0,0 +1,277 @@ +PKG_DRIVERS += \ + ath ath5k ath6kl ath6kl-sdio ath6kl-usb ath9k ath9k-common ath9k-htc ath10k \ + carl9170 + +PKG_CONFIG_DEPENDS += \ + CONFIG_PACKAGE_ATH_DEBUG \ + CONFIG_PACKAGE_ATH_DFS \ + CONFIG_PACKAGE_ATH_SPECTRAL \ + CONFIG_PACKAGE_ATH_DYNACK \ + CONFIG_ATH9K_SUPPORT_PCOEM \ + CONFIG_ATH9K_TX99 \ + CONFIG_ATH10K_LEDS \ + CONFIG_ATH10K_THERMAL \ + CONFIG_ATH_USER_REGD + +ifdef CONFIG_PACKAGE_MAC80211_DEBUGFS + config-y += \ + ATH9K_DEBUGFS \ + ATH9K_HTC_DEBUGFS \ + ATH10K_DEBUGFS \ + CARL9170_DEBUGFS \ + ATH5K_DEBUG \ + ATH6KL_DEBUG +endif + +ifdef CONFIG_PACKAGE_MAC80211_TRACING + config-y += \ + ATH10K_TRACING \ + ATH6KL_TRACING \ + ATH_TRACEPOINTS \ + ATH5K_TRACER +endif + +config-$(call config_package,ath) += ATH_CARDS ATH_COMMON ATH_REG_DYNAMIC_USER_REG_HINTS +config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH10K_DEBUG ATH9K_STATION_STATISTICS +config-$(CONFIG_PACKAGE_ATH_DFS) += ATH9K_DFS_CERTIFIED ATH10K_DFS_CERTIFIED +config-$(CONFIG_PACKAGE_ATH_SPECTRAL) += ATH9K_COMMON_SPECTRAL ATH10K_SPECTRAL +config-$(CONFIG_PACKAGE_ATH_DYNACK) += ATH9K_DYNACK +config-$(call config_package,ath9k) += ATH9K +config-$(call config_package,ath9k-common) += ATH9K_COMMON +config-$(CONFIG_TARGET_ar71xx) += ATH9K_AHB +config-$(CONFIG_TARGET_ath79) += ATH9K_AHB +config-$(CONFIG_TARGET_ipq40xx) += ATH10K_AHB +config-$(CONFIG_PCI) += ATH9K_PCI +config-$(CONFIG_ATH_USER_REGD) += ATH_USER_REGD +config-$(CONFIG_ATH9K_SUPPORT_PCOEM) += ATH9K_PCOEM +config-$(CONFIG_ATH9K_TX99) += ATH9K_TX99 +config-$(CONFIG_ATH9K_UBNTHSR) += ATH9K_UBNTHSR +config-$(CONFIG_ATH10K_LEDS) += ATH10K_LEDS +config-$(CONFIG_ATH10K_THERMAL) += ATH10K_THERMAL + +config-$(call config_package,ath9k-htc) += ATH9K_HTC +config-$(call config_package,ath10k) += ATH10K ATH10K_PCI + +config-$(call config_package,ath5k) += ATH5K +ifdef CONFIG_TARGET_ath25 + config-y += ATH5K_AHB +else + config-y += ATH5K_PCI +endif + +config-$(call config_package,ath6kl) += ATH6KL +config-$(call config_package,ath6kl-sdio) += ATH6KL_SDIO +config-$(call config_package,ath6kl-usb) += ATH6KL_USB + +config-$(call config_package,carl9170) += CARL9170 + +define KernelPackage/ath/config + if PACKAGE_kmod-ath + config ATH_USER_REGD + bool "Force Atheros drivers to respect the user's regdomain settings" + default y + help + Atheros' idea of regulatory handling is that the EEPROM of the card defines + the regulatory limits and the user is only allowed to restrict the settings + even further, even if the country allows frequencies or power levels that + are forbidden by the EEPROM settings. + + Select this option if you want the driver to respect the user's decision about + regulatory settings. + + config PACKAGE_ATH_DEBUG + bool "Atheros wireless debugging" + help + Say Y, if you want to debug atheros wireless drivers. + Only ath9k & ath10k make use of this. + + config PACKAGE_ATH_DFS + bool "Enable DFS support" + default y + help + Dynamic frequency selection (DFS) is required for most of the 5 GHz band + channels in Europe, US, and Japan. + + Select this option if you want to use such channels. + + config PACKAGE_ATH_SPECTRAL + bool "Atheros spectral scan support" + depends on PACKAGE_ATH_DEBUG + select KERNEL_RELAY + help + Say Y to enable access to the FFT/spectral data via debugfs. + + config PACKAGE_ATH_DYNACK + bool "Enable Dynack support" + depends on PACKAGE_kmod-ath9k-common + help + Enables support for Dynamic ACK estimation, which allows the fastest possible speed + at any distance automatically by increasing/decreasing the max frame ACK time for + the most remote station detected. It can be enabled by using iw (iw phy0 set distance auto), + or by sending the NL80211_ATTR_WIPHY_DYN_ACK flag to mac80211 driver using netlink. + + Select this option if you want to enable this feature + + endif +endef + +define KernelPackage/ath + $(call KernelPackage/mac80211/Default) + TITLE:=Atheros common driver part + DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx||TARGET_ath79||TARGET_ath25 +kmod-mac80211 + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath.ko + MENU:=1 +endef + +define KernelPackage/ath/description + This module contains some common parts needed by Atheros Wireless drivers. +endef + +define KernelPackage/ath5k + $(call KernelPackage/mac80211/Default) + TITLE:=Atheros 5xxx wireless cards support + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath5k + DEPENDS+= @(PCI_SUPPORT||TARGET_ath25) +kmod-ath +@DRIVER_11W_SUPPORT + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath5k/ath5k.ko + AUTOLOAD:=$(call AutoProbe,ath5k) +endef + +define KernelPackage/ath5k/description + This module adds support for wireless adapters based on + Atheros 5xxx chipset. +endef + +define KernelPackage/ath6kl + $(call KernelPackage/mac80211/Default) + TITLE:=Atheros FullMAC wireless devices (common code for ath6kl_sdio and ath6kl_usb) + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath6kl + HIDDEN:=1 + DEPENDS+= +kmod-ath +@DRIVER_11N_SUPPORT + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath6kl/ath6kl_core.ko +endef + +define KernelPackage/ath6kl-sdio + $(call KernelPackage/mac80211/Default) + TITLE:=Atheros 802.11n SDIO wireless cards support + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath6kl + DEPENDS+= +kmod-mmc +kmod-ath6kl + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath6kl/ath6kl_sdio.ko + AUTOLOAD:=$(call AutoProbe,ath6kl_sdio) +endef + +define KernelPackage/ath6kl-sdio/description +This module adds support for wireless adapters based on +Atheros IEEE 802.11n AR6003 and AR6004 family of chipsets. +endef + +define KernelPackage/ath6kl-usb + $(call KernelPackage/mac80211/Default) + TITLE:=Atheros 802.11n USB wireless cards support + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath6kl + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-ath6kl + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath6kl/ath6kl_usb.ko + AUTOLOAD:=$(call AutoProbe,ath6kl_usb) +endef + +define KernelPackage/ath6kl-usb/description +This module adds support for wireless adapters based on the +Atheros IEEE 802.11n AR6004 chipset. +endef + +define KernelPackage/ath9k-common + $(call KernelPackage/mac80211/Default) + TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc) + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k + HIDDEN:=1 + DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx||TARGET_ath79 +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT + FILES:= \ + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \ + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.ko +endef + +define KernelPackage/ath9k + $(call KernelPackage/mac80211/Default) + TITLE:=Atheros 802.11n PCI wireless cards support + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k + DEPENDS+= @PCI_SUPPORT||TARGET_ar71xx||TARGET_ath79 +kmod-ath9k-common + FILES:= \ + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k.ko + AUTOLOAD:=$(call AutoProbe,ath9k) +endef + +define KernelPackage/ath9k/description +This module adds support for wireless adapters based on +Atheros IEEE 802.11n AR5008 and AR9001 family of chipsets. +endef + +define KernelPackage/ath9k/config + + config ATH9K_SUPPORT_PCOEM + bool "Support chips used in PC OEM cards" + depends on PACKAGE_kmod-ath9k + + config ATH9K_TX99 + bool "Enable TX99 support (WARNING: testing only, breaks normal operation!)" + depends on PACKAGE_kmod-ath9k + + config ATH9K_UBNTHSR + bool "Support for Ubiquiti UniFi Outdoor+ access point" + depends on PACKAGE_kmod-ath9k && (TARGET_ar71xx_generic||TARGET_ath79) + default y + +endef + +define KernelPackage/ath9k-htc + $(call KernelPackage/mac80211/Default) + TITLE:=Atheros 802.11n USB device support + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k + DEPENDS+= @USB_SUPPORT +kmod-ath9k-common +kmod-usb-core +ath9k-htc-firmware + FILES:= \ + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_htc.ko + AUTOLOAD:=$(call AutoProbe,ath9k_htc) +endef + +define KernelPackage/ath9k-htc/description +This module adds support for wireless adapters based on +Atheros USB AR9271 and AR7010 family of chipsets. +endef + +define KernelPackage/ath10k + $(call KernelPackage/mac80211/Default) + TITLE:=Atheros 802.11ac wireless cards support + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath10k + DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11W_SUPPORT \ + +ATH10K_THERMAL:kmod-hwmon-core +ATH10K_THERMAL:kmod-thermal + FILES:= \ + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \ + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko + AUTOLOAD:=$(call AutoProbe,ath10k_pci) +endef + +define KernelPackage/ath10k/description +This module adds support for wireless adapters based on +Atheros IEEE 802.11ac family of chipsets. For now only +PCI is supported. +endef + +define KernelPackage/ath10k/config + + config ATH10K_LEDS + bool "Enable LED support" + default y + depends on PACKAGE_kmod-ath10k + + config ATH10K_THERMAL + default y + bool "Enable thermal sensors and throttling support" + depends on PACKAGE_kmod-ath10k + +endef + +define KernelPackage/carl9170 + $(call KernelPackage/mac80211/Default) + TITLE:=Driver for Atheros AR9170 USB sticks + DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +carl9170-firmware + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170/carl9170.ko + AUTOLOAD:=$(call AutoProbe,carl9170) +endef diff --git a/package/kernel/mac80211/broadcom.mk b/package/kernel/mac80211/broadcom.mk new file mode 100644 index 00000000000000..a58d78a6a4e4ee --- /dev/null +++ b/package/kernel/mac80211/broadcom.mk @@ -0,0 +1,487 @@ +PKG_DRIVERS += \ + b43 b43legacy brcmsmac brcmfmac brcmutil + +PKG_CONFIG_DEPENDS += \ + CONFIG_PACKAGE_B43_DEBUG \ + CONFIG_PACKAGE_B43_PIO \ + CONFIG_PACKAGE_B43_PHY_G \ + CONFIG_PACKAGE_B43_PHY_N \ + CONFIG_PACKAGE_B43_PHY_LP \ + CONFIG_PACKAGE_B43_PHY_HT \ + CONFIG_PACKAGE_B43_BUSES_BCMA_AND_SSB \ + CONFIG_PACKAGE_B43_BUSES_BCMA \ + CONFIG_PACKAGE_B43_BUSES_SSB \ + CONFIG_PACKAGE_BRCM80211_DEBUG + +config-$(call config_package,b43) += B43 +config-$(CONFIG_PACKAGE_B43_BUSES_BCMA_AND_SSB) += B43_BUSES_BCMA_AND_SSB +config-$(CONFIG_PACKAGE_B43_BUSES_BCMA) += B43_BUSES_BCMA +config-$(CONFIG_PACKAGE_B43_BUSES_SSB) += B43_BUSES_SSB +config-$(CONFIG_PACKAGE_B43_PHY_G) += B43_PHY_G +config-$(CONFIG_PACKAGE_B43_PHY_N) += B43_PHY_N +config-$(CONFIG_PACKAGE_B43_PHY_LP) += B43_PHY_LP +config-$(CONFIG_PACKAGE_B43_PHY_HT) += B43_PHY_HT +config-$(CONFIG_PACKAGE_B43_PIO) += B43_PIO +config-$(CONFIG_PACKAGE_B43_DEBUG) += B43_DEBUG + +config-$(call config_package,b43legacy) += B43LEGACY +config-y += B43LEGACY_DMA_MODE + +config-$(call config_package,brcmutil) += BRCMUTIL +config-$(call config_package,brcmsmac) += BRCMSMAC +config-$(call config_package,brcmfmac) += BRCMFMAC +config-$(CONFIG_BRCMFMAC_SDIO) += BRCMFMAC_SDIO +config-$(CONFIG_BRCMFMAC_USB) += BRCMFMAC_USB +config-$(CONFIG_BRCMFMAC_PCIE) += BRCMFMAC_PCIE +config-$(CONFIG_PACKAGE_BRCM80211_DEBUG) += BRCMDBG + +config-$(CONFIG_LEDS_TRIGGERS) += B43_LEDS B43LEGACY_LEDS + +#Broadcom firmware +ifneq ($(CONFIG_B43_FW_6_30),) + PKG_B43_FWV4_NAME:=broadcom-wl + PKG_B43_FWV4_VERSION:=6.30.163.46 + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).wl_apsta.o + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2 + PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/ + PKG_B43_FWV4_HASH:=a07c3b6b277833c7dbe61daa511f908cd66c5e2763eb7a0859abc36cd9335c2d +else +ifneq ($(CONFIG_B43_FW_5_10),) + PKG_B43_FWV4_NAME:=broadcom-wl + PKG_B43_FWV4_VERSION:=5.10.56.27.3 + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta/wl_prebuilt.o + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)_mipsel.tar.bz2 + PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/ + PKG_B43_FWV4_HASH:=26a8c370f48fc129d0731cfd751c36cae1419b0bc8ca35781126744e60eae009 +else +ifneq ($(CONFIG_B43_FW_4_178),) + PKG_B43_FWV4_NAME:=broadcom-wl + PKG_B43_FWV4_VERSION:=4.178.10.4 + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2 + PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/ + PKG_B43_FWV4_HASH:=32f6ad98facbb9045646fdc8b54bb03086d204153253f9c65d0234a5d90ae53f +else +ifneq ($(CONFIG_B43_FW_5_100_138),) + PKG_B43_FWV4_NAME:=broadcom-wl + PKG_B43_FWV4_VERSION:=5.100.138 + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2 + PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/ + PKG_B43_FWV4_HASH:=f1e7067aac5b62b67b8b6e4c517990277804339ac16065eb13c731ff909ae46f +else + PKG_B43_FWV4_NAME:=broadcom-wl + PKG_B43_FWV4_VERSION:=4.150.10.5 + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta_mimo.o + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2 + PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/ + PKG_B43_FWV4_HASH:=a9f4e276a4d8d3a1cd0f2eb87080ae89b77f0a7140f06d4e9e2135fc44fdd533 +endif +endif +endif +endif +ifneq ($(CONFIG_B43_OPENFIRMWARE),) + PKG_B43_FWV4_NAME:=broadcom-wl + PKG_B43_FWV4_VERSION:=5.2 + PKG_B43_FWV4_OBJECT:=openfwwf-$(PKG_B43_FWV4_VERSION) + PKG_B43_FWV4_SOURCE:=openfwwf-$(PKG_B43_FWV4_VERSION).tar.gz + PKG_B43_FWV4_SOURCE_URL:=http://netweb.ing.unibs.it/~openfwwf/firmware + PKG_B43_FWV4_HASH:=9de03320083201080b2e94b81637ac07a159cf4e6f3481383e1a217e627bc0dc +endif + + +define Download/b43 + FILE:=$(PKG_B43_FWV4_SOURCE) + URL:=$(PKG_B43_FWV4_SOURCE_URL) + HASH:=$(PKG_B43_FWV4_HASH) +endef +$(eval $(call Download,b43)) + +define KernelPackage/b43 + $(call KernelPackage/mac80211/Default) + TITLE:=Broadcom 43xx wireless support + URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43 + KCONFIG:= \ + CONFIG_HW_RANDOM=y + # Depend on PCI_SUPPORT to make sure we can select kmod-bcma or kmod-ssb + DEPENDS += \ + @PCI_SUPPORT +kmod-mac80211 \ + $(if $(CONFIG_PACKAGE_B43_USE_SSB),+kmod-ssb) \ + $(if $(CONFIG_PACKAGE_B43_USE_BCMA),+kmod-bcma) + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/b43/b43.ko + AUTOLOAD:=$(call AutoProbe,b43) + MENU:=1 +endef + +define KernelPackage/b43/config + +config PACKAGE_B43_USE_SSB + select PACKAGE_kmod-ssb + tristate + depends on !TARGET_brcm47xx && !TARGET_brcm63xx + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_SSB + +config PACKAGE_B43_USE_BCMA + select PACKAGE_kmod-bcma + tristate + depends on !TARGET_brcm47xx && !TARGET_bcm53xx + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA + + if PACKAGE_kmod-b43 + + choice + prompt "b43 firmware version" + default B43_FW_5_100_138 + help + This option allows you to select the version of the b43 firmware. + + config B43_FW_4_150 + bool "Firmware 410.2160 from driver 4.150.10.5 (old stable)" + help + Old stable firmware for BCM43xx devices. + + If unsure, select this. + + config B43_FW_4_178 + bool "Firmware 478.104 from driver 4.178.10.4" + help + Older firmware for BCM43xx devices. + + If unsure, select the "stable" firmware. + + config B43_FW_5_10 + bool "Firmware 508.1084 from driver 5.10.56.27" + help + Older firmware for BCM43xx devices. + + If unsure, select the "stable" firmware. + + config B43_FW_5_100_138 + bool "Firmware 666.2 from driver 5.100.138 (stable)" + help + The currently default firmware for BCM43xx devices. + + This firmware currently gets most of the testing and is needed for some N-PHY devices. + + If unsure, select the this firmware. + + config B43_FW_6_30 + bool "Firmware 784.2 from driver 6.30.163.46 (experimental)" + help + Newer experimental firmware for BCM43xx devices. + + This firmware is mostly untested. + + If unsure, select the "stable" firmware. + + config B43_OPENFIRMWARE + bool "Open FirmWare for WiFi networks" + help + Opensource firmware for BCM43xx devices. + + Do _not_ select this, unless you know what you are doing. + The Opensource firmware is not suitable for embedded devices, yet. + It does not support QoS, which is bad for AccessPoints. + It does not support hardware crypto acceleration, which is a showstopper + for embedded devices with low CPU resources. + + If unsure, select the "stable" firmware. + + endchoice + + config B43_FW_SQUASH + bool "Remove unnecessary firmware files" + depends on !B43_OPENFIRMWARE + default y + help + This options allows you to remove unnecessary b43 firmware files + from the final rootfs image. This can reduce the rootfs size by + up to 200k. + + If unsure, say Y. + + config B43_FW_SQUASH_COREREVS + string "Core revisions to include" + depends on B43_FW_SQUASH + default "5,6,7,8,9,10,11,13,15" if TARGET_brcm47xx_legacy + default "16,28,29,30" if TARGET_brcm47xx_mips74k + default "5,6,7,8,9,10,11,13,15,16,28,29,30" + help + This is a comma seperated list of core revision numbers. + + Example (keep files for rev5 only): + 5 + + Example (keep files for rev5 and rev11): + 5,11 + + config B43_FW_SQUASH_PHYTYPES + string "PHY types to include" + depends on B43_FW_SQUASH + default "G,N,LP" if TARGET_brcm47xx_legacy + default "N,HT" if TARGET_brcm47xx_mips74k + default "G,N,LP,HT" + help + This is a comma seperated list of PHY types: + A => A-PHY + AG => Dual A-PHY G-PHY + G => G-PHY + LP => LP-PHY + N => N-PHY + HT => HT-PHY + LCN => LCN-PHY + LCN40 => LCN40-PHY + AC => AC-PHY + + Example (keep files for G-PHY only): + G + + Example (keep files for G-PHY and N-PHY): + G,N + + choice + prompt "Supported buses" + default PACKAGE_B43_BUSES_BCMA_AND_SSB + help + This allows choosing buses that b43 should support. + + config PACKAGE_B43_BUSES_BCMA_AND_SSB + depends on !TARGET_brcm47xx_legacy && !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx + bool "BCMA and SSB" + + config PACKAGE_B43_BUSES_BCMA + depends on !TARGET_brcm47xx_legacy + bool "BCMA only" + + config PACKAGE_B43_BUSES_SSB + depends on !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx + bool "SSB only" + + endchoice + + config PACKAGE_B43_DEBUG + bool "Enable debug output and debugfs for b43" + default n + help + Enable additional debug output and runtime sanity checks for b43 + and enables the debugfs interface. + + If unsure, say N. + + config PACKAGE_B43_PIO + bool "Enable support for PIO transfer mode" + default n + help + Enable support for using PIO instead of DMA. Unless you have DMA + transfer problems you don't need this. + + If unsure, say N. + + config PACKAGE_B43_PHY_G + bool "Enable support for G-PHYs" + default n if TARGET_brcm47xx_mips74k + default y + help + Enable support for G-PHY. This includes support for the following devices: + PCI: BCM4306, BCM4311, BCM4318 + SoC: BCM5352E, BCM4712 + + If unsure, say Y. + + config PACKAGE_B43_PHY_N + bool "Enable support for N-PHYs" + default y + help + Enable support for N-PHY. This includes support for the following devices: + PCI: BCM4321, BCM4322, BCM43222, BCM43224, BCM43225 + SoC: BCM4716, BCM4717, BCM4718 + + Currently only 11g speed is available. + + If unsure, say Y. + + config PACKAGE_B43_PHY_LP + bool "Enable support for LP-PHYs" + default n if TARGET_brcm47xx_mips74k + default y + help + Enable support for LP-PHY. This includes support for the following devices: + PCI: BCM4312 + SoC: BCM5354 + + If unsure, say Y. + + config PACKAGE_B43_PHY_HT + bool "Enable support for HT-PHYs" + default n if TARGET_brcm47xx_legacy + default y + help + Enable support for HT-PHY. This includes support for the following devices: + PCI: BCM4331 + + Currently only 11g speed is available. + + If unsure, say Y. + + config PACKAGE_B43_PHY_LCN + bool "Enable support for LCN-PHYs" + depends on BROKEN + default n + help + Currently broken. + + If unsure, say N. + + endif +endef + +define KernelPackage/b43/description +Kernel module for Broadcom 43xx wireless support (mac80211 stack) new +endef + +define KernelPackage/b43legacy + $(call KernelPackage/mac80211/Default) + TITLE:=Broadcom 43xx-legacy wireless support + URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43 + KCONFIG:= \ + CONFIG_HW_RANDOM=y + DEPENDS+= +kmod-mac80211 +!(TARGET_brcm47xx||TARGET_brcm63xx):kmod-ssb @!TARGET_brcm47xx_mips74k +b43legacy-firmware + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/b43legacy/b43legacy.ko + AUTOLOAD:=$(call AutoProbe,b43legacy) + MENU:=1 +endef + +define KernelPackage/b43legacy/description +Kernel module for Broadcom 43xx-legacy wireless support (mac80211 stack) new +endef + + +define KernelPackage/brcmutil + $(call KernelPackage/mac80211/Default) + TITLE:=Broadcom IEEE802.11n common driver parts + URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211 + DEPENDS+=@PCI_SUPPORT||USB_SUPPORT + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/brcm80211/brcmutil/brcmutil.ko + AUTOLOAD:=$(call AutoProbe,brcmutil) + MENU:=1 +endef + +define KernelPackage/brcmutil/description + This module contains some common parts needed by Broadcom Wireless drivers brcmsmac and brcmfmac. +endef + +define KernelPackage/brcmutil/config + if PACKAGE_kmod-brcmutil + + config PACKAGE_BRCM80211_DEBUG + bool "Broadcom wireless driver debugging" + help + Say Y, if you want to debug brcmsmac and brcmfmac wireless driver. + + endif +endef + +PKG_BRCMSMAC_FW_NAME:=broadcom-wl +PKG_BRCMSMAC_FW_VERSION:=5.100.138 +PKG_BRCMSMAC_FW_OBJECT:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION)/linux/wl_apsta.o +PKG_BRCMSMAC_FW_SOURCE:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION).tar.bz2 +PKG_BRCMSMAC_FW_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/ +PKG_BRCMSMAC_FW_HASH:=f1e7067aac5b62b67b8b6e4c517990277804339ac16065eb13c731ff909ae46f + +define Download/brcmsmac + FILE:=$(PKG_BRCMSMAC_FW_SOURCE) + URL:=$(PKG_BRCMSMAC_FW_SOURCE_URL) + HASH:=$(PKG_BRCMSMAC_FW_HASH) +endef +$(eval $(call Download,brcmsmac)) + +define KernelPackage/brcmsmac + $(call KernelPackage/mac80211/Default) + TITLE:=Broadcom IEEE802.11n PCIe SoftMAC WLAN driver + URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211 + DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT +!TARGET_brcm47xx:kmod-bcma +kmod-lib-cordic +kmod-lib-crc8 +kmod-brcmutil +!BRCMSMAC_USE_FW_FROM_WL:brcmsmac-firmware + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcmsmac.ko + AUTOLOAD:=$(call AutoProbe,brcmsmac) + MENU:=1 +endef + +define KernelPackage/brcmsmac/description + Kernel module for Broadcom IEEE802.11n PCIe Wireless cards +endef + +define KernelPackage/brcmsmac/config + if PACKAGE_kmod-brcmsmac + + config BRCMSMAC_USE_FW_FROM_WL + bool "Use firmware extracted from broadcom proprietary driver" + default y + help + Instead of using the official brcmsmac firmware a firmware + version 666.2 extracted from the proprietary Broadcom driver + is used. This is needed to get core rev 17 used in bcm4716 + to work. + + If unsure, say Y. + + endif +endef + + +define KernelPackage/brcmfmac + $(call KernelPackage/mac80211/Default) + TITLE:=Broadcom IEEE802.11n USB FullMAC WLAN driver + URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211 + DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11W_SUPPORT \ + +kmod-brcmutil +BRCMFMAC_SDIO:kmod-mmc @!TARGET_uml \ + +BRCMFMAC_USB:kmod-usb-core +BRCMFMAC_USB:brcmfmac-firmware-usb + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko + AUTOLOAD:=$(call AutoProbe,brcmfmac) +endef + +define KernelPackage/brcmfmac/description + Kernel module for Broadcom IEEE802.11n USB Wireless cards +endef + +define KernelPackage/brcmfmac/config + if PACKAGE_kmod-brcmfmac + + config BRCMFMAC_SDIO + bool "Enable SDIO bus interface support" + default y if TARGET_bcm27xx + default y if TARGET_sunxi + default n + help + Enable support for cards attached to an SDIO bus. + Select this option only if you are sure that your + board has a Broadcom wireless chip atacched to + that bus. + + config BRCMFMAC_USB + bool "Enable USB bus interface support" + depends on USB_SUPPORT + default y + help + Supported USB connected chipsets: + BCM43235, BCM43236, BCM43238 (all in revision 3 only) + BCM43143, BCM43242, BCM43566, BCM43569 + + config BRCMFMAC_PCIE + bool "Enable PCIE bus interface support" + depends on PCI_SUPPORT + default y + help + Supported PCIe connected chipsets: + BCM4354, BCM4356, BCM43567, BCM43570, BCM43602 + + endif +endef + +define KernelPackage/brcmsmac/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm +ifeq ($(CONFIG_BRCMSMAC_USE_FW_FROM_WL),y) + tar xjf "$(DL_DIR)/$(PKG_BRCMSMAC_FW_SOURCE)" -C "$(PKG_BUILD_DIR)" + b43-fwcutter --brcmsmac -w $(1)/lib/firmware/ $(PKG_BUILD_DIR)/$(PKG_BRCMSMAC_FW_OBJECT) +endif +endef diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index 244260a2dd8f2b..9ffec7ac22b9f8 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -14,11 +14,16 @@ MP_CONFIG_INT="mesh_retry_timeout mesh_confirm_timeout mesh_holding_timeout mesh MP_CONFIG_BOOL="mesh_auto_open_plinks mesh_fwding" MP_CONFIG_STRING="mesh_power_mode" +iw() { + command iw $@ || logger -t mac80211 "Failed command: iw $@" +} + drv_mac80211_init_device_config() { hostapd_common_add_device_config config_add_string path phy 'macaddr:macaddr' config_add_string hwmode + config_add_string tx_burst config_add_int beacon_int chanbw frag rts config_add_int rxantenna txantenna antenna_gain txpower distance config_add_boolean noscan ht_coex @@ -92,8 +97,13 @@ mac80211_hostapd_setup_base() { [ "$auto_channel" -gt 0 ] && channel=acs_survey [ "$auto_channel" -gt 0 ] && json_get_values channel_list channels - json_get_vars noscan ht_coex - json_get_values ht_capab_list ht_capab + json_get_vars noscan ht_coex vendor_vht + json_get_values ht_capab_list ht_capab tx_burst + + set_default noscan 0 + + [ "$noscan" -gt 0 ] && hostapd_noscan=1 + [ "$tx_burst" = 0 ] && tx_burst= ieee80211n=1 ht_capab= @@ -203,7 +213,7 @@ mac80211_hostapd_setup_base() { ;; esac - if [ "$enable_ac" != "0" ]; then + if [ "$enable_ac" != "0" -o "$vendor_vht" = "1" ]; then json_get_vars \ rxldpc:1 \ short_gi_80:1 \ @@ -223,6 +233,7 @@ mac80211_hostapd_setup_base() { vht_link_adapt:3 \ vht160:2 + set_default tx_burst 2.0 append base_cfg "ieee80211ac=1" "$N" vht_cap=0 for cap in $(iw phy "$phy" info | awk -F "[()]" '/VHT Capabilities/ { print $2 }'); do @@ -303,7 +314,8 @@ mac80211_hostapd_setup_base() { cat >> "$hostapd_conf_file" </dev/null 2>&1 iw phy "$phy" set antenna_gain $antenna_gain iw phy "$phy" set distance "$distance" @@ -791,11 +776,15 @@ drv_mac80211_setup() { has_ap= hostapd_ctrl= + hostapd_noscan= for_each_interface "ap" mac80211_check_ap rm -f "$hostapd_conf_file" + + for_each_interface "sta adhoc mesh" mac80211_set_noscan [ -n "$has_ap" ] && mac80211_hostapd_setup_base "$phy" + mac80211_prepare_iw_htmode for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif for_each_interface "ap" mac80211_prepare_vif diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh index 511a9188db218f..6103b5d04e1b41 100644 --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh @@ -113,7 +113,7 @@ detect_mac80211() { set wireless.radio${devidx}.hwmode=11${mode_band} ${dev_id} ${ht_capab} - set wireless.radio${devidx}.disabled=1 + set wireless.radio${devidx}.disabled=0 set wireless.default_radio${devidx}=wifi-iface set wireless.default_radio${devidx}.device=radio${devidx} diff --git a/package/kernel/mac80211/intel.mk b/package/kernel/mac80211/intel.mk new file mode 100644 index 00000000000000..a8ae4ff7c7657f --- /dev/null +++ b/package/kernel/mac80211/intel.mk @@ -0,0 +1,200 @@ +PKG_DRIVERS += \ + iwl-legacy iwl3945 iwl4965 iwlwifi \ + libipw ipw2100 ipw2200 \ + +config-$(call config_package,iwl-legacy) += IWLEGACY +config-$(call config_package,iwl3945) += IWL3945 +config-$(call config_package,iwl4965) += IWL4965 +config-$(call config_package,iwlwifi) += IWLWIFI IWLDVM IWLMVM +config-$(CONFIG_PACKAGE_IWLWIFI_DEBUG)+= IWLWIFI_DEBUG +config-$(CONFIG_PACKAGE_IWLWIFI_DEBUGFS)+= IWLWIFI_DEBUGFS + +config-$(call config_package,libipw) += LIBIPW +config-$(call config_package,ipw2100) += IPW2100 +config-$(call config_package,ipw2200) += IPW2200 + +define KernelPackage/iwlwifi + $(call KernelPackage/mac80211/Default) + DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11W_SUPPORT + TITLE:=Intel AGN Wireless support + FILES:= \ + $(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko \ + $(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/dvm/iwldvm.ko \ + $(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/mvm/iwlmvm.ko + AUTOLOAD:=$(call AutoProbe,iwlwifi iwldvm iwlmvm) + MENU:=1 +endef + +define KernelPackage/iwlwifi/description + iwlwifi kernel module for + Intel Wireless WiFi Link 6250AGN Adapter + Intel 6000 Series Wi-Fi Adapters (6200AGN and 6300AGN) + Intel WiFi Link 1000BGN + Intel Wireless WiFi 5150AGN + Intel Wireless WiFi 5100AGN, 5300AGN, and 5350AGN + Intel 6005 Series Wi-Fi Adapters + Intel 6030 Series Wi-Fi Adapters + Intel Wireless WiFi Link 6150BGN 2 Adapter + Intel 100 Series Wi-Fi Adapters (100BGN and 130BGN) + Intel 2000 Series Wi-Fi Adapters + Intel 7260 Wi-Fi Adapter + Intel 3160 Wi-Fi Adapter + Intel 7265 Wi-Fi Adapter + Intel 8260 Wi-Fi Adapter + Intel 3165 Wi-Fi Adapter +endef + +define KernelPackage/iwlwifi/config + if PACKAGE_kmod-iwlwifi + + config PACKAGE_IWLWIFI_DEBUG + bool "Enable full debugging output in the iwlwifi driver" + default n + help + This option will enable debug tracing output for the iwlwifi drivers + + This will result in the kernel module being ~100k larger. You can + control which debug output is sent to the kernel log by setting the + value in + + /sys/module/iwlwifi/parameters/debug + + This entry will only exist if this option is enabled. + + To set a value, simply echo an 8-byte hex value to the same file: + + % echo 0x43fff > /sys/module/iwlwifi/parameters/debug + + You can find the list of debug mask values in: + drivers/net/wireless/intel/iwlwifi/iwl-debug.h + + If this is your first time using this driver, you should say Y here + as the debug information can assist others in helping you resolve + any problems you may encounter. + + config PACKAGE_IWLWIFI_DEBUGFS + bool "iwlwifi debugfs support" + depends on PACKAGE_MAC80211_DEBUGFS + default n + help + Enable creation of debugfs files for the iwlwifi drivers. This + is a low-impact option that allows getting insight into the + driver's state at runtime. + + endif +endef + +define KernelPackage/iwl-legacy + $(call KernelPackage/mac80211/Default) + DEPENDS:= +kmod-mac80211 @PCI_SUPPORT + TITLE:=Intel legacy Wireless support + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlegacy/iwlegacy.ko + AUTOLOAD:=$(call AutoProbe,iwlegacy) +endef + +define KernelPackage/iwl-legacy/description + iwl-legacy kernel module for legacy Intel wireless support +endef + +define KernelPackage/iwl3945 + $(call KernelPackage/mac80211/Default) + DEPENDS:= +kmod-mac80211 +kmod-iwl-legacy +iwl3945-firmware + TITLE:=Intel iwl3945 Wireless support + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlegacy/iwl3945.ko + AUTOLOAD:=$(call AutoProbe,iwl3945) +endef + +define KernelPackage/iwl3945/description + iwl3945 kernel module for Intel 3945 support +endef + +define KernelPackage/iwl4965 + $(call KernelPackage/mac80211/Default) + DEPENDS:= +kmod-mac80211 +kmod-iwl-legacy +@DRIVER_11N_SUPPORT +iwl4965-firmware + TITLE:=Intel iwl4965 Wireless support + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlegacy/iwl4965.ko + AUTOLOAD:=$(call AutoProbe,iwl4965) +endef + +define KernelPackage/iwl4965/description + iwl4965 kernel module for Intel 4965 support +endef + + +define KernelPackage/libipw + $(call KernelPackage/mac80211/Default) + TITLE:=libipw for ipw2100 and ipw2200 + DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-crypto-ecb +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/libipw.ko + AUTOLOAD:=$(call AutoProbe,libipw) +endef + +define KernelPackage/libipw/description + Hardware independent IEEE 802.11 networking stack for ipw2100 and ipw2200. +endef + +IPW2100_NAME:=ipw2100-fw +IPW2100_VERSION:=1.3 + +define Download/ipw2100 + URL:= \ + https://src.fedoraproject.org/repo/pkgs/ipw2100-firmware/ipw2100-fw-1.3.tgz/46aa75bcda1a00efa841f9707bbbd113/ \ + https://archlinux.mirror.pkern.at/other/packages/ipw2100-fw/ \ + http://mirror.ox.ac.uk/sites/ftp.openbsd.org/pub/OpenBSD/distfiles/firmware/ \ + http://firmware.openbsd.org/firmware-dist/ + FILE:=$(IPW2100_NAME)-$(IPW2100_VERSION).tgz + HASH:=e1107c455e48d324a616b47a622593bc8413dcce72026f72731c0b03dae3a7a2 +endef +$(eval $(call Download,ipw2100)) + +define KernelPackage/ipw2100 + $(call KernelPackage/mac80211/Default) + TITLE:=Intel IPW2100 driver + DEPENDS:=@PCI_SUPPORT +kmod-libipw + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/ipw2100.ko + AUTOLOAD:=$(call AutoProbe,ipw2100) +endef + +define KernelPackage/ipw2100/description + Kernel support for Intel IPW2100 + Includes: + - ipw2100 +endef + +IPW2200_NAME:=ipw2200-fw +IPW2200_VERSION:=3.1 + +define Download/ipw2200 + URL:= \ + https://src.fedoraproject.org/repo/pkgs/ipw2200-firmware/ipw2200-fw-3.1.tgz/eaba788643c7cc7483dd67ace70f6e99/ \ + https://archlinux.mirror.pkern.at/other/packages/ipw2200-fw/ \ + http://mirror.ox.ac.uk/sites/ftp.openbsd.org/pub/OpenBSD/distfiles/firmware/ \ + http://firmware.openbsd.org/firmware-dist/ + FILE:=$(IPW2200_NAME)-$(IPW2200_VERSION).tgz + HASH:=c6818c11c18cc030d55ff83f64b2bad8feef485e7742f84f94a61d811a6258bd +endef +$(eval $(call Download,ipw2200)) + +define KernelPackage/ipw2200 + $(call KernelPackage/mac80211/Default) + TITLE:=Intel IPW2200 driver + DEPENDS:=@PCI_SUPPORT +kmod-libipw + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/ipw2200.ko + AUTOLOAD:=$(call AutoProbe,ipw2200) +endef + +define KernelPackage/ipw2200/description + Kernel support for Intel IPW2200 + Includes: + - ipw2200 +endef + +define KernelPackage/ipw2100/install + $(INSTALL_DIR) $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/ipw2100-$(IPW2100_VERSION)*.fw $(1)/lib/firmware +endef + +define KernelPackage/ipw2200/install + $(INSTALL_DIR) $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION)/ipw2200*.fw $(1)/lib/firmware +endef diff --git a/package/kernel/mac80211/marvell.mk b/package/kernel/mac80211/marvell.mk new file mode 100644 index 00000000000000..a0e67091e5f302 --- /dev/null +++ b/package/kernel/mac80211/marvell.mk @@ -0,0 +1,90 @@ +PKG_DRIVERS += \ + libertas-sdio libertas-usb libertas-spi \ + mwl8k mwifiex-pcie mwifiex-sdio + +config-$(call config_package,libertas-sdio) += LIBERTAS LIBERTAS_SDIO +config-$(call config_package,libertas-usb) += LIBERTAS LIBERTAS_USB +config-$(call config_package,libertas-spi) += LIBERTAS LIBERTAS_SPI +config-$(call config_package,mwl8k) += MWL8K +config-$(call config_package,mwifiex-pcie) += MWIFIEX MWIFIEX_PCIE +config-$(call config_package,mwifiex-sdio) += MWIFIEX MWIFIEX_SDIO + +define KernelPackage/libertas-usb + $(call KernelPackage/mac80211/Default) + DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +kmod-usb-core +kmod-lib80211 +@DRIVER_WEXT_SUPPORT +libertas-usb-firmware + TITLE:=Marvell 88W8015 Wireless Driver + FILES:= \ + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas.ko \ + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/usb8xxx.ko + AUTOLOAD:=$(call AutoProbe,libertas usb8xxx) +endef + +define KernelPackage/libertas-sdio + $(call KernelPackage/mac80211/Default) + DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +kmod-mmc +@DRIVER_WEXT_SUPPORT @!TARGET_uml +libertas-sdio-firmware + TITLE:=Marvell 88W8686 Wireless Driver + FILES:= \ + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas.ko \ + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas_sdio.ko + AUTOLOAD:=$(call AutoProbe,libertas libertas_sdio) +endef + +define KernelPackage/libertas-spi + $(call KernelPackage/mac80211/Default) + SUBMENU:=Wireless Drivers + DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT @!TARGET_uml +libertas-spi-firmware + KCONFIG := \ + CONFIG_SPI=y \ + CONFIG_SPI_MASTER=y + TITLE:=Marvell 88W8686 SPI Wireless Driver + FILES:= \ + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas.ko \ + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas_spi.ko + AUTOLOAD:=$(call AutoProbe,libertas libertas_spi) +endef + + +define KernelPackage/mwl8k + $(call KernelPackage/mac80211/Default) + TITLE:=Driver for Marvell TOPDOG 802.11 Wireless cards + URL:=https://wireless.wiki.kernel.org/en/users/drivers/mwl8k + DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT +mwl8k-firmware + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwl8k.ko + AUTOLOAD:=$(call AutoProbe,mwl8k) +endef + +define KernelPackage/mwl8k/description + Kernel modules for Marvell TOPDOG 802.11 Wireless cards +endef + + +define KernelPackage/mwifiex-pcie + $(call KernelPackage/mac80211/Default) + TITLE:=Driver for Marvell 802.11n/802.11ac PCIe Wireless cards + URL:=https://wireless.wiki.kernel.org/en/users/drivers/mwifiex + DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +mwifiex-pcie-firmware + FILES:= \ + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwifiex/mwifiex.ko \ + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwifiex/mwifiex_pcie.ko + AUTOLOAD:=$(call AutoProbe,mwifiex_pcie) +endef + +define KernelPackage/mwifiex-pcie/description + Kernel modules for Marvell 802.11n/802.11ac PCIe Wireless cards +endef + +define KernelPackage/mwifiex-sdio + $(call KernelPackage/mac80211/Default) + TITLE:=Driver for Marvell 802.11n/802.11ac SDIO Wireless cards + URL:=https://wireless.wiki.kernel.org/en/users/drivers/mwifiex + DEPENDS+= +kmod-mmc +kmod-mac80211 +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +mwifiex-sdio-firmware + FILES:= \ + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwifiex/mwifiex.ko \ + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwifiex/mwifiex_sdio.ko + AUTOLOAD:=$(call AutoProbe,mwifiex_sdio) +endef + +define KernelPackage/mwifiex-sdio/description + Kernel modules for Marvell 802.11n/802.11ac SDIO Wireless cards +endef + diff --git a/package/kernel/mac80211/patches/005-revert-devcoredump.patch b/package/kernel/mac80211/patches/005-revert-devcoredump.patch deleted file mode 100644 index d485d95586bd43..00000000000000 --- a/package/kernel/mac80211/patches/005-revert-devcoredump.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/compat/Makefile -+++ b/compat/Makefile -@@ -70,8 +70,6 @@ quiet_cmd_build_OID_registry = GEN $ - cmd_build_OID_registry = perl $(src)/build_OID_registry $< $@ - compat-$(CPTCFG_BPAUTO_ASN1_DECODER) += lib-asn1_decoder.o - compat-$(CPTCFG_BPAUTO_BUILD_SYSTEM_DATA_VERIFICATION) += lib-oid_registry.o --skcipher-objs += crypto-skcipher.o --obj-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += skcipher.o - compat-$(CPTCFG_BPAUTO_RHASHTABLE) += lib-rhashtable.o - cordic-objs += lib-cordic.o - obj-$(CPTCFG_BPAUTO_BUILD_CORDIC) += cordic.o diff --git a/package/kernel/mac80211/patches/006-fix-genl-multicast.patch b/package/kernel/mac80211/patches/006-fix-genl-multicast.patch deleted file mode 100644 index 42fd3e82711a35..00000000000000 --- a/package/kernel/mac80211/patches/006-fix-genl-multicast.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/compat/backport-4.12.c -+++ b/compat/backport-4.12.c -@@ -225,6 +225,7 @@ int bp_extack_genl_register_family(struc - - /* copy this since the family might access it directly */ - family->attrbuf = copy->family.attrbuf; -+ family->mcgrp_offset = copy->family.mcgrp_offset; - - mutex_lock(&copies_mutex); - list_add_tail(©->list, &copies_list); diff --git a/package/kernel/mac80211/patches/007-fix-linux-verification-h.patch b/package/kernel/mac80211/patches/007-fix-linux-verification-h.patch deleted file mode 100644 index 4011f1d3ba9380..00000000000000 --- a/package/kernel/mac80211/patches/007-fix-linux-verification-h.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/backport-include/linux/verification.h -+++ b/backport-include/linux/verification.h -@@ -1,7 +1,7 @@ - #ifndef __BP_VERIFICATION_H - #define __BP_VERIFICATION_H - #include --#ifndef CPTCFG_BPAUTO_BUILD_SYSTEM_DATA_VERIFICATION -+#if LINUX_VERSION_IS_GEQ(4,7,0) && !defined(CPTCFG_BPAUTO_BUILD_SYSTEM_DATA_VERIFICATION) - #include_next - #else - #include diff --git a/package/kernel/mac80211/patches/008-fix-genl-family-id.patch b/package/kernel/mac80211/patches/008-fix-genl-family-id.patch deleted file mode 100644 index ee8fa6c2bc577b..00000000000000 --- a/package/kernel/mac80211/patches/008-fix-genl-family-id.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/compat/backport-4.12.c -+++ b/compat/backport-4.12.c -@@ -224,6 +224,7 @@ int bp_extack_genl_register_family(struc - } - - /* copy this since the family might access it directly */ -+ family->id = copy->family.id; - family->attrbuf = copy->family.attrbuf; - family->mcgrp_offset = copy->family.mcgrp_offset; - diff --git a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch deleted file mode 100644 index d897b2b40eb8cd..00000000000000 --- a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch +++ /dev/null @@ -1,132 +0,0 @@ ---- a/local-symbols -+++ b/local-symbols -@@ -388,45 +388,6 @@ USB_IPHETH= - USB_SIERRA_NET= - USB_VL600= - USB_NET_CH9200= --SSB_POSSIBLE= --SSB= --SSB_SPROM= --SSB_BLOCKIO= --SSB_PCIHOST_POSSIBLE= --SSB_PCIHOST= --SSB_B43_PCI_BRIDGE= --SSB_PCMCIAHOST_POSSIBLE= --SSB_PCMCIAHOST= --SSB_SDIOHOST_POSSIBLE= --SSB_SDIOHOST= --SSB_HOST_SOC= --SSB_SILENT= --SSB_DEBUG= --SSB_SERIAL= --SSB_DRIVER_PCICORE_POSSIBLE= --SSB_DRIVER_PCICORE= --SSB_PCICORE_HOSTMODE= --SSB_DRIVER_MIPS= --SSB_SFLASH= --SSB_EMBEDDED= --SSB_DRIVER_EXTIF= --SSB_DRIVER_GIGE= --SSB_DRIVER_GPIO= --BCMA_POSSIBLE= --BCMA= --BCMA_BLOCKIO= --BCMA_HOST_PCI_POSSIBLE= --BCMA_HOST_PCI= --BCMA_HOST_SOC= --BCMA_DRIVER_PCI= --BCMA_DRIVER_PCI_HOSTMODE= --BCMA_DRIVER_MIPS= --BCMA_PFLASH= --BCMA_SFLASH= --BCMA_NFLASH= --BCMA_DRIVER_GMAC_CMN= --BCMA_DRIVER_GPIO= --BCMA_DEBUG= - NFC= - NFC_DIGITAL= - NFC_NCI= ---- a/drivers/net/wireless/broadcom/b43/main.c -+++ b/drivers/net/wireless/broadcom/b43/main.c -@@ -2876,7 +2876,7 @@ static struct ssb_device *b43_ssb_gpio_d - { - struct ssb_bus *bus = dev->dev->sdev->bus; - --#ifdef CPTCFG_SSB_DRIVER_PCICORE -+#ifdef CONFIG_SSB_DRIVER_PCICORE - return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev); - #else - return bus->chipco.dev; -@@ -4893,7 +4893,7 @@ static int b43_wireless_core_init(struct - } - if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW) - hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */ --#if defined(CPTCFG_B43_SSB) && defined(CPTCFG_SSB_DRIVER_PCICORE) -+#if defined(CPTCFG_B43_SSB) && defined(CONFIG_SSB_DRIVER_PCICORE) - if (dev->dev->bus_type == B43_BUS_SSB && - dev->dev->sdev->bus->bustype == SSB_BUSTYPE_PCI && - dev->dev->sdev->bus->pcicore.dev->id.revision <= 10) ---- a/drivers/net/wireless/broadcom/b43legacy/main.c -+++ b/drivers/net/wireless/broadcom/b43legacy/main.c -@@ -1937,7 +1937,7 @@ static int b43legacy_gpio_init(struct b4 - if (dev->dev->id.revision >= 2) - mask |= 0x0010; /* FIXME: This is redundant. */ - --#ifdef CPTCFG_SSB_DRIVER_PCICORE -+#ifdef CONFIG_SSB_DRIVER_PCICORE - pcidev = bus->pcicore.dev; - #endif - gpiodev = bus->chipco.dev ? : pcidev; -@@ -1956,7 +1956,7 @@ static void b43legacy_gpio_cleanup(struc - struct ssb_bus *bus = dev->dev->bus; - struct ssb_device *gpiodev, *pcidev = NULL; - --#ifdef CPTCFG_SSB_DRIVER_PCICORE -+#ifdef CONFIG_SSB_DRIVER_PCICORE - pcidev = bus->pcicore.dev; - #endif - gpiodev = bus->chipco.dev ? : pcidev; ---- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/Makefile -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/Makefile -@@ -42,6 +42,6 @@ brcmsmac-y := \ - brcms_trace_events.o \ - debug.o - --brcmsmac-$(CPTCFG_BCMA_DRIVER_GPIO) += led.o -+brcmsmac-$(CONFIG_BCMA_DRIVER_GPIO) += led.o - - obj-$(CPTCFG_BRCMSMAC) += brcmsmac.o ---- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.h -@@ -22,7 +22,7 @@ struct brcms_led { - bool active_low; - }; - --#ifdef CPTCFG_BCMA_DRIVER_GPIO -+#ifdef CONFIG_BCMA_DRIVER_GPIO - void brcms_led_unregister(struct brcms_info *wl); - int brcms_led_register(struct brcms_info *wl); - #else ---- a/Kconfig.sources -+++ b/Kconfig.sources -@@ -9,9 +9,6 @@ source "$BACKPORT_DIR/drivers/net/wirele - #source "$BACKPORT_DIR/drivers/net/ethernet/Kconfig" - source "$BACKPORT_DIR/drivers/net/usb/Kconfig" - --source "$BACKPORT_DIR/drivers/ssb/Kconfig" --source "$BACKPORT_DIR/drivers/bcma/Kconfig" -- - source "$BACKPORT_DIR/net/nfc/Kconfig" - - #source "$BACKPORT_DIR/drivers/media/Kconfig" ---- a/Makefile.kernel -+++ b/Makefile.kernel -@@ -42,8 +42,6 @@ obj-$(CPTCFG_MAC80211) += net/mac80211/ - obj-$(CPTCFG_WLAN) += drivers/net/wireless/ - #obj-$(CPTCFG_BT) += net/bluetooth/ - #obj-$(CPTCFG_BT) += drivers/bluetooth/ --obj-$(CPTCFG_SSB) += drivers/ssb/ --obj-$(CPTCFG_BCMA) += drivers/bcma/ - #obj-$(CPTCFG_ETHERNET) += drivers/net/ethernet/ - obj-$(CPTCFG_USB_NET_RNDIS_WLAN) += drivers/net/usb/ - obj-$(CPTCFG_NFC) += net/nfc/ diff --git a/package/kernel/mac80211/patches/081-ath10k-calibration-variant.patch b/package/kernel/mac80211/patches/081-ath10k-calibration-variant.patch deleted file mode 100644 index 2724027866adcb..00000000000000 --- a/package/kernel/mac80211/patches/081-ath10k-calibration-variant.patch +++ /dev/null @@ -1,111 +0,0 @@ -From d06f26c5c8a41f246a9c40862a77a55725cedbd3 Mon Sep 17 00:00:00 2001 -From: Sven Eckelmann -Date: Fri, 8 Dec 2017 11:37:42 +0100 -Subject: ath10k: search DT for qcom,ath10k-calibration-variant - -Board Data File (BDF) is loaded upon driver boot-up procedure. The right -board data file is identified on QCA4019 using bus, bmi-chip-id and -bmi-board-id. - -The problem, however, can occur when the (default) board data file cannot -fulfill with the vendor requirements and it is necessary to use a different -board data file. - -This problem was solved for SMBIOS by adding a special SMBIOS type 0xF8. -Something similar has to be provided for systems without SMBIOS but with -device trees. No solution was specified by QCA and therefore a new one has -to be found for ath10k. - -The device tree requires addition strings to define the variant name - - wifi@a000000 { - status = "okay"; - qcom,ath10k-calibration-variant = "RT-AC58U"; - }; - - wifi@a800000 { - status = "okay"; - qcom,ath10k-calibration-variant = "RT-AC58U"; - }; - -This would create the boarddata identifiers for the board-2.bin search - - * bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=RT-AC58U - * bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=RT-AC58U - -Signed-off-by: Sven Eckelmann -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/ath/ath10k/core.c | 40 ++++++++++++++++++++++++++++------ - 1 file changed, 33 insertions(+), 7 deletions(-) - ---- a/drivers/net/wireless/ath/ath10k/core.c -+++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -860,6 +860,28 @@ static int ath10k_core_check_smbios(stru - return 0; - } - -+static int ath10k_core_check_dt(struct ath10k *ar) -+{ -+ struct device_node *node; -+ const char *variant = NULL; -+ -+ node = ar->dev->of_node; -+ if (!node) -+ return -ENOENT; -+ -+ of_property_read_string(node, "qcom,ath10k-calibration-variant", -+ &variant); -+ if (!variant) -+ return -ENODATA; -+ -+ if (strscpy(ar->id.bdf_ext, variant, sizeof(ar->id.bdf_ext)) < 0) -+ ath10k_dbg(ar, ATH10K_DBG_BOOT, -+ "bdf variant string is longer than the buffer can accommodate (variant: %s)\n", -+ variant); -+ -+ return 0; -+} -+ - static int ath10k_download_and_run_otp(struct ath10k *ar) - { - u32 result, address = ar->hw_params.patch_load_addr; -@@ -1231,19 +1253,19 @@ static int ath10k_core_create_board_name - /* strlen(',variant=') + strlen(ar->id.bdf_ext) */ - char variant[9 + ATH10K_SMBIOS_BDF_EXT_STR_LENGTH] = { 0 }; - -+ if (ar->id.bdf_ext[0] != '\0') -+ scnprintf(variant, sizeof(variant), ",variant=%s", -+ ar->id.bdf_ext); -+ - if (ar->id.bmi_ids_valid) { - scnprintf(name, name_len, -- "bus=%s,bmi-chip-id=%d,bmi-board-id=%d", -+ "bus=%s,bmi-chip-id=%d,bmi-board-id=%d%s", - ath10k_bus_str(ar->hif.bus), - ar->id.bmi_chip_id, -- ar->id.bmi_board_id); -+ ar->id.bmi_board_id, variant); - goto out; - } - -- if (ar->id.bdf_ext[0] != '\0') -- scnprintf(variant, sizeof(variant), ",variant=%s", -- ar->id.bdf_ext); -- - scnprintf(name, name_len, - "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x%s", - ath10k_bus_str(ar->hif.bus), -@@ -2343,7 +2365,11 @@ static int ath10k_core_probe_fw(struct a - - ret = ath10k_core_check_smbios(ar); - if (ret) -- ath10k_dbg(ar, ATH10K_DBG_BOOT, "bdf variant name not set.\n"); -+ ath10k_dbg(ar, ATH10K_DBG_BOOT, "SMBIOS bdf variant name not set.\n"); -+ -+ ret = ath10k_core_check_dt(ar); -+ if (ret) -+ ath10k_dbg(ar, ATH10K_DBG_BOOT, "DT bdf variant name not set.\n"); - - ret = ath10k_core_fetch_board_file(ar); - if (ret) { diff --git a/package/kernel/mac80211/patches/082-ath10k-suppress-Unknown-eventid-36925-warnings.patch b/package/kernel/mac80211/patches/082-ath10k-suppress-Unknown-eventid-36925-warnings.patch deleted file mode 100644 index 9ddede3a674e40..00000000000000 --- a/package/kernel/mac80211/patches/082-ath10k-suppress-Unknown-eventid-36925-warnings.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 606204bb863fa3b0bb54929d79b4dc46338f9180 Mon Sep 17 00:00:00 2001 -From: Sathishkumar Muruganandam -Date: Tue, 27 Mar 2018 11:26:46 +0300 -Subject: [PATCH] ath10k: suppress "Unknown eventid: 36925" warnings - -FW has Smart Logging feature enabled by default for detecting failures -and processing FATAL_CONDITION_EVENTID (36925 - 0x903D) back to host. - -Since ath10k doesn't implement the Smart Logging and FATAL CONDITION -EVENT processing yet, suppressing the unknown event ID warning by moving -this under ATH10K_DBG_WMI. - -Simulated the same issue by having associated STA powered off when -ping flood was running from AP backbone. This triggerd STA KICKOUT -in AP followed by FATAL CONDITION event 36925. - -Issue was reproduced and verified in below DUT ------------------------------------------------- -AP mode of OpenWRT QCA9984 running 6.0.8 with FW ver 10.4-3.5.3-00053 - -Signed-off-by: Sathishkumar Muruganandam -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/ath/ath10k/wmi.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/ath/ath10k/wmi.c -+++ b/drivers/net/wireless/ath/ath10k/wmi.c -@@ -5462,6 +5462,7 @@ static void ath10k_wmi_10_4_op_rx(struct - case WMI_10_4_WOW_WAKEUP_HOST_EVENTID: - case WMI_10_4_PEER_RATECODE_LIST_EVENTID: - case WMI_10_4_WDS_PEER_EVENTID: -+ case WMI_10_4_DEBUG_FATAL_CONDITION_EVENTID: - ath10k_dbg(ar, ATH10K_DBG_WMI, - "received event id %d not implemented\n", id); - break; diff --git a/package/kernel/mac80211/patches/090-Revert-rt2800-use-TXOP_BACKOFF-for-probe-frames.patch b/package/kernel/mac80211/patches/090-Revert-rt2800-use-TXOP_BACKOFF-for-probe-frames.patch deleted file mode 100644 index 82a7cb6f466bf5..00000000000000 --- a/package/kernel/mac80211/patches/090-Revert-rt2800-use-TXOP_BACKOFF-for-probe-frames.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 52a192362932f333a7ebafd581c4d9b81da2fec8 Mon Sep 17 00:00:00 2001 -From: Stanislaw Gruszka -Date: Mon, 28 May 2018 13:25:06 +0200 -Subject: [PATCH] Revert "rt2800: use TXOP_BACKOFF for probe frames" - -This reverts commit fb47ada8dc3c30c8e7b415da155742b49536c61e. - -In some situations when we set TXOP_BACKOFF, the probe frame is -not sent at all. What it worse then sending probe frame as part -of AMPDU and can degrade 11n performance to 11g rates. - -Cc: stable@vger.kernel.org -Signed-off-by: Stanislaw Gruszka -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c -@@ -372,16 +372,15 @@ static void rt2x00queue_create_tx_descri - - /* - * Determine IFS values -- * - Use TXOP_BACKOFF for probe and management frames except beacons -+ * - Use TXOP_BACKOFF for management frames except beacons - * - Use TXOP_SIFS for fragment bursts - * - Use TXOP_HTTXOP for everything else - * - * Note: rt2800 devices won't use CTS protection (if used) - * for frames not transmitted with TXOP_HTTXOP - */ -- if ((ieee80211_is_mgmt(hdr->frame_control) && -- !ieee80211_is_beacon(hdr->frame_control)) || -- (tx_info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)) -+ if (ieee80211_is_mgmt(hdr->frame_control) && -+ !ieee80211_is_beacon(hdr->frame_control)) - txdesc->u.ht.txop = TXOP_BACKOFF; - else if (!(tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)) - txdesc->u.ht.txop = TXOP_SIFS; --- -2.17.1 - diff --git a/package/kernel/mac80211/patches/160-ath10k-search-all-IEs-for-variant-before-falling-back.patch b/package/kernel/mac80211/patches/160-ath10k-search-all-IEs-for-variant-before-falling-back.patch deleted file mode 100644 index 357b006bcc9257..00000000000000 --- a/package/kernel/mac80211/patches/160-ath10k-search-all-IEs-for-variant-before-falling-back.patch +++ /dev/null @@ -1,237 +0,0 @@ -From: Thomas Hebb -Subject: [PATCH] ath10k: search all IEs for variant before falling back -Date: Wed, 21 Feb 2018 11:43:39 -0500 - -commit f2593cb1b291 ("ath10k: Search SMBIOS for OEM board file -extension") added a feature to ath10k that allows Board Data File -(BDF) conflicts between multiple devices that use the same device IDs -but have different calibration requirements to be resolved by allowing -a "variant" string to be stored in SMBIOS [and later device tree, added -by commit d06f26c5c8a4 ("ath10k: search DT for qcom,ath10k-calibration- -variant")] that gets appended to the ID stored in board-2.bin. - -This original patch had a regression, however. Namely that devices with -a variant present in SMBIOS that didn't need custom BDFs could no longer -find the default BDF, which has no variant appended. The patch was -reverted and re-applied with a fix for this issue in commit 1657b8f84ed9 -("search SMBIOS for OEM board file extension"). - -But the fix to fall back to a default BDF introduced another issue: the -driver currently parses IEs in board-2.bin one by one, and for each one -it first checks to see if it matches the ID with the variant appended. -If it doesn't, it checks to see if it matches the "fallback" ID with no -variant. If a matching BDF is found at any point during this search, the -search is terminated and that BDF is used. The issue is that it's very -possible (and is currently the case for board-2.bin files present in the -ath10k-firmware repository) for the default BDF to occur in an earlier -IE than the variant-specific BDF. In this case, the current code will -happily choose the default BDF even though a better-matching BDF is -present later in the file. - -This patch fixes the issue by first searching the entire file for the ID -with variant, and searching for the fallback ID only if that search -fails. It also includes some code cleanup in the area, as -ath10k_core_fetch_board_data_api_n() no longer does its own string -mangling to remove the variant from an ID, instead leaving that job to a -new flag passed to ath10k_core_create_board_name(). - -I've tested this patch on a QCA4019 and verified that the driver behaves -correctly for 1) both fallback and variant BDFs present, 2) only fallback -BDF present, and 3) no matching BDFs present. - -Fixes: 1657b8f84ed9 ("ath10k: search SMBIOS for OEM board file extension") -Signed-off-by: Thomas Hebb ---- - drivers/net/wireless/ath/ath10k/core.c | 134 ++++++++++++++++++--------------- - 1 file changed, 72 insertions(+), 62 deletions(-) - ---- a/drivers/net/wireless/ath/ath10k/core.c -+++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -1132,14 +1132,61 @@ out: - return ret; - } - -+static int ath10k_core_search_bd(struct ath10k *ar, -+ const char *boardname, -+ const u8 *data, -+ size_t len) -+{ -+ size_t ie_len; -+ struct ath10k_fw_ie *hdr; -+ int ret = -ENOENT, ie_id; -+ -+ while (len > sizeof(struct ath10k_fw_ie)) { -+ hdr = (struct ath10k_fw_ie *)data; -+ ie_id = le32_to_cpu(hdr->id); -+ ie_len = le32_to_cpu(hdr->len); -+ -+ len -= sizeof(*hdr); -+ data = hdr->data; -+ -+ if (len < ALIGN(ie_len, 4)) { -+ ath10k_err(ar, "invalid length for board ie_id %d ie_len %zu len %zu\n", -+ ie_id, ie_len, len); -+ return -EINVAL; -+ } -+ -+ switch (ie_id) { -+ case ATH10K_BD_IE_BOARD: -+ ret = ath10k_core_parse_bd_ie_board(ar, data, ie_len, -+ boardname); -+ if (ret == -ENOENT) -+ /* no match found, continue */ -+ break; -+ -+ /* either found or error, so stop searching */ -+ goto out; -+ } -+ -+ /* jump over the padding */ -+ ie_len = ALIGN(ie_len, 4); -+ -+ len -= ie_len; -+ data += ie_len; -+ } -+ -+out: -+ /* return result of parse_bd_ie_board() or -ENOENT */ -+ return ret; -+} -+ - static int ath10k_core_fetch_board_data_api_n(struct ath10k *ar, - const char *boardname, -+ const char *fallback_boardname, - const char *filename) - { -- size_t len, magic_len, ie_len; -- struct ath10k_fw_ie *hdr; -+ size_t len, magic_len; - const u8 *data; -- int ret, ie_id; -+ int ret; - - ar->normal_mode_fw.board = ath10k_fetch_fw_file(ar, - ar->hw_params.fw.dir, -@@ -1177,69 +1224,23 @@ static int ath10k_core_fetch_board_data_ - data += magic_len; - len -= magic_len; - -- while (len > sizeof(struct ath10k_fw_ie)) { -- hdr = (struct ath10k_fw_ie *)data; -- ie_id = le32_to_cpu(hdr->id); -- ie_len = le32_to_cpu(hdr->len); -- -- len -= sizeof(*hdr); -- data = hdr->data; -- -- if (len < ALIGN(ie_len, 4)) { -- ath10k_err(ar, "invalid length for board ie_id %d ie_len %zu len %zu\n", -- ie_id, ie_len, len); -- ret = -EINVAL; -- goto err; -- } -+ /* attempt to find boardname in the IE list */ -+ ret = ath10k_core_search_bd(ar, boardname, data, len); - -- switch (ie_id) { -- case ATH10K_BD_IE_BOARD: -- ret = ath10k_core_parse_bd_ie_board(ar, data, ie_len, -- boardname); -- if (ret == -ENOENT && ar->id.bdf_ext[0] != '\0') { -- /* try default bdf if variant was not found */ -- char *s, *v = ",variant="; -- char boardname2[100]; -- -- strlcpy(boardname2, boardname, -- sizeof(boardname2)); -- -- s = strstr(boardname2, v); -- if (s) -- *s = '\0'; /* strip ",variant=%s" */ -- -- ret = ath10k_core_parse_bd_ie_board(ar, data, -- ie_len, -- boardname2); -- } -+ /* if we didn't find it and have a fallback name, try that */ -+ if (ret == -ENOENT && fallback_boardname) -+ ret = ath10k_core_search_bd(ar, fallback_boardname, data, len); - -- if (ret == -ENOENT) -- /* no match found, continue */ -- break; -- else if (ret) -- /* there was an error, bail out */ -- goto err; -- -- /* board data found */ -- goto out; -- } -- -- /* jump over the padding */ -- ie_len = ALIGN(ie_len, 4); -- -- len -= ie_len; -- data += ie_len; -- } -- --out: -- if (!ar->normal_mode_fw.board_data || !ar->normal_mode_fw.board_len) { -+ if (ret == -ENOENT) { - ath10k_err(ar, - "failed to fetch board data for %s from %s/%s\n", - boardname, ar->hw_params.fw.dir, filename); - ret = -ENODATA; -- goto err; - } - -+ if (ret) -+ goto err; -+ - return 0; - - err: -@@ -1248,12 +1249,12 @@ err: - } - - static int ath10k_core_create_board_name(struct ath10k *ar, char *name, -- size_t name_len) -+ size_t name_len, bool with_variant) - { - /* strlen(',variant=') + strlen(ar->id.bdf_ext) */ - char variant[9 + ATH10K_SMBIOS_BDF_EXT_STR_LENGTH] = { 0 }; - -- if (ar->id.bdf_ext[0] != '\0') -+ if (with_variant && ar->id.bdf_ext[0] != '\0') - scnprintf(variant, sizeof(variant), ",variant=%s", - ar->id.bdf_ext); - -@@ -1279,17 +1280,26 @@ out: - - static int ath10k_core_fetch_board_file(struct ath10k *ar) - { -- char boardname[100]; -+ char boardname[100], fallback_boardname[100]; - int ret; - -- ret = ath10k_core_create_board_name(ar, boardname, sizeof(boardname)); -+ ret = ath10k_core_create_board_name(ar, boardname, -+ sizeof(boardname), true); - if (ret) { - ath10k_err(ar, "failed to create board name: %d", ret); - return ret; - } - -+ ret = ath10k_core_create_board_name(ar, fallback_boardname, -+ sizeof(boardname), false); -+ if (ret) { -+ ath10k_err(ar, "failed to create fallback board name: %d", ret); -+ return ret; -+ } -+ - ar->bd_api = 2; - ret = ath10k_core_fetch_board_data_api_n(ar, boardname, -+ fallback_boardname, - ATH10K_BOARD_API2_FILE); - if (!ret) - goto success; diff --git a/package/kernel/mac80211/patches/300-v4.15-ath10k-fix-build-errors-with-CONFIG_PM.patch b/package/kernel/mac80211/patches/300-v4.15-ath10k-fix-build-errors-with-CONFIG_PM.patch deleted file mode 100644 index 2aeb49dc162943..00000000000000 --- a/package/kernel/mac80211/patches/300-v4.15-ath10k-fix-build-errors-with-CONFIG_PM.patch +++ /dev/null @@ -1,72 +0,0 @@ -From: Brian Norris -Date: Thu, 19 Oct 2017 11:45:19 -0700 -Subject: [PATCH] ath10k: fix build errors with !CONFIG_PM - -Build errors have been reported with CONFIG_PM=n: - -drivers/net/wireless/ath/ath10k/pci.c:3416:8: error: implicit -declaration of function 'ath10k_pci_suspend' -[-Werror=implicit-function-declaration] - -drivers/net/wireless/ath/ath10k/pci.c:3428:8: error: implicit -declaration of function 'ath10k_pci_resume' -[-Werror=implicit-function-declaration] - -These are caused by the combination of the following two commits: - -6af1de2e4ec4 ("ath10k: mark PM functions as __maybe_unused") -96378bd2c6cd ("ath10k: fix core PCI suspend when WoWLAN is supported but -disabled") - -Both build fine on their own. - -But now that ath10k_pci_pm_{suspend,resume}() is compiled -unconditionally, we should also compile ath10k_pci_{suspend,resume}() -unconditionally. - -And drop the #ifdef around ath10k_pci_hif_{suspend,resume}() too; they -are trivial (empty), so we're not saving much space by compiling them -out. And the alternatives would be to sprinkle more __maybe_unused, or -spread the #ifdef's further. - -Build tested with the following combinations: -CONFIG_PM=y && CONFIG_PM_SLEEP=y -CONFIG_PM=y && CONFIG_PM_SLEEP=n -CONFIG_PM=n - -Fixes: 96378bd2c6cd ("ath10k: fix core PCI suspend when WoWLAN is supported but disabled") -Fixes: 096ad2a15fd8 ("Merge branch 'ath-next'") -Signed-off-by: Brian Norris -Signed-off-by: Kalle Valo ---- - ---- a/drivers/net/wireless/ath/ath10k/pci.c -+++ b/drivers/net/wireless/ath/ath10k/pci.c -@@ -2577,8 +2577,6 @@ void ath10k_pci_hif_power_down(struct at - */ - } - --#ifdef CONFIG_PM -- - static int ath10k_pci_hif_suspend(struct ath10k *ar) - { - /* Nothing to do; the important stuff is in the driver suspend. */ -@@ -2627,7 +2625,6 @@ static int ath10k_pci_resume(struct ath1 - - return ret; - } --#endif - - static bool ath10k_pci_validate_cal(void *data, size_t size) - { -@@ -2782,10 +2779,8 @@ static const struct ath10k_hif_ops ath10 - .power_down = ath10k_pci_hif_power_down, - .read32 = ath10k_pci_read32, - .write32 = ath10k_pci_write32, --#ifdef CONFIG_PM - .suspend = ath10k_pci_hif_suspend, - .resume = ath10k_pci_hif_resume, --#endif - .fetch_cal_eeprom = ath10k_pci_hif_fetch_cal_eeprom, - }; - diff --git a/package/kernel/mac80211/patches/301-v4.15-mac80211-properly-free-requested-but-not-started-TX-.patch b/package/kernel/mac80211/patches/301-v4.15-mac80211-properly-free-requested-but-not-started-TX-.patch deleted file mode 100644 index ecc5e491207594..00000000000000 --- a/package/kernel/mac80211/patches/301-v4.15-mac80211-properly-free-requested-but-not-started-TX-.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: Johannes Berg -Date: Mon, 20 Nov 2017 17:01:44 +0100 -Subject: [PATCH] mac80211: properly free requested-but-not-started TX agg - sessions - -When deleting a station or otherwise tearing down all aggregation -sessions, make sure to delete requested but not yet started ones, -to avoid the following scenario: - - * session is requested, added to tid_start_tx[] - * ieee80211_ba_session_work() runs, gets past BLOCK_BA check - * ieee80211_sta_tear_down_BA_sessions() runs, locks &sta->ampdu_mlme.mtx, - e.g. while deleting the station - deleting all active sessions - * ieee80211_ba_session_work() continues since tear down flushes it, and - calls ieee80211_tx_ba_session_handle_start() for the new session, arms - the timer for it - * station deletion continues to __cleanup_single_sta() and frees the - session struct, while the timer is armed - -Reported-by: Fengguang Wu -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/agg-tx.c -+++ b/net/mac80211/agg-tx.c -@@ -330,6 +330,11 @@ int ___ieee80211_stop_tx_ba_session(stru - - spin_lock_bh(&sta->lock); - -+ /* free struct pending for start, if present */ -+ tid_tx = sta->ampdu_mlme.tid_start_tx[tid]; -+ kfree(tid_tx); -+ sta->ampdu_mlme.tid_start_tx[tid] = NULL; -+ - tid_tx = rcu_dereference_protected_tid_tx(sta, tid); - if (!tid_tx) { - spin_unlock_bh(&sta->lock); diff --git a/package/kernel/mac80211/patches/302-v4.15-mac80211-mesh-drop-frames-appearing-to-be-from-us.patch b/package/kernel/mac80211/patches/302-v4.15-mac80211-mesh-drop-frames-appearing-to-be-from-us.patch deleted file mode 100644 index 839e927880b49e..00000000000000 --- a/package/kernel/mac80211/patches/302-v4.15-mac80211-mesh-drop-frames-appearing-to-be-from-us.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Johannes Berg -Date: Thu, 4 Jan 2018 15:51:53 +0100 -Subject: [PATCH] mac80211: mesh: drop frames appearing to be from us - -If there are multiple mesh stations with the same MAC address, -they will both get confused and start throwing warnings. - -Obviously in this case nothing can actually work anyway, so just -drop frames that look like they're from ourselves early on. - -Reported-by: Gui Iribarren -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -3632,6 +3632,8 @@ static bool ieee80211_accept_frame(struc - } - return true; - case NL80211_IFTYPE_MESH_POINT: -+ if (ether_addr_equal(sdata->vif.addr, hdr->addr2)) -+ return false; - if (multicast) - return true; - return ether_addr_equal(sdata->vif.addr, hdr->addr1); diff --git a/package/kernel/mac80211/patches/303-v4.15-0001-brcmfmac-handle-FWHALT-mailbox-indication.patch b/package/kernel/mac80211/patches/303-v4.15-0001-brcmfmac-handle-FWHALT-mailbox-indication.patch deleted file mode 100644 index b8f3be1c8b196a..00000000000000 --- a/package/kernel/mac80211/patches/303-v4.15-0001-brcmfmac-handle-FWHALT-mailbox-indication.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 2fd3877b5bb7d39782c3205a1dcda02023b8514a Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Wed, 8 Nov 2017 14:36:31 +0100 -Subject: [PATCH] brcmfmac: handle FWHALT mailbox indication - -The firmware uses a mailbox to communicate to the host what is going -on. In the driver we validate the bit received. Various people seen -the following message: - - brcmfmac: brcmf_sdio_hostmail: Unknown mailbox data content: 0x40012 - -Bit 4 is cause of this message, but this actually indicates the firmware -has halted. Handle this bit by giving a more meaningful error message. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 14 ++++++++++---- - 1 file changed, 10 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -260,10 +260,11 @@ struct rte_console { - #define I_HMB_HOST_INT I_HMB_SW3 /* Miscellaneous Interrupt */ - - /* tohostmailboxdata */ --#define HMB_DATA_NAKHANDLED 1 /* retransmit NAK'd frame */ --#define HMB_DATA_DEVREADY 2 /* talk to host after enable */ --#define HMB_DATA_FC 4 /* per prio flowcontrol update flag */ --#define HMB_DATA_FWREADY 8 /* fw ready for protocol activity */ -+#define HMB_DATA_NAKHANDLED 0x0001 /* retransmit NAK'd frame */ -+#define HMB_DATA_DEVREADY 0x0002 /* talk to host after enable */ -+#define HMB_DATA_FC 0x0004 /* per prio flowcontrol update flag */ -+#define HMB_DATA_FWREADY 0x0008 /* fw ready for protocol activity */ -+#define HMB_DATA_FWHALT 0x0010 /* firmware halted */ - - #define HMB_DATA_FCDATA_MASK 0xff000000 - #define HMB_DATA_FCDATA_SHIFT 24 -@@ -1094,6 +1095,10 @@ static u32 brcmf_sdio_hostmail(struct br - offsetof(struct sdpcmd_regs, tosbmailbox)); - bus->sdcnt.f1regdata += 2; - -+ /* dongle indicates the firmware has halted/crashed */ -+ if (hmb_data & HMB_DATA_FWHALT) -+ brcmf_err("mailbox indicates firmware halted\n"); -+ - /* Dongle recomposed rx frames, accept them again */ - if (hmb_data & HMB_DATA_NAKHANDLED) { - brcmf_dbg(SDIO, "Dongle reports NAK handled, expect rtx of %d\n", -@@ -1151,6 +1156,7 @@ static u32 brcmf_sdio_hostmail(struct br - HMB_DATA_NAKHANDLED | - HMB_DATA_FC | - HMB_DATA_FWREADY | -+ HMB_DATA_FWHALT | - HMB_DATA_FCDATA_MASK | HMB_DATA_VERSION_MASK)) - brcmf_err("Unknown mailbox data content: 0x%02x\n", - hmb_data); diff --git a/package/kernel/mac80211/patches/303-v4.15-0002-brcmfmac-disable-packet-filtering-in-promiscuous-mod.patch b/package/kernel/mac80211/patches/303-v4.15-0002-brcmfmac-disable-packet-filtering-in-promiscuous-mod.patch deleted file mode 100644 index 901663193a8e5a..00000000000000 --- a/package/kernel/mac80211/patches/303-v4.15-0002-brcmfmac-disable-packet-filtering-in-promiscuous-mod.patch +++ /dev/null @@ -1,133 +0,0 @@ -From 6c219b0088158da839a5be63c5b3d96c145501d2 Mon Sep 17 00:00:00 2001 -From: Franky Lin -Date: Wed, 8 Nov 2017 14:36:32 +0100 -Subject: [PATCH] brcmfmac: disable packet filtering in promiscuous mode - -Disable arp and nd offload to allow all packets sending to host. - -Reported-by: Phil Elwell -Tested-by: Phil Elwell -Reviewed-by: Arend Van Spriel -Signed-off-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../broadcom/brcm80211/brcmfmac/cfg80211.c | 41 ---------------------- - .../wireless/broadcom/brcm80211/brcmfmac/core.c | 38 ++++++++++++++++++++ - .../wireless/broadcom/brcm80211/brcmfmac/core.h | 1 + - 3 files changed, 39 insertions(+), 41 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -472,47 +472,6 @@ send_key_to_dongle(struct brcmf_if *ifp, - return err; - } - --static s32 --brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable) --{ -- s32 err; -- u32 mode; -- -- if (enable) -- mode = BRCMF_ARP_OL_AGENT | BRCMF_ARP_OL_PEER_AUTO_REPLY; -- else -- mode = 0; -- -- /* Try to set and enable ARP offload feature, this may fail, then it */ -- /* is simply not supported and err 0 will be returned */ -- err = brcmf_fil_iovar_int_set(ifp, "arp_ol", mode); -- if (err) { -- brcmf_dbg(TRACE, "failed to set ARP offload mode to 0x%x, err = %d\n", -- mode, err); -- err = 0; -- } else { -- err = brcmf_fil_iovar_int_set(ifp, "arpoe", enable); -- if (err) { -- brcmf_dbg(TRACE, "failed to configure (%d) ARP offload err = %d\n", -- enable, err); -- err = 0; -- } else -- brcmf_dbg(TRACE, "successfully configured (%d) ARP offload to 0x%x\n", -- enable, mode); -- } -- -- err = brcmf_fil_iovar_int_set(ifp, "ndoe", enable); -- if (err) { -- brcmf_dbg(TRACE, "failed to configure (%d) ND offload err = %d\n", -- enable, err); -- err = 0; -- } else -- brcmf_dbg(TRACE, "successfully configured (%d) ND offload to 0x%x\n", -- enable, mode); -- -- return err; --} -- - static void - brcmf_cfg80211_update_proto_addr_mode(struct wireless_dev *wdev) - { ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -71,6 +71,43 @@ struct brcmf_if *brcmf_get_ifp(struct br - return ifp; - } - -+void brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable) -+{ -+ s32 err; -+ u32 mode; -+ -+ if (enable) -+ mode = BRCMF_ARP_OL_AGENT | BRCMF_ARP_OL_PEER_AUTO_REPLY; -+ else -+ mode = 0; -+ -+ /* Try to set and enable ARP offload feature, this may fail, then it */ -+ /* is simply not supported and err 0 will be returned */ -+ err = brcmf_fil_iovar_int_set(ifp, "arp_ol", mode); -+ if (err) { -+ brcmf_dbg(TRACE, "failed to set ARP offload mode to 0x%x, err = %d\n", -+ mode, err); -+ } else { -+ err = brcmf_fil_iovar_int_set(ifp, "arpoe", enable); -+ if (err) { -+ brcmf_dbg(TRACE, "failed to configure (%d) ARP offload err = %d\n", -+ enable, err); -+ } else { -+ brcmf_dbg(TRACE, "successfully configured (%d) ARP offload to 0x%x\n", -+ enable, mode); -+ } -+ } -+ -+ err = brcmf_fil_iovar_int_set(ifp, "ndoe", enable); -+ if (err) { -+ brcmf_dbg(TRACE, "failed to configure (%d) ND offload err = %d\n", -+ enable, err); -+ } else { -+ brcmf_dbg(TRACE, "successfully configured (%d) ND offload to 0x%x\n", -+ enable, mode); -+ } -+} -+ - static void _brcmf_set_multicast_list(struct work_struct *work) - { - struct brcmf_if *ifp; -@@ -134,6 +171,7 @@ static void _brcmf_set_multicast_list(st - if (err < 0) - brcmf_err("Setting BRCMF_C_SET_PROMISC failed, %d\n", - err); -+ brcmf_configure_arp_nd_offload(ifp, !cmd_value); - } - - #if IS_ENABLED(CONFIG_IPV6) ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -@@ -203,6 +203,7 @@ int brcmf_netdev_wait_pend8021x(struct b - /* Return pointer to interface name */ - char *brcmf_ifname(struct brcmf_if *ifp); - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx); -+void brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable); - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked); - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx, - bool is_p2pdev, const char *name, u8 *mac_addr); diff --git a/package/kernel/mac80211/patches/303-v4.15-0003-brcmfmac-cleanup-brcmf_cfg80211_escan-function.patch b/package/kernel/mac80211/patches/303-v4.15-0003-brcmfmac-cleanup-brcmf_cfg80211_escan-function.patch deleted file mode 100644 index b6f3d0c6979da0..00000000000000 --- a/package/kernel/mac80211/patches/303-v4.15-0003-brcmfmac-cleanup-brcmf_cfg80211_escan-function.patch +++ /dev/null @@ -1,133 +0,0 @@ -From 8c6efda22f5f9f73fc948f517424466be01ae84d Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Wed, 8 Nov 2017 14:36:33 +0100 -Subject: [PATCH] brcmfmac: cleanup brcmf_cfg80211_escan() function - -The function brcmf_cfg80211_escan() was always called with a non-null -request parameter and null pointer for this_ssid parameter. Clean up -the function removing the dead code path. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../broadcom/brcm80211/brcmfmac/cfg80211.c | 76 ++++------------------ - 1 file changed, 11 insertions(+), 65 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -1072,18 +1072,10 @@ brcmf_do_escan(struct brcmf_if *ifp, str - - static s32 - brcmf_cfg80211_escan(struct wiphy *wiphy, struct brcmf_cfg80211_vif *vif, -- struct cfg80211_scan_request *request, -- struct cfg80211_ssid *this_ssid) -+ struct cfg80211_scan_request *request) - { -- struct brcmf_if *ifp = vif->ifp; - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); -- struct cfg80211_ssid *ssids; -- u32 passive_scan; -- bool escan_req; -- bool spec_scan; - s32 err; -- struct brcmf_ssid_le ssid_le; -- u32 SSID_len; - - brcmf_dbg(SCAN, "START ESCAN\n"); - -@@ -1101,8 +1093,8 @@ brcmf_cfg80211_escan(struct wiphy *wiphy - cfg->scan_status); - return -EAGAIN; - } -- if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state)) { -- brcmf_err("Connecting: status (%lu)\n", ifp->vif->sme_state); -+ if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state)) { -+ brcmf_err("Connecting: status (%lu)\n", vif->sme_state); - return -EAGAIN; - } - -@@ -1110,63 +1102,17 @@ brcmf_cfg80211_escan(struct wiphy *wiphy - if (vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif) - vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif; - -- escan_req = false; -- if (request) { -- /* scan bss */ -- ssids = request->ssids; -- escan_req = true; -- } else { -- /* scan in ibss */ -- /* we don't do escan in ibss */ -- ssids = this_ssid; -- } -- - cfg->scan_request = request; - set_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); -- if (escan_req) { -- cfg->escan_info.run = brcmf_run_escan; -- err = brcmf_p2p_scan_prep(wiphy, request, vif); -- if (err) -- goto scan_out; -- -- err = brcmf_do_escan(vif->ifp, request); -- if (err) -- goto scan_out; -- } else { -- brcmf_dbg(SCAN, "ssid \"%s\", ssid_len (%d)\n", -- ssids->ssid, ssids->ssid_len); -- memset(&ssid_le, 0, sizeof(ssid_le)); -- SSID_len = min_t(u8, sizeof(ssid_le.SSID), ssids->ssid_len); -- ssid_le.SSID_len = cpu_to_le32(0); -- spec_scan = false; -- if (SSID_len) { -- memcpy(ssid_le.SSID, ssids->ssid, SSID_len); -- ssid_le.SSID_len = cpu_to_le32(SSID_len); -- spec_scan = true; -- } else -- brcmf_dbg(SCAN, "Broadcast scan\n"); -- -- passive_scan = cfg->active_scan ? 0 : 1; -- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PASSIVE_SCAN, -- passive_scan); -- if (err) { -- brcmf_err("WLC_SET_PASSIVE_SCAN error (%d)\n", err); -- goto scan_out; -- } -- brcmf_scan_config_mpc(ifp, 0); -- err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN, &ssid_le, -- sizeof(ssid_le)); -- if (err) { -- if (err == -EBUSY) -- brcmf_dbg(INFO, "BUSY: scan for \"%s\" canceled\n", -- ssid_le.SSID); -- else -- brcmf_err("WLC_SCAN error (%d)\n", err); -- -- brcmf_scan_config_mpc(ifp, 1); -- goto scan_out; -- } -- } -+ -+ cfg->escan_info.run = brcmf_run_escan; -+ err = brcmf_p2p_scan_prep(wiphy, request, vif); -+ if (err) -+ goto scan_out; -+ -+ err = brcmf_do_escan(vif->ifp, request); -+ if (err) -+ goto scan_out; - - /* Arm scan timeout timer */ - mod_timer(&cfg->escan_timeout, jiffies + -@@ -1191,7 +1137,7 @@ brcmf_cfg80211_scan(struct wiphy *wiphy, - if (!check_vif_up(vif)) - return -EIO; - -- err = brcmf_cfg80211_escan(wiphy, vif, request, NULL); -+ err = brcmf_cfg80211_escan(wiphy, vif, request); - - if (err) - brcmf_err("scan error (%d)\n", err); diff --git a/package/kernel/mac80211/patches/303-v4.15-0004-brcmfmac-use-msecs_to_jiffies-instead-of-calculation.patch b/package/kernel/mac80211/patches/303-v4.15-0004-brcmfmac-use-msecs_to_jiffies-instead-of-calculation.patch deleted file mode 100644 index c2e3cba52d5b18..00000000000000 --- a/package/kernel/mac80211/patches/303-v4.15-0004-brcmfmac-use-msecs_to_jiffies-instead-of-calculation.patch +++ /dev/null @@ -1,31 +0,0 @@ -From df2d8388bc96c0f29d27d121f2a4cd054f8b3900 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Wed, 8 Nov 2017 14:36:34 +0100 -Subject: [PATCH] brcmfmac: use msecs_to_jiffies() instead of calculation using - HZ - -Minor cleanup using provided macro to convert milliseconds interval -to jiffies in brcmf_cfg80211_escan(). - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -1115,8 +1115,8 @@ brcmf_cfg80211_escan(struct wiphy *wiphy - goto scan_out; - - /* Arm scan timeout timer */ -- mod_timer(&cfg->escan_timeout, jiffies + -- BRCMF_ESCAN_TIMER_INTERVAL_MS * HZ / 1000); -+ mod_timer(&cfg->escan_timeout, -+ jiffies + msecs_to_jiffies(BRCMF_ESCAN_TIMER_INTERVAL_MS)); - - return 0; - diff --git a/package/kernel/mac80211/patches/303-v4.15-0005-brcmfmac-get-rid-of-brcmf_cfg80211_escan-function.patch b/package/kernel/mac80211/patches/303-v4.15-0005-brcmfmac-get-rid-of-brcmf_cfg80211_escan-function.patch deleted file mode 100644 index 575ffb01834b0c..00000000000000 --- a/package/kernel/mac80211/patches/303-v4.15-0005-brcmfmac-get-rid-of-brcmf_cfg80211_escan-function.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 588378f15cff285ac81c929239ccba01d7f71d50 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Wed, 8 Nov 2017 14:36:35 +0100 -Subject: [PATCH] brcmfmac: get rid of brcmf_cfg80211_escan() function - -The function brcmf_cfg80211_escan() is only called by brcmf_cfg80211_scan() -so there is no reason to split in two function especially since the latter -does not do an awful lot. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../broadcom/brcm80211/brcmfmac/cfg80211.c | 34 +++++++--------------- - 1 file changed, 10 insertions(+), 24 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -1071,13 +1071,16 @@ brcmf_do_escan(struct brcmf_if *ifp, str - } - - static s32 --brcmf_cfg80211_escan(struct wiphy *wiphy, struct brcmf_cfg80211_vif *vif, -- struct cfg80211_scan_request *request) -+brcmf_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) - { - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); -- s32 err; -+ struct brcmf_cfg80211_vif *vif; -+ s32 err = 0; - -- brcmf_dbg(SCAN, "START ESCAN\n"); -+ brcmf_dbg(TRACE, "Enter\n"); -+ vif = container_of(request->wdev, struct brcmf_cfg80211_vif, wdev); -+ if (!check_vif_up(vif)) -+ return -EIO; - - if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { - brcmf_err("Scanning already: status (%lu)\n", cfg->scan_status); -@@ -1102,6 +1105,8 @@ brcmf_cfg80211_escan(struct wiphy *wiphy - if (vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif) - vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif; - -+ brcmf_dbg(SCAN, "START ESCAN\n"); -+ - cfg->scan_request = request; - set_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); - -@@ -1121,31 +1126,12 @@ brcmf_cfg80211_escan(struct wiphy *wiphy - return 0; - - scan_out: -+ brcmf_err("scan error (%d)\n", err); - clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); - cfg->scan_request = NULL; - return err; - } - --static s32 --brcmf_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) --{ -- struct brcmf_cfg80211_vif *vif; -- s32 err = 0; -- -- brcmf_dbg(TRACE, "Enter\n"); -- vif = container_of(request->wdev, struct brcmf_cfg80211_vif, wdev); -- if (!check_vif_up(vif)) -- return -EIO; -- -- err = brcmf_cfg80211_escan(wiphy, vif, request); -- -- if (err) -- brcmf_err("scan error (%d)\n", err); -- -- brcmf_dbg(TRACE, "Exit\n"); -- return err; --} -- - static s32 brcmf_set_rts(struct net_device *ndev, u32 rts_threshold) - { - s32 err = 0; diff --git a/package/kernel/mac80211/patches/303-v4.15-0006-brcmfmac-get-rid-of-struct-brcmf_cfg80211_info-activ.patch b/package/kernel/mac80211/patches/303-v4.15-0006-brcmfmac-get-rid-of-struct-brcmf_cfg80211_info-activ.patch deleted file mode 100644 index 4d4235f4b069f4..00000000000000 --- a/package/kernel/mac80211/patches/303-v4.15-0006-brcmfmac-get-rid-of-struct-brcmf_cfg80211_info-activ.patch +++ /dev/null @@ -1,86 +0,0 @@ -From bbf35414cd23a9d7230bfd7046e1e2c26020e7eb Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Wed, 8 Nov 2017 14:36:36 +0100 -Subject: [PATCH] brcmfmac: get rid of struct brcmf_cfg80211_info::active_scan - field - -The field struct brcmf_cfg80211_info::active_scan is set to true upon -initializing the driver instance, but it is never changed so simply -get rid of it. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 10 +--------- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h | 2 -- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 5 +---- - 3 files changed, 2 insertions(+), 15 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -1043,7 +1043,6 @@ brcmf_do_escan(struct brcmf_if *ifp, str - { - struct brcmf_cfg80211_info *cfg = ifp->drvr->config; - s32 err; -- u32 passive_scan; - struct brcmf_scan_results *results; - struct escan_info *escan = &cfg->escan_info; - -@@ -1051,13 +1050,7 @@ brcmf_do_escan(struct brcmf_if *ifp, str - escan->ifp = ifp; - escan->wiphy = cfg->wiphy; - escan->escan_state = WL_ESCAN_STATE_SCANNING; -- passive_scan = cfg->active_scan ? 0 : 1; -- err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PASSIVE_SCAN, -- passive_scan); -- if (err) { -- brcmf_err("error (%d)\n", err); -- return err; -- } -+ - brcmf_scan_config_mpc(ifp, 0); - results = (struct brcmf_scan_results *)cfg->escan_info.escan_buf; - results->version = 0; -@@ -5767,7 +5760,6 @@ static s32 wl_init_priv(struct brcmf_cfg - - cfg->scan_request = NULL; - cfg->pwr_save = true; -- cfg->active_scan = true; /* we do active scan per default */ - cfg->dongle_up = false; /* dongle is not up yet */ - err = brcmf_init_priv_mem(cfg); - if (err) ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h -@@ -283,7 +283,6 @@ struct brcmf_cfg80211_wowl { - * @scan_status: scan activity on the dongle. - * @pub: common driver information. - * @channel: current channel. -- * @active_scan: current scan mode. - * @int_escan_map: bucket map for which internal e-scan is done. - * @ibss_starter: indicates this sta is ibss starter. - * @pwr_save: indicate whether dongle to support power save mode. -@@ -316,7 +315,6 @@ struct brcmf_cfg80211_info { - unsigned long scan_status; - struct brcmf_pub *pub; - u32 channel; -- bool active_scan; - u32 int_escan_map; - bool ibss_starter; - bool pwr_save; ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c -@@ -692,10 +692,7 @@ static s32 brcmf_p2p_escan(struct brcmf_ - - /* determine the scan engine parameters */ - sparams->bss_type = DOT11_BSSTYPE_ANY; -- if (p2p->cfg->active_scan) -- sparams->scan_type = 0; -- else -- sparams->scan_type = 1; -+ sparams->scan_type = BRCMF_SCANTYPE_ACTIVE; - - eth_broadcast_addr(sparams->bssid); - sparams->home_time = cpu_to_le32(P2PAPI_SCAN_HOME_TIME_MS); diff --git a/package/kernel/mac80211/patches/303-v4.15-0007-brcmfmac-move-configuration-of-probe-request-IEs.patch b/package/kernel/mac80211/patches/303-v4.15-0007-brcmfmac-move-configuration-of-probe-request-IEs.patch deleted file mode 100644 index 3ad6e79db7dcf9..00000000000000 --- a/package/kernel/mac80211/patches/303-v4.15-0007-brcmfmac-move-configuration-of-probe-request-IEs.patch +++ /dev/null @@ -1,55 +0,0 @@ -From bd99a3013bdc00f8fc7534c657b39616792b4467 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Wed, 8 Nov 2017 14:36:37 +0100 -Subject: [PATCH] brcmfmac: move configuration of probe request IEs - -The configuration of the IEs for probe requests was done in a P2P -related function, which is not very obvious. Moving it to -.scan callback function, ie. brcmf_cfg80211_scan(). - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 5 +++++ - drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 6 ++---- - 2 files changed, 7 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -1108,6 +1108,11 @@ brcmf_cfg80211_scan(struct wiphy *wiphy, - if (err) - goto scan_out; - -+ err = brcmf_vif_set_mgmt_ie(vif, BRCMF_VNDR_IE_PRBREQ_FLAG, -+ request->ie, request->ie_len); -+ if (err) -+ goto scan_out; -+ - err = brcmf_do_escan(vif->ifp, request); - if (err) - goto scan_out; ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c -@@ -881,7 +881,7 @@ int brcmf_p2p_scan_prep(struct wiphy *wi - { - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct brcmf_p2p_info *p2p = &cfg->p2p; -- int err = 0; -+ int err; - - if (brcmf_p2p_scan_is_p2p_request(request)) { - /* find my listen channel */ -@@ -904,9 +904,7 @@ int brcmf_p2p_scan_prep(struct wiphy *wi - /* override .run_escan() callback. */ - cfg->escan_info.run = brcmf_p2p_run_escan; - } -- err = brcmf_vif_set_mgmt_ie(vif, BRCMF_VNDR_IE_PRBREQ_FLAG, -- request->ie, request->ie_len); -- return err; -+ return 0; - } - - diff --git a/package/kernel/mac80211/patches/304-v4.15-brcmfmac-add-CLM-download-support.patch b/package/kernel/mac80211/patches/304-v4.15-brcmfmac-add-CLM-download-support.patch deleted file mode 100644 index 2cd5f731262a82..00000000000000 --- a/package/kernel/mac80211/patches/304-v4.15-brcmfmac-add-CLM-download-support.patch +++ /dev/null @@ -1,434 +0,0 @@ -From fdd0bd88ceaecf729db103ac8836af5805dd2dc1 Mon Sep 17 00:00:00 2001 -From: Chung-Hsien Hsu -Date: Fri, 10 Nov 2017 17:27:15 +0800 -Subject: [PATCH] brcmfmac: add CLM download support - -The firmware for brcmfmac devices includes information regarding -regulatory constraints. For certain devices this information is kept -separately in a binary form that needs to be downloaded to the device. -This patch adds support to download this so-called CLM blob file. It -uses the same naming scheme as the other firmware files with extension -of .clm_blob. - -The CLM blob file is optional. If the file does not exist, the download -process will be bypassed. It will not affect the driver loading. - -Reviewed-by: Arend van Spriel -Signed-off-by: Chung-Hsien Hsu -Signed-off-by: Kalle Valo ---- - .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 10 ++ - .../wireless/broadcom/brcm80211/brcmfmac/common.c | 157 +++++++++++++++++++++ - .../wireless/broadcom/brcm80211/brcmfmac/core.c | 2 + - .../wireless/broadcom/brcm80211/brcmfmac/core.h | 2 + - .../broadcom/brcm80211/brcmfmac/fwil_types.h | 31 ++++ - .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 19 +++ - .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 19 +++ - .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 18 +++ - 8 files changed, 258 insertions(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h -@@ -71,6 +71,7 @@ struct brcmf_bus_dcmd { - * @wowl_config: specify if dongle is configured for wowl when going to suspend - * @get_ramsize: obtain size of device memory. - * @get_memdump: obtain device memory dump in provided buffer. -+ * @get_fwname: obtain firmware name. - * - * This structure provides an abstract interface towards the - * bus specific driver. For control messages to common driver -@@ -87,6 +88,8 @@ struct brcmf_bus_ops { - void (*wowl_config)(struct device *dev, bool enabled); - size_t (*get_ramsize)(struct device *dev); - int (*get_memdump)(struct device *dev, void *data, size_t len); -+ int (*get_fwname)(struct device *dev, uint chip, uint chiprev, -+ unsigned char *fw_name); - }; - - -@@ -224,6 +227,13 @@ int brcmf_bus_get_memdump(struct brcmf_b - return bus->ops->get_memdump(bus->dev, data, len); - } - -+static inline -+int brcmf_bus_get_fwname(struct brcmf_bus *bus, uint chip, uint chiprev, -+ unsigned char *fw_name) -+{ -+ return bus->ops->get_fwname(bus->dev, chip, chiprev, fw_name); -+} -+ - /* - * interface functions from common layer - */ ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -@@ -18,6 +18,7 @@ - #include - #include - #include -+#include - #include - #include - #include "core.h" -@@ -28,6 +29,7 @@ - #include "tracepoint.h" - #include "common.h" - #include "of.h" -+#include "firmware.h" - - MODULE_AUTHOR("Broadcom Corporation"); - MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver."); -@@ -104,12 +106,140 @@ void brcmf_c_set_joinpref_default(struct - brcmf_err("Set join_pref error (%d)\n", err); - } - -+static int brcmf_c_download(struct brcmf_if *ifp, u16 flag, -+ struct brcmf_dload_data_le *dload_buf, -+ u32 len) -+{ -+ s32 err; -+ -+ flag |= (DLOAD_HANDLER_VER << DLOAD_FLAG_VER_SHIFT); -+ dload_buf->flag = cpu_to_le16(flag); -+ dload_buf->dload_type = cpu_to_le16(DL_TYPE_CLM); -+ dload_buf->len = cpu_to_le32(len); -+ dload_buf->crc = cpu_to_le32(0); -+ len = sizeof(*dload_buf) + len - 1; -+ -+ err = brcmf_fil_iovar_data_set(ifp, "clmload", dload_buf, len); -+ -+ return err; -+} -+ -+static int brcmf_c_get_clm_name(struct brcmf_if *ifp, u8 *clm_name) -+{ -+ struct brcmf_bus *bus = ifp->drvr->bus_if; -+ struct brcmf_rev_info *ri = &ifp->drvr->revinfo; -+ u8 fw_name[BRCMF_FW_NAME_LEN]; -+ u8 *ptr; -+ size_t len; -+ s32 err; -+ -+ memset(fw_name, 0, BRCMF_FW_NAME_LEN); -+ err = brcmf_bus_get_fwname(bus, ri->chipnum, ri->chiprev, fw_name); -+ if (err) { -+ brcmf_err("get firmware name failed (%d)\n", err); -+ goto done; -+ } -+ -+ /* generate CLM blob file name */ -+ ptr = strrchr(fw_name, '.'); -+ if (!ptr) { -+ err = -ENOENT; -+ goto done; -+ } -+ -+ len = ptr - fw_name + 1; -+ if (len + strlen(".clm_blob") > BRCMF_FW_NAME_LEN) { -+ err = -E2BIG; -+ } else { -+ strlcpy(clm_name, fw_name, len); -+ strlcat(clm_name, ".clm_blob", BRCMF_FW_NAME_LEN); -+ } -+done: -+ return err; -+} -+ -+static int brcmf_c_process_clm_blob(struct brcmf_if *ifp) -+{ -+ struct device *dev = ifp->drvr->bus_if->dev; -+ struct brcmf_dload_data_le *chunk_buf; -+ const struct firmware *clm = NULL; -+ u8 clm_name[BRCMF_FW_NAME_LEN]; -+ u32 chunk_len; -+ u32 datalen; -+ u32 cumulative_len; -+ u16 dl_flag = DL_BEGIN; -+ u32 status; -+ s32 err; -+ -+ brcmf_dbg(TRACE, "Enter\n"); -+ -+ memset(clm_name, 0, BRCMF_FW_NAME_LEN); -+ err = brcmf_c_get_clm_name(ifp, clm_name); -+ if (err) { -+ brcmf_err("get CLM blob file name failed (%d)\n", err); -+ return err; -+ } -+ -+ err = request_firmware(&clm, clm_name, dev); -+ if (err) { -+ if (err == -ENOENT) { -+ brcmf_dbg(INFO, "continue with CLM data currently present in firmware\n"); -+ return 0; -+ } -+ brcmf_err("request CLM blob file failed (%d)\n", err); -+ return err; -+ } -+ -+ chunk_buf = kzalloc(sizeof(*chunk_buf) + MAX_CHUNK_LEN - 1, GFP_KERNEL); -+ if (!chunk_buf) { -+ err = -ENOMEM; -+ goto done; -+ } -+ -+ datalen = clm->size; -+ cumulative_len = 0; -+ do { -+ if (datalen > MAX_CHUNK_LEN) { -+ chunk_len = MAX_CHUNK_LEN; -+ } else { -+ chunk_len = datalen; -+ dl_flag |= DL_END; -+ } -+ memcpy(chunk_buf->data, clm->data + cumulative_len, chunk_len); -+ -+ err = brcmf_c_download(ifp, dl_flag, chunk_buf, chunk_len); -+ -+ dl_flag &= ~DL_BEGIN; -+ -+ cumulative_len += chunk_len; -+ datalen -= chunk_len; -+ } while ((datalen > 0) && (err == 0)); -+ -+ if (err) { -+ brcmf_err("clmload (%zu byte file) failed (%d); ", -+ clm->size, err); -+ /* Retrieve clmload_status and print */ -+ err = brcmf_fil_iovar_int_get(ifp, "clmload_status", &status); -+ if (err) -+ brcmf_err("get clmload_status failed (%d)\n", err); -+ else -+ brcmf_dbg(INFO, "clmload_status=%d\n", status); -+ err = -EIO; -+ } -+ -+ kfree(chunk_buf); -+done: -+ release_firmware(clm); -+ return err; -+} -+ - int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) - { - s8 eventmask[BRCMF_EVENTING_MASK_LEN]; - u8 buf[BRCMF_DCMD_SMLEN]; - struct brcmf_rev_info_le revinfo; - struct brcmf_rev_info *ri; -+ char *clmver; - char *ptr; - s32 err; - -@@ -148,6 +278,13 @@ int brcmf_c_preinit_dcmds(struct brcmf_i - } - ri->result = err; - -+ /* Do any CLM downloading */ -+ err = brcmf_c_process_clm_blob(ifp); -+ if (err < 0) { -+ brcmf_err("download CLM blob file failed, %d\n", err); -+ goto done; -+ } -+ - /* query for 'ver' to get version info from firmware */ - memset(buf, 0, sizeof(buf)); - strcpy(buf, "ver"); -@@ -167,6 +304,26 @@ int brcmf_c_preinit_dcmds(struct brcmf_i - ptr = strrchr(buf, ' ') + 1; - strlcpy(ifp->drvr->fwver, ptr, sizeof(ifp->drvr->fwver)); - -+ /* Query for 'clmver' to get CLM version info from firmware */ -+ memset(buf, 0, sizeof(buf)); -+ err = brcmf_fil_iovar_data_get(ifp, "clmver", buf, sizeof(buf)); -+ if (err) { -+ brcmf_dbg(TRACE, "retrieving clmver failed, %d\n", err); -+ } else { -+ clmver = (char *)buf; -+ /* store CLM version for adding it to revinfo debugfs file */ -+ memcpy(ifp->drvr->clmver, clmver, sizeof(ifp->drvr->clmver)); -+ -+ /* Replace all newline/linefeed characters with space -+ * character -+ */ -+ ptr = clmver; -+ while ((ptr = strnchr(ptr, '\n', sizeof(buf))) != NULL) -+ *ptr = ' '; -+ -+ brcmf_dbg(INFO, "CLM version = %s\n", clmver); -+ } -+ - /* set mpc */ - err = brcmf_fil_iovar_int_set(ifp, "mpc", 1); - if (err) { ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1009,6 +1009,8 @@ static int brcmf_revinfo_read(struct seq - seq_printf(s, "anarev: %u\n", ri->anarev); - seq_printf(s, "nvramrev: %08x\n", ri->nvramrev); - -+ seq_printf(s, "clmver: %s\n", bus_if->drvr->clmver); -+ - return 0; - } - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -@@ -141,6 +141,8 @@ struct brcmf_pub { - struct notifier_block inetaddr_notifier; - struct notifier_block inet6addr_notifier; - struct brcmf_mp_device *settings; -+ -+ u8 clmver[BRCMF_DCMD_SMLEN]; - }; - - /* forward declarations */ ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h -@@ -155,6 +155,21 @@ - #define BRCMF_MFP_CAPABLE 1 - #define BRCMF_MFP_REQUIRED 2 - -+/* MAX_CHUNK_LEN is the maximum length for data passing to firmware in each -+ * ioctl. It is relatively small because firmware has small maximum size input -+ * playload restriction for ioctls. -+ */ -+#define MAX_CHUNK_LEN 1400 -+ -+#define DLOAD_HANDLER_VER 1 /* Downloader version */ -+#define DLOAD_FLAG_VER_MASK 0xf000 /* Downloader version mask */ -+#define DLOAD_FLAG_VER_SHIFT 12 /* Downloader version shift */ -+ -+#define DL_BEGIN 0x0002 -+#define DL_END 0x0004 -+ -+#define DL_TYPE_CLM 2 -+ - /* join preference types for join_pref iovar */ - enum brcmf_join_pref_types { - BRCMF_JOIN_PREF_RSSI = 1, -@@ -827,6 +842,22 @@ struct brcmf_pno_macaddr_le { - }; - - /** -+ * struct brcmf_dload_data_le - data passing to firmware for downloading -+ * @flag: flags related to download data. -+ * @dload_type: type of download data. -+ * @len: length in bytes of download data. -+ * @crc: crc of download data. -+ * @data: download data. -+ */ -+struct brcmf_dload_data_le { -+ __le16 flag; -+ __le16 dload_type; -+ __le32 len; -+ __le32 crc; -+ u8 data[1]; -+}; -+ -+/** - * struct brcmf_pno_bssid_le - bssid configuration for PNO scan. - * - * @bssid: BSS network identifier. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -@@ -1350,6 +1350,24 @@ static int brcmf_pcie_get_memdump(struct - return 0; - } - -+static int brcmf_pcie_get_fwname(struct device *dev, u32 chip, u32 chiprev, -+ u8 *fw_name) -+{ -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev); -+ struct brcmf_pciedev *buspub = bus_if->bus_priv.pcie; -+ struct brcmf_pciedev_info *devinfo = buspub->devinfo; -+ int ret = 0; -+ -+ if (devinfo->fw_name[0] != '\0') -+ strlcpy(fw_name, devinfo->fw_name, BRCMF_FW_NAME_LEN); -+ else -+ ret = brcmf_fw_map_chip_to_name(chip, chiprev, -+ brcmf_pcie_fwnames, -+ ARRAY_SIZE(brcmf_pcie_fwnames), -+ fw_name, NULL); -+ -+ return ret; -+} - - static const struct brcmf_bus_ops brcmf_pcie_bus_ops = { - .txdata = brcmf_pcie_tx, -@@ -1359,6 +1377,7 @@ static const struct brcmf_bus_ops brcmf_ - .wowl_config = brcmf_pcie_wowl_config, - .get_ramsize = brcmf_pcie_get_ramsize, - .get_memdump = brcmf_pcie_get_memdump, -+ .get_fwname = brcmf_pcie_get_fwname, - }; - - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -3985,6 +3985,24 @@ brcmf_sdio_watchdog(unsigned long data) - } - } - -+static int brcmf_sdio_get_fwname(struct device *dev, u32 chip, u32 chiprev, -+ u8 *fw_name) -+{ -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev); -+ struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; -+ int ret = 0; -+ -+ if (sdiodev->fw_name[0] != '\0') -+ strlcpy(fw_name, sdiodev->fw_name, BRCMF_FW_NAME_LEN); -+ else -+ ret = brcmf_fw_map_chip_to_name(chip, chiprev, -+ brcmf_sdio_fwnames, -+ ARRAY_SIZE(brcmf_sdio_fwnames), -+ fw_name, NULL); -+ -+ return ret; -+} -+ - static const struct brcmf_bus_ops brcmf_sdio_bus_ops = { - .stop = brcmf_sdio_bus_stop, - .preinit = brcmf_sdio_bus_preinit, -@@ -3995,6 +4013,7 @@ static const struct brcmf_bus_ops brcmf_ - .wowl_config = brcmf_sdio_wowl_config, - .get_ramsize = brcmf_sdio_bus_get_ramsize, - .get_memdump = brcmf_sdio_bus_get_memdump, -+ .get_fwname = brcmf_sdio_get_fwname, - }; - - static void brcmf_sdio_firmware_callback(struct device *dev, int err, ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c -@@ -1128,12 +1128,30 @@ static void brcmf_usb_wowl_config(struct - device_set_wakeup_enable(devinfo->dev, false); - } - -+static int brcmf_usb_get_fwname(struct device *dev, u32 chip, u32 chiprev, -+ u8 *fw_name) -+{ -+ struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev); -+ int ret = 0; -+ -+ if (devinfo->fw_name[0] != '\0') -+ strlcpy(fw_name, devinfo->fw_name, BRCMF_FW_NAME_LEN); -+ else -+ ret = brcmf_fw_map_chip_to_name(chip, chiprev, -+ brcmf_usb_fwnames, -+ ARRAY_SIZE(brcmf_usb_fwnames), -+ fw_name, NULL); -+ -+ return ret; -+} -+ - static const struct brcmf_bus_ops brcmf_usb_bus_ops = { - .txdata = brcmf_usb_tx, - .stop = brcmf_usb_down, - .txctl = brcmf_usb_tx_ctlpkt, - .rxctl = brcmf_usb_rx_ctlpkt, - .wowl_config = brcmf_usb_wowl_config, -+ .get_fwname = brcmf_usb_get_fwname, - }; - - static int brcmf_usb_bus_setup(struct brcmf_usbdev_info *devinfo) diff --git a/package/kernel/mac80211/patches/305-v4.15-brcmfmac-change-driver-unbind-order-of-the-sdio-func.patch b/package/kernel/mac80211/patches/305-v4.15-brcmfmac-change-driver-unbind-order-of-the-sdio-func.patch deleted file mode 100644 index 3649bdda492ef9..00000000000000 --- a/package/kernel/mac80211/patches/305-v4.15-brcmfmac-change-driver-unbind-order-of-the-sdio-func.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 5c3de777bdaf48bd0cfb43097c0d0fb85056cab7 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Sat, 25 Nov 2017 21:39:25 +0100 -Subject: [PATCH] brcmfmac: change driver unbind order of the sdio function - devices - -In the function brcmf_sdio_firmware_callback() the driver is -unbound from the sdio function devices in the error path. -However, the order in which it is done resulted in a use-after-free -issue (see brcmf_ops_sdio_remove() in bcmsdh.c). Hence change -the order and first unbind sdio function #2 device and then -unbind sdio function #1 device. - -Cc: stable@vger.kernel.org # v4.12.x -Fixes: 7a51461fc2da ("brcmfmac: unbind all devices upon failure in firmware callback") -Reported-by: Stefan Wahren -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -4121,8 +4121,8 @@ release: - sdio_release_host(sdiodev->func[1]); - fail: - brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), err); -- device_release_driver(dev); - device_release_driver(&sdiodev->func[2]->dev); -+ device_release_driver(dev); - } - - struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) diff --git a/package/kernel/mac80211/patches/306-v4.15-brcmfmac-Avoid-build-error-with-make-W-1.patch b/package/kernel/mac80211/patches/306-v4.15-brcmfmac-Avoid-build-error-with-make-W-1.patch deleted file mode 100644 index 7344580d34386f..00000000000000 --- a/package/kernel/mac80211/patches/306-v4.15-brcmfmac-Avoid-build-error-with-make-W-1.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 51ef7925e10688c57186d438e784532e063492e4 Mon Sep 17 00:00:00 2001 -From: Andy Shevchenko -Date: Thu, 23 Nov 2017 17:57:04 +0200 -Subject: [PATCH] brcmfmac: Avoid build error with make W=1 - -When I run make W=1 on gcc (Debian 7.2.0-16) 7.2.0 I got an error for -the first run, all next ones are okay. - - CC [M] drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.o -drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:2078: error: Cannot parse struct or union! -scripts/Makefile.build:310: recipe for target 'drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.o' failed - -Seems like something happened with W=1 and wrong kernel doc format. -As a quick fix remove dubious /** in the code. - -Signed-off-by: Andy Shevchenko -Acked-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -2070,7 +2070,7 @@ static int brcmf_sdio_txpkt_hdalign(stru - return head_pad; - } - --/** -+/* - * struct brcmf_skbuff_cb reserves first two bytes in sk_buff::cb for - * bus layer usage. - */ diff --git a/package/kernel/mac80211/patches/307-v4.15-brcmfmac-fix-CLM-load-error-for-legacy-chips-when-us.patch b/package/kernel/mac80211/patches/307-v4.15-brcmfmac-fix-CLM-load-error-for-legacy-chips-when-us.patch deleted file mode 100644 index ead5e72145619a..00000000000000 --- a/package/kernel/mac80211/patches/307-v4.15-brcmfmac-fix-CLM-load-error-for-legacy-chips-when-us.patch +++ /dev/null @@ -1,40 +0,0 @@ -From cc124d5cc8d81985c3511892d7a6d546552ff754 Mon Sep 17 00:00:00 2001 -From: Wright Feng -Date: Tue, 16 Jan 2018 17:26:50 +0800 -Subject: [PATCH] brcmfmac: fix CLM load error for legacy chips when user - helper is enabled - -For legacy chips without CLM blob files, kernel with user helper function -returns -EAGAIN when we request_firmware(), and then driver got failed -when bringing up legacy chips. We expect the CLM blob file for legacy chip -is not existence in firmware path, but the -ENOENT error is transferred to --EAGAIN in firmware_class.c with user helper. -Because of that, we continue with CLM data currently present in firmware -if getting error from doing request_firmware(). - -Cc: stable@vger.kernel.org # v4.15.y -Reviewed-by: Arend van Spriel -Signed-off-by: Wright Feng -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 9 +++------ - 1 file changed, 3 insertions(+), 6 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -@@ -182,12 +182,9 @@ static int brcmf_c_process_clm_blob(stru - - err = request_firmware(&clm, clm_name, dev); - if (err) { -- if (err == -ENOENT) { -- brcmf_dbg(INFO, "continue with CLM data currently present in firmware\n"); -- return 0; -- } -- brcmf_err("request CLM blob file failed (%d)\n", err); -- return err; -+ brcmf_info("no clm_blob available(err=%d), device may have limited channels available\n", -+ err); -+ return 0; - } - - chunk_buf = kzalloc(sizeof(*chunk_buf) + MAX_CHUNK_LEN - 1, GFP_KERNEL); diff --git a/package/kernel/mac80211/patches/308-v4.16-0001-ath9k-move-spectral-scan-support-under-a-separate-co.patch b/package/kernel/mac80211/patches/308-v4.16-0001-ath9k-move-spectral-scan-support-under-a-separate-co.patch deleted file mode 100644 index 703051fe1927fb..00000000000000 --- a/package/kernel/mac80211/patches/308-v4.16-0001-ath9k-move-spectral-scan-support-under-a-separate-co.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 9df7ddc3ed25b7d3473f117a0680b9418adb5753 Mon Sep 17 00:00:00 2001 -Message-Id: <9df7ddc3ed25b7d3473f117a0680b9418adb5753.1515610034.git.mschiffer@universe-factory.net> -From: Matthias Schiffer -Date: Mon, 27 Nov 2017 18:56:22 +0100 -Subject: [PATCH 1/2] ath9k: move spectral scan support under a separate config - symbol - -At the moment, spectral scan support, and with it RELAY, is always enabled -with ATH9K[_HTC]_DEBUGFS. Spectral scan support is currently the only user -of RELAY in ath9k, and it unconditionally reserves a relay channel. - -Having debugfs support in ath9k is often useful even on very small embedded -routers, where we'd rather like to avoid the code size and RAM usage of the -relay support. - -Signed-off-by: Matthias Schiffer -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/ath/ath9k/Kconfig | 14 ++++++++++---- - drivers/net/wireless/ath/ath9k/Makefile | 4 ++-- - drivers/net/wireless/ath/ath9k/common-spectral.h | 4 ++-- - 3 files changed, 14 insertions(+), 8 deletions(-) - ---- a/drivers/net/wireless/ath/ath9k/Kconfig -+++ b/drivers/net/wireless/ath/ath9k/Kconfig -@@ -64,13 +64,12 @@ config ATH9K_DEBUGFS - depends on ATH9K && DEBUG_FS - select MAC80211_DEBUGFS - select ATH9K_COMMON_DEBUG -- depends on RELAY - ---help--- - Say Y, if you need access to ath9k's statistics for - interrupts, rate control, etc. - -- Also required for changing debug message flags at run time. -- As well as access to the FFT/spectral data and TX99. -+ Also required for changing debug message flags at run time and for -+ TX99. - - config ATH9K_STATION_STATISTICS - bool "Detailed station statistics" -@@ -181,7 +180,6 @@ config ATH9K_HTC_DEBUGFS - bool "Atheros ath9k_htc debugging" - depends on ATH9K_HTC && DEBUG_FS - select ATH9K_COMMON_DEBUG -- depends on RELAY - ---help--- - Say Y, if you need access to ath9k_htc's statistics. - As well as access to the FFT/spectral data. -@@ -197,3 +195,11 @@ config ATH9K_HWRNG - - Say Y, feeds the entropy directly from the WiFi driver to the input - pool. -+ -+config ATH9K_COMMON_SPECTRAL -+ bool "Atheros ath9k/ath9k_htc spectral scan support" -+ depends on ATH9K_DEBUGFS || ATH9K_HTC_DEBUGFS -+ depends on RELAY -+ default n -+ ---help--- -+ Say Y to enable access to the FFT/spectral data via debugfs. ---- a/drivers/net/wireless/ath/ath9k/Makefile -+++ b/drivers/net/wireless/ath/ath9k/Makefile -@@ -61,8 +61,8 @@ ath9k_common-y:= common.o \ - common-init.o \ - common-beacon.o \ - --ath9k_common-$(CPTCFG_ATH9K_COMMON_DEBUG) += common-debug.o \ -- common-spectral.o -+ath9k_common-$(CPTCFG_ATH9K_COMMON_DEBUG) += common-debug.o -+ath9k_common-$(CPTCFG_ATH9K_COMMON_SPECTRAL) += common-spectral.o - - ath9k_htc-y += htc_hst.o \ - hif_usb.o \ ---- a/drivers/net/wireless/ath/ath9k/common-spectral.h -+++ b/drivers/net/wireless/ath/ath9k/common-spectral.h -@@ -151,7 +151,7 @@ static inline u8 spectral_bitmap_weight( - return bins[0] & 0x3f; - } - --#ifdef CPTCFG_ATH9K_COMMON_DEBUG -+#ifdef CPTCFG_ATH9K_COMMON_SPECTRAL - void ath9k_cmn_spectral_init_debug(struct ath_spec_scan_priv *spec_priv, struct dentry *debugfs_phy); - void ath9k_cmn_spectral_deinit_debug(struct ath_spec_scan_priv *spec_priv); - -@@ -183,6 +183,6 @@ static inline int ath_cmn_process_fft(st - { - return 0; - } --#endif /* CPTCFG_ATH9K_COMMON_DEBUG */ -+#endif /* CPTCFG_ATH9K_COMMON_SPECTRAL */ - - #endif /* SPECTRAL_H */ ---- a/local-symbols -+++ b/local-symbols -@@ -116,6 +116,7 @@ ATH9K_PCOEM= - ATH9K_HTC= - ATH9K_HTC_DEBUGFS= - ATH9K_HWRNG= -+ATH9K_COMMON_SPECTRAL= - CARL9170= - CARL9170_LEDS= - CARL9170_DEBUGFS= diff --git a/package/kernel/mac80211/patches/309-v4.16-0002-ath10k-move-spectral-scan-support-under-a-separate-c.patch b/package/kernel/mac80211/patches/309-v4.16-0002-ath10k-move-spectral-scan-support-under-a-separate-c.patch deleted file mode 100644 index 604a6f1585aba2..00000000000000 --- a/package/kernel/mac80211/patches/309-v4.16-0002-ath10k-move-spectral-scan-support-under-a-separate-c.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 42e01cb9cb109fb0bb4743f6c54d6aa67ac39b61 Mon Sep 17 00:00:00 2001 -Message-Id: <42e01cb9cb109fb0bb4743f6c54d6aa67ac39b61.1515610034.git.mschiffer@universe-factory.net> -In-Reply-To: <9df7ddc3ed25b7d3473f117a0680b9418adb5753.1515610034.git.mschiffer@universe-factory.net> -References: <9df7ddc3ed25b7d3473f117a0680b9418adb5753.1515610034.git.mschiffer@universe-factory.net> -From: Matthias Schiffer -Date: Mon, 27 Nov 2017 18:56:23 +0100 -Subject: [PATCH 2/2] ath10k: move spectral scan support under a separate - config symbol - -At the moment, spectral scan support, and with it RELAY, is always enabled -with ATH10K_DEBUGFS. Spectral scan support is currently the only user of -RELAY in ath10k, and it unconditionally reserves a relay channel. - -Having debugfs support in ath10k is often useful even on very small -embedded routers, where we'd rather like to avoid the code size and RAM -usage of the relay support. While ath10k-based devices usually have more -resources than ath9k-based ones, it makes sense to keep the configuration -symmetric to ath9k, so the same base kernel without RELAY can be used for -both ath9k and ath10k hardware. - -Signed-off-by: Matthias Schiffer -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/ath/ath10k/Kconfig | 9 ++++++++- - drivers/net/wireless/ath/ath10k/Makefile | 2 +- - drivers/net/wireless/ath/ath10k/spectral.h | 4 ++-- - 3 files changed, 11 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/ath/ath10k/Kconfig -+++ b/drivers/net/wireless/ath/ath10k/Kconfig -@@ -51,12 +51,19 @@ config ATH10K_DEBUG - config ATH10K_DEBUGFS - bool "Atheros ath10k debugfs support" - depends on ATH10K && DEBUG_FS -- depends on RELAY - ---help--- - Enabled debugfs support - - If unsure, say Y to make it easier to debug problems. - -+config ATH10K_SPECTRAL -+ bool "Atheros ath10k spectral scan support" -+ depends on ATH10K_DEBUGFS -+ depends on RELAY -+ default n -+ ---help--- -+ Say Y to enable access to the FFT/spectral data via debugfs. -+ - config ATH10K_TRACING - depends on !KERNEL_3_4 - bool "Atheros ath10k tracing support" ---- a/drivers/net/wireless/ath/ath10k/Makefile -+++ b/drivers/net/wireless/ath/ath10k/Makefile -@@ -14,7 +14,7 @@ ath10k_core-y += mac.o \ - p2p.o \ - swap.o - --ath10k_core-$(CPTCFG_ATH10K_DEBUGFS) += spectral.o -+ath10k_core-$(CPTCFG_ATH10K_SPECTRAL) += spectral.o - ath10k_core-$(CPTCFG_NL80211_TESTMODE) += testmode.o - ath10k_core-$(CPTCFG_ATH10K_TRACING) += trace.o - ath10k_core-$(CPTCFG_ATH10K_THERMAL) += thermal.o ---- a/drivers/net/wireless/ath/ath10k/spectral.h -+++ b/drivers/net/wireless/ath/ath10k/spectral.h -@@ -44,7 +44,7 @@ enum ath10k_spectral_mode { - SPECTRAL_MANUAL, - }; - --#ifdef CPTCFG_ATH10K_DEBUGFS -+#ifdef CPTCFG_ATH10K_SPECTRAL - - int ath10k_spectral_process_fft(struct ath10k *ar, - struct wmi_phyerr_ev_arg *phyerr, -@@ -85,6 +85,6 @@ static inline void ath10k_spectral_destr - { - } - --#endif /* CPTCFG_ATH10K_DEBUGFS */ -+#endif /* CPTCFG_ATH10K_SPECTRAL */ - - #endif /* SPECTRAL_H */ ---- a/local-symbols -+++ b/local-symbols -@@ -140,6 +140,7 @@ ATH10K_SDIO= - ATH10K_USB= - ATH10K_DEBUG= - ATH10K_DEBUGFS= -+ATH10K_SPECTRAL= - ATH10K_TRACING= - ATH10K_DFS_CERTIFIED= - WCN36XX= diff --git a/package/kernel/mac80211/patches/310-v4.16-ath9k-discard-undersized-packets.patch b/package/kernel/mac80211/patches/310-v4.16-ath9k-discard-undersized-packets.patch deleted file mode 100644 index b2b2fcf4aad5ad..00000000000000 --- a/package/kernel/mac80211/patches/310-v4.16-ath9k-discard-undersized-packets.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Felix Fietkau -Date: Wed, 17 Jan 2018 11:11:17 +0100 -Subject: [PATCH] ath9k: discard undersized packets - -Sometimes the hardware will push small packets that trigger a WARN_ON -in mac80211. Discard them early to avoid this issue. - -Reported-by: Stijn Tintel -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/recv.c -+++ b/drivers/net/wireless/ath/ath9k/recv.c -@@ -826,9 +826,9 @@ static int ath9k_rx_skb_preprocess(struc - sc->rx.discard_next = false; - - /* -- * Discard zero-length packets. -+ * Discard zero-length packets and packets smaller than an ACK - */ -- if (!rx_stats->rs_datalen) { -+ if (rx_stats->rs_datalen < 10) { - RX_STAT_INC(rx_len_err); - goto corrupt; - } diff --git a/package/kernel/mac80211/patches/311-v4.16-0001-brcmfmac-Fix-parameter-order-in-brcmf_sdiod_f0_write.patch b/package/kernel/mac80211/patches/311-v4.16-0001-brcmfmac-Fix-parameter-order-in-brcmf_sdiod_f0_write.patch deleted file mode 100644 index 616a82119f91dd..00000000000000 --- a/package/kernel/mac80211/patches/311-v4.16-0001-brcmfmac-Fix-parameter-order-in-brcmf_sdiod_f0_write.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 1fd3ae124d5e675f57cf7e3c601fb8f7712e0329 Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Mon, 13 Nov 2017 21:35:38 +0100 -Subject: [PATCH] brcmfmac: Fix parameter order in brcmf_sdiod_f0_writeb() - -All the other IO functions are the other way round in this -driver. Make this one match. - -Signed-off-by: Ian Molton -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -230,8 +230,8 @@ void brcmf_sdiod_change_state(struct brc - sdiodev->state = state; - } - --static inline int brcmf_sdiod_f0_writeb(struct sdio_func *func, -- uint regaddr, u8 byte) -+static inline int brcmf_sdiod_f0_writeb(struct sdio_func *func, u8 byte, -+ uint regaddr) - { - int err_ret; - -@@ -269,8 +269,8 @@ static int brcmf_sdiod_request_data(stru - if (fn) - sdio_writeb(func, *(u8 *)data, addr, &ret); - else -- ret = brcmf_sdiod_f0_writeb(func, addr, -- *(u8 *)data); -+ ret = brcmf_sdiod_f0_writeb(func, *(u8 *)data, -+ addr); - } else { - if (fn) - *(u8 *)data = sdio_readb(func, addr, &ret); diff --git a/package/kernel/mac80211/patches/311-v4.16-0002-brcmfmac-Register-sizes-on-hardware-are-not-dependen.patch b/package/kernel/mac80211/patches/311-v4.16-0002-brcmfmac-Register-sizes-on-hardware-are-not-dependen.patch deleted file mode 100644 index 719268f8fec0c8..00000000000000 --- a/package/kernel/mac80211/patches/311-v4.16-0002-brcmfmac-Register-sizes-on-hardware-are-not-dependen.patch +++ /dev/null @@ -1,105 +0,0 @@ -From 1e6f676f43aa4270ebc5cff8e32a55f72362e042 Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Mon, 13 Nov 2017 21:35:39 +0100 -Subject: [PATCH] brcmfmac: Register sizes on hardware are not dependent on - compiler types - -The 4 IO functions in this patch are incorrect as they use compiler types -to determine how many bytes to send to the hardware. - -Signed-off-by: Ian Molton -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 22 +++++++++++----------- - 1 file changed, 11 insertions(+), 11 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -264,7 +264,7 @@ static int brcmf_sdiod_request_data(stru - func = sdiodev->func[fn]; - - switch (regsz) { -- case sizeof(u8): -+ case 1: - if (write) { - if (fn) - sdio_writeb(func, *(u8 *)data, addr, &ret); -@@ -278,13 +278,13 @@ static int brcmf_sdiod_request_data(stru - *(u8 *)data = sdio_f0_readb(func, addr, &ret); - } - break; -- case sizeof(u16): -+ case 2: - if (write) - sdio_writew(func, *(u16 *)data, addr, &ret); - else - *(u16 *)data = sdio_readw(func, addr, &ret); - break; -- case sizeof(u32): -+ case 4: - if (write) - sdio_writel(func, *(u32 *)data, addr, &ret); - else -@@ -368,7 +368,7 @@ brcmf_sdiod_set_sbaddr_window(struct brc - for (i = 0; i < 3; i++) { - err = brcmf_sdiod_regrw_helper(sdiodev, - SBSDIO_FUNC1_SBADDRLOW + i, -- sizeof(u8), &addr[i], true); -+ 1, &addr[i], true); - if (err) { - brcmf_err("failed at addr: 0x%0x\n", - SBSDIO_FUNC1_SBADDRLOW + i); -@@ -407,7 +407,7 @@ u8 brcmf_sdiod_regrb(struct brcmf_sdio_d - int retval; - - brcmf_dbg(SDIO, "addr:0x%08x\n", addr); -- retval = brcmf_sdiod_regrw_helper(sdiodev, addr, sizeof(data), &data, -+ retval = brcmf_sdiod_regrw_helper(sdiodev, addr, 1, &data, - false); - brcmf_dbg(SDIO, "data:0x%02x\n", data); - -@@ -423,10 +423,10 @@ u32 brcmf_sdiod_regrl(struct brcmf_sdio_ - int retval; - - brcmf_dbg(SDIO, "addr:0x%08x\n", addr); -- retval = brcmf_sdiod_addrprep(sdiodev, sizeof(data), &addr); -+ retval = brcmf_sdiod_addrprep(sdiodev, 4, &addr); - if (retval) - goto done; -- retval = brcmf_sdiod_regrw_helper(sdiodev, addr, sizeof(data), &data, -+ retval = brcmf_sdiod_regrw_helper(sdiodev, addr, 4, &data, - false); - brcmf_dbg(SDIO, "data:0x%08x\n", data); - -@@ -443,7 +443,7 @@ void brcmf_sdiod_regwb(struct brcmf_sdio - int retval; - - brcmf_dbg(SDIO, "addr:0x%08x, data:0x%02x\n", addr, data); -- retval = brcmf_sdiod_regrw_helper(sdiodev, addr, sizeof(data), &data, -+ retval = brcmf_sdiod_regrw_helper(sdiodev, addr, 1, &data, - true); - if (ret) - *ret = retval; -@@ -455,10 +455,10 @@ void brcmf_sdiod_regwl(struct brcmf_sdio - int retval; - - brcmf_dbg(SDIO, "addr:0x%08x, data:0x%08x\n", addr, data); -- retval = brcmf_sdiod_addrprep(sdiodev, sizeof(data), &addr); -+ retval = brcmf_sdiod_addrprep(sdiodev, 4, &addr); - if (retval) - goto done; -- retval = brcmf_sdiod_regrw_helper(sdiodev, addr, sizeof(data), &data, -+ retval = brcmf_sdiod_regrw_helper(sdiodev, addr, 4, &data, - true); - - done: -@@ -876,7 +876,7 @@ int brcmf_sdiod_abort(struct brcmf_sdio_ - - /* issue abort cmd52 command through F0 */ - brcmf_sdiod_request_data(sdiodev, SDIO_FUNC_0, SDIO_CCCR_ABORT, -- sizeof(t_func), &t_func, true); -+ 1, &t_func, true); - - brcmf_dbg(SDIO, "Exit\n"); - return 0; diff --git a/package/kernel/mac80211/patches/311-v4.16-0003-brcmfmac-Split-brcmf_sdiod_regrw_helper-up.patch b/package/kernel/mac80211/patches/311-v4.16-0003-brcmfmac-Split-brcmf_sdiod_regrw_helper-up.patch deleted file mode 100644 index b04465ae4f9b9b..00000000000000 --- a/package/kernel/mac80211/patches/311-v4.16-0003-brcmfmac-Split-brcmf_sdiod_regrw_helper-up.patch +++ /dev/null @@ -1,179 +0,0 @@ -From 0fcc9fe0048422d66bb906eaa73cc75e11ff7345 Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Mon, 13 Nov 2017 21:35:40 +0100 -Subject: [PATCH] brcmfmac: Split brcmf_sdiod_regrw_helper() up. - -This large function is concealing a LOT of obscure logic about -how the hardware functions. Time to split it up. - -This first patch splits the function into two pieces - read and write, -doing away with the rw flag in the process. - -Signed-off-by: Ian Molton -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 94 +++++++++++++++++----- - 1 file changed, 73 insertions(+), 21 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -302,8 +302,8 @@ static int brcmf_sdiod_request_data(stru - return ret; - } - --static int brcmf_sdiod_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr, -- u8 regsz, void *data, bool write) -+static int brcmf_sdiod_reg_write(struct brcmf_sdio_dev *sdiodev, u32 addr, -+ u8 regsz, void *data) - { - u8 func; - s32 retry = 0; -@@ -324,13 +324,66 @@ static int brcmf_sdiod_regrw_helper(stru - func = SDIO_FUNC_1; - - do { -- if (!write) -- memset(data, 0, regsz); - /* for retry wait for 1 ms till bus get settled down */ - if (retry) - usleep_range(1000, 2000); -+ -+ ret = brcmf_sdiod_request_data(sdiodev, func, addr, regsz, -+ data, true); -+ -+ } while (ret != 0 && ret != -ENOMEDIUM && -+ retry++ < SDIOH_API_ACCESS_RETRY_LIMIT); -+ -+ if (ret == -ENOMEDIUM) { -+ brcmf_sdiod_change_state(sdiodev, BRCMF_SDIOD_NOMEDIUM); -+ } else if (ret != 0) { -+ /* -+ * SleepCSR register access can fail when -+ * waking up the device so reduce this noise -+ * in the logs. -+ */ -+ if (addr != SBSDIO_FUNC1_SLEEPCSR) -+ brcmf_err("failed to write data F%d@0x%05x, err: %d\n", -+ func, addr, ret); -+ else -+ brcmf_dbg(SDIO, "failed to write data F%d@0x%05x, err: %d\n", -+ func, addr, ret); -+ } -+ -+ return ret; -+} -+ -+static int brcmf_sdiod_reg_read(struct brcmf_sdio_dev *sdiodev, u32 addr, -+ u8 regsz, void *data) -+{ -+ u8 func; -+ s32 retry = 0; -+ int ret; -+ -+ if (sdiodev->state == BRCMF_SDIOD_NOMEDIUM) -+ return -ENOMEDIUM; -+ -+ /* -+ * figure out how to read the register based on address range -+ * 0x00 ~ 0x7FF: function 0 CCCR and FBR -+ * 0x10000 ~ 0x1FFFF: function 1 miscellaneous registers -+ * The rest: function 1 silicon backplane core registers -+ */ -+ if ((addr & ~REG_F0_REG_MASK) == 0) -+ func = SDIO_FUNC_0; -+ else -+ func = SDIO_FUNC_1; -+ -+ do { -+ memset(data, 0, regsz); -+ -+ /* for retry wait for 1 ms till bus get settled down */ -+ if (retry) -+ usleep_range(1000, 2000); -+ - ret = brcmf_sdiod_request_data(sdiodev, func, addr, regsz, -- data, write); -+ data, false); -+ - } while (ret != 0 && ret != -ENOMEDIUM && - retry++ < SDIOH_API_ACCESS_RETRY_LIMIT); - -@@ -343,12 +396,13 @@ static int brcmf_sdiod_regrw_helper(stru - * in the logs. - */ - if (addr != SBSDIO_FUNC1_SLEEPCSR) -- brcmf_err("failed to %s data F%d@0x%05x, err: %d\n", -- write ? "write" : "read", func, addr, ret); -+ brcmf_err("failed to read data F%d@0x%05x, err: %d\n", -+ func, addr, ret); - else -- brcmf_dbg(SDIO, "failed to %s data F%d@0x%05x, err: %d\n", -- write ? "write" : "read", func, addr, ret); -+ brcmf_dbg(SDIO, "failed to read data F%d@0x%05x, err: %d\n", -+ func, addr, ret); - } -+ - return ret; - } - -@@ -366,13 +420,11 @@ brcmf_sdiod_set_sbaddr_window(struct brc - addr[2] = (address >> 24) & SBSDIO_SBADDRHIGH_MASK; - - for (i = 0; i < 3; i++) { -- err = brcmf_sdiod_regrw_helper(sdiodev, -- SBSDIO_FUNC1_SBADDRLOW + i, -- 1, &addr[i], true); -+ brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_SBADDRLOW + i, addr[i], -+ &err); - if (err) { - brcmf_err("failed at addr: 0x%0x\n", - SBSDIO_FUNC1_SBADDRLOW + i); -- break; - } - } - -@@ -407,8 +459,7 @@ u8 brcmf_sdiod_regrb(struct brcmf_sdio_d - int retval; - - brcmf_dbg(SDIO, "addr:0x%08x\n", addr); -- retval = brcmf_sdiod_regrw_helper(sdiodev, addr, 1, &data, -- false); -+ retval = brcmf_sdiod_reg_read(sdiodev, addr, 1, &data); - brcmf_dbg(SDIO, "data:0x%02x\n", data); - - if (ret) -@@ -426,8 +477,9 @@ u32 brcmf_sdiod_regrl(struct brcmf_sdio_ - retval = brcmf_sdiod_addrprep(sdiodev, 4, &addr); - if (retval) - goto done; -- retval = brcmf_sdiod_regrw_helper(sdiodev, addr, 4, &data, -- false); -+ -+ retval = brcmf_sdiod_reg_read(sdiodev, addr, 4, &data); -+ - brcmf_dbg(SDIO, "data:0x%08x\n", data); - - done: -@@ -443,8 +495,8 @@ void brcmf_sdiod_regwb(struct brcmf_sdio - int retval; - - brcmf_dbg(SDIO, "addr:0x%08x, data:0x%02x\n", addr, data); -- retval = brcmf_sdiod_regrw_helper(sdiodev, addr, 1, &data, -- true); -+ retval = brcmf_sdiod_reg_write(sdiodev, addr, 1, &data); -+ - if (ret) - *ret = retval; - } -@@ -458,8 +510,8 @@ void brcmf_sdiod_regwl(struct brcmf_sdio - retval = brcmf_sdiod_addrprep(sdiodev, 4, &addr); - if (retval) - goto done; -- retval = brcmf_sdiod_regrw_helper(sdiodev, addr, 4, &data, -- true); -+ -+ retval = brcmf_sdiod_reg_write(sdiodev, addr, 4, &data); - - done: - if (ret) diff --git a/package/kernel/mac80211/patches/311-v4.16-0004-brcmfmac-Clean-up-brcmf_sdiod_set_sbaddr_window.patch b/package/kernel/mac80211/patches/311-v4.16-0004-brcmfmac-Clean-up-brcmf_sdiod_set_sbaddr_window.patch deleted file mode 100644 index 1f0488a621543f..00000000000000 --- a/package/kernel/mac80211/patches/311-v4.16-0004-brcmfmac-Clean-up-brcmf_sdiod_set_sbaddr_window.patch +++ /dev/null @@ -1,62 +0,0 @@ -From b9b0d290bc0c90a5a262bc89c9d995988ea98669 Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Mon, 13 Nov 2017 21:35:41 +0100 -Subject: [PATCH] brcmfmac: Clean up brcmf_sdiod_set_sbaddr_window() - -This function sets the address of the IO window used for -SDIO accesses onto the backplane of the chip. - -It currently uses 3 separate masks despite the full mask being -defined in the code already. Remove the separate masks and clean up. - -Signed-off-by: Ian Molton -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 17 +++++------------ - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h | 3 --- - 2 files changed, 5 insertions(+), 15 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -410,23 +410,16 @@ static int - brcmf_sdiod_set_sbaddr_window(struct brcmf_sdio_dev *sdiodev, u32 address) - { - int err = 0, i; -- u8 addr[3]; -+ u32 addr; - - if (sdiodev->state == BRCMF_SDIOD_NOMEDIUM) - return -ENOMEDIUM; - -- addr[0] = (address >> 8) & SBSDIO_SBADDRLOW_MASK; -- addr[1] = (address >> 16) & SBSDIO_SBADDRMID_MASK; -- addr[2] = (address >> 24) & SBSDIO_SBADDRHIGH_MASK; -+ addr = (address & SBSDIO_SBWINDOW_MASK) >> 8; - -- for (i = 0; i < 3; i++) { -- brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_SBADDRLOW + i, addr[i], -- &err); -- if (err) { -- brcmf_err("failed at addr: 0x%0x\n", -- SBSDIO_FUNC1_SBADDRLOW + i); -- } -- } -+ for (i = 0 ; i < 3 && !err ; i++, addr >>= 8) -+ brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_SBADDRLOW + i, -+ addr & 0xff, &err); - - return err; - } ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h -@@ -133,9 +133,6 @@ - - /* valid bits in SBSDIO_FUNC1_SBADDRxxx regs */ - --#define SBSDIO_SBADDRLOW_MASK 0x80 /* Valid bits in SBADDRLOW */ --#define SBSDIO_SBADDRMID_MASK 0xff /* Valid bits in SBADDRMID */ --#define SBSDIO_SBADDRHIGH_MASK 0xffU /* Valid bits in SBADDRHIGH */ - /* Address bits from SBADDR regs */ - #define SBSDIO_SBWINDOW_MASK 0xffff8000 - diff --git a/package/kernel/mac80211/patches/311-v4.16-0005-brcmfmac-Remove-dead-IO-code.patch b/package/kernel/mac80211/patches/311-v4.16-0005-brcmfmac-Remove-dead-IO-code.patch deleted file mode 100644 index 7d50ce923dfcf6..00000000000000 --- a/package/kernel/mac80211/patches/311-v4.16-0005-brcmfmac-Remove-dead-IO-code.patch +++ /dev/null @@ -1,91 +0,0 @@ -From ea243e9077b3545f20d93884e91c50ac0719685a Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Mon, 13 Nov 2017 21:35:42 +0100 -Subject: [PATCH] brcmfmac: Remove dead IO code - -The value passed to brcmf_sdiod_addrprep() is *always* 4 -remove this parameter and the unused code to handle it. - -Signed-off-by: Ian Molton -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 18 ++++++++---------- - 1 file changed, 8 insertions(+), 10 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -425,7 +425,7 @@ brcmf_sdiod_set_sbaddr_window(struct brc - } - - static int --brcmf_sdiod_addrprep(struct brcmf_sdio_dev *sdiodev, uint width, u32 *addr) -+brcmf_sdiod_addrprep(struct brcmf_sdio_dev *sdiodev, u32 *addr) - { - uint bar0 = *addr & ~SBSDIO_SB_OFT_ADDR_MASK; - int err = 0; -@@ -439,9 +439,7 @@ brcmf_sdiod_addrprep(struct brcmf_sdio_d - } - - *addr &= SBSDIO_SB_OFT_ADDR_MASK; -- -- if (width == 4) -- *addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; -+ *addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - - return 0; - } -@@ -467,7 +465,7 @@ u32 brcmf_sdiod_regrl(struct brcmf_sdio_ - int retval; - - brcmf_dbg(SDIO, "addr:0x%08x\n", addr); -- retval = brcmf_sdiod_addrprep(sdiodev, 4, &addr); -+ retval = brcmf_sdiod_addrprep(sdiodev, &addr); - if (retval) - goto done; - -@@ -500,7 +498,7 @@ void brcmf_sdiod_regwl(struct brcmf_sdio - int retval; - - brcmf_dbg(SDIO, "addr:0x%08x, data:0x%08x\n", addr, data); -- retval = brcmf_sdiod_addrprep(sdiodev, 4, &addr); -+ retval = brcmf_sdiod_addrprep(sdiodev, &addr); - if (retval) - goto done; - -@@ -736,7 +734,7 @@ int brcmf_sdiod_recv_pkt(struct brcmf_sd - - brcmf_dbg(SDIO, "addr = 0x%x, size = %d\n", addr, pkt->len); - -- err = brcmf_sdiod_addrprep(sdiodev, 4, &addr); -+ err = brcmf_sdiod_addrprep(sdiodev, &addr); - if (err) - goto done; - -@@ -757,7 +755,7 @@ int brcmf_sdiod_recv_chain(struct brcmf_ - brcmf_dbg(SDIO, "addr = 0x%x, size = %d\n", - addr, pktq->qlen); - -- err = brcmf_sdiod_addrprep(sdiodev, 4, &addr); -+ err = brcmf_sdiod_addrprep(sdiodev, &addr); - if (err) - goto done; - -@@ -801,7 +799,7 @@ int brcmf_sdiod_send_buf(struct brcmf_sd - - memcpy(mypkt->data, buf, nbytes); - -- err = brcmf_sdiod_addrprep(sdiodev, 4, &addr); -+ err = brcmf_sdiod_addrprep(sdiodev, &addr); - - if (!err) - err = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_2, true, addr, -@@ -821,7 +819,7 @@ int brcmf_sdiod_send_pkt(struct brcmf_sd - - brcmf_dbg(SDIO, "addr = 0x%x, size = %d\n", addr, pktq->qlen); - -- err = brcmf_sdiod_addrprep(sdiodev, 4, &addr); -+ err = brcmf_sdiod_addrprep(sdiodev, &addr); - if (err) - return err; - diff --git a/package/kernel/mac80211/patches/311-v4.16-0006-brcmfmac-Remove-bandaid-for-SleepCSR.patch b/package/kernel/mac80211/patches/311-v4.16-0006-brcmfmac-Remove-bandaid-for-SleepCSR.patch deleted file mode 100644 index fef29fc7157c70..00000000000000 --- a/package/kernel/mac80211/patches/311-v4.16-0006-brcmfmac-Remove-bandaid-for-SleepCSR.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 4a3338ba2a7421db2260159cca5a27bd2ee36d00 Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Mon, 13 Nov 2017 21:35:43 +0100 -Subject: [PATCH] brcmfmac: Remove bandaid for SleepCSR - -Register access code is not the place for band-aid fixes like this. -If this is a genuine problem, it should be fixed further up in the driver -stack. - -Signed-off-by: Ian Molton -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 28 +--------------------- - 1 file changed, 1 insertion(+), 27 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -334,21 +334,8 @@ static int brcmf_sdiod_reg_write(struct - } while (ret != 0 && ret != -ENOMEDIUM && - retry++ < SDIOH_API_ACCESS_RETRY_LIMIT); - -- if (ret == -ENOMEDIUM) { -+ if (ret == -ENOMEDIUM) - brcmf_sdiod_change_state(sdiodev, BRCMF_SDIOD_NOMEDIUM); -- } else if (ret != 0) { -- /* -- * SleepCSR register access can fail when -- * waking up the device so reduce this noise -- * in the logs. -- */ -- if (addr != SBSDIO_FUNC1_SLEEPCSR) -- brcmf_err("failed to write data F%d@0x%05x, err: %d\n", -- func, addr, ret); -- else -- brcmf_dbg(SDIO, "failed to write data F%d@0x%05x, err: %d\n", -- func, addr, ret); -- } - - return ret; - } -@@ -389,19 +376,6 @@ static int brcmf_sdiod_reg_read(struct b - - if (ret == -ENOMEDIUM) - brcmf_sdiod_change_state(sdiodev, BRCMF_SDIOD_NOMEDIUM); -- else if (ret != 0) { -- /* -- * SleepCSR register access can fail when -- * waking up the device so reduce this noise -- * in the logs. -- */ -- if (addr != SBSDIO_FUNC1_SLEEPCSR) -- brcmf_err("failed to read data F%d@0x%05x, err: %d\n", -- func, addr, ret); -- else -- brcmf_dbg(SDIO, "failed to read data F%d@0x%05x, err: %d\n", -- func, addr, ret); -- } - - return ret; - } diff --git a/package/kernel/mac80211/patches/311-v4.16-0007-brcmfmac-Remove-brcmf_sdiod_request_data.patch b/package/kernel/mac80211/patches/311-v4.16-0007-brcmfmac-Remove-brcmf_sdiod_request_data.patch deleted file mode 100644 index 552f9fb4439739..00000000000000 --- a/package/kernel/mac80211/patches/311-v4.16-0007-brcmfmac-Remove-brcmf_sdiod_request_data.patch +++ /dev/null @@ -1,344 +0,0 @@ -From 993a98a42e6e790fd0d2bf7d55a031513c7ba7dc Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Mon, 13 Nov 2017 21:35:44 +0100 -Subject: [PATCH] brcmfmac: Remove brcmf_sdiod_request_data() - -This function is obfuscating how IO works on this chip. Remove it -and push its logic into brcmf_sdiod_reg_{read,write}(). - -Handling of -ENOMEDIUM is altered, but as that's pretty much broken anyway -we can ignore that. - -Signed-off-by: Ian Molton -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 237 ++++++++------------- - .../wireless/broadcom/brcm80211/brcmfmac/sdio.h | 2 +- - 2 files changed, 87 insertions(+), 152 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -230,6 +230,43 @@ void brcmf_sdiod_change_state(struct brc - sdiodev->state = state; - } - -+static int brcmf_sdiod_set_sbaddr_window(struct brcmf_sdio_dev *sdiodev, -+ u32 address) -+{ -+ int err = 0, i; -+ u32 addr; -+ -+ if (sdiodev->state == BRCMF_SDIOD_NOMEDIUM) -+ return -ENOMEDIUM; -+ -+ addr = (address & SBSDIO_SBWINDOW_MASK) >> 8; -+ -+ for (i = 0 ; i < 3 && !err ; i++, addr >>= 8) -+ brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_SBADDRLOW + i, -+ addr & 0xff, &err); -+ -+ return err; -+} -+ -+static int brcmf_sdiod_addrprep(struct brcmf_sdio_dev *sdiodev, u32 *addr) -+{ -+ uint bar0 = *addr & ~SBSDIO_SB_OFT_ADDR_MASK; -+ int err = 0; -+ -+ if (bar0 != sdiodev->sbwad) { -+ err = brcmf_sdiod_set_sbaddr_window(sdiodev, bar0); -+ if (err) -+ return err; -+ -+ sdiodev->sbwad = bar0; -+ } -+ -+ *addr &= SBSDIO_SB_OFT_ADDR_MASK; -+ *addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; -+ -+ return 0; -+} -+ - static inline int brcmf_sdiod_f0_writeb(struct sdio_func *func, u8 byte, - uint regaddr) - { -@@ -249,173 +286,84 @@ static inline int brcmf_sdiod_f0_writeb( - return err_ret; - } - --static int brcmf_sdiod_request_data(struct brcmf_sdio_dev *sdiodev, u8 fn, -- u32 addr, u8 regsz, void *data, bool write) --{ -- struct sdio_func *func; -- int ret = -EINVAL; -- -- brcmf_dbg(SDIO, "rw=%d, func=%d, addr=0x%05x, nbytes=%d\n", -- write, fn, addr, regsz); -- -- /* only allow byte access on F0 */ -- if (WARN_ON(regsz > 1 && !fn)) -- return -EINVAL; -- func = sdiodev->func[fn]; -- -- switch (regsz) { -- case 1: -- if (write) { -- if (fn) -- sdio_writeb(func, *(u8 *)data, addr, &ret); -- else -- ret = brcmf_sdiod_f0_writeb(func, *(u8 *)data, -- addr); -- } else { -- if (fn) -- *(u8 *)data = sdio_readb(func, addr, &ret); -- else -- *(u8 *)data = sdio_f0_readb(func, addr, &ret); -- } -- break; -- case 2: -- if (write) -- sdio_writew(func, *(u16 *)data, addr, &ret); -- else -- *(u16 *)data = sdio_readw(func, addr, &ret); -- break; -- case 4: -- if (write) -- sdio_writel(func, *(u32 *)data, addr, &ret); -- else -- *(u32 *)data = sdio_readl(func, addr, &ret); -- break; -- default: -- brcmf_err("invalid size: %d\n", regsz); -- break; -- } -- -- if (ret) -- brcmf_dbg(SDIO, "failed to %s data F%d@0x%05x, err: %d\n", -- write ? "write" : "read", fn, addr, ret); -- -- return ret; --} -- - static int brcmf_sdiod_reg_write(struct brcmf_sdio_dev *sdiodev, u32 addr, - u8 regsz, void *data) - { -- u8 func; -- s32 retry = 0; - int ret; - -- if (sdiodev->state == BRCMF_SDIOD_NOMEDIUM) -- return -ENOMEDIUM; -- - /* - * figure out how to read the register based on address range - * 0x00 ~ 0x7FF: function 0 CCCR and FBR - * 0x10000 ~ 0x1FFFF: function 1 miscellaneous registers - * The rest: function 1 silicon backplane core registers -+ * f0 writes must be bytewise - */ -- if ((addr & ~REG_F0_REG_MASK) == 0) -- func = SDIO_FUNC_0; -- else -- func = SDIO_FUNC_1; -- -- do { -- /* for retry wait for 1 ms till bus get settled down */ -- if (retry) -- usleep_range(1000, 2000); - -- ret = brcmf_sdiod_request_data(sdiodev, func, addr, regsz, -- data, true); -- -- } while (ret != 0 && ret != -ENOMEDIUM && -- retry++ < SDIOH_API_ACCESS_RETRY_LIMIT); -+ if ((addr & ~REG_F0_REG_MASK) == 0) { -+ if (WARN_ON(regsz > 1)) -+ return -EINVAL; -+ ret = brcmf_sdiod_f0_writeb(sdiodev->func[0], -+ *(u8 *)data, addr); -+ } else { -+ switch (regsz) { -+ case 1: -+ sdio_writeb(sdiodev->func[1], *(u8 *)data, addr, &ret); -+ break; -+ case 4: -+ ret = brcmf_sdiod_addrprep(sdiodev, &addr); -+ if (ret) -+ goto done; - -- if (ret == -ENOMEDIUM) -- brcmf_sdiod_change_state(sdiodev, BRCMF_SDIOD_NOMEDIUM); -+ sdio_writel(sdiodev->func[1], *(u32 *)data, addr, &ret); -+ break; -+ default: -+ WARN(1, "Invalid reg size\n"); -+ ret = -EINVAL; -+ break; -+ } -+ } - -+done: - return ret; - } - - static int brcmf_sdiod_reg_read(struct brcmf_sdio_dev *sdiodev, u32 addr, - u8 regsz, void *data) - { -- u8 func; -- s32 retry = 0; - int ret; - -- if (sdiodev->state == BRCMF_SDIOD_NOMEDIUM) -- return -ENOMEDIUM; -- - /* - * figure out how to read the register based on address range - * 0x00 ~ 0x7FF: function 0 CCCR and FBR - * 0x10000 ~ 0x1FFFF: function 1 miscellaneous registers - * The rest: function 1 silicon backplane core registers -+ * f0 reads must be bytewise - */ -- if ((addr & ~REG_F0_REG_MASK) == 0) -- func = SDIO_FUNC_0; -- else -- func = SDIO_FUNC_1; -- -- do { -- memset(data, 0, regsz); -- -- /* for retry wait for 1 ms till bus get settled down */ -- if (retry) -- usleep_range(1000, 2000); -- -- ret = brcmf_sdiod_request_data(sdiodev, func, addr, regsz, -- data, false); -- -- } while (ret != 0 && ret != -ENOMEDIUM && -- retry++ < SDIOH_API_ACCESS_RETRY_LIMIT); -- -- if (ret == -ENOMEDIUM) -- brcmf_sdiod_change_state(sdiodev, BRCMF_SDIOD_NOMEDIUM); -- -- return ret; --} -- --static int --brcmf_sdiod_set_sbaddr_window(struct brcmf_sdio_dev *sdiodev, u32 address) --{ -- int err = 0, i; -- u32 addr; -- -- if (sdiodev->state == BRCMF_SDIOD_NOMEDIUM) -- return -ENOMEDIUM; -- -- addr = (address & SBSDIO_SBWINDOW_MASK) >> 8; -- -- for (i = 0 ; i < 3 && !err ; i++, addr >>= 8) -- brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_SBADDRLOW + i, -- addr & 0xff, &err); -- -- return err; --} -- --static int --brcmf_sdiod_addrprep(struct brcmf_sdio_dev *sdiodev, u32 *addr) --{ -- uint bar0 = *addr & ~SBSDIO_SB_OFT_ADDR_MASK; -- int err = 0; -- -- if (bar0 != sdiodev->sbwad) { -- err = brcmf_sdiod_set_sbaddr_window(sdiodev, bar0); -- if (err) -- return err; -+ if ((addr & ~REG_F0_REG_MASK) == 0) { -+ if (WARN_ON(regsz > 1)) -+ return -EINVAL; -+ *(u8 *)data = sdio_f0_readb(sdiodev->func[0], addr, &ret); -+ } else { -+ switch (regsz) { -+ case 1: -+ *(u8 *)data = sdio_readb(sdiodev->func[1], addr, &ret); -+ break; -+ case 4: -+ ret = brcmf_sdiod_addrprep(sdiodev, &addr); -+ if (ret) -+ goto done; - -- sdiodev->sbwad = bar0; -+ *(u32 *)data = sdio_readl(sdiodev->func[1], addr, &ret); -+ break; -+ default: -+ WARN(1, "Invalid reg size\n"); -+ ret = -EINVAL; -+ break; -+ } - } - -- *addr &= SBSDIO_SB_OFT_ADDR_MASK; -- *addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; -- -- return 0; -+done: -+ return ret; - } - - u8 brcmf_sdiod_regrb(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret) -@@ -439,15 +387,9 @@ u32 brcmf_sdiod_regrl(struct brcmf_sdio_ - int retval; - - brcmf_dbg(SDIO, "addr:0x%08x\n", addr); -- retval = brcmf_sdiod_addrprep(sdiodev, &addr); -- if (retval) -- goto done; -- - retval = brcmf_sdiod_reg_read(sdiodev, addr, 4, &data); -- - brcmf_dbg(SDIO, "data:0x%08x\n", data); - --done: - if (ret) - *ret = retval; - -@@ -472,13 +414,8 @@ void brcmf_sdiod_regwl(struct brcmf_sdio - int retval; - - brcmf_dbg(SDIO, "addr:0x%08x, data:0x%08x\n", addr, data); -- retval = brcmf_sdiod_addrprep(sdiodev, &addr); -- if (retval) -- goto done; -- - retval = brcmf_sdiod_reg_write(sdiodev, addr, 4, &data); - --done: - if (ret) - *ret = retval; - } -@@ -886,14 +823,12 @@ brcmf_sdiod_ramrw(struct brcmf_sdio_dev - return bcmerror; - } - --int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, uint fn) -+int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, u8 fn) - { -- char t_func = (char)fn; - brcmf_dbg(SDIO, "Enter\n"); - - /* issue abort cmd52 command through F0 */ -- brcmf_sdiod_request_data(sdiodev, SDIO_FUNC_0, SDIO_CCCR_ABORT, -- 1, &t_func, true); -+ brcmf_sdiod_reg_write(sdiodev, SDIO_CCCR_ABORT, 1, &fn); - - brcmf_dbg(SDIO, "Exit\n"); - return 0; ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h -@@ -339,7 +339,7 @@ int brcmf_sdiod_ramrw(struct brcmf_sdio_ - u8 *data, uint size); - - /* Issue an abort to the specified function */ --int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, uint fn); -+int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, u8 fn); - void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev); - void brcmf_sdiod_change_state(struct brcmf_sdio_dev *sdiodev, - enum brcmf_sdiod_state state); diff --git a/package/kernel/mac80211/patches/311-v4.16-0008-brcmfmac-Fix-asymmetric-IO-functions.patch b/package/kernel/mac80211/patches/311-v4.16-0008-brcmfmac-Fix-asymmetric-IO-functions.patch deleted file mode 100644 index bcf59722b28762..00000000000000 --- a/package/kernel/mac80211/patches/311-v4.16-0008-brcmfmac-Fix-asymmetric-IO-functions.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 3508a056a1f45d95c874fc9af8748bf4229432b6 Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Mon, 13 Nov 2017 21:35:45 +0100 -Subject: [PATCH] brcmfmac: Fix asymmetric IO functions. - -Unlikely to be a problem, but brcmf_sdiod_regrl() is -not symmetric with brcmf_sdiod_regrb() in initializing -the data value on stack. Fix that. - -Signed-off-by: Ian Molton -[arend: reword the commit message a bit] -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -383,7 +383,7 @@ u8 brcmf_sdiod_regrb(struct brcmf_sdio_d - - u32 brcmf_sdiod_regrl(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret) - { -- u32 data = 0; -+ u32 data; - int retval; - - brcmf_dbg(SDIO, "addr:0x%08x\n", addr); diff --git a/package/kernel/mac80211/patches/311-v4.16-0009-brcmfmac-Remove-noisy-debugging.patch b/package/kernel/mac80211/patches/311-v4.16-0009-brcmfmac-Remove-noisy-debugging.patch deleted file mode 100644 index 9a570450a773d0..00000000000000 --- a/package/kernel/mac80211/patches/311-v4.16-0009-brcmfmac-Remove-noisy-debugging.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 12e3e74e2820e11d91ee44fd3a190cd80d109faa Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Mon, 13 Nov 2017 21:35:46 +0100 -Subject: [PATCH] brcmfmac: Remove noisy debugging. - -If you need debugging this low level, you're doing something wrong. -Remove these noisy debug statements so the code is more readable. - -Signed-off-by: Ian Molton -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 6 ------ - 1 file changed, 6 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -371,9 +371,7 @@ u8 brcmf_sdiod_regrb(struct brcmf_sdio_d - u8 data; - int retval; - -- brcmf_dbg(SDIO, "addr:0x%08x\n", addr); - retval = brcmf_sdiod_reg_read(sdiodev, addr, 1, &data); -- brcmf_dbg(SDIO, "data:0x%02x\n", data); - - if (ret) - *ret = retval; -@@ -386,9 +384,7 @@ u32 brcmf_sdiod_regrl(struct brcmf_sdio_ - u32 data; - int retval; - -- brcmf_dbg(SDIO, "addr:0x%08x\n", addr); - retval = brcmf_sdiod_reg_read(sdiodev, addr, 4, &data); -- brcmf_dbg(SDIO, "data:0x%08x\n", data); - - if (ret) - *ret = retval; -@@ -401,7 +397,6 @@ void brcmf_sdiod_regwb(struct brcmf_sdio - { - int retval; - -- brcmf_dbg(SDIO, "addr:0x%08x, data:0x%02x\n", addr, data); - retval = brcmf_sdiod_reg_write(sdiodev, addr, 1, &data); - - if (ret) -@@ -413,7 +408,6 @@ void brcmf_sdiod_regwl(struct brcmf_sdio - { - int retval; - -- brcmf_dbg(SDIO, "addr:0x%08x, data:0x%08x\n", addr, data); - retval = brcmf_sdiod_reg_write(sdiodev, addr, 4, &data); - - if (ret) diff --git a/package/kernel/mac80211/patches/311-v4.16-0010-brcmfmac-Rename-bcmerror-to-err.patch b/package/kernel/mac80211/patches/311-v4.16-0010-brcmfmac-Rename-bcmerror-to-err.patch deleted file mode 100644 index dd153fe6cc4dfc..00000000000000 --- a/package/kernel/mac80211/patches/311-v4.16-0010-brcmfmac-Rename-bcmerror-to-err.patch +++ /dev/null @@ -1,58 +0,0 @@ -From dd8a2d49e4ed321ab8e7b679499c3a98ccc5ca24 Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Mon, 13 Nov 2017 21:35:47 +0100 -Subject: [PATCH] brcmfmac: Rename bcmerror to err - -Trivial cleanup of nasty variable name - -Signed-off-by: Ian Molton -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -746,7 +746,7 @@ int - brcmf_sdiod_ramrw(struct brcmf_sdio_dev *sdiodev, bool write, u32 address, - u8 *data, uint size) - { -- int bcmerror = 0; -+ int err = 0; - struct sk_buff *pkt; - u32 sdaddr; - uint dsize; -@@ -771,8 +771,8 @@ brcmf_sdiod_ramrw(struct brcmf_sdio_dev - /* Do the transfer(s) */ - while (size) { - /* Set the backplane window to include the start address */ -- bcmerror = brcmf_sdiod_set_sbaddr_window(sdiodev, address); -- if (bcmerror) -+ err = brcmf_sdiod_set_sbaddr_window(sdiodev, address); -+ if (err) - break; - - brcmf_dbg(SDIO, "%s %d bytes at offset 0x%08x in window 0x%08x\n", -@@ -785,9 +785,9 @@ brcmf_sdiod_ramrw(struct brcmf_sdio_dev - skb_put(pkt, dsize); - if (write) - memcpy(pkt->data, data, dsize); -- bcmerror = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_1, write, -- sdaddr, pkt); -- if (bcmerror) { -+ err = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_1, write, sdaddr, -+ pkt); -+ if (err) { - brcmf_err("membytes transfer failed\n"); - break; - } -@@ -814,7 +814,7 @@ brcmf_sdiod_ramrw(struct brcmf_sdio_dev - - sdio_release_host(sdiodev->func[1]); - -- return bcmerror; -+ return err; - } - - int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, u8 fn) diff --git a/package/kernel/mac80211/patches/312-v4.16-0001-brcmfmac-Split-brcmf_sdiod_buffrw-function-up.patch b/package/kernel/mac80211/patches/312-v4.16-0001-brcmfmac-Split-brcmf_sdiod_buffrw-function-up.patch deleted file mode 100644 index c260b96550e005..00000000000000 --- a/package/kernel/mac80211/patches/312-v4.16-0001-brcmfmac-Split-brcmf_sdiod_buffrw-function-up.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 8f13c87ccc495e30de5f58bbda967f6edd5bec53 Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Fri, 8 Dec 2017 13:10:26 +0100 -Subject: [PATCH] brcmfmac: Split brcmf_sdiod_buffrw function up. - -This function needs to be split up into separate read / write variants -for clarity. - -Signed-off-by: Ian Molton -Reviewed-by: Arend van Spriel -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 67 +++++++++++++++------- - 1 file changed, 45 insertions(+), 22 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -414,8 +414,8 @@ void brcmf_sdiod_regwl(struct brcmf_sdio - *ret = retval; - } - --static int brcmf_sdiod_buffrw(struct brcmf_sdio_dev *sdiodev, uint fn, -- bool write, u32 addr, struct sk_buff *pkt) -+static int brcmf_sdiod_buff_read(struct brcmf_sdio_dev *sdiodev, uint fn, -+ u32 addr, struct sk_buff *pkt) - { - unsigned int req_sz; - int err; -@@ -424,18 +424,36 @@ static int brcmf_sdiod_buffrw(struct brc - req_sz = pkt->len + 3; - req_sz &= (uint)~3; - -- if (write) -- err = sdio_memcpy_toio(sdiodev->func[fn], addr, -- ((u8 *)(pkt->data)), req_sz); -- else if (fn == 1) -- err = sdio_memcpy_fromio(sdiodev->func[fn], ((u8 *)(pkt->data)), -- addr, req_sz); -+ if (fn == 1) -+ err = sdio_memcpy_fromio(sdiodev->func[fn], -+ ((u8 *)(pkt->data)), addr, req_sz); - else - /* function 2 read is FIFO operation */ -- err = sdio_readsb(sdiodev->func[fn], ((u8 *)(pkt->data)), addr, -- req_sz); -+ err = sdio_readsb(sdiodev->func[fn], -+ ((u8 *)(pkt->data)), addr, req_sz); -+ -+ if (err == -ENOMEDIUM) -+ brcmf_sdiod_change_state(sdiodev, BRCMF_SDIOD_NOMEDIUM); -+ -+ return err; -+} -+ -+static int brcmf_sdiod_buff_write(struct brcmf_sdio_dev *sdiodev, uint fn, -+ u32 addr, struct sk_buff *pkt) -+{ -+ unsigned int req_sz; -+ int err; -+ -+ /* Single skb use the standard mmc interface */ -+ req_sz = pkt->len + 3; -+ req_sz &= (uint)~3; -+ -+ err = sdio_memcpy_toio(sdiodev->func[fn], addr, -+ ((u8 *)(pkt->data)), req_sz); -+ - if (err == -ENOMEDIUM) - brcmf_sdiod_change_state(sdiodev, BRCMF_SDIOD_NOMEDIUM); -+ - return err; - } - -@@ -643,7 +661,7 @@ int brcmf_sdiod_recv_pkt(struct brcmf_sd - if (err) - goto done; - -- err = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_2, false, addr, pkt); -+ err = brcmf_sdiod_buff_read(sdiodev, SDIO_FUNC_2, addr, pkt); - - done: - return err; -@@ -665,14 +683,14 @@ int brcmf_sdiod_recv_chain(struct brcmf_ - goto done; - - if (pktq->qlen == 1) -- err = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_2, false, addr, -- pktq->next); -+ err = brcmf_sdiod_buff_read(sdiodev, SDIO_FUNC_2, addr, -+ pktq->next); - else if (!sdiodev->sg_support) { - glom_skb = brcmu_pkt_buf_get_skb(totlen); - if (!glom_skb) - return -ENOMEM; -- err = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_2, false, addr, -- glom_skb); -+ err = brcmf_sdiod_buff_read(sdiodev, SDIO_FUNC_2, addr, -+ glom_skb); - if (err) - goto done; - -@@ -707,8 +725,7 @@ int brcmf_sdiod_send_buf(struct brcmf_sd - err = brcmf_sdiod_addrprep(sdiodev, &addr); - - if (!err) -- err = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_2, true, addr, -- mypkt); -+ err = brcmf_sdiod_buff_write(sdiodev, SDIO_FUNC_2, addr, mypkt); - - brcmu_pkt_buf_free_skb(mypkt); - return err; -@@ -730,8 +747,8 @@ int brcmf_sdiod_send_pkt(struct brcmf_sd - - if (pktq->qlen == 1 || !sdiodev->sg_support) - skb_queue_walk(pktq, skb) { -- err = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_2, true, -- addr, skb); -+ err = brcmf_sdiod_buff_write(sdiodev, SDIO_FUNC_2, -+ addr, skb); - if (err) - break; - } -@@ -783,10 +800,16 @@ brcmf_sdiod_ramrw(struct brcmf_sdio_dev - sdaddr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - - skb_put(pkt, dsize); -- if (write) -+ -+ if (write) { - memcpy(pkt->data, data, dsize); -- err = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_1, write, sdaddr, -- pkt); -+ err = brcmf_sdiod_buff_write(sdiodev, SDIO_FUNC_1, -+ sdaddr, pkt); -+ } else { -+ err = brcmf_sdiod_buff_read(sdiodev, SDIO_FUNC_1, -+ sdaddr, pkt); -+ } -+ - if (err) { - brcmf_err("membytes transfer failed\n"); - break; diff --git a/package/kernel/mac80211/patches/312-v4.16-0002-brcmfmac-whitespace-fixes-in-brcmf_sdiod_send_buf.patch b/package/kernel/mac80211/patches/312-v4.16-0002-brcmfmac-whitespace-fixes-in-brcmf_sdiod_send_buf.patch deleted file mode 100644 index 088a6169fdae2e..00000000000000 --- a/package/kernel/mac80211/patches/312-v4.16-0002-brcmfmac-whitespace-fixes-in-brcmf_sdiod_send_buf.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 6e24dd012bfda479d0046f7995058f167e1923bc Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Fri, 8 Dec 2017 13:10:27 +0100 -Subject: [PATCH] brcmfmac: whitespace fixes in brcmf_sdiod_send_buf() - -Signed-off-by: Ian Molton -Reviewed-by: Arend van Spriel -[arend: mention function in patch subject] -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -714,6 +714,7 @@ int brcmf_sdiod_send_buf(struct brcmf_sd - int err; - - mypkt = brcmu_pkt_buf_get_skb(nbytes); -+ - if (!mypkt) { - brcmf_err("brcmu_pkt_buf_get_skb failed: len %d\n", - nbytes); -@@ -728,8 +729,8 @@ int brcmf_sdiod_send_buf(struct brcmf_sd - err = brcmf_sdiod_buff_write(sdiodev, SDIO_FUNC_2, addr, mypkt); - - brcmu_pkt_buf_free_skb(mypkt); -- return err; - -+ return err; - } - - int brcmf_sdiod_send_pkt(struct brcmf_sdio_dev *sdiodev, diff --git a/package/kernel/mac80211/patches/312-v4.16-0003-brcmfmac-Clarify-if-using-braces.patch b/package/kernel/mac80211/patches/312-v4.16-0003-brcmfmac-Clarify-if-using-braces.patch deleted file mode 100644 index a44155b61a8a81..00000000000000 --- a/package/kernel/mac80211/patches/312-v4.16-0003-brcmfmac-Clarify-if-using-braces.patch +++ /dev/null @@ -1,36 +0,0 @@ -From a7323378dcf1f10a98f47b744e6f65e6fd671d84 Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Fri, 8 Dec 2017 13:10:28 +0100 -Subject: [PATCH] brcmfmac: Clarify if using braces. - -Whilst this if () statement is technically correct, it lacks clarity. - -Signed-off-by: Ian Molton -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -746,16 +746,17 @@ int brcmf_sdiod_send_pkt(struct brcmf_sd - if (err) - return err; - -- if (pktq->qlen == 1 || !sdiodev->sg_support) -+ if (pktq->qlen == 1 || !sdiodev->sg_support) { - skb_queue_walk(pktq, skb) { - err = brcmf_sdiod_buff_write(sdiodev, SDIO_FUNC_2, - addr, skb); - if (err) - break; - } -- else -+ } else { - err = brcmf_sdiod_sglist_rw(sdiodev, SDIO_FUNC_2, true, addr, - pktq); -+ } - - return err; - } diff --git a/package/kernel/mac80211/patches/312-v4.16-0004-brcmfmac-Rename-replace-old-IO-functions-with-simple.patch b/package/kernel/mac80211/patches/312-v4.16-0004-brcmfmac-Rename-replace-old-IO-functions-with-simple.patch deleted file mode 100644 index 7c27e17775c310..00000000000000 --- a/package/kernel/mac80211/patches/312-v4.16-0004-brcmfmac-Rename-replace-old-IO-functions-with-simple.patch +++ /dev/null @@ -1,831 +0,0 @@ -From 71bd508d7ded8c504ef05d1b4befecfe25e54cb1 Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Fri, 8 Dec 2017 13:10:29 +0100 -Subject: [PATCH] brcmfmac: Rename / replace old IO functions with simpler - ones. - -Primarily this patch removes: - -brcmf_sdiod_f0_writeb() -brcmf_sdiod_reg_write() -brcmf_sdiod_reg_read() - -Since we no longer use the quirky method of deciding which function to -address via the address being accessed, take the opportunity to rename -some IO functions more in line with common kernel code. We also convert -those that map directly to sdio_{read,write}*() to macros. - -Signed-off-by: Ian Molton -Reviewed-by: Arend van Spriel -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 169 +++---------------- - .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 186 ++++++++++----------- - .../wireless/broadcom/brcm80211/brcmfmac/sdio.h | 28 +++- - 3 files changed, 138 insertions(+), 245 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -137,27 +137,27 @@ int brcmf_sdiod_intr_register(struct brc - if (sdiodev->bus_if->chip == BRCM_CC_43362_CHIP_ID) { - /* assign GPIO to SDIO core */ - addr = CORE_CC_REG(SI_ENUM_BASE, gpiocontrol); -- gpiocontrol = brcmf_sdiod_regrl(sdiodev, addr, &ret); -+ gpiocontrol = brcmf_sdiod_readl(sdiodev, addr, &ret); - gpiocontrol |= 0x2; -- brcmf_sdiod_regwl(sdiodev, addr, gpiocontrol, &ret); -+ brcmf_sdiod_writel(sdiodev, addr, gpiocontrol, &ret); - -- brcmf_sdiod_regwb(sdiodev, SBSDIO_GPIO_SELECT, 0xf, -- &ret); -- brcmf_sdiod_regwb(sdiodev, SBSDIO_GPIO_OUT, 0, &ret); -- brcmf_sdiod_regwb(sdiodev, SBSDIO_GPIO_EN, 0x2, &ret); -+ brcmf_sdiod_writeb(sdiodev, SBSDIO_GPIO_SELECT, -+ 0xf, &ret); -+ brcmf_sdiod_writeb(sdiodev, SBSDIO_GPIO_OUT, 0, &ret); -+ brcmf_sdiod_writeb(sdiodev, SBSDIO_GPIO_EN, 0x2, &ret); - } - - /* must configure SDIO_CCCR_IENx to enable irq */ -- data = brcmf_sdiod_regrb(sdiodev, SDIO_CCCR_IENx, &ret); -+ data = brcmf_sdiod_func0_rb(sdiodev, SDIO_CCCR_IENx, &ret); - data |= 1 << SDIO_FUNC_1 | 1 << SDIO_FUNC_2 | 1; -- brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_IENx, data, &ret); -+ brcmf_sdiod_func0_wb(sdiodev, SDIO_CCCR_IENx, data, &ret); - - /* redirect, configure and enable io for interrupt signal */ - data = SDIO_SEPINT_MASK | SDIO_SEPINT_OE; - if (pdata->oob_irq_flags & IRQF_TRIGGER_HIGH) - data |= SDIO_SEPINT_ACT_HI; -- brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, data, &ret); -- -+ brcmf_sdiod_func0_wb(sdiodev, SDIO_CCCR_BRCM_SEPINT, -+ data, &ret); - sdio_release_host(sdiodev->func[1]); - } else { - brcmf_dbg(SDIO, "Entering\n"); -@@ -183,8 +183,8 @@ void brcmf_sdiod_intr_unregister(struct - - pdata = &sdiodev->settings->bus.sdio; - sdio_claim_host(sdiodev->func[1]); -- brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, 0, NULL); -- brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_IENx, 0, NULL); -+ brcmf_sdiod_func0_wb(sdiodev, SDIO_CCCR_BRCM_SEPINT, 0, NULL); -+ brcmf_sdiod_func0_wb(sdiodev, SDIO_CCCR_IENx, 0, NULL); - sdio_release_host(sdiodev->func[1]); - - sdiodev->oob_irq_requested = false; -@@ -242,8 +242,8 @@ static int brcmf_sdiod_set_sbaddr_window - addr = (address & SBSDIO_SBWINDOW_MASK) >> 8; - - for (i = 0 ; i < 3 && !err ; i++, addr >>= 8) -- brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_SBADDRLOW + i, -- addr & 0xff, &err); -+ brcmf_sdiod_writeb(sdiodev, SBSDIO_FUNC1_SBADDRLOW + i, -+ addr & 0xff, &err); - - return err; - } -@@ -267,124 +267,15 @@ static int brcmf_sdiod_addrprep(struct b - return 0; - } - --static inline int brcmf_sdiod_f0_writeb(struct sdio_func *func, u8 byte, -- uint regaddr) --{ -- int err_ret; -- -- /* -- * Can only directly write to some F0 registers. -- * Handle CCCR_IENx and CCCR_ABORT command -- * as a special case. -- */ -- if ((regaddr == SDIO_CCCR_ABORT) || -- (regaddr == SDIO_CCCR_IENx)) -- sdio_writeb(func, byte, regaddr, &err_ret); -- else -- sdio_f0_writeb(func, byte, regaddr, &err_ret); -- -- return err_ret; --} -- --static int brcmf_sdiod_reg_write(struct brcmf_sdio_dev *sdiodev, u32 addr, -- u8 regsz, void *data) --{ -- int ret; -- -- /* -- * figure out how to read the register based on address range -- * 0x00 ~ 0x7FF: function 0 CCCR and FBR -- * 0x10000 ~ 0x1FFFF: function 1 miscellaneous registers -- * The rest: function 1 silicon backplane core registers -- * f0 writes must be bytewise -- */ -- -- if ((addr & ~REG_F0_REG_MASK) == 0) { -- if (WARN_ON(regsz > 1)) -- return -EINVAL; -- ret = brcmf_sdiod_f0_writeb(sdiodev->func[0], -- *(u8 *)data, addr); -- } else { -- switch (regsz) { -- case 1: -- sdio_writeb(sdiodev->func[1], *(u8 *)data, addr, &ret); -- break; -- case 4: -- ret = brcmf_sdiod_addrprep(sdiodev, &addr); -- if (ret) -- goto done; -- -- sdio_writel(sdiodev->func[1], *(u32 *)data, addr, &ret); -- break; -- default: -- WARN(1, "Invalid reg size\n"); -- ret = -EINVAL; -- break; -- } -- } -- --done: -- return ret; --} -- --static int brcmf_sdiod_reg_read(struct brcmf_sdio_dev *sdiodev, u32 addr, -- u8 regsz, void *data) --{ -- int ret; -- -- /* -- * figure out how to read the register based on address range -- * 0x00 ~ 0x7FF: function 0 CCCR and FBR -- * 0x10000 ~ 0x1FFFF: function 1 miscellaneous registers -- * The rest: function 1 silicon backplane core registers -- * f0 reads must be bytewise -- */ -- if ((addr & ~REG_F0_REG_MASK) == 0) { -- if (WARN_ON(regsz > 1)) -- return -EINVAL; -- *(u8 *)data = sdio_f0_readb(sdiodev->func[0], addr, &ret); -- } else { -- switch (regsz) { -- case 1: -- *(u8 *)data = sdio_readb(sdiodev->func[1], addr, &ret); -- break; -- case 4: -- ret = brcmf_sdiod_addrprep(sdiodev, &addr); -- if (ret) -- goto done; -- -- *(u32 *)data = sdio_readl(sdiodev->func[1], addr, &ret); -- break; -- default: -- WARN(1, "Invalid reg size\n"); -- ret = -EINVAL; -- break; -- } -- } -- --done: -- return ret; --} -- --u8 brcmf_sdiod_regrb(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret) -+u32 brcmf_sdiod_readl(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret) - { -- u8 data; -+ u32 data = 0; - int retval; - -- retval = brcmf_sdiod_reg_read(sdiodev, addr, 1, &data); -- -- if (ret) -- *ret = retval; -- -- return data; --} -+ retval = brcmf_sdiod_addrprep(sdiodev, &addr); - --u32 brcmf_sdiod_regrl(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret) --{ -- u32 data; -- int retval; -- -- retval = brcmf_sdiod_reg_read(sdiodev, addr, 4, &data); -+ if (!retval) -+ data = sdio_readl(sdiodev->func[1], addr, &retval); - - if (ret) - *ret = retval; -@@ -392,23 +283,15 @@ u32 brcmf_sdiod_regrl(struct brcmf_sdio_ - return data; - } - --void brcmf_sdiod_regwb(struct brcmf_sdio_dev *sdiodev, u32 addr, -- u8 data, int *ret) -+void brcmf_sdiod_writel(struct brcmf_sdio_dev *sdiodev, u32 addr, -+ u32 data, int *ret) - { - int retval; - -- retval = brcmf_sdiod_reg_write(sdiodev, addr, 1, &data); -- -- if (ret) -- *ret = retval; --} -- --void brcmf_sdiod_regwl(struct brcmf_sdio_dev *sdiodev, u32 addr, -- u32 data, int *ret) --{ -- int retval; -+ retval = brcmf_sdiod_addrprep(sdiodev, &addr); - -- retval = brcmf_sdiod_reg_write(sdiodev, addr, 4, &data); -+ if (!retval) -+ sdio_writel(sdiodev->func[1], data, addr, &retval); - - if (ret) - *ret = retval; -@@ -846,8 +729,8 @@ int brcmf_sdiod_abort(struct brcmf_sdio_ - { - brcmf_dbg(SDIO, "Enter\n"); - -- /* issue abort cmd52 command through F0 */ -- brcmf_sdiod_reg_write(sdiodev, SDIO_CCCR_ABORT, 1, &fn); -+ /* Issue abort cmd52 command through F0 */ -+ brcmf_sdiod_func0_wb(sdiodev, SDIO_CCCR_ABORT, fn, NULL); - - brcmf_dbg(SDIO, "Exit\n"); - return 0; ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -669,7 +669,7 @@ static int r_sdreg32(struct brcmf_sdio * - int ret; - - core = brcmf_chip_get_core(bus->ci, BCMA_CORE_SDIO_DEV); -- *regvar = brcmf_sdiod_regrl(bus->sdiodev, core->base + offset, &ret); -+ *regvar = brcmf_sdiod_readl(bus->sdiodev, core->base + offset, &ret); - - return ret; - } -@@ -680,7 +680,7 @@ static int w_sdreg32(struct brcmf_sdio * - int ret; - - core = brcmf_chip_get_core(bus->ci, BCMA_CORE_SDIO_DEV); -- brcmf_sdiod_regwl(bus->sdiodev, core->base + reg_offset, regval, &ret); -+ brcmf_sdiod_writel(bus->sdiodev, core->base + reg_offset, regval, &ret); - - return ret; - } -@@ -697,8 +697,7 @@ brcmf_sdio_kso_control(struct brcmf_sdio - - wr_val = (on << SBSDIO_FUNC1_SLEEPCSR_KSO_SHIFT); - /* 1st KSO write goes to AOS wake up core if device is asleep */ -- brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, -- wr_val, &err); -+ brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, wr_val, &err); - - if (on) { - /* device WAKEUP through KSO: -@@ -724,7 +723,7 @@ brcmf_sdio_kso_control(struct brcmf_sdio - * just one write attempt may fail, - * read it back until it matches written value - */ -- rd_val = brcmf_sdiod_regrb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, -+ rd_val = brcmf_sdiod_readb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, - &err); - if (!err) { - if ((rd_val & bmask) == cmp_val) -@@ -734,9 +733,11 @@ brcmf_sdio_kso_control(struct brcmf_sdio - /* bail out upon subsequent access errors */ - if (err && (err_cnt++ > BRCMF_SDIO_MAX_ACCESS_ERRORS)) - break; -+ - udelay(KSO_WAIT_US); -- brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, -- wr_val, &err); -+ brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, wr_val, -+ &err); -+ - } while (try_cnt++ < MAX_KSO_ATTEMPTS); - - if (try_cnt > 2) -@@ -772,15 +773,15 @@ static int brcmf_sdio_htclk(struct brcmf - clkreq = - bus->alp_only ? SBSDIO_ALP_AVAIL_REQ : SBSDIO_HT_AVAIL_REQ; - -- brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, -- clkreq, &err); -+ brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, -+ clkreq, &err); - if (err) { - brcmf_err("HT Avail request error: %d\n", err); - return -EBADE; - } - - /* Check current status */ -- clkctl = brcmf_sdiod_regrb(bus->sdiodev, -+ clkctl = brcmf_sdiod_readb(bus->sdiodev, - SBSDIO_FUNC1_CHIPCLKCSR, &err); - if (err) { - brcmf_err("HT Avail read error: %d\n", err); -@@ -790,35 +791,34 @@ static int brcmf_sdio_htclk(struct brcmf - /* Go to pending and await interrupt if appropriate */ - if (!SBSDIO_CLKAV(clkctl, bus->alp_only) && pendok) { - /* Allow only clock-available interrupt */ -- devctl = brcmf_sdiod_regrb(bus->sdiodev, -+ devctl = brcmf_sdiod_readb(bus->sdiodev, - SBSDIO_DEVICE_CTL, &err); - if (err) { -- brcmf_err("Devctl error setting CA: %d\n", -- err); -+ brcmf_err("Devctl error setting CA: %d\n", err); - return -EBADE; - } - - devctl |= SBSDIO_DEVCTL_CA_INT_ONLY; -- brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL, -- devctl, &err); -+ brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_DEVICE_CTL, -+ devctl, &err); - brcmf_dbg(SDIO, "CLKCTL: set PENDING\n"); - bus->clkstate = CLK_PENDING; - - return 0; - } else if (bus->clkstate == CLK_PENDING) { - /* Cancel CA-only interrupt filter */ -- devctl = brcmf_sdiod_regrb(bus->sdiodev, -+ devctl = brcmf_sdiod_readb(bus->sdiodev, - SBSDIO_DEVICE_CTL, &err); - devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY; -- brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL, -- devctl, &err); -+ brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_DEVICE_CTL, -+ devctl, &err); - } - - /* Otherwise, wait here (polling) for HT Avail */ - timeout = jiffies + - msecs_to_jiffies(PMU_MAX_TRANSITION_DLY/1000); - while (!SBSDIO_CLKAV(clkctl, bus->alp_only)) { -- clkctl = brcmf_sdiod_regrb(bus->sdiodev, -+ clkctl = brcmf_sdiod_readb(bus->sdiodev, - SBSDIO_FUNC1_CHIPCLKCSR, - &err); - if (time_after(jiffies, timeout)) -@@ -852,16 +852,16 @@ static int brcmf_sdio_htclk(struct brcmf - - if (bus->clkstate == CLK_PENDING) { - /* Cancel CA-only interrupt filter */ -- devctl = brcmf_sdiod_regrb(bus->sdiodev, -+ devctl = brcmf_sdiod_readb(bus->sdiodev, - SBSDIO_DEVICE_CTL, &err); - devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY; -- brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL, -- devctl, &err); -+ brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_DEVICE_CTL, -+ devctl, &err); - } - - bus->clkstate = CLK_SDONLY; -- brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, -- clkreq, &err); -+ brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, -+ clkreq, &err); - brcmf_dbg(SDIO, "CLKCTL: turned OFF\n"); - if (err) { - brcmf_err("Failed access turning clock off: %d\n", -@@ -951,14 +951,14 @@ brcmf_sdio_bus_sleep(struct brcmf_sdio * - - /* Going to sleep */ - if (sleep) { -- clkcsr = brcmf_sdiod_regrb(bus->sdiodev, -+ clkcsr = brcmf_sdiod_readb(bus->sdiodev, - SBSDIO_FUNC1_CHIPCLKCSR, - &err); - if ((clkcsr & SBSDIO_CSR_MASK) == 0) { - brcmf_dbg(SDIO, "no clock, set ALP\n"); -- brcmf_sdiod_regwb(bus->sdiodev, -- SBSDIO_FUNC1_CHIPCLKCSR, -- SBSDIO_ALP_AVAIL_REQ, &err); -+ brcmf_sdiod_writeb(bus->sdiodev, -+ SBSDIO_FUNC1_CHIPCLKCSR, -+ SBSDIO_ALP_AVAIL_REQ, &err); - } - err = brcmf_sdio_kso_control(bus, false); - } else { -@@ -1178,16 +1178,16 @@ static void brcmf_sdio_rxfail(struct brc - if (abort) - brcmf_sdiod_abort(bus->sdiodev, SDIO_FUNC_2); - -- brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_FRAMECTRL, -- SFC_RF_TERM, &err); -+ brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_FUNC1_FRAMECTRL, SFC_RF_TERM, -+ &err); - bus->sdcnt.f1regdata++; - - /* Wait until the packet has been flushed (device/FIFO stable) */ - for (lastrbc = retries = 0xffff; retries > 0; retries--) { -- hi = brcmf_sdiod_regrb(bus->sdiodev, -- SBSDIO_FUNC1_RFRAMEBCHI, &err); -- lo = brcmf_sdiod_regrb(bus->sdiodev, -- SBSDIO_FUNC1_RFRAMEBCLO, &err); -+ hi = brcmf_sdiod_readb(bus->sdiodev, SBSDIO_FUNC1_RFRAMEBCHI, -+ &err); -+ lo = brcmf_sdiod_readb(bus->sdiodev, SBSDIO_FUNC1_RFRAMEBCLO, -+ &err); - bus->sdcnt.f1regdata += 2; - - if ((hi == 0) && (lo == 0)) -@@ -1229,12 +1229,12 @@ static void brcmf_sdio_txfail(struct brc - bus->sdcnt.tx_sderrs++; - - brcmf_sdiod_abort(sdiodev, SDIO_FUNC_2); -- brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_FRAMECTRL, SFC_WF_TERM, NULL); -+ brcmf_sdiod_writeb(sdiodev, SBSDIO_FUNC1_FRAMECTRL, SFC_WF_TERM, NULL); - bus->sdcnt.f1regdata++; - - for (i = 0; i < 3; i++) { -- hi = brcmf_sdiod_regrb(sdiodev, SBSDIO_FUNC1_WFRAMEBCHI, NULL); -- lo = brcmf_sdiod_regrb(sdiodev, SBSDIO_FUNC1_WFRAMEBCLO, NULL); -+ hi = brcmf_sdiod_readb(sdiodev, SBSDIO_FUNC1_WFRAMEBCHI, NULL); -+ lo = brcmf_sdiod_readb(sdiodev, SBSDIO_FUNC1_WFRAMEBCLO, NULL); - bus->sdcnt.f1regdata += 2; - if ((hi == 0) && (lo == 0)) - break; -@@ -2446,11 +2446,11 @@ static void brcmf_sdio_bus_stop(struct d - bus->hostintmask = 0; - - /* Force backplane clocks to assure F2 interrupt propagates */ -- saveclk = brcmf_sdiod_regrb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, -+ saveclk = brcmf_sdiod_readb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, - &err); - if (!err) -- brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, -- (saveclk | SBSDIO_FORCE_HT), &err); -+ brcmf_sdiod_writeb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, -+ (saveclk | SBSDIO_FORCE_HT), &err); - if (err) - brcmf_err("Failed to force clock for F2: err %d\n", - err); -@@ -2509,7 +2509,7 @@ static int brcmf_sdio_intr_rstatus(struc - buscore = brcmf_chip_get_core(bus->ci, BCMA_CORE_SDIO_DEV); - addr = buscore->base + offsetof(struct sdpcmd_regs, intstatus); - -- val = brcmf_sdiod_regrl(bus->sdiodev, addr, &ret); -+ val = brcmf_sdiod_readl(bus->sdiodev, addr, &ret); - bus->sdcnt.f1regdata++; - if (ret != 0) - return ret; -@@ -2519,7 +2519,7 @@ static int brcmf_sdio_intr_rstatus(struc - - /* Clear interrupts */ - if (val) { -- brcmf_sdiod_regwl(bus->sdiodev, addr, val, &ret); -+ brcmf_sdiod_writel(bus->sdiodev, addr, val, &ret); - bus->sdcnt.f1regdata++; - atomic_or(val, &bus->intstatus); - } -@@ -2545,23 +2545,23 @@ static void brcmf_sdio_dpc(struct brcmf_ - - #ifdef DEBUG - /* Check for inconsistent device control */ -- devctl = brcmf_sdiod_regrb(bus->sdiodev, -- SBSDIO_DEVICE_CTL, &err); -+ devctl = brcmf_sdiod_readb(bus->sdiodev, SBSDIO_DEVICE_CTL, -+ &err); - #endif /* DEBUG */ - - /* Read CSR, if clock on switch to AVAIL, else ignore */ -- clkctl = brcmf_sdiod_regrb(bus->sdiodev, -+ clkctl = brcmf_sdiod_readb(bus->sdiodev, - SBSDIO_FUNC1_CHIPCLKCSR, &err); - - brcmf_dbg(SDIO, "DPC: PENDING, devctl 0x%02x clkctl 0x%02x\n", - devctl, clkctl); - - if (SBSDIO_HTAV(clkctl)) { -- devctl = brcmf_sdiod_regrb(bus->sdiodev, -+ devctl = brcmf_sdiod_readb(bus->sdiodev, - SBSDIO_DEVICE_CTL, &err); - devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY; -- brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL, -- devctl, &err); -+ brcmf_sdiod_writeb(bus->sdiodev, -+ SBSDIO_DEVICE_CTL, devctl, &err); - bus->clkstate = CLK_AVAIL; - } - } -@@ -3347,31 +3347,31 @@ static void brcmf_sdio_sr_init(struct br - - brcmf_dbg(TRACE, "Enter\n"); - -- val = brcmf_sdiod_regrb(bus->sdiodev, SBSDIO_FUNC1_WAKEUPCTRL, &err); -+ val = brcmf_sdiod_readb(bus->sdiodev, SBSDIO_FUNC1_WAKEUPCTRL, &err); - if (err) { - brcmf_err("error reading SBSDIO_FUNC1_WAKEUPCTRL\n"); - return; - } - - val |= 1 << SBSDIO_FUNC1_WCTRL_HTWAIT_SHIFT; -- brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_WAKEUPCTRL, val, &err); -+ brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_FUNC1_WAKEUPCTRL, val, &err); - if (err) { - brcmf_err("error writing SBSDIO_FUNC1_WAKEUPCTRL\n"); - return; - } - - /* Add CMD14 Support */ -- brcmf_sdiod_regwb(bus->sdiodev, SDIO_CCCR_BRCM_CARDCAP, -- (SDIO_CCCR_BRCM_CARDCAP_CMD14_SUPPORT | -- SDIO_CCCR_BRCM_CARDCAP_CMD14_EXT), -- &err); -+ brcmf_sdiod_func0_wb(bus->sdiodev, SDIO_CCCR_BRCM_CARDCAP, -+ (SDIO_CCCR_BRCM_CARDCAP_CMD14_SUPPORT | -+ SDIO_CCCR_BRCM_CARDCAP_CMD14_EXT), -+ &err); - if (err) { - brcmf_err("error writing SDIO_CCCR_BRCM_CARDCAP\n"); - return; - } - -- brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, -- SBSDIO_FORCE_HT, &err); -+ brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, -+ SBSDIO_FORCE_HT, &err); - if (err) { - brcmf_err("error writing SBSDIO_FUNC1_CHIPCLKCSR\n"); - return; -@@ -3394,7 +3394,7 @@ static int brcmf_sdio_kso_init(struct br - if (brcmf_chip_get_core(bus->ci, BCMA_CORE_SDIO_DEV)->rev < 12) - return 0; - -- val = brcmf_sdiod_regrb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, &err); -+ val = brcmf_sdiod_readb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, &err); - if (err) { - brcmf_err("error reading SBSDIO_FUNC1_SLEEPCSR\n"); - return err; -@@ -3403,8 +3403,8 @@ static int brcmf_sdio_kso_init(struct br - if (!(val & SBSDIO_FUNC1_SLEEPCSR_KSO_MASK)) { - val |= (SBSDIO_FUNC1_SLEEPCSR_KSO_EN << - SBSDIO_FUNC1_SLEEPCSR_KSO_SHIFT); -- brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, -- val, &err); -+ brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, -+ val, &err); - if (err) { - brcmf_err("error writing SBSDIO_FUNC1_SLEEPCSR\n"); - return err; -@@ -3565,9 +3565,9 @@ static void brcmf_sdio_bus_watchdog(stru - u8 devpend; - - sdio_claim_host(bus->sdiodev->func[1]); -- devpend = brcmf_sdiod_regrb(bus->sdiodev, -- SDIO_CCCR_INTx, -- NULL); -+ devpend = brcmf_sdiod_func0_rb(bus->sdiodev, -+ SDIO_CCCR_INTx, -+ NULL); - sdio_release_host(bus->sdiodev->func[1]); - intstatus = devpend & (INTR_STATUS_FUNC1 | - INTR_STATUS_FUNC2); -@@ -3705,12 +3705,12 @@ brcmf_sdio_drivestrengthinit(struct brcm - } - } - addr = CORE_CC_REG(pmu->base, chipcontrol_addr); -- brcmf_sdiod_regwl(sdiodev, addr, 1, NULL); -- cc_data_temp = brcmf_sdiod_regrl(sdiodev, addr, NULL); -+ brcmf_sdiod_writel(sdiodev, addr, 1, NULL); -+ cc_data_temp = brcmf_sdiod_readl(sdiodev, addr, NULL); - cc_data_temp &= ~str_mask; - drivestrength_sel <<= str_shift; - cc_data_temp |= drivestrength_sel; -- brcmf_sdiod_regwl(sdiodev, addr, cc_data_temp, NULL); -+ brcmf_sdiod_writel(sdiodev, addr, cc_data_temp, NULL); - - brcmf_dbg(INFO, "SDIO: %d mA (req=%d mA) drive strength selected, set to 0x%08x\n", - str_tab[i].strength, drivestrength, cc_data_temp); -@@ -3725,7 +3725,7 @@ static int brcmf_sdio_buscoreprep(void * - - /* Try forcing SDIO core to do ALPAvail request only */ - clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_ALP_AVAIL_REQ; -- brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, clkset, &err); -+ brcmf_sdiod_writeb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, clkset, &err); - if (err) { - brcmf_err("error writing for HT off\n"); - return err; -@@ -3733,8 +3733,7 @@ static int brcmf_sdio_buscoreprep(void * - - /* If register supported, wait for ALPAvail and then force ALP */ - /* This may take up to 15 milliseconds */ -- clkval = brcmf_sdiod_regrb(sdiodev, -- SBSDIO_FUNC1_CHIPCLKCSR, NULL); -+ clkval = brcmf_sdiod_readb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, NULL); - - if ((clkval & ~SBSDIO_AVBITS) != clkset) { - brcmf_err("ChipClkCSR access: wrote 0x%02x read 0x%02x\n", -@@ -3742,10 +3741,11 @@ static int brcmf_sdio_buscoreprep(void * - return -EACCES; - } - -- SPINWAIT(((clkval = brcmf_sdiod_regrb(sdiodev, -- SBSDIO_FUNC1_CHIPCLKCSR, NULL)), -- !SBSDIO_ALPAV(clkval)), -- PMU_MAX_TRANSITION_DLY); -+ SPINWAIT(((clkval = brcmf_sdiod_readb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, -+ NULL)), -+ !SBSDIO_ALPAV(clkval)), -+ PMU_MAX_TRANSITION_DLY); -+ - if (!SBSDIO_ALPAV(clkval)) { - brcmf_err("timeout on ALPAV wait, clkval 0x%02x\n", - clkval); -@@ -3753,11 +3753,11 @@ static int brcmf_sdio_buscoreprep(void * - } - - clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_FORCE_ALP; -- brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, clkset, &err); -+ brcmf_sdiod_writeb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, clkset, &err); - udelay(65); - - /* Also, disable the extra SDIO pull-ups */ -- brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_SDIOPULLUP, 0, NULL); -+ brcmf_sdiod_writeb(sdiodev, SBSDIO_FUNC1_SDIOPULLUP, 0, NULL); - - return 0; - } -@@ -3772,7 +3772,7 @@ static void brcmf_sdio_buscore_activate( - /* clear all interrupts */ - core = brcmf_chip_get_core(chip, BCMA_CORE_SDIO_DEV); - reg_addr = core->base + offsetof(struct sdpcmd_regs, intstatus); -- brcmf_sdiod_regwl(sdiodev, reg_addr, 0xFFFFFFFF, NULL); -+ brcmf_sdiod_writel(sdiodev, reg_addr, 0xFFFFFFFF, NULL); - - if (rstvec) - /* Write reset vector to address 0 */ -@@ -3785,7 +3785,7 @@ static u32 brcmf_sdio_buscore_read32(voi - struct brcmf_sdio_dev *sdiodev = ctx; - u32 val, rev; - -- val = brcmf_sdiod_regrl(sdiodev, addr, NULL); -+ val = brcmf_sdiod_readl(sdiodev, addr, NULL); - if ((sdiodev->func[0]->device == SDIO_DEVICE_ID_BROADCOM_4335_4339 || - sdiodev->func[0]->device == SDIO_DEVICE_ID_BROADCOM_4339) && - addr == CORE_CC_REG(SI_ENUM_BASE, chipid)) { -@@ -3802,7 +3802,7 @@ static void brcmf_sdio_buscore_write32(v - { - struct brcmf_sdio_dev *sdiodev = ctx; - -- brcmf_sdiod_regwl(sdiodev, addr, val, NULL); -+ brcmf_sdiod_writel(sdiodev, addr, val, NULL); - } - - static const struct brcmf_buscore_ops brcmf_sdio_buscore_ops = { -@@ -3826,18 +3826,18 @@ brcmf_sdio_probe_attach(struct brcmf_sdi - sdio_claim_host(sdiodev->func[1]); - - pr_debug("F1 signature read @0x18000000=0x%4x\n", -- brcmf_sdiod_regrl(sdiodev, SI_ENUM_BASE, NULL)); -+ brcmf_sdiod_readl(sdiodev, SI_ENUM_BASE, NULL)); - - /* - * Force PLL off until brcmf_chip_attach() - * programs PLL control regs - */ - -- brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, -- BRCMF_INIT_CLKCTL1, &err); -+ brcmf_sdiod_writeb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, BRCMF_INIT_CLKCTL1, -+ &err); - if (!err) -- clkctl = brcmf_sdiod_regrb(sdiodev, -- SBSDIO_FUNC1_CHIPCLKCSR, &err); -+ clkctl = brcmf_sdiod_readb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, -+ &err); - - if (err || ((clkctl & ~SBSDIO_AVBITS) != BRCMF_INIT_CLKCTL1)) { - brcmf_err("ChipClkCSR access: err %d wrote 0x%02x read 0x%02x\n", -@@ -3897,25 +3897,25 @@ brcmf_sdio_probe_attach(struct brcmf_sdi - brcmf_sdio_drivestrengthinit(sdiodev, bus->ci, drivestrength); - - /* Set card control so an SDIO card reset does a WLAN backplane reset */ -- reg_val = brcmf_sdiod_regrb(sdiodev, SDIO_CCCR_BRCM_CARDCTRL, &err); -+ reg_val = brcmf_sdiod_func0_rb(sdiodev, SDIO_CCCR_BRCM_CARDCTRL, &err); - if (err) - goto fail; - - reg_val |= SDIO_CCCR_BRCM_CARDCTRL_WLANRESET; - -- brcmf_sdiod_regwb(sdiodev, SDIO_CCCR_BRCM_CARDCTRL, reg_val, &err); -+ brcmf_sdiod_func0_wb(sdiodev, SDIO_CCCR_BRCM_CARDCTRL, reg_val, &err); - if (err) - goto fail; - - /* set PMUControl so a backplane reset does PMU state reload */ - reg_addr = CORE_CC_REG(brcmf_chip_get_pmu(bus->ci)->base, pmucontrol); -- reg_val = brcmf_sdiod_regrl(sdiodev, reg_addr, &err); -+ reg_val = brcmf_sdiod_readl(sdiodev, reg_addr, &err); - if (err) - goto fail; - - reg_val |= (BCMA_CC_PMU_CTL_RES_RELOAD << BCMA_CC_PMU_CTL_RES_SHIFT); - -- brcmf_sdiod_regwl(sdiodev, reg_addr, reg_val, &err); -+ brcmf_sdiod_writel(sdiodev, reg_addr, reg_val, &err); - if (err) - goto fail; - -@@ -4055,10 +4055,10 @@ static void brcmf_sdio_firmware_callback - goto release; - - /* Force clocks on backplane to be sure F2 interrupt propagates */ -- saveclk = brcmf_sdiod_regrb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, &err); -+ saveclk = brcmf_sdiod_readb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, &err); - if (!err) { -- brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, -- (saveclk | SBSDIO_FORCE_HT), &err); -+ brcmf_sdiod_writeb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, -+ (saveclk | SBSDIO_FORCE_HT), &err); - } - if (err) { - brcmf_err("Failed to force clock for F2: err %d\n", err); -@@ -4080,7 +4080,7 @@ static void brcmf_sdio_firmware_callback - w_sdreg32(bus, bus->hostintmask, - offsetof(struct sdpcmd_regs, hostintmask)); - -- brcmf_sdiod_regwb(sdiodev, SBSDIO_WATERMARK, 8, &err); -+ brcmf_sdiod_writeb(sdiodev, SBSDIO_WATERMARK, 8, &err); - } else { - /* Disable F2 again */ - sdio_disable_func(sdiodev->func[SDIO_FUNC_2]); -@@ -4091,8 +4091,8 @@ static void brcmf_sdio_firmware_callback - brcmf_sdio_sr_init(bus); - } else { - /* Restore previous clock setting */ -- brcmf_sdiod_regwb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, -- saveclk, &err); -+ brcmf_sdiod_writeb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, -+ saveclk, &err); - } - - if (err == 0) { -@@ -4225,7 +4225,7 @@ struct brcmf_sdio *brcmf_sdio_probe(stru - bus->rxflow = false; - - /* Done with backplane-dependent accesses, can drop clock... */ -- brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, 0, NULL); -+ brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, 0, NULL); - - sdio_release_host(bus->sdiodev->func[1]); - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h -@@ -50,6 +50,7 @@ - #define SBSDIO_NUM_FUNCTION 3 - - /* function 0 vendor specific CCCR registers */ -+ - #define SDIO_CCCR_BRCM_CARDCAP 0xf0 - #define SDIO_CCCR_BRCM_CARDCAP_CMD14_SUPPORT 0x02 - #define SDIO_CCCR_BRCM_CARDCAP_CMD14_EXT 0x04 -@@ -131,8 +132,6 @@ - /* with b15, maps to 32-bit SB access */ - #define SBSDIO_SB_ACCESS_2_4B_FLAG 0x08000 - --/* valid bits in SBSDIO_FUNC1_SBADDRxxx regs */ -- - /* Address bits from SBADDR regs */ - #define SBSDIO_SBWINDOW_MASK 0xffff8000 - -@@ -293,13 +292,24 @@ struct sdpcmd_regs { - int brcmf_sdiod_intr_register(struct brcmf_sdio_dev *sdiodev); - void brcmf_sdiod_intr_unregister(struct brcmf_sdio_dev *sdiodev); - --/* sdio device register access interface */ --u8 brcmf_sdiod_regrb(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret); --u32 brcmf_sdiod_regrl(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret); --void brcmf_sdiod_regwb(struct brcmf_sdio_dev *sdiodev, u32 addr, u8 data, -- int *ret); --void brcmf_sdiod_regwl(struct brcmf_sdio_dev *sdiodev, u32 addr, u32 data, -- int *ret); -+/* SDIO device register access interface */ -+/* Accessors for SDIO Function 0 */ -+#define brcmf_sdiod_func0_rb(sdiodev, addr, r) \ -+ sdio_readb((sdiodev)->func[0], (addr), (r)) -+ -+#define brcmf_sdiod_func0_wb(sdiodev, addr, v, ret) \ -+ sdio_writeb((sdiodev)->func[0], (v), (addr), (ret)) -+ -+/* Accessors for SDIO Function 1 */ -+#define brcmf_sdiod_readb(sdiodev, addr, r) \ -+ sdio_readb((sdiodev)->func[1], (addr), (r)) -+ -+#define brcmf_sdiod_writeb(sdiodev, addr, v, ret) \ -+ sdio_writeb((sdiodev)->func[1], (v), (addr), (ret)) -+ -+u32 brcmf_sdiod_readl(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret); -+void brcmf_sdiod_writel(struct brcmf_sdio_dev *sdiodev, u32 addr, u32 data, -+ int *ret); - - /* Buffer transfer to/from device (client) core via cmd53. - * fn: function number diff --git a/package/kernel/mac80211/patches/312-v4.16-0005-brcmfmac-Tidy-register-definitions-a-little.patch b/package/kernel/mac80211/patches/312-v4.16-0005-brcmfmac-Tidy-register-definitions-a-little.patch deleted file mode 100644 index e77d601a81eaae..00000000000000 --- a/package/kernel/mac80211/patches/312-v4.16-0005-brcmfmac-Tidy-register-definitions-a-little.patch +++ /dev/null @@ -1,59 +0,0 @@ -From eeef8a5da781e11746347b3cd9f1942be48ebaf0 Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Fri, 8 Dec 2017 13:10:30 +0100 -Subject: [PATCH] brcmfmac: Tidy register definitions a little - -Trivial tidy of register definitions. - -Signed-off-by: Ian Molton -Acked-by: Arend van Spriel -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 4 ++-- - .../net/wireless/broadcom/brcm80211/brcmfmac/sdio.h | 19 ++++++++++--------- - 2 files changed, 12 insertions(+), 11 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -153,9 +153,9 @@ int brcmf_sdiod_intr_register(struct brc - brcmf_sdiod_func0_wb(sdiodev, SDIO_CCCR_IENx, data, &ret); - - /* redirect, configure and enable io for interrupt signal */ -- data = SDIO_SEPINT_MASK | SDIO_SEPINT_OE; -+ data = SDIO_CCCR_BRCM_SEPINT_MASK | SDIO_CCCR_BRCM_SEPINT_OE; - if (pdata->oob_irq_flags & IRQF_TRIGGER_HIGH) -- data |= SDIO_SEPINT_ACT_HI; -+ data |= SDIO_CCCR_BRCM_SEPINT_ACT_HI; - brcmf_sdiod_func0_wb(sdiodev, SDIO_CCCR_BRCM_SEPINT, - data, &ret); - sdio_release_host(sdiodev->func[1]); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h -@@ -52,16 +52,17 @@ - /* function 0 vendor specific CCCR registers */ - - #define SDIO_CCCR_BRCM_CARDCAP 0xf0 --#define SDIO_CCCR_BRCM_CARDCAP_CMD14_SUPPORT 0x02 --#define SDIO_CCCR_BRCM_CARDCAP_CMD14_EXT 0x04 --#define SDIO_CCCR_BRCM_CARDCAP_CMD_NODEC 0x08 --#define SDIO_CCCR_BRCM_CARDCTRL 0xf1 --#define SDIO_CCCR_BRCM_CARDCTRL_WLANRESET 0x02 --#define SDIO_CCCR_BRCM_SEPINT 0xf2 -+#define SDIO_CCCR_BRCM_CARDCAP_CMD14_SUPPORT BIT(1) -+#define SDIO_CCCR_BRCM_CARDCAP_CMD14_EXT BIT(2) -+#define SDIO_CCCR_BRCM_CARDCAP_CMD_NODEC BIT(3) -+ -+#define SDIO_CCCR_BRCM_CARDCTRL 0xf1 -+#define SDIO_CCCR_BRCM_CARDCTRL_WLANRESET BIT(1) - --#define SDIO_SEPINT_MASK 0x01 --#define SDIO_SEPINT_OE 0x02 --#define SDIO_SEPINT_ACT_HI 0x04 -+#define SDIO_CCCR_BRCM_SEPINT 0xf2 -+#define SDIO_CCCR_BRCM_SEPINT_MASK BIT(0) -+#define SDIO_CCCR_BRCM_SEPINT_OE BIT(1) -+#define SDIO_CCCR_BRCM_SEPINT_ACT_HI BIT(2) - - /* function 1 miscellaneous registers */ - diff --git a/package/kernel/mac80211/patches/312-v4.16-0006-brcmfmac-Remove-brcmf_sdiod_addrprep.patch b/package/kernel/mac80211/patches/312-v4.16-0006-brcmfmac-Remove-brcmf_sdiod_addrprep.patch deleted file mode 100644 index dc598aa4719ba3..00000000000000 --- a/package/kernel/mac80211/patches/312-v4.16-0006-brcmfmac-Remove-brcmf_sdiod_addrprep.patch +++ /dev/null @@ -1,190 +0,0 @@ -From a7c3aa1509e243a09c5b1660c8702d792ca76aed Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Fri, 8 Dec 2017 13:10:31 +0100 -Subject: [PATCH] brcmfmac: Remove brcmf_sdiod_addrprep() - -This function has become trivial enough that it may as well be pushed into -its callers, which has the side-benefit of clarifying what's going on. - -Remove it, and rename brcmf_sdiod_set_sbaddr_window() to -brcmf_sdiod_set_backplane_window() as it's easier to understand. - -Signed-off-by: Ian Molton -Reviewed-by: Arend van Spriel -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 84 ++++++++++++---------- - 1 file changed, 46 insertions(+), 38 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -230,41 +230,25 @@ void brcmf_sdiod_change_state(struct brc - sdiodev->state = state; - } - --static int brcmf_sdiod_set_sbaddr_window(struct brcmf_sdio_dev *sdiodev, -- u32 address) -+static int brcmf_sdiod_set_backplane_window(struct brcmf_sdio_dev *sdiodev, -+ u32 addr) - { -+ u32 v, bar0 = addr & SBSDIO_SBWINDOW_MASK; - int err = 0, i; -- u32 addr; - -- if (sdiodev->state == BRCMF_SDIOD_NOMEDIUM) -- return -ENOMEDIUM; -+ if (bar0 == sdiodev->sbwad) -+ return 0; - -- addr = (address & SBSDIO_SBWINDOW_MASK) >> 8; -+ v = bar0 >> 8; - -- for (i = 0 ; i < 3 && !err ; i++, addr >>= 8) -+ for (i = 0 ; i < 3 && !err ; i++, v >>= 8) - brcmf_sdiod_writeb(sdiodev, SBSDIO_FUNC1_SBADDRLOW + i, -- addr & 0xff, &err); -- -- return err; --} -- --static int brcmf_sdiod_addrprep(struct brcmf_sdio_dev *sdiodev, u32 *addr) --{ -- uint bar0 = *addr & ~SBSDIO_SB_OFT_ADDR_MASK; -- int err = 0; -- -- if (bar0 != sdiodev->sbwad) { -- err = brcmf_sdiod_set_sbaddr_window(sdiodev, bar0); -- if (err) -- return err; -+ v & 0xff, &err); - -+ if (!err) - sdiodev->sbwad = bar0; -- } - -- *addr &= SBSDIO_SB_OFT_ADDR_MASK; -- *addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; -- -- return 0; -+ return err; - } - - u32 brcmf_sdiod_readl(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret) -@@ -272,11 +256,16 @@ u32 brcmf_sdiod_readl(struct brcmf_sdio_ - u32 data = 0; - int retval; - -- retval = brcmf_sdiod_addrprep(sdiodev, &addr); -+ retval = brcmf_sdiod_set_backplane_window(sdiodev, addr); -+ if (retval) -+ goto out; -+ -+ addr &= SBSDIO_SB_OFT_ADDR_MASK; -+ addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - -- if (!retval) -- data = sdio_readl(sdiodev->func[1], addr, &retval); -+ data = sdio_readl(sdiodev->func[1], addr, &retval); - -+out: - if (ret) - *ret = retval; - -@@ -288,11 +277,16 @@ void brcmf_sdiod_writel(struct brcmf_sdi - { - int retval; - -- retval = brcmf_sdiod_addrprep(sdiodev, &addr); -+ retval = brcmf_sdiod_set_backplane_window(sdiodev, addr); -+ if (retval) -+ goto out; - -- if (!retval) -- sdio_writel(sdiodev->func[1], data, addr, &retval); -+ addr &= SBSDIO_SB_OFT_ADDR_MASK; -+ addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - -+ sdio_writel(sdiodev->func[1], data, addr, &retval); -+ -+out: - if (ret) - *ret = retval; - } -@@ -540,10 +534,13 @@ int brcmf_sdiod_recv_pkt(struct brcmf_sd - - brcmf_dbg(SDIO, "addr = 0x%x, size = %d\n", addr, pkt->len); - -- err = brcmf_sdiod_addrprep(sdiodev, &addr); -+ err = brcmf_sdiod_set_backplane_window(sdiodev, addr); - if (err) - goto done; - -+ addr &= SBSDIO_SB_OFT_ADDR_MASK; -+ addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; -+ - err = brcmf_sdiod_buff_read(sdiodev, SDIO_FUNC_2, addr, pkt); - - done: -@@ -561,10 +558,13 @@ int brcmf_sdiod_recv_chain(struct brcmf_ - brcmf_dbg(SDIO, "addr = 0x%x, size = %d\n", - addr, pktq->qlen); - -- err = brcmf_sdiod_addrprep(sdiodev, &addr); -+ err = brcmf_sdiod_set_backplane_window(sdiodev, addr); - if (err) - goto done; - -+ addr &= SBSDIO_SB_OFT_ADDR_MASK; -+ addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; -+ - if (pktq->qlen == 1) - err = brcmf_sdiod_buff_read(sdiodev, SDIO_FUNC_2, addr, - pktq->next); -@@ -606,7 +606,12 @@ int brcmf_sdiod_send_buf(struct brcmf_sd - - memcpy(mypkt->data, buf, nbytes); - -- err = brcmf_sdiod_addrprep(sdiodev, &addr); -+ err = brcmf_sdiod_set_backplane_window(sdiodev, addr); -+ if (err) -+ return err; -+ -+ addr &= SBSDIO_SB_OFT_ADDR_MASK; -+ addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - - if (!err) - err = brcmf_sdiod_buff_write(sdiodev, SDIO_FUNC_2, addr, mypkt); -@@ -625,10 +630,13 @@ int brcmf_sdiod_send_pkt(struct brcmf_sd - - brcmf_dbg(SDIO, "addr = 0x%x, size = %d\n", addr, pktq->qlen); - -- err = brcmf_sdiod_addrprep(sdiodev, &addr); -+ err = brcmf_sdiod_set_backplane_window(sdiodev, addr); - if (err) - return err; - -+ addr &= SBSDIO_SB_OFT_ADDR_MASK; -+ addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; -+ - if (pktq->qlen == 1 || !sdiodev->sg_support) { - skb_queue_walk(pktq, skb) { - err = brcmf_sdiod_buff_write(sdiodev, SDIO_FUNC_2, -@@ -673,7 +681,7 @@ brcmf_sdiod_ramrw(struct brcmf_sdio_dev - /* Do the transfer(s) */ - while (size) { - /* Set the backplane window to include the start address */ -- err = brcmf_sdiod_set_sbaddr_window(sdiodev, address); -+ err = brcmf_sdiod_set_backplane_window(sdiodev, address); - if (err) - break; - -@@ -716,7 +724,7 @@ brcmf_sdiod_ramrw(struct brcmf_sdio_dev - dev_kfree_skb(pkt); - - /* Return the window to backplane enumeration space for core access */ -- if (brcmf_sdiod_set_sbaddr_window(sdiodev, sdiodev->sbwad)) -+ if (brcmf_sdiod_set_backplane_window(sdiodev, sdiodev->sbwad)) - brcmf_err("FAILED to set window back to 0x%x\n", - sdiodev->sbwad); - diff --git a/package/kernel/mac80211/patches/312-v4.16-0007-brcmfmac-remove-unnecessary-call-to-brcmf_sdiod_set_.patch b/package/kernel/mac80211/patches/312-v4.16-0007-brcmfmac-remove-unnecessary-call-to-brcmf_sdiod_set_.patch deleted file mode 100644 index b9410dd7d0a006..00000000000000 --- a/package/kernel/mac80211/patches/312-v4.16-0007-brcmfmac-remove-unnecessary-call-to-brcmf_sdiod_set_.patch +++ /dev/null @@ -1,32 +0,0 @@ -From c900072bd6faff089aa4fb7b19136a2a0fe3baf0 Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Fri, 8 Dec 2017 13:10:32 +0100 -Subject: [PATCH] brcmfmac: remove unnecessary call to - brcmf_sdiod_set_backplane_window() - -All functions that might require the window address changing call -brcmf_sdiod_set_backplane_window() prior to access. Thus resetting -the window is not required. - -Signed-off-by: Ian Molton -[arend: corrected the driver prefix in the subject] -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 5 ----- - 1 file changed, 5 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -723,11 +723,6 @@ brcmf_sdiod_ramrw(struct brcmf_sdio_dev - - dev_kfree_skb(pkt); - -- /* Return the window to backplane enumeration space for core access */ -- if (brcmf_sdiod_set_backplane_window(sdiodev, sdiodev->sbwad)) -- brcmf_err("FAILED to set window back to 0x%x\n", -- sdiodev->sbwad); -- - sdio_release_host(sdiodev->func[1]); - - return err; diff --git a/package/kernel/mac80211/patches/312-v4.16-0008-brcmfmac-Cleanup-offsetof.patch b/package/kernel/mac80211/patches/312-v4.16-0008-brcmfmac-Cleanup-offsetof.patch deleted file mode 100644 index f9e5df550f1f47..00000000000000 --- a/package/kernel/mac80211/patches/312-v4.16-0008-brcmfmac-Cleanup-offsetof.patch +++ /dev/null @@ -1,134 +0,0 @@ -From e4c05fc3c0a6c79376f72f17d08014477e962ada Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Fri, 8 Dec 2017 13:10:33 +0100 -Subject: [PATCH] brcmfmac: Cleanup offsetof() - -Create a macro to make the code a bit more readable, whilst we're stuck -with using struct element offsets as register offsets. - -Signed-off-by: Ian Molton -Reviewed-by: Arend van Spriel -[arend: rename macro to SD_REG] -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 35 +++++++++------------- - 1 file changed, 14 insertions(+), 21 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -161,6 +161,8 @@ struct rte_console { - - #define CORE_BUS_REG(base, field) \ - (base + offsetof(struct sdpcmd_regs, field)) -+#define SD_REG(field) \ -+ (offsetof(struct sdpcmd_regs, field)) - - /* SDIO function 1 register CHIPCLKCSR */ - /* Force ALP request to backplane */ -@@ -1087,12 +1089,10 @@ static u32 brcmf_sdio_hostmail(struct br - brcmf_dbg(SDIO, "Enter\n"); - - /* Read mailbox data and ack that we did so */ -- ret = r_sdreg32(bus, &hmb_data, -- offsetof(struct sdpcmd_regs, tohostmailboxdata)); -+ ret = r_sdreg32(bus, &hmb_data, SD_REG(tohostmailboxdata)); - - if (ret == 0) -- w_sdreg32(bus, SMB_INT_ACK, -- offsetof(struct sdpcmd_regs, tosbmailbox)); -+ w_sdreg32(bus, SMB_INT_ACK, SD_REG(tosbmailbox)); - bus->sdcnt.f1regdata += 2; - - /* dongle indicates the firmware has halted/crashed */ -@@ -1207,8 +1207,7 @@ static void brcmf_sdio_rxfail(struct brc - - if (rtx) { - bus->sdcnt.rxrtx++; -- err = w_sdreg32(bus, SMB_NAK, -- offsetof(struct sdpcmd_regs, tosbmailbox)); -+ err = w_sdreg32(bus, SMB_NAK, SD_REG(tosbmailbox)); - - bus->sdcnt.f1regdata++; - if (err == 0) -@@ -2333,9 +2332,7 @@ static uint brcmf_sdio_sendfromq(struct - if (!bus->intr) { - /* Check device status, signal pending interrupt */ - sdio_claim_host(bus->sdiodev->func[1]); -- ret = r_sdreg32(bus, &intstatus, -- offsetof(struct sdpcmd_regs, -- intstatus)); -+ ret = r_sdreg32(bus, &intstatus, SD_REG(intstatus)); - sdio_release_host(bus->sdiodev->func[1]); - bus->sdcnt.f2txdata++; - if (ret != 0) -@@ -2441,7 +2438,7 @@ static void brcmf_sdio_bus_stop(struct d - brcmf_sdio_bus_sleep(bus, false, false); - - /* Disable and clear interrupts at the chip level also */ -- w_sdreg32(bus, 0, offsetof(struct sdpcmd_regs, hostintmask)); -+ w_sdreg32(bus, 0, SD_REG(hostintmask)); - local_hostintmask = bus->hostintmask; - bus->hostintmask = 0; - -@@ -2460,8 +2457,7 @@ static void brcmf_sdio_bus_stop(struct d - sdio_disable_func(sdiodev->func[SDIO_FUNC_2]); - - /* Clear any pending interrupts now that F2 is disabled */ -- w_sdreg32(bus, local_hostintmask, -- offsetof(struct sdpcmd_regs, intstatus)); -+ w_sdreg32(bus, local_hostintmask, SD_REG(intstatus)); - - sdio_release_host(sdiodev->func[1]); - } -@@ -2507,7 +2503,7 @@ static int brcmf_sdio_intr_rstatus(struc - int ret; - - buscore = brcmf_chip_get_core(bus->ci, BCMA_CORE_SDIO_DEV); -- addr = buscore->base + offsetof(struct sdpcmd_regs, intstatus); -+ addr = buscore->base + SD_REG(intstatus); - - val = brcmf_sdiod_readl(bus->sdiodev, addr, &ret); - bus->sdcnt.f1regdata++; -@@ -2584,11 +2580,9 @@ static void brcmf_sdio_dpc(struct brcmf_ - */ - if (intstatus & I_HMB_FC_CHANGE) { - intstatus &= ~I_HMB_FC_CHANGE; -- err = w_sdreg32(bus, I_HMB_FC_CHANGE, -- offsetof(struct sdpcmd_regs, intstatus)); -+ err = w_sdreg32(bus, I_HMB_FC_CHANGE, SD_REG(intstatus)); - -- err = r_sdreg32(bus, &newstatus, -- offsetof(struct sdpcmd_regs, intstatus)); -+ err = r_sdreg32(bus, &newstatus, SD_REG(intstatus)); - bus->sdcnt.f1regdata += 2; - atomic_set(&bus->fcstate, - !!(newstatus & (I_HMB_FC_STATE | I_HMB_FC_CHANGE))); -@@ -3771,7 +3765,7 @@ static void brcmf_sdio_buscore_activate( - - /* clear all interrupts */ - core = brcmf_chip_get_core(chip, BCMA_CORE_SDIO_DEV); -- reg_addr = core->base + offsetof(struct sdpcmd_regs, intstatus); -+ reg_addr = core->base + SD_REG(intstatus); - brcmf_sdiod_writel(sdiodev, reg_addr, 0xFFFFFFFF, NULL); - - if (rstvec) -@@ -4067,7 +4061,7 @@ static void brcmf_sdio_firmware_callback - - /* Enable function 2 (frame transfers) */ - w_sdreg32(bus, SDPCM_PROT_VERSION << SMB_DATA_VERSION_SHIFT, -- offsetof(struct sdpcmd_regs, tosbmailboxdata)); -+ SD_REG(tosbmailboxdata)); - err = sdio_enable_func(sdiodev->func[SDIO_FUNC_2]); - - -@@ -4077,8 +4071,7 @@ static void brcmf_sdio_firmware_callback - if (!err) { - /* Set up the interrupt mask and enable interrupts */ - bus->hostintmask = HOSTINTMASK; -- w_sdreg32(bus, bus->hostintmask, -- offsetof(struct sdpcmd_regs, hostintmask)); -+ w_sdreg32(bus, bus->hostintmask, SD_REG(hostintmask)); - - brcmf_sdiod_writeb(sdiodev, SBSDIO_WATERMARK, 8, &err); - } else { diff --git a/package/kernel/mac80211/patches/312-v4.16-0009-brcmfmac-Remove-unused-macro.patch b/package/kernel/mac80211/patches/312-v4.16-0009-brcmfmac-Remove-unused-macro.patch deleted file mode 100644 index df72a70b3b6fb4..00000000000000 --- a/package/kernel/mac80211/patches/312-v4.16-0009-brcmfmac-Remove-unused-macro.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 5cfe38f1f8d3c6b98e15b8cfde05028a3c79930b Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Fri, 8 Dec 2017 13:10:34 +0100 -Subject: [PATCH] brcmfmac: Remove unused macro. - -This macro is used exactly nowhere in the code. Delete it. - -Signed-off-by: Ian Molton -Reviewed-by: Arend van Spriel -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 -- - 1 file changed, 2 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -159,8 +159,6 @@ struct rte_console { - /* manfid tuple length, include tuple, link bytes */ - #define SBSDIO_CIS_MANFID_TUPLE_LEN 6 - --#define CORE_BUS_REG(base, field) \ -- (base + offsetof(struct sdpcmd_regs, field)) - #define SD_REG(field) \ - (offsetof(struct sdpcmd_regs, field)) - diff --git a/package/kernel/mac80211/patches/312-v4.16-0010-brcmfmac-Remove-repeated-calls-to-brcmf_chip_get_cor.patch b/package/kernel/mac80211/patches/312-v4.16-0010-brcmfmac-Remove-repeated-calls-to-brcmf_chip_get_cor.patch deleted file mode 100644 index 69fbf5c80fdf63..00000000000000 --- a/package/kernel/mac80211/patches/312-v4.16-0010-brcmfmac-Remove-repeated-calls-to-brcmf_chip_get_cor.patch +++ /dev/null @@ -1,128 +0,0 @@ -From 21a10846d09db3c5e3bdfb0be0fc7aa9fdc7000a Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Fri, 8 Dec 2017 13:10:35 +0100 -Subject: [PATCH] brcmfmac: Remove repeated calls to brcmf_chip_get_core() - -There is no need to repeatdly call brcmf_chip_get_core(), which -traverses a list of cores every time its called (including during -register access code!). - -Call it once, and store a pointer to the core structure. The existing -code does nto keep track of users of the cores anyway, and even so, this -will allow for easier refcounting in future. - -Signed-off-by: Ian Molton -Reviewed-by: Arend van Spriel -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 25 +++++++++++++--------- - 1 file changed, 15 insertions(+), 10 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -436,6 +436,7 @@ struct brcmf_sdio_count { - struct brcmf_sdio { - struct brcmf_sdio_dev *sdiodev; /* sdio device handler */ - struct brcmf_chip *ci; /* Chip info struct */ -+ struct brcmf_core *sdio_core; /* sdio core info struct */ - - u32 hostintmask; /* Copy of Host Interrupt Mask */ - atomic_t intstatus; /* Intstatus bits (events) pending */ -@@ -665,10 +666,9 @@ static bool data_ok(struct brcmf_sdio *b - */ - static int r_sdreg32(struct brcmf_sdio *bus, u32 *regvar, u32 offset) - { -- struct brcmf_core *core; -+ struct brcmf_core *core = bus->sdio_core; - int ret; - -- core = brcmf_chip_get_core(bus->ci, BCMA_CORE_SDIO_DEV); - *regvar = brcmf_sdiod_readl(bus->sdiodev, core->base + offset, &ret); - - return ret; -@@ -676,10 +676,9 @@ static int r_sdreg32(struct brcmf_sdio * - - static int w_sdreg32(struct brcmf_sdio *bus, u32 regval, u32 reg_offset) - { -- struct brcmf_core *core; -+ struct brcmf_core *core = bus->sdio_core; - int ret; - -- core = brcmf_chip_get_core(bus->ci, BCMA_CORE_SDIO_DEV); - brcmf_sdiod_writel(bus->sdiodev, core->base + reg_offset, regval, &ret); - - return ret; -@@ -2495,12 +2494,11 @@ static inline void brcmf_sdio_clrintr(st - - static int brcmf_sdio_intr_rstatus(struct brcmf_sdio *bus) - { -- struct brcmf_core *buscore; -+ struct brcmf_core *buscore = bus->sdio_core; - u32 addr; - unsigned long val; - int ret; - -- buscore = brcmf_chip_get_core(bus->ci, BCMA_CORE_SDIO_DEV); - addr = buscore->base + SD_REG(intstatus); - - val = brcmf_sdiod_readl(bus->sdiodev, addr, &ret); -@@ -3377,13 +3375,14 @@ static void brcmf_sdio_sr_init(struct br - /* enable KSO bit */ - static int brcmf_sdio_kso_init(struct brcmf_sdio *bus) - { -+ struct brcmf_core *core = bus->sdio_core; - u8 val; - int err = 0; - - brcmf_dbg(TRACE, "Enter\n"); - - /* KSO bit added in SDIO core rev 12 */ -- if (brcmf_chip_get_core(bus->ci, BCMA_CORE_SDIO_DEV)->rev < 12) -+ if (core->rev < 12) - return 0; - - val = brcmf_sdiod_readb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, &err); -@@ -3412,6 +3411,7 @@ static int brcmf_sdio_bus_preinit(struct - struct brcmf_bus *bus_if = dev_get_drvdata(dev); - struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; - struct brcmf_sdio *bus = sdiodev->bus; -+ struct brcmf_core *core = bus->sdio_core; - uint pad_size; - u32 value; - int err; -@@ -3420,7 +3420,7 @@ static int brcmf_sdio_bus_preinit(struct - * a device perspective, ie. bus:txglom affects the - * bus transfers from device to host. - */ -- if (brcmf_chip_get_core(bus->ci, BCMA_CORE_SDIO_DEV)->rev < 12) { -+ if (core->rev < 12) { - /* for sdio core rev < 12, disable txgloming */ - value = 0; - err = brcmf_iovar_data_set(dev, "bus:txglom", &value, -@@ -3758,11 +3758,10 @@ static void brcmf_sdio_buscore_activate( - u32 rstvec) - { - struct brcmf_sdio_dev *sdiodev = ctx; -- struct brcmf_core *core; -+ struct brcmf_core *core = sdiodev->bus->sdio_core; - u32 reg_addr; - - /* clear all interrupts */ -- core = brcmf_chip_get_core(chip, BCMA_CORE_SDIO_DEV); - reg_addr = core->base + SD_REG(intstatus); - brcmf_sdiod_writel(sdiodev, reg_addr, 0xFFFFFFFF, NULL); - -@@ -3843,6 +3842,12 @@ brcmf_sdio_probe_attach(struct brcmf_sdi - bus->ci = NULL; - goto fail; - } -+ -+ /* Pick up the SDIO core info struct from chip.c */ -+ bus->sdio_core = brcmf_chip_get_core(bus->ci, BCMA_CORE_SDIO_DEV); -+ if (!bus->sdio_core) -+ goto fail; -+ - sdiodev->settings = brcmf_get_module_param(sdiodev->dev, - BRCMF_BUSTYPE_SDIO, - bus->ci->chip, diff --git a/package/kernel/mac80211/patches/313-v4.16-0001-brcmfmac-enlarge-buffer-size-of-caps-to-512-bytes.patch b/package/kernel/mac80211/patches/313-v4.16-0001-brcmfmac-enlarge-buffer-size-of-caps-to-512-bytes.patch deleted file mode 100644 index 731b7eda1b12a1..00000000000000 --- a/package/kernel/mac80211/patches/313-v4.16-0001-brcmfmac-enlarge-buffer-size-of-caps-to-512-bytes.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 7762bb134e3b40e8ee2611365775b7432190a9c7 Mon Sep 17 00:00:00 2001 -From: Wright Feng -Date: Mon, 11 Dec 2017 15:38:21 +0800 -Subject: [PATCH] brcmfmac: enlarge buffer size of caps to 512 bytes - -The buffer size of return of cap iovar is greater than 256 bytes in some -firmwares. For instance, the return size of cap iovar is 271 bytes in 4373 -13.10.246.79 firmare. It makes feature capability parsing failed because -caps buffer is default value. -So we enlarge caps buffer size to 512 bytes and add the error print for -cap iovar error. - -Signed-off-by: Wright Feng -Acked-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c -@@ -130,13 +130,19 @@ static void brcmf_feat_iovar_data_set(st - } - } - -+#define MAX_CAPS_BUFFER_SIZE 512 - static void brcmf_feat_firmware_capabilities(struct brcmf_if *ifp) - { -- char caps[256]; -+ char caps[MAX_CAPS_BUFFER_SIZE]; - enum brcmf_feat_id id; -- int i; -+ int i, err; -+ -+ err = brcmf_fil_iovar_data_get(ifp, "cap", caps, sizeof(caps)); -+ if (err) { -+ brcmf_err("could not get firmware cap (%d)\n", err); -+ return; -+ } - -- brcmf_fil_iovar_data_get(ifp, "cap", caps, sizeof(caps)); - brcmf_dbg(INFO, "[ %s]\n", caps); - - for (i = 0; i < ARRAY_SIZE(brcmf_fwcap_map); i++) { diff --git a/package/kernel/mac80211/patches/314-v4.16-0001-brcmfmac-Remove-r-w-_sdreg32.patch b/package/kernel/mac80211/patches/314-v4.16-0001-brcmfmac-Remove-r-w-_sdreg32.patch deleted file mode 100644 index 291cd5d787f532..00000000000000 --- a/package/kernel/mac80211/patches/314-v4.16-0001-brcmfmac-Remove-r-w-_sdreg32.patch +++ /dev/null @@ -1,227 +0,0 @@ -From 3d110df8f74781354051e4bb1e3e97fa368b2f80 Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Tue, 19 Dec 2017 13:47:07 +0100 -Subject: [PATCH] brcmfmac: Remove {r,w}_sdreg32 - -Remove yet another IO function from the code and replace with one -that already exists. - -Signed-off-by: Ian Molton -Reviewed-by: Arend van Spriel -[arend: keep address calculation, ie. (base + offset) in one line] -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 88 +++++++++++----------- - 1 file changed, 42 insertions(+), 46 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -660,30 +660,6 @@ static bool data_ok(struct brcmf_sdio *b - ((u8)(bus->tx_max - bus->tx_seq) & 0x80) == 0; - } - --/* -- * Reads a register in the SDIO hardware block. This block occupies a series of -- * adresses on the 32 bit backplane bus. -- */ --static int r_sdreg32(struct brcmf_sdio *bus, u32 *regvar, u32 offset) --{ -- struct brcmf_core *core = bus->sdio_core; -- int ret; -- -- *regvar = brcmf_sdiod_readl(bus->sdiodev, core->base + offset, &ret); -- -- return ret; --} -- --static int w_sdreg32(struct brcmf_sdio *bus, u32 regval, u32 reg_offset) --{ -- struct brcmf_core *core = bus->sdio_core; -- int ret; -- -- brcmf_sdiod_writel(bus->sdiodev, core->base + reg_offset, regval, &ret); -- -- return ret; --} -- - static int - brcmf_sdio_kso_control(struct brcmf_sdio *bus, bool on) - { -@@ -1078,6 +1054,8 @@ static void brcmf_sdio_get_console_addr( - - static u32 brcmf_sdio_hostmail(struct brcmf_sdio *bus) - { -+ struct brcmf_sdio_dev *sdiod = bus->sdiodev; -+ struct brcmf_core *core = bus->sdio_core; - u32 intstatus = 0; - u32 hmb_data; - u8 fcbits; -@@ -1086,10 +1064,14 @@ static u32 brcmf_sdio_hostmail(struct br - brcmf_dbg(SDIO, "Enter\n"); - - /* Read mailbox data and ack that we did so */ -- ret = r_sdreg32(bus, &hmb_data, SD_REG(tohostmailboxdata)); -+ hmb_data = brcmf_sdiod_readl(sdiod, -+ core->base + SD_REG(tohostmailboxdata), -+ &ret); -+ -+ if (!ret) -+ brcmf_sdiod_writel(sdiod, core->base + SD_REG(tosbmailbox), -+ SMB_INT_ACK, &ret); - -- if (ret == 0) -- w_sdreg32(bus, SMB_INT_ACK, SD_REG(tosbmailbox)); - bus->sdcnt.f1regdata += 2; - - /* dongle indicates the firmware has halted/crashed */ -@@ -1163,6 +1145,8 @@ static u32 brcmf_sdio_hostmail(struct br - - static void brcmf_sdio_rxfail(struct brcmf_sdio *bus, bool abort, bool rtx) - { -+ struct brcmf_sdio_dev *sdiod = bus->sdiodev; -+ struct brcmf_core *core = bus->sdio_core; - uint retries = 0; - u16 lastrbc; - u8 hi, lo; -@@ -1204,7 +1188,8 @@ static void brcmf_sdio_rxfail(struct brc - - if (rtx) { - bus->sdcnt.rxrtx++; -- err = w_sdreg32(bus, SMB_NAK, SD_REG(tosbmailbox)); -+ brcmf_sdiod_writel(sdiod, core->base + SD_REG(tosbmailbox), -+ SMB_NAK, &err); - - bus->sdcnt.f1regdata++; - if (err == 0) -@@ -2291,6 +2276,7 @@ static uint brcmf_sdio_sendfromq(struct - { - struct sk_buff *pkt; - struct sk_buff_head pktq; -+ u32 intstat_addr = bus->sdio_core->base + SD_REG(intstatus); - u32 intstatus = 0; - int ret = 0, prec_out, i; - uint cnt = 0; -@@ -2329,7 +2315,8 @@ static uint brcmf_sdio_sendfromq(struct - if (!bus->intr) { - /* Check device status, signal pending interrupt */ - sdio_claim_host(bus->sdiodev->func[1]); -- ret = r_sdreg32(bus, &intstatus, SD_REG(intstatus)); -+ intstatus = brcmf_sdiod_readl(bus->sdiodev, -+ intstat_addr, &ret); - sdio_release_host(bus->sdiodev->func[1]); - bus->sdcnt.f2txdata++; - if (ret != 0) -@@ -2413,12 +2400,13 @@ static int brcmf_sdio_tx_ctrlframe(struc - - static void brcmf_sdio_bus_stop(struct device *dev) - { -- u32 local_hostintmask; -- u8 saveclk; -- int err; - struct brcmf_bus *bus_if = dev_get_drvdata(dev); - struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; - struct brcmf_sdio *bus = sdiodev->bus; -+ struct brcmf_core *core = bus->sdio_core; -+ u32 local_hostintmask; -+ u8 saveclk; -+ int err; - - brcmf_dbg(TRACE, "Enter\n"); - -@@ -2435,7 +2423,9 @@ static void brcmf_sdio_bus_stop(struct d - brcmf_sdio_bus_sleep(bus, false, false); - - /* Disable and clear interrupts at the chip level also */ -- w_sdreg32(bus, 0, SD_REG(hostintmask)); -+ brcmf_sdiod_writel(sdiodev, core->base + SD_REG(hostintmask), -+ 0, NULL); -+ - local_hostintmask = bus->hostintmask; - bus->hostintmask = 0; - -@@ -2454,7 +2444,8 @@ static void brcmf_sdio_bus_stop(struct d - sdio_disable_func(sdiodev->func[SDIO_FUNC_2]); - - /* Clear any pending interrupts now that F2 is disabled */ -- w_sdreg32(bus, local_hostintmask, SD_REG(intstatus)); -+ brcmf_sdiod_writel(sdiodev, core->base + SD_REG(intstatus), -+ local_hostintmask, NULL); - - sdio_release_host(sdiodev->func[1]); - } -@@ -2521,7 +2512,9 @@ static int brcmf_sdio_intr_rstatus(struc - - static void brcmf_sdio_dpc(struct brcmf_sdio *bus) - { -+ struct brcmf_sdio_dev *sdiod = bus->sdiodev; - u32 newstatus = 0; -+ u32 intstat_addr = bus->sdio_core->base + SD_REG(intstatus); - unsigned long intstatus; - uint txlimit = bus->txbound; /* Tx frames to send before resched */ - uint framecnt; /* Temporary counter of tx/rx frames */ -@@ -2576,9 +2569,10 @@ static void brcmf_sdio_dpc(struct brcmf_ - */ - if (intstatus & I_HMB_FC_CHANGE) { - intstatus &= ~I_HMB_FC_CHANGE; -- err = w_sdreg32(bus, I_HMB_FC_CHANGE, SD_REG(intstatus)); -+ brcmf_sdiod_writel(sdiod, intstat_addr, I_HMB_FC_CHANGE, &err); -+ -+ newstatus = brcmf_sdiod_readl(sdiod, intstat_addr, &err); - -- err = r_sdreg32(bus, &newstatus, SD_REG(intstatus)); - bus->sdcnt.f1regdata += 2; - atomic_set(&bus->fcstate, - !!(newstatus & (I_HMB_FC_STATE | I_HMB_FC_CHANGE))); -@@ -4017,22 +4011,21 @@ static void brcmf_sdio_firmware_callback - const struct firmware *code, - void *nvram, u32 nvram_len) - { -- struct brcmf_bus *bus_if; -- struct brcmf_sdio_dev *sdiodev; -- struct brcmf_sdio *bus; -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev); -+ struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; -+ struct brcmf_sdio *bus = sdiodev->bus; -+ struct brcmf_sdio_dev *sdiod = bus->sdiodev; -+ struct brcmf_core *core = bus->sdio_core; - u8 saveclk; - - brcmf_dbg(TRACE, "Enter: dev=%s, err=%d\n", dev_name(dev), err); -- bus_if = dev_get_drvdata(dev); -- sdiodev = bus_if->bus_priv.sdio; -+ - if (err) - goto fail; - - if (!bus_if->drvr) - return; - -- bus = sdiodev->bus; -- - /* try to download image and nvram to the dongle */ - bus->alp_only = true; - err = brcmf_sdio_download_firmware(bus, code, nvram, nvram_len); -@@ -4063,8 +4056,9 @@ static void brcmf_sdio_firmware_callback - } - - /* Enable function 2 (frame transfers) */ -- w_sdreg32(bus, SDPCM_PROT_VERSION << SMB_DATA_VERSION_SHIFT, -- SD_REG(tosbmailboxdata)); -+ brcmf_sdiod_writel(sdiod, core->base + SD_REG(tosbmailboxdata), -+ SDPCM_PROT_VERSION << SMB_DATA_VERSION_SHIFT, NULL); -+ - err = sdio_enable_func(sdiodev->func[SDIO_FUNC_2]); - - -@@ -4074,7 +4068,9 @@ static void brcmf_sdio_firmware_callback - if (!err) { - /* Set up the interrupt mask and enable interrupts */ - bus->hostintmask = HOSTINTMASK; -- w_sdreg32(bus, bus->hostintmask, SD_REG(hostintmask)); -+ brcmf_sdiod_writel(sdiod, core->base + SD_REG(hostintmask), -+ bus->hostintmask, NULL); -+ - - brcmf_sdiod_writeb(sdiodev, SBSDIO_WATERMARK, 8, &err); - } else { diff --git a/package/kernel/mac80211/patches/314-v4.16-0002-brcmfmac-Rename-buscore-to-core-for-consistency.patch b/package/kernel/mac80211/patches/314-v4.16-0002-brcmfmac-Rename-buscore-to-core-for-consistency.patch deleted file mode 100644 index e9b5628309d975..00000000000000 --- a/package/kernel/mac80211/patches/314-v4.16-0002-brcmfmac-Rename-buscore-to-core-for-consistency.patch +++ /dev/null @@ -1,33 +0,0 @@ -From dbda7dacb79a377e8ed9d38ce0e4a58b70aa9060 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Tue, 19 Dec 2017 13:47:08 +0100 -Subject: [PATCH] brcmfmac: Rename buscore to core for consistency - -Avoid confusion with unrelated _buscore labels. - -Signed-off-by: Ian Molton -Acked-by: Arend van Spriel -[arend: only do the rename] -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -2485,12 +2485,12 @@ static inline void brcmf_sdio_clrintr(st - - static int brcmf_sdio_intr_rstatus(struct brcmf_sdio *bus) - { -- struct brcmf_core *buscore = bus->sdio_core; -+ struct brcmf_core *core = bus->sdio_core; - u32 addr; - unsigned long val; - int ret; - -- addr = buscore->base + SD_REG(intstatus); -+ addr = core->base + SD_REG(intstatus); - - val = brcmf_sdiod_readl(bus->sdiodev, addr, &ret); - bus->sdcnt.f1regdata++; diff --git a/package/kernel/mac80211/patches/314-v4.16-0003-brcmfmac-stabilise-the-value-of-sbwad-in-use-for-som.patch b/package/kernel/mac80211/patches/314-v4.16-0003-brcmfmac-stabilise-the-value-of-sbwad-in-use-for-som.patch deleted file mode 100644 index 3828c320f4c5c7..00000000000000 --- a/package/kernel/mac80211/patches/314-v4.16-0003-brcmfmac-stabilise-the-value-of-sbwad-in-use-for-som.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 874bb8e49b7c6368f8ff9f2566c7bd06a2249be0 Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Tue, 19 Dec 2017 13:47:09 +0100 -Subject: [PATCH] brcmfmac: stabilise the value of ->sbwad in use for some xfer - routines. - -The IO functions operate within the Chipcommon IO window. Explicitly -set this, rather than relying on the last initialisation IO access to -leave it set to the right value by chance. - -Signed-off-by: Ian Molton -Acked-by: Arend van Spriel -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 8 ++++---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 5 +++++ - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h | 1 + - 3 files changed, 10 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -529,7 +529,7 @@ int brcmf_sdiod_recv_buf(struct brcmf_sd - - int brcmf_sdiod_recv_pkt(struct brcmf_sdio_dev *sdiodev, struct sk_buff *pkt) - { -- u32 addr = sdiodev->sbwad; -+ u32 addr = sdiodev->cc_core->base; - int err = 0; - - brcmf_dbg(SDIO, "addr = 0x%x, size = %d\n", addr, pkt->len); -@@ -552,7 +552,7 @@ int brcmf_sdiod_recv_chain(struct brcmf_ - { - struct sk_buff *glom_skb = NULL; - struct sk_buff *skb; -- u32 addr = sdiodev->sbwad; -+ u32 addr = sdiodev->cc_core->base; - int err = 0; - - brcmf_dbg(SDIO, "addr = 0x%x, size = %d\n", -@@ -593,7 +593,7 @@ done: - int brcmf_sdiod_send_buf(struct brcmf_sdio_dev *sdiodev, u8 *buf, uint nbytes) - { - struct sk_buff *mypkt; -- u32 addr = sdiodev->sbwad; -+ u32 addr = sdiodev->cc_core->base; - int err; - - mypkt = brcmu_pkt_buf_get_skb(nbytes); -@@ -625,7 +625,7 @@ int brcmf_sdiod_send_pkt(struct brcmf_sd - struct sk_buff_head *pktq) - { - struct sk_buff *skb; -- u32 addr = sdiodev->sbwad; -+ u32 addr = sdiodev->cc_core->base; - int err; - - brcmf_dbg(SDIO, "addr = 0x%x, size = %d\n", addr, pktq->qlen); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -3842,6 +3842,11 @@ brcmf_sdio_probe_attach(struct brcmf_sdi - if (!bus->sdio_core) - goto fail; - -+ /* Pick up the CHIPCOMMON core info struct, for bulk IO in bcmsdh.c */ -+ sdiodev->cc_core = brcmf_chip_get_core(bus->ci, BCMA_CORE_CHIPCOMMON); -+ if (!sdiodev->cc_core) -+ goto fail; -+ - sdiodev->settings = brcmf_get_module_param(sdiodev->dev, - BRCMF_BUSTYPE_SDIO, - bus->ci->chip, ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h -@@ -178,6 +178,7 @@ struct brcmf_sdio_dev { - struct sdio_func *func[SDIO_MAX_FUNCS]; - u8 num_funcs; /* Supported funcs on client */ - u32 sbwad; /* Save backplane window address */ -+ struct brcmf_core *cc_core; /* chipcommon core info struct */ - struct brcmf_sdio *bus; - struct device *dev; - struct brcmf_bus *bus_if; diff --git a/package/kernel/mac80211/patches/314-v4.16-0004-brcmfmac-Correctly-handle-accesses-to-SDIO-func0.patch b/package/kernel/mac80211/patches/314-v4.16-0004-brcmfmac-Correctly-handle-accesses-to-SDIO-func0.patch deleted file mode 100644 index 86b269a34866db..00000000000000 --- a/package/kernel/mac80211/patches/314-v4.16-0004-brcmfmac-Correctly-handle-accesses-to-SDIO-func0.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 508422f3695bf66f7b85fb4723c22f5166003ec6 Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Tue, 19 Dec 2017 13:47:10 +0100 -Subject: [PATCH] brcmfmac: Correctly handle accesses to SDIO func0 - -Rather than workaround the restrictions on func0 addressing in the -driver, set MMC_QUIRK_LENIENT_FN0 - -Signed-off-by: Ian Molton -Acked-by: Arend van Spriel -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 4 ++++ - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h | 4 ++-- - 2 files changed, 6 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -995,6 +995,10 @@ static int brcmf_ops_sdio_probe(struct s - brcmf_dbg(SDIO, "Function#: %d\n", func->num); - - dev = &func->dev; -+ -+ /* Set MMC_QUIRK_LENIENT_FN0 for this card */ -+ func->card->quirks |= MMC_QUIRK_LENIENT_FN0; -+ - /* prohibit ACPI power management for this device */ - brcmf_sdiod_acpi_set_power_manageable(dev, 0); - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h -@@ -297,10 +297,10 @@ void brcmf_sdiod_intr_unregister(struct - /* SDIO device register access interface */ - /* Accessors for SDIO Function 0 */ - #define brcmf_sdiod_func0_rb(sdiodev, addr, r) \ -- sdio_readb((sdiodev)->func[0], (addr), (r)) -+ sdio_f0_readb((sdiodev)->func[0], (addr), (r)) - - #define brcmf_sdiod_func0_wb(sdiodev, addr, v, ret) \ -- sdio_writeb((sdiodev)->func[0], (v), (addr), (ret)) -+ sdio_f0_writeb((sdiodev)->func[0], (v), (addr), (ret)) - - /* Accessors for SDIO Function 1 */ - #define brcmf_sdiod_readb(sdiodev, addr, r) \ diff --git a/package/kernel/mac80211/patches/314-v4.16-0005-brcmfmac-Remove-func0-from-function-array.patch b/package/kernel/mac80211/patches/314-v4.16-0005-brcmfmac-Remove-func0-from-function-array.patch deleted file mode 100644 index 715b8656194c25..00000000000000 --- a/package/kernel/mac80211/patches/314-v4.16-0005-brcmfmac-Remove-func0-from-function-array.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 99d7b6fdfc8c24052c92c720330d31ca1332f996 Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Tue, 19 Dec 2017 13:47:11 +0100 -Subject: [PATCH] brcmfmac: Remove func0 from function array - -func0 is not provided by the mmc stack as a function when probing. -Instead providing specific access functions to read/write it. - -This prepares for a patch to remove the actual array entry itself. - -Signed-off-by: Ian Molton -Acked-by: Arend van Spriel -[arend: rephrased the commit message] -[arend: removed unrelated comment for which separate patch is warranted] -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 5 +---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 7 ++++--- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h | 13 ++++++------- - 3 files changed, 11 insertions(+), 14 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -1022,8 +1022,7 @@ static int brcmf_ops_sdio_probe(struct s - /* store refs to functions used. mmc_card does - * not hold the F0 function pointer. - */ -- sdiodev->func[0] = kmemdup(func, sizeof(*func), GFP_KERNEL); -- sdiodev->func[0]->num = 0; -+ sdiodev->func[0] = NULL; - sdiodev->func[1] = func->card->sdio_func[0]; - sdiodev->func[2] = func; - -@@ -1049,7 +1048,6 @@ static int brcmf_ops_sdio_probe(struct s - fail: - dev_set_drvdata(&func->dev, NULL); - dev_set_drvdata(&sdiodev->func[1]->dev, NULL); -- kfree(sdiodev->func[0]); - kfree(sdiodev); - kfree(bus_if); - return err; -@@ -1082,7 +1080,6 @@ static void brcmf_ops_sdio_remove(struct - dev_set_drvdata(&sdiodev->func[2]->dev, NULL); - - kfree(bus_if); -- kfree(sdiodev->func[0]); - kfree(sdiodev); - } - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -3771,9 +3771,10 @@ static u32 brcmf_sdio_buscore_read32(voi - u32 val, rev; - - val = brcmf_sdiod_readl(sdiodev, addr, NULL); -- if ((sdiodev->func[0]->device == SDIO_DEVICE_ID_BROADCOM_4335_4339 || -- sdiodev->func[0]->device == SDIO_DEVICE_ID_BROADCOM_4339) && -- addr == CORE_CC_REG(SI_ENUM_BASE, chipid)) { -+ -+ if ((sdiodev->func[1]->device == SDIO_DEVICE_ID_BROADCOM_4335_4339 || -+ sdiodev->func[1]->device == SDIO_DEVICE_ID_BROADCOM_4339) && -+ addr == CORE_CC_REG(SI_ENUM_BASE, chipid)) { - rev = (val & CID_REV_MASK) >> CID_REV_SHIFT; - if (rev >= 2) { - val &= ~CID_ID_MASK; ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h -@@ -21,7 +21,9 @@ - #include - #include "firmware.h" - --#define SDIO_FUNC_0 0 -+/* Maximum number of I/O funcs */ -+#define NUM_SDIO_FUNCS 3 -+ - #define SDIO_FUNC_1 1 - #define SDIO_FUNC_2 2 - -@@ -39,9 +41,6 @@ - #define INTR_STATUS_FUNC1 0x2 - #define INTR_STATUS_FUNC2 0x4 - --/* Maximum number of I/O funcs */ --#define SDIOD_MAX_IOFUNCS 7 -- - /* mask of register map */ - #define REG_F0_REG_MASK 0x7FF - #define REG_F1_MISC_MASK 0x1FFFF -@@ -175,7 +174,7 @@ struct brcmf_sdio; - struct brcmf_sdiod_freezer; - - struct brcmf_sdio_dev { -- struct sdio_func *func[SDIO_MAX_FUNCS]; -+ struct sdio_func *func[NUM_SDIO_FUNCS]; - u8 num_funcs; /* Supported funcs on client */ - u32 sbwad; /* Save backplane window address */ - struct brcmf_core *cc_core; /* chipcommon core info struct */ -@@ -297,10 +296,10 @@ void brcmf_sdiod_intr_unregister(struct - /* SDIO device register access interface */ - /* Accessors for SDIO Function 0 */ - #define brcmf_sdiod_func0_rb(sdiodev, addr, r) \ -- sdio_f0_readb((sdiodev)->func[0], (addr), (r)) -+ sdio_f0_readb((sdiodev)->func[1], (addr), (r)) - - #define brcmf_sdiod_func0_wb(sdiodev, addr, v, ret) \ -- sdio_f0_writeb((sdiodev)->func[0], (v), (addr), (ret)) -+ sdio_f0_writeb((sdiodev)->func[1], (v), (addr), (ret)) - - /* Accessors for SDIO Function 1 */ - #define brcmf_sdiod_readb(sdiodev, addr, r) \ diff --git a/package/kernel/mac80211/patches/314-v4.16-0006-brcmfmac-More-efficient-and-slightly-easier-to-read-.patch b/package/kernel/mac80211/patches/314-v4.16-0006-brcmfmac-More-efficient-and-slightly-easier-to-read-.patch deleted file mode 100644 index 71e4894b063664..00000000000000 --- a/package/kernel/mac80211/patches/314-v4.16-0006-brcmfmac-More-efficient-and-slightly-easier-to-read-.patch +++ /dev/null @@ -1,40 +0,0 @@ -From bcadaaa097c7ec103fe75f9da41f8fe52693b644 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Tue, 19 Dec 2017 13:47:12 +0100 -Subject: [PATCH] brcmfmac: More efficient and slightly easier to read fixup - for 4339 chips - -Its more efficient to test the register we're interested in first, -potentially avoiding two more comparisons, and therefore always avoiding -one comparison per call on all other chips. - -Signed-off-by: Ian Molton -[arend: fix some checkpatch warnings] -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -3772,15 +3772,16 @@ static u32 brcmf_sdio_buscore_read32(voi - - val = brcmf_sdiod_readl(sdiodev, addr, NULL); - -- if ((sdiodev->func[1]->device == SDIO_DEVICE_ID_BROADCOM_4335_4339 || -- sdiodev->func[1]->device == SDIO_DEVICE_ID_BROADCOM_4339) && -- addr == CORE_CC_REG(SI_ENUM_BASE, chipid)) { -+ if (addr == CORE_CC_REG(SI_ENUM_BASE, chipid) && -+ (sdiodev->func[1]->device == SDIO_DEVICE_ID_BROADCOM_4339 || -+ sdiodev->func[1]->device == SDIO_DEVICE_ID_BROADCOM_4335_4339)) { - rev = (val & CID_REV_MASK) >> CID_REV_SHIFT; - if (rev >= 2) { - val &= ~CID_ID_MASK; - val |= BRCM_CC_4339_CHIP_ID; - } - } -+ - return val; - } - diff --git a/package/kernel/mac80211/patches/314-v4.16-0007-brcmfmac-Replace-function-index-with-function-pointe.patch b/package/kernel/mac80211/patches/314-v4.16-0007-brcmfmac-Replace-function-index-with-function-pointe.patch deleted file mode 100644 index 4354a7081c1004..00000000000000 --- a/package/kernel/mac80211/patches/314-v4.16-0007-brcmfmac-Replace-function-index-with-function-pointe.patch +++ /dev/null @@ -1,347 +0,0 @@ -From 00eb62cfc5f806b003fe5d54c8b5fe9a9665482f Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Tue, 19 Dec 2017 13:47:13 +0100 -Subject: [PATCH] brcmfmac: Replace function index with function pointer - -In preparation for removing the function array, remove all code that -refers to function by index and replace with pointers to the function -itself. - -Signed-off-by: Ian Molton -Reviewed-by: Arend van Spriel -[arend: replace BUG() with WARN() macro] -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 85 ++++++++++++---------- - .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 15 ++-- - .../wireless/broadcom/brcm80211/brcmfmac/sdio.h | 6 +- - 3 files changed, 56 insertions(+), 50 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -291,8 +291,9 @@ out: - *ret = retval; - } - --static int brcmf_sdiod_buff_read(struct brcmf_sdio_dev *sdiodev, uint fn, -- u32 addr, struct sk_buff *pkt) -+static int brcmf_sdiod_buff_read(struct brcmf_sdio_dev *sdiodev, -+ struct sdio_func *func, u32 addr, -+ struct sk_buff *pkt) - { - unsigned int req_sz; - int err; -@@ -301,13 +302,19 @@ static int brcmf_sdiod_buff_read(struct - req_sz = pkt->len + 3; - req_sz &= (uint)~3; - -- if (fn == 1) -- err = sdio_memcpy_fromio(sdiodev->func[fn], -- ((u8 *)(pkt->data)), addr, req_sz); -- else -- /* function 2 read is FIFO operation */ -- err = sdio_readsb(sdiodev->func[fn], -- ((u8 *)(pkt->data)), addr, req_sz); -+ switch (func->num) { -+ case 1: -+ err = sdio_memcpy_fromio(func, ((u8 *)(pkt->data)), addr, -+ req_sz); -+ break; -+ case 2: -+ err = sdio_readsb(func, ((u8 *)(pkt->data)), addr, req_sz); -+ break; -+ default: -+ /* bail out as things are really fishy here */ -+ WARN(1, "invalid sdio function number: %d\n", func->num); -+ err = -ENOMEDIUM; -+ }; - - if (err == -ENOMEDIUM) - brcmf_sdiod_change_state(sdiodev, BRCMF_SDIOD_NOMEDIUM); -@@ -315,8 +322,9 @@ static int brcmf_sdiod_buff_read(struct - return err; - } - --static int brcmf_sdiod_buff_write(struct brcmf_sdio_dev *sdiodev, uint fn, -- u32 addr, struct sk_buff *pkt) -+static int brcmf_sdiod_buff_write(struct brcmf_sdio_dev *sdiodev, -+ struct sdio_func *func, u32 addr, -+ struct sk_buff *pkt) - { - unsigned int req_sz; - int err; -@@ -325,8 +333,7 @@ static int brcmf_sdiod_buff_write(struct - req_sz = pkt->len + 3; - req_sz &= (uint)~3; - -- err = sdio_memcpy_toio(sdiodev->func[fn], addr, -- ((u8 *)(pkt->data)), req_sz); -+ err = sdio_memcpy_toio(func, addr, ((u8 *)(pkt->data)), req_sz); - - if (err == -ENOMEDIUM) - brcmf_sdiod_change_state(sdiodev, BRCMF_SDIOD_NOMEDIUM); -@@ -337,7 +344,7 @@ static int brcmf_sdiod_buff_write(struct - /** - * brcmf_sdiod_sglist_rw - SDIO interface function for block data access - * @sdiodev: brcmfmac sdio device -- * @fn: SDIO function number -+ * @func: SDIO function - * @write: direction flag - * @addr: dongle memory address as source/destination - * @pkt: skb pointer -@@ -346,7 +353,8 @@ static int brcmf_sdiod_buff_write(struct - * stack for block data access. It assumes that the skb passed down by the - * caller has already been padded and aligned. - */ --static int brcmf_sdiod_sglist_rw(struct brcmf_sdio_dev *sdiodev, uint fn, -+static int brcmf_sdiod_sglist_rw(struct brcmf_sdio_dev *sdiodev, -+ struct sdio_func *func, - bool write, u32 addr, - struct sk_buff_head *pktlist) - { -@@ -372,7 +380,7 @@ static int brcmf_sdiod_sglist_rw(struct - req_sz = 0; - skb_queue_walk(pktlist, pkt_next) - req_sz += pkt_next->len; -- req_sz = ALIGN(req_sz, sdiodev->func[fn]->cur_blksize); -+ req_sz = ALIGN(req_sz, func->cur_blksize); - while (req_sz > PAGE_SIZE) { - pkt_next = brcmu_pkt_buf_get_skb(PAGE_SIZE); - if (pkt_next == NULL) { -@@ -391,7 +399,7 @@ static int brcmf_sdiod_sglist_rw(struct - target_list = &local_list; - } - -- func_blk_sz = sdiodev->func[fn]->cur_blksize; -+ func_blk_sz = func->cur_blksize; - max_req_sz = sdiodev->max_request_size; - max_seg_cnt = min_t(unsigned short, sdiodev->max_segment_count, - target_list->qlen); -@@ -408,10 +416,10 @@ static int brcmf_sdiod_sglist_rw(struct - mmc_dat.flags = write ? MMC_DATA_WRITE : MMC_DATA_READ; - mmc_cmd.opcode = SD_IO_RW_EXTENDED; - mmc_cmd.arg = write ? 1<<31 : 0; /* write flag */ -- mmc_cmd.arg |= (fn & 0x7) << 28; /* SDIO func num */ -- mmc_cmd.arg |= 1<<27; /* block mode */ -+ mmc_cmd.arg |= (func->num & 0x7) << 28; /* SDIO func num */ -+ mmc_cmd.arg |= 1 << 27; /* block mode */ - /* for function 1 the addr will be incremented */ -- mmc_cmd.arg |= (fn == 1) ? 1<<26 : 0; -+ mmc_cmd.arg |= (func->num == 1) ? 1 << 26 : 0; - mmc_cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_ADTC; - mmc_req.cmd = &mmc_cmd; - mmc_req.data = &mmc_dat; -@@ -457,11 +465,11 @@ static int brcmf_sdiod_sglist_rw(struct - mmc_cmd.arg |= (addr & 0x1FFFF) << 9; /* address */ - mmc_cmd.arg |= mmc_dat.blocks & 0x1FF; /* block count */ - /* incrementing addr for function 1 */ -- if (fn == 1) -+ if (func->num == 1) - addr += req_sz; - -- mmc_set_data_timeout(&mmc_dat, sdiodev->func[fn]->card); -- mmc_wait_for_req(sdiodev->func[fn]->card->host, &mmc_req); -+ mmc_set_data_timeout(&mmc_dat, func->card); -+ mmc_wait_for_req(func->card->host, &mmc_req); - - ret = mmc_cmd.error ? mmc_cmd.error : mmc_dat.error; - if (ret == -ENOMEDIUM) { -@@ -541,7 +549,7 @@ int brcmf_sdiod_recv_pkt(struct brcmf_sd - addr &= SBSDIO_SB_OFT_ADDR_MASK; - addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - -- err = brcmf_sdiod_buff_read(sdiodev, SDIO_FUNC_2, addr, pkt); -+ err = brcmf_sdiod_buff_read(sdiodev, sdiodev->func[2], addr, pkt); - - done: - return err; -@@ -566,13 +574,13 @@ int brcmf_sdiod_recv_chain(struct brcmf_ - addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - - if (pktq->qlen == 1) -- err = brcmf_sdiod_buff_read(sdiodev, SDIO_FUNC_2, addr, -+ err = brcmf_sdiod_buff_read(sdiodev, sdiodev->func[2], addr, - pktq->next); - else if (!sdiodev->sg_support) { - glom_skb = brcmu_pkt_buf_get_skb(totlen); - if (!glom_skb) - return -ENOMEM; -- err = brcmf_sdiod_buff_read(sdiodev, SDIO_FUNC_2, addr, -+ err = brcmf_sdiod_buff_read(sdiodev, sdiodev->func[2], addr, - glom_skb); - if (err) - goto done; -@@ -582,8 +590,8 @@ int brcmf_sdiod_recv_chain(struct brcmf_ - skb_pull(glom_skb, skb->len); - } - } else -- err = brcmf_sdiod_sglist_rw(sdiodev, SDIO_FUNC_2, false, addr, -- pktq); -+ err = brcmf_sdiod_sglist_rw(sdiodev, sdiodev->func[2], false, -+ addr, pktq); - - done: - brcmu_pkt_buf_free_skb(glom_skb); -@@ -614,7 +622,8 @@ int brcmf_sdiod_send_buf(struct brcmf_sd - addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - - if (!err) -- err = brcmf_sdiod_buff_write(sdiodev, SDIO_FUNC_2, addr, mypkt); -+ err = brcmf_sdiod_buff_write(sdiodev, sdiodev->func[2], addr, -+ mypkt); - - brcmu_pkt_buf_free_skb(mypkt); - -@@ -639,14 +648,14 @@ int brcmf_sdiod_send_pkt(struct brcmf_sd - - if (pktq->qlen == 1 || !sdiodev->sg_support) { - skb_queue_walk(pktq, skb) { -- err = brcmf_sdiod_buff_write(sdiodev, SDIO_FUNC_2, -+ err = brcmf_sdiod_buff_write(sdiodev, sdiodev->func[2], - addr, skb); - if (err) - break; - } - } else { -- err = brcmf_sdiod_sglist_rw(sdiodev, SDIO_FUNC_2, true, addr, -- pktq); -+ err = brcmf_sdiod_sglist_rw(sdiodev, sdiodev->func[2], true, -+ addr, pktq); - } - - return err; -@@ -696,10 +705,10 @@ brcmf_sdiod_ramrw(struct brcmf_sdio_dev - - if (write) { - memcpy(pkt->data, data, dsize); -- err = brcmf_sdiod_buff_write(sdiodev, SDIO_FUNC_1, -+ err = brcmf_sdiod_buff_write(sdiodev, sdiodev->func[1], - sdaddr, pkt); - } else { -- err = brcmf_sdiod_buff_read(sdiodev, SDIO_FUNC_1, -+ err = brcmf_sdiod_buff_read(sdiodev, sdiodev->func[1], - sdaddr, pkt); - } - -@@ -728,12 +737,12 @@ brcmf_sdiod_ramrw(struct brcmf_sdio_dev - return err; - } - --int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, u8 fn) -+int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, struct sdio_func *func) - { - brcmf_dbg(SDIO, "Enter\n"); - - /* Issue abort cmd52 command through F0 */ -- brcmf_sdiod_func0_wb(sdiodev, SDIO_CCCR_ABORT, fn, NULL); -+ brcmf_sdiod_func0_wb(sdiodev, SDIO_CCCR_ABORT, func->num, NULL); - - brcmf_dbg(SDIO, "Exit\n"); - return 0; -@@ -1105,7 +1114,7 @@ static int brcmf_ops_sdio_suspend(struct - - func = container_of(dev, struct sdio_func, dev); - brcmf_dbg(SDIO, "Enter: F%d\n", func->num); -- if (func->num != SDIO_FUNC_1) -+ if (func->num != 1) - return 0; - - -@@ -1134,7 +1143,7 @@ static int brcmf_ops_sdio_resume(struct - struct sdio_func *func = container_of(dev, struct sdio_func, dev); - - brcmf_dbg(SDIO, "Enter: F%d\n", func->num); -- if (func->num != SDIO_FUNC_2) -+ if (func->num != 2) - return 0; - - brcmf_sdiod_freezer_off(sdiodev); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -1157,7 +1157,7 @@ static void brcmf_sdio_rxfail(struct brc - rtx ? ", send NAK" : ""); - - if (abort) -- brcmf_sdiod_abort(bus->sdiodev, SDIO_FUNC_2); -+ brcmf_sdiod_abort(bus->sdiodev, bus->sdiodev->func[2]); - - brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_FUNC1_FRAMECTRL, SFC_RF_TERM, - &err); -@@ -1209,7 +1209,7 @@ static void brcmf_sdio_txfail(struct brc - brcmf_err("sdio error, abort command and terminate frame\n"); - bus->sdcnt.tx_sderrs++; - -- brcmf_sdiod_abort(sdiodev, SDIO_FUNC_2); -+ brcmf_sdiod_abort(sdiodev, sdiodev->func[2]); - brcmf_sdiod_writeb(sdiodev, SBSDIO_FUNC1_FRAMECTRL, SFC_WF_TERM, NULL); - bus->sdcnt.f1regdata++; - -@@ -2072,7 +2072,7 @@ static int brcmf_sdio_txpkt_prep_sg(stru - int ntail, ret; - - sdiodev = bus->sdiodev; -- blksize = sdiodev->func[SDIO_FUNC_2]->cur_blksize; -+ blksize = sdiodev->func[2]->cur_blksize; - /* sg entry alignment should be a divisor of block size */ - WARN_ON(blksize % bus->sgentry_align); - -@@ -2441,7 +2441,7 @@ static void brcmf_sdio_bus_stop(struct d - - /* Turn off the bus (F2), free any pending packets */ - brcmf_dbg(INTR, "disable SDIO interrupts\n"); -- sdio_disable_func(sdiodev->func[SDIO_FUNC_2]); -+ sdio_disable_func(sdiodev->func[2]); - - /* Clear any pending interrupts now that F2 is disabled */ - brcmf_sdiod_writel(sdiodev, core->base + SD_REG(intstatus), -@@ -4066,8 +4066,7 @@ static void brcmf_sdio_firmware_callback - brcmf_sdiod_writel(sdiod, core->base + SD_REG(tosbmailboxdata), - SDPCM_PROT_VERSION << SMB_DATA_VERSION_SHIFT, NULL); - -- err = sdio_enable_func(sdiodev->func[SDIO_FUNC_2]); -- -+ err = sdio_enable_func(sdiodev->func[2]); - - brcmf_dbg(INFO, "enable F2: err=%d\n", err); - -@@ -4082,7 +4081,7 @@ static void brcmf_sdio_firmware_callback - brcmf_sdiod_writeb(sdiodev, SBSDIO_WATERMARK, 8, &err); - } else { - /* Disable F2 again */ -- sdio_disable_func(sdiodev->func[SDIO_FUNC_2]); -+ sdio_disable_func(sdiodev->func[2]); - goto release; - } - -@@ -4219,7 +4218,7 @@ struct brcmf_sdio *brcmf_sdio_probe(stru - sdio_claim_host(bus->sdiodev->func[1]); - - /* Disable F2 to clear any intermediate frame state on the dongle */ -- sdio_disable_func(bus->sdiodev->func[SDIO_FUNC_2]); -+ sdio_disable_func(bus->sdiodev->func[2]); - - bus->rxflow = false; - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h -@@ -45,9 +45,6 @@ - #define REG_F0_REG_MASK 0x7FF - #define REG_F1_MISC_MASK 0x1FFFF - --/* as of sdiod rev 0, supports 3 functions */ --#define SBSDIO_NUM_FUNCTION 3 -- - /* function 0 vendor specific CCCR registers */ - - #define SDIO_CCCR_BRCM_CARDCAP 0xf0 -@@ -350,7 +347,8 @@ int brcmf_sdiod_ramrw(struct brcmf_sdio_ - u8 *data, uint size); - - /* Issue an abort to the specified function */ --int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, u8 fn); -+int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, struct sdio_func *func); -+ - void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev); - void brcmf_sdiod_change_state(struct brcmf_sdio_dev *sdiodev, - enum brcmf_sdiod_state state); diff --git a/package/kernel/mac80211/patches/314-v4.16-0008-brcmfmac-Clean-up-interrupt-macros.patch b/package/kernel/mac80211/patches/314-v4.16-0008-brcmfmac-Clean-up-interrupt-macros.patch deleted file mode 100644 index d732c8e58a310a..00000000000000 --- a/package/kernel/mac80211/patches/314-v4.16-0008-brcmfmac-Clean-up-interrupt-macros.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 9c3438ed215adba7025268ee1f0b6f7a2af12316 Mon Sep 17 00:00:00 2001 -From: Ian Molton -Date: Tue, 19 Dec 2017 13:47:14 +0100 -Subject: [PATCH] brcmfmac: Clean up interrupt macros - -Make it more obvious that this code acually enables interrupts, and -provide nice definitions for the bits in the register. - -Signed-off-by: Ian Molton -Acked-by: Arend van Spriel -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 3 ++- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h | 8 +++++--- - 2 files changed, 7 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -149,7 +149,8 @@ int brcmf_sdiod_intr_register(struct brc - - /* must configure SDIO_CCCR_IENx to enable irq */ - data = brcmf_sdiod_func0_rb(sdiodev, SDIO_CCCR_IENx, &ret); -- data |= 1 << SDIO_FUNC_1 | 1 << SDIO_FUNC_2 | 1; -+ data |= SDIO_CCCR_IEN_FUNC1 | SDIO_CCCR_IEN_FUNC2 | -+ SDIO_CCCR_IEN_FUNC0; - brcmf_sdiod_func0_wb(sdiodev, SDIO_CCCR_IENx, data, &ret); - - /* redirect, configure and enable io for interrupt signal */ ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h -@@ -24,9 +24,6 @@ - /* Maximum number of I/O funcs */ - #define NUM_SDIO_FUNCS 3 - --#define SDIO_FUNC_1 1 --#define SDIO_FUNC_2 2 -- - #define SDIOD_FBR_SIZE 0x100 - - /* io_en */ -@@ -52,6 +49,11 @@ - #define SDIO_CCCR_BRCM_CARDCAP_CMD14_EXT BIT(2) - #define SDIO_CCCR_BRCM_CARDCAP_CMD_NODEC BIT(3) - -+/* Interrupt enable bits for each function */ -+#define SDIO_CCCR_IEN_FUNC0 BIT(0) -+#define SDIO_CCCR_IEN_FUNC1 BIT(1) -+#define SDIO_CCCR_IEN_FUNC2 BIT(2) -+ - #define SDIO_CCCR_BRCM_CARDCTRL 0xf1 - #define SDIO_CCCR_BRCM_CARDCTRL_WLANRESET BIT(1) - diff --git a/package/kernel/mac80211/patches/315-v4.16-0001-brcmfmac-Support-43455-save-restore-SR-feature-if-FW.patch b/package/kernel/mac80211/patches/315-v4.16-0001-brcmfmac-Support-43455-save-restore-SR-feature-if-FW.patch deleted file mode 100644 index d010d23f01dc87..00000000000000 --- a/package/kernel/mac80211/patches/315-v4.16-0001-brcmfmac-Support-43455-save-restore-SR-feature-if-FW.patch +++ /dev/null @@ -1,27 +0,0 @@ -From e3720dad99859251a8b0fe2807275a8afcfb560d Mon Sep 17 00:00:00 2001 -From: Double Lo -Date: Tue, 19 Dec 2017 14:56:44 +0800 -Subject: [PATCH] brcmfmac: Support 43455 save-restore (SR) feature if FW - include -sr - -This patch will add 43455 into the save-restore(SR) capable chip list, so -the SR engine will be enabled with 43455 FW which built-in the -sr -function. - -Signed-off-by: Double Lo -Signed-off-by: Wright Feng -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c -@@ -1338,6 +1338,7 @@ bool brcmf_chip_sr_capable(struct brcmf_ - switch (pub->chip) { - case BRCM_CC_4354_CHIP_ID: - case BRCM_CC_4356_CHIP_ID: -+ case BRCM_CC_4345_CHIP_ID: - /* explicitly check SR engine enable bit */ - pmu_cc3_mask = BIT(2); - /* fall-through */ diff --git a/package/kernel/mac80211/patches/316-v4.16-0001-brcmfmac-Remove-array-of-functions.patch b/package/kernel/mac80211/patches/316-v4.16-0001-brcmfmac-Remove-array-of-functions.patch deleted file mode 100644 index bd9de13d7a12b6..00000000000000 --- a/package/kernel/mac80211/patches/316-v4.16-0001-brcmfmac-Remove-array-of-functions.patch +++ /dev/null @@ -1,1043 +0,0 @@ -From c9aa7a91de740c537dc8c2f9f3d36fc651371b13 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Tue, 9 Jan 2018 13:22:52 +0100 -Subject: [PATCH] brcmfmac: Remove array of functions - -Replace the array of functions with a pair of pointers to the -relevant functions. - -Signed-off-by: Ian Molton -Acked-by: Arend van Spriel -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 115 +++++++------- - .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 168 ++++++++++----------- - .../wireless/broadcom/brcm80211/brcmfmac/sdio.h | 15 +- - 3 files changed, 146 insertions(+), 152 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -118,7 +118,7 @@ int brcmf_sdiod_intr_register(struct brc - - ret = request_irq(pdata->oob_irq_nr, brcmf_sdiod_oob_irqhandler, - pdata->oob_irq_flags, "brcmf_oob_intr", -- &sdiodev->func[1]->dev); -+ &sdiodev->func1->dev); - if (ret != 0) { - brcmf_err("request_irq failed %d\n", ret); - return ret; -@@ -132,7 +132,7 @@ int brcmf_sdiod_intr_register(struct brc - } - sdiodev->irq_wake = true; - -- sdio_claim_host(sdiodev->func[1]); -+ sdio_claim_host(sdiodev->func1); - - if (sdiodev->bus_if->chip == BRCM_CC_43362_CHIP_ID) { - /* assign GPIO to SDIO core */ -@@ -159,13 +159,13 @@ int brcmf_sdiod_intr_register(struct brc - data |= SDIO_CCCR_BRCM_SEPINT_ACT_HI; - brcmf_sdiod_func0_wb(sdiodev, SDIO_CCCR_BRCM_SEPINT, - data, &ret); -- sdio_release_host(sdiodev->func[1]); -+ sdio_release_host(sdiodev->func1); - } else { - brcmf_dbg(SDIO, "Entering\n"); -- sdio_claim_host(sdiodev->func[1]); -- sdio_claim_irq(sdiodev->func[1], brcmf_sdiod_ib_irqhandler); -- sdio_claim_irq(sdiodev->func[2], brcmf_sdiod_dummy_irqhandler); -- sdio_release_host(sdiodev->func[1]); -+ sdio_claim_host(sdiodev->func1); -+ sdio_claim_irq(sdiodev->func1, brcmf_sdiod_ib_irqhandler); -+ sdio_claim_irq(sdiodev->func2, brcmf_sdiod_dummy_irqhandler); -+ sdio_release_host(sdiodev->func1); - sdiodev->sd_irq_requested = true; - } - -@@ -183,26 +183,26 @@ void brcmf_sdiod_intr_unregister(struct - struct brcmfmac_sdio_pd *pdata; - - pdata = &sdiodev->settings->bus.sdio; -- sdio_claim_host(sdiodev->func[1]); -+ sdio_claim_host(sdiodev->func1); - brcmf_sdiod_func0_wb(sdiodev, SDIO_CCCR_BRCM_SEPINT, 0, NULL); - brcmf_sdiod_func0_wb(sdiodev, SDIO_CCCR_IENx, 0, NULL); -- sdio_release_host(sdiodev->func[1]); -+ sdio_release_host(sdiodev->func1); - - sdiodev->oob_irq_requested = false; - if (sdiodev->irq_wake) { - disable_irq_wake(pdata->oob_irq_nr); - sdiodev->irq_wake = false; - } -- free_irq(pdata->oob_irq_nr, &sdiodev->func[1]->dev); -+ free_irq(pdata->oob_irq_nr, &sdiodev->func1->dev); - sdiodev->irq_en = false; - sdiodev->oob_irq_requested = false; - } - - if (sdiodev->sd_irq_requested) { -- sdio_claim_host(sdiodev->func[1]); -- sdio_release_irq(sdiodev->func[2]); -- sdio_release_irq(sdiodev->func[1]); -- sdio_release_host(sdiodev->func[1]); -+ sdio_claim_host(sdiodev->func1); -+ sdio_release_irq(sdiodev->func2); -+ sdio_release_irq(sdiodev->func1); -+ sdio_release_host(sdiodev->func1); - sdiodev->sd_irq_requested = false; - } - } -@@ -264,7 +264,7 @@ u32 brcmf_sdiod_readl(struct brcmf_sdio_ - addr &= SBSDIO_SB_OFT_ADDR_MASK; - addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - -- data = sdio_readl(sdiodev->func[1], addr, &retval); -+ data = sdio_readl(sdiodev->func1, addr, &retval); - - out: - if (ret) -@@ -285,7 +285,7 @@ void brcmf_sdiod_writel(struct brcmf_sdi - addr &= SBSDIO_SB_OFT_ADDR_MASK; - addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - -- sdio_writel(sdiodev->func[1], data, addr, &retval); -+ sdio_writel(sdiodev->func1, data, addr, &retval); - - out: - if (ret) -@@ -550,7 +550,7 @@ int brcmf_sdiod_recv_pkt(struct brcmf_sd - addr &= SBSDIO_SB_OFT_ADDR_MASK; - addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - -- err = brcmf_sdiod_buff_read(sdiodev, sdiodev->func[2], addr, pkt); -+ err = brcmf_sdiod_buff_read(sdiodev, sdiodev->func2, addr, pkt); - - done: - return err; -@@ -575,13 +575,13 @@ int brcmf_sdiod_recv_chain(struct brcmf_ - addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - - if (pktq->qlen == 1) -- err = brcmf_sdiod_buff_read(sdiodev, sdiodev->func[2], addr, -+ err = brcmf_sdiod_buff_read(sdiodev, sdiodev->func2, addr, - pktq->next); - else if (!sdiodev->sg_support) { - glom_skb = brcmu_pkt_buf_get_skb(totlen); - if (!glom_skb) - return -ENOMEM; -- err = brcmf_sdiod_buff_read(sdiodev, sdiodev->func[2], addr, -+ err = brcmf_sdiod_buff_read(sdiodev, sdiodev->func2, addr, - glom_skb); - if (err) - goto done; -@@ -591,7 +591,7 @@ int brcmf_sdiod_recv_chain(struct brcmf_ - skb_pull(glom_skb, skb->len); - } - } else -- err = brcmf_sdiod_sglist_rw(sdiodev, sdiodev->func[2], false, -+ err = brcmf_sdiod_sglist_rw(sdiodev, sdiodev->func2, false, - addr, pktq); - - done: -@@ -623,7 +623,7 @@ int brcmf_sdiod_send_buf(struct brcmf_sd - addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - - if (!err) -- err = brcmf_sdiod_buff_write(sdiodev, sdiodev->func[2], addr, -+ err = brcmf_sdiod_buff_write(sdiodev, sdiodev->func2, addr, - mypkt); - - brcmu_pkt_buf_free_skb(mypkt); -@@ -649,13 +649,13 @@ int brcmf_sdiod_send_pkt(struct brcmf_sd - - if (pktq->qlen == 1 || !sdiodev->sg_support) { - skb_queue_walk(pktq, skb) { -- err = brcmf_sdiod_buff_write(sdiodev, sdiodev->func[2], -+ err = brcmf_sdiod_buff_write(sdiodev, sdiodev->func2, - addr, skb); - if (err) - break; - } - } else { -- err = brcmf_sdiod_sglist_rw(sdiodev, sdiodev->func[2], true, -+ err = brcmf_sdiod_sglist_rw(sdiodev, sdiodev->func2, true, - addr, pktq); - } - -@@ -686,7 +686,7 @@ brcmf_sdiod_ramrw(struct brcmf_sdio_dev - else - dsize = size; - -- sdio_claim_host(sdiodev->func[1]); -+ sdio_claim_host(sdiodev->func1); - - /* Do the transfer(s) */ - while (size) { -@@ -706,10 +706,10 @@ brcmf_sdiod_ramrw(struct brcmf_sdio_dev - - if (write) { - memcpy(pkt->data, data, dsize); -- err = brcmf_sdiod_buff_write(sdiodev, sdiodev->func[1], -+ err = brcmf_sdiod_buff_write(sdiodev, sdiodev->func1, - sdaddr, pkt); - } else { -- err = brcmf_sdiod_buff_read(sdiodev, sdiodev->func[1], -+ err = brcmf_sdiod_buff_read(sdiodev, sdiodev->func1, - sdaddr, pkt); - } - -@@ -733,7 +733,7 @@ brcmf_sdiod_ramrw(struct brcmf_sdio_dev - - dev_kfree_skb(pkt); - -- sdio_release_host(sdiodev->func[1]); -+ sdio_release_host(sdiodev->func1); - - return err; - } -@@ -757,7 +757,7 @@ void brcmf_sdiod_sgtable_alloc(struct br - uint nents; - int err; - -- func = sdiodev->func[2]; -+ func = sdiodev->func2; - host = func->card->host; - sdiodev->sg_support = host->max_segs > 1; - max_blocks = min_t(uint, host->max_blk_count, 511u); -@@ -818,17 +818,17 @@ static int brcmf_sdiod_freezer_on(struct - brcmf_sdio_trigger_dpc(sdiodev->bus); - wait_event(sdiodev->freezer->thread_freeze, - atomic_read(expect) == sdiodev->freezer->frozen_count); -- sdio_claim_host(sdiodev->func[1]); -+ sdio_claim_host(sdiodev->func1); - res = brcmf_sdio_sleep(sdiodev->bus, true); -- sdio_release_host(sdiodev->func[1]); -+ sdio_release_host(sdiodev->func1); - return res; - } - - static void brcmf_sdiod_freezer_off(struct brcmf_sdio_dev *sdiodev) - { -- sdio_claim_host(sdiodev->func[1]); -+ sdio_claim_host(sdiodev->func1); - brcmf_sdio_sleep(sdiodev->bus, false); -- sdio_release_host(sdiodev->func[1]); -+ sdio_release_host(sdiodev->func1); - atomic_set(&sdiodev->freezer->freezing, 0); - complete_all(&sdiodev->freezer->resumed); - } -@@ -878,19 +878,19 @@ static int brcmf_sdiod_remove(struct brc - brcmf_sdiod_freezer_detach(sdiodev); - - /* Disable Function 2 */ -- sdio_claim_host(sdiodev->func[2]); -- sdio_disable_func(sdiodev->func[2]); -- sdio_release_host(sdiodev->func[2]); -+ sdio_claim_host(sdiodev->func2); -+ sdio_disable_func(sdiodev->func2); -+ sdio_release_host(sdiodev->func2); - - /* Disable Function 1 */ -- sdio_claim_host(sdiodev->func[1]); -- sdio_disable_func(sdiodev->func[1]); -- sdio_release_host(sdiodev->func[1]); -+ sdio_claim_host(sdiodev->func1); -+ sdio_disable_func(sdiodev->func1); -+ sdio_release_host(sdiodev->func1); - - sg_free_table(&sdiodev->sgtable); - sdiodev->sbwad = 0; - -- pm_runtime_allow(sdiodev->func[1]->card->host->parent); -+ pm_runtime_allow(sdiodev->func1->card->host->parent); - return 0; - } - -@@ -906,29 +906,27 @@ static int brcmf_sdiod_probe(struct brcm - { - int ret = 0; - -- sdiodev->num_funcs = 2; -+ sdio_claim_host(sdiodev->func1); - -- sdio_claim_host(sdiodev->func[1]); -- -- ret = sdio_set_block_size(sdiodev->func[1], SDIO_FUNC1_BLOCKSIZE); -+ ret = sdio_set_block_size(sdiodev->func1, SDIO_FUNC1_BLOCKSIZE); - if (ret) { - brcmf_err("Failed to set F1 blocksize\n"); -- sdio_release_host(sdiodev->func[1]); -+ sdio_release_host(sdiodev->func1); - goto out; - } -- ret = sdio_set_block_size(sdiodev->func[2], SDIO_FUNC2_BLOCKSIZE); -+ ret = sdio_set_block_size(sdiodev->func2, SDIO_FUNC2_BLOCKSIZE); - if (ret) { - brcmf_err("Failed to set F2 blocksize\n"); -- sdio_release_host(sdiodev->func[1]); -+ sdio_release_host(sdiodev->func1); - goto out; - } - - /* increase F2 timeout */ -- sdiodev->func[2]->enable_timeout = SDIO_WAIT_F2RDY; -+ sdiodev->func2->enable_timeout = SDIO_WAIT_F2RDY; - - /* Enable Function 1 */ -- ret = sdio_enable_func(sdiodev->func[1]); -- sdio_release_host(sdiodev->func[1]); -+ ret = sdio_enable_func(sdiodev->func1); -+ sdio_release_host(sdiodev->func1); - if (ret) { - brcmf_err("Failed to enable F1: err=%d\n", ret); - goto out; -@@ -944,7 +942,7 @@ static int brcmf_sdiod_probe(struct brcm - ret = -ENODEV; - goto out; - } -- brcmf_sdiod_host_fixup(sdiodev->func[2]->card->host); -+ brcmf_sdiod_host_fixup(sdiodev->func2->card->host); - out: - if (ret) - brcmf_sdiod_remove(sdiodev); -@@ -1032,16 +1030,15 @@ static int brcmf_ops_sdio_probe(struct s - /* store refs to functions used. mmc_card does - * not hold the F0 function pointer. - */ -- sdiodev->func[0] = NULL; -- sdiodev->func[1] = func->card->sdio_func[0]; -- sdiodev->func[2] = func; -+ sdiodev->func1 = func->card->sdio_func[0]; -+ sdiodev->func2 = func; - - sdiodev->bus_if = bus_if; - bus_if->bus_priv.sdio = sdiodev; - bus_if->proto_type = BRCMF_PROTO_BCDC; - dev_set_drvdata(&func->dev, bus_if); -- dev_set_drvdata(&sdiodev->func[1]->dev, bus_if); -- sdiodev->dev = &sdiodev->func[1]->dev; -+ dev_set_drvdata(&sdiodev->func1->dev, bus_if); -+ sdiodev->dev = &sdiodev->func1->dev; - - brcmf_sdiod_change_state(sdiodev, BRCMF_SDIOD_DOWN); - -@@ -1057,7 +1054,7 @@ static int brcmf_ops_sdio_probe(struct s - - fail: - dev_set_drvdata(&func->dev, NULL); -- dev_set_drvdata(&sdiodev->func[1]->dev, NULL); -+ dev_set_drvdata(&sdiodev->func1->dev, NULL); - kfree(sdiodev); - kfree(bus_if); - return err; -@@ -1086,8 +1083,8 @@ static void brcmf_ops_sdio_remove(struct - /* only proceed with rest of cleanup if func 1 */ - brcmf_sdiod_remove(sdiodev); - -- dev_set_drvdata(&sdiodev->func[1]->dev, NULL); -- dev_set_drvdata(&sdiodev->func[2]->dev, NULL); -+ dev_set_drvdata(&sdiodev->func1->dev, NULL); -+ dev_set_drvdata(&sdiodev->func2->dev, NULL); - - kfree(bus_if); - kfree(sdiodev); -@@ -1132,7 +1129,7 @@ static int brcmf_ops_sdio_suspend(struct - else - sdio_flags |= MMC_PM_WAKE_SDIO_IRQ; - } -- if (sdio_set_host_pm_flags(sdiodev->func[1], sdio_flags)) -+ if (sdio_set_host_pm_flags(sdiodev->func1, sdio_flags)) - brcmf_err("Failed to set pm_flags %x\n", sdio_flags); - return 0; - } ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -979,7 +979,7 @@ static int brcmf_sdio_readshared(struct - struct sdpcm_shared_le sh_le; - __le32 addr_le; - -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - brcmf_sdio_bus_sleep(bus, false, false); - - /* -@@ -1013,7 +1013,7 @@ static int brcmf_sdio_readshared(struct - if (rv < 0) - goto fail; - -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - - /* Endianness */ - sh->flags = le32_to_cpu(sh_le.flags); -@@ -1035,7 +1035,7 @@ static int brcmf_sdio_readshared(struct - fail: - brcmf_err("unable to obtain sdpcm_shared info: rv=%d (addr=0x%x)\n", - rv, addr); -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - return rv; - } - -@@ -1157,7 +1157,7 @@ static void brcmf_sdio_rxfail(struct brc - rtx ? ", send NAK" : ""); - - if (abort) -- brcmf_sdiod_abort(bus->sdiodev, bus->sdiodev->func[2]); -+ brcmf_sdiod_abort(bus->sdiodev, bus->sdiodev->func2); - - brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_FUNC1_FRAMECTRL, SFC_RF_TERM, - &err); -@@ -1209,7 +1209,7 @@ static void brcmf_sdio_txfail(struct brc - brcmf_err("sdio error, abort command and terminate frame\n"); - bus->sdcnt.tx_sderrs++; - -- brcmf_sdiod_abort(sdiodev, sdiodev->func[2]); -+ brcmf_sdiod_abort(sdiodev, sdiodev->func2); - brcmf_sdiod_writeb(sdiodev, SBSDIO_FUNC1_FRAMECTRL, SFC_WF_TERM, NULL); - bus->sdcnt.f1regdata++; - -@@ -1565,10 +1565,10 @@ static u8 brcmf_sdio_rxglom(struct brcmf - * read directly into the chained packet, or allocate a large - * packet and and copy into the chain. - */ -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - errcode = brcmf_sdiod_recv_chain(bus->sdiodev, - &bus->glom, dlen); -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - bus->sdcnt.f2rxdata++; - - /* On failure, kill the superframe */ -@@ -1576,11 +1576,11 @@ static u8 brcmf_sdio_rxglom(struct brcmf - brcmf_err("glom read of %d bytes failed: %d\n", - dlen, errcode); - -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - brcmf_sdio_rxfail(bus, true, false); - bus->sdcnt.rxglomfail++; - brcmf_sdio_free_glom(bus); -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - return 0; - } - -@@ -1590,10 +1590,10 @@ static u8 brcmf_sdio_rxglom(struct brcmf - - rd_new.seq_num = rxseq; - rd_new.len = dlen; -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - errcode = brcmf_sdio_hdparse(bus, pfirst->data, &rd_new, - BRCMF_SDIO_FT_SUPER); -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - bus->cur_read.len = rd_new.len_nxtfrm << 4; - - /* Remove superframe header, remember offset */ -@@ -1609,10 +1609,10 @@ static u8 brcmf_sdio_rxglom(struct brcmf - - rd_new.len = pnext->len; - rd_new.seq_num = rxseq++; -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - errcode = brcmf_sdio_hdparse(bus, pnext->data, &rd_new, - BRCMF_SDIO_FT_SUB); -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - brcmf_dbg_hex_dump(BRCMF_GLOM_ON(), - pnext->data, 32, "subframe:\n"); - -@@ -1621,11 +1621,11 @@ static u8 brcmf_sdio_rxglom(struct brcmf - - if (errcode) { - /* Terminate frame on error */ -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - brcmf_sdio_rxfail(bus, true, false); - bus->sdcnt.rxglomfail++; - brcmf_sdio_free_glom(bus); -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - bus->cur_read.len = 0; - return 0; - } -@@ -1833,7 +1833,7 @@ static uint brcmf_sdio_readframes(struct - - rd->len_left = rd->len; - /* read header first for unknow frame length */ -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - if (!rd->len) { - ret = brcmf_sdiod_recv_buf(bus->sdiodev, - bus->rxhdr, BRCMF_FIRSTREAD); -@@ -1843,7 +1843,7 @@ static uint brcmf_sdio_readframes(struct - ret); - bus->sdcnt.rx_hdrfail++; - brcmf_sdio_rxfail(bus, true, true); -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - continue; - } - -@@ -1853,7 +1853,7 @@ static uint brcmf_sdio_readframes(struct - - if (brcmf_sdio_hdparse(bus, bus->rxhdr, rd, - BRCMF_SDIO_FT_NORMAL)) { -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - if (!bus->rxpending) - break; - else -@@ -1869,7 +1869,7 @@ static uint brcmf_sdio_readframes(struct - rd->len_nxtfrm = 0; - /* treat all packet as event if we don't know */ - rd->channel = SDPCM_EVENT_CHANNEL; -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - continue; - } - rd->len_left = rd->len > BRCMF_FIRSTREAD ? -@@ -1886,7 +1886,7 @@ static uint brcmf_sdio_readframes(struct - brcmf_err("brcmu_pkt_buf_get_skb failed\n"); - brcmf_sdio_rxfail(bus, false, - RETRYCHAN(rd->channel)); -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - continue; - } - skb_pull(pkt, head_read); -@@ -1894,16 +1894,16 @@ static uint brcmf_sdio_readframes(struct - - ret = brcmf_sdiod_recv_pkt(bus->sdiodev, pkt); - bus->sdcnt.f2rxdata++; -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - - if (ret < 0) { - brcmf_err("read %d bytes from channel %d failed: %d\n", - rd->len, rd->channel, ret); - brcmu_pkt_buf_free_skb(pkt); -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - brcmf_sdio_rxfail(bus, true, - RETRYCHAN(rd->channel)); -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - continue; - } - -@@ -1914,7 +1914,7 @@ static uint brcmf_sdio_readframes(struct - } else { - memcpy(bus->rxhdr, pkt->data, SDPCM_HDRLEN); - rd_new.seq_num = rd->seq_num; -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - if (brcmf_sdio_hdparse(bus, bus->rxhdr, &rd_new, - BRCMF_SDIO_FT_NORMAL)) { - rd->len = 0; -@@ -1927,11 +1927,11 @@ static uint brcmf_sdio_readframes(struct - roundup(rd_new.len, 16) >> 4); - rd->len = 0; - brcmf_sdio_rxfail(bus, true, true); -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - brcmu_pkt_buf_free_skb(pkt); - continue; - } -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - rd->len_nxtfrm = rd_new.len_nxtfrm; - rd->channel = rd_new.channel; - rd->dat_offset = rd_new.dat_offset; -@@ -1947,9 +1947,9 @@ static uint brcmf_sdio_readframes(struct - rd_new.seq_num); - /* Force retry w/normal header read */ - rd->len = 0; -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - brcmf_sdio_rxfail(bus, false, true); -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - brcmu_pkt_buf_free_skb(pkt); - continue; - } -@@ -1972,9 +1972,9 @@ static uint brcmf_sdio_readframes(struct - } else { - brcmf_err("%s: glom superframe w/o " - "descriptor!\n", __func__); -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - brcmf_sdio_rxfail(bus, false, false); -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - } - /* prepare the descriptor for the next read */ - rd->len = rd->len_nxtfrm << 4; -@@ -2072,7 +2072,7 @@ static int brcmf_sdio_txpkt_prep_sg(stru - int ntail, ret; - - sdiodev = bus->sdiodev; -- blksize = sdiodev->func[2]->cur_blksize; -+ blksize = sdiodev->func2->cur_blksize; - /* sg entry alignment should be a divisor of block size */ - WARN_ON(blksize % bus->sgentry_align); - -@@ -2251,14 +2251,14 @@ static int brcmf_sdio_txpkt(struct brcmf - if (ret) - goto done; - -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - ret = brcmf_sdiod_send_pkt(bus->sdiodev, pktq); - bus->sdcnt.f2txdata++; - - if (ret < 0) - brcmf_sdio_txfail(bus); - -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - - done: - brcmf_sdio_txpkt_postp(bus, pktq); -@@ -2314,10 +2314,11 @@ static uint brcmf_sdio_sendfromq(struct - /* In poll mode, need to check for other events */ - if (!bus->intr) { - /* Check device status, signal pending interrupt */ -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - intstatus = brcmf_sdiod_readl(bus->sdiodev, - intstat_addr, &ret); -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); -+ - bus->sdcnt.f2txdata++; - if (ret != 0) - break; -@@ -2417,7 +2418,7 @@ static void brcmf_sdio_bus_stop(struct d - } - - if (sdiodev->state != BRCMF_SDIOD_NOMEDIUM) { -- sdio_claim_host(sdiodev->func[1]); -+ sdio_claim_host(sdiodev->func1); - - /* Enable clock for device interrupts */ - brcmf_sdio_bus_sleep(bus, false, false); -@@ -2441,13 +2442,13 @@ static void brcmf_sdio_bus_stop(struct d - - /* Turn off the bus (F2), free any pending packets */ - brcmf_dbg(INTR, "disable SDIO interrupts\n"); -- sdio_disable_func(sdiodev->func[2]); -+ sdio_disable_func(sdiodev->func2); - - /* Clear any pending interrupts now that F2 is disabled */ - brcmf_sdiod_writel(sdiodev, core->base + SD_REG(intstatus), - local_hostintmask, NULL); - -- sdio_release_host(sdiodev->func[1]); -+ sdio_release_host(sdiodev->func1); - } - /* Clear the data packet queues */ - brcmu_pktq_flush(&bus->txq, true, NULL, NULL); -@@ -2522,7 +2523,7 @@ static void brcmf_sdio_dpc(struct brcmf_ - - brcmf_dbg(TRACE, "Enter\n"); - -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - - /* If waiting for HTAVAIL, check status */ - if (!bus->sr_enabled && bus->clkstate == CLK_PENDING) { -@@ -2585,7 +2586,7 @@ static void brcmf_sdio_dpc(struct brcmf_ - intstatus |= brcmf_sdio_hostmail(bus); - } - -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - - /* Generally don't ask for these, can get CRC errors... */ - if (intstatus & I_WR_OOSYNC) { -@@ -2628,7 +2629,7 @@ static void brcmf_sdio_dpc(struct brcmf_ - - if (bus->ctrl_frame_stat && (bus->clkstate == CLK_AVAIL) && - data_ok(bus)) { -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - if (bus->ctrl_frame_stat) { - err = brcmf_sdio_tx_ctrlframe(bus, bus->ctrl_frame_buf, - bus->ctrl_frame_len); -@@ -2636,7 +2637,7 @@ static void brcmf_sdio_dpc(struct brcmf_ - wmb(); - bus->ctrl_frame_stat = false; - } -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - brcmf_sdio_wait_event_wakeup(bus); - } - /* Send queued frames (limit 1 if rx may still be pending) */ -@@ -2652,14 +2653,14 @@ static void brcmf_sdio_dpc(struct brcmf_ - brcmf_err("failed backplane access over SDIO, halting operation\n"); - atomic_set(&bus->intstatus, 0); - if (bus->ctrl_frame_stat) { -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - if (bus->ctrl_frame_stat) { - bus->ctrl_frame_err = -ENODEV; - wmb(); - bus->ctrl_frame_stat = false; - brcmf_sdio_wait_event_wakeup(bus); - } -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - } - } else if (atomic_read(&bus->intstatus) || - atomic_read(&bus->ipend) > 0 || -@@ -2874,13 +2875,13 @@ brcmf_sdio_bus_txctl(struct device *dev, - CTL_DONE_TIMEOUT); - ret = 0; - if (bus->ctrl_frame_stat) { -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - if (bus->ctrl_frame_stat) { - brcmf_dbg(SDIO, "ctrl_frame timeout\n"); - bus->ctrl_frame_stat = false; - ret = -ETIMEDOUT; - } -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - } - if (!ret) { - brcmf_dbg(SDIO, "ctrl_frame complete, err=%d\n", -@@ -3004,7 +3005,7 @@ static int brcmf_sdio_assert_info(struct - return 0; - } - -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - if (sh->assert_file_addr != 0) { - error = brcmf_sdiod_ramrw(bus->sdiodev, false, - sh->assert_file_addr, (u8 *)file, 80); -@@ -3017,7 +3018,7 @@ static int brcmf_sdio_assert_info(struct - if (error < 0) - return error; - } -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - - seq_printf(seq, "dongle assert: %s:%d: assert(%s)\n", - file, sh->assert_line, expr); -@@ -3291,7 +3292,7 @@ static int brcmf_sdio_download_firmware( - int bcmerror; - u32 rstvec; - -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - brcmf_sdio_clkctl(bus, CLK_AVAIL, false); - - rstvec = get_unaligned_le32(fw->data); -@@ -3320,7 +3321,7 @@ static int brcmf_sdio_download_firmware( - - err: - brcmf_sdio_clkctl(bus, CLK_SDONLY, false); -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - return bcmerror; - } - -@@ -3435,7 +3436,7 @@ static int brcmf_sdio_bus_preinit(struct - if (sdiodev->sg_support) { - bus->txglom = false; - value = 1; -- pad_size = bus->sdiodev->func[2]->cur_blksize << 1; -+ pad_size = bus->sdiodev->func2->cur_blksize << 1; - err = brcmf_iovar_data_set(bus->sdiodev->dev, "bus:rxglom", - &value, sizeof(u32)); - if (err < 0) { -@@ -3477,7 +3478,7 @@ static int brcmf_sdio_bus_get_memdump(st - - address = bus->ci->rambase; - offset = err = 0; -- sdio_claim_host(sdiodev->func[1]); -+ sdio_claim_host(sdiodev->func1); - while (offset < mem_size) { - len = ((offset + MEMBLOCK) < mem_size) ? MEMBLOCK : - mem_size - offset; -@@ -3493,7 +3494,7 @@ static int brcmf_sdio_bus_get_memdump(st - } - - done: -- sdio_release_host(sdiodev->func[1]); -+ sdio_release_host(sdiodev->func1); - return err; - } - -@@ -3550,11 +3551,10 @@ static void brcmf_sdio_bus_watchdog(stru - if (!bus->dpc_triggered) { - u8 devpend; - -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - devpend = brcmf_sdiod_func0_rb(bus->sdiodev, -- SDIO_CCCR_INTx, -- NULL); -- sdio_release_host(bus->sdiodev->func[1]); -+ SDIO_CCCR_INTx, NULL); -+ sdio_release_host(bus->sdiodev->func1); - intstatus = devpend & (INTR_STATUS_FUNC1 | - INTR_STATUS_FUNC2); - } -@@ -3580,13 +3580,13 @@ static void brcmf_sdio_bus_watchdog(stru - bus->console.count += jiffies_to_msecs(BRCMF_WD_POLL); - if (bus->console.count >= bus->console_interval) { - bus->console.count -= bus->console_interval; -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - /* Make sure backplane clock is on */ - brcmf_sdio_bus_sleep(bus, false, false); - if (brcmf_sdio_readconsole(bus) < 0) - /* stop on error */ - bus->console_interval = 0; -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - } - } - #endif /* DEBUG */ -@@ -3599,11 +3599,11 @@ static void brcmf_sdio_bus_watchdog(stru - bus->idlecount++; - if (bus->idlecount > bus->idletime) { - brcmf_dbg(SDIO, "idle\n"); -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - brcmf_sdio_wd_timer(bus, false); - bus->idlecount = 0; - brcmf_sdio_bus_sleep(bus, true, false); -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - } - } else { - bus->idlecount = 0; -@@ -3773,8 +3773,8 @@ static u32 brcmf_sdio_buscore_read32(voi - val = brcmf_sdiod_readl(sdiodev, addr, NULL); - - if (addr == CORE_CC_REG(SI_ENUM_BASE, chipid) && -- (sdiodev->func[1]->device == SDIO_DEVICE_ID_BROADCOM_4339 || -- sdiodev->func[1]->device == SDIO_DEVICE_ID_BROADCOM_4335_4339)) { -+ (sdiodev->func1->device == SDIO_DEVICE_ID_BROADCOM_4339 || -+ sdiodev->func1->device == SDIO_DEVICE_ID_BROADCOM_4335_4339)) { - rev = (val & CID_REV_MASK) >> CID_REV_SHIFT; - if (rev >= 2) { - val &= ~CID_ID_MASK; -@@ -3810,7 +3810,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdi - u32 drivestrength; - - sdiodev = bus->sdiodev; -- sdio_claim_host(sdiodev->func[1]); -+ sdio_claim_host(sdiodev->func1); - - pr_debug("F1 signature read @0x18000000=0x%4x\n", - brcmf_sdiod_readl(sdiodev, SI_ENUM_BASE, NULL)); -@@ -3877,8 +3877,8 @@ brcmf_sdio_probe_attach(struct brcmf_sdi - /* wowl can be supported when KEEP_POWER is true and (WAKE_SDIO_IRQ - * is true or when platform data OOB irq is true). - */ -- if ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_KEEP_POWER) && -- ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_WAKE_SDIO_IRQ) || -+ if ((sdio_get_host_pm_caps(sdiodev->func1) & MMC_PM_KEEP_POWER) && -+ ((sdio_get_host_pm_caps(sdiodev->func1) & MMC_PM_WAKE_SDIO_IRQ) || - (sdiodev->settings->bus.sdio.oob_irq_supported))) - sdiodev->bus_if->wowl_supported = true; - #endif -@@ -3917,7 +3917,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdi - if (err) - goto fail; - -- sdio_release_host(sdiodev->func[1]); -+ sdio_release_host(sdiodev->func1); - - brcmu_pktq_init(&bus->txq, (PRIOMASK + 1), TXQLEN); - -@@ -3938,7 +3938,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdi - return true; - - fail: -- sdio_release_host(sdiodev->func[1]); -+ sdio_release_host(sdiodev->func1); - return false; - } - -@@ -4044,7 +4044,7 @@ static void brcmf_sdio_firmware_callback - bus->sdcnt.tickcnt = 0; - brcmf_sdio_wd_timer(bus, true); - -- sdio_claim_host(sdiodev->func[1]); -+ sdio_claim_host(sdiodev->func1); - - /* Make sure backplane clock is on, needed to generate F2 interrupt */ - brcmf_sdio_clkctl(bus, CLK_AVAIL, false); -@@ -4066,7 +4066,7 @@ static void brcmf_sdio_firmware_callback - brcmf_sdiod_writel(sdiod, core->base + SD_REG(tosbmailboxdata), - SDPCM_PROT_VERSION << SMB_DATA_VERSION_SHIFT, NULL); - -- err = sdio_enable_func(sdiodev->func[2]); -+ err = sdio_enable_func(sdiodev->func2); - - brcmf_dbg(INFO, "enable F2: err=%d\n", err); - -@@ -4081,7 +4081,7 @@ static void brcmf_sdio_firmware_callback - brcmf_sdiod_writeb(sdiodev, SBSDIO_WATERMARK, 8, &err); - } else { - /* Disable F2 again */ -- sdio_disable_func(sdiodev->func[2]); -+ sdio_disable_func(sdiodev->func2); - goto release; - } - -@@ -4106,7 +4106,7 @@ static void brcmf_sdio_firmware_callback - if (err != 0) - brcmf_sdio_clkctl(bus, CLK_NONE, false); - -- sdio_release_host(sdiodev->func[1]); -+ sdio_release_host(sdiodev->func1); - - err = brcmf_bus_started(dev); - if (err != 0) { -@@ -4116,10 +4116,10 @@ static void brcmf_sdio_firmware_callback - return; - - release: -- sdio_release_host(sdiodev->func[1]); -+ sdio_release_host(sdiodev->func1); - fail: - brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), err); -- device_release_driver(&sdiodev->func[2]->dev); -+ device_release_driver(&sdiodev->func2->dev); - device_release_driver(dev); - } - -@@ -4146,7 +4146,7 @@ struct brcmf_sdio *brcmf_sdio_probe(stru - - /* single-threaded workqueue */ - wq = alloc_ordered_workqueue("brcmf_wq/%s", WQ_MEM_RECLAIM, -- dev_name(&sdiodev->func[1]->dev)); -+ dev_name(&sdiodev->func1->dev)); - if (!wq) { - brcmf_err("insufficient memory to create txworkqueue\n"); - goto fail; -@@ -4173,7 +4173,7 @@ struct brcmf_sdio *brcmf_sdio_probe(stru - init_completion(&bus->watchdog_wait); - bus->watchdog_tsk = kthread_run(brcmf_sdio_watchdog_thread, - bus, "brcmf_wdog/%s", -- dev_name(&sdiodev->func[1]->dev)); -+ dev_name(&sdiodev->func1->dev)); - if (IS_ERR(bus->watchdog_tsk)) { - pr_warn("brcmf_watchdog thread failed to start\n"); - bus->watchdog_tsk = NULL; -@@ -4199,7 +4199,7 @@ struct brcmf_sdio *brcmf_sdio_probe(stru - } - - /* Query the F2 block size, set roundup accordingly */ -- bus->blocksize = bus->sdiodev->func[2]->cur_blksize; -+ bus->blocksize = bus->sdiodev->func2->cur_blksize; - bus->roundup = min(max_roundup, bus->blocksize); - - /* Allocate buffers */ -@@ -4215,17 +4215,17 @@ struct brcmf_sdio *brcmf_sdio_probe(stru - } - } - -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - - /* Disable F2 to clear any intermediate frame state on the dongle */ -- sdio_disable_func(bus->sdiodev->func[2]); -+ sdio_disable_func(bus->sdiodev->func2); - - bus->rxflow = false; - - /* Done with backplane-dependent accesses, can drop clock... */ - brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, 0, NULL); - -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - - /* ...and initialize clock/power states */ - bus->clkstate = CLK_SDONLY; -@@ -4277,7 +4277,7 @@ void brcmf_sdio_remove(struct brcmf_sdio - - if (bus->ci) { - if (bus->sdiodev->state != BRCMF_SDIOD_NOMEDIUM) { -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - brcmf_sdio_wd_timer(bus, false); - brcmf_sdio_clkctl(bus, CLK_AVAIL, false); - /* Leave the device in state where it is -@@ -4287,7 +4287,7 @@ void brcmf_sdio_remove(struct brcmf_sdio - msleep(20); - brcmf_chip_set_passive(bus->ci); - brcmf_sdio_clkctl(bus, CLK_NONE, false); -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - } - brcmf_chip_detach(bus->ci); - } -@@ -4334,9 +4334,9 @@ int brcmf_sdio_sleep(struct brcmf_sdio * - { - int ret; - -- sdio_claim_host(bus->sdiodev->func[1]); -+ sdio_claim_host(bus->sdiodev->func1); - ret = brcmf_sdio_bus_sleep(bus, sleep, false); -- sdio_release_host(bus->sdiodev->func[1]); -+ sdio_release_host(bus->sdiodev->func1); - - return ret; - } ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h -@@ -21,9 +21,6 @@ - #include - #include "firmware.h" - --/* Maximum number of I/O funcs */ --#define NUM_SDIO_FUNCS 3 -- - #define SDIOD_FBR_SIZE 0x100 - - /* io_en */ -@@ -173,8 +170,8 @@ struct brcmf_sdio; - struct brcmf_sdiod_freezer; - - struct brcmf_sdio_dev { -- struct sdio_func *func[NUM_SDIO_FUNCS]; -- u8 num_funcs; /* Supported funcs on client */ -+ struct sdio_func *func1; -+ struct sdio_func *func2; - u32 sbwad; /* Save backplane window address */ - struct brcmf_core *cc_core; /* chipcommon core info struct */ - struct brcmf_sdio *bus; -@@ -295,17 +292,17 @@ void brcmf_sdiod_intr_unregister(struct - /* SDIO device register access interface */ - /* Accessors for SDIO Function 0 */ - #define brcmf_sdiod_func0_rb(sdiodev, addr, r) \ -- sdio_f0_readb((sdiodev)->func[1], (addr), (r)) -+ sdio_f0_readb((sdiodev)->func1, (addr), (r)) - - #define brcmf_sdiod_func0_wb(sdiodev, addr, v, ret) \ -- sdio_f0_writeb((sdiodev)->func[1], (v), (addr), (ret)) -+ sdio_f0_writeb((sdiodev)->func1, (v), (addr), (ret)) - - /* Accessors for SDIO Function 1 */ - #define brcmf_sdiod_readb(sdiodev, addr, r) \ -- sdio_readb((sdiodev)->func[1], (addr), (r)) -+ sdio_readb((sdiodev)->func1, (addr), (r)) - - #define brcmf_sdiod_writeb(sdiodev, addr, v, ret) \ -- sdio_writeb((sdiodev)->func[1], (v), (addr), (ret)) -+ sdio_writeb((sdiodev)->func1, (v), (addr), (ret)) - - u32 brcmf_sdiod_readl(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret); - void brcmf_sdiod_writel(struct brcmf_sdio_dev *sdiodev, u32 addr, u32 data, diff --git a/package/kernel/mac80211/patches/316-v4.16-0002-brcmfmac-add-comment-block-in-brcmf_sdio_buscore_rea.patch b/package/kernel/mac80211/patches/316-v4.16-0002-brcmfmac-add-comment-block-in-brcmf_sdio_buscore_rea.patch deleted file mode 100644 index dc78000be121e9..00000000000000 --- a/package/kernel/mac80211/patches/316-v4.16-0002-brcmfmac-add-comment-block-in-brcmf_sdio_buscore_rea.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 32adbcaa5df49f1977441f7a4bf180a0bcfe9966 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Tue, 9 Jan 2018 13:22:53 +0100 -Subject: [PATCH] brcmfmac: add comment block in brcmf_sdio_buscore_read() - -In brcmf_sdio_buscore_read() there is some special handling upon -register access to chipid register of the chipcommon core. Add -comment explaining why it is done here. - -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 7 +++++++ - 1 file changed, 7 insertions(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -3772,6 +3772,13 @@ static u32 brcmf_sdio_buscore_read32(voi - - val = brcmf_sdiod_readl(sdiodev, addr, NULL); - -+ /* -+ * this is a bit of special handling if reading the chipcommon chipid -+ * register. The 4339 is a next-gen of the 4335. It uses the same -+ * SDIO device id as 4335 and the chipid register returns 4335 as well. -+ * It can be identified as 4339 by looking at the chip revision. It -+ * is corrected here so the chip.c module has the right info. -+ */ - if (addr == CORE_CC_REG(SI_ENUM_BASE, chipid) && - (sdiodev->func1->device == SDIO_DEVICE_ID_BROADCOM_4339 || - sdiodev->func1->device == SDIO_DEVICE_ID_BROADCOM_4335_4339)) { diff --git a/package/kernel/mac80211/patches/316-v4.16-0003-brcmfmac-rename-brcmf_sdiod_buff_-read-write-functio.patch b/package/kernel/mac80211/patches/316-v4.16-0003-brcmfmac-rename-brcmf_sdiod_buff_-read-write-functio.patch deleted file mode 100644 index c587f413d525d0..00000000000000 --- a/package/kernel/mac80211/patches/316-v4.16-0003-brcmfmac-rename-brcmf_sdiod_buff_-read-write-functio.patch +++ /dev/null @@ -1,137 +0,0 @@ -From 378f6a16043e5d3346301fc618f503e97aea335b Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Tue, 9 Jan 2018 13:22:54 +0100 -Subject: [PATCH] brcmfmac: rename brcmf_sdiod_buff_{read,write}() functions - -Rename functions to brcmf_sdio_skbuff_{read,write}() as we pass an -skbuff to this function. - -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 48 +++++++++++----------- - 1 file changed, 24 insertions(+), 24 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -292,24 +292,24 @@ out: - *ret = retval; - } - --static int brcmf_sdiod_buff_read(struct brcmf_sdio_dev *sdiodev, -- struct sdio_func *func, u32 addr, -- struct sk_buff *pkt) -+static int brcmf_sdiod_skbuff_read(struct brcmf_sdio_dev *sdiodev, -+ struct sdio_func *func, u32 addr, -+ struct sk_buff *skb) - { - unsigned int req_sz; - int err; - - /* Single skb use the standard mmc interface */ -- req_sz = pkt->len + 3; -+ req_sz = skb->len + 3; - req_sz &= (uint)~3; - - switch (func->num) { - case 1: -- err = sdio_memcpy_fromio(func, ((u8 *)(pkt->data)), addr, -+ err = sdio_memcpy_fromio(func, ((u8 *)(skb->data)), addr, - req_sz); - break; - case 2: -- err = sdio_readsb(func, ((u8 *)(pkt->data)), addr, req_sz); -+ err = sdio_readsb(func, ((u8 *)(skb->data)), addr, req_sz); - break; - default: - /* bail out as things are really fishy here */ -@@ -323,18 +323,18 @@ static int brcmf_sdiod_buff_read(struct - return err; - } - --static int brcmf_sdiod_buff_write(struct brcmf_sdio_dev *sdiodev, -- struct sdio_func *func, u32 addr, -- struct sk_buff *pkt) -+static int brcmf_sdiod_skbuff_write(struct brcmf_sdio_dev *sdiodev, -+ struct sdio_func *func, u32 addr, -+ struct sk_buff *skb) - { - unsigned int req_sz; - int err; - - /* Single skb use the standard mmc interface */ -- req_sz = pkt->len + 3; -+ req_sz = skb->len + 3; - req_sz &= (uint)~3; - -- err = sdio_memcpy_toio(func, addr, ((u8 *)(pkt->data)), req_sz); -+ err = sdio_memcpy_toio(func, addr, ((u8 *)(skb->data)), req_sz); - - if (err == -ENOMEDIUM) - brcmf_sdiod_change_state(sdiodev, BRCMF_SDIOD_NOMEDIUM); -@@ -550,7 +550,7 @@ int brcmf_sdiod_recv_pkt(struct brcmf_sd - addr &= SBSDIO_SB_OFT_ADDR_MASK; - addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - -- err = brcmf_sdiod_buff_read(sdiodev, sdiodev->func2, addr, pkt); -+ err = brcmf_sdiod_skbuff_read(sdiodev, sdiodev->func2, addr, pkt); - - done: - return err; -@@ -575,14 +575,14 @@ int brcmf_sdiod_recv_chain(struct brcmf_ - addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - - if (pktq->qlen == 1) -- err = brcmf_sdiod_buff_read(sdiodev, sdiodev->func2, addr, -- pktq->next); -+ err = brcmf_sdiod_skbuff_read(sdiodev, sdiodev->func2, addr, -+ pktq->next); - else if (!sdiodev->sg_support) { - glom_skb = brcmu_pkt_buf_get_skb(totlen); - if (!glom_skb) - return -ENOMEM; -- err = brcmf_sdiod_buff_read(sdiodev, sdiodev->func2, addr, -- glom_skb); -+ err = brcmf_sdiod_skbuff_read(sdiodev, sdiodev->func2, addr, -+ glom_skb); - if (err) - goto done; - -@@ -623,8 +623,8 @@ int brcmf_sdiod_send_buf(struct brcmf_sd - addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - - if (!err) -- err = brcmf_sdiod_buff_write(sdiodev, sdiodev->func2, addr, -- mypkt); -+ err = brcmf_sdiod_skbuff_write(sdiodev, sdiodev->func2, addr, -+ mypkt); - - brcmu_pkt_buf_free_skb(mypkt); - -@@ -649,8 +649,8 @@ int brcmf_sdiod_send_pkt(struct brcmf_sd - - if (pktq->qlen == 1 || !sdiodev->sg_support) { - skb_queue_walk(pktq, skb) { -- err = brcmf_sdiod_buff_write(sdiodev, sdiodev->func2, -- addr, skb); -+ err = brcmf_sdiod_skbuff_write(sdiodev, sdiodev->func2, -+ addr, skb); - if (err) - break; - } -@@ -706,11 +706,11 @@ brcmf_sdiod_ramrw(struct brcmf_sdio_dev - - if (write) { - memcpy(pkt->data, data, dsize); -- err = brcmf_sdiod_buff_write(sdiodev, sdiodev->func1, -- sdaddr, pkt); -+ err = brcmf_sdiod_skbuff_write(sdiodev, sdiodev->func1, -+ sdaddr, pkt); - } else { -- err = brcmf_sdiod_buff_read(sdiodev, sdiodev->func1, -- sdaddr, pkt); -+ err = brcmf_sdiod_skbuff_read(sdiodev, sdiodev->func1, -+ sdaddr, pkt); - } - - if (err) { diff --git a/package/kernel/mac80211/patches/317-v4.16-0001-brcmfmac-Use-zeroing-memory-allocator-than-allocator.patch b/package/kernel/mac80211/patches/317-v4.16-0001-brcmfmac-Use-zeroing-memory-allocator-than-allocator.patch deleted file mode 100644 index b60c81a3a2c146..00000000000000 --- a/package/kernel/mac80211/patches/317-v4.16-0001-brcmfmac-Use-zeroing-memory-allocator-than-allocator.patch +++ /dev/null @@ -1,59 +0,0 @@ -From b7acadaf038740c43515dc1548f43d01cc92823a Mon Sep 17 00:00:00 2001 -From: Himanshu Jha -Date: Tue, 9 Jan 2018 02:15:31 +0530 -Subject: [PATCH] brcmfmac: Use zeroing memory allocator than allocator/memset - -Use dma_zalloc_coherent for allocating zeroed -memory and remove unnecessary memset function. - -Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci - -Suggested-by: Luis R. Rodriguez -Signed-off-by: Himanshu Jha -Signed-off-by: Kalle Valo ---- - .../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 20 ++++++++++---------- - 1 file changed, 10 insertions(+), 10 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -@@ -1251,14 +1251,14 @@ static int brcmf_pcie_init_scratchbuffer - u64 address; - u32 addr; - -- devinfo->shared.scratch = dma_alloc_coherent(&devinfo->pdev->dev, -- BRCMF_DMA_D2H_SCRATCH_BUF_LEN, -- &devinfo->shared.scratch_dmahandle, GFP_KERNEL); -+ devinfo->shared.scratch = -+ dma_zalloc_coherent(&devinfo->pdev->dev, -+ BRCMF_DMA_D2H_SCRATCH_BUF_LEN, -+ &devinfo->shared.scratch_dmahandle, -+ GFP_KERNEL); - if (!devinfo->shared.scratch) - goto fail; - -- memset(devinfo->shared.scratch, 0, BRCMF_DMA_D2H_SCRATCH_BUF_LEN); -- - addr = devinfo->shared.tcm_base_address + - BRCMF_SHARED_DMA_SCRATCH_ADDR_OFFSET; - address = (u64)devinfo->shared.scratch_dmahandle; -@@ -1268,14 +1268,14 @@ static int brcmf_pcie_init_scratchbuffer - BRCMF_SHARED_DMA_SCRATCH_LEN_OFFSET; - brcmf_pcie_write_tcm32(devinfo, addr, BRCMF_DMA_D2H_SCRATCH_BUF_LEN); - -- devinfo->shared.ringupd = dma_alloc_coherent(&devinfo->pdev->dev, -- BRCMF_DMA_D2H_RINGUPD_BUF_LEN, -- &devinfo->shared.ringupd_dmahandle, GFP_KERNEL); -+ devinfo->shared.ringupd = -+ dma_zalloc_coherent(&devinfo->pdev->dev, -+ BRCMF_DMA_D2H_RINGUPD_BUF_LEN, -+ &devinfo->shared.ringupd_dmahandle, -+ GFP_KERNEL); - if (!devinfo->shared.ringupd) - goto fail; - -- memset(devinfo->shared.ringupd, 0, BRCMF_DMA_D2H_RINGUPD_BUF_LEN); -- - addr = devinfo->shared.tcm_base_address + - BRCMF_SHARED_DMA_RINGUPD_ADDR_OFFSET; - address = (u64)devinfo->shared.ringupd_dmahandle; diff --git a/package/kernel/mac80211/patches/318-v4.17-mac80211-round-IEEE80211_TX_STATUS_HEADROOM-up-to-mu.patch b/package/kernel/mac80211/patches/318-v4.17-mac80211-round-IEEE80211_TX_STATUS_HEADROOM-up-to-mu.patch deleted file mode 100644 index e955cb3a25a3d1..00000000000000 --- a/package/kernel/mac80211/patches/318-v4.17-mac80211-round-IEEE80211_TX_STATUS_HEADROOM-up-to-mu.patch +++ /dev/null @@ -1,26 +0,0 @@ -From: Felix Fietkau -Date: Fri, 9 Feb 2018 19:46:54 +0100 -Subject: [PATCH] mac80211: round IEEE80211_TX_STATUS_HEADROOM up to multiple - of 4 - -This ensures that mac80211 allocated management frames are properly -aligned, which makes copying them more efficient. -For instance, mt76 uses iowrite32_copy to copy beacon frames to beacon -template memory on the chip. -Misaligned 32-bit accesses cause CPU exceptions on MIPS and should be -avoided. - -Signed-off-by: Felix Fietkau ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -4145,7 +4145,7 @@ void ieee80211_sta_uapsd_trigger(struct - * The TX headroom reserved by mac80211 for its own tx_status functions. - * This is enough for the radiotap header. - */ --#define IEEE80211_TX_STATUS_HEADROOM 14 -+#define IEEE80211_TX_STATUS_HEADROOM ALIGN(14, 4) - - /** - * ieee80211_sta_set_buffered - inform mac80211 about driver-buffered frames diff --git a/package/kernel/mac80211/patches/319-v4.17-0001-mac80211-drop-frames-with-unexpected-DS-bits-from-fa.patch b/package/kernel/mac80211/patches/319-v4.17-0001-mac80211-drop-frames-with-unexpected-DS-bits-from-fa.patch deleted file mode 100644 index a7562996b18060..00000000000000 --- a/package/kernel/mac80211/patches/319-v4.17-0001-mac80211-drop-frames-with-unexpected-DS-bits-from-fa.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: Felix Fietkau -Date: Fri, 23 Feb 2018 09:59:35 +0100 -Subject: [PATCH] mac80211: drop frames with unexpected DS bits from - fast-rx to slow path - -Fixes rx for 4-addr packets in AP mode - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -3928,7 +3928,7 @@ static bool ieee80211_invoke_fast_rx(str - if ((hdr->frame_control & cpu_to_le16(IEEE80211_FCTL_FROMDS | - IEEE80211_FCTL_TODS)) != - fast_rx->expected_ds_bits) -- goto drop; -+ return false; - - /* assign the key to drop unencrypted frames (later) - * and strip the IV/MIC if necessary diff --git a/package/kernel/mac80211/patches/319-v4.17-0002-mac80211-support-AP-4-addr-mode-fast-rx.patch b/package/kernel/mac80211/patches/319-v4.17-0002-mac80211-support-AP-4-addr-mode-fast-rx.patch deleted file mode 100644 index 3f3eb0a5e16a24..00000000000000 --- a/package/kernel/mac80211/patches/319-v4.17-0002-mac80211-support-AP-4-addr-mode-fast-rx.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Felix Fietkau -Date: Fri, 23 Feb 2018 10:00:22 +0100 -Subject: [PATCH] mac80211: support AP 4-addr mode fast-rx - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -3774,6 +3774,15 @@ void ieee80211_check_fast_rx(struct sta_ - !(sdata->flags & IEEE80211_SDATA_DONT_BRIDGE_PACKETS) && - (sdata->vif.type != NL80211_IFTYPE_AP_VLAN || - !sdata->u.vlan.sta); -+ -+ if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN && -+ sdata->u.vlan.sta) { -+ fastrx.expected_ds_bits |= -+ cpu_to_le16(IEEE80211_FCTL_FROMDS); -+ fastrx.sa_offs = offsetof(struct ieee80211_hdr, addr4); -+ fastrx.internal_forward = 0; -+ } -+ - break; - default: - goto clear; diff --git a/package/kernel/mac80211/patches/319-v4.17-0003-mac80211-support-fast-rx-with-incompatible-PS-capabi.patch b/package/kernel/mac80211/patches/319-v4.17-0003-mac80211-support-fast-rx-with-incompatible-PS-capabi.patch deleted file mode 100644 index 8c4c724ef75adc..00000000000000 --- a/package/kernel/mac80211/patches/319-v4.17-0003-mac80211-support-fast-rx-with-incompatible-PS-capabi.patch +++ /dev/null @@ -1,53 +0,0 @@ -From: Felix Fietkau -Date: Fri, 23 Feb 2018 10:01:53 +0100 -Subject: [PATCH] mac80211: support fast-rx with incompatible PS - capabilities when PS is disabled - -When powersave is disabled for the interface, we can do fast-rx anyway. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -2658,6 +2658,7 @@ static int ieee80211_set_power_mgmt(stru - - ieee80211_recalc_ps(local); - ieee80211_recalc_ps_vif(sdata); -+ ieee80211_check_fast_rx_iface(sdata); - - return 0; - } ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -3741,12 +3741,7 @@ void ieee80211_check_fast_rx(struct sta_ - /* 4-addr is harder to deal with, later maybe */ - if (sdata->u.mgd.use_4addr) - goto clear; -- /* software powersave is a huge mess, avoid all of it */ -- if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK)) -- goto clear; -- if (ieee80211_hw_check(&local->hw, SUPPORTS_PS) && -- !ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS)) -- goto clear; -+ - if (sta->sta.tdls) { - fastrx.da_offs = offsetof(struct ieee80211_hdr, addr1); - fastrx.sa_offs = offsetof(struct ieee80211_hdr, addr2); -@@ -3758,6 +3753,16 @@ void ieee80211_check_fast_rx(struct sta_ - fastrx.expected_ds_bits = - cpu_to_le16(IEEE80211_FCTL_FROMDS); - } -+ -+ if (!sdata->u.mgd.powersave) -+ break; -+ -+ /* software powersave is a huge mess, avoid all of it */ -+ if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK)) -+ goto clear; -+ if (ieee80211_hw_check(&local->hw, SUPPORTS_PS) && -+ !ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS)) -+ goto clear; - break; - case NL80211_IFTYPE_AP_VLAN: - case NL80211_IFTYPE_AP: diff --git a/package/kernel/mac80211/patches/319-v4.17-0004-mac80211-support-station-4-addr-mode-fast-rx.patch b/package/kernel/mac80211/patches/319-v4.17-0004-mac80211-support-station-4-addr-mode-fast-rx.patch deleted file mode 100644 index 97a5d8bebaa7dc..00000000000000 --- a/package/kernel/mac80211/patches/319-v4.17-0004-mac80211-support-station-4-addr-mode-fast-rx.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Felix Fietkau -Date: Fri, 23 Feb 2018 10:05:08 +0100 -Subject: [PATCH] mac80211: support station 4-addr mode fast-rx - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -3738,10 +3738,6 @@ void ieee80211_check_fast_rx(struct sta_ - - switch (sdata->vif.type) { - case NL80211_IFTYPE_STATION: -- /* 4-addr is harder to deal with, later maybe */ -- if (sdata->u.mgd.use_4addr) -- goto clear; -- - if (sta->sta.tdls) { - fastrx.da_offs = offsetof(struct ieee80211_hdr, addr1); - fastrx.sa_offs = offsetof(struct ieee80211_hdr, addr2); -@@ -3754,6 +3750,13 @@ void ieee80211_check_fast_rx(struct sta_ - cpu_to_le16(IEEE80211_FCTL_FROMDS); - } - -+ if (sdata->u.mgd.use_4addr && !sta->sta.tdls) { -+ fastrx.expected_ds_bits |= -+ cpu_to_le16(IEEE80211_FCTL_TODS); -+ fastrx.da_offs = offsetof(struct ieee80211_hdr, addr3); -+ fastrx.sa_offs = offsetof(struct ieee80211_hdr, addr4); -+ } -+ - if (!sdata->u.mgd.powersave) - break; - diff --git a/package/kernel/mac80211/patches/320-v4.17-mac80211-support-A-MSDU-in-fast-rx.patch b/package/kernel/mac80211/patches/320-v4.17-mac80211-support-A-MSDU-in-fast-rx.patch deleted file mode 100644 index 3c6d342ff13865..00000000000000 --- a/package/kernel/mac80211/patches/320-v4.17-mac80211-support-A-MSDU-in-fast-rx.patch +++ /dev/null @@ -1,256 +0,0 @@ -From: Felix Fietkau -Date: Mon, 26 Feb 2018 22:09:29 +0100 -Subject: [PATCH] mac80211: support A-MSDU in fast-rx - -Only works if the IV was stripped from packets. Create a smaller -variant of ieee80211_rx_h_amsdu, which bypasses checks already done -within the fast-rx context. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2358,39 +2358,17 @@ ieee80211_deliver_skb(struct ieee80211_r - } - - static ieee80211_rx_result debug_noinline --ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) -+__ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx, u8 data_offset) - { - struct net_device *dev = rx->sdata->dev; - struct sk_buff *skb = rx->skb; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - __le16 fc = hdr->frame_control; - struct sk_buff_head frame_list; -- struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); - struct ethhdr ethhdr; - const u8 *check_da = ethhdr.h_dest, *check_sa = ethhdr.h_source; - -- if (unlikely(!ieee80211_is_data(fc))) -- return RX_CONTINUE; -- -- if (unlikely(!ieee80211_is_data_present(fc))) -- return RX_DROP_MONITOR; -- -- if (!(status->rx_flags & IEEE80211_RX_AMSDU)) -- return RX_CONTINUE; -- - if (unlikely(ieee80211_has_a4(hdr->frame_control))) { -- switch (rx->sdata->vif.type) { -- case NL80211_IFTYPE_AP_VLAN: -- if (!rx->sdata->u.vlan.sta) -- return RX_DROP_UNUSABLE; -- break; -- case NL80211_IFTYPE_STATION: -- if (!rx->sdata->u.mgd.use_4addr) -- return RX_DROP_UNUSABLE; -- break; -- default: -- return RX_DROP_UNUSABLE; -- } - check_da = NULL; - check_sa = NULL; - } else switch (rx->sdata->vif.type) { -@@ -2410,15 +2388,13 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx - break; - } - -- if (is_multicast_ether_addr(hdr->addr1)) -- return RX_DROP_UNUSABLE; -- - skb->dev = dev; - __skb_queue_head_init(&frame_list); - - if (ieee80211_data_to_8023_exthdr(skb, ðhdr, - rx->sdata->vif.addr, -- rx->sdata->vif.type)) -+ rx->sdata->vif.type, -+ data_offset)) - return RX_DROP_UNUSABLE; - - ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr, -@@ -2440,6 +2416,44 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx - return RX_QUEUED; - } - -+static ieee80211_rx_result debug_noinline -+ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) -+{ -+ struct sk_buff *skb = rx->skb; -+ struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); -+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; -+ __le16 fc = hdr->frame_control; -+ -+ if (!(status->rx_flags & IEEE80211_RX_AMSDU)) -+ return RX_CONTINUE; -+ -+ if (unlikely(!ieee80211_is_data(fc))) -+ return RX_CONTINUE; -+ -+ if (unlikely(!ieee80211_is_data_present(fc))) -+ return RX_DROP_MONITOR; -+ -+ if (unlikely(ieee80211_has_a4(hdr->frame_control))) { -+ switch (rx->sdata->vif.type) { -+ case NL80211_IFTYPE_AP_VLAN: -+ if (!rx->sdata->u.vlan.sta) -+ return RX_DROP_UNUSABLE; -+ break; -+ case NL80211_IFTYPE_STATION: -+ if (!rx->sdata->u.mgd.use_4addr) -+ return RX_DROP_UNUSABLE; -+ break; -+ default: -+ return RX_DROP_UNUSABLE; -+ } -+ } -+ -+ if (is_multicast_ether_addr(hdr->addr1)) -+ return RX_DROP_UNUSABLE; -+ -+ return __ieee80211_rx_h_amsdu(rx, 0); -+} -+ - #ifdef CPTCFG_MAC80211_MESH - static ieee80211_rx_result - ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) -@@ -3889,7 +3903,8 @@ static bool ieee80211_invoke_fast_rx(str - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - struct sta_info *sta = rx->sta; - int orig_len = skb->len; -- int snap_offs = ieee80211_hdrlen(hdr->frame_control); -+ int hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ int snap_offs = hdrlen; - struct { - u8 snap[sizeof(rfc1042_header)]; - __be16 proto; -@@ -3920,10 +3935,6 @@ static bool ieee80211_invoke_fast_rx(str - (status->flag & FAST_RX_CRYPT_FLAGS) != FAST_RX_CRYPT_FLAGS) - return false; - -- /* we don't deal with A-MSDU deaggregation here */ -- if (status->rx_flags & IEEE80211_RX_AMSDU) -- return false; -- - if (unlikely(!ieee80211_is_data_present(hdr->frame_control))) - return false; - -@@ -3955,21 +3966,24 @@ static bool ieee80211_invoke_fast_rx(str - snap_offs += IEEE80211_CCMP_HDR_LEN; - } - -- if (!pskb_may_pull(skb, snap_offs + sizeof(*payload))) -- goto drop; -- payload = (void *)(skb->data + snap_offs); -+ if (!(status->rx_flags & IEEE80211_RX_AMSDU)) { -+ if (!pskb_may_pull(skb, snap_offs + sizeof(*payload))) -+ goto drop; - -- if (!ether_addr_equal(payload->snap, fast_rx->rfc1042_hdr)) -- return false; -+ payload = (void *)(skb->data + snap_offs); - -- /* Don't handle these here since they require special code. -- * Accept AARP and IPX even though they should come with a -- * bridge-tunnel header - but if we get them this way then -- * there's little point in discarding them. -- */ -- if (unlikely(payload->proto == cpu_to_be16(ETH_P_TDLS) || -- payload->proto == fast_rx->control_port_protocol)) -- return false; -+ if (!ether_addr_equal(payload->snap, fast_rx->rfc1042_hdr)) -+ return false; -+ -+ /* Don't handle these here since they require special code. -+ * Accept AARP and IPX even though they should come with a -+ * bridge-tunnel header - but if we get them this way then -+ * there's little point in discarding them. -+ */ -+ if (unlikely(payload->proto == cpu_to_be16(ETH_P_TDLS) || -+ payload->proto == fast_rx->control_port_protocol)) -+ return false; -+ } - - /* after this point, don't punt to the slowpath! */ - -@@ -3983,12 +3997,6 @@ static bool ieee80211_invoke_fast_rx(str - } - - /* statistics part of ieee80211_rx_h_sta_process() */ -- stats->last_rx = jiffies; -- stats->last_rate = sta_stats_encode_rate(status); -- -- stats->fragments++; -- stats->packets++; -- - if (!(status->flag & RX_FLAG_NO_SIGNAL_VAL)) { - stats->last_signal = status->signal; - if (!fast_rx->uses_rss) -@@ -4017,6 +4025,20 @@ static bool ieee80211_invoke_fast_rx(str - if (rx->key && !ieee80211_has_protected(hdr->frame_control)) - goto drop; - -+ if (status->rx_flags & IEEE80211_RX_AMSDU) { -+ if (__ieee80211_rx_h_amsdu(rx, snap_offs - hdrlen) != -+ RX_QUEUED) -+ goto drop; -+ -+ return true; -+ } -+ -+ stats->last_rx = jiffies; -+ stats->last_rate = sta_stats_encode_rate(status); -+ -+ stats->fragments++; -+ stats->packets++; -+ - /* do the header conversion - first grab the addresses */ - ether_addr_copy(addrs.da, skb->data + fast_rx->da_offs); - ether_addr_copy(addrs.sa, skb->data + fast_rx->sa_offs); ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -4331,10 +4331,12 @@ unsigned int ieee80211_get_mesh_hdrlen(s - * of it being pushed into the SKB - * @addr: the device MAC address - * @iftype: the virtual interface type -+ * @data_offset: offset of payload after the 802.11 header - * Return: 0 on success. Non-zero on error. - */ - int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, -- const u8 *addr, enum nl80211_iftype iftype); -+ const u8 *addr, enum nl80211_iftype iftype, -+ u8 data_offset); - - /** - * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 -@@ -4346,7 +4348,7 @@ int ieee80211_data_to_8023_exthdr(struct - static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, - enum nl80211_iftype iftype) - { -- return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype); -+ return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0); - } - - /** ---- a/net/wireless/util.c -+++ b/net/wireless/util.c -@@ -419,7 +419,8 @@ unsigned int ieee80211_get_mesh_hdrlen(s - EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen); - - int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr, -- const u8 *addr, enum nl80211_iftype iftype) -+ const u8 *addr, enum nl80211_iftype iftype, -+ u8 data_offset) - { - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - struct { -@@ -433,7 +434,7 @@ int ieee80211_data_to_8023_exthdr(struct - if (unlikely(!ieee80211_is_data_present(hdr->frame_control))) - return -1; - -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ hdrlen = ieee80211_hdrlen(hdr->frame_control) + data_offset; - if (skb->len < hdrlen + 8) - return -1; - diff --git a/package/kernel/mac80211/patches/321-v4.16-0001-brcmfmac-assure-bcdc-dcmd-api-does-not-return-value-.patch b/package/kernel/mac80211/patches/321-v4.16-0001-brcmfmac-assure-bcdc-dcmd-api-does-not-return-value-.patch deleted file mode 100644 index 394fbfc5b2e26c..00000000000000 --- a/package/kernel/mac80211/patches/321-v4.16-0001-brcmfmac-assure-bcdc-dcmd-api-does-not-return-value-.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 5242a5444e0b6464d7455beb55d936dd192b5e9d Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Mon, 22 Jan 2018 21:46:39 +0100 -Subject: [PATCH] brcmfmac: assure bcdc dcmd api does not return value > 0 - -The protocol layer api defines callbacks for dongle commands. -Although not really well documented these should only return an -error code in case of an error, or 0 upon success. In the bcdc -protocol it can return value above 0 and we carry a fix in the -caller of the protocol layer api. This patch makes it adhere to -the intent of the api as described above. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 6 +++++- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c | 8 +++----- - 2 files changed, 8 insertions(+), 6 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c -@@ -211,6 +211,8 @@ retry: - memcpy(buf, info, len); - } - -+ ret = 0; -+ - /* Check the ERROR flag */ - if (flags & BCDC_DCMD_ERROR) - ret = le32_to_cpu(msg->status); -@@ -225,7 +227,7 @@ brcmf_proto_bcdc_set_dcmd(struct brcmf_p - { - struct brcmf_bcdc *bcdc = (struct brcmf_bcdc *)drvr->proto->pd; - struct brcmf_proto_bcdc_dcmd *msg = &bcdc->msg; -- int ret = 0; -+ int ret; - u32 flags, id; - - brcmf_dbg(BCDC, "Enter, cmd %d len %d\n", cmd, len); -@@ -249,6 +251,8 @@ brcmf_proto_bcdc_set_dcmd(struct brcmf_p - goto done; - } - -+ ret = 0; -+ - /* Check the ERROR flag */ - if (flags & BCDC_DCMD_ERROR) - ret = le32_to_cpu(msg->status); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c -@@ -121,11 +121,9 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp, - else - err = brcmf_proto_query_dcmd(drvr, ifp->ifidx, cmd, data, len); - -- if (err >= 0) -- return 0; -- -- brcmf_dbg(FIL, "Failed: %s (%d)\n", -- brcmf_fil_get_errstr((u32)(-err)), err); -+ if (err) -+ brcmf_dbg(FIL, "Failed: %s (%d)\n", -+ brcmf_fil_get_errstr((u32)(-err)), err); - - return err; - } diff --git a/package/kernel/mac80211/patches/321-v4.16-0002-brcmfmac-separate-firmware-errors-from-i-o-errors.patch b/package/kernel/mac80211/patches/321-v4.16-0002-brcmfmac-separate-firmware-errors-from-i-o-errors.patch deleted file mode 100644 index 28e3c1a65f88d1..00000000000000 --- a/package/kernel/mac80211/patches/321-v4.16-0002-brcmfmac-separate-firmware-errors-from-i-o-errors.patch +++ /dev/null @@ -1,186 +0,0 @@ -From b69c1df47281ad47bd2037a42b98f5c7115b7fd5 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Mon, 22 Jan 2018 21:46:40 +0100 -Subject: [PATCH] brcmfmac: separate firmware errors from i/o errors - -When using the firmware api it can fail simply because firmware does -not like the request or it fails due to issues in the host interface. -Currently, there is only a single error code which is confusing. So -adding a parameter to pass the firmware error separately and in case -of a firmware error always return -EBADE to user-space. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 11 ++++++----- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c | 16 +++++++++++----- - .../net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 10 ++++++---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h | 14 ++++++++------ - 4 files changed, 31 insertions(+), 20 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c -@@ -165,7 +165,7 @@ static int brcmf_proto_bcdc_cmplt(struct - - static int - brcmf_proto_bcdc_query_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd, -- void *buf, uint len) -+ void *buf, uint len, int *fwerr) - { - struct brcmf_bcdc *bcdc = (struct brcmf_bcdc *)drvr->proto->pd; - struct brcmf_proto_bcdc_dcmd *msg = &bcdc->msg; -@@ -175,6 +175,7 @@ brcmf_proto_bcdc_query_dcmd(struct brcmf - - brcmf_dbg(BCDC, "Enter, cmd %d len %d\n", cmd, len); - -+ *fwerr = 0; - ret = brcmf_proto_bcdc_msg(drvr, ifidx, cmd, buf, len, false); - if (ret < 0) { - brcmf_err("brcmf_proto_bcdc_msg failed w/status %d\n", -@@ -215,15 +216,14 @@ retry: - - /* Check the ERROR flag */ - if (flags & BCDC_DCMD_ERROR) -- ret = le32_to_cpu(msg->status); -- -+ *fwerr = le32_to_cpu(msg->status); - done: - return ret; - } - - static int - brcmf_proto_bcdc_set_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd, -- void *buf, uint len) -+ void *buf, uint len, int *fwerr) - { - struct brcmf_bcdc *bcdc = (struct brcmf_bcdc *)drvr->proto->pd; - struct brcmf_proto_bcdc_dcmd *msg = &bcdc->msg; -@@ -232,6 +232,7 @@ brcmf_proto_bcdc_set_dcmd(struct brcmf_p - - brcmf_dbg(BCDC, "Enter, cmd %d len %d\n", cmd, len); - -+ *fwerr = 0; - ret = brcmf_proto_bcdc_msg(drvr, ifidx, cmd, buf, len, true); - if (ret < 0) - goto done; -@@ -255,7 +256,7 @@ brcmf_proto_bcdc_set_dcmd(struct brcmf_p - - /* Check the ERROR flag */ - if (flags & BCDC_DCMD_ERROR) -- ret = le32_to_cpu(msg->status); -+ *fwerr = le32_to_cpu(msg->status); - - done: - return ret; ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c -@@ -107,7 +107,7 @@ static s32 - brcmf_fil_cmd_data(struct brcmf_if *ifp, u32 cmd, void *data, u32 len, bool set) - { - struct brcmf_pub *drvr = ifp->drvr; -- s32 err; -+ s32 err, fwerr; - - if (drvr->bus_if->state != BRCMF_BUS_UP) { - brcmf_err("bus is down. we have nothing to do.\n"); -@@ -117,14 +117,20 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp, - if (data != NULL) - len = min_t(uint, len, BRCMF_DCMD_MAXLEN); - if (set) -- err = brcmf_proto_set_dcmd(drvr, ifp->ifidx, cmd, data, len); -+ err = brcmf_proto_set_dcmd(drvr, ifp->ifidx, cmd, -+ data, len, &fwerr); - else -- err = brcmf_proto_query_dcmd(drvr, ifp->ifidx, cmd, data, len); -+ err = brcmf_proto_query_dcmd(drvr, ifp->ifidx, cmd, -+ data, len, &fwerr); - -- if (err) -+ if (err) { - brcmf_dbg(FIL, "Failed: %s (%d)\n", - brcmf_fil_get_errstr((u32)(-err)), err); -- -+ } else if (fwerr < 0) { -+ brcmf_dbg(FIL, "Firmware error: %s (%d)\n", -+ brcmf_fil_get_errstr((u32)(-fwerr)), fwerr); -+ err = -EBADE; -+ } - return err; - } - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c -@@ -477,7 +477,7 @@ static void brcmf_msgbuf_ioctl_resp_wake - - - static int brcmf_msgbuf_query_dcmd(struct brcmf_pub *drvr, int ifidx, -- uint cmd, void *buf, uint len) -+ uint cmd, void *buf, uint len, int *fwerr) - { - struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd; - struct sk_buff *skb = NULL; -@@ -485,6 +485,7 @@ static int brcmf_msgbuf_query_dcmd(struc - int err; - - brcmf_dbg(MSGBUF, "ifidx=%d, cmd=%d, len=%d\n", ifidx, cmd, len); -+ *fwerr = 0; - msgbuf->ctl_completed = false; - err = brcmf_msgbuf_tx_ioctl(drvr, ifidx, cmd, buf, len); - if (err) -@@ -508,14 +509,15 @@ static int brcmf_msgbuf_query_dcmd(struc - } - brcmu_pkt_buf_free_skb(skb); - -- return msgbuf->ioctl_resp_status; -+ *fwerr = msgbuf->ioctl_resp_status; -+ return 0; - } - - - static int brcmf_msgbuf_set_dcmd(struct brcmf_pub *drvr, int ifidx, -- uint cmd, void *buf, uint len) -+ uint cmd, void *buf, uint len, int *fwerr) - { -- return brcmf_msgbuf_query_dcmd(drvr, ifidx, cmd, buf, len); -+ return brcmf_msgbuf_query_dcmd(drvr, ifidx, cmd, buf, len, fwerr); - } - - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h -@@ -30,9 +30,9 @@ struct brcmf_proto { - int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws, - struct sk_buff *skb, struct brcmf_if **ifp); - int (*query_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd, -- void *buf, uint len); -+ void *buf, uint len, int *fwerr); - int (*set_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd, void *buf, -- uint len); -+ uint len, int *fwerr); - int (*tx_queue_data)(struct brcmf_pub *drvr, int ifidx, - struct sk_buff *skb); - int (*txdata)(struct brcmf_pub *drvr, int ifidx, u8 offset, -@@ -71,14 +71,16 @@ static inline int brcmf_proto_hdrpull(st - return drvr->proto->hdrpull(drvr, do_fws, skb, ifp); - } - static inline int brcmf_proto_query_dcmd(struct brcmf_pub *drvr, int ifidx, -- uint cmd, void *buf, uint len) -+ uint cmd, void *buf, uint len, -+ int *fwerr) - { -- return drvr->proto->query_dcmd(drvr, ifidx, cmd, buf, len); -+ return drvr->proto->query_dcmd(drvr, ifidx, cmd, buf, len,fwerr); - } - static inline int brcmf_proto_set_dcmd(struct brcmf_pub *drvr, int ifidx, -- uint cmd, void *buf, uint len) -+ uint cmd, void *buf, uint len, -+ int *fwerr) - { -- return drvr->proto->set_dcmd(drvr, ifidx, cmd, buf, len); -+ return drvr->proto->set_dcmd(drvr, ifidx, cmd, buf, len, fwerr); - } - - static inline int brcmf_proto_tx_queue_data(struct brcmf_pub *drvr, int ifidx, diff --git a/package/kernel/mac80211/patches/322-v4.16-0001-brcmfmac-add-possibility-to-obtain-firmware-error.patch b/package/kernel/mac80211/patches/322-v4.16-0001-brcmfmac-add-possibility-to-obtain-firmware-error.patch deleted file mode 100644 index e6486160fc08b1..00000000000000 --- a/package/kernel/mac80211/patches/322-v4.16-0001-brcmfmac-add-possibility-to-obtain-firmware-error.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 933897342d0714ae1c10729cbaeecea0c6178db5 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Wed, 28 Feb 2018 21:15:19 +0100 -Subject: [PATCH] brcmfmac: add possibility to obtain firmware error - -The feature module needs to evaluate the actual firmware error return -upon a control command. This adds a flag to struct brcmf_if that the -caller can set. This flag is checked to determine the error code that -needs to be returned. - -Fixes: b69c1df47281 ("brcmfmac: separate firmware errors from i/o errors") -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h | 2 ++ - drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c | 10 ++++++++++ - drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c | 3 +++ - 3 files changed, 15 insertions(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -@@ -181,6 +181,7 @@ enum brcmf_netif_stop_reason { - * @netif_stop_lock: spinlock for update netif_stop from multiple sources. - * @pend_8021x_cnt: tracks outstanding number of 802.1x frames. - * @pend_8021x_wait: used for signalling change in count. -+ * @fwil_fwerr: flag indicating fwil layer should return firmware error codes. - */ - struct brcmf_if { - struct brcmf_pub *drvr; -@@ -198,6 +199,7 @@ struct brcmf_if { - wait_queue_head_t pend_8021x_wait; - struct in6_addr ipv6_addr_tbl[NDOL_MAX_ENTRIES]; - u8 ipv6addr_idx; -+ bool fwil_fwerr; - }; - - int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c -@@ -104,6 +104,9 @@ static void brcmf_feat_iovar_int_get(str - u32 data; - int err; - -+ /* we need to know firmware error */ -+ ifp->fwil_fwerr = true; -+ - err = brcmf_fil_iovar_int_get(ifp, name, &data); - if (err == 0) { - brcmf_dbg(INFO, "enabling feature: %s\n", brcmf_feat_names[id]); -@@ -112,6 +115,8 @@ static void brcmf_feat_iovar_int_get(str - brcmf_dbg(TRACE, "%s feature check failed: %d\n", - brcmf_feat_names[id], err); - } -+ -+ ifp->fwil_fwerr = false; - } - - static void brcmf_feat_iovar_data_set(struct brcmf_if *ifp, -@@ -120,6 +125,9 @@ static void brcmf_feat_iovar_data_set(st - { - int err; - -+ /* we need to know firmware error */ -+ ifp->fwil_fwerr = true; -+ - err = brcmf_fil_iovar_data_set(ifp, name, data, len); - if (err != -BRCMF_FW_UNSUPPORTED) { - brcmf_dbg(INFO, "enabling feature: %s\n", brcmf_feat_names[id]); -@@ -128,6 +136,8 @@ static void brcmf_feat_iovar_data_set(st - brcmf_dbg(TRACE, "%s feature check failed: %d\n", - brcmf_feat_names[id], err); - } -+ -+ ifp->fwil_fwerr = false; - } - - #define MAX_CAPS_BUFFER_SIZE 512 ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c -@@ -131,6 +131,9 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp, - brcmf_fil_get_errstr((u32)(-fwerr)), fwerr); - err = -EBADE; - } -+ if (ifp->fwil_fwerr) -+ return fwerr; -+ - return err; - } - diff --git a/package/kernel/mac80211/patches/322-v4.16-0002-brcmfmac-fix-P2P_DEVICE-ethernet-address-generation.patch b/package/kernel/mac80211/patches/322-v4.16-0002-brcmfmac-fix-P2P_DEVICE-ethernet-address-generation.patch deleted file mode 100644 index 20e16ad23f00ef..00000000000000 --- a/package/kernel/mac80211/patches/322-v4.16-0002-brcmfmac-fix-P2P_DEVICE-ethernet-address-generation.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 455f3e76cfc0d893585a5f358b9ddbe9c1e1e53b Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Wed, 28 Feb 2018 21:15:20 +0100 -Subject: [PATCH] brcmfmac: fix P2P_DEVICE ethernet address generation - -The firmware has a requirement that the P2P_DEVICE address should -be different from the address of the primary interface. When not -specified by user-space, the driver generates the MAC address for -the P2P_DEVICE interface using the MAC address of the primary -interface and setting the locally administered bit. However, the MAC -address of the primary interface may already have that bit set causing -the creation of the P2P_DEVICE interface to fail with -EBUSY. Fix this -by using a random address instead to determine the P2P_DEVICE address. - -Cc: stable@vger.kernel.org # 3.10.y -Reported-by: Hans de Goede -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 24 ++++++++++------------ - 1 file changed, 11 insertions(+), 13 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c -@@ -462,25 +462,23 @@ static int brcmf_p2p_set_firmware(struct - * @dev_addr: optional device address. - * - * P2P needs mac addresses for P2P device and interface. If no device -- * address it specified, these are derived from the primary net device, ie. -- * the permanent ethernet address of the device. -+ * address it specified, these are derived from a random ethernet -+ * address. - */ - static void brcmf_p2p_generate_bss_mac(struct brcmf_p2p_info *p2p, u8 *dev_addr) - { -- struct brcmf_if *pri_ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; -- bool local_admin = false; -+ bool random_addr = false; - -- if (!dev_addr || is_zero_ether_addr(dev_addr)) { -- dev_addr = pri_ifp->mac_addr; -- local_admin = true; -- } -+ if (!dev_addr || is_zero_ether_addr(dev_addr)) -+ random_addr = true; - -- /* Generate the P2P Device Address. This consists of the device's -- * primary MAC address with the locally administered bit set. -+ /* Generate the P2P Device Address obtaining a random ethernet -+ * address with the locally administered bit set. - */ -- memcpy(p2p->dev_addr, dev_addr, ETH_ALEN); -- if (local_admin) -- p2p->dev_addr[0] |= 0x02; -+ if (random_addr) -+ eth_random_addr(p2p->dev_addr); -+ else -+ memcpy(p2p->dev_addr, dev_addr, ETH_ALEN); - - /* Generate the P2P Interface Address. If the discovery and connection - * BSSCFGs need to simultaneously co-exist, then this address must be diff --git a/package/kernel/mac80211/patches/323-v4.16-0001-brcmfmac-drop-Inter-Access-Point-Protocol-packets-by.patch b/package/kernel/mac80211/patches/323-v4.16-0001-brcmfmac-drop-Inter-Access-Point-Protocol-packets-by.patch deleted file mode 100644 index f25dea01d29246..00000000000000 --- a/package/kernel/mac80211/patches/323-v4.16-0001-brcmfmac-drop-Inter-Access-Point-Protocol-packets-by.patch +++ /dev/null @@ -1,157 +0,0 @@ -From 1259055170287a350cad453e9eac139c81609860 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 15 Mar 2018 08:29:09 +0100 -Subject: [PATCH] brcmfmac: drop Inter-Access Point Protocol packets by default -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Testing brcmfmac with more recent firmwares resulted in AP interfaces -not working in some specific setups. Debugging resulted in discovering -support for IAPP in Broadcom's firmwares. - -Older firmwares were only generating 802.11f frames. Newer ones like: -1) 10.10 (TOB) (r663589) -2) 10.10.122.20 (r683106) -for 4366b1 and 4366c0 respectively seem to also /respect/ 802.11f frames -in the Tx path by performing a STA disassociation. - -This obsoleted standard and its implementation is something that: -1) Most people don't need / want to use -2) Can allow local DoS attacks -3) Breaks AP interfaces in some specific bridge setups - -To solve issues it can cause this commit modifies brcmfmac to drop IAPP -packets. If affects: -1) Rx path: driver won't be sending these unwanted packets up. -2) Tx path: driver will reject packets that would trigger STA - disassociation perfromed by a firmware (possible local DoS attack). - -It appears there are some Broadcom's clients/users who care about this -feature despite the drawbacks. They can switch it on using a new module -param. - -This change results in only two more comparisons (check for module param -and check for Ethernet packet length) for 99.9% of packets. Its overhead -should be very minimal. - -Signed-off-by: Rafał Miłecki -Acked-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/common.c | 5 ++ - .../wireless/broadcom/brcm80211/brcmfmac/common.h | 1 + - .../wireless/broadcom/brcm80211/brcmfmac/core.c | 57 ++++++++++++++++++++++ - 3 files changed, 63 insertions(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -@@ -75,6 +75,10 @@ static int brcmf_roamoff; - module_param_named(roamoff, brcmf_roamoff, int, S_IRUSR); - MODULE_PARM_DESC(roamoff, "Do not use internal roaming engine"); - -+static int brcmf_iapp_enable; -+module_param_named(iapp, brcmf_iapp_enable, int, 0); -+MODULE_PARM_DESC(iapp, "Enable partial support for the obsoleted Inter-Access Point Protocol"); -+ - #ifdef DEBUG - /* always succeed brcmf_bus_started() */ - static int brcmf_ignore_probe_fail; -@@ -441,6 +445,7 @@ struct brcmf_mp_device *brcmf_get_module - settings->feature_disable = brcmf_feature_disable; - settings->fcmode = brcmf_fcmode; - settings->roamoff = !!brcmf_roamoff; -+ settings->iapp = !!brcmf_iapp_enable; - #ifdef DEBUG - settings->ignore_probe_fail = !!brcmf_ignore_probe_fail; - #endif ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h -@@ -58,6 +58,7 @@ struct brcmf_mp_device { - unsigned int feature_disable; - int fcmode; - bool roamoff; -+ bool iapp; - bool ignore_probe_fail; - struct brcmfmac_pd_cc *country_codes; - union { ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -230,6 +230,37 @@ static void brcmf_netdev_set_multicast_l - schedule_work(&ifp->multicast_work); - } - -+/** -+ * brcmf_skb_is_iapp - checks if skb is an IAPP packet -+ * -+ * @skb: skb to check -+ */ -+static bool brcmf_skb_is_iapp(struct sk_buff *skb) -+{ -+ static const u8 iapp_l2_update_packet[6] __aligned(2) = { -+ 0x00, 0x01, 0xaf, 0x81, 0x01, 0x00, -+ }; -+ unsigned char *eth_data; -+#if !defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) -+ const u16 *a, *b; -+#endif -+ -+ if (skb->len - skb->mac_len != 6 || -+ !is_multicast_ether_addr(eth_hdr(skb)->h_dest)) -+ return false; -+ -+ eth_data = skb_mac_header(skb) + ETH_HLEN; -+#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) -+ return !(((*(const u32 *)eth_data) ^ (*(const u32 *)iapp_l2_update_packet)) | -+ ((*(const u16 *)(eth_data + 4)) ^ (*(const u16 *)(iapp_l2_update_packet + 4)))); -+#else -+ a = (const u16 *)eth_data; -+ b = (const u16 *)iapp_l2_update_packet; -+ -+ return !((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])); -+#endif -+} -+ - static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, - struct net_device *ndev) - { -@@ -250,6 +281,23 @@ static netdev_tx_t brcmf_netdev_start_xm - goto done; - } - -+ /* Some recent Broadcom's firmwares disassociate STA when they receive -+ * an 802.11f ADD frame. This behavior can lead to a local DoS security -+ * issue. Attacker may trigger disassociation of any STA by sending a -+ * proper Ethernet frame to the wireless interface. -+ * -+ * Moreover this feature may break AP interfaces in some specific -+ * setups. This applies e.g. to the bridge with hairpin mode enabled and -+ * IFLA_BRPORT_MCAST_TO_UCAST set. IAPP packet generated by a firmware -+ * will get passed back to the wireless interface and cause immediate -+ * disassociation of a just-connected STA. -+ */ -+ if (!drvr->settings->iapp && brcmf_skb_is_iapp(skb)) { -+ dev_kfree_skb(skb); -+ ret = -EINVAL; -+ goto done; -+ } -+ - /* Make sure there's enough writeable headroom */ - if (skb_headroom(skb) < drvr->hdrlen || skb_header_cloned(skb)) { - head_delta = max_t(int, drvr->hdrlen - skb_headroom(skb), 0); -@@ -325,6 +373,15 @@ void brcmf_txflowblock_if(struct brcmf_i - - void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb) - { -+ /* Most of Broadcom's firmwares send 802.11f ADD frame every time a new -+ * STA connects to the AP interface. This is an obsoleted standard most -+ * users don't use, so don't pass these frames up unless requested. -+ */ -+ if (!ifp->drvr->settings->iapp && brcmf_skb_is_iapp(skb)) { -+ brcmu_pkt_buf_free_skb(skb); -+ return; -+ } -+ - if (skb->pkt_type == PACKET_MULTICAST) - ifp->ndev->stats.multicast++; - diff --git a/package/kernel/mac80211/patches/324-v4.16-0001-brcmfmac-Fix-check-for-ISO3166-code.patch b/package/kernel/mac80211/patches/324-v4.16-0001-brcmfmac-Fix-check-for-ISO3166-code.patch deleted file mode 100644 index d45f64ff236377..00000000000000 --- a/package/kernel/mac80211/patches/324-v4.16-0001-brcmfmac-Fix-check-for-ISO3166-code.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 9b9322db5c5a1917a66c71fe47c3848a9a31227e Mon Sep 17 00:00:00 2001 -From: Stefan Wahren -Date: Wed, 14 Mar 2018 20:02:59 +0100 -Subject: [PATCH] brcmfmac: Fix check for ISO3166 code - -The commit "regulatory: add NUL to request alpha2" increases the length of -alpha2 to 3. This causes a regression on brcmfmac, because -brcmf_cfg80211_reg_notifier() expect valid ISO3166 codes in the complete -array. So fix this accordingly. - -Fixes: 657308f73e67 ("regulatory: add NUL to request alpha2") -Signed-off-by: Stefan Wahren -Acked-by: Franky Lin -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -6803,7 +6803,7 @@ static void brcmf_cfg80211_reg_notifier( - return; - - /* ignore non-ISO3166 country codes */ -- for (i = 0; i < sizeof(req->alpha2); i++) -+ for (i = 0; i < 2; i++) - if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') { - brcmf_err("not an ISO3166 code (0x%02x 0x%02x)\n", - req->alpha2[0], req->alpha2[1]); diff --git a/package/kernel/mac80211/patches/325-v4.17-0001-brcmfmac-move-brcmf_bus_preinit-call-just-after-chan.patch b/package/kernel/mac80211/patches/325-v4.17-0001-brcmfmac-move-brcmf_bus_preinit-call-just-after-chan.patch deleted file mode 100644 index f4d9a84b257f20..00000000000000 --- a/package/kernel/mac80211/patches/325-v4.17-0001-brcmfmac-move-brcmf_bus_preinit-call-just-after-chan.patch +++ /dev/null @@ -1,45 +0,0 @@ -From da472385a29f1fddcac7cfa0499482704310bd16 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Tue, 20 Feb 2018 00:14:18 +0100 -Subject: [PATCH] brcmfmac: move brcmf_bus_preinit() call just after changing - bus state - -Moving the brcmf_bus_preinit() call allows the bus code to do some -required initialization before handling firmware control messages. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 3 --- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 5 +++++ - 2 files changed, 5 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -@@ -369,9 +369,6 @@ int brcmf_c_preinit_dcmds(struct brcmf_i - - /* Enable tx beamforming, errors can be ignored (not supported) */ - (void)brcmf_fil_iovar_int_set(ifp, "txbf", 1); -- -- /* do bus specific preinit here */ -- err = brcmf_bus_preinit(ifp->drvr->bus_if); - done: - return err; - } ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1091,6 +1091,11 @@ int brcmf_bus_started(struct device *dev - /* signal bus ready */ - brcmf_bus_change_state(bus_if, BRCMF_BUS_UP); - -+ /* do bus specific preinit here */ -+ ret = brcmf_bus_preinit(ifp->drvr->bus_if); -+ if (ret < 0) -+ goto fail; -+ - /* Bus is ready, do any initialization */ - ret = brcmf_c_preinit_dcmds(ifp); - if (ret < 0) diff --git a/package/kernel/mac80211/patches/325-v4.17-0002-brcmfmac-move-allocation-of-control-rx-buffer-to-brc.patch b/package/kernel/mac80211/patches/325-v4.17-0002-brcmfmac-move-allocation-of-control-rx-buffer-to-brc.patch deleted file mode 100644 index 230e891cea1e8b..00000000000000 --- a/package/kernel/mac80211/patches/325-v4.17-0002-brcmfmac-move-allocation-of-control-rx-buffer-to-brc.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 4b5adc736828dc25ca33e263ad8c0b9dcd3bf325 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Tue, 20 Feb 2018 00:14:19 +0100 -Subject: [PATCH] brcmfmac: move allocation of control rx buffer to - brcmf_sdio_bus_preinit() - -Allocate the control rx buffer needed for firmware control interface -during brcmf_sdio_bus_preinit(). This relies on common layer setting -struct brcmf_bus::maxctl during brcmf_attach(). By moving the allocation -we can move brcmf_attach() in subsequent change. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 26 ++++++++++------------ - 1 file changed, 12 insertions(+), 14 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -1707,7 +1707,6 @@ brcmf_sdio_read_control(struct brcmf_sdi - int sdret; - - brcmf_dbg(TRACE, "Enter\n"); -- - if (bus->rxblen) - buf = vzalloc(bus->rxblen); - if (!buf) -@@ -3411,6 +3410,18 @@ static int brcmf_sdio_bus_preinit(struct - u32 value; - int err; - -+ /* maxctl provided by common layer */ -+ if (WARN_ON(!bus_if->maxctl)) -+ return -EINVAL; -+ -+ /* Allocate control receive buffer */ -+ bus_if->maxctl += bus->roundup; -+ value = roundup((bus_if->maxctl + SDPCM_HDRLEN), ALIGNMENT); -+ value += bus->head_align; -+ bus->rxbuf = kmalloc(value, GFP_ATOMIC); -+ if (bus->rxbuf) -+ bus->rxblen = value; -+ - /* the commands below use the terms tx and rx from - * a device perspective, ie. bus:txglom affects the - * bus transfers from device to host. -@@ -4209,19 +4220,6 @@ struct brcmf_sdio *brcmf_sdio_probe(stru - bus->blocksize = bus->sdiodev->func2->cur_blksize; - bus->roundup = min(max_roundup, bus->blocksize); - -- /* Allocate buffers */ -- if (bus->sdiodev->bus_if->maxctl) { -- bus->sdiodev->bus_if->maxctl += bus->roundup; -- bus->rxblen = -- roundup((bus->sdiodev->bus_if->maxctl + SDPCM_HDRLEN), -- ALIGNMENT) + bus->head_align; -- bus->rxbuf = kmalloc(bus->rxblen, GFP_ATOMIC); -- if (!(bus->rxbuf)) { -- brcmf_err("rxbuf allocation failed\n"); -- goto fail; -- } -- } -- - sdio_claim_host(bus->sdiodev->func1); - - /* Disable F2 to clear any intermediate frame state on the dongle */ diff --git a/package/kernel/mac80211/patches/325-v4.17-0003-brcmfmac-call-brcmf_attach-just-before-calling-brcmf.patch b/package/kernel/mac80211/patches/325-v4.17-0003-brcmfmac-call-brcmf_attach-just-before-calling-brcmf.patch deleted file mode 100644 index a8b0171cb34211..00000000000000 --- a/package/kernel/mac80211/patches/325-v4.17-0003-brcmfmac-call-brcmf_attach-just-before-calling-brcmf.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 262f2b53f67936b59cc8dfc6f3899ab8905bf1ed Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Tue, 20 Feb 2018 00:14:20 +0100 -Subject: [PATCH] brcmfmac: call brcmf_attach() just before calling - brcmf_bus_started() - -Now we can move brcmf_attach() until after the firmware has been downloaded -to the device. Make the call just before brcmf_bus_started(). - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/core.c | 6 ++++ - .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 34 +++++++++++----------- - 2 files changed, 23 insertions(+), 17 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1268,6 +1268,12 @@ void brcmf_bus_change_state(struct brcmf - int ifidx; - - brcmf_dbg(TRACE, "%d -> %d\n", bus->state, state); -+ -+ if (!drvr) { -+ brcmf_dbg(INFO, "ignoring transition, bus not attached yet\n"); -+ return; -+ } -+ - bus->state = state; - - if (state == BRCMF_BUS_UP) { ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -4048,9 +4048,6 @@ static void brcmf_sdio_firmware_callback - if (err) - goto fail; - -- if (!bus_if->drvr) -- return; -- - /* try to download image and nvram to the dongle */ - bus->alp_only = true; - err = brcmf_sdio_download_firmware(bus, code, nvram, nvram_len); -@@ -4126,11 +4123,28 @@ static void brcmf_sdio_firmware_callback - - sdio_release_host(sdiodev->func1); - -+ /* Assign bus interface call back */ -+ sdiodev->bus_if->dev = sdiodev->dev; -+ sdiodev->bus_if->ops = &brcmf_sdio_bus_ops; -+ sdiodev->bus_if->chip = bus->ci->chip; -+ sdiodev->bus_if->chiprev = bus->ci->chiprev; -+ -+ /* Attach to the common layer, reserve hdr space */ -+ err = brcmf_attach(sdiodev->dev, sdiodev->settings); -+ if (err != 0) { -+ brcmf_err("brcmf_attach failed\n"); -+ goto fail; -+ } -+ -+ brcmf_sdio_debugfs_create(bus); -+ - err = brcmf_bus_started(dev); - if (err != 0) { - brcmf_err("dongle is not responding\n"); - goto fail; - } -+ -+ /* ready */ - return; - - release: -@@ -4200,22 +4214,9 @@ struct brcmf_sdio *brcmf_sdio_probe(stru - bus->dpc_triggered = false; - bus->dpc_running = false; - -- /* Assign bus interface call back */ -- bus->sdiodev->bus_if->dev = bus->sdiodev->dev; -- bus->sdiodev->bus_if->ops = &brcmf_sdio_bus_ops; -- bus->sdiodev->bus_if->chip = bus->ci->chip; -- bus->sdiodev->bus_if->chiprev = bus->ci->chiprev; -- - /* default sdio bus header length for tx packet */ - bus->tx_hdrlen = SDPCM_HWHDR_LEN + SDPCM_SWHDR_LEN; - -- /* Attach to the common layer, reserve hdr space */ -- ret = brcmf_attach(bus->sdiodev->dev, bus->sdiodev->settings); -- if (ret != 0) { -- brcmf_err("brcmf_attach failed\n"); -- goto fail; -- } -- - /* Query the F2 block size, set roundup accordingly */ - bus->blocksize = bus->sdiodev->func2->cur_blksize; - bus->roundup = min(max_roundup, bus->blocksize); -@@ -4240,7 +4241,6 @@ struct brcmf_sdio *brcmf_sdio_probe(stru - /* SR state */ - bus->sr_enabled = false; - -- brcmf_sdio_debugfs_create(bus); - brcmf_dbg(INFO, "completed!!\n"); - - ret = brcmf_fw_map_chip_to_name(bus->ci->chip, bus->ci->chiprev, diff --git a/package/kernel/mac80211/patches/325-v4.17-0004-brcmfmac-usb-call-brcmf_usb_up-during-brcmf_bus_prei.patch b/package/kernel/mac80211/patches/325-v4.17-0004-brcmfmac-usb-call-brcmf_usb_up-during-brcmf_bus_prei.patch deleted file mode 100644 index 00c4141cc50433..00000000000000 --- a/package/kernel/mac80211/patches/325-v4.17-0004-brcmfmac-usb-call-brcmf_usb_up-during-brcmf_bus_prei.patch +++ /dev/null @@ -1,41 +0,0 @@ -From a7f4a80c0070b673d4a4ce94b99979ea6d0c6296 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Tue, 20 Feb 2018 00:14:21 +0100 -Subject: [PATCH] brcmfmac: usb: call brcmf_usb_up() during brcmf_bus_preinit() - -By calling brcmf_usb_up() during brcmf_bus_preinit() it does not need -to be called in brcmf_usb_bus_setup(). - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 7 ++----- - 1 file changed, 2 insertions(+), 5 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c -@@ -1146,8 +1146,9 @@ static int brcmf_usb_get_fwname(struct d - } - - static const struct brcmf_bus_ops brcmf_usb_bus_ops = { -- .txdata = brcmf_usb_tx, -+ .preinit = brcmf_usb_up, - .stop = brcmf_usb_down, -+ .txdata = brcmf_usb_tx, - .txctl = brcmf_usb_tx_ctlpkt, - .rxctl = brcmf_usb_rx_ctlpkt, - .wowl_config = brcmf_usb_wowl_config, -@@ -1165,10 +1166,6 @@ static int brcmf_usb_bus_setup(struct br - return ret; - } - -- ret = brcmf_usb_up(devinfo->dev); -- if (ret) -- goto fail; -- - ret = brcmf_bus_started(devinfo->dev); - if (ret) - goto fail; diff --git a/package/kernel/mac80211/patches/325-v4.17-0005-brcmfmac-move-brcmf_attach-function-in-core.c.patch b/package/kernel/mac80211/patches/325-v4.17-0005-brcmfmac-move-brcmf_attach-function-in-core.c.patch deleted file mode 100644 index 086b5fadcc101d..00000000000000 --- a/package/kernel/mac80211/patches/325-v4.17-0005-brcmfmac-move-brcmf_attach-function-in-core.c.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 0542503c4c164c65cd1567b0f2b3f887af6c81eb Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Tue, 20 Feb 2018 00:14:22 +0100 -Subject: [PATCH] brcmfmac: move brcmf_attach() function in core.c - -Moving the function in preparation of subsequent patch. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/core.c | 98 +++++++++++----------- - 1 file changed, 49 insertions(+), 49 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -992,55 +992,6 @@ static int brcmf_inet6addr_changed(struc - } - #endif - --int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings) --{ -- struct brcmf_pub *drvr = NULL; -- int ret = 0; -- int i; -- -- brcmf_dbg(TRACE, "Enter\n"); -- -- /* Allocate primary brcmf_info */ -- drvr = kzalloc(sizeof(struct brcmf_pub), GFP_ATOMIC); -- if (!drvr) -- return -ENOMEM; -- -- for (i = 0; i < ARRAY_SIZE(drvr->if2bss); i++) -- drvr->if2bss[i] = BRCMF_BSSIDX_INVALID; -- -- mutex_init(&drvr->proto_block); -- -- /* Link to bus module */ -- drvr->hdrlen = 0; -- drvr->bus_if = dev_get_drvdata(dev); -- drvr->bus_if->drvr = drvr; -- drvr->settings = settings; -- -- /* attach debug facilities */ -- brcmf_debug_attach(drvr); -- -- /* Attach and link in the protocol */ -- ret = brcmf_proto_attach(drvr); -- if (ret != 0) { -- brcmf_err("brcmf_prot_attach failed\n"); -- goto fail; -- } -- -- /* Attach to events important for core code */ -- brcmf_fweh_register(drvr, BRCMF_E_PSM_WATCHDOG, -- brcmf_psm_watchdog_notify); -- -- /* attach firmware event handler */ -- brcmf_fweh_attach(drvr); -- -- return ret; -- --fail: -- brcmf_detach(dev); -- -- return ret; --} -- - static int brcmf_revinfo_read(struct seq_file *s, void *data) - { - struct brcmf_bus *bus_if = dev_get_drvdata(s->private); -@@ -1170,6 +1121,55 @@ fail: - - return ret; - } -+ -+int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings) -+{ -+ struct brcmf_pub *drvr = NULL; -+ int ret = 0; -+ int i; -+ -+ brcmf_dbg(TRACE, "Enter\n"); -+ -+ /* Allocate primary brcmf_info */ -+ drvr = kzalloc(sizeof(*drvr), GFP_ATOMIC); -+ if (!drvr) -+ return -ENOMEM; -+ -+ for (i = 0; i < ARRAY_SIZE(drvr->if2bss); i++) -+ drvr->if2bss[i] = BRCMF_BSSIDX_INVALID; -+ -+ mutex_init(&drvr->proto_block); -+ -+ /* Link to bus module */ -+ drvr->hdrlen = 0; -+ drvr->bus_if = dev_get_drvdata(dev); -+ drvr->bus_if->drvr = drvr; -+ drvr->settings = settings; -+ -+ /* attach debug facilities */ -+ brcmf_debug_attach(drvr); -+ -+ /* Attach and link in the protocol */ -+ ret = brcmf_proto_attach(drvr); -+ if (ret != 0) { -+ brcmf_err("brcmf_prot_attach failed\n"); -+ goto fail; -+ } -+ -+ /* Attach to events important for core code */ -+ brcmf_fweh_register(drvr, BRCMF_E_PSM_WATCHDOG, -+ brcmf_psm_watchdog_notify); -+ -+ /* attach firmware event handler */ -+ brcmf_fweh_attach(drvr); -+ -+ return ret; -+ -+fail: -+ brcmf_detach(dev); -+ -+ return ret; -+} - - void brcmf_bus_add_txhdrlen(struct device *dev, uint len) - { diff --git a/package/kernel/mac80211/patches/325-v4.17-0006-brcmfmac-remove-brcmf_bus_started-from-bus-api.patch b/package/kernel/mac80211/patches/325-v4.17-0006-brcmfmac-remove-brcmf_bus_started-from-bus-api.patch deleted file mode 100644 index 6d23ccdac215a8..00000000000000 --- a/package/kernel/mac80211/patches/325-v4.17-0006-brcmfmac-remove-brcmf_bus_started-from-bus-api.patch +++ /dev/null @@ -1,190 +0,0 @@ -From de2a3027f6f15e2f6558dc4d178282ccc1f054db Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Tue, 20 Feb 2018 00:14:23 +0100 -Subject: [PATCH] brcmfmac: remove brcmf_bus_started() from bus api - -No longer needed to call this in bus layer so make it static and call -it in the last phase of brcmf_attach() instead. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 1 - - .../wireless/broadcom/brcm80211/brcmfmac/core.c | 14 +++++++---- - .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 20 +--------------- - .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 10 ++------ - .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 28 ++++------------------ - 5 files changed, 16 insertions(+), 57 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h -@@ -253,7 +253,6 @@ void brcmf_dev_reset(struct device *dev) - /* Configure the "global" bus state used by upper layers */ - void brcmf_bus_change_state(struct brcmf_bus *bus, enum brcmf_bus_state state); - --int brcmf_bus_started(struct device *dev); - s32 brcmf_iovar_data_set(struct device *dev, char *name, void *data, u32 len); - void brcmf_bus_add_txhdrlen(struct device *dev, uint len); - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1022,11 +1022,10 @@ static int brcmf_revinfo_read(struct seq - return 0; - } - --int brcmf_bus_started(struct device *dev) -+static int brcmf_bus_started(struct brcmf_pub *drvr) - { - int ret = -1; -- struct brcmf_bus *bus_if = dev_get_drvdata(dev); -- struct brcmf_pub *drvr = bus_if->drvr; -+ struct brcmf_bus *bus_if = drvr->bus_if; - struct brcmf_if *ifp; - struct brcmf_if *p2p_ifp; - -@@ -1043,7 +1042,7 @@ int brcmf_bus_started(struct device *dev - brcmf_bus_change_state(bus_if, BRCMF_BUS_UP); - - /* do bus specific preinit here */ -- ret = brcmf_bus_preinit(ifp->drvr->bus_if); -+ ret = brcmf_bus_preinit(bus_if); - if (ret < 0) - goto fail; - -@@ -1163,7 +1162,12 @@ int brcmf_attach(struct device *dev, str - /* attach firmware event handler */ - brcmf_fweh_attach(drvr); - -- return ret; -+ ret = brcmf_bus_started(drvr); -+ if (ret != 0) { -+ brcmf_err("dongle is not responding: err=%d\n", ret); -+ goto fail; -+ } -+ return 0; - - fail: - brcmf_detach(dev); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -@@ -1581,24 +1581,6 @@ static void brcmf_pcie_release_resource( - } - - --static int brcmf_pcie_attach_bus(struct brcmf_pciedev_info *devinfo) --{ -- int ret; -- -- /* Attach to the common driver interface */ -- ret = brcmf_attach(&devinfo->pdev->dev, devinfo->settings); -- if (ret) { -- brcmf_err("brcmf_attach failed\n"); -- } else { -- ret = brcmf_bus_started(&devinfo->pdev->dev); -- if (ret) -- brcmf_err("dongle is not responding\n"); -- } -- -- return ret; --} -- -- - static u32 brcmf_pcie_buscore_prep_addr(const struct pci_dev *pdev, u32 addr) - { - u32 ret_addr; -@@ -1735,7 +1717,7 @@ static void brcmf_pcie_setup(struct devi - init_waitqueue_head(&devinfo->mbdata_resp_wait); - - brcmf_pcie_intr_enable(devinfo); -- if (brcmf_pcie_attach_bus(devinfo) == 0) -+ if (brcmf_attach(&devinfo->pdev->dev, devinfo->settings) == 0) - return; - - brcmf_pcie_bus_console_read(devinfo); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -3422,6 +3422,8 @@ static int brcmf_sdio_bus_preinit(struct - if (bus->rxbuf) - bus->rxblen = value; - -+ brcmf_sdio_debugfs_create(bus); -+ - /* the commands below use the terms tx and rx from - * a device perspective, ie. bus:txglom affects the - * bus transfers from device to host. -@@ -4136,14 +4138,6 @@ static void brcmf_sdio_firmware_callback - goto fail; - } - -- brcmf_sdio_debugfs_create(bus); -- -- err = brcmf_bus_started(dev); -- if (err != 0) { -- brcmf_err("dongle is not responding\n"); -- goto fail; -- } -- - /* ready */ - return; - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c -@@ -1155,27 +1155,6 @@ static const struct brcmf_bus_ops brcmf_ - .get_fwname = brcmf_usb_get_fwname, - }; - --static int brcmf_usb_bus_setup(struct brcmf_usbdev_info *devinfo) --{ -- int ret; -- -- /* Attach to the common driver interface */ -- ret = brcmf_attach(devinfo->dev, devinfo->settings); -- if (ret) { -- brcmf_err("brcmf_attach failed\n"); -- return ret; -- } -- -- ret = brcmf_bus_started(devinfo->dev); -- if (ret) -- goto fail; -- -- return 0; --fail: -- brcmf_detach(devinfo->dev); -- return ret; --} -- - static void brcmf_usb_probe_phase2(struct device *dev, int ret, - const struct firmware *fw, - void *nvram, u32 nvlen) -@@ -1203,7 +1182,8 @@ static void brcmf_usb_probe_phase2(struc - if (ret) - goto error; - -- ret = brcmf_usb_bus_setup(devinfo); -+ /* Attach to the common driver interface */ -+ ret = brcmf_attach(devinfo->dev, devinfo->settings); - if (ret) - goto error; - -@@ -1253,7 +1233,7 @@ static int brcmf_usb_probe_cb(struct brc - } - - if (!brcmf_usb_dlneeded(devinfo)) { -- ret = brcmf_usb_bus_setup(devinfo); -+ ret = brcmf_attach(devinfo->dev, devinfo->settings); - if (ret) - goto fail; - /* we are done */ -@@ -1456,7 +1436,7 @@ static int brcmf_usb_resume(struct usb_i - - brcmf_dbg(USB, "Enter\n"); - if (!devinfo->wowl_enabled) -- return brcmf_usb_bus_setup(devinfo); -+ return brcmf_attach(devinfo->dev, devinfo->settings); - - devinfo->bus_pub.state = BRCMFMAC_USB_STATE_UP; - brcmf_usb_rx_fill_all(devinfo); diff --git a/package/kernel/mac80211/patches/325-v4.17-0007-brcmfmac-change-log-level-for-some-low-level-sdio-fu.patch b/package/kernel/mac80211/patches/325-v4.17-0007-brcmfmac-change-log-level-for-some-low-level-sdio-fu.patch deleted file mode 100644 index 344826912d8d60..00000000000000 --- a/package/kernel/mac80211/patches/325-v4.17-0007-brcmfmac-change-log-level-for-some-low-level-sdio-fu.patch +++ /dev/null @@ -1,64 +0,0 @@ -From d678296bfb9a630d0000222fc21f4ed0d0d65332 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Tue, 20 Feb 2018 00:14:24 +0100 -Subject: [PATCH] brcmfmac: change log level for some low-level sdio functions - -Reducing the number of trace level messages in sdio code giving -them sdio log level instead. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -1706,7 +1706,7 @@ brcmf_sdio_read_control(struct brcmf_sdi - u8 *buf = NULL, *rbuf; - int sdret; - -- brcmf_dbg(TRACE, "Enter\n"); -+ brcmf_dbg(SDIO, "Enter\n"); - if (bus->rxblen) - buf = vzalloc(bus->rxblen); - if (!buf) -@@ -1809,7 +1809,7 @@ static uint brcmf_sdio_readframes(struct - struct brcmf_sdio_hdrinfo *rd = &bus->cur_read, rd_new; - u8 head_read = 0; - -- brcmf_dbg(TRACE, "Enter\n"); -+ brcmf_dbg(SDIO, "Enter\n"); - - /* Not finished unless we encounter no more frames indication */ - bus->rxpending = true; -@@ -2344,7 +2344,7 @@ static int brcmf_sdio_tx_ctrlframe(struc - struct brcmf_sdio_hdrinfo hd_info = {0}; - int ret; - -- brcmf_dbg(TRACE, "Enter\n"); -+ brcmf_dbg(SDIO, "Enter\n"); - - /* Back the pointer to make room for bus header */ - frame -= bus->tx_hdrlen; -@@ -2520,7 +2520,7 @@ static void brcmf_sdio_dpc(struct brcmf_ - uint framecnt; /* Temporary counter of tx/rx frames */ - int err = 0; - -- brcmf_dbg(TRACE, "Enter\n"); -+ brcmf_dbg(SDIO, "Enter\n"); - - sdio_claim_host(bus->sdiodev->func1); - -@@ -2605,7 +2605,7 @@ static void brcmf_sdio_dpc(struct brcmf_ - - /* Would be active due to wake-wlan in gSPI */ - if (intstatus & I_CHIPACTIVE) { -- brcmf_dbg(INFO, "Dongle reports CHIPACTIVE\n"); -+ brcmf_dbg(SDIO, "Dongle reports CHIPACTIVE\n"); - intstatus &= ~I_CHIPACTIVE; - } - diff --git a/package/kernel/mac80211/patches/325-v4.17-0008-brcmfmac-remove-duplicate-pointer-variable-from-brcm.patch b/package/kernel/mac80211/patches/325-v4.17-0008-brcmfmac-remove-duplicate-pointer-variable-from-brcm.patch deleted file mode 100644 index 39fba211fec381..00000000000000 --- a/package/kernel/mac80211/patches/325-v4.17-0008-brcmfmac-remove-duplicate-pointer-variable-from-brcm.patch +++ /dev/null @@ -1,126 +0,0 @@ -From 2d6edad4b2da1991f74e7b02053eeb4a043b887f Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Tue, 20 Feb 2018 00:14:25 +0100 -Subject: [PATCH] brcmfmac: remove duplicate pointer variable from - brcmf_sdio_firmware_callback() - -In brcmf_sdio_firmware_callback() two pointer variables were used -pointing to the same construct. Get rid of sdiodev variable. - -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 37 +++++++++++----------- - 1 file changed, 18 insertions(+), 19 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -4039,9 +4039,8 @@ static void brcmf_sdio_firmware_callback - void *nvram, u32 nvram_len) - { - struct brcmf_bus *bus_if = dev_get_drvdata(dev); -- struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; -- struct brcmf_sdio *bus = sdiodev->bus; -- struct brcmf_sdio_dev *sdiod = bus->sdiodev; -+ struct brcmf_sdio_dev *sdiod = bus_if->bus_priv.sdio; -+ struct brcmf_sdio *bus = sdiod->bus; - struct brcmf_core *core = bus->sdio_core; - u8 saveclk; - -@@ -4061,7 +4060,7 @@ static void brcmf_sdio_firmware_callback - bus->sdcnt.tickcnt = 0; - brcmf_sdio_wd_timer(bus, true); - -- sdio_claim_host(sdiodev->func1); -+ sdio_claim_host(sdiod->func1); - - /* Make sure backplane clock is on, needed to generate F2 interrupt */ - brcmf_sdio_clkctl(bus, CLK_AVAIL, false); -@@ -4069,9 +4068,9 @@ static void brcmf_sdio_firmware_callback - goto release; - - /* Force clocks on backplane to be sure F2 interrupt propagates */ -- saveclk = brcmf_sdiod_readb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, &err); -+ saveclk = brcmf_sdiod_readb(sdiod, SBSDIO_FUNC1_CHIPCLKCSR, &err); - if (!err) { -- brcmf_sdiod_writeb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, -+ brcmf_sdiod_writeb(sdiod, SBSDIO_FUNC1_CHIPCLKCSR, - (saveclk | SBSDIO_FORCE_HT), &err); - } - if (err) { -@@ -4083,7 +4082,7 @@ static void brcmf_sdio_firmware_callback - brcmf_sdiod_writel(sdiod, core->base + SD_REG(tosbmailboxdata), - SDPCM_PROT_VERSION << SMB_DATA_VERSION_SHIFT, NULL); - -- err = sdio_enable_func(sdiodev->func2); -+ err = sdio_enable_func(sdiod->func2); - - brcmf_dbg(INFO, "enable F2: err=%d\n", err); - -@@ -4095,10 +4094,10 @@ static void brcmf_sdio_firmware_callback - bus->hostintmask, NULL); - - -- brcmf_sdiod_writeb(sdiodev, SBSDIO_WATERMARK, 8, &err); -+ brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK, 8, &err); - } else { - /* Disable F2 again */ -- sdio_disable_func(sdiodev->func2); -+ sdio_disable_func(sdiod->func2); - goto release; - } - -@@ -4106,7 +4105,7 @@ static void brcmf_sdio_firmware_callback - brcmf_sdio_sr_init(bus); - } else { - /* Restore previous clock setting */ -- brcmf_sdiod_writeb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, -+ brcmf_sdiod_writeb(sdiod, SBSDIO_FUNC1_CHIPCLKCSR, - saveclk, &err); - } - -@@ -4114,7 +4113,7 @@ static void brcmf_sdio_firmware_callback - /* Allow full data communication using DPC from now on. */ - brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DATA); - -- err = brcmf_sdiod_intr_register(sdiodev); -+ err = brcmf_sdiod_intr_register(sdiod); - if (err != 0) - brcmf_err("intr register failed:%d\n", err); - } -@@ -4123,16 +4122,16 @@ static void brcmf_sdio_firmware_callback - if (err != 0) - brcmf_sdio_clkctl(bus, CLK_NONE, false); - -- sdio_release_host(sdiodev->func1); -+ sdio_release_host(sdiod->func1); - - /* Assign bus interface call back */ -- sdiodev->bus_if->dev = sdiodev->dev; -- sdiodev->bus_if->ops = &brcmf_sdio_bus_ops; -- sdiodev->bus_if->chip = bus->ci->chip; -- sdiodev->bus_if->chiprev = bus->ci->chiprev; -+ sdiod->bus_if->dev = sdiod->dev; -+ sdiod->bus_if->ops = &brcmf_sdio_bus_ops; -+ sdiod->bus_if->chip = bus->ci->chip; -+ sdiod->bus_if->chiprev = bus->ci->chiprev; - - /* Attach to the common layer, reserve hdr space */ -- err = brcmf_attach(sdiodev->dev, sdiodev->settings); -+ err = brcmf_attach(sdiod->dev, sdiod->settings); - if (err != 0) { - brcmf_err("brcmf_attach failed\n"); - goto fail; -@@ -4142,10 +4141,10 @@ static void brcmf_sdio_firmware_callback - return; - - release: -- sdio_release_host(sdiodev->func1); -+ sdio_release_host(sdiod->func1); - fail: - brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), err); -- device_release_driver(&sdiodev->func2->dev); -+ device_release_driver(&sdiod->func2->dev); - device_release_driver(dev); - } - diff --git a/package/kernel/mac80211/patches/326-v4.17-0001-brcmfmac-reject-too-long-PSK.patch b/package/kernel/mac80211/patches/326-v4.17-0001-brcmfmac-reject-too-long-PSK.patch deleted file mode 100644 index b83f2fce8be526..00000000000000 --- a/package/kernel/mac80211/patches/326-v4.17-0001-brcmfmac-reject-too-long-PSK.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 64d1519edc959f5b8f86a66a51c40971c215e4ec Mon Sep 17 00:00:00 2001 -From: Johannes Berg -Date: Mon, 19 Feb 2018 13:30:45 +0100 -Subject: [PATCH] brcmfmac: reject too long PSK - -nl80211 already allows specifying 48 bytes, but brcmfmac -only supports 32. Reject keys that are too long. - -Signed-off-by: Johannes Berg -Acked-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -5125,6 +5125,9 @@ static int brcmf_cfg80211_set_pmk(struct - if (WARN_ON(ifp->vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_1X)) - return -EINVAL; - -+ if (conf->pmk_len > BRCMF_WSEC_MAX_PSK_LEN) -+ return -ERANGE; -+ - return brcmf_set_pmk(ifp, conf->pmk, conf->pmk_len); - } - diff --git a/package/kernel/mac80211/patches/327-v4.17-0001-brcmfmac-do-not-convert-linux-error-to-firmware-erro.patch b/package/kernel/mac80211/patches/327-v4.17-0001-brcmfmac-do-not-convert-linux-error-to-firmware-erro.patch deleted file mode 100644 index 2e9ec8b9634703..00000000000000 --- a/package/kernel/mac80211/patches/327-v4.17-0001-brcmfmac-do-not-convert-linux-error-to-firmware-erro.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 1170f6d1be6a39e1a115a2c0f50923eb4ce2a7ec Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Thu, 22 Mar 2018 21:28:20 +0100 -Subject: [PATCH] brcmfmac: do not convert linux error to firmware error string - -In case of a linux error brcmf_fil_cmd_data() blurts an error message -in which the error code is translated to an error string. However, it -maps it to a firmware error string which should not happen. Simply -print only the numeric error code and be done with it. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c -@@ -124,8 +124,7 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp, - data, len, &fwerr); - - if (err) { -- brcmf_dbg(FIL, "Failed: %s (%d)\n", -- brcmf_fil_get_errstr((u32)(-err)), err); -+ brcmf_dbg(FIL, "Failed: error=%d\n", err); - } else if (fwerr < 0) { - brcmf_dbg(FIL, "Firmware error: %s (%d)\n", - brcmf_fil_get_errstr((u32)(-fwerr)), fwerr); diff --git a/package/kernel/mac80211/patches/327-v4.17-0002-brcmfmac-use-brcmf_chip_name-to-store-name-in-revinf.patch b/package/kernel/mac80211/patches/327-v4.17-0002-brcmfmac-use-brcmf_chip_name-to-store-name-in-revinf.patch deleted file mode 100644 index 790811957a7302..00000000000000 --- a/package/kernel/mac80211/patches/327-v4.17-0002-brcmfmac-use-brcmf_chip_name-to-store-name-in-revinf.patch +++ /dev/null @@ -1,203 +0,0 @@ -From 756a2b390874d274f2f615921318ef0856ff9313 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Thu, 22 Mar 2018 21:28:21 +0100 -Subject: [PATCH] brcmfmac: use brcmf_chip_name() to store name in revinfo - -The chip id can either be four or five digits. For the chip name either -the hexadecimal value needs to be taken (four digits) or the decimal -value (five digits). The function brcmf_chip_name() does this conversion -so use it to store the name in driver revision info. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/chip.c | 9 +++++---- - .../wireless/broadcom/brcm80211/brcmfmac/chip.h | 3 ++- - .../wireless/broadcom/brcm80211/brcmfmac/common.c | 23 ++++++++++++++++------ - .../wireless/broadcom/brcm80211/brcmfmac/core.c | 10 +--------- - .../wireless/broadcom/brcm80211/brcmfmac/core.h | 3 +-- - 5 files changed, 26 insertions(+), 22 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c -@@ -464,12 +464,12 @@ static void brcmf_chip_ai_resetcore(stru - ci->ops->read32(ci->ctx, core->wrapbase + BCMA_IOCTL); - } - --static char *brcmf_chip_name(uint chipid, char *buf, uint len) -+char *brcmf_chip_name(u32 id, u32 rev, char *buf, uint len) - { - const char *fmt; - -- fmt = ((chipid > 0xa000) || (chipid < 0x4000)) ? "%d" : "%x"; -- snprintf(buf, len, fmt, chipid); -+ fmt = ((id > 0xa000) || (id < 0x4000)) ? "BCM%d/%u" : "BCM%x/%u"; -+ snprintf(buf, len, fmt, id, rev); - return buf; - } - -@@ -924,7 +924,8 @@ static int brcmf_chip_recognition(struct - ci->pub.chiprev = (regdata & CID_REV_MASK) >> CID_REV_SHIFT; - socitype = (regdata & CID_TYPE_MASK) >> CID_TYPE_SHIFT; - -- brcmf_chip_name(ci->pub.chip, ci->pub.name, sizeof(ci->pub.name)); -+ brcmf_chip_name(ci->pub.chip, ci->pub.chiprev, -+ ci->pub.name, sizeof(ci->pub.name)); - brcmf_dbg(INFO, "found %s chip: BCM%s, rev=%d\n", - socitype == SOCI_SB ? "SB" : "AXI", ci->pub.name, - ci->pub.chiprev); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h -@@ -45,7 +45,7 @@ struct brcmf_chip { - u32 rambase; - u32 ramsize; - u32 srsize; -- char name[8]; -+ char name[12]; - }; - - /** -@@ -93,5 +93,6 @@ void brcmf_chip_resetcore(struct brcmf_c - void brcmf_chip_set_passive(struct brcmf_chip *ci); - bool brcmf_chip_set_active(struct brcmf_chip *ci, u32 rstvec); - bool brcmf_chip_sr_capable(struct brcmf_chip *pub); -+char *brcmf_chip_name(u32 chipid, u32 chiprev, char *buf, uint len); - - #endif /* BRCMF_AXIDMP_H */ ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -@@ -30,6 +30,7 @@ - #include "common.h" - #include "of.h" - #include "firmware.h" -+#include "chip.h" - - MODULE_AUTHOR("Broadcom Corporation"); - MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver."); -@@ -131,14 +132,13 @@ static int brcmf_c_download(struct brcmf - static int brcmf_c_get_clm_name(struct brcmf_if *ifp, u8 *clm_name) - { - struct brcmf_bus *bus = ifp->drvr->bus_if; -- struct brcmf_rev_info *ri = &ifp->drvr->revinfo; - u8 fw_name[BRCMF_FW_NAME_LEN]; - u8 *ptr; - size_t len; - s32 err; - - memset(fw_name, 0, BRCMF_FW_NAME_LEN); -- err = brcmf_bus_get_fwname(bus, ri->chipnum, ri->chiprev, fw_name); -+ err = brcmf_bus_get_fwname(bus, bus->chip, bus->chiprev, fw_name); - if (err) { - brcmf_err("get firmware name failed (%d)\n", err); - goto done; -@@ -238,6 +238,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i - { - s8 eventmask[BRCMF_EVENTING_MASK_LEN]; - u8 buf[BRCMF_DCMD_SMLEN]; -+ struct brcmf_bus *bus; - struct brcmf_rev_info_le revinfo; - struct brcmf_rev_info *ri; - char *clmver; -@@ -253,16 +254,18 @@ int brcmf_c_preinit_dcmds(struct brcmf_i - } - memcpy(ifp->drvr->mac, ifp->mac_addr, sizeof(ifp->drvr->mac)); - -+ bus = ifp->drvr->bus_if; -+ ri = &ifp->drvr->revinfo; -+ - err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_REVINFO, - &revinfo, sizeof(revinfo)); -- ri = &ifp->drvr->revinfo; - if (err < 0) { - brcmf_err("retrieving revision info failed, %d\n", err); -+ strlcpy(ri->chipname, "UNKNOWN", sizeof(ri->chipname)); - } else { - ri->vendorid = le32_to_cpu(revinfo.vendorid); - ri->deviceid = le32_to_cpu(revinfo.deviceid); - ri->radiorev = le32_to_cpu(revinfo.radiorev); -- ri->chiprev = le32_to_cpu(revinfo.chiprev); - ri->corerev = le32_to_cpu(revinfo.corerev); - ri->boardid = le32_to_cpu(revinfo.boardid); - ri->boardvendor = le32_to_cpu(revinfo.boardvendor); -@@ -270,15 +273,23 @@ int brcmf_c_preinit_dcmds(struct brcmf_i - ri->driverrev = le32_to_cpu(revinfo.driverrev); - ri->ucoderev = le32_to_cpu(revinfo.ucoderev); - ri->bus = le32_to_cpu(revinfo.bus); -- ri->chipnum = le32_to_cpu(revinfo.chipnum); - ri->phytype = le32_to_cpu(revinfo.phytype); - ri->phyrev = le32_to_cpu(revinfo.phyrev); - ri->anarev = le32_to_cpu(revinfo.anarev); - ri->chippkg = le32_to_cpu(revinfo.chippkg); - ri->nvramrev = le32_to_cpu(revinfo.nvramrev); -+ -+ if (!bus->chip) { -+ bus->chip = le32_to_cpu(revinfo.chipnum); -+ bus->chiprev = le32_to_cpu(revinfo.chiprev); -+ } - } - ri->result = err; - -+ if (bus->chip) -+ brcmf_chip_name(bus->chip, bus->chiprev, -+ ri->chipname, sizeof(ri->chipname)); -+ - /* Do any CLM downloading */ - err = brcmf_c_process_clm_blob(ifp); - if (err < 0) { -@@ -299,7 +310,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i - strsep(&ptr, "\n"); - - /* Print fw version info */ -- brcmf_info("Firmware version = %s\n", buf); -+ brcmf_info("Firmware: %s %s\n", ri->chipname, buf); - - /* locate firmware version number for ethtool */ - ptr = strrchr(buf, ' ') + 1; ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1002,8 +1002,7 @@ static int brcmf_revinfo_read(struct seq - seq_printf(s, "vendorid: 0x%04x\n", ri->vendorid); - seq_printf(s, "deviceid: 0x%04x\n", ri->deviceid); - seq_printf(s, "radiorev: %s\n", brcmu_dotrev_str(ri->radiorev, drev)); -- seq_printf(s, "chipnum: %u (%x)\n", ri->chipnum, ri->chipnum); -- seq_printf(s, "chiprev: %u\n", ri->chiprev); -+ seq_printf(s, "chip: %s\n", ri->chipname); - seq_printf(s, "chippkg: %u\n", ri->chippkg); - seq_printf(s, "corerev: %u\n", ri->corerev); - seq_printf(s, "boardid: 0x%04x\n", ri->boardid); -@@ -1053,13 +1052,6 @@ static int brcmf_bus_started(struct brcm - - brcmf_debugfs_add_entry(drvr, "revinfo", brcmf_revinfo_read); - -- /* assure we have chipid before feature attach */ -- if (!bus_if->chip) { -- bus_if->chip = drvr->revinfo.chipnum; -- bus_if->chiprev = drvr->revinfo.chiprev; -- brcmf_dbg(INFO, "firmware revinfo: chip %x (%d) rev %d\n", -- bus_if->chip, bus_if->chip, bus_if->chiprev); -- } - brcmf_feat_attach(drvr); - - ret = brcmf_proto_init_done(drvr); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -@@ -87,7 +87,6 @@ struct brcmf_rev_info { - u32 vendorid; - u32 deviceid; - u32 radiorev; -- u32 chiprev; - u32 corerev; - u32 boardid; - u32 boardvendor; -@@ -95,7 +94,7 @@ struct brcmf_rev_info { - u32 driverrev; - u32 ucoderev; - u32 bus; -- u32 chipnum; -+ char chipname[12]; - u32 phytype; - u32 phyrev; - u32 anarev; diff --git a/package/kernel/mac80211/patches/327-v4.17-0003-brcmfmac-use-brcmf_chip_name-for-consistency.patch b/package/kernel/mac80211/patches/327-v4.17-0003-brcmfmac-use-brcmf_chip_name-for-consistency.patch deleted file mode 100644 index e3d06f32cc66aa..00000000000000 --- a/package/kernel/mac80211/patches/327-v4.17-0003-brcmfmac-use-brcmf_chip_name-for-consistency.patch +++ /dev/null @@ -1,69 +0,0 @@ -From c88cfa075de356ddf40c668896b2126340f19ba4 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Thu, 22 Mar 2018 21:28:22 +0100 -Subject: [PATCH] brcmfmac: use brcmf_chip_name() for consistency - -When logging the chip id/revision information make use of -brcmf_chip_name() so it is always the same. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 5 ++--- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 7 +++++-- - 2 files changed, 7 insertions(+), 5 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c -@@ -926,9 +926,8 @@ static int brcmf_chip_recognition(struct - - brcmf_chip_name(ci->pub.chip, ci->pub.chiprev, - ci->pub.name, sizeof(ci->pub.name)); -- brcmf_dbg(INFO, "found %s chip: BCM%s, rev=%d\n", -- socitype == SOCI_SB ? "SB" : "AXI", ci->pub.name, -- ci->pub.chiprev); -+ brcmf_dbg(INFO, "found %s chip: %s\n", -+ socitype == SOCI_SB ? "SB" : "AXI", ci->pub.name); - - if (socitype == SOCI_SB) { - if (ci->pub.chip != BRCM_CC_4329_CHIP_ID) { ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -@@ -25,6 +25,7 @@ - #include "firmware.h" - #include "core.h" - #include "common.h" -+#include "chip.h" - - #define BRCMF_FW_MAX_NVRAM_SIZE 64000 - #define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */ -@@ -567,6 +568,7 @@ int brcmf_fw_map_chip_to_name(u32 chip, - u32 table_size, char fw_name[BRCMF_FW_NAME_LEN], - char nvram_name[BRCMF_FW_NAME_LEN]) - { -+ char chipname[12]; - u32 i; - char end; - -@@ -581,6 +583,8 @@ int brcmf_fw_map_chip_to_name(u32 chip, - return -ENODEV; - } - -+ brcmf_chip_name(chip, chiprev, chipname, sizeof(chipname)); -+ - /* check if firmware path is provided by module parameter */ - if (brcmf_mp_global.firmware_path[0] != '\0') { - strlcpy(fw_name, brcmf_mp_global.firmware_path, -@@ -601,8 +605,7 @@ int brcmf_fw_map_chip_to_name(u32 chip, - if ((nvram_name) && (mapping_table[i].nvram)) - strlcat(nvram_name, mapping_table[i].nvram, BRCMF_FW_NAME_LEN); - -- brcmf_info("using %s for chip %#08x(%d) rev %#08x\n", -- fw_name, chip, chip, chiprev); -+ brcmf_info("using %s for chip %s\n", fw_name, chipname); - - return 0; - } diff --git a/package/kernel/mac80211/patches/327-v4.17-0004-brcmfmac-allocate-struct-brcmf_pub-instance-using-wi.patch b/package/kernel/mac80211/patches/327-v4.17-0004-brcmfmac-allocate-struct-brcmf_pub-instance-using-wi.patch deleted file mode 100644 index 42adff61b9db87..00000000000000 --- a/package/kernel/mac80211/patches/327-v4.17-0004-brcmfmac-allocate-struct-brcmf_pub-instance-using-wi.patch +++ /dev/null @@ -1,452 +0,0 @@ -From 856d5a011c86b59f6564be4508912fb1d866adfc Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Thu, 22 Mar 2018 21:28:23 +0100 -Subject: [PATCH] brcmfmac: allocate struct brcmf_pub instance using - wiphy_new() - -Rework the driver so the wiphy instance holds the main driver information -in its private buffer. Previously it held struct brcmf_cfg80211_info -instance so a bit of reorg was needed. This was done so that the wiphy -name or its parent device can be shown in debug output. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/btcoex.c | 2 +- - .../broadcom/brcm80211/brcmfmac/cfg80211.c | 86 ++++++++++------------ - .../broadcom/brcm80211/brcmfmac/cfg80211.h | 17 +++-- - .../wireless/broadcom/brcm80211/brcmfmac/common.c | 2 + - .../wireless/broadcom/brcm80211/brcmfmac/core.c | 27 +++++-- - .../wireless/broadcom/brcm80211/brcmfmac/core.h | 1 + - .../net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 2 +- - 7 files changed, 76 insertions(+), 61 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/btcoex.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/btcoex.c -@@ -462,7 +462,7 @@ static void brcmf_btcoex_dhcp_end(struct - int brcmf_btcoex_set_mode(struct brcmf_cfg80211_vif *vif, - enum brcmf_btcoex_mode mode, u16 duration) - { -- struct brcmf_cfg80211_info *cfg = wiphy_priv(vif->wdev.wiphy); -+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy); - struct brcmf_btcoex_info *btci = cfg->btcoex; - struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -753,7 +753,7 @@ s32 brcmf_notify_escan_complete(struct b - static int brcmf_cfg80211_del_ap_iface(struct wiphy *wiphy, - struct wireless_dev *wdev) - { -- struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); -+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct net_device *ndev = wdev->netdev; - struct brcmf_if *ifp = netdev_priv(ndev); - int ret; -@@ -786,7 +786,7 @@ err_unarm: - static - int brcmf_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev) - { -- struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); -+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct net_device *ndev = wdev->netdev; - - if (ndev && ndev == cfg_to_ndev(cfg)) -@@ -831,7 +831,7 @@ brcmf_cfg80211_change_iface(struct wiphy - enum nl80211_iftype type, - struct vif_params *params) - { -- struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); -+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct brcmf_if *ifp = netdev_priv(ndev); - struct brcmf_cfg80211_vif *vif = ifp->vif; - s32 infra = 0; -@@ -2127,17 +2127,15 @@ static s32 - brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, - s32 *dbm) - { -- struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); -- struct net_device *ndev = cfg_to_ndev(cfg); -- struct brcmf_if *ifp = netdev_priv(ndev); -+ struct brcmf_cfg80211_vif *vif = wdev_to_vif(wdev); - s32 qdbm = 0; - s32 err; - - brcmf_dbg(TRACE, "Enter\n"); -- if (!check_vif_up(ifp->vif)) -+ if (!check_vif_up(vif)) - return -EIO; - -- err = brcmf_fil_iovar_int_get(ifp, "qtxpower", &qdbm); -+ err = brcmf_fil_iovar_int_get(vif->ifp, "qtxpower", &qdbm); - if (err) { - brcmf_err("error (%d)\n", err); - goto done; -@@ -3359,7 +3357,7 @@ brcmf_cfg80211_sched_scan_start(struct w - struct cfg80211_sched_scan_request *req) - { - struct brcmf_if *ifp = netdev_priv(ndev); -- struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); -+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - - brcmf_dbg(SCAN, "Enter: n_match_sets=%d n_ssids=%d\n", - req->n_match_sets, req->n_ssids); -@@ -5191,6 +5189,12 @@ static struct cfg80211_ops brcmf_cfg8021 - .del_pmk = brcmf_cfg80211_del_pmk, - }; - -+struct cfg80211_ops *brcmf_cfg80211_get_ops(void) -+{ -+ return kmemdup(&brcmf_cfg80211_ops, sizeof(brcmf_cfg80211_ops), -+ GFP_KERNEL); -+} -+ - struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg, - enum nl80211_iftype type) - { -@@ -5898,7 +5902,7 @@ static void brcmf_update_bw40_channel_fl - static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg, - u32 bw_cap[]) - { -- struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); -+ struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); - struct ieee80211_supported_band *band; - struct ieee80211_channel *channel; - struct wiphy *wiphy; -@@ -6013,7 +6017,7 @@ fail_pbuf: - - static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg) - { -- struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); -+ struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); - struct ieee80211_supported_band *band; - struct brcmf_fil_bwcap_le band_bwcap; - struct brcmf_chanspec_list *list; -@@ -6198,10 +6202,10 @@ static void brcmf_update_vht_cap(struct - } - } - --static int brcmf_setup_wiphybands(struct wiphy *wiphy) -+static int brcmf_setup_wiphybands(struct brcmf_cfg80211_info *cfg) - { -- struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); -- struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); -+ struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); -+ struct wiphy *wiphy; - u32 nmode = 0; - u32 vhtmode = 0; - u32 bw_cap[2] = { WLC_BW_20MHZ_BIT, WLC_BW_20MHZ_BIT }; -@@ -6795,8 +6799,8 @@ static s32 brcmf_translate_country_code( - static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy, - struct regulatory_request *req) - { -- struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); -- struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); -+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); -+ struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); - struct brcmf_fil_country_le ccreq; - s32 err; - int i; -@@ -6831,7 +6835,7 @@ static void brcmf_cfg80211_reg_notifier( - brcmf_err("Firmware rejected country setting\n"); - return; - } -- brcmf_setup_wiphybands(wiphy); -+ brcmf_setup_wiphybands(cfg); - } - - static void brcmf_free_wiphy(struct wiphy *wiphy) -@@ -6858,17 +6862,15 @@ static void brcmf_free_wiphy(struct wiph - if (wiphy->wowlan != &brcmf_wowlan_support) - kfree(wiphy->wowlan); - #endif -- wiphy_free(wiphy); - } - - struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr, -- struct device *busdev, -+ struct cfg80211_ops *ops, - bool p2pdev_forced) - { -+ struct wiphy *wiphy = drvr->wiphy; - struct net_device *ndev = brcmf_get_ifp(drvr, 0)->ndev; - struct brcmf_cfg80211_info *cfg; -- struct wiphy *wiphy; -- struct cfg80211_ops *ops; - struct brcmf_cfg80211_vif *vif; - struct brcmf_if *ifp; - s32 err = 0; -@@ -6880,26 +6882,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802 - return NULL; - } - -- ops = kmemdup(&brcmf_cfg80211_ops, sizeof(*ops), GFP_KERNEL); -- if (!ops) -- return NULL; -- -- ifp = netdev_priv(ndev); --#ifdef CONFIG_PM -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_GTK)) -- ops->set_rekey_data = brcmf_cfg80211_set_rekey_data; --#endif -- wiphy = wiphy_new(ops, sizeof(struct brcmf_cfg80211_info)); -- if (!wiphy) { -+ cfg = kzalloc(sizeof(*cfg), GFP_KERNEL); -+ if (!cfg) { - brcmf_err("Could not allocate wiphy device\n"); -- goto ops_out; -+ return NULL; - } -- memcpy(wiphy->perm_addr, drvr->mac, ETH_ALEN); -- set_wiphy_dev(wiphy, busdev); - -- cfg = wiphy_priv(wiphy); - cfg->wiphy = wiphy; -- cfg->ops = ops; - cfg->pub = drvr; - init_vif_event(&cfg->vif_event); - INIT_LIST_HEAD(&cfg->vif_list); -@@ -6908,6 +6897,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802 - if (IS_ERR(vif)) - goto wiphy_out; - -+ ifp = netdev_priv(ndev); - vif->ifp = ifp; - vif->wdev.netdev = ndev; - ndev->ieee80211_ptr = &vif->wdev; -@@ -6934,6 +6924,11 @@ struct brcmf_cfg80211_info *brcmf_cfg802 - if (err < 0) - goto priv_out; - -+ /* regulatory notifer below needs access to cfg so -+ * assign it now. -+ */ -+ drvr->config = cfg; -+ - brcmf_dbg(INFO, "Registering custom regulatory\n"); - wiphy->reg_notifier = brcmf_cfg80211_reg_notifier; - wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG; -@@ -6947,13 +6942,17 @@ struct brcmf_cfg80211_info *brcmf_cfg802 - cap = &wiphy->bands[NL80211_BAND_2GHZ]->ht_cap.cap; - *cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; - } -+#ifdef CONFIG_PM -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_GTK)) -+ ops->set_rekey_data = brcmf_cfg80211_set_rekey_data; -+#endif - err = wiphy_register(wiphy); - if (err < 0) { - brcmf_err("Could not register wiphy device (%d)\n", err); - goto priv_out; - } - -- err = brcmf_setup_wiphybands(wiphy); -+ err = brcmf_setup_wiphybands(cfg); - if (err) { - brcmf_err("Setting wiphy bands failed (%d)\n", err); - goto wiphy_unreg_out; -@@ -6970,12 +6969,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802 - else - *cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; - } -- /* p2p might require that "if-events" get processed by fweh. So -- * activate the already registered event handlers now and activate -- * the rest when initialization has completed. drvr->config needs to -- * be assigned before activating events. -- */ -- drvr->config = cfg; -+ - err = brcmf_fweh_activate_events(ifp); - if (err) { - brcmf_err("FWEH activation failed (%d)\n", err); -@@ -7043,8 +7037,7 @@ priv_out: - ifp->vif = NULL; - wiphy_out: - brcmf_free_wiphy(wiphy); --ops_out: -- kfree(ops); -+ kfree(cfg); - return NULL; - } - -@@ -7059,4 +7052,5 @@ void brcmf_cfg80211_detach(struct brcmf_ - kfree(cfg->ops); - wl_deinit_priv(cfg); - brcmf_free_wiphy(cfg->wiphy); -+ kfree(cfg); - } ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h -@@ -355,20 +355,24 @@ static inline struct wiphy *cfg_to_wiphy - - static inline struct brcmf_cfg80211_info *wiphy_to_cfg(struct wiphy *w) - { -- return (struct brcmf_cfg80211_info *)(wiphy_priv(w)); -+ struct brcmf_pub *drvr = wiphy_priv(w); -+ return drvr->config; - } - - static inline struct brcmf_cfg80211_info *wdev_to_cfg(struct wireless_dev *wd) - { -- return (struct brcmf_cfg80211_info *)(wdev_priv(wd)); -+ return wiphy_to_cfg(wd->wiphy); -+} -+ -+static inline struct brcmf_cfg80211_vif *wdev_to_vif(struct wireless_dev *wdev) -+{ -+ return container_of(wdev, struct brcmf_cfg80211_vif, wdev); - } - - static inline - struct net_device *cfg_to_ndev(struct brcmf_cfg80211_info *cfg) - { -- struct brcmf_cfg80211_vif *vif; -- vif = list_first_entry(&cfg->vif_list, struct brcmf_cfg80211_vif, list); -- return vif->wdev.netdev; -+ return brcmf_get_ifp(cfg->pub, 0)->ndev; - } - - static inline struct brcmf_cfg80211_info *ndev_to_cfg(struct net_device *ndev) -@@ -395,11 +399,12 @@ brcmf_cfg80211_connect_info *cfg_to_conn - } - - struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr, -- struct device *busdev, -+ struct cfg80211_ops *ops, - bool p2pdev_forced); - void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg); - s32 brcmf_cfg80211_up(struct net_device *ndev); - s32 brcmf_cfg80211_down(struct net_device *ndev); -+struct cfg80211_ops *brcmf_cfg80211_get_ops(void); - enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp); - - struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg, ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -@@ -252,6 +252,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i - brcmf_err("Retreiving cur_etheraddr failed, %d\n", err); - goto done; - } -+ memcpy(ifp->drvr->wiphy->perm_addr, ifp->drvr->mac, ETH_ALEN); - memcpy(ifp->drvr->mac, ifp->mac_addr, sizeof(ifp->drvr->mac)); - - bus = ifp->drvr->bus_if; -@@ -279,6 +280,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i - ri->chippkg = le32_to_cpu(revinfo.chippkg); - ri->nvramrev = le32_to_cpu(revinfo.nvramrev); - -+ /* use revinfo if not known yet */ - if (!bus->chip) { - bus->chip = le32_to_cpu(revinfo.chipnum); - bus->chiprev = le32_to_cpu(revinfo.chiprev); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1021,7 +1021,7 @@ static int brcmf_revinfo_read(struct seq - return 0; - } - --static int brcmf_bus_started(struct brcmf_pub *drvr) -+static int brcmf_bus_started(struct brcmf_pub *drvr, struct cfg80211_ops *ops) - { - int ret = -1; - struct brcmf_bus *bus_if = drvr->bus_if; -@@ -1060,7 +1060,7 @@ static int brcmf_bus_started(struct brcm - - brcmf_proto_add_if(drvr, ifp); - -- drvr->config = brcmf_cfg80211_attach(drvr, bus_if->dev, -+ drvr->config = brcmf_cfg80211_attach(drvr, ops, - drvr->settings->p2p_enable); - if (drvr->config == NULL) { - ret = -ENOMEM; -@@ -1115,17 +1115,26 @@ fail: - - int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings) - { -+ struct wiphy *wiphy; -+ struct cfg80211_ops *ops; - struct brcmf_pub *drvr = NULL; - int ret = 0; - int i; - - brcmf_dbg(TRACE, "Enter\n"); - -- /* Allocate primary brcmf_info */ -- drvr = kzalloc(sizeof(*drvr), GFP_ATOMIC); -- if (!drvr) -+ ops = brcmf_cfg80211_get_ops(); -+ if (!ops) - return -ENOMEM; - -+ wiphy = wiphy_new(ops, sizeof(*drvr)); -+ if (!wiphy) -+ return -ENOMEM; -+ -+ set_wiphy_dev(wiphy, dev); -+ drvr = wiphy_priv(wiphy); -+ drvr->wiphy = wiphy; -+ - for (i = 0; i < ARRAY_SIZE(drvr->if2bss); i++) - drvr->if2bss[i] = BRCMF_BSSIDX_INVALID; - -@@ -1154,15 +1163,18 @@ int brcmf_attach(struct device *dev, str - /* attach firmware event handler */ - brcmf_fweh_attach(drvr); - -- ret = brcmf_bus_started(drvr); -+ ret = brcmf_bus_started(drvr, ops); - if (ret != 0) { - brcmf_err("dongle is not responding: err=%d\n", ret); - goto fail; - } -+ -+ drvr->config->ops = ops; - return 0; - - fail: - brcmf_detach(dev); -+ kfree(ops); - - return ret; - } -@@ -1220,6 +1232,7 @@ void brcmf_detach(struct device *dev) - brcmf_remove_interface(drvr->iflist[i], false); - - brcmf_cfg80211_detach(drvr->config); -+ drvr->config = NULL; - - brcmf_bus_stop(drvr->bus_if); - -@@ -1227,7 +1240,7 @@ void brcmf_detach(struct device *dev) - - brcmf_debug_detach(drvr); - bus_if->drvr = NULL; -- kfree(drvr); -+ wiphy_free(drvr->wiphy); - } - - s32 brcmf_iovar_data_set(struct device *dev, char *name, void *data, u32 len) ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -@@ -107,6 +107,7 @@ struct brcmf_pub { - /* Linkage ponters */ - struct brcmf_bus *bus_if; - struct brcmf_proto *proto; -+ struct wiphy *wiphy; - struct brcmf_cfg80211_info *config; - - /* Internal brcmf items */ ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c -@@ -2229,7 +2229,7 @@ fail: - */ - int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev) - { -- struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); -+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct brcmf_p2p_info *p2p = &cfg->p2p; - struct brcmf_cfg80211_vif *vif; - enum nl80211_iftype iftype; diff --git a/package/kernel/mac80211/patches/327-v4.17-0005-brcmfmac-use-wiphy-debugfs-dir-entry.patch b/package/kernel/mac80211/patches/327-v4.17-0005-brcmfmac-use-wiphy-debugfs-dir-entry.patch deleted file mode 100644 index c5485c390a1b35..00000000000000 --- a/package/kernel/mac80211/patches/327-v4.17-0005-brcmfmac-use-wiphy-debugfs-dir-entry.patch +++ /dev/null @@ -1,349 +0,0 @@ -From 34789d0cf682c643862792750a06c31ccf016cbc Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Thu, 22 Mar 2018 21:28:24 +0100 -Subject: [PATCH] brcmfmac: use wiphy debugfs dir entry - -The driver used to create a brcmfmac dir entry at the top level -debugfs mount point. This moves the debugfs entries into the -wiphy debugfs dir entry. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 6 ++++ - .../wireless/broadcom/brcm80211/brcmfmac/common.c | 5 --- - .../wireless/broadcom/brcm80211/brcmfmac/core.c | 11 +++--- - .../wireless/broadcom/brcm80211/brcmfmac/debug.c | 42 ++-------------------- - .../wireless/broadcom/brcm80211/brcmfmac/debug.h | 17 --------- - .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 3 ++ - .../wireless/broadcom/brcm80211/brcmfmac/feature.h | 7 ++++ - .../broadcom/brcm80211/brcmfmac/fwsignal.c | 11 +++--- - .../broadcom/brcm80211/brcmfmac/fwsignal.h | 1 + - .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 8 +++-- - .../wireless/broadcom/brcm80211/brcmfmac/proto.c | 3 +- - .../wireless/broadcom/brcm80211/brcmfmac/proto.h | 7 ++++ - 12 files changed, 47 insertions(+), 74 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c -@@ -445,6 +445,11 @@ brcmf_proto_bcdc_init_done(struct brcmf_ - return 0; - } - -+static void brcmf_proto_bcdc_debugfs_create(struct brcmf_pub *drvr) -+{ -+ brcmf_fws_debugfs_create(drvr); -+} -+ - int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) - { - struct brcmf_bcdc *bcdc; -@@ -472,6 +477,7 @@ int brcmf_proto_bcdc_attach(struct brcmf - drvr->proto->del_if = brcmf_proto_bcdc_del_if; - drvr->proto->reset_if = brcmf_proto_bcdc_reset_if; - drvr->proto->init_done = brcmf_proto_bcdc_init_done; -+ drvr->proto->debugfs_create = brcmf_proto_bcdc_debugfs_create; - drvr->proto->pd = bcdc; - - drvr->hdrlen += BCDC_HEADER_LEN + BRCMF_PROT_FW_SIGNAL_MAX_TXBYTES; ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -@@ -529,9 +529,6 @@ static int __init brcmfmac_module_init(v - { - int err; - -- /* Initialize debug system first */ -- brcmf_debugfs_init(); -- - /* Get the platform data (if available) for our devices */ - err = platform_driver_probe(&brcmf_pd, brcmf_common_pd_probe); - if (err == -ENODEV) -@@ -543,7 +540,6 @@ static int __init brcmfmac_module_init(v - /* Continue the initialization by registering the different busses */ - err = brcmf_core_init(); - if (err) { -- brcmf_debugfs_exit(); - if (brcmfmac_pdata) - platform_driver_unregister(&brcmf_pd); - } -@@ -556,7 +552,6 @@ static void __exit brcmfmac_module_exit( - brcmf_core_exit(); - if (brcmfmac_pdata) - platform_driver_unregister(&brcmf_pd); -- brcmf_debugfs_exit(); - } - - module_init(brcmfmac_module_init); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1050,8 +1050,6 @@ static int brcmf_bus_started(struct brcm - if (ret < 0) - goto fail; - -- brcmf_debugfs_add_entry(drvr, "revinfo", brcmf_revinfo_read); -- - brcmf_feat_attach(drvr); - - ret = brcmf_proto_init_done(drvr); -@@ -1094,6 +1092,11 @@ static int brcmf_bus_started(struct brcm - #endif - #endif /* CONFIG_INET */ - -+ /* populate debugfs */ -+ brcmf_debugfs_add_entry(drvr, "revinfo", brcmf_revinfo_read); -+ brcmf_feat_debugfs_create(drvr); -+ brcmf_proto_debugfs_create(drvr); -+ - return 0; - - fail: -@@ -1146,9 +1149,6 @@ int brcmf_attach(struct device *dev, str - drvr->bus_if->drvr = drvr; - drvr->settings = settings; - -- /* attach debug facilities */ -- brcmf_debug_attach(drvr); -- - /* Attach and link in the protocol */ - ret = brcmf_proto_attach(drvr); - if (ret != 0) { -@@ -1238,7 +1238,6 @@ void brcmf_detach(struct device *dev) - - brcmf_proto_detach(drvr); - -- brcmf_debug_detach(drvr); - bus_if->drvr = NULL; - wiphy_free(drvr->wiphy); - } ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c -@@ -25,8 +25,6 @@ - #include "fweh.h" - #include "debug.h" - --static struct dentry *root_folder; -- - int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data, - size_t len) - { -@@ -54,44 +52,9 @@ int brcmf_debug_create_memdump(struct br - return 0; - } - --void brcmf_debugfs_init(void) --{ -- root_folder = debugfs_create_dir(KBUILD_MODNAME, NULL); -- if (IS_ERR(root_folder)) -- root_folder = NULL; --} -- --void brcmf_debugfs_exit(void) --{ -- if (!root_folder) -- return; -- -- debugfs_remove_recursive(root_folder); -- root_folder = NULL; --} -- --int brcmf_debug_attach(struct brcmf_pub *drvr) --{ -- struct device *dev = drvr->bus_if->dev; -- -- if (!root_folder) -- return -ENODEV; -- -- drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder); -- return PTR_ERR_OR_ZERO(drvr->dbgfs_dir); --} -- --void brcmf_debug_detach(struct brcmf_pub *drvr) --{ -- brcmf_fweh_unregister(drvr, BRCMF_E_PSM_WATCHDOG); -- -- if (!IS_ERR_OR_NULL(drvr->dbgfs_dir)) -- debugfs_remove_recursive(drvr->dbgfs_dir); --} -- - struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr) - { -- return drvr->dbgfs_dir; -+ return drvr->wiphy->debugfsdir; - } - - int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn, -@@ -99,7 +62,8 @@ int brcmf_debugfs_add_entry(struct brcmf - { - struct dentry *e; - -+ WARN(!drvr->wiphy->debugfsdir, "wiphy not (yet) registered\n"); - e = debugfs_create_devm_seqfile(drvr->bus_if->dev, fn, -- drvr->dbgfs_dir, read_fn); -+ drvr->wiphy->debugfsdir, read_fn); - return PTR_ERR_OR_ZERO(e); - } ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h -@@ -113,29 +113,12 @@ extern int brcmf_msg_level; - struct brcmf_bus; - struct brcmf_pub; - #ifdef DEBUG --void brcmf_debugfs_init(void); --void brcmf_debugfs_exit(void); --int brcmf_debug_attach(struct brcmf_pub *drvr); --void brcmf_debug_detach(struct brcmf_pub *drvr); - struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr); - int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn, - int (*read_fn)(struct seq_file *seq, void *data)); - int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data, - size_t len); - #else --static inline void brcmf_debugfs_init(void) --{ --} --static inline void brcmf_debugfs_exit(void) --{ --} --static inline int brcmf_debug_attach(struct brcmf_pub *drvr) --{ -- return 0; --} --static inline void brcmf_debug_detach(struct brcmf_pub *drvr) --{ --} - static inline - int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn, - int (*read_fn)(struct seq_file *seq, void *data)) ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c -@@ -228,7 +228,10 @@ void brcmf_feat_attach(struct brcmf_pub - /* no quirks */ - break; - } -+} - -+void brcmf_feat_debugfs_create(struct brcmf_pub *drvr) -+{ - brcmf_debugfs_add_entry(drvr, "features", brcmf_feat_debugfs_read); - } - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h -@@ -90,6 +90,13 @@ enum brcmf_feat_quirk { - void brcmf_feat_attach(struct brcmf_pub *drvr); - - /** -+ * brcmf_feat_debugfs_create() - create debugfs entries. -+ * -+ * @drvr: driver instance. -+ */ -+void brcmf_feat_debugfs_create(struct brcmf_pub *drvr); -+ -+/** - * brcmf_feat_is_enabled() - query feature. - * - * @ifp: interface instance. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c -@@ -2399,10 +2399,6 @@ struct brcmf_fws_info *brcmf_fws_attach( - brcmu_pktq_init(&fws->desc.other.psq, BRCMF_FWS_PSQ_PREC_COUNT, - BRCMF_FWS_PSQ_LEN); - -- /* create debugfs file for statistics */ -- brcmf_debugfs_add_entry(drvr, "fws_stats", -- brcmf_debugfs_fws_stats_read); -- - brcmf_dbg(INFO, "%s bdcv2 tlv signaling [%x]\n", - fws->fw_signals ? "enabled" : "disabled", tlv); - return fws; -@@ -2429,6 +2425,13 @@ void brcmf_fws_detach(struct brcmf_fws_i - kfree(fws); - } - -+void brcmf_fws_debugfs_create(struct brcmf_pub *drvr) -+{ -+ /* create debugfs file for statistics */ -+ brcmf_debugfs_add_entry(drvr, "fws_stats", -+ brcmf_debugfs_fws_stats_read); -+} -+ - bool brcmf_fws_queue_skbs(struct brcmf_fws_info *fws) - { - return !fws->avoid_queueing; ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h -@@ -20,6 +20,7 @@ - - struct brcmf_fws_info *brcmf_fws_attach(struct brcmf_pub *drvr); - void brcmf_fws_detach(struct brcmf_fws_info *fws); -+void brcmf_fws_debugfs_create(struct brcmf_pub *drvr); - bool brcmf_fws_queue_skbs(struct brcmf_fws_info *fws); - bool brcmf_fws_fc_active(struct brcmf_fws_info *fws); - void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c -@@ -1418,6 +1418,11 @@ static int brcmf_msgbuf_stats_read(struc - } - #endif - -+static void brcmf_msgbuf_debugfs_create(struct brcmf_pub *drvr) -+{ -+ brcmf_debugfs_add_entry(drvr, "msgbuf_stats", brcmf_msgbuf_stats_read); -+} -+ - int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr) - { - struct brcmf_bus_msgbuf *if_msgbuf; -@@ -1472,6 +1477,7 @@ int brcmf_proto_msgbuf_attach(struct brc - drvr->proto->delete_peer = brcmf_msgbuf_delete_peer; - drvr->proto->add_tdls_peer = brcmf_msgbuf_add_tdls_peer; - drvr->proto->rxreorder = brcmf_msgbuf_rxreorder; -+ drvr->proto->debugfs_create = brcmf_msgbuf_debugfs_create; - drvr->proto->pd = msgbuf; - - init_waitqueue_head(&msgbuf->ioctl_resp_wait); -@@ -1525,8 +1531,6 @@ int brcmf_proto_msgbuf_attach(struct brc - spin_lock_init(&msgbuf->flowring_work_lock); - INIT_LIST_HEAD(&msgbuf->work_queue); - -- brcmf_debugfs_add_entry(drvr, "msgbuf_stats", brcmf_msgbuf_stats_read); -- - return 0; - - fail: ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c -@@ -54,7 +54,8 @@ int brcmf_proto_attach(struct brcmf_pub - if (!proto->tx_queue_data || (proto->hdrpull == NULL) || - (proto->query_dcmd == NULL) || (proto->set_dcmd == NULL) || - (proto->configure_addr_mode == NULL) || -- (proto->delete_peer == NULL) || (proto->add_tdls_peer == NULL)) { -+ (proto->delete_peer == NULL) || (proto->add_tdls_peer == NULL) || -+ (proto->debugfs_create == NULL)) { - brcmf_err("Not all proto handlers have been installed\n"); - goto fail; - } ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h -@@ -48,6 +48,7 @@ struct brcmf_proto { - void (*del_if)(struct brcmf_if *ifp); - void (*reset_if)(struct brcmf_if *ifp); - int (*init_done)(struct brcmf_pub *drvr); -+ void (*debugfs_create)(struct brcmf_pub *drvr); - void *pd; - }; - -@@ -156,4 +157,10 @@ brcmf_proto_init_done(struct brcmf_pub * - return drvr->proto->init_done(drvr); - } - -+static inline void -+brcmf_proto_debugfs_create(struct brcmf_pub *drvr) -+{ -+ drvr->proto->debugfs_create(drvr); -+} -+ - #endif /* BRCMFMAC_PROTO_H */ diff --git a/package/kernel/mac80211/patches/327-v4.17-0006-brcmfmac-derive-firmware-filenames-from-basename-map.patch b/package/kernel/mac80211/patches/327-v4.17-0006-brcmfmac-derive-firmware-filenames-from-basename-map.patch deleted file mode 100644 index 0b1ae56bc06a9b..00000000000000 --- a/package/kernel/mac80211/patches/327-v4.17-0006-brcmfmac-derive-firmware-filenames-from-basename-map.patch +++ /dev/null @@ -1,286 +0,0 @@ -From 41f573dbb534f14e62a4a5411f602c970cad1d77 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Thu, 22 Mar 2018 21:28:25 +0100 -Subject: [PATCH] brcmfmac: derive firmware filenames from basename mapping - -Instead of defining individual filenames for firmware and nvram -use a basename and derive the names from that. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../broadcom/brcm80211/brcmfmac/firmware.c | 31 ++++++--- - .../broadcom/brcm80211/brcmfmac/firmware.h | 24 ++----- - .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 56 ++++++++--------- - .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 73 +++++++++++----------- - .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 10 +-- - 5 files changed, 96 insertions(+), 98 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -@@ -563,6 +563,13 @@ int brcmf_fw_get_firmwares(struct device - 0); - } - -+static void brcmf_fw_get_full_name(char fw_name[BRCMF_FW_NAME_LEN], -+ const char *fw_base, const char *extension) -+{ -+ strlcat(fw_name, fw_base, BRCMF_FW_NAME_LEN); -+ strlcat(fw_name, extension, BRCMF_FW_NAME_LEN); -+} -+ - int brcmf_fw_map_chip_to_name(u32 chip, u32 chiprev, - struct brcmf_firmware_mapping mapping_table[], - u32 table_size, char fw_name[BRCMF_FW_NAME_LEN], -@@ -587,25 +594,31 @@ int brcmf_fw_map_chip_to_name(u32 chip, - - /* check if firmware path is provided by module parameter */ - if (brcmf_mp_global.firmware_path[0] != '\0') { -- strlcpy(fw_name, brcmf_mp_global.firmware_path, -- BRCMF_FW_NAME_LEN); -- if ((nvram_name) && (mapping_table[i].nvram)) -+ if (fw_name) -+ strlcpy(fw_name, brcmf_mp_global.firmware_path, -+ BRCMF_FW_NAME_LEN); -+ if (nvram_name) - strlcpy(nvram_name, brcmf_mp_global.firmware_path, - BRCMF_FW_NAME_LEN); - - end = brcmf_mp_global.firmware_path[ - strlen(brcmf_mp_global.firmware_path) - 1]; - if (end != '/') { -- strlcat(fw_name, "/", BRCMF_FW_NAME_LEN); -- if ((nvram_name) && (mapping_table[i].nvram)) -+ if (fw_name) -+ strlcat(fw_name, "/", BRCMF_FW_NAME_LEN); -+ if (nvram_name) - strlcat(nvram_name, "/", BRCMF_FW_NAME_LEN); - } - } -- strlcat(fw_name, mapping_table[i].fw, BRCMF_FW_NAME_LEN); -- if ((nvram_name) && (mapping_table[i].nvram)) -- strlcat(nvram_name, mapping_table[i].nvram, BRCMF_FW_NAME_LEN); - -- brcmf_info("using %s for chip %s\n", fw_name, chipname); -+ brcmf_info("using %s for chip %s\n", -+ mapping_table[i].fw_base, chipname); -+ if (fw_name) -+ brcmf_fw_get_full_name(fw_name, -+ mapping_table[i].fw_base, ".bin"); -+ if (nvram_name) -+ brcmf_fw_get_full_name(nvram_name, -+ mapping_table[i].fw_base, ".txt"); - - return 0; - } ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h -@@ -38,28 +38,16 @@ - struct brcmf_firmware_mapping { - u32 chipid; - u32 revmask; -- const char *fw; -- const char *nvram; -+ const char *fw_base; - }; - --#define BRCMF_FW_NVRAM_DEF(fw_nvram_name, fw, nvram) \ --static const char BRCM_ ## fw_nvram_name ## _FIRMWARE_NAME[] = \ -- BRCMF_FW_DEFAULT_PATH fw; \ --static const char BRCM_ ## fw_nvram_name ## _NVRAM_NAME[] = \ -- BRCMF_FW_DEFAULT_PATH nvram; \ --MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw); -- --#define BRCMF_FW_DEF(fw_name, fw) \ --static const char BRCM_ ## fw_name ## _FIRMWARE_NAME[] = \ -- BRCMF_FW_DEFAULT_PATH fw; \ --MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw) \ -- --#define BRCMF_FW_NVRAM_ENTRY(chipid, mask, name) \ -- { chipid, mask, \ -- BRCM_ ## name ## _FIRMWARE_NAME, BRCM_ ## name ## _NVRAM_NAME } -+#define BRCMF_FW_DEF(fw_name, fw_base) \ -+static const char BRCM_ ## fw_name ## _FIRMWARE_BASENAME[] = \ -+ BRCMF_FW_DEFAULT_PATH fw_base; \ -+MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw_base ".bin") - - #define BRCMF_FW_ENTRY(chipid, mask, name) \ -- { chipid, mask, BRCM_ ## name ## _FIRMWARE_NAME, NULL } -+ { chipid, mask, BRCM_ ## name ## _FIRMWARE_BASENAME } - - int brcmf_fw_map_chip_to_name(u32 chip, u32 chiprev, - struct brcmf_firmware_mapping mapping_table[], ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -@@ -46,36 +46,36 @@ enum brcmf_pcie_state { - BRCMFMAC_PCIE_STATE_UP - }; - --BRCMF_FW_NVRAM_DEF(43602, "brcmfmac43602-pcie.bin", "brcmfmac43602-pcie.txt"); --BRCMF_FW_NVRAM_DEF(4350, "brcmfmac4350-pcie.bin", "brcmfmac4350-pcie.txt"); --BRCMF_FW_NVRAM_DEF(4350C, "brcmfmac4350c2-pcie.bin", "brcmfmac4350c2-pcie.txt"); --BRCMF_FW_NVRAM_DEF(4356, "brcmfmac4356-pcie.bin", "brcmfmac4356-pcie.txt"); --BRCMF_FW_NVRAM_DEF(43570, "brcmfmac43570-pcie.bin", "brcmfmac43570-pcie.txt"); --BRCMF_FW_NVRAM_DEF(4358, "brcmfmac4358-pcie.bin", "brcmfmac4358-pcie.txt"); --BRCMF_FW_NVRAM_DEF(4359, "brcmfmac4359-pcie.bin", "brcmfmac4359-pcie.txt"); --BRCMF_FW_NVRAM_DEF(4365B, "brcmfmac4365b-pcie.bin", "brcmfmac4365b-pcie.txt"); --BRCMF_FW_NVRAM_DEF(4365C, "brcmfmac4365c-pcie.bin", "brcmfmac4365c-pcie.txt"); --BRCMF_FW_NVRAM_DEF(4366B, "brcmfmac4366b-pcie.bin", "brcmfmac4366b-pcie.txt"); --BRCMF_FW_NVRAM_DEF(4366C, "brcmfmac4366c-pcie.bin", "brcmfmac4366c-pcie.txt"); --BRCMF_FW_NVRAM_DEF(4371, "brcmfmac4371-pcie.bin", "brcmfmac4371-pcie.txt"); -+BRCMF_FW_DEF(43602, "brcmfmac43602-pcie"); -+BRCMF_FW_DEF(4350, "brcmfmac4350-pcie"); -+BRCMF_FW_DEF(4350C, "brcmfmac4350c2-pcie"); -+BRCMF_FW_DEF(4356, "brcmfmac4356-pcie"); -+BRCMF_FW_DEF(43570, "brcmfmac43570-pcie"); -+BRCMF_FW_DEF(4358, "brcmfmac4358-pcie"); -+BRCMF_FW_DEF(4359, "brcmfmac4359-pcie"); -+BRCMF_FW_DEF(4365B, "brcmfmac4365b-pcie"); -+BRCMF_FW_DEF(4365C, "brcmfmac4365c-pcie"); -+BRCMF_FW_DEF(4366B, "brcmfmac4366b-pcie"); -+BRCMF_FW_DEF(4366C, "brcmfmac4366c-pcie"); -+BRCMF_FW_DEF(4371, "brcmfmac4371-pcie"); - - static struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = { -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43602_CHIP_ID, 0xFFFFFFFF, 43602), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43465_CHIP_ID, 0xFFFFFFF0, 4366C), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4350_CHIP_ID, 0x000000FF, 4350C), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4350_CHIP_ID, 0xFFFFFF00, 4350), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43525_CHIP_ID, 0xFFFFFFF0, 4365C), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43567_CHIP_ID, 0xFFFFFFFF, 43570), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43569_CHIP_ID, 0xFFFFFFFF, 43570), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43570_CHIP_ID, 0xFFFFFFFF, 43570), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4358_CHIP_ID, 0xFFFFFFFF, 4358), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4359_CHIP_ID, 0xFFFFFFFF, 4359), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4365_CHIP_ID, 0x0000000F, 4365B), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4365_CHIP_ID, 0xFFFFFFF0, 4365C), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0x0000000F, 4366B), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFF0, 4366C), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371), -+ BRCMF_FW_ENTRY(BRCM_CC_43602_CHIP_ID, 0xFFFFFFFF, 43602), -+ BRCMF_FW_ENTRY(BRCM_CC_43465_CHIP_ID, 0xFFFFFFF0, 4366C), -+ BRCMF_FW_ENTRY(BRCM_CC_4350_CHIP_ID, 0x000000FF, 4350C), -+ BRCMF_FW_ENTRY(BRCM_CC_4350_CHIP_ID, 0xFFFFFF00, 4350), -+ BRCMF_FW_ENTRY(BRCM_CC_43525_CHIP_ID, 0xFFFFFFF0, 4365C), -+ BRCMF_FW_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356), -+ BRCMF_FW_ENTRY(BRCM_CC_43567_CHIP_ID, 0xFFFFFFFF, 43570), -+ BRCMF_FW_ENTRY(BRCM_CC_43569_CHIP_ID, 0xFFFFFFFF, 43570), -+ BRCMF_FW_ENTRY(BRCM_CC_43570_CHIP_ID, 0xFFFFFFFF, 43570), -+ BRCMF_FW_ENTRY(BRCM_CC_4358_CHIP_ID, 0xFFFFFFFF, 4358), -+ BRCMF_FW_ENTRY(BRCM_CC_4359_CHIP_ID, 0xFFFFFFFF, 4359), -+ BRCMF_FW_ENTRY(BRCM_CC_4365_CHIP_ID, 0x0000000F, 4365B), -+ BRCMF_FW_ENTRY(BRCM_CC_4365_CHIP_ID, 0xFFFFFFF0, 4365C), -+ BRCMF_FW_ENTRY(BRCM_CC_4366_CHIP_ID, 0x0000000F, 4366B), -+ BRCMF_FW_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFF0, 4366C), -+ BRCMF_FW_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371), - }; - - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */ ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -600,47 +600,44 @@ static const struct sdiod_drive_str sdio - {4, 0x1} - }; - --BRCMF_FW_NVRAM_DEF(43143, "brcmfmac43143-sdio.bin", "brcmfmac43143-sdio.txt"); --BRCMF_FW_NVRAM_DEF(43241B0, "brcmfmac43241b0-sdio.bin", -- "brcmfmac43241b0-sdio.txt"); --BRCMF_FW_NVRAM_DEF(43241B4, "brcmfmac43241b4-sdio.bin", -- "brcmfmac43241b4-sdio.txt"); --BRCMF_FW_NVRAM_DEF(43241B5, "brcmfmac43241b5-sdio.bin", -- "brcmfmac43241b5-sdio.txt"); --BRCMF_FW_NVRAM_DEF(4329, "brcmfmac4329-sdio.bin", "brcmfmac4329-sdio.txt"); --BRCMF_FW_NVRAM_DEF(4330, "brcmfmac4330-sdio.bin", "brcmfmac4330-sdio.txt"); --BRCMF_FW_NVRAM_DEF(4334, "brcmfmac4334-sdio.bin", "brcmfmac4334-sdio.txt"); --BRCMF_FW_NVRAM_DEF(43340, "brcmfmac43340-sdio.bin", "brcmfmac43340-sdio.txt"); --BRCMF_FW_NVRAM_DEF(4335, "brcmfmac4335-sdio.bin", "brcmfmac4335-sdio.txt"); --BRCMF_FW_NVRAM_DEF(43362, "brcmfmac43362-sdio.bin", "brcmfmac43362-sdio.txt"); --BRCMF_FW_NVRAM_DEF(4339, "brcmfmac4339-sdio.bin", "brcmfmac4339-sdio.txt"); --BRCMF_FW_NVRAM_DEF(43430A0, "brcmfmac43430a0-sdio.bin", "brcmfmac43430a0-sdio.txt"); -+BRCMF_FW_DEF(43143, "brcmfmac43143-sdio"); -+BRCMF_FW_DEF(43241B0, "brcmfmac43241b0-sdio"); -+BRCMF_FW_DEF(43241B4, "brcmfmac43241b4-sdio"); -+BRCMF_FW_DEF(43241B5, "brcmfmac43241b5-sdio"); -+BRCMF_FW_DEF(4329, "brcmfmac4329-sdio"); -+BRCMF_FW_DEF(4330, "brcmfmac4330-sdio"); -+BRCMF_FW_DEF(4334, "brcmfmac4334-sdio"); -+BRCMF_FW_DEF(43340, "brcmfmac43340-sdio"); -+BRCMF_FW_DEF(4335, "brcmfmac4335-sdio"); -+BRCMF_FW_DEF(43362, "brcmfmac43362-sdio"); -+BRCMF_FW_DEF(4339, "brcmfmac4339-sdio"); -+BRCMF_FW_DEF(43430A0, "brcmfmac43430a0-sdio"); - /* Note the names are not postfixed with a1 for backward compatibility */ --BRCMF_FW_NVRAM_DEF(43430A1, "brcmfmac43430-sdio.bin", "brcmfmac43430-sdio.txt"); --BRCMF_FW_NVRAM_DEF(43455, "brcmfmac43455-sdio.bin", "brcmfmac43455-sdio.txt"); --BRCMF_FW_NVRAM_DEF(4354, "brcmfmac4354-sdio.bin", "brcmfmac4354-sdio.txt"); --BRCMF_FW_NVRAM_DEF(4356, "brcmfmac4356-sdio.bin", "brcmfmac4356-sdio.txt"); --BRCMF_FW_NVRAM_DEF(4373, "brcmfmac4373-sdio.bin", "brcmfmac4373-sdio.txt"); -+BRCMF_FW_DEF(43430A1, "brcmfmac43430-sdio"); -+BRCMF_FW_DEF(43455, "brcmfmac43455-sdio"); -+BRCMF_FW_DEF(4354, "brcmfmac4354-sdio"); -+BRCMF_FW_DEF(4356, "brcmfmac4356-sdio"); -+BRCMF_FW_DEF(4373, "brcmfmac4373-sdio"); - - static struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = { -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43241_CHIP_ID, 0x0000001F, 43241B0), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43241_CHIP_ID, 0x00000020, 43241B4), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43241_CHIP_ID, 0xFFFFFFC0, 43241B5), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4329_CHIP_ID, 0xFFFFFFFF, 4329), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, 4330), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, 4334), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, 43340), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43341_CHIP_ID, 0xFFFFFFFF, 43340), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, 4335), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43430_CHIP_ID, 0x00000001, 43430A0), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43430_CHIP_ID, 0xFFFFFFFE, 43430A1), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, 43455), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, 4354), -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356), -- BRCMF_FW_NVRAM_ENTRY(CY_CC_4373_CHIP_ID, 0xFFFFFFFF, 4373) -+ BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143), -+ BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x0000001F, 43241B0), -+ BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x00000020, 43241B4), -+ BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0xFFFFFFC0, 43241B5), -+ BRCMF_FW_ENTRY(BRCM_CC_4329_CHIP_ID, 0xFFFFFFFF, 4329), -+ BRCMF_FW_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, 4330), -+ BRCMF_FW_ENTRY(BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, 4334), -+ BRCMF_FW_ENTRY(BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, 43340), -+ BRCMF_FW_ENTRY(BRCM_CC_43341_CHIP_ID, 0xFFFFFFFF, 43340), -+ BRCMF_FW_ENTRY(BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, 4335), -+ BRCMF_FW_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362), -+ BRCMF_FW_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339), -+ BRCMF_FW_ENTRY(BRCM_CC_43430_CHIP_ID, 0x00000001, 43430A0), -+ BRCMF_FW_ENTRY(BRCM_CC_43430_CHIP_ID, 0xFFFFFFFE, 43430A1), -+ BRCMF_FW_ENTRY(BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, 43455), -+ BRCMF_FW_ENTRY(BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, 4354), -+ BRCMF_FW_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356), -+ BRCMF_FW_ENTRY(CY_CC_4373_CHIP_ID, 0xFFFFFFFF, 4373) - }; - - static void pkt_align(struct sk_buff *p, int len, int align) ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c -@@ -46,11 +46,11 @@ - #define BRCMF_USB_CBCTL_READ 1 - #define BRCMF_USB_MAX_PKT_SIZE 1600 - --BRCMF_FW_DEF(43143, "brcmfmac43143.bin"); --BRCMF_FW_DEF(43236B, "brcmfmac43236b.bin"); --BRCMF_FW_DEF(43242A, "brcmfmac43242a.bin"); --BRCMF_FW_DEF(43569, "brcmfmac43569.bin"); --BRCMF_FW_DEF(4373, "brcmfmac4373.bin"); -+BRCMF_FW_DEF(43143, "brcmfmac43143"); -+BRCMF_FW_DEF(43236B, "brcmfmac43236b"); -+BRCMF_FW_DEF(43242A, "brcmfmac43242a"); -+BRCMF_FW_DEF(43569, "brcmfmac43569"); -+BRCMF_FW_DEF(4373, "brcmfmac4373"); - - static struct brcmf_firmware_mapping brcmf_usb_fwnames[] = { - BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143), diff --git a/package/kernel/mac80211/patches/327-v4.17-0007-brcmfmac-pass-struct-in-brcmf_fw_get_firmwares.patch b/package/kernel/mac80211/patches/327-v4.17-0007-brcmfmac-pass-struct-in-brcmf_fw_get_firmwares.patch deleted file mode 100644 index a75465a893094e..00000000000000 --- a/package/kernel/mac80211/patches/327-v4.17-0007-brcmfmac-pass-struct-in-brcmf_fw_get_firmwares.patch +++ /dev/null @@ -1,574 +0,0 @@ -From d09ae51a4b676151edaf572bcd5f272b5532639f Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Thu, 22 Mar 2018 21:28:26 +0100 -Subject: [PATCH] brcmfmac: pass struct in brcmf_fw_get_firmwares() - -Make the function brcmf_fw_get_firmwares() a bit more easy to extend -using a structure to pass the request parameters. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../broadcom/brcm80211/brcmfmac/firmware.c | 175 ++++++++++++++------- - .../broadcom/brcm80211/brcmfmac/firmware.h | 43 +++-- - .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 38 ++++- - .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 32 +++- - .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 43 ++++- - 5 files changed, 245 insertions(+), 86 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -@@ -438,18 +438,31 @@ void brcmf_fw_nvram_free(void *nvram) - - struct brcmf_fw { - struct device *dev; -- u16 flags; -- const struct firmware *code; -- const char *nvram_name; -- u16 domain_nr; -- u16 bus_nr; -- void (*done)(struct device *dev, int err, const struct firmware *fw, -- void *nvram_image, u32 nvram_len); -+ struct brcmf_fw_request *req; -+ u32 curpos; -+ void (*done)(struct device *dev, int err, struct brcmf_fw_request *req); - }; - -+static void brcmf_fw_request_done(const struct firmware *fw, void *ctx); -+ -+static void brcmf_fw_free_request(struct brcmf_fw_request *req) -+{ -+ struct brcmf_fw_item *item; -+ int i; -+ -+ for (i = 0, item = &req->items[0]; i < req->n_items; i++, item++) { -+ if (item->type == BRCMF_FW_TYPE_BINARY) -+ release_firmware(item->binary); -+ else if (item->type == BRCMF_FW_TYPE_NVRAM) -+ brcmf_fw_nvram_free(item->nv_data.data); -+ } -+ kfree(req); -+} -+ - static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx) - { - struct brcmf_fw *fwctx = ctx; -+ struct brcmf_fw_item *cur; - u32 nvram_length = 0; - void *nvram = NULL; - u8 *data = NULL; -@@ -457,83 +470,150 @@ static void brcmf_fw_request_nvram_done( - bool raw_nvram; - - brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(fwctx->dev)); -+ -+ cur = &fwctx->req->items[fwctx->curpos]; -+ - if (fw && fw->data) { - data = (u8 *)fw->data; - data_len = fw->size; - raw_nvram = false; - } else { - data = bcm47xx_nvram_get_contents(&data_len); -- if (!data && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL)) -+ if (!data && !(cur->flags & BRCMF_FW_REQF_OPTIONAL)) - goto fail; - raw_nvram = true; - } - - if (data) - nvram = brcmf_fw_nvram_strip(data, data_len, &nvram_length, -- fwctx->domain_nr, fwctx->bus_nr); -+ fwctx->req->domain_nr, -+ fwctx->req->bus_nr); - - if (raw_nvram) - bcm47xx_nvram_release_contents(data); - release_firmware(fw); -- if (!nvram && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL)) -+ if (!nvram && !(cur->flags & BRCMF_FW_REQF_OPTIONAL)) - goto fail; - -- fwctx->done(fwctx->dev, 0, fwctx->code, nvram, nvram_length); -- kfree(fwctx); -+ brcmf_dbg(TRACE, "nvram %p len %d\n", nvram, nvram_length); -+ cur->nv_data.data = nvram; -+ cur->nv_data.len = nvram_length; - return; - - fail: - brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev)); -- release_firmware(fwctx->code); -- fwctx->done(fwctx->dev, -ENOENT, NULL, NULL, 0); -+ fwctx->done(fwctx->dev, -ENOENT, NULL); -+ brcmf_fw_free_request(fwctx->req); - kfree(fwctx); - } - --static void brcmf_fw_request_code_done(const struct firmware *fw, void *ctx) -+static int brcmf_fw_request_next_item(struct brcmf_fw *fwctx, bool async) -+{ -+ struct brcmf_fw_item *cur; -+ const struct firmware *fw = NULL; -+ int ret; -+ -+ cur = &fwctx->req->items[fwctx->curpos]; -+ -+ brcmf_dbg(TRACE, "%srequest for %s\n", async ? "async " : "", -+ cur->path); -+ -+ if (async) -+ ret = request_firmware_nowait(THIS_MODULE, true, cur->path, -+ fwctx->dev, GFP_KERNEL, fwctx, -+ brcmf_fw_request_done); -+ else -+ ret = request_firmware(&fw, cur->path, fwctx->dev); -+ -+ if (ret < 0) { -+ brcmf_fw_request_done(NULL, fwctx); -+ } else if (!async && fw) { -+ brcmf_dbg(TRACE, "firmware %s %sfound\n", cur->path, -+ fw ? "" : "not "); -+ if (cur->type == BRCMF_FW_TYPE_BINARY) -+ cur->binary = fw; -+ else if (cur->type == BRCMF_FW_TYPE_NVRAM) -+ brcmf_fw_request_nvram_done(fw, fwctx); -+ else -+ release_firmware(fw); -+ -+ return -EAGAIN; -+ } -+ return 0; -+} -+ -+static void brcmf_fw_request_done(const struct firmware *fw, void *ctx) - { - struct brcmf_fw *fwctx = ctx; -+ struct brcmf_fw_item *cur; - int ret = 0; - -- brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(fwctx->dev)); -- if (!fw) { -+ cur = &fwctx->req->items[fwctx->curpos]; -+ -+ brcmf_dbg(TRACE, "enter: firmware %s %sfound\n", cur->path, -+ fw ? "" : "not "); -+ -+ if (fw) { -+ if (cur->type == BRCMF_FW_TYPE_BINARY) -+ cur->binary = fw; -+ else if (cur->type == BRCMF_FW_TYPE_NVRAM) -+ brcmf_fw_request_nvram_done(fw, fwctx); -+ else -+ release_firmware(fw); -+ } else if (cur->type == BRCMF_FW_TYPE_NVRAM) { -+ brcmf_fw_request_nvram_done(NULL, fwctx); -+ } else if (!(cur->flags & BRCMF_FW_REQF_OPTIONAL)) { - ret = -ENOENT; - goto fail; - } -- /* only requested code so done here */ -- if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) -- goto done; -- -- fwctx->code = fw; -- ret = request_firmware_nowait(THIS_MODULE, true, fwctx->nvram_name, -- fwctx->dev, GFP_KERNEL, fwctx, -- brcmf_fw_request_nvram_done); - -- /* pass NULL to nvram callback for bcm47xx fallback */ -- if (ret) -- brcmf_fw_request_nvram_done(NULL, fwctx); -+ do { -+ if (++fwctx->curpos == fwctx->req->n_items) { -+ ret = 0; -+ goto done; -+ } -+ -+ ret = brcmf_fw_request_next_item(fwctx, false); -+ } while (ret == -EAGAIN); -+ - return; - - fail: -- brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev)); -+ brcmf_dbg(TRACE, "failed err=%d: dev=%s, fw=%s\n", ret, -+ dev_name(fwctx->dev), cur->path); -+ brcmf_fw_free_request(fwctx->req); -+ fwctx->req = NULL; - done: -- fwctx->done(fwctx->dev, ret, fw, NULL, 0); -+ fwctx->done(fwctx->dev, ret, fwctx->req); - kfree(fwctx); - } - --int brcmf_fw_get_firmwares_pcie(struct device *dev, u16 flags, -- const char *code, const char *nvram, -- void (*fw_cb)(struct device *dev, int err, -- const struct firmware *fw, -- void *nvram_image, u32 nvram_len), -- u16 domain_nr, u16 bus_nr) -+static bool brcmf_fw_request_is_valid(struct brcmf_fw_request *req) -+{ -+ struct brcmf_fw_item *item; -+ int i; -+ -+ if (!req->n_items) -+ return false; -+ -+ for (i = 0, item = &req->items[0]; i < req->n_items; i++, item++) { -+ if (!item->path) -+ return false; -+ } -+ return true; -+} -+ -+int brcmf_fw_get_firmwares(struct device *dev, struct brcmf_fw_request *req, -+ void (*fw_cb)(struct device *dev, int err, -+ struct brcmf_fw_request *req)) - { - struct brcmf_fw *fwctx; - - brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev)); -- if (!fw_cb || !code) -+ if (!fw_cb) - return -EINVAL; - -- if ((flags & BRCMF_FW_REQUEST_NVRAM) && !nvram) -+ if (!brcmf_fw_request_is_valid(req)) - return -EINVAL; - - fwctx = kzalloc(sizeof(*fwctx), GFP_KERNEL); -@@ -541,26 +621,11 @@ int brcmf_fw_get_firmwares_pcie(struct d - return -ENOMEM; - - fwctx->dev = dev; -- fwctx->flags = flags; -+ fwctx->req = req; - fwctx->done = fw_cb; -- if (flags & BRCMF_FW_REQUEST_NVRAM) -- fwctx->nvram_name = nvram; -- fwctx->domain_nr = domain_nr; -- fwctx->bus_nr = bus_nr; -- -- return request_firmware_nowait(THIS_MODULE, true, code, dev, -- GFP_KERNEL, fwctx, -- brcmf_fw_request_code_done); --} - --int brcmf_fw_get_firmwares(struct device *dev, u16 flags, -- const char *code, const char *nvram, -- void (*fw_cb)(struct device *dev, int err, -- const struct firmware *fw, -- void *nvram_image, u32 nvram_len)) --{ -- return brcmf_fw_get_firmwares_pcie(dev, flags, code, nvram, fw_cb, 0, -- 0); -+ brcmf_fw_request_next_item(fwctx, true); -+ return 0; - } - - static void brcmf_fw_get_full_name(char fw_name[BRCMF_FW_NAME_LEN], ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h -@@ -16,10 +16,7 @@ - #ifndef BRCMFMAC_FIRMWARE_H - #define BRCMFMAC_FIRMWARE_H - --#define BRCMF_FW_REQUEST 0x000F --#define BRCMF_FW_REQUEST_NVRAM 0x0001 --#define BRCMF_FW_REQ_FLAGS 0x00F0 --#define BRCMF_FW_REQ_NV_OPTIONAL 0x0010 -+#define BRCMF_FW_REQF_OPTIONAL 0x0001 - - #define BRCMF_FW_NAME_LEN 320 - -@@ -54,21 +51,39 @@ int brcmf_fw_map_chip_to_name(u32 chip, - u32 table_size, char fw_name[BRCMF_FW_NAME_LEN], - char nvram_name[BRCMF_FW_NAME_LEN]); - void brcmf_fw_nvram_free(void *nvram); -+ -+enum brcmf_fw_type { -+ BRCMF_FW_TYPE_BINARY, -+ BRCMF_FW_TYPE_NVRAM -+}; -+ -+struct brcmf_fw_item { -+ const char *path; -+ enum brcmf_fw_type type; -+ u16 flags; -+ union { -+ const struct firmware *binary; -+ struct { -+ void *data; -+ u32 len; -+ } nv_data; -+ }; -+}; -+ -+struct brcmf_fw_request { -+ u16 domain_nr; -+ u16 bus_nr; -+ u32 n_items; -+ struct brcmf_fw_item items[0]; -+}; -+ - /* - * Request firmware(s) asynchronously. When the asynchronous request - * fails it will not use the callback, but call device_release_driver() - * instead which will call the driver .remove() callback. - */ --int brcmf_fw_get_firmwares_pcie(struct device *dev, u16 flags, -- const char *code, const char *nvram, -- void (*fw_cb)(struct device *dev, int err, -- const struct firmware *fw, -- void *nvram_image, u32 nvram_len), -- u16 domain_nr, u16 bus_nr); --int brcmf_fw_get_firmwares(struct device *dev, u16 flags, -- const char *code, const char *nvram, -+int brcmf_fw_get_firmwares(struct device *dev, struct brcmf_fw_request *req, - void (*fw_cb)(struct device *dev, int err, -- const struct firmware *fw, -- void *nvram_image, u32 nvram_len)); -+ struct brcmf_fw_request *req)); - - #endif /* BRCMFMAC_FIRMWARE_H */ ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -@@ -1651,15 +1651,19 @@ static const struct brcmf_buscore_ops br - .write32 = brcmf_pcie_buscore_write32, - }; - -+#define BRCMF_PCIE_FW_CODE 0 -+#define BRCMF_PCIE_FW_NVRAM 1 -+ - static void brcmf_pcie_setup(struct device *dev, int ret, -- const struct firmware *fw, -- void *nvram, u32 nvram_len) -+ struct brcmf_fw_request *fwreq) - { -+ const struct firmware *fw; -+ void *nvram; - struct brcmf_bus *bus; - struct brcmf_pciedev *pcie_bus_dev; - struct brcmf_pciedev_info *devinfo; - struct brcmf_commonring **flowrings; -- u32 i; -+ u32 i, nvram_len; - - /* check firmware loading result */ - if (ret) -@@ -1670,6 +1674,11 @@ static void brcmf_pcie_setup(struct devi - devinfo = pcie_bus_dev->devinfo; - brcmf_pcie_attach(devinfo); - -+ fw = fwreq->items[BRCMF_PCIE_FW_CODE].binary; -+ nvram = fwreq->items[BRCMF_PCIE_FW_NVRAM].nv_data.data; -+ nvram_len = fwreq->items[BRCMF_PCIE_FW_NVRAM].nv_data.len; -+ kfree(fwreq); -+ - /* Some of the firmwares have the size of the memory of the device - * defined inside the firmware. This is because part of the memory in - * the device is shared and the devision is determined by FW. Parse -@@ -1730,6 +1739,7 @@ static int - brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) - { - int ret; -+ struct brcmf_fw_request *fwreq; - struct brcmf_pciedev_info *devinfo; - struct brcmf_pciedev *pcie_bus_dev; - struct brcmf_bus *bus; -@@ -1800,12 +1810,26 @@ brcmf_pcie_probe(struct pci_dev *pdev, c - if (ret) - goto fail_bus; - -- ret = brcmf_fw_get_firmwares_pcie(bus->dev, BRCMF_FW_REQUEST_NVRAM | -- BRCMF_FW_REQ_NV_OPTIONAL, -- devinfo->fw_name, devinfo->nvram_name, -- brcmf_pcie_setup, domain_nr, bus_nr); -+ fwreq = kzalloc(sizeof(*fwreq) + 2 * sizeof(struct brcmf_fw_item), -+ GFP_KERNEL); -+ if (!fwreq) { -+ ret = -ENOMEM; -+ goto fail_bus; -+ } -+ -+ fwreq->items[BRCMF_PCIE_FW_CODE].path = devinfo->fw_name; -+ fwreq->items[BRCMF_PCIE_FW_CODE].type = BRCMF_FW_TYPE_BINARY; -+ fwreq->items[BRCMF_PCIE_FW_NVRAM].path = devinfo->nvram_name; -+ fwreq->items[BRCMF_PCIE_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; -+ fwreq->items[BRCMF_PCIE_FW_NVRAM].flags = BRCMF_FW_REQF_OPTIONAL; -+ fwreq->n_items = 2; -+ fwreq->domain_nr = domain_nr; -+ fwreq->bus_nr = bus_nr; -+ ret = brcmf_fw_get_firmwares(bus->dev, fwreq, brcmf_pcie_setup); - if (ret == 0) - return 0; -+ -+ kfree(fwreq); - fail_bus: - kfree(bus->msgbuf); - kfree(bus); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -4031,14 +4031,19 @@ static const struct brcmf_bus_ops brcmf_ - .get_fwname = brcmf_sdio_get_fwname, - }; - -+#define BRCMF_SDIO_FW_CODE 0 -+#define BRCMF_SDIO_FW_NVRAM 1 -+ - static void brcmf_sdio_firmware_callback(struct device *dev, int err, -- const struct firmware *code, -- void *nvram, u32 nvram_len) -+ struct brcmf_fw_request *fwreq) - { - struct brcmf_bus *bus_if = dev_get_drvdata(dev); - struct brcmf_sdio_dev *sdiod = bus_if->bus_priv.sdio; - struct brcmf_sdio *bus = sdiod->bus; - struct brcmf_core *core = bus->sdio_core; -+ const struct firmware *code; -+ void *nvram; -+ u32 nvram_len; - u8 saveclk; - - brcmf_dbg(TRACE, "Enter: dev=%s, err=%d\n", dev_name(dev), err); -@@ -4046,6 +4051,11 @@ static void brcmf_sdio_firmware_callback - if (err) - goto fail; - -+ code = fwreq->items[BRCMF_SDIO_FW_CODE].binary; -+ nvram = fwreq->items[BRCMF_SDIO_FW_NVRAM].nv_data.data; -+ nvram_len = fwreq->items[BRCMF_SDIO_FW_NVRAM].nv_data.len; -+ kfree(fwreq); -+ - /* try to download image and nvram to the dongle */ - bus->alp_only = true; - err = brcmf_sdio_download_firmware(bus, code, nvram, nvram_len); -@@ -4150,6 +4160,7 @@ struct brcmf_sdio *brcmf_sdio_probe(stru - int ret; - struct brcmf_sdio *bus; - struct workqueue_struct *wq; -+ struct brcmf_fw_request *fwreq; - - brcmf_dbg(TRACE, "Enter\n"); - -@@ -4240,11 +4251,24 @@ struct brcmf_sdio *brcmf_sdio_probe(stru - if (ret) - goto fail; - -- ret = brcmf_fw_get_firmwares(sdiodev->dev, BRCMF_FW_REQUEST_NVRAM, -- sdiodev->fw_name, sdiodev->nvram_name, -+ fwreq = kzalloc(sizeof(fwreq) + 2 * sizeof(struct brcmf_fw_item), -+ GFP_KERNEL); -+ if (!fwreq) { -+ ret = -ENOMEM; -+ goto fail; -+ } -+ -+ fwreq->items[BRCMF_SDIO_FW_CODE].path = sdiodev->fw_name; -+ fwreq->items[BRCMF_SDIO_FW_CODE].type = BRCMF_FW_TYPE_BINARY; -+ fwreq->items[BRCMF_SDIO_FW_NVRAM].path = sdiodev->nvram_name; -+ fwreq->items[BRCMF_SDIO_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; -+ fwreq->n_items = 2; -+ -+ ret = brcmf_fw_get_firmwares(sdiodev->dev, fwreq, - brcmf_sdio_firmware_callback); - if (ret != 0) { - brcmf_err("async firmware request failed: %d\n", ret); -+ kfree(fwreq); - goto fail; - } - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c -@@ -1155,18 +1155,23 @@ static const struct brcmf_bus_ops brcmf_ - .get_fwname = brcmf_usb_get_fwname, - }; - -+#define BRCMF_USB_FW_CODE 0 -+ - static void brcmf_usb_probe_phase2(struct device *dev, int ret, -- const struct firmware *fw, -- void *nvram, u32 nvlen) -+ struct brcmf_fw_request *fwreq) - { - struct brcmf_bus *bus = dev_get_drvdata(dev); - struct brcmf_usbdev_info *devinfo = bus->bus_priv.usb->devinfo; -+ const struct firmware *fw; - - if (ret) - goto error; - - brcmf_dbg(USB, "Start fw downloading\n"); - -+ fw = fwreq->items[BRCMF_USB_FW_CODE].binary; -+ kfree(fwreq); -+ - ret = check_file(fw->data); - if (ret < 0) { - brcmf_err("invalid firmware\n"); -@@ -1200,6 +1205,7 @@ static int brcmf_usb_probe_cb(struct brc - struct brcmf_bus *bus = NULL; - struct brcmf_usbdev *bus_pub = NULL; - struct device *dev = devinfo->dev; -+ struct brcmf_fw_request *fwreq; - int ret; - - brcmf_dbg(USB, "Enter\n"); -@@ -1250,11 +1256,22 @@ static int brcmf_usb_probe_cb(struct brc - if (ret) - goto fail; - -+ fwreq = kzalloc(sizeof(*fwreq) + sizeof(struct brcmf_fw_item), -+ GFP_KERNEL); -+ if (!fwreq) { -+ ret = -ENOMEM; -+ goto fail; -+ } -+ -+ fwreq->items[BRCMF_USB_FW_CODE].path = devinfo->fw_name; -+ fwreq->items[BRCMF_USB_FW_CODE].type = BRCMF_FW_TYPE_BINARY; -+ fwreq->n_items = 1; -+ - /* request firmware here */ -- ret = brcmf_fw_get_firmwares(dev, 0, devinfo->fw_name, NULL, -- brcmf_usb_probe_phase2); -+ ret = brcmf_fw_get_firmwares(dev, fwreq, brcmf_usb_probe_phase2); - if (ret) { - brcmf_err("firmware request failed: %d\n", ret); -+ kfree(fwreq); - goto fail; - } - -@@ -1447,11 +1464,25 @@ static int brcmf_usb_reset_resume(struct - { - struct usb_device *usb = interface_to_usbdev(intf); - struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(&usb->dev); -+ struct brcmf_fw_request *fwreq; -+ int ret; - - brcmf_dbg(USB, "Enter\n"); - -- return brcmf_fw_get_firmwares(&usb->dev, 0, devinfo->fw_name, NULL, -- brcmf_usb_probe_phase2); -+ fwreq = kzalloc(sizeof(*fwreq) + sizeof(struct brcmf_fw_item), -+ GFP_KERNEL); -+ if (!fwreq) -+ return -ENOMEM; -+ -+ fwreq->items[BRCMF_USB_FW_CODE].path = devinfo->fw_name; -+ fwreq->items[BRCMF_USB_FW_CODE].type = BRCMF_FW_TYPE_BINARY; -+ fwreq->n_items = 1; -+ -+ ret = brcmf_fw_get_firmwares(&usb->dev, fwreq, brcmf_usb_probe_phase2); -+ if (ret < 0) -+ kfree(fwreq); -+ -+ return ret; - } - - #define BRCMF_USB_DEVICE(dev_id) \ diff --git a/package/kernel/mac80211/patches/327-v4.17-0008-brcmfmac-introduce-brcmf_fw_alloc_request-function.patch b/package/kernel/mac80211/patches/327-v4.17-0008-brcmfmac-introduce-brcmf_fw_alloc_request-function.patch deleted file mode 100644 index 408154ef0fe256..00000000000000 --- a/package/kernel/mac80211/patches/327-v4.17-0008-brcmfmac-introduce-brcmf_fw_alloc_request-function.patch +++ /dev/null @@ -1,328 +0,0 @@ -From 2baa3aaee27f137b8db9a9224d0fe9b281d28e34 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Thu, 22 Mar 2018 21:28:27 +0100 -Subject: [PATCH] brcmfmac: introduce brcmf_fw_alloc_request() function - -The function brcmf_fw_alloc_request() takes a list of required files -and allocated the struct brcmf_fw_request instance accordingly. The -request can be modified by the caller before being passed to the -brcmf_fw_request_firmwares() function. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../broadcom/brcm80211/brcmfmac/firmware.c | 58 ++++++++++++++++++++++ - .../broadcom/brcm80211/brcmfmac/firmware.h | 11 ++++ - .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 58 ++++++++++++---------- - .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 38 ++++++++------ - .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 42 +++++++++------- - 5 files changed, 147 insertions(+), 60 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -@@ -688,3 +688,61 @@ int brcmf_fw_map_chip_to_name(u32 chip, - return 0; - } - -+struct brcmf_fw_request * -+brcmf_fw_alloc_request(u32 chip, u32 chiprev, -+ struct brcmf_firmware_mapping mapping_table[], -+ u32 table_size, struct brcmf_fw_name *fwnames, -+ u32 n_fwnames) -+{ -+ struct brcmf_fw_request *fwreq; -+ char chipname[12]; -+ const char *mp_path; -+ u32 i, j; -+ char end; -+ size_t reqsz; -+ -+ for (i = 0; i < table_size; i++) { -+ if (mapping_table[i].chipid == chip && -+ mapping_table[i].revmask & BIT(chiprev)) -+ break; -+ } -+ -+ if (i == table_size) { -+ brcmf_err("Unknown chipid %d [%d]\n", chip, chiprev); -+ return NULL; -+ } -+ -+ reqsz = sizeof(*fwreq) + n_fwnames * sizeof(struct brcmf_fw_item); -+ fwreq = kzalloc(reqsz, GFP_KERNEL); -+ if (!fwreq) -+ return NULL; -+ -+ brcmf_chip_name(chip, chiprev, chipname, sizeof(chipname)); -+ -+ brcmf_info("using %s for chip %s\n", -+ mapping_table[i].fw_base, chipname); -+ -+ mp_path = brcmf_mp_global.firmware_path; -+ end = mp_path[strlen(mp_path) - 1]; -+ fwreq->n_items = n_fwnames; -+ -+ for (j = 0; j < n_fwnames; j++) { -+ fwreq->items[j].path = fwnames[j].path; -+ /* check if firmware path is provided by module parameter */ -+ if (brcmf_mp_global.firmware_path[0] != '\0') { -+ strlcpy(fwnames[j].path, mp_path, -+ BRCMF_FW_NAME_LEN); -+ -+ if (end != '/') { -+ strlcat(fwnames[j].path, "/", -+ BRCMF_FW_NAME_LEN); -+ } -+ } -+ brcmf_fw_get_full_name(fwnames[j].path, -+ mapping_table[i].fw_base, -+ fwnames[j].extension); -+ fwreq->items[j].path = fwnames[j].path; -+ } -+ -+ return fwreq; -+} ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h -@@ -77,6 +77,17 @@ struct brcmf_fw_request { - struct brcmf_fw_item items[0]; - }; - -+struct brcmf_fw_name { -+ const char *extension; -+ char *path; -+}; -+ -+struct brcmf_fw_request * -+brcmf_fw_alloc_request(u32 chip, u32 chiprev, -+ struct brcmf_firmware_mapping mapping_table[], -+ u32 table_size, struct brcmf_fw_name *fwnames, -+ u32 n_fwnames); -+ - /* - * Request firmware(s) asynchronously. When the asynchronous request - * fails it will not use the callback, but call device_release_driver() ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -@@ -1735,6 +1735,31 @@ fail: - device_release_driver(dev); - } - -+static struct brcmf_fw_request * -+brcmf_pcie_prepare_fw_request(struct brcmf_pciedev_info *devinfo) -+{ -+ struct brcmf_fw_request *fwreq; -+ struct brcmf_fw_name fwnames[] = { -+ { ".bin", devinfo->fw_name }, -+ { ".txt", devinfo->nvram_name }, -+ }; -+ -+ fwreq = brcmf_fw_alloc_request(devinfo->ci->chip, devinfo->ci->chiprev, -+ brcmf_pcie_fwnames, -+ ARRAY_SIZE(brcmf_pcie_fwnames), -+ fwnames, ARRAY_SIZE(fwnames)); -+ if (!fwreq) -+ return NULL; -+ -+ fwreq->items[BRCMF_PCIE_FW_CODE].type = BRCMF_FW_TYPE_BINARY; -+ fwreq->items[BRCMF_PCIE_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; -+ fwreq->items[BRCMF_PCIE_FW_NVRAM].flags = BRCMF_FW_REQF_OPTIONAL; -+ fwreq->domain_nr = pci_domain_nr(devinfo->pdev->bus); -+ fwreq->bus_nr = devinfo->pdev->bus->number; -+ -+ return fwreq; -+} -+ - static int - brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) - { -@@ -1743,13 +1768,8 @@ brcmf_pcie_probe(struct pci_dev *pdev, c - struct brcmf_pciedev_info *devinfo; - struct brcmf_pciedev *pcie_bus_dev; - struct brcmf_bus *bus; -- u16 domain_nr; -- u16 bus_nr; - -- domain_nr = pci_domain_nr(pdev->bus) + 1; -- bus_nr = pdev->bus->number; -- brcmf_dbg(PCIE, "Enter %x:%x (%d/%d)\n", pdev->vendor, pdev->device, -- domain_nr, bus_nr); -+ brcmf_dbg(PCIE, "Enter %x:%x\n", pdev->vendor, pdev->device); - - ret = -ENOMEM; - devinfo = kzalloc(sizeof(*devinfo), GFP_KERNEL); -@@ -1803,33 +1823,19 @@ brcmf_pcie_probe(struct pci_dev *pdev, c - bus->wowl_supported = pci_pme_capable(pdev, PCI_D3hot); - dev_set_drvdata(&pdev->dev, bus); - -- ret = brcmf_fw_map_chip_to_name(devinfo->ci->chip, devinfo->ci->chiprev, -- brcmf_pcie_fwnames, -- ARRAY_SIZE(brcmf_pcie_fwnames), -- devinfo->fw_name, devinfo->nvram_name); -- if (ret) -- goto fail_bus; -- -- fwreq = kzalloc(sizeof(*fwreq) + 2 * sizeof(struct brcmf_fw_item), -- GFP_KERNEL); -+ fwreq = brcmf_pcie_prepare_fw_request(devinfo); - if (!fwreq) { - ret = -ENOMEM; - goto fail_bus; - } - -- fwreq->items[BRCMF_PCIE_FW_CODE].path = devinfo->fw_name; -- fwreq->items[BRCMF_PCIE_FW_CODE].type = BRCMF_FW_TYPE_BINARY; -- fwreq->items[BRCMF_PCIE_FW_NVRAM].path = devinfo->nvram_name; -- fwreq->items[BRCMF_PCIE_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; -- fwreq->items[BRCMF_PCIE_FW_NVRAM].flags = BRCMF_FW_REQF_OPTIONAL; -- fwreq->n_items = 2; -- fwreq->domain_nr = domain_nr; -- fwreq->bus_nr = bus_nr; - ret = brcmf_fw_get_firmwares(bus->dev, fwreq, brcmf_pcie_setup); -- if (ret == 0) -- return 0; -+ if (ret < 0) { -+ kfree(fwreq); -+ goto fail_bus; -+ } -+ return 0; - -- kfree(fwreq); - fail_bus: - kfree(bus->msgbuf); - kfree(bus); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -4155,6 +4155,28 @@ fail: - device_release_driver(dev); - } - -+static struct brcmf_fw_request * -+brcmf_sdio_prepare_fw_request(struct brcmf_sdio *bus) -+{ -+ struct brcmf_fw_request *fwreq; -+ struct brcmf_fw_name fwnames[] = { -+ { ".bin", bus->sdiodev->fw_name }, -+ { ".txt", bus->sdiodev->nvram_name }, -+ }; -+ -+ fwreq = brcmf_fw_alloc_request(bus->ci->chip, bus->ci->chiprev, -+ brcmf_sdio_fwnames, -+ ARRAY_SIZE(brcmf_sdio_fwnames), -+ fwnames, ARRAY_SIZE(fwnames)); -+ if (!fwreq) -+ return NULL; -+ -+ fwreq->items[BRCMF_SDIO_FW_CODE].type = BRCMF_FW_TYPE_BINARY; -+ fwreq->items[BRCMF_SDIO_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; -+ -+ return fwreq; -+} -+ - struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) - { - int ret; -@@ -4244,26 +4266,12 @@ struct brcmf_sdio *brcmf_sdio_probe(stru - - brcmf_dbg(INFO, "completed!!\n"); - -- ret = brcmf_fw_map_chip_to_name(bus->ci->chip, bus->ci->chiprev, -- brcmf_sdio_fwnames, -- ARRAY_SIZE(brcmf_sdio_fwnames), -- sdiodev->fw_name, sdiodev->nvram_name); -- if (ret) -- goto fail; -- -- fwreq = kzalloc(sizeof(fwreq) + 2 * sizeof(struct brcmf_fw_item), -- GFP_KERNEL); -+ fwreq = brcmf_sdio_prepare_fw_request(bus); - if (!fwreq) { - ret = -ENOMEM; - goto fail; - } - -- fwreq->items[BRCMF_SDIO_FW_CODE].path = sdiodev->fw_name; -- fwreq->items[BRCMF_SDIO_FW_CODE].type = BRCMF_FW_TYPE_BINARY; -- fwreq->items[BRCMF_SDIO_FW_NVRAM].path = sdiodev->nvram_name; -- fwreq->items[BRCMF_SDIO_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; -- fwreq->n_items = 2; -- - ret = brcmf_fw_get_firmwares(sdiodev->dev, fwreq, - brcmf_sdio_firmware_callback); - if (ret != 0) { ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c -@@ -1200,6 +1200,27 @@ error: - device_release_driver(dev); - } - -+static struct brcmf_fw_request * -+brcmf_usb_prepare_fw_request(struct brcmf_usbdev_info *devinfo) -+{ -+ struct brcmf_fw_request *fwreq; -+ struct brcmf_fw_name fwnames[] = { -+ { ".bin", devinfo->fw_name }, -+ }; -+ -+ fwreq = brcmf_fw_alloc_request(devinfo->bus_pub.devid, -+ devinfo->bus_pub.chiprev, -+ brcmf_usb_fwnames, -+ ARRAY_SIZE(brcmf_usb_fwnames), -+ fwnames, ARRAY_SIZE(fwnames)); -+ if (!fwreq) -+ return NULL; -+ -+ fwreq->items[BRCMF_USB_FW_CODE].type = BRCMF_FW_TYPE_BINARY; -+ -+ return fwreq; -+} -+ - static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo) - { - struct brcmf_bus *bus = NULL; -@@ -1249,24 +1270,12 @@ static int brcmf_usb_probe_cb(struct brc - bus->chip = bus_pub->devid; - bus->chiprev = bus_pub->chiprev; - -- ret = brcmf_fw_map_chip_to_name(bus_pub->devid, bus_pub->chiprev, -- brcmf_usb_fwnames, -- ARRAY_SIZE(brcmf_usb_fwnames), -- devinfo->fw_name, NULL); -- if (ret) -- goto fail; -- -- fwreq = kzalloc(sizeof(*fwreq) + sizeof(struct brcmf_fw_item), -- GFP_KERNEL); -+ fwreq = brcmf_usb_prepare_fw_request(devinfo); - if (!fwreq) { - ret = -ENOMEM; - goto fail; - } - -- fwreq->items[BRCMF_USB_FW_CODE].path = devinfo->fw_name; -- fwreq->items[BRCMF_USB_FW_CODE].type = BRCMF_FW_TYPE_BINARY; -- fwreq->n_items = 1; -- - /* request firmware here */ - ret = brcmf_fw_get_firmwares(dev, fwreq, brcmf_usb_probe_phase2); - if (ret) { -@@ -1469,15 +1478,10 @@ static int brcmf_usb_reset_resume(struct - - brcmf_dbg(USB, "Enter\n"); - -- fwreq = kzalloc(sizeof(*fwreq) + sizeof(struct brcmf_fw_item), -- GFP_KERNEL); -+ fwreq = brcmf_usb_prepare_fw_request(devinfo); - if (!fwreq) - return -ENOMEM; - -- fwreq->items[BRCMF_USB_FW_CODE].path = devinfo->fw_name; -- fwreq->items[BRCMF_USB_FW_CODE].type = BRCMF_FW_TYPE_BINARY; -- fwreq->n_items = 1; -- - ret = brcmf_fw_get_firmwares(&usb->dev, fwreq, brcmf_usb_probe_phase2); - if (ret < 0) - kfree(fwreq); diff --git a/package/kernel/mac80211/patches/327-v4.17-0009-brcmfmac-add-extension-to-.get_fwname-callbacks.patch b/package/kernel/mac80211/patches/327-v4.17-0009-brcmfmac-add-extension-to-.get_fwname-callbacks.patch deleted file mode 100644 index 391229a865112e..00000000000000 --- a/package/kernel/mac80211/patches/327-v4.17-0009-brcmfmac-add-extension-to-.get_fwname-callbacks.patch +++ /dev/null @@ -1,231 +0,0 @@ -From bf7a7b37f6ef5090a2bae7e7ae23cd26b741cca4 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Thu, 22 Mar 2018 21:28:28 +0100 -Subject: [PATCH] brcmfmac: add extension to .get_fwname() callbacks - -This changes the bus layer api by having the caller provide an -extension. With this the callback can use brcmf_fw_alloc_request() -to get the needed firmware name. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 6 +-- - .../wireless/broadcom/brcm80211/brcmfmac/common.c | 43 +++------------------- - .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 27 +++++++------- - .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 26 +++++++------ - .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 27 ++++++++------ - 5 files changed, 51 insertions(+), 78 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h -@@ -88,7 +88,7 @@ struct brcmf_bus_ops { - void (*wowl_config)(struct device *dev, bool enabled); - size_t (*get_ramsize)(struct device *dev); - int (*get_memdump)(struct device *dev, void *data, size_t len); -- int (*get_fwname)(struct device *dev, uint chip, uint chiprev, -+ int (*get_fwname)(struct device *dev, const char *ext, - unsigned char *fw_name); - }; - -@@ -228,10 +228,10 @@ int brcmf_bus_get_memdump(struct brcmf_b - } - - static inline --int brcmf_bus_get_fwname(struct brcmf_bus *bus, uint chip, uint chiprev, -+int brcmf_bus_get_fwname(struct brcmf_bus *bus, const char *ext, - unsigned char *fw_name) - { -- return bus->ops->get_fwname(bus->dev, chip, chiprev, fw_name); -+ return bus->ops->get_fwname(bus->dev, ext, fw_name); - } - - /* ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -@@ -129,42 +129,9 @@ static int brcmf_c_download(struct brcmf - return err; - } - --static int brcmf_c_get_clm_name(struct brcmf_if *ifp, u8 *clm_name) --{ -- struct brcmf_bus *bus = ifp->drvr->bus_if; -- u8 fw_name[BRCMF_FW_NAME_LEN]; -- u8 *ptr; -- size_t len; -- s32 err; -- -- memset(fw_name, 0, BRCMF_FW_NAME_LEN); -- err = brcmf_bus_get_fwname(bus, bus->chip, bus->chiprev, fw_name); -- if (err) { -- brcmf_err("get firmware name failed (%d)\n", err); -- goto done; -- } -- -- /* generate CLM blob file name */ -- ptr = strrchr(fw_name, '.'); -- if (!ptr) { -- err = -ENOENT; -- goto done; -- } -- -- len = ptr - fw_name + 1; -- if (len + strlen(".clm_blob") > BRCMF_FW_NAME_LEN) { -- err = -E2BIG; -- } else { -- strlcpy(clm_name, fw_name, len); -- strlcat(clm_name, ".clm_blob", BRCMF_FW_NAME_LEN); -- } --done: -- return err; --} -- - static int brcmf_c_process_clm_blob(struct brcmf_if *ifp) - { -- struct device *dev = ifp->drvr->bus_if->dev; -+ struct brcmf_bus *bus = ifp->drvr->bus_if; - struct brcmf_dload_data_le *chunk_buf; - const struct firmware *clm = NULL; - u8 clm_name[BRCMF_FW_NAME_LEN]; -@@ -177,16 +144,16 @@ static int brcmf_c_process_clm_blob(stru - - brcmf_dbg(TRACE, "Enter\n"); - -- memset(clm_name, 0, BRCMF_FW_NAME_LEN); -- err = brcmf_c_get_clm_name(ifp, clm_name); -+ memset(clm_name, 0, sizeof(clm_name)); -+ err = brcmf_bus_get_fwname(bus, ".clm_blob", clm_name); - if (err) { - brcmf_err("get CLM blob file name failed (%d)\n", err); - return err; - } - -- err = request_firmware(&clm, clm_name, dev); -+ err = request_firmware(&clm, clm_name, bus->dev); - if (err) { -- brcmf_info("no clm_blob available(err=%d), device may have limited channels available\n", -+ brcmf_info("no clm_blob available (err=%d), device may have limited channels available\n", - err); - return 0; - } ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -@@ -1350,23 +1350,24 @@ static int brcmf_pcie_get_memdump(struct - return 0; - } - --static int brcmf_pcie_get_fwname(struct device *dev, u32 chip, u32 chiprev, -- u8 *fw_name) -+static -+int brcmf_pcie_get_fwname(struct device *dev, const char *ext, u8 *fw_name) - { - struct brcmf_bus *bus_if = dev_get_drvdata(dev); -- struct brcmf_pciedev *buspub = bus_if->bus_priv.pcie; -- struct brcmf_pciedev_info *devinfo = buspub->devinfo; -- int ret = 0; -+ struct brcmf_fw_request *fwreq; -+ struct brcmf_fw_name fwnames[] = { -+ { ext, fw_name }, -+ }; - -- if (devinfo->fw_name[0] != '\0') -- strlcpy(fw_name, devinfo->fw_name, BRCMF_FW_NAME_LEN); -- else -- ret = brcmf_fw_map_chip_to_name(chip, chiprev, -- brcmf_pcie_fwnames, -- ARRAY_SIZE(brcmf_pcie_fwnames), -- fw_name, NULL); -+ fwreq = brcmf_fw_alloc_request(bus_if->chip, bus_if->chiprev, -+ brcmf_pcie_fwnames, -+ ARRAY_SIZE(brcmf_pcie_fwnames), -+ fwnames, ARRAY_SIZE(fwnames)); -+ if (!fwreq) -+ return -ENOMEM; - -- return ret; -+ kfree(fwreq); -+ return 0; - } - - static const struct brcmf_bus_ops brcmf_pcie_bus_ops = { ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -4000,22 +4000,24 @@ brcmf_sdio_watchdog(unsigned long data) - } - } - --static int brcmf_sdio_get_fwname(struct device *dev, u32 chip, u32 chiprev, -- u8 *fw_name) -+static -+int brcmf_sdio_get_fwname(struct device *dev, const char *ext, u8 *fw_name) - { - struct brcmf_bus *bus_if = dev_get_drvdata(dev); -- struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; -- int ret = 0; -+ struct brcmf_fw_request *fwreq; -+ struct brcmf_fw_name fwnames[] = { -+ { ext, fw_name }, -+ }; - -- if (sdiodev->fw_name[0] != '\0') -- strlcpy(fw_name, sdiodev->fw_name, BRCMF_FW_NAME_LEN); -- else -- ret = brcmf_fw_map_chip_to_name(chip, chiprev, -- brcmf_sdio_fwnames, -- ARRAY_SIZE(brcmf_sdio_fwnames), -- fw_name, NULL); -+ fwreq = brcmf_fw_alloc_request(bus_if->chip, bus_if->chiprev, -+ brcmf_sdio_fwnames, -+ ARRAY_SIZE(brcmf_sdio_fwnames), -+ fwnames, ARRAY_SIZE(fwnames)); -+ if (!fwreq) -+ return -ENOMEM; - -- return ret; -+ kfree(fwreq); -+ return 0; - } - - static const struct brcmf_bus_ops brcmf_sdio_bus_ops = { ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c -@@ -1128,21 +1128,24 @@ static void brcmf_usb_wowl_config(struct - device_set_wakeup_enable(devinfo->dev, false); - } - --static int brcmf_usb_get_fwname(struct device *dev, u32 chip, u32 chiprev, -- u8 *fw_name) -+static -+int brcmf_usb_get_fwname(struct device *dev, const char *ext, u8 *fw_name) - { -- struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev); -- int ret = 0; -+ struct brcmf_bus *bus = dev_get_drvdata(dev); -+ struct brcmf_fw_request *fwreq; -+ struct brcmf_fw_name fwnames[] = { -+ { ext, fw_name }, -+ }; - -- if (devinfo->fw_name[0] != '\0') -- strlcpy(fw_name, devinfo->fw_name, BRCMF_FW_NAME_LEN); -- else -- ret = brcmf_fw_map_chip_to_name(chip, chiprev, -- brcmf_usb_fwnames, -- ARRAY_SIZE(brcmf_usb_fwnames), -- fw_name, NULL); -+ fwreq = brcmf_fw_alloc_request(bus->chip, bus->chiprev, -+ brcmf_usb_fwnames, -+ ARRAY_SIZE(brcmf_usb_fwnames), -+ fwnames, ARRAY_SIZE(fwnames)); -+ if (!fwreq) -+ return -ENOMEM; - -- return ret; -+ kfree(fwreq); -+ return 0; - } - - static const struct brcmf_bus_ops brcmf_usb_bus_ops = { diff --git a/package/kernel/mac80211/patches/327-v4.17-0010-brcmfmac-get-rid-of-brcmf_fw_map_chip_to_name.patch b/package/kernel/mac80211/patches/327-v4.17-0010-brcmfmac-get-rid-of-brcmf_fw_map_chip_to_name.patch deleted file mode 100644 index becf7cf3fbf9d4..00000000000000 --- a/package/kernel/mac80211/patches/327-v4.17-0010-brcmfmac-get-rid-of-brcmf_fw_map_chip_to_name.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 18c2b20e276e04476a3350b4a92c1dfad725d45d Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Thu, 22 Mar 2018 21:28:29 +0100 -Subject: [PATCH] brcmfmac: get rid of brcmf_fw_map_chip_to_name() - -The function is no longer used so removing it. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../broadcom/brcm80211/brcmfmac/firmware.c | 53 ---------------------- - .../broadcom/brcm80211/brcmfmac/firmware.h | 4 -- - 2 files changed, 57 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -@@ -635,59 +635,6 @@ static void brcmf_fw_get_full_name(char - strlcat(fw_name, extension, BRCMF_FW_NAME_LEN); - } - --int brcmf_fw_map_chip_to_name(u32 chip, u32 chiprev, -- struct brcmf_firmware_mapping mapping_table[], -- u32 table_size, char fw_name[BRCMF_FW_NAME_LEN], -- char nvram_name[BRCMF_FW_NAME_LEN]) --{ -- char chipname[12]; -- u32 i; -- char end; -- -- for (i = 0; i < table_size; i++) { -- if (mapping_table[i].chipid == chip && -- mapping_table[i].revmask & BIT(chiprev)) -- break; -- } -- -- if (i == table_size) { -- brcmf_err("Unknown chipid %d [%d]\n", chip, chiprev); -- return -ENODEV; -- } -- -- brcmf_chip_name(chip, chiprev, chipname, sizeof(chipname)); -- -- /* check if firmware path is provided by module parameter */ -- if (brcmf_mp_global.firmware_path[0] != '\0') { -- if (fw_name) -- strlcpy(fw_name, brcmf_mp_global.firmware_path, -- BRCMF_FW_NAME_LEN); -- if (nvram_name) -- strlcpy(nvram_name, brcmf_mp_global.firmware_path, -- BRCMF_FW_NAME_LEN); -- -- end = brcmf_mp_global.firmware_path[ -- strlen(brcmf_mp_global.firmware_path) - 1]; -- if (end != '/') { -- if (fw_name) -- strlcat(fw_name, "/", BRCMF_FW_NAME_LEN); -- if (nvram_name) -- strlcat(nvram_name, "/", BRCMF_FW_NAME_LEN); -- } -- } -- -- brcmf_info("using %s for chip %s\n", -- mapping_table[i].fw_base, chipname); -- if (fw_name) -- brcmf_fw_get_full_name(fw_name, -- mapping_table[i].fw_base, ".bin"); -- if (nvram_name) -- brcmf_fw_get_full_name(nvram_name, -- mapping_table[i].fw_base, ".txt"); -- -- return 0; --} -- - struct brcmf_fw_request * - brcmf_fw_alloc_request(u32 chip, u32 chiprev, - struct brcmf_firmware_mapping mapping_table[], ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h -@@ -46,10 +46,6 @@ MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw - #define BRCMF_FW_ENTRY(chipid, mask, name) \ - { chipid, mask, BRCM_ ## name ## _FIRMWARE_BASENAME } - --int brcmf_fw_map_chip_to_name(u32 chip, u32 chiprev, -- struct brcmf_firmware_mapping mapping_table[], -- u32 table_size, char fw_name[BRCMF_FW_NAME_LEN], -- char nvram_name[BRCMF_FW_NAME_LEN]); - void brcmf_fw_nvram_free(void *nvram); - - enum brcmf_fw_type { diff --git a/package/kernel/mac80211/patches/327-v4.17-0011-brcmfmac-get-rid-of-brcmf_fw_get_full_name.patch b/package/kernel/mac80211/patches/327-v4.17-0011-brcmfmac-get-rid-of-brcmf_fw_get_full_name.patch deleted file mode 100644 index d831f44fcdc50b..00000000000000 --- a/package/kernel/mac80211/patches/327-v4.17-0011-brcmfmac-get-rid-of-brcmf_fw_get_full_name.patch +++ /dev/null @@ -1,44 +0,0 @@ -From bf291b7247e53f52a4236c0b55a5df046d6177df Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Thu, 22 Mar 2018 21:28:30 +0100 -Subject: [PATCH] brcmfmac: get rid of brcmf_fw_get_full_name() - -The function was pretty minimal and now it is called only from one -place so just get rid of it. - -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 14 ++++---------- - 1 file changed, 4 insertions(+), 10 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -@@ -628,13 +628,6 @@ int brcmf_fw_get_firmwares(struct device - return 0; - } - --static void brcmf_fw_get_full_name(char fw_name[BRCMF_FW_NAME_LEN], -- const char *fw_base, const char *extension) --{ -- strlcat(fw_name, fw_base, BRCMF_FW_NAME_LEN); -- strlcat(fw_name, extension, BRCMF_FW_NAME_LEN); --} -- - struct brcmf_fw_request * - brcmf_fw_alloc_request(u32 chip, u32 chiprev, - struct brcmf_firmware_mapping mapping_table[], -@@ -685,9 +678,10 @@ brcmf_fw_alloc_request(u32 chip, u32 chi - BRCMF_FW_NAME_LEN); - } - } -- brcmf_fw_get_full_name(fwnames[j].path, -- mapping_table[i].fw_base, -- fwnames[j].extension); -+ strlcat(fwnames[j].path, mapping_table[i].fw_base, -+ BRCMF_FW_NAME_LEN); -+ strlcat(fwnames[j].path, fwnames[j].extension, -+ BRCMF_FW_NAME_LEN); - fwreq->items[j].path = fwnames[j].path; - } - diff --git a/package/kernel/mac80211/patches/327-v4.17-0012-brcmfmac-add-kerneldoc-for-struct-brcmf_bus-msgbuf.patch b/package/kernel/mac80211/patches/327-v4.17-0012-brcmfmac-add-kerneldoc-for-struct-brcmf_bus-msgbuf.patch deleted file mode 100644 index 1c9c99599f0781..00000000000000 --- a/package/kernel/mac80211/patches/327-v4.17-0012-brcmfmac-add-kerneldoc-for-struct-brcmf_bus-msgbuf.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 48eaee3f272a5bfe6986d07c51f6975d3c2f74d1 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Thu, 22 Mar 2018 21:28:31 +0100 -Subject: [PATCH] brcmfmac: add kerneldoc for struct brcmf_bus::msgbuf - -This field did not have kerneldoc description so adding it now. - -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h -@@ -140,6 +140,7 @@ struct brcmf_bus_stats { - * @always_use_fws_queue: bus wants use queue also when fwsignal is inactive. - * @wowl_supported: is wowl supported by bus driver. - * @chiprev: revision of the dongle chip. -+ * @msgbuf: msgbuf protocol parameters provided by bus layer. - */ - struct brcmf_bus { - union { diff --git a/package/kernel/mac80211/patches/328-v4.17-0001-brcmfmac-fix-firmware-request-processing-if-nvram-lo.patch b/package/kernel/mac80211/patches/328-v4.17-0001-brcmfmac-fix-firmware-request-processing-if-nvram-lo.patch deleted file mode 100644 index cd2279dd65c819..00000000000000 --- a/package/kernel/mac80211/patches/328-v4.17-0001-brcmfmac-fix-firmware-request-processing-if-nvram-lo.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 0b5c0305e57ca940713bcb2b202fd2b412c62f31 Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Tue, 3 Apr 2018 10:18:15 +0200 -Subject: [PATCH] brcmfmac: fix firmware request processing if nvram load fails - -When nvram loading fails a double free occurred. Fix this and reorg the -code a little. - -Fixes: d09ae51a4b67 ("brcmfmac: pass struct in brcmf_fw_get_firmwares()") -Reported-by: Dan Carpenter -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../broadcom/brcm80211/brcmfmac/firmware.c | 36 ++++++++++++---------- - 1 file changed, 20 insertions(+), 16 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -@@ -459,7 +459,7 @@ static void brcmf_fw_free_request(struct - kfree(req); - } - --static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx) -+static int brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx) - { - struct brcmf_fw *fwctx = ctx; - struct brcmf_fw_item *cur; -@@ -498,13 +498,10 @@ static void brcmf_fw_request_nvram_done( - brcmf_dbg(TRACE, "nvram %p len %d\n", nvram, nvram_length); - cur->nv_data.data = nvram; - cur->nv_data.len = nvram_length; -- return; -+ return 0; - - fail: -- brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev)); -- fwctx->done(fwctx->dev, -ENOENT, NULL); -- brcmf_fw_free_request(fwctx->req); -- kfree(fwctx); -+ return -ENOENT; - } - - static int brcmf_fw_request_next_item(struct brcmf_fw *fwctx, bool async) -@@ -553,20 +550,27 @@ static void brcmf_fw_request_done(const - brcmf_dbg(TRACE, "enter: firmware %s %sfound\n", cur->path, - fw ? "" : "not "); - -- if (fw) { -- if (cur->type == BRCMF_FW_TYPE_BINARY) -- cur->binary = fw; -- else if (cur->type == BRCMF_FW_TYPE_NVRAM) -- brcmf_fw_request_nvram_done(fw, fwctx); -- else -- release_firmware(fw); -- } else if (cur->type == BRCMF_FW_TYPE_NVRAM) { -- brcmf_fw_request_nvram_done(NULL, fwctx); -- } else if (!(cur->flags & BRCMF_FW_REQF_OPTIONAL)) { -+ if (!fw) - ret = -ENOENT; -+ -+ switch (cur->type) { -+ case BRCMF_FW_TYPE_NVRAM: -+ ret = brcmf_fw_request_nvram_done(fw, fwctx); -+ break; -+ case BRCMF_FW_TYPE_BINARY: -+ cur->binary = fw; -+ break; -+ default: -+ /* something fishy here so bail out early */ -+ brcmf_err("unknown fw type: %d\n", cur->type); -+ release_firmware(fw); -+ ret = -EINVAL; - goto fail; - } - -+ if (ret < 0 && !(cur->flags & BRCMF_FW_REQF_OPTIONAL)) -+ goto fail; -+ - do { - if (++fwctx->curpos == fwctx->req->n_items) { - ret = 0; diff --git a/package/kernel/mac80211/patches/329-v4.18-0001-brcmfmac-add-support-for-BCM4366E-chipset.patch b/package/kernel/mac80211/patches/329-v4.18-0001-brcmfmac-add-support-for-BCM4366E-chipset.patch deleted file mode 100644 index e31d69826daa6e..00000000000000 --- a/package/kernel/mac80211/patches/329-v4.18-0001-brcmfmac-add-support-for-BCM4366E-chipset.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 1f589e2510d5df1192dca7c089103a2cbd028101 Mon Sep 17 00:00:00 2001 -From: Dan Haab -Date: Tue, 3 Apr 2018 10:21:56 +0200 -Subject: [PATCH] brcmfmac: add support for BCM4366E chipset - -BCM4366E is a wireless chipset with a BCM43664 ChipCommon. It's -supported by the same firmware as 4366c0. - -Signed-off-by: Dan Haab -[arend: rebase patch and remove unnecessary definition] -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 1 + - drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 1 + - drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 1 + - 3 files changed, 3 insertions(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c -@@ -689,6 +689,7 @@ static u32 brcmf_chip_tcm_rambase(struct - case BRCM_CC_43525_CHIP_ID: - case BRCM_CC_4365_CHIP_ID: - case BRCM_CC_4366_CHIP_ID: -+ case BRCM_CC_43664_CHIP_ID: - return 0x200000; - case CY_CC_4373_CHIP_ID: - return 0x160000; ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -@@ -75,6 +75,7 @@ static struct brcmf_firmware_mapping brc - BRCMF_FW_ENTRY(BRCM_CC_4365_CHIP_ID, 0xFFFFFFF0, 4365C), - BRCMF_FW_ENTRY(BRCM_CC_4366_CHIP_ID, 0x0000000F, 4366B), - BRCMF_FW_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFF0, 4366C), -+ BRCMF_FW_ENTRY(BRCM_CC_43664_CHIP_ID, 0xFFFFFFF0, 4366C), - BRCMF_FW_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371), - }; - ---- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h -+++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h -@@ -57,6 +57,7 @@ - #define BRCM_CC_43602_CHIP_ID 43602 - #define BRCM_CC_4365_CHIP_ID 0x4365 - #define BRCM_CC_4366_CHIP_ID 0x4366 -+#define BRCM_CC_43664_CHIP_ID 43664 - #define BRCM_CC_4371_CHIP_ID 0x4371 - #define CY_CC_4373_CHIP_ID 0x4373 - diff --git a/package/kernel/mac80211/patches/330-v4.18-0001-brcmfmac-check-p2pdev-mac-address-uniqueness.patch b/package/kernel/mac80211/patches/330-v4.18-0001-brcmfmac-check-p2pdev-mac-address-uniqueness.patch deleted file mode 100644 index 909000cc59796a..00000000000000 --- a/package/kernel/mac80211/patches/330-v4.18-0001-brcmfmac-check-p2pdev-mac-address-uniqueness.patch +++ /dev/null @@ -1,34 +0,0 @@ -From cb746e47837ad0f35c8ae28e9aacc8eb07916d2a Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Thu, 26 Apr 2018 12:16:47 +0200 -Subject: [PATCH] brcmfmac: check p2pdev mac address uniqueness - -The mac address for p2pdev must be different from the primary interface -due to firmware requirement. Add an explicit check for this requirement -if user-space provides a mac address. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 7 +++++++ - 1 file changed, 7 insertions(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c -@@ -2073,6 +2073,13 @@ static struct wireless_dev *brcmf_p2p_cr - } - - pri_ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; -+ -+ /* firmware requires unique mac address for p2pdev interface */ -+ if (addr && ether_addr_equal(addr, pri_ifp->mac_addr)) { -+ brcmf_err("discovery vif must be different from primary interface\n"); -+ return ERR_PTR(-EINVAL); -+ } -+ - brcmf_p2p_generate_bss_mac(p2p, addr); - brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr); - diff --git a/package/kernel/mac80211/patches/330-v4.18-0002-brcmfmac-reports-boottime_ns-while-informing-bss.patch b/package/kernel/mac80211/patches/330-v4.18-0002-brcmfmac-reports-boottime_ns-while-informing-bss.patch deleted file mode 100644 index 4f59507cab50b0..00000000000000 --- a/package/kernel/mac80211/patches/330-v4.18-0002-brcmfmac-reports-boottime_ns-while-informing-bss.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 7742fce4c007141617dab9bcb90034b3c0fe2347 Mon Sep 17 00:00:00 2001 -From: Franky Lin -Date: Thu, 26 Apr 2018 12:18:35 +0200 -Subject: [PATCH] brcmfmac: reports boottime_ns while informing bss - -Provides a timestamp in bss information so user space can see when the -bss info was updated. Since tsf is not available from the dongle events -boottime is reported instead. - -Reported-by: Dmitry Shmidt -Reviewed-by: Arend van Spriel -Signed-off-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../broadcom/brcm80211/brcmfmac/cfg80211.c | 26 +++++++++++----------- - 1 file changed, 13 insertions(+), 13 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2728,7 +2728,6 @@ static s32 brcmf_inform_single_bss(struc - struct brcmf_bss_info_le *bi) - { - struct wiphy *wiphy = cfg_to_wiphy(cfg); -- struct ieee80211_channel *notify_channel; - struct cfg80211_bss *bss; - struct ieee80211_supported_band *band; - struct brcmu_chan ch; -@@ -2738,7 +2737,7 @@ static s32 brcmf_inform_single_bss(struc - u16 notify_interval; - u8 *notify_ie; - size_t notify_ielen; -- s32 notify_signal; -+ struct cfg80211_inform_bss bss_data = { 0 }; - - if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) { - brcmf_err("Bss info is larger than buffer. Discarding\n"); -@@ -2758,27 +2757,28 @@ static s32 brcmf_inform_single_bss(struc - band = wiphy->bands[NL80211_BAND_5GHZ]; - - freq = ieee80211_channel_to_frequency(channel, band->band); -- notify_channel = ieee80211_get_channel(wiphy, freq); -+ bss_data.chan = ieee80211_get_channel(wiphy, freq); -+ bss_data.scan_width = NL80211_BSS_CHAN_WIDTH_20; -+ bss_data.boottime_ns = ktime_to_ns(ktime_get_boottime()); - - notify_capability = le16_to_cpu(bi->capability); - notify_interval = le16_to_cpu(bi->beacon_period); - notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset); - notify_ielen = le32_to_cpu(bi->ie_length); -- notify_signal = (s16)le16_to_cpu(bi->RSSI) * 100; -+ bss_data.signal = (s16)le16_to_cpu(bi->RSSI) * 100; - - brcmf_dbg(CONN, "bssid: %pM\n", bi->BSSID); - brcmf_dbg(CONN, "Channel: %d(%d)\n", channel, freq); - brcmf_dbg(CONN, "Capability: %X\n", notify_capability); - brcmf_dbg(CONN, "Beacon interval: %d\n", notify_interval); -- brcmf_dbg(CONN, "Signal: %d\n", notify_signal); -+ brcmf_dbg(CONN, "Signal: %d\n", bss_data.signal); - -- bss = cfg80211_inform_bss(wiphy, notify_channel, -- CFG80211_BSS_FTYPE_UNKNOWN, -- (const u8 *)bi->BSSID, -- 0, notify_capability, -- notify_interval, notify_ie, -- notify_ielen, notify_signal, -- GFP_KERNEL); -+ bss = cfg80211_inform_bss_data(wiphy, &bss_data, -+ CFG80211_BSS_FTYPE_UNKNOWN, -+ (const u8 *)bi->BSSID, -+ 0, notify_capability, -+ notify_interval, notify_ie, -+ notify_ielen, GFP_KERNEL); - - if (!bss) - return -ENOMEM; diff --git a/package/kernel/mac80211/patches/330-v4.18-0003-brcmfmac-use-nl80211_band-directly-to-get-ieee80211-.patch b/package/kernel/mac80211/patches/330-v4.18-0003-brcmfmac-use-nl80211_band-directly-to-get-ieee80211-.patch deleted file mode 100644 index 2d60c0d9ee4acd..00000000000000 --- a/package/kernel/mac80211/patches/330-v4.18-0003-brcmfmac-use-nl80211_band-directly-to-get-ieee80211-.patch +++ /dev/null @@ -1,43 +0,0 @@ -From aed14219067ab96e5eeb7730e9bceed10d9be989 Mon Sep 17 00:00:00 2001 -From: Franky Lin -Date: Thu, 26 Apr 2018 12:16:48 +0200 -Subject: [PATCH] brcmfmac: use nl80211_band directly to get ieee80211 channel - -The enum nl80211_band used to retrieve wiphy->bands is the same as -wiphy->bands->band which is checked by wiphy_register(). So it can be used -directly as parameter of ieee80211_channel_to_frequency(). - -Reviewed-by: Arend van Spriel -Signed-off-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2729,7 +2729,7 @@ static s32 brcmf_inform_single_bss(struc - { - struct wiphy *wiphy = cfg_to_wiphy(cfg); - struct cfg80211_bss *bss; -- struct ieee80211_supported_band *band; -+ enum nl80211_band band; - struct brcmu_chan ch; - u16 channel; - u32 freq; -@@ -2752,11 +2752,11 @@ static s32 brcmf_inform_single_bss(struc - channel = bi->ctl_ch; - - if (channel <= CH_MAX_2G_CHANNEL) -- band = wiphy->bands[NL80211_BAND_2GHZ]; -+ band = NL80211_BAND_2GHZ; - else -- band = wiphy->bands[NL80211_BAND_5GHZ]; -+ band = NL80211_BAND_5GHZ; - -- freq = ieee80211_channel_to_frequency(channel, band->band); -+ freq = ieee80211_channel_to_frequency(channel, band); - bss_data.chan = ieee80211_get_channel(wiphy, freq); - bss_data.scan_width = NL80211_BSS_CHAN_WIDTH_20; - bss_data.boottime_ns = ktime_to_ns(ktime_get_boottime()); diff --git a/package/kernel/mac80211/patches/330-v4.18-0004-brcmfmac-constify-firmware-mapping-tables.patch b/package/kernel/mac80211/patches/330-v4.18-0004-brcmfmac-constify-firmware-mapping-tables.patch deleted file mode 100644 index df2648374a8280..00000000000000 --- a/package/kernel/mac80211/patches/330-v4.18-0004-brcmfmac-constify-firmware-mapping-tables.patch +++ /dev/null @@ -1,76 +0,0 @@ -From ff68c9f9c06d1fd437c8f90fc05ca28c47f7d85e Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Thu, 26 Apr 2018 12:16:49 +0200 -Subject: [PATCH] brcmfmac: constify firmware mapping tables - -The information in the firmware mapping does not need to be modified -so it can be static const. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 2 +- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h | 2 +- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 2 +- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 +- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 2 +- - 5 files changed, 5 insertions(+), 5 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -@@ -634,7 +634,7 @@ int brcmf_fw_get_firmwares(struct device - - struct brcmf_fw_request * - brcmf_fw_alloc_request(u32 chip, u32 chiprev, -- struct brcmf_firmware_mapping mapping_table[], -+ const struct brcmf_firmware_mapping mapping_table[], - u32 table_size, struct brcmf_fw_name *fwnames, - u32 n_fwnames) - { ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h -@@ -80,7 +80,7 @@ struct brcmf_fw_name { - - struct brcmf_fw_request * - brcmf_fw_alloc_request(u32 chip, u32 chiprev, -- struct brcmf_firmware_mapping mapping_table[], -+ const struct brcmf_firmware_mapping mapping_table[], - u32 table_size, struct brcmf_fw_name *fwnames, - u32 n_fwnames); - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -@@ -59,7 +59,7 @@ BRCMF_FW_DEF(4366B, "brcmfmac4366b-pcie" - BRCMF_FW_DEF(4366C, "brcmfmac4366c-pcie"); - BRCMF_FW_DEF(4371, "brcmfmac4371-pcie"); - --static struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = { -+static const struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = { - BRCMF_FW_ENTRY(BRCM_CC_43602_CHIP_ID, 0xFFFFFFFF, 43602), - BRCMF_FW_ENTRY(BRCM_CC_43465_CHIP_ID, 0xFFFFFFF0, 4366C), - BRCMF_FW_ENTRY(BRCM_CC_4350_CHIP_ID, 0x000000FF, 4350C), ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -619,7 +619,7 @@ BRCMF_FW_DEF(4354, "brcmfmac4354-sdio"); - BRCMF_FW_DEF(4356, "brcmfmac4356-sdio"); - BRCMF_FW_DEF(4373, "brcmfmac4373-sdio"); - --static struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = { -+static const struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = { - BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143), - BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x0000001F, 43241B0), - BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x00000020, 43241B4), ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c -@@ -52,7 +52,7 @@ BRCMF_FW_DEF(43242A, "brcmfmac43242a"); - BRCMF_FW_DEF(43569, "brcmfmac43569"); - BRCMF_FW_DEF(4373, "brcmfmac4373"); - --static struct brcmf_firmware_mapping brcmf_usb_fwnames[] = { -+static const struct brcmf_firmware_mapping brcmf_usb_fwnames[] = { - BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143), - BRCMF_FW_ENTRY(BRCM_CC_43235_CHIP_ID, 0x00000008, 43236B), - BRCMF_FW_ENTRY(BRCM_CC_43236_CHIP_ID, 0x00000008, 43236B), diff --git a/package/kernel/mac80211/patches/330-v4.18-0005-brcmfmac-add-hostready-indication.patch b/package/kernel/mac80211/patches/330-v4.18-0005-brcmfmac-add-hostready-indication.patch deleted file mode 100644 index e3d4441f7f8acc..00000000000000 --- a/package/kernel/mac80211/patches/330-v4.18-0005-brcmfmac-add-hostready-indication.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 84ad327d18debe19b8d509059b61db445d048b02 Mon Sep 17 00:00:00 2001 -From: Franky Lin -Date: Thu, 26 Apr 2018 12:16:50 +0200 -Subject: [PATCH] brcmfmac: add hostready indication - -A hostready signal is introduced to inform firmware through mailbox -doorbell1 when common ring initialized or D3 exited. - -Reviewed-by: Arend van Spriel -Signed-off-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 14 ++++++++++++-- - 1 file changed, 12 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -@@ -105,7 +105,8 @@ static const struct brcmf_firmware_mappi - #define BRCMF_PCIE_PCIE2REG_MAILBOXMASK 0x4C - #define BRCMF_PCIE_PCIE2REG_CONFIGADDR 0x120 - #define BRCMF_PCIE_PCIE2REG_CONFIGDATA 0x124 --#define BRCMF_PCIE_PCIE2REG_H2D_MAILBOX 0x140 -+#define BRCMF_PCIE_PCIE2REG_H2D_MAILBOX_0 0x140 -+#define BRCMF_PCIE_PCIE2REG_H2D_MAILBOX_1 0x144 - - #define BRCMF_PCIE2_INTA 0x01 - #define BRCMF_PCIE2_INTB 0x02 -@@ -140,6 +141,7 @@ static const struct brcmf_firmware_mappi - #define BRCMF_PCIE_SHARED_VERSION_MASK 0x00FF - #define BRCMF_PCIE_SHARED_DMA_INDEX 0x10000 - #define BRCMF_PCIE_SHARED_DMA_2B_IDX 0x100000 -+#define BRCMF_PCIE_SHARED_HOSTRDY_DB1 0x10000000 - - #define BRCMF_PCIE_FLAGS_HTOD_SPLIT 0x4000 - #define BRCMF_PCIE_FLAGS_DTOH_SPLIT 0x8000 -@@ -782,6 +784,12 @@ static void brcmf_pcie_intr_enable(struc - BRCMF_PCIE_MB_INT_FN0_1); - } - -+static void brcmf_pcie_hostready(struct brcmf_pciedev_info *devinfo) -+{ -+ if (devinfo->shared.flags & BRCMF_PCIE_SHARED_HOSTRDY_DB1) -+ brcmf_pcie_write_reg32(devinfo, -+ BRCMF_PCIE_PCIE2REG_H2D_MAILBOX_1, 1); -+} - - static irqreturn_t brcmf_pcie_quick_check_isr(int irq, void *arg) - { -@@ -924,7 +932,7 @@ static int brcmf_pcie_ring_mb_ring_bell( - - brcmf_dbg(PCIE, "RING !\n"); - /* Any arbitrary value will do, lets use 1 */ -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_H2D_MAILBOX, 1); -+ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_H2D_MAILBOX_0, 1); - - return 0; - } -@@ -1728,6 +1736,7 @@ static void brcmf_pcie_setup(struct devi - init_waitqueue_head(&devinfo->mbdata_resp_wait); - - brcmf_pcie_intr_enable(devinfo); -+ brcmf_pcie_hostready(devinfo); - if (brcmf_attach(&devinfo->pdev->dev, devinfo->settings) == 0) - return; - -@@ -1950,6 +1959,7 @@ static int brcmf_pcie_pm_leave_D3(struct - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2); - brcmf_bus_change_state(bus, BRCMF_BUS_UP); - brcmf_pcie_intr_enable(devinfo); -+ brcmf_pcie_hostready(devinfo); - return 0; - } - diff --git a/package/kernel/mac80211/patches/330-v4.18-0006-brcmfmac-coarse-support-for-PCIe-shared-structure-re.patch b/package/kernel/mac80211/patches/330-v4.18-0006-brcmfmac-coarse-support-for-PCIe-shared-structure-re.patch deleted file mode 100644 index 8750037d85b216..00000000000000 --- a/package/kernel/mac80211/patches/330-v4.18-0006-brcmfmac-coarse-support-for-PCIe-shared-structure-re.patch +++ /dev/null @@ -1,97 +0,0 @@ -From f56324baf329bc9362a52ad77a4a1a0f3356d1bc Mon Sep 17 00:00:00 2001 -From: Franky Lin -Date: Thu, 26 Apr 2018 12:16:51 +0200 -Subject: [PATCH] brcmfmac: coarse support for PCIe shared structure rev7 - -Revision 7 of PCIe dongle interface increases the item size of tx and rx -complete rings to accommodate extra payload for new feature. This patch -simply bump up the size of these two rings without adding the support -for utilizing the new space. This makes brcmfmac compatible with rev7 -firmware. - -Reviewed-by: Arend van Spriel -Signed-off-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.h | 6 ++++-- - .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 23 ++++++++++++++++++---- - 2 files changed, 23 insertions(+), 6 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h -@@ -27,8 +27,10 @@ - #define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_ITEMSIZE 40 - #define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_ITEMSIZE 32 - #define BRCMF_D2H_MSGRING_CONTROL_COMPLETE_ITEMSIZE 24 --#define BRCMF_D2H_MSGRING_TX_COMPLETE_ITEMSIZE 16 --#define BRCMF_D2H_MSGRING_RX_COMPLETE_ITEMSIZE 32 -+#define BRCMF_D2H_MSGRING_TX_COMPLETE_ITEMSIZE_PRE_V7 16 -+#define BRCMF_D2H_MSGRING_TX_COMPLETE_ITEMSIZE 24 -+#define BRCMF_D2H_MSGRING_RX_COMPLETE_ITEMSIZE_PRE_V7 32 -+#define BRCMF_D2H_MSGRING_RX_COMPLETE_ITEMSIZE 40 - #define BRCMF_H2D_TXFLOWRING_ITEMSIZE 48 - - struct msgbuf_buf_addr { ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -@@ -136,8 +136,9 @@ static const struct brcmf_firmware_mappi - BRCMF_PCIE_MB_INT_D2H3_DB0 | \ - BRCMF_PCIE_MB_INT_D2H3_DB1) - -+#define BRCMF_PCIE_SHARED_VERSION_7 7 - #define BRCMF_PCIE_MIN_SHARED_VERSION 5 --#define BRCMF_PCIE_MAX_SHARED_VERSION 6 -+#define BRCMF_PCIE_MAX_SHARED_VERSION BRCMF_PCIE_SHARED_VERSION_7 - #define BRCMF_PCIE_SHARED_VERSION_MASK 0x00FF - #define BRCMF_PCIE_SHARED_DMA_INDEX 0x10000 - #define BRCMF_PCIE_SHARED_DMA_2B_IDX 0x100000 -@@ -318,6 +319,14 @@ static const u32 brcmf_ring_max_item[BRC - BRCMF_D2H_MSGRING_RX_COMPLETE_MAX_ITEM - }; - -+static const u32 brcmf_ring_itemsize_pre_v7[BRCMF_NROF_COMMON_MSGRINGS] = { -+ BRCMF_H2D_MSGRING_CONTROL_SUBMIT_ITEMSIZE, -+ BRCMF_H2D_MSGRING_RXPOST_SUBMIT_ITEMSIZE, -+ BRCMF_D2H_MSGRING_CONTROL_COMPLETE_ITEMSIZE, -+ BRCMF_D2H_MSGRING_TX_COMPLETE_ITEMSIZE_PRE_V7, -+ BRCMF_D2H_MSGRING_RX_COMPLETE_ITEMSIZE_PRE_V7 -+}; -+ - static const u32 brcmf_ring_itemsize[BRCMF_NROF_COMMON_MSGRINGS] = { - BRCMF_H2D_MSGRING_CONTROL_SUBMIT_ITEMSIZE, - BRCMF_H2D_MSGRING_RXPOST_SUBMIT_ITEMSIZE, -@@ -1007,8 +1016,14 @@ brcmf_pcie_alloc_dma_and_ring(struct brc - struct brcmf_pcie_ringbuf *ring; - u32 size; - u32 addr; -+ const u32 *ring_itemsize_array; -+ -+ if (devinfo->shared.version < BRCMF_PCIE_SHARED_VERSION_7) -+ ring_itemsize_array = brcmf_ring_itemsize_pre_v7; -+ else -+ ring_itemsize_array = brcmf_ring_itemsize; - -- size = brcmf_ring_max_item[ring_id] * brcmf_ring_itemsize[ring_id]; -+ size = brcmf_ring_max_item[ring_id] * ring_itemsize_array[ring_id]; - dma_buf = brcmf_pcie_init_dmabuffer_for_device(devinfo, size, - tcm_ring_phys_addr + BRCMF_RING_MEM_BASE_ADDR_OFFSET, - &dma_handle); -@@ -1018,7 +1033,7 @@ brcmf_pcie_alloc_dma_and_ring(struct brc - addr = tcm_ring_phys_addr + BRCMF_RING_MAX_ITEM_OFFSET; - brcmf_pcie_write_tcm16(devinfo, addr, brcmf_ring_max_item[ring_id]); - addr = tcm_ring_phys_addr + BRCMF_RING_LEN_ITEMS_OFFSET; -- brcmf_pcie_write_tcm16(devinfo, addr, brcmf_ring_itemsize[ring_id]); -+ brcmf_pcie_write_tcm16(devinfo, addr, ring_itemsize_array[ring_id]); - - ring = kzalloc(sizeof(*ring), GFP_KERNEL); - if (!ring) { -@@ -1027,7 +1042,7 @@ brcmf_pcie_alloc_dma_and_ring(struct brc - return NULL; - } - brcmf_commonring_config(&ring->commonring, brcmf_ring_max_item[ring_id], -- brcmf_ring_itemsize[ring_id], dma_buf); -+ ring_itemsize_array[ring_id], dma_buf); - ring->dma_handle = dma_handle; - ring->devinfo = devinfo; - brcmf_commonring_register_cb(&ring->commonring, diff --git a/package/kernel/mac80211/patches/331-v4.18-0001-brcmfmac-Add-support-for-bcm43364-wireless-chipset.patch b/package/kernel/mac80211/patches/331-v4.18-0001-brcmfmac-Add-support-for-bcm43364-wireless-chipset.patch deleted file mode 100644 index 13f169be9fb41a..00000000000000 --- a/package/kernel/mac80211/patches/331-v4.18-0001-brcmfmac-Add-support-for-bcm43364-wireless-chipset.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 9c4a121e82634aa000a702c98cd6f05b27d6e186 Mon Sep 17 00:00:00 2001 -From: Sean Lanigan -Date: Fri, 4 May 2018 16:48:23 +1000 -Subject: [PATCH] brcmfmac: Add support for bcm43364 wireless chipset - -Add support for the BCM43364 chipset via an SDIO interface, as used in -e.g. the Murata 1FX module. - -The BCM43364 uses the same firmware as the BCM43430 (which is already -included), the only difference is the omission of Bluetooth. - -However, the SDIO_ID for the BCM43364 is 02D0:A9A4, giving it a MODALIAS -of sdio:c00v02D0dA9A4, which doesn't get recognised and hence doesn't -load the brcmfmac module. Adding the 'A9A4' ID in the appropriate place -triggers the brcmfmac driver to load, and then correctly use the -firmware file 'brcmfmac43430-sdio.bin'. - -Signed-off-by: Sean Lanigan -Acked-by: Ulf Hansson -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 1 + - include/linux/mmc/sdio_ids.h | 1 + - 2 files changed, 2 insertions(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -963,6 +963,7 @@ static const struct sdio_device_id brcmf - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43340), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43341), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43362), -+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43364), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4335_4339), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4339), - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43430), ---- a/include/linux/mmc/sdio_ids.h -+++ b/include/linux/mmc/sdio_ids.h -@@ -34,6 +34,7 @@ - #define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335 - #define SDIO_DEVICE_ID_BROADCOM_4339 0x4339 - #define SDIO_DEVICE_ID_BROADCOM_43362 0xa962 -+#define SDIO_DEVICE_ID_BROADCOM_43364 0xa9a4 - #define SDIO_DEVICE_ID_BROADCOM_43430 0xa9a6 - #define SDIO_DEVICE_ID_BROADCOM_4345 0x4345 - #define SDIO_DEVICE_ID_BROADCOM_43455 0xa9bf diff --git a/package/kernel/mac80211/patches/332-v4.18-0001-brcmfmac-set-WIPHY_FLAG_HAVE_AP_SME-flag.patch b/package/kernel/mac80211/patches/332-v4.18-0001-brcmfmac-set-WIPHY_FLAG_HAVE_AP_SME-flag.patch deleted file mode 100644 index de41e1c4535604..00000000000000 --- a/package/kernel/mac80211/patches/332-v4.18-0001-brcmfmac-set-WIPHY_FLAG_HAVE_AP_SME-flag.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 1204aa17f3b4f63e67ac9b7c9afa9496485969c5 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 10 May 2018 15:21:39 +0200 -Subject: [PATCH] brcmfmac: set WIPHY_FLAG_HAVE_AP_SME flag -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -brcmfmac is a FullMAC driver and it implements/uses cfg80211 interface -for stations management. At the same time it doesn't receive or pass up -management frames. - -This flag indicates that authenticator doesn't have to subscribe to or -handle management frames. Some authenticators (e.g. hostapd) were -working with brcmfmac thanks to some extra assumptions. This commit -clears up the situation. - -Signed-off-by: Rafał Miłecki -Acked-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -6513,6 +6513,7 @@ static int brcmf_setup_wiphy(struct wiph - - wiphy->flags |= WIPHY_FLAG_NETNS_OK | - WIPHY_FLAG_PS_ON_BY_DEFAULT | -+ WIPHY_FLAG_HAVE_AP_SME | - WIPHY_FLAG_OFFCHAN_TX | - WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_TDLS)) diff --git a/package/kernel/mac80211/patches/333-v4.18-0001-brcmfmac-fix-initialization-of-struct-cfg80211_infor.patch b/package/kernel/mac80211/patches/333-v4.18-0001-brcmfmac-fix-initialization-of-struct-cfg80211_infor.patch deleted file mode 100644 index 2436bb8a8a1c81..00000000000000 --- a/package/kernel/mac80211/patches/333-v4.18-0001-brcmfmac-fix-initialization-of-struct-cfg80211_infor.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 763ece85f45a6b93268e25a0abf02922f911dab4 Mon Sep 17 00:00:00 2001 -From: Franky Lin -Date: Tue, 15 May 2018 11:14:44 +0200 -Subject: [PATCH] brcmfmac: fix initialization of struct cfg80211_inform_bss - variable - -This patch fixes a sparse warning "Using plain integer as NULL pointer" -about cfg80211_inform_bss structure initialization. - -Reported-by: kbuild test robot -Reviewed-by: Arend van Spriel -Signed-off-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2737,7 +2737,7 @@ static s32 brcmf_inform_single_bss(struc - u16 notify_interval; - u8 *notify_ie; - size_t notify_ielen; -- struct cfg80211_inform_bss bss_data = { 0 }; -+ struct cfg80211_inform_bss bss_data = {}; - - if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) { - brcmf_err("Bss info is larger than buffer. Discarding\n"); diff --git a/package/kernel/mac80211/patches/334-v4.18-0001-brcmfmac-add-debugfs-entry-for-reading-firmware-capa.patch b/package/kernel/mac80211/patches/334-v4.18-0001-brcmfmac-add-debugfs-entry-for-reading-firmware-capa.patch deleted file mode 100644 index f350d1e8194440..00000000000000 --- a/package/kernel/mac80211/patches/334-v4.18-0001-brcmfmac-add-debugfs-entry-for-reading-firmware-capa.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 88001968245c42c26416476bf0ef960442371605 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 14 May 2018 08:48:20 +0200 -Subject: [PATCH] brcmfmac: add debugfs entry for reading firmware capabilities -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This allows reading all capabilities as reported by a firmware. They are -printed using native (raw) names, just like developers like it the most. -It's how firmware reports support for various features, e.g. supported -modes, supported standards, power saving details, max BSS-es. - -Access to all that info is useful for trying new firmwares, comparing -them and debugging features AKA bugs. - -Signed-off-by: Rafał Miłecki -Reviewed-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 36 ++++++++++++++++++++++ - 1 file changed, 36 insertions(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c -@@ -165,6 +165,41 @@ static void brcmf_feat_firmware_capabili - } - } - -+/** -+ * brcmf_feat_fwcap_debugfs_read() - expose firmware capabilities to debugfs. -+ * -+ * @seq: sequence for debugfs entry. -+ * @data: raw data pointer. -+ */ -+static int brcmf_feat_fwcap_debugfs_read(struct seq_file *seq, void *data) -+{ -+ struct brcmf_bus *bus_if = dev_get_drvdata(seq->private); -+ struct brcmf_if *ifp = brcmf_get_ifp(bus_if->drvr, 0); -+ char caps[MAX_CAPS_BUFFER_SIZE + 1] = { }; -+ char *tmp; -+ int err; -+ -+ err = brcmf_fil_iovar_data_get(ifp, "cap", caps, sizeof(caps)); -+ if (err) { -+ brcmf_err("could not get firmware cap (%d)\n", err); -+ return err; -+ } -+ -+ /* Put every capability in a new line */ -+ for (tmp = caps; *tmp; tmp++) { -+ if (*tmp == ' ') -+ *tmp = '\n'; -+ } -+ -+ /* Usually there is a space at the end of capabilities string */ -+ seq_printf(seq, "%s", caps); -+ /* So make sure we don't print two line breaks */ -+ if (tmp > caps && *(tmp - 1) != '\n') -+ seq_printf(seq, "\n"); -+ -+ return 0; -+} -+ - void brcmf_feat_attach(struct brcmf_pub *drvr) - { - struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0); -@@ -233,6 +268,7 @@ void brcmf_feat_attach(struct brcmf_pub - void brcmf_feat_debugfs_create(struct brcmf_pub *drvr) - { - brcmf_debugfs_add_entry(drvr, "features", brcmf_feat_debugfs_read); -+ brcmf_debugfs_add_entry(drvr, "fwcap", brcmf_feat_fwcap_debugfs_read); - } - - bool brcmf_feat_is_enabled(struct brcmf_if *ifp, enum brcmf_feat_id id) diff --git a/package/kernel/mac80211/patches/335-v4.18-0001-brcmfmac-move-ALLFFMAC-variable-in-flowring-module.patch b/package/kernel/mac80211/patches/335-v4.18-0001-brcmfmac-move-ALLFFMAC-variable-in-flowring-module.patch deleted file mode 100644 index f353a60b87e735..00000000000000 --- a/package/kernel/mac80211/patches/335-v4.18-0001-brcmfmac-move-ALLFFMAC-variable-in-flowring-module.patch +++ /dev/null @@ -1,52 +0,0 @@ -From f8793c26fe586659d6da3fa277e63961a69d314b Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Wed, 16 May 2018 14:11:58 +0200 -Subject: [PATCH] brcmfmac: move ALLFFMAC variable in flowring module - -The only user of ALLFFMAC is the flowring module so no need to -expose it in a header file. - -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 2 -- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h | 2 -- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c | 2 ++ - 3 files changed, 2 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -@@ -36,8 +36,6 @@ MODULE_AUTHOR("Broadcom Corporation"); - MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver."); - MODULE_LICENSE("Dual BSD/GPL"); - --const u8 ALLFFMAC[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; -- - #define BRCMF_DEFAULT_SCAN_CHANNEL_TIME 40 - #define BRCMF_DEFAULT_SCAN_UNASSOC_TIME 40 - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h -@@ -19,8 +19,6 @@ - #include - #include "fwil_types.h" - --extern const u8 ALLFFMAC[ETH_ALEN]; -- - #define BRCMF_FW_ALTPATH_LEN 256 - - /* Definitions for the module global and device specific settings are defined ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c -@@ -46,6 +46,8 @@ static const u8 brcmf_flowring_prio2fifo - 3 - }; - -+static const u8 ALLFFMAC[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; -+ - - static bool - brcmf_flowring_is_tdls_mac(struct brcmf_flowring *flow, u8 mac[ETH_ALEN]) diff --git a/package/kernel/mac80211/patches/335-v4.18-0002-brcmfmac-add-support-for-sysfs-initiated-coredump.patch b/package/kernel/mac80211/patches/335-v4.18-0002-brcmfmac-add-support-for-sysfs-initiated-coredump.patch deleted file mode 100644 index 86533b95b61ea5..00000000000000 --- a/package/kernel/mac80211/patches/335-v4.18-0002-brcmfmac-add-support-for-sysfs-initiated-coredump.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 8e072168f75ebce85b96cbcefea2b10ddbd5913f Mon Sep 17 00:00:00 2001 -From: Arend Van Spriel -Date: Wed, 16 May 2018 14:11:59 +0200 -Subject: [PATCH] brcmfmac: add support for sysfs initiated coredump - -The driver already supports device coredump initiated by firmware -event. Since commit 3c47d19ff4dc ("drivers: base: add coredump driver -ops") it is also possible to initiate it from user-space through -sysfs. This patch adds support for SDIO and PCIe devices. - -[rafal@milecki.pl: use LINUX_VERSION_CODE] -Reviewed-by: Hante Meuleman -Reviewed-by: Pieter-Paul Giesberts -Reviewed-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo -Signed-off-by: Rafał Miłecki ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 1 + - drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 2 ++ - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 8 ++++++++ - drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 1 + - 4 files changed, 12 insertions(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c -@@ -1165,6 +1165,9 @@ static struct sdio_driver brcmf_sdmmc_dr - #ifdef CONFIG_PM_SLEEP - .pm = &brcmf_sdio_pm_ops, - #endif /* CONFIG_PM_SLEEP */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0) -+ .coredump = brcmf_dev_coredump, -+#endif - }, - }; - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h -@@ -250,6 +250,8 @@ int brcmf_attach(struct device *dev, str - void brcmf_detach(struct device *dev); - /* Indication from bus module that dongle should be reset */ - void brcmf_dev_reset(struct device *dev); -+/* Request from bus module to initiate a coredump */ -+void brcmf_dev_coredump(struct device *dev); - - /* Configure the "global" bus state used by upper layers */ - void brcmf_bus_change_state(struct brcmf_bus *bus, enum brcmf_bus_state state); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1201,6 +1201,14 @@ void brcmf_dev_reset(struct device *dev) - brcmf_fil_cmd_int_set(drvr->iflist[0], BRCMF_C_TERMINATED, 1); - } - -+void brcmf_dev_coredump(struct device *dev) -+{ -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev); -+ -+ if (brcmf_debug_create_memdump(bus_if, NULL, 0) < 0) -+ brcmf_dbg(TRACE, "failed to create coredump\n"); -+} -+ - void brcmf_detach(struct device *dev) - { - s32 i; ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -@@ -2044,6 +2044,9 @@ static struct pci_driver brcmf_pciedrvr - #ifdef CONFIG_PM - .driver.pm = &brcmf_pciedrvr_pm, - #endif -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0) -+ .driver.coredump = brcmf_dev_coredump, -+#endif - }; - - diff --git a/package/kernel/mac80211/patches/335-v4.18-0004-brcmfmac-validate-user-provided-data-for-memdump-bef.patch b/package/kernel/mac80211/patches/335-v4.18-0004-brcmfmac-validate-user-provided-data-for-memdump-bef.patch deleted file mode 100644 index 455009ef1d46a1..00000000000000 --- a/package/kernel/mac80211/patches/335-v4.18-0004-brcmfmac-validate-user-provided-data-for-memdump-bef.patch +++ /dev/null @@ -1,32 +0,0 @@ -From d2af9b566554e01f9ad67b330ce569dbc130e5d3 Mon Sep 17 00:00:00 2001 -From: Franky Lin -Date: Wed, 16 May 2018 14:12:01 +0200 -Subject: [PATCH] brcmfmac: validate user provided data for memdump before - copying - -In patch "brcmfmac: add support for sysfs initiated coredump", a new -scenario of brcmf_debug_create_memdump was added in which the user of -the function might not necessarily provide prefix data. Hence the -function should not assume the data is always valid and should perform a -check before copying. - -Reviewed-by: Arend van Spriel -Signed-off-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c -@@ -40,7 +40,8 @@ int brcmf_debug_create_memdump(struct br - if (!dump) - return -ENOMEM; - -- memcpy(dump, data, len); -+ if (data && len > 0) -+ memcpy(dump, data, len); - err = brcmf_bus_get_memdump(bus, dump + len, ramsize); - if (err) { - vfree(dump); diff --git a/package/kernel/mac80211/patches/335-v4.18-0005-brcmfmac-trigger-memory-dump-upon-firmware-halt-sign.patch b/package/kernel/mac80211/patches/335-v4.18-0005-brcmfmac-trigger-memory-dump-upon-firmware-halt-sign.patch deleted file mode 100644 index b94e06fa44509e..00000000000000 --- a/package/kernel/mac80211/patches/335-v4.18-0005-brcmfmac-trigger-memory-dump-upon-firmware-halt-sign.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 8a3ab2f38f1669e3be6433a1f6b82a077b38c4c7 Mon Sep 17 00:00:00 2001 -From: Franky Lin -Date: Wed, 16 May 2018 14:12:02 +0200 -Subject: [PATCH] brcmfmac: trigger memory dump upon firmware halt signal - -PCIe dongle firmware signals a halt/trap through mailbox interrupt. -Trigger a memory dump upon receiving such signal could help to provide -useful information for issue debug. - -Reviewed-by: Arend van Spriel -Signed-off-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 5 +++++ - 1 file changed, 5 insertions(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -@@ -182,6 +182,7 @@ static const struct brcmf_firmware_mappi - #define BRCMF_D2H_DEV_D3_ACK 0x00000001 - #define BRCMF_D2H_DEV_DS_ENTER_REQ 0x00000002 - #define BRCMF_D2H_DEV_DS_EXIT_NOTE 0x00000004 -+#define BRCMF_D2H_DEV_FWHALT 0x10000000 - - #define BRCMF_H2D_HOST_D3_INFORM 0x00000001 - #define BRCMF_H2D_HOST_DS_ACK 0x00000002 -@@ -717,6 +718,10 @@ static void brcmf_pcie_handle_mb_data(st - devinfo->mbdata_completed = true; - wake_up(&devinfo->mbdata_resp_wait); - } -+ if (dtoh_mb_data & BRCMF_D2H_DEV_FWHALT) { -+ brcmf_dbg(PCIE, "D2H_MB_DATA: FW HALT\n"); -+ brcmf_dev_coredump(&devinfo->pdev->dev); -+ } - } - - diff --git a/package/kernel/mac80211/patches/335-v4.18-0006-brcmfmac-trigger-memory-dump-on-SDIO-firmware-halt-m.patch b/package/kernel/mac80211/patches/335-v4.18-0006-brcmfmac-trigger-memory-dump-on-SDIO-firmware-halt-m.patch deleted file mode 100644 index 045e20acfb031a..00000000000000 --- a/package/kernel/mac80211/patches/335-v4.18-0006-brcmfmac-trigger-memory-dump-on-SDIO-firmware-halt-m.patch +++ /dev/null @@ -1,30 +0,0 @@ -From b8248236e92790ac635caeb4156e46ea2417e037 Mon Sep 17 00:00:00 2001 -From: Franky Lin -Date: Wed, 16 May 2018 14:12:03 +0200 -Subject: [PATCH] brcmfmac: trigger memory dump on SDIO firmware halt message - -Attempt to dump dongle memory for debug upon receiving firmware halt -message through dongle to host mail box interrupt. - -Reviewed-by: Arend van Spriel -Signed-off-by: Franky Lin -Signed-off-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -1072,8 +1072,10 @@ static u32 brcmf_sdio_hostmail(struct br - bus->sdcnt.f1regdata += 2; - - /* dongle indicates the firmware has halted/crashed */ -- if (hmb_data & HMB_DATA_FWHALT) -+ if (hmb_data & HMB_DATA_FWHALT) { - brcmf_err("mailbox indicates firmware halted\n"); -+ brcmf_dev_coredump(&sdiod->func1->dev); -+ } - - /* Dongle recomposed rx frames, accept them again */ - if (hmb_data & HMB_DATA_NAKHANDLED) { diff --git a/package/kernel/mac80211/patches/336-v4.18-brcmfmac-stop-watchdog-before-detach-and-free-everyt.patch b/package/kernel/mac80211/patches/336-v4.18-brcmfmac-stop-watchdog-before-detach-and-free-everyt.patch deleted file mode 100644 index a478b675cc6303..00000000000000 --- a/package/kernel/mac80211/patches/336-v4.18-brcmfmac-stop-watchdog-before-detach-and-free-everyt.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 373c83a801f15b1e3d02d855fad89112bd4ccbe0 Mon Sep 17 00:00:00 2001 -From: Michael Trimarchi -Date: Wed, 30 May 2018 11:06:34 +0200 -Subject: [PATCH] brcmfmac: stop watchdog before detach and free everything - -Using built-in in kernel image without a firmware in filesystem -or in the kernel image can lead to a kernel NULL pointer deference. -Watchdog need to be stopped in brcmf_sdio_remove - -The system is going down NOW! -[ 1348.110759] Unable to handle kernel NULL pointer dereference at virtual address 000002f8 -Sent SIGTERM to all processes -[ 1348.121412] Mem abort info: -[ 1348.126962] ESR = 0x96000004 -[ 1348.130023] Exception class = DABT (current EL), IL = 32 bits -[ 1348.135948] SET = 0, FnV = 0 -[ 1348.138997] EA = 0, S1PTW = 0 -[ 1348.142154] Data abort info: -[ 1348.145045] ISV = 0, ISS = 0x00000004 -[ 1348.148884] CM = 0, WnR = 0 -[ 1348.151861] user pgtable: 4k pages, 48-bit VAs, pgdp = (____ptrval____) -[ 1348.158475] [00000000000002f8] pgd=0000000000000000 -[ 1348.163364] Internal error: Oops: 96000004 [#1] PREEMPT SMP -[ 1348.168927] Modules linked in: ipv6 -[ 1348.172421] CPU: 3 PID: 1421 Comm: brcmf_wdog/mmc0 Not tainted 4.17.0-rc5-next-20180517 #18 -[ 1348.180757] Hardware name: Amarula A64-Relic (DT) -[ 1348.185455] pstate: 60000005 (nZCv daif -PAN -UAO) -[ 1348.190251] pc : brcmf_sdiod_freezer_count+0x0/0x20 -[ 1348.195124] lr : brcmf_sdio_watchdog_thread+0x64/0x290 -[ 1348.200253] sp : ffff00000b85be30 -[ 1348.203561] x29: ffff00000b85be30 x28: 0000000000000000 -[ 1348.208868] x27: ffff00000b6cb918 x26: ffff80003b990638 -[ 1348.214176] x25: ffff0000087b1a20 x24: ffff80003b94f800 -[ 1348.219483] x23: ffff000008e620c8 x22: ffff000008f0b660 -[ 1348.224790] x21: ffff000008c6a858 x20: 00000000fffffe00 -[ 1348.230097] x19: ffff80003b94f800 x18: 0000000000000001 -[ 1348.235404] x17: 0000ffffab2e8a74 x16: ffff0000080d7de8 -[ 1348.240711] x15: 0000000000000000 x14: 0000000000000400 -[ 1348.246018] x13: 0000000000000400 x12: 0000000000000001 -[ 1348.251324] x11: 00000000000002c4 x10: 0000000000000a10 -[ 1348.256631] x9 : ffff00000b85bc40 x8 : ffff80003be11870 -[ 1348.261937] x7 : ffff80003dfc7308 x6 : 000000078ff08b55 -[ 1348.267243] x5 : 00000139e1058400 x4 : 0000000000000000 -[ 1348.272550] x3 : dead000000000100 x2 : 958f2788d6618100 -[ 1348.277856] x1 : 00000000fffffe00 x0 : 0000000000000000 - -Signed-off-by: Michael Trimarchi -Acked-by: Arend van Spriel -Tested-by: Andy Shevchenko -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 7 +++++++ - 1 file changed, 7 insertions(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -4297,6 +4297,13 @@ void brcmf_sdio_remove(struct brcmf_sdio - brcmf_dbg(TRACE, "Enter\n"); - - if (bus) { -+ /* Stop watchdog task */ -+ if (bus->watchdog_tsk) { -+ send_sig(SIGTERM, bus->watchdog_tsk, 1); -+ kthread_stop(bus->watchdog_tsk); -+ bus->watchdog_tsk = NULL; -+ } -+ - /* De-register interrupt handler */ - brcmf_sdiod_intr_unregister(bus->sdiodev); - diff --git a/package/kernel/mac80211/patches/337-v4.18-brcmfmac-fix-regression-in-parsing-NVRAM-for-multipl.patch b/package/kernel/mac80211/patches/337-v4.18-brcmfmac-fix-regression-in-parsing-NVRAM-for-multipl.patch deleted file mode 100644 index 2e265a2f379579..00000000000000 --- a/package/kernel/mac80211/patches/337-v4.18-brcmfmac-fix-regression-in-parsing-NVRAM-for-multipl.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 299b6365a3b7cf7f5ea1c945a420e9ee4841d6f7 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Sun, 22 Jul 2018 23:46:25 +0200 -Subject: [PATCH] brcmfmac: fix regression in parsing NVRAM for multiple - devices -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -NVRAM is designed to work with Broadcom's SDK Linux kernel which fakes -PCI domain 0 for all internal MMIO devices. Since official Linux kernel -uses platform devices for that purpose there is a mismatch in numbering -PCI domains. - -There used to be a fix for that problem but it was accidentally dropped -during the last firmware loading rework. That resulted in brcmfmac not -being able to extract device specific NVRAM content and all kind of -calibration problems. - -Reported-by: Aditya Xavier -Fixes: 2baa3aaee27f ("brcmfmac: introduce brcmf_fw_alloc_request() function") -Cc: stable@vger.kernel.org # v4.17+ -Signed-off-by: Rafał Miłecki -Acked-by: Arend van Spriel -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -@@ -1785,7 +1785,8 @@ brcmf_pcie_prepare_fw_request(struct brc - fwreq->items[BRCMF_PCIE_FW_CODE].type = BRCMF_FW_TYPE_BINARY; - fwreq->items[BRCMF_PCIE_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; - fwreq->items[BRCMF_PCIE_FW_NVRAM].flags = BRCMF_FW_REQF_OPTIONAL; -- fwreq->domain_nr = pci_domain_nr(devinfo->pdev->bus); -+ /* NVRAM reserves PCI domain 0 for Broadcom's SDK faked bus */ -+ fwreq->domain_nr = pci_domain_nr(devinfo->pdev->bus) + 1; - fwreq->bus_nr = devinfo->pdev->bus->number; - - return fwreq; diff --git a/package/kernel/mac80211/patches/352-ath9k_hw-set-spectral-scan-enable-bit-on-trigger-for.patch b/package/kernel/mac80211/patches/352-ath9k_hw-set-spectral-scan-enable-bit-on-trigger-for.patch deleted file mode 100644 index dfe9aae268c4be..00000000000000 --- a/package/kernel/mac80211/patches/352-ath9k_hw-set-spectral-scan-enable-bit-on-trigger-for.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: Felix Fietkau -Date: Mon, 11 Jul 2016 12:07:40 +0200 -Subject: [PATCH] ath9k_hw: set spectral scan enable bit on trigger for - AR9003+ - -AR9002 code and QCA AR9003+ code do the same. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c -+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c -@@ -1800,6 +1800,8 @@ static void ar9003_hw_spectral_scan_conf - - static void ar9003_hw_spectral_scan_trigger(struct ath_hw *ah) - { -+ REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, -+ AR_PHY_SPECTRAL_SCAN_ENABLE); - /* Activate spectral scan */ - REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, - AR_PHY_SPECTRAL_SCAN_ACTIVE); diff --git a/package/kernel/mac80211/patches/353-ath9k-don-t-run-periodic-and-nf-calibation-at-the-sa.patch b/package/kernel/mac80211/patches/353-ath9k-don-t-run-periodic-and-nf-calibation-at-the-sa.patch deleted file mode 100644 index 22f51541466506..00000000000000 --- a/package/kernel/mac80211/patches/353-ath9k-don-t-run-periodic-and-nf-calibation-at-the-sa.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: Felix Fietkau -Date: Tue, 27 Dec 2016 23:16:23 +0100 -Subject: [PATCH] ath9k: don't run periodic and nf calibation at the same - time - -The checks already prevents periodic cal from being started while noise -floor calibration runs. It is missing checks for the other way around. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c -@@ -676,10 +676,10 @@ static int ar9002_hw_calibrate(struct at - return 0; - - ah->cal_list_curr = currCal = currCal->calNext; -- if (currCal->calState == CAL_WAITING) { -+ if (currCal->calState == CAL_WAITING) - ath9k_hw_reset_calibration(ah, currCal); -- return 0; -- } -+ -+ return 0; - } - - /* Do NF cal only at longer intervals */ diff --git a/package/kernel/mac80211/patches/357-mac80211-add-hdrlen-to-ieee80211_tx_data.patch b/package/kernel/mac80211/patches/357-mac80211-add-hdrlen-to-ieee80211_tx_data.patch deleted file mode 100644 index 83c613434d321f..00000000000000 --- a/package/kernel/mac80211/patches/357-mac80211-add-hdrlen-to-ieee80211_tx_data.patch +++ /dev/null @@ -1,219 +0,0 @@ -From: Janusz Dziedzic -Date: Fri, 19 Feb 2016 11:01:49 +0100 -Subject: [PATCH] mac80211: add hdrlen to ieee80211_tx_data - -Add hdrlen to ieee80211_tx_data and use this -when wep/ccmd/tkip. This is preparation for -aligned4 code. - -Signed-off-by: Janusz Dziedzic ---- - ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -177,6 +177,7 @@ struct ieee80211_tx_data { - struct ieee80211_tx_rate rate; - - unsigned int flags; -+ unsigned int hdrlen; - }; - - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -921,7 +921,7 @@ ieee80211_tx_h_fragment(struct ieee80211 - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr = (void *)skb->data; - int frag_threshold = tx->local->hw.wiphy->frag_threshold; -- int hdrlen; -+ int hdrlen = tx->hdrlen; - int fragnum; - - /* no matter what happens, tx->skb moves to tx->skbs */ -@@ -942,8 +942,6 @@ ieee80211_tx_h_fragment(struct ieee80211 - if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU)) - return TX_DROP; - -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -- - /* internal error, why isn't DONTFRAG set? */ - if (WARN_ON(skb->len + FCS_LEN <= frag_threshold)) - return TX_DROP; -@@ -1175,6 +1173,8 @@ ieee80211_tx_prepare(struct ieee80211_su - - hdr = (struct ieee80211_hdr *) skb->data; - -+ tx->hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ - if (likely(sta)) { - if (!IS_ERR(sta)) - tx->sta = sta; -@@ -3468,6 +3468,7 @@ begin: - tx.local = local; - tx.skb = skb; - tx.sdata = vif_to_sdata(info->control.vif); -+ tx.hdrlen = ieee80211_padded_hdrlen(hw, hdr->frame_control); - - if (txq->sta) - tx.sta = container_of(txq->sta, struct sta_info, sta); -@@ -3796,6 +3797,7 @@ ieee80211_build_data_template(struct iee - hdr = (void *)skb->data; - tx.sta = sta_info_get(sdata, hdr->addr1); - tx.skb = skb; -+ tx.hdrlen = ieee80211_padded_hdrlen(&tx.local->hw, hdr->frame_control); - - if (ieee80211_tx_h_select_key(&tx) != TX_CONTINUE) { - rcu_read_unlock(); ---- a/net/mac80211/util.c -+++ b/net/mac80211/util.c -@@ -1232,6 +1232,7 @@ void ieee80211_send_auth(struct ieee8021 - struct ieee80211_local *local = sdata->local; - struct sk_buff *skb; - struct ieee80211_mgmt *mgmt; -+ unsigned int hdrlen; - int err; - - /* 24 + 6 = header + auth_algo + auth_transaction + status_code */ -@@ -1255,8 +1256,10 @@ void ieee80211_send_auth(struct ieee8021 - skb_put_data(skb, extra, extra_len); - - if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) { -+ hdrlen = ieee80211_hdrlen(mgmt->frame_control); - mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); -- err = ieee80211_wep_encrypt(local, skb, key, key_len, key_idx); -+ err = ieee80211_wep_encrypt(local, skb, hdrlen, key, -+ key_len, key_idx); - WARN_ON(err); - } - ---- a/net/mac80211/wep.c -+++ b/net/mac80211/wep.c -@@ -89,11 +89,11 @@ static void ieee80211_wep_get_iv(struct - - static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local, - struct sk_buff *skb, -+ unsigned int hdrlen, - int keylen, int keyidx) - { - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); -- unsigned int hdrlen; - u8 *newhdr; - - hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); -@@ -101,7 +101,6 @@ static u8 *ieee80211_wep_add_iv(struct i - if (WARN_ON(skb_headroom(skb) < IEEE80211_WEP_IV_LEN)) - return NULL; - -- hdrlen = ieee80211_hdrlen(hdr->frame_control); - newhdr = skb_push(skb, IEEE80211_WEP_IV_LEN); - memmove(newhdr, newhdr + IEEE80211_WEP_IV_LEN, hdrlen); - -@@ -160,6 +159,7 @@ int ieee80211_wep_encrypt_data(struct cr - */ - int ieee80211_wep_encrypt(struct ieee80211_local *local, - struct sk_buff *skb, -+ unsigned int hdrlen, - const u8 *key, int keylen, int keyidx) - { - u8 *iv; -@@ -169,7 +169,7 @@ int ieee80211_wep_encrypt(struct ieee802 - if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN)) - return -1; - -- iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx); -+ iv = ieee80211_wep_add_iv(local, skb, hdrlen, keylen, keyidx); - if (!iv) - return -1; - -@@ -307,13 +307,14 @@ static int wep_encrypt_skb(struct ieee80 - struct ieee80211_key_conf *hw_key = info->control.hw_key; - - if (!hw_key) { -- if (ieee80211_wep_encrypt(tx->local, skb, tx->key->conf.key, -+ if (ieee80211_wep_encrypt(tx->local, skb, tx->hdrlen, -+ tx->key->conf.key, - tx->key->conf.keylen, - tx->key->conf.keyidx)) - return -1; - } else if ((hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) || - (hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)) { -- if (!ieee80211_wep_add_iv(tx->local, skb, -+ if (!ieee80211_wep_add_iv(tx->local, skb, tx->hdrlen, - tx->key->conf.keylen, - tx->key->conf.keyidx)) - return -1; ---- a/net/mac80211/wep.h -+++ b/net/mac80211/wep.h -@@ -22,6 +22,7 @@ int ieee80211_wep_encrypt_data(struct cr - size_t klen, u8 *data, size_t data_len); - int ieee80211_wep_encrypt(struct ieee80211_local *local, - struct sk_buff *skb, -+ unsigned int hdrlen, - const u8 *key, int keylen, int keyidx); - int ieee80211_wep_decrypt_data(struct crypto_cipher *tfm, u8 *rc4key, - size_t klen, u8 *data, size_t data_len); ---- a/net/mac80211/wpa.c -+++ b/net/mac80211/wpa.c -@@ -44,7 +44,7 @@ ieee80211_tx_h_michael_mic_add(struct ie - skb->len < 24 || !ieee80211_is_data_present(hdr->frame_control)) - return TX_CONTINUE; - -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ hdrlen = tx->hdrlen; - if (skb->len < hdrlen) - return TX_DROP; - -@@ -187,7 +187,6 @@ mic_fail_no_key: - - static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) - { -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - struct ieee80211_key *key = tx->key; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - unsigned int hdrlen; -@@ -202,7 +201,7 @@ static int tkip_encrypt_skb(struct ieee8 - return 0; - } - -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ hdrlen = tx->hdrlen; - len = skb->len - hdrlen; - - if (info->control.hw_key) -@@ -420,7 +419,7 @@ static int ccmp_encrypt_skb(struct ieee8 - return 0; - } - -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ hdrlen = tx->hdrlen; - len = skb->len - hdrlen; - - if (info->control.hw_key) -@@ -653,7 +652,7 @@ static int gcmp_encrypt_skb(struct ieee8 - return 0; - } - -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ hdrlen = tx->hdrlen; - len = skb->len - hdrlen; - - if (info->control.hw_key) -@@ -793,7 +792,6 @@ static ieee80211_tx_result - ieee80211_crypto_cs_encrypt(struct ieee80211_tx_data *tx, - struct sk_buff *skb) - { -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct ieee80211_key *key = tx->key; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - int hdrlen; -@@ -809,8 +807,7 @@ ieee80211_crypto_cs_encrypt(struct ieee8 - pskb_expand_head(skb, iv_len, 0, GFP_ATOMIC))) - return TX_DROP; - -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -- -+ hdrlen = tx->hdrlen; - pos = skb_push(skb, iv_len); - memmove(pos, pos + iv_len, hdrlen); - diff --git a/package/kernel/mac80211/patches/358-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch b/package/kernel/mac80211/patches/358-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch deleted file mode 100644 index a9f01b368de3cf..00000000000000 --- a/package/kernel/mac80211/patches/358-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch +++ /dev/null @@ -1,233 +0,0 @@ -From: Janusz Dziedzic -Date: Fri, 19 Feb 2016 11:01:50 +0100 -Subject: [PATCH] mac80211: add NEED_ALIGNED4_SKBS hw flag - -HW/driver should set NEED_ALIGNED4_SKBS flag in case -require aligned skbs to four-byte boundaries. -This affect only TX direction. - -Padding is added after ieee80211_hdr, before IV/LLC. - -Before we have to do memmove(hdrlen) twice in the -dirver. Once before we pass this to HW and next -in tx completion (to be sure monitor will report -this tx frame correctly). - -With this patch we can skip this memmove() and save CPU. - -Currently this was tested with ath9k, both hw/sw crypt for -wep/tkip/ccmp. - -Signed-off-by: Janusz Dziedzic ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -2059,6 +2059,9 @@ struct ieee80211_txq { - * @IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA: Hardware supports buffer STA on - * TDLS links. - * -+ * @IEEE80211_HW_NEEDS_ALIGNED4_SKBS: Driver need aligned skbs to four-byte. -+ * Padding will be added after ieee80211_hdr, before IV/LLC. -+ * - * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays - */ - enum ieee80211_hw_flags { -@@ -2102,6 +2105,7 @@ enum ieee80211_hw_flags { - IEEE80211_HW_REPORTS_LOW_ACK, - IEEE80211_HW_SUPPORTS_TX_FRAG, - IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA, -+ IEEE80211_HW_NEEDS_ALIGNED4_SKBS, - - /* keep last, obviously */ - NUM_IEEE80211_HW_FLAGS ---- a/net/mac80211/debugfs.c -+++ b/net/mac80211/debugfs.c -@@ -212,6 +212,7 @@ static const char *hw_flag_names[] = { - FLAG(REPORTS_LOW_ACK), - FLAG(SUPPORTS_TX_FRAG), - FLAG(SUPPORTS_TDLS_BUFFER_STA), -+ FLAG(NEEDS_ALIGNED4_SKBS), - #undef FLAG - }; - ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -1548,6 +1548,29 @@ ieee80211_vif_get_num_mcast_if(struct ie - return -1; - } - -+static inline unsigned int -+ieee80211_hdr_padsize(struct ieee80211_hw *hw, unsigned int hdrlen) -+{ -+ /* -+ * While hdrlen is already aligned to two-byte boundaries, -+ * simple check with & 2 will return correct padsize. -+ */ -+ if (ieee80211_hw_check(hw, NEEDS_ALIGNED4_SKBS)) -+ return hdrlen & 2; -+ return 0; -+} -+ -+static inline unsigned int -+ieee80211_padded_hdrlen(struct ieee80211_hw *hw, __le16 fc) -+{ -+ unsigned int hdrlen; -+ -+ hdrlen = ieee80211_hdrlen(fc); -+ hdrlen += ieee80211_hdr_padsize(hw, hdrlen); -+ -+ return hdrlen; -+} -+ - u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local, - struct ieee80211_rx_status *status, - unsigned int mpdu_len, ---- a/net/mac80211/sta_info.h -+++ b/net/mac80211/sta_info.h -@@ -300,7 +300,7 @@ struct ieee80211_fast_tx { - u8 hdr_len; - u8 sa_offs, da_offs, pn_offs; - u8 band; -- u8 hdr[30 + 2 + IEEE80211_FAST_XMIT_MAX_IV + -+ u8 hdr[30 + 2 + 2 + IEEE80211_FAST_XMIT_MAX_IV + - sizeof(rfc1042_header)] __aligned(2); - - struct rcu_head rcu_head; ---- a/net/mac80211/status.c -+++ b/net/mac80211/status.c -@@ -642,9 +642,22 @@ void ieee80211_tx_monitor(struct ieee802 - struct sk_buff *skb2; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_sub_if_data *sdata; -+ struct ieee80211_hdr *hdr = (void *)skb->data; - struct net_device *prev_dev = NULL; -+ unsigned int hdrlen, padsize; - int rtap_len; - -+ /* Remove padding if was added */ -+ if (ieee80211_hw_check(&local->hw, NEEDS_ALIGNED4_SKBS)) { -+ hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ padsize = ieee80211_hdr_padsize(&local->hw, hdrlen); -+ -+ if (padsize && skb->len > hdrlen + padsize) { -+ memmove(skb->data + padsize, skb->data, hdrlen); -+ skb_pull(skb, padsize); -+ } -+ } -+ - /* send frame to monitor interfaces now */ - rtap_len = ieee80211_tx_radiotap_len(info); - if (WARN_ON_ONCE(skb_headroom(skb) < rtap_len)) { ---- a/net/mac80211/tkip.c -+++ b/net/mac80211/tkip.c -@@ -201,10 +201,12 @@ void ieee80211_get_tkip_p2k(struct ieee8 - { - struct ieee80211_key *key = (struct ieee80211_key *) - container_of(keyconf, struct ieee80211_key, conf); -+ struct ieee80211_hw *hw = &key->local->hw; - const u8 *tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY]; - struct tkip_ctx *ctx = &key->u.tkip.tx; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; -- const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control); -+ const u8 *data = (u8 *)hdr + ieee80211_padded_hdrlen(hw, -+ hdr->frame_control); - u32 iv32 = get_unaligned_le32(&data[4]); - u16 iv16 = data[2] | (data[0] << 8); - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -1172,8 +1172,7 @@ ieee80211_tx_prepare(struct ieee80211_su - info->flags &= ~IEEE80211_TX_INTFL_NEED_TXPROCESSING; - - hdr = (struct ieee80211_hdr *) skb->data; -- -- tx->hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ tx->hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control); - - if (likely(sta)) { - if (!IS_ERR(sta)) -@@ -2184,7 +2183,7 @@ netdev_tx_t ieee80211_monitor_start_xmit - goto fail; - - hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr); -- hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control); - - if (skb->len < len_rthdr + hdrlen) - goto fail; -@@ -2402,7 +2401,7 @@ static struct sk_buff *ieee80211_build_h - struct ieee80211_chanctx_conf *chanctx_conf; - struct ieee80211_sub_if_data *ap_sdata; - enum nl80211_band band; -- int ret; -+ int padsize, ret; - - if (IS_ERR(sta)) - sta = NULL; -@@ -2622,6 +2621,9 @@ static struct sk_buff *ieee80211_build_h - hdrlen += 2; - } - -+ /* Check aligned4 skb required */ -+ padsize = ieee80211_hdr_padsize(&sdata->local->hw, hdrlen); -+ - /* - * Drop unicast frames to unauthorised stations unless they are - * EAPOL frames from the local station. -@@ -2702,6 +2704,7 @@ static struct sk_buff *ieee80211_build_h - - skb_pull(skb, skip_header_bytes); - head_need = hdrlen + encaps_len + meshhdrlen - skb_headroom(skb); -+ head_need += padsize; - - /* - * So we need to modify the skb header and hence need a copy of -@@ -2734,6 +2737,9 @@ static struct sk_buff *ieee80211_build_h - memcpy(skb_push(skb, meshhdrlen), &mesh_hdr, meshhdrlen); - #endif - -+ if (padsize) -+ memset(skb_push(skb, padsize), 0, padsize); -+ - if (ieee80211_is_data_qos(fc)) { - __le16 *qos_control; - -@@ -2909,6 +2915,9 @@ void ieee80211_check_fast_xmit(struct st - fc |= cpu_to_le16(IEEE80211_STYPE_QOS_DATA); - } - -+ /* Check aligned4 skb required */ -+ build.hdr_len += ieee80211_hdr_padsize(&local->hw, build.hdr_len); -+ - /* We store the key here so there's no point in using rcu_dereference() - * but that's fine because the code that changes the pointers will call - * this function after doing so. For a single CPU that would be enough, -@@ -3495,7 +3504,7 @@ begin: - - if (tx.key && - (tx.key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) -- pn_offs = ieee80211_hdrlen(hdr->frame_control); -+ pn_offs = tx.hdrlen; - - ieee80211_xmit_fast_finish(sta->sdata, sta, pn_offs, - tx.key, skb); ---- a/net/mac80211/util.c -+++ b/net/mac80211/util.c -@@ -1230,6 +1230,7 @@ void ieee80211_send_auth(struct ieee8021 - u32 tx_flags) - { - struct ieee80211_local *local = sdata->local; -+ struct ieee80211_hw *hw = &local->hw; - struct sk_buff *skb; - struct ieee80211_mgmt *mgmt; - unsigned int hdrlen; -@@ -1256,7 +1257,7 @@ void ieee80211_send_auth(struct ieee8021 - skb_put_data(skb, extra, extra_len); - - if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) { -- hdrlen = ieee80211_hdrlen(mgmt->frame_control); -+ hdrlen = ieee80211_padded_hdrlen(hw, mgmt->frame_control); - mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); - err = ieee80211_wep_encrypt(local, skb, hdrlen, key, - key_len, key_idx); diff --git a/package/kernel/mac80211/patches/359-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch b/package/kernel/mac80211/patches/359-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch deleted file mode 100644 index 609b15b8325d31..00000000000000 --- a/package/kernel/mac80211/patches/359-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch +++ /dev/null @@ -1,82 +0,0 @@ -From: Chaitanya T K -Date: Mon, 27 Jun 2016 15:23:26 +0530 -Subject: [PATCH] mac80211: minstrel: Enable STBC and LDPC for VHT Rates - -If peer support reception of STBC and LDPC, enable them for better -performance. - -Signed-off-by: Chaitanya TK ---- - ---- a/include/linux/ieee80211.h -+++ b/include/linux/ieee80211.h -@@ -1556,6 +1556,7 @@ struct ieee80211_vht_operation { - #define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300 - #define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400 - #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700 -+#define IEEE80211_VHT_CAP_RXSTBC_SHIFT 8 - #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800 - #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 - #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13 ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -1130,7 +1130,7 @@ minstrel_ht_update_caps(void *priv, stru - struct minstrel_ht_sta_priv *msp = priv_sta; - struct minstrel_ht_sta *mi = &msp->ht; - struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs; -- u16 sta_cap = sta->ht_cap.cap; -+ u16 ht_cap = sta->ht_cap.cap; - struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap; - struct sta_info *sinfo = container_of(sta, struct sta_info, sta); - int use_vht; -@@ -1138,6 +1138,7 @@ minstrel_ht_update_caps(void *priv, stru - int ack_dur; - int stbc; - int i; -+ bool ldpc = false; - - /* fall back to the old minstrel for legacy stations */ - if (!sta->ht_cap.ht_supported) -@@ -1175,16 +1176,24 @@ minstrel_ht_update_caps(void *priv, stru - } - mi->sample_tries = 4; - -- /* TODO tx_flags for vht - ATM the RC API is not fine-grained enough */ - if (!use_vht) { -- stbc = (sta_cap & IEEE80211_HT_CAP_RX_STBC) >> -+ stbc = (ht_cap & IEEE80211_HT_CAP_RX_STBC) >> - IEEE80211_HT_CAP_RX_STBC_SHIFT; -- mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT; - -- if (sta_cap & IEEE80211_HT_CAP_LDPC_CODING) -- mi->tx_flags |= IEEE80211_TX_CTL_LDPC; -+ if (ht_cap & IEEE80211_HT_CAP_LDPC_CODING) -+ ldpc = true; -+ } else { -+ stbc = (vht_cap->cap & IEEE80211_VHT_CAP_RXSTBC_MASK) >> -+ IEEE80211_VHT_CAP_RXSTBC_SHIFT; -+ -+ if (vht_cap->cap & IEEE80211_VHT_CAP_RXLDPC) -+ ldpc = true; - } - -+ mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT; -+ if (ldpc) -+ mi->tx_flags |= IEEE80211_TX_CTL_LDPC; -+ - for (i = 0; i < ARRAY_SIZE(mi->groups); i++) { - u32 gflags = minstrel_mcs_groups[i].flags; - int bw, nss; -@@ -1197,10 +1206,10 @@ minstrel_ht_update_caps(void *priv, stru - - if (gflags & IEEE80211_TX_RC_SHORT_GI) { - if (gflags & IEEE80211_TX_RC_40_MHZ_WIDTH) { -- if (!(sta_cap & IEEE80211_HT_CAP_SGI_40)) -+ if (!(ht_cap & IEEE80211_HT_CAP_SGI_40)) - continue; - } else { -- if (!(sta_cap & IEEE80211_HT_CAP_SGI_20)) -+ if (!(ht_cap & IEEE80211_HT_CAP_SGI_20)) - continue; - } - } diff --git a/package/kernel/mac80211/patches/360-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch b/package/kernel/mac80211/patches/360-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch deleted file mode 100644 index d651e6ce30abeb..00000000000000 --- a/package/kernel/mac80211/patches/360-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch +++ /dev/null @@ -1,50 +0,0 @@ -From: Felix Fietkau -Date: Sun, 28 Aug 2016 13:13:01 +0200 -Subject: [PATCH] ath9k: fix moredata bit in PS buffered frame release - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/xmit.c -+++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -1659,6 +1659,22 @@ void ath_tx_aggr_wakeup(struct ath_softc - } - } - -+ -+static void -+ath9k_set_moredata(struct ath_softc *sc, struct ath_buf *bf, bool val) -+{ -+ struct ieee80211_hdr *hdr; -+ u16 mask = cpu_to_le16(IEEE80211_FCTL_MOREDATA); -+ u16 mask_val = mask * val; -+ -+ hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data; -+ if ((hdr->frame_control & mask) != mask_val) { -+ hdr->frame_control = (hdr->frame_control & ~mask) | mask_val; -+ dma_sync_single_for_device(sc->dev, bf->bf_buf_addr, -+ sizeof(*hdr), DMA_TO_DEVICE); -+ } -+} -+ - void ath9k_release_buffered_frames(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - u16 tids, int nframes, -@@ -1689,6 +1705,7 @@ void ath9k_release_buffered_frames(struc - if (!bf) - break; - -+ ath9k_set_moredata(sc, bf, true); - list_add_tail(&bf->list, &bf_q); - ath_set_rates(tid->an->vif, tid->an->sta, bf); - if (bf_isampdu(bf)) { -@@ -1712,6 +1729,9 @@ void ath9k_release_buffered_frames(struc - if (list_empty(&bf_q)) - return; - -+ if (!more_data) -+ ath9k_set_moredata(sc, bf_tail, false); -+ - info = IEEE80211_SKB_CB(bf_tail->bf_mpdu); - info->flags |= IEEE80211_TX_STATUS_EOSP; - diff --git a/package/kernel/mac80211/patches/361-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch b/package/kernel/mac80211/patches/361-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch deleted file mode 100644 index 319de2a767783e..00000000000000 --- a/package/kernel/mac80211/patches/361-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch +++ /dev/null @@ -1,22 +0,0 @@ -From: Felix Fietkau -Date: Sun, 28 Aug 2016 13:13:42 +0200 -Subject: [PATCH] ath9k: clear potentially stale EOSP status bit in - intermediate queues - -Prevents spurious ieee80211_sta_eosp calls. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/xmit.c -+++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -969,7 +969,8 @@ ath_tx_get_tid_subframe(struct ath_softc - bf->bf_lastbf = bf; - - tx_info = IEEE80211_SKB_CB(skb); -- tx_info->flags &= ~IEEE80211_TX_CTL_CLEAR_PS_FILT; -+ tx_info->flags &= ~(IEEE80211_TX_CTL_CLEAR_PS_FILT | -+ IEEE80211_TX_STATUS_EOSP); - - /* - * No aggregation session is running, but there may be frames diff --git a/package/kernel/mac80211/patches/362-ath9k-report-tx-status-on-EOSP.patch b/package/kernel/mac80211/patches/362-ath9k-report-tx-status-on-EOSP.patch deleted file mode 100644 index 80a3074a4d8d97..00000000000000 --- a/package/kernel/mac80211/patches/362-ath9k-report-tx-status-on-EOSP.patch +++ /dev/null @@ -1,19 +0,0 @@ -From: Felix Fietkau -Date: Sun, 28 Aug 2016 13:23:27 +0200 -Subject: [PATCH] ath9k: report tx status on EOSP - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/xmit.c -+++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -86,7 +86,8 @@ static void ath_tx_status(struct ieee802 - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_sta *sta = info->status.status_driver_data[0]; - -- if (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS) { -+ if (info->flags & (IEEE80211_TX_CTL_REQ_TX_STATUS | -+ IEEE80211_TX_STATUS_EOSP)) { - ieee80211_tx_status(hw, skb); - return; - } diff --git a/package/kernel/mac80211/patches/363-ath9k-fix-block-ack-window-tracking-issues.patch b/package/kernel/mac80211/patches/363-ath9k-fix-block-ack-window-tracking-issues.patch deleted file mode 100644 index e25e92dda9f86d..00000000000000 --- a/package/kernel/mac80211/patches/363-ath9k-fix-block-ack-window-tracking-issues.patch +++ /dev/null @@ -1,114 +0,0 @@ -From: Felix Fietkau -Date: Tue, 30 Aug 2016 12:44:08 +0200 -Subject: [PATCH] ath9k: fix block-ack window tracking issues - -Ensure that a buffer gets tracked as part of the block-ack window as -soon as it's dequeued from the tid for the first time. Ensure that -double calls to ath_tx_addto_baw (e.g. on retransmission) don't cause -any issues. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/xmit.c -+++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -62,7 +62,7 @@ static void ath_tx_rc_status(struct ath_ - struct ath_tx_status *ts, int nframes, int nbad, - int txok); - static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid, -- int seqno); -+ struct ath_buf *bf); - static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, - struct ath_txq *txq, - struct ath_atx_tid *tid, -@@ -296,7 +296,7 @@ static void ath_tx_flush_tid(struct ath_ - } - - if (fi->baw_tracked) { -- ath_tx_update_baw(sc, tid, bf->bf_state.seqno); -+ ath_tx_update_baw(sc, tid, bf); - sendbar = true; - } - -@@ -312,10 +312,15 @@ static void ath_tx_flush_tid(struct ath_ - } - - static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid, -- int seqno) -+ struct ath_buf *bf) - { -+ struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu); -+ u16 seqno = bf->bf_state.seqno; - int index, cindex; - -+ if (!fi->baw_tracked) -+ return; -+ - index = ATH_BA_INDEX(tid->seq_start, seqno); - cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1); - -@@ -336,6 +341,9 @@ static void ath_tx_addto_baw(struct ath_ - u16 seqno = bf->bf_state.seqno; - int index, cindex; - -+ if (fi->baw_tracked) -+ return; -+ - index = ATH_BA_INDEX(tid->seq_start, seqno); - cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1); - __set_bit(cindex, tid->tx_buf); -@@ -612,7 +620,7 @@ static void ath_tx_complete_aggr(struct - * complete the acked-ones/xretried ones; update - * block-ack window - */ -- ath_tx_update_baw(sc, tid, seqno); -+ ath_tx_update_baw(sc, tid, bf); - - if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) { - memcpy(tx_info->control.rates, rates, sizeof(rates)); -@@ -642,7 +650,7 @@ static void ath_tx_complete_aggr(struct - * run out of tx buf. - */ - if (!tbf) { -- ath_tx_update_baw(sc, tid, seqno); -+ ath_tx_update_baw(sc, tid, bf); - - ath_tx_complete_buf(sc, bf, txq, - &bf_head, NULL, ts, -@@ -1011,11 +1019,14 @@ ath_tx_get_tid_subframe(struct ath_softc - - INIT_LIST_HEAD(&bf_head); - list_add(&bf->list, &bf_head); -- ath_tx_update_baw(sc, tid, seqno); -+ ath_tx_update_baw(sc, tid, bf); - ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0); - continue; - } - -+ if (bf_isampdu(bf)) -+ ath_tx_addto_baw(sc, tid, bf); -+ - return bf; - } - -@@ -1073,8 +1084,6 @@ ath_tx_form_aggr(struct ath_softc *sc, s - bf->bf_next = NULL; - - /* link buffers of this frame to the aggregate */ -- if (!fi->baw_tracked) -- ath_tx_addto_baw(sc, tid, bf); - bf->bf_state.ndelim = ndelim; - - list_add_tail(&bf->list, bf_q); -@@ -1710,10 +1719,8 @@ void ath9k_release_buffered_frames(struc - ath9k_set_moredata(sc, bf, true); - list_add_tail(&bf->list, &bf_q); - ath_set_rates(tid->an->vif, tid->an->sta, bf); -- if (bf_isampdu(bf)) { -- ath_tx_addto_baw(sc, tid, bf); -+ if (bf_isampdu(bf)) - bf->bf_state.bf_type &= ~BUF_AGGR; -- } - if (bf_tail) - bf_tail->bf_next = bf; - diff --git a/package/kernel/mac80211/patches/364-ath9k_hw-fix-channel-maximum-power-level-test.patch b/package/kernel/mac80211/patches/364-ath9k_hw-fix-channel-maximum-power-level-test.patch deleted file mode 100644 index 67cbe92e595c12..00000000000000 --- a/package/kernel/mac80211/patches/364-ath9k_hw-fix-channel-maximum-power-level-test.patch +++ /dev/null @@ -1,47 +0,0 @@ -From: Felix Fietkau -Date: Wed, 22 Mar 2017 20:37:04 +0100 -Subject: [PATCH] ath9k_hw: fix channel maximum power level test - -The tx power applied by set_txpower is limited by the CTL (conformance -test limit) entries in the EEPROM. These can change based on the user -configured regulatory domain. -Depending on the EEPROM data this can cause the tx power to become too -limited, if the original regdomain CTLs impose lowr limits than the CTLs -of the user configured regdomain. - -To fix this issue, set the initial channel limits without any CTL -restrictions and only apply the CTL at run time when setting the channel -and the real tx power. - -Cc: stable@vger.kernel.org -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/hw.c -+++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -2937,10 +2937,14 @@ void ath9k_hw_apply_txpower(struct ath_h - struct ieee80211_channel *channel; - int chan_pwr, new_pwr, max_gain; - int ant_gain, ant_reduction = 0; -+ u16 ctl = NO_CTL; - - if (!chan) - return; - -+ if (!test) -+ ctl = ath9k_regd_get_ctl(reg, chan); -+ - channel = chan->chan; - chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER); - new_pwr = min_t(int, chan_pwr, reg->power_limit); -@@ -2950,9 +2954,7 @@ void ath9k_hw_apply_txpower(struct ath_h - if (ant_gain > max_gain) - ant_reduction = ant_gain - max_gain; - -- ah->eep_ops->set_txpower(ah, chan, -- ath9k_regd_get_ctl(reg, chan), -- ant_reduction, new_pwr, test); -+ ah->eep_ops->set_txpower(ah, chan, ctl, ant_reduction, new_pwr, test); - } - - void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) diff --git a/package/kernel/mac80211/patches/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch b/package/kernel/mac80211/patches/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch deleted file mode 100644 index 78083517bc6d4e..00000000000000 --- a/package/kernel/mac80211/patches/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch +++ /dev/null @@ -1,24 +0,0 @@ -From: Felix Fietkau -Date: Wed, 19 Jul 2017 08:49:31 +0200 -Subject: [PATCH] ath9k: adjust tx power reduction for US regulatory - domain - -FCC regulatory rules allow for up to 3 dBi antenna gain. Account for -this in the EEPROM based tx power reduction code. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/hw.c -+++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -2954,6 +2954,10 @@ void ath9k_hw_apply_txpower(struct ath_h - if (ant_gain > max_gain) - ant_reduction = ant_gain - max_gain; - -+ /* FCC allows maximum antenna gain of 3 dBi */ -+ if (reg->region == NL80211_DFS_FCC) -+ ant_reduction = max_t(int, ant_reduction - 6, 0); -+ - ah->eep_ops->set_txpower(ah, chan, ctl, ant_reduction, new_pwr, test); - } - diff --git a/package/kernel/mac80211/patches/366-ath9k-fix-more-data-flag-for-buffered-multicast-pack.patch b/package/kernel/mac80211/patches/366-ath9k-fix-more-data-flag-for-buffered-multicast-pack.patch deleted file mode 100644 index 0f3120d6716227..00000000000000 --- a/package/kernel/mac80211/patches/366-ath9k-fix-more-data-flag-for-buffered-multicast-pack.patch +++ /dev/null @@ -1,41 +0,0 @@ -From: Felix Fietkau -Date: Sun, 23 Jul 2017 14:58:22 +0200 -Subject: [PATCH] ath9k: fix more-data flag for buffered multicast - packets - -The flag needs to be cleared for the last packet in the list, not the -first one. Fixes some issues with multicast packet loss for powersave -clients connected to an ath9k AP. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/ath/ath9k/xmit.c -+++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -2436,7 +2436,6 @@ void ath_tx_cabq(struct ieee80211_hw *hw - .txq = sc->beacon.cabq - }; - struct ath_tx_info info = {}; -- struct ieee80211_hdr *hdr; - struct ath_buf *bf_tail = NULL; - struct ath_buf *bf; - LIST_HEAD(bf_q); -@@ -2480,15 +2479,10 @@ void ath_tx_cabq(struct ieee80211_hw *hw - if (list_empty(&bf_q)) - return; - -- bf = list_first_entry(&bf_q, struct ath_buf, list); -- hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data; -- -- if (hdr->frame_control & cpu_to_le16(IEEE80211_FCTL_MOREDATA)) { -- hdr->frame_control &= ~cpu_to_le16(IEEE80211_FCTL_MOREDATA); -- dma_sync_single_for_device(sc->dev, bf->bf_buf_addr, -- sizeof(*hdr), DMA_TO_DEVICE); -- } -+ bf = list_last_entry(&bf_q, struct ath_buf, list); -+ ath9k_set_moredata(sc, bf, false); - -+ bf = list_first_entry(&bf_q, struct ath_buf, list); - ath_txq_lock(sc, txctl.txq); - ath_tx_fill_desc(sc, bf, txctl.txq, 0); - ath_tx_txqaddbuf(sc, txctl.txq, &bf_q, false); diff --git a/package/kernel/mac80211/patches/367-Revert-ath10k-disable-wake_tx_queue-for-older-device.patch b/package/kernel/mac80211/patches/367-Revert-ath10k-disable-wake_tx_queue-for-older-device.patch deleted file mode 100644 index 56d86c1525ac30..00000000000000 --- a/package/kernel/mac80211/patches/367-Revert-ath10k-disable-wake_tx_queue-for-older-device.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: dave taht -Date: Wed, 5 Oct 2016 20:09:15 -0700 -Subject: [PATCH] Revert "ath10k: disable wake_tx_queue for older - devices" - -This reverts commit 4ca1807815aa6801aaced7fdefa9edacc2521767 -in the hope that we've fixed all the performance problems now. ---- - ---- a/drivers/net/wireless/ath/ath10k/mac.c -+++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -8319,15 +8319,6 @@ int ath10k_mac_register(struct ath10k *a - ath10k_warn(ar, "failed to initialise DFS pattern detector\n"); - } - -- /* Current wake_tx_queue implementation imposes a significant -- * performance penalty in some setups. The tx scheduling code needs -- * more work anyway so disable the wake_tx_queue unless firmware -- * supports the pull-push mechanism. -- */ -- if (!test_bit(ATH10K_FW_FEATURE_PEER_FLOW_CONTROL, -- ar->running_fw->fw_file.fw_features)) -- ar->ops->wake_tx_queue = NULL; -- - ret = ath10k_mac_init_rd(ar); - if (ret) { - ath10k_err(ar, "failed to derive regdom: %d\n", ret); diff --git a/package/kernel/mac80211/patches/368-ath10k-fix-recent-bandwidth-conversion-bug.patch b/package/kernel/mac80211/patches/368-ath10k-fix-recent-bandwidth-conversion-bug.patch deleted file mode 100644 index 5d5329f27e9366..00000000000000 --- a/package/kernel/mac80211/patches/368-ath10k-fix-recent-bandwidth-conversion-bug.patch +++ /dev/null @@ -1,61 +0,0 @@ -From: Christian Lamparter -Date: Wed, 1 Nov 2017 21:01:57 +0100 -Subject: [PATCH] ath10k: fix recent bandwidth conversion bug - -The commit "cfg80211: make RATE_INFO_BW_20 the default" changed -the index of RATE_INFO_BW_20, but the updates to ath10k missed -the special bandwidth calculation case in -ath10k_update_per_peer_tx_stats(). - -Fixes: 842be75c77cb ("cfg80211: make RATE_INFO_BW_20 the default") -Signed-off-by: Christian Lamparter -Patchwork-Id: 10037035 -Signed-off-by: Kalle Valo ---- - ---- a/drivers/net/wireless/ath/ath10k/htt_rx.c -+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c -@@ -592,6 +592,9 @@ struct amsdu_subframe_hdr { - - #define GROUP_ID_IS_SU_MIMO(x) ((x) == 0 || (x) == 63) - -+static const u8 ath10k_bw_to_mac80211[] = { RATE_INFO_BW_20, RATE_INFO_BW_40, -+ RATE_INFO_BW_80, RATE_INFO_BW_160 }; -+ - static void ath10k_htt_rx_h_rates(struct ath10k *ar, - struct ieee80211_rx_status *status, - struct htt_rx_desc *rxd) -@@ -694,23 +697,7 @@ static void ath10k_htt_rx_h_rates(struct - if (sgi) - status->enc_flags |= RX_ENC_FLAG_SHORT_GI; - -- switch (bw) { -- /* 20MHZ */ -- case 0: -- break; -- /* 40MHZ */ -- case 1: -- status->bw = RATE_INFO_BW_40; -- break; -- /* 80MHZ */ -- case 2: -- status->bw = RATE_INFO_BW_80; -- break; -- case 3: -- status->bw = RATE_INFO_BW_160; -- break; -- } -- -+ status->bw = ath10k_bw_to_mac80211[bw]; - status->encoding = RX_ENC_VHT; - break; - default: -@@ -2297,7 +2284,7 @@ ath10k_update_per_peer_tx_stats(struct a - arsta->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; - - arsta->txrate.nss = txrate.nss; -- arsta->txrate.bw = txrate.bw + RATE_INFO_BW_20; -+ arsta->txrate.bw = ath10k_bw_to_mac80211[txrate.bw]; - } - - static void ath10k_htt_fetch_peer_stats(struct ath10k *ar, diff --git a/package/kernel/mac80211/patches/369-cfg80211-use-only-1Mbps-for-basic-rates-in-mesh.patch b/package/kernel/mac80211/patches/369-cfg80211-use-only-1Mbps-for-basic-rates-in-mesh.patch deleted file mode 100644 index bc4174e4c20f96..00000000000000 --- a/package/kernel/mac80211/patches/369-cfg80211-use-only-1Mbps-for-basic-rates-in-mesh.patch +++ /dev/null @@ -1,55 +0,0 @@ -From: Johannes Berg -Date: Tue, 30 Jan 2018 13:17:38 +0100 -Subject: [PATCH] cfg80211: use only 1Mbps for basic rates in mesh - -Mesh used to use the mandatory rates as basic rates, but we got -the calculation of mandatory rates wrong until some time ago. -Fix this this broke interoperability with older versions since -now more basic rates are required, and thus the MBSS isn't the -same and the network stops working. - -Fix this by simply using only 1Mbps as the basic rate in 2.4GHz. -Since the changed mandatory rates only affected 2.4GHz, this is -all we need to make it work again. - -Reported-and-tested-by: Matthias Schiffer -Fixes: 1bd773c077de ("wireless: set correct mandatory rate flags") -Signed-off-by: Johannes Berg ---- - net/wireless/mesh.c | 25 ++++++++++++++++++++++--- - 1 file changed, 22 insertions(+), 3 deletions(-) - ---- a/net/wireless/mesh.c -+++ b/net/wireless/mesh.c -@@ -169,9 +169,28 @@ int __cfg80211_join_mesh(struct cfg80211 - enum nl80211_bss_scan_width scan_width; - struct ieee80211_supported_band *sband = - rdev->wiphy.bands[setup->chandef.chan->band]; -- scan_width = cfg80211_chandef_to_scan_width(&setup->chandef); -- setup->basic_rates = ieee80211_mandatory_rates(sband, -- scan_width); -+ -+ if (setup->chandef.chan->band == NL80211_BAND_2GHZ) { -+ int i; -+ -+ /* -+ * Older versions selected the mandatory rates for -+ * 2.4 GHz as well, but were broken in that only -+ * 1 Mbps was regarded as a mandatory rate. Keep -+ * using just 1 Mbps as the default basic rate for -+ * mesh to be interoperable with older versions. -+ */ -+ for (i = 0; i < sband->n_bitrates; i++) { -+ if (sband->bitrates[i].bitrate == 10) { -+ setup->basic_rates = BIT(i); -+ break; -+ } -+ } -+ } else { -+ scan_width = cfg80211_chandef_to_scan_width(&setup->chandef); -+ setup->basic_rates = ieee80211_mandatory_rates(sband, -+ scan_width); -+ } - } - - err = cfg80211_chandef_dfs_required(&rdev->wiphy, diff --git a/package/kernel/mac80211/patches/370-mac80211-minstrel-remove-unnecessary-debugfs-cleanup.patch b/package/kernel/mac80211/patches/370-mac80211-minstrel-remove-unnecessary-debugfs-cleanup.patch deleted file mode 100644 index 14cf6641d81340..00000000000000 --- a/package/kernel/mac80211/patches/370-mac80211-minstrel-remove-unnecessary-debugfs-cleanup.patch +++ /dev/null @@ -1,150 +0,0 @@ -From: Felix Fietkau -Date: Sat, 10 Feb 2018 12:41:51 +0100 -Subject: [PATCH] mac80211: minstrel: remove unnecessary debugfs cleanup - code - -debugfs entries are cleaned up by debugfs_remove_recursive already. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel.c -+++ b/net/mac80211/rc80211_minstrel.c -@@ -689,8 +689,8 @@ minstrel_alloc(struct ieee80211_hw *hw, - - #ifdef CPTCFG_MAC80211_DEBUGFS - mp->fixed_rate_idx = (u32) -1; -- mp->dbg_fixed_rate = debugfs_create_u32("fixed_rate_idx", -- S_IRUGO | S_IWUGO, debugfsdir, &mp->fixed_rate_idx); -+ debugfs_create_u32("fixed_rate_idx", S_IRUGO | S_IWUGO, debugfsdir, -+ &mp->fixed_rate_idx); - #endif - - minstrel_init_cck_rates(mp); -@@ -701,9 +701,6 @@ minstrel_alloc(struct ieee80211_hw *hw, - static void - minstrel_free(void *priv) - { --#ifdef CPTCFG_MAC80211_DEBUGFS -- debugfs_remove(((struct minstrel_priv *)priv)->dbg_fixed_rate); --#endif - kfree(priv); - } - -@@ -735,7 +732,6 @@ const struct rate_control_ops mac80211_m - .free_sta = minstrel_free_sta, - #ifdef CPTCFG_MAC80211_DEBUGFS - .add_sta_debugfs = minstrel_add_sta_debugfs, -- .remove_sta_debugfs = minstrel_remove_sta_debugfs, - #endif - .get_expected_throughput = minstrel_get_expected_throughput, - }; ---- a/net/mac80211/rc80211_minstrel.h -+++ b/net/mac80211/rc80211_minstrel.h -@@ -109,11 +109,6 @@ struct minstrel_sta_info { - - /* sampling table */ - u8 *sample_table; -- --#ifdef CPTCFG_MAC80211_DEBUGFS -- struct dentry *dbg_stats; -- struct dentry *dbg_stats_csv; --#endif - }; - - struct minstrel_priv { -@@ -137,7 +132,6 @@ struct minstrel_priv { - * - setting will be applied on next update - */ - u32 fixed_rate_idx; -- struct dentry *dbg_fixed_rate; - #endif - }; - -@@ -156,7 +150,6 @@ minstrel_get_ewmsd10(struct minstrel_rat - - extern const struct rate_control_ops mac80211_minstrel; - void minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); --void minstrel_remove_sta_debugfs(void *priv, void *priv_sta); - - /* Recalculate success probabilities and counters for a given rate using EWMA */ - void minstrel_calc_rate_stats(struct minstrel_rate_stats *mrs); ---- a/net/mac80211/rc80211_minstrel_debugfs.c -+++ b/net/mac80211/rc80211_minstrel_debugfs.c -@@ -214,19 +214,7 @@ minstrel_add_sta_debugfs(void *priv, voi - { - struct minstrel_sta_info *mi = priv_sta; - -- mi->dbg_stats = debugfs_create_file("rc_stats", S_IRUGO, dir, mi, -- &minstrel_stat_fops); -- -- mi->dbg_stats_csv = debugfs_create_file("rc_stats_csv", S_IRUGO, dir, -- mi, &minstrel_stat_csv_fops); --} -- --void --minstrel_remove_sta_debugfs(void *priv, void *priv_sta) --{ -- struct minstrel_sta_info *mi = priv_sta; -- -- debugfs_remove(mi->dbg_stats); -- -- debugfs_remove(mi->dbg_stats_csv); -+ debugfs_create_file("rc_stats", S_IRUGO, dir, mi, &minstrel_stat_fops); -+ debugfs_create_file("rc_stats_csv", S_IRUGO, dir, mi, -+ &minstrel_stat_csv_fops); - } ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -1393,7 +1393,6 @@ static const struct rate_control_ops mac - .free = minstrel_ht_free, - #ifdef CPTCFG_MAC80211_DEBUGFS - .add_sta_debugfs = minstrel_ht_add_sta_debugfs, -- .remove_sta_debugfs = minstrel_ht_remove_sta_debugfs, - #endif - .get_expected_throughput = minstrel_ht_get_expected_throughput, - }; ---- a/net/mac80211/rc80211_minstrel_ht.h -+++ b/net/mac80211/rc80211_minstrel_ht.h -@@ -110,17 +110,12 @@ struct minstrel_ht_sta_priv { - struct minstrel_ht_sta ht; - struct minstrel_sta_info legacy; - }; --#ifdef CPTCFG_MAC80211_DEBUGFS -- struct dentry *dbg_stats; -- struct dentry *dbg_stats_csv; --#endif - void *ratelist; - void *sample_table; - bool is_ht; - }; - - void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); --void minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta); - int minstrel_ht_get_tp_avg(struct minstrel_ht_sta *mi, int group, int rate, - int prob_ewma); - ---- a/net/mac80211/rc80211_minstrel_ht_debugfs.c -+++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c -@@ -303,17 +303,8 @@ minstrel_ht_add_sta_debugfs(void *priv, - { - struct minstrel_ht_sta_priv *msp = priv_sta; - -- msp->dbg_stats = debugfs_create_file("rc_stats", S_IRUGO, dir, msp, -- &minstrel_ht_stat_fops); -- msp->dbg_stats_csv = debugfs_create_file("rc_stats_csv", S_IRUGO, -- dir, msp, &minstrel_ht_stat_csv_fops); --} -- --void --minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta) --{ -- struct minstrel_ht_sta_priv *msp = priv_sta; -- -- debugfs_remove(msp->dbg_stats); -- debugfs_remove(msp->dbg_stats_csv); -+ debugfs_create_file("rc_stats", S_IRUGO, dir, msp, -+ &minstrel_ht_stat_fops); -+ debugfs_create_file("rc_stats_csv", S_IRUGO, dir, msp, -+ &minstrel_ht_stat_csv_fops); - } diff --git a/package/kernel/mac80211/patches/371-mac80211-minstrel-merge-with-minstrel_ht-always-enab.patch b/package/kernel/mac80211/patches/371-mac80211-minstrel-merge-with-minstrel_ht-always-enab.patch deleted file mode 100644 index a2bdfd81a0ae3c..00000000000000 --- a/package/kernel/mac80211/patches/371-mac80211-minstrel-merge-with-minstrel_ht-always-enab.patch +++ /dev/null @@ -1,576 +0,0 @@ -From: Felix Fietkau -Date: Sat, 10 Feb 2018 12:43:30 +0100 -Subject: [PATCH] mac80211: minstrel: merge with minstrel_ht, always enable - VHT support - -Legacy-only devices are not very common and the overhead of the extra -code for HT and VHT rates is not big enough to justify all those extra -lines of code to make it optional. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/Kconfig -+++ b/net/mac80211/Kconfig -@@ -25,20 +25,6 @@ config MAC80211_RC_MINSTREL - ---help--- - This option enables the 'minstrel' TX rate control algorithm - --config MAC80211_RC_MINSTREL_HT -- bool "Minstrel 802.11n support" if EXPERT -- depends on MAC80211_RC_MINSTREL -- default y -- ---help--- -- This option enables the 'minstrel_ht' TX rate control algorithm -- --config MAC80211_RC_MINSTREL_VHT -- bool "Minstrel 802.11ac support" if EXPERT -- depends on MAC80211_RC_MINSTREL_HT -- default n -- ---help--- -- This option enables VHT in the 'minstrel_ht' TX rate control algorithm -- - choice - prompt "Default rate control algorithm" - depends on MAC80211_HAS_RC -@@ -60,8 +46,7 @@ endchoice - - config MAC80211_RC_DEFAULT - string -- default "minstrel_ht" if MAC80211_RC_DEFAULT_MINSTREL && MAC80211_RC_MINSTREL_HT -- default "minstrel" if MAC80211_RC_DEFAULT_MINSTREL -+ default "minstrel_ht" if MAC80211_RC_DEFAULT_MINSTREL - default "" - - endif ---- a/net/mac80211/Makefile -+++ b/net/mac80211/Makefile -@@ -50,13 +50,14 @@ mac80211-$(CONFIG_PM) += pm.o - - CFLAGS_trace.o := -I$(src) - --rc80211_minstrel-y := rc80211_minstrel.o --rc80211_minstrel-$(CPTCFG_MAC80211_DEBUGFS) += rc80211_minstrel_debugfs.o -+rc80211_minstrel-y := \ -+ rc80211_minstrel.o \ -+ rc80211_minstrel_ht.o - --rc80211_minstrel_ht-y := rc80211_minstrel_ht.o --rc80211_minstrel_ht-$(CPTCFG_MAC80211_DEBUGFS) += rc80211_minstrel_ht_debugfs.o -+rc80211_minstrel-$(CPTCFG_MAC80211_DEBUGFS) += \ -+ rc80211_minstrel_debugfs.o \ -+ rc80211_minstrel_ht_debugfs.o - - mac80211-$(CPTCFG_MAC80211_RC_MINSTREL) += $(rc80211_minstrel-y) --mac80211-$(CPTCFG_MAC80211_RC_MINSTREL_HT) += $(rc80211_minstrel_ht-y) - - ccflags-y += -DDEBUG ---- a/net/mac80211/main.c -+++ b/net/mac80211/main.c -@@ -1252,18 +1252,12 @@ static int __init ieee80211_init(void) - if (ret) - return ret; - -- ret = rc80211_minstrel_ht_init(); -- if (ret) -- goto err_minstrel; -- - ret = ieee80211_iface_init(); - if (ret) - goto err_netdev; - - return 0; - err_netdev: -- rc80211_minstrel_ht_exit(); -- err_minstrel: - rc80211_minstrel_exit(); - - return ret; -@@ -1271,7 +1265,6 @@ static int __init ieee80211_init(void) - - static void __exit ieee80211_exit(void) - { -- rc80211_minstrel_ht_exit(); - rc80211_minstrel_exit(); - - ieee80211s_stop(); ---- a/net/mac80211/rate.h -+++ b/net/mac80211/rate.h -@@ -95,18 +95,5 @@ static inline void rc80211_minstrel_exit - } - #endif - --#ifdef CPTCFG_MAC80211_RC_MINSTREL_HT --int rc80211_minstrel_ht_init(void); --void rc80211_minstrel_ht_exit(void); --#else --static inline int rc80211_minstrel_ht_init(void) --{ -- return 0; --} --static inline void rc80211_minstrel_ht_exit(void) --{ --} --#endif -- - - #endif /* IEEE80211_RATE_H */ ---- a/net/mac80211/rc80211_minstrel.c -+++ b/net/mac80211/rc80211_minstrel.c -@@ -572,138 +572,6 @@ minstrel_rate_init(void *priv, struct ie - minstrel_update_rates(mp, mi); - } - --static void * --minstrel_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) --{ -- struct ieee80211_supported_band *sband; -- struct minstrel_sta_info *mi; -- struct minstrel_priv *mp = priv; -- struct ieee80211_hw *hw = mp->hw; -- int max_rates = 0; -- int i; -- -- mi = kzalloc(sizeof(struct minstrel_sta_info), gfp); -- if (!mi) -- return NULL; -- -- for (i = 0; i < NUM_NL80211_BANDS; i++) { -- sband = hw->wiphy->bands[i]; -- if (sband && sband->n_bitrates > max_rates) -- max_rates = sband->n_bitrates; -- } -- -- mi->r = kzalloc(sizeof(struct minstrel_rate) * max_rates, gfp); -- if (!mi->r) -- goto error; -- -- mi->sample_table = kmalloc(SAMPLE_COLUMNS * max_rates, gfp); -- if (!mi->sample_table) -- goto error1; -- -- mi->last_stats_update = jiffies; -- return mi; -- --error1: -- kfree(mi->r); --error: -- kfree(mi); -- return NULL; --} -- --static void --minstrel_free_sta(void *priv, struct ieee80211_sta *sta, void *priv_sta) --{ -- struct minstrel_sta_info *mi = priv_sta; -- -- kfree(mi->sample_table); -- kfree(mi->r); -- kfree(mi); --} -- --static void --minstrel_init_cck_rates(struct minstrel_priv *mp) --{ -- static const int bitrates[4] = { 10, 20, 55, 110 }; -- struct ieee80211_supported_band *sband; -- u32 rate_flags = ieee80211_chandef_rate_flags(&mp->hw->conf.chandef); -- int i, j; -- -- sband = mp->hw->wiphy->bands[NL80211_BAND_2GHZ]; -- if (!sband) -- return; -- -- for (i = 0, j = 0; i < sband->n_bitrates; i++) { -- struct ieee80211_rate *rate = &sband->bitrates[i]; -- -- if (rate->flags & IEEE80211_RATE_ERP_G) -- continue; -- -- if ((rate_flags & sband->bitrates[i].flags) != rate_flags) -- continue; -- -- for (j = 0; j < ARRAY_SIZE(bitrates); j++) { -- if (rate->bitrate != bitrates[j]) -- continue; -- -- mp->cck_rates[j] = i; -- break; -- } -- } --} -- --static void * --minstrel_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) --{ -- struct minstrel_priv *mp; -- -- mp = kzalloc(sizeof(struct minstrel_priv), GFP_ATOMIC); -- if (!mp) -- return NULL; -- -- /* contention window settings -- * Just an approximation. Using the per-queue values would complicate -- * the calculations and is probably unnecessary */ -- mp->cw_min = 15; -- mp->cw_max = 1023; -- -- /* number of packets (in %) to use for sampling other rates -- * sample less often for non-mrr packets, because the overhead -- * is much higher than with mrr */ -- mp->lookaround_rate = 5; -- mp->lookaround_rate_mrr = 10; -- -- /* maximum time that the hw is allowed to stay in one MRR segment */ -- mp->segment_size = 6000; -- -- if (hw->max_rate_tries > 0) -- mp->max_retry = hw->max_rate_tries; -- else -- /* safe default, does not necessarily have to match hw properties */ -- mp->max_retry = 7; -- -- if (hw->max_rates >= 4) -- mp->has_mrr = true; -- -- mp->hw = hw; -- mp->update_interval = 100; -- --#ifdef CPTCFG_MAC80211_DEBUGFS -- mp->fixed_rate_idx = (u32) -1; -- debugfs_create_u32("fixed_rate_idx", S_IRUGO | S_IWUGO, debugfsdir, -- &mp->fixed_rate_idx); --#endif -- -- minstrel_init_cck_rates(mp); -- -- return mp; --} -- --static void --minstrel_free(void *priv) --{ -- kfree(priv); --} -- - static u32 minstrel_get_expected_throughput(void *priv_sta) - { - struct minstrel_sta_info *mi = priv_sta; -@@ -722,29 +590,8 @@ static u32 minstrel_get_expected_through - } - - const struct rate_control_ops mac80211_minstrel = { -- .name = "minstrel", - .tx_status_ext = minstrel_tx_status, - .get_rate = minstrel_get_rate, - .rate_init = minstrel_rate_init, -- .alloc = minstrel_alloc, -- .free = minstrel_free, -- .alloc_sta = minstrel_alloc_sta, -- .free_sta = minstrel_free_sta, --#ifdef CPTCFG_MAC80211_DEBUGFS -- .add_sta_debugfs = minstrel_add_sta_debugfs, --#endif - .get_expected_throughput = minstrel_get_expected_throughput, - }; -- --int __init --rc80211_minstrel_init(void) --{ -- return ieee80211_rate_control_register(&mac80211_minstrel); --} -- --void --rc80211_minstrel_exit(void) --{ -- ieee80211_rate_control_unregister(&mac80211_minstrel); --} -- ---- a/net/mac80211/rc80211_minstrel.h -+++ b/net/mac80211/rc80211_minstrel.h -@@ -158,7 +158,5 @@ int minstrel_get_tp_avg(struct minstrel_ - /* debugfs */ - int minstrel_stats_open(struct inode *inode, struct file *file); - int minstrel_stats_csv_open(struct inode *inode, struct file *file); --ssize_t minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos); --int minstrel_stats_release(struct inode *inode, struct file *file); - - #endif ---- a/net/mac80211/rc80211_minstrel_debugfs.c -+++ b/net/mac80211/rc80211_minstrel_debugfs.c -@@ -54,22 +54,6 @@ - #include - #include "rc80211_minstrel.h" - --ssize_t --minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos) --{ -- struct minstrel_debugfs_info *ms; -- -- ms = file->private_data; -- return simple_read_from_buffer(buf, len, ppos, ms->buf, ms->len); --} -- --int --minstrel_stats_release(struct inode *inode, struct file *file) --{ -- kfree(file->private_data); -- return 0; --} -- - int - minstrel_stats_open(struct inode *inode, struct file *file) - { -@@ -135,14 +119,6 @@ minstrel_stats_open(struct inode *inode, - return 0; - } - --static const struct file_operations minstrel_stat_fops = { -- .owner = THIS_MODULE, -- .open = minstrel_stats_open, -- .read = minstrel_stats_read, -- .release = minstrel_stats_release, -- .llseek = default_llseek, --}; -- - int - minstrel_stats_csv_open(struct inode *inode, struct file *file) - { -@@ -200,21 +176,3 @@ minstrel_stats_csv_open(struct inode *in - - return 0; - } -- --static const struct file_operations minstrel_stat_csv_fops = { -- .owner = THIS_MODULE, -- .open = minstrel_stats_csv_open, -- .read = minstrel_stats_read, -- .release = minstrel_stats_release, -- .llseek = default_llseek, --}; -- --void --minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir) --{ -- struct minstrel_sta_info *mi = priv_sta; -- -- debugfs_create_file("rc_stats", S_IRUGO, dir, mi, &minstrel_stat_fops); -- debugfs_create_file("rc_stats_csv", S_IRUGO, dir, mi, -- &minstrel_stat_csv_fops); --} ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -137,12 +137,10 @@ - } \ - } - --#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT - static bool minstrel_vht_only = true; - module_param(minstrel_vht_only, bool, 0644); - MODULE_PARM_DESC(minstrel_vht_only, - "Use only VHT rates when VHT is supported by sta."); --#endif - - /* - * To enable sufficiently targeted rate sampling, MCS rates are divided into -@@ -171,7 +169,6 @@ const struct mcs_group minstrel_mcs_grou - - CCK_GROUP, - --#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT - VHT_GROUP(1, 0, BW_20), - VHT_GROUP(2, 0, BW_20), - VHT_GROUP(3, 0, BW_20), -@@ -195,7 +192,6 @@ const struct mcs_group minstrel_mcs_grou - VHT_GROUP(1, 1, BW_80), - VHT_GROUP(2, 1, BW_80), - VHT_GROUP(3, 1, BW_80), --#endif - }; - - static u8 sample_table[SAMPLE_COLUMNS][MCS_GROUP_RATES] __read_mostly; -@@ -1146,12 +1142,10 @@ minstrel_ht_update_caps(void *priv, stru - - BUILD_BUG_ON(ARRAY_SIZE(minstrel_mcs_groups) != MINSTREL_GROUPS_NB); - --#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT - if (vht_cap->vht_supported) - use_vht = vht_cap->vht_mcs.tx_mcs_map != cpu_to_le16(~0); - else --#endif -- use_vht = 0; -+ use_vht = 0; - - msp->is_ht = true; - memset(mi, 0, sizeof(*mi)); -@@ -1226,10 +1220,9 @@ minstrel_ht_update_caps(void *priv, stru - - /* HT rate */ - if (gflags & IEEE80211_TX_RC_MCS) { --#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT - if (use_vht && minstrel_vht_only) - continue; --#endif -+ - mi->supported[i] = mcs->rx_mask[nss - 1]; - if (mi->supported[i]) - n_supported++; -@@ -1349,16 +1342,88 @@ minstrel_ht_free_sta(void *priv, struct - kfree(msp); - } - -+static void -+minstrel_ht_init_cck_rates(struct minstrel_priv *mp) -+{ -+ static const int bitrates[4] = { 10, 20, 55, 110 }; -+ struct ieee80211_supported_band *sband; -+ u32 rate_flags = ieee80211_chandef_rate_flags(&mp->hw->conf.chandef); -+ int i, j; -+ -+ sband = mp->hw->wiphy->bands[NL80211_BAND_2GHZ]; -+ if (!sband) -+ return; -+ -+ for (i = 0, j = 0; i < sband->n_bitrates; i++) { -+ struct ieee80211_rate *rate = &sband->bitrates[i]; -+ -+ if (rate->flags & IEEE80211_RATE_ERP_G) -+ continue; -+ -+ if ((rate_flags & sband->bitrates[i].flags) != rate_flags) -+ continue; -+ -+ for (j = 0; j < ARRAY_SIZE(bitrates); j++) { -+ if (rate->bitrate != bitrates[j]) -+ continue; -+ -+ mp->cck_rates[j] = i; -+ break; -+ } -+ } -+} -+ - static void * - minstrel_ht_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) - { -- return mac80211_minstrel.alloc(hw, debugfsdir); -+ struct minstrel_priv *mp; -+ -+ mp = kzalloc(sizeof(struct minstrel_priv), GFP_ATOMIC); -+ if (!mp) -+ return NULL; -+ -+ /* contention window settings -+ * Just an approximation. Using the per-queue values would complicate -+ * the calculations and is probably unnecessary */ -+ mp->cw_min = 15; -+ mp->cw_max = 1023; -+ -+ /* number of packets (in %) to use for sampling other rates -+ * sample less often for non-mrr packets, because the overhead -+ * is much higher than with mrr */ -+ mp->lookaround_rate = 5; -+ mp->lookaround_rate_mrr = 10; -+ -+ /* maximum time that the hw is allowed to stay in one MRR segment */ -+ mp->segment_size = 6000; -+ -+ if (hw->max_rate_tries > 0) -+ mp->max_retry = hw->max_rate_tries; -+ else -+ /* safe default, does not necessarily have to match hw properties */ -+ mp->max_retry = 7; -+ -+ if (hw->max_rates >= 4) -+ mp->has_mrr = true; -+ -+ mp->hw = hw; -+ mp->update_interval = 100; -+ -+#ifdef CPTCFG_MAC80211_DEBUGFS -+ mp->fixed_rate_idx = (u32) -1; -+ debugfs_create_u32("fixed_rate_idx", S_IRUGO | S_IWUGO, debugfsdir, -+ &mp->fixed_rate_idx); -+#endif -+ -+ minstrel_ht_init_cck_rates(mp); -+ -+ return mp; - } - - static void - minstrel_ht_free(void *priv) - { -- mac80211_minstrel.free(priv); -+ kfree(priv); - } - - static u32 minstrel_ht_get_expected_throughput(void *priv_sta) -@@ -1417,14 +1482,14 @@ static void __init init_sample_table(voi - } - - int __init --rc80211_minstrel_ht_init(void) -+rc80211_minstrel_init(void) - { - init_sample_table(); - return ieee80211_rate_control_register(&mac80211_minstrel_ht); - } - - void --rc80211_minstrel_ht_exit(void) -+rc80211_minstrel_exit(void) - { - ieee80211_rate_control_unregister(&mac80211_minstrel_ht); - } ---- a/net/mac80211/rc80211_minstrel_ht.h -+++ b/net/mac80211/rc80211_minstrel_ht.h -@@ -15,11 +15,7 @@ - */ - #define MINSTREL_MAX_STREAMS 3 - #define MINSTREL_HT_STREAM_GROUPS 4 /* BW(=2) * SGI(=2) */ --#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT - #define MINSTREL_VHT_STREAM_GROUPS 6 /* BW(=3) * SGI(=2) */ --#else --#define MINSTREL_VHT_STREAM_GROUPS 0 --#endif - - #define MINSTREL_HT_GROUPS_NB (MINSTREL_MAX_STREAMS * \ - MINSTREL_HT_STREAM_GROUPS) -@@ -34,11 +30,7 @@ - #define MINSTREL_CCK_GROUP (MINSTREL_HT_GROUP_0 + MINSTREL_HT_GROUPS_NB) - #define MINSTREL_VHT_GROUP_0 (MINSTREL_CCK_GROUP + 1) - --#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT - #define MCS_GROUP_RATES 10 --#else --#define MCS_GROUP_RATES 8 --#endif - - struct mcs_group { - u32 flags; ---- a/net/mac80211/rc80211_minstrel_ht_debugfs.c -+++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c -@@ -15,6 +15,22 @@ - #include "rc80211_minstrel.h" - #include "rc80211_minstrel_ht.h" - -+static ssize_t -+minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos) -+{ -+ struct minstrel_debugfs_info *ms; -+ -+ ms = file->private_data; -+ return simple_read_from_buffer(buf, len, ppos, ms->buf, ms->len); -+} -+ -+static int -+minstrel_stats_release(struct inode *inode, struct file *file) -+{ -+ kfree(file->private_data); -+ return 0; -+} -+ - static char * - minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p) - { diff --git a/package/kernel/mac80211/patches/372-mac80211-minstrel-reduce-minstrel_mcs_groups-size.patch b/package/kernel/mac80211/patches/372-mac80211-minstrel-reduce-minstrel_mcs_groups-size.patch deleted file mode 100644 index 02a0ca0a52b3d8..00000000000000 --- a/package/kernel/mac80211/patches/372-mac80211-minstrel-reduce-minstrel_mcs_groups-size.patch +++ /dev/null @@ -1,368 +0,0 @@ -From: Felix Fietkau -Date: Sat, 10 Feb 2018 12:45:47 +0100 -Subject: [PATCH] mac80211: minstrel: reduce minstrel_mcs_groups size - -By storing a shift value for all duration values of a group, we can -reduce precision by a neglegible amount to make it fit into a u16 value. -This improves cache footprint and reduces size: - -Before: - text data bss dec hex filename - 10024 116 0 10140 279c rc80211_minstrel_ht.o - -After: - text data bss dec hex filename - 9368 116 0 9484 250c rc80211_minstrel_ht.o - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -52,22 +52,23 @@ - _streams - 1 - - /* MCS rate information for an MCS group */ --#define MCS_GROUP(_streams, _sgi, _ht40) \ -+#define MCS_GROUP(_streams, _sgi, _ht40, _s) \ - [GROUP_IDX(_streams, _sgi, _ht40)] = { \ - .streams = _streams, \ -+ .shift = _s, \ - .flags = \ - IEEE80211_TX_RC_MCS | \ - (_sgi ? IEEE80211_TX_RC_SHORT_GI : 0) | \ - (_ht40 ? IEEE80211_TX_RC_40_MHZ_WIDTH : 0), \ - .duration = { \ -- MCS_DURATION(_streams, _sgi, _ht40 ? 54 : 26), \ -- MCS_DURATION(_streams, _sgi, _ht40 ? 108 : 52), \ -- MCS_DURATION(_streams, _sgi, _ht40 ? 162 : 78), \ -- MCS_DURATION(_streams, _sgi, _ht40 ? 216 : 104), \ -- MCS_DURATION(_streams, _sgi, _ht40 ? 324 : 156), \ -- MCS_DURATION(_streams, _sgi, _ht40 ? 432 : 208), \ -- MCS_DURATION(_streams, _sgi, _ht40 ? 486 : 234), \ -- MCS_DURATION(_streams, _sgi, _ht40 ? 540 : 260) \ -+ MCS_DURATION(_streams, _sgi, _ht40 ? 54 : 26) >> _s, \ -+ MCS_DURATION(_streams, _sgi, _ht40 ? 108 : 52) >> _s, \ -+ MCS_DURATION(_streams, _sgi, _ht40 ? 162 : 78) >> _s, \ -+ MCS_DURATION(_streams, _sgi, _ht40 ? 216 : 104) >> _s, \ -+ MCS_DURATION(_streams, _sgi, _ht40 ? 324 : 156) >> _s, \ -+ MCS_DURATION(_streams, _sgi, _ht40 ? 432 : 208) >> _s, \ -+ MCS_DURATION(_streams, _sgi, _ht40 ? 486 : 234) >> _s, \ -+ MCS_DURATION(_streams, _sgi, _ht40 ? 540 : 260) >> _s \ - } \ - } - -@@ -80,9 +81,10 @@ - #define BW2VBPS(_bw, r3, r2, r1) \ - (_bw == BW_80 ? r3 : _bw == BW_40 ? r2 : r1) - --#define VHT_GROUP(_streams, _sgi, _bw) \ -+#define VHT_GROUP(_streams, _sgi, _bw, _s) \ - [VHT_GROUP_IDX(_streams, _sgi, _bw)] = { \ - .streams = _streams, \ -+ .shift = _s, \ - .flags = \ - IEEE80211_TX_RC_VHT_MCS | \ - (_sgi ? IEEE80211_TX_RC_SHORT_GI : 0) | \ -@@ -90,25 +92,25 @@ - _bw == BW_40 ? IEEE80211_TX_RC_40_MHZ_WIDTH : 0), \ - .duration = { \ - MCS_DURATION(_streams, _sgi, \ -- BW2VBPS(_bw, 117, 54, 26)), \ -+ BW2VBPS(_bw, 117, 54, 26)) >> _s, \ - MCS_DURATION(_streams, _sgi, \ -- BW2VBPS(_bw, 234, 108, 52)), \ -+ BW2VBPS(_bw, 234, 108, 52)) >> _s, \ - MCS_DURATION(_streams, _sgi, \ -- BW2VBPS(_bw, 351, 162, 78)), \ -+ BW2VBPS(_bw, 351, 162, 78)) >> _s, \ - MCS_DURATION(_streams, _sgi, \ -- BW2VBPS(_bw, 468, 216, 104)), \ -+ BW2VBPS(_bw, 468, 216, 104)) >> _s, \ - MCS_DURATION(_streams, _sgi, \ -- BW2VBPS(_bw, 702, 324, 156)), \ -+ BW2VBPS(_bw, 702, 324, 156)) >> _s, \ - MCS_DURATION(_streams, _sgi, \ -- BW2VBPS(_bw, 936, 432, 208)), \ -+ BW2VBPS(_bw, 936, 432, 208)) >> _s, \ - MCS_DURATION(_streams, _sgi, \ -- BW2VBPS(_bw, 1053, 486, 234)), \ -+ BW2VBPS(_bw, 1053, 486, 234)) >> _s, \ - MCS_DURATION(_streams, _sgi, \ -- BW2VBPS(_bw, 1170, 540, 260)), \ -+ BW2VBPS(_bw, 1170, 540, 260)) >> _s, \ - MCS_DURATION(_streams, _sgi, \ -- BW2VBPS(_bw, 1404, 648, 312)), \ -+ BW2VBPS(_bw, 1404, 648, 312)) >> _s, \ - MCS_DURATION(_streams, _sgi, \ -- BW2VBPS(_bw, 1560, 720, 346)) \ -+ BW2VBPS(_bw, 1560, 720, 346)) >> _s \ - } \ - } - -@@ -121,19 +123,20 @@ - (CCK_DURATION((_bitrate > 10 ? 20 : 10), false, 60) + \ - CCK_DURATION(_bitrate, _short, AVG_PKT_SIZE)) - --#define CCK_DURATION_LIST(_short) \ -- CCK_ACK_DURATION(10, _short), \ -- CCK_ACK_DURATION(20, _short), \ -- CCK_ACK_DURATION(55, _short), \ -- CCK_ACK_DURATION(110, _short) -+#define CCK_DURATION_LIST(_short, _s) \ -+ CCK_ACK_DURATION(10, _short) >> _s, \ -+ CCK_ACK_DURATION(20, _short) >> _s, \ -+ CCK_ACK_DURATION(55, _short) >> _s, \ -+ CCK_ACK_DURATION(110, _short) >> _s - --#define CCK_GROUP \ -+#define CCK_GROUP(_s) \ - [MINSTREL_CCK_GROUP] = { \ - .streams = 0, \ - .flags = 0, \ -+ .shift = _s, \ - .duration = { \ -- CCK_DURATION_LIST(false), \ -- CCK_DURATION_LIST(true) \ -+ CCK_DURATION_LIST(false, _s), \ -+ CCK_DURATION_LIST(true, _s) \ - } \ - } - -@@ -151,47 +154,47 @@ MODULE_PARM_DESC(minstrel_vht_only, - * BW -> SGI -> #streams - */ - const struct mcs_group minstrel_mcs_groups[] = { -- MCS_GROUP(1, 0, BW_20), -- MCS_GROUP(2, 0, BW_20), -- MCS_GROUP(3, 0, BW_20), -- -- MCS_GROUP(1, 1, BW_20), -- MCS_GROUP(2, 1, BW_20), -- MCS_GROUP(3, 1, BW_20), -- -- MCS_GROUP(1, 0, BW_40), -- MCS_GROUP(2, 0, BW_40), -- MCS_GROUP(3, 0, BW_40), -- -- MCS_GROUP(1, 1, BW_40), -- MCS_GROUP(2, 1, BW_40), -- MCS_GROUP(3, 1, BW_40), -- -- CCK_GROUP, -- -- VHT_GROUP(1, 0, BW_20), -- VHT_GROUP(2, 0, BW_20), -- VHT_GROUP(3, 0, BW_20), -- -- VHT_GROUP(1, 1, BW_20), -- VHT_GROUP(2, 1, BW_20), -- VHT_GROUP(3, 1, BW_20), -- -- VHT_GROUP(1, 0, BW_40), -- VHT_GROUP(2, 0, BW_40), -- VHT_GROUP(3, 0, BW_40), -- -- VHT_GROUP(1, 1, BW_40), -- VHT_GROUP(2, 1, BW_40), -- VHT_GROUP(3, 1, BW_40), -- -- VHT_GROUP(1, 0, BW_80), -- VHT_GROUP(2, 0, BW_80), -- VHT_GROUP(3, 0, BW_80), -- -- VHT_GROUP(1, 1, BW_80), -- VHT_GROUP(2, 1, BW_80), -- VHT_GROUP(3, 1, BW_80), -+ MCS_GROUP(1, 0, BW_20, 5), -+ MCS_GROUP(2, 0, BW_20, 4), -+ MCS_GROUP(3, 0, BW_20, 4), -+ -+ MCS_GROUP(1, 1, BW_20, 5), -+ MCS_GROUP(2, 1, BW_20, 4), -+ MCS_GROUP(3, 1, BW_20, 4), -+ -+ MCS_GROUP(1, 0, BW_40, 4), -+ MCS_GROUP(2, 0, BW_40, 4), -+ MCS_GROUP(3, 0, BW_40, 4), -+ -+ MCS_GROUP(1, 1, BW_40, 4), -+ MCS_GROUP(2, 1, BW_40, 4), -+ MCS_GROUP(3, 1, BW_40, 4), -+ -+ CCK_GROUP(8), -+ -+ VHT_GROUP(1, 0, BW_20, 5), -+ VHT_GROUP(2, 0, BW_20, 4), -+ VHT_GROUP(3, 0, BW_20, 4), -+ -+ VHT_GROUP(1, 1, BW_20, 5), -+ VHT_GROUP(2, 1, BW_20, 4), -+ VHT_GROUP(3, 1, BW_20, 4), -+ -+ VHT_GROUP(1, 0, BW_40, 4), -+ VHT_GROUP(2, 0, BW_40, 4), -+ VHT_GROUP(3, 0, BW_40, 4), -+ -+ VHT_GROUP(1, 1, BW_40, 4), -+ VHT_GROUP(2, 1, BW_40, 4), -+ VHT_GROUP(3, 1, BW_40, 4), -+ -+ VHT_GROUP(1, 0, BW_80, 4), -+ VHT_GROUP(2, 0, BW_80, 4), -+ VHT_GROUP(3, 0, BW_80, 4), -+ -+ VHT_GROUP(1, 1, BW_80, 4), -+ VHT_GROUP(2, 1, BW_80, 4), -+ VHT_GROUP(3, 1, BW_80, 4), - }; - - static u8 sample_table[SAMPLE_COLUMNS][MCS_GROUP_RATES] __read_mostly; -@@ -307,7 +310,8 @@ minstrel_ht_get_tp_avg(struct minstrel_h - if (group != MINSTREL_CCK_GROUP) - nsecs = 1000 * mi->overhead / MINSTREL_TRUNC(mi->avg_ampdu_len); - -- nsecs += minstrel_mcs_groups[group].duration[rate]; -+ nsecs += minstrel_mcs_groups[group].duration[rate] << -+ minstrel_mcs_groups[group].shift; - - /* - * For the throughput calculation, limit the probability value to 90% to -@@ -755,12 +759,19 @@ minstrel_ht_tx_status(void *priv, struct - minstrel_ht_update_rates(mp, mi); - } - -+static inline int -+minstrel_get_duration(int index) -+{ -+ const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; -+ unsigned int duration = group->duration[index % MCS_GROUP_RATES]; -+ return duration << group->shift; -+} -+ - static void - minstrel_calc_retransmit(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, - int index) - { - struct minstrel_rate_stats *mrs; -- const struct mcs_group *group; - unsigned int tx_time, tx_time_rtscts, tx_time_data; - unsigned int cw = mp->cw_min; - unsigned int ctime = 0; -@@ -779,8 +790,7 @@ minstrel_calc_retransmit(struct minstrel - mrs->retry_count_rtscts = 2; - mrs->retry_updated = true; - -- group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; -- tx_time_data = group->duration[index % MCS_GROUP_RATES] * ampdu_len / 1000; -+ tx_time_data = minstrel_get_duration(index) * ampdu_len / 1000; - - /* Contention time for first 2 tries */ - ctime = (t_slot * cw) >> 1; -@@ -874,20 +884,24 @@ minstrel_ht_get_max_amsdu_len(struct min - int group = mi->max_prob_rate / MCS_GROUP_RATES; - const struct mcs_group *g = &minstrel_mcs_groups[group]; - int rate = mi->max_prob_rate % MCS_GROUP_RATES; -+ unsigned int duration; - - /* Disable A-MSDU if max_prob_rate is bad */ - if (mi->groups[group].rates[rate].prob_ewma < MINSTREL_FRAC(50, 100)) - return 1; - -+ duration = g->duration[rate]; -+ duration <<= g->shift; -+ - /* If the rate is slower than single-stream MCS1, make A-MSDU limit small */ -- if (g->duration[rate] > MCS_DURATION(1, 0, 52)) -+ if (duration > MCS_DURATION(1, 0, 52)) - return 500; - - /* - * If the rate is slower than single-stream MCS4, limit A-MSDU to usual - * data packet size - */ -- if (g->duration[rate] > MCS_DURATION(1, 0, 104)) -+ if (duration > MCS_DURATION(1, 0, 104)) - return 1600; - - /* -@@ -895,7 +909,7 @@ minstrel_ht_get_max_amsdu_len(struct min - * rate success probability is less than 75%, limit A-MSDU to twice the usual - * data packet size - */ -- if (g->duration[rate] > MCS_DURATION(1, 0, 260) || -+ if (duration > MCS_DURATION(1, 0, 260) || - (minstrel_ht_get_prob_ewma(mi, mi->max_tp_rate[0]) < - MINSTREL_FRAC(75, 100))) - return 3200; -@@ -942,13 +956,6 @@ minstrel_ht_update_rates(struct minstrel - rate_control_set_rates(mp->hw, mi->sta, rates); - } - --static inline int --minstrel_get_duration(int index) --{ -- const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; -- return group->duration[index % MCS_GROUP_RATES]; --} -- - static int - minstrel_get_sample_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) - { ---- a/net/mac80211/rc80211_minstrel_ht.h -+++ b/net/mac80211/rc80211_minstrel_ht.h -@@ -33,9 +33,10 @@ - #define MCS_GROUP_RATES 10 - - struct mcs_group { -- u32 flags; -- unsigned int streams; -- unsigned int duration[MCS_GROUP_RATES]; -+ u16 flags; -+ u8 streams; -+ u8 shift; -+ u16 duration[MCS_GROUP_RATES]; - }; - - extern const struct mcs_group minstrel_mcs_groups[]; ---- a/net/mac80211/rc80211_minstrel_ht_debugfs.c -+++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c -@@ -58,6 +58,7 @@ minstrel_ht_stats_dump(struct minstrel_h - static const int bitrates[4] = { 10, 20, 55, 110 }; - int idx = i * MCS_GROUP_RATES + j; - unsigned int prob_ewmsd; -+ unsigned int duration; - - if (!(mi->supported[i] & BIT(j))) - continue; -@@ -95,7 +96,9 @@ minstrel_ht_stats_dump(struct minstrel_h - p += sprintf(p, " %3u ", idx); - - /* tx_time[rate(i)] in usec */ -- tx_time = DIV_ROUND_CLOSEST(mg->duration[j], 1000); -+ duration = mg->duration[j]; -+ duration <<= mg->shift; -+ tx_time = DIV_ROUND_CLOSEST(duration, 1000); - p += sprintf(p, "%6u ", tx_time); - - tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100)); -@@ -204,6 +207,7 @@ minstrel_ht_stats_csv_dump(struct minstr - static const int bitrates[4] = { 10, 20, 55, 110 }; - int idx = i * MCS_GROUP_RATES + j; - unsigned int prob_ewmsd; -+ unsigned int duration; - - if (!(mi->supported[i] & BIT(j))) - continue; -@@ -238,7 +242,10 @@ minstrel_ht_stats_csv_dump(struct minstr - } - - p += sprintf(p, "%u,", idx); -- tx_time = DIV_ROUND_CLOSEST(mg->duration[j], 1000); -+ -+ duration = mg->duration[j]; -+ duration <<= mg->shift; -+ tx_time = DIV_ROUND_CLOSEST(duration, 1000); - p += sprintf(p, "%u,", tx_time); - - tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100)); diff --git a/package/kernel/mac80211/patches/373-mac80211-minstrel-fix-using-short-preamble-CCK-rates.patch b/package/kernel/mac80211/patches/373-mac80211-minstrel-fix-using-short-preamble-CCK-rates.patch deleted file mode 100644 index 502d8c7768cc1b..00000000000000 --- a/package/kernel/mac80211/patches/373-mac80211-minstrel-fix-using-short-preamble-CCK-rates.patch +++ /dev/null @@ -1,31 +0,0 @@ -From: Felix Fietkau -Date: Sat, 10 Feb 2018 13:43:07 +0100 -Subject: [PATCH] mac80211: minstrel: fix using short preamble CCK rates on - HT clients - -mi->supported[MINSTREL_CCK_GROUP] needs to be updated - -Fixes: 782dda00ab8e ("mac80211: minstrel_ht: move short preamble check out of get_rate") -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -1135,7 +1135,6 @@ minstrel_ht_update_caps(void *priv, stru - struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs; - u16 ht_cap = sta->ht_cap.cap; - struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap; -- struct sta_info *sinfo = container_of(sta, struct sta_info, sta); - int use_vht; - int n_supported = 0; - int ack_dur; -@@ -1267,8 +1266,7 @@ minstrel_ht_update_caps(void *priv, stru - if (!n_supported) - goto use_legacy; - -- if (test_sta_flag(sinfo, WLAN_STA_SHORT_PREAMBLE)) -- mi->cck_supported_short |= mi->cck_supported_short << 4; -+ mi->supported[MINSTREL_CCK_GROUP] |= mi->cck_supported_short << 4; - - /* create an initial rate table with the lowest supported rates */ - minstrel_ht_update_stats(mp, mi); diff --git a/package/kernel/mac80211/patches/374-ath9k-Protect-queue-draining-by-rcu_read_lock.patch b/package/kernel/mac80211/patches/374-ath9k-Protect-queue-draining-by-rcu_read_lock.patch deleted file mode 100644 index 0b599b73ac62a3..00000000000000 --- a/package/kernel/mac80211/patches/374-ath9k-Protect-queue-draining-by-rcu_read_lock.patch +++ /dev/null @@ -1,43 +0,0 @@ -From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= -Date: Fri, 2 Feb 2018 11:36:45 +0100 -Subject: [PATCH] ath9k: Protect queue draining by rcu_read_lock() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When ath9k was switched over to use the mac80211 intermediate queues, -node cleanup now drains the mac80211 queues. However, this call path is -not protected by rcu_read_lock() as it was previously entirely internal -to the driver which uses its own locking. - -This leads to a possible rcu_dereference() without holding -rcu_read_lock(); but only if a station is cleaned up while having -packets queued on the TXQ. Fix this by adding the rcu_read_lock() to the -caller in ath9k. - -Fixes: 50f08edf9809 ("ath9k: Switch to using mac80211 intermediate software queues.") -Cc: stable@vger.kernel.org -Reported-by: Ben Greear -Signed-off-by: Toke Høiland-Jørgensen ---- - ---- a/drivers/net/wireless/ath/ath9k/xmit.c -+++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -2915,6 +2915,8 @@ void ath_tx_node_cleanup(struct ath_soft - struct ath_txq *txq; - int tidno; - -+ rcu_read_lock(); -+ - for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) { - tid = ath_node_to_tid(an, tidno); - txq = tid->txq; -@@ -2932,6 +2934,8 @@ void ath_tx_node_cleanup(struct ath_soft - if (!an->sta) - break; /* just one multicast ath_atx_tid */ - } -+ -+ rcu_read_unlock(); - } - - #ifdef CPTCFG_ATH9K_TX99 diff --git a/package/kernel/mac80211/patches/375-mac80211-minstrel-fix-CCK-rate-group-streams-value.patch b/package/kernel/mac80211/patches/375-mac80211-minstrel-fix-CCK-rate-group-streams-value.patch deleted file mode 100644 index f0ffcd9655a54e..00000000000000 --- a/package/kernel/mac80211/patches/375-mac80211-minstrel-fix-CCK-rate-group-streams-value.patch +++ /dev/null @@ -1,20 +0,0 @@ -From: Felix Fietkau -Date: Thu, 1 Mar 2018 13:27:54 +0100 -Subject: [PATCH] mac80211: minstrel: fix CCK rate group streams value - -Fixes a harmless underflow issue when CCK rates are actively being used - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -131,7 +131,7 @@ - - #define CCK_GROUP(_s) \ - [MINSTREL_CCK_GROUP] = { \ -- .streams = 0, \ -+ .streams = 1, \ - .flags = 0, \ - .shift = _s, \ - .duration = { \ diff --git a/package/kernel/mac80211/patches/376-mac80211-minstrel-fix-sampling-reporting-of-CCK-rate.patch b/package/kernel/mac80211/patches/376-mac80211-minstrel-fix-sampling-reporting-of-CCK-rate.patch deleted file mode 100644 index e0049c36eb6020..00000000000000 --- a/package/kernel/mac80211/patches/376-mac80211-minstrel-fix-sampling-reporting-of-CCK-rate.patch +++ /dev/null @@ -1,58 +0,0 @@ -From: Felix Fietkau -Date: Thu, 1 Mar 2018 13:28:48 +0100 -Subject: [PATCH] mac80211: minstrel: fix sampling/reporting of CCK rates - in HT mode - -Long/short preamble selection cannot be sampled separately, since it -depends on the BSS state. Because of that, sampling attempts to -currently not used preamble modes are not counted in the statistics, -which leads to CCK rates being sampled too often. - -Fix statistics accounting for long/short preamble by increasing the -index where necessary. -Fix excessive CCK rate sampling by dropping unsupported sample attempts. - -This improves throughput on 2.4 GHz channels - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -281,7 +281,8 @@ minstrel_ht_get_stats(struct minstrel_pr - break; - - /* short preamble */ -- if (!(mi->supported[group] & BIT(idx))) -+ if ((mi->supported[group] & BIT(idx + 4)) && -+ (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)) - idx += 4; - } - return &mi->groups[group].rates[idx]; -@@ -1080,18 +1081,23 @@ minstrel_ht_get_rate(void *priv, struct - return; - - sample_group = &minstrel_mcs_groups[sample_idx / MCS_GROUP_RATES]; -+ sample_idx %= MCS_GROUP_RATES; -+ -+ if (sample_group == &minstrel_mcs_groups[MINSTREL_CCK_GROUP] && -+ (sample_idx >= 4) != txrc->short_preamble) -+ return; -+ - info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; - rate->count = 1; - -- if (sample_idx / MCS_GROUP_RATES == MINSTREL_CCK_GROUP) { -+ if (sample_group == &minstrel_mcs_groups[MINSTREL_CCK_GROUP]) { - int idx = sample_idx % ARRAY_SIZE(mp->cck_rates); - rate->idx = mp->cck_rates[idx]; - } else if (sample_group->flags & IEEE80211_TX_RC_VHT_MCS) { - ieee80211_rate_set_vht(rate, sample_idx % MCS_GROUP_RATES, - sample_group->streams); - } else { -- rate->idx = sample_idx % MCS_GROUP_RATES + -- (sample_group->streams - 1) * 8; -+ rate->idx = sample_idx + (sample_group->streams - 1) * 8; - } - - rate->flags = sample_group->flags; diff --git a/package/kernel/mac80211/patches/378-mac80211-fix-memory-accounting-with-A-MSDU-aggregati.patch b/package/kernel/mac80211/patches/378-mac80211-fix-memory-accounting-with-A-MSDU-aggregati.patch deleted file mode 100644 index c64457a17ffef5..00000000000000 --- a/package/kernel/mac80211/patches/378-mac80211-fix-memory-accounting-with-A-MSDU-aggregati.patch +++ /dev/null @@ -1,58 +0,0 @@ -From: Felix Fietkau -Date: Thu, 8 Mar 2018 21:00:56 +0100 -Subject: [PATCH] mac80211: fix memory accounting with A-MSDU aggregation - -fq uses skb->truesize for memory usage tracking. Increments/decrements -are done on enqueue/dequeue. -When A-MSDU aggregation is performed on tx side, the packet is -aggregated with the last packet in the queue belonging to the same flow. -There are multiple bugs here: -- The truesize field of the aggregated packet isn't updated, so memory -usage is underestimated -- fq->memory_usage isn't adjusted. - -Because of the combination of both bugs, this only causes tx issues in -rare cases, mainly when the A-MSDU head needs to be reallocated. - -Fix this by adjusting both truesize of the A-MSDU head and adding the -truesize delta to fq->memory_usage. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -3171,6 +3171,7 @@ static bool ieee80211_amsdu_aggregate(st - u8 max_subframes = sta->sta.max_amsdu_subframes; - int max_frags = local->hw.max_tx_fragments; - int max_amsdu_len = sta->sta.max_amsdu_len; -+ int orig_truesize; - __be16 len; - void *data; - bool ret = false; -@@ -3201,12 +3202,13 @@ static bool ieee80211_amsdu_aggregate(st - flow = fq_flow_classify(fq, tin, skb, fq_flow_get_default_func); - head = skb_peek_tail(&flow->queue); - if (!head) -- goto out; -+ goto unlock; - -+ orig_truesize = head->truesize; - orig_len = head->len; - - if (skb->len + head->len > max_amsdu_len) -- goto out; -+ goto unlock; - - if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head)) - goto out; -@@ -3249,6 +3251,9 @@ static bool ieee80211_amsdu_aggregate(st - fq_recalc_backlog(fq, tin, flow); - - out: -+ fq->memory_usage += head->truesize - orig_truesize; -+ -+unlock: - spin_unlock_bh(&fq->lock); - - return ret; diff --git a/package/kernel/mac80211/patches/379-cfg80211-initialize-sinfo-in-cfg80211_get_station.patch b/package/kernel/mac80211/patches/379-cfg80211-initialize-sinfo-in-cfg80211_get_station.patch deleted file mode 100644 index 37323c1f7defee..00000000000000 --- a/package/kernel/mac80211/patches/379-cfg80211-initialize-sinfo-in-cfg80211_get_station.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 4f717a2589be649afddbbd3ac58b67ebfa7426f7 Mon Sep 17 00:00:00 2001 -From: Sven Eckelmann -Date: Wed, 6 Jun 2018 10:18:31 +0200 -Subject: [PATCH v2] cfg80211: initialize sinfo in cfg80211_get_station - -Most of the implementations behind cfg80211_get_station will not initialize -sinfo to zero before manipulating it. For example, the member "filled", -which indicates the filled in parts of this struct, is often only modified -by enabling certain bits in the bitfield while keeping the remaining bits -in their original state. A caller without a preinitialized sinfo.filled can -then no longer decide which parts of sinfo were filled in by -cfg80211_get_station (or actually the underlying implementations). - -cfg80211_get_station must therefore take care that sinfo is initialized to -zero. Otherwise, the caller may tries to read information which was not -filled in and which must therefore also be considered uninitialized. In -batadv_v_elp_get_throughput's case, an invalid "random" expected throughput -may be stored for this neighbor and thus the B.A.T.M.A.N V algorithm may -switch to non-optimal neighbors for certain destinations. - -Fixes: 7406353d43c8 ("cfg80211: implement cfg80211_get_station cfg80211 API") -Reported-by: Thomas Lauer -Reported-by: Marcel Schmidt -Cc: b.a.t.m.a.n@lists.open-mesh.org -Signed-off-by: Sven Eckelmann - -Forwarded: https://patchwork.kernel.org/patch/10449857/ ---- - net/wireless/util.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/net/wireless/util.c -+++ b/net/wireless/util.c -@@ -1749,6 +1749,8 @@ int cfg80211_get_station(struct net_devi - if (!rdev->ops->get_station) - return -EOPNOTSUPP; - -+ memset(sinfo, 0, sizeof(*sinfo)); -+ - return rdev_get_station(rdev, dev, mac_addr, sinfo); - } - EXPORT_SYMBOL(cfg80211_get_station); diff --git a/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch b/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch deleted file mode 100644 index 00be2ef98dd96c..00000000000000 --- a/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/net/wireless/reg.c -+++ b/net/wireless/reg.c -@@ -2860,6 +2860,8 @@ void regulatory_hint_country_ie(struct w - enum environment_cap env = ENVIRON_ANY; - struct regulatory_request *request = NULL, *lr; - -+ return; -+ - /* IE len must be evenly divisible by 2 */ - if (country_ie_len & 0x01) - return; -@@ -3066,6 +3068,7 @@ static void restore_regulatory_settings( - - void regulatory_hint_disconnect(void) - { -+ return; - pr_debug("All devices are disconnected, going to restore regulatory settings\n"); - restore_regulatory_settings(false); - } diff --git a/package/kernel/mac80211/patches/600-02-rt2x00-rt2800lib-enable-support-for-RT3883.patch b/package/kernel/mac80211/patches/600-02-rt2x00-rt2800lib-enable-support-for-RT3883.patch deleted file mode 100644 index 5127c5cfe47b7e..00000000000000 --- a/package/kernel/mac80211/patches/600-02-rt2x00-rt2800lib-enable-support-for-RT3883.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 4f16582c93a71eba9d389e0f0a8aa9099a9587cd Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Sun, 24 Mar 2013 19:26:26 +0100 -Subject: [PATCH] rt2x00: rt2800lib: enable support for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -9403,6 +9403,7 @@ static int rt2800_probe_rt(struct rt2x00 - case RT3390: - case RT3572: - case RT3593: -+ case RT3883: - case RT5350: - case RT5390: - case RT5392: diff --git a/package/kernel/mac80211/patches/600-03-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch b/package/kernel/mac80211/patches/600-03-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch deleted file mode 100644 index 60e57c1baef4a5..00000000000000 --- a/package/kernel/mac80211/patches/600-03-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch +++ /dev/null @@ -1,112 +0,0 @@ -From ecb394ccf248d8652c463133c4f404458a57a9c1 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Sun, 24 Mar 2013 19:26:26 +0100 -Subject: [PATCH] rt2x00: rt2800lib: add rf_vals for RF3853 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800.h | 4 +- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 65 +++++++++++++++++++++++++++++++ - 2 files changed, 68 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h -@@ -48,7 +48,8 @@ - * RF2853 2.4G/5G 3T3R - * RF3320 2.4G 1T1R(RT3350/RT3370/RT3390) - * RF3322 2.4G 2T2R(RT3352/RT3371/RT3372/RT3391/RT3392) -- * RF3053 2.4G/5G 3T3R(RT3883/RT3563/RT3573/RT3593/RT3662) -+ * RF3053 2.4G/5G 3T3R(RT3563/RT3573/RT3593) -+ * RF3853 2.4G/5G 3T3R(RT3883/RT3662) - * RF5592 2.4G/5G 2T2R - * RF3070 2.4G 1T1R - * RF5360 2.4G 1T1R -@@ -72,6 +73,7 @@ - #define RF5592 0x000f - #define RF3070 0x3070 - #define RF3290 0x3290 -+#define RF3853 0x3853 - #define RF5350 0x5350 - #define RF5360 0x5360 - #define RF5362 0x5362 ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8981,6 +8981,66 @@ static const struct rf_channel rf_vals_3 - {14, 0xF0, 2, 0x18}, - }; - -+static const struct rf_channel rf_vals_3853[] = { -+ {1, 241, 6, 2}, -+ {2, 241, 6, 7}, -+ {3, 242, 6, 2}, -+ {4, 242, 6, 7}, -+ {5, 243, 6, 2}, -+ {6, 243, 6, 7}, -+ {7, 244, 6, 2}, -+ {8, 244, 6, 7}, -+ {9, 245, 6, 2}, -+ {10, 245, 6, 7}, -+ {11, 246, 6, 2}, -+ {12, 246, 6, 7}, -+ {13, 247, 6, 2}, -+ {14, 248, 6, 4}, -+ -+ {36, 0x56, 8, 4}, -+ {38, 0x56, 8, 6}, -+ {40, 0x56, 8, 8}, -+ {44, 0x57, 8, 0}, -+ {46, 0x57, 8, 2}, -+ {48, 0x57, 8, 4}, -+ {52, 0x57, 8, 8}, -+ {54, 0x57, 8, 10}, -+ {56, 0x58, 8, 0}, -+ {60, 0x58, 8, 4}, -+ {62, 0x58, 8, 6}, -+ {64, 0x58, 8, 8}, -+ -+ {100, 0x5b, 8, 8}, -+ {102, 0x5b, 8, 10}, -+ {104, 0x5c, 8, 0}, -+ {108, 0x5c, 8, 4}, -+ {110, 0x5c, 8, 6}, -+ {112, 0x5c, 8, 8}, -+ {114, 0x5c, 8, 10}, -+ {116, 0x5d, 8, 0}, -+ {118, 0x5d, 8, 2}, -+ {120, 0x5d, 8, 4}, -+ {124, 0x5d, 8, 8}, -+ {126, 0x5d, 8, 10}, -+ {128, 0x5e, 8, 0}, -+ {132, 0x5e, 8, 4}, -+ {134, 0x5e, 8, 6}, -+ {136, 0x5e, 8, 8}, -+ {140, 0x5f, 8, 0}, -+ -+ {149, 0x5f, 8, 9}, -+ {151, 0x5f, 8, 11}, -+ {153, 0x60, 8, 1}, -+ {157, 0x60, 8, 5}, -+ {159, 0x60, 8, 7}, -+ {161, 0x60, 8, 9}, -+ {165, 0x61, 8, 1}, -+ {167, 0x61, 8, 3}, -+ {169, 0x61, 8, 5}, -+ {171, 0x61, 8, 7}, -+ {173, 0x61, 8, 9}, -+}; -+ - static const struct rf_channel rf_vals_5592_xtal20[] = { - /* Channel, N, K, mod, R */ - {1, 482, 4, 10, 3}, -@@ -9244,6 +9304,11 @@ static int rt2800_probe_hw_mode(struct r - spec->channels = rf_vals_3x; - break; - -+ case RF3853: -+ spec->num_channels = ARRAY_SIZE(rf_vals_3853); -+ spec->channels = rf_vals_3853; -+ break; -+ - case RF5592: - reg = rt2800_register_read(rt2x00dev, MAC_DEBUG_INDEX); - if (rt2x00_get_field32(reg, MAC_DEBUG_INDEX_XTAL)) { diff --git a/package/kernel/mac80211/patches/600-04-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch b/package/kernel/mac80211/patches/600-04-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch deleted file mode 100644 index def2c397fd1d28..00000000000000 --- a/package/kernel/mac80211/patches/600-04-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch +++ /dev/null @@ -1,28 +0,0 @@ -From f8e3fcf18e1f2d7f9e6a9680c5452da090f33d88 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Thu, 1 Aug 2013 14:40:44 +0200 -Subject: [PATCH] rt2x00: rt2800lib: enable VCO calibration for RF3853 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -4881,6 +4881,7 @@ void rt2800_vco_calibration(struct rt2x0 - case RF3053: - case RF3070: - case RF3290: -+ case RF3853: - case RF5350: - case RF5360: - case RF5362: -@@ -9426,6 +9427,7 @@ static int rt2800_probe_hw_mode(struct r - case RF3053: - case RF3070: - case RF3290: -+ case RF3853: - case RF5350: - case RF5360: - case RF5362: diff --git a/package/kernel/mac80211/patches/600-05-rt2x00-rt2800lib-add-channel-configuration-function-.patch b/package/kernel/mac80211/patches/600-05-rt2x00-rt2800lib-add-channel-configuration-function-.patch deleted file mode 100644 index 1d6e312037344e..00000000000000 --- a/package/kernel/mac80211/patches/600-05-rt2x00-rt2800lib-add-channel-configuration-function-.patch +++ /dev/null @@ -1,235 +0,0 @@ -From 6e3a17190815c6aa4dc53c2cfe9125fb1154f187 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Sun, 24 Mar 2013 19:26:27 +0100 -Subject: [PATCH] rt2x00: rt2800lib: add channel configuration function for - RF3853 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 208 +++++++++++++++++++++++++++++++ - 1 file changed, 208 insertions(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -2713,6 +2713,211 @@ static void rt2800_config_channel_rf3053 - } - } - -+static void rt2800_config_channel_rf3853(struct rt2x00_dev *rt2x00dev, -+ struct ieee80211_conf *conf, -+ struct rf_channel *rf, -+ struct channel_info *info) -+{ -+ u8 rfcsr; -+ u8 bbp; -+ u8 pwr1, pwr2, pwr3; -+ -+ const bool txbf_enabled = false; /* TODO */ -+ -+ /* TODO: add band selection */ -+ -+ if (rf->channel <= 14) -+ rt2800_rfcsr_write(rt2x00dev, 6, 0x40); -+ else if (rf->channel < 132) -+ rt2800_rfcsr_write(rt2x00dev, 6, 0x80); -+ else -+ rt2800_rfcsr_write(rt2x00dev, 6, 0x40); -+ -+ rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1); -+ rt2800_rfcsr_write(rt2x00dev, 9, rf->rf3); -+ -+ if (rf->channel <= 14) -+ rt2800_rfcsr_write(rt2x00dev, 11, 0x46); -+ else -+ rt2800_rfcsr_write(rt2x00dev, 11, 0x48); -+ -+ if (rf->channel <= 14) -+ rt2800_rfcsr_write(rt2x00dev, 12, 0x1a); -+ else -+ rt2800_rfcsr_write(rt2x00dev, 12, 0x52); -+ -+ rt2800_rfcsr_write(rt2x00dev, 13, 0x12); -+ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); -+ rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 0); -+ rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 0); -+ rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 0); -+ rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 0); -+ rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 0); -+ rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 0); -+ rt2x00_set_field8(&rfcsr, RFCSR1_RF_BLOCK_EN, 1); -+ rt2x00_set_field8(&rfcsr, RFCSR1_PLL_PD, 1); -+ -+ switch (rt2x00dev->default_ant.tx_chain_num) { -+ case 3: -+ rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 1); -+ /* fallthrough */ -+ case 2: -+ rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 1); -+ /* fallthrough */ -+ case 1: -+ rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 1); -+ break; -+ } -+ -+ switch (rt2x00dev->default_ant.rx_chain_num) { -+ case 3: -+ rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 1); -+ /* fallthrough */ -+ case 2: -+ rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 1); -+ /* fallthrough */ -+ case 1: -+ rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 1); -+ break; -+ } -+ rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); -+ -+ rt2800_freq_cal_mode1(rt2x00dev); -+ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 30); -+ if (!conf_is_ht40(conf)) -+ rfcsr &= ~(0x06); -+ else -+ rfcsr |= 0x06; -+ rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); -+ -+ if (rf->channel <= 14) -+ rt2800_rfcsr_write(rt2x00dev, 31, 0xa0); -+ else -+ rt2800_rfcsr_write(rt2x00dev, 31, 0x80); -+ -+ if (conf_is_ht40(conf)) -+ rt2800_rfcsr_write(rt2x00dev, 32, 0x80); -+ else -+ rt2800_rfcsr_write(rt2x00dev, 32, 0xd8); -+ -+ if (rf->channel <= 14) -+ rt2800_rfcsr_write(rt2x00dev, 34, 0x3c); -+ else -+ rt2800_rfcsr_write(rt2x00dev, 34, 0x20); -+ -+ /* loopback RF_BS */ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 36); -+ if (rf->channel <= 14) -+ rt2x00_set_field8(&rfcsr, RFCSR36_RF_BS, 1); -+ else -+ rt2x00_set_field8(&rfcsr, RFCSR36_RF_BS, 0); -+ rt2800_rfcsr_write(rt2x00dev, 36, rfcsr); -+ -+ if (rf->channel <= 14) -+ rfcsr = 0x23; -+ else if (rf->channel < 100) -+ rfcsr = 0x36; -+ else if (rf->channel < 132) -+ rfcsr = 0x32; -+ else -+ rfcsr = 0x30; -+ -+ if (txbf_enabled) -+ rfcsr |= 0x40; -+ -+ rt2800_rfcsr_write(rt2x00dev, 39, rfcsr); -+ -+ if (rf->channel <= 14) -+ rt2800_rfcsr_write(rt2x00dev, 44, 0x93); -+ else -+ rt2800_rfcsr_write(rt2x00dev, 44, 0x9b); -+ -+ if (rf->channel <= 14) -+ rfcsr = 0xbb; -+ else if (rf->channel < 100) -+ rfcsr = 0xeb; -+ else if (rf->channel < 132) -+ rfcsr = 0xb3; -+ else -+ rfcsr = 0x9b; -+ rt2800_rfcsr_write(rt2x00dev, 45, rfcsr); -+ -+ if (rf->channel <= 14) -+ rfcsr = 0x8e; -+ else -+ rfcsr = 0x8a; -+ -+ if (txbf_enabled) -+ rfcsr |= 0x20; -+ -+ rt2800_rfcsr_write(rt2x00dev, 49, rfcsr); -+ -+ rt2800_rfcsr_write(rt2x00dev, 50, 0x86); -+ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 51); -+ if (rf->channel <= 14) -+ rt2800_rfcsr_write(rt2x00dev, 51, 0x75); -+ else -+ rt2800_rfcsr_write(rt2x00dev, 51, 0x51); -+ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 52); -+ if (rf->channel <= 14) -+ rt2800_rfcsr_write(rt2x00dev, 52, 0x45); -+ else -+ rt2800_rfcsr_write(rt2x00dev, 52, 0x05); -+ -+ if (rf->channel <= 14) { -+ pwr1 = info->default_power1 & 0x1f; -+ pwr2 = info->default_power2 & 0x1f; -+ pwr3 = info->default_power3 & 0x1f; -+ } else { -+ pwr1 = 0x48 | ((info->default_power1 & 0x18) << 1) | -+ (info->default_power1 & 0x7); -+ pwr2 = 0x48 | ((info->default_power2 & 0x18) << 1) | -+ (info->default_power2 & 0x7); -+ pwr3 = 0x48 | ((info->default_power3 & 0x18) << 1) | -+ (info->default_power3 & 0x7); -+ } -+ -+ rt2800_rfcsr_write(rt2x00dev, 53, pwr1); -+ rt2800_rfcsr_write(rt2x00dev, 54, pwr2); -+ rt2800_rfcsr_write(rt2x00dev, 55, pwr3); -+ -+ rt2x00_dbg(rt2x00dev, "Channel:%d, pwr1:%02x, pwr2:%02x, pwr3:%02x\n", -+ rf->channel, pwr1, pwr2, pwr3); -+ -+ bbp = (info->default_power1 >> 5) | -+ ((info->default_power2 & 0xe0) >> 1); -+ rt2800_bbp_write(rt2x00dev, 109, bbp); -+ -+ bbp = rt2800_bbp_read(rt2x00dev, 110); -+ bbp &= 0x0f; -+ bbp |= (info->default_power3 & 0xe0) >> 1; -+ rt2800_bbp_write(rt2x00dev, 110, bbp); -+ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 57); -+ if (rf->channel <= 14) -+ rt2800_rfcsr_write(rt2x00dev, 57, 0x6e); -+ else -+ rt2800_rfcsr_write(rt2x00dev, 57, 0x3e); -+ -+ /* Enable RF tuning */ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 3); -+ rt2x00_set_field8(&rfcsr, RFCSR3_VCOCAL_EN, 1); -+ rt2800_rfcsr_write(rt2x00dev, 3, rfcsr); -+ -+ udelay(2000); -+ -+ bbp = rt2800_bbp_read(rt2x00dev, 49); -+ /* clear update flag */ -+ rt2800_bbp_write(rt2x00dev, 49, bbp & 0xfe); -+ rt2800_bbp_write(rt2x00dev, 49, bbp); -+ -+ /* TODO: add calibration for TxBF */ -+} -+ - #define POWER_BOUND 0x27 - #define POWER_BOUND_5G 0x2b - -@@ -3570,6 +3775,9 @@ static void rt2800_config_channel(struct - case RF3322: - rt2800_config_channel_rf3322(rt2x00dev, conf, rf, info); - break; -+ case RF3853: -+ rt2800_config_channel_rf3853(rt2x00dev, conf, rf, info); -+ break; - case RF3070: - case RF5350: - case RF5360: diff --git a/package/kernel/mac80211/patches/600-06-rt2x00-rt2800lib-enable-RF3853-support.patch b/package/kernel/mac80211/patches/600-06-rt2x00-rt2800lib-enable-RF3853-support.patch deleted file mode 100644 index 6476dc107bee3e..00000000000000 --- a/package/kernel/mac80211/patches/600-06-rt2x00-rt2800lib-enable-RF3853-support.patch +++ /dev/null @@ -1,20 +0,0 @@ -From afd38ae82226551bf879b6c7c4b620c271fee9d2 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Thu, 1 Aug 2013 14:42:05 +0200 -Subject: [PATCH] rt2x00: rt2800lib: enable RF3853 support - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8906,6 +8906,7 @@ static int rt2800_init_eeprom(struct rt2 - case RF3290: - case RF3320: - case RF3322: -+ case RF3853: - case RF5350: - case RF5360: - case RF5362: diff --git a/package/kernel/mac80211/patches/600-07-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch b/package/kernel/mac80211/patches/600-07-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch deleted file mode 100644 index 0a931e2026f22a..00000000000000 --- a/package/kernel/mac80211/patches/600-07-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 0094872a5e8e4664c6ea1b2dfa487063d39ae363 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Sun, 24 Mar 2013 19:26:26 +0100 -Subject: [PATCH] rt2x00: rt2800lib: add MAC register initialization for - RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800.h | 14 ++++++++++++++ - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 19 ++++++++++++++++--- - 2 files changed, 30 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h -@@ -1727,6 +1727,20 @@ - #define TX_PWR_CFG_9B_STBC_MCS7 FIELD32(0x000000ff) - - /* -+ * TX_TXBF_CFG: -+ */ -+#define TX_TXBF_CFG_0 0x138c -+#define TX_TXBF_CFG_1 0x13a4 -+#define TX_TXBF_CFG_2 0x13a8 -+#define TX_TXBF_CFG_3 0x13ac -+ -+/* -+ * TX_FBK_CFG_3S: -+ */ -+#define TX_FBK_CFG_3S_0 0x13c4 -+#define TX_FBK_CFG_3S_1 0x13c8 -+ -+/* - * RX_FILTER_CFG: RX configuration register. - */ - #define RX_FILTER_CFG 0x1400 ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -5509,6 +5509,12 @@ static int rt2800_init_registers(struct - rt2800_register_write(rt2x00dev, TX_SW_CFG2, - 0x00000000); - } -+ } else if (rt2x00_rt(rt2x00dev, RT3883)) { -+ rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000402); -+ rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000); -+ rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00040000); -+ rt2800_register_write(rt2x00dev, TX_TXBF_CFG_0, 0x8000fc21); -+ rt2800_register_write(rt2x00dev, TX_TXBF_CFG_3, 0x00009c40); - } else if (rt2x00_rt(rt2x00dev, RT5390) || - rt2x00_rt(rt2x00dev, RT5392) || - rt2x00_rt(rt2x00dev, RT6352)) { -@@ -5722,6 +5728,11 @@ static int rt2800_init_registers(struct - reg = rt2x00_rt(rt2x00dev, RT5592) ? 0x00000082 : 0x00000002; - rt2800_register_write(rt2x00dev, TXOP_HLDR_ET, reg); - -+ if (rt2x00_rt(rt2x00dev, RT3883)) { -+ rt2800_register_write(rt2x00dev, TX_FBK_CFG_3S_0, 0x12111008); -+ rt2800_register_write(rt2x00dev, TX_FBK_CFG_3S_1, 0x16151413); -+ } -+ - reg = rt2800_register_read(rt2x00dev, TX_RTS_CFG); - rt2x00_set_field32(®, TX_RTS_CFG_AUTO_RTS_RETRY_LIMIT, 7); - rt2x00_set_field32(®, TX_RTS_CFG_RTS_THRES, diff --git a/package/kernel/mac80211/patches/600-08-rt2x00-rt2800soc-fix-rt2800soc_disable_radio-for-RT3.patch b/package/kernel/mac80211/patches/600-08-rt2x00-rt2800soc-fix-rt2800soc_disable_radio-for-RT3.patch deleted file mode 100644 index d68ad504476adf..00000000000000 --- a/package/kernel/mac80211/patches/600-08-rt2x00-rt2800soc-fix-rt2800soc_disable_radio-for-RT3.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 6c2d32478159fffff0b85abb6817a21bb2338231 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Sun, 24 Mar 2013 19:26:27 +0100 -Subject: [PATCH] rt2x00: rt2800soc: fix rt2800soc_disable_radio for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800soc.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c -@@ -51,9 +51,16 @@ static bool rt2800soc_hwcrypt_disabled(s - - static void rt2800soc_disable_radio(struct rt2x00_dev *rt2x00dev) - { -+ u32 reg; -+ - rt2800_disable_radio(rt2x00dev); - rt2x00mmio_register_write(rt2x00dev, PWR_PIN_CFG, 0); -- rt2x00mmio_register_write(rt2x00dev, TX_PIN_CFG, 0); -+ -+ reg = 0; -+ if (rt2x00_rt(rt2x00dev, RT3883)) -+ rt2x00_set_field32(®, TX_PIN_CFG_RFTR_EN, 1); -+ -+ rt2x00mmio_register_write(rt2x00dev, TX_PIN_CFG, reg); - } - - static int rt2800soc_set_device_state(struct rt2x00_dev *rt2x00dev, diff --git a/package/kernel/mac80211/patches/600-09-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch b/package/kernel/mac80211/patches/600-09-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch deleted file mode 100644 index 99f57bcd336a61..00000000000000 --- a/package/kernel/mac80211/patches/600-09-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 84833056aa7dd25f5b097e31c78f2a0914c5160c Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Sun, 24 Mar 2013 19:26:26 +0100 -Subject: [PATCH] rt2x00: rt2800lib: add BBP register initialization for - RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 44 +++++++++++++++++++++++++++++++ - 1 file changed, 44 insertions(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -6349,6 +6349,47 @@ static void rt2800_init_bbp_3593(struct - rt2800_bbp_write(rt2x00dev, 103, 0xc0); - } - -+static void rt2800_init_bbp_3883(struct rt2x00_dev *rt2x00dev) -+{ -+ rt2800_init_bbp_early(rt2x00dev); -+ -+ rt2800_bbp_write(rt2x00dev, 4, 0x50); -+ rt2800_bbp_write(rt2x00dev, 47, 0x48); -+ -+ rt2800_bbp_write(rt2x00dev, 86, 0x46); -+ rt2800_bbp_write(rt2x00dev, 88, 0x90); -+ -+ rt2800_bbp_write(rt2x00dev, 92, 0x02); -+ -+ rt2800_bbp_write(rt2x00dev, 103, 0xc0); -+ rt2800_bbp_write(rt2x00dev, 104, 0x92); -+ rt2800_bbp_write(rt2x00dev, 105, 0x34); -+ rt2800_bbp_write(rt2x00dev, 106, 0x12); -+ rt2800_bbp_write(rt2x00dev, 120, 0x50); -+ rt2800_bbp_write(rt2x00dev, 137, 0x0f); -+ rt2800_bbp_write(rt2x00dev, 163, 0x9d); -+ -+ /* Set ITxBF timeout to 0x9C40=1000msec */ -+ rt2800_bbp_write(rt2x00dev, 179, 0x02); -+ rt2800_bbp_write(rt2x00dev, 180, 0x00); -+ rt2800_bbp_write(rt2x00dev, 182, 0x40); -+ rt2800_bbp_write(rt2x00dev, 180, 0x01); -+ rt2800_bbp_write(rt2x00dev, 182, 0x9c); -+ -+ rt2800_bbp_write(rt2x00dev, 179, 0x00); -+ -+ /* Reprogram the inband interface to put right values in RXWI */ -+ rt2800_bbp_write(rt2x00dev, 142, 0x04); -+ rt2800_bbp_write(rt2x00dev, 143, 0x3b); -+ rt2800_bbp_write(rt2x00dev, 142, 0x06); -+ rt2800_bbp_write(rt2x00dev, 143, 0xa0); -+ rt2800_bbp_write(rt2x00dev, 142, 0x07); -+ rt2800_bbp_write(rt2x00dev, 143, 0xa1); -+ rt2800_bbp_write(rt2x00dev, 142, 0x08); -+ rt2800_bbp_write(rt2x00dev, 143, 0xa2); -+ rt2800_bbp_write(rt2x00dev, 148, 0xc8); -+} -+ - static void rt2800_init_bbp_53xx(struct rt2x00_dev *rt2x00dev) - { - int ant, div_mode; -@@ -6792,6 +6833,9 @@ static void rt2800_init_bbp(struct rt2x0 - case RT3593: - rt2800_init_bbp_3593(rt2x00dev); - return; -+ case RT3883: -+ rt2800_init_bbp_3883(rt2x00dev); -+ return; - case RT5390: - case RT5392: - rt2800_init_bbp_53xx(rt2x00dev); diff --git a/package/kernel/mac80211/patches/600-10-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch b/package/kernel/mac80211/patches/600-10-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch deleted file mode 100644 index c0f1f5863b4f31..00000000000000 --- a/package/kernel/mac80211/patches/600-10-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch +++ /dev/null @@ -1,178 +0,0 @@ -From 99c659cf345640fd0f733cbcaf4583cc2c868ec0 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Mon, 29 Apr 2013 13:21:48 +0200 -Subject: [PATCH] rt2x00: rt2800lib: add RFCSR initialization for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800.h | 1 + - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 141 +++++++++++++++++++++++++++++++ - 2 files changed, 142 insertions(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h -@@ -2311,6 +2311,7 @@ struct mac_iveiv_entry { - /* - * RFCSR 2: - */ -+#define RFCSR2_RESCAL_BP FIELD8(0x40) - #define RFCSR2_RESCAL_EN FIELD8(0x80) - #define RFCSR2_RX2_EN_MT7620 FIELD8(0x02) - #define RFCSR2_TX2_EN_MT7620 FIELD8(0x20) ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -7707,6 +7707,144 @@ static void rt2800_init_rfcsr_5350(struc - rt2800_rfcsr_write(rt2x00dev, 63, 0x00); - } - -+static void rt2800_init_rfcsr_3883(struct rt2x00_dev *rt2x00dev) -+{ -+ u8 rfcsr; -+ -+ /* TODO: get the actual ECO value from the SoC */ -+ const unsigned int eco = 5; -+ -+ rt2800_rf_init_calibration(rt2x00dev, 2); -+ -+ rt2800_rfcsr_write(rt2x00dev, 0, 0xe0); -+ rt2800_rfcsr_write(rt2x00dev, 1, 0x03); -+ rt2800_rfcsr_write(rt2x00dev, 2, 0x50); -+ rt2800_rfcsr_write(rt2x00dev, 3, 0x20); -+ rt2800_rfcsr_write(rt2x00dev, 4, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 5, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 6, 0x40); -+ rt2800_rfcsr_write(rt2x00dev, 7, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 8, 0x5b); -+ rt2800_rfcsr_write(rt2x00dev, 9, 0x08); -+ rt2800_rfcsr_write(rt2x00dev, 10, 0xd3); -+ rt2800_rfcsr_write(rt2x00dev, 11, 0x48); -+ rt2800_rfcsr_write(rt2x00dev, 12, 0x1a); -+ rt2800_rfcsr_write(rt2x00dev, 13, 0x12); -+ rt2800_rfcsr_write(rt2x00dev, 14, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 15, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 16, 0x00); -+ -+ /* RFCSR 17 will be initialized later based on the -+ * frequency offset stored in the EEPROM -+ */ -+ -+ rt2800_rfcsr_write(rt2x00dev, 18, 0x40); -+ rt2800_rfcsr_write(rt2x00dev, 19, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 20, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 21, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 22, 0x20); -+ rt2800_rfcsr_write(rt2x00dev, 23, 0xc0); -+ rt2800_rfcsr_write(rt2x00dev, 24, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 25, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 26, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 27, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 28, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 29, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 30, 0x10); -+ rt2800_rfcsr_write(rt2x00dev, 31, 0x80); -+ rt2800_rfcsr_write(rt2x00dev, 32, 0x80); -+ rt2800_rfcsr_write(rt2x00dev, 33, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 34, 0x20); -+ rt2800_rfcsr_write(rt2x00dev, 35, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 36, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 37, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 38, 0x86); -+ rt2800_rfcsr_write(rt2x00dev, 39, 0x23); -+ rt2800_rfcsr_write(rt2x00dev, 40, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 41, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 42, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 43, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 44, 0x93); -+ rt2800_rfcsr_write(rt2x00dev, 45, 0xbb); -+ rt2800_rfcsr_write(rt2x00dev, 46, 0x60); -+ rt2800_rfcsr_write(rt2x00dev, 47, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 48, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 49, 0x8e); -+ rt2800_rfcsr_write(rt2x00dev, 50, 0x86); -+ rt2800_rfcsr_write(rt2x00dev, 51, 0x51); -+ rt2800_rfcsr_write(rt2x00dev, 52, 0x05); -+ rt2800_rfcsr_write(rt2x00dev, 53, 0x76); -+ rt2800_rfcsr_write(rt2x00dev, 54, 0x76); -+ rt2800_rfcsr_write(rt2x00dev, 55, 0x76); -+ rt2800_rfcsr_write(rt2x00dev, 56, 0xdb); -+ rt2800_rfcsr_write(rt2x00dev, 57, 0x3e); -+ rt2800_rfcsr_write(rt2x00dev, 58, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 59, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 60, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 61, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 62, 0x00); -+ rt2800_rfcsr_write(rt2x00dev, 63, 0x00); -+ -+ /* TODO: rx filter calibration? */ -+ -+ rt2800_bbp_write(rt2x00dev, 137, 0x0f); -+ -+ rt2800_bbp_write(rt2x00dev, 163, 0x9d); -+ -+ rt2800_bbp_write(rt2x00dev, 105, 0x05); -+ -+ rt2800_bbp_write(rt2x00dev, 179, 0x02); -+ rt2800_bbp_write(rt2x00dev, 180, 0x00); -+ rt2800_bbp_write(rt2x00dev, 182, 0x40); -+ rt2800_bbp_write(rt2x00dev, 180, 0x01); -+ rt2800_bbp_write(rt2x00dev, 182, 0x9c); -+ -+ rt2800_bbp_write(rt2x00dev, 179, 0x00); -+ -+ rt2800_bbp_write(rt2x00dev, 142, 0x04); -+ rt2800_bbp_write(rt2x00dev, 143, 0x3b); -+ rt2800_bbp_write(rt2x00dev, 142, 0x06); -+ rt2800_bbp_write(rt2x00dev, 143, 0xa0); -+ rt2800_bbp_write(rt2x00dev, 142, 0x07); -+ rt2800_bbp_write(rt2x00dev, 143, 0xa1); -+ rt2800_bbp_write(rt2x00dev, 142, 0x08); -+ rt2800_bbp_write(rt2x00dev, 143, 0xa2); -+ rt2800_bbp_write(rt2x00dev, 148, 0xc8); -+ -+ if (eco == 5) { -+ rt2800_rfcsr_write(rt2x00dev, 32, 0xd8); -+ rt2800_rfcsr_write(rt2x00dev, 33, 0x32); -+ } -+ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 2); -+ rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_BP, 0); -+ rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_EN, 1); -+ rt2800_rfcsr_write(rt2x00dev, 2, rfcsr); -+ msleep(1); -+ rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_EN, 0); -+ rt2800_rfcsr_write(rt2x00dev, 2, rfcsr); -+ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); -+ rt2x00_set_field8(&rfcsr, RFCSR1_RF_BLOCK_EN, 1); -+ rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); -+ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 6); -+ rfcsr |= 0xc0; -+ rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); -+ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 22); -+ rfcsr |= 0x20; -+ rt2800_rfcsr_write(rt2x00dev, 22, rfcsr); -+ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 46); -+ rfcsr |= 0x20; -+ rt2800_rfcsr_write(rt2x00dev, 46, rfcsr); -+ -+ rfcsr = rt2800_rfcsr_read(rt2x00dev, 20); -+ rfcsr &= ~0xee; -+ rt2800_rfcsr_write(rt2x00dev, 20, rfcsr); -+} -+ - static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev) - { - rt2800_rf_init_calibration(rt2x00dev, 2); -@@ -8549,6 +8687,9 @@ static void rt2800_init_rfcsr(struct rt2 - case RT3390: - rt2800_init_rfcsr_3390(rt2x00dev); - break; -+ case RT3883: -+ rt2800_init_rfcsr_3883(rt2x00dev); -+ break; - case RT3572: - rt2800_init_rfcsr_3572(rt2x00dev); - break; diff --git a/package/kernel/mac80211/patches/600-11-rt2x00-rt2800lib-use-the-extended-EEPROM-map-for-RT3.patch b/package/kernel/mac80211/patches/600-11-rt2x00-rt2800lib-use-the-extended-EEPROM-map-for-RT3.patch deleted file mode 100644 index e74f399e65169f..00000000000000 --- a/package/kernel/mac80211/patches/600-11-rt2x00-rt2800lib-use-the-extended-EEPROM-map-for-RT3.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 86022438ffeb1b87dfcd018bf477fdbb43076691 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Wed, 8 May 2013 19:35:33 +0200 -Subject: [PATCH] rt2x00: rt2800lib: use the extended EEPROM map for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -381,7 +381,8 @@ static unsigned int rt2800_eeprom_word_i - wiphy_name(rt2x00dev->hw->wiphy), word)) - return 0; - -- if (rt2x00_rt(rt2x00dev, RT3593)) -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) - map = rt2800_eeprom_map_ext; - else - map = rt2800_eeprom_map; diff --git a/package/kernel/mac80211/patches/600-12-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch b/package/kernel/mac80211/patches/600-12-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch deleted file mode 100644 index 2e917c8ebf6f1e..00000000000000 --- a/package/kernel/mac80211/patches/600-12-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 4cf5403f02fa65dc2207f61d223cffa9ae50e907 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Thu, 1 Aug 2013 14:48:21 +0200 -Subject: [PATCH] rt2x00: rt2800lib: force rf type to RF3853 on RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -9083,6 +9083,8 @@ static int rt2800_init_eeprom(struct rt2 - rf = rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID); - else if (rt2x00_rt(rt2x00dev, RT3352)) - rf = RF3322; -+ else if (rt2x00_rt(rt2x00dev, RT3883)) -+ rf = RF3853; - else if (rt2x00_rt(rt2x00dev, RT5350)) - rf = RF5350; - else diff --git a/package/kernel/mac80211/patches/600-13-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch b/package/kernel/mac80211/patches/600-13-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch deleted file mode 100644 index 0bb2d335777175..00000000000000 --- a/package/kernel/mac80211/patches/600-13-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch +++ /dev/null @@ -1,136 +0,0 @@ -From 269f19c848a2380db03a3f207cafb88e28d71c53 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Sun, 24 Mar 2013 19:26:28 +0100 -Subject: [PATCH] rt2x00: rt2800lib: add channel configuration code for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 72 +++++++++++++++++++++++++++++-- - 1 file changed, 69 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -3738,6 +3738,36 @@ static char rt2800_txpower_to_dev(struct - return clamp_t(char, txpower, MIN_A_TXPOWER, MAX_A_TXPOWER); - } - -+static void rt3883_bbp_adjust(struct rt2x00_dev *rt2x00dev, -+ struct rf_channel *rf) -+{ -+ u8 bbp; -+ -+ bbp = (rf->channel > 14) ? 0x48 : 0x38; -+ rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, bbp); -+ -+ rt2800_bbp_write(rt2x00dev, 69, 0x12); -+ -+ if (rf->channel <= 14) { -+ rt2800_bbp_write(rt2x00dev, 70, 0x0a); -+ } else { -+ /* Disable CCK packet detection */ -+ rt2800_bbp_write(rt2x00dev, 70, 0x00); -+ } -+ -+ rt2800_bbp_write(rt2x00dev, 73, 0x10); -+ -+ if (rf->channel > 14) { -+ rt2800_bbp_write(rt2x00dev, 62, 0x1d); -+ rt2800_bbp_write(rt2x00dev, 63, 0x1d); -+ rt2800_bbp_write(rt2x00dev, 64, 0x1d); -+ } else { -+ rt2800_bbp_write(rt2x00dev, 62, 0x2d); -+ rt2800_bbp_write(rt2x00dev, 63, 0x2d); -+ rt2800_bbp_write(rt2x00dev, 64, 0x2d); -+ } -+} -+ - static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, - struct ieee80211_conf *conf, - struct rf_channel *rf, -@@ -3756,6 +3786,12 @@ static void rt2800_config_channel(struct - rt2800_txpower_to_dev(rt2x00dev, rf->channel, - info->default_power3); - -+ switch (rt2x00dev->chip.rt) { -+ case RT3883: -+ rt3883_bbp_adjust(rt2x00dev, rf); -+ break; -+ } -+ - switch (rt2x00dev->chip.rf) { - case RF2020: - case RF3020: -@@ -3860,6 +3896,15 @@ static void rt2800_config_channel(struct - rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); - rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); - rt2800_bbp_write(rt2x00dev, 77, 0x98); -+ } else if (rt2x00_rt(rt2x00dev, RT3883)) { -+ rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); -+ rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); -+ rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); -+ -+ if (rt2x00dev->default_ant.rx_chain_num > 1) -+ rt2800_bbp_write(rt2x00dev, 86, 0x46); -+ else -+ rt2800_bbp_write(rt2x00dev, 86, 0); - } else { - rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); - rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); -@@ -3873,6 +3918,7 @@ static void rt2800_config_channel(struct - !rt2x00_rt(rt2x00dev, RT6352)) { - if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { - rt2800_bbp_write(rt2x00dev, 82, 0x62); -+ rt2800_bbp_write(rt2x00dev, 82, 0x62); - rt2800_bbp_write(rt2x00dev, 75, 0x46); - } else { - if (rt2x00_rt(rt2x00dev, RT3593)) -@@ -3881,19 +3927,22 @@ static void rt2800_config_channel(struct - rt2800_bbp_write(rt2x00dev, 82, 0x84); - rt2800_bbp_write(rt2x00dev, 75, 0x50); - } -- if (rt2x00_rt(rt2x00dev, RT3593)) -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) - rt2800_bbp_write(rt2x00dev, 83, 0x8a); - } - - } else { - if (rt2x00_rt(rt2x00dev, RT3572)) - rt2800_bbp_write(rt2x00dev, 82, 0x94); -- else if (rt2x00_rt(rt2x00dev, RT3593)) -+ else if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) - rt2800_bbp_write(rt2x00dev, 82, 0x82); - else if (!rt2x00_rt(rt2x00dev, RT6352)) - rt2800_bbp_write(rt2x00dev, 82, 0xf2); - -- if (rt2x00_rt(rt2x00dev, RT3593)) -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) - rt2800_bbp_write(rt2x00dev, 83, 0x9a); - - if (rt2x00_has_cap_external_lna_a(rt2x00dev)) -@@ -4019,6 +4068,23 @@ static void rt2800_config_channel(struct - - rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); - -+ usleep_range(1000, 1500); -+ } -+ -+ if (rt2x00_rt(rt2x00dev, RT3883)) { -+ if (!conf_is_ht40(conf)) -+ rt2800_bbp_write(rt2x00dev, 105, 0x34); -+ else -+ rt2800_bbp_write(rt2x00dev, 105, 0x04); -+ -+ /* AGC init */ -+ if (rf->channel <= 14) -+ reg = 0x2e + rt2x00dev->lna_gain; -+ else -+ reg = 0x20 + ((rt2x00dev->lna_gain * 5) / 3); -+ -+ rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); -+ - usleep_range(1000, 1500); - } - diff --git a/package/kernel/mac80211/patches/600-14-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch b/package/kernel/mac80211/patches/600-14-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch deleted file mode 100644 index 56157510eb80fc..00000000000000 --- a/package/kernel/mac80211/patches/600-14-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch +++ /dev/null @@ -1,30 +0,0 @@ -From e37d93abaabe3ab72b0332a18092acc162307274 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Mon, 30 Sep 2013 13:57:26 +0200 -Subject: [PATCH] rt2x00: rt2800lib: fix txpower_to_dev function for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -3725,13 +3725,15 @@ static char rt2800_txpower_to_dev(struct - unsigned int channel, - char txpower) - { -- if (rt2x00_rt(rt2x00dev, RT3593)) -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) - txpower = rt2x00_get_field8(txpower, EEPROM_TXPOWER_ALC); - - if (channel <= 14) - return clamp_t(char, txpower, MIN_G_TXPOWER, MAX_G_TXPOWER); - -- if (rt2x00_rt(rt2x00dev, RT3593)) -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) - return clamp_t(char, txpower, MIN_A_TXPOWER_3593, - MAX_A_TXPOWER_3593); - else diff --git a/package/kernel/mac80211/patches/600-15-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch b/package/kernel/mac80211/patches/600-15-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch deleted file mode 100644 index c1409bcfa3cfc2..00000000000000 --- a/package/kernel/mac80211/patches/600-15-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch +++ /dev/null @@ -1,23 +0,0 @@ -From c4d79e344bd580d85821390d49f92dced7d8e125 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Sun, 24 Mar 2013 19:26:29 +0100 -Subject: [PATCH] rt2x00: rt2800lib: use correct txpower calculation function - for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -5111,7 +5111,8 @@ static void rt2800_config_txpower(struct - struct ieee80211_channel *chan, - int power_level) - { -- if (rt2x00_rt(rt2x00dev, RT3593)) -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) - rt2800_config_txpower_rt3593(rt2x00dev, chan, power_level); - else if (rt2x00_rt(rt2x00dev, RT6352)) - rt2800_config_txpower_rt6352(rt2x00dev, chan, power_level); diff --git a/package/kernel/mac80211/patches/600-16-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch b/package/kernel/mac80211/patches/600-16-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch deleted file mode 100644 index a4ccb2851891ae..00000000000000 --- a/package/kernel/mac80211/patches/600-16-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch +++ /dev/null @@ -1,33 +0,0 @@ -From caea0671cd8fd9ade4f5969cbe0ee545e94ae105 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Sat, 24 Aug 2013 11:49:55 +0200 -Subject: [PATCH] rt2x00: rt2800lib: hardcode txmixer gain values to zero for - RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8965,7 +8965,8 @@ static u8 rt2800_get_txmixer_gain_24g(st - { - u16 word; - -- if (rt2x00_rt(rt2x00dev, RT3593)) -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) - return 0; - - word = rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG); -@@ -8979,7 +8980,8 @@ static u8 rt2800_get_txmixer_gain_5g(str - { - u16 word; - -- if (rt2x00_rt(rt2x00dev, RT3593)) -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) - return 0; - - word = rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_A); diff --git a/package/kernel/mac80211/patches/600-17-rt2x00-rt2800lib-use-correct-RT-XWI-size-for-RT3883.patch b/package/kernel/mac80211/patches/600-17-rt2x00-rt2800lib-use-correct-RT-XWI-size-for-RT3883.patch deleted file mode 100644 index 197aabd7bce50d..00000000000000 --- a/package/kernel/mac80211/patches/600-17-rt2x00-rt2800lib-use-correct-RT-XWI-size-for-RT3883.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 11c40fb47c4a4dd6ad060c2ae127ced89ffb9fe1 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Thu, 18 Apr 2013 14:33:33 +0200 -Subject: [PATCH] rt2x00: rt2800lib: use correct [RT]XWI size for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -591,6 +591,7 @@ void rt2800_get_txwi_rxwi_size(struct rt - { - switch (rt2x00dev->chip.rt) { - case RT3593: -+ case RT3883: - *txwi_size = TXWI_DESC_SIZE_4WORDS; - *rxwi_size = RXWI_DESC_SIZE_5WORDS; - break; diff --git a/package/kernel/mac80211/patches/600-18-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch b/package/kernel/mac80211/patches/600-18-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch deleted file mode 100644 index 24c0ef91b05788..00000000000000 --- a/package/kernel/mac80211/patches/600-18-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch +++ /dev/null @@ -1,22 +0,0 @@ -From fa5ad9c025610c22048add2f0ad03f62b6ca1e74 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Mon, 30 Sep 2013 16:53:33 +0200 -Subject: [PATCH] rt2x00: rt2800lib: fix antenna configuration for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -2017,7 +2017,8 @@ void rt2800_config_ant(struct rt2x00_dev - rt2800_bbp_write(rt2x00dev, 3, r3); - rt2800_bbp_write(rt2x00dev, 1, r1); - -- if (rt2x00_rt(rt2x00dev, RT3593)) { -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) { - if (ant->rx_chain_num == 1) - rt2800_bbp_write(rt2x00dev, 86, 0x00); - else diff --git a/package/kernel/mac80211/patches/600-19-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch b/package/kernel/mac80211/patches/600-19-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch deleted file mode 100644 index 52733ffeb96a25..00000000000000 --- a/package/kernel/mac80211/patches/600-19-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 6d668fef3a1baa60bdd715ee062ddb6333d2647c Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Mon, 30 Sep 2013 16:58:23 +0200 -Subject: [PATCH] rt2x00: rt2800lib: fix LNA gain configuration for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -2040,7 +2040,8 @@ static void rt2800_config_lna_gain(struc - eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_LNA); - lna_gain = rt2x00_get_field16(eeprom, EEPROM_LNA_A0); - } else if (libconf->rf.channel <= 128) { -- if (rt2x00_rt(rt2x00dev, RT3593)) { -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) { - eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2); - lna_gain = rt2x00_get_field16(eeprom, - EEPROM_EXT_LNA2_A1); -@@ -2050,7 +2051,8 @@ static void rt2800_config_lna_gain(struc - EEPROM_RSSI_BG2_LNA_A1); - } - } else { -- if (rt2x00_rt(rt2x00dev, RT3593)) { -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) { - eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2); - lna_gain = rt2x00_get_field16(eeprom, - EEPROM_EXT_LNA2_A2); diff --git a/package/kernel/mac80211/patches/600-20-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch b/package/kernel/mac80211/patches/600-20-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch deleted file mode 100644 index 301928d2837069..00000000000000 --- a/package/kernel/mac80211/patches/600-20-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch +++ /dev/null @@ -1,44 +0,0 @@ -From c49b2d829aa1c816a46a577cdec6d2ff14d9f06e Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Tue, 1 Oct 2013 15:40:08 +0200 -Subject: [PATCH] rt2x00: rt2800lib: fix VGC setup for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -5364,7 +5364,8 @@ static u8 rt2800_get_default_vgc(struct - else - vgc = 0x2e + rt2x00dev->lna_gain; - } else { /* 5GHZ band */ -- if (rt2x00_rt(rt2x00dev, RT3593)) -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) - vgc = 0x20 + (rt2x00dev->lna_gain * 5) / 3; - else if (rt2x00_rt(rt2x00dev, RT5592)) - vgc = 0x24 + (2 * rt2x00dev->lna_gain); -@@ -5384,7 +5385,8 @@ static inline void rt2800_set_vgc(struct - { - if (qual->vgc_level != vgc_level) { - if (rt2x00_rt(rt2x00dev, RT3572) || -- rt2x00_rt(rt2x00dev, RT3593)) { -+ rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) { - rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, - vgc_level); - } else if (rt2x00_rt(rt2x00dev, RT5592)) { -@@ -5431,6 +5433,11 @@ void rt2800_link_tuner(struct rt2x00_dev - } - break; - -+ case RT3883: -+ if (qual->rssi > -65) -+ vgc += 0x10; -+ break; -+ - case RT5592: - if (qual->rssi > -65) - vgc += 0x20; diff --git a/package/kernel/mac80211/patches/600-21-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch b/package/kernel/mac80211/patches/600-21-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch deleted file mode 100644 index 4bbc7ae44e6c4f..00000000000000 --- a/package/kernel/mac80211/patches/600-21-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 1616650aea676541d4dc8adc6f4219856d193c8b Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Tue, 1 Oct 2013 17:27:57 +0200 -Subject: [PATCH] rt2x00: rt2800lib: fix EEPROM LNA validation for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -9098,7 +9098,8 @@ static int rt2800_validate_eeprom(struct - word = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2); - if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10) - rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0); -- if (!rt2x00_rt(rt2x00dev, RT3593)) { -+ if (!rt2x00_rt(rt2x00dev, RT3593) && -+ !rt2x00_rt(rt2x00dev, RT3883)) { - if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 || - rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff) - rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1, -@@ -9118,7 +9119,8 @@ static int rt2800_validate_eeprom(struct - word = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2); - if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10) - rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0); -- if (!rt2x00_rt(rt2x00dev, RT3593)) { -+ if (!rt2x00_rt(rt2x00dev, RT3593) && -+ !rt2x00_rt(rt2x00dev, RT3883)) { - if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 || - rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff) - rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2, -@@ -9126,7 +9128,8 @@ static int rt2800_validate_eeprom(struct - } - rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word); - -- if (rt2x00_rt(rt2x00dev, RT3593)) { -+ if (rt2x00_rt(rt2x00dev, RT3593) || -+ rt2x00_rt(rt2x00dev, RT3883)) { - word = rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2); - if (rt2x00_get_field16(word, EEPROM_EXT_LNA2_A1) == 0x00 || - rt2x00_get_field16(word, EEPROM_EXT_LNA2_A1) == 0xff) diff --git a/package/kernel/mac80211/patches/600-22-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch b/package/kernel/mac80211/patches/600-22-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch deleted file mode 100644 index e752efd0ea206a..00000000000000 --- a/package/kernel/mac80211/patches/600-22-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch +++ /dev/null @@ -1,22 +0,0 @@ -From e3871034a0e7c8a95152dc3eafbcc4535398cbdc Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Wed, 2 Oct 2013 10:11:59 +0200 -Subject: [PATCH] rt2x00: rt2800lib: fix txpower compensation for RT3883 - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 +++ - 1 file changed, 3 insertions(+) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -4354,6 +4354,9 @@ static u8 rt2800_compensate_txpower(stru - if (rt2x00_rt(rt2x00dev, RT3593)) - return min_t(u8, txpower, 0xc); - -+ if (rt2x00_rt(rt2x00dev, RT3883)) -+ return min_t(u8, txpower, 0xf); -+ - if (rt2x00_has_cap_power_limit(rt2x00dev)) { - /* - * Check if eirp txpower exceed txpower_limit. diff --git a/package/kernel/mac80211/patches/600-23-rt2x00-rt2800mmio-add-a-workaround-for-spurious-TX_F.patch b/package/kernel/mac80211/patches/600-23-rt2x00-rt2800mmio-add-a-workaround-for-spurious-TX_F.patch deleted file mode 100644 index 342174f8d5dfc7..00000000000000 --- a/package/kernel/mac80211/patches/600-23-rt2x00-rt2800mmio-add-a-workaround-for-spurious-TX_F.patch +++ /dev/null @@ -1,136 +0,0 @@ -From 5e67d4f8a46d19748b501c2ef86de3f50d3cfd51 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Sun, 24 Mar 2013 19:26:27 +0100 -Subject: [PATCH] rt2x00: rt2800mmio: add a workaround for spurious - TX_FIFO_STATUS interrupts - -Signed-off-by: Gabor Juhos ---- - drivers/net/wireless/ralink/rt2x00/rt2800mmio.c | 72 +++++++++++++++++++++++++----- - drivers/net/wireless/ralink/rt2x00/rt2x00.h | 5 +++ - 2 files changed, 65 insertions(+), 12 deletions(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c -@@ -424,9 +424,9 @@ void rt2800mmio_autowake_tasklet(unsigne - } - EXPORT_SYMBOL_GPL(rt2800mmio_autowake_tasklet); - --static void rt2800mmio_txstatus_interrupt(struct rt2x00_dev *rt2x00dev) -+static void rt2800mmio_txstatus_interrupt(struct rt2x00_dev *rt2x00dev, -+ u32 status) - { -- u32 status; - int i; - - /* -@@ -447,29 +447,77 @@ static void rt2800mmio_txstatus_interrup - * Since we have only one producer and one consumer we don't - * need to lock the kfifo. - */ -- for (i = 0; i < rt2x00dev->tx->limit; i++) { -- status = rt2x00mmio_register_read(rt2x00dev, TX_STA_FIFO); -- -- if (!rt2x00_get_field32(status, TX_STA_FIFO_VALID)) -- break; -- -+ i = 0; -+ do { - if (!kfifo_put(&rt2x00dev->txstatus_fifo, status)) { -- rt2x00_warn(rt2x00dev, "TX status FIFO overrun, drop tx status report\n"); -+ rt2x00_warn(rt2x00dev, -+ "TX status FIFO overrun, drop TX status report\n"); - break; - } -- } -+ -+ if (++i >= rt2x00dev->tx->limit) -+ break; -+ -+ status = rt2x00mmio_register_read(rt2x00dev, TX_STA_FIFO); -+ } while (rt2x00_get_field32(status, TX_STA_FIFO_VALID)); - - /* Schedule the tasklet for processing the tx status. */ - tasklet_schedule(&rt2x00dev->txstatus_tasklet); - } - -+#define RT2800MMIO_TXSTATUS_IRQ_MAX_RETRIES 4 -+ -+static bool rt2800mmio_txstatus_is_spurious(struct rt2x00_dev *rt2x00dev, -+ u32 txstatus) -+{ -+ if (likely(rt2x00_get_field32(txstatus, TX_STA_FIFO_VALID))) { -+ rt2x00dev->txstatus_irq_retries = 0; -+ return false; -+ } -+ -+ rt2x00dev->txstatus_irq_retries++; -+ -+ /* Ensure that we don't go into an infinite IRQ loop. */ -+ if (rt2x00dev->txstatus_irq_retries >= -+ RT2800MMIO_TXSTATUS_IRQ_MAX_RETRIES) { -+ rt2x00_warn(rt2x00dev, -+ "%u spurious TX_FIFO_STATUS interrupt(s)\n", -+ rt2x00dev->txstatus_irq_retries); -+ rt2x00dev->txstatus_irq_retries = 0; -+ return false; -+ } -+ -+ return true; -+} -+ - irqreturn_t rt2800mmio_interrupt(int irq, void *dev_instance) - { - struct rt2x00_dev *rt2x00dev = dev_instance; - u32 reg, mask; -+ u32 txstatus = 0; - -- /* Read status and ACK all interrupts */ -+ /* Read status */ - reg = rt2x00mmio_register_read(rt2x00dev, INT_SOURCE_CSR); -+ -+ if (rt2x00_get_field32(reg, INT_SOURCE_CSR_TX_FIFO_STATUS)) { -+ /* Due to unknown reason the hardware generates a -+ * TX_FIFO_STATUS interrupt before the TX_STA_FIFO -+ * register contain valid data. Read the TX status -+ * here to see if we have to process the actual -+ * request. -+ */ -+ txstatus = rt2x00mmio_register_read(rt2x00dev, TX_STA_FIFO); -+ if (rt2800mmio_txstatus_is_spurious(rt2x00dev, txstatus)) { -+ /* Remove the TX_FIFO_STATUS bit so it won't be -+ * processed in this turn. The hardware will -+ * generate another IRQ for us. -+ */ -+ rt2x00_set_field32(®, -+ INT_SOURCE_CSR_TX_FIFO_STATUS, 0); -+ } -+ } -+ -+ /* ACK interrupts */ - rt2x00mmio_register_write(rt2x00dev, INT_SOURCE_CSR, reg); - - if (!reg) -@@ -486,7 +534,7 @@ irqreturn_t rt2800mmio_interrupt(int irq - mask = ~reg; - - if (rt2x00_get_field32(reg, INT_SOURCE_CSR_TX_FIFO_STATUS)) { -- rt2800mmio_txstatus_interrupt(rt2x00dev); -+ rt2800mmio_txstatus_interrupt(rt2x00dev, txstatus); - /* - * Never disable the TX_FIFO_STATUS interrupt. - */ ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -1000,6 +1000,11 @@ struct rt2x00_dev { - int rf_channel; - - /* -+ * Counter for tx status irq retries (rt2800pci). -+ */ -+ unsigned int txstatus_irq_retries; -+ -+ /* - * Protect the interrupt mask register. - */ - spinlock_t irqmask_lock; diff --git a/package/kernel/mac80211/patches/650-rt2x00-add-support-for-external-PA-on-MT7620.patch b/package/kernel/mac80211/patches/650-rt2x00-add-support-for-external-PA-on-MT7620.patch deleted file mode 100644 index 9fad80b6726457..00000000000000 --- a/package/kernel/mac80211/patches/650-rt2x00-add-support-for-external-PA-on-MT7620.patch +++ /dev/null @@ -1,118 +0,0 @@ -From 9782a7f7488443568fa4d6088b73c9aff7eb8510 Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Wed, 19 Apr 2017 16:14:53 +0200 -Subject: [PATCH] rt2x00: add support for external PA on MT7620 -To: Stanislaw Gruszka -Cc: Helmut Schaa , - linux-wireless@vger.kernel.org, - Kalle Valo - -Signed-off-by: Daniel Golle ---- - drivers/net/wireless/ralink/rt2x00/rt2800.h | 1 + - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 70 +++++++++++++++++++++++++- - 2 files changed, 70 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800.h -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h -@@ -2749,6 +2749,7 @@ enum rt2800_eeprom_word { - #define EEPROM_NIC_CONF2_RX_STREAM FIELD16(0x000f) - #define EEPROM_NIC_CONF2_TX_STREAM FIELD16(0x00f0) - #define EEPROM_NIC_CONF2_CRYSTAL FIELD16(0x0600) -+#define EEPROM_NIC_CONF2_EXTERNAL_PA FIELD16(0xc000) - - /* - * EEPROM LNA ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -4120,6 +4120,61 @@ static void rt2800_config_channel(struct - rt2800_iq_calibrate(rt2x00dev, rf->channel); - } - -+ if (rt2x00_rt(rt2x00dev, RT6352)) { -+ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, -+ &rt2x00dev->cap_flags)) { -+ rt2x00_warn(rt2x00dev, "Using incomplete support for " \ -+ "external PA\n"); -+ reg = rt2800_register_read(rt2x00dev, RF_CONTROL3); -+ reg |= 0x00000101; -+ rt2800_register_write(rt2x00dev, RF_CONTROL3, reg); -+ -+ reg = rt2800_register_read(rt2x00dev, RF_BYPASS3); -+ reg |= 0x00000101; -+ rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); -+ -+ rt2800_rfcsr_write_bank(rt2x00dev, 4, 43, 0x73); -+ rt2800_rfcsr_write_bank(rt2x00dev, 6, 43, 0x73); -+ rt2800_rfcsr_write_bank(rt2x00dev, 4, 44, 0x73); -+ rt2800_rfcsr_write_bank(rt2x00dev, 6, 44, 0x73); -+ rt2800_rfcsr_write_bank(rt2x00dev, 4, 45, 0x73); -+ rt2800_rfcsr_write_bank(rt2x00dev, 6, 45, 0x73); -+ rt2800_rfcsr_write_bank(rt2x00dev, 4, 46, 0x27); -+ rt2800_rfcsr_write_bank(rt2x00dev, 6, 46, 0x27); -+ rt2800_rfcsr_write_bank(rt2x00dev, 4, 47, 0xC8); -+ rt2800_rfcsr_write_bank(rt2x00dev, 6, 47, 0xC8); -+ rt2800_rfcsr_write_bank(rt2x00dev, 4, 48, 0xA4); -+ rt2800_rfcsr_write_bank(rt2x00dev, 6, 48, 0xA4); -+ rt2800_rfcsr_write_bank(rt2x00dev, 4, 49, 0x05); -+ rt2800_rfcsr_write_bank(rt2x00dev, 6, 49, 0x05); -+ rt2800_rfcsr_write_bank(rt2x00dev, 4, 54, 0x27); -+ rt2800_rfcsr_write_bank(rt2x00dev, 6, 54, 0x27); -+ rt2800_rfcsr_write_bank(rt2x00dev, 4, 55, 0xC8); -+ rt2800_rfcsr_write_bank(rt2x00dev, 6, 55, 0xC8); -+ rt2800_rfcsr_write_bank(rt2x00dev, 4, 56, 0xA4); -+ rt2800_rfcsr_write_bank(rt2x00dev, 6, 56, 0xA4); -+ rt2800_rfcsr_write_bank(rt2x00dev, 4, 57, 0x05); -+ rt2800_rfcsr_write_bank(rt2x00dev, 6, 57, 0x05); -+ rt2800_rfcsr_write_bank(rt2x00dev, 4, 58, 0x27); -+ rt2800_rfcsr_write_bank(rt2x00dev, 6, 58, 0x27); -+ rt2800_rfcsr_write_bank(rt2x00dev, 4, 59, 0xC8); -+ rt2800_rfcsr_write_bank(rt2x00dev, 6, 59, 0xC8); -+ rt2800_rfcsr_write_bank(rt2x00dev, 4, 60, 0xA4); -+ rt2800_rfcsr_write_bank(rt2x00dev, 6, 60, 0xA4); -+ rt2800_rfcsr_write_bank(rt2x00dev, 4, 61, 0x05); -+ rt2800_rfcsr_write_bank(rt2x00dev, 6, 61, 0x05); -+ rt2800_rfcsr_write_bank(rt2x00dev, 5, 05, 0x00); -+ rt2800_rfcsr_write_bank(rt2x00dev, 7, 05, 0x00); -+ -+ rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, -+ 0x36303636); -+ rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, -+ 0x6C6C6B6C); -+ rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, -+ 0x6C6C6B6C); -+ } -+ } -+ - bbp = rt2800_bbp_read(rt2x00dev, 4); - rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf)); - rt2800_bbp_write(rt2x00dev, 4, bbp); -@@ -9314,7 +9369,8 @@ static int rt2800_init_eeprom(struct rt2 - */ - eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1); - -- if (rt2x00_rt(rt2x00dev, RT3352)) { -+ if (rt2x00_rt(rt2x00dev, RT3352) || -+ rt2x00_rt(rt2x00dev, RT6352)) { - if (rt2x00_get_field16(eeprom, - EEPROM_NIC_CONF1_EXTERNAL_TX0_PA_3352)) - __set_bit(CAPABILITY_EXTERNAL_PA_TX0, -@@ -9325,6 +9381,18 @@ static int rt2800_init_eeprom(struct rt2 - &rt2x00dev->cap_flags); - } - -+ eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF2); -+ -+ if (rt2x00_rt(rt2x00dev, RT6352) && eeprom != 0 && eeprom != 0xffff) { -+ if (rt2x00_get_field16(eeprom, -+ EEPROM_NIC_CONF2_EXTERNAL_PA)) { -+ __set_bit(CAPABILITY_EXTERNAL_PA_TX0, -+ &rt2x00dev->cap_flags); -+ __set_bit(CAPABILITY_EXTERNAL_PA_TX1, -+ &rt2x00dev->cap_flags); -+ } -+ } -+ - return 0; - } - diff --git a/package/kernel/mac80211/patches/651-rt2x00-remove-unneccesary-code.patch b/package/kernel/mac80211/patches/651-rt2x00-remove-unneccesary-code.patch deleted file mode 100644 index 475fcbc223ee46..00000000000000 --- a/package/kernel/mac80211/patches/651-rt2x00-remove-unneccesary-code.patch +++ /dev/null @@ -1,132 +0,0 @@ -From pozega.tomislav@gmail.com Thu May 18 12:42:27 2017 -Return-path: -Envelope-to: daniel@makrotopia.org -Delivery-date: Thu, 18 May 2017 12:42:27 +0200 -Received: from mail by fudo.makrotopia.org with sa-checked (Exim 4.88) - (envelope-from ) - id 1dBIsy-00088b-PU - for daniel@makrotopia.org; Thu, 18 May 2017 12:42:27 +0200 -X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on fudo.makrotopia.org -X-Spam-Level: -X-Spam-Status: No, score=-0.8 required=2.5 tests=DKIM_SIGNED,DKIM_VALID, - DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW shortcircuit=no - autolearn=ham autolearn_force=no version=3.4.1 -Received: from mail-oi0-x22a.google.com ([2607:f8b0:4003:c06::22a]) - by fudo.makrotopia.org with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) - (Exim 4.88) - (envelope-from ) - id 1dBIsv-00088Q-Dq - for daniel@makrotopia.org; Thu, 18 May 2017 12:42:24 +0200 -Received: by mail-oi0-x22a.google.com with SMTP id w10so48782189oif.0 - for ; Thu, 18 May 2017 03:42:21 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=gmail.com; s=20161025; - h=mime-version:from:date:message-id:subject:to; - bh=9dF7PHDassYY74+N6dAhmsL/B9i5oG3SEuMzHuazhJo=; - b=cBGJ44v+o4ASyCPmHCBRMmRYnJCv4Gx6lzDiScKn0XqYmNHYpZTPg5cAY1GZFUhHdz - 9QT5fzhJKFikBliSuJc/7/pI8KzvyEAdvawiWA7/5fbeiTZ+zjJnzRVGezqkYDKxjR6u - 7TsoJxR2/oFwo7bOFlThhee+Nwf7qaX8AVal7JdkqovekX79JQ5vsKAa4LapDp7Cl0wr - KCh0WRUHGEgpTLJFyQ3ThPmLqc8bhmu+6/V/LJ53VOY7uksZHMhvaKkk9vDCoOuPnBMK - Cj2/c7z9RTErz/xlHg6HxnBe/pPc31XUsuPJUleOEdZASczPsreEEKacKCONVlP1wjAB - iOkA== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20161025; - h=x-gm-message-state:mime-version:from:date:message-id:subject:to; - bh=9dF7PHDassYY74+N6dAhmsL/B9i5oG3SEuMzHuazhJo=; - b=LJAe4ZwS9aNJypROW7j+I9aNfRBWyDYy0c8ABnDbLrIoF9P2AA/Vs/Cli5f7GjaAxr - 1JCx602ach+7R7QjQq/nqNmLuhRCfSvB0TGrq4R4v+CJ4ADO541+PddnFiU1dlIXQRP2 - TE2FOydSO0FGJBMg+kY0eFiidBtYj1T5x7IHAhQzufiuiF6/1xZS8h61CYJjLzt/aR5y - JxOxsVvu3W2YQ0T5wKmAPlKtarFH6ZZgs446bRYt1MX5KAWzIoBM1+IPMMv7lSCpCaDR - fwH05aDyaJW2IzXH5R9Tq7gGYycYjx/SnO7JupJXJVvOzKgBJxp60JwJhCfqCwESDuuD - 8nNA== -X-Gm-Message-State: AODbwcDOpdFZgbxAxFsVsqFdCBN3pRGDvEclZ1heVg2byNZ9BuG5kqJg - GvZ9x4NGt0v8lVGa3esDw0N1KiJENg== -X-Received: by 10.157.17.217 with SMTP id y25mr1310632oty.137.1495104134863; - Thu, 18 May 2017 03:42:14 -0700 (PDT) -MIME-Version: 1.0 -Received: by 10.157.0.105 with HTTP; Thu, 18 May 2017 03:42:14 -0700 (PDT) -From: Tom Psyborg -Date: Thu, 18 May 2017 12:42:14 +0200 -Message-ID: -Subject: [PATCH] rt2x00: remove unneccesary code -To: linux-wireless , - Linux Kernel Mailing List , Arnd Bergmann , - Jes Sorensen , Stanislaw Gruszka , - David Miller , Helmut Schaa , - Kalle Valo , Daniel Golle , - Mathias Kresin , Johannes Berg , - Serge Vasilugin , Roman Yeryomin , - Networking -Content-Type: multipart/alternative; boundary="94eb2c1905d2dc6361054fca0e62" -Status: RO -Content-Length: 11079 -Lines: 178 - ---94eb2c1905d2dc6361054fca0e62 -Content-Type: text/plain; charset="UTF-8" -Content-Transfer-Encoding: quoted-printable - -Use chanreg and dccal helpers to reduce the size of ePA code. - -Signed-off-by: Tomislav Po=C5=BEega -Signed-off-by: Daniel Golle -[daniel@makrotopia.org: fixed white-space so patch applies] ---- - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -4133,38 +4133,22 @@ static void rt2800_config_channel(struct - reg |= 0x00000101; - rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); - -- rt2800_rfcsr_write_bank(rt2x00dev, 4, 43, 0x73); -- rt2800_rfcsr_write_bank(rt2x00dev, 6, 43, 0x73); -- rt2800_rfcsr_write_bank(rt2x00dev, 4, 44, 0x73); -- rt2800_rfcsr_write_bank(rt2x00dev, 6, 44, 0x73); -- rt2800_rfcsr_write_bank(rt2x00dev, 4, 45, 0x73); -- rt2800_rfcsr_write_bank(rt2x00dev, 6, 45, 0x73); -- rt2800_rfcsr_write_bank(rt2x00dev, 4, 46, 0x27); -- rt2800_rfcsr_write_bank(rt2x00dev, 6, 46, 0x27); -- rt2800_rfcsr_write_bank(rt2x00dev, 4, 47, 0xC8); -- rt2800_rfcsr_write_bank(rt2x00dev, 6, 47, 0xC8); -- rt2800_rfcsr_write_bank(rt2x00dev, 4, 48, 0xA4); -- rt2800_rfcsr_write_bank(rt2x00dev, 6, 48, 0xA4); -- rt2800_rfcsr_write_bank(rt2x00dev, 4, 49, 0x05); -- rt2800_rfcsr_write_bank(rt2x00dev, 6, 49, 0x05); -- rt2800_rfcsr_write_bank(rt2x00dev, 4, 54, 0x27); -- rt2800_rfcsr_write_bank(rt2x00dev, 6, 54, 0x27); -- rt2800_rfcsr_write_bank(rt2x00dev, 4, 55, 0xC8); -- rt2800_rfcsr_write_bank(rt2x00dev, 6, 55, 0xC8); -- rt2800_rfcsr_write_bank(rt2x00dev, 4, 56, 0xA4); -- rt2800_rfcsr_write_bank(rt2x00dev, 6, 56, 0xA4); -- rt2800_rfcsr_write_bank(rt2x00dev, 4, 57, 0x05); -- rt2800_rfcsr_write_bank(rt2x00dev, 6, 57, 0x05); -- rt2800_rfcsr_write_bank(rt2x00dev, 4, 58, 0x27); -- rt2800_rfcsr_write_bank(rt2x00dev, 6, 58, 0x27); -- rt2800_rfcsr_write_bank(rt2x00dev, 4, 59, 0xC8); -- rt2800_rfcsr_write_bank(rt2x00dev, 6, 59, 0xC8); -- rt2800_rfcsr_write_bank(rt2x00dev, 4, 60, 0xA4); -- rt2800_rfcsr_write_bank(rt2x00dev, 6, 60, 0xA4); -- rt2800_rfcsr_write_bank(rt2x00dev, 4, 61, 0x05); -- rt2800_rfcsr_write_bank(rt2x00dev, 6, 61, 0x05); -- rt2800_rfcsr_write_bank(rt2x00dev, 5, 05, 0x00); -- rt2800_rfcsr_write_bank(rt2x00dev, 7, 05, 0x00); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0x73); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0x73); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0x73); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0xC8); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xA4); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x05); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0xC8); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xA4); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x05); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x27); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0xC8); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xA4); -+ rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x05); -+ rt2800_rfcsr_write_dccal(rt2x00dev, 05, 0x00); - - rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, - 0x36303636); diff --git a/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch b/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch deleted file mode 100644 index 65782906a1c0b7..00000000000000 --- a/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch +++ /dev/null @@ -1,66 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 8 Jun 2015 16:11:40 +0200 -Subject: [PATCH] brcmfmac: register wiphy(s) during module_init -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This is needed by OpenWrt which expects all PHYs to be created after -module loads successfully. - -Signed-off-by: Rafał Miłecki ---- - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1322,6 +1322,7 @@ int __init brcmf_core_init(void) - { - if (!schedule_work(&brcmf_driver_work)) - return -EBUSY; -+ flush_work(&brcmf_driver_work); - - return 0; - } ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -@@ -441,6 +441,7 @@ struct brcmf_fw { - struct brcmf_fw_request *req; - u32 curpos; - void (*done)(struct device *dev, int err, struct brcmf_fw_request *req); -+ struct completion *completion; - }; - - static void brcmf_fw_request_done(const struct firmware *fw, void *ctx); -@@ -589,6 +590,8 @@ fail: - fwctx->req = NULL; - done: - fwctx->done(fwctx->dev, ret, fwctx->req); -+ if (fwctx->completion) -+ complete(fwctx->completion); - kfree(fwctx); - } - -@@ -612,6 +615,8 @@ int brcmf_fw_get_firmwares(struct device - struct brcmf_fw_request *req)) - { - struct brcmf_fw *fwctx; -+ struct completion completion; -+ int err; - - brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev)); - if (!fw_cb) -@@ -628,7 +633,14 @@ int brcmf_fw_get_firmwares(struct device - fwctx->req = req; - fwctx->done = fw_cb; - -+ init_completion(&completion); -+ fwctx->completion = &completion; -+ - brcmf_fw_request_next_item(fwctx, true); -+ -+ wait_for_completion_timeout(fwctx->completion, msecs_to_jiffies(5000)); -+ fwctx->completion = NULL; -+ - return 0; - } - diff --git a/package/kernel/mac80211/patches/936-ath10k-fix-otp-failure-result.patch b/package/kernel/mac80211/patches/936-ath10k-fix-otp-failure-result.patch deleted file mode 100644 index ea30a9dfd6cdfe..00000000000000 --- a/package/kernel/mac80211/patches/936-ath10k-fix-otp-failure-result.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/drivers/net/wireless/ath/ath10k/core.c -+++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -770,7 +770,7 @@ static int ath10k_core_get_board_id_from - if (ret) { - ath10k_err(ar, "could not execute otp for board id check: %d\n", - ret); -- return ret; -+ return -EOPNOTSUPP; - } - - board_id = MS(result, ATH10K_BMI_BOARD_ID_FROM_OTP); diff --git a/package/kernel/mac80211/patches/941-fix-ath10k-crashes.patch b/package/kernel/mac80211/patches/941-fix-ath10k-crashes.patch deleted file mode 100755 index d7f3eba96f3ec8..00000000000000 --- a/package/kernel/mac80211/patches/941-fix-ath10k-crashes.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/drivers/net/wireless/ath/ath10k/pci.c -+++ b/drivers/net/wireless/ath/ath10k/pci.c -@@ -1923,7 +1923,6 @@ static int ath10k_pci_bmi_wait(struct at - if (xfer->tx_done && (xfer->rx_done == xfer->wait_for_resp)) - return 0; - -- schedule(); - } - - return -ETIMEDOUT; diff --git a/package/kernel/mac80211/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch b/package/kernel/mac80211/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch deleted file mode 100644 index 914472aab9bc04..00000000000000 --- a/package/kernel/mac80211/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/drivers/net/wireless/ath/ath10k/htt.h -+++ b/drivers/net/wireless/ath/ath10k/htt.h -@@ -200,7 +200,7 @@ enum htt_rx_ring_flags { - }; - - #define HTT_RX_RING_SIZE_MIN 128 --#define HTT_RX_RING_SIZE_MAX 2048 -+#define HTT_RX_RING_SIZE_MAX 512 - - struct htt_rx_ring_setup_ring { - __le32 fw_idx_shadow_reg_paddr; diff --git a/package/kernel/mac80211/patches/960-0011-ath10k-limit-pci-buffer-size.patch b/package/kernel/mac80211/patches/960-0011-ath10k-limit-pci-buffer-size.patch deleted file mode 100644 index a101282d074aeb..00000000000000 --- a/package/kernel/mac80211/patches/960-0011-ath10k-limit-pci-buffer-size.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- a/drivers/net/wireless/ath/ath10k/pci.c -+++ b/drivers/net/wireless/ath/ath10k/pci.c -@@ -128,7 +128,7 @@ static struct ce_attr host_ce_config_wla - .flags = CE_ATTR_FLAGS, - .src_nentries = 0, - .src_sz_max = 2048, -- .dest_nentries = 512, -+ .dest_nentries = 128, - .recv_cb = ath10k_pci_htt_htc_rx_cb, - }, - -@@ -137,7 +137,7 @@ static struct ce_attr host_ce_config_wla - .flags = CE_ATTR_FLAGS, - .src_nentries = 0, - .src_sz_max = 2048, -- .dest_nentries = 128, -+ .dest_nentries = 64, - .recv_cb = ath10k_pci_htc_rx_cb, - }, - -@@ -164,7 +164,7 @@ static struct ce_attr host_ce_config_wla - .flags = CE_ATTR_FLAGS, - .src_nentries = 0, - .src_sz_max = 512, -- .dest_nentries = 512, -+ .dest_nentries = 128, - .recv_cb = ath10k_pci_htt_rx_cb, - }, - -@@ -189,7 +189,7 @@ static struct ce_attr host_ce_config_wla - .flags = CE_ATTR_FLAGS, - .src_nentries = 0, - .src_sz_max = 2048, -- .dest_nentries = 128, -+ .dest_nentries = 96, - .recv_cb = ath10k_pci_pktlog_rx_cb, - }, - diff --git a/package/kernel/mac80211/patches/970-rsi-fix-kbuild-reported-build-errors-with-CONFIG_PM-off b/package/kernel/mac80211/patches/970-rsi-fix-kbuild-reported-build-errors-with-CONFIG_PM-off deleted file mode 100644 index 3b139ee3268068..00000000000000 --- a/package/kernel/mac80211/patches/970-rsi-fix-kbuild-reported-build-errors-with-CONFIG_PM-off +++ /dev/null @@ -1,93 +0,0 @@ -From e6b3b2ed3d270b3c7080c9cf7d28636dc74b0387 Mon Sep 17 00:00:00 2001 -From: Amitkumar Karwar -Date: Wed, 1 Nov 2017 17:42:45 +0530 -Subject: rsi: fix kbuild reported build errors with CONFIG_PM off - -Some wowlan related code was outside CONFIG_PM flag which caused these -build errors. They are fixed by moving that code under CONFIG_PM flag. - -Reported-by: kbuild test robot -Fixes: ef71ed0608c ("rsi: sdio: Add WOWLAN support for S5 shutdown state") -Fixes: a24e35fcee0 ("rsi: sdio: Add WOWLAN support for S4 hibernate state") -Fixes: e1ced6422a3 ("rsi: sdio: add WOWLAN support for S3 suspend state") -Signed-off-by: Amitkumar Karwar -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/rsi/rsi_91x_mac80211.c | 5 ++++- - drivers/net/wireless/rsi/rsi_91x_mgmt.c | 2 ++ - drivers/net/wireless/rsi/rsi_common.h | 2 ++ - drivers/net/wireless/rsi/rsi_mgmt.h | 2 ++ - 4 files changed, 10 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c -+++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c -@@ -1752,6 +1752,7 @@ static int rsi_mac80211_cancel_roc(struc - return 0; - } - -+#ifdef CONFIG_PM - static const struct wiphy_wowlan_support rsi_wowlan_support = { - .flags = WIPHY_WOWLAN_ANY | - WIPHY_WOWLAN_MAGIC_PKT | -@@ -1824,7 +1825,6 @@ int rsi_config_wowlan(struct rsi_hw *ada - } - EXPORT_SYMBOL(rsi_config_wowlan); - --#ifdef CONFIG_PM - static int rsi_mac80211_suspend(struct ieee80211_hw *hw, - struct cfg80211_wowlan *wowlan) - { -@@ -1977,7 +1977,10 @@ int rsi_mac80211_attach(struct rsi_commo - wiphy->features |= NL80211_FEATURE_INACTIVITY_TIMER; - wiphy->reg_notifier = rsi_reg_notify; - -+#ifdef CONFIG_PM - wiphy->wowlan = &rsi_wowlan_support; -+#endif -+ - wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); - - /* Wi-Fi direct parameters */ ---- a/drivers/net/wireless/rsi/rsi_91x_mgmt.c -+++ b/drivers/net/wireless/rsi/rsi_91x_mgmt.c -@@ -1597,6 +1597,7 @@ static int rsi_send_beacon(struct rsi_co - return 0; - } - -+#ifdef CONFIG_PM - int rsi_send_wowlan_request(struct rsi_common *common, u16 flags, - u16 sleep_status) - { -@@ -1630,6 +1631,7 @@ int rsi_send_wowlan_request(struct rsi_c - - return rsi_send_internal_mgmt_frame(common, skb); - } -+#endif - - /** - * rsi_handle_ta_confirm_type() - This function handles the confirm frames. ---- a/drivers/net/wireless/rsi/rsi_common.h -+++ b/drivers/net/wireless/rsi/rsi_common.h -@@ -83,7 +83,9 @@ u16 rsi_get_connected_channel(struct iee - struct rsi_hw *rsi_91x_init(void); - void rsi_91x_deinit(struct rsi_hw *adapter); - int rsi_read_pkt(struct rsi_common *common, s32 rcv_pkt_len); -+#ifdef CONFIG_PM - int rsi_config_wowlan(struct rsi_hw *adapter, struct cfg80211_wowlan *wowlan); -+#endif - struct rsi_sta *rsi_find_sta(struct rsi_common *common, u8 *mac_addr); - struct ieee80211_vif *rsi_get_vif(struct rsi_hw *adapter, u8 *mac); - void rsi_roc_timeout(struct timer_list *t); ---- a/drivers/net/wireless/rsi/rsi_mgmt.h -+++ b/drivers/net/wireless/rsi/rsi_mgmt.h -@@ -668,8 +668,10 @@ int rsi_band_check(struct rsi_common *co - int rsi_send_rx_filter_frame(struct rsi_common *common, u16 rx_filter_word); - int rsi_send_radio_params_update(struct rsi_common *common); - int rsi_set_antenna(struct rsi_common *common, u8 antenna); -+#ifdef CONFIG_PM - int rsi_send_wowlan_request(struct rsi_common *common, u16 flags, - u16 sleep_status); -+#endif - int rsi_send_ps_request(struct rsi_hw *adapter, bool enable, - struct ieee80211_vif *vif); - #endif diff --git a/package/kernel/mac80211/patches/971-rsi-move-rsi_sdio_reinit_device-out-of-CONFIG_PM.patch b/package/kernel/mac80211/patches/971-rsi-move-rsi_sdio_reinit_device-out-of-CONFIG_PM.patch deleted file mode 100644 index 499b4ee7fced52..00000000000000 --- a/package/kernel/mac80211/patches/971-rsi-move-rsi_sdio_reinit_device-out-of-CONFIG_PM.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 39f1332c526cd9d6de59a72520e8334e54b62cda Mon Sep 17 00:00:00 2001 -From: Amitkumar Karwar -Date: Wed, 1 Nov 2017 17:42:44 +0530 -Subject: rsi: move rsi_sdio_reinit_device() out of CONFIG_PM - -This function is generic. It doesn't contain wowlan specific code. -It should not be under CONFIG_PM. This patch resolves compilation -errors observed when CONFIG_PM flag is disabled. - -Reported-by: kbuild test robot -Fixes: ef71ed0608c ("rsi: sdio: Add WOWLAN support for S5 shutdown state") -Fixes: a24e35fcee0 ("rsi: sdio: Add WOWLAN support for S4 hibernate state") -Fixes: e1ced6422a3 ("rsi: sdio: add WOWLAN support for S3 suspend state") -Signed-off-by: Amitkumar Karwar -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/rsi/rsi_91x_sdio.c | 52 ++++++++++++++++----------------- - drivers/net/wireless/rsi/rsi_sdio.h | 1 - - 2 files changed, 26 insertions(+), 27 deletions(-) - ---- a/drivers/net/wireless/rsi/rsi_91x_sdio.c -+++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c -@@ -871,6 +871,32 @@ fail: - return status; - } - -+static int rsi_sdio_reinit_device(struct rsi_hw *adapter) -+{ -+ struct rsi_91x_sdiodev *sdev = adapter->rsi_dev; -+ struct sdio_func *pfunction = sdev->pfunction; -+ int ii; -+ -+ for (ii = 0; ii < NUM_SOFT_QUEUES; ii++) -+ skb_queue_purge(&adapter->priv->tx_queue[ii]); -+ -+ /* Initialize device again */ -+ sdio_claim_host(pfunction); -+ -+ sdio_release_irq(pfunction); -+ rsi_reset_card(pfunction); -+ -+ sdio_enable_func(pfunction); -+ rsi_setupcard(adapter); -+ rsi_init_sdio_slave_regs(adapter); -+ sdio_claim_irq(pfunction, rsi_handle_interrupt); -+ rsi_hal_device_init(adapter); -+ -+ sdio_release_host(pfunction); -+ -+ return 0; -+} -+ - static struct rsi_host_intf_ops sdio_host_intf_ops = { - .write_pkt = rsi_sdio_host_intf_write_pkt, - .read_pkt = rsi_sdio_host_intf_read_pkt, -@@ -1281,32 +1307,6 @@ static void rsi_shutdown(struct device * - rsi_dbg(INFO_ZONE, "***** RSI module shut down *****\n"); - } - --int rsi_sdio_reinit_device(struct rsi_hw *adapter) --{ -- struct rsi_91x_sdiodev *sdev = adapter->rsi_dev; -- struct sdio_func *pfunction = sdev->pfunction; -- int ii; -- -- for (ii = 0; ii < NUM_SOFT_QUEUES; ii++) -- skb_queue_purge(&adapter->priv->tx_queue[ii]); -- -- /* Initialize device again */ -- sdio_claim_host(pfunction); -- -- sdio_release_irq(pfunction); -- rsi_reset_card(pfunction); -- -- sdio_enable_func(pfunction); -- rsi_setupcard(adapter); -- rsi_init_sdio_slave_regs(adapter); -- sdio_claim_irq(pfunction, rsi_handle_interrupt); -- rsi_hal_device_init(adapter); -- -- sdio_release_host(pfunction); -- -- return 0; --} -- - static int rsi_restore(struct device *dev) - { - struct sdio_func *pfunction = dev_to_sdio_func(dev); ---- a/drivers/net/wireless/rsi/rsi_sdio.h -+++ b/drivers/net/wireless/rsi/rsi_sdio.h -@@ -131,5 +131,4 @@ int rsi_sdio_master_access_msword(struct - void rsi_sdio_ack_intr(struct rsi_hw *adapter, u8 int_bit); - int rsi_sdio_determine_event_timeout(struct rsi_hw *adapter); - int rsi_sdio_check_buffer_status(struct rsi_hw *adapter, u8 q_num); --int rsi_sdio_reinit_device(struct rsi_hw *adapter); - #endif diff --git a/package/kernel/mac80211/patches/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch b/package/kernel/mac80211/patches/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch deleted file mode 100644 index 9dceea8f41e01c..00000000000000 --- a/package/kernel/mac80211/patches/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch +++ /dev/null @@ -1,132 +0,0 @@ -From: Sebastian Gottschall - -current handling of peer_bw_rxnss_override parameter is based on guessing the -VHT160/8080 capability by rx rate. this is wrong and may lead -to a non initialized peer_bw_rxnss_override parameter which is required since -VHT160 operation mode only supports 2x2 chainmasks in addition the original code -initialized the parameter with wrong masked values. -This patch uses the peer phymode and peer nss information for correct -initialisation of the peer_bw_rxnss_override parameter. -if this peer information is not available, we initialize the parameter by -minimum nss which is suggested by QCA as temporary workaround according -to the QCA sourcecodes. - -Signed-off-by: Sebastian Gottschall - -v2: remove debug messages -v3: apply some cosmetics, update documentation -v4: fix compile warning and truncate nss to maximum of 2x2 since current -chipsets only support 2x2 at vht160 -v5: handle maximum nss for chipsets supportig vht160 with 1x1 only -v7: use more simple code variant and take care about hw/sw chainmask -configuration ---- - drivers/net/wireless/ath/ath10k/mac.c | 40 +++++++++++++++------------ - drivers/net/wireless/ath/ath10k/wmi.c | 7 +---- - drivers/net/wireless/ath/ath10k/wmi.h | 14 +++++++++- - 3 files changed, 36 insertions(+), 25 deletions(-) - ---- a/drivers/net/wireless/ath/ath10k/mac.c -+++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -2466,7 +2466,7 @@ static void ath10k_peer_assoc_h_vht(stru - const u16 *vht_mcs_mask; - u8 ampdu_factor; - u8 max_nss, vht_mcs; -- int i; -+ int i, nss160; - - if (WARN_ON(ath10k_mac_vif_chan(vif, &def))) - return; -@@ -2526,23 +2526,27 @@ static void ath10k_peer_assoc_h_vht(stru - __le16_to_cpu(vht_cap->vht_mcs.tx_highest); - arg->peer_vht_rates.tx_mcs_set = ath10k_peer_assoc_h_vht_limit( - __le16_to_cpu(vht_cap->vht_mcs.tx_mcs_map), vht_mcs_mask); -+ arg->peer_bw_rxnss_override = 0; -+ nss160 = 1; /* 1x1 default config for VHT160 */ - -- ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vht peer %pM max_mpdu %d flags 0x%x\n", -- sta->addr, arg->peer_max_mpdu, arg->peer_flags); -- -- if (arg->peer_vht_rates.rx_max_rate && -- (sta->vht_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK)) { -- switch (arg->peer_vht_rates.rx_max_rate) { -- case 1560: -- /* Must be 2x2 at 160Mhz is all it can do. */ -- arg->peer_bw_rxnss_override = 2; -- break; -- case 780: -- /* Can only do 1x1 at 160Mhz (Long Guard Interval) */ -- arg->peer_bw_rxnss_override = 1; -- break; -- } -+ /* only 4x4 configuration do support 2x2 for VHT160, everything else must use 1x1 */ -+ if (ar->cfg_rx_chainmask == 15) -+ nss160 = arg->peer_num_spatial_streams <= 2 ? arg->peer_num_spatial_streams : 2; -+ -+ /* in case if peer is connected with vht160 or vht80+80, we need to properly adjust rxnss parameters otherwise firmware will raise a assert */ -+ switch(arg->peer_phymode) { -+ case MODE_11AC_VHT80_80: -+ arg->peer_bw_rxnss_override = BW_NSS_FWCONF_80_80(nss160); -+ /* fall through */ -+ case MODE_11AC_VHT160: -+ arg->peer_bw_rxnss_override |= BW_NSS_FWCONF_160(nss160); -+ break; -+ default: -+ break; - } -+ -+ ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vht peer %pM max_mpdu %d flags 0x%x peer_bw_rxnss_override 0x%x\n", -+ sta->addr, arg->peer_max_mpdu, arg->peer_flags, arg->peer_bw_rxnss_override); - } - - static void ath10k_peer_assoc_h_qos(struct ath10k *ar, -@@ -2694,9 +2698,9 @@ static int ath10k_peer_assoc_prepare(str - ath10k_peer_assoc_h_crypto(ar, vif, sta, arg); - ath10k_peer_assoc_h_rates(ar, vif, sta, arg); - ath10k_peer_assoc_h_ht(ar, vif, sta, arg); -+ ath10k_peer_assoc_h_phymode(ar, vif, sta, arg); - ath10k_peer_assoc_h_vht(ar, vif, sta, arg); - ath10k_peer_assoc_h_qos(ar, vif, sta, arg); -- ath10k_peer_assoc_h_phymode(ar, vif, sta, arg); - - return 0; - } ---- a/drivers/net/wireless/ath/ath10k/wmi.c -+++ b/drivers/net/wireless/ath/ath10k/wmi.c -@@ -6760,12 +6760,7 @@ ath10k_wmi_peer_assoc_fill_10_4(struct a - struct wmi_10_4_peer_assoc_complete_cmd *cmd = buf; - - ath10k_wmi_peer_assoc_fill_10_2(ar, buf, arg); -- if (arg->peer_bw_rxnss_override) -- cmd->peer_bw_rxnss_override = -- __cpu_to_le32((arg->peer_bw_rxnss_override - 1) | -- BIT(PEER_BW_RXNSS_OVERRIDE_OFFSET)); -- else -- cmd->peer_bw_rxnss_override = 0; -+ cmd->peer_bw_rxnss_override = __cpu_to_le32(arg->peer_bw_rxnss_override); - } - - static int ---- a/drivers/net/wireless/ath/ath10k/wmi.h -+++ b/drivers/net/wireless/ath/ath10k/wmi.h -@@ -6209,7 +6209,19 @@ struct wmi_10_2_peer_assoc_complete_cmd - __le32 info0; /* WMI_PEER_ASSOC_INFO0_ */ - } __packed; - --#define PEER_BW_RXNSS_OVERRIDE_OFFSET 31 -+#define BW_NSS_FWCONF_MAP_ENABLE (1 << 31) -+#define BW_NSS_FWCONF_MAP_160MHZ_S (0) -+#define BW_NSS_FWCONF_MAP_160MHZ_M (0x00000007) -+#define BW_NSS_FWCONF_MAP_80_80MHZ_S (3) -+#define BW_NSS_FWCONF_MAP_80_80MHZ_M (0x00000038) -+#define BW_NSS_FWCONF_MAP_M (0x0000003F) -+ -+#define GET_BW_NSS_FWCONF_160(x) ((((x) & BW_NSS_FWCONF_MAP_160MHZ_M) >> BW_NSS_FWCONF_MAP_160MHZ_S) + 1) -+#define GET_BW_NSS_FWCONF_80_80(x) ((((x) & BW_NSS_FWCONF_MAP_80_80MHZ_M) >> BW_NSS_FWCONF_MAP_80_80MHZ_S) + 1) -+ -+/* Values defined to set 160 MHz Bandwidth NSS Mapping into FW*/ -+#define BW_NSS_FWCONF_160(x) (BW_NSS_FWCONF_MAP_ENABLE | (((x - 1) << BW_NSS_FWCONF_MAP_160MHZ_S) & BW_NSS_FWCONF_MAP_160MHZ_M)) -+#define BW_NSS_FWCONF_80_80(x) (BW_NSS_FWCONF_MAP_ENABLE | (((x - 1) << BW_NSS_FWCONF_MAP_80_80MHZ_S) & BW_NSS_FWCONF_MAP_80_80MHZ_M)) - - struct wmi_10_4_peer_assoc_complete_cmd { - struct wmi_10_2_peer_assoc_complete_cmd cmd; diff --git a/package/kernel/mac80211/patches/984-fix-9531-tuningcaps.patch b/package/kernel/mac80211/patches/984-fix-9531-tuningcaps.patch deleted file mode 100644 index 6e8e10d0647531..00000000000000 --- a/package/kernel/mac80211/patches/984-fix-9531-tuningcaps.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c -+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c -@@ -3982,15 +3982,24 @@ static void ar9003_hw_apply_tuning_caps( - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - u8 tuning_caps_param = eep->baseEepHeader.params_for_tuning_caps[0]; - -- if (AR_SREV_9340(ah) || AR_SREV_9531(ah)) -+ if (AR_SREV_9340(ah)) - return; - - if (eep->baseEepHeader.featureEnable & 0x40) { - tuning_caps_param &= 0x7f; -- REG_RMW_FIELD(ah, AR_CH0_XTAL, AR_CH0_XTAL_CAPINDAC, -+ if(AR_SREV_9531(ah)) -+ { -+ REG_RMW_FIELD(ah, 0x162c0, AR_CH0_XTAL_CAPINDAC, - tuning_caps_param); -- REG_RMW_FIELD(ah, AR_CH0_XTAL, AR_CH0_XTAL_CAPOUTDAC, -+ REG_RMW_FIELD(ah, 0x162c0, AR_CH0_XTAL_CAPOUTDAC, - tuning_caps_param); -+ } -+ else{ -+ REG_RMW_FIELD(ah, AR_CH0_XTAL, AR_CH0_XTAL_CAPINDAC, -+ tuning_caps_param); -+ REG_RMW_FIELD(ah, AR_CH0_XTAL, AR_CH0_XTAL_CAPOUTDAC, -+ tuning_caps_param); -+ } - } - } - diff --git a/package/kernel/mac80211/patches/070-ath_common_config.patch b/package/kernel/mac80211/patches/ath/070-ath_common_config.patch similarity index 100% rename from package/kernel/mac80211/patches/070-ath_common_config.patch rename to package/kernel/mac80211/patches/ath/070-ath_common_config.patch diff --git a/package/kernel/mac80211/patches/080-ath10k_thermal_config.patch b/package/kernel/mac80211/patches/ath/080-ath10k_thermal_config.patch similarity index 77% rename from package/kernel/mac80211/patches/080-ath10k_thermal_config.patch rename to package/kernel/mac80211/patches/ath/080-ath10k_thermal_config.patch index 796615b03c9adb..a86cbc6e548a87 100644 --- a/package/kernel/mac80211/patches/080-ath10k_thermal_config.patch +++ b/package/kernel/mac80211/patches/ath/080-ath10k_thermal_config.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath10k/Kconfig +++ b/drivers/net/wireless/ath/ath10k/Kconfig -@@ -65,6 +65,12 @@ config ATH10K_TRACING +@@ -85,6 +85,12 @@ config ATH10K_TRACING ---help--- Select this to ath10k use tracing infrastructure. @@ -15,15 +15,15 @@ depends on ATH10K && CFG80211_CERTIFICATION_ONUS --- a/drivers/net/wireless/ath/ath10k/Makefile +++ b/drivers/net/wireless/ath/ath10k/Makefile -@@ -17,7 +17,7 @@ ath10k_core-y += mac.o \ - ath10k_core-$(CPTCFG_ATH10K_DEBUGFS) += spectral.o +@@ -18,7 +18,7 @@ ath10k_core-y += mac.o \ + ath10k_core-$(CPTCFG_ATH10K_SPECTRAL) += spectral.o ath10k_core-$(CPTCFG_NL80211_TESTMODE) += testmode.o ath10k_core-$(CPTCFG_ATH10K_TRACING) += trace.o -ath10k_core-$(CONFIG_THERMAL) += thermal.o +ath10k_core-$(CPTCFG_ATH10K_THERMAL) += thermal.o ath10k_core-$(CPTCFG_MAC80211_DEBUGFS) += debugfs_sta.o ath10k_core-$(CONFIG_PM) += wow.o - + ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o --- a/drivers/net/wireless/ath/ath10k/thermal.h +++ b/drivers/net/wireless/ath/ath10k/thermal.h @@ -36,7 +36,7 @@ struct ath10k_thermal { @@ -35,3 +35,13 @@ int ath10k_thermal_register(struct ath10k *ar); void ath10k_thermal_unregister(struct ath10k *ar); void ath10k_thermal_event_temperature(struct ath10k *ar, int temperature); +--- a/local-symbols ++++ b/local-symbols +@@ -139,6 +139,7 @@ ATH10K_SNOC= + ATH10K_DEBUG= + ATH10K_DEBUGFS= + ATH10K_SPECTRAL= ++ATH10K_THERMAL= + ATH10K_TRACING= + ATH10K_DFS_CERTIFIED= + WCN36XX= diff --git a/package/kernel/mac80211/patches/201-ath5k-WAR-for-AR71xx-PCI-bug.patch b/package/kernel/mac80211/patches/ath/201-ath5k-WAR-for-AR71xx-PCI-bug.patch similarity index 100% rename from package/kernel/mac80211/patches/201-ath5k-WAR-for-AR71xx-PCI-bug.patch rename to package/kernel/mac80211/patches/ath/201-ath5k-WAR-for-AR71xx-PCI-bug.patch diff --git a/package/kernel/mac80211/patches/350-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch b/package/kernel/mac80211/patches/ath/350-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch similarity index 89% rename from package/kernel/mac80211/patches/350-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch rename to package/kernel/mac80211/patches/ath/350-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch index a7bcfa549b0603..d648a3a3e564a3 100644 --- a/package/kernel/mac80211/patches/350-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch +++ b/package/kernel/mac80211/patches/ath/350-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch @@ -9,7 +9,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1394,8 +1394,12 @@ static bool ath9k_hw_set_reset(struct at +@@ -1435,8 +1435,12 @@ static bool ath9k_hw_set_reset(struct at if (!AR_SREV_9100(ah)) REG_WRITE(ah, AR_RC, 0); diff --git a/package/kernel/mac80211/patches/351-ath9k_hw-issue-external-reset-for-QCA955x.patch b/package/kernel/mac80211/patches/ath/351-ath9k_hw-issue-external-reset-for-QCA955x.patch similarity index 95% rename from package/kernel/mac80211/patches/351-ath9k_hw-issue-external-reset-for-QCA955x.patch rename to package/kernel/mac80211/patches/ath/351-ath9k_hw-issue-external-reset-for-QCA955x.patch index 5eb69b898d8f5a..5f265b84c26e0c 100644 --- a/package/kernel/mac80211/patches/351-ath9k_hw-issue-external-reset-for-QCA955x.patch +++ b/package/kernel/mac80211/patches/ath/351-ath9k_hw-issue-external-reset-for-QCA955x.patch @@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1271,39 +1271,56 @@ void ath9k_hw_get_delta_slope_vals(struc +@@ -1312,39 +1312,56 @@ void ath9k_hw_get_delta_slope_vals(struc *coef_exponent = coef_exp - 16; } @@ -94,7 +94,7 @@ Signed-off-by: Felix Fietkau return true; } -@@ -1356,24 +1373,24 @@ static bool ath9k_hw_set_reset(struct at +@@ -1397,24 +1414,24 @@ static bool ath9k_hw_set_reset(struct at rst_flags |= AR_RTC_RC_MAC_COLD; } diff --git a/package/kernel/mac80211/patches/354-ath9k-force-rx_clear-when-disabling-rx.patch b/package/kernel/mac80211/patches/ath/354-ath9k-force-rx_clear-when-disabling-rx.patch similarity index 100% rename from package/kernel/mac80211/patches/354-ath9k-force-rx_clear-when-disabling-rx.patch rename to package/kernel/mac80211/patches/ath/354-ath9k-force-rx_clear-when-disabling-rx.patch diff --git a/package/kernel/mac80211/patches/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch b/package/kernel/mac80211/patches/ath/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch similarity index 82% rename from package/kernel/mac80211/patches/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch rename to package/kernel/mac80211/patches/ath/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch index 35d07430eb732f..1a91265f1bd0dc 100644 --- a/package/kernel/mac80211/patches/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch +++ b/package/kernel/mac80211/patches/ath/356-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch @@ -8,17 +8,17 @@ This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411. --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -2935,7 +2935,8 @@ void ath9k_hw_apply_txpower(struct ath_h +@@ -2976,7 +2976,8 @@ void ath9k_hw_apply_txpower(struct ath_h { struct ath_regulatory *reg = ath9k_hw_regulatory(ah); struct ieee80211_channel *channel; - int chan_pwr, new_pwr; + int chan_pwr, new_pwr, max_gain; + int ant_gain, ant_reduction = 0; + u16 ctl = NO_CTL; if (!chan) - return; -@@ -2943,10 +2944,15 @@ void ath9k_hw_apply_txpower(struct ath_h +@@ -2988,9 +2989,14 @@ void ath9k_hw_apply_txpower(struct ath_h channel = chan->chan; chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER); new_pwr = min_t(int, chan_pwr, reg->power_limit); @@ -28,8 +28,7 @@ This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411. + if (ant_gain > max_gain) + ant_reduction = ant_gain - max_gain; - ah->eep_ops->set_txpower(ah, chan, - ath9k_regd_get_ctl(reg, chan), + ah->eep_ops->set_txpower(ah, chan, ctl, - get_antenna_gain(ah, chan), new_pwr, test); + ant_reduction, new_pwr, test); } diff --git a/package/kernel/mac80211/patches/ath/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch b/package/kernel/mac80211/patches/ath/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch new file mode 100644 index 00000000000000..288d4e478c790f --- /dev/null +++ b/package/kernel/mac80211/patches/ath/365-ath9k-adjust-tx-power-reduction-for-US-regulatory-do.patch @@ -0,0 +1,24 @@ +From: Felix Fietkau +Date: Wed, 19 Jul 2017 08:49:31 +0200 +Subject: [PATCH] ath9k: adjust tx power reduction for US regulatory + domain + +FCC regulatory rules allow for up to 6 dBi antenna gain. Account for +this in the EEPROM based tx power reduction code. + +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/wireless/ath/ath9k/hw.c ++++ b/drivers/net/wireless/ath/ath9k/hw.c +@@ -2995,6 +2995,10 @@ void ath9k_hw_apply_txpower(struct ath_h + if (ant_gain > max_gain) + ant_reduction = ant_gain - max_gain; + ++ /* FCC allows maximum antenna gain of 6 dBi */ ++ if (reg->region == NL80211_DFS_FCC) ++ ant_reduction = max_t(int, ant_reduction - 12, 0); ++ + ah->eep_ops->set_txpower(ah, chan, ctl, + ant_reduction, new_pwr, test); + } diff --git a/package/kernel/mac80211/patches/400-ath_move_debug_code.patch b/package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch similarity index 88% rename from package/kernel/mac80211/patches/400-ath_move_debug_code.patch rename to package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch index ed65053d7753f7..e7df0e14be5d49 100644 --- a/package/kernel/mac80211/patches/400-ath_move_debug_code.patch +++ b/package/kernel/mac80211/patches/ath/400-ath_move_debug_code.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/Makefile +++ b/drivers/net/wireless/ath/Makefile -@@ -13,10 +13,10 @@ ath-objs := main.o \ +@@ -14,10 +14,10 @@ ath-objs := main.o \ regd.o \ hw.o \ key.o \ @@ -14,7 +14,7 @@ CFLAGS_trace.o := -I$(src) --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h -@@ -318,14 +318,7 @@ void _ath_dbg(struct ath_common *common, +@@ -316,14 +316,7 @@ void _ath_dbg(struct ath_common *common, #endif /* CPTCFG_ATH_DEBUG */ /** Returns string describing opmode, or NULL if unknown mode. */ diff --git a/package/kernel/mac80211/patches/401-ath9k_blink_default.patch b/package/kernel/mac80211/patches/ath/401-ath9k_blink_default.patch similarity index 88% rename from package/kernel/mac80211/patches/401-ath9k_blink_default.patch rename to package/kernel/mac80211/patches/ath/401-ath9k_blink_default.patch index 7405e594fe64ce..3eb57bb1cf5caf 100644 --- a/package/kernel/mac80211/patches/401-ath9k_blink_default.patch +++ b/package/kernel/mac80211/patches/ath/401-ath9k_blink_default.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -47,7 +47,7 @@ int ath9k_modparam_nohwcrypt; +@@ -48,7 +48,7 @@ int ath9k_modparam_nohwcrypt; module_param_named(nohwcrypt, ath9k_modparam_nohwcrypt, int, 0444); MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption"); diff --git a/package/kernel/mac80211/patches/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch similarity index 98% rename from package/kernel/mac80211/patches/402-ath_regd_optional.patch rename to package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch index 8fa56f40a46363..03c12df1a8c411 100644 --- a/package/kernel/mac80211/patches/402-ath_regd_optional.patch +++ b/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch @@ -82,7 +82,7 @@ ---help--- --- a/local-symbols +++ b/local-symbols -@@ -87,6 +87,7 @@ ADM8211= +@@ -83,6 +83,7 @@ ADM8211= ATH_COMMON= WLAN_VENDOR_ATH= ATH_DEBUG= diff --git a/package/kernel/mac80211/patches/403-world_regd_fixup.patch b/package/kernel/mac80211/patches/ath/403-world_regd_fixup.patch similarity index 100% rename from package/kernel/mac80211/patches/403-world_regd_fixup.patch rename to package/kernel/mac80211/patches/ath/403-world_regd_fixup.patch diff --git a/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch b/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch new file mode 100644 index 00000000000000..266b750e4b31c7 --- /dev/null +++ b/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch @@ -0,0 +1,19 @@ +--- a/net/wireless/reg.c ++++ b/net/wireless/reg.c +@@ -3027,6 +3027,8 @@ void regulatory_hint_country_ie(struct w + enum environment_cap env = ENVIRON_ANY; + struct regulatory_request *request = NULL, *lr; + ++ return; ++ + /* IE len must be evenly divisible by 2 */ + if (country_ie_len & 0x01) + return; +@@ -3252,6 +3254,7 @@ static bool is_wiphy_all_set_reg_flag(en + + void regulatory_hint_disconnect(void) + { ++ return; + /* Restore of regulatory settings is not required when wiphy(s) + * ignore IE from connected access point but clearance of beacon hints + * is required when wiphy(s) supports beacon hints. diff --git a/package/kernel/mac80211/patches/405-ath_regd_us.patch b/package/kernel/mac80211/patches/ath/405-ath_regd_us.patch similarity index 83% rename from package/kernel/mac80211/patches/405-ath_regd_us.patch rename to package/kernel/mac80211/patches/ath/405-ath_regd_us.patch index cc558778099d40..8cb7f00ff94ff2 100644 --- a/package/kernel/mac80211/patches/405-ath_regd_us.patch +++ b/package/kernel/mac80211/patches/ath/405-ath_regd_us.patch @@ -8,15 +8,15 @@ FRANCE_RES = 0x31, FCC3_FCCA = 0x3A, FCC3_WORLD = 0x3B, -@@ -167,6 +168,7 @@ static struct reg_dmn_pair_mapping regDo +@@ -172,6 +173,7 @@ static struct reg_dmn_pair_mapping regDo {FCC2_WORLD, CTL_FCC, CTL_ETSI}, {FCC2_ETSIC, CTL_FCC, CTL_ETSI}, {FCC3_FCCA, CTL_FCC, CTL_FCC}, + {FCC3_FCCA_2, CTL_FCC, CTL_FCC}, {FCC3_WORLD, CTL_FCC, CTL_ETSI}, + {FCC3_ETSIC, CTL_FCC, CTL_ETSI}, {FCC4_FCCA, CTL_FCC, CTL_FCC}, - {FCC5_FCCA, CTL_FCC, CTL_FCC}, -@@ -463,6 +465,7 @@ static struct country_code_to_enum_rd al +@@ -483,6 +485,7 @@ static struct country_code_to_enum_rd al {CTRY_UAE, NULL1_WORLD, "AE"}, {CTRY_UNITED_KINGDOM, ETSI1_WORLD, "GB"}, {CTRY_UNITED_STATES, FCC3_FCCA, "US"}, diff --git a/package/kernel/mac80211/patches/406-ath_relax_default_regd.patch b/package/kernel/mac80211/patches/ath/406-ath_relax_default_regd.patch similarity index 100% rename from package/kernel/mac80211/patches/406-ath_relax_default_regd.patch rename to package/kernel/mac80211/patches/ath/406-ath_relax_default_regd.patch diff --git a/package/kernel/mac80211/patches/ath/407-regd_add_extra_country_codes.patch b/package/kernel/mac80211/patches/ath/407-regd_add_extra_country_codes.patch new file mode 100644 index 00000000000000..8f621002fe60c5 --- /dev/null +++ b/package/kernel/mac80211/patches/ath/407-regd_add_extra_country_codes.patch @@ -0,0 +1,35 @@ +From: Oever Gonzalez +Date: Mon, 7 Jan 2019 01:07:12 +0200 +Subject: [PATCH] ath: regd: add extra coutry codes + +This patch adds several country codes to the regd.h and regd_common.h +files in order to support devices whose country codes are not present in +the original list. Without this patch, all devices whose manufacturer +programmed any of these code in their EEPROM will not work. + +Signed-off-by: Oever Gonzalez +--- + +--- a/drivers/net/wireless/ath/regd.h ++++ b/drivers/net/wireless/ath/regd.h +@@ -185,7 +185,9 @@ enum CountryCode { + CTRY_UKRAINE = 804, + CTRY_UNITED_KINGDOM = 826, + CTRY_UNITED_STATES = 840, ++ CTRY_UNITED_STATES2 = 841, + CTRY_UNITED_STATES_FCC49 = 842, ++ CTRY_UNITED_STATES3 = 843, + CTRY_URUGUAY = 858, + CTRY_UZBEKISTAN = 860, + CTRY_VENEZUELA = 862, +--- a/drivers/net/wireless/ath/regd_common.h ++++ b/drivers/net/wireless/ath/regd_common.h +@@ -486,6 +486,8 @@ static struct country_code_to_enum_rd al + {CTRY_UNITED_KINGDOM, ETSI1_WORLD, "GB"}, + {CTRY_UNITED_STATES, FCC3_FCCA, "US"}, + {CTRY_UNITED_STATES, FCC3_FCCA_2, "US"}, ++ {CTRY_UNITED_STATES2, FCC3_FCCA, "US"}, ++ {CTRY_UNITED_STATES3, FCC3_FCCA, "US"}, + /* This "PS" is for US public safety actually... to support this we + * would need to assign new special alpha2 to CRDA db as with the world + * regdomain and use another alpha2 */ diff --git a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch b/package/kernel/mac80211/patches/ath/410-ath9k_allow_adhoc_and_ap.patch similarity index 83% rename from package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch rename to package/kernel/mac80211/patches/ath/410-ath9k_allow_adhoc_and_ap.patch index 86f96e8e9749c4..25c236b12c2549 100644 --- a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch +++ b/package/kernel/mac80211/patches/ath/410-ath9k_allow_adhoc_and_ap.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -777,6 +777,7 @@ static const struct ieee80211_iface_limi +@@ -833,6 +833,7 @@ static const struct ieee80211_iface_limi BIT(NL80211_IFTYPE_AP) }, { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | BIT(NL80211_IFTYPE_P2P_GO) }, diff --git a/package/kernel/mac80211/patches/411-ath5k_allow_adhoc_and_ap.patch b/package/kernel/mac80211/patches/ath/411-ath5k_allow_adhoc_and_ap.patch similarity index 100% rename from package/kernel/mac80211/patches/411-ath5k_allow_adhoc_and_ap.patch rename to package/kernel/mac80211/patches/ath/411-ath5k_allow_adhoc_and_ap.patch diff --git a/package/kernel/mac80211/patches/420-ath5k_disable_fast_cc.patch b/package/kernel/mac80211/patches/ath/420-ath5k_disable_fast_cc.patch similarity index 100% rename from package/kernel/mac80211/patches/420-ath5k_disable_fast_cc.patch rename to package/kernel/mac80211/patches/ath/420-ath5k_disable_fast_cc.patch diff --git a/package/kernel/mac80211/patches/430-add_ath5k_platform.patch b/package/kernel/mac80211/patches/ath/430-add_ath5k_platform.patch similarity index 100% rename from package/kernel/mac80211/patches/430-add_ath5k_platform.patch rename to package/kernel/mac80211/patches/ath/430-add_ath5k_platform.patch diff --git a/package/kernel/mac80211/patches/431-add_platform_eeprom_support_to_ath5k.patch b/package/kernel/mac80211/patches/ath/431-add_platform_eeprom_support_to_ath5k.patch similarity index 100% rename from package/kernel/mac80211/patches/431-add_platform_eeprom_support_to_ath5k.patch rename to package/kernel/mac80211/patches/ath/431-add_platform_eeprom_support_to_ath5k.patch diff --git a/package/kernel/mac80211/patches/432-ath5k_add_pciids.patch b/package/kernel/mac80211/patches/ath/432-ath5k_add_pciids.patch similarity index 100% rename from package/kernel/mac80211/patches/432-ath5k_add_pciids.patch rename to package/kernel/mac80211/patches/ath/432-ath5k_add_pciids.patch diff --git a/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch b/package/kernel/mac80211/patches/ath/440-ath5k_channel_bw_debugfs.patch similarity index 92% rename from package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch rename to package/kernel/mac80211/patches/ath/440-ath5k_channel_bw_debugfs.patch index 3ae01a5c35d790..57d33632744964 100644 --- a/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch +++ b/package/kernel/mac80211/patches/ath/440-ath5k_channel_bw_debugfs.patch @@ -109,16 +109,15 @@ drivers/net/wireless/ath/ath5k/debug.c | 86 ++++++++++++++++++++++++++++++++ /* debugfs: queues etc */ -@@ -1012,6 +1103,9 @@ ath5k_debug_init_device(struct ath5k_hw - debugfs_create_file("beacon", S_IWUSR | S_IRUSR, phydir, ah, - &fops_beacon); - +@@ -1016,6 +1107,8 @@ ath5k_debug_init_device(struct ath5k_hw + debugfs_create_file("queue", 0600, phydir, ah, &fops_queue); + debugfs_create_bool("32khz_clock", 0600, phydir, + &ah->ah_use_32khz_clock); + debugfs_create_file("bwmode", S_IWUSR | S_IRUSR, phydir, ah, + &fops_bwmode); -+ - debugfs_create_file("reset", S_IWUSR, phydir, ah, &fops_reset); + } - debugfs_create_file("antenna", S_IWUSR | S_IRUSR, phydir, ah, + /* functions used in other places */ --- a/drivers/net/wireless/ath/ath5k/ath5k.h +++ b/drivers/net/wireless/ath/ath5k/ath5k.h @@ -1372,6 +1372,7 @@ struct ath5k_hw { diff --git a/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch b/package/kernel/mac80211/patches/ath/500-ath9k_eeprom_debugfs.patch similarity index 100% rename from package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch rename to package/kernel/mac80211/patches/ath/500-ath9k_eeprom_debugfs.patch diff --git a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/ath/501-ath9k_ahb_init.patch similarity index 86% rename from package/kernel/mac80211/patches/501-ath9k_ahb_init.patch rename to package/kernel/mac80211/patches/ath/501-ath9k_ahb_init.patch index 53225dbc36e769..5fc60dd0ae8250 100644 --- a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch +++ b/package/kernel/mac80211/patches/ath/501-ath9k_ahb_init.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -1088,23 +1088,23 @@ static int __init ath9k_init(void) +@@ -1144,25 +1144,25 @@ static int __init ath9k_init(void) { int error; @@ -21,6 +21,8 @@ + goto err_ahb_exit; } + dmi_check_system(ath9k_quirks); + return 0; - err_pci_exit: diff --git a/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch b/package/kernel/mac80211/patches/ath/510-ath9k_intr_mitigation_tweak.patch similarity index 87% rename from package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch rename to package/kernel/mac80211/patches/ath/510-ath9k_intr_mitigation_tweak.patch index d2a3b9657065cd..75b48b480e3cfd 100644 --- a/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch +++ b/package/kernel/mac80211/patches/ath/510-ath9k_intr_mitigation_tweak.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -390,13 +390,8 @@ static void ath9k_hw_init_config(struct +@@ -403,13 +403,8 @@ static void ath9k_hw_init_config(struct ah->config.rx_intr_mitigation = true; diff --git a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch b/package/kernel/mac80211/patches/ath/511-ath9k_reduce_rxbuf.patch similarity index 100% rename from package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch rename to package/kernel/mac80211/patches/ath/511-ath9k_reduce_rxbuf.patch diff --git a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch b/package/kernel/mac80211/patches/ath/512-ath9k_channelbw_debugfs.patch similarity index 98% rename from package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch rename to package/kernel/mac80211/patches/ath/512-ath9k_channelbw_debugfs.patch index 2ebb73d689dfc6..2d4a5688c821bf 100644 --- a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch +++ b/package/kernel/mac80211/patches/ath/512-ath9k_channelbw_debugfs.patch @@ -64,7 +64,7 @@ debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy, --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h -@@ -151,6 +151,7 @@ struct ath_common { +@@ -149,6 +149,7 @@ struct ath_common { int debug_mask; enum ath_device_state state; unsigned long op_flags; diff --git a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch b/package/kernel/mac80211/patches/ath/513-ath9k_add_pci_ids.patch similarity index 87% rename from package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch rename to package/kernel/mac80211/patches/ath/513-ath9k_add_pci_ids.patch index fdeaed05e8de3b..113c35625f7975 100644 --- a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch +++ b/package/kernel/mac80211/patches/ath/513-ath9k_add_pci_ids.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -647,6 +647,7 @@ int ath9k_hw_init(struct ath_hw *ah) +@@ -663,6 +663,7 @@ int ath9k_hw_init(struct ath_hw *ah) /* These are all the AR5008/AR9001/AR9002/AR9003 hardware family of chipsets */ switch (ah->hw_version.devid) { @@ -20,7 +20,7 @@ #define AR9160_DEVID_PCI 0x0027 --- a/drivers/net/wireless/ath/ath9k/pci.c +++ b/drivers/net/wireless/ath/ath9k/pci.c -@@ -773,6 +773,7 @@ static const struct pci_device_id ath_pc +@@ -774,6 +774,7 @@ static const struct pci_device_id ath_pc .driver_data = ATH9K_PCI_BT_ANT_DIV }, #endif diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/ath/530-ath9k_extra_leds.patch similarity index 99% rename from package/kernel/mac80211/patches/530-ath9k_extra_leds.patch rename to package/kernel/mac80211/patches/ath/530-ath9k_extra_leds.patch index 8ea2f79a202e53..c13a72cbb077d8 100644 --- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch +++ b/package/kernel/mac80211/patches/ath/530-ath9k_extra_leds.patch @@ -181,7 +181,7 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -1000,7 +1000,7 @@ int ath9k_init_device(u16 devid, struct +@@ -1056,7 +1056,7 @@ int ath9k_init_device(u16 devid, struct #ifdef CPTCFG_MAC80211_LEDS /* must be initialized before ieee80211_register_hw */ diff --git a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch b/package/kernel/mac80211/patches/ath/531-ath9k_extra_platform_leds.patch similarity index 100% rename from package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch rename to package/kernel/mac80211/patches/ath/531-ath9k_extra_platform_leds.patch diff --git a/package/kernel/mac80211/patches/540-ath9k_reduce_ani_interval.patch b/package/kernel/mac80211/patches/ath/540-ath9k_reduce_ani_interval.patch similarity index 100% rename from package/kernel/mac80211/patches/540-ath9k_reduce_ani_interval.patch rename to package/kernel/mac80211/patches/ath/540-ath9k_reduce_ani_interval.patch diff --git a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/ath/542-ath9k_debugfs_diag.patch similarity index 94% rename from package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch rename to package/kernel/mac80211/patches/ath/542-ath9k_debugfs_diag.patch index 6dd03fd28a4fa6..e627c38495b832 100644 --- a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch +++ b/package/kernel/mac80211/patches/ath/542-ath9k_debugfs_diag.patch @@ -75,7 +75,7 @@ struct ath9k_hw_version { u32 magic; u16 devid; -@@ -806,6 +812,8 @@ struct ath_hw { +@@ -808,6 +814,8 @@ struct ath_hw { u32 ah_flags; s16 nf_override; @@ -84,7 +84,7 @@ bool reset_power_on; bool htc_reset_init; -@@ -1068,6 +1076,7 @@ void ath9k_hw_check_nav(struct ath_hw *a +@@ -1073,6 +1081,7 @@ void ath9k_hw_check_nav(struct ath_hw *a bool ath9k_hw_check_alive(struct ath_hw *ah); bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode); @@ -94,7 +94,7 @@ struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah, --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1842,6 +1842,20 @@ u32 ath9k_hw_get_tsf_offset(struct times +@@ -1883,6 +1883,20 @@ u32 ath9k_hw_get_tsf_offset(struct times } EXPORT_SYMBOL(ath9k_hw_get_tsf_offset); @@ -115,7 +115,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, struct ath9k_hw_cal_data *caldata, bool fastcc) { -@@ -2050,6 +2064,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st +@@ -2091,6 +2105,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st ar9003_hw_disable_phy_restart(ah); ath9k_hw_apply_gpio_override(ah); diff --git a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/ath/543-ath9k_entropy_from_adc.patch similarity index 94% rename from package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch rename to package/kernel/mac80211/patches/ath/543-ath9k_entropy_from_adc.patch index f9d3251c22da80..b0a027564a8c7c 100644 --- a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch +++ b/package/kernel/mac80211/patches/ath/543-ath9k_entropy_from_adc.patch @@ -55,7 +55,7 @@ ops->spectral_scan_config = ar9003_hw_spectral_scan_config; --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -765,7 +765,8 @@ static void ath9k_init_txpower_limits(st +@@ -821,7 +821,8 @@ static void ath9k_init_txpower_limits(st if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) ath9k_init_band_txpower(sc, NL80211_BAND_5GHZ); @@ -65,7 +65,7 @@ } static const struct ieee80211_iface_limit if_limits[] = { -@@ -960,6 +961,18 @@ static void ath9k_set_hw_capab(struct at +@@ -1016,6 +1017,18 @@ static void ath9k_set_hw_capab(struct at wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); } @@ -84,7 +84,7 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, const struct ath_bus_ops *bus_ops) { -@@ -1005,6 +1018,8 @@ int ath9k_init_device(u16 devid, struct +@@ -1061,6 +1074,8 @@ int ath9k_init_device(u16 devid, struct ARRAY_SIZE(ath9k_tpt_blink)); #endif @@ -110,7 +110,7 @@ static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable) --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c -@@ -1322,9 +1322,30 @@ void ar5008_hw_init_rate_txpower(struct +@@ -1324,9 +1324,30 @@ void ar5008_hw_init_rate_txpower(struct } } @@ -141,7 +141,7 @@ static const u32 ar5416_cca_regs[6] = { AR_PHY_CCA, AR_PHY_CH1_CCA, -@@ -1339,6 +1360,8 @@ int ar5008_hw_attach_phy_ops(struct ath_ +@@ -1341,6 +1362,8 @@ int ar5008_hw_attach_phy_ops(struct ath_ if (ret) return ret; diff --git a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch b/package/kernel/mac80211/patches/ath/544-ath9k-ar933x-usb-hang-workaround.patch similarity index 84% rename from package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch rename to package/kernel/mac80211/patches/ath/544-ath9k-ar933x-usb-hang-workaround.patch index 680bb6d590ff37..93eee34b648121 100644 --- a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch +++ b/package/kernel/mac80211/patches/ath/544-ath9k-ar933x-usb-hang-workaround.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -246,6 +246,19 @@ void ath9k_hw_get_channel_centers(struct +@@ -248,6 +248,19 @@ void ath9k_hw_get_channel_centers(struct centers->synth_center + (extoff * HT40_CHANNEL_CENTER_SHIFT); } @@ -20,7 +20,7 @@ /******************/ /* Chip Revisions */ /******************/ -@@ -1414,6 +1427,9 @@ static bool ath9k_hw_set_reset(struct at +@@ -1455,6 +1468,9 @@ static bool ath9k_hw_set_reset(struct at udelay(50); } @@ -30,7 +30,7 @@ return true; } -@@ -1513,6 +1529,9 @@ static bool ath9k_hw_chip_reset(struct a +@@ -1554,6 +1570,9 @@ static bool ath9k_hw_chip_reset(struct a ar9003_hw_internal_regulator_apply(ah); ath9k_hw_init_pll(ah, chan); @@ -40,7 +40,7 @@ return true; } -@@ -1820,8 +1839,14 @@ static int ath9k_hw_do_fastcc(struct ath +@@ -1861,8 +1880,14 @@ static int ath9k_hw_do_fastcc(struct ath if (AR_SREV_9271(ah)) ar9002_hw_load_ani_reg(ah, chan); @@ -55,7 +55,7 @@ return -EINVAL; } -@@ -2075,6 +2100,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st +@@ -2116,6 +2141,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st ath9k_hw_set_radar_params(ah); } diff --git a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch b/package/kernel/mac80211/patches/ath/545-ath9k_ani_ws_detect.patch similarity index 98% rename from package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch rename to package/kernel/mac80211/patches/ath/545-ath9k_ani_ws_detect.patch index 22a2308a0b7118..3a3f244b9d21b2 100644 --- a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch +++ b/package/kernel/mac80211/patches/ath/545-ath9k_ani_ws_detect.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c -@@ -951,55 +951,6 @@ static bool ar5008_hw_ani_control_new(st +@@ -953,55 +953,6 @@ static bool ar5008_hw_ani_control_new(st * on == 0 means more noise imm */ u32 on = param ? 1 : 0; diff --git a/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch b/package/kernel/mac80211/patches/ath/547-ath9k_led_defstate_fix.patch similarity index 100% rename from package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch rename to package/kernel/mac80211/patches/ath/547-ath9k_led_defstate_fix.patch diff --git a/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/ath/548-ath9k_enable_gpio_chip.patch similarity index 95% rename from package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch rename to package/kernel/mac80211/patches/ath/548-ath9k_enable_gpio_chip.patch index 31dac29ad77b89..eb9eb26a7481a0 100644 --- a/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch +++ b/package/kernel/mac80211/patches/ath/548-ath9k_enable_gpio_chip.patch @@ -45,7 +45,7 @@ Signed-off-by: Felix Fietkau #ifdef CPTCFG_ATH9K_DEBUGFS --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c -@@ -16,13 +16,135 @@ +@@ -16,13 +16,139 @@ #include "ath9k.h" #include @@ -126,11 +126,13 @@ Signed-off-by: Felix Fietkau + gc->sc = sc; + snprintf(gc->label, sizeof(gc->label), "ath9k-%s", + wiphy_name(sc->hw->wiphy)); ++#ifdef CONFIG_OF +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0) + gc->gchip.parent = sc->dev; +#else + gc->gchip.dev = sc->dev; +#endif ++#endif + gc->gchip.label = gc->label; + gc->gchip.base = -1; /* determine base automatically */ + gc->gchip.ngpio = ah->caps.num_gpio_pins; @@ -145,7 +147,9 @@ Signed-off-by: Felix Fietkau + return; + } + ++#ifdef CONFIG_OF + gc->gchip.owner = NULL; ++#endif + sc->gpiochip = gc; +} + @@ -183,7 +187,7 @@ Signed-off-by: Felix Fietkau static void ath_fill_led_pin(struct ath_softc *sc) { struct ath_hw *ah = sc->sc_ah; -@@ -80,6 +202,12 @@ static int ath_add_led(struct ath_softc +@@ -80,6 +206,12 @@ static int ath_add_led(struct ath_softc else ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low); @@ -196,7 +200,7 @@ Signed-off-by: Felix Fietkau return 0; } -@@ -136,17 +264,24 @@ void ath_deinit_leds(struct ath_softc *s +@@ -136,17 +268,24 @@ void ath_deinit_leds(struct ath_softc *s while (!list_empty(&sc->leds)) { led = list_first_entry(&sc->leds, struct ath_led, list); @@ -221,7 +225,7 @@ Signed-off-by: Felix Fietkau char led_name[32]; const char *trigger; int i; -@@ -156,6 +291,15 @@ void ath_init_leds(struct ath_softc *sc) +@@ -156,6 +295,15 @@ void ath_init_leds(struct ath_softc *sc) if (AR_SREV_9100(sc->sc_ah)) return; @@ -237,7 +241,7 @@ Signed-off-by: Felix Fietkau ath_fill_led_pin(sc); if (pdata && pdata->leds && pdata->num_leds) -@@ -180,6 +324,7 @@ void ath_init_leds(struct ath_softc *sc) +@@ -180,6 +328,7 @@ void ath_init_leds(struct ath_softc *sc) ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high); } diff --git a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/ath/549-ath9k_enable_gpio_buttons.patch similarity index 93% rename from package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch rename to package/kernel/mac80211/patches/ath/549-ath9k_enable_gpio_buttons.patch index e86e3e38bd69ee..bd71b75e76c1cc 100644 --- a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch +++ b/package/kernel/mac80211/patches/ath/549-ath9k_enable_gpio_buttons.patch @@ -29,7 +29,7 @@ Signed-off-by: Felix Fietkau #ifdef CPTCFG_MAC80211_LEDS -@@ -129,6 +131,67 @@ static void ath9k_unregister_gpio_chip(s +@@ -133,6 +135,67 @@ static void ath9k_unregister_gpio_chip(s sc->gpiochip = NULL; } @@ -97,7 +97,7 @@ Signed-off-by: Felix Fietkau #else /* CONFIG_GPIOLIB */ static inline void ath9k_register_gpio_chip(struct ath_softc *sc) -@@ -139,6 +202,14 @@ static inline void ath9k_unregister_gpio +@@ -143,6 +206,14 @@ static inline void ath9k_unregister_gpio { } @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau #endif /* CONFIG_GPIOLIB */ /********************************/ -@@ -262,6 +333,7 @@ void ath_deinit_leds(struct ath_softc *s +@@ -266,6 +337,7 @@ void ath_deinit_leds(struct ath_softc *s { struct ath_led *led; @@ -120,7 +120,7 @@ Signed-off-by: Felix Fietkau while (!list_empty(&sc->leds)) { led = list_first_entry(&sc->leds, struct ath_led, list); #ifdef CONFIG_GPIOLIB -@@ -301,6 +373,7 @@ void ath_init_leds(struct ath_softc *sc) +@@ -305,6 +377,7 @@ void ath_init_leds(struct ath_softc *sc) } ath_fill_led_pin(sc); diff --git a/package/kernel/mac80211/patches/550-ath9k-disable-bands-via-dt.patch b/package/kernel/mac80211/patches/ath/550-ath9k-disable-bands-via-dt.patch similarity index 88% rename from package/kernel/mac80211/patches/550-ath9k-disable-bands-via-dt.patch rename to package/kernel/mac80211/patches/ath/550-ath9k-disable-bands-via-dt.patch index 55f040f170ed4f..7d3a334c42da86 100644 --- a/package/kernel/mac80211/patches/550-ath9k-disable-bands-via-dt.patch +++ b/package/kernel/mac80211/patches/ath/550-ath9k-disable-bands-via-dt.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -571,6 +571,12 @@ static int ath9k_of_init(struct ath_soft +@@ -627,6 +627,12 @@ static int ath9k_of_init(struct ath_soft ath_dbg(common, CONFIG, "parsing configuration from OF node\n"); diff --git a/package/kernel/mac80211/patches/551-ath9k_ubnt_uap_plus_hsr.patch b/package/kernel/mac80211/patches/ath/551-ath9k_ubnt_uap_plus_hsr.patch similarity index 99% rename from package/kernel/mac80211/patches/551-ath9k_ubnt_uap_plus_hsr.patch rename to package/kernel/mac80211/patches/ath/551-ath9k_ubnt_uap_plus_hsr.patch index 82b8109e069c5f..30eba271370607 100644 --- a/package/kernel/mac80211/patches/551-ath9k_ubnt_uap_plus_hsr.patch +++ b/package/kernel/mac80211/patches/ath/551-ath9k_ubnt_uap_plus_hsr.patch @@ -365,7 +365,7 @@ * semi-random values after suspend/resume. --- a/drivers/net/wireless/ath/ath9k/Makefile +++ b/drivers/net/wireless/ath/ath9k/Makefile -@@ -16,6 +16,7 @@ ath9k-$(CPTCFG_ATH9K_DFS_CERTIFIED) += d +@@ -17,6 +17,7 @@ ath9k-$(CPTCFG_ATH9K_DFS_CERTIFIED) += d ath9k-$(CPTCFG_ATH9K_TX99) += tx99.o ath9k-$(CPTCFG_ATH9K_WOW) += wow.o ath9k-$(CPTCFG_ATH9K_HWRNG) += rng.o @@ -386,7 +386,7 @@ #endif /* _LINUX_ATH9K_PLATFORM_H */ --- a/local-symbols +++ b/local-symbols -@@ -114,6 +114,7 @@ ATH9K_WOW= +@@ -110,6 +110,7 @@ ATH9K_WOW= ATH9K_RFKILL= ATH9K_CHANNEL_CONTEXT= ATH9K_PCOEM= diff --git a/package/kernel/mac80211/patches/ath/552-ahb_of.patch b/package/kernel/mac80211/patches/ath/552-ahb_of.patch new file mode 100644 index 00000000000000..c16bf424ea2b99 --- /dev/null +++ b/package/kernel/mac80211/patches/ath/552-ahb_of.patch @@ -0,0 +1,337 @@ +--- a/drivers/net/wireless/ath/ath9k/ahb.c ++++ b/drivers/net/wireless/ath/ath9k/ahb.c +@@ -20,7 +20,15 @@ + #include + #include + #include ++#include + #include "ath9k.h" ++#include ++ ++#ifdef CONFIG_OF ++#include ++#include ++#include ++#endif + + static const struct platform_device_id ath9k_platform_id_table[] = { + { +@@ -69,6 +77,242 @@ static const struct ath_bus_ops ath_ahb_ + .eeprom_read = ath_ahb_eeprom_read, + }; + ++#ifdef CONFIG_OF ++ ++#define QCA955X_DDR_CTL_CONFIG 0x108 ++#define QCA955X_DDR_CTL_CONFIG_ACT_WMAC BIT(23) ++ ++static int of_get_wifi_cal(struct device_node *np, struct ath9k_platform_data *pdata) ++{ ++#ifdef CONFIG_MTD ++ struct device_node *mtd_np = NULL; ++ size_t retlen; ++ int size, ret; ++ struct mtd_info *mtd; ++ const char *part; ++ const __be32 *list; ++ phandle phandle; ++ ++ list = of_get_property(np, "mtd-cal-data", &size); ++ if (!list) ++ return 0; ++ ++ if (size != (2 * sizeof(*list))) ++ return 1; ++ ++ phandle = be32_to_cpup(list++); ++ if (phandle) ++ mtd_np = of_find_node_by_phandle(phandle); ++ ++ if (!mtd_np) ++ return 1; ++ ++ part = of_get_property(mtd_np, "label", NULL); ++ if (!part) ++ part = mtd_np->name; ++ ++ mtd = get_mtd_device_nm(part); ++ if (IS_ERR(mtd)) ++ return 1; ++ ++ ret = mtd_read(mtd, be32_to_cpup(list), sizeof(pdata->eeprom_data), ++ &retlen, (u8*)pdata->eeprom_data); ++ put_mtd_device(mtd); ++ ++#endif ++ return 0; ++} ++ ++static int ar913x_wmac_reset(void) ++{ ++ ath79_device_reset_set(AR913X_RESET_AMBA2WMAC); ++ mdelay(10); ++ ++ ath79_device_reset_clear(AR913X_RESET_AMBA2WMAC); ++ mdelay(10); ++ ++ return 0; ++} ++ ++static int ar933x_wmac_reset(void) ++{ ++ int retries = 20; ++ ++ ath79_device_reset_set(AR933X_RESET_WMAC); ++ ath79_device_reset_clear(AR933X_RESET_WMAC); ++ ++ while (1) { ++ u32 bootstrap; ++ ++ bootstrap = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP); ++ if ((bootstrap & AR933X_BOOTSTRAP_EEPBUSY) == 0) ++ return 0; ++ ++ if (retries-- == 0) ++ break; ++ ++ udelay(10000); ++ } ++ ++ pr_err("ar933x: WMAC reset timed out"); ++ return -ETIMEDOUT; ++} ++ ++static int qca955x_wmac_reset(void) ++{ ++ int i; ++ ++ /* Try to wait for WMAC DDR activity to stop */ ++ for (i = 0; i < 10; i++) { ++ if (!(__raw_readl(ath79_ddr_base + QCA955X_DDR_CTL_CONFIG) & ++ QCA955X_DDR_CTL_CONFIG_ACT_WMAC)) ++ break; ++ ++ udelay(10); ++ } ++ ++ ath79_device_reset_set(QCA955X_RESET_RTC); ++ udelay(10); ++ ath79_device_reset_clear(QCA955X_RESET_RTC); ++ udelay(10); ++ ++ return 0; ++} ++ ++enum { ++ AR913X_WMAC = 0, ++ AR933X_WMAC, ++ AR934X_WMAC, ++ QCA953X_WMAC, ++ QCA955X_WMAC, ++ QCA956X_WMAC, ++}; ++ ++static int ar9330_get_soc_revision(void) ++{ ++ if (ath79_soc_rev == 1) ++ return ath79_soc_rev; ++ ++ return 0; ++} ++ ++static int ath79_get_soc_revision(void) ++{ ++ return ath79_soc_rev; ++} ++ ++static const struct of_ath_ahb_data { ++ u16 dev_id; ++ u32 bootstrap_reg; ++ u32 bootstrap_ref; ++ ++ int (*soc_revision)(void); ++ int (*wmac_reset)(void); ++} of_ath_ahb_data[] = { ++ [AR913X_WMAC] = { ++ .dev_id = AR5416_AR9100_DEVID, ++ .wmac_reset = ar913x_wmac_reset, ++ ++ }, ++ [AR933X_WMAC] = { ++ .dev_id = AR9300_DEVID_AR9330, ++ .bootstrap_reg = AR933X_RESET_REG_BOOTSTRAP, ++ .bootstrap_ref = AR933X_BOOTSTRAP_REF_CLK_40, ++ .soc_revision = ar9330_get_soc_revision, ++ .wmac_reset = ar933x_wmac_reset, ++ }, ++ [AR934X_WMAC] = { ++ .dev_id = AR9300_DEVID_AR9340, ++ .bootstrap_reg = AR934X_RESET_REG_BOOTSTRAP, ++ .bootstrap_ref = AR934X_BOOTSTRAP_REF_CLK_40, ++ .soc_revision = ath79_get_soc_revision, ++ }, ++ [QCA953X_WMAC] = { ++ .dev_id = AR9300_DEVID_AR953X, ++ .bootstrap_reg = QCA953X_RESET_REG_BOOTSTRAP, ++ .bootstrap_ref = QCA953X_BOOTSTRAP_REF_CLK_40, ++ .soc_revision = ath79_get_soc_revision, ++ }, ++ [QCA955X_WMAC] = { ++ .dev_id = AR9300_DEVID_QCA955X, ++ .bootstrap_reg = QCA955X_RESET_REG_BOOTSTRAP, ++ .bootstrap_ref = QCA955X_BOOTSTRAP_REF_CLK_40, ++ .wmac_reset = qca955x_wmac_reset, ++ }, ++ [QCA956X_WMAC] = { ++ .dev_id = AR9300_DEVID_QCA956X, ++ .bootstrap_reg = QCA956X_RESET_REG_BOOTSTRAP, ++ .bootstrap_ref = QCA956X_BOOTSTRAP_REF_CLK_40, ++ .soc_revision = ath79_get_soc_revision, ++ }, ++}; ++ ++const struct of_device_id of_ath_ahb_match[] = { ++ { .compatible = "qca,ar9130-wmac", .data = &of_ath_ahb_data[AR913X_WMAC] }, ++ { .compatible = "qca,ar9330-wmac", .data = &of_ath_ahb_data[AR933X_WMAC] }, ++ { .compatible = "qca,ar9340-wmac", .data = &of_ath_ahb_data[AR934X_WMAC] }, ++ { .compatible = "qca,qca9530-wmac", .data = &of_ath_ahb_data[QCA953X_WMAC] }, ++ { .compatible = "qca,qca9550-wmac", .data = &of_ath_ahb_data[QCA955X_WMAC] }, ++ { .compatible = "qca,qca9560-wmac", .data = &of_ath_ahb_data[QCA956X_WMAC] }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, of_ath_ahb_match); ++ ++static int of_ath_ahb_probe(struct platform_device *pdev) ++{ ++ struct ath9k_platform_data *pdata; ++ const struct of_device_id *match; ++ const struct of_ath_ahb_data *data; ++ u8 led_pin; ++ ++ match = of_match_device(of_ath_ahb_match, &pdev->dev); ++ data = (const struct of_ath_ahb_data *)match->data; ++ ++ pdata = dev_get_platdata(&pdev->dev); ++ ++ if (!of_property_read_u8(pdev->dev.of_node, "qca,led-pin", &led_pin)) ++ pdata->led_pin = led_pin; ++ else ++ pdata->led_pin = -1; ++ ++ if (of_property_read_bool(pdev->dev.of_node, "qca,disable-2ghz")) ++ pdata->disable_2ghz = true; ++ ++ if (of_property_read_bool(pdev->dev.of_node, "qca,disable-5ghz")) ++ pdata->disable_5ghz = true; ++ ++ if (of_property_read_bool(pdev->dev.of_node, "qca,tx-gain-buffalo")) ++ pdata->tx_gain_buffalo = true; ++ ++ if (data->wmac_reset) { ++ data->wmac_reset(); ++ pdata->external_reset = data->wmac_reset; ++ } ++ ++ if (data->dev_id == AR9300_DEVID_AR953X) { ++ /* ++ * QCA953x only supports 25MHz refclk. ++ * Some vendors have an invalid bootstrap option ++ * set, which would break the WMAC here. ++ */ ++ pdata->is_clk_25mhz = true; ++ } else if (data->bootstrap_reg && data->bootstrap_ref) { ++ u32 t = ath79_reset_rr(data->bootstrap_reg); ++ if (t & data->bootstrap_ref) ++ pdata->is_clk_25mhz = false; ++ else ++ pdata->is_clk_25mhz = true; ++ } ++ ++ pdata->get_mac_revision = data->soc_revision; ++ ++ if (of_get_wifi_cal(pdev->dev.of_node, pdata)) ++ dev_err(&pdev->dev, "failed to load calibration data from mtd device\n"); ++ ++ return data->dev_id; ++} ++#endif ++ + static int ath_ahb_probe(struct platform_device *pdev) + { + void __iomem *mem; +@@ -80,6 +324,17 @@ static int ath_ahb_probe(struct platform + int ret = 0; + struct ath_hw *ah; + char hw_name[64]; ++ u16 dev_id; ++ ++ if (id) ++ dev_id = id->driver_data; ++ ++#ifdef CONFIG_OF ++ if (pdev->dev.of_node) ++ pdev->dev.platform_data = devm_kzalloc(&pdev->dev, ++ sizeof(struct ath9k_platform_data), ++ GFP_KERNEL); ++#endif + + if (!dev_get_platdata(&pdev->dev)) { + dev_err(&pdev->dev, "no platform data specified\n"); +@@ -122,13 +377,16 @@ static int ath_ahb_probe(struct platform + sc->mem = mem; + sc->irq = irq; + ++#ifdef CONFIG_OF ++ dev_id = of_ath_ahb_probe(pdev); ++#endif + ret = request_irq(irq, ath_isr, IRQF_SHARED, "ath9k", sc); + if (ret) { + dev_err(&pdev->dev, "request_irq failed\n"); + goto err_free_hw; + } + +- ret = ath9k_init_device(id->driver_data, sc, &ath_ahb_bus_ops); ++ ret = ath9k_init_device(dev_id, sc, &ath_ahb_bus_ops); + if (ret) { + dev_err(&pdev->dev, "failed to initialize device\n"); + goto err_irq; +@@ -159,6 +417,9 @@ static int ath_ahb_remove(struct platfor + free_irq(sc->irq, sc); + ieee80211_free_hw(sc->hw); + } ++#ifdef CONFIG_OF ++ pdev->dev.platform_data = NULL; ++#endif + + return 0; + } +@@ -168,6 +429,9 @@ static struct platform_driver ath_ahb_dr + .remove = ath_ahb_remove, + .driver = { + .name = "ath9k", ++#ifdef CONFIG_OF ++ .of_match_table = of_ath_ahb_match, ++#endif + }, + .id_table = ath9k_platform_id_table, + }; +--- a/drivers/net/wireless/ath/ath9k/ath9k.h ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + #include "common.h" + #include "debug.h" +@@ -1023,6 +1024,9 @@ struct ath_softc { + struct ath_hw *sc_ah; + void __iomem *mem; + int irq; ++#ifdef CONFIG_OF ++ struct reset_control *reset; ++#endif + spinlock_t sc_serial_rw; + spinlock_t sc_pm_lock; + spinlock_t sc_pcu_lock; diff --git a/package/kernel/mac80211/patches/ath/553-ath9k_of_gpio_mask.patch b/package/kernel/mac80211/patches/ath/553-ath9k_of_gpio_mask.patch new file mode 100644 index 00000000000000..72b99050c4cb78 --- /dev/null +++ b/package/kernel/mac80211/patches/ath/553-ath9k_of_gpio_mask.patch @@ -0,0 +1,25 @@ +--- a/drivers/net/wireless/ath/ath9k/init.c ++++ b/drivers/net/wireless/ath/ath9k/init.c +@@ -654,6 +654,12 @@ static int ath9k_of_init(struct ath_soft + return 0; + } + ++static void ath9k_of_gpio_mask(struct ath_softc *sc) ++{ ++ of_property_read_u32(sc->dev->of_node, "qca,gpio-mask", ++ &sc->sc_ah->caps.gpio_mask); ++} ++ + static int ath9k_init_softc(u16 devid, struct ath_softc *sc, + const struct ath_bus_ops *bus_ops) + { +@@ -758,6 +764,9 @@ static int ath9k_init_softc(u16 devid, s + if (ret) + goto err_hw; + ++ /* GPIO mask quirk */ ++ ath9k_of_gpio_mask(sc); ++ + ret = ath9k_init_queues(sc); + if (ret) + goto err_queues; diff --git a/package/kernel/mac80211/patches/ath/554-ath9k-dynack-move-debug-log-after-buffer-increments.patch b/package/kernel/mac80211/patches/ath/554-ath9k-dynack-move-debug-log-after-buffer-increments.patch new file mode 100644 index 00000000000000..607722cc3db1db --- /dev/null +++ b/package/kernel/mac80211/patches/ath/554-ath9k-dynack-move-debug-log-after-buffer-increments.patch @@ -0,0 +1,88 @@ +From: Lorenzo Bianconi +Date: Fri, 2 Nov 2018 21:49:56 +0100 +Subject: [PATCH] ath9k: dynack: move debug log after buffer increments + +Move debug log in ath_dynack_sample_tx_ts and ath_dynack_sample_ack_ts +after timestamp buffer head/tail increments in order to make debugging +more user friendly + +Tested-by: Koen Vandeputte +Signed-off-by: Lorenzo Bianconi +--- + +--- a/drivers/net/wireless/ath/ath9k/dynack.c ++++ b/drivers/net/wireless/ath/ath9k/dynack.c +@@ -178,11 +178,12 @@ void ath_dynack_sample_tx_ts(struct ath_ + struct ath_tx_status *ts, + struct ieee80211_sta *sta) + { +- u8 ridx; + struct ieee80211_hdr *hdr; + struct ath_dynack *da = &ah->dynack; + struct ath_common *common = ath9k_hw_common(ah); + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); ++ u32 dur = ts->duration; ++ u8 ridx; + + if (!da->enabled || (info->flags & IEEE80211_TX_CTL_NO_ACK)) + return; +@@ -217,14 +218,13 @@ void ath_dynack_sample_tx_ts(struct ath_ + ridx = ts->ts_rateindex; + + da->st_rbf.ts[da->st_rbf.t_rb].tstamp = ts->ts_tstamp; +- da->st_rbf.ts[da->st_rbf.t_rb].dur = ts->duration; + ether_addr_copy(da->st_rbf.addr[da->st_rbf.t_rb].h_dest, hdr->addr1); + ether_addr_copy(da->st_rbf.addr[da->st_rbf.t_rb].h_src, hdr->addr2); + + if (!(info->status.rates[ridx].flags & IEEE80211_TX_RC_MCS)) { +- u32 phy, sifs; + const struct ieee80211_rate *rate; + struct ieee80211_tx_rate *rates = info->status.rates; ++ u32 phy; + + rate = &common->sbands[info->band].bitrates[rates[ridx].idx]; + if (info->band == NL80211_BAND_2GHZ && +@@ -233,19 +233,18 @@ void ath_dynack_sample_tx_ts(struct ath_ + else + phy = WLAN_RC_PHY_OFDM; + +- sifs = ath_dynack_get_sifs(ah, phy); +- da->st_rbf.ts[da->st_rbf.t_rb].dur -= sifs; ++ dur -= ath_dynack_get_sifs(ah, phy); + } +- +- ath_dbg(common, DYNACK, "{%pM} tx sample %u [dur %u][h %u-t %u]\n", +- hdr->addr1, da->st_rbf.ts[da->st_rbf.t_rb].tstamp, +- da->st_rbf.ts[da->st_rbf.t_rb].dur, da->st_rbf.h_rb, +- (da->st_rbf.t_rb + 1) % ATH_DYN_BUF); ++ da->st_rbf.ts[da->st_rbf.t_rb].dur = dur; + + INCR(da->st_rbf.t_rb, ATH_DYN_BUF); + if (da->st_rbf.t_rb == da->st_rbf.h_rb) + INCR(da->st_rbf.h_rb, ATH_DYN_BUF); + ++ ath_dbg(common, DYNACK, "{%pM} tx sample %u [dur %u][h %u-t %u]\n", ++ hdr->addr1, ts->ts_tstamp, dur, da->st_rbf.h_rb, ++ da->st_rbf.t_rb); ++ + ath_dynack_compute_to(ah); + + spin_unlock_bh(&da->qlock); +@@ -272,14 +271,13 @@ void ath_dynack_sample_ack_ts(struct ath + spin_lock_bh(&da->qlock); + da->ack_rbf.tstamp[da->ack_rbf.t_rb] = ts; + +- ath_dbg(common, DYNACK, "rx sample %u [h %u-t %u]\n", +- da->ack_rbf.tstamp[da->ack_rbf.t_rb], +- da->ack_rbf.h_rb, (da->ack_rbf.t_rb + 1) % ATH_DYN_BUF); +- + INCR(da->ack_rbf.t_rb, ATH_DYN_BUF); + if (da->ack_rbf.t_rb == da->ack_rbf.h_rb) + INCR(da->ack_rbf.h_rb, ATH_DYN_BUF); + ++ ath_dbg(common, DYNACK, "rx sample %u [h %u-t %u]\n", ++ ts, da->ack_rbf.h_rb, da->ack_rbf.t_rb); ++ + ath_dynack_compute_to(ah); + + spin_unlock_bh(&da->qlock); diff --git a/package/kernel/mac80211/patches/ath/557-ath9k-dynack-remove-experimental-tag.patch b/package/kernel/mac80211/patches/ath/557-ath9k-dynack-remove-experimental-tag.patch new file mode 100644 index 00000000000000..2e4cffd1fa2695 --- /dev/null +++ b/package/kernel/mac80211/patches/ath/557-ath9k-dynack-remove-experimental-tag.patch @@ -0,0 +1,22 @@ +From: Lorenzo Bianconi +Date: Fri, 2 Nov 2018 21:49:59 +0100 +Subject: [PATCH] ath9k: dynack: remove 'experimental' tag + +Remove experimental tag from dynack Kconfig entry since it has +been tested on outdoor 25Km links + +Tested-by: Koen Vandeputte +Signed-off-by: Lorenzo Bianconi +--- + +--- a/drivers/net/wireless/ath/ath9k/Kconfig ++++ b/drivers/net/wireless/ath/ath9k/Kconfig +@@ -132,7 +132,7 @@ config ATH9K_DFS_CERTIFIED + except increase code size. + + config ATH9K_DYNACK +- bool "Atheros ath9k ACK timeout estimation algorithm (EXPERIMENTAL)" ++ bool "Atheros ath9k ACK timeout estimation algorithm" + depends on ATH9K + default n + ---help--- diff --git a/package/kernel/mac80211/patches/ath/558-ath9k-dynack-introduce-ath_dynack_set_timeout-routin.patch b/package/kernel/mac80211/patches/ath/558-ath9k-dynack-introduce-ath_dynack_set_timeout-routin.patch new file mode 100644 index 00000000000000..d765f88559ccf9 --- /dev/null +++ b/package/kernel/mac80211/patches/ath/558-ath9k-dynack-introduce-ath_dynack_set_timeout-routin.patch @@ -0,0 +1,89 @@ +From 4420866ef1b602682b009e0186fbb8aefd2125be Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Tue, 20 Aug 2019 18:20:19 +0200 +Subject: [PATCH 1/4] ath9k: dynack: introduce ath_dynack_set_timeout routine + +Introduce ath_dynack_set_timeout routine to configure slottime/ack/cts +timeouts and remove duplicated code + +Tested-by: Koen Vandeputte +Signed-off-by: Lorenzo Bianconi +--- + drivers/net/wireless/ath/ath9k/dynack.c | 37 ++++++++++++++----------- + 1 file changed, 21 insertions(+), 16 deletions(-) + +--- a/drivers/net/wireless/ath/ath9k/dynack.c ++++ b/drivers/net/wireless/ath/ath9k/dynack.c +@@ -79,6 +79,24 @@ static inline bool ath_dynack_bssidmask( + } + + /** ++ * ath_dynack_set_timeout - configure timeouts/slottime registers ++ * @ah: ath hw ++ * @to: timeout value ++ * ++ */ ++static void ath_dynack_set_timeout(struct ath_hw *ah, int to) ++{ ++ struct ath_common *common = ath9k_hw_common(ah); ++ int slottime = (to - 3) / 2; ++ ++ ath_dbg(common, DYNACK, "ACK timeout %u slottime %u\n", ++ to, slottime); ++ ath9k_hw_setslottime(ah, slottime); ++ ath9k_hw_set_ack_timeout(ah, to); ++ ath9k_hw_set_cts_timeout(ah, to); ++} ++ ++/** + * ath_dynack_compute_ackto - compute ACK timeout as the maximum STA timeout + * @ah: ath hw + * +@@ -86,7 +104,6 @@ static inline bool ath_dynack_bssidmask( + */ + static void ath_dynack_compute_ackto(struct ath_hw *ah) + { +- struct ath_common *common = ath9k_hw_common(ah); + struct ath_dynack *da = &ah->dynack; + struct ath_node *an; + int to = 0; +@@ -96,15 +113,8 @@ static void ath_dynack_compute_ackto(str + to = an->ackto; + + if (to && da->ackto != to) { +- u32 slottime; +- +- slottime = (to - 3) / 2; ++ ath_dynack_set_timeout(ah, to); + da->ackto = to; +- ath_dbg(common, DYNACK, "ACK timeout %u slottime %u\n", +- da->ackto, slottime); +- ath9k_hw_setslottime(ah, slottime); +- ath9k_hw_set_ack_timeout(ah, da->ackto); +- ath9k_hw_set_cts_timeout(ah, da->ackto); + } + } + +@@ -198,10 +208,7 @@ void ath_dynack_sample_tx_ts(struct ath_ + ieee80211_is_assoc_resp(hdr->frame_control) || + ieee80211_is_auth(hdr->frame_control)) { + ath_dbg(common, DYNACK, "late ack\n"); +- +- ath9k_hw_setslottime(ah, (LATEACK_TO - 3) / 2); +- ath9k_hw_set_ack_timeout(ah, LATEACK_TO); +- ath9k_hw_set_cts_timeout(ah, LATEACK_TO); ++ ath_dynack_set_timeout(ah, LATEACK_TO); + if (sta) { + struct ath_node *an; + +@@ -340,9 +347,7 @@ void ath_dynack_reset(struct ath_hw *ah) + da->ack_rbf.h_rb = 0; + + /* init acktimeout */ +- ath9k_hw_setslottime(ah, (ackto - 3) / 2); +- ath9k_hw_set_ack_timeout(ah, ackto); +- ath9k_hw_set_cts_timeout(ah, ackto); ++ ath_dynack_set_timeout(ah, ackto); + } + EXPORT_SYMBOL(ath_dynack_reset); + diff --git a/package/kernel/mac80211/patches/ath/559-ath9k-dynack-properly-set-last-timeout-timestamp-in-.patch b/package/kernel/mac80211/patches/ath/559-ath9k-dynack-properly-set-last-timeout-timestamp-in-.patch new file mode 100644 index 00000000000000..5a2aac27823a60 --- /dev/null +++ b/package/kernel/mac80211/patches/ath/559-ath9k-dynack-properly-set-last-timeout-timestamp-in-.patch @@ -0,0 +1,27 @@ +From e5b56ce50eab31d24df6a70cf025db3acc4aa3ac Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Tue, 20 Aug 2019 18:20:20 +0200 +Subject: [PATCH 2/4] ath9k: dynack: properly set last timeout timestamp in + ath_dynack_reset + +Add compute timeout to last computation timestamp in +ath_dynack_reset in order to not run ath_dynack_compute_ackto +immediately + +Tested-by: Koen Vandeputte +Signed-off-by: Lorenzo Bianconi +--- + drivers/net/wireless/ath/ath9k/dynack.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/ath/ath9k/dynack.c ++++ b/drivers/net/wireless/ath/ath9k/dynack.c +@@ -338,7 +338,7 @@ void ath_dynack_reset(struct ath_hw *ah) + u32 ackto = 9 + 16 + 64; + struct ath_dynack *da = &ah->dynack; + +- da->lto = jiffies; ++ da->lto = jiffies + COMPUTE_TO; + da->ackto = ackto; + + da->st_rbf.t_rb = 0; diff --git a/package/kernel/mac80211/patches/ath/560-ath9k-dynack-set-max-timeout-according-to-channel-wi.patch b/package/kernel/mac80211/patches/ath/560-ath9k-dynack-set-max-timeout-according-to-channel-wi.patch new file mode 100644 index 00000000000000..876b113aba2e2b --- /dev/null +++ b/package/kernel/mac80211/patches/ath/560-ath9k-dynack-set-max-timeout-according-to-channel-wi.patch @@ -0,0 +1,92 @@ +From 3f737abb7d53cc80d619a3b4a30b6fa63cdc8df7 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Tue, 20 Aug 2019 18:20:21 +0200 +Subject: [PATCH 3/4] ath9k: dynack: set max timeout according to channel width + +Compute maximum configurable ackimeout/ctstimeout according to channel +width (clockrate) + +Tested-by: Koen Vandeputte +Signed-off-by: Lorenzo Bianconi +--- + drivers/net/wireless/ath/ath9k/dynack.c | 38 +++++++++++++++++++------ + 1 file changed, 30 insertions(+), 8 deletions(-) + +--- a/drivers/net/wireless/ath/ath9k/dynack.c ++++ b/drivers/net/wireless/ath/ath9k/dynack.c +@@ -20,12 +20,31 @@ + + #define COMPUTE_TO (5 * HZ) + #define LATEACK_DELAY (10 * HZ) +-#define LATEACK_TO 256 +-#define MAX_DELAY 300 + #define EWMA_LEVEL 96 + #define EWMA_DIV 128 + + /** ++ * ath_dynack_get_max_to - set max timeout according to channel width ++ * @ah: ath hw ++ * ++ */ ++static u32 ath_dynack_get_max_to(struct ath_hw *ah) ++{ ++ const struct ath9k_channel *chan = ah->curchan; ++ ++ if (!chan) ++ return 300; ++ ++ if (IS_CHAN_HT40(chan)) ++ return 300; ++ if (IS_CHAN_HALF_RATE(chan)) ++ return 750; ++ if (IS_CHAN_QUARTER_RATE(chan)) ++ return 1500; ++ return 600; ++} ++ ++/** + * ath_dynack_ewma - EWMA (Exponentially Weighted Moving Average) calculation + * + */ +@@ -126,15 +145,16 @@ static void ath_dynack_compute_ackto(str + */ + static void ath_dynack_compute_to(struct ath_hw *ah) + { +- u32 ackto, ack_ts; +- u8 *dst, *src; ++ struct ath_dynack *da = &ah->dynack; ++ u32 ackto, ack_ts, max_to; + struct ieee80211_sta *sta; +- struct ath_node *an; + struct ts_info *st_ts; +- struct ath_dynack *da = &ah->dynack; ++ struct ath_node *an; ++ u8 *dst, *src; + + rcu_read_lock(); + ++ max_to = ath_dynack_get_max_to(ah); + while (da->st_rbf.h_rb != da->st_rbf.t_rb && + da->ack_rbf.h_rb != da->ack_rbf.t_rb) { + ack_ts = da->ack_rbf.tstamp[da->ack_rbf.h_rb]; +@@ -150,7 +170,7 @@ static void ath_dynack_compute_to(struct + if (ack_ts > st_ts->tstamp + st_ts->dur) { + ackto = ack_ts - st_ts->tstamp - st_ts->dur; + +- if (ackto < MAX_DELAY) { ++ if (ackto < max_to) { + sta = ieee80211_find_sta_by_ifaddr(ah->hw, dst, + src); + if (sta) { +@@ -207,8 +227,10 @@ void ath_dynack_sample_tx_ts(struct ath_ + if (ieee80211_is_assoc_req(hdr->frame_control) || + ieee80211_is_assoc_resp(hdr->frame_control) || + ieee80211_is_auth(hdr->frame_control)) { ++ u32 max_to = ath_dynack_get_max_to(ah); ++ + ath_dbg(common, DYNACK, "late ack\n"); +- ath_dynack_set_timeout(ah, LATEACK_TO); ++ ath_dynack_set_timeout(ah, max_to); + if (sta) { + struct ath_node *an; + diff --git a/package/kernel/mac80211/patches/ath/561-ath9k-dynack-set-ackto-to-max-timeout-in-ath_dynack_.patch b/package/kernel/mac80211/patches/ath/561-ath9k-dynack-set-ackto-to-max-timeout-in-ath_dynack_.patch new file mode 100644 index 00000000000000..6495bf01b00b83 --- /dev/null +++ b/package/kernel/mac80211/patches/ath/561-ath9k-dynack-set-ackto-to-max-timeout-in-ath_dynack_.patch @@ -0,0 +1,73 @@ +From cc783bfa67e87d2e6206f7626b7bbb74d5c5f269 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Tue, 20 Aug 2019 18:20:22 +0200 +Subject: [PATCH 4/4] ath9k: dynack: set ackto to max timeout in + ath_dynack_reset + +Initialize acktimeout to the maximum configurable value in +ath_dynack_reset in order to not disconnect long distance static links +enabling dynack and even to take care of possible errors configuring +a static timeout. Moreover initialize station timeout value to the current +acktimeout value + +Tested-by: Koen Vandeputte +Signed-off-by: Lorenzo Bianconi +--- + drivers/net/wireless/ath/ath9k/dynack.c | 20 +++++++++++++------- + 1 file changed, 13 insertions(+), 7 deletions(-) + +--- a/drivers/net/wireless/ath/ath9k/dynack.c ++++ b/drivers/net/wireless/ath/ath9k/dynack.c +@@ -321,11 +321,9 @@ EXPORT_SYMBOL(ath_dynack_sample_ack_ts); + */ + void ath_dynack_node_init(struct ath_hw *ah, struct ath_node *an) + { +- /* ackto = slottime + sifs + air delay */ +- u32 ackto = 9 + 16 + 64; + struct ath_dynack *da = &ah->dynack; + +- an->ackto = ackto; ++ an->ackto = da->ackto; + + spin_lock(&da->qlock); + list_add_tail(&an->list, &da->nodes); +@@ -356,20 +354,26 @@ EXPORT_SYMBOL(ath_dynack_node_deinit); + */ + void ath_dynack_reset(struct ath_hw *ah) + { +- /* ackto = slottime + sifs + air delay */ +- u32 ackto = 9 + 16 + 64; + struct ath_dynack *da = &ah->dynack; ++ struct ath_node *an; ++ ++ spin_lock_bh(&da->qlock); + + da->lto = jiffies + COMPUTE_TO; +- da->ackto = ackto; + + da->st_rbf.t_rb = 0; + da->st_rbf.h_rb = 0; + da->ack_rbf.t_rb = 0; + da->ack_rbf.h_rb = 0; + ++ da->ackto = ath_dynack_get_max_to(ah); ++ list_for_each_entry(an, &da->nodes, list) ++ an->ackto = da->ackto; ++ + /* init acktimeout */ +- ath_dynack_set_timeout(ah, ackto); ++ ath_dynack_set_timeout(ah, da->ackto); ++ ++ spin_unlock_bh(&da->qlock); + } + EXPORT_SYMBOL(ath_dynack_reset); + +@@ -386,6 +390,8 @@ void ath_dynack_init(struct ath_hw *ah) + + spin_lock_init(&da->qlock); + INIT_LIST_HEAD(&da->nodes); ++ /* ackto = slottime + sifs + air delay */ ++ da->ackto = 9 + 16 + 64; + + ah->hw->wiphy->features |= NL80211_FEATURE_ACKTO_ESTIMATION; + } diff --git a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/ath/921-ath10k_init_devices_synchronously.patch similarity index 94% rename from package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch rename to package/kernel/mac80211/patches/ath/921-ath10k_init_devices_synchronously.patch index 2c466a300c0aaa..bf9d5cbd97713c 100644 --- a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch +++ b/package/kernel/mac80211/patches/ath/921-ath10k_init_devices_synchronously.patch @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -2494,6 +2494,16 @@ int ath10k_core_register(struct ath10k * +@@ -2735,6 +2735,16 @@ int ath10k_core_register(struct ath10k * ar->chip_id = chip_id; queue_work(ar->workqueue, &ar->register_work); diff --git a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch b/package/kernel/mac80211/patches/ath/930-ath10k_add_tpt_led_trigger.patch similarity index 90% rename from package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch rename to package/kernel/mac80211/patches/ath/930-ath10k_add_tpt_led_trigger.patch index 21e7359bc96917..4bcde171a9153f 100644 --- a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch +++ b/package/kernel/mac80211/patches/ath/930-ath10k_add_tpt_led_trigger.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -8080,6 +8080,21 @@ static int ath10k_mac_init_rd(struct ath +@@ -8297,6 +8297,21 @@ static int ath10k_mac_init_rd(struct ath return 0; } @@ -22,7 +22,7 @@ int ath10k_mac_register(struct ath10k *ar) { static const u32 cipher_suites[] = { -@@ -8352,6 +8367,12 @@ int ath10k_mac_register(struct ath10k *a +@@ -8581,6 +8596,12 @@ int ath10k_mac_register(struct ath10k *a wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); diff --git a/package/kernel/mac80211/patches/ath/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch b/package/kernel/mac80211/patches/ath/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch new file mode 100644 index 00000000000000..6ff445c730169d --- /dev/null +++ b/package/kernel/mac80211/patches/ath/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch @@ -0,0 +1,144 @@ +From: Sebastian Gottschall + +current handling of peer_bw_rxnss_override parameter is based on guessing the VHT160/8080 capability by rx rate. this is wrong and may lead +to a non initialized peer_bw_rxnss_override parameter which is required since VHT160 operation mode only supports 2x2 chainmasks in addition the original code +initialized the parameter with wrong masked values. +This patch uses the peer phymode and peer nss information for correct initialisation of the peer_bw_rxnss_override parameter. +if this peer information is not available, we initialize the parameter by minimum nss which is suggested by QCA as temporary workaround according +to the QCA sourcecodes. + +Signed-off-by: Sebastian Gottschall + +v2: remove debug messages +v3: apply some cosmetics, update documentation +v4: fix compile warning and truncate nss to maximum of 2x2 since current chipsets only support 2x2 at vht160 +v5: handle maximum nss for chipsets supportig vht160 with 1x1 only +v7: use more simple code variant and take care about hw/sw chainmask configuration +v8: fix some code style issues +v9: use SM/MS macros from code.h to simplify shift/mask handling +--- + drivers/net/wireless/ath/ath10k/mac.c | 54 +++++++++++++++++++-------- + drivers/net/wireless/ath/ath10k/wmi.c | 7 +--- + drivers/net/wireless/ath/ath10k/wmi.h | 14 ++++++- + 3 files changed, 52 insertions(+), 23 deletions(-) +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -2474,7 +2474,7 @@ static void ath10k_peer_assoc_h_vht(stru + const u16 *vht_mcs_mask; + u8 ampdu_factor; + u8 max_nss, vht_mcs; +- int i; ++ int i, nss160; + + if (WARN_ON(ath10k_mac_vif_chan(vif, &def))) + return; +@@ -2534,23 +2534,45 @@ static void ath10k_peer_assoc_h_vht(stru + __le16_to_cpu(vht_cap->vht_mcs.tx_highest); + arg->peer_vht_rates.tx_mcs_set = ath10k_peer_assoc_h_vht_limit( + __le16_to_cpu(vht_cap->vht_mcs.tx_mcs_map), vht_mcs_mask); ++ arg->peer_bw_rxnss_override = 0; ++ nss160 = 1; /* 1x1 default config for VHT160 */ + +- ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vht peer %pM max_mpdu %d flags 0x%x\n", +- sta->addr, arg->peer_max_mpdu, arg->peer_flags); ++ /* only local 4x4 configuration do support 2x2 for VHT160, ++ * everything else must use 1x1 ++ */ + +- if (arg->peer_vht_rates.rx_max_rate && +- (sta->vht_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK)) { +- switch (arg->peer_vht_rates.rx_max_rate) { +- case 1560: +- /* Must be 2x2 at 160Mhz is all it can do. */ +- arg->peer_bw_rxnss_override = 2; +- break; +- case 780: +- /* Can only do 1x1 at 160Mhz (Long Guard Interval) */ +- arg->peer_bw_rxnss_override = 1; +- break; +- } ++ if (ar->cfg_rx_chainmask == 15) ++ nss160 = arg->peer_num_spatial_streams <= 2 ? 1 : 2; ++ ++ /* if peer provides 1x1 nss160 information using max rate ++ * vht information, we reduce local nss160 to 1x1. ++ * consider that it has been observed that some client ++ * devices provide zero here, no matter which transmission ++ * rate is possible. in that case the local nss configuration ++ * will be used at maxmimum configuration possible. (see above) ++ */ ++ ++ if (arg->peer_vht_rates.rx_max_rate == 780) ++ nss160 = 1; ++ ++ /* in case if peer is connected with vht160 or vht80+80, ++ * we need to properly adjust rxnss parameters otherwise ++ * firmware will raise a assert ++ */ ++ switch (arg->peer_phymode) { ++ case MODE_11AC_VHT80_80: ++ arg->peer_bw_rxnss_override = BW_NSS_FWCONF_80_80(nss160); ++ /* fall through */ ++ case MODE_11AC_VHT160: ++ arg->peer_bw_rxnss_override |= BW_NSS_FWCONF_160(nss160); ++ break; ++ default: ++ break; + } ++ ++ ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vht peer %pM max_mpdu %d flags 0x%x peer_bw_rxnss_override 0x%x\n", ++ sta->addr, arg->peer_max_mpdu, arg->peer_flags, ++ arg->peer_bw_rxnss_override); + } + + static void ath10k_peer_assoc_h_qos(struct ath10k *ar, +@@ -2702,9 +2724,9 @@ static int ath10k_peer_assoc_prepare(str + ath10k_peer_assoc_h_crypto(ar, vif, sta, arg); + ath10k_peer_assoc_h_rates(ar, vif, sta, arg); + ath10k_peer_assoc_h_ht(ar, vif, sta, arg); ++ ath10k_peer_assoc_h_phymode(ar, vif, sta, arg); + ath10k_peer_assoc_h_vht(ar, vif, sta, arg); + ath10k_peer_assoc_h_qos(ar, vif, sta, arg); +- ath10k_peer_assoc_h_phymode(ar, vif, sta, arg); + + return 0; + } +--- a/drivers/net/wireless/ath/ath10k/wmi.c ++++ b/drivers/net/wireless/ath/ath10k/wmi.c +@@ -7378,12 +7378,7 @@ ath10k_wmi_peer_assoc_fill_10_4(struct a + struct wmi_10_4_peer_assoc_complete_cmd *cmd = buf; + + ath10k_wmi_peer_assoc_fill_10_2(ar, buf, arg); +- if (arg->peer_bw_rxnss_override) +- cmd->peer_bw_rxnss_override = +- __cpu_to_le32((arg->peer_bw_rxnss_override - 1) | +- BIT(PEER_BW_RXNSS_OVERRIDE_OFFSET)); +- else +- cmd->peer_bw_rxnss_override = 0; ++ cmd->peer_bw_rxnss_override = __cpu_to_le32(arg->peer_bw_rxnss_override); + } + + static int +--- a/drivers/net/wireless/ath/ath10k/wmi.h ++++ b/drivers/net/wireless/ath/ath10k/wmi.h +@@ -6357,7 +6357,19 @@ struct wmi_10_2_peer_assoc_complete_cmd + __le32 info0; /* WMI_PEER_ASSOC_INFO0_ */ + } __packed; + +-#define PEER_BW_RXNSS_OVERRIDE_OFFSET 31 ++#define BW_NSS_FWCONF_MAP_ENABLE BIT(31) ++#define BW_NSS_FWCONF_MAP_160MHZ_LSB (0) ++#define BW_NSS_FWCONF_MAP_160MHZ_MASK (0x00000007) ++#define BW_NSS_FWCONF_MAP_80_80MHZ_LSB (3) ++#define BW_NSS_FWCONF_MAP_80_80MHZ_MASK (0x00000038) ++#define BW_NSS_FWCONF_MAP_MASK (0x0000003F) ++ ++#define GET_BW_NSS_FWCONF_160(x) (MS(x, BW_NSS_FWCONF_MAP_160MHZ) + 1) ++#define GET_BW_NSS_FWCONF_80_80(x) (MS(x, BW_NSS_FWCONF_MAP_80_80MHZ) + 1) ++ ++/* Values defined to set 160 MHz Bandwidth NSS Mapping into FW*/ ++#define BW_NSS_FWCONF_160(x) (BW_NSS_FWCONF_MAP_ENABLE | SM(x - 1, BW_NSS_FWCONF_MAP_160MHZ)) ++#define BW_NSS_FWCONF_80_80(x) (BW_NSS_FWCONF_MAP_ENABLE | SM(x - 1, BW_NSS_FWCONF_MAP_80_80MHZ)) + + struct wmi_10_4_peer_assoc_complete_cmd { + struct wmi_10_2_peer_assoc_complete_cmd cmd; diff --git a/package/kernel/mac80211/patches/973-ath10k_fix-band_center_freq-handling-for-VHT160-in-recent-firmwares.patch b/package/kernel/mac80211/patches/ath/973-ath10k_fix-band_center_freq-handling-for-VHT160-in-recent-firmwares.patch similarity index 88% rename from package/kernel/mac80211/patches/973-ath10k_fix-band_center_freq-handling-for-VHT160-in-recent-firmwares.patch rename to package/kernel/mac80211/patches/ath/973-ath10k_fix-band_center_freq-handling-for-VHT160-in-recent-firmwares.patch index 657b31f5a83ab6..4984fc66991483 100644 --- a/package/kernel/mac80211/patches/973-ath10k_fix-band_center_freq-handling-for-VHT160-in-recent-firmwares.patch +++ b/package/kernel/mac80211/patches/ath/973-ath10k_fix-band_center_freq-handling-for-VHT160-in-recent-firmwares.patch @@ -4,13 +4,16 @@ starting with firmware 10.4.3.4.x series QCA changed the handling of the channel likelly for backward compatiblity with vht80 only capable clients. this patch adjusts the handling to get vht160 to work again with official qca firmwares newer than 3.3 consider that this patch will not work with older firmwares anymore. to avoid undefined behaviour this we disable vht160 capability for outdated firmwares +Signed-off-by: Sebastian Gottschall + +v2: fix trailing whitespace issue and fix some typos within the commit note --- drivers/net/wireless/ath/ath10k/mac.c | 7 ------- drivers/net/wireless/ath/ath10k/wmi.c | 11 ++++++++--- 2 files changed, 8 insertions(+), 10 deletions(-) --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -4415,13 +4415,6 @@ static struct ieee80211_sta_vht_cap ath1 +@@ -4480,13 +4480,6 @@ static struct ieee80211_sta_vht_cap ath1 vht_cap.cap |= val; } @@ -26,7 +29,7 @@ consider that this patch will not work with older firmwares anymore. to avoid un if ((i < ar->num_rf_chains) && (ar->cfg_tx_chainmask & BIT(i))) --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c -@@ -1660,13 +1660,18 @@ void ath10k_wmi_put_wmi_channel(struct w +@@ -1677,13 +1677,18 @@ void ath10k_wmi_put_wmi_channel(struct w flags |= WMI_CHAN_FLAG_HT40_PLUS; if (arg->chan_radar) flags |= WMI_CHAN_FLAG_DFS; @@ -42,7 +45,7 @@ consider that this patch will not work with older firmwares anymore. to avoid un + if (arg->freq < arg->band_center_freq1) + ch->band_center_freq1 = __cpu_to_le32(arg->band_center_freq1 - 40); + else -+ ch->band_center_freq1 = __cpu_to_le32(arg->band_center_freq1 + 40); ++ ch->band_center_freq1 = __cpu_to_le32(arg->band_center_freq1 + 40); + ch->band_center_freq2 = __cpu_to_le32(arg->band_center_freq1); + } ch->min_power = arg->min_power; diff --git a/package/kernel/mac80211/patches/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch b/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch similarity index 78% rename from package/kernel/mac80211/patches/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch rename to package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch index ee216529f67bd5..a13fb036ad56f8 100644 --- a/package/kernel/mac80211/patches/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch +++ b/package/kernel/mac80211/patches/ath/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch @@ -83,11 +83,9 @@ v13: 12 files changed, 314 insertions(+), 1 deletion(-) create mode 100644 drivers/net/wireless/ath/ath10k/leds.c create mode 100644 drivers/net/wireless/ath/ath10k/leds.h -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/Kconfig -=================================================================== ---- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/Kconfig -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/Kconfig -@@ -56,6 +56,16 @@ config ATH10K_DEBUGFS +--- a/drivers/net/wireless/ath/ath10k/Kconfig ++++ b/drivers/net/wireless/ath/ath10k/Kconfig +@@ -69,6 +69,16 @@ config ATH10K_DEBUGFS If unsure, say Y to make it easier to debug problems. @@ -104,43 +102,37 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/Kconfig config ATH10K_SPECTRAL bool "Atheros ath10k spectral scan support" depends on ATH10K_DEBUGFS -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/Makefile -=================================================================== ---- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/Makefile -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/Makefile -@@ -18,6 +18,7 @@ ath10k_core-$(CPTCFG_ATH10K_SPECTRAL) += +--- a/drivers/net/wireless/ath/ath10k/Makefile ++++ b/drivers/net/wireless/ath/ath10k/Makefile +@@ -19,6 +19,7 @@ ath10k_core-$(CPTCFG_ATH10K_SPECTRAL) += ath10k_core-$(CPTCFG_NL80211_TESTMODE) += testmode.o ath10k_core-$(CPTCFG_ATH10K_TRACING) += trace.o ath10k_core-$(CPTCFG_ATH10K_THERMAL) += thermal.o +ath10k_core-$(CPTCFG_ATH10K_LEDS) += leds.o ath10k_core-$(CPTCFG_MAC80211_DEBUGFS) += debugfs_sta.o ath10k_core-$(CONFIG_PM) += wow.o - -Index: backports-2017-11-01/local-symbols -=================================================================== ---- backports-2017-11-01.orig/local-symbols -+++ backports-2017-11-01/local-symbols -@@ -143,6 +143,7 @@ ATH10K_USB= - ATH10K_DEBUG= + ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o +--- a/local-symbols ++++ b/local-symbols +@@ -142,6 +142,7 @@ ATH10K_DEBUG= ATH10K_DEBUGFS= ATH10K_SPECTRAL= + ATH10K_THERMAL= +ATH10K_LEDS= ATH10K_TRACING= ATH10K_DFS_CERTIFIED= WCN36XX= -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.c -=================================================================== ---- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/core.c -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.c -@@ -32,6 +32,7 @@ - #include "htt.h" +--- a/drivers/net/wireless/ath/ath10k/core.c ++++ b/drivers/net/wireless/ath/ath10k/core.c +@@ -34,6 +34,7 @@ #include "testmode.h" #include "wmi-ops.h" + #include "coredump.h" +#include "leds.h" unsigned int ath10k_debug_mask; static unsigned int ath10k_cryptmode_param; -@@ -56,6 +57,7 @@ static const struct ath10k_hw_params ath +@@ -64,6 +65,7 @@ static const struct ath10k_hw_params ath .id = QCA988X_HW_2_0_VERSION, .dev_id = QCA988X_2_0_DEVICE_ID, .name = "qca988x hw2.0", @@ -148,7 +140,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.c .patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, -@@ -80,6 +82,7 @@ static const struct ath10k_hw_params ath +@@ -131,6 +133,7 @@ static const struct ath10k_hw_params ath .id = QCA9887_HW_1_0_VERSION, .dev_id = QCA9887_1_0_DEVICE_ID, .name = "qca9887 hw1.0", @@ -156,7 +148,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.c .patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, -@@ -199,6 +202,7 @@ static const struct ath10k_hw_params ath +@@ -300,6 +303,7 @@ static const struct ath10k_hw_params ath .id = QCA99X0_HW_2_0_DEV_VERSION, .dev_id = QCA99X0_2_0_DEVICE_ID, .name = "qca99x0 hw2.0", @@ -164,7 +156,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.c .patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .otp_exe_param = 0x00000700, -@@ -228,6 +232,7 @@ static const struct ath10k_hw_params ath +@@ -339,6 +343,7 @@ static const struct ath10k_hw_params ath .id = QCA9984_HW_1_0_DEV_VERSION, .dev_id = QCA9984_1_0_DEVICE_ID, .name = "qca9984/qca9994 hw1.0", @@ -172,7 +164,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.c .patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, -@@ -262,6 +267,7 @@ static const struct ath10k_hw_params ath +@@ -383,6 +388,7 @@ static const struct ath10k_hw_params ath .id = QCA9888_HW_2_0_DEV_VERSION, .dev_id = QCA9888_2_0_DEVICE_ID, .name = "qca9888 hw2.0", @@ -180,7 +172,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.c .patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, -@@ -2254,6 +2260,10 @@ int ath10k_core_start(struct ath10k *ar, +@@ -2456,6 +2462,10 @@ int ath10k_core_start(struct ath10k *ar, if (status) goto err_hif_stop; @@ -191,7 +183,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.c return 0; err_hif_stop: -@@ -2471,9 +2481,18 @@ static void ath10k_core_register_work(st +@@ -2710,9 +2720,18 @@ static void ath10k_core_register_work(st goto err_spectral_destroy; } @@ -210,7 +202,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.c err_spectral_destroy: ath10k_spectral_destroy(ar); err_debug_destroy: -@@ -2515,6 +2534,8 @@ void ath10k_core_unregister(struct ath10 +@@ -2756,6 +2775,8 @@ void ath10k_core_unregister(struct ath10 if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags)) return; @@ -219,11 +211,9 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.c ath10k_thermal_unregister(ar); /* Stop spectral before unregistering from mac80211 to remove the * relayfs debugfs file cleanly. Otherwise the parent debugfs tree -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.h -=================================================================== ---- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/core.h -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.h -@@ -24,6 +24,7 @@ +--- a/drivers/net/wireless/ath/ath10k/core.h ++++ b/drivers/net/wireless/ath/ath10k/core.h +@@ -25,6 +25,7 @@ #include #include #include @@ -231,7 +221,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.h #include "htt.h" #include "htc.h" -@@ -789,7 +790,6 @@ struct ath10k { +@@ -908,7 +909,6 @@ struct ath10k { u32 low_5ghz_chan; u32 high_5ghz_chan; bool ani_enabled; @@ -239,7 +229,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.h bool p2p; struct { -@@ -972,6 +972,13 @@ struct ath10k { +@@ -1100,6 +1100,13 @@ struct ath10k { } testmode; struct { @@ -253,11 +243,9 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/core.h /* protected by data_lock */ u32 fw_crash_counter; u32 fw_warm_reset_counter; -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/hw.h -=================================================================== ---- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/hw.h -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/hw.h -@@ -490,6 +490,7 @@ struct ath10k_hw_params { +--- a/drivers/net/wireless/ath/ath10k/hw.h ++++ b/drivers/net/wireless/ath/ath10k/hw.h +@@ -504,6 +504,7 @@ struct ath10k_hw_params { const char *name; u32 patch_load_addr; int uart_pin; @@ -265,10 +253,8 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/hw.h u32 otp_exe_param; /* Type of hw cycle counter wraparound logic, for more info -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/leds.c -=================================================================== --- /dev/null -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/leds.c ++++ b/drivers/net/wireless/ath/ath10k/leds.c @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2005-2011 Atheros Communications Inc. @@ -373,10 +359,8 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/leds.c + led_classdev_unregister(&ar->leds.cdev); +} + -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/leds.h -=================================================================== --- /dev/null -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/leds.h ++++ b/drivers/net/wireless/ath/ath10k/leds.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2018, The Linux Foundation. All rights reserved. @@ -419,11 +403,9 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/leds.h + +#endif +#endif /* _LEDS_H_ */ -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/mac.c -=================================================================== ---- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/mac.c -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/mac.c -@@ -32,6 +32,7 @@ +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -34,6 +34,7 @@ #include "wmi-tlv.h" #include "wmi-ops.h" #include "wow.h" @@ -431,22 +413,20 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/mac.c /*********/ /* Rates */ -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi-ops.h -=================================================================== ---- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/wmi-ops.h -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi-ops.h -@@ -197,6 +197,10 @@ struct wmi_ops { - (struct ath10k *ar, - enum wmi_bss_survey_req_type type); +--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h ++++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h +@@ -216,7 +216,10 @@ struct wmi_ops { struct sk_buff *(*gen_echo)(struct ath10k *ar, u32 value); + struct sk_buff *(*gen_pdev_get_tpc_table_cmdid)(struct ath10k *ar, + u32 param); + struct sk_buff *(*gen_gpio_config)(struct ath10k *ar, u32 gpio_num, + u32 input, u32 pull_type, u32 intr_mode); -+ + + struct sk_buff *(*gen_gpio_output)(struct ath10k *ar, u32 gpio_num, u32 set); }; int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id); -@@ -951,6 +955,35 @@ ath10k_wmi_force_fw_hang(struct ath10k * +@@ -1054,6 +1057,35 @@ ath10k_wmi_force_fw_hang(struct ath10k * return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->force_fw_hang_cmdid); } @@ -482,11 +462,9 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi-ops.h static inline int ath10k_wmi_dbglog_cfg(struct ath10k *ar, u64 module_enable, u32 log_level) { -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi-tlv.c -=================================================================== ---- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/wmi-tlv.c -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi-tlv.c -@@ -3619,6 +3619,8 @@ static const struct wmi_ops wmi_tlv_ops +--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c ++++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c +@@ -3976,6 +3976,8 @@ static const struct wmi_ops wmi_tlv_ops .gen_echo = ath10k_wmi_tlv_op_gen_echo, .gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf, .gen_vdev_spectral_enable = ath10k_wmi_tlv_op_gen_vdev_spectral_enable, @@ -495,11 +473,9 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi-tlv.c }; static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = { -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.c -=================================================================== ---- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/wmi.c -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.c -@@ -6580,6 +6580,49 @@ ath10k_wmi_op_gen_peer_set_param(struct +--- a/drivers/net/wireless/ath/ath10k/wmi.c ++++ b/drivers/net/wireless/ath/ath10k/wmi.c +@@ -7198,6 +7198,49 @@ ath10k_wmi_op_gen_peer_set_param(struct return skb; } @@ -549,7 +525,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.c static struct sk_buff * ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id, enum wmi_sta_ps_mode psmode) -@@ -8081,6 +8124,9 @@ static const struct wmi_ops wmi_ops = { +@@ -8809,6 +8852,9 @@ static const struct wmi_ops wmi_ops = { .fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, .gen_echo = ath10k_wmi_op_gen_echo, @@ -559,7 +535,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.c /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -8151,6 +8197,8 @@ static const struct wmi_ops wmi_10_1_ops +@@ -8879,6 +8925,8 @@ static const struct wmi_ops wmi_10_1_ops .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, .gen_echo = ath10k_wmi_op_gen_echo, @@ -568,7 +544,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.c /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -8222,6 +8270,8 @@ static const struct wmi_ops wmi_10_2_ops +@@ -8950,6 +8998,8 @@ static const struct wmi_ops wmi_10_2_ops .gen_delba_send = ath10k_wmi_op_gen_delba_send, .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, @@ -577,7 +553,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.c /* .gen_pdev_enable_adaptive_cca not implemented */ }; -@@ -8292,6 +8342,8 @@ static const struct wmi_ops wmi_10_2_4_o +@@ -9020,6 +9070,8 @@ static const struct wmi_ops wmi_10_2_4_o .gen_pdev_enable_adaptive_cca = ath10k_wmi_op_gen_pdev_enable_adaptive_cca, .get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype, @@ -586,7 +562,7 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.c /* .gen_bcn_tmpl not implemented */ /* .gen_prb_tmpl not implemented */ /* .gen_p2p_go_bcn_ie not implemented */ -@@ -8367,6 +8419,8 @@ static const struct wmi_ops wmi_10_4_ops +@@ -9099,6 +9151,8 @@ static const struct wmi_ops wmi_10_4_ops .gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info, .gen_echo = ath10k_wmi_op_gen_echo, .gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config, @@ -595,11 +571,9 @@ Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.c }; int ath10k_wmi_attach(struct ath10k *ar) -Index: backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.h -=================================================================== ---- backports-2017-11-01.orig/drivers/net/wireless/ath/ath10k/wmi.h -+++ backports-2017-11-01/drivers/net/wireless/ath/ath10k/wmi.h -@@ -2899,6 +2899,41 @@ enum wmi_10_4_feature_mask { +--- a/drivers/net/wireless/ath/ath10k/wmi.h ++++ b/drivers/net/wireless/ath/ath10k/wmi.h +@@ -2942,6 +2942,41 @@ enum wmi_10_4_feature_mask { }; diff --git a/package/kernel/mac80211/patches/ath/975-ath10k-use-tpt-trigger-by-default.patch b/package/kernel/mac80211/patches/ath/975-ath10k-use-tpt-trigger-by-default.patch new file mode 100644 index 00000000000000..e60a213a3076f2 --- /dev/null +++ b/package/kernel/mac80211/patches/ath/975-ath10k-use-tpt-trigger-by-default.patch @@ -0,0 +1,53 @@ +From 79c9d7aabae1d1da9eea97d83b61e1517a8a2221 Mon Sep 17 00:00:00 2001 +From: Mathias Kresin +Date: Fri, 22 Jun 2018 18:59:44 +0200 +Subject: [PATCH] ath10k: use tpt LED trigger by default + +Use the tpt LED trigger for each created phy led. Ths way LEDs attached +to the ath10k GPIO pins are indicating the phy status and blink on +traffic. + +Signed-off-by: Mathias Kresin +--- + drivers/net/wireless/ath/ath10k/core.h | 4 ++++ + drivers/net/wireless/ath/ath10k/leds.c | 4 +--- + drivers/net/wireless/ath/ath10k/mac.c | 2 +- + 3 files changed, 6 insertions(+), 4 deletions(-) + +--- a/drivers/net/wireless/ath/ath10k/core.h ++++ b/drivers/net/wireless/ath/ath10k/core.h +@@ -1145,6 +1145,10 @@ struct ath10k { + struct ath10k_radar_found_info last_radar_info; + struct work_struct radar_confirmation_work; + ++#ifdef CPTCFG_MAC80211_LEDS ++ const char *led_default_trigger; ++#endif ++ + /* must be last */ + u8 drv_priv[0] __aligned(sizeof(void *)); + }; +--- a/drivers/net/wireless/ath/ath10k/leds.c ++++ b/drivers/net/wireless/ath/ath10k/leds.c +@@ -81,9 +81,7 @@ int ath10k_leds_register(struct ath10k * + + ar->leds.cdev.name = ar->leds.label; + ar->leds.cdev.brightness_set_blocking = ath10k_leds_set_brightness_blocking; +- +- /* FIXME: this assignment doesn't make sense as it's NULL, remove it? */ +- ar->leds.cdev.default_trigger = ar->leds.wifi_led.default_trigger; ++ ar->leds.cdev.default_trigger = ar->led_default_trigger; + + ret = led_classdev_register(wiphy_dev(ar->hw->wiphy), &ar->leds.cdev); + if (ret) +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -8613,7 +8613,7 @@ int ath10k_mac_register(struct ath10k *a + wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); + + #ifdef CPTCFG_MAC80211_LEDS +- ieee80211_create_tpt_led_trigger(ar->hw, ++ ar->led_default_trigger = ieee80211_create_tpt_led_trigger(ar->hw, + IEEE80211_TPT_LEDTRIG_FL_RADIO, ath10k_tpt_blink, + ARRAY_SIZE(ath10k_tpt_blink)); + #endif diff --git a/package/kernel/mac80211/patches/ath/977-ath10k-add-support-for-configuring-management-packet.patch b/package/kernel/mac80211/patches/ath/977-ath10k-add-support-for-configuring-management-packet.patch new file mode 100644 index 00000000000000..a750e232df0533 --- /dev/null +++ b/package/kernel/mac80211/patches/ath/977-ath10k-add-support-for-configuring-management-packet.patch @@ -0,0 +1,89 @@ +From: Sriram R +Date: Mon, 10 Sep 2018 11:09:40 +0530 +Subject: [PATCH] ath10k: add support for configuring management packet rate + +By default the firmware uses 1Mbps and 6Mbps rate for management packets +in 2G and 5G bands respectively. But when the user selects different +basic rates from the userspace, we need to send the management +packets at the lowest basic rate selected by the user. + +This change makes use of WMI_VDEV_PARAM_MGMT_RATE param for configuring the +management packets rate to the firmware. + +Chipsets Tested : QCA988X, QCA9887, QCA9984 +FW Tested : 10.2.4-1.0-41, 10.4-3.6.104 + +Signed-off-by: Sriram R +Signed-off-by: Kalle Valo + +Origin: backport, https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f279294e9ee22a8f306fdc8e4181cf555e6f0f70 +--- +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -158,6 +158,22 @@ u8 ath10k_mac_bitrate_to_idx(const struc + return 0; + } + ++static int ath10k_mac_get_rate_hw_value(int bitrate) ++{ ++ int i; ++ u8 hw_value_prefix = 0; ++ ++ if (ath10k_mac_bitrate_is_cck(bitrate)) ++ hw_value_prefix = WMI_RATE_PREAMBLE_CCK << 6; ++ ++ for (i = 0; i < sizeof(ath10k_rates); i++) { ++ if (ath10k_rates[i].bitrate == bitrate) ++ return hw_value_prefix | ath10k_rates[i].hw_value; ++ } ++ ++ return -EINVAL; ++} ++ + static int ath10k_mac_get_max_vht_mcs_map(u16 mcs_map, int nss) + { + switch ((mcs_map >> (2 * nss)) & 0x3) { +@@ -5482,9 +5498,10 @@ static void ath10k_bss_info_changed(stru + struct cfg80211_chan_def def; + u32 vdev_param, pdev_param, slottime, preamble; + u16 bitrate, hw_value; +- u8 rate; +- int rateidx, ret = 0; ++ u8 rate, basic_rate_idx; ++ int rateidx, ret = 0, hw_rate_code; + enum nl80211_band band; ++ const struct ieee80211_supported_band *sband; + + mutex_lock(&ar->conf_mutex); + +@@ -5690,6 +5707,30 @@ static void ath10k_bss_info_changed(stru + arvif->vdev_id, ret); + } + ++ if (changed & BSS_CHANGED_BASIC_RATES) { ++ if (WARN_ON(ath10k_mac_vif_chan(vif, &def))) { ++ mutex_unlock(&ar->conf_mutex); ++ return; ++ } ++ ++ sband = ar->hw->wiphy->bands[def.chan->band]; ++ basic_rate_idx = ffs(vif->bss_conf.basic_rates) - 1; ++ bitrate = sband->bitrates[basic_rate_idx].bitrate; ++ ++ hw_rate_code = ath10k_mac_get_rate_hw_value(bitrate); ++ if (hw_rate_code < 0) { ++ ath10k_warn(ar, "bitrate not supported %d\n", bitrate); ++ mutex_unlock(&ar->conf_mutex); ++ return; ++ } ++ ++ vdev_param = ar->wmi.vdev_param->mgmt_rate; ++ ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, ++ hw_rate_code); ++ if (ret) ++ ath10k_warn(ar, "failed to set mgmt tx rate %d\n", ret); ++ } ++ + mutex_unlock(&ar->conf_mutex); + } + diff --git a/package/kernel/mac80211/patches/ath/978-ath10k-fix-possible-out-of-bound-access-of-ath10k_ra.patch b/package/kernel/mac80211/patches/ath/978-ath10k-fix-possible-out-of-bound-access-of-ath10k_ra.patch new file mode 100644 index 00000000000000..218301ca3a4f5d --- /dev/null +++ b/package/kernel/mac80211/patches/ath/978-ath10k-fix-possible-out-of-bound-access-of-ath10k_ra.patch @@ -0,0 +1,66 @@ +From: Sriram R +Date: Wed, 3 Oct 2018 08:43:50 +0530 +Subject: [PATCH] ath10k: fix possible out of bound access of ath10k_rates array + +While using 'ath10k_mac_get_rate_hw_value()' to obtain the hw value +from the passed bitrate, there is a chance of out of bound array access +when wrong bitrate is passed. This is fixed by comparing the bitrates +within the correct size of the ath10k_rates array. + +Fixes commit f279294e9ee2 ("ath10k: add support for configuring management +packet rate"). Also correction made to some indents used in the above commit. + +Signed-off-by: Sriram R +Signed-off-by: Kalle Valo + +Origin: backport, https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=34e141eea7dd8525dd1ef7a925459e455b4d307f +--- +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -166,7 +166,7 @@ static int ath10k_mac_get_rate_hw_value( + if (ath10k_mac_bitrate_is_cck(bitrate)) + hw_value_prefix = WMI_RATE_PREAMBLE_CCK << 6; + +- for (i = 0; i < sizeof(ath10k_rates); i++) { ++ for (i = 0; i < ARRAY_SIZE(ath10k_rates); i++) { + if (ath10k_rates[i].bitrate == bitrate) + return hw_value_prefix | ath10k_rates[i].hw_value; + } +@@ -5713,22 +5713,22 @@ static void ath10k_bss_info_changed(stru + return; + } + +- sband = ar->hw->wiphy->bands[def.chan->band]; +- basic_rate_idx = ffs(vif->bss_conf.basic_rates) - 1; +- bitrate = sband->bitrates[basic_rate_idx].bitrate; +- +- hw_rate_code = ath10k_mac_get_rate_hw_value(bitrate); +- if (hw_rate_code < 0) { +- ath10k_warn(ar, "bitrate not supported %d\n", bitrate); +- mutex_unlock(&ar->conf_mutex); +- return; +- } ++ sband = ar->hw->wiphy->bands[def.chan->band]; ++ basic_rate_idx = ffs(vif->bss_conf.basic_rates) - 1; ++ bitrate = sband->bitrates[basic_rate_idx].bitrate; ++ ++ hw_rate_code = ath10k_mac_get_rate_hw_value(bitrate); ++ if (hw_rate_code < 0) { ++ ath10k_warn(ar, "bitrate not supported %d\n", bitrate); ++ mutex_unlock(&ar->conf_mutex); ++ return; ++ } + +- vdev_param = ar->wmi.vdev_param->mgmt_rate; +- ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, +- hw_rate_code); +- if (ret) +- ath10k_warn(ar, "failed to set mgmt tx rate %d\n", ret); ++ vdev_param = ar->wmi.vdev_param->mgmt_rate; ++ ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, ++ hw_rate_code); ++ if (ret) ++ ath10k_warn(ar, "failed to set mgmt tx rate %d\n", ret); + } + + mutex_unlock(&ar->conf_mutex); diff --git a/package/kernel/mac80211/patches/ath/979-ath10k-fix-incorrect-multicast-broadcast-rate-settin.patch b/package/kernel/mac80211/patches/ath/979-ath10k-fix-incorrect-multicast-broadcast-rate-settin.patch new file mode 100644 index 00000000000000..58422304b63fa6 --- /dev/null +++ b/package/kernel/mac80211/patches/ath/979-ath10k-fix-incorrect-multicast-broadcast-rate-settin.patch @@ -0,0 +1,43 @@ +From: Pradeep kumar Chitrapu +Date: Mon, 10 Dec 2018 20:56:11 -0800 +Subject: ath10k: fix incorrect multicast/broadcast rate setting + +Invalid rate code is sent to firmware when multicast rate value of 0 is +sent to driver indicating disabled case, causing broken mesh path. +so fix that. + +Tested on QCA9984 with firmware 10.4-3.6.1-00827 + +Fixes: cd93b83ad92 ("ath10k: support for multicast rate control") +Co-developed-by: Zhi Chen +Signed-off-by: Zhi Chen +Signed-off-by: Pradeep Kumar Chitrapu + +Origin: other, https://patchwork.kernel.org/patch/10723033/ + +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -5498,8 +5498,8 @@ static void ath10k_bss_info_changed(stru + struct cfg80211_chan_def def; + u32 vdev_param, pdev_param, slottime, preamble; + u16 bitrate, hw_value; +- u8 rate, basic_rate_idx; +- int rateidx, ret = 0, hw_rate_code; ++ u8 rate, basic_rate_idx, rateidx; ++ int ret = 0, hw_rate_code, mcast_rate; + enum nl80211_band band; + const struct ieee80211_supported_band *sband; + +@@ -5672,7 +5672,11 @@ static void ath10k_bss_info_changed(stru + if (changed & BSS_CHANGED_MCAST_RATE && + !ath10k_mac_vif_chan(arvif->vif, &def)) { + band = def.chan->band; +- rateidx = vif->bss_conf.mcast_rate[band] - 1; ++ mcast_rate = vif->bss_conf.mcast_rate[band]; ++ if (mcast_rate > 0) ++ rateidx = mcast_rate - 1; ++ else ++ rateidx = ffs(vif->bss_conf.basic_rates) - 1; + + if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) + rateidx += ATH10K_MAC_FIRST_OFDM_RATE_IDX; diff --git a/package/kernel/mac80211/patches/ath/980-ath10k-fix-max-antenna-gain-unit.patch b/package/kernel/mac80211/patches/ath/980-ath10k-fix-max-antenna-gain-unit.patch new file mode 100644 index 00000000000000..8a675e4fb100c5 --- /dev/null +++ b/package/kernel/mac80211/patches/ath/980-ath10k-fix-max-antenna-gain-unit.patch @@ -0,0 +1,49 @@ +From: Sven Eckelmann +Date: Tue, 11 Jun 2019 13:58:35 +0200 +Subject: ath10k: fix max antenna gain unit + +Most of the txpower for the ath10k firmware is stored as twicepower (0.5 dB +steps). This isn't the case for max_antenna_gain - which is still expected +by the firmware as dB. + +The firmware is converting it from dB to the internal (twicepower) +representation when it calculates the limits of a channel. This can be seen +in tpc_stats when configuring "12" as max_antenna_gain. Instead of the +expected 12 (6 dB), the tpc_stats shows 24 (12 dB). + +Tested on QCA9888 and IPQ4019 with firmware 10.4-3.5.3-00057. + +Fixes: 02256930d9b8 ("ath10k: use proper tx power unit") +Signed-off-by: Sven Eckelmann + +Forwarded: https://patchwork.kernel.org/patch/10986723/ + +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -1020,7 +1020,7 @@ static int ath10k_monitor_vdev_start(str + arg.channel.min_power = 0; + arg.channel.max_power = channel->max_power * 2; + arg.channel.max_reg_power = channel->max_reg_power * 2; +- arg.channel.max_antenna_gain = channel->max_antenna_gain * 2; ++ arg.channel.max_antenna_gain = channel->max_antenna_gain; + + reinit_completion(&ar->vdev_setup_done); + +@@ -1462,7 +1462,7 @@ static int ath10k_vdev_start_restart(str + arg.channel.min_power = 0; + arg.channel.max_power = chandef->chan->max_power * 2; + arg.channel.max_reg_power = chandef->chan->max_reg_power * 2; +- arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain * 2; ++ arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain; + + if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { + arg.ssid = arvif->u.ap.ssid; +@@ -3143,7 +3143,7 @@ static int ath10k_update_channel_list(st + ch->min_power = 0; + ch->max_power = channel->max_power * 2; + ch->max_reg_power = channel->max_reg_power * 2; +- ch->max_antenna_gain = channel->max_antenna_gain * 2; ++ ch->max_antenna_gain = channel->max_antenna_gain; + ch->reg_class_id = 0; /* FIXME */ + + /* FIXME: why use only legacy modes, why not any diff --git a/package/kernel/mac80211/patches/ath/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch b/package/kernel/mac80211/patches/ath/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch new file mode 100644 index 00000000000000..32b2d681d51e8c --- /dev/null +++ b/package/kernel/mac80211/patches/ath/981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch @@ -0,0 +1,101 @@ +From: Sven Eckelmann +Date: Wed, 28 Nov 2018 16:16:27 +0100 +Subject: ath10k: adjust tx power reduction for US regulatory domain + +FCC allows maximum antenna gain of 6 dBi. 15.247(b)(4): + +> (4) The conducted output power limit +> specified in paragraph (b) of this section +> is based on the use of antennas +> with directional gains that do not exceed +> 6 dBi. Except as shown in paragraph +> (c) of this section, if transmitting +> antennas of directional gain greater +> than 6 dBi are used, the conducted +> output power from the intentional radiator +> shall be reduced below the stated +> values in paragraphs (b)(1), (b)(2), +> and (b)(3) of this section, as appropriate, +> by the amount in dB that the +> directional gain of the antenna exceeds +> 6 dBi. + +https://www.gpo.gov/fdsys/pkg/CFR-2013-title47-vol1/pdf/CFR-2013-title47-vol1-sec15-247.pdf + +Signed-off-by: Sven Eckelmann + +Forwarded: no + +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -988,6 +988,40 @@ static inline int ath10k_vdev_setup_sync + return ar->last_wmi_vdev_start_status; + } + ++static u32 ath10k_get_max_antenna_gain(struct ath10k *ar, ++ u32 ch_max_antenna_gain) ++{ ++ u32 max_antenna_gain; ++ ++ if (ar->dfs_detector && ar->dfs_detector->region == NL80211_DFS_FCC) { ++ /* FCC allows maximum antenna gain of 6 dBi. 15.247(b)(4): ++ * ++ * > (4) The conducted output power limit ++ * > specified in paragraph (b) of this section ++ * > is based on the use of antennas ++ * > with directional gains that do not exceed ++ * > 6 dBi. Except as shown in paragraph ++ * > (c) of this section, if transmitting ++ * > antennas of directional gain greater ++ * > than 6 dBi are used, the conducted ++ * > output power from the intentional radiator ++ * > shall be reduced below the stated ++ * > values in paragraphs (b)(1), (b)(2), ++ * > and (b)(3) of this section, as appropriate, ++ * > by the amount in dB that the ++ * > directional gain of the antenna exceeds ++ * > 6 dBi. ++ * ++ * https://www.gpo.gov/fdsys/pkg/CFR-2013-title47-vol1/pdf/CFR-2013-title47-vol1-sec15-247.pdf ++ */ ++ max_antenna_gain = 6; ++ } else { ++ max_antenna_gain = 0; ++ } ++ ++ return max(ch_max_antenna_gain, max_antenna_gain); ++} ++ + static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id) + { + struct cfg80211_chan_def *chandef = NULL; +@@ -1020,7 +1054,8 @@ static int ath10k_monitor_vdev_start(str + arg.channel.min_power = 0; + arg.channel.max_power = channel->max_power * 2; + arg.channel.max_reg_power = channel->max_reg_power * 2; +- arg.channel.max_antenna_gain = channel->max_antenna_gain; ++ arg.channel.max_antenna_gain = ath10k_get_max_antenna_gain(ar, ++ channel->max_antenna_gain); + + reinit_completion(&ar->vdev_setup_done); + +@@ -1462,7 +1497,8 @@ static int ath10k_vdev_start_restart(str + arg.channel.min_power = 0; + arg.channel.max_power = chandef->chan->max_power * 2; + arg.channel.max_reg_power = chandef->chan->max_reg_power * 2; +- arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain; ++ arg.channel.max_antenna_gain = ath10k_get_max_antenna_gain(ar, ++ chandef->chan->max_antenna_gain); + + if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { + arg.ssid = arvif->u.ap.ssid; +@@ -3143,7 +3179,8 @@ static int ath10k_update_channel_list(st + ch->min_power = 0; + ch->max_power = channel->max_power * 2; + ch->max_reg_power = channel->max_reg_power * 2; +- ch->max_antenna_gain = channel->max_antenna_gain; ++ ch->max_antenna_gain = ath10k_get_max_antenna_gain(ar, ++ channel->max_antenna_gain); + ch->reg_class_id = 0; /* FIXME */ + + /* FIXME: why use only legacy modes, why not any diff --git a/package/kernel/mac80211/patches/ath/983-ath10k-allow-vht-on-2g.patch b/package/kernel/mac80211/patches/ath/983-ath10k-allow-vht-on-2g.patch new file mode 100644 index 00000000000000..eeca88a613fbf1 --- /dev/null +++ b/package/kernel/mac80211/patches/ath/983-ath10k-allow-vht-on-2g.patch @@ -0,0 +1,10 @@ +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -4718,6 +4718,7 @@ static void ath10k_mac_setup_ht_vht_cap( + if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) { + band = &ar->mac.sbands[NL80211_BAND_2GHZ]; + band->ht_cap = ht_cap; ++ band->vht_cap = vht_cap; + } + if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) { + band = &ar->mac.sbands[NL80211_BAND_5GHZ]; diff --git a/package/kernel/mac80211/patches/ath/998-ignore-peer-stats-debug-info.patch b/package/kernel/mac80211/patches/ath/998-ignore-peer-stats-debug-info.patch new file mode 100644 index 00000000000000..6c315bd9906589 --- /dev/null +++ b/package/kernel/mac80211/patches/ath/998-ignore-peer-stats-debug-info.patch @@ -0,0 +1,49 @@ +diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c +index 7d295ee71534..50670d651cff 100644 +--- a/drivers/net/wireless/ath/ath10k/htt_rx.c ++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c +@@ -2520,7 +2520,7 @@ + sgi = ATH10K_HW_GI(peer_stats->flags); + + if (txrate.flags == WMI_RATE_PREAMBLE_VHT && txrate.mcs > 9) { +- ath10k_warn(ar, "Invalid VHT mcs %hhd peer stats", txrate.mcs); ++ + return; + } + +@@ -2578,7 +2578,7 @@ + ppdu_len = resp->peer_tx_stats.ppdu_len * sizeof(__le32); + + if (skb->len < sizeof(struct htt_resp_hdr) + num_ppdu * ppdu_len) { +- ath10k_warn(ar, "Invalid peer stats buf length %d\n", skb->len); ++ + return; + } + +@@ -2590,8 +2590,8 @@ + spin_lock_bh(&ar->data_lock); + peer = ath10k_peer_find_by_id(ar, peer_id); + if (!peer || !peer->sta) { +- ath10k_warn(ar, "Invalid peer id %d peer stats buffer\n", +- peer_id); ++ ++ + goto out; + } + + +diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c +--- a/drivers/net/wireless/ath/ath10k/txrx.c ++++ b/drivers/net/wireless/ath/ath10k/txrx.c +@@ -261,8 +261,8 @@ + spin_lock_bh(&ar->data_lock); + peer = ath10k_peer_find_by_id(ar, ev->peer_id); + if (!peer) { +- ath10k_warn(ar, "peer-unmap-event: unknown peer id %d\n", +- ev->peer_id); ++ ++ + goto exit; + } + + diff --git a/package/kernel/mac80211/patches/040-brcmutil_option.patch b/package/kernel/mac80211/patches/brcm/040-brcmutil_option.patch similarity index 100% rename from package/kernel/mac80211/patches/040-brcmutil_option.patch rename to package/kernel/mac80211/patches/brcm/040-brcmutil_option.patch diff --git a/package/kernel/mac80211/patches/brcm/300-v4.20-0001-brcmfmac-add-CYW89342-mini-PCIe-device.patch b/package/kernel/mac80211/patches/brcm/300-v4.20-0001-brcmfmac-add-CYW89342-mini-PCIe-device.patch new file mode 100644 index 00000000000000..d0d9b20373902a --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/300-v4.20-0001-brcmfmac-add-CYW89342-mini-PCIe-device.patch @@ -0,0 +1,25 @@ +From 2fef681a4cf7994c882190fd2417b95f30510afb Mon Sep 17 00:00:00 2001 +From: Jia-Shyr Chuang +Date: Wed, 15 Aug 2018 04:23:09 -0500 +Subject: [PATCH] brcmfmac: add CYW89342 mini-PCIe device + +CYW89342 is a 2x2 MIMO, 802.11a/b/g/n/ac for WLAN. It is a member of +4355/4359 family. + +Signed-off-by: Jia-Shyr Chuang +Signed-off-by: Chi-Hsien Lin +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -2017,6 +2017,7 @@ static const struct dev_pm_ops brcmf_pci + + static const struct pci_device_id brcmf_pcie_devid_table[] = { + BRCMF_PCIE_DEVICE(BRCM_PCIE_4350_DEVICE_ID), ++ BRCMF_PCIE_DEVICE_SUB(0x4355, BRCM_PCIE_VENDOR_ID_BROADCOM, 0x4355), + BRCMF_PCIE_DEVICE(BRCM_PCIE_4356_DEVICE_ID), + BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID), + BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID), diff --git a/package/kernel/mac80211/patches/brcm/305-v4.20-0001-brcmfmac-remove-set-but-not-used-variables-sfdoff-an.patch b/package/kernel/mac80211/patches/brcm/305-v4.20-0001-brcmfmac-remove-set-but-not-used-variables-sfdoff-an.patch new file mode 100644 index 00000000000000..659cdabd8497e5 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/305-v4.20-0001-brcmfmac-remove-set-but-not-used-variables-sfdoff-an.patch @@ -0,0 +1,57 @@ +From a8254fa4ba60b85829b6e5ede6564f81cd70d59f Mon Sep 17 00:00:00 2001 +From: YueHaibing +Date: Tue, 11 Sep 2018 11:24:04 +0800 +Subject: [PATCH] brcmfmac: remove set but not used variables 'sfdoff' and + 'pad_size' + +Fixes gcc '-Wunused-but-set-variable' warning: + +drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c: In function 'brcmf_sdio_rxglom': +drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:1466:11: warning: + variable 'sfdoff' set but not used [-Wunused-but-set-variable] + +drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c: In function 'brcmf_sdio_bus_preinit': +drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:3408:7: warning: + variable 'pad_size' set but not used [-Wunused-but-set-variable] + +Signed-off-by: YueHaibing +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -1480,7 +1480,7 @@ static u8 brcmf_sdio_rxglom(struct brcmf + struct sk_buff *pfirst, *pnext; + + int errcode; +- u8 doff, sfdoff; ++ u8 doff; + + struct brcmf_sdio_hdrinfo rd_new; + +@@ -1614,7 +1614,6 @@ static u8 brcmf_sdio_rxglom(struct brcmf + + /* Remove superframe header, remember offset */ + skb_pull(pfirst, rd_new.dat_offset); +- sfdoff = rd_new.dat_offset; + num = 0; + + /* Validate all the subframe headers */ +@@ -3422,7 +3421,6 @@ static int brcmf_sdio_bus_preinit(struct + struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; + struct brcmf_sdio *bus = sdiodev->bus; + struct brcmf_core *core = bus->sdio_core; +- uint pad_size; + u32 value; + int err; + +@@ -3465,7 +3463,6 @@ static int brcmf_sdio_bus_preinit(struct + if (sdiodev->sg_support) { + bus->txglom = false; + value = 1; +- pad_size = bus->sdiodev->func2->cur_blksize << 1; + err = brcmf_iovar_data_set(bus->sdiodev->dev, "bus:rxglom", + &value, sizeof(u32)); + if (err < 0) { diff --git a/package/kernel/mac80211/patches/brcm/320-v5.0-0001-brcmfmac-Remove-firmware-loading-code-duplication.patch b/package/kernel/mac80211/patches/brcm/320-v5.0-0001-brcmfmac-Remove-firmware-loading-code-duplication.patch new file mode 100644 index 00000000000000..eca15a516e5bf1 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/320-v5.0-0001-brcmfmac-Remove-firmware-loading-code-duplication.patch @@ -0,0 +1,102 @@ +From a1a3b762163868ad07a4499a73df324f40d5ab0b Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 10 Oct 2018 13:00:58 +0200 +Subject: [PATCH] brcmfmac: Remove firmware-loading code duplication + +brcmf_fw_request_next_item and brcmf_fw_request_done both have identical +code to complete the fw-request depending on the item-type. + +This commit adds a new brcmf_fw_complete_request helper removing this code +duplication. + +Signed-off-by: Hans de Goede +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/firmware.c | 62 +++++++++++----------- + 1 file changed, 31 insertions(+), 31 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -504,6 +504,34 @@ fail: + return -ENOENT; + } + ++static int brcmf_fw_complete_request(const struct firmware *fw, ++ struct brcmf_fw *fwctx) ++{ ++ struct brcmf_fw_item *cur = &fwctx->req->items[fwctx->curpos]; ++ int ret = 0; ++ ++ brcmf_dbg(TRACE, "firmware %s %sfound\n", cur->path, fw ? "" : "not "); ++ ++ switch (cur->type) { ++ case BRCMF_FW_TYPE_NVRAM: ++ ret = brcmf_fw_request_nvram_done(fw, fwctx); ++ break; ++ case BRCMF_FW_TYPE_BINARY: ++ if (fw) ++ cur->binary = fw; ++ else ++ ret = -ENOENT; ++ break; ++ default: ++ /* something fishy here so bail out early */ ++ brcmf_err("unknown fw type: %d\n", cur->type); ++ release_firmware(fw); ++ ret = -EINVAL; ++ } ++ ++ return (cur->flags & BRCMF_FW_REQF_OPTIONAL) ? 0 : ret; ++} ++ + static int brcmf_fw_request_next_item(struct brcmf_fw *fwctx, bool async) + { + struct brcmf_fw_item *cur; +@@ -525,15 +553,7 @@ static int brcmf_fw_request_next_item(st + if (ret < 0) { + brcmf_fw_request_done(NULL, fwctx); + } else if (!async && fw) { +- brcmf_dbg(TRACE, "firmware %s %sfound\n", cur->path, +- fw ? "" : "not "); +- if (cur->type == BRCMF_FW_TYPE_BINARY) +- cur->binary = fw; +- else if (cur->type == BRCMF_FW_TYPE_NVRAM) +- brcmf_fw_request_nvram_done(fw, fwctx); +- else +- release_firmware(fw); +- ++ brcmf_fw_complete_request(fw, fwctx); + return -EAGAIN; + } + return 0; +@@ -547,28 +567,8 @@ static void brcmf_fw_request_done(const + + cur = &fwctx->req->items[fwctx->curpos]; + +- brcmf_dbg(TRACE, "enter: firmware %s %sfound\n", cur->path, +- fw ? "" : "not "); +- +- if (!fw) +- ret = -ENOENT; +- +- switch (cur->type) { +- case BRCMF_FW_TYPE_NVRAM: +- ret = brcmf_fw_request_nvram_done(fw, fwctx); +- break; +- case BRCMF_FW_TYPE_BINARY: +- cur->binary = fw; +- break; +- default: +- /* something fishy here so bail out early */ +- brcmf_err("unknown fw type: %d\n", cur->type); +- release_firmware(fw); +- ret = -EINVAL; +- goto fail; +- } +- +- if (ret < 0 && !(cur->flags & BRCMF_FW_REQF_OPTIONAL)) ++ ret = brcmf_fw_complete_request(fw, fwctx); ++ if (ret < 0) + goto fail; + + do { diff --git a/package/kernel/mac80211/patches/brcm/320-v5.0-0002-brcmfmac-Remove-recursion-from-firmware-load-error-h.patch b/package/kernel/mac80211/patches/brcm/320-v5.0-0002-brcmfmac-Remove-recursion-from-firmware-load-error-h.patch new file mode 100644 index 00000000000000..1a4a1ec348aa72 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/320-v5.0-0002-brcmfmac-Remove-recursion-from-firmware-load-error-h.patch @@ -0,0 +1,127 @@ +From 5b587496dc63595b71265d986ce69728c2724370 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 10 Oct 2018 13:00:59 +0200 +Subject: [PATCH] brcmfmac: Remove recursion from firmware load error handling + +Before this commit brcmf_fw_request_done would call +brcmf_fw_request_next_item to load the next item, which on an error would +call brcmf_fw_request_done, which if the error is recoverable (*) will +then continue calling brcmf_fw_request_next_item for the next item again +which on an error will call brcmf_fw_request_done again... + +This does not blow up because we only have a limited number of items so +we never recurse too deep. But the recursion is still quite ugly and +frankly is giving me a headache, so lets fix this. + +This commit fixes this by removing brcmf_fw_request_next_item and by +making brcmf_fw_get_firmwares and brcmf_fw_request_done directly call +firmware_request_nowait resp. firmware_request themselves. + +*) brcmf_fw_request_nvram_done fallback path succeeds or + BRCMF_FW_REQF_OPTIONAL is set + +Signed-off-by: Hans de Goede +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/firmware.c | 65 +++++++--------------- + 1 file changed, 19 insertions(+), 46 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -532,33 +532,6 @@ static int brcmf_fw_complete_request(con + return (cur->flags & BRCMF_FW_REQF_OPTIONAL) ? 0 : ret; + } + +-static int brcmf_fw_request_next_item(struct brcmf_fw *fwctx, bool async) +-{ +- struct brcmf_fw_item *cur; +- const struct firmware *fw = NULL; +- int ret; +- +- cur = &fwctx->req->items[fwctx->curpos]; +- +- brcmf_dbg(TRACE, "%srequest for %s\n", async ? "async " : "", +- cur->path); +- +- if (async) +- ret = request_firmware_nowait(THIS_MODULE, true, cur->path, +- fwctx->dev, GFP_KERNEL, fwctx, +- brcmf_fw_request_done); +- else +- ret = request_firmware(&fw, cur->path, fwctx->dev); +- +- if (ret < 0) { +- brcmf_fw_request_done(NULL, fwctx); +- } else if (!async && fw) { +- brcmf_fw_complete_request(fw, fwctx); +- return -EAGAIN; +- } +- return 0; +-} +- + static void brcmf_fw_request_done(const struct firmware *fw, void *ctx) + { + struct brcmf_fw *fwctx = ctx; +@@ -568,26 +541,19 @@ static void brcmf_fw_request_done(const + cur = &fwctx->req->items[fwctx->curpos]; + + ret = brcmf_fw_complete_request(fw, fwctx); +- if (ret < 0) +- goto fail; + +- do { +- if (++fwctx->curpos == fwctx->req->n_items) { +- ret = 0; +- goto done; +- } +- +- ret = brcmf_fw_request_next_item(fwctx, false); +- } while (ret == -EAGAIN); +- +- return; +- +-fail: +- brcmf_dbg(TRACE, "failed err=%d: dev=%s, fw=%s\n", ret, +- dev_name(fwctx->dev), cur->path); +- brcmf_fw_free_request(fwctx->req); +- fwctx->req = NULL; +-done: ++ while (ret == 0 && ++fwctx->curpos < fwctx->req->n_items) { ++ cur = &fwctx->req->items[fwctx->curpos]; ++ request_firmware(&fw, cur->path, fwctx->dev); ++ ret = brcmf_fw_complete_request(fw, ctx); ++ } ++ ++ if (ret) { ++ brcmf_dbg(TRACE, "failed err=%d: dev=%s, fw=%s\n", ret, ++ dev_name(fwctx->dev), cur->path); ++ brcmf_fw_free_request(fwctx->req); ++ fwctx->req = NULL; ++ } + fwctx->done(fwctx->dev, ret, fwctx->req); + kfree(fwctx); + } +@@ -611,7 +577,9 @@ int brcmf_fw_get_firmwares(struct device + void (*fw_cb)(struct device *dev, int err, + struct brcmf_fw_request *req)) + { ++ struct brcmf_fw_item *first = &req->items[0]; + struct brcmf_fw *fwctx; ++ int ret; + + brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev)); + if (!fw_cb) +@@ -628,7 +596,12 @@ int brcmf_fw_get_firmwares(struct device + fwctx->req = req; + fwctx->done = fw_cb; + +- brcmf_fw_request_next_item(fwctx, true); ++ ret = request_firmware_nowait(THIS_MODULE, true, first->path, ++ fwctx->dev, GFP_KERNEL, fwctx, ++ brcmf_fw_request_done); ++ if (ret < 0) ++ brcmf_fw_request_done(NULL, fwctx); ++ + return 0; + } + diff --git a/package/kernel/mac80211/patches/brcm/320-v5.0-0003-brcmfmac-Add-support-for-first-trying-to-get-a-board.patch b/package/kernel/mac80211/patches/brcm/320-v5.0-0003-brcmfmac-Add-support-for-first-trying-to-get-a-board.patch new file mode 100644 index 00000000000000..727dcbe85a82c2 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/320-v5.0-0003-brcmfmac-Add-support-for-first-trying-to-get-a-board.patch @@ -0,0 +1,77 @@ +From eae8e50669e15002b195177212a6e25afbe7cf4d Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 10 Oct 2018 13:01:00 +0200 +Subject: [PATCH] brcmfmac: Add support for first trying to get a board + specific nvram file + +The nvram files which some brcmfmac chips need are board-specific. To be +able to distribute these as part of linux-firmware, so that devices with +such a wifi chip will work OOTB, multiple (one per board) versions must +co-exist under /lib/firmware. + +This commit adds support for callers of the brcmfmac/firmware.c code to +pass in a board_type parameter through the request structure. + +If that parameter is set then the code will first try to load +chipmodel.board_type.txt before falling back to the old chipmodel.txt name. + +Signed-off-by: Hans de Goede +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/firmware.c | 27 +++++++++++++++++++++- + .../broadcom/brcm80211/brcmfmac/firmware.h | 1 + + 2 files changed, 27 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -532,6 +532,31 @@ static int brcmf_fw_complete_request(con + return (cur->flags & BRCMF_FW_REQF_OPTIONAL) ? 0 : ret; + } + ++static int brcmf_fw_request_firmware(const struct firmware **fw, ++ struct brcmf_fw *fwctx) ++{ ++ struct brcmf_fw_item *cur = &fwctx->req->items[fwctx->curpos]; ++ int ret; ++ ++ /* nvram files are board-specific, first try a board-specific path */ ++ if (cur->type == BRCMF_FW_TYPE_NVRAM && fwctx->req->board_type) { ++ char alt_path[BRCMF_FW_NAME_LEN]; ++ ++ strlcpy(alt_path, cur->path, BRCMF_FW_NAME_LEN); ++ /* strip .txt at the end */ ++ alt_path[strlen(alt_path) - 4] = 0; ++ strlcat(alt_path, ".", BRCMF_FW_NAME_LEN); ++ strlcat(alt_path, fwctx->req->board_type, BRCMF_FW_NAME_LEN); ++ strlcat(alt_path, ".txt", BRCMF_FW_NAME_LEN); ++ ++ ret = request_firmware(fw, alt_path, fwctx->dev); ++ if (ret == 0) ++ return ret; ++ } ++ ++ return request_firmware(fw, cur->path, fwctx->dev); ++} ++ + static void brcmf_fw_request_done(const struct firmware *fw, void *ctx) + { + struct brcmf_fw *fwctx = ctx; +@@ -544,7 +569,7 @@ static void brcmf_fw_request_done(const + + while (ret == 0 && ++fwctx->curpos < fwctx->req->n_items) { + cur = &fwctx->req->items[fwctx->curpos]; +- request_firmware(&fw, cur->path, fwctx->dev); ++ brcmf_fw_request_firmware(&fw, fwctx); + ret = brcmf_fw_complete_request(fw, ctx); + } + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h +@@ -70,6 +70,7 @@ struct brcmf_fw_request { + u16 domain_nr; + u16 bus_nr; + u32 n_items; ++ const char *board_type; + struct brcmf_fw_item items[0]; + }; + diff --git a/package/kernel/mac80211/patches/brcm/320-v5.0-0004-brcmfmac-Set-board_type-used-for-nvram-file-selectio.patch b/package/kernel/mac80211/patches/brcm/320-v5.0-0004-brcmfmac-Set-board_type-used-for-nvram-file-selectio.patch new file mode 100644 index 00000000000000..fe930508b61d59 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/320-v5.0-0004-brcmfmac-Set-board_type-used-for-nvram-file-selectio.patch @@ -0,0 +1,77 @@ +From 0ad4b55b2f29784f93875e6231bf57cd233624a2 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 10 Oct 2018 13:01:01 +0200 +Subject: [PATCH] brcmfmac: Set board_type used for nvram file selection to + machine-compatible + +For of/devicetree using machines, set the board_type used for nvram file +selection to the first string listed in the top-level's node compatible +string, aka the machine-compatible as used by of_machine_is_compatible(). + +The board_type setting is used to load the board-specific nvram file with +a board-specific name so that we can ship files for each supported board +in linux-firmware. + +Signed-off-by: Hans de Goede +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h | 1 + + drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 11 ++++++++++- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 1 + + drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 1 + + 4 files changed, 13 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h +@@ -59,6 +59,7 @@ struct brcmf_mp_device { + bool iapp; + bool ignore_probe_fail; + struct brcmfmac_pd_cc *country_codes; ++ const char *board_type; + union { + struct brcmfmac_sdio_pd sdio; + } bus; +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +@@ -27,11 +27,20 @@ void brcmf_of_probe(struct device *dev, + struct brcmf_mp_device *settings) + { + struct brcmfmac_sdio_pd *sdio = &settings->bus.sdio; +- struct device_node *np = dev->of_node; ++ struct device_node *root, *np = dev->of_node; ++ struct property *prop; + int irq; + u32 irqf; + u32 val; + ++ /* Set board-type to the first string of the machine compatible prop */ ++ root = of_find_node_by_path("/"); ++ if (root) { ++ prop = of_find_property(root, "compatible", NULL); ++ settings->board_type = of_prop_next_string(prop, NULL); ++ of_node_put(root); ++ } ++ + if (!np || bus_type != BRCMF_BUSTYPE_SDIO || + !of_device_is_compatible(np, "brcm,bcm4329-fmac")) + return; +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -1785,6 +1785,7 @@ brcmf_pcie_prepare_fw_request(struct brc + fwreq->items[BRCMF_PCIE_FW_CODE].type = BRCMF_FW_TYPE_BINARY; + fwreq->items[BRCMF_PCIE_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; + fwreq->items[BRCMF_PCIE_FW_NVRAM].flags = BRCMF_FW_REQF_OPTIONAL; ++ fwreq->board_type = devinfo->settings->board_type; + /* NVRAM reserves PCI domain 0 for Broadcom's SDK faked bus */ + fwreq->domain_nr = pci_domain_nr(devinfo->pdev->bus) + 1; + fwreq->bus_nr = devinfo->pdev->bus->number; +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -4210,6 +4210,7 @@ brcmf_sdio_prepare_fw_request(struct brc + + fwreq->items[BRCMF_SDIO_FW_CODE].type = BRCMF_FW_TYPE_BINARY; + fwreq->items[BRCMF_SDIO_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; ++ fwreq->board_type = bus->sdiodev->settings->board_type; + + return fwreq; + } diff --git a/package/kernel/mac80211/patches/brcm/320-v5.0-0005-brcmfmac-Set-board_type-from-DMI-on-x86-based-machin.patch b/package/kernel/mac80211/patches/brcm/320-v5.0-0005-brcmfmac-Set-board_type-from-DMI-on-x86-based-machin.patch new file mode 100644 index 00000000000000..25426e3f109523 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/320-v5.0-0005-brcmfmac-Set-board_type-from-DMI-on-x86-based-machin.patch @@ -0,0 +1,179 @@ +From bd1e82bb420adf4ad7cd468d8a482cde622dd69d Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 10 Oct 2018 13:01:02 +0200 +Subject: [PATCH] brcmfmac: Set board_type from DMI on x86 based machines + +For x86 based machines, set the board_type used for nvram file selection +based on the DMI sys-vendor and product-name strings. + +Since on some models these strings are too generic, this commit also adds +a quirk table overriding the strings for models listed in that table. + +The board_type setting is used to load the board-specific nvram file with +a board-specific name so that we can ship files for each supported board +in linux-firmware. + +Signed-off-by: Hans de Goede +Signed-off-by: Kalle Valo +--- + .../wireless/broadcom/brcm80211/brcmfmac/Makefile | 2 + + .../wireless/broadcom/brcm80211/brcmfmac/common.c | 3 +- + .../wireless/broadcom/brcm80211/brcmfmac/common.h | 7 ++ + .../net/wireless/broadcom/brcm80211/brcmfmac/dmi.c | 116 +++++++++++++++++++++ + 4 files changed, 127 insertions(+), 1 deletion(-) + create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile +@@ -54,3 +54,5 @@ brcmfmac-$(CPTCFG_BRCM_TRACING) += \ + tracepoint.o + brcmfmac-$(CONFIG_OF) += \ + of.o ++brcmfmac-$(CONFIG_DMI) += \ ++ dmi.o +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -448,8 +448,9 @@ struct brcmf_mp_device *brcmf_get_module + } + } + if (!found) { +- /* No platform data for this device, try OF (Open Firwmare) */ ++ /* No platform data for this device, try OF and DMI data */ + brcmf_of_probe(dev, bus_type, settings); ++ brcmf_dmi_probe(settings, chip, chiprev); + } + return settings; + } +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h +@@ -75,4 +75,11 @@ void brcmf_release_module_param(struct b + /* Sets dongle media info (drv_version, mac address). */ + int brcmf_c_preinit_dcmds(struct brcmf_if *ifp); + ++#ifdef CONFIG_DMI ++void brcmf_dmi_probe(struct brcmf_mp_device *settings, u32 chip, u32 chiprev); ++#else ++static inline void ++brcmf_dmi_probe(struct brcmf_mp_device *settings, u32 chip, u32 chiprev) {} ++#endif ++ + #endif /* BRCMFMAC_COMMON_H */ +--- /dev/null ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c +@@ -0,0 +1,116 @@ ++/* ++ * Copyright 2018 Hans de Goede ++ * ++ * 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 ++#include ++#include "core.h" ++#include "common.h" ++#include "brcm_hw_ids.h" ++ ++/* The DMI data never changes so we can use a static buf for this */ ++static char dmi_board_type[128]; ++ ++struct brcmf_dmi_data { ++ u32 chip; ++ u32 chiprev; ++ const char *board_type; ++}; ++ ++/* NOTE: Please keep all entries sorted alphabetically */ ++ ++static const struct brcmf_dmi_data gpd_win_pocket_data = { ++ BRCM_CC_4356_CHIP_ID, 2, "gpd-win-pocket" ++}; ++ ++static const struct brcmf_dmi_data jumper_ezpad_mini3_data = { ++ BRCM_CC_43430_CHIP_ID, 0, "jumper-ezpad-mini3" ++}; ++ ++static const struct brcmf_dmi_data meegopad_t08_data = { ++ BRCM_CC_43340_CHIP_ID, 2, "meegopad-t08" ++}; ++ ++static const struct dmi_system_id dmi_platform_data[] = { ++ { ++ /* Match for the GPDwin which unfortunately uses somewhat ++ * generic dmi strings, which is why we test for 4 strings. ++ * Comparing against 23 other byt/cht boards, board_vendor ++ * and board_name are unique to the GPDwin, where as only one ++ * other board has the same board_serial and 3 others have ++ * the same default product_name. Also the GPDwin is the ++ * only device to have both board_ and product_name not set. ++ */ ++ .matches = { ++ DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), ++ DMI_MATCH(DMI_BOARD_NAME, "Default string"), ++ DMI_MATCH(DMI_BOARD_SERIAL, "Default string"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), ++ }, ++ .driver_data = (void *)&gpd_win_pocket_data, ++ }, ++ { ++ /* Jumper EZpad mini3 */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Insyde"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "CherryTrail"), ++ /* jumperx.T87.KFBNEEA02 with the version-nr dropped */ ++ DMI_MATCH(DMI_BIOS_VERSION, "jumperx.T87.KFBNEEA"), ++ }, ++ .driver_data = (void *)&jumper_ezpad_mini3_data, ++ }, ++ { ++ /* Meegopad T08 */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Default string"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), ++ DMI_MATCH(DMI_BOARD_NAME, "T3 MRD"), ++ DMI_MATCH(DMI_BOARD_VERSION, "V1.1"), ++ }, ++ .driver_data = (void *)&meegopad_t08_data, ++ }, ++ {} ++}; ++ ++void brcmf_dmi_probe(struct brcmf_mp_device *settings, u32 chip, u32 chiprev) ++{ ++ const struct dmi_system_id *match; ++ const struct brcmf_dmi_data *data; ++ const char *sys_vendor; ++ const char *product_name; ++ ++ /* Some models have DMI strings which are too generic, e.g. ++ * "Default string", we use a quirk table for these. ++ */ ++ for (match = dmi_first_match(dmi_platform_data); ++ match; ++ match = dmi_first_match(match + 1)) { ++ data = match->driver_data; ++ ++ if (data->chip == chip && data->chiprev == chiprev) { ++ settings->board_type = data->board_type; ++ return; ++ } ++ } ++ ++ /* Not found in the quirk-table, use sys_vendor-product_name */ ++ sys_vendor = dmi_get_system_info(DMI_SYS_VENDOR); ++ product_name = dmi_get_system_info(DMI_PRODUCT_NAME); ++ if (sys_vendor && product_name) { ++ snprintf(dmi_board_type, sizeof(dmi_board_type), "%s-%s", ++ sys_vendor, product_name); ++ settings->board_type = dmi_board_type; ++ } ++} diff --git a/package/kernel/mac80211/patches/brcm/320-v5.0-0006-brcmfmac-Cleanup-brcmf_fw_request_done.patch b/package/kernel/mac80211/patches/brcm/320-v5.0-0006-brcmfmac-Cleanup-brcmf_fw_request_done.patch new file mode 100644 index 00000000000000..211e9e4a9fc5cb --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/320-v5.0-0006-brcmfmac-Cleanup-brcmf_fw_request_done.patch @@ -0,0 +1,41 @@ +From 55e491edbf14b2da5419c2a319ea3b1d6368d9a2 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 10 Oct 2018 13:01:03 +0200 +Subject: [PATCH] brcmfmac: Cleanup brcmf_fw_request_done() + +The "cur" variable is now only used for a debug print and we already +print the same info from brcmf_fw_complete_request(), so the debug print +does not provide any extra info and we can remove it. + +Signed-off-by: Hans de Goede +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -560,22 +560,16 @@ static int brcmf_fw_request_firmware(con + static void brcmf_fw_request_done(const struct firmware *fw, void *ctx) + { + struct brcmf_fw *fwctx = ctx; +- struct brcmf_fw_item *cur; +- int ret = 0; +- +- cur = &fwctx->req->items[fwctx->curpos]; ++ int ret; + + ret = brcmf_fw_complete_request(fw, fwctx); + + while (ret == 0 && ++fwctx->curpos < fwctx->req->n_items) { +- cur = &fwctx->req->items[fwctx->curpos]; + brcmf_fw_request_firmware(&fw, fwctx); + ret = brcmf_fw_complete_request(fw, ctx); + } + + if (ret) { +- brcmf_dbg(TRACE, "failed err=%d: dev=%s, fw=%s\n", ret, +- dev_name(fwctx->dev), cur->path); + brcmf_fw_free_request(fwctx->req); + fwctx->req = NULL; + } diff --git a/package/kernel/mac80211/patches/brcm/321-v5.0-0001-brcmfmac-Add-support-for-getting-nvram-contents-from.patch b/package/kernel/mac80211/patches/brcm/321-v5.0-0001-brcmfmac-Add-support-for-getting-nvram-contents-from.patch new file mode 100644 index 00000000000000..88e5c67735b63d --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/321-v5.0-0001-brcmfmac-Add-support-for-getting-nvram-contents-from.patch @@ -0,0 +1,132 @@ +From ce2e6db554fad444fa0b3904fc3015336e0ef765 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Thu, 11 Oct 2018 11:51:06 +0200 +Subject: [PATCH] brcmfmac: Add support for getting nvram contents from EFI + variables + +Various X86 laptops with a SDIO attached brcmfmac wifi chip, store the +nvram contents in a special EFI variable. This commit adds support for +getting nvram directly from this EFI variable, without the user needing +to manually copy it. + +This makes Wifi / Bluetooth work out of the box on these devices instead of +requiring manual setup. + +This has been tested on the following models: Acer Iconia Tab8 w1-810, +Acer One 10, Asus T100CHI, Asus T100HA, Asus T100TA, Asus T200TA and a +Lenovo Mixx 2 8. + +Tested-by: Hans de Goede +Signed-off-by: Hans de Goede +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/firmware.c | 63 +++++++++++++++++++--- + 1 file changed, 57 insertions(+), 6 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -14,6 +14,7 @@ + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + ++#include + #include + #include + #include +@@ -445,6 +446,51 @@ struct brcmf_fw { + + static void brcmf_fw_request_done(const struct firmware *fw, void *ctx); + ++#ifdef CONFIG_EFI ++static u8 *brcmf_fw_nvram_from_efi(size_t *data_len_ret) ++{ ++ const u16 name[] = { 'n', 'v', 'r', 'a', 'm', 0 }; ++ struct efivar_entry *nvram_efivar; ++ unsigned long data_len = 0; ++ u8 *data = NULL; ++ int err; ++ ++ nvram_efivar = kzalloc(sizeof(*nvram_efivar), GFP_KERNEL); ++ if (!nvram_efivar) ++ return NULL; ++ ++ memcpy(&nvram_efivar->var.VariableName, name, sizeof(name)); ++ nvram_efivar->var.VendorGuid = EFI_GUID(0x74b00bd9, 0x805a, 0x4d61, ++ 0xb5, 0x1f, 0x43, 0x26, ++ 0x81, 0x23, 0xd1, 0x13); ++ ++ err = efivar_entry_size(nvram_efivar, &data_len); ++ if (err) ++ goto fail; ++ ++ data = kmalloc(data_len, GFP_KERNEL); ++ if (!data) ++ goto fail; ++ ++ err = efivar_entry_get(nvram_efivar, NULL, &data_len, data); ++ if (err) ++ goto fail; ++ ++ brcmf_info("Using nvram EFI variable\n"); ++ ++ kfree(nvram_efivar); ++ *data_len_ret = data_len; ++ return data; ++ ++fail: ++ kfree(data); ++ kfree(nvram_efivar); ++ return NULL; ++} ++#else ++static u8 *brcmf_fw_nvram_from_efi(size_t *data_len) { return NULL; } ++#endif ++ + static void brcmf_fw_free_request(struct brcmf_fw_request *req) + { + struct brcmf_fw_item *item; +@@ -463,11 +509,12 @@ static int brcmf_fw_request_nvram_done(c + { + struct brcmf_fw *fwctx = ctx; + struct brcmf_fw_item *cur; ++ bool free_bcm47xx_nvram = false; ++ bool kfree_nvram = false; + u32 nvram_length = 0; + void *nvram = NULL; + u8 *data = NULL; + size_t data_len; +- bool raw_nvram; + + brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(fwctx->dev)); + +@@ -476,12 +523,13 @@ static int brcmf_fw_request_nvram_done(c + if (fw && fw->data) { + data = (u8 *)fw->data; + data_len = fw->size; +- raw_nvram = false; + } else { +- data = bcm47xx_nvram_get_contents(&data_len); +- if (!data && !(cur->flags & BRCMF_FW_REQF_OPTIONAL)) ++ if ((data = bcm47xx_nvram_get_contents(&data_len))) ++ free_bcm47xx_nvram = true; ++ else if ((data = brcmf_fw_nvram_from_efi(&data_len))) ++ kfree_nvram = true; ++ else if (!(cur->flags & BRCMF_FW_REQF_OPTIONAL)) + goto fail; +- raw_nvram = true; + } + + if (data) +@@ -489,8 +537,11 @@ static int brcmf_fw_request_nvram_done(c + fwctx->req->domain_nr, + fwctx->req->bus_nr); + +- if (raw_nvram) ++ if (free_bcm47xx_nvram) + bcm47xx_nvram_release_contents(data); ++ if (kfree_nvram) ++ kfree(data); ++ + release_firmware(fw); + if (!nvram && !(cur->flags & BRCMF_FW_REQF_OPTIONAL)) + goto fail; diff --git a/package/kernel/mac80211/patches/brcm/321-v5.0-0002-brcmfmac-Fix-ccode-from-EFI-nvram-when-necessary.patch b/package/kernel/mac80211/patches/brcm/321-v5.0-0002-brcmfmac-Fix-ccode-from-EFI-nvram-when-necessary.patch new file mode 100644 index 00000000000000..c2fd620d6c95c9 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/321-v5.0-0002-brcmfmac-Fix-ccode-from-EFI-nvram-when-necessary.patch @@ -0,0 +1,97 @@ +From 29ec3394f0bd85c22674ab6693d92da5e2324610 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Thu, 11 Oct 2018 11:51:07 +0200 +Subject: [PATCH] brcmfmac: Fix ccode from EFI nvram when necessary + +In some cases the EFI-var stored nvram contains "ccode=ALL" or "ccode=XV" +to specify "worldwide" compatible settings, but these 2 ccode-s do not work +properly. + +I've tested the different known "worldwide" ccode-s used in various nvram +sources with the latest firmwares from linux-firmware for various brcmfmac +models, here is a simplified (*) table with what each setting results in: + +ALL: 12-14 disab, U-NII-1, U-NII-2 no-IR/radar, U-NII-3 +XV: 12-14 no-IR, disables all 5G channels +XY: 12-13 enab, 14 disab, U-NII-1 enab, U-NII-2 no-IR/radar, U-NII-3 disab +X2: 12-13 no-IR, 14 dis, U-NII-1 no-IR, U-NII-2 no-IR/radar, U-NII-3 no-IR + +Where 12,13,14 are 2.4G channels 12-14 and U-NII-1/2/3 are the 3 different +5G channel groups. no-IR is no-Initiate-Radiation, we will never send on +these channels without first having received valid wifi traffic there. + +This immediately shows that both ALL and XV are not as worldwide as we want +them to be. ALL causes channels 12 and 13 to not be available and XV causes +all 5GHz channels to not be available. Also ALL unconditionally enables the +U-NII-1 and U-NII-3 5G groups, while we really should be using no-IR for +these. + +This commit replace XV and ALL with X2, which allows usage of chan 12-13 +and 5G channels, but only after receiving valid wifi traffic there first. + +Note that this configure the firmware's channel limits, the kernels own +regulatory restrictions based on e.g. regulatory info received from the +access-point, will be applied on top of this. + +This fixes channels 12+13 not working on the Asus T200TA and the Lenovo +Mixx 2 8 and 5G channels not working on the Asus T100HA. + +This has been tested on the following models: Acer Iconia Tab8 w1-810, +Acer One 10, Asus T100CHI, Asus T100HA, Asus T100TA, Asus T200TA and a +Lenovo Mixx 2 8. + +*) There are some exceptions to this table: +1) On really old firmware e.g. linux-firmware's 2011 brcmfmac4330-sdio.bin + ALL really means all, unconditionally enabling everything +2) The exact meaning might be influenced by setting the regrev nvram var. + Specifically using ccode=XV + regrev=1 on brcmfmac43241b4 leads to: + 12-14 no-ir, U-NII-1 no-ir, U-NII-2 no-ir/radar, U-NII-3 no-ir + But only on the brcmfmac43241b4 and not on e.g. the brcmfmac43340 + +Tested-by: Hans de Goede +Signed-off-by: Hans de Goede +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/firmware.c | 24 ++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -447,6 +447,29 @@ struct brcmf_fw { + static void brcmf_fw_request_done(const struct firmware *fw, void *ctx); + + #ifdef CONFIG_EFI ++/* In some cases the EFI-var stored nvram contains "ccode=ALL" or "ccode=XV" ++ * to specify "worldwide" compatible settings, but these 2 ccode-s do not work ++ * properly. "ccode=ALL" causes channels 12 and 13 to not be available, ++ * "ccode=XV" causes all 5GHz channels to not be available. So we replace both ++ * with "ccode=X2" which allows channels 12+13 and 5Ghz channels in ++ * no-Initiate-Radiation mode. This means that we will never send on these ++ * channels without first having received valid wifi traffic on the channel. ++ */ ++static void brcmf_fw_fix_efi_nvram_ccode(char *data, unsigned long data_len) ++{ ++ char *ccode; ++ ++ ccode = strnstr((char *)data, "ccode=ALL", data_len); ++ if (!ccode) ++ ccode = strnstr((char *)data, "ccode=XV\r", data_len); ++ if (!ccode) ++ return; ++ ++ ccode[6] = 'X'; ++ ccode[7] = '2'; ++ ccode[8] = '\r'; ++} ++ + static u8 *brcmf_fw_nvram_from_efi(size_t *data_len_ret) + { + const u16 name[] = { 'n', 'v', 'r', 'a', 'm', 0 }; +@@ -476,6 +499,7 @@ static u8 *brcmf_fw_nvram_from_efi(size_ + if (err) + goto fail; + ++ brcmf_fw_fix_efi_nvram_ccode(data, data_len); + brcmf_info("Using nvram EFI variable\n"); + + kfree(nvram_efivar); diff --git a/package/kernel/mac80211/patches/brcm/322-v5.0-0001-brcmfmac-fix-spelling-mistake-Retreiving-Retrieving.patch b/package/kernel/mac80211/patches/brcm/322-v5.0-0001-brcmfmac-fix-spelling-mistake-Retreiving-Retrieving.patch new file mode 100644 index 00000000000000..c1aea25cbac614 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/322-v5.0-0001-brcmfmac-fix-spelling-mistake-Retreiving-Retrieving.patch @@ -0,0 +1,34 @@ +From e966a79c2f761a696dec9cfb0e2d4aa977bf78cb Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Tue, 16 Oct 2018 18:43:42 +0100 +Subject: [PATCH] brcmfmac: fix spelling mistake "Retreiving" -> "Retrieving" + +Trivial fix to spelling mistake in brcmf_err error message. + +Signed-off-by: Colin Ian King +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -214,7 +214,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr, + sizeof(ifp->mac_addr)); + if (err < 0) { +- brcmf_err("Retreiving cur_etheraddr failed, %d\n", err); ++ brcmf_err("Retrieving cur_etheraddr failed, %d\n", err); + goto done; + } + memcpy(ifp->drvr->wiphy->perm_addr, ifp->drvr->mac, ETH_ALEN); +@@ -269,7 +269,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + strcpy(buf, "ver"); + err = brcmf_fil_iovar_data_get(ifp, "ver", buf, sizeof(buf)); + if (err < 0) { +- brcmf_err("Retreiving version information failed, %d\n", ++ brcmf_err("Retrieving version information failed, %d\n", + err); + goto done; + } diff --git a/package/kernel/mac80211/patches/brcm/323-v5.0-0001-brcmutil-print-invalid-chanspec-when-WARN-ing.patch b/package/kernel/mac80211/patches/brcm/323-v5.0-0001-brcmutil-print-invalid-chanspec-when-WARN-ing.patch new file mode 100644 index 00000000000000..566336cbc3285c --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/323-v5.0-0001-brcmutil-print-invalid-chanspec-when-WARN-ing.patch @@ -0,0 +1,83 @@ +From ae5848cb4511bbbfe0306fcdbe5d9a95cd9546a9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 26 Oct 2018 13:22:32 +0200 +Subject: [PATCH] brcmutil: print invalid chanspec when WARN-ing +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +On one of my devices I got WARNINGs when brcmfmac tried to decode +chanspec. I couldn't tell if it was some unsupported format or just a +malformed value passed by a firmware. + +Print chanspec value so it's possible to debug a possible problem. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmutil/d11.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmutil/d11.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmutil/d11.c +@@ -128,7 +128,7 @@ static void brcmu_d11n_decchspec(struct + } + break; + default: +- WARN_ON_ONCE(1); ++ WARN_ONCE(1, "Invalid chanspec 0x%04x\n", ch->chspec); + break; + } + +@@ -140,7 +140,7 @@ static void brcmu_d11n_decchspec(struct + ch->band = BRCMU_CHAN_BAND_2G; + break; + default: +- WARN_ON_ONCE(1); ++ WARN_ONCE(1, "Invalid chanspec 0x%04x\n", ch->chspec); + break; + } + } +@@ -167,7 +167,7 @@ static void brcmu_d11ac_decchspec(struct + ch->sb = BRCMU_CHAN_SB_U; + ch->control_ch_num += CH_10MHZ_APART; + } else { +- WARN_ON_ONCE(1); ++ WARN_ONCE(1, "Invalid chanspec 0x%04x\n", ch->chspec); + } + break; + case BRCMU_CHSPEC_D11AC_BW_80: +@@ -188,7 +188,7 @@ static void brcmu_d11ac_decchspec(struct + ch->control_ch_num += CH_30MHZ_APART; + break; + default: +- WARN_ON_ONCE(1); ++ WARN_ONCE(1, "Invalid chanspec 0x%04x\n", ch->chspec); + break; + } + break; +@@ -222,13 +222,13 @@ static void brcmu_d11ac_decchspec(struct + ch->control_ch_num += CH_70MHZ_APART; + break; + default: +- WARN_ON_ONCE(1); ++ WARN_ONCE(1, "Invalid chanspec 0x%04x\n", ch->chspec); + break; + } + break; + case BRCMU_CHSPEC_D11AC_BW_8080: + default: +- WARN_ON_ONCE(1); ++ WARN_ONCE(1, "Invalid chanspec 0x%04x\n", ch->chspec); + break; + } + +@@ -240,7 +240,7 @@ static void brcmu_d11ac_decchspec(struct + ch->band = BRCMU_CHAN_BAND_2G; + break; + default: +- WARN_ON_ONCE(1); ++ WARN_ONCE(1, "Invalid chanspec 0x%04x\n", ch->chspec); + break; + } + } diff --git a/package/kernel/mac80211/patches/brcm/325-v5.0-brcmfmac-support-STA-info-struct-v7.patch b/package/kernel/mac80211/patches/brcm/325-v5.0-brcmfmac-support-STA-info-struct-v7.patch new file mode 100644 index 00000000000000..8ff42462b04b84 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/325-v5.0-brcmfmac-support-STA-info-struct-v7.patch @@ -0,0 +1,80 @@ +From 4282ff17e557d319e1b988fa4f582792cfaf6fff Mon Sep 17 00:00:00 2001 +From: Dan Haab +Date: Fri, 9 Nov 2018 09:38:55 -0700 +Subject: [PATCH] brcmfmac: support STA info struct v7 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The newest firmwares provide STA info using v7 of the struct. As v7 +isn't backward compatible, a union is needed. + +Even though brcmfmac does not use any of the new info it's important to +provide the proper struct buffer. Without this change new firmwares will +fallback to the very limited v3 instead of something in between such as +v4. + +Signed-off-by: Dan Haab +Reviewed-by: Rafał Miłecki +Reviewed-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/fwil_types.h | 40 +++++++++++++++---- + 1 file changed, 33 insertions(+), 7 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +@@ -176,6 +176,8 @@ + + #define BRCMF_VHT_CAP_MCS_MAP_NSS_MAX 8 + ++#define BRCMF_HE_CAP_MCS_MAP_NSS_MAX 8 ++ + /* MAX_CHUNK_LEN is the maximum length for data passing to firmware in each + * ioctl. It is relatively small because firmware has small maximum size input + * playload restriction for ioctls. +@@ -601,13 +603,37 @@ struct brcmf_sta_info_le { + __le32 rx_pkts_retried; /* # rx with retry bit set */ + __le32 tx_rate_fallback; /* lowest fallback TX rate */ + +- /* Fields valid for ver >= 5 */ +- struct { +- __le32 count; /* # rates in this set */ +- u8 rates[BRCMF_MAXRATES_IN_SET]; /* rates in 500kbps units w/hi bit set if basic */ +- u8 mcs[BRCMF_MCSSET_LEN]; /* supported mcs index bit map */ +- __le16 vht_mcs[BRCMF_VHT_CAP_MCS_MAP_NSS_MAX]; /* supported mcs index bit map per nss */ +- } rateset_adv; ++ union { ++ struct { ++ struct { ++ __le32 count; /* # rates in this set */ ++ u8 rates[BRCMF_MAXRATES_IN_SET]; /* rates in 500kbps units w/hi bit set if basic */ ++ u8 mcs[BRCMF_MCSSET_LEN]; /* supported mcs index bit map */ ++ __le16 vht_mcs[BRCMF_VHT_CAP_MCS_MAP_NSS_MAX]; /* supported mcs index bit map per nss */ ++ } rateset_adv; ++ } v5; ++ ++ struct { ++ __le32 rx_dur_total; /* total user RX duration (estimated) */ ++ __le16 chanspec; /** chanspec this sta is on */ ++ __le16 pad_1; ++ struct { ++ __le16 version; /* version */ ++ __le16 len; /* length */ ++ __le32 count; /* # rates in this set */ ++ u8 rates[BRCMF_MAXRATES_IN_SET]; /* rates in 500kbps units w/hi bit set if basic */ ++ u8 mcs[BRCMF_MCSSET_LEN]; /* supported mcs index bit map */ ++ __le16 vht_mcs[BRCMF_VHT_CAP_MCS_MAP_NSS_MAX]; /* supported mcs index bit map per nss */ ++ __le16 he_mcs[BRCMF_HE_CAP_MCS_MAP_NSS_MAX]; /* supported he mcs index bit map per nss */ ++ } rateset_adv; /* rateset along with mcs index bitmap */ ++ __le16 wpauth; /* authentication type */ ++ u8 algo; /* crypto algorithm */ ++ u8 pad_2; ++ __le32 tx_rspec; /* Rate of last successful tx frame */ ++ __le32 rx_rspec; /* Rate of last successful rx frame */ ++ __le32 wnm_cap; /* wnm capabilities */ ++ } v7; ++ }; + }; + + struct brcmf_chanspec_list { diff --git a/package/kernel/mac80211/patches/brcm/326-v5.0-brcmfmac-Call-brcmf_dmi_probe-before-brcmf_of_probe.patch b/package/kernel/mac80211/patches/brcm/326-v5.0-brcmfmac-Call-brcmf_dmi_probe-before-brcmf_of_probe.patch new file mode 100644 index 00000000000000..01621561c1842f --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/326-v5.0-brcmfmac-Call-brcmf_dmi_probe-before-brcmf_of_probe.patch @@ -0,0 +1,39 @@ +From 554da3868eb1d7174710c18b4ddd6ff01f6d612c Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Fri, 23 Nov 2018 10:11:48 +0100 +Subject: [PATCH] brcmfmac: Call brcmf_dmi_probe before brcmf_of_probe + +ARM systems with UEFI may have both devicetree (of) and DMI data in this +case we end up setting brcmf_mp_device.board_type twice. + +In this case we should prefer the devicetree data, because: +1) The devicerree data is more reliable +2) Some ARM systems (e.g. the Raspberry Pi 3 models) support both UEFI and + classic uboot booting, the devicetree data is always there, so using it + makes sure we ask for the same nvram file independent of how we booted. + +This commit moves the brcmf_dmi_probe call to before the brcmf_of_probe +call, so that the latter can override the value of the first if both are +set. + +Fixes: bd1e82bb420a ("brcmfmac: Set board_type from DMI on x86 based ...") +Cc: Peter Robinson +Tested-and-reported-by: Peter Robinson +Signed-off-by: Hans de Goede +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -449,8 +449,8 @@ struct brcmf_mp_device *brcmf_get_module + } + if (!found) { + /* No platform data for this device, try OF and DMI data */ +- brcmf_of_probe(dev, bus_type, settings); + brcmf_dmi_probe(settings, chip, chiprev); ++ brcmf_of_probe(dev, bus_type, settings); + } + return settings; + } diff --git a/package/kernel/mac80211/patches/brcm/328-v5.0-0001-brcmfmac-add-credit-numbers-updating-support.patch b/package/kernel/mac80211/patches/brcm/328-v5.0-0001-brcmfmac-add-credit-numbers-updating-support.patch new file mode 100644 index 00000000000000..3f84e542081ddf --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/328-v5.0-0001-brcmfmac-add-credit-numbers-updating-support.patch @@ -0,0 +1,95 @@ +From 153e22c0ff1260035cd7fe72c8aeead1f5fac757 Mon Sep 17 00:00:00 2001 +From: Wright Feng +Date: Mon, 5 Nov 2018 05:51:54 +0000 +Subject: [PATCH] brcmfmac: add credit numbers updating support + +The credit numbers are static and tunable per chip in firmware side. +However the credit number may be changed that is based on packet pool +length and will send BRCMF_E_FIFO_CREDIT_MAP event to notify host driver +updates the credit numbers during interface up. +The purpose of this patch is making host driver has ability of updating +the credit numbers when receiving the BRCMF_E_FIFO_CREDIT_MAP event. + +Signed-off-by: Wright Feng +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/fwsignal.c | 23 ++++++++++++------- + 1 file changed, 15 insertions(+), 8 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c +@@ -511,6 +511,7 @@ struct brcmf_fws_info { + struct work_struct fws_dequeue_work; + u32 fifo_enqpkt[BRCMF_FWS_FIFO_COUNT]; + int fifo_credit[BRCMF_FWS_FIFO_COUNT]; ++ int init_fifo_credit[BRCMF_FWS_FIFO_COUNT]; + int credits_borrowed[BRCMF_FWS_FIFO_AC_VO + 1]; + int deq_node_pos[BRCMF_FWS_FIFO_COUNT]; + u32 fifo_credit_map; +@@ -1241,6 +1242,9 @@ static void brcmf_fws_return_credits(str + } + + fws->fifo_credit[fifo] += credits; ++ if (fws->fifo_credit[fifo] > fws->init_fifo_credit[fifo]) ++ fws->fifo_credit[fifo] = fws->init_fifo_credit[fifo]; ++ + } + + static void brcmf_fws_schedule_deq(struct brcmf_fws_info *fws) +@@ -1599,19 +1603,21 @@ static int brcmf_fws_notify_credit_map(s + brcmf_err("event payload too small (%d)\n", e->datalen); + return -EINVAL; + } +- if (fws->creditmap_received) +- return 0; + + fws->creditmap_received = true; + + brcmf_dbg(TRACE, "enter: credits %pM\n", credits); + brcmf_fws_lock(fws); + for (i = 0; i < ARRAY_SIZE(fws->fifo_credit); i++) { +- if (*credits) ++ fws->fifo_credit[i] += credits[i] - fws->init_fifo_credit[i]; ++ fws->init_fifo_credit[i] = credits[i]; ++ if (fws->fifo_credit[i] > 0) + fws->fifo_credit_map |= 1 << i; + else + fws->fifo_credit_map &= ~(1 << i); +- fws->fifo_credit[i] = *credits++; ++ WARN_ONCE(fws->fifo_credit[i] < 0, ++ "fifo_credit[%d] is negative(%d)\n", i, ++ fws->fifo_credit[i]); + } + brcmf_fws_schedule_deq(fws); + brcmf_fws_unlock(fws); +@@ -2017,7 +2023,7 @@ static int brcmf_fws_borrow_credit(struc + } + + for (lender_ac = 0; lender_ac <= BRCMF_FWS_FIFO_AC_VO; lender_ac++) { +- if (fws->fifo_credit[lender_ac]) { ++ if (fws->fifo_credit[lender_ac] > 0) { + fws->credits_borrowed[lender_ac]++; + fws->fifo_credit[lender_ac]--; + if (fws->fifo_credit[lender_ac] == 0) +@@ -2216,8 +2222,9 @@ static void brcmf_fws_dequeue_worker(str + } + continue; + } +- while ((fws->fifo_credit[fifo]) || ((!fws->bcmc_credit_check) && +- (fifo == BRCMF_FWS_FIFO_BCMC))) { ++ while ((fws->fifo_credit[fifo] > 0) || ++ ((!fws->bcmc_credit_check) && ++ (fifo == BRCMF_FWS_FIFO_BCMC))) { + skb = brcmf_fws_deq(fws, fifo); + if (!skb) + break; +@@ -2228,7 +2235,7 @@ static void brcmf_fws_dequeue_worker(str + break; + } + if ((fifo == BRCMF_FWS_FIFO_AC_BE) && +- (fws->fifo_credit[fifo] == 0) && ++ (fws->fifo_credit[fifo] <= 0) && + (!fws->bus_flow_blocked)) { + while (brcmf_fws_borrow_credit(fws) == 0) { + skb = brcmf_fws_deq(fws, fifo); diff --git a/package/kernel/mac80211/patches/brcm/328-v5.0-0002-brcmfmac-enable-frameburst-mode-in-default-firmware-.patch b/package/kernel/mac80211/patches/brcm/328-v5.0-0002-brcmfmac-enable-frameburst-mode-in-default-firmware-.patch new file mode 100644 index 00000000000000..3464839a2b6df7 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/328-v5.0-0002-brcmfmac-enable-frameburst-mode-in-default-firmware-.patch @@ -0,0 +1,42 @@ +From a3bdc6deb60bf6be4405058ca49a686c4db08c39 Mon Sep 17 00:00:00 2001 +From: Wright Feng +Date: Mon, 5 Nov 2018 05:51:59 +0000 +Subject: [PATCH] brcmfmac: enable frameburst mode in default firmware setting + +The frameburst feature can enable per-packet framebursting in firmware +side and get higher TX throughput in High Throughput(HT) mode. To enhance +TX throughput, we enable frameburst mode in default firmware setting. + +Signed-off-by: Wright Feng +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 6 ++++++ + drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h | 1 + + 2 files changed, 7 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -6654,6 +6654,12 @@ static s32 brcmf_config_dongle(struct br + + brcmf_configure_arp_nd_offload(ifp, true); + ++ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_FAKEFRAG, 1); ++ if (err) { ++ brcmf_err("failed to set frameburst mode\n"); ++ goto default_conf_out; ++ } ++ + cfg->dongle_up = true; + default_conf_out: + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h +@@ -80,6 +80,7 @@ + #define BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON 201 + #define BRCMF_C_SET_ASSOC_PREFER 205 + #define BRCMF_C_GET_VALID_CHANNELS 217 ++#define BRCMF_C_SET_FAKEFRAG 219 + #define BRCMF_C_GET_KEY_PRIMARY 235 + #define BRCMF_C_SET_KEY_PRIMARY 236 + #define BRCMF_C_SET_SCAN_PASSIVE_TIME 258 diff --git a/package/kernel/mac80211/patches/brcm/328-v5.0-0003-brcmfmac-handle-compressed-tx-status-signal.patch b/package/kernel/mac80211/patches/brcm/328-v5.0-0003-brcmfmac-handle-compressed-tx-status-signal.patch new file mode 100644 index 00000000000000..bf72dcabc1a671 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/328-v5.0-0003-brcmfmac-handle-compressed-tx-status-signal.patch @@ -0,0 +1,229 @@ +From e4af3ffb43d50f070134aa1b40d5c3573f57deb1 Mon Sep 17 00:00:00 2001 +From: Chung-Hsien Hsu +Date: Mon, 5 Nov 2018 05:52:05 +0000 +Subject: [PATCH] brcmfmac: handle compressed tx status signal + +Firmware inform the driver about tx status by normal tx status signal +or compressed tx status signal. This patch adds support to handle the +compressed tx status signal. + +Signed-off-by: Chung-Hsien Hsu +Signed-off-by: Chi-Hsien Lin +Signed-off-by: Wright Feng +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/fwsignal.c | 121 ++++++++++-------- + 1 file changed, 71 insertions(+), 50 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c +@@ -1459,9 +1459,10 @@ static int brcmf_fws_txstatus_suppressed + + static int + brcmf_fws_txs_process(struct brcmf_fws_info *fws, u8 flags, u32 hslot, +- u32 genbit, u16 seq) ++ u32 genbit, u16 seq, u8 compcnt) + { + u32 fifo; ++ u8 cnt = 0; + int ret; + bool remove_from_hanger = true; + struct sk_buff *skb; +@@ -1472,60 +1473,71 @@ brcmf_fws_txs_process(struct brcmf_fws_i + brcmf_dbg(DATA, "flags %d\n", flags); + + if (flags == BRCMF_FWS_TXSTATUS_DISCARD) +- fws->stats.txs_discard++; ++ fws->stats.txs_discard += compcnt; + else if (flags == BRCMF_FWS_TXSTATUS_CORE_SUPPRESS) { +- fws->stats.txs_supp_core++; ++ fws->stats.txs_supp_core += compcnt; + remove_from_hanger = false; + } else if (flags == BRCMF_FWS_TXSTATUS_FW_PS_SUPPRESS) { +- fws->stats.txs_supp_ps++; ++ fws->stats.txs_supp_ps += compcnt; + remove_from_hanger = false; + } else if (flags == BRCMF_FWS_TXSTATUS_FW_TOSSED) +- fws->stats.txs_tossed++; ++ fws->stats.txs_tossed += compcnt; + else if (flags == BRCMF_FWS_TXSTATUS_HOST_TOSSED) +- fws->stats.txs_host_tossed++; ++ fws->stats.txs_host_tossed += compcnt; + else + brcmf_err("unexpected txstatus\n"); + +- ret = brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb, +- remove_from_hanger); +- if (ret != 0) { +- brcmf_err("no packet in hanger slot: hslot=%d\n", hslot); +- return ret; +- } ++ while (cnt < compcnt) { ++ ret = brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb, ++ remove_from_hanger); ++ if (ret != 0) { ++ brcmf_err("no packet in hanger slot: hslot=%d\n", ++ hslot); ++ goto cont; ++ } + +- skcb = brcmf_skbcb(skb); +- entry = skcb->mac; +- if (WARN_ON(!entry)) { +- brcmu_pkt_buf_free_skb(skb); +- return -EINVAL; +- } +- entry->transit_count--; +- if (entry->suppressed && entry->suppr_transit_count) +- entry->suppr_transit_count--; +- +- brcmf_dbg(DATA, "%s flags %d htod %X seq %X\n", entry->name, flags, +- skcb->htod, seq); +- +- /* pick up the implicit credit from this packet */ +- fifo = brcmf_skb_htod_tag_get_field(skb, FIFO); +- if ((fws->fcmode == BRCMF_FWS_FCMODE_IMPLIED_CREDIT) || +- (brcmf_skb_if_flags_get_field(skb, REQ_CREDIT)) || +- (flags == BRCMF_FWS_TXSTATUS_HOST_TOSSED)) { +- brcmf_fws_return_credits(fws, fifo, 1); +- brcmf_fws_schedule_deq(fws); +- } +- brcmf_fws_macdesc_return_req_credit(skb); ++ skcb = brcmf_skbcb(skb); ++ entry = skcb->mac; ++ if (WARN_ON(!entry)) { ++ brcmu_pkt_buf_free_skb(skb); ++ goto cont; ++ } ++ entry->transit_count--; ++ if (entry->suppressed && entry->suppr_transit_count) ++ entry->suppr_transit_count--; + +- ret = brcmf_proto_hdrpull(fws->drvr, false, skb, &ifp); +- if (ret) { +- brcmu_pkt_buf_free_skb(skb); +- return -EINVAL; ++ brcmf_dbg(DATA, "%s flags %d htod %X seq %X\n", entry->name, ++ flags, skcb->htod, seq); ++ ++ /* pick up the implicit credit from this packet */ ++ fifo = brcmf_skb_htod_tag_get_field(skb, FIFO); ++ if (fws->fcmode == BRCMF_FWS_FCMODE_IMPLIED_CREDIT || ++ (brcmf_skb_if_flags_get_field(skb, REQ_CREDIT)) || ++ flags == BRCMF_FWS_TXSTATUS_HOST_TOSSED) { ++ brcmf_fws_return_credits(fws, fifo, 1); ++ brcmf_fws_schedule_deq(fws); ++ } ++ brcmf_fws_macdesc_return_req_credit(skb); ++ ++ ret = brcmf_proto_hdrpull(fws->drvr, false, skb, &ifp); ++ if (ret) { ++ brcmu_pkt_buf_free_skb(skb); ++ goto cont; ++ } ++ if (!remove_from_hanger) ++ ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ++ genbit, seq); ++ if (remove_from_hanger || ret) ++ brcmf_txfinalize(ifp, skb, true); ++ ++cont: ++ hslot = (hslot + 1) & (BRCMF_FWS_TXSTAT_HSLOT_MASK >> ++ BRCMF_FWS_TXSTAT_HSLOT_SHIFT); ++ if (BRCMF_FWS_MODE_GET_REUSESEQ(fws->mode)) ++ seq = (seq + 1) & BRCMF_SKB_HTOD_SEQ_NR_MASK; ++ ++ cnt++; + } +- if (!remove_from_hanger) +- ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, +- genbit, seq); +- if (remove_from_hanger || ret) +- brcmf_txfinalize(ifp, skb, true); + + return 0; + } +@@ -1551,7 +1563,8 @@ static int brcmf_fws_fifocreditback_indi + return BRCMF_FWS_RET_OK_SCHEDULE; + } + +-static int brcmf_fws_txstatus_indicate(struct brcmf_fws_info *fws, u8 *data) ++static int brcmf_fws_txstatus_indicate(struct brcmf_fws_info *fws, u8 type, ++ u8 *data) + { + __le32 status_le; + __le16 seq_le; +@@ -1560,23 +1573,31 @@ static int brcmf_fws_txstatus_indicate(s + u32 genbit; + u8 flags; + u16 seq; ++ u8 compcnt; ++ u8 compcnt_offset = BRCMF_FWS_TYPE_TXSTATUS_LEN; + +- fws->stats.txs_indicate++; + memcpy(&status_le, data, sizeof(status_le)); + status = le32_to_cpu(status_le); + flags = brcmf_txstatus_get_field(status, FLAGS); + hslot = brcmf_txstatus_get_field(status, HSLOT); + genbit = brcmf_txstatus_get_field(status, GENERATION); + if (BRCMF_FWS_MODE_GET_REUSESEQ(fws->mode)) { +- memcpy(&seq_le, &data[BRCMF_FWS_TYPE_PKTTAG_LEN], ++ memcpy(&seq_le, &data[BRCMF_FWS_TYPE_TXSTATUS_LEN], + sizeof(seq_le)); + seq = le16_to_cpu(seq_le); ++ compcnt_offset += BRCMF_FWS_TYPE_SEQ_LEN; + } else { + seq = 0; + } + ++ if (type == BRCMF_FWS_TYPE_COMP_TXSTATUS) ++ compcnt = data[compcnt_offset]; ++ else ++ compcnt = 1; ++ fws->stats.txs_indicate += compcnt; ++ + brcmf_fws_lock(fws); +- brcmf_fws_txs_process(fws, flags, hslot, genbit, seq); ++ brcmf_fws_txs_process(fws, flags, hslot, genbit, seq, compcnt); + brcmf_fws_unlock(fws); + return BRCMF_FWS_RET_OK_NOSCHEDULE; + } +@@ -1892,8 +1913,6 @@ void brcmf_fws_hdrpull(struct brcmf_if * + + err = BRCMF_FWS_RET_OK_NOSCHEDULE; + switch (type) { +- case BRCMF_FWS_TYPE_COMP_TXSTATUS: +- break; + case BRCMF_FWS_TYPE_HOST_REORDER_RXPKTS: + rd = (struct brcmf_skb_reorder_data *)skb->cb; + rd->reorder = data; +@@ -1916,7 +1935,8 @@ void brcmf_fws_hdrpull(struct brcmf_if * + err = brcmf_fws_request_indicate(fws, type, data); + break; + case BRCMF_FWS_TYPE_TXSTATUS: +- brcmf_fws_txstatus_indicate(fws, data); ++ case BRCMF_FWS_TYPE_COMP_TXSTATUS: ++ brcmf_fws_txstatus_indicate(fws, type, data); + break; + case BRCMF_FWS_TYPE_FIFO_CREDITBACK: + err = brcmf_fws_fifocreditback_indicate(fws, data); +@@ -2005,7 +2025,7 @@ static void brcmf_fws_rollback_toq(struc + fws->stats.rollback_failed++; + hslot = brcmf_skb_htod_tag_get_field(skb, HSLOT); + brcmf_fws_txs_process(fws, BRCMF_FWS_TXSTATUS_HOST_TOSSED, +- hslot, 0, 0); ++ hslot, 0, 0, 1); + } else { + fws->stats.rollback_success++; + brcmf_fws_return_credits(fws, fifo, 1); +@@ -2476,7 +2496,8 @@ void brcmf_fws_bustxfail(struct brcmf_fw + } + brcmf_fws_lock(fws); + hslot = brcmf_skb_htod_tag_get_field(skb, HSLOT); +- brcmf_fws_txs_process(fws, BRCMF_FWS_TXSTATUS_HOST_TOSSED, hslot, 0, 0); ++ brcmf_fws_txs_process(fws, BRCMF_FWS_TXSTATUS_HOST_TOSSED, hslot, 0, 0, ++ 1); + brcmf_fws_unlock(fws); + } + diff --git a/package/kernel/mac80211/patches/brcm/329-v5.0-0001-brcmfmac-add-4354-raw-pcie-device-id.patch b/package/kernel/mac80211/patches/brcm/329-v5.0-0001-brcmfmac-add-4354-raw-pcie-device-id.patch new file mode 100644 index 00000000000000..ead33db0d5c4f9 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/329-v5.0-0001-brcmfmac-add-4354-raw-pcie-device-id.patch @@ -0,0 +1,36 @@ +From eb6b33bfb8f56859df7264dccc2ca8ab7c57342a Mon Sep 17 00:00:00 2001 +From: Winnie Chang +Date: Wed, 21 Nov 2018 07:53:42 +0000 +Subject: [PATCH] brcmfmac: add 4354 raw pcie device id + +Add the raw 4354 PCIe device ID for unprogrammed Cypress boards. + +Reviewed-by: Arend Van Spriel +Signed-off-by: Winnie Chang +Signed-off-by: Chi-Hsien Lin +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 1 + + drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 1 + + 2 files changed, 2 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -2019,6 +2019,7 @@ static const struct dev_pm_ops brcmf_pci + static const struct pci_device_id brcmf_pcie_devid_table[] = { + BRCMF_PCIE_DEVICE(BRCM_PCIE_4350_DEVICE_ID), + BRCMF_PCIE_DEVICE_SUB(0x4355, BRCM_PCIE_VENDOR_ID_BROADCOM, 0x4355), ++ BRCMF_PCIE_DEVICE(BRCM_PCIE_4354_RAW_DEVICE_ID), + BRCMF_PCIE_DEVICE(BRCM_PCIE_4356_DEVICE_ID), + BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID), + BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID), +--- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h ++++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h +@@ -74,6 +74,7 @@ + /* PCIE Device IDs */ + #define BRCM_PCIE_4350_DEVICE_ID 0x43a3 + #define BRCM_PCIE_4354_DEVICE_ID 0x43df ++#define BRCM_PCIE_4354_RAW_DEVICE_ID 0x4354 + #define BRCM_PCIE_4356_DEVICE_ID 0x43ec + #define BRCM_PCIE_43567_DEVICE_ID 0x43d3 + #define BRCM_PCIE_43570_DEVICE_ID 0x43d9 diff --git a/package/kernel/mac80211/patches/brcm/329-v5.0-0004-brcmfmac-add-support-for-CYW43012-SDIO-chipset.patch b/package/kernel/mac80211/patches/brcm/329-v5.0-0004-brcmfmac-add-support-for-CYW43012-SDIO-chipset.patch new file mode 100644 index 00000000000000..2c7828cf5fd17c --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/329-v5.0-0004-brcmfmac-add-support-for-CYW43012-SDIO-chipset.patch @@ -0,0 +1,253 @@ +From 35cb51b2162a1a7c5cd977f92595e60ab14d3b22 Mon Sep 17 00:00:00 2001 +From: Chi-Hsien Lin +Date: Wed, 21 Nov 2018 07:53:47 +0000 +Subject: [PATCH] brcmfmac: add support for CYW43012 SDIO chipset + +CYW43012 is a 1x1 802.11a/b/g/n Dual-Band HT20, 256-QAM/Turbo QAM. It +is an Ultra Low Power WLAN+BT combo chip. + +Reviewed-by: Arend van Spriel +Signed-off-by: Chi-Hsien Lin +Signed-off-by: Praveen Babu C +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/bcmsdh.c | 1 + + .../broadcom/brcm80211/brcmfmac/chip.c | 14 +++- + .../broadcom/brcm80211/brcmfmac/sdio.c | 74 ++++++++++++++++--- + .../broadcom/brcm80211/include/brcm_hw_ids.h | 1 + + include/linux/mmc/sdio_ids.h | 1 + + 5 files changed, 78 insertions(+), 13 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +@@ -972,6 +972,7 @@ static const struct sdio_device_id brcmf + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4356), + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_CYPRESS_4373), ++ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_CYPRESS_43012), + { /* end: all zeroes */ } + }; + MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_ids); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +@@ -165,6 +165,7 @@ struct sbconfig { + #define SRCI_LSS_MASK 0x00f00000 + #define SRCI_LSS_SHIFT 20 + #define SRCI_SRNB_MASK 0xf0 ++#define SRCI_SRNB_MASK_EXT 0x100 + #define SRCI_SRNB_SHIFT 4 + #define SRCI_SRBSZ_MASK 0xf + #define SRCI_SRBSZ_SHIFT 0 +@@ -592,7 +593,13 @@ static void brcmf_chip_socram_ramsize(st + if (lss != 0) + *ramsize += (1 << ((lss - 1) + SR_BSZ_BASE)); + } else { +- nb = (coreinfo & SRCI_SRNB_MASK) >> SRCI_SRNB_SHIFT; ++ /* length of SRAM Banks increased for corerev greater than 23 */ ++ if (sr->pub.rev >= 23) { ++ nb = (coreinfo & (SRCI_SRNB_MASK | SRCI_SRNB_MASK_EXT)) ++ >> SRCI_SRNB_SHIFT; ++ } else { ++ nb = (coreinfo & SRCI_SRNB_MASK) >> SRCI_SRNB_SHIFT; ++ } + for (i = 0; i < nb; i++) { + retent = brcmf_chip_socram_banksize(sr, i, &banksize); + *ramsize += banksize; +@@ -1356,6 +1363,11 @@ bool brcmf_chip_sr_capable(struct brcmf_ + addr = CORE_CC_REG(base, sr_control1); + reg = chip->ops->read32(chip->ctx, addr); + return reg != 0; ++ case CY_CC_43012_CHIP_ID: ++ addr = CORE_CC_REG(pmu->base, retention_ctl); ++ reg = chip->ops->read32(chip->ctx, addr); ++ return (reg & (PMU_RCTL_MACPHY_DISABLE_MASK | ++ PMU_RCTL_LOGIC_DISABLE_MASK)) == 0; + default: + addr = CORE_CC_REG(pmu->base, pmucapabilities_ext); + reg = chip->ops->read32(chip->ctx, addr); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -624,6 +624,7 @@ BRCMF_FW_DEF(43455, "brcmfmac43455-sdio" + BRCMF_FW_DEF(4354, "brcmfmac4354-sdio"); + BRCMF_FW_DEF(4356, "brcmfmac4356-sdio"); + BRCMF_FW_DEF(4373, "brcmfmac4373-sdio"); ++BRCMF_FW_DEF(43012, "brcmfmac43012-sdio"); + + static const struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = { + BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143), +@@ -643,7 +644,8 @@ static const struct brcmf_firmware_mappi + BRCMF_FW_ENTRY(BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, 43455), + BRCMF_FW_ENTRY(BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, 4354), + BRCMF_FW_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356), +- BRCMF_FW_ENTRY(CY_CC_4373_CHIP_ID, 0xFFFFFFFF, 4373) ++ BRCMF_FW_ENTRY(CY_CC_4373_CHIP_ID, 0xFFFFFFFF, 4373), ++ BRCMF_FW_ENTRY(CY_CC_43012_CHIP_ID, 0xFFFFFFFF, 43012) + }; + + static void pkt_align(struct sk_buff *p, int len, int align) +@@ -683,6 +685,14 @@ brcmf_sdio_kso_control(struct brcmf_sdio + /* 1st KSO write goes to AOS wake up core if device is asleep */ + brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, wr_val, &err); + ++ /* In case of 43012 chip, the chip could go down immediately after ++ * KSO bit is cleared. So the further reads of KSO register could ++ * fail. Thereby just bailing out immediately after clearing KSO ++ * bit, to avoid polling of KSO bit. ++ */ ++ if (!on && bus->ci->chip == CY_CC_43012_CHIP_ID) ++ return err; ++ + if (on) { + /* device WAKEUP through KSO: + * write bit 0 & read back until +@@ -2413,6 +2423,14 @@ static int brcmf_sdio_tx_ctrlframe(struc + return ret; + } + ++static bool brcmf_chip_is_ulp(struct brcmf_chip *ci) ++{ ++ if (ci->chip == CY_CC_43012_CHIP_ID) ++ return true; ++ else ++ return false; ++} ++ + static void brcmf_sdio_bus_stop(struct device *dev) + { + struct brcmf_bus *bus_if = dev_get_drvdata(dev); +@@ -2420,7 +2438,7 @@ static void brcmf_sdio_bus_stop(struct d + struct brcmf_sdio *bus = sdiodev->bus; + struct brcmf_core *core = bus->sdio_core; + u32 local_hostintmask; +- u8 saveclk; ++ u8 saveclk, bpreq; + int err; + + brcmf_dbg(TRACE, "Enter\n"); +@@ -2447,9 +2465,14 @@ static void brcmf_sdio_bus_stop(struct d + /* Force backplane clocks to assure F2 interrupt propagates */ + saveclk = brcmf_sdiod_readb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, + &err); +- if (!err) +- brcmf_sdiod_writeb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, +- (saveclk | SBSDIO_FORCE_HT), &err); ++ if (!err) { ++ bpreq = saveclk; ++ bpreq |= brcmf_chip_is_ulp(bus->ci) ? ++ SBSDIO_HT_AVAIL_REQ : SBSDIO_FORCE_HT; ++ brcmf_sdiod_writeb(sdiodev, ++ SBSDIO_FUNC1_CHIPCLKCSR, ++ bpreq, &err); ++ } + if (err) + brcmf_err("Failed to force clock for F2: err %d\n", + err); +@@ -3339,20 +3362,45 @@ err: + return bcmerror; + } + ++static bool brcmf_sdio_aos_no_decode(struct brcmf_sdio *bus) ++{ ++ if (bus->ci->chip == CY_CC_43012_CHIP_ID) ++ return true; ++ else ++ return false; ++} ++ + static void brcmf_sdio_sr_init(struct brcmf_sdio *bus) + { + int err = 0; + u8 val; ++ u8 wakeupctrl; ++ u8 cardcap; ++ u8 chipclkcsr; + + brcmf_dbg(TRACE, "Enter\n"); + ++ if (brcmf_chip_is_ulp(bus->ci)) { ++ wakeupctrl = SBSDIO_FUNC1_WCTRL_ALPWAIT_SHIFT; ++ chipclkcsr = SBSDIO_HT_AVAIL_REQ; ++ } else { ++ wakeupctrl = SBSDIO_FUNC1_WCTRL_HTWAIT_SHIFT; ++ chipclkcsr = SBSDIO_FORCE_HT; ++ } ++ ++ if (brcmf_sdio_aos_no_decode(bus)) { ++ cardcap = SDIO_CCCR_BRCM_CARDCAP_CMD_NODEC; ++ } else { ++ cardcap = (SDIO_CCCR_BRCM_CARDCAP_CMD14_SUPPORT | ++ SDIO_CCCR_BRCM_CARDCAP_CMD14_EXT); ++ } ++ + val = brcmf_sdiod_readb(bus->sdiodev, SBSDIO_FUNC1_WAKEUPCTRL, &err); + if (err) { + brcmf_err("error reading SBSDIO_FUNC1_WAKEUPCTRL\n"); + return; + } +- +- val |= 1 << SBSDIO_FUNC1_WCTRL_HTWAIT_SHIFT; ++ val |= 1 << wakeupctrl; + brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_FUNC1_WAKEUPCTRL, val, &err); + if (err) { + brcmf_err("error writing SBSDIO_FUNC1_WAKEUPCTRL\n"); +@@ -3361,8 +3409,7 @@ static void brcmf_sdio_sr_init(struct br + + /* Add CMD14 Support */ + brcmf_sdiod_func0_wb(bus->sdiodev, SDIO_CCCR_BRCM_CARDCAP, +- (SDIO_CCCR_BRCM_CARDCAP_CMD14_SUPPORT | +- SDIO_CCCR_BRCM_CARDCAP_CMD14_EXT), ++ cardcap, + &err); + if (err) { + brcmf_err("error writing SDIO_CCCR_BRCM_CARDCAP\n"); +@@ -3370,7 +3417,7 @@ static void brcmf_sdio_sr_init(struct br + } + + brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, +- SBSDIO_FORCE_HT, &err); ++ chipclkcsr, &err); + if (err) { + brcmf_err("error writing SBSDIO_FUNC1_CHIPCLKCSR\n"); + return; +@@ -4062,7 +4109,7 @@ static void brcmf_sdio_firmware_callback + const struct firmware *code; + void *nvram; + u32 nvram_len; +- u8 saveclk; ++ u8 saveclk, bpreq; + u8 devctl; + + brcmf_dbg(TRACE, "Enter: dev=%s, err=%d\n", dev_name(dev), err); +@@ -4096,8 +4143,11 @@ static void brcmf_sdio_firmware_callback + /* Force clocks on backplane to be sure F2 interrupt propagates */ + saveclk = brcmf_sdiod_readb(sdiod, SBSDIO_FUNC1_CHIPCLKCSR, &err); + if (!err) { ++ bpreq = saveclk; ++ bpreq |= brcmf_chip_is_ulp(bus->ci) ? ++ SBSDIO_HT_AVAIL_REQ : SBSDIO_FORCE_HT; + brcmf_sdiod_writeb(sdiod, SBSDIO_FUNC1_CHIPCLKCSR, +- (saveclk | SBSDIO_FORCE_HT), &err); ++ bpreq, &err); + } + if (err) { + brcmf_err("Failed to force clock for F2: err %d\n", err); +--- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h ++++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h +@@ -60,6 +60,7 @@ + #define BRCM_CC_43664_CHIP_ID 43664 + #define BRCM_CC_4371_CHIP_ID 0x4371 + #define CY_CC_4373_CHIP_ID 0x4373 ++#define CY_CC_43012_CHIP_ID 43012 + + /* USB Device IDs */ + #define BRCM_USB_43143_DEVICE_ID 0xbd1e +--- a/include/linux/mmc/sdio_ids.h ++++ b/include/linux/mmc/sdio_ids.h +@@ -42,6 +42,7 @@ + #define SDIO_DEVICE_ID_BROADCOM_4354 0x4354 + #define SDIO_DEVICE_ID_BROADCOM_4356 0x4356 + #define SDIO_DEVICE_ID_CYPRESS_4373 0x4373 ++#define SDIO_DEVICE_ID_CYPRESS_43012 43012 + + #define SDIO_VENDOR_ID_INTEL 0x0089 + #define SDIO_DEVICE_ID_INTEL_IWMC3200WIMAX 0x1402 diff --git a/package/kernel/mac80211/patches/brcm/329-v5.0-0005-brcmfmac-allow-GCI-core-enumuration.patch b/package/kernel/mac80211/patches/brcm/329-v5.0-0005-brcmfmac-allow-GCI-core-enumuration.patch new file mode 100644 index 00000000000000..809ee9a5168eea --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/329-v5.0-0005-brcmfmac-allow-GCI-core-enumuration.patch @@ -0,0 +1,60 @@ +From b021a6bc1175442609af0b66d64f850883e155fb Mon Sep 17 00:00:00 2001 +From: Chi-Hsien Lin +Date: Wed, 21 Nov 2018 07:53:48 +0000 +Subject: [PATCH] brcmfmac: allow GCI core enumuration + +GCI core is needed for ULP operation. Allow GCI core enumuration with +below changes: + - Allow GCI to be added to core list even when it doesn't have a wrapper. + - Allow 8K address space size. + - Don't overwrite the address value when an additional size descriptor + is in place. + +Reviewed-by: Arend van Spriel +Signed-off-by: Chi-Hsien Lin +Signed-off-by: Kalle Valo +--- + .../wireless/broadcom/brcm80211/brcmfmac/chip.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +@@ -786,7 +786,7 @@ static int brcmf_chip_dmp_get_regaddr(st + u32 *regbase, u32 *wrapbase) + { + u8 desc; +- u32 val; ++ u32 val, szdesc; + u8 mpnum = 0; + u8 stype, sztype, wraptype; + +@@ -832,14 +832,15 @@ static int brcmf_chip_dmp_get_regaddr(st + + /* next size descriptor can be skipped */ + if (sztype == DMP_SLAVE_SIZE_DESC) { +- val = brcmf_chip_dmp_get_desc(ci, eromaddr, NULL); ++ szdesc = brcmf_chip_dmp_get_desc(ci, eromaddr, NULL); + /* skip upper size descriptor if present */ +- if (val & DMP_DESC_ADDRSIZE_GT32) ++ if (szdesc & DMP_DESC_ADDRSIZE_GT32) + brcmf_chip_dmp_get_desc(ci, eromaddr, NULL); + } + +- /* only look for 4K register regions */ +- if (sztype != DMP_SLAVE_SIZE_4K) ++ /* look for 4K or 8K register regions */ ++ if (sztype != DMP_SLAVE_SIZE_4K && ++ sztype != DMP_SLAVE_SIZE_8K) + continue; + + stype = (val & DMP_SLAVE_TYPE) >> DMP_SLAVE_TYPE_S; +@@ -896,7 +897,8 @@ int brcmf_chip_dmp_erom_scan(struct brcm + + /* need core with ports */ + if (nmw + nsw == 0 && +- id != BCMA_CORE_PMU) ++ id != BCMA_CORE_PMU && ++ id != BCMA_CORE_GCI) + continue; + + /* try to obtain register address info */ diff --git a/package/kernel/mac80211/patches/brcm/329-v5.0-0006-brcmfmac-update-43012-F2-watermark-setting-to-fix-DM.patch b/package/kernel/mac80211/patches/brcm/329-v5.0-0006-brcmfmac-update-43012-F2-watermark-setting-to-fix-DM.patch new file mode 100644 index 00000000000000..c43f0668e95e82 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/329-v5.0-0006-brcmfmac-update-43012-F2-watermark-setting-to-fix-DM.patch @@ -0,0 +1,49 @@ +From f95a8d9c6aca196f1ace5b2e53a3dd3bc491b1b3 Mon Sep 17 00:00:00 2001 +From: Naveen Gupta +Date: Wed, 21 Nov 2018 07:53:49 +0000 +Subject: [PATCH] brcmfmac: update 43012 F2 watermark setting to fix DMA Error + during UDP RX Traffic + +The number of words that the read FIFO has to contain except +the end of frame before sends data back to the host. +Max watermark = (512B - 2* (BurstLength))/4 = +(512 - 128)/4 = 384/4 = 0x60 +so if burst length (i.e. BurstLength = 64) is increased, +watermark has to be reduced. This is the optimal setting for this chip. + +Reviewed-by: Arend van Spriel +Signed-off-by: Naveen Gupta +Signed-off-by: Chi-Hsien Lin +Signed-off-by: Kalle Valo +--- + .../net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -52,6 +52,7 @@ + /* watermark expressed in number of words */ + #define DEFAULT_F2_WATERMARK 0x8 + #define CY_4373_F2_WATERMARK 0x40 ++#define CY_43012_F2_WATERMARK 0x60 + + #ifdef DEBUG + +@@ -4184,6 +4185,17 @@ static void brcmf_sdio_firmware_callback + CY_4373_F2_WATERMARK | + SBSDIO_MESBUSYCTRL_ENAB, &err); + break; ++ case SDIO_DEVICE_ID_CYPRESS_43012: ++ brcmf_dbg(INFO, "set F2 watermark to 0x%x*4 bytes\n", ++ CY_43012_F2_WATERMARK); ++ brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK, ++ CY_43012_F2_WATERMARK, &err); ++ devctl = brcmf_sdiod_readb(sdiod, SBSDIO_DEVICE_CTL, ++ &err); ++ devctl |= SBSDIO_DEVCTL_F2WM_ENAB; ++ brcmf_sdiod_writeb(sdiod, SBSDIO_DEVICE_CTL, devctl, ++ &err); ++ break; + default: + brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK, + DEFAULT_F2_WATERMARK, &err); diff --git a/package/kernel/mac80211/patches/brcm/329-v5.0-0007-brcmfmac-4373-save-restore-support.patch b/package/kernel/mac80211/patches/brcm/329-v5.0-0007-brcmfmac-4373-save-restore-support.patch new file mode 100644 index 00000000000000..61c65692ded8c8 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/329-v5.0-0007-brcmfmac-4373-save-restore-support.patch @@ -0,0 +1,57 @@ +From 2f2d389efda4caa4c1b69cb4fa2ab217f0fe6d6f Mon Sep 17 00:00:00 2001 +From: Chi-Hsien Lin +Date: Wed, 21 Nov 2018 07:53:50 +0000 +Subject: [PATCH] brcmfmac: 4373 save-restore support + +Use chipcommon sr_control0 register to check 4373 sr support. + +Reviewed-by: Arend van Spriel +Signed-off-by: Chi-Hsien Lin +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/chip.c | 5 +++++ + .../broadcom/brcm80211/include/chipcommon.h | 19 +++++++++++++++++++ + 2 files changed, 24 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +@@ -1365,6 +1365,11 @@ bool brcmf_chip_sr_capable(struct brcmf_ + addr = CORE_CC_REG(base, sr_control1); + reg = chip->ops->read32(chip->ctx, addr); + return reg != 0; ++ case CY_CC_4373_CHIP_ID: ++ /* explicitly check SR engine enable bit */ ++ addr = CORE_CC_REG(base, sr_control0); ++ reg = chip->ops->read32(chip->ctx, addr); ++ return (reg & CC_SR_CTL0_ENABLE_MASK) != 0; + case CY_CC_43012_CHIP_ID: + addr = CORE_CC_REG(pmu->base, retention_ctl); + reg = chip->ops->read32(chip->ctx, addr); +--- a/drivers/net/wireless/broadcom/brcm80211/include/chipcommon.h ++++ b/drivers/net/wireless/broadcom/brcm80211/include/chipcommon.h +@@ -269,6 +269,25 @@ struct chipcregs { + /* GSIO (spi/i2c) present, rev >= 37 */ + #define CC_CAP2_GSIO 0x00000002 + ++/* sr_control0, rev >= 48 */ ++#define CC_SR_CTL0_ENABLE_MASK BIT(0) ++#define CC_SR_CTL0_ENABLE_SHIFT 0 ++#define CC_SR_CTL0_EN_SR_ENG_CLK_SHIFT 1 /* sr_clk to sr_memory enable */ ++#define CC_SR_CTL0_RSRC_TRIGGER_SHIFT 2 /* Rising edge resource trigger 0 to ++ * sr_engine ++ */ ++#define CC_SR_CTL0_MIN_DIV_SHIFT 6 /* Min division value for fast clk ++ * in sr_engine ++ */ ++#define CC_SR_CTL0_EN_SBC_STBY_SHIFT 16 ++#define CC_SR_CTL0_EN_SR_ALP_CLK_MASK_SHIFT 18 ++#define CC_SR_CTL0_EN_SR_HT_CLK_SHIFT 19 ++#define CC_SR_CTL0_ALLOW_PIC_SHIFT 20 /* Allow pic to separate power ++ * domains ++ */ ++#define CC_SR_CTL0_MAX_SR_LQ_CLK_CNT_SHIFT 25 ++#define CC_SR_CTL0_EN_MEM_DISABLE_FOR_SLEEP 30 ++ + /* pmucapabilities */ + #define PCAP_REV_MASK 0x000000ff + #define PCAP_RC_MASK 0x00001f00 diff --git a/package/kernel/mac80211/patches/brcm/329-v5.0-0008-brcmfmac-disable-command-decode-in-sdio_aos.patch b/package/kernel/mac80211/patches/brcm/329-v5.0-0008-brcmfmac-disable-command-decode-in-sdio_aos.patch new file mode 100644 index 00000000000000..63f30fb8e6dc69 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/329-v5.0-0008-brcmfmac-disable-command-decode-in-sdio_aos.patch @@ -0,0 +1,45 @@ +From 29f6589140a10ece8c1d73f58043ea5b3473ab3e Mon Sep 17 00:00:00 2001 +From: Wright Feng +Date: Wed, 21 Nov 2018 07:53:52 +0000 +Subject: [PATCH] brcmfmac: disable command decode in sdio_aos + +AOS is a part of the SDIOD core that becomes active when the rest of +SDIOD is sleeping to keep SDIO bus alive responding to reduced set of +commands. + +Transaction between AOS and SDIOD is not protected, and if cmd 52 is +received in AOS and in the middle of response state changed from AOS to +SDIOD, response is corrupted and it causes to SDIO Host controller to +hang. + +Command decode for below chips are disabled in this commit: + - 4339 + - 4345 + - 4354 + - 4373 + +Reviewed-by: Arend van Spriel +Signed-off-by: Wright Feng +Signed-off-by: Double Lo +Signed-off-by: Madhan Mohan R +Signed-off-by: Chi-Hsien Lin +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -3365,7 +3365,11 @@ err: + + static bool brcmf_sdio_aos_no_decode(struct brcmf_sdio *bus) + { +- if (bus->ci->chip == CY_CC_43012_CHIP_ID) ++ if (bus->ci->chip == CY_CC_43012_CHIP_ID || ++ bus->ci->chip == CY_CC_4373_CHIP_ID || ++ bus->ci->chip == BRCM_CC_4339_CHIP_ID || ++ bus->ci->chip == BRCM_CC_4345_CHIP_ID || ++ bus->ci->chip == BRCM_CC_4354_CHIP_ID) + return true; + else + return false; diff --git a/package/kernel/mac80211/patches/brcm/330-v5.0-0001-brcmfmac-fix-false-positive-Wmaybe-unintialized-warn.patch b/package/kernel/mac80211/patches/brcm/330-v5.0-0001-brcmfmac-fix-false-positive-Wmaybe-unintialized-warn.patch new file mode 100644 index 00000000000000..5d454fd3eed7c4 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/330-v5.0-0001-brcmfmac-fix-false-positive-Wmaybe-unintialized-warn.patch @@ -0,0 +1,34 @@ +From 412dd15c8177d93abe0c8787b83b31c5eb061405 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Mon, 10 Dec 2018 21:55:37 +0100 +Subject: [PATCH] brcmfmac: fix false-positive -Wmaybe-unintialized warning + +When CONFIG_NO_AUTO_INLINE is set, we get a false-postive warning +for the brcmf_fw_request_nvram_done() function, after gcc figures +out that brcmf_fw_nvram_from_efi() might not set the 'data_len' +variable, but fails to notice that it always returns NULL: + +drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c: In function 'brcmf_fw_request_nvram_done': +drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:560:11: error: 'data_len' may be used uninitialized in this function [-Werror=maybe-uninitialized] + +Mark it 'inline' to force gcc to understand this. + +Fixes: ce2e6db554fa ("brcmfmac: Add support for getting nvram contents from EFI variables") +Signed-off-by: Arnd Bergmann +Reviewed-by: Hans de Goede +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -512,7 +512,7 @@ fail: + return NULL; + } + #else +-static u8 *brcmf_fw_nvram_from_efi(size_t *data_len) { return NULL; } ++static inline u8 *brcmf_fw_nvram_from_efi(size_t *data_len) { return NULL; } + #endif + + static void brcmf_fw_free_request(struct brcmf_fw_request *req) diff --git a/package/kernel/mac80211/patches/brcm/340-v5.1-brcmfmac-Add-DMI-nvram-filename-quirk-for-PoV-TAB-P1.patch b/package/kernel/mac80211/patches/brcm/340-v5.1-brcmfmac-Add-DMI-nvram-filename-quirk-for-PoV-TAB-P1.patch new file mode 100644 index 00000000000000..4cb3a4243af535 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/340-v5.1-brcmfmac-Add-DMI-nvram-filename-quirk-for-PoV-TAB-P1.patch @@ -0,0 +1,51 @@ +From 4d95f99c59b8b814bcf09ba86020d937ec7caa86 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Thu, 20 Dec 2018 17:40:58 +0100 +Subject: [PATCH] brcmfmac: Add DMI nvram filename quirk for PoV TAB-P1006W-232 + tablet + +The Point of View TAB-P1006W-232 tablet contains quite generic names in +the sys_vendor and product_name DMI strings, without this patch brcmfmac +will try to load: brcmfmac43340-sdio.Insyde-BayTrail.txt as nvram file +which is a bit too generic. + +Add a DMI quirk so that a unique and clearly identifiable nvram file +name is used on the PoV TAB-P1006W-232 tablet. + +Signed-off-by: Hans de Goede +Signed-off-by: Kalle Valo +--- + .../wireless/broadcom/brcm80211/brcmfmac/dmi.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c +@@ -43,6 +43,10 @@ static const struct brcmf_dmi_data meego + BRCM_CC_43340_CHIP_ID, 2, "meegopad-t08" + }; + ++static const struct brcmf_dmi_data pov_tab_p1006w_data = { ++ BRCM_CC_43340_CHIP_ID, 2, "pov-tab-p1006w-data" ++}; ++ + static const struct dmi_system_id dmi_platform_data[] = { + { + /* Match for the GPDwin which unfortunately uses somewhat +@@ -81,6 +85,17 @@ static const struct dmi_system_id dmi_pl + }, + .driver_data = (void *)&meegopad_t08_data, + }, ++ { ++ /* Point of View TAB-P1006W-232 */ ++ .matches = { ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Insyde"), ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "BayTrail"), ++ /* Note 105b is Foxcon's USB/PCI vendor id */ ++ DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "105B"), ++ DMI_EXACT_MATCH(DMI_BOARD_NAME, "0E57"), ++ }, ++ .driver_data = (void *)&pov_tab_p1006w_data, ++ }, + {} + }; + diff --git a/package/kernel/mac80211/patches/brcm/341-v5.1-brcmfmac-add-a-check-for-the-status-of-usb_register.patch b/package/kernel/mac80211/patches/brcm/341-v5.1-brcmfmac-add-a-check-for-the-status-of-usb_register.patch new file mode 100644 index 00000000000000..5104666b69c10c --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/341-v5.1-brcmfmac-add-a-check-for-the-status-of-usb_register.patch @@ -0,0 +1,28 @@ +From 42daad3343be4a4e1ee03e30a5f5cc731dadfef5 Mon Sep 17 00:00:00 2001 +From: Kangjie Lu +Date: Tue, 25 Dec 2018 19:22:24 -0600 +Subject: [PATCH] brcmfmac: add a check for the status of usb_register + +usb_register() may fail, so let's check its status and issue an error +message if it fails. + +Signed-off-by: Kangjie Lu +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -1557,6 +1557,10 @@ void brcmf_usb_exit(void) + + void brcmf_usb_register(void) + { ++ int ret; ++ + brcmf_dbg(USB, "Enter\n"); +- usb_register(&brcmf_usbdrvr); ++ ret = usb_register(&brcmf_usbdrvr); ++ if (ret) ++ brcmf_err("usb_register failed %d\n", ret); + } diff --git a/package/kernel/mac80211/patches/brcm/342-v5.1-brcmfmac-fix-system-warning-message-during-wowl-susp.patch b/package/kernel/mac80211/patches/brcm/342-v5.1-brcmfmac-fix-system-warning-message-during-wowl-susp.patch new file mode 100644 index 00000000000000..9115373addcbff --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/342-v5.1-brcmfmac-fix-system-warning-message-during-wowl-susp.patch @@ -0,0 +1,33 @@ +From 3a33bd840523aaa06f4429fbfd38922bf0dc2e8d Mon Sep 17 00:00:00 2001 +From: Lo-Hsiang Lo +Date: Mon, 7 Jan 2019 08:46:16 +0000 +Subject: [PATCH] brcmfmac: fix system warning message during wowl suspend + +There is a system warning message, warn_slowpath-fmt, during suspend +while using supplicant join AP and enable wowl feature by IW command. +It's caused by brcmf_pno_remove_request path can't find the reqid. +This fix will not go to remove pno request function if there is no +pno scan. + +Acked-by: Arend van Spriel +Signed-off-by: Lo-Hsiang Lo +Signed-off-by: Chi-Hsien Lin +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c +@@ -496,6 +496,11 @@ int brcmf_pno_stop_sched_scan(struct brc + brcmf_dbg(TRACE, "reqid=%llu\n", reqid); + + pi = ifp_to_pno(ifp); ++ ++ /* No PNO request */ ++ if (!pi->n_reqs) ++ return 0; ++ + err = brcmf_pno_remove_request(pi, reqid); + if (err) + return err; diff --git a/package/kernel/mac80211/patches/brcm/344-v5.1-brcmfmac-modify-__brcmf_err-to-take-bus-as-a-paramet.patch b/package/kernel/mac80211/patches/brcm/344-v5.1-brcmfmac-modify-__brcmf_err-to-take-bus-as-a-paramet.patch new file mode 100644 index 00000000000000..f83f38f27496cb --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/344-v5.1-brcmfmac-modify-__brcmf_err-to-take-bus-as-a-paramet.patch @@ -0,0 +1,104 @@ +From 5cc898fbcb352b764f8d51c16e10e2eb0056173d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 6 Feb 2019 12:28:15 +0100 +Subject: [PATCH] brcmfmac: modify __brcmf_err() to take bus as a parameter +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +So far __brcmf_err() was using pr_err() which didn't allow identifying +device that was affected by an error. It's crucial for systems with more +than 1 device supported by brcmfmac (a common case for home routers). + +This change allows passing struct brcmf_bus to the __brcmf_err(). That +struct has been agreed to be the most common one. It allows accessing +struct device easily & using dev_err() printing helper. + +Signed-off-by: Rafał Miłecki +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../net/wireless/broadcom/brcm80211/brcmfmac/common.c | 7 +++++-- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 8 +++++--- + .../wireless/broadcom/brcm80211/brcmfmac/tracepoint.c | 9 +++++++-- + 3 files changed, 17 insertions(+), 7 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -350,7 +350,7 @@ done: + } + + #ifndef CPTCFG_BRCM_TRACING +-void __brcmf_err(const char *func, const char *fmt, ...) ++void __brcmf_err(struct brcmf_bus *bus, const char *func, const char *fmt, ...) + { + struct va_format vaf; + va_list args; +@@ -359,7 +359,10 @@ void __brcmf_err(const char *func, const + + vaf.fmt = fmt; + vaf.va = &args; +- pr_err("%s: %pV", func, &vaf); ++ if (bus) ++ dev_err(bus->dev, "%s: %pV", func, &vaf); ++ else ++ pr_err("%s: %pV", func, &vaf); + + va_end(args); + } +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +@@ -45,8 +45,10 @@ + #undef pr_fmt + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +-__printf(2, 3) +-void __brcmf_err(const char *func, const char *fmt, ...); ++struct brcmf_bus; ++ ++__printf(3, 4) ++void __brcmf_err(struct brcmf_bus *bus, const char *func, const char *fmt, ...); + /* Macro for error messages. When debugging / tracing the driver all error + * messages are important to us. + */ +@@ -55,7 +57,7 @@ void __brcmf_err(const char *func, const + if (IS_ENABLED(CPTCFG_BRCMDBG) || \ + IS_ENABLED(CPTCFG_BRCM_TRACING) || \ + net_ratelimit()) \ +- __brcmf_err(__func__, fmt, ##__VA_ARGS__); \ ++ __brcmf_err(NULL, __func__, fmt, ##__VA_ARGS__);\ + } while (0) + + #if defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c +@@ -14,14 +14,16 @@ + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + ++#include + #include /* bug in tracepoint.h, it should include this */ + + #ifndef __CHECKER__ + #define CREATE_TRACE_POINTS ++#include "bus.h" + #include "tracepoint.h" + #include "debug.h" + +-void __brcmf_err(const char *func, const char *fmt, ...) ++void __brcmf_err(struct brcmf_bus *bus, const char *func, const char *fmt, ...) + { + struct va_format vaf = { + .fmt = fmt, +@@ -30,7 +32,10 @@ void __brcmf_err(const char *func, const + + va_start(args, fmt); + vaf.va = &args; +- pr_err("%s: %pV", func, &vaf); ++ if (bus) ++ dev_err(bus->dev, "%s: %pV", func, &vaf); ++ else ++ pr_err("%s: %pV", func, &vaf); + trace_brcmf_err(func, &vaf); + va_end(args); + } diff --git a/package/kernel/mac80211/patches/brcm/345-v5.1-brcmfmac-pass-bus-to-the-__brcmf_err-in-pcie.c.patch b/package/kernel/mac80211/patches/brcm/345-v5.1-brcmfmac-pass-bus-to-the-__brcmf_err-in-pcie.c.patch new file mode 100644 index 00000000000000..8eceee68593b59 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/345-v5.1-brcmfmac-pass-bus-to-the-__brcmf_err-in-pcie.c.patch @@ -0,0 +1,266 @@ +From 8602e62441aba276cafd68034b72162fbc5ca0a6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 6 Feb 2019 12:28:16 +0100 +Subject: [PATCH] brcmfmac: pass bus to the __brcmf_err() in pcie.c +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This enables dev_err() usage (instead of pr_err()) in the __brcmf_err(). +It makes error messages more meaningful and is important for debugging +errors/bugs on systems with multiple brcmfmac supported devices. + +All bus files should follow & get updated similarly (soon). + +Signed-off-by: Rafał Miłecki +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/debug.h | 2 + + .../broadcom/brcm80211/brcmfmac/pcie.c | 59 +++++++++++-------- + 2 files changed, 38 insertions(+), 23 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +@@ -52,6 +52,7 @@ void __brcmf_err(struct brcmf_bus *bus, + /* Macro for error messages. When debugging / tracing the driver all error + * messages are important to us. + */ ++#ifndef brcmf_err + #define brcmf_err(fmt, ...) \ + do { \ + if (IS_ENABLED(CPTCFG_BRCMDBG) || \ +@@ -59,6 +60,7 @@ void __brcmf_err(struct brcmf_bus *bus, + net_ratelimit()) \ + __brcmf_err(NULL, __func__, fmt, ##__VA_ARGS__);\ + } while (0) ++#endif + + #if defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -30,6 +30,15 @@ + #include + #include + ++/* Custom brcmf_err() that takes bus arg and passes it further */ ++#define brcmf_err(bus, fmt, ...) \ ++ do { \ ++ if (IS_ENABLED(CPTCFG_BRCMDBG) || \ ++ IS_ENABLED(CPTCFG_BRCM_TRACING) || \ ++ net_ratelimit()) \ ++ __brcmf_err(bus, __func__, fmt, ##__VA_ARGS__); \ ++ } while (0) ++ + #include "debug.h" + #include "bus.h" + #include "commonring.h" +@@ -531,6 +540,7 @@ static void + brcmf_pcie_select_core(struct brcmf_pciedev_info *devinfo, u16 coreid) + { + const struct pci_dev *pdev = devinfo->pdev; ++ struct brcmf_bus *bus = dev_get_drvdata(&pdev->dev); + struct brcmf_core *core; + u32 bar0_win; + +@@ -548,7 +558,7 @@ brcmf_pcie_select_core(struct brcmf_pcie + } + } + } else { +- brcmf_err("Unsupported core selected %x\n", coreid); ++ brcmf_err(bus, "Unsupported core selected %x\n", coreid); + } + } + +@@ -848,9 +858,8 @@ static irqreturn_t brcmf_pcie_isr_thread + + static int brcmf_pcie_request_irq(struct brcmf_pciedev_info *devinfo) + { +- struct pci_dev *pdev; +- +- pdev = devinfo->pdev; ++ struct pci_dev *pdev = devinfo->pdev; ++ struct brcmf_bus *bus = dev_get_drvdata(&pdev->dev); + + brcmf_pcie_intr_disable(devinfo); + +@@ -861,7 +870,7 @@ static int brcmf_pcie_request_irq(struct + brcmf_pcie_isr_thread, IRQF_SHARED, + "brcmf_pcie_intr", devinfo)) { + pci_disable_msi(pdev); +- brcmf_err("Failed to request IRQ %d\n", pdev->irq); ++ brcmf_err(bus, "Failed to request IRQ %d\n", pdev->irq); + return -EIO; + } + devinfo->irq_allocated = true; +@@ -871,15 +880,14 @@ static int brcmf_pcie_request_irq(struct + + static void brcmf_pcie_release_irq(struct brcmf_pciedev_info *devinfo) + { +- struct pci_dev *pdev; ++ struct pci_dev *pdev = devinfo->pdev; ++ struct brcmf_bus *bus = dev_get_drvdata(&pdev->dev); + u32 status; + u32 count; + + if (!devinfo->irq_allocated) + return; + +- pdev = devinfo->pdev; +- + brcmf_pcie_intr_disable(devinfo); + free_irq(pdev->irq, devinfo); + pci_disable_msi(pdev); +@@ -891,7 +899,7 @@ static void brcmf_pcie_release_irq(struc + count++; + } + if (devinfo->in_irq) +- brcmf_err("Still in IRQ (processing) !!!\n"); ++ brcmf_err(bus, "Still in IRQ (processing) !!!\n"); + + status = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT); + brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT, status); +@@ -1102,6 +1110,7 @@ static void brcmf_pcie_release_ringbuffe + + static int brcmf_pcie_init_ringbuffers(struct brcmf_pciedev_info *devinfo) + { ++ struct brcmf_bus *bus = dev_get_drvdata(&devinfo->pdev->dev); + struct brcmf_pcie_ringbuf *ring; + struct brcmf_pcie_ringbuf *rings; + u32 d2h_w_idx_ptr; +@@ -1254,7 +1263,7 @@ static int brcmf_pcie_init_ringbuffers(s + return 0; + + fail: +- brcmf_err("Allocating ring buffers failed\n"); ++ brcmf_err(bus, "Allocating ring buffers failed\n"); + brcmf_pcie_release_ringbuffers(devinfo); + return -ENOMEM; + } +@@ -1277,6 +1286,7 @@ brcmf_pcie_release_scratchbuffers(struct + + static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo) + { ++ struct brcmf_bus *bus = dev_get_drvdata(&devinfo->pdev->dev); + u64 address; + u32 addr; + +@@ -1316,7 +1326,7 @@ static int brcmf_pcie_init_scratchbuffer + return 0; + + fail: +- brcmf_err("Allocating scratch buffers failed\n"); ++ brcmf_err(bus, "Allocating scratch buffers failed\n"); + brcmf_pcie_release_scratchbuffers(devinfo); + return -ENOMEM; + } +@@ -1437,6 +1447,7 @@ static int + brcmf_pcie_init_share_ram_info(struct brcmf_pciedev_info *devinfo, + u32 sharedram_addr) + { ++ struct brcmf_bus *bus = dev_get_drvdata(&devinfo->pdev->dev); + struct brcmf_pcie_shared_info *shared; + u32 addr; + +@@ -1448,7 +1459,8 @@ brcmf_pcie_init_share_ram_info(struct br + brcmf_dbg(PCIE, "PCIe protocol version %d\n", shared->version); + if ((shared->version > BRCMF_PCIE_MAX_SHARED_VERSION) || + (shared->version < BRCMF_PCIE_MIN_SHARED_VERSION)) { +- brcmf_err("Unsupported PCIE version %d\n", shared->version); ++ brcmf_err(bus, "Unsupported PCIE version %d\n", ++ shared->version); + return -EINVAL; + } + +@@ -1490,6 +1502,7 @@ static int brcmf_pcie_download_fw_nvram( + const struct firmware *fw, void *nvram, + u32 nvram_len) + { ++ struct brcmf_bus *bus = dev_get_drvdata(&devinfo->pdev->dev); + u32 sharedram_addr; + u32 sharedram_addr_written; + u32 loop_counter; +@@ -1544,7 +1557,7 @@ static int brcmf_pcie_download_fw_nvram( + loop_counter--; + } + if (sharedram_addr == sharedram_addr_written) { +- brcmf_err("FW failed to initialize\n"); ++ brcmf_err(bus, "FW failed to initialize\n"); + return -ENODEV; + } + brcmf_dbg(PCIE, "Shared RAM addr: 0x%08x\n", sharedram_addr); +@@ -1555,16 +1568,15 @@ static int brcmf_pcie_download_fw_nvram( + + static int brcmf_pcie_get_resource(struct brcmf_pciedev_info *devinfo) + { +- struct pci_dev *pdev; ++ struct pci_dev *pdev = devinfo->pdev; ++ struct brcmf_bus *bus = dev_get_drvdata(&pdev->dev); + int err; + phys_addr_t bar0_addr, bar1_addr; + ulong bar1_size; + +- pdev = devinfo->pdev; +- + err = pci_enable_device(pdev); + if (err) { +- brcmf_err("pci_enable_device failed err=%d\n", err); ++ brcmf_err(bus, "pci_enable_device failed err=%d\n", err); + return err; + } + +@@ -1577,7 +1589,7 @@ static int brcmf_pcie_get_resource(struc + /* read Bar-1 mapped memory range */ + bar1_size = pci_resource_len(pdev, 2); + if ((bar1_size == 0) || (bar1_addr == 0)) { +- brcmf_err("BAR1 Not enabled, device size=%ld, addr=%#016llx\n", ++ brcmf_err(bus, "BAR1 Not enabled, device size=%ld, addr=%#016llx\n", + bar1_size, (unsigned long long)bar1_addr); + return -EINVAL; + } +@@ -1586,7 +1598,7 @@ static int brcmf_pcie_get_resource(struc + devinfo->tcm = ioremap_nocache(bar1_addr, bar1_size); + + if (!devinfo->regs || !devinfo->tcm) { +- brcmf_err("ioremap() failed (%p,%p)\n", devinfo->regs, ++ brcmf_err(bus, "ioremap() failed (%p,%p)\n", devinfo->regs, + devinfo->tcm); + return -EINVAL; + } +@@ -1873,7 +1885,7 @@ fail_bus: + kfree(bus->msgbuf); + kfree(bus); + fail: +- brcmf_err("failed %x:%x\n", pdev->vendor, pdev->device); ++ brcmf_err(NULL, "failed %x:%x\n", pdev->vendor, pdev->device); + brcmf_pcie_release_resource(devinfo); + if (devinfo->ci) + brcmf_chip_detach(devinfo->ci); +@@ -1947,7 +1959,7 @@ static int brcmf_pcie_pm_enter_D3(struct + wait_event_timeout(devinfo->mbdata_resp_wait, devinfo->mbdata_completed, + BRCMF_PCIE_MBDATA_TIMEOUT); + if (!devinfo->mbdata_completed) { +- brcmf_err("Timeout on response for entering D3 substate\n"); ++ brcmf_err(bus, "Timeout on response for entering D3 substate\n"); + brcmf_bus_change_state(bus, BRCMF_BUS_UP); + return -EIO; + } +@@ -1993,7 +2005,7 @@ cleanup: + + err = brcmf_pcie_probe(pdev, NULL); + if (err) +- brcmf_err("probe after resume failed, err=%d\n", err); ++ brcmf_err(bus, "probe after resume failed, err=%d\n", err); + + return err; + } +@@ -2066,7 +2078,8 @@ void brcmf_pcie_register(void) + brcmf_dbg(PCIE, "Enter\n"); + err = pci_register_driver(&brcmf_pciedrvr); + if (err) +- brcmf_err("PCIE driver registration failed, err=%d\n", err); ++ brcmf_err(NULL, "PCIE driver registration failed, err=%d\n", ++ err); + } + + diff --git a/package/kernel/mac80211/patches/brcm/346-v5.1-brcmfmac-add-bphy_err-and-use-it-in-the-cfg80211.c.patch b/package/kernel/mac80211/patches/brcm/346-v5.1-brcmfmac-add-bphy_err-and-use-it-in-the-cfg80211.c.patch new file mode 100644 index 00000000000000..8858b186a79949 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/346-v5.1-brcmfmac-add-bphy_err-and-use-it-in-the-cfg80211.c.patch @@ -0,0 +1,2025 @@ +From 3ef005b82e2ad68107fc5814eaa743d171a6c362 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 16 Jan 2019 07:28:54 +0100 +Subject: [PATCH] brcmfmac: add bphy_err() and use it in the cfg80211.c +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This new macro uses wiphy_err() which: +1) Should be the best choice with wiphy already created +2) Uses dev_err() which allows identifying error-affected device + +Signed-off-by: Rafał Miłecki +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 497 ++++++++++-------- + .../broadcom/brcm80211/brcmfmac/debug.h | 9 + + 2 files changed, 282 insertions(+), 224 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -457,6 +457,7 @@ static void convert_key_from_CPU(struct + static int + send_key_to_dongle(struct brcmf_if *ifp, struct brcmf_wsec_key *key) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + int err; + struct brcmf_wsec_key_le key_le; + +@@ -468,7 +469,7 @@ send_key_to_dongle(struct brcmf_if *ifp, + sizeof(key_le)); + + if (err) +- brcmf_err("wsec_key error (%d)\n", err); ++ bphy_err(wiphy, "wsec_key error (%d)\n", err); + return err; + } + +@@ -508,6 +509,7 @@ static int brcmf_get_first_free_bsscfgid + + static int brcmf_cfg80211_request_ap_if(struct brcmf_if *ifp) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + struct brcmf_mbss_ssid_le mbss_ssid_le; + int bsscfgidx; + int err; +@@ -524,7 +526,7 @@ static int brcmf_cfg80211_request_ap_if( + err = brcmf_fil_bsscfg_data_set(ifp, "bsscfg:ssid", &mbss_ssid_le, + sizeof(mbss_ssid_le)); + if (err < 0) +- brcmf_err("setting ssid failed %d\n", err); ++ bphy_err(wiphy, "setting ssid failed %d\n", err); + + return err; + } +@@ -567,7 +569,7 @@ struct wireless_dev *brcmf_ap_add_vif(st + BRCMF_VIF_EVENT_TIMEOUT); + brcmf_cfg80211_arm_vif_event(cfg, NULL); + if (!err) { +- brcmf_err("timeout occurred\n"); ++ bphy_err(wiphy, "timeout occurred\n"); + err = -EIO; + goto fail; + } +@@ -575,7 +577,7 @@ struct wireless_dev *brcmf_ap_add_vif(st + /* interface created in firmware */ + ifp = vif->ifp; + if (!ifp) { +- brcmf_err("no if pointer provided\n"); ++ bphy_err(wiphy, "no if pointer provided\n"); + err = -ENOENT; + goto fail; + } +@@ -583,7 +585,7 @@ struct wireless_dev *brcmf_ap_add_vif(st + strncpy(ifp->ndev->name, name, sizeof(ifp->ndev->name) - 1); + err = brcmf_net_attach(ifp, true); + if (err) { +- brcmf_err("Registering netdevice failed\n"); ++ bphy_err(wiphy, "Registering netdevice failed\n"); + free_netdev(ifp->ndev); + goto fail; + } +@@ -620,7 +622,7 @@ static struct wireless_dev *brcmf_cfg802 + brcmf_dbg(TRACE, "enter: %s type %d\n", name, type); + err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type); + if (err) { +- brcmf_err("iface validation failed: err=%d\n", err); ++ bphy_err(wiphy, "iface validation failed: err=%d\n", err); + return ERR_PTR(err); + } + switch (type) { +@@ -645,8 +647,8 @@ static struct wireless_dev *brcmf_cfg802 + } + + if (IS_ERR(wdev)) +- brcmf_err("add iface %s type %d failed: err=%d\n", +- name, type, (int)PTR_ERR(wdev)); ++ bphy_err(wiphy, "add iface %s type %d failed: err=%d\n", name, ++ type, (int)PTR_ERR(wdev)); + else + brcmf_cfg80211_update_proto_addr_mode(wdev); + +@@ -661,12 +663,13 @@ static void brcmf_scan_config_mpc(struct + + void brcmf_set_mpc(struct brcmf_if *ifp, int mpc) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + s32 err = 0; + + if (check_vif_up(ifp->vif)) { + err = brcmf_fil_iovar_int_set(ifp, "mpc", mpc); + if (err) { +- brcmf_err("fail to set mpc\n"); ++ bphy_err(wiphy, "fail to set mpc\n"); + return; + } + brcmf_dbg(INFO, "MPC : %d\n", mpc); +@@ -677,6 +680,7 @@ s32 brcmf_notify_escan_complete(struct b + struct brcmf_if *ifp, bool aborted, + bool fw_abort) + { ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + struct brcmf_scan_params_le params_le; + struct cfg80211_scan_request *scan_request; + u64 reqid; +@@ -711,7 +715,7 @@ s32 brcmf_notify_escan_complete(struct b + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN, + ¶ms_le, sizeof(params_le)); + if (err) +- brcmf_err("Scan abort failed\n"); ++ bphy_err(wiphy, "Scan abort failed\n"); + } + + brcmf_scan_config_mpc(ifp, 1); +@@ -763,7 +767,7 @@ static int brcmf_cfg80211_del_ap_iface(s + + err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0); + if (err) { +- brcmf_err("interface_remove failed %d\n", err); ++ bphy_err(wiphy, "interface_remove failed %d\n", err); + goto err_unarm; + } + +@@ -771,7 +775,7 @@ static int brcmf_cfg80211_del_ap_iface(s + ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL, + BRCMF_VIF_EVENT_TIMEOUT); + if (!ret) { +- brcmf_err("timeout occurred\n"); ++ bphy_err(wiphy, "timeout occurred\n"); + err = -EIO; + goto err_unarm; + } +@@ -873,14 +877,14 @@ brcmf_cfg80211_change_iface(struct wiphy + } + err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type); + if (err) { +- brcmf_err("iface validation failed: err=%d\n", err); ++ bphy_err(wiphy, "iface validation failed: err=%d\n", err); + return err; + } + switch (type) { + case NL80211_IFTYPE_MONITOR: + case NL80211_IFTYPE_WDS: +- brcmf_err("type (%d) : currently we do not support this type\n", +- type); ++ bphy_err(wiphy, "type (%d) : currently we do not support this type\n", ++ type); + return -EOPNOTSUPP; + case NL80211_IFTYPE_ADHOC: + infra = 0; +@@ -908,7 +912,7 @@ brcmf_cfg80211_change_iface(struct wiphy + } else { + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, infra); + if (err) { +- brcmf_err("WLC_SET_INFRA error (%d)\n", err); ++ bphy_err(wiphy, "WLC_SET_INFRA error (%d)\n", err); + err = -EAGAIN; + goto done; + } +@@ -999,6 +1003,7 @@ static s32 + brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp, + struct cfg80211_scan_request *request) + { ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE + + offsetof(struct brcmf_escan_params_le, params_le); + struct brcmf_escan_params_le *params; +@@ -1030,7 +1035,7 @@ brcmf_run_escan(struct brcmf_cfg80211_in + if (err == -EBUSY) + brcmf_dbg(INFO, "system busy : escan canceled\n"); + else +- brcmf_err("error (%d)\n", err); ++ bphy_err(wiphy, "error (%d)\n", err); + } + + kfree(params); +@@ -1076,21 +1081,22 @@ brcmf_cfg80211_scan(struct wiphy *wiphy, + return -EIO; + + if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { +- brcmf_err("Scanning already: status (%lu)\n", cfg->scan_status); ++ bphy_err(wiphy, "Scanning already: status (%lu)\n", ++ cfg->scan_status); + return -EAGAIN; + } + if (test_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status)) { +- brcmf_err("Scanning being aborted: status (%lu)\n", +- cfg->scan_status); ++ bphy_err(wiphy, "Scanning being aborted: status (%lu)\n", ++ cfg->scan_status); + return -EAGAIN; + } + if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) { +- brcmf_err("Scanning suppressed: status (%lu)\n", +- cfg->scan_status); ++ bphy_err(wiphy, "Scanning suppressed: status (%lu)\n", ++ cfg->scan_status); + return -EAGAIN; + } + if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state)) { +- brcmf_err("Connecting: status (%lu)\n", vif->sme_state); ++ bphy_err(wiphy, "Connecting: status (%lu)\n", vif->sme_state); + return -EAGAIN; + } + +@@ -1124,7 +1130,7 @@ brcmf_cfg80211_scan(struct wiphy *wiphy, + return 0; + + scan_out: +- brcmf_err("scan error (%d)\n", err); ++ bphy_err(wiphy, "scan error (%d)\n", err); + clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); + cfg->scan_request = NULL; + return err; +@@ -1132,36 +1138,41 @@ scan_out: + + static s32 brcmf_set_rts(struct net_device *ndev, u32 rts_threshold) + { ++ struct brcmf_if *ifp = netdev_priv(ndev); ++ struct wiphy *wiphy = ifp->drvr->wiphy; + s32 err = 0; + +- err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "rtsthresh", +- rts_threshold); ++ err = brcmf_fil_iovar_int_set(ifp, "rtsthresh", rts_threshold); + if (err) +- brcmf_err("Error (%d)\n", err); ++ bphy_err(wiphy, "Error (%d)\n", err); + + return err; + } + + static s32 brcmf_set_frag(struct net_device *ndev, u32 frag_threshold) + { ++ struct brcmf_if *ifp = netdev_priv(ndev); ++ struct wiphy *wiphy = ifp->drvr->wiphy; + s32 err = 0; + +- err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "fragthresh", ++ err = brcmf_fil_iovar_int_set(ifp, "fragthresh", + frag_threshold); + if (err) +- brcmf_err("Error (%d)\n", err); ++ bphy_err(wiphy, "Error (%d)\n", err); + + return err; + } + + static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l) + { ++ struct brcmf_if *ifp = netdev_priv(ndev); ++ struct wiphy *wiphy = ifp->drvr->wiphy; + s32 err = 0; + u32 cmd = (l ? BRCMF_C_SET_LRL : BRCMF_C_SET_SRL); + +- err = brcmf_fil_cmd_int_set(netdev_priv(ndev), cmd, retry); ++ err = brcmf_fil_cmd_int_set(ifp, cmd, retry); + if (err) { +- brcmf_err("cmd (%d) , error (%d)\n", cmd, err); ++ bphy_err(wiphy, "cmd (%d) , error (%d)\n", cmd, err); + return err; + } + return err; +@@ -1237,6 +1248,7 @@ static u16 brcmf_map_fw_linkdown_reason( + + static int brcmf_set_pmk(struct brcmf_if *ifp, const u8 *pmk_data, u16 pmk_len) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + struct brcmf_wsec_pmk_le pmk; + int i, err; + +@@ -1250,8 +1262,8 @@ static int brcmf_set_pmk(struct brcmf_if + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_WSEC_PMK, + &pmk, sizeof(pmk)); + if (err < 0) +- brcmf_err("failed to change PSK in firmware (len=%u)\n", +- pmk_len); ++ bphy_err(wiphy, "failed to change PSK in firmware (len=%u)\n", ++ pmk_len); + + return err; + } +@@ -1259,6 +1271,7 @@ static int brcmf_set_pmk(struct brcmf_if + static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason) + { + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy); ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + s32 err = 0; + + brcmf_dbg(TRACE, "Enter\n"); +@@ -1268,7 +1281,7 @@ static void brcmf_link_down(struct brcmf + err = brcmf_fil_cmd_data_set(vif->ifp, + BRCMF_C_DISASSOC, NULL, 0); + if (err) { +- brcmf_err("WLC_DISASSOC failed (%d)\n", err); ++ bphy_err(wiphy, "WLC_DISASSOC failed (%d)\n", err); + } + if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) || + (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT)) +@@ -1356,7 +1369,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w + + err = brcmf_fil_iovar_int_set(ifp, "wsec", wsec); + if (err) { +- brcmf_err("wsec failed (%d)\n", err); ++ bphy_err(wiphy, "wsec failed (%d)\n", err); + goto done; + } + +@@ -1368,7 +1381,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w + + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, bcnprd); + if (err) { +- brcmf_err("WLC_SET_BCNPRD failed (%d)\n", err); ++ bphy_err(wiphy, "WLC_SET_BCNPRD failed (%d)\n", err); + goto done; + } + +@@ -1413,7 +1426,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_CHANNEL, + target_channel); + if (err) { +- brcmf_err("WLC_SET_CHANNEL failed (%d)\n", err); ++ bphy_err(wiphy, "WLC_SET_CHANNEL failed (%d)\n", err); + goto done; + } + } else +@@ -1425,7 +1438,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, + &join_params, join_params_size); + if (err) { +- brcmf_err("WLC_SET_SSID failed (%d)\n", err); ++ bphy_err(wiphy, "WLC_SET_SSID failed (%d)\n", err); + goto done; + } + +@@ -1461,6 +1474,8 @@ brcmf_cfg80211_leave_ibss(struct wiphy * + static s32 brcmf_set_wpa_version(struct net_device *ndev, + struct cfg80211_connect_params *sme) + { ++ struct brcmf_if *ifp = netdev_priv(ndev); ++ struct wiphy *wiphy = ifp->drvr->wiphy; + struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev); + struct brcmf_cfg80211_security *sec; + s32 val = 0; +@@ -1473,9 +1488,9 @@ static s32 brcmf_set_wpa_version(struct + else + val = WPA_AUTH_DISABLED; + brcmf_dbg(CONN, "setting wpa_auth to 0x%0x\n", val); +- err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val); ++ err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", val); + if (err) { +- brcmf_err("set wpa_auth failed (%d)\n", err); ++ bphy_err(wiphy, "set wpa_auth failed (%d)\n", err); + return err; + } + sec = &profile->sec; +@@ -1486,6 +1501,8 @@ static s32 brcmf_set_wpa_version(struct + static s32 brcmf_set_auth_type(struct net_device *ndev, + struct cfg80211_connect_params *sme) + { ++ struct brcmf_if *ifp = netdev_priv(ndev); ++ struct wiphy *wiphy = ifp->drvr->wiphy; + struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev); + struct brcmf_cfg80211_security *sec; + s32 val = 0; +@@ -1506,9 +1523,9 @@ static s32 brcmf_set_auth_type(struct ne + break; + } + +- err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val); ++ err = brcmf_fil_bsscfg_int_set(ifp, "auth", val); + if (err) { +- brcmf_err("set auth failed (%d)\n", err); ++ bphy_err(wiphy, "set auth failed (%d)\n", err); + return err; + } + sec = &profile->sec; +@@ -1520,6 +1537,8 @@ static s32 + brcmf_set_wsec_mode(struct net_device *ndev, + struct cfg80211_connect_params *sme) + { ++ struct brcmf_if *ifp = netdev_priv(ndev); ++ struct wiphy *wiphy = ifp->drvr->wiphy; + struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev); + struct brcmf_cfg80211_security *sec; + s32 pval = 0; +@@ -1543,8 +1562,8 @@ brcmf_set_wsec_mode(struct net_device *n + pval = AES_ENABLED; + break; + default: +- brcmf_err("invalid cipher pairwise (%d)\n", +- sme->crypto.ciphers_pairwise[0]); ++ bphy_err(wiphy, "invalid cipher pairwise (%d)\n", ++ sme->crypto.ciphers_pairwise[0]); + return -EINVAL; + } + } +@@ -1564,8 +1583,8 @@ brcmf_set_wsec_mode(struct net_device *n + gval = AES_ENABLED; + break; + default: +- brcmf_err("invalid cipher group (%d)\n", +- sme->crypto.cipher_group); ++ bphy_err(wiphy, "invalid cipher group (%d)\n", ++ sme->crypto.cipher_group); + return -EINVAL; + } + } +@@ -1578,9 +1597,9 @@ brcmf_set_wsec_mode(struct net_device *n + pval = AES_ENABLED; + + wsec = pval | gval; +- err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wsec", wsec); ++ err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec); + if (err) { +- brcmf_err("error (%d)\n", err); ++ bphy_err(wiphy, "error (%d)\n", err); + return err; + } + +@@ -1595,6 +1614,7 @@ static s32 + brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme) + { + struct brcmf_if *ifp = netdev_priv(ndev); ++ struct wiphy *wiphy = ifp->drvr->wiphy; + struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; + s32 val; + s32 err; +@@ -1613,7 +1633,7 @@ brcmf_set_key_mgmt(struct net_device *nd + + err = brcmf_fil_bsscfg_int_get(netdev_priv(ndev), "wpa_auth", &val); + if (err) { +- brcmf_err("could not get wpa_auth (%d)\n", err); ++ bphy_err(wiphy, "could not get wpa_auth (%d)\n", err); + return err; + } + if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) { +@@ -1627,8 +1647,8 @@ brcmf_set_key_mgmt(struct net_device *nd + val = WPA_AUTH_PSK; + break; + default: +- brcmf_err("invalid cipher group (%d)\n", +- sme->crypto.cipher_group); ++ bphy_err(wiphy, "invalid cipher group (%d)\n", ++ sme->crypto.cipher_group); + return -EINVAL; + } + } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) { +@@ -1650,8 +1670,8 @@ brcmf_set_key_mgmt(struct net_device *nd + val = WPA2_AUTH_PSK; + break; + default: +- brcmf_err("invalid cipher group (%d)\n", +- sme->crypto.cipher_group); ++ bphy_err(wiphy, "invalid cipher group (%d)\n", ++ sme->crypto.cipher_group); + return -EINVAL; + } + } +@@ -1697,7 +1717,7 @@ skip_mfp_config: + brcmf_dbg(CONN, "setting wpa_auth to %d\n", val); + err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val); + if (err) { +- brcmf_err("could not set wpa_auth (%d)\n", err); ++ bphy_err(wiphy, "could not set wpa_auth (%d)\n", err); + return err; + } + +@@ -1708,6 +1728,8 @@ static s32 + brcmf_set_sharedkey(struct net_device *ndev, + struct cfg80211_connect_params *sme) + { ++ struct brcmf_if *ifp = netdev_priv(ndev); ++ struct wiphy *wiphy = ifp->drvr->wiphy; + struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev); + struct brcmf_cfg80211_security *sec; + struct brcmf_wsec_key key; +@@ -1734,7 +1756,7 @@ brcmf_set_sharedkey(struct net_device *n + key.len = (u32) sme->key_len; + key.index = (u32) sme->key_idx; + if (key.len > sizeof(key.data)) { +- brcmf_err("Too long key length (%u)\n", key.len); ++ bphy_err(wiphy, "Too long key length (%u)\n", key.len); + return -EINVAL; + } + memcpy(key.data, sme->key, key.len); +@@ -1747,24 +1769,24 @@ brcmf_set_sharedkey(struct net_device *n + key.algo = CRYPTO_ALGO_WEP128; + break; + default: +- brcmf_err("Invalid algorithm (%d)\n", +- sme->crypto.ciphers_pairwise[0]); ++ bphy_err(wiphy, "Invalid algorithm (%d)\n", ++ sme->crypto.ciphers_pairwise[0]); + return -EINVAL; + } + /* Set the new key/index */ + brcmf_dbg(CONN, "key length (%d) key index (%d) algo (%d)\n", + key.len, key.index, key.algo); + brcmf_dbg(CONN, "key \"%s\"\n", key.data); +- err = send_key_to_dongle(netdev_priv(ndev), &key); ++ err = send_key_to_dongle(ifp, &key); + if (err) + return err; + + if (sec->auth_type == NL80211_AUTHTYPE_SHARED_KEY) { + brcmf_dbg(CONN, "set auth_type to shared key\n"); + val = WL_AUTH_SHARED_KEY; /* shared key */ +- err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val); ++ err = brcmf_fil_bsscfg_int_set(ifp, "auth", val); + if (err) +- brcmf_err("set auth failed (%d)\n", err); ++ bphy_err(wiphy, "set auth failed (%d)\n", err); + } + return err; + } +@@ -1784,6 +1806,7 @@ enum nl80211_auth_type brcmf_war_auth_ty + static void brcmf_set_join_pref(struct brcmf_if *ifp, + struct cfg80211_bss_selection *bss_select) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + struct brcmf_join_pref_params join_pref_params[2]; + enum nl80211_band band; + int err, i = 0; +@@ -1822,7 +1845,7 @@ static void brcmf_set_join_pref(struct b + err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params, + sizeof(join_pref_params)); + if (err) +- brcmf_err("Set join_pref error (%d)\n", err); ++ bphy_err(wiphy, "Set join_pref error (%d)\n", err); + } + + static s32 +@@ -1849,7 +1872,7 @@ brcmf_cfg80211_connect(struct wiphy *wip + return -EIO; + + if (!sme->ssid) { +- brcmf_err("Invalid ssid\n"); ++ bphy_err(wiphy, "Invalid ssid\n"); + return -EOPNOTSUPP; + } + +@@ -1878,7 +1901,7 @@ brcmf_cfg80211_connect(struct wiphy *wip + err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG, + sme->ie, sme->ie_len); + if (err) +- brcmf_err("Set Assoc REQ IE Failed\n"); ++ bphy_err(wiphy, "Set Assoc REQ IE Failed\n"); + else + brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n"); + +@@ -1899,32 +1922,32 @@ brcmf_cfg80211_connect(struct wiphy *wip + + err = brcmf_set_wpa_version(ndev, sme); + if (err) { +- brcmf_err("wl_set_wpa_version failed (%d)\n", err); ++ bphy_err(wiphy, "wl_set_wpa_version failed (%d)\n", err); + goto done; + } + + sme->auth_type = brcmf_war_auth_type(ifp, sme->auth_type); + err = brcmf_set_auth_type(ndev, sme); + if (err) { +- brcmf_err("wl_set_auth_type failed (%d)\n", err); ++ bphy_err(wiphy, "wl_set_auth_type failed (%d)\n", err); + goto done; + } + + err = brcmf_set_wsec_mode(ndev, sme); + if (err) { +- brcmf_err("wl_set_set_cipher failed (%d)\n", err); ++ bphy_err(wiphy, "wl_set_set_cipher failed (%d)\n", err); + goto done; + } + + err = brcmf_set_key_mgmt(ndev, sme); + if (err) { +- brcmf_err("wl_set_key_mgmt failed (%d)\n", err); ++ bphy_err(wiphy, "wl_set_key_mgmt failed (%d)\n", err); + goto done; + } + + err = brcmf_set_sharedkey(ndev, sme); + if (err) { +- brcmf_err("brcmf_set_sharedkey failed (%d)\n", err); ++ bphy_err(wiphy, "brcmf_set_sharedkey failed (%d)\n", err); + goto done; + } + +@@ -1941,7 +1964,7 @@ brcmf_cfg80211_connect(struct wiphy *wip + /* enable firmware supplicant for this interface */ + err = brcmf_fil_iovar_int_set(ifp, "sup_wpa", 1); + if (err < 0) { +- brcmf_err("failed to enable fw supplicant\n"); ++ bphy_err(wiphy, "failed to enable fw supplicant\n"); + goto done; + } + } +@@ -2036,7 +2059,7 @@ brcmf_cfg80211_connect(struct wiphy *wip + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, + &join_params, join_params_size); + if (err) +- brcmf_err("BRCMF_C_SET_SSID failed (%d)\n", err); ++ bphy_err(wiphy, "BRCMF_C_SET_SSID failed (%d)\n", err); + + done: + if (err) +@@ -2067,7 +2090,7 @@ brcmf_cfg80211_disconnect(struct wiphy * + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_DISASSOC, + &scbval, sizeof(scbval)); + if (err) +- brcmf_err("error (%d)\n", err); ++ bphy_err(wiphy, "error (%d)\n", err); + + brcmf_dbg(TRACE, "Exit\n"); + return err; +@@ -2094,7 +2117,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy + case NL80211_TX_POWER_LIMITED: + case NL80211_TX_POWER_FIXED: + if (mbm < 0) { +- brcmf_err("TX_POWER_FIXED - dbm is negative\n"); ++ bphy_err(wiphy, "TX_POWER_FIXED - dbm is negative\n"); + err = -EINVAL; + goto done; + } +@@ -2104,7 +2127,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy + qdbm |= WL_TXPWR_OVERRIDE; + break; + default: +- brcmf_err("Unsupported type %d\n", type); ++ bphy_err(wiphy, "Unsupported type %d\n", type); + err = -EINVAL; + goto done; + } +@@ -2112,11 +2135,11 @@ brcmf_cfg80211_set_tx_power(struct wiphy + disable = WL_RADIO_SW_DISABLE << 16; + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_RADIO, disable); + if (err) +- brcmf_err("WLC_SET_RADIO error (%d)\n", err); ++ bphy_err(wiphy, "WLC_SET_RADIO error (%d)\n", err); + + err = brcmf_fil_iovar_int_set(ifp, "qtxpower", qdbm); + if (err) +- brcmf_err("qtxpower error (%d)\n", err); ++ bphy_err(wiphy, "qtxpower error (%d)\n", err); + + done: + brcmf_dbg(TRACE, "Exit %d (qdbm)\n", qdbm & ~WL_TXPWR_OVERRIDE); +@@ -2137,7 +2160,7 @@ brcmf_cfg80211_get_tx_power(struct wiphy + + err = brcmf_fil_iovar_int_get(vif->ifp, "qtxpower", &qdbm); + if (err) { +- brcmf_err("error (%d)\n", err); ++ bphy_err(wiphy, "error (%d)\n", err); + goto done; + } + *dbm = (qdbm & ~WL_TXPWR_OVERRIDE) / 4; +@@ -2163,7 +2186,7 @@ brcmf_cfg80211_config_default_key(struct + + err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); + if (err) { +- brcmf_err("WLC_GET_WSEC error (%d)\n", err); ++ bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err); + goto done; + } + +@@ -2173,7 +2196,7 @@ brcmf_cfg80211_config_default_key(struct + err = brcmf_fil_cmd_int_set(ifp, + BRCMF_C_SET_KEY_PRIMARY, index); + if (err) +- brcmf_err("error (%d)\n", err); ++ bphy_err(wiphy, "error (%d)\n", err); + } + done: + brcmf_dbg(TRACE, "Exit\n"); +@@ -2237,7 +2260,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip + + if (key_idx >= BRCMF_MAX_DEFAULT_KEYS) { + /* we ignore this key index in this case */ +- brcmf_err("invalid key index (%d)\n", key_idx); ++ bphy_err(wiphy, "invalid key index (%d)\n", key_idx); + return -EINVAL; + } + +@@ -2246,7 +2269,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip + mac_addr); + + if (params->key_len > sizeof(key->data)) { +- brcmf_err("Too long key length (%u)\n", params->key_len); ++ bphy_err(wiphy, "Too long key length (%u)\n", params->key_len); + return -EINVAL; + } + +@@ -2300,7 +2323,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip + brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n"); + break; + default: +- brcmf_err("Invalid cipher (0x%x)\n", params->cipher); ++ bphy_err(wiphy, "Invalid cipher (0x%x)\n", params->cipher); + err = -EINVAL; + goto done; + } +@@ -2311,13 +2334,13 @@ brcmf_cfg80211_add_key(struct wiphy *wip + + err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); + if (err) { +- brcmf_err("get wsec error (%d)\n", err); ++ bphy_err(wiphy, "get wsec error (%d)\n", err); + goto done; + } + wsec |= val; + err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec); + if (err) { +- brcmf_err("set wsec error (%d)\n", err); ++ bphy_err(wiphy, "set wsec error (%d)\n", err); + goto done; + } + +@@ -2348,7 +2371,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip + + err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); + if (err) { +- brcmf_err("WLC_GET_WSEC error (%d)\n", err); ++ bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err); + /* Ignore this error, may happen during DISASSOC */ + err = -EAGAIN; + goto done; +@@ -2369,7 +2392,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip + params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; + brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n"); + } else { +- brcmf_err("Invalid algo (0x%x)\n", wsec); ++ bphy_err(wiphy, "Invalid algo (0x%x)\n", wsec); + err = -EINVAL; + goto done; + } +@@ -2399,6 +2422,7 @@ brcmf_cfg80211_config_default_mgmt_key(s + static void + brcmf_cfg80211_reconfigure_wep(struct brcmf_if *ifp) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + s32 err; + u8 key_idx; + struct brcmf_wsec_key *key; +@@ -2415,18 +2439,18 @@ brcmf_cfg80211_reconfigure_wep(struct br + + err = send_key_to_dongle(ifp, key); + if (err) { +- brcmf_err("Setting WEP key failed (%d)\n", err); ++ bphy_err(wiphy, "Setting WEP key failed (%d)\n", err); + return; + } + err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); + if (err) { +- brcmf_err("get wsec error (%d)\n", err); ++ bphy_err(wiphy, "get wsec error (%d)\n", err); + return; + } + wsec |= WEP_ENABLED; + err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec); + if (err) +- brcmf_err("set wsec error (%d)\n", err); ++ bphy_err(wiphy, "set wsec error (%d)\n", err); + } + + static void brcmf_convert_sta_flags(u32 fw_sta_flags, struct station_info *si) +@@ -2452,6 +2476,7 @@ static void brcmf_convert_sta_flags(u32 + + static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + struct { + __le32 len; + struct brcmf_bss_info_le bss_le; +@@ -2467,7 +2492,7 @@ static void brcmf_fill_bss_param(struct + err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, buf, + WL_BSS_INFO_MAX); + if (err) { +- brcmf_err("Failed to get bss info (%d)\n", err); ++ bphy_err(wiphy, "Failed to get bss info (%d)\n", err); + goto out_kfree; + } + si->filled |= BIT_ULL(NL80211_STA_INFO_BSS_PARAM); +@@ -2489,6 +2514,7 @@ static s32 + brcmf_cfg80211_get_station_ibss(struct brcmf_if *ifp, + struct station_info *sinfo) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + struct brcmf_scb_val_le scbval; + struct brcmf_pktcnt_le pktcnt; + s32 err; +@@ -2498,7 +2524,7 @@ brcmf_cfg80211_get_station_ibss(struct b + /* Get the current tx rate */ + err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate); + if (err < 0) { +- brcmf_err("BRCMF_C_GET_RATE error (%d)\n", err); ++ bphy_err(wiphy, "BRCMF_C_GET_RATE error (%d)\n", err); + return err; + } + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); +@@ -2508,7 +2534,7 @@ brcmf_cfg80211_get_station_ibss(struct b + err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, &scbval, + sizeof(scbval)); + if (err) { +- brcmf_err("BRCMF_C_GET_RSSI error (%d)\n", err); ++ bphy_err(wiphy, "BRCMF_C_GET_RSSI error (%d)\n", err); + return err; + } + rssi = le32_to_cpu(scbval.val); +@@ -2518,7 +2544,7 @@ brcmf_cfg80211_get_station_ibss(struct b + err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_GET_PKTCNTS, &pktcnt, + sizeof(pktcnt)); + if (err) { +- brcmf_err("BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err); ++ bphy_err(wiphy, "BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err); + return err; + } + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS) | +@@ -2566,7 +2592,7 @@ brcmf_cfg80211_get_station(struct wiphy + &sta_info_le, + sizeof(sta_info_le)); + if (err < 0) { +- brcmf_err("GET STA INFO failed, %d\n", err); ++ bphy_err(wiphy, "GET STA INFO failed, %d\n", err); + goto done; + } + } +@@ -2635,7 +2661,8 @@ brcmf_cfg80211_get_station(struct wiphy + err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, + &scb_val, sizeof(scb_val)); + if (err) { +- brcmf_err("Could not get rssi (%d)\n", err); ++ bphy_err(wiphy, "Could not get rssi (%d)\n", ++ err); + goto done; + } else { + rssi = le32_to_cpu(scb_val.val); +@@ -2666,8 +2693,8 @@ brcmf_cfg80211_dump_station(struct wiphy + &cfg->assoclist, + sizeof(cfg->assoclist)); + if (err) { +- brcmf_err("BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n", +- err); ++ bphy_err(wiphy, "BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n", ++ err); + cfg->assoclist.count = 0; + return -EOPNOTSUPP; + } +@@ -2715,9 +2742,9 @@ brcmf_cfg80211_set_power_mgmt(struct wip + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm); + if (err) { + if (err == -ENODEV) +- brcmf_err("net_device is not ready yet\n"); ++ bphy_err(wiphy, "net_device is not ready yet\n"); + else +- brcmf_err("error (%d)\n", err); ++ bphy_err(wiphy, "error (%d)\n", err); + } + done: + brcmf_dbg(TRACE, "Exit\n"); +@@ -2740,7 +2767,7 @@ static s32 brcmf_inform_single_bss(struc + struct cfg80211_inform_bss bss_data = {}; + + if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) { +- brcmf_err("Bss info is larger than buffer. Discarding\n"); ++ bphy_err(wiphy, "Bss info is larger than buffer. Discarding\n"); + return 0; + } + +@@ -2799,6 +2826,7 @@ next_bss_le(struct brcmf_scan_results *l + + static s32 brcmf_inform_bss(struct brcmf_cfg80211_info *cfg) + { ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + struct brcmf_scan_results *bss_list; + struct brcmf_bss_info_le *bi = NULL; /* must be initialized */ + s32 err = 0; +@@ -2807,8 +2835,8 @@ static s32 brcmf_inform_bss(struct brcmf + bss_list = (struct brcmf_scan_results *)cfg->escan_info.escan_buf; + if (bss_list->count != 0 && + bss_list->version != BRCMF_BSS_INFO_VERSION) { +- brcmf_err("Version %d != WL_BSS_INFO_VERSION\n", +- bss_list->version); ++ bphy_err(wiphy, "Version %d != WL_BSS_INFO_VERSION\n", ++ bss_list->version); + return -EOPNOTSUPP; + } + brcmf_dbg(SCAN, "scanned AP count (%d)\n", bss_list->count); +@@ -2852,7 +2880,7 @@ static s32 brcmf_inform_ibss(struct brcm + err = brcmf_fil_cmd_data_get(netdev_priv(ndev), BRCMF_C_GET_BSS_INFO, + buf, WL_BSS_INFO_MAX); + if (err) { +- brcmf_err("WLC_GET_BSS_INFO failed: %d\n", err); ++ bphy_err(wiphy, "WLC_GET_BSS_INFO failed: %d\n", err); + goto CleanUp; + } + +@@ -2906,6 +2934,7 @@ CleanUp: + static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg, + struct brcmf_if *ifp) + { ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + struct brcmf_bss_info_le *bi; + const struct brcmf_tlv *tim; + u16 beacon_interval; +@@ -2922,7 +2951,7 @@ static s32 brcmf_update_bss_info(struct + err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, + cfg->extra_buf, WL_EXTRA_BUF_MAX); + if (err) { +- brcmf_err("Could not get bss info %d\n", err); ++ bphy_err(wiphy, "Could not get bss info %d\n", err); + goto update_bss_info_out; + } + +@@ -2947,7 +2976,7 @@ static s32 brcmf_update_bss_info(struct + u32 var; + err = brcmf_fil_iovar_int_get(ifp, "dtim_assoc", &var); + if (err) { +- brcmf_err("wl dtim_assoc failed (%d)\n", err); ++ bphy_err(wiphy, "wl dtim_assoc failed (%d)\n", err); + goto update_bss_info_out; + } + dtim_period = (u8)var; +@@ -2985,9 +3014,10 @@ static void brcmf_escan_timeout(struct t + { + struct brcmf_cfg80211_info *cfg = + from_timer(cfg, t, escan_timeout); ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + + if (cfg->int_escan_map || cfg->scan_request) { +- brcmf_err("timer expired\n"); ++ bphy_err(wiphy, "timer expired\n"); + schedule_work(&cfg->escan_timeout_work); + } + } +@@ -3036,6 +3066,7 @@ brcmf_cfg80211_escan_handler(struct brcm + const struct brcmf_event_msg *e, void *data) + { + struct brcmf_cfg80211_info *cfg = ifp->drvr->config; ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + s32 status; + struct brcmf_escan_result_le *escan_result_le; + u32 escan_buflen; +@@ -3052,32 +3083,33 @@ brcmf_cfg80211_escan_handler(struct brcm + goto exit; + + if (!test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { +- brcmf_err("scan not ready, bsscfgidx=%d\n", ifp->bsscfgidx); ++ bphy_err(wiphy, "scan not ready, bsscfgidx=%d\n", ++ ifp->bsscfgidx); + return -EPERM; + } + + if (status == BRCMF_E_STATUS_PARTIAL) { + brcmf_dbg(SCAN, "ESCAN Partial result\n"); + if (e->datalen < sizeof(*escan_result_le)) { +- brcmf_err("invalid event data length\n"); ++ bphy_err(wiphy, "invalid event data length\n"); + goto exit; + } + escan_result_le = (struct brcmf_escan_result_le *) data; + if (!escan_result_le) { +- brcmf_err("Invalid escan result (NULL pointer)\n"); ++ bphy_err(wiphy, "Invalid escan result (NULL pointer)\n"); + goto exit; + } + escan_buflen = le32_to_cpu(escan_result_le->buflen); + if (escan_buflen > BRCMF_ESCAN_BUF_SIZE || + escan_buflen > e->datalen || + escan_buflen < sizeof(*escan_result_le)) { +- brcmf_err("Invalid escan buffer length: %d\n", +- escan_buflen); ++ bphy_err(wiphy, "Invalid escan buffer length: %d\n", ++ escan_buflen); + goto exit; + } + if (le16_to_cpu(escan_result_le->bss_count) != 1) { +- brcmf_err("Invalid bss_count %d: ignoring\n", +- escan_result_le->bss_count); ++ bphy_err(wiphy, "Invalid bss_count %d: ignoring\n", ++ escan_result_le->bss_count); + goto exit; + } + bss_info_le = &escan_result_le->bss_info_le; +@@ -3092,8 +3124,8 @@ brcmf_cfg80211_escan_handler(struct brcm + + bi_length = le32_to_cpu(bss_info_le->length); + if (bi_length != escan_buflen - WL_ESCAN_RESULTS_FIXED_SIZE) { +- brcmf_err("Ignoring invalid bss_info length: %d\n", +- bi_length); ++ bphy_err(wiphy, "Ignoring invalid bss_info length: %d\n", ++ bi_length); + goto exit; + } + +@@ -3101,7 +3133,7 @@ brcmf_cfg80211_escan_handler(struct brcm + BIT(NL80211_IFTYPE_ADHOC))) { + if (le16_to_cpu(bss_info_le->capability) & + WLAN_CAPABILITY_IBSS) { +- brcmf_err("Ignoring IBSS result\n"); ++ bphy_err(wiphy, "Ignoring IBSS result\n"); + goto exit; + } + } +@@ -3109,7 +3141,7 @@ brcmf_cfg80211_escan_handler(struct brcm + list = (struct brcmf_scan_results *) + cfg->escan_info.escan_buf; + if (bi_length > BRCMF_ESCAN_BUF_SIZE - list->buflen) { +- brcmf_err("Buffer is too small: ignoring\n"); ++ bphy_err(wiphy, "Buffer is too small: ignoring\n"); + goto exit; + } + +@@ -3301,14 +3333,14 @@ brcmf_notify_sched_scan_results(struct b + WARN_ON(status != BRCMF_PNO_SCAN_COMPLETE); + brcmf_dbg(SCAN, "PFN NET FOUND event. count: %d\n", result_count); + if (!result_count) { +- brcmf_err("FALSE PNO Event. (pfn_count == 0)\n"); ++ bphy_err(wiphy, "FALSE PNO Event. (pfn_count == 0)\n"); + goto out_err; + } + + netinfo_start = brcmf_get_netinfo_array(pfn_result); + datalen = e->datalen - ((void *)netinfo_start - (void *)pfn_result); + if (datalen < result_count * sizeof(*netinfo)) { +- brcmf_err("insufficient event data\n"); ++ bphy_err(wiphy, "insufficient event data\n"); + goto out_err; + } + +@@ -3362,8 +3394,8 @@ brcmf_cfg80211_sched_scan_start(struct w + req->n_match_sets, req->n_ssids); + + if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) { +- brcmf_err("Scanning suppressed: status=%lu\n", +- cfg->scan_status); ++ bphy_err(wiphy, "Scanning suppressed: status=%lu\n", ++ cfg->scan_status); + return -EAGAIN; + } + +@@ -3442,6 +3474,7 @@ brcmf_wowl_nd_results(struct brcmf_if *i + void *data) + { + struct brcmf_cfg80211_info *cfg = ifp->drvr->config; ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + struct brcmf_pno_scanresults_le *pfn_result; + struct brcmf_pno_net_info_le *netinfo; + +@@ -3460,8 +3493,8 @@ brcmf_wowl_nd_results(struct brcmf_if *i + } + + if (le32_to_cpu(pfn_result->count) < 1) { +- brcmf_err("Invalid result count, expected 1 (%d)\n", +- le32_to_cpu(pfn_result->count)); ++ bphy_err(wiphy, "Invalid result count, expected 1 (%d)\n", ++ le32_to_cpu(pfn_result->count)); + return -EINVAL; + } + +@@ -3500,7 +3533,7 @@ static void brcmf_report_wowl_wakeind(st + err = brcmf_fil_iovar_data_get(ifp, "wowl_wakeind", &wake_ind_le, + sizeof(wake_ind_le)); + if (err) { +- brcmf_err("Get wowl_wakeind failed, err = %d\n", err); ++ bphy_err(wiphy, "Get wowl_wakeind failed, err = %d\n", err); + return; + } + +@@ -3541,7 +3574,7 @@ static void brcmf_report_wowl_wakeind(st + cfg->wowl.nd_data_completed, + BRCMF_ND_INFO_TIMEOUT); + if (!timeout) +- brcmf_err("No result for wowl net detect\n"); ++ bphy_err(wiphy, "No result for wowl net detect\n"); + else + wakeup_data.net_detect = cfg->wowl.nd_info; + } +@@ -3749,7 +3782,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *w + cfg->pmk_list.npmk = cpu_to_le32(npmk); + } + } else { +- brcmf_err("Too many PMKSA entries cached %d\n", npmk); ++ bphy_err(wiphy, "Too many PMKSA entries cached %d\n", npmk); + return -EINVAL; + } + +@@ -3795,7 +3828,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *w + memset(&pmk[i], 0, sizeof(*pmk)); + cfg->pmk_list.npmk = cpu_to_le32(npmk - 1); + } else { +- brcmf_err("Cache entry not found\n"); ++ bphy_err(wiphy, "Cache entry not found\n"); + return -EINVAL; + } + +@@ -3827,19 +3860,20 @@ brcmf_cfg80211_flush_pmksa(struct wiphy + + static s32 brcmf_configure_opensecurity(struct brcmf_if *ifp) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + s32 err; + s32 wpa_val; + + /* set auth */ + err = brcmf_fil_bsscfg_int_set(ifp, "auth", 0); + if (err < 0) { +- brcmf_err("auth error %d\n", err); ++ bphy_err(wiphy, "auth error %d\n", err); + return err; + } + /* set wsec */ + err = brcmf_fil_bsscfg_int_set(ifp, "wsec", 0); + if (err < 0) { +- brcmf_err("wsec error %d\n", err); ++ bphy_err(wiphy, "wsec error %d\n", err); + return err; + } + /* set upper-layer auth */ +@@ -3849,7 +3883,7 @@ static s32 brcmf_configure_opensecurity( + wpa_val = WPA_AUTH_DISABLED; + err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_val); + if (err < 0) { +- brcmf_err("wpa_auth error %d\n", err); ++ bphy_err(wiphy, "wpa_auth error %d\n", err); + return err; + } + +@@ -3869,6 +3903,7 @@ brcmf_configure_wpaie(struct brcmf_if *i + const struct brcmf_vs_tlv *wpa_ie, + bool is_rsn_ie) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + u32 auth = 0; /* d11 open authentication */ + u16 count; + s32 err = 0; +@@ -3899,13 +3934,13 @@ brcmf_configure_wpaie(struct brcmf_if *i + /* check for multicast cipher suite */ + if (offset + WPA_IE_MIN_OUI_LEN > len) { + err = -EINVAL; +- brcmf_err("no multicast cipher suite\n"); ++ bphy_err(wiphy, "no multicast cipher suite\n"); + goto exit; + } + + if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) { + err = -EINVAL; +- brcmf_err("ivalid OUI\n"); ++ bphy_err(wiphy, "ivalid OUI\n"); + goto exit; + } + offset += TLV_OUI_LEN; +@@ -3927,7 +3962,7 @@ brcmf_configure_wpaie(struct brcmf_if *i + break; + default: + err = -EINVAL; +- brcmf_err("Invalid multi cast cipher info\n"); ++ bphy_err(wiphy, "Invalid multi cast cipher info\n"); + goto exit; + } + +@@ -3938,13 +3973,13 @@ brcmf_configure_wpaie(struct brcmf_if *i + /* Check for unicast suite(s) */ + if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) { + err = -EINVAL; +- brcmf_err("no unicast cipher suite\n"); ++ bphy_err(wiphy, "no unicast cipher suite\n"); + goto exit; + } + for (i = 0; i < count; i++) { + if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) { + err = -EINVAL; +- brcmf_err("ivalid OUI\n"); ++ bphy_err(wiphy, "ivalid OUI\n"); + goto exit; + } + offset += TLV_OUI_LEN; +@@ -3962,7 +3997,7 @@ brcmf_configure_wpaie(struct brcmf_if *i + pval |= AES_ENABLED; + break; + default: +- brcmf_err("Invalid unicast security info\n"); ++ bphy_err(wiphy, "Invalid unicast security info\n"); + } + offset++; + } +@@ -3972,13 +4007,13 @@ brcmf_configure_wpaie(struct brcmf_if *i + /* Check for auth key management suite(s) */ + if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) { + err = -EINVAL; +- brcmf_err("no auth key mgmt suite\n"); ++ bphy_err(wiphy, "no auth key mgmt suite\n"); + goto exit; + } + for (i = 0; i < count; i++) { + if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) { + err = -EINVAL; +- brcmf_err("ivalid OUI\n"); ++ bphy_err(wiphy, "ivalid OUI\n"); + goto exit; + } + offset += TLV_OUI_LEN; +@@ -4006,7 +4041,7 @@ brcmf_configure_wpaie(struct brcmf_if *i + wpa_auth |= WPA2_AUTH_1X_SHA256; + break; + default: +- brcmf_err("Invalid key mgmt info\n"); ++ bphy_err(wiphy, "Invalid key mgmt info\n"); + } + offset++; + } +@@ -4048,7 +4083,7 @@ brcmf_configure_wpaie(struct brcmf_if *i + err = brcmf_fil_bsscfg_int_set(ifp, "wme_bss_disable", + wme_bss_disable); + if (err < 0) { +- brcmf_err("wme_bss_disable error %d\n", err); ++ bphy_err(wiphy, "wme_bss_disable error %d\n", err); + goto exit; + } + +@@ -4062,7 +4097,7 @@ brcmf_configure_wpaie(struct brcmf_if *i + &data[offset], + WPA_IE_MIN_OUI_LEN); + if (err < 0) { +- brcmf_err("bip error %d\n", err); ++ bphy_err(wiphy, "bip error %d\n", err); + goto exit; + } + } +@@ -4073,13 +4108,13 @@ brcmf_configure_wpaie(struct brcmf_if *i + /* set auth */ + err = brcmf_fil_bsscfg_int_set(ifp, "auth", auth); + if (err < 0) { +- brcmf_err("auth error %d\n", err); ++ bphy_err(wiphy, "auth error %d\n", err); + goto exit; + } + /* set wsec */ + err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec); + if (err < 0) { +- brcmf_err("wsec error %d\n", err); ++ bphy_err(wiphy, "wsec error %d\n", err); + goto exit; + } + /* Configure MFP, this needs to go after wsec otherwise the wsec command +@@ -4088,14 +4123,14 @@ brcmf_configure_wpaie(struct brcmf_if *i + if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP)) { + err = brcmf_fil_bsscfg_int_set(ifp, "mfp", mfp); + if (err < 0) { +- brcmf_err("mfp error %d\n", err); ++ bphy_err(wiphy, "mfp error %d\n", err); + goto exit; + } + } + /* set upper-layer auth */ + err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_auth); + if (err < 0) { +- brcmf_err("wpa_auth error %d\n", err); ++ bphy_err(wiphy, "wpa_auth error %d\n", err); + goto exit; + } + +@@ -4182,6 +4217,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c + const u8 *vndr_ie_buf, u32 vndr_ie_len) + { + struct brcmf_if *ifp; ++ struct wiphy *wiphy; + struct vif_saved_ie *saved_ie; + s32 err = 0; + u8 *iovar_ie_buf; +@@ -4202,6 +4238,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c + if (!vif) + return -ENODEV; + ifp = vif->ifp; ++ wiphy = ifp->drvr->wiphy; + saved_ie = &vif->saved_ie; + + brcmf_dbg(TRACE, "bsscfgidx %d, pktflag : 0x%02X\n", ifp->bsscfgidx, +@@ -4233,13 +4270,13 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c + break; + default: + err = -EPERM; +- brcmf_err("not suitable type\n"); ++ bphy_err(wiphy, "not suitable type\n"); + goto exit; + } + + if (vndr_ie_len > mgmt_ie_buf_len) { + err = -ENOMEM; +- brcmf_err("extra IE size too big\n"); ++ bphy_err(wiphy, "extra IE size too big\n"); + goto exit; + } + +@@ -4300,8 +4337,8 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c + /* verify remained buf size before copy data */ + if (remained_buf_len < (vndrie_info->vndrie.len + + VNDR_IE_VSIE_OFFSET)) { +- brcmf_err("no space in mgmt_ie_buf: len left %d", +- remained_buf_len); ++ bphy_err(wiphy, "no space in mgmt_ie_buf: len left %d", ++ remained_buf_len); + break; + } + remained_buf_len -= (vndrie_info->ie_len + +@@ -4332,7 +4369,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c + err = brcmf_fil_bsscfg_data_set(ifp, "vndr_ie", iovar_ie_buf, + total_ie_buf_len); + if (err) +- brcmf_err("vndr ie set error : %d\n", err); ++ bphy_err(wiphy, "vndr ie set error : %d\n", err); + } + + exit: +@@ -4360,13 +4397,14 @@ static s32 + brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif, + struct cfg80211_beacon_data *beacon) + { ++ struct wiphy *wiphy = vif->ifp->drvr->wiphy; + s32 err; + + /* Set Beacon IEs to FW */ + err = brcmf_vif_set_mgmt_ie(vif, BRCMF_VNDR_IE_BEACON_FLAG, + beacon->tail, beacon->tail_len); + if (err) { +- brcmf_err("Set Beacon IE Failed\n"); ++ bphy_err(wiphy, "Set Beacon IE Failed\n"); + return err; + } + brcmf_dbg(TRACE, "Applied Vndr IEs for Beacon\n"); +@@ -4376,7 +4414,7 @@ brcmf_config_ap_mgmt_ie(struct brcmf_cfg + beacon->proberesp_ies, + beacon->proberesp_ies_len); + if (err) +- brcmf_err("Set Probe Resp IE Failed\n"); ++ bphy_err(wiphy, "Set Probe Resp IE Failed\n"); + else + brcmf_dbg(TRACE, "Applied Vndr IEs for Probe Resp\n"); + +@@ -4485,7 +4523,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY, + is_11d); + if (err < 0) { +- brcmf_err("Regulatory Set Error, %d\n", err); ++ bphy_err(wiphy, "Regulatory Set Error, %d\n", ++ err); + goto exit; + } + } +@@ -4493,8 +4532,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, + settings->beacon_interval); + if (err < 0) { +- brcmf_err("Beacon Interval Set Error, %d\n", +- err); ++ bphy_err(wiphy, "Beacon Interval Set Error, %d\n", ++ err); + goto exit; + } + } +@@ -4502,7 +4541,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_DTIMPRD, + settings->dtim_period); + if (err < 0) { +- brcmf_err("DTIM Interval Set Error, %d\n", err); ++ bphy_err(wiphy, "DTIM Interval Set Error, %d\n", ++ err); + goto exit; + } + } +@@ -4512,7 +4552,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + !brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB))) { + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); + if (err < 0) { +- brcmf_err("BRCMF_C_DOWN error %d\n", err); ++ bphy_err(wiphy, "BRCMF_C_DOWN error %d\n", ++ err); + goto exit; + } + brcmf_fil_iovar_int_set(ifp, "apsta", 0); +@@ -4520,7 +4561,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 1); + if (err < 0) { +- brcmf_err("SET INFRA error %d\n", err); ++ bphy_err(wiphy, "SET INFRA error %d\n", err); + goto exit; + } + } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) { +@@ -4536,7 +4577,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 1); + if (err < 0) { +- brcmf_err("setting AP mode failed %d\n", err); ++ bphy_err(wiphy, "setting AP mode failed %d\n", ++ err); + goto exit; + } + if (!mbss) { +@@ -4545,14 +4587,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + */ + err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); + if (err < 0) { +- brcmf_err("Set Channel failed: chspec=%d, %d\n", +- chanspec, err); ++ bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n", ++ chanspec, err); + goto exit; + } + } + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1); + if (err < 0) { +- brcmf_err("BRCMF_C_UP error (%d)\n", err); ++ bphy_err(wiphy, "BRCMF_C_UP error (%d)\n", err); + goto exit; + } + /* On DOWN the firmware removes the WEP keys, reconfigure +@@ -4567,14 +4609,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, + &join_params, sizeof(join_params)); + if (err < 0) { +- brcmf_err("SET SSID error (%d)\n", err); ++ bphy_err(wiphy, "SET SSID error (%d)\n", err); + goto exit; + } + + if (settings->hidden_ssid) { + err = brcmf_fil_iovar_int_set(ifp, "closednet", 1); + if (err) { +- brcmf_err("closednet error (%d)\n", err); ++ bphy_err(wiphy, "closednet error (%d)\n", err); + goto exit; + } + } +@@ -4583,14 +4625,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + } else if (dev_role == NL80211_IFTYPE_P2P_GO) { + err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); + if (err < 0) { +- brcmf_err("Set Channel failed: chspec=%d, %d\n", +- chanspec, err); ++ bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n", ++ chanspec, err); + goto exit; + } + err = brcmf_fil_bsscfg_data_set(ifp, "ssid", &ssid_le, + sizeof(ssid_le)); + if (err < 0) { +- brcmf_err("setting ssid failed %d\n", err); ++ bphy_err(wiphy, "setting ssid failed %d\n", err); + goto exit; + } + bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx); +@@ -4598,7 +4640,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable, + sizeof(bss_enable)); + if (err < 0) { +- brcmf_err("bss_enable config failed %d\n", err); ++ bphy_err(wiphy, "bss_enable config failed %d\n", err); + goto exit; + } + +@@ -4646,13 +4688,13 @@ static int brcmf_cfg80211_stop_ap(struct + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, + &join_params, sizeof(join_params)); + if (err < 0) +- brcmf_err("SET SSID error (%d)\n", err); ++ bphy_err(wiphy, "SET SSID error (%d)\n", err); + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); + if (err < 0) +- brcmf_err("BRCMF_C_DOWN error %d\n", err); ++ bphy_err(wiphy, "BRCMF_C_DOWN error %d\n", err); + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0); + if (err < 0) +- brcmf_err("setting AP mode failed %d\n", err); ++ bphy_err(wiphy, "setting AP mode failed %d\n", err); + if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) + brcmf_fil_iovar_int_set(ifp, "mbss", 0); + brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY, +@@ -4660,7 +4702,7 @@ static int brcmf_cfg80211_stop_ap(struct + /* Bring device back up so it can be used again */ + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1); + if (err < 0) +- brcmf_err("BRCMF_C_UP error %d\n", err); ++ bphy_err(wiphy, "BRCMF_C_UP error %d\n", err); + + brcmf_vif_clear_mgmt_ies(ifp->vif); + } else { +@@ -4669,7 +4711,7 @@ static int brcmf_cfg80211_stop_ap(struct + err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable, + sizeof(bss_enable)); + if (err < 0) +- brcmf_err("bss_enable config failed %d\n", err); ++ bphy_err(wiphy, "bss_enable config failed %d\n", err); + } + brcmf_set_mpc(ifp, 1); + brcmf_configure_arp_nd_offload(ifp, true); +@@ -4717,7 +4759,8 @@ brcmf_cfg80211_del_station(struct wiphy + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON, + &scbval, sizeof(scbval)); + if (err) +- brcmf_err("SCB_DEAUTHENTICATE_FOR_REASON failed %d\n", err); ++ bphy_err(wiphy, "SCB_DEAUTHENTICATE_FOR_REASON failed %d\n", ++ err); + + brcmf_dbg(TRACE, "Exit\n"); + return err; +@@ -4747,7 +4790,7 @@ brcmf_cfg80211_change_station(struct wip + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SCB_DEAUTHORIZE, + (void *)mac, ETH_ALEN); + if (err < 0) +- brcmf_err("Setting SCB (de-)authorize failed, %d\n", err); ++ bphy_err(wiphy, "Setting SCB (de-)authorize failed, %d\n", err); + + return err; + } +@@ -4797,7 +4840,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip + mgmt = (const struct ieee80211_mgmt *)buf; + + if (!ieee80211_is_mgmt(mgmt->frame_control)) { +- brcmf_err("Driver only allows MGMT packet type\n"); ++ bphy_err(wiphy, "Driver only allows MGMT packet type\n"); + return -EPERM; + } + +@@ -4828,13 +4871,13 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip + GFP_KERNEL); + } else if (ieee80211_is_action(mgmt->frame_control)) { + if (len > BRCMF_FIL_ACTION_FRAME_SIZE + DOT11_MGMT_HDR_LEN) { +- brcmf_err("invalid action frame length\n"); ++ bphy_err(wiphy, "invalid action frame length\n"); + err = -EINVAL; + goto exit; + } + af_params = kzalloc(sizeof(*af_params), GFP_KERNEL); + if (af_params == NULL) { +- brcmf_err("unable to allocate frame\n"); ++ bphy_err(wiphy, "unable to allocate frame\n"); + err = -ENOMEM; + goto exit; + } +@@ -4892,7 +4935,7 @@ brcmf_cfg80211_cancel_remain_on_channel( + + vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif; + if (vif == NULL) { +- brcmf_err("No p2p device available for probe response\n"); ++ bphy_err(wiphy, "No p2p device available for probe response\n"); + err = -ENODEV; + goto exit; + } +@@ -4920,7 +4963,7 @@ static int brcmf_cfg80211_get_channel(st + + err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec); + if (err) { +- brcmf_err("chanspec failed (%d)\n", err); ++ bphy_err(wiphy, "chanspec failed (%d)\n", err); + return err; + } + +@@ -5059,7 +5102,7 @@ static int brcmf_cfg80211_tdls_oper(stru + ret = brcmf_fil_iovar_data_set(ifp, "tdls_endpoint", + &info, sizeof(info)); + if (ret < 0) +- brcmf_err("tdls_endpoint iovar failed: ret=%d\n", ret); ++ bphy_err(wiphy, "tdls_endpoint iovar failed: ret=%d\n", ret); + + return ret; + } +@@ -5080,7 +5123,7 @@ brcmf_cfg80211_update_conn_params(struct + err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG, + sme->ie, sme->ie_len); + if (err) +- brcmf_err("Set Assoc REQ IE Failed\n"); ++ bphy_err(wiphy, "Set Assoc REQ IE Failed\n"); + else + brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n"); + +@@ -5106,7 +5149,7 @@ brcmf_cfg80211_set_rekey_data(struct wip + ret = brcmf_fil_iovar_data_set(ifp, "gtk_key_info", >k_le, + sizeof(gtk_le)); + if (ret < 0) +- brcmf_err("gtk_key_info iovar failed: ret=%d\n", ret); ++ bphy_err(wiphy, "gtk_key_info iovar failed: ret=%d\n", ret); + + return ret; + } +@@ -5338,6 +5381,7 @@ static void brcmf_clear_assoc_ies(struct + static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg, + struct brcmf_if *ifp) + { ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + struct brcmf_cfg80211_assoc_ielen_le *assoc_info; + struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg); + u32 req_len; +@@ -5349,7 +5393,7 @@ static s32 brcmf_get_assoc_ies(struct br + err = brcmf_fil_iovar_data_get(ifp, "assoc_info", + cfg->extra_buf, WL_ASSOC_INFO_MAX); + if (err) { +- brcmf_err("could not get assoc info (%d)\n", err); ++ bphy_err(wiphy, "could not get assoc info (%d)\n", err); + return err; + } + assoc_info = +@@ -5361,7 +5405,7 @@ static s32 brcmf_get_assoc_ies(struct br + cfg->extra_buf, + WL_ASSOC_INFO_MAX); + if (err) { +- brcmf_err("could not get assoc req (%d)\n", err); ++ bphy_err(wiphy, "could not get assoc req (%d)\n", err); + return err; + } + conn_info->req_ie_len = req_len; +@@ -5379,7 +5423,7 @@ static s32 brcmf_get_assoc_ies(struct br + cfg->extra_buf, + WL_ASSOC_INFO_MAX); + if (err) { +- brcmf_err("could not get assoc resp (%d)\n", err); ++ bphy_err(wiphy, "could not get assoc resp (%d)\n", err); + return err; + } + conn_info->resp_ie_len = resp_len; +@@ -5508,6 +5552,7 @@ brcmf_notify_connect_status_ap(struct br + struct net_device *ndev, + const struct brcmf_event_msg *e, void *data) + { ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + static int generation; + u32 event = e->event_code; + u32 reason = e->reason; +@@ -5525,7 +5570,7 @@ brcmf_notify_connect_status_ap(struct br + if (((event == BRCMF_E_ASSOC_IND) || (event == BRCMF_E_REASSOC_IND)) && + (reason == BRCMF_E_STATUS_SUCCESS)) { + if (!data) { +- brcmf_err("No IEs present in ASSOC/REASSOC_IND"); ++ bphy_err(wiphy, "No IEs present in ASSOC/REASSOC_IND\n"); + return -EINVAL; + } + +@@ -5817,6 +5862,7 @@ static void init_vif_event(struct brcmf_ + + static s32 brcmf_dongle_roam(struct brcmf_if *ifp) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + s32 err; + u32 bcn_timeout; + __le32 roamtrigger[2]; +@@ -5829,7 +5875,7 @@ static s32 brcmf_dongle_roam(struct brcm + bcn_timeout = BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON; + err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout); + if (err) { +- brcmf_err("bcn_timeout error (%d)\n", err); ++ bphy_err(wiphy, "bcn_timeout error (%d)\n", err); + goto roam_setup_done; + } + +@@ -5841,7 +5887,7 @@ static s32 brcmf_dongle_roam(struct brcm + err = brcmf_fil_iovar_int_set(ifp, "roam_off", + ifp->drvr->settings->roamoff); + if (err) { +- brcmf_err("roam_off error (%d)\n", err); ++ bphy_err(wiphy, "roam_off error (%d)\n", err); + goto roam_setup_done; + } + +@@ -5850,7 +5896,7 @@ static s32 brcmf_dongle_roam(struct brcm + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_TRIGGER, + (void *)roamtrigger, sizeof(roamtrigger)); + if (err) { +- brcmf_err("WLC_SET_ROAM_TRIGGER error (%d)\n", err); ++ bphy_err(wiphy, "WLC_SET_ROAM_TRIGGER error (%d)\n", err); + goto roam_setup_done; + } + +@@ -5859,7 +5905,7 @@ static s32 brcmf_dongle_roam(struct brcm + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_DELTA, + (void *)roam_delta, sizeof(roam_delta)); + if (err) { +- brcmf_err("WLC_SET_ROAM_DELTA error (%d)\n", err); ++ bphy_err(wiphy, "WLC_SET_ROAM_DELTA error (%d)\n", err); + goto roam_setup_done; + } + +@@ -5870,25 +5916,26 @@ roam_setup_done: + static s32 + brcmf_dongle_scantime(struct brcmf_if *ifp) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + s32 err = 0; + + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME, + BRCMF_SCAN_CHANNEL_TIME); + if (err) { +- brcmf_err("Scan assoc time error (%d)\n", err); ++ bphy_err(wiphy, "Scan assoc time error (%d)\n", err); + goto dongle_scantime_out; + } + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME, + BRCMF_SCAN_UNASSOC_TIME); + if (err) { +- brcmf_err("Scan unassoc time error (%d)\n", err); ++ bphy_err(wiphy, "Scan unassoc time error (%d)\n", err); + goto dongle_scantime_out; + } + + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_PASSIVE_TIME, + BRCMF_SCAN_PASSIVE_TIME); + if (err) { +- brcmf_err("Scan passive time error (%d)\n", err); ++ bphy_err(wiphy, "Scan passive time error (%d)\n", err); + goto dongle_scantime_out; + } + +@@ -5920,10 +5967,10 @@ static void brcmf_update_bw40_channel_fl + static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg, + u32 bw_cap[]) + { ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); + struct ieee80211_supported_band *band; + struct ieee80211_channel *channel; +- struct wiphy *wiphy; + struct brcmf_chanspec_list *list; + struct brcmu_chan ch; + int err; +@@ -5942,11 +5989,10 @@ static int brcmf_construct_chaninfo(stru + err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf, + BRCMF_DCMD_MEDLEN); + if (err) { +- brcmf_err("get chanspecs error (%d)\n", err); ++ bphy_err(wiphy, "get chanspecs error (%d)\n", err); + goto fail_pbuf; + } + +- wiphy = cfg_to_wiphy(cfg); + band = wiphy->bands[NL80211_BAND_2GHZ]; + if (band) + for (i = 0; i < band->n_channels; i++) +@@ -5966,7 +6012,8 @@ static int brcmf_construct_chaninfo(stru + } else if (ch.band == BRCMU_CHAN_BAND_5G) { + band = wiphy->bands[NL80211_BAND_5GHZ]; + } else { +- brcmf_err("Invalid channel Spec. 0x%x.\n", ch.chspec); ++ bphy_err(wiphy, "Invalid channel Spec. 0x%x.\n", ++ ch.chspec); + continue; + } + if (!band) +@@ -5989,8 +6036,8 @@ static int brcmf_construct_chaninfo(stru + /* It seems firmware supports some channel we never + * considered. Something new in IEEE standard? + */ +- brcmf_err("Ignoring unexpected firmware channel %d\n", +- ch.control_ch_num); ++ bphy_err(wiphy, "Ignoring unexpected firmware channel %d\n", ++ ch.control_ch_num); + continue; + } + +@@ -6036,6 +6083,7 @@ fail_pbuf: + + static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg) + { ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); + struct ieee80211_supported_band *band; + struct brcmf_fil_bwcap_le band_bwcap; +@@ -6082,7 +6130,7 @@ static int brcmf_enable_bw40_2g(struct b + err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf, + BRCMF_DCMD_MEDLEN); + if (err) { +- brcmf_err("get chanspecs error (%d)\n", err); ++ bphy_err(wiphy, "get chanspecs error (%d)\n", err); + kfree(pbuf); + return err; + } +@@ -6113,6 +6161,7 @@ static int brcmf_enable_bw40_2g(struct b + + static void brcmf_get_bwcap(struct brcmf_if *ifp, u32 bw_cap[]) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + u32 band, mimo_bwcap; + int err; + +@@ -6148,7 +6197,7 @@ static void brcmf_get_bwcap(struct brcmf + bw_cap[NL80211_BAND_5GHZ] |= WLC_BW_20MHZ_BIT; + break; + default: +- brcmf_err("invalid mimo_bw_cap value\n"); ++ bphy_err(wiphy, "invalid mimo_bw_cap value\n"); + } + } + +@@ -6224,7 +6273,7 @@ static void brcmf_update_vht_cap(struct + static int brcmf_setup_wiphybands(struct brcmf_cfg80211_info *cfg) + { + struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); +- struct wiphy *wiphy; ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + u32 nmode = 0; + u32 vhtmode = 0; + u32 bw_cap[2] = { WLC_BW_20MHZ_BIT, WLC_BW_20MHZ_BIT }; +@@ -6240,7 +6289,7 @@ static int brcmf_setup_wiphybands(struct + (void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode); + err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode); + if (err) { +- brcmf_err("nmode error (%d)\n", err); ++ bphy_err(wiphy, "nmode error (%d)\n", err); + } else { + brcmf_get_bwcap(ifp, bw_cap); + } +@@ -6250,7 +6299,7 @@ static int brcmf_setup_wiphybands(struct + + err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain); + if (err) { +- brcmf_err("rxchain error (%d)\n", err); ++ bphy_err(wiphy, "rxchain error (%d)\n", err); + nchain = 1; + } else { + for (nchain = 0; rxchain; nchain++) +@@ -6260,7 +6309,7 @@ static int brcmf_setup_wiphybands(struct + + err = brcmf_construct_chaninfo(cfg, bw_cap); + if (err) { +- brcmf_err("brcmf_construct_chaninfo failed (%d)\n", err); ++ bphy_err(wiphy, "brcmf_construct_chaninfo failed (%d)\n", err); + return err; + } + +@@ -6272,7 +6321,6 @@ static int brcmf_setup_wiphybands(struct + &txbf_bfr_cap); + } + +- wiphy = cfg_to_wiphy(cfg); + for (i = 0; i < ARRAY_SIZE(wiphy->bands); i++) { + band = wiphy->bands[i]; + if (band == NULL) +@@ -6473,7 +6521,7 @@ static void brcmf_wiphy_wowl_params(stru + wowl = kmemdup(&brcmf_wowlan_support, sizeof(brcmf_wowlan_support), + GFP_KERNEL); + if (!wowl) { +- brcmf_err("only support basic wowlan features\n"); ++ bphy_err(wiphy, "only support basic wowlan features\n"); + wiphy->wowlan = &brcmf_wowlan_support; + return; + } +@@ -6570,7 +6618,7 @@ static int brcmf_setup_wiphy(struct wiph + err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist, + sizeof(bandlist)); + if (err) { +- brcmf_err("could not obtain band info: err=%d\n", err); ++ bphy_err(wiphy, "could not obtain band info: err=%d\n", err); + return err; + } + /* first entry in bandlist is number of bands */ +@@ -6619,6 +6667,7 @@ static int brcmf_setup_wiphy(struct wiph + + static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg) + { ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + struct net_device *ndev; + struct wireless_dev *wdev; + struct brcmf_if *ifp; +@@ -6656,7 +6705,7 @@ static s32 brcmf_config_dongle(struct br + + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_FAKEFRAG, 1); + if (err) { +- brcmf_err("failed to set frameburst mode\n"); ++ bphy_err(wiphy, "failed to set frameburst mode\n"); + goto default_conf_out; + } + +@@ -6848,8 +6897,8 @@ static void brcmf_cfg80211_reg_notifier( + /* ignore non-ISO3166 country codes */ + for (i = 0; i < 2; i++) + if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') { +- brcmf_err("not an ISO3166 code (0x%02x 0x%02x)\n", +- req->alpha2[0], req->alpha2[1]); ++ bphy_err(wiphy, "not an ISO3166 code (0x%02x 0x%02x)\n", ++ req->alpha2[0], req->alpha2[1]); + return; + } + +@@ -6858,7 +6907,7 @@ static void brcmf_cfg80211_reg_notifier( + + err = brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq)); + if (err) { +- brcmf_err("Country code iovar returned err = %d\n", err); ++ bphy_err(wiphy, "Country code iovar returned err = %d\n", err); + return; + } + +@@ -6868,7 +6917,7 @@ static void brcmf_cfg80211_reg_notifier( + + err = brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq)); + if (err) { +- brcmf_err("Firmware rejected country setting\n"); ++ bphy_err(wiphy, "Firmware rejected country setting\n"); + return; + } + brcmf_setup_wiphybands(cfg); +@@ -6914,13 +6963,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + u16 *cap = NULL; + + if (!ndev) { +- brcmf_err("ndev is invalid\n"); ++ bphy_err(wiphy, "ndev is invalid\n"); + return NULL; + } + + cfg = kzalloc(sizeof(*cfg), GFP_KERNEL); + if (!cfg) { +- brcmf_err("Could not allocate wiphy device\n"); ++ bphy_err(wiphy, "Could not allocate wiphy device\n"); + return NULL; + } + +@@ -6941,7 +6990,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + + err = wl_init_priv(cfg); + if (err) { +- brcmf_err("Failed to init iwm_priv (%d)\n", err); ++ bphy_err(wiphy, "Failed to init iwm_priv (%d)\n", err); + brcmf_free_vif(vif); + goto wiphy_out; + } +@@ -6950,7 +6999,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + /* determine d11 io type before wiphy setup */ + err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_VERSION, &io_type); + if (err) { +- brcmf_err("Failed to get D11 version (%d)\n", err); ++ bphy_err(wiphy, "Failed to get D11 version (%d)\n", err); + goto priv_out; + } + cfg->d11inf.io_type = (u8)io_type; +@@ -6984,13 +7033,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + #endif + err = wiphy_register(wiphy); + if (err < 0) { +- brcmf_err("Could not register wiphy device (%d)\n", err); ++ bphy_err(wiphy, "Could not register wiphy device (%d)\n", err); + goto priv_out; + } + + err = brcmf_setup_wiphybands(cfg); + if (err) { +- brcmf_err("Setting wiphy bands failed (%d)\n", err); ++ bphy_err(wiphy, "Setting wiphy bands failed (%d)\n", err); + goto wiphy_unreg_out; + } + +@@ -7008,24 +7057,24 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + + err = brcmf_fweh_activate_events(ifp); + if (err) { +- brcmf_err("FWEH activation failed (%d)\n", err); ++ bphy_err(wiphy, "FWEH activation failed (%d)\n", err); + goto wiphy_unreg_out; + } + + err = brcmf_p2p_attach(cfg, p2pdev_forced); + if (err) { +- brcmf_err("P2P initialisation failed (%d)\n", err); ++ bphy_err(wiphy, "P2P initialisation failed (%d)\n", err); + goto wiphy_unreg_out; + } + err = brcmf_btcoex_attach(cfg); + if (err) { +- brcmf_err("BT-coex initialisation failed (%d)\n", err); ++ bphy_err(wiphy, "BT-coex initialisation failed (%d)\n", err); + brcmf_p2p_detach(&cfg->p2p); + goto wiphy_unreg_out; + } + err = brcmf_pno_attach(cfg); + if (err) { +- brcmf_err("PNO initialisation failed (%d)\n", err); ++ bphy_err(wiphy, "PNO initialisation failed (%d)\n", err); + brcmf_btcoex_detach(cfg); + brcmf_p2p_detach(&cfg->p2p); + goto wiphy_unreg_out; +@@ -7045,7 +7094,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + /* (re-) activate FWEH event handling */ + err = brcmf_fweh_activate_events(ifp); + if (err) { +- brcmf_err("FWEH activation failed (%d)\n", err); ++ bphy_err(wiphy, "FWEH activation failed (%d)\n", err); + goto detach; + } + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +@@ -62,6 +62,15 @@ void __brcmf_err(struct brcmf_bus *bus, + } while (0) + #endif + ++#define bphy_err(wiphy, fmt, ...) \ ++ do { \ ++ if (IS_ENABLED(CPTCFG_BRCMDBG) || \ ++ IS_ENABLED(CPTCFG_BRCM_TRACING) || \ ++ net_ratelimit()) \ ++ wiphy_err(wiphy, "%s: " fmt, __func__, \ ++ ##__VA_ARGS__); \ ++ } while (0) ++ + #if defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) + + /* For debug/tracing purposes treat info messages as errors */ diff --git a/package/kernel/mac80211/patches/brcm/347-v5.1-brcmfmac-fix-typos.patch b/package/kernel/mac80211/patches/brcm/347-v5.1-brcmfmac-fix-typos.patch new file mode 100644 index 00000000000000..e21c1ee60a59b7 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/347-v5.1-brcmfmac-fix-typos.patch @@ -0,0 +1,62 @@ +From 2359dd09f9819c7d57d81e05173541f0f9f820c7 Mon Sep 17 00:00:00 2001 +From: Matteo Croce +Date: Tue, 29 Jan 2019 18:47:17 +0100 +Subject: [PATCH] brcmfmac: fix typos + +Fix spelling mistakes in brcmfmac: "lenght" -> "length". +The typos are also in the special comment blocks which +translates to documentation. + +Signed-off-by: Matteo Croce +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h | 2 +- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 2 +- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h | 2 +- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +@@ -36,7 +36,7 @@ + #define BRCMF_DCMD_MEDLEN 1536 + #define BRCMF_DCMD_MAXLEN 8192 + +-/* IOCTL from host to device are limited in lenght. A device can only handle ++/* IOCTL from host to device are limited in length. A device can only handle + * ethernet frame size. This limitation is to be applied by protocol layer. + */ + #define BRCMF_TX_IOCTL_MAX_MSG_SIZE (ETH_FRAME_LEN+ETH_FCS_LEN) +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -47,7 +47,7 @@ enum nvram_parser_state { + * @state: current parser state. + * @data: input buffer being parsed. + * @nvram: output buffer with parse result. +- * @nvram_len: lenght of parse result. ++ * @nvram_len: length of parse result. + * @line: current line. + * @column: current column in line. + * @pos: byte offset in input buffer. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h +@@ -266,7 +266,7 @@ struct brcmf_event { + * @status: status information. + * @reason: reason code. + * @auth_type: authentication type. +- * @datalen: lenght of event data buffer. ++ * @datalen: length of event data buffer. + * @addr: ether address. + * @ifname: interface name. + * @ifidx: interface index. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -508,7 +508,7 @@ static void brcmf_usb_rx_complete(struct + skb = req->skb; + req->skb = NULL; + +- /* zero lenght packets indicate usb "failure". Do not refill */ ++ /* zero length packets indicate usb "failure". Do not refill */ + if (urb->status != 0 || !urb->actual_length) { + brcmu_pkt_buf_free_skb(skb); + brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req, NULL); diff --git a/package/kernel/mac80211/patches/brcm/348-v5.1-brcmfmac-support-monitor-frames-with-the-hardware-uc.patch b/package/kernel/mac80211/patches/brcm/348-v5.1-brcmfmac-support-monitor-frames-with-the-hardware-uc.patch new file mode 100644 index 00000000000000..c93bcf0ce91333 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/348-v5.1-brcmfmac-support-monitor-frames-with-the-hardware-uc.patch @@ -0,0 +1,143 @@ +From e665988be29ccea3584528967b432a5cfd801ca4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 8 Feb 2019 07:42:30 +0100 +Subject: [PATCH] brcmfmac: support monitor frames with the hardware/ucode + header +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +So far there were two monitor frame formats: +1) 802.11 frames (with frame (sub)type & all addresses) +2) 802.11 frames with the radiotap header + +Testing the latest FullMAC firmwares for 4366b1/4366c0 resulted in +discovering a new format being used. It seems (almost?) identical to the +one known from ucode used in SoftMAC devices which is most likely the +same codebase anyway. + +While new firmwares will /announce/ radiotap header support using the +"rtap" fw capability string it seems no string was added for the new +ucode header format. + +All above means that: +1) We need new format support when dealing with a received frame +2) A new feature bit & mapping quirks have to be added manually + +As for now only an empty radiotap is being created. Adding support for +extracting some info (band, channel, signal, etc.) is planned for the +future. + +Signed-off-by: Rafał Miłecki +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/core.c | 55 +++++++++++++++++++ + .../broadcom/brcm80211/brcmfmac/feature.c | 4 ++ + .../broadcom/brcm80211/brcmfmac/feature.h | 4 +- + 3 files changed, 62 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -43,6 +43,36 @@ + + #define BRCMF_BSSIDX_INVALID -1 + ++#define RXS_PBPRES BIT(2) ++ ++#define D11_PHY_HDR_LEN 6 ++ ++struct d11rxhdr_le { ++ __le16 RxFrameSize; ++ u16 PAD; ++ __le16 PhyRxStatus_0; ++ __le16 PhyRxStatus_1; ++ __le16 PhyRxStatus_2; ++ __le16 PhyRxStatus_3; ++ __le16 PhyRxStatus_4; ++ __le16 PhyRxStatus_5; ++ __le16 RxStatus1; ++ __le16 RxStatus2; ++ __le16 RxTSFTime; ++ __le16 RxChan; ++ u8 unknown[12]; ++} __packed; ++ ++struct wlc_d11rxhdr { ++ struct d11rxhdr_le rxhdr; ++ __le32 tsf_l; ++ s8 rssi; ++ s8 rxpwr0; ++ s8 rxpwr1; ++ s8 do_rssi_ma; ++ s8 rxpwr[4]; ++} __packed; ++ + char *brcmf_ifname(struct brcmf_if *ifp) + { + if (!ifp) +@@ -409,6 +439,31 @@ void brcmf_netif_mon_rx(struct brcmf_if + { + if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MONITOR_FMT_RADIOTAP)) { + /* Do nothing */ ++ } else if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MONITOR_FMT_HW_RX_HDR)) { ++ struct wlc_d11rxhdr *wlc_rxhdr = (struct wlc_d11rxhdr *)skb->data; ++ struct ieee80211_radiotap_header *radiotap; ++ unsigned int offset; ++ u16 RxStatus1; ++ ++ RxStatus1 = le16_to_cpu(wlc_rxhdr->rxhdr.RxStatus1); ++ ++ offset = sizeof(struct wlc_d11rxhdr); ++ /* MAC inserts 2 pad bytes for a4 headers or QoS or A-MSDU ++ * subframes ++ */ ++ if (RxStatus1 & RXS_PBPRES) ++ offset += 2; ++ offset += D11_PHY_HDR_LEN; ++ ++ skb_pull(skb, offset); ++ ++ /* TODO: use RX header to fill some radiotap data */ ++ radiotap = skb_push(skb, sizeof(*radiotap)); ++ memset(radiotap, 0, sizeof(*radiotap)); ++ radiotap->it_len = cpu_to_le16(sizeof(*radiotap)); ++ ++ /* TODO: 4 bytes with receive status? */ ++ skb->len -= 4; + } else { + struct ieee80211_radiotap_header *radiotap; + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +@@ -103,6 +103,10 @@ static const struct brcmf_feat_fwfeat br + { "01-6cb8e269", BIT(BRCMF_FEAT_MONITOR) }, + /* brcmfmac4366b-pcie.bin from linux-firmware.git commit 52442afee990 */ + { "01-c47a91a4", BIT(BRCMF_FEAT_MONITOR) }, ++ /* brcmfmac4366b-pcie.bin from linux-firmware.git commit 211de1679a68 */ ++ { "01-801fb449", BIT(BRCMF_FEAT_MONITOR_FMT_HW_RX_HDR) }, ++ /* brcmfmac4366c-pcie.bin from linux-firmware.git commit 211de1679a68 */ ++ { "01-d2cbb8fd", BIT(BRCMF_FEAT_MONITOR_FMT_HW_RX_HDR) }, + }; + + static void brcmf_feat_firmware_overrides(struct brcmf_pub *drv) +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h +@@ -35,6 +35,7 @@ + * FWSUP: Firmware supplicant. + * MONITOR: firmware can pass monitor packets to host. + * MONITOR_FMT_RADIOTAP: firmware provides monitor packets with radiotap header ++ * MONITOR_FMT_HW_RX_HDR: firmware provides monitor packets with hw/ucode header + */ + #define BRCMF_FEAT_LIST \ + BRCMF_FEAT_DEF(MBSS) \ +@@ -52,7 +53,8 @@ + BRCMF_FEAT_DEF(GSCAN) \ + BRCMF_FEAT_DEF(FWSUP) \ + BRCMF_FEAT_DEF(MONITOR) \ +- BRCMF_FEAT_DEF(MONITOR_FMT_RADIOTAP) ++ BRCMF_FEAT_DEF(MONITOR_FMT_RADIOTAP) \ ++ BRCMF_FEAT_DEF(MONITOR_FMT_HW_RX_HDR) + + /* + * Quirks: diff --git a/package/kernel/mac80211/patches/brcm/349-v5.1-0003-brcmfmac-create-debugfs-files-for-bus-specific-layer.patch b/package/kernel/mac80211/patches/brcm/349-v5.1-0003-brcmfmac-create-debugfs-files-for-bus-specific-layer.patch new file mode 100644 index 00000000000000..487aa004090b04 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/349-v5.1-0003-brcmfmac-create-debugfs-files-for-bus-specific-layer.patch @@ -0,0 +1,101 @@ +From aaf6a5e86e36766abbeedf220462bde8031f9a72 Mon Sep 17 00:00:00 2001 +From: Arend van Spriel +Date: Thu, 14 Feb 2019 13:43:49 +0100 +Subject: [PATCH] brcmfmac: create debugfs files for bus-specific layer + +Since we moved the drivers debugfs directory under ieee80211 debugfs the +debugfs entries need to be added after wiphy_register() has been called. +For most part that has been done accordingly, but for the debugfs entries +added by SDIO it was not and failed silently. This patch fixes that by +adding a bus-layer callback for it. + +Fixes: 856d5a011c86 ("brcmfmac: allocate struct brcmf_pub instance using wiphy_new()") +Reported-by: Russel King +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 10 ++++++++++ + .../net/wireless/broadcom/brcm80211/brcmfmac/core.c | 1 + + .../net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 12 +++++++----- + 3 files changed, 18 insertions(+), 5 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +@@ -90,6 +90,7 @@ struct brcmf_bus_ops { + int (*get_memdump)(struct device *dev, void *data, size_t len); + int (*get_fwname)(struct device *dev, const char *ext, + unsigned char *fw_name); ++ void (*debugfs_create)(struct device *dev); + }; + + +@@ -235,6 +236,15 @@ int brcmf_bus_get_fwname(struct brcmf_bu + return bus->ops->get_fwname(bus->dev, ext, fw_name); + } + ++static inline ++void brcmf_bus_debugfs_create(struct brcmf_bus *bus) ++{ ++ if (!bus->ops->debugfs_create) ++ return; ++ ++ return bus->ops->debugfs_create(bus->dev); ++} ++ + /* + * interface functions from common layer + */ +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -1181,6 +1181,7 @@ static int brcmf_bus_started(struct brcm + brcmf_debugfs_add_entry(drvr, "revinfo", brcmf_revinfo_read); + brcmf_feat_debugfs_create(drvr); + brcmf_proto_debugfs_create(drvr); ++ brcmf_bus_debugfs_create(bus_if); + + return 0; + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -3154,9 +3154,12 @@ static int brcmf_debugfs_sdio_count_read + return 0; + } + +-static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus) ++static void brcmf_sdio_debugfs_create(struct device *dev) + { +- struct brcmf_pub *drvr = bus->sdiodev->bus_if->drvr; ++ struct brcmf_bus *bus_if = dev_get_drvdata(dev); ++ struct brcmf_pub *drvr = bus_if->drvr; ++ struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; ++ struct brcmf_sdio *bus = sdiodev->bus; + struct dentry *dentry = brcmf_debugfs_get_devdir(drvr); + + if (IS_ERR_OR_NULL(dentry)) +@@ -3176,7 +3179,7 @@ static int brcmf_sdio_checkdied(struct b + return 0; + } + +-static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus) ++static void brcmf_sdio_debugfs_create(struct device *dev) + { + } + #endif /* DEBUG */ +@@ -3488,8 +3491,6 @@ static int brcmf_sdio_bus_preinit(struct + if (bus->rxbuf) + bus->rxblen = value; + +- brcmf_sdio_debugfs_create(bus); +- + /* the commands below use the terms tx and rx from + * a device perspective, ie. bus:txglom affects the + * bus transfers from device to host. +@@ -4099,6 +4100,7 @@ static const struct brcmf_bus_ops brcmf_ + .get_ramsize = brcmf_sdio_bus_get_ramsize, + .get_memdump = brcmf_sdio_bus_get_memdump, + .get_fwname = brcmf_sdio_get_fwname, ++ .debugfs_create = brcmf_sdio_debugfs_create + }; + + #define BRCMF_SDIO_FW_CODE 0 diff --git a/package/kernel/mac80211/patches/brcm/349-v5.1-0004-brcmfmac-disable-MBSS-feature-for-bcm4330-device.patch b/package/kernel/mac80211/patches/brcm/349-v5.1-0004-brcmfmac-disable-MBSS-feature-for-bcm4330-device.patch new file mode 100644 index 00000000000000..e6602d79004e31 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/349-v5.1-0004-brcmfmac-disable-MBSS-feature-for-bcm4330-device.patch @@ -0,0 +1,41 @@ +From 92d3b88b1029c46f9bf27302c502dc0e3541805b Mon Sep 17 00:00:00 2001 +From: Arend van Spriel +Date: Thu, 14 Feb 2019 13:43:50 +0100 +Subject: [PATCH] brcmfmac: disable MBSS feature for bcm4330 device + +The MBSS feature was already disabled for bcm43362 as it resulted in a +beacon with BRCM_TEST_SSID regardless user configuration in hostapd. Now +the same has been reported for bcm4330 so disable the feature for this +device as well. + +Reported-by: Russell King +Tested-by: Christopher Martin +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../net/wireless/broadcom/brcm80211/brcmfmac/feature.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +@@ -272,9 +272,15 @@ void brcmf_feat_attach(struct brcmf_pub + BIT(BRCMF_FEAT_WOWL_GTK); + } + } +- /* MBSS does not work for 43362 */ +- if (drvr->bus_if->chip == BRCM_CC_43362_CHIP_ID) ++ /* MBSS does not work for all chips */ ++ switch (drvr->bus_if->chip) { ++ case BRCM_CC_4330_CHIP_ID: ++ case BRCM_CC_43362_CHIP_ID: + ifp->drvr->feat_flags &= ~BIT(BRCMF_FEAT_MBSS); ++ break; ++ default: ++ break; ++ } + brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_RSDB, "rsdb_mode"); + brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_TDLS, "tdls_enable"); + brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MFP, "mfp"); diff --git a/package/kernel/mac80211/patches/brcm/349-v5.1-0005-brcmfmac-check-and-dump-trap-info-during-sdio-probe.patch b/package/kernel/mac80211/patches/brcm/349-v5.1-0005-brcmfmac-check-and-dump-trap-info-during-sdio-probe.patch new file mode 100644 index 00000000000000..c9757db976d777 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/349-v5.1-0005-brcmfmac-check-and-dump-trap-info-during-sdio-probe.patch @@ -0,0 +1,121 @@ +From 4ab2cf03da91785f2c34d79a302e53da06928bc1 Mon Sep 17 00:00:00 2001 +From: Arend van Spriel +Date: Thu, 14 Feb 2019 13:43:51 +0100 +Subject: [PATCH] brcmfmac: check and dump trap info during sdio probe + +When the firmware crashes during the probe sequence we provide little +information on what really failed. This patch checks the sdpcm shared +location and show the trap information if a firmware trap has happened. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/sdio.c | 59 +++++++++++++------ + 1 file changed, 40 insertions(+), 19 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -3010,21 +3010,35 @@ static int brcmf_sdio_trap_info(struct s + if (error < 0) + return error; + +- seq_printf(seq, +- "dongle trap info: type 0x%x @ epc 0x%08x\n" +- " cpsr 0x%08x spsr 0x%08x sp 0x%08x\n" +- " lr 0x%08x pc 0x%08x offset 0x%x\n" +- " r0 0x%08x r1 0x%08x r2 0x%08x r3 0x%08x\n" +- " r4 0x%08x r5 0x%08x r6 0x%08x r7 0x%08x\n", +- le32_to_cpu(tr.type), le32_to_cpu(tr.epc), +- le32_to_cpu(tr.cpsr), le32_to_cpu(tr.spsr), +- le32_to_cpu(tr.r13), le32_to_cpu(tr.r14), +- le32_to_cpu(tr.pc), sh->trap_addr, +- le32_to_cpu(tr.r0), le32_to_cpu(tr.r1), +- le32_to_cpu(tr.r2), le32_to_cpu(tr.r3), +- le32_to_cpu(tr.r4), le32_to_cpu(tr.r5), +- le32_to_cpu(tr.r6), le32_to_cpu(tr.r7)); +- ++ if (seq) ++ seq_printf(seq, ++ "dongle trap info: type 0x%x @ epc 0x%08x\n" ++ " cpsr 0x%08x spsr 0x%08x sp 0x%08x\n" ++ " lr 0x%08x pc 0x%08x offset 0x%x\n" ++ " r0 0x%08x r1 0x%08x r2 0x%08x r3 0x%08x\n" ++ " r4 0x%08x r5 0x%08x r6 0x%08x r7 0x%08x\n", ++ le32_to_cpu(tr.type), le32_to_cpu(tr.epc), ++ le32_to_cpu(tr.cpsr), le32_to_cpu(tr.spsr), ++ le32_to_cpu(tr.r13), le32_to_cpu(tr.r14), ++ le32_to_cpu(tr.pc), sh->trap_addr, ++ le32_to_cpu(tr.r0), le32_to_cpu(tr.r1), ++ le32_to_cpu(tr.r2), le32_to_cpu(tr.r3), ++ le32_to_cpu(tr.r4), le32_to_cpu(tr.r5), ++ le32_to_cpu(tr.r6), le32_to_cpu(tr.r7)); ++ else ++ pr_debug("dongle trap info: type 0x%x @ epc 0x%08x\n" ++ " cpsr 0x%08x spsr 0x%08x sp 0x%08x\n" ++ " lr 0x%08x pc 0x%08x offset 0x%x\n" ++ " r0 0x%08x r1 0x%08x r2 0x%08x r3 0x%08x\n" ++ " r4 0x%08x r5 0x%08x r6 0x%08x r7 0x%08x\n", ++ le32_to_cpu(tr.type), le32_to_cpu(tr.epc), ++ le32_to_cpu(tr.cpsr), le32_to_cpu(tr.spsr), ++ le32_to_cpu(tr.r13), le32_to_cpu(tr.r14), ++ le32_to_cpu(tr.pc), sh->trap_addr, ++ le32_to_cpu(tr.r0), le32_to_cpu(tr.r1), ++ le32_to_cpu(tr.r2), le32_to_cpu(tr.r3), ++ le32_to_cpu(tr.r4), le32_to_cpu(tr.r5), ++ le32_to_cpu(tr.r6), le32_to_cpu(tr.r7)); + return 0; + } + +@@ -3078,8 +3092,10 @@ static int brcmf_sdio_checkdied(struct b + else if (sh.flags & SDPCM_SHARED_ASSERT) + brcmf_err("assertion in dongle\n"); + +- if (sh.flags & SDPCM_SHARED_TRAP) ++ if (sh.flags & SDPCM_SHARED_TRAP) { + brcmf_err("firmware trap in dongle\n"); ++ brcmf_sdio_trap_info(NULL, bus, &sh); ++ } + + return 0; + } +@@ -4210,7 +4226,7 @@ static void brcmf_sdio_firmware_callback + } else { + /* Disable F2 again */ + sdio_disable_func(sdiod->func2); +- goto release; ++ goto checkdied; + } + + if (brcmf_chip_sr_capable(bus->ci)) { +@@ -4231,8 +4247,10 @@ static void brcmf_sdio_firmware_callback + } + + /* If we didn't come up, turn off backplane clock */ +- if (err != 0) ++ if (err != 0) { + brcmf_sdio_clkctl(bus, CLK_NONE, false); ++ goto checkdied; ++ } + + sdio_release_host(sdiod->func1); + +@@ -4246,12 +4264,15 @@ static void brcmf_sdio_firmware_callback + err = brcmf_attach(sdiod->dev, sdiod->settings); + if (err != 0) { + brcmf_err("brcmf_attach failed\n"); +- goto fail; ++ sdio_claim_host(sdiod->func1); ++ goto checkdied; + } + + /* ready */ + return; + ++checkdied: ++ brcmf_sdio_checkdied(bus); + release: + sdio_release_host(sdiod->func1); + fail: diff --git a/package/kernel/mac80211/patches/brcm/349-v5.1-0006-brcmfmac-use-chipname-in-brcmf_fw_alloc_request-for-.patch b/package/kernel/mac80211/patches/brcm/349-v5.1-0006-brcmfmac-use-chipname-in-brcmf_fw_alloc_request-for-.patch new file mode 100644 index 00000000000000..23180c72361334 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/349-v5.1-0006-brcmfmac-use-chipname-in-brcmf_fw_alloc_request-for-.patch @@ -0,0 +1,42 @@ +From a250c91c1762e85c736e67cb4a9a95ebae72e62d Mon Sep 17 00:00:00 2001 +From: Arend van Spriel +Date: Thu, 14 Feb 2019 13:43:52 +0100 +Subject: [PATCH] brcmfmac: use chipname in brcmf_fw_alloc_request() for error + path as well + +The local variable chipname is string representation of chip id and revision +which is printed in the good flow of brcmf_fw_alloc_request(). Also use it +for the error path, ie. for unknown/unsupported devices. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -719,8 +719,10 @@ brcmf_fw_alloc_request(u32 chip, u32 chi + break; + } + ++ brcmf_chip_name(chip, chiprev, chipname, sizeof(chipname)); ++ + if (i == table_size) { +- brcmf_err("Unknown chipid %d [%d]\n", chip, chiprev); ++ brcmf_err("Unknown chip %s\n", chipname); + return NULL; + } + +@@ -729,8 +731,6 @@ brcmf_fw_alloc_request(u32 chip, u32 chi + if (!fwreq) + return NULL; + +- brcmf_chip_name(chip, chiprev, chipname, sizeof(chipname)); +- + brcmf_info("using %s for chip %s\n", + mapping_table[i].fw_base, chipname); + diff --git a/package/kernel/mac80211/patches/brcm/350-v5.1-brcmfmac-print-firmware-reported-ring-status-errors.patch b/package/kernel/mac80211/patches/brcm/350-v5.1-brcmfmac-print-firmware-reported-ring-status-errors.patch new file mode 100644 index 00000000000000..b41b9cebf40aa7 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/350-v5.1-brcmfmac-print-firmware-reported-ring-status-errors.patch @@ -0,0 +1,67 @@ +From c988b78244df8216902e20de536434e2f474a37e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 8 Feb 2019 15:24:39 +0100 +Subject: [PATCH] brcmfmac: print firmware reported ring status errors +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Firmware is capable of reporting ring status. It's used e.g. to signal +some problem with a specific ring setup. This patch adds support for +printing ring & error number which may be useful for debugging setup +issues. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/msgbuf.c | 25 +++++++++++++++++++ + 1 file changed, 25 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +@@ -134,6 +134,14 @@ struct msgbuf_completion_hdr { + __le16 flow_ring_id; + }; + ++/* Data struct for the MSGBUF_TYPE_RING_STATUS */ ++struct msgbuf_ring_status { ++ struct msgbuf_common_hdr msg; ++ struct msgbuf_completion_hdr compl_hdr; ++ __le16 write_idx; ++ __le32 rsvd0[5]; ++}; ++ + struct msgbuf_rx_event { + struct msgbuf_common_hdr msg; + struct msgbuf_completion_hdr compl_hdr; +@@ -1180,6 +1188,19 @@ brcmf_msgbuf_process_rx_complete(struct + brcmf_netif_rx(ifp, skb); + } + ++static void brcmf_msgbuf_process_ring_status(struct brcmf_msgbuf *msgbuf, ++ void *buf) ++{ ++ struct msgbuf_ring_status *ring_status = buf; ++ int err; ++ ++ err = le16_to_cpu(ring_status->compl_hdr.status); ++ if (err) { ++ int ring = le16_to_cpu(ring_status->compl_hdr.flow_ring_id); ++ ++ brcmf_err("Firmware reported ring %d error: %d\n", ring, err); ++ } ++} + + static void + brcmf_msgbuf_process_flow_ring_create_response(struct brcmf_msgbuf *msgbuf, +@@ -1241,6 +1262,10 @@ static void brcmf_msgbuf_process_msgtype + + msg = (struct msgbuf_common_hdr *)buf; + switch (msg->msgtype) { ++ case MSGBUF_TYPE_RING_STATUS: ++ brcmf_dbg(MSGBUF, "MSGBUF_TYPE_RING_STATUS\n"); ++ brcmf_msgbuf_process_ring_status(msgbuf, buf); ++ break; + case MSGBUF_TYPE_FLOW_RING_CREATE_CMPLT: + brcmf_dbg(MSGBUF, "MSGBUF_TYPE_FLOW_RING_CREATE_CMPLT\n"); + brcmf_msgbuf_process_flow_ring_create_response(msgbuf, buf); diff --git a/package/kernel/mac80211/patches/brcm/351-v5.1-0001-brcmfmac-improve-code-handling-bandwidth-of-firmware.patch b/package/kernel/mac80211/patches/brcm/351-v5.1-0001-brcmfmac-improve-code-handling-bandwidth-of-firmware.patch new file mode 100644 index 00000000000000..b28ff817eaf2e2 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/351-v5.1-0001-brcmfmac-improve-code-handling-bandwidth-of-firmware.patch @@ -0,0 +1,42 @@ +From f4e183293b871c96c0220dcc549d5ca4c72628ad Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 11 Feb 2019 23:04:53 +0100 +Subject: [PATCH] brcmfmac: improve code handling bandwidth of firmware + reported channels +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +1) Use switch to simplify/improve the code & avoid some duplication +2) Add warning for unsupported values + +Signed-off-by: Rafał Miłecki +Signed-off-by: Kalle Valo +--- + .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -6047,11 +6047,18 @@ static int brcmf_construct_chaninfo(stru + /* assuming the chanspecs order is HT20, + * HT40 upper, HT40 lower, and VHT80. + */ +- if (ch.bw == BRCMU_CHAN_BW_80) { ++ switch (ch.bw) { ++ case BRCMU_CHAN_BW_80: + channel->flags &= ~IEEE80211_CHAN_NO_80MHZ; +- } else if (ch.bw == BRCMU_CHAN_BW_40) { ++ break; ++ case BRCMU_CHAN_BW_40: + brcmf_update_bw40_channel_flag(channel, &ch); +- } else { ++ break; ++ default: ++ wiphy_warn(wiphy, "Firmware reported unsupported bandwidth %d\n", ++ ch.bw); ++ /* fall through */ ++ case BRCMU_CHAN_BW_20: + /* enable the channel and disable other bandwidths + * for now as mentioned order assure they are enabled + * for subsequent chanspecs. diff --git a/package/kernel/mac80211/patches/brcm/351-v5.1-0002-brcmfmac-support-firmware-reporting-160-MHz-channels.patch b/package/kernel/mac80211/patches/brcm/351-v5.1-0002-brcmfmac-support-firmware-reporting-160-MHz-channels.patch new file mode 100644 index 00000000000000..3d92f80b3eb63a --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/351-v5.1-0002-brcmfmac-support-firmware-reporting-160-MHz-channels.patch @@ -0,0 +1,30 @@ +From 30519cbe339a45bd11a57ca8ece07f4f6a1cda2e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 11 Feb 2019 23:04:54 +0100 +Subject: [PATCH] brcmfmac: support firmware reporting 160 MHz channels +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +So far 160 MHz channels were treated as 20 MHz ones which was breaking +support for 40/80 MHz due to the brcmf_construct_chaninfo() logic and +its assumptions. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -6048,6 +6048,9 @@ static int brcmf_construct_chaninfo(stru + * HT40 upper, HT40 lower, and VHT80. + */ + switch (ch.bw) { ++ case BRCMU_CHAN_BW_160: ++ channel->flags &= ~IEEE80211_CHAN_NO_160MHZ; ++ break; + case BRCMU_CHAN_BW_80: + channel->flags &= ~IEEE80211_CHAN_NO_80MHZ; + break; diff --git a/package/kernel/mac80211/patches/brcm/352-v5.1-brcmfmac-rework-bphy_err-to-take-struct-brcmf_pub-ar.patch b/package/kernel/mac80211/patches/brcm/352-v5.1-brcmfmac-rework-bphy_err-to-take-struct-brcmf_pub-ar.patch new file mode 100644 index 00000000000000..bab3b3a20429a2 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/352-v5.1-brcmfmac-rework-bphy_err-to-take-struct-brcmf_pub-ar.patch @@ -0,0 +1,2290 @@ +From 16e646768396339b3d354985b99bcd3f1f195a7d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 15 Feb 2019 15:45:54 +0100 +Subject: [PATCH] brcmfmac: rework bphy_err() to take struct brcmf_pub argument +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This macro will be used in more places not just the cfg80211.c. It makes +sense to pass some common struct to it as "struct wiphy" is mostly +referenced in cfg80211 code only. + +A very common one (used above the bus abstraction layer) is struct +brcmf_pub. Many functions already keep reference to it which will make +using bphy_err() simpler. It should also allow extending that macro's +logic if it's ever needed. + +This improves code recently added in the commit 3ef005b82e2a ("brcmfmac: +add bphy_err() and use it in the cfg80211.c"). + +Signed-off-by: Rafał Miłecki +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 510 ++++++++++-------- + .../broadcom/brcm80211/brcmfmac/debug.h | 4 +- + 2 files changed, 281 insertions(+), 233 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -457,7 +457,7 @@ static void convert_key_from_CPU(struct + static int + send_key_to_dongle(struct brcmf_if *ifp, struct brcmf_wsec_key *key) + { +- struct wiphy *wiphy = ifp->drvr->wiphy; ++ struct brcmf_pub *drvr = ifp->drvr; + int err; + struct brcmf_wsec_key_le key_le; + +@@ -469,7 +469,7 @@ send_key_to_dongle(struct brcmf_if *ifp, + sizeof(key_le)); + + if (err) +- bphy_err(wiphy, "wsec_key error (%d)\n", err); ++ bphy_err(drvr, "wsec_key error (%d)\n", err); + return err; + } + +@@ -509,7 +509,7 @@ static int brcmf_get_first_free_bsscfgid + + static int brcmf_cfg80211_request_ap_if(struct brcmf_if *ifp) + { +- struct wiphy *wiphy = ifp->drvr->wiphy; ++ struct brcmf_pub *drvr = ifp->drvr; + struct brcmf_mbss_ssid_le mbss_ssid_le; + int bsscfgidx; + int err; +@@ -526,7 +526,7 @@ static int brcmf_cfg80211_request_ap_if( + err = brcmf_fil_bsscfg_data_set(ifp, "bsscfg:ssid", &mbss_ssid_le, + sizeof(mbss_ssid_le)); + if (err < 0) +- bphy_err(wiphy, "setting ssid failed %d\n", err); ++ bphy_err(drvr, "setting ssid failed %d\n", err); + + return err; + } +@@ -544,6 +544,7 @@ struct wireless_dev *brcmf_ap_add_vif(st + { + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_cfg80211_vif *vif; + int err; + +@@ -569,7 +570,7 @@ struct wireless_dev *brcmf_ap_add_vif(st + BRCMF_VIF_EVENT_TIMEOUT); + brcmf_cfg80211_arm_vif_event(cfg, NULL); + if (!err) { +- bphy_err(wiphy, "timeout occurred\n"); ++ bphy_err(drvr, "timeout occurred\n"); + err = -EIO; + goto fail; + } +@@ -577,7 +578,7 @@ struct wireless_dev *brcmf_ap_add_vif(st + /* interface created in firmware */ + ifp = vif->ifp; + if (!ifp) { +- bphy_err(wiphy, "no if pointer provided\n"); ++ bphy_err(drvr, "no if pointer provided\n"); + err = -ENOENT; + goto fail; + } +@@ -585,7 +586,7 @@ struct wireless_dev *brcmf_ap_add_vif(st + strncpy(ifp->ndev->name, name, sizeof(ifp->ndev->name) - 1); + err = brcmf_net_attach(ifp, true); + if (err) { +- bphy_err(wiphy, "Registering netdevice failed\n"); ++ bphy_err(drvr, "Registering netdevice failed\n"); + free_netdev(ifp->ndev); + goto fail; + } +@@ -616,13 +617,15 @@ static struct wireless_dev *brcmf_cfg802 + enum nl80211_iftype type, + struct vif_params *params) + { ++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); ++ struct brcmf_pub *drvr = cfg->pub; + struct wireless_dev *wdev; + int err; + + brcmf_dbg(TRACE, "enter: %s type %d\n", name, type); + err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type); + if (err) { +- bphy_err(wiphy, "iface validation failed: err=%d\n", err); ++ bphy_err(drvr, "iface validation failed: err=%d\n", err); + return ERR_PTR(err); + } + switch (type) { +@@ -647,7 +650,7 @@ static struct wireless_dev *brcmf_cfg802 + } + + if (IS_ERR(wdev)) +- bphy_err(wiphy, "add iface %s type %d failed: err=%d\n", name, ++ bphy_err(drvr, "add iface %s type %d failed: err=%d\n", name, + type, (int)PTR_ERR(wdev)); + else + brcmf_cfg80211_update_proto_addr_mode(wdev); +@@ -663,13 +666,13 @@ static void brcmf_scan_config_mpc(struct + + void brcmf_set_mpc(struct brcmf_if *ifp, int mpc) + { +- struct wiphy *wiphy = ifp->drvr->wiphy; ++ struct brcmf_pub *drvr = ifp->drvr; + s32 err = 0; + + if (check_vif_up(ifp->vif)) { + err = brcmf_fil_iovar_int_set(ifp, "mpc", mpc); + if (err) { +- bphy_err(wiphy, "fail to set mpc\n"); ++ bphy_err(drvr, "fail to set mpc\n"); + return; + } + brcmf_dbg(INFO, "MPC : %d\n", mpc); +@@ -680,7 +683,7 @@ s32 brcmf_notify_escan_complete(struct b + struct brcmf_if *ifp, bool aborted, + bool fw_abort) + { +- struct wiphy *wiphy = cfg_to_wiphy(cfg); ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_scan_params_le params_le; + struct cfg80211_scan_request *scan_request; + u64 reqid; +@@ -715,7 +718,7 @@ s32 brcmf_notify_escan_complete(struct b + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN, + ¶ms_le, sizeof(params_le)); + if (err) +- bphy_err(wiphy, "Scan abort failed\n"); ++ bphy_err(drvr, "Scan abort failed\n"); + } + + brcmf_scan_config_mpc(ifp, 1); +@@ -760,6 +763,7 @@ static int brcmf_cfg80211_del_ap_iface(s + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct net_device *ndev = wdev->netdev; + struct brcmf_if *ifp = netdev_priv(ndev); ++ struct brcmf_pub *drvr = cfg->pub; + int ret; + int err; + +@@ -767,7 +771,7 @@ static int brcmf_cfg80211_del_ap_iface(s + + err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0); + if (err) { +- bphy_err(wiphy, "interface_remove failed %d\n", err); ++ bphy_err(drvr, "interface_remove failed %d\n", err); + goto err_unarm; + } + +@@ -775,7 +779,7 @@ static int brcmf_cfg80211_del_ap_iface(s + ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL, + BRCMF_VIF_EVENT_TIMEOUT); + if (!ret) { +- bphy_err(wiphy, "timeout occurred\n"); ++ bphy_err(drvr, "timeout occurred\n"); + err = -EIO; + goto err_unarm; + } +@@ -838,6 +842,7 @@ brcmf_cfg80211_change_iface(struct wiphy + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct brcmf_if *ifp = netdev_priv(ndev); + struct brcmf_cfg80211_vif *vif = ifp->vif; ++ struct brcmf_pub *drvr = cfg->pub; + s32 infra = 0; + s32 ap = 0; + s32 err = 0; +@@ -877,13 +882,13 @@ brcmf_cfg80211_change_iface(struct wiphy + } + err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type); + if (err) { +- bphy_err(wiphy, "iface validation failed: err=%d\n", err); ++ bphy_err(drvr, "iface validation failed: err=%d\n", err); + return err; + } + switch (type) { + case NL80211_IFTYPE_MONITOR: + case NL80211_IFTYPE_WDS: +- bphy_err(wiphy, "type (%d) : currently we do not support this type\n", ++ bphy_err(drvr, "type (%d) : currently we do not support this type\n", + type); + return -EOPNOTSUPP; + case NL80211_IFTYPE_ADHOC: +@@ -912,7 +917,7 @@ brcmf_cfg80211_change_iface(struct wiphy + } else { + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, infra); + if (err) { +- bphy_err(wiphy, "WLC_SET_INFRA error (%d)\n", err); ++ bphy_err(drvr, "WLC_SET_INFRA error (%d)\n", err); + err = -EAGAIN; + goto done; + } +@@ -1003,7 +1008,7 @@ static s32 + brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp, + struct cfg80211_scan_request *request) + { +- struct wiphy *wiphy = cfg_to_wiphy(cfg); ++ struct brcmf_pub *drvr = cfg->pub; + s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE + + offsetof(struct brcmf_escan_params_le, params_le); + struct brcmf_escan_params_le *params; +@@ -1035,7 +1040,7 @@ brcmf_run_escan(struct brcmf_cfg80211_in + if (err == -EBUSY) + brcmf_dbg(INFO, "system busy : escan canceled\n"); + else +- bphy_err(wiphy, "error (%d)\n", err); ++ bphy_err(drvr, "error (%d)\n", err); + } + + kfree(params); +@@ -1072,6 +1077,7 @@ static s32 + brcmf_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) + { + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_cfg80211_vif *vif; + s32 err = 0; + +@@ -1081,22 +1087,22 @@ brcmf_cfg80211_scan(struct wiphy *wiphy, + return -EIO; + + if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { +- bphy_err(wiphy, "Scanning already: status (%lu)\n", ++ bphy_err(drvr, "Scanning already: status (%lu)\n", + cfg->scan_status); + return -EAGAIN; + } + if (test_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status)) { +- bphy_err(wiphy, "Scanning being aborted: status (%lu)\n", ++ bphy_err(drvr, "Scanning being aborted: status (%lu)\n", + cfg->scan_status); + return -EAGAIN; + } + if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) { +- bphy_err(wiphy, "Scanning suppressed: status (%lu)\n", ++ bphy_err(drvr, "Scanning suppressed: status (%lu)\n", + cfg->scan_status); + return -EAGAIN; + } + if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state)) { +- bphy_err(wiphy, "Connecting: status (%lu)\n", vif->sme_state); ++ bphy_err(drvr, "Connecting: status (%lu)\n", vif->sme_state); + return -EAGAIN; + } + +@@ -1130,7 +1136,7 @@ brcmf_cfg80211_scan(struct wiphy *wiphy, + return 0; + + scan_out: +- bphy_err(wiphy, "scan error (%d)\n", err); ++ bphy_err(drvr, "scan error (%d)\n", err); + clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); + cfg->scan_request = NULL; + return err; +@@ -1139,12 +1145,12 @@ scan_out: + static s32 brcmf_set_rts(struct net_device *ndev, u32 rts_threshold) + { + struct brcmf_if *ifp = netdev_priv(ndev); +- struct wiphy *wiphy = ifp->drvr->wiphy; ++ struct brcmf_pub *drvr = ifp->drvr; + s32 err = 0; + + err = brcmf_fil_iovar_int_set(ifp, "rtsthresh", rts_threshold); + if (err) +- bphy_err(wiphy, "Error (%d)\n", err); ++ bphy_err(drvr, "Error (%d)\n", err); + + return err; + } +@@ -1152,13 +1158,13 @@ static s32 brcmf_set_rts(struct net_devi + static s32 brcmf_set_frag(struct net_device *ndev, u32 frag_threshold) + { + struct brcmf_if *ifp = netdev_priv(ndev); +- struct wiphy *wiphy = ifp->drvr->wiphy; ++ struct brcmf_pub *drvr = ifp->drvr; + s32 err = 0; + + err = brcmf_fil_iovar_int_set(ifp, "fragthresh", + frag_threshold); + if (err) +- bphy_err(wiphy, "Error (%d)\n", err); ++ bphy_err(drvr, "Error (%d)\n", err); + + return err; + } +@@ -1166,13 +1172,13 @@ static s32 brcmf_set_frag(struct net_dev + static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l) + { + struct brcmf_if *ifp = netdev_priv(ndev); +- struct wiphy *wiphy = ifp->drvr->wiphy; ++ struct brcmf_pub *drvr = ifp->drvr; + s32 err = 0; + u32 cmd = (l ? BRCMF_C_SET_LRL : BRCMF_C_SET_SRL); + + err = brcmf_fil_cmd_int_set(ifp, cmd, retry); + if (err) { +- bphy_err(wiphy, "cmd (%d) , error (%d)\n", cmd, err); ++ bphy_err(drvr, "cmd (%d) , error (%d)\n", cmd, err); + return err; + } + return err; +@@ -1248,7 +1254,7 @@ static u16 brcmf_map_fw_linkdown_reason( + + static int brcmf_set_pmk(struct brcmf_if *ifp, const u8 *pmk_data, u16 pmk_len) + { +- struct wiphy *wiphy = ifp->drvr->wiphy; ++ struct brcmf_pub *drvr = ifp->drvr; + struct brcmf_wsec_pmk_le pmk; + int i, err; + +@@ -1262,7 +1268,7 @@ static int brcmf_set_pmk(struct brcmf_if + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_WSEC_PMK, + &pmk, sizeof(pmk)); + if (err < 0) +- bphy_err(wiphy, "failed to change PSK in firmware (len=%u)\n", ++ bphy_err(drvr, "failed to change PSK in firmware (len=%u)\n", + pmk_len); + + return err; +@@ -1271,7 +1277,7 @@ static int brcmf_set_pmk(struct brcmf_if + static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason) + { + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy); +- struct wiphy *wiphy = cfg_to_wiphy(cfg); ++ struct brcmf_pub *drvr = cfg->pub; + s32 err = 0; + + brcmf_dbg(TRACE, "Enter\n"); +@@ -1281,7 +1287,7 @@ static void brcmf_link_down(struct brcmf + err = brcmf_fil_cmd_data_set(vif->ifp, + BRCMF_C_DISASSOC, NULL, 0); + if (err) { +- bphy_err(wiphy, "WLC_DISASSOC failed (%d)\n", err); ++ bphy_err(drvr, "WLC_DISASSOC failed (%d)\n", err); + } + if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) || + (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT)) +@@ -1305,6 +1311,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct brcmf_if *ifp = netdev_priv(ndev); + struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_join_params join_params; + size_t join_params_size = 0; + s32 err = 0; +@@ -1369,7 +1376,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w + + err = brcmf_fil_iovar_int_set(ifp, "wsec", wsec); + if (err) { +- bphy_err(wiphy, "wsec failed (%d)\n", err); ++ bphy_err(drvr, "wsec failed (%d)\n", err); + goto done; + } + +@@ -1381,7 +1388,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w + + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, bcnprd); + if (err) { +- bphy_err(wiphy, "WLC_SET_BCNPRD failed (%d)\n", err); ++ bphy_err(drvr, "WLC_SET_BCNPRD failed (%d)\n", err); + goto done; + } + +@@ -1426,7 +1433,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_CHANNEL, + target_channel); + if (err) { +- bphy_err(wiphy, "WLC_SET_CHANNEL failed (%d)\n", err); ++ bphy_err(drvr, "WLC_SET_CHANNEL failed (%d)\n", err); + goto done; + } + } else +@@ -1438,7 +1445,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, + &join_params, join_params_size); + if (err) { +- bphy_err(wiphy, "WLC_SET_SSID failed (%d)\n", err); ++ bphy_err(drvr, "WLC_SET_SSID failed (%d)\n", err); + goto done; + } + +@@ -1475,8 +1482,8 @@ static s32 brcmf_set_wpa_version(struct + struct cfg80211_connect_params *sme) + { + struct brcmf_if *ifp = netdev_priv(ndev); +- struct wiphy *wiphy = ifp->drvr->wiphy; + struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev); ++ struct brcmf_pub *drvr = ifp->drvr; + struct brcmf_cfg80211_security *sec; + s32 val = 0; + s32 err = 0; +@@ -1490,7 +1497,7 @@ static s32 brcmf_set_wpa_version(struct + brcmf_dbg(CONN, "setting wpa_auth to 0x%0x\n", val); + err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", val); + if (err) { +- bphy_err(wiphy, "set wpa_auth failed (%d)\n", err); ++ bphy_err(drvr, "set wpa_auth failed (%d)\n", err); + return err; + } + sec = &profile->sec; +@@ -1502,8 +1509,8 @@ static s32 brcmf_set_auth_type(struct ne + struct cfg80211_connect_params *sme) + { + struct brcmf_if *ifp = netdev_priv(ndev); +- struct wiphy *wiphy = ifp->drvr->wiphy; + struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev); ++ struct brcmf_pub *drvr = ifp->drvr; + struct brcmf_cfg80211_security *sec; + s32 val = 0; + s32 err = 0; +@@ -1525,7 +1532,7 @@ static s32 brcmf_set_auth_type(struct ne + + err = brcmf_fil_bsscfg_int_set(ifp, "auth", val); + if (err) { +- bphy_err(wiphy, "set auth failed (%d)\n", err); ++ bphy_err(drvr, "set auth failed (%d)\n", err); + return err; + } + sec = &profile->sec; +@@ -1538,8 +1545,8 @@ brcmf_set_wsec_mode(struct net_device *n + struct cfg80211_connect_params *sme) + { + struct brcmf_if *ifp = netdev_priv(ndev); +- struct wiphy *wiphy = ifp->drvr->wiphy; + struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev); ++ struct brcmf_pub *drvr = ifp->drvr; + struct brcmf_cfg80211_security *sec; + s32 pval = 0; + s32 gval = 0; +@@ -1562,7 +1569,7 @@ brcmf_set_wsec_mode(struct net_device *n + pval = AES_ENABLED; + break; + default: +- bphy_err(wiphy, "invalid cipher pairwise (%d)\n", ++ bphy_err(drvr, "invalid cipher pairwise (%d)\n", + sme->crypto.ciphers_pairwise[0]); + return -EINVAL; + } +@@ -1583,7 +1590,7 @@ brcmf_set_wsec_mode(struct net_device *n + gval = AES_ENABLED; + break; + default: +- bphy_err(wiphy, "invalid cipher group (%d)\n", ++ bphy_err(drvr, "invalid cipher group (%d)\n", + sme->crypto.cipher_group); + return -EINVAL; + } +@@ -1599,7 +1606,7 @@ brcmf_set_wsec_mode(struct net_device *n + wsec = pval | gval; + err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec); + if (err) { +- bphy_err(wiphy, "error (%d)\n", err); ++ bphy_err(drvr, "error (%d)\n", err); + return err; + } + +@@ -1614,8 +1621,8 @@ static s32 + brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme) + { + struct brcmf_if *ifp = netdev_priv(ndev); +- struct wiphy *wiphy = ifp->drvr->wiphy; + struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; ++ struct brcmf_pub *drvr = ifp->drvr; + s32 val; + s32 err; + const struct brcmf_tlv *rsn_ie; +@@ -1633,7 +1640,7 @@ brcmf_set_key_mgmt(struct net_device *nd + + err = brcmf_fil_bsscfg_int_get(netdev_priv(ndev), "wpa_auth", &val); + if (err) { +- bphy_err(wiphy, "could not get wpa_auth (%d)\n", err); ++ bphy_err(drvr, "could not get wpa_auth (%d)\n", err); + return err; + } + if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) { +@@ -1647,7 +1654,7 @@ brcmf_set_key_mgmt(struct net_device *nd + val = WPA_AUTH_PSK; + break; + default: +- bphy_err(wiphy, "invalid cipher group (%d)\n", ++ bphy_err(drvr, "invalid cipher group (%d)\n", + sme->crypto.cipher_group); + return -EINVAL; + } +@@ -1670,7 +1677,7 @@ brcmf_set_key_mgmt(struct net_device *nd + val = WPA2_AUTH_PSK; + break; + default: +- bphy_err(wiphy, "invalid cipher group (%d)\n", ++ bphy_err(drvr, "invalid cipher group (%d)\n", + sme->crypto.cipher_group); + return -EINVAL; + } +@@ -1717,7 +1724,7 @@ skip_mfp_config: + brcmf_dbg(CONN, "setting wpa_auth to %d\n", val); + err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val); + if (err) { +- bphy_err(wiphy, "could not set wpa_auth (%d)\n", err); ++ bphy_err(drvr, "could not set wpa_auth (%d)\n", err); + return err; + } + +@@ -1729,7 +1736,7 @@ brcmf_set_sharedkey(struct net_device *n + struct cfg80211_connect_params *sme) + { + struct brcmf_if *ifp = netdev_priv(ndev); +- struct wiphy *wiphy = ifp->drvr->wiphy; ++ struct brcmf_pub *drvr = ifp->drvr; + struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev); + struct brcmf_cfg80211_security *sec; + struct brcmf_wsec_key key; +@@ -1756,7 +1763,7 @@ brcmf_set_sharedkey(struct net_device *n + key.len = (u32) sme->key_len; + key.index = (u32) sme->key_idx; + if (key.len > sizeof(key.data)) { +- bphy_err(wiphy, "Too long key length (%u)\n", key.len); ++ bphy_err(drvr, "Too long key length (%u)\n", key.len); + return -EINVAL; + } + memcpy(key.data, sme->key, key.len); +@@ -1769,7 +1776,7 @@ brcmf_set_sharedkey(struct net_device *n + key.algo = CRYPTO_ALGO_WEP128; + break; + default: +- bphy_err(wiphy, "Invalid algorithm (%d)\n", ++ bphy_err(drvr, "Invalid algorithm (%d)\n", + sme->crypto.ciphers_pairwise[0]); + return -EINVAL; + } +@@ -1786,7 +1793,7 @@ brcmf_set_sharedkey(struct net_device *n + val = WL_AUTH_SHARED_KEY; /* shared key */ + err = brcmf_fil_bsscfg_int_set(ifp, "auth", val); + if (err) +- bphy_err(wiphy, "set auth failed (%d)\n", err); ++ bphy_err(drvr, "set auth failed (%d)\n", err); + } + return err; + } +@@ -1806,7 +1813,7 @@ enum nl80211_auth_type brcmf_war_auth_ty + static void brcmf_set_join_pref(struct brcmf_if *ifp, + struct cfg80211_bss_selection *bss_select) + { +- struct wiphy *wiphy = ifp->drvr->wiphy; ++ struct brcmf_pub *drvr = ifp->drvr; + struct brcmf_join_pref_params join_pref_params[2]; + enum nl80211_band band; + int err, i = 0; +@@ -1845,7 +1852,7 @@ static void brcmf_set_join_pref(struct b + err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params, + sizeof(join_pref_params)); + if (err) +- bphy_err(wiphy, "Set join_pref error (%d)\n", err); ++ bphy_err(drvr, "Set join_pref error (%d)\n", err); + } + + static s32 +@@ -1856,6 +1863,7 @@ brcmf_cfg80211_connect(struct wiphy *wip + struct brcmf_if *ifp = netdev_priv(ndev); + struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; + struct ieee80211_channel *chan = sme->channel; ++ struct brcmf_pub *drvr = ifp->drvr; + struct brcmf_join_params join_params; + size_t join_params_size; + const struct brcmf_tlv *rsn_ie; +@@ -1872,7 +1880,7 @@ brcmf_cfg80211_connect(struct wiphy *wip + return -EIO; + + if (!sme->ssid) { +- bphy_err(wiphy, "Invalid ssid\n"); ++ bphy_err(drvr, "Invalid ssid\n"); + return -EOPNOTSUPP; + } + +@@ -1901,7 +1909,7 @@ brcmf_cfg80211_connect(struct wiphy *wip + err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG, + sme->ie, sme->ie_len); + if (err) +- bphy_err(wiphy, "Set Assoc REQ IE Failed\n"); ++ bphy_err(drvr, "Set Assoc REQ IE Failed\n"); + else + brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n"); + +@@ -1922,32 +1930,32 @@ brcmf_cfg80211_connect(struct wiphy *wip + + err = brcmf_set_wpa_version(ndev, sme); + if (err) { +- bphy_err(wiphy, "wl_set_wpa_version failed (%d)\n", err); ++ bphy_err(drvr, "wl_set_wpa_version failed (%d)\n", err); + goto done; + } + + sme->auth_type = brcmf_war_auth_type(ifp, sme->auth_type); + err = brcmf_set_auth_type(ndev, sme); + if (err) { +- bphy_err(wiphy, "wl_set_auth_type failed (%d)\n", err); ++ bphy_err(drvr, "wl_set_auth_type failed (%d)\n", err); + goto done; + } + + err = brcmf_set_wsec_mode(ndev, sme); + if (err) { +- bphy_err(wiphy, "wl_set_set_cipher failed (%d)\n", err); ++ bphy_err(drvr, "wl_set_set_cipher failed (%d)\n", err); + goto done; + } + + err = brcmf_set_key_mgmt(ndev, sme); + if (err) { +- bphy_err(wiphy, "wl_set_key_mgmt failed (%d)\n", err); ++ bphy_err(drvr, "wl_set_key_mgmt failed (%d)\n", err); + goto done; + } + + err = brcmf_set_sharedkey(ndev, sme); + if (err) { +- bphy_err(wiphy, "brcmf_set_sharedkey failed (%d)\n", err); ++ bphy_err(drvr, "brcmf_set_sharedkey failed (%d)\n", err); + goto done; + } + +@@ -1964,7 +1972,7 @@ brcmf_cfg80211_connect(struct wiphy *wip + /* enable firmware supplicant for this interface */ + err = brcmf_fil_iovar_int_set(ifp, "sup_wpa", 1); + if (err < 0) { +- bphy_err(wiphy, "failed to enable fw supplicant\n"); ++ bphy_err(drvr, "failed to enable fw supplicant\n"); + goto done; + } + } +@@ -2059,7 +2067,7 @@ brcmf_cfg80211_connect(struct wiphy *wip + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, + &join_params, join_params_size); + if (err) +- bphy_err(wiphy, "BRCMF_C_SET_SSID failed (%d)\n", err); ++ bphy_err(drvr, "BRCMF_C_SET_SSID failed (%d)\n", err); + + done: + if (err) +@@ -2072,8 +2080,10 @@ static s32 + brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev, + u16 reason_code) + { ++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct brcmf_if *ifp = netdev_priv(ndev); + struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_scb_val_le scbval; + s32 err = 0; + +@@ -2090,7 +2100,7 @@ brcmf_cfg80211_disconnect(struct wiphy * + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_DISASSOC, + &scbval, sizeof(scbval)); + if (err) +- bphy_err(wiphy, "error (%d)\n", err); ++ bphy_err(drvr, "error (%d)\n", err); + + brcmf_dbg(TRACE, "Exit\n"); + return err; +@@ -2103,6 +2113,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct net_device *ndev = cfg_to_ndev(cfg); + struct brcmf_if *ifp = netdev_priv(ndev); ++ struct brcmf_pub *drvr = cfg->pub; + s32 err; + s32 disable; + u32 qdbm = 127; +@@ -2117,7 +2128,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy + case NL80211_TX_POWER_LIMITED: + case NL80211_TX_POWER_FIXED: + if (mbm < 0) { +- bphy_err(wiphy, "TX_POWER_FIXED - dbm is negative\n"); ++ bphy_err(drvr, "TX_POWER_FIXED - dbm is negative\n"); + err = -EINVAL; + goto done; + } +@@ -2127,7 +2138,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy + qdbm |= WL_TXPWR_OVERRIDE; + break; + default: +- bphy_err(wiphy, "Unsupported type %d\n", type); ++ bphy_err(drvr, "Unsupported type %d\n", type); + err = -EINVAL; + goto done; + } +@@ -2135,11 +2146,11 @@ brcmf_cfg80211_set_tx_power(struct wiphy + disable = WL_RADIO_SW_DISABLE << 16; + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_RADIO, disable); + if (err) +- bphy_err(wiphy, "WLC_SET_RADIO error (%d)\n", err); ++ bphy_err(drvr, "WLC_SET_RADIO error (%d)\n", err); + + err = brcmf_fil_iovar_int_set(ifp, "qtxpower", qdbm); + if (err) +- bphy_err(wiphy, "qtxpower error (%d)\n", err); ++ bphy_err(drvr, "qtxpower error (%d)\n", err); + + done: + brcmf_dbg(TRACE, "Exit %d (qdbm)\n", qdbm & ~WL_TXPWR_OVERRIDE); +@@ -2150,7 +2161,9 @@ static s32 + brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, + s32 *dbm) + { ++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct brcmf_cfg80211_vif *vif = wdev_to_vif(wdev); ++ struct brcmf_pub *drvr = cfg->pub; + s32 qdbm = 0; + s32 err; + +@@ -2160,7 +2173,7 @@ brcmf_cfg80211_get_tx_power(struct wiphy + + err = brcmf_fil_iovar_int_get(vif->ifp, "qtxpower", &qdbm); + if (err) { +- bphy_err(wiphy, "error (%d)\n", err); ++ bphy_err(drvr, "error (%d)\n", err); + goto done; + } + *dbm = (qdbm & ~WL_TXPWR_OVERRIDE) / 4; +@@ -2175,6 +2188,7 @@ brcmf_cfg80211_config_default_key(struct + u8 key_idx, bool unicast, bool multicast) + { + struct brcmf_if *ifp = netdev_priv(ndev); ++ struct brcmf_pub *drvr = ifp->drvr; + u32 index; + u32 wsec; + s32 err = 0; +@@ -2186,7 +2200,7 @@ brcmf_cfg80211_config_default_key(struct + + err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); + if (err) { +- bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err); ++ bphy_err(drvr, "WLC_GET_WSEC error (%d)\n", err); + goto done; + } + +@@ -2196,7 +2210,7 @@ brcmf_cfg80211_config_default_key(struct + err = brcmf_fil_cmd_int_set(ifp, + BRCMF_C_SET_KEY_PRIMARY, index); + if (err) +- bphy_err(wiphy, "error (%d)\n", err); ++ bphy_err(drvr, "error (%d)\n", err); + } + done: + brcmf_dbg(TRACE, "Exit\n"); +@@ -2245,7 +2259,9 @@ brcmf_cfg80211_add_key(struct wiphy *wip + u8 key_idx, bool pairwise, const u8 *mac_addr, + struct key_params *params) + { ++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct brcmf_if *ifp = netdev_priv(ndev); ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_wsec_key *key; + s32 val; + s32 wsec; +@@ -2260,7 +2276,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip + + if (key_idx >= BRCMF_MAX_DEFAULT_KEYS) { + /* we ignore this key index in this case */ +- bphy_err(wiphy, "invalid key index (%d)\n", key_idx); ++ bphy_err(drvr, "invalid key index (%d)\n", key_idx); + return -EINVAL; + } + +@@ -2269,7 +2285,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip + mac_addr); + + if (params->key_len > sizeof(key->data)) { +- bphy_err(wiphy, "Too long key length (%u)\n", params->key_len); ++ bphy_err(drvr, "Too long key length (%u)\n", params->key_len); + return -EINVAL; + } + +@@ -2323,7 +2339,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip + brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n"); + break; + default: +- bphy_err(wiphy, "Invalid cipher (0x%x)\n", params->cipher); ++ bphy_err(drvr, "Invalid cipher (0x%x)\n", params->cipher); + err = -EINVAL; + goto done; + } +@@ -2334,13 +2350,13 @@ brcmf_cfg80211_add_key(struct wiphy *wip + + err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); + if (err) { +- bphy_err(wiphy, "get wsec error (%d)\n", err); ++ bphy_err(drvr, "get wsec error (%d)\n", err); + goto done; + } + wsec |= val; + err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec); + if (err) { +- bphy_err(wiphy, "set wsec error (%d)\n", err); ++ bphy_err(drvr, "set wsec error (%d)\n", err); + goto done; + } + +@@ -2355,9 +2371,11 @@ brcmf_cfg80211_get_key(struct wiphy *wip + void (*callback)(void *cookie, + struct key_params *params)) + { ++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct key_params params; + struct brcmf_if *ifp = netdev_priv(ndev); + struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_cfg80211_security *sec; + s32 wsec; + s32 err = 0; +@@ -2371,7 +2389,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip + + err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); + if (err) { +- bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err); ++ bphy_err(drvr, "WLC_GET_WSEC error (%d)\n", err); + /* Ignore this error, may happen during DISASSOC */ + err = -EAGAIN; + goto done; +@@ -2392,7 +2410,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip + params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; + brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n"); + } else { +- bphy_err(wiphy, "Invalid algo (0x%x)\n", wsec); ++ bphy_err(drvr, "Invalid algo (0x%x)\n", wsec); + err = -EINVAL; + goto done; + } +@@ -2422,7 +2440,7 @@ brcmf_cfg80211_config_default_mgmt_key(s + static void + brcmf_cfg80211_reconfigure_wep(struct brcmf_if *ifp) + { +- struct wiphy *wiphy = ifp->drvr->wiphy; ++ struct brcmf_pub *drvr = ifp->drvr; + s32 err; + u8 key_idx; + struct brcmf_wsec_key *key; +@@ -2439,18 +2457,18 @@ brcmf_cfg80211_reconfigure_wep(struct br + + err = send_key_to_dongle(ifp, key); + if (err) { +- bphy_err(wiphy, "Setting WEP key failed (%d)\n", err); ++ bphy_err(drvr, "Setting WEP key failed (%d)\n", err); + return; + } + err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); + if (err) { +- bphy_err(wiphy, "get wsec error (%d)\n", err); ++ bphy_err(drvr, "get wsec error (%d)\n", err); + return; + } + wsec |= WEP_ENABLED; + err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec); + if (err) +- bphy_err(wiphy, "set wsec error (%d)\n", err); ++ bphy_err(drvr, "set wsec error (%d)\n", err); + } + + static void brcmf_convert_sta_flags(u32 fw_sta_flags, struct station_info *si) +@@ -2476,7 +2494,7 @@ static void brcmf_convert_sta_flags(u32 + + static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si) + { +- struct wiphy *wiphy = ifp->drvr->wiphy; ++ struct brcmf_pub *drvr = ifp->drvr; + struct { + __le32 len; + struct brcmf_bss_info_le bss_le; +@@ -2492,7 +2510,7 @@ static void brcmf_fill_bss_param(struct + err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, buf, + WL_BSS_INFO_MAX); + if (err) { +- bphy_err(wiphy, "Failed to get bss info (%d)\n", err); ++ bphy_err(drvr, "Failed to get bss info (%d)\n", err); + goto out_kfree; + } + si->filled |= BIT_ULL(NL80211_STA_INFO_BSS_PARAM); +@@ -2514,7 +2532,7 @@ static s32 + brcmf_cfg80211_get_station_ibss(struct brcmf_if *ifp, + struct station_info *sinfo) + { +- struct wiphy *wiphy = ifp->drvr->wiphy; ++ struct brcmf_pub *drvr = ifp->drvr; + struct brcmf_scb_val_le scbval; + struct brcmf_pktcnt_le pktcnt; + s32 err; +@@ -2524,7 +2542,7 @@ brcmf_cfg80211_get_station_ibss(struct b + /* Get the current tx rate */ + err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate); + if (err < 0) { +- bphy_err(wiphy, "BRCMF_C_GET_RATE error (%d)\n", err); ++ bphy_err(drvr, "BRCMF_C_GET_RATE error (%d)\n", err); + return err; + } + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); +@@ -2534,7 +2552,7 @@ brcmf_cfg80211_get_station_ibss(struct b + err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, &scbval, + sizeof(scbval)); + if (err) { +- bphy_err(wiphy, "BRCMF_C_GET_RSSI error (%d)\n", err); ++ bphy_err(drvr, "BRCMF_C_GET_RSSI error (%d)\n", err); + return err; + } + rssi = le32_to_cpu(scbval.val); +@@ -2544,7 +2562,7 @@ brcmf_cfg80211_get_station_ibss(struct b + err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_GET_PKTCNTS, &pktcnt, + sizeof(pktcnt)); + if (err) { +- bphy_err(wiphy, "BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err); ++ bphy_err(drvr, "BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err); + return err; + } + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS) | +@@ -2563,7 +2581,9 @@ static s32 + brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, + const u8 *mac, struct station_info *sinfo) + { ++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct brcmf_if *ifp = netdev_priv(ndev); ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_scb_val_le scb_val; + s32 err = 0; + struct brcmf_sta_info_le sta_info_le; +@@ -2592,7 +2612,7 @@ brcmf_cfg80211_get_station(struct wiphy + &sta_info_le, + sizeof(sta_info_le)); + if (err < 0) { +- bphy_err(wiphy, "GET STA INFO failed, %d\n", err); ++ bphy_err(drvr, "GET STA INFO failed, %d\n", err); + goto done; + } + } +@@ -2661,7 +2681,7 @@ brcmf_cfg80211_get_station(struct wiphy + err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, + &scb_val, sizeof(scb_val)); + if (err) { +- bphy_err(wiphy, "Could not get rssi (%d)\n", ++ bphy_err(drvr, "Could not get rssi (%d)\n", + err); + goto done; + } else { +@@ -2683,6 +2703,7 @@ brcmf_cfg80211_dump_station(struct wiphy + { + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct brcmf_if *ifp = netdev_priv(ndev); ++ struct brcmf_pub *drvr = cfg->pub; + s32 err; + + brcmf_dbg(TRACE, "Enter, idx %d\n", idx); +@@ -2693,7 +2714,7 @@ brcmf_cfg80211_dump_station(struct wiphy + &cfg->assoclist, + sizeof(cfg->assoclist)); + if (err) { +- bphy_err(wiphy, "BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n", ++ bphy_err(drvr, "BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n", + err); + cfg->assoclist.count = 0; + return -EOPNOTSUPP; +@@ -2714,6 +2735,7 @@ brcmf_cfg80211_set_power_mgmt(struct wip + s32 err = 0; + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct brcmf_if *ifp = netdev_priv(ndev); ++ struct brcmf_pub *drvr = cfg->pub; + + brcmf_dbg(TRACE, "Enter\n"); + +@@ -2742,9 +2764,9 @@ brcmf_cfg80211_set_power_mgmt(struct wip + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm); + if (err) { + if (err == -ENODEV) +- bphy_err(wiphy, "net_device is not ready yet\n"); ++ bphy_err(drvr, "net_device is not ready yet\n"); + else +- bphy_err(wiphy, "error (%d)\n", err); ++ bphy_err(drvr, "error (%d)\n", err); + } + done: + brcmf_dbg(TRACE, "Exit\n"); +@@ -2755,6 +2777,7 @@ static s32 brcmf_inform_single_bss(struc + struct brcmf_bss_info_le *bi) + { + struct wiphy *wiphy = cfg_to_wiphy(cfg); ++ struct brcmf_pub *drvr = cfg->pub; + struct cfg80211_bss *bss; + enum nl80211_band band; + struct brcmu_chan ch; +@@ -2767,7 +2790,7 @@ static s32 brcmf_inform_single_bss(struc + struct cfg80211_inform_bss bss_data = {}; + + if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) { +- bphy_err(wiphy, "Bss info is larger than buffer. Discarding\n"); ++ bphy_err(drvr, "Bss info is larger than buffer. Discarding\n"); + return 0; + } + +@@ -2826,7 +2849,7 @@ next_bss_le(struct brcmf_scan_results *l + + static s32 brcmf_inform_bss(struct brcmf_cfg80211_info *cfg) + { +- struct wiphy *wiphy = cfg_to_wiphy(cfg); ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_scan_results *bss_list; + struct brcmf_bss_info_le *bi = NULL; /* must be initialized */ + s32 err = 0; +@@ -2835,7 +2858,7 @@ static s32 brcmf_inform_bss(struct brcmf + bss_list = (struct brcmf_scan_results *)cfg->escan_info.escan_buf; + if (bss_list->count != 0 && + bss_list->version != BRCMF_BSS_INFO_VERSION) { +- bphy_err(wiphy, "Version %d != WL_BSS_INFO_VERSION\n", ++ bphy_err(drvr, "Version %d != WL_BSS_INFO_VERSION\n", + bss_list->version); + return -EOPNOTSUPP; + } +@@ -2853,6 +2876,7 @@ static s32 brcmf_inform_ibss(struct brcm + struct net_device *ndev, const u8 *bssid) + { + struct wiphy *wiphy = cfg_to_wiphy(cfg); ++ struct brcmf_pub *drvr = cfg->pub; + struct ieee80211_channel *notify_channel; + struct brcmf_bss_info_le *bi = NULL; + struct ieee80211_supported_band *band; +@@ -2880,7 +2904,7 @@ static s32 brcmf_inform_ibss(struct brcm + err = brcmf_fil_cmd_data_get(netdev_priv(ndev), BRCMF_C_GET_BSS_INFO, + buf, WL_BSS_INFO_MAX); + if (err) { +- bphy_err(wiphy, "WLC_GET_BSS_INFO failed: %d\n", err); ++ bphy_err(drvr, "WLC_GET_BSS_INFO failed: %d\n", err); + goto CleanUp; + } + +@@ -2934,7 +2958,7 @@ CleanUp: + static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg, + struct brcmf_if *ifp) + { +- struct wiphy *wiphy = cfg_to_wiphy(cfg); ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_bss_info_le *bi; + const struct brcmf_tlv *tim; + u16 beacon_interval; +@@ -2951,7 +2975,7 @@ static s32 brcmf_update_bss_info(struct + err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, + cfg->extra_buf, WL_EXTRA_BUF_MAX); + if (err) { +- bphy_err(wiphy, "Could not get bss info %d\n", err); ++ bphy_err(drvr, "Could not get bss info %d\n", err); + goto update_bss_info_out; + } + +@@ -2976,7 +3000,7 @@ static s32 brcmf_update_bss_info(struct + u32 var; + err = brcmf_fil_iovar_int_get(ifp, "dtim_assoc", &var); + if (err) { +- bphy_err(wiphy, "wl dtim_assoc failed (%d)\n", err); ++ bphy_err(drvr, "wl dtim_assoc failed (%d)\n", err); + goto update_bss_info_out; + } + dtim_period = (u8)var; +@@ -3014,10 +3038,10 @@ static void brcmf_escan_timeout(struct t + { + struct brcmf_cfg80211_info *cfg = + from_timer(cfg, t, escan_timeout); +- struct wiphy *wiphy = cfg_to_wiphy(cfg); ++ struct brcmf_pub *drvr = cfg->pub; + + if (cfg->int_escan_map || cfg->scan_request) { +- bphy_err(wiphy, "timer expired\n"); ++ bphy_err(drvr, "timer expired\n"); + schedule_work(&cfg->escan_timeout_work); + } + } +@@ -3065,8 +3089,8 @@ static s32 + brcmf_cfg80211_escan_handler(struct brcmf_if *ifp, + const struct brcmf_event_msg *e, void *data) + { +- struct brcmf_cfg80211_info *cfg = ifp->drvr->config; +- struct wiphy *wiphy = cfg_to_wiphy(cfg); ++ struct brcmf_pub *drvr = ifp->drvr; ++ struct brcmf_cfg80211_info *cfg = drvr->config; + s32 status; + struct brcmf_escan_result_le *escan_result_le; + u32 escan_buflen; +@@ -3083,7 +3107,7 @@ brcmf_cfg80211_escan_handler(struct brcm + goto exit; + + if (!test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { +- bphy_err(wiphy, "scan not ready, bsscfgidx=%d\n", ++ bphy_err(drvr, "scan not ready, bsscfgidx=%d\n", + ifp->bsscfgidx); + return -EPERM; + } +@@ -3091,24 +3115,24 @@ brcmf_cfg80211_escan_handler(struct brcm + if (status == BRCMF_E_STATUS_PARTIAL) { + brcmf_dbg(SCAN, "ESCAN Partial result\n"); + if (e->datalen < sizeof(*escan_result_le)) { +- bphy_err(wiphy, "invalid event data length\n"); ++ bphy_err(drvr, "invalid event data length\n"); + goto exit; + } + escan_result_le = (struct brcmf_escan_result_le *) data; + if (!escan_result_le) { +- bphy_err(wiphy, "Invalid escan result (NULL pointer)\n"); ++ bphy_err(drvr, "Invalid escan result (NULL pointer)\n"); + goto exit; + } + escan_buflen = le32_to_cpu(escan_result_le->buflen); + if (escan_buflen > BRCMF_ESCAN_BUF_SIZE || + escan_buflen > e->datalen || + escan_buflen < sizeof(*escan_result_le)) { +- bphy_err(wiphy, "Invalid escan buffer length: %d\n", ++ bphy_err(drvr, "Invalid escan buffer length: %d\n", + escan_buflen); + goto exit; + } + if (le16_to_cpu(escan_result_le->bss_count) != 1) { +- bphy_err(wiphy, "Invalid bss_count %d: ignoring\n", ++ bphy_err(drvr, "Invalid bss_count %d: ignoring\n", + escan_result_le->bss_count); + goto exit; + } +@@ -3124,7 +3148,7 @@ brcmf_cfg80211_escan_handler(struct brcm + + bi_length = le32_to_cpu(bss_info_le->length); + if (bi_length != escan_buflen - WL_ESCAN_RESULTS_FIXED_SIZE) { +- bphy_err(wiphy, "Ignoring invalid bss_info length: %d\n", ++ bphy_err(drvr, "Ignoring invalid bss_info length: %d\n", + bi_length); + goto exit; + } +@@ -3133,7 +3157,7 @@ brcmf_cfg80211_escan_handler(struct brcm + BIT(NL80211_IFTYPE_ADHOC))) { + if (le16_to_cpu(bss_info_le->capability) & + WLAN_CAPABILITY_IBSS) { +- bphy_err(wiphy, "Ignoring IBSS result\n"); ++ bphy_err(drvr, "Ignoring IBSS result\n"); + goto exit; + } + } +@@ -3141,7 +3165,7 @@ brcmf_cfg80211_escan_handler(struct brcm + list = (struct brcmf_scan_results *) + cfg->escan_info.escan_buf; + if (bi_length > BRCMF_ESCAN_BUF_SIZE - list->buflen) { +- bphy_err(wiphy, "Buffer is too small: ignoring\n"); ++ bphy_err(drvr, "Buffer is too small: ignoring\n"); + goto exit; + } + +@@ -3300,7 +3324,8 @@ static s32 + brcmf_notify_sched_scan_results(struct brcmf_if *ifp, + const struct brcmf_event_msg *e, void *data) + { +- struct brcmf_cfg80211_info *cfg = ifp->drvr->config; ++ struct brcmf_pub *drvr = ifp->drvr; ++ struct brcmf_cfg80211_info *cfg = drvr->config; + struct brcmf_pno_net_info_le *netinfo, *netinfo_start; + struct cfg80211_scan_request *request = NULL; + struct wiphy *wiphy = cfg_to_wiphy(cfg); +@@ -3333,14 +3358,14 @@ brcmf_notify_sched_scan_results(struct b + WARN_ON(status != BRCMF_PNO_SCAN_COMPLETE); + brcmf_dbg(SCAN, "PFN NET FOUND event. count: %d\n", result_count); + if (!result_count) { +- bphy_err(wiphy, "FALSE PNO Event. (pfn_count == 0)\n"); ++ bphy_err(drvr, "FALSE PNO Event. (pfn_count == 0)\n"); + goto out_err; + } + + netinfo_start = brcmf_get_netinfo_array(pfn_result); + datalen = e->datalen - ((void *)netinfo_start - (void *)pfn_result); + if (datalen < result_count * sizeof(*netinfo)) { +- bphy_err(wiphy, "insufficient event data\n"); ++ bphy_err(drvr, "insufficient event data\n"); + goto out_err; + } + +@@ -3387,14 +3412,15 @@ brcmf_cfg80211_sched_scan_start(struct w + struct net_device *ndev, + struct cfg80211_sched_scan_request *req) + { +- struct brcmf_if *ifp = netdev_priv(ndev); + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); ++ struct brcmf_if *ifp = netdev_priv(ndev); ++ struct brcmf_pub *drvr = cfg->pub; + + brcmf_dbg(SCAN, "Enter: n_match_sets=%d n_ssids=%d\n", + req->n_match_sets, req->n_ssids); + + if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) { +- bphy_err(wiphy, "Scanning suppressed: status=%lu\n", ++ bphy_err(drvr, "Scanning suppressed: status=%lu\n", + cfg->scan_status); + return -EAGAIN; + } +@@ -3473,8 +3499,8 @@ static s32 + brcmf_wowl_nd_results(struct brcmf_if *ifp, const struct brcmf_event_msg *e, + void *data) + { +- struct brcmf_cfg80211_info *cfg = ifp->drvr->config; +- struct wiphy *wiphy = cfg_to_wiphy(cfg); ++ struct brcmf_pub *drvr = ifp->drvr; ++ struct brcmf_cfg80211_info *cfg = drvr->config; + struct brcmf_pno_scanresults_le *pfn_result; + struct brcmf_pno_net_info_le *netinfo; + +@@ -3493,7 +3519,7 @@ brcmf_wowl_nd_results(struct brcmf_if *i + } + + if (le32_to_cpu(pfn_result->count) < 1) { +- bphy_err(wiphy, "Invalid result count, expected 1 (%d)\n", ++ bphy_err(drvr, "Invalid result count, expected 1 (%d)\n", + le32_to_cpu(pfn_result->count)); + return -EINVAL; + } +@@ -3523,6 +3549,7 @@ brcmf_wowl_nd_results(struct brcmf_if *i + static void brcmf_report_wowl_wakeind(struct wiphy *wiphy, struct brcmf_if *ifp) + { + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_wowl_wakeind_le wake_ind_le; + struct cfg80211_wowlan_wakeup wakeup_data; + struct cfg80211_wowlan_wakeup *wakeup; +@@ -3533,7 +3560,7 @@ static void brcmf_report_wowl_wakeind(st + err = brcmf_fil_iovar_data_get(ifp, "wowl_wakeind", &wake_ind_le, + sizeof(wake_ind_le)); + if (err) { +- bphy_err(wiphy, "Get wowl_wakeind failed, err = %d\n", err); ++ bphy_err(drvr, "Get wowl_wakeind failed, err = %d\n", err); + return; + } + +@@ -3574,7 +3601,7 @@ static void brcmf_report_wowl_wakeind(st + cfg->wowl.nd_data_completed, + BRCMF_ND_INFO_TIMEOUT); + if (!timeout) +- bphy_err(wiphy, "No result for wowl net detect\n"); ++ bphy_err(drvr, "No result for wowl net detect\n"); + else + wakeup_data.net_detect = cfg->wowl.nd_info; + } +@@ -3763,6 +3790,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *w + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct brcmf_if *ifp = netdev_priv(ndev); + struct brcmf_pmksa *pmk = &cfg->pmk_list.pmk[0]; ++ struct brcmf_pub *drvr = cfg->pub; + s32 err; + u32 npmk, i; + +@@ -3782,7 +3810,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *w + cfg->pmk_list.npmk = cpu_to_le32(npmk); + } + } else { +- bphy_err(wiphy, "Too many PMKSA entries cached %d\n", npmk); ++ bphy_err(drvr, "Too many PMKSA entries cached %d\n", npmk); + return -EINVAL; + } + +@@ -3805,6 +3833,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *w + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct brcmf_if *ifp = netdev_priv(ndev); + struct brcmf_pmksa *pmk = &cfg->pmk_list.pmk[0]; ++ struct brcmf_pub *drvr = cfg->pub; + s32 err; + u32 npmk, i; + +@@ -3828,7 +3857,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *w + memset(&pmk[i], 0, sizeof(*pmk)); + cfg->pmk_list.npmk = cpu_to_le32(npmk - 1); + } else { +- bphy_err(wiphy, "Cache entry not found\n"); ++ bphy_err(drvr, "Cache entry not found\n"); + return -EINVAL; + } + +@@ -3860,20 +3889,20 @@ brcmf_cfg80211_flush_pmksa(struct wiphy + + static s32 brcmf_configure_opensecurity(struct brcmf_if *ifp) + { +- struct wiphy *wiphy = ifp->drvr->wiphy; ++ struct brcmf_pub *drvr = ifp->drvr; + s32 err; + s32 wpa_val; + + /* set auth */ + err = brcmf_fil_bsscfg_int_set(ifp, "auth", 0); + if (err < 0) { +- bphy_err(wiphy, "auth error %d\n", err); ++ bphy_err(drvr, "auth error %d\n", err); + return err; + } + /* set wsec */ + err = brcmf_fil_bsscfg_int_set(ifp, "wsec", 0); + if (err < 0) { +- bphy_err(wiphy, "wsec error %d\n", err); ++ bphy_err(drvr, "wsec error %d\n", err); + return err; + } + /* set upper-layer auth */ +@@ -3883,7 +3912,7 @@ static s32 brcmf_configure_opensecurity( + wpa_val = WPA_AUTH_DISABLED; + err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_val); + if (err < 0) { +- bphy_err(wiphy, "wpa_auth error %d\n", err); ++ bphy_err(drvr, "wpa_auth error %d\n", err); + return err; + } + +@@ -3903,7 +3932,7 @@ brcmf_configure_wpaie(struct brcmf_if *i + const struct brcmf_vs_tlv *wpa_ie, + bool is_rsn_ie) + { +- struct wiphy *wiphy = ifp->drvr->wiphy; ++ struct brcmf_pub *drvr = ifp->drvr; + u32 auth = 0; /* d11 open authentication */ + u16 count; + s32 err = 0; +@@ -3934,13 +3963,13 @@ brcmf_configure_wpaie(struct brcmf_if *i + /* check for multicast cipher suite */ + if (offset + WPA_IE_MIN_OUI_LEN > len) { + err = -EINVAL; +- bphy_err(wiphy, "no multicast cipher suite\n"); ++ bphy_err(drvr, "no multicast cipher suite\n"); + goto exit; + } + + if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) { + err = -EINVAL; +- bphy_err(wiphy, "ivalid OUI\n"); ++ bphy_err(drvr, "ivalid OUI\n"); + goto exit; + } + offset += TLV_OUI_LEN; +@@ -3962,7 +3991,7 @@ brcmf_configure_wpaie(struct brcmf_if *i + break; + default: + err = -EINVAL; +- bphy_err(wiphy, "Invalid multi cast cipher info\n"); ++ bphy_err(drvr, "Invalid multi cast cipher info\n"); + goto exit; + } + +@@ -3973,13 +4002,13 @@ brcmf_configure_wpaie(struct brcmf_if *i + /* Check for unicast suite(s) */ + if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) { + err = -EINVAL; +- bphy_err(wiphy, "no unicast cipher suite\n"); ++ bphy_err(drvr, "no unicast cipher suite\n"); + goto exit; + } + for (i = 0; i < count; i++) { + if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) { + err = -EINVAL; +- bphy_err(wiphy, "ivalid OUI\n"); ++ bphy_err(drvr, "ivalid OUI\n"); + goto exit; + } + offset += TLV_OUI_LEN; +@@ -3997,7 +4026,7 @@ brcmf_configure_wpaie(struct brcmf_if *i + pval |= AES_ENABLED; + break; + default: +- bphy_err(wiphy, "Invalid unicast security info\n"); ++ bphy_err(drvr, "Invalid unicast security info\n"); + } + offset++; + } +@@ -4007,13 +4036,13 @@ brcmf_configure_wpaie(struct brcmf_if *i + /* Check for auth key management suite(s) */ + if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) { + err = -EINVAL; +- bphy_err(wiphy, "no auth key mgmt suite\n"); ++ bphy_err(drvr, "no auth key mgmt suite\n"); + goto exit; + } + for (i = 0; i < count; i++) { + if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) { + err = -EINVAL; +- bphy_err(wiphy, "ivalid OUI\n"); ++ bphy_err(drvr, "ivalid OUI\n"); + goto exit; + } + offset += TLV_OUI_LEN; +@@ -4041,7 +4070,7 @@ brcmf_configure_wpaie(struct brcmf_if *i + wpa_auth |= WPA2_AUTH_1X_SHA256; + break; + default: +- bphy_err(wiphy, "Invalid key mgmt info\n"); ++ bphy_err(drvr, "Invalid key mgmt info\n"); + } + offset++; + } +@@ -4083,7 +4112,7 @@ brcmf_configure_wpaie(struct brcmf_if *i + err = brcmf_fil_bsscfg_int_set(ifp, "wme_bss_disable", + wme_bss_disable); + if (err < 0) { +- bphy_err(wiphy, "wme_bss_disable error %d\n", err); ++ bphy_err(drvr, "wme_bss_disable error %d\n", err); + goto exit; + } + +@@ -4097,7 +4126,7 @@ brcmf_configure_wpaie(struct brcmf_if *i + &data[offset], + WPA_IE_MIN_OUI_LEN); + if (err < 0) { +- bphy_err(wiphy, "bip error %d\n", err); ++ bphy_err(drvr, "bip error %d\n", err); + goto exit; + } + } +@@ -4108,13 +4137,13 @@ brcmf_configure_wpaie(struct brcmf_if *i + /* set auth */ + err = brcmf_fil_bsscfg_int_set(ifp, "auth", auth); + if (err < 0) { +- bphy_err(wiphy, "auth error %d\n", err); ++ bphy_err(drvr, "auth error %d\n", err); + goto exit; + } + /* set wsec */ + err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec); + if (err < 0) { +- bphy_err(wiphy, "wsec error %d\n", err); ++ bphy_err(drvr, "wsec error %d\n", err); + goto exit; + } + /* Configure MFP, this needs to go after wsec otherwise the wsec command +@@ -4123,14 +4152,14 @@ brcmf_configure_wpaie(struct brcmf_if *i + if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP)) { + err = brcmf_fil_bsscfg_int_set(ifp, "mfp", mfp); + if (err < 0) { +- bphy_err(wiphy, "mfp error %d\n", err); ++ bphy_err(drvr, "mfp error %d\n", err); + goto exit; + } + } + /* set upper-layer auth */ + err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_auth); + if (err < 0) { +- bphy_err(wiphy, "wpa_auth error %d\n", err); ++ bphy_err(drvr, "wpa_auth error %d\n", err); + goto exit; + } + +@@ -4216,8 +4245,8 @@ brcmf_vndr_ie(u8 *iebuf, s32 pktflag, u8 + s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag, + const u8 *vndr_ie_buf, u32 vndr_ie_len) + { ++ struct brcmf_pub *drvr; + struct brcmf_if *ifp; +- struct wiphy *wiphy; + struct vif_saved_ie *saved_ie; + s32 err = 0; + u8 *iovar_ie_buf; +@@ -4238,7 +4267,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c + if (!vif) + return -ENODEV; + ifp = vif->ifp; +- wiphy = ifp->drvr->wiphy; ++ drvr = ifp->drvr; + saved_ie = &vif->saved_ie; + + brcmf_dbg(TRACE, "bsscfgidx %d, pktflag : 0x%02X\n", ifp->bsscfgidx, +@@ -4270,13 +4299,13 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c + break; + default: + err = -EPERM; +- bphy_err(wiphy, "not suitable type\n"); ++ bphy_err(drvr, "not suitable type\n"); + goto exit; + } + + if (vndr_ie_len > mgmt_ie_buf_len) { + err = -ENOMEM; +- bphy_err(wiphy, "extra IE size too big\n"); ++ bphy_err(drvr, "extra IE size too big\n"); + goto exit; + } + +@@ -4337,7 +4366,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c + /* verify remained buf size before copy data */ + if (remained_buf_len < (vndrie_info->vndrie.len + + VNDR_IE_VSIE_OFFSET)) { +- bphy_err(wiphy, "no space in mgmt_ie_buf: len left %d", ++ bphy_err(drvr, "no space in mgmt_ie_buf: len left %d", + remained_buf_len); + break; + } +@@ -4369,7 +4398,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c + err = brcmf_fil_bsscfg_data_set(ifp, "vndr_ie", iovar_ie_buf, + total_ie_buf_len); + if (err) +- bphy_err(wiphy, "vndr ie set error : %d\n", err); ++ bphy_err(drvr, "vndr ie set error : %d\n", err); + } + + exit: +@@ -4397,14 +4426,14 @@ static s32 + brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif, + struct cfg80211_beacon_data *beacon) + { +- struct wiphy *wiphy = vif->ifp->drvr->wiphy; ++ struct brcmf_pub *drvr = vif->ifp->drvr; + s32 err; + + /* Set Beacon IEs to FW */ + err = brcmf_vif_set_mgmt_ie(vif, BRCMF_VNDR_IE_BEACON_FLAG, + beacon->tail, beacon->tail_len); + if (err) { +- bphy_err(wiphy, "Set Beacon IE Failed\n"); ++ bphy_err(drvr, "Set Beacon IE Failed\n"); + return err; + } + brcmf_dbg(TRACE, "Applied Vndr IEs for Beacon\n"); +@@ -4414,7 +4443,7 @@ brcmf_config_ap_mgmt_ie(struct brcmf_cfg + beacon->proberesp_ies, + beacon->proberesp_ies_len); + if (err) +- bphy_err(wiphy, "Set Probe Resp IE Failed\n"); ++ bphy_err(drvr, "Set Probe Resp IE Failed\n"); + else + brcmf_dbg(TRACE, "Applied Vndr IEs for Probe Resp\n"); + +@@ -4428,6 +4457,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + s32 ie_offset; + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct brcmf_if *ifp = netdev_priv(ndev); ++ struct brcmf_pub *drvr = cfg->pub; + const struct brcmf_tlv *ssid_ie; + const struct brcmf_tlv *country_ie; + struct brcmf_ssid_le ssid_le; +@@ -4523,7 +4553,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY, + is_11d); + if (err < 0) { +- bphy_err(wiphy, "Regulatory Set Error, %d\n", ++ bphy_err(drvr, "Regulatory Set Error, %d\n", + err); + goto exit; + } +@@ -4532,7 +4562,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, + settings->beacon_interval); + if (err < 0) { +- bphy_err(wiphy, "Beacon Interval Set Error, %d\n", ++ bphy_err(drvr, "Beacon Interval Set Error, %d\n", + err); + goto exit; + } +@@ -4541,7 +4571,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_DTIMPRD, + settings->dtim_period); + if (err < 0) { +- bphy_err(wiphy, "DTIM Interval Set Error, %d\n", ++ bphy_err(drvr, "DTIM Interval Set Error, %d\n", + err); + goto exit; + } +@@ -4552,7 +4582,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + !brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB))) { + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); + if (err < 0) { +- bphy_err(wiphy, "BRCMF_C_DOWN error %d\n", ++ bphy_err(drvr, "BRCMF_C_DOWN error %d\n", + err); + goto exit; + } +@@ -4561,7 +4591,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 1); + if (err < 0) { +- bphy_err(wiphy, "SET INFRA error %d\n", err); ++ bphy_err(drvr, "SET INFRA error %d\n", err); + goto exit; + } + } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) { +@@ -4577,7 +4607,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 1); + if (err < 0) { +- bphy_err(wiphy, "setting AP mode failed %d\n", ++ bphy_err(drvr, "setting AP mode failed %d\n", + err); + goto exit; + } +@@ -4587,14 +4617,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + */ + err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); + if (err < 0) { +- bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n", ++ bphy_err(drvr, "Set Channel failed: chspec=%d, %d\n", + chanspec, err); + goto exit; + } + } + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1); + if (err < 0) { +- bphy_err(wiphy, "BRCMF_C_UP error (%d)\n", err); ++ bphy_err(drvr, "BRCMF_C_UP error (%d)\n", err); + goto exit; + } + /* On DOWN the firmware removes the WEP keys, reconfigure +@@ -4609,14 +4639,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, + &join_params, sizeof(join_params)); + if (err < 0) { +- bphy_err(wiphy, "SET SSID error (%d)\n", err); ++ bphy_err(drvr, "SET SSID error (%d)\n", err); + goto exit; + } + + if (settings->hidden_ssid) { + err = brcmf_fil_iovar_int_set(ifp, "closednet", 1); + if (err) { +- bphy_err(wiphy, "closednet error (%d)\n", err); ++ bphy_err(drvr, "closednet error (%d)\n", err); + goto exit; + } + } +@@ -4625,14 +4655,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + } else if (dev_role == NL80211_IFTYPE_P2P_GO) { + err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); + if (err < 0) { +- bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n", ++ bphy_err(drvr, "Set Channel failed: chspec=%d, %d\n", + chanspec, err); + goto exit; + } + err = brcmf_fil_bsscfg_data_set(ifp, "ssid", &ssid_le, + sizeof(ssid_le)); + if (err < 0) { +- bphy_err(wiphy, "setting ssid failed %d\n", err); ++ bphy_err(drvr, "setting ssid failed %d\n", err); + goto exit; + } + bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx); +@@ -4640,7 +4670,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable, + sizeof(bss_enable)); + if (err < 0) { +- bphy_err(wiphy, "bss_enable config failed %d\n", err); ++ bphy_err(drvr, "bss_enable config failed %d\n", err); + goto exit; + } + +@@ -4663,7 +4693,9 @@ exit: + + static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) + { ++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct brcmf_if *ifp = netdev_priv(ndev); ++ struct brcmf_pub *drvr = cfg->pub; + s32 err; + struct brcmf_fil_bss_enable_le bss_enable; + struct brcmf_join_params join_params; +@@ -4688,13 +4720,13 @@ static int brcmf_cfg80211_stop_ap(struct + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, + &join_params, sizeof(join_params)); + if (err < 0) +- bphy_err(wiphy, "SET SSID error (%d)\n", err); ++ bphy_err(drvr, "SET SSID error (%d)\n", err); + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); + if (err < 0) +- bphy_err(wiphy, "BRCMF_C_DOWN error %d\n", err); ++ bphy_err(drvr, "BRCMF_C_DOWN error %d\n", err); + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0); + if (err < 0) +- bphy_err(wiphy, "setting AP mode failed %d\n", err); ++ bphy_err(drvr, "setting AP mode failed %d\n", err); + if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) + brcmf_fil_iovar_int_set(ifp, "mbss", 0); + brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY, +@@ -4702,7 +4734,7 @@ static int brcmf_cfg80211_stop_ap(struct + /* Bring device back up so it can be used again */ + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1); + if (err < 0) +- bphy_err(wiphy, "BRCMF_C_UP error %d\n", err); ++ bphy_err(drvr, "BRCMF_C_UP error %d\n", err); + + brcmf_vif_clear_mgmt_ies(ifp->vif); + } else { +@@ -4711,7 +4743,7 @@ static int brcmf_cfg80211_stop_ap(struct + err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable, + sizeof(bss_enable)); + if (err < 0) +- bphy_err(wiphy, "bss_enable config failed %d\n", err); ++ bphy_err(drvr, "bss_enable config failed %d\n", err); + } + brcmf_set_mpc(ifp, 1); + brcmf_configure_arp_nd_offload(ifp, true); +@@ -4740,6 +4772,7 @@ brcmf_cfg80211_del_station(struct wiphy + struct station_del_parameters *params) + { + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_scb_val_le scbval; + struct brcmf_if *ifp = netdev_priv(ndev); + s32 err; +@@ -4759,7 +4792,7 @@ brcmf_cfg80211_del_station(struct wiphy + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON, + &scbval, sizeof(scbval)); + if (err) +- bphy_err(wiphy, "SCB_DEAUTHENTICATE_FOR_REASON failed %d\n", ++ bphy_err(drvr, "SCB_DEAUTHENTICATE_FOR_REASON failed %d\n", + err); + + brcmf_dbg(TRACE, "Exit\n"); +@@ -4770,6 +4803,8 @@ static int + brcmf_cfg80211_change_station(struct wiphy *wiphy, struct net_device *ndev, + const u8 *mac, struct station_parameters *params) + { ++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_if *ifp = netdev_priv(ndev); + s32 err; + +@@ -4790,7 +4825,7 @@ brcmf_cfg80211_change_station(struct wip + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SCB_DEAUTHORIZE, + (void *)mac, ETH_ALEN); + if (err < 0) +- bphy_err(wiphy, "Setting SCB (de-)authorize failed, %d\n", err); ++ bphy_err(drvr, "Setting SCB (de-)authorize failed, %d\n", err); + + return err; + } +@@ -4820,6 +4855,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip + { + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct ieee80211_channel *chan = params->chan; ++ struct brcmf_pub *drvr = cfg->pub; + const u8 *buf = params->buf; + size_t len = params->len; + const struct ieee80211_mgmt *mgmt; +@@ -4840,7 +4876,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip + mgmt = (const struct ieee80211_mgmt *)buf; + + if (!ieee80211_is_mgmt(mgmt->frame_control)) { +- bphy_err(wiphy, "Driver only allows MGMT packet type\n"); ++ bphy_err(drvr, "Driver only allows MGMT packet type\n"); + return -EPERM; + } + +@@ -4871,13 +4907,13 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip + GFP_KERNEL); + } else if (ieee80211_is_action(mgmt->frame_control)) { + if (len > BRCMF_FIL_ACTION_FRAME_SIZE + DOT11_MGMT_HDR_LEN) { +- bphy_err(wiphy, "invalid action frame length\n"); ++ bphy_err(drvr, "invalid action frame length\n"); + err = -EINVAL; + goto exit; + } + af_params = kzalloc(sizeof(*af_params), GFP_KERNEL); + if (af_params == NULL) { +- bphy_err(wiphy, "unable to allocate frame\n"); ++ bphy_err(drvr, "unable to allocate frame\n"); + err = -ENOMEM; + goto exit; + } +@@ -4928,6 +4964,7 @@ brcmf_cfg80211_cancel_remain_on_channel( + u64 cookie) + { + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_cfg80211_vif *vif; + int err = 0; + +@@ -4935,7 +4972,7 @@ brcmf_cfg80211_cancel_remain_on_channel( + + vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif; + if (vif == NULL) { +- bphy_err(wiphy, "No p2p device available for probe response\n"); ++ bphy_err(drvr, "No p2p device available for probe response\n"); + err = -ENODEV; + goto exit; + } +@@ -4950,6 +4987,7 @@ static int brcmf_cfg80211_get_channel(st + { + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct net_device *ndev = wdev->netdev; ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_if *ifp; + struct brcmu_chan ch; + enum nl80211_band band = 0; +@@ -4963,7 +5001,7 @@ static int brcmf_cfg80211_get_channel(st + + err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec); + if (err) { +- bphy_err(wiphy, "chanspec failed (%d)\n", err); ++ bphy_err(drvr, "chanspec failed (%d)\n", err); + return err; + } + +@@ -5085,6 +5123,8 @@ static int brcmf_cfg80211_tdls_oper(stru + struct net_device *ndev, const u8 *peer, + enum nl80211_tdls_operation oper) + { ++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_if *ifp; + struct brcmf_tdls_iovar_le info; + int ret = 0; +@@ -5102,7 +5142,7 @@ static int brcmf_cfg80211_tdls_oper(stru + ret = brcmf_fil_iovar_data_set(ifp, "tdls_endpoint", + &info, sizeof(info)); + if (ret < 0) +- bphy_err(wiphy, "tdls_endpoint iovar failed: ret=%d\n", ret); ++ bphy_err(drvr, "tdls_endpoint iovar failed: ret=%d\n", ret); + + return ret; + } +@@ -5113,6 +5153,8 @@ brcmf_cfg80211_update_conn_params(struct + struct cfg80211_connect_params *sme, + u32 changed) + { ++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_if *ifp; + int err; + +@@ -5123,7 +5165,7 @@ brcmf_cfg80211_update_conn_params(struct + err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG, + sme->ie, sme->ie_len); + if (err) +- bphy_err(wiphy, "Set Assoc REQ IE Failed\n"); ++ bphy_err(drvr, "Set Assoc REQ IE Failed\n"); + else + brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n"); + +@@ -5135,6 +5177,8 @@ static int + brcmf_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *ndev, + struct cfg80211_gtk_rekey_data *gtk) + { ++ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_if *ifp = netdev_priv(ndev); + struct brcmf_gtk_keyinfo_le gtk_le; + int ret; +@@ -5149,7 +5193,7 @@ brcmf_cfg80211_set_rekey_data(struct wip + ret = brcmf_fil_iovar_data_set(ifp, "gtk_key_info", >k_le, + sizeof(gtk_le)); + if (ret < 0) +- bphy_err(wiphy, "gtk_key_info iovar failed: ret=%d\n", ret); ++ bphy_err(drvr, "gtk_key_info iovar failed: ret=%d\n", ret); + + return ret; + } +@@ -5381,7 +5425,7 @@ static void brcmf_clear_assoc_ies(struct + static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg, + struct brcmf_if *ifp) + { +- struct wiphy *wiphy = cfg_to_wiphy(cfg); ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_cfg80211_assoc_ielen_le *assoc_info; + struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg); + u32 req_len; +@@ -5393,7 +5437,7 @@ static s32 brcmf_get_assoc_ies(struct br + err = brcmf_fil_iovar_data_get(ifp, "assoc_info", + cfg->extra_buf, WL_ASSOC_INFO_MAX); + if (err) { +- bphy_err(wiphy, "could not get assoc info (%d)\n", err); ++ bphy_err(drvr, "could not get assoc info (%d)\n", err); + return err; + } + assoc_info = +@@ -5405,7 +5449,7 @@ static s32 brcmf_get_assoc_ies(struct br + cfg->extra_buf, + WL_ASSOC_INFO_MAX); + if (err) { +- bphy_err(wiphy, "could not get assoc req (%d)\n", err); ++ bphy_err(drvr, "could not get assoc req (%d)\n", err); + return err; + } + conn_info->req_ie_len = req_len; +@@ -5423,7 +5467,7 @@ static s32 brcmf_get_assoc_ies(struct br + cfg->extra_buf, + WL_ASSOC_INFO_MAX); + if (err) { +- bphy_err(wiphy, "could not get assoc resp (%d)\n", err); ++ bphy_err(drvr, "could not get assoc resp (%d)\n", err); + return err; + } + conn_info->resp_ie_len = resp_len; +@@ -5552,7 +5596,7 @@ brcmf_notify_connect_status_ap(struct br + struct net_device *ndev, + const struct brcmf_event_msg *e, void *data) + { +- struct wiphy *wiphy = cfg_to_wiphy(cfg); ++ struct brcmf_pub *drvr = cfg->pub; + static int generation; + u32 event = e->event_code; + u32 reason = e->reason; +@@ -5570,7 +5614,7 @@ brcmf_notify_connect_status_ap(struct br + if (((event == BRCMF_E_ASSOC_IND) || (event == BRCMF_E_REASSOC_IND)) && + (reason == BRCMF_E_STATUS_SUCCESS)) { + if (!data) { +- bphy_err(wiphy, "No IEs present in ASSOC/REASSOC_IND\n"); ++ bphy_err(drvr, "No IEs present in ASSOC/REASSOC_IND\n"); + return -EINVAL; + } + +@@ -5862,7 +5906,7 @@ static void init_vif_event(struct brcmf_ + + static s32 brcmf_dongle_roam(struct brcmf_if *ifp) + { +- struct wiphy *wiphy = ifp->drvr->wiphy; ++ struct brcmf_pub *drvr = ifp->drvr; + s32 err; + u32 bcn_timeout; + __le32 roamtrigger[2]; +@@ -5875,7 +5919,7 @@ static s32 brcmf_dongle_roam(struct brcm + bcn_timeout = BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON; + err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout); + if (err) { +- bphy_err(wiphy, "bcn_timeout error (%d)\n", err); ++ bphy_err(drvr, "bcn_timeout error (%d)\n", err); + goto roam_setup_done; + } + +@@ -5887,7 +5931,7 @@ static s32 brcmf_dongle_roam(struct brcm + err = brcmf_fil_iovar_int_set(ifp, "roam_off", + ifp->drvr->settings->roamoff); + if (err) { +- bphy_err(wiphy, "roam_off error (%d)\n", err); ++ bphy_err(drvr, "roam_off error (%d)\n", err); + goto roam_setup_done; + } + +@@ -5896,7 +5940,7 @@ static s32 brcmf_dongle_roam(struct brcm + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_TRIGGER, + (void *)roamtrigger, sizeof(roamtrigger)); + if (err) { +- bphy_err(wiphy, "WLC_SET_ROAM_TRIGGER error (%d)\n", err); ++ bphy_err(drvr, "WLC_SET_ROAM_TRIGGER error (%d)\n", err); + goto roam_setup_done; + } + +@@ -5905,7 +5949,7 @@ static s32 brcmf_dongle_roam(struct brcm + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_DELTA, + (void *)roam_delta, sizeof(roam_delta)); + if (err) { +- bphy_err(wiphy, "WLC_SET_ROAM_DELTA error (%d)\n", err); ++ bphy_err(drvr, "WLC_SET_ROAM_DELTA error (%d)\n", err); + goto roam_setup_done; + } + +@@ -5916,26 +5960,26 @@ roam_setup_done: + static s32 + brcmf_dongle_scantime(struct brcmf_if *ifp) + { +- struct wiphy *wiphy = ifp->drvr->wiphy; ++ struct brcmf_pub *drvr = ifp->drvr; + s32 err = 0; + + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME, + BRCMF_SCAN_CHANNEL_TIME); + if (err) { +- bphy_err(wiphy, "Scan assoc time error (%d)\n", err); ++ bphy_err(drvr, "Scan assoc time error (%d)\n", err); + goto dongle_scantime_out; + } + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME, + BRCMF_SCAN_UNASSOC_TIME); + if (err) { +- bphy_err(wiphy, "Scan unassoc time error (%d)\n", err); ++ bphy_err(drvr, "Scan unassoc time error (%d)\n", err); + goto dongle_scantime_out; + } + + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_PASSIVE_TIME, + BRCMF_SCAN_PASSIVE_TIME); + if (err) { +- bphy_err(wiphy, "Scan passive time error (%d)\n", err); ++ bphy_err(drvr, "Scan passive time error (%d)\n", err); + goto dongle_scantime_out; + } + +@@ -5968,7 +6012,8 @@ static int brcmf_construct_chaninfo(stru + u32 bw_cap[]) + { + struct wiphy *wiphy = cfg_to_wiphy(cfg); +- struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); ++ struct brcmf_pub *drvr = cfg->pub; ++ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0); + struct ieee80211_supported_band *band; + struct ieee80211_channel *channel; + struct brcmf_chanspec_list *list; +@@ -5989,7 +6034,7 @@ static int brcmf_construct_chaninfo(stru + err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf, + BRCMF_DCMD_MEDLEN); + if (err) { +- bphy_err(wiphy, "get chanspecs error (%d)\n", err); ++ bphy_err(drvr, "get chanspecs error (%d)\n", err); + goto fail_pbuf; + } + +@@ -6012,7 +6057,7 @@ static int brcmf_construct_chaninfo(stru + } else if (ch.band == BRCMU_CHAN_BAND_5G) { + band = wiphy->bands[NL80211_BAND_5GHZ]; + } else { +- bphy_err(wiphy, "Invalid channel Spec. 0x%x.\n", ++ bphy_err(drvr, "Invalid channel Spec. 0x%x.\n", + ch.chspec); + continue; + } +@@ -6036,7 +6081,7 @@ static int brcmf_construct_chaninfo(stru + /* It seems firmware supports some channel we never + * considered. Something new in IEEE standard? + */ +- bphy_err(wiphy, "Ignoring unexpected firmware channel %d\n", ++ bphy_err(drvr, "Ignoring unexpected firmware channel %d\n", + ch.control_ch_num); + continue; + } +@@ -6093,8 +6138,8 @@ fail_pbuf: + + static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg) + { +- struct wiphy *wiphy = cfg_to_wiphy(cfg); +- struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); ++ struct brcmf_pub *drvr = cfg->pub; ++ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0); + struct ieee80211_supported_band *band; + struct brcmf_fil_bwcap_le band_bwcap; + struct brcmf_chanspec_list *list; +@@ -6140,7 +6185,7 @@ static int brcmf_enable_bw40_2g(struct b + err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf, + BRCMF_DCMD_MEDLEN); + if (err) { +- bphy_err(wiphy, "get chanspecs error (%d)\n", err); ++ bphy_err(drvr, "get chanspecs error (%d)\n", err); + kfree(pbuf); + return err; + } +@@ -6171,7 +6216,7 @@ static int brcmf_enable_bw40_2g(struct b + + static void brcmf_get_bwcap(struct brcmf_if *ifp, u32 bw_cap[]) + { +- struct wiphy *wiphy = ifp->drvr->wiphy; ++ struct brcmf_pub *drvr = ifp->drvr; + u32 band, mimo_bwcap; + int err; + +@@ -6207,7 +6252,7 @@ static void brcmf_get_bwcap(struct brcmf + bw_cap[NL80211_BAND_5GHZ] |= WLC_BW_20MHZ_BIT; + break; + default: +- bphy_err(wiphy, "invalid mimo_bw_cap value\n"); ++ bphy_err(drvr, "invalid mimo_bw_cap value\n"); + } + } + +@@ -6282,7 +6327,8 @@ static void brcmf_update_vht_cap(struct + + static int brcmf_setup_wiphybands(struct brcmf_cfg80211_info *cfg) + { +- struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); ++ struct brcmf_pub *drvr = cfg->pub; ++ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0); + struct wiphy *wiphy = cfg_to_wiphy(cfg); + u32 nmode = 0; + u32 vhtmode = 0; +@@ -6299,7 +6345,7 @@ static int brcmf_setup_wiphybands(struct + (void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode); + err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode); + if (err) { +- bphy_err(wiphy, "nmode error (%d)\n", err); ++ bphy_err(drvr, "nmode error (%d)\n", err); + } else { + brcmf_get_bwcap(ifp, bw_cap); + } +@@ -6309,7 +6355,7 @@ static int brcmf_setup_wiphybands(struct + + err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain); + if (err) { +- bphy_err(wiphy, "rxchain error (%d)\n", err); ++ bphy_err(drvr, "rxchain error (%d)\n", err); + nchain = 1; + } else { + for (nchain = 0; rxchain; nchain++) +@@ -6319,7 +6365,7 @@ static int brcmf_setup_wiphybands(struct + + err = brcmf_construct_chaninfo(cfg, bw_cap); + if (err) { +- bphy_err(wiphy, "brcmf_construct_chaninfo failed (%d)\n", err); ++ bphy_err(drvr, "brcmf_construct_chaninfo failed (%d)\n", err); + return err; + } + +@@ -6526,12 +6572,13 @@ static void brcmf_wiphy_wowl_params(stru + { + #ifdef CONFIG_PM + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); ++ struct brcmf_pub *drvr = cfg->pub; + struct wiphy_wowlan_support *wowl; + + wowl = kmemdup(&brcmf_wowlan_support, sizeof(brcmf_wowlan_support), + GFP_KERNEL); + if (!wowl) { +- bphy_err(wiphy, "only support basic wowlan features\n"); ++ bphy_err(drvr, "only support basic wowlan features\n"); + wiphy->wowlan = &brcmf_wowlan_support; + return; + } +@@ -6628,7 +6675,7 @@ static int brcmf_setup_wiphy(struct wiph + err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist, + sizeof(bandlist)); + if (err) { +- bphy_err(wiphy, "could not obtain band info: err=%d\n", err); ++ bphy_err(drvr, "could not obtain band info: err=%d\n", err); + return err; + } + /* first entry in bandlist is number of bands */ +@@ -6677,7 +6724,7 @@ static int brcmf_setup_wiphy(struct wiph + + static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg) + { +- struct wiphy *wiphy = cfg_to_wiphy(cfg); ++ struct brcmf_pub *drvr = cfg->pub; + struct net_device *ndev; + struct wireless_dev *wdev; + struct brcmf_if *ifp; +@@ -6715,7 +6762,7 @@ static s32 brcmf_config_dongle(struct br + + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_FAKEFRAG, 1); + if (err) { +- bphy_err(wiphy, "failed to set frameburst mode\n"); ++ bphy_err(drvr, "failed to set frameburst mode\n"); + goto default_conf_out; + } + +@@ -6896,6 +6943,7 @@ static void brcmf_cfg80211_reg_notifier( + { + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_fil_country_le ccreq; + s32 err; + int i; +@@ -6907,7 +6955,7 @@ static void brcmf_cfg80211_reg_notifier( + /* ignore non-ISO3166 country codes */ + for (i = 0; i < 2; i++) + if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') { +- bphy_err(wiphy, "not an ISO3166 code (0x%02x 0x%02x)\n", ++ bphy_err(drvr, "not an ISO3166 code (0x%02x 0x%02x)\n", + req->alpha2[0], req->alpha2[1]); + return; + } +@@ -6917,7 +6965,7 @@ static void brcmf_cfg80211_reg_notifier( + + err = brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq)); + if (err) { +- bphy_err(wiphy, "Country code iovar returned err = %d\n", err); ++ bphy_err(drvr, "Country code iovar returned err = %d\n", err); + return; + } + +@@ -6927,7 +6975,7 @@ static void brcmf_cfg80211_reg_notifier( + + err = brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq)); + if (err) { +- bphy_err(wiphy, "Firmware rejected country setting\n"); ++ bphy_err(drvr, "Firmware rejected country setting\n"); + return; + } + brcmf_setup_wiphybands(cfg); +@@ -6973,13 +7021,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + u16 *cap = NULL; + + if (!ndev) { +- bphy_err(wiphy, "ndev is invalid\n"); ++ bphy_err(drvr, "ndev is invalid\n"); + return NULL; + } + + cfg = kzalloc(sizeof(*cfg), GFP_KERNEL); + if (!cfg) { +- bphy_err(wiphy, "Could not allocate wiphy device\n"); ++ bphy_err(drvr, "Could not allocate wiphy device\n"); + return NULL; + } + +@@ -7000,7 +7048,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + + err = wl_init_priv(cfg); + if (err) { +- bphy_err(wiphy, "Failed to init iwm_priv (%d)\n", err); ++ bphy_err(drvr, "Failed to init iwm_priv (%d)\n", err); + brcmf_free_vif(vif); + goto wiphy_out; + } +@@ -7009,7 +7057,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + /* determine d11 io type before wiphy setup */ + err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_VERSION, &io_type); + if (err) { +- bphy_err(wiphy, "Failed to get D11 version (%d)\n", err); ++ bphy_err(drvr, "Failed to get D11 version (%d)\n", err); + goto priv_out; + } + cfg->d11inf.io_type = (u8)io_type; +@@ -7043,13 +7091,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + #endif + err = wiphy_register(wiphy); + if (err < 0) { +- bphy_err(wiphy, "Could not register wiphy device (%d)\n", err); ++ bphy_err(drvr, "Could not register wiphy device (%d)\n", err); + goto priv_out; + } + + err = brcmf_setup_wiphybands(cfg); + if (err) { +- bphy_err(wiphy, "Setting wiphy bands failed (%d)\n", err); ++ bphy_err(drvr, "Setting wiphy bands failed (%d)\n", err); + goto wiphy_unreg_out; + } + +@@ -7067,24 +7115,24 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + + err = brcmf_fweh_activate_events(ifp); + if (err) { +- bphy_err(wiphy, "FWEH activation failed (%d)\n", err); ++ bphy_err(drvr, "FWEH activation failed (%d)\n", err); + goto wiphy_unreg_out; + } + + err = brcmf_p2p_attach(cfg, p2pdev_forced); + if (err) { +- bphy_err(wiphy, "P2P initialisation failed (%d)\n", err); ++ bphy_err(drvr, "P2P initialisation failed (%d)\n", err); + goto wiphy_unreg_out; + } + err = brcmf_btcoex_attach(cfg); + if (err) { +- bphy_err(wiphy, "BT-coex initialisation failed (%d)\n", err); ++ bphy_err(drvr, "BT-coex initialisation failed (%d)\n", err); + brcmf_p2p_detach(&cfg->p2p); + goto wiphy_unreg_out; + } + err = brcmf_pno_attach(cfg); + if (err) { +- bphy_err(wiphy, "PNO initialisation failed (%d)\n", err); ++ bphy_err(drvr, "PNO initialisation failed (%d)\n", err); + brcmf_btcoex_detach(cfg); + brcmf_p2p_detach(&cfg->p2p); + goto wiphy_unreg_out; +@@ -7104,7 +7152,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + /* (re-) activate FWEH event handling */ + err = brcmf_fweh_activate_events(ifp); + if (err) { +- bphy_err(wiphy, "FWEH activation failed (%d)\n", err); ++ bphy_err(drvr, "FWEH activation failed (%d)\n", err); + goto detach; + } + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +@@ -62,12 +62,12 @@ void __brcmf_err(struct brcmf_bus *bus, + } while (0) + #endif + +-#define bphy_err(wiphy, fmt, ...) \ ++#define bphy_err(drvr, fmt, ...) \ + do { \ + if (IS_ENABLED(CPTCFG_BRCMDBG) || \ + IS_ENABLED(CPTCFG_BRCM_TRACING) || \ + net_ratelimit()) \ +- wiphy_err(wiphy, "%s: " fmt, __func__, \ ++ wiphy_err((drvr)->wiphy, "%s: " fmt, __func__, \ + ##__VA_ARGS__); \ + } while (0) + diff --git a/package/kernel/mac80211/patches/brcm/353-v5.1-brcmfmac-remove-set-but-not-used-variable-old_state.patch b/package/kernel/mac80211/patches/brcm/353-v5.1-brcmfmac-remove-set-but-not-used-variable-old_state.patch new file mode 100644 index 00000000000000..2a46378e73debc --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/353-v5.1-brcmfmac-remove-set-but-not-used-variable-old_state.patch @@ -0,0 +1,38 @@ +From e4d1b2716b8859199c28f2ac5f984bd05a146a6b Mon Sep 17 00:00:00 2001 +From: YueHaibing +Date: Mon, 18 Feb 2019 08:08:46 +0000 +Subject: [PATCH] brcmfmac: remove set but not used variable 'old_state' + +Fixes gcc '-Wunused-but-set-variable' warning: + +drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c: In function 'brcmf_usb_state_change': +drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c:578:6: warning: + variable 'old_state' set but not used [-Wunused-but-set-variable] + +It's never used and can be removed. + +Signed-off-by: YueHaibing +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 2 -- + 1 file changed, 2 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -575,7 +575,6 @@ static void + brcmf_usb_state_change(struct brcmf_usbdev_info *devinfo, int state) + { + struct brcmf_bus *bcmf_bus = devinfo->bus_pub.bus; +- int old_state; + + brcmf_dbg(USB, "Enter, current state=%d, new state=%d\n", + devinfo->bus_pub.state, state); +@@ -583,7 +582,6 @@ brcmf_usb_state_change(struct brcmf_usbd + if (devinfo->bus_pub.state == state) + return; + +- old_state = devinfo->bus_pub.state; + devinfo->bus_pub.state = state; + + /* update state of upper layer */ diff --git a/package/kernel/mac80211/patches/brcm/354-v5.1-brcmfmac-use-bphy_err-in-all-wiphy-related-code.patch b/package/kernel/mac80211/patches/brcm/354-v5.1-brcmfmac-use-bphy_err-in-all-wiphy-related-code.patch new file mode 100644 index 00000000000000..3d1bcd3d6ccbdb --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/354-v5.1-brcmfmac-use-bphy_err-in-all-wiphy-related-code.patch @@ -0,0 +1,1707 @@ +From dcb1471bc6d0541d636c7ecd9239573304842884 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 19 Feb 2019 23:42:19 +0100 +Subject: [PATCH] brcmfmac: use bphy_err() in all wiphy-related code +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This recently added macro provides more meaningful error messages thanks +to identifying a specific wiphy. It's especially important on systems +with few cards supported by the same (brcmfmac) driver. + +Signed-off-by: Rafał Miłecki +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/bcdc.c | 22 ++--- + .../broadcom/brcm80211/brcmfmac/common.c | 39 ++++---- + .../broadcom/brcm80211/brcmfmac/core.c | 74 ++++++++-------- + .../broadcom/brcm80211/brcmfmac/feature.c | 8 +- + .../broadcom/brcm80211/brcmfmac/fweh.c | 25 +++--- + .../broadcom/brcm80211/brcmfmac/fwil.c | 10 +-- + .../broadcom/brcm80211/brcmfmac/fwsignal.c | 38 ++++---- + .../broadcom/brcm80211/brcmfmac/msgbuf.c | 65 ++++++++------ + .../broadcom/brcm80211/brcmfmac/p2p.c | 88 +++++++++++-------- + .../broadcom/brcm80211/brcmfmac/pno.c | 22 +++-- + .../broadcom/brcm80211/brcmfmac/proto.c | 6 +- + 11 files changed, 224 insertions(+), 173 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c +@@ -178,8 +178,8 @@ brcmf_proto_bcdc_query_dcmd(struct brcmf + *fwerr = 0; + ret = brcmf_proto_bcdc_msg(drvr, ifidx, cmd, buf, len, false); + if (ret < 0) { +- brcmf_err("brcmf_proto_bcdc_msg failed w/status %d\n", +- ret); ++ bphy_err(drvr, "brcmf_proto_bcdc_msg failed w/status %d\n", ++ ret); + goto done; + } + +@@ -195,9 +195,9 @@ retry: + if ((id < bcdc->reqid) && (++retries < RETRIES)) + goto retry; + if (id != bcdc->reqid) { +- brcmf_err("%s: unexpected request id %d (expected %d)\n", +- brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id, +- bcdc->reqid); ++ bphy_err(drvr, "%s: unexpected request id %d (expected %d)\n", ++ brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id, ++ bcdc->reqid); + ret = -EINVAL; + goto done; + } +@@ -245,9 +245,9 @@ brcmf_proto_bcdc_set_dcmd(struct brcmf_p + id = (flags & BCDC_DCMD_ID_MASK) >> BCDC_DCMD_ID_SHIFT; + + if (id != bcdc->reqid) { +- brcmf_err("%s: unexpected request id %d (expected %d)\n", +- brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id, +- bcdc->reqid); ++ bphy_err(drvr, "%s: unexpected request id %d (expected %d)\n", ++ brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id, ++ bcdc->reqid); + ret = -EINVAL; + goto done; + } +@@ -312,8 +312,8 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu + } + if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) != + BCDC_PROTO_VER) { +- brcmf_err("%s: non-BCDC packet received, flags 0x%x\n", +- brcmf_ifname(tmp_if), h->flags); ++ bphy_err(drvr, "%s: non-BCDC packet received, flags 0x%x\n", ++ brcmf_ifname(tmp_if), h->flags); + return -EBADE; + } + +@@ -460,7 +460,7 @@ int brcmf_proto_bcdc_attach(struct brcmf + + /* ensure that the msg buf directly follows the cdc msg struct */ + if ((unsigned long)(&bcdc->msg + 1) != (unsigned long)bcdc->buf) { +- brcmf_err("struct brcmf_proto_bcdc is not correctly defined\n"); ++ bphy_err(drvr, "struct brcmf_proto_bcdc is not correctly defined\n"); + goto fail; + } + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -90,6 +90,7 @@ struct brcmf_mp_global_t brcmf_mp_global + + void brcmf_c_set_joinpref_default(struct brcmf_if *ifp) + { ++ struct brcmf_pub *drvr = ifp->drvr; + struct brcmf_join_pref_params join_pref_params[2]; + int err; + +@@ -106,7 +107,7 @@ void brcmf_c_set_joinpref_default(struct + err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params, + sizeof(join_pref_params)); + if (err) +- brcmf_err("Set join_pref error (%d)\n", err); ++ bphy_err(drvr, "Set join_pref error (%d)\n", err); + } + + static int brcmf_c_download(struct brcmf_if *ifp, u16 flag, +@@ -129,7 +130,8 @@ static int brcmf_c_download(struct brcmf + + static int brcmf_c_process_clm_blob(struct brcmf_if *ifp) + { +- struct brcmf_bus *bus = ifp->drvr->bus_if; ++ struct brcmf_pub *drvr = ifp->drvr; ++ struct brcmf_bus *bus = drvr->bus_if; + struct brcmf_dload_data_le *chunk_buf; + const struct firmware *clm = NULL; + u8 clm_name[BRCMF_FW_NAME_LEN]; +@@ -145,7 +147,7 @@ static int brcmf_c_process_clm_blob(stru + memset(clm_name, 0, sizeof(clm_name)); + err = brcmf_bus_get_fwname(bus, ".clm_blob", clm_name); + if (err) { +- brcmf_err("get CLM blob file name failed (%d)\n", err); ++ bphy_err(drvr, "get CLM blob file name failed (%d)\n", err); + return err; + } + +@@ -182,12 +184,12 @@ static int brcmf_c_process_clm_blob(stru + } while ((datalen > 0) && (err == 0)); + + if (err) { +- brcmf_err("clmload (%zu byte file) failed (%d); ", +- clm->size, err); ++ bphy_err(drvr, "clmload (%zu byte file) failed (%d)\n", ++ clm->size, err); + /* Retrieve clmload_status and print */ + err = brcmf_fil_iovar_int_get(ifp, "clmload_status", &status); + if (err) +- brcmf_err("get clmload_status failed (%d)\n", err); ++ bphy_err(drvr, "get clmload_status failed (%d)\n", err); + else + brcmf_dbg(INFO, "clmload_status=%d\n", status); + err = -EIO; +@@ -201,6 +203,7 @@ done: + + int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) + { ++ struct brcmf_pub *drvr = ifp->drvr; + s8 eventmask[BRCMF_EVENTING_MASK_LEN]; + u8 buf[BRCMF_DCMD_SMLEN]; + struct brcmf_bus *bus; +@@ -214,7 +217,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr, + sizeof(ifp->mac_addr)); + if (err < 0) { +- brcmf_err("Retrieving cur_etheraddr failed, %d\n", err); ++ bphy_err(drvr, "Retrieving cur_etheraddr failed, %d\n", err); + goto done; + } + memcpy(ifp->drvr->wiphy->perm_addr, ifp->drvr->mac, ETH_ALEN); +@@ -226,7 +229,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_REVINFO, + &revinfo, sizeof(revinfo)); + if (err < 0) { +- brcmf_err("retrieving revision info failed, %d\n", err); ++ bphy_err(drvr, "retrieving revision info failed, %d\n", err); + strlcpy(ri->chipname, "UNKNOWN", sizeof(ri->chipname)); + } else { + ri->vendorid = le32_to_cpu(revinfo.vendorid); +@@ -260,7 +263,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + /* Do any CLM downloading */ + err = brcmf_c_process_clm_blob(ifp); + if (err < 0) { +- brcmf_err("download CLM blob file failed, %d\n", err); ++ bphy_err(drvr, "download CLM blob file failed, %d\n", err); + goto done; + } + +@@ -269,8 +272,8 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + strcpy(buf, "ver"); + err = brcmf_fil_iovar_data_get(ifp, "ver", buf, sizeof(buf)); + if (err < 0) { +- brcmf_err("Retrieving version information failed, %d\n", +- err); ++ bphy_err(drvr, "Retrieving version information failed, %d\n", ++ err); + goto done; + } + ptr = (char *)buf; +@@ -304,7 +307,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + /* set mpc */ + err = brcmf_fil_iovar_int_set(ifp, "mpc", 1); + if (err) { +- brcmf_err("failed setting mpc\n"); ++ bphy_err(drvr, "failed setting mpc\n"); + goto done; + } + +@@ -314,14 +317,14 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + err = brcmf_fil_iovar_data_get(ifp, "event_msgs", eventmask, + BRCMF_EVENTING_MASK_LEN); + if (err) { +- brcmf_err("Get event_msgs error (%d)\n", err); ++ bphy_err(drvr, "Get event_msgs error (%d)\n", err); + goto done; + } + setbit(eventmask, BRCMF_E_IF); + err = brcmf_fil_iovar_data_set(ifp, "event_msgs", eventmask, + BRCMF_EVENTING_MASK_LEN); + if (err) { +- brcmf_err("Set event_msgs error (%d)\n", err); ++ bphy_err(drvr, "Set event_msgs error (%d)\n", err); + goto done; + } + +@@ -329,8 +332,8 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME, + BRCMF_DEFAULT_SCAN_CHANNEL_TIME); + if (err) { +- brcmf_err("BRCMF_C_SET_SCAN_CHANNEL_TIME error (%d)\n", +- err); ++ bphy_err(drvr, "BRCMF_C_SET_SCAN_CHANNEL_TIME error (%d)\n", ++ err); + goto done; + } + +@@ -338,8 +341,8 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME, + BRCMF_DEFAULT_SCAN_UNASSOC_TIME); + if (err) { +- brcmf_err("BRCMF_C_SET_SCAN_UNASSOC_TIME error (%d)\n", +- err); ++ bphy_err(drvr, "BRCMF_C_SET_SCAN_UNASSOC_TIME error (%d)\n", ++ err); + goto done; + } + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -90,7 +90,7 @@ struct brcmf_if *brcmf_get_ifp(struct br + s32 bsscfgidx; + + if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) { +- brcmf_err("ifidx %d out of range\n", ifidx); ++ bphy_err(drvr, "ifidx %d out of range\n", ifidx); + return NULL; + } + +@@ -141,7 +141,9 @@ void brcmf_configure_arp_nd_offload(stru + + static void _brcmf_set_multicast_list(struct work_struct *work) + { +- struct brcmf_if *ifp; ++ struct brcmf_if *ifp = container_of(work, struct brcmf_if, ++ multicast_work); ++ struct brcmf_pub *drvr = ifp->drvr; + struct net_device *ndev; + struct netdev_hw_addr *ha; + u32 cmd_value, cnt; +@@ -150,8 +152,6 @@ static void _brcmf_set_multicast_list(st + u32 buflen; + s32 err; + +- ifp = container_of(work, struct brcmf_if, multicast_work); +- + brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx); + + ndev = ifp->ndev; +@@ -181,7 +181,7 @@ static void _brcmf_set_multicast_list(st + + err = brcmf_fil_iovar_data_set(ifp, "mcast_list", buf, buflen); + if (err < 0) { +- brcmf_err("Setting mcast_list failed, %d\n", err); ++ bphy_err(drvr, "Setting mcast_list failed, %d\n", err); + cmd_value = cnt ? true : cmd_value; + } + +@@ -194,25 +194,25 @@ static void _brcmf_set_multicast_list(st + */ + err = brcmf_fil_iovar_int_set(ifp, "allmulti", cmd_value); + if (err < 0) +- brcmf_err("Setting allmulti failed, %d\n", err); ++ bphy_err(drvr, "Setting allmulti failed, %d\n", err); + + /*Finally, pick up the PROMISC flag */ + cmd_value = (ndev->flags & IFF_PROMISC) ? true : false; + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PROMISC, cmd_value); + if (err < 0) +- brcmf_err("Setting BRCMF_C_SET_PROMISC failed, %d\n", +- err); ++ bphy_err(drvr, "Setting BRCMF_C_SET_PROMISC failed, %d\n", ++ err); + brcmf_configure_arp_nd_offload(ifp, !cmd_value); + } + + #if IS_ENABLED(CONFIG_IPV6) + static void _brcmf_update_ndtable(struct work_struct *work) + { +- struct brcmf_if *ifp; ++ struct brcmf_if *ifp = container_of(work, struct brcmf_if, ++ ndoffload_work); ++ struct brcmf_pub *drvr = ifp->drvr; + int i, ret; + +- ifp = container_of(work, struct brcmf_if, ndoffload_work); +- + /* clear the table in firmware */ + ret = brcmf_fil_iovar_data_set(ifp, "nd_hostip_clear", NULL, 0); + if (ret) { +@@ -225,7 +225,7 @@ static void _brcmf_update_ndtable(struct + &ifp->ipv6_addr_tbl[i], + sizeof(struct in6_addr)); + if (ret) +- brcmf_err("add nd ip err %d\n", ret); ++ bphy_err(drvr, "add nd ip err %d\n", ret); + } + } + #else +@@ -238,6 +238,7 @@ static int brcmf_netdev_set_mac_address( + { + struct brcmf_if *ifp = netdev_priv(ndev); + struct sockaddr *sa = (struct sockaddr *)addr; ++ struct brcmf_pub *drvr = ifp->drvr; + int err; + + brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx); +@@ -245,7 +246,7 @@ static int brcmf_netdev_set_mac_address( + err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", sa->sa_data, + ETH_ALEN); + if (err < 0) { +- brcmf_err("Setting cur_etheraddr failed, %d\n", err); ++ bphy_err(drvr, "Setting cur_etheraddr failed, %d\n", err); + } else { + brcmf_dbg(TRACE, "updated to %pM\n", sa->sa_data); + memcpy(ifp->mac_addr, sa->sa_data, ETH_ALEN); +@@ -305,7 +306,7 @@ static netdev_tx_t brcmf_netdev_start_xm + + /* Can the device send data? */ + if (drvr->bus_if->state != BRCMF_BUS_UP) { +- brcmf_err("xmit rejected state=%d\n", drvr->bus_if->state); ++ bphy_err(drvr, "xmit rejected state=%d\n", drvr->bus_if->state); + netif_stop_queue(ndev); + dev_kfree_skb(skb); + ret = -ENODEV; +@@ -339,8 +340,8 @@ static netdev_tx_t brcmf_netdev_start_xm + ret = pskb_expand_head(skb, ALIGN(head_delta, NET_SKB_PAD), 0, + GFP_ATOMIC); + if (ret < 0) { +- brcmf_err("%s: failed to expand headroom\n", +- brcmf_ifname(ifp)); ++ bphy_err(drvr, "%s: failed to expand headroom\n", ++ brcmf_ifname(ifp)); + atomic_inc(&drvr->bus_if->stats.pktcow_failed); + goto done; + } +@@ -607,7 +608,7 @@ static int brcmf_netdev_open(struct net_ + + /* If bus is not ready, can't continue */ + if (bus_if->state != BRCMF_BUS_UP) { +- brcmf_err("failed bus is not ready\n"); ++ bphy_err(drvr, "failed bus is not ready\n"); + return -EAGAIN; + } + +@@ -621,7 +622,7 @@ static int brcmf_netdev_open(struct net_ + ndev->features &= ~NETIF_F_IP_CSUM; + + if (brcmf_cfg80211_up(ndev)) { +- brcmf_err("failed to bring up cfg80211\n"); ++ bphy_err(drvr, "failed to bring up cfg80211\n"); + return -EIO; + } + +@@ -683,7 +684,7 @@ int brcmf_net_attach(struct brcmf_if *if + else + err = register_netdev(ndev); + if (err != 0) { +- brcmf_err("couldn't register the net device\n"); ++ bphy_err(drvr, "couldn't register the net device\n"); + goto fail; + } + +@@ -760,6 +761,7 @@ static const struct net_device_ops brcmf + + static int brcmf_net_p2p_attach(struct brcmf_if *ifp) + { ++ struct brcmf_pub *drvr = ifp->drvr; + struct net_device *ndev; + + brcmf_dbg(TRACE, "Enter, bsscfgidx=%d mac=%pM\n", ifp->bsscfgidx, +@@ -772,7 +774,7 @@ static int brcmf_net_p2p_attach(struct b + memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN); + + if (register_netdev(ndev) != 0) { +- brcmf_err("couldn't register the p2p net device\n"); ++ bphy_err(drvr, "couldn't register the p2p net device\n"); + goto fail; + } + +@@ -801,8 +803,8 @@ struct brcmf_if *brcmf_add_if(struct brc + */ + if (ifp) { + if (ifidx) { +- brcmf_err("ERROR: netdev:%s already exists\n", +- ifp->ndev->name); ++ bphy_err(drvr, "ERROR: netdev:%s already exists\n", ++ ifp->ndev->name); + netif_stop_queue(ifp->ndev); + brcmf_net_detach(ifp->ndev, false); + drvr->iflist[bsscfgidx] = NULL; +@@ -864,7 +866,7 @@ static void brcmf_del_if(struct brcmf_pu + + ifp = drvr->iflist[bsscfgidx]; + if (!ifp) { +- brcmf_err("Null interface, bsscfgidx=%d\n", bsscfgidx); ++ bphy_err(drvr, "Null interface, bsscfgidx=%d\n", bsscfgidx); + return; + } + brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", bsscfgidx, +@@ -918,16 +920,17 @@ static int brcmf_psm_watchdog_notify(str + const struct brcmf_event_msg *evtmsg, + void *data) + { ++ struct brcmf_pub *drvr = ifp->drvr; + int err; + + brcmf_dbg(TRACE, "enter: bsscfgidx=%d\n", ifp->bsscfgidx); + +- brcmf_err("PSM's watchdog has fired!\n"); ++ bphy_err(drvr, "PSM's watchdog has fired!\n"); + + err = brcmf_debug_create_memdump(ifp->drvr->bus_if, data, + evtmsg->datalen); + if (err) +- brcmf_err("Failed to get memory dump, %d\n", err); ++ bphy_err(drvr, "Failed to get memory dump, %d\n", err); + + return err; + } +@@ -971,7 +974,7 @@ static int brcmf_inetaddr_changed(struct + ret = brcmf_fil_iovar_data_get(ifp, "arp_hostip", addr_table, + sizeof(addr_table)); + if (ret) { +- brcmf_err("fail to get arp ip table err:%d\n", ret); ++ bphy_err(drvr, "fail to get arp ip table err:%d\n", ret); + return NOTIFY_OK; + } + +@@ -988,7 +991,7 @@ static int brcmf_inetaddr_changed(struct + ret = brcmf_fil_iovar_data_set(ifp, "arp_hostip", + &ifa->ifa_address, sizeof(ifa->ifa_address)); + if (ret) +- brcmf_err("add arp ip err %d\n", ret); ++ bphy_err(drvr, "add arp ip err %d\n", ret); + } + break; + case NETDEV_DOWN: +@@ -1000,8 +1003,8 @@ static int brcmf_inetaddr_changed(struct + ret = brcmf_fil_iovar_data_set(ifp, "arp_hostip_clear", + NULL, 0); + if (ret) { +- brcmf_err("fail to clear arp ip table err:%d\n", +- ret); ++ bphy_err(drvr, "fail to clear arp ip table err:%d\n", ++ ret); + return NOTIFY_OK; + } + for (i = 0; i < ARPOL_MAX_ENTRIES; i++) { +@@ -1011,8 +1014,8 @@ static int brcmf_inetaddr_changed(struct + &addr_table[i], + sizeof(addr_table[i])); + if (ret) +- brcmf_err("add arp ip err %d\n", +- ret); ++ bphy_err(drvr, "add arp ip err %d\n", ++ ret); + } + } + break; +@@ -1186,7 +1189,7 @@ static int brcmf_bus_started(struct brcm + return 0; + + fail: +- brcmf_err("failed: %d\n", ret); ++ bphy_err(drvr, "failed: %d\n", ret); + if (drvr->config) { + brcmf_cfg80211_detach(drvr->config); + drvr->config = NULL; +@@ -1238,7 +1241,7 @@ int brcmf_attach(struct device *dev, str + /* Attach and link in the protocol */ + ret = brcmf_proto_attach(drvr); + if (ret != 0) { +- brcmf_err("brcmf_prot_attach failed\n"); ++ bphy_err(drvr, "brcmf_prot_attach failed\n"); + goto fail; + } + +@@ -1251,7 +1254,7 @@ int brcmf_attach(struct device *dev, str + + ret = brcmf_bus_started(drvr, ops); + if (ret != 0) { +- brcmf_err("dongle is not responding: err=%d\n", ret); ++ bphy_err(drvr, "dongle is not responding: err=%d\n", ret); + goto fail; + } + +@@ -1358,6 +1361,7 @@ static int brcmf_get_pend_8021x_cnt(stru + + int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp) + { ++ struct brcmf_pub *drvr = ifp->drvr; + int err; + + err = wait_event_timeout(ifp->pend_8021x_wait, +@@ -1365,7 +1369,7 @@ int brcmf_netdev_wait_pend8021x(struct b + MAX_WAIT_FOR_8021X_TX); + + if (!err) +- brcmf_err("Timed out waiting for no pending 802.1x packets\n"); ++ bphy_err(drvr, "Timed out waiting for no pending 802.1x packets\n"); + + return !err; + } +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +@@ -185,13 +185,14 @@ static void brcmf_feat_iovar_data_set(st + #define MAX_CAPS_BUFFER_SIZE 768 + static void brcmf_feat_firmware_capabilities(struct brcmf_if *ifp) + { ++ struct brcmf_pub *drvr = ifp->drvr; + char caps[MAX_CAPS_BUFFER_SIZE]; + enum brcmf_feat_id id; + int i, err; + + err = brcmf_fil_iovar_data_get(ifp, "cap", caps, sizeof(caps)); + if (err) { +- brcmf_err("could not get firmware cap (%d)\n", err); ++ bphy_err(drvr, "could not get firmware cap (%d)\n", err); + return; + } + +@@ -216,14 +217,15 @@ static void brcmf_feat_firmware_capabili + static int brcmf_feat_fwcap_debugfs_read(struct seq_file *seq, void *data) + { + struct brcmf_bus *bus_if = dev_get_drvdata(seq->private); +- struct brcmf_if *ifp = brcmf_get_ifp(bus_if->drvr, 0); ++ struct brcmf_pub *drvr = bus_if->drvr; ++ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0); + char caps[MAX_CAPS_BUFFER_SIZE + 1] = { }; + char *tmp; + int err; + + err = brcmf_fil_iovar_data_get(ifp, "cap", caps, sizeof(caps)); + if (err) { +- brcmf_err("could not get firmware cap (%d)\n", err); ++ bphy_err(drvr, "could not get firmware cap (%d)\n", err); + return err; + } + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c +@@ -102,7 +102,8 @@ static void brcmf_fweh_queue_event(struc + schedule_work(&fweh->event_work); + } + +-static int brcmf_fweh_call_event_handler(struct brcmf_if *ifp, ++static int brcmf_fweh_call_event_handler(struct brcmf_pub *drvr, ++ struct brcmf_if *ifp, + enum brcmf_fweh_event_code code, + struct brcmf_event_msg *emsg, + void *data) +@@ -117,9 +118,9 @@ static int brcmf_fweh_call_event_handler + if (fweh->evt_handler[code]) + err = fweh->evt_handler[code](ifp, emsg, data); + else +- brcmf_err("unhandled event %d ignored\n", code); ++ bphy_err(drvr, "unhandled event %d ignored\n", code); + } else { +- brcmf_err("no interface object\n"); ++ bphy_err(drvr, "no interface object\n"); + } + return err; + } +@@ -158,7 +159,7 @@ static void brcmf_fweh_handle_if_event(s + return; + } + if (ifevent->ifidx >= BRCMF_MAX_IFS) { +- brcmf_err("invalid interface index: %u\n", ifevent->ifidx); ++ bphy_err(drvr, "invalid interface index: %u\n", ifevent->ifidx); + return; + } + +@@ -181,7 +182,8 @@ static void brcmf_fweh_handle_if_event(s + if (ifp && ifevent->action == BRCMF_E_IF_CHANGE) + brcmf_proto_reset_if(drvr, ifp); + +- err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data); ++ err = brcmf_fweh_call_event_handler(drvr, ifp, emsg->event_code, emsg, ++ data); + + if (ifp && ifevent->action == BRCMF_E_IF_DEL) { + bool armed = brcmf_cfg80211_vif_event_armed(drvr->config); +@@ -268,11 +270,11 @@ static void brcmf_fweh_event_worker(stru + ifp = drvr->iflist[0]; + else + ifp = drvr->iflist[emsg.bsscfgidx]; +- err = brcmf_fweh_call_event_handler(ifp, event->code, &emsg, +- event->data); ++ err = brcmf_fweh_call_event_handler(drvr, ifp, event->code, ++ &emsg, event->data); + if (err) { +- brcmf_err("event handler failed (%d)\n", +- event->code); ++ bphy_err(drvr, "event handler failed (%d)\n", ++ event->code); + err = 0; + } + event_free: +@@ -339,7 +341,7 @@ int brcmf_fweh_register(struct brcmf_pub + brcmf_fweh_handler_t handler) + { + if (drvr->fweh.evt_handler[code]) { +- brcmf_err("event code %d already registered\n", code); ++ bphy_err(drvr, "event code %d already registered\n", code); + return -ENOSPC; + } + drvr->fweh.evt_handler[code] = handler; +@@ -369,6 +371,7 @@ void brcmf_fweh_unregister(struct brcmf_ + */ + int brcmf_fweh_activate_events(struct brcmf_if *ifp) + { ++ struct brcmf_pub *drvr = ifp->drvr; + int i, err; + s8 eventmask[BRCMF_EVENTING_MASK_LEN]; + +@@ -388,7 +391,7 @@ int brcmf_fweh_activate_events(struct br + err = brcmf_fil_iovar_data_set(ifp, "event_msgs", + eventmask, BRCMF_EVENTING_MASK_LEN); + if (err) +- brcmf_err("Set event_msgs error (%d)\n", err); ++ bphy_err(drvr, "Set event_msgs error (%d)\n", err); + + return err; + } +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c +@@ -110,7 +110,7 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp, + s32 err, fwerr; + + if (drvr->bus_if->state != BRCMF_BUS_UP) { +- brcmf_err("bus is down. we have nothing to do.\n"); ++ bphy_err(drvr, "bus is down. we have nothing to do.\n"); + return -EIO; + } + +@@ -242,7 +242,7 @@ brcmf_fil_iovar_data_set(struct brcmf_if + buflen, true); + } else { + err = -EPERM; +- brcmf_err("Creating iovar failed\n"); ++ bphy_err(drvr, "Creating iovar failed\n"); + } + + mutex_unlock(&drvr->proto_block); +@@ -268,7 +268,7 @@ brcmf_fil_iovar_data_get(struct brcmf_if + memcpy(data, drvr->proto_buf, len); + } else { + err = -EPERM; +- brcmf_err("Creating iovar failed\n"); ++ bphy_err(drvr, "Creating iovar failed\n"); + } + + brcmf_dbg(FIL, "ifidx=%d, name=%s, len=%d\n", ifp->ifidx, name, len); +@@ -366,7 +366,7 @@ brcmf_fil_bsscfg_data_set(struct brcmf_i + buflen, true); + } else { + err = -EPERM; +- brcmf_err("Creating bsscfg failed\n"); ++ bphy_err(drvr, "Creating bsscfg failed\n"); + } + + mutex_unlock(&drvr->proto_block); +@@ -392,7 +392,7 @@ brcmf_fil_bsscfg_data_get(struct brcmf_i + memcpy(data, drvr->proto_buf, len); + } else { + err = -EPERM; +- brcmf_err("Creating bsscfg failed\n"); ++ bphy_err(drvr, "Creating bsscfg failed\n"); + } + brcmf_dbg(FIL, "ifidx=%d, bsscfgidx=%d, name=%s, len=%d\n", ifp->ifidx, + ifp->bsscfgidx, name, len); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c +@@ -1259,6 +1259,7 @@ static int brcmf_fws_enq(struct brcmf_fw + enum brcmf_fws_skb_state state, int fifo, + struct sk_buff *p) + { ++ struct brcmf_pub *drvr = fws->drvr; + int prec = 2 * fifo; + u32 *qfull_stat = &fws->stats.delayq_full_error; + struct brcmf_fws_mac_descriptor *entry; +@@ -1271,7 +1272,7 @@ static int brcmf_fws_enq(struct brcmf_fw + + entry = brcmf_skbcb(p)->mac; + if (entry == NULL) { +- brcmf_err("no mac descriptor found for skb %p\n", p); ++ bphy_err(drvr, "no mac descriptor found for skb %p\n", p); + return -ENOENT; + } + +@@ -1461,6 +1462,7 @@ static int + brcmf_fws_txs_process(struct brcmf_fws_info *fws, u8 flags, u32 hslot, + u32 genbit, u16 seq, u8 compcnt) + { ++ struct brcmf_pub *drvr = fws->drvr; + u32 fifo; + u8 cnt = 0; + int ret; +@@ -1485,14 +1487,14 @@ brcmf_fws_txs_process(struct brcmf_fws_i + else if (flags == BRCMF_FWS_TXSTATUS_HOST_TOSSED) + fws->stats.txs_host_tossed += compcnt; + else +- brcmf_err("unexpected txstatus\n"); ++ bphy_err(drvr, "unexpected txstatus\n"); + + while (cnt < compcnt) { + ret = brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb, + remove_from_hanger); + if (ret != 0) { +- brcmf_err("no packet in hanger slot: hslot=%d\n", +- hslot); ++ bphy_err(drvr, "no packet in hanger slot: hslot=%d\n", ++ hslot); + goto cont; + } + +@@ -1616,12 +1618,13 @@ static int brcmf_fws_notify_credit_map(s + const struct brcmf_event_msg *e, + void *data) + { +- struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr); ++ struct brcmf_pub *drvr = ifp->drvr; ++ struct brcmf_fws_info *fws = drvr_to_fws(drvr); + int i; + u8 *credits = data; + + if (e->datalen < BRCMF_FWS_FIFO_COUNT) { +- brcmf_err("event payload too small (%d)\n", e->datalen); ++ bphy_err(drvr, "event payload too small (%d)\n", e->datalen); + return -EINVAL; + } + +@@ -1685,6 +1688,7 @@ static void brcmf_rxreorder_get_skb_list + + void brcmf_fws_rxreorder(struct brcmf_if *ifp, struct sk_buff *pkt) + { ++ struct brcmf_pub *drvr = ifp->drvr; + u8 *reorder_data; + u8 flow_id, max_idx, cur_idx, exp_idx, end_idx; + struct brcmf_ampdu_rx_reorder *rfi; +@@ -1699,7 +1703,7 @@ void brcmf_fws_rxreorder(struct brcmf_if + + /* validate flags and flow id */ + if (flags == 0xFF) { +- brcmf_err("invalid flags...so ignore this packet\n"); ++ bphy_err(drvr, "invalid flags...so ignore this packet\n"); + brcmf_netif_rx(ifp, pkt); + return; + } +@@ -1736,7 +1740,7 @@ void brcmf_fws_rxreorder(struct brcmf_if + flow_id, max_idx); + rfi = kzalloc(buf_size, GFP_ATOMIC); + if (rfi == NULL) { +- brcmf_err("failed to alloc buffer\n"); ++ bphy_err(drvr, "failed to alloc buffer\n"); + brcmf_netif_rx(ifp, pkt); + return; + } +@@ -2000,6 +2004,7 @@ static u8 brcmf_fws_precommit_skb(struct + static void brcmf_fws_rollback_toq(struct brcmf_fws_info *fws, + struct sk_buff *skb, int fifo) + { ++ struct brcmf_pub *drvr = fws->drvr; + struct brcmf_fws_mac_descriptor *entry; + struct sk_buff *pktout; + int qidx, hslot; +@@ -2013,11 +2018,11 @@ static void brcmf_fws_rollback_toq(struc + + pktout = brcmu_pktq_penq_head(&entry->psq, qidx, skb); + if (pktout == NULL) { +- brcmf_err("%s queue %d full\n", entry->name, qidx); ++ bphy_err(drvr, "%s queue %d full\n", entry->name, qidx); + rc = -ENOSPC; + } + } else { +- brcmf_err("%s entry removed\n", entry->name); ++ bphy_err(drvr, "%s entry removed\n", entry->name); + rc = -ENOENT; + } + +@@ -2122,7 +2127,8 @@ static int brcmf_fws_assign_htod(struct + + int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb) + { +- struct brcmf_fws_info *fws = drvr_to_fws(ifp->drvr); ++ struct brcmf_pub *drvr = ifp->drvr; ++ struct brcmf_fws_info *fws = drvr_to_fws(drvr); + struct brcmf_skbuff_cb *skcb = brcmf_skbcb(skb); + struct ethhdr *eh = (struct ethhdr *)(skb->data); + int fifo = BRCMF_FWS_FIFO_BCMC; +@@ -2150,7 +2156,7 @@ int brcmf_fws_process_skb(struct brcmf_i + brcmf_fws_enq(fws, BRCMF_FWS_SKBSTATE_DELAYED, fifo, skb); + brcmf_fws_schedule_deq(fws); + } else { +- brcmf_err("drop skb: no hanger slot\n"); ++ bphy_err(drvr, "drop skb: no hanger slot\n"); + brcmf_txfinalize(ifp, skb, false); + rc = -ENOMEM; + } +@@ -2371,7 +2377,7 @@ struct brcmf_fws_info *brcmf_fws_attach( + + fws->fws_wq = create_singlethread_workqueue("brcmf_fws_wq"); + if (fws->fws_wq == NULL) { +- brcmf_err("workqueue creation failed\n"); ++ bphy_err(drvr, "workqueue creation failed\n"); + rc = -EBADF; + goto fail; + } +@@ -2387,13 +2393,13 @@ struct brcmf_fws_info *brcmf_fws_attach( + rc = brcmf_fweh_register(drvr, BRCMF_E_FIFO_CREDIT_MAP, + brcmf_fws_notify_credit_map); + if (rc < 0) { +- brcmf_err("register credit map handler failed\n"); ++ bphy_err(drvr, "register credit map handler failed\n"); + goto fail; + } + rc = brcmf_fweh_register(drvr, BRCMF_E_BCMC_CREDIT_SUPPORT, + brcmf_fws_notify_bcmc_credit_support); + if (rc < 0) { +- brcmf_err("register bcmc credit handler failed\n"); ++ bphy_err(drvr, "register bcmc credit handler failed\n"); + brcmf_fweh_unregister(drvr, BRCMF_E_FIFO_CREDIT_MAP); + goto fail; + } +@@ -2405,7 +2411,7 @@ struct brcmf_fws_info *brcmf_fws_attach( + fws->fw_signals = true; + ifp = brcmf_get_ifp(drvr, 0); + if (brcmf_fil_iovar_int_set(ifp, "tlv", tlv)) { +- brcmf_err("failed to set bdcv2 tlv signaling\n"); ++ bphy_err(drvr, "failed to set bdcv2 tlv signaling\n"); + fws->fcmode = BRCMF_FWS_FCMODE_NONE; + fws->fw_signals = false; + } +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +@@ -439,7 +439,7 @@ static int brcmf_msgbuf_tx_ioctl(struct + brcmf_commonring_lock(commonring); + ret_ptr = brcmf_commonring_reserve_for_write(commonring); + if (!ret_ptr) { +- brcmf_err("Failed to reserve space in commonring\n"); ++ bphy_err(drvr, "Failed to reserve space in commonring\n"); + brcmf_commonring_unlock(commonring); + return -ENOMEM; + } +@@ -503,7 +503,7 @@ static int brcmf_msgbuf_query_dcmd(struc + + timeout = brcmf_msgbuf_ioctl_resp_wait(msgbuf); + if (!timeout) { +- brcmf_err("Timeout on response for query command\n"); ++ bphy_err(drvr, "Timeout on response for query command\n"); + return -EIO; + } + +@@ -580,6 +580,7 @@ static u32 + brcmf_msgbuf_flowring_create_worker(struct brcmf_msgbuf *msgbuf, + struct brcmf_msgbuf_work_item *work) + { ++ struct brcmf_pub *drvr = msgbuf->drvr; + struct msgbuf_tx_flowring_create_req *create; + struct brcmf_commonring *commonring; + void *ret_ptr; +@@ -595,7 +596,7 @@ brcmf_msgbuf_flowring_create_worker(stru + &msgbuf->flowring_dma_handle[flowid], + GFP_KERNEL); + if (!dma_buf) { +- brcmf_err("dma_alloc_coherent failed\n"); ++ bphy_err(drvr, "dma_alloc_coherent failed\n"); + brcmf_flowring_delete(msgbuf->flow, flowid); + return BRCMF_FLOWRING_INVALID_ID; + } +@@ -608,7 +609,7 @@ brcmf_msgbuf_flowring_create_worker(stru + brcmf_commonring_lock(commonring); + ret_ptr = brcmf_commonring_reserve_for_write(commonring); + if (!ret_ptr) { +- brcmf_err("Failed to reserve space in commonring\n"); ++ bphy_err(drvr, "Failed to reserve space in commonring\n"); + brcmf_commonring_unlock(commonring); + brcmf_msgbuf_remove_flowring(msgbuf, flowid); + return BRCMF_FLOWRING_INVALID_ID; +@@ -635,7 +636,7 @@ brcmf_msgbuf_flowring_create_worker(stru + err = brcmf_commonring_write_complete(commonring); + brcmf_commonring_unlock(commonring); + if (err) { +- brcmf_err("Failed to write commonring\n"); ++ bphy_err(drvr, "Failed to write commonring\n"); + brcmf_msgbuf_remove_flowring(msgbuf, flowid); + return BRCMF_FLOWRING_INVALID_ID; + } +@@ -694,6 +695,7 @@ static u32 brcmf_msgbuf_flowring_create( + static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u16 flowid) + { + struct brcmf_flowring *flow = msgbuf->flow; ++ struct brcmf_pub *drvr = msgbuf->drvr; + struct brcmf_commonring *commonring; + void *ret_ptr; + u32 count; +@@ -713,8 +715,8 @@ static void brcmf_msgbuf_txflow(struct b + while (brcmf_flowring_qlen(flow, flowid)) { + skb = brcmf_flowring_dequeue(flow, flowid); + if (skb == NULL) { +- brcmf_err("No SKB, but qlen %d\n", +- brcmf_flowring_qlen(flow, flowid)); ++ bphy_err(drvr, "No SKB, but qlen %d\n", ++ brcmf_flowring_qlen(flow, flowid)); + break; + } + skb_orphan(skb); +@@ -722,7 +724,7 @@ static void brcmf_msgbuf_txflow(struct b + msgbuf->tx_pktids, skb, ETH_HLEN, + &physaddr, &pktid)) { + brcmf_flowring_reinsert(flow, flowid, skb); +- brcmf_err("No PKTID available !!\n"); ++ bphy_err(drvr, "No PKTID available !!\n"); + break; + } + ret_ptr = brcmf_commonring_reserve_for_write(commonring); +@@ -893,6 +895,7 @@ brcmf_msgbuf_process_txstatus(struct brc + + static u32 brcmf_msgbuf_rxbuf_data_post(struct brcmf_msgbuf *msgbuf, u32 count) + { ++ struct brcmf_pub *drvr = msgbuf->drvr; + struct brcmf_commonring *commonring; + void *ret_ptr; + struct sk_buff *skb; +@@ -920,7 +923,7 @@ static u32 brcmf_msgbuf_rxbuf_data_post( + skb = brcmu_pkt_buf_get_skb(BRCMF_MSGBUF_MAX_PKT_SIZE); + + if (skb == NULL) { +- brcmf_err("Failed to alloc SKB\n"); ++ bphy_err(drvr, "Failed to alloc SKB\n"); + brcmf_commonring_write_cancel(commonring, alloced - i); + break; + } +@@ -930,7 +933,7 @@ static u32 brcmf_msgbuf_rxbuf_data_post( + msgbuf->rx_pktids, skb, 0, + &physaddr, &pktid)) { + dev_kfree_skb_any(skb); +- brcmf_err("No PKTID available !!\n"); ++ bphy_err(drvr, "No PKTID available !!\n"); + brcmf_commonring_write_cancel(commonring, alloced - i); + break; + } +@@ -1000,6 +1003,7 @@ static u32 + brcmf_msgbuf_rxbuf_ctrl_post(struct brcmf_msgbuf *msgbuf, bool event_buf, + u32 count) + { ++ struct brcmf_pub *drvr = msgbuf->drvr; + struct brcmf_commonring *commonring; + void *ret_ptr; + struct sk_buff *skb; +@@ -1017,7 +1021,7 @@ brcmf_msgbuf_rxbuf_ctrl_post(struct brcm + count, + &alloced); + if (!ret_ptr) { +- brcmf_err("Failed to reserve space in commonring\n"); ++ bphy_err(drvr, "Failed to reserve space in commonring\n"); + brcmf_commonring_unlock(commonring); + return 0; + } +@@ -1029,7 +1033,7 @@ brcmf_msgbuf_rxbuf_ctrl_post(struct brcm + skb = brcmu_pkt_buf_get_skb(BRCMF_MSGBUF_MAX_PKT_SIZE); + + if (skb == NULL) { +- brcmf_err("Failed to alloc SKB\n"); ++ bphy_err(drvr, "Failed to alloc SKB\n"); + brcmf_commonring_write_cancel(commonring, alloced - i); + break; + } +@@ -1039,7 +1043,7 @@ brcmf_msgbuf_rxbuf_ctrl_post(struct brcm + msgbuf->rx_pktids, skb, 0, + &physaddr, &pktid)) { + dev_kfree_skb_any(skb); +- brcmf_err("No PKTID available !!\n"); ++ bphy_err(drvr, "No PKTID available !!\n"); + brcmf_commonring_write_cancel(commonring, alloced - i); + break; + } +@@ -1091,6 +1095,7 @@ static void brcmf_msgbuf_rxbuf_event_pos + + static void brcmf_msgbuf_process_event(struct brcmf_msgbuf *msgbuf, void *buf) + { ++ struct brcmf_pub *drvr = msgbuf->drvr; + struct msgbuf_rx_event *event; + u32 idx; + u16 buflen; +@@ -1117,8 +1122,8 @@ static void brcmf_msgbuf_process_event(s + + ifp = brcmf_get_ifp(msgbuf->drvr, event->msg.ifidx); + if (!ifp || !ifp->ndev) { +- brcmf_err("Received pkt for invalid ifidx %d\n", +- event->msg.ifidx); ++ bphy_err(drvr, "Received pkt for invalid ifidx %d\n", ++ event->msg.ifidx); + goto exit; + } + +@@ -1134,6 +1139,7 @@ exit: + static void + brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf) + { ++ struct brcmf_pub *drvr = msgbuf->drvr; + struct msgbuf_rx_complete *rx_complete; + struct sk_buff *skb; + u16 data_offset; +@@ -1167,7 +1173,7 @@ brcmf_msgbuf_process_rx_complete(struct + ifp = msgbuf->drvr->mon_if; + + if (!ifp) { +- brcmf_err("Received unexpected monitor pkt\n"); ++ bphy_err(drvr, "Received unexpected monitor pkt\n"); + brcmu_pkt_buf_free_skb(skb); + return; + } +@@ -1178,8 +1184,8 @@ brcmf_msgbuf_process_rx_complete(struct + + ifp = brcmf_get_ifp(msgbuf->drvr, rx_complete->msg.ifidx); + if (!ifp || !ifp->ndev) { +- brcmf_err("Received pkt for invalid ifidx %d\n", +- rx_complete->msg.ifidx); ++ bphy_err(drvr, "Received pkt for invalid ifidx %d\n", ++ rx_complete->msg.ifidx); + brcmu_pkt_buf_free_skb(skb); + return; + } +@@ -1192,13 +1198,15 @@ static void brcmf_msgbuf_process_ring_st + void *buf) + { + struct msgbuf_ring_status *ring_status = buf; ++ struct brcmf_pub *drvr = msgbuf->drvr; + int err; + + err = le16_to_cpu(ring_status->compl_hdr.status); + if (err) { + int ring = le16_to_cpu(ring_status->compl_hdr.flow_ring_id); + +- brcmf_err("Firmware reported ring %d error: %d\n", ring, err); ++ bphy_err(drvr, "Firmware reported ring %d error: %d\n", ring, ++ err); + } + } + +@@ -1206,6 +1214,7 @@ static void + brcmf_msgbuf_process_flow_ring_create_response(struct brcmf_msgbuf *msgbuf, + void *buf) + { ++ struct brcmf_pub *drvr = msgbuf->drvr; + struct msgbuf_flowring_create_resp *flowring_create_resp; + u16 status; + u16 flowid; +@@ -1217,7 +1226,7 @@ brcmf_msgbuf_process_flow_ring_create_re + status = le16_to_cpu(flowring_create_resp->compl_hdr.status); + + if (status) { +- brcmf_err("Flowring creation failed, code %d\n", status); ++ bphy_err(drvr, "Flowring creation failed, code %d\n", status); + brcmf_msgbuf_remove_flowring(msgbuf, flowid); + return; + } +@@ -1234,6 +1243,7 @@ static void + brcmf_msgbuf_process_flow_ring_delete_response(struct brcmf_msgbuf *msgbuf, + void *buf) + { ++ struct brcmf_pub *drvr = msgbuf->drvr; + struct msgbuf_flowring_delete_resp *flowring_delete_resp; + u16 status; + u16 flowid; +@@ -1245,7 +1255,7 @@ brcmf_msgbuf_process_flow_ring_delete_re + status = le16_to_cpu(flowring_delete_resp->compl_hdr.status); + + if (status) { +- brcmf_err("Flowring deletion failed, code %d\n", status); ++ bphy_err(drvr, "Flowring deletion failed, code %d\n", status); + brcmf_flowring_delete(msgbuf->flow, flowid); + return; + } +@@ -1258,6 +1268,7 @@ brcmf_msgbuf_process_flow_ring_delete_re + + static void brcmf_msgbuf_process_msgtype(struct brcmf_msgbuf *msgbuf, void *buf) + { ++ struct brcmf_pub *drvr = msgbuf->drvr; + struct msgbuf_common_hdr *msg; + + msg = (struct msgbuf_common_hdr *)buf; +@@ -1294,7 +1305,7 @@ static void brcmf_msgbuf_process_msgtype + brcmf_msgbuf_process_rx_complete(msgbuf, buf); + break; + default: +- brcmf_err("Unsupported msgtype %d\n", msg->msgtype); ++ bphy_err(drvr, "Unsupported msgtype %d\n", msg->msgtype); + break; + } + } +@@ -1377,7 +1388,7 @@ void brcmf_msgbuf_delete_flowring(struct + brcmf_commonring_lock(commonring); + ret_ptr = brcmf_commonring_reserve_for_write(commonring); + if (!ret_ptr) { +- brcmf_err("FW unaware, flowring will be removed !!\n"); ++ bphy_err(drvr, "FW unaware, flowring will be removed !!\n"); + brcmf_commonring_unlock(commonring); + brcmf_msgbuf_remove_flowring(msgbuf, flowid); + return; +@@ -1401,7 +1412,7 @@ void brcmf_msgbuf_delete_flowring(struct + err = brcmf_commonring_write_complete(commonring); + brcmf_commonring_unlock(commonring); + if (err) { +- brcmf_err("Failed to submit RING_DELETE, flowring will be removed\n"); ++ bphy_err(drvr, "Failed to submit RING_DELETE, flowring will be removed\n"); + brcmf_msgbuf_remove_flowring(msgbuf, flowid); + } + } +@@ -1476,8 +1487,8 @@ int brcmf_proto_msgbuf_attach(struct brc + if_msgbuf = drvr->bus_if->msgbuf; + + if (if_msgbuf->max_flowrings >= BRCMF_FLOWRING_HASHSIZE) { +- brcmf_err("driver not configured for this many flowrings %d\n", +- if_msgbuf->max_flowrings); ++ bphy_err(drvr, "driver not configured for this many flowrings %d\n", ++ if_msgbuf->max_flowrings); + if_msgbuf->max_flowrings = BRCMF_FLOWRING_HASHSIZE - 1; + } + +@@ -1487,7 +1498,7 @@ int brcmf_proto_msgbuf_attach(struct brc + + msgbuf->txflow_wq = create_singlethread_workqueue("msgbuf_txflow"); + if (msgbuf->txflow_wq == NULL) { +- brcmf_err("workqueue creation failed\n"); ++ bphy_err(drvr, "workqueue creation failed\n"); + goto fail; + } + INIT_WORK(&msgbuf->txflow_work, brcmf_msgbuf_txflow_worker); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +@@ -434,6 +434,7 @@ static void brcmf_p2p_print_actframe(boo + */ + static int brcmf_p2p_set_firmware(struct brcmf_if *ifp, u8 *p2p_mac) + { ++ struct brcmf_pub *drvr = ifp->drvr; + s32 ret = 0; + + brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); +@@ -450,7 +451,7 @@ static int brcmf_p2p_set_firmware(struct + ret = brcmf_fil_iovar_data_set(ifp, "p2p_da_override", p2p_mac, + ETH_ALEN); + if (ret) +- brcmf_err("failed to update device address ret %d\n", ret); ++ bphy_err(drvr, "failed to update device address ret %d\n", ret); + + return ret; + } +@@ -570,13 +571,14 @@ static s32 brcmf_p2p_deinit_discovery(st + */ + static int brcmf_p2p_enable_discovery(struct brcmf_p2p_info *p2p) + { ++ struct brcmf_pub *drvr = p2p->cfg->pub; + struct brcmf_cfg80211_vif *vif; + s32 ret = 0; + + brcmf_dbg(TRACE, "enter\n"); + vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; + if (!vif) { +- brcmf_err("P2P config device not available\n"); ++ bphy_err(drvr, "P2P config device not available\n"); + ret = -EPERM; + goto exit; + } +@@ -590,13 +592,13 @@ static int brcmf_p2p_enable_discovery(st + vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif; + ret = brcmf_fil_iovar_int_set(vif->ifp, "p2p_disc", 1); + if (ret < 0) { +- brcmf_err("set p2p_disc error\n"); ++ bphy_err(drvr, "set p2p_disc error\n"); + goto exit; + } + vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; + ret = brcmf_p2p_set_discover_state(vif->ifp, WL_P2P_DISC_ST_SCAN, 0, 0); + if (ret < 0) { +- brcmf_err("unable to set WL_P2P_DISC_ST_SCAN\n"); ++ bphy_err(drvr, "unable to set WL_P2P_DISC_ST_SCAN\n"); + goto exit; + } + +@@ -608,7 +610,7 @@ static int brcmf_p2p_enable_discovery(st + */ + ret = brcmf_fil_bsscfg_int_set(vif->ifp, "wsec", AES_ENABLED); + if (ret < 0) { +- brcmf_err("wsec error %d\n", ret); ++ bphy_err(drvr, "wsec error %d\n", ret); + goto exit; + } + +@@ -630,6 +632,7 @@ static s32 brcmf_p2p_escan(struct brcmf_ + u16 chanspecs[], s32 search_state, + enum p2p_bss_type bss_type) + { ++ struct brcmf_pub *drvr = p2p->cfg->pub; + s32 ret = 0; + s32 memsize = offsetof(struct brcmf_p2p_scan_le, + eparams.params_le.channel_list); +@@ -648,7 +651,7 @@ static s32 brcmf_p2p_escan(struct brcmf_ + + vif = p2p->bss_idx[bss_type].vif; + if (vif == NULL) { +- brcmf_err("no vif for bss type %d\n", bss_type); ++ bphy_err(drvr, "no vif for bss type %d\n", bss_type); + ret = -EINVAL; + goto exit; + } +@@ -676,7 +679,7 @@ static s32 brcmf_p2p_escan(struct brcmf_ + BRCMF_P2P_WILDCARD_SSID_LEN); + break; + default: +- brcmf_err(" invalid search state %d\n", search_state); ++ bphy_err(drvr, " invalid search state %d\n", search_state); + ret = -EINVAL; + goto exit; + } +@@ -760,6 +763,7 @@ static s32 brcmf_p2p_run_escan(struct br + struct cfg80211_scan_request *request) + { + struct brcmf_p2p_info *p2p = &cfg->p2p; ++ struct brcmf_pub *drvr = cfg->pub; + s32 err = 0; + s32 search_state = WL_P2P_DISC_ST_SCAN; + struct brcmf_cfg80211_vif *vif; +@@ -822,7 +826,7 @@ static s32 brcmf_p2p_run_escan(struct br + } + exit: + if (err) +- brcmf_err("error (%d)\n", err); ++ bphy_err(drvr, "error (%d)\n", err); + return err; + } + +@@ -917,19 +921,20 @@ int brcmf_p2p_scan_prep(struct wiphy *wi + static s32 + brcmf_p2p_discover_listen(struct brcmf_p2p_info *p2p, u16 channel, u32 duration) + { ++ struct brcmf_pub *drvr = p2p->cfg->pub; + struct brcmf_cfg80211_vif *vif; + struct brcmu_chan ch; + s32 err = 0; + + vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; + if (!vif) { +- brcmf_err("Discovery is not set, so we have nothing to do\n"); ++ bphy_err(drvr, "Discovery is not set, so we have nothing to do\n"); + err = -EPERM; + goto exit; + } + + if (test_bit(BRCMF_P2P_STATUS_DISCOVER_LISTEN, &p2p->status)) { +- brcmf_err("Previous LISTEN is not completed yet\n"); ++ bphy_err(drvr, "Previous LISTEN is not completed yet\n"); + /* WAR: prevent cookie mismatch in wpa_supplicant return OK */ + goto exit; + } +@@ -1046,6 +1051,7 @@ void brcmf_p2p_cancel_remain_on_channel( + */ + static s32 brcmf_p2p_act_frm_search(struct brcmf_p2p_info *p2p, u16 channel) + { ++ struct brcmf_pub *drvr = p2p->cfg->pub; + s32 err; + u32 channel_cnt; + u16 *default_chan_list; +@@ -1061,7 +1067,7 @@ static s32 brcmf_p2p_act_frm_search(stru + default_chan_list = kcalloc(channel_cnt, sizeof(*default_chan_list), + GFP_KERNEL); + if (default_chan_list == NULL) { +- brcmf_err("channel list allocation failed\n"); ++ bphy_err(drvr, "channel list allocation failed\n"); + err = -ENOMEM; + goto exit; + } +@@ -1103,6 +1109,7 @@ static void brcmf_p2p_afx_handler(struct + struct brcmf_p2p_info *p2p = container_of(afx_hdl, + struct brcmf_p2p_info, + afx_hdl); ++ struct brcmf_pub *drvr = p2p->cfg->pub; + s32 err; + + if (!afx_hdl->is_active) +@@ -1116,7 +1123,7 @@ static void brcmf_p2p_afx_handler(struct + err = brcmf_p2p_act_frm_search(p2p, afx_hdl->peer_listen_chan); + + if (err) { +- brcmf_err("ERROR occurred! value is (%d)\n", err); ++ bphy_err(drvr, "ERROR occurred! value is (%d)\n", err); + if (test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, + &p2p->status)) + complete(&afx_hdl->act_frm_scan); +@@ -1338,7 +1345,8 @@ int brcmf_p2p_notify_action_frame_rx(str + const struct brcmf_event_msg *e, + void *data) + { +- struct brcmf_cfg80211_info *cfg = ifp->drvr->config; ++ struct brcmf_pub *drvr = ifp->drvr; ++ struct brcmf_cfg80211_info *cfg = drvr->config; + struct brcmf_p2p_info *p2p = &cfg->p2p; + struct afx_hdl *afx_hdl = &p2p->afx_hdl; + struct wireless_dev *wdev; +@@ -1409,7 +1417,7 @@ int brcmf_p2p_notify_action_frame_rx(str + mgmt_frame = kzalloc(offsetof(struct ieee80211_mgmt, u) + + mgmt_frame_len, GFP_KERNEL); + if (!mgmt_frame) { +- brcmf_err("No memory available for action frame\n"); ++ bphy_err(drvr, "No memory available for action frame\n"); + return -ENOMEM; + } + memcpy(mgmt_frame->da, ifp->mac_addr, ETH_ALEN); +@@ -1492,6 +1500,7 @@ int brcmf_p2p_notify_action_tx_complete( + static s32 brcmf_p2p_tx_action_frame(struct brcmf_p2p_info *p2p, + struct brcmf_fil_af_params_le *af_params) + { ++ struct brcmf_pub *drvr = p2p->cfg->pub; + struct brcmf_cfg80211_vif *vif; + s32 err = 0; + s32 timeout = 0; +@@ -1506,7 +1515,7 @@ static s32 brcmf_p2p_tx_action_frame(str + err = brcmf_fil_bsscfg_data_set(vif->ifp, "actframe", af_params, + sizeof(*af_params)); + if (err) { +- brcmf_err(" sending action frame has failed\n"); ++ bphy_err(drvr, " sending action frame has failed\n"); + goto exit; + } + +@@ -1556,6 +1565,7 @@ static s32 brcmf_p2p_pub_af_tx(struct br + struct brcmf_config_af_params *config_af_params) + { + struct brcmf_p2p_info *p2p = &cfg->p2p; ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_fil_action_frame_le *action_frame; + struct brcmf_p2p_pub_act_frame *act_frm; + s32 err = 0; +@@ -1634,8 +1644,8 @@ static s32 brcmf_p2p_pub_af_tx(struct br + config_af_params->extra_listen = false; + break; + default: +- brcmf_err("Unknown p2p pub act frame subtype: %d\n", +- act_frm->subtype); ++ bphy_err(drvr, "Unknown p2p pub act frame subtype: %d\n", ++ act_frm->subtype); + err = -EINVAL; + } + return err; +@@ -1657,6 +1667,7 @@ bool brcmf_p2p_send_action_frame(struct + struct brcmf_fil_action_frame_le *action_frame; + struct brcmf_config_af_params config_af_params; + struct afx_hdl *afx_hdl = &p2p->afx_hdl; ++ struct brcmf_pub *drvr = cfg->pub; + u16 action_frame_len; + bool ack = false; + u8 category; +@@ -1692,7 +1703,7 @@ bool brcmf_p2p_send_action_frame(struct + if (brcmf_p2p_pub_af_tx(cfg, af_params, &config_af_params)) { + /* Just send unknown subtype frame with */ + /* default parameters. */ +- brcmf_err("P2P Public action frame, unknown subtype.\n"); ++ bphy_err(drvr, "P2P Public action frame, unknown subtype.\n"); + } + } else if (brcmf_p2p_is_gas_action(action_frame->data, + action_frame_len)) { +@@ -1714,7 +1725,7 @@ bool brcmf_p2p_send_action_frame(struct + af_params->dwell_time = + cpu_to_le32(P2P_AF_MIN_DWELL_TIME); + } else { +- brcmf_err("Unknown action type: %d\n", action); ++ bphy_err(drvr, "Unknown action type: %d\n", action); + goto exit; + } + } else if (brcmf_p2p_is_p2p_action(action_frame->data, +@@ -1722,8 +1733,8 @@ bool brcmf_p2p_send_action_frame(struct + /* do not configure anything. it will be */ + /* sent with a default configuration */ + } else { +- brcmf_err("Unknown Frame: category 0x%x, action 0x%x\n", +- category, action); ++ bphy_err(drvr, "Unknown Frame: category 0x%x, action 0x%x\n", ++ category, action); + return false; + } + +@@ -1761,7 +1772,7 @@ bool brcmf_p2p_send_action_frame(struct + + if (brcmf_p2p_af_searching_channel(p2p) == + P2P_INVALID_CHANNEL) { +- brcmf_err("Couldn't find peer's channel.\n"); ++ bphy_err(drvr, "Couldn't find peer's channel.\n"); + goto exit; + } + +@@ -1783,7 +1794,8 @@ bool brcmf_p2p_send_action_frame(struct + tx_retry++; + } + if (ack == false) { +- brcmf_err("Failed to send Action Frame(retry %d)\n", tx_retry); ++ bphy_err(drvr, "Failed to send Action Frame(retry %d)\n", ++ tx_retry); + clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status); + } + +@@ -1965,6 +1977,7 @@ int brcmf_p2p_ifchange(struct brcmf_cfg8 + enum brcmf_fil_p2p_if_types if_type) + { + struct brcmf_p2p_info *p2p = &cfg->p2p; ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_cfg80211_vif *vif; + struct brcmf_fil_p2p_if_le if_request; + s32 err; +@@ -1974,13 +1987,13 @@ int brcmf_p2p_ifchange(struct brcmf_cfg8 + + vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif; + if (!vif) { +- brcmf_err("vif for P2PAPI_BSSCFG_PRIMARY does not exist\n"); ++ bphy_err(drvr, "vif for P2PAPI_BSSCFG_PRIMARY does not exist\n"); + return -EPERM; + } + brcmf_notify_escan_complete(cfg, vif->ifp, true, true); + vif = p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif; + if (!vif) { +- brcmf_err("vif for P2PAPI_BSSCFG_CONNECTION does not exist\n"); ++ bphy_err(drvr, "vif for P2PAPI_BSSCFG_CONNECTION does not exist\n"); + return -EPERM; + } + brcmf_set_mpc(vif->ifp, 0); +@@ -1998,7 +2011,7 @@ int brcmf_p2p_ifchange(struct brcmf_cfg8 + err = brcmf_fil_iovar_data_set(vif->ifp, "p2p_ifupd", &if_request, + sizeof(if_request)); + if (err) { +- brcmf_err("p2p_ifupd FAILED, err=%d\n", err); ++ bphy_err(drvr, "p2p_ifupd FAILED, err=%d\n", err); + brcmf_cfg80211_arm_vif_event(cfg, NULL); + return err; + } +@@ -2006,7 +2019,7 @@ int brcmf_p2p_ifchange(struct brcmf_cfg8 + BRCMF_VIF_EVENT_TIMEOUT); + brcmf_cfg80211_arm_vif_event(cfg, NULL); + if (!err) { +- brcmf_err("No BRCMF_E_IF_CHANGE event received\n"); ++ bphy_err(drvr, "No BRCMF_E_IF_CHANGE event received\n"); + return -EIO; + } + +@@ -2069,6 +2082,7 @@ static struct wireless_dev *brcmf_p2p_cr + struct wiphy *wiphy, + u8 *addr) + { ++ struct brcmf_pub *drvr = p2p->cfg->pub; + struct brcmf_cfg80211_vif *p2p_vif; + struct brcmf_if *p2p_ifp; + struct brcmf_if *pri_ifp; +@@ -2080,7 +2094,7 @@ static struct wireless_dev *brcmf_p2p_cr + + p2p_vif = brcmf_alloc_vif(p2p->cfg, NL80211_IFTYPE_P2P_DEVICE); + if (IS_ERR(p2p_vif)) { +- brcmf_err("could not create discovery vif\n"); ++ bphy_err(drvr, "could not create discovery vif\n"); + return (struct wireless_dev *)p2p_vif; + } + +@@ -2088,7 +2102,7 @@ static struct wireless_dev *brcmf_p2p_cr + + /* firmware requires unique mac address for p2pdev interface */ + if (addr && ether_addr_equal(addr, pri_ifp->mac_addr)) { +- brcmf_err("discovery vif must be different from primary interface\n"); ++ bphy_err(drvr, "discovery vif must be different from primary interface\n"); + return ERR_PTR(-EINVAL); + } + +@@ -2101,7 +2115,7 @@ static struct wireless_dev *brcmf_p2p_cr + /* Initialize P2P Discovery in the firmware */ + err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1); + if (err < 0) { +- brcmf_err("set p2p_disc error\n"); ++ bphy_err(drvr, "set p2p_disc error\n"); + brcmf_fweh_p2pdev_setup(pri_ifp, false); + brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL); + goto fail; +@@ -2113,7 +2127,7 @@ static struct wireless_dev *brcmf_p2p_cr + brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL); + brcmf_fweh_p2pdev_setup(pri_ifp, false); + if (!err) { +- brcmf_err("timeout occurred\n"); ++ bphy_err(drvr, "timeout occurred\n"); + err = -EIO; + goto fail; + } +@@ -2127,7 +2141,7 @@ static struct wireless_dev *brcmf_p2p_cr + /* verify bsscfg index for P2P discovery */ + err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bsscfgidx); + if (err < 0) { +- brcmf_err("retrieving discover bsscfg index failed\n"); ++ bphy_err(drvr, "retrieving discover bsscfg index failed\n"); + goto fail; + } + +@@ -2161,6 +2175,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s + { + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_cfg80211_vif *vif; + enum brcmf_fil_p2p_if_types iftype; + int err; +@@ -2201,7 +2216,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s + BRCMF_VIF_EVENT_TIMEOUT); + brcmf_cfg80211_arm_vif_event(cfg, NULL); + if (!err) { +- brcmf_err("timeout occurred\n"); ++ bphy_err(drvr, "timeout occurred\n"); + err = -EIO; + goto fail; + } +@@ -2209,7 +2224,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s + /* interface created in firmware */ + ifp = vif->ifp; + if (!ifp) { +- brcmf_err("no if pointer provided\n"); ++ bphy_err(drvr, "no if pointer provided\n"); + err = -ENOENT; + goto fail; + } +@@ -2220,7 +2235,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s + #endif /* >= 3.17.0 */ + err = brcmf_net_attach(ifp, true); + if (err) { +- brcmf_err("Registering netdevice failed\n"); ++ bphy_err(drvr, "Registering netdevice failed\n"); + free_netdev(ifp->ndev); + goto fail; + } +@@ -2375,6 +2390,7 @@ void brcmf_p2p_stop_device(struct wiphy + */ + s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced) + { ++ struct brcmf_pub *drvr = cfg->pub; + struct brcmf_p2p_info *p2p; + struct brcmf_if *pri_ifp; + s32 err = 0; +@@ -2389,7 +2405,7 @@ s32 brcmf_p2p_attach(struct brcmf_cfg802 + if (p2pdev_forced) { + err_ptr = brcmf_p2p_create_p2pdev(p2p, NULL, NULL); + if (IS_ERR(err_ptr)) { +- brcmf_err("P2P device creation failed.\n"); ++ bphy_err(drvr, "P2P device creation failed.\n"); + err = PTR_ERR(err_ptr); + } + } else { +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c +@@ -109,6 +109,7 @@ static int brcmf_pno_channel_config(stru + static int brcmf_pno_config(struct brcmf_if *ifp, u32 scan_freq, + u32 mscan, u32 bestn) + { ++ struct brcmf_pub *drvr = ifp->drvr; + struct brcmf_pno_param_le pfn_param; + u16 flags; + u32 pfnmem; +@@ -132,13 +133,13 @@ static int brcmf_pno_config(struct brcmf + /* set bestn in firmware */ + err = brcmf_fil_iovar_int_set(ifp, "pfnmem", pfnmem); + if (err < 0) { +- brcmf_err("failed to set pfnmem\n"); ++ bphy_err(drvr, "failed to set pfnmem\n"); + goto exit; + } + /* get max mscan which the firmware supports */ + err = brcmf_fil_iovar_int_get(ifp, "pfnmem", &pfnmem); + if (err < 0) { +- brcmf_err("failed to get pfnmem\n"); ++ bphy_err(drvr, "failed to get pfnmem\n"); + goto exit; + } + mscan = min_t(u32, mscan, pfnmem); +@@ -152,7 +153,7 @@ static int brcmf_pno_config(struct brcmf + err = brcmf_fil_iovar_data_set(ifp, "pfn_set", &pfn_param, + sizeof(pfn_param)); + if (err) +- brcmf_err("pfn_set failed, err=%d\n", err); ++ bphy_err(drvr, "pfn_set failed, err=%d\n", err); + + exit: + return err; +@@ -160,6 +161,7 @@ exit: + + static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi) + { ++ struct brcmf_pub *drvr = ifp->drvr; + struct brcmf_pno_macaddr_le pfn_mac; + u8 *mac_addr = NULL; + u8 *mac_mask = NULL; +@@ -194,7 +196,7 @@ static int brcmf_pno_set_random(struct b + err = brcmf_fil_iovar_data_set(ifp, "pfn_macaddr", &pfn_mac, + sizeof(pfn_mac)); + if (err) +- brcmf_err("pfn_macaddr failed, err=%d\n", err); ++ bphy_err(drvr, "pfn_macaddr failed, err=%d\n", err); + + return err; + } +@@ -202,6 +204,7 @@ static int brcmf_pno_set_random(struct b + static int brcmf_pno_add_ssid(struct brcmf_if *ifp, struct cfg80211_ssid *ssid, + bool active) + { ++ struct brcmf_pub *drvr = ifp->drvr; + struct brcmf_pno_net_param_le pfn; + int err; + +@@ -218,12 +221,13 @@ static int brcmf_pno_add_ssid(struct brc + brcmf_dbg(SCAN, "adding ssid=%.32s (active=%d)\n", ssid->ssid, active); + err = brcmf_fil_iovar_data_set(ifp, "pfn_add", &pfn, sizeof(pfn)); + if (err < 0) +- brcmf_err("adding failed: err=%d\n", err); ++ bphy_err(drvr, "adding failed: err=%d\n", err); + return err; + } + + static int brcmf_pno_add_bssid(struct brcmf_if *ifp, const u8 *bssid) + { ++ struct brcmf_pub *drvr = ifp->drvr; + struct brcmf_pno_bssid_le bssid_cfg; + int err; + +@@ -234,7 +238,7 @@ static int brcmf_pno_add_bssid(struct br + err = brcmf_fil_iovar_data_set(ifp, "pfn_add_bssid", &bssid_cfg, + sizeof(bssid_cfg)); + if (err < 0) +- brcmf_err("adding failed: err=%d\n", err); ++ bphy_err(drvr, "adding failed: err=%d\n", err); + return err; + } + +@@ -258,6 +262,7 @@ static bool brcmf_is_ssid_active(struct + + static int brcmf_pno_clean(struct brcmf_if *ifp) + { ++ struct brcmf_pub *drvr = ifp->drvr; + int ret; + + /* Disable pfn */ +@@ -267,7 +272,7 @@ static int brcmf_pno_clean(struct brcmf_ + ret = brcmf_fil_iovar_data_set(ifp, "pfnclear", NULL, 0); + } + if (ret < 0) +- brcmf_err("failed code %d\n", ret); ++ bphy_err(drvr, "failed code %d\n", ret); + + return ret; + } +@@ -392,6 +397,7 @@ static int brcmf_pno_config_networks(str + + static int brcmf_pno_config_sched_scans(struct brcmf_if *ifp) + { ++ struct brcmf_pub *drvr = ifp->drvr; + struct brcmf_pno_info *pi; + struct brcmf_gscan_config *gscan_cfg; + struct brcmf_gscan_bucket_config *buckets; +@@ -416,7 +422,7 @@ static int brcmf_pno_config_sched_scans( + /* clean up everything */ + err = brcmf_pno_clean(ifp); + if (err < 0) { +- brcmf_err("failed error=%d\n", err); ++ bphy_err(drvr, "failed error=%d\n", err); + goto free_gscan; + } + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c +@@ -47,8 +47,8 @@ int brcmf_proto_attach(struct brcmf_pub + if (brcmf_proto_msgbuf_attach(drvr)) + goto fail; + } else { +- brcmf_err("Unsupported proto type %d\n", +- drvr->bus_if->proto_type); ++ bphy_err(drvr, "Unsupported proto type %d\n", ++ drvr->bus_if->proto_type); + goto fail; + } + if (!proto->tx_queue_data || (proto->hdrpull == NULL) || +@@ -56,7 +56,7 @@ int brcmf_proto_attach(struct brcmf_pub + (proto->configure_addr_mode == NULL) || + (proto->delete_peer == NULL) || (proto->add_tdls_peer == NULL) || + (proto->debugfs_create == NULL)) { +- brcmf_err("Not all proto handlers have been installed\n"); ++ bphy_err(drvr, "Not all proto handlers have been installed\n"); + goto fail; + } + return 0; diff --git a/package/kernel/mac80211/patches/brcm/355-v5.1-brcmfmac-add-basic-validation-of-shared-RAM-address.patch b/package/kernel/mac80211/patches/brcm/355-v5.1-brcmfmac-add-basic-validation-of-shared-RAM-address.patch new file mode 100644 index 00000000000000..323e93354cda68 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/355-v5.1-brcmfmac-add-basic-validation-of-shared-RAM-address.patch @@ -0,0 +1,38 @@ +From e0a8ef4d7b4315bc4c1641fb3f3a7dfdfa6627b8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 20 Feb 2019 11:30:47 +0100 +Subject: [PATCH] brcmfmac: add basic validation of shared RAM address +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +While experimenting with firmware loading I ended up in a state of +firmware reporting shared RAM address 0x04000001. It was causing: +[ 94.448015] Unable to handle kernel paging request at virtual address cd680001 +due to reading out of the mapped memory. + +This patch adds some basic validation to avoid kernel crashes due to the +unexpected firmware behavior. + +Signed-off-by: Rafał Miłecki +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -1560,6 +1560,12 @@ static int brcmf_pcie_download_fw_nvram( + brcmf_err(bus, "FW failed to initialize\n"); + return -ENODEV; + } ++ if (sharedram_addr < devinfo->ci->rambase || ++ sharedram_addr >= devinfo->ci->rambase + devinfo->ci->ramsize) { ++ brcmf_err(bus, "Invalid shared RAM address 0x%08x\n", ++ sharedram_addr); ++ return -ENODEV; ++ } + brcmf_dbg(PCIE, "Shared RAM addr: 0x%08x\n", sharedram_addr); + + return (brcmf_pcie_init_share_ram_info(devinfo, sharedram_addr)); diff --git a/package/kernel/mac80211/patches/brcm/356-v5.1-0001-brcmfmac-fix-size-of-the-struct-msgbuf_ring_status.patch b/package/kernel/mac80211/patches/brcm/356-v5.1-0001-brcmfmac-fix-size-of-the-struct-msgbuf_ring_status.patch new file mode 100644 index 00000000000000..10834db6085f1f --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/356-v5.1-0001-brcmfmac-fix-size-of-the-struct-msgbuf_ring_status.patch @@ -0,0 +1,29 @@ +From 0c7051610c577b60b01b3b5aec14d6765e177b0d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 21 Feb 2019 11:33:24 +0100 +Subject: [PATCH] brcmfmac: fix size of the struct msgbuf_ring_status +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This updates host struct to match the in-firmawre definition. It's a +cosmetic change as it only applies to the reserved struct space. + +Fixes: c988b78244df ("brcmfmac: print firmware reported ring status errors") +Signed-off-by: Rafał Miłecki +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +@@ -139,7 +139,7 @@ struct msgbuf_ring_status { + struct msgbuf_common_hdr msg; + struct msgbuf_completion_hdr compl_hdr; + __le16 write_idx; +- __le32 rsvd0[5]; ++ __le16 rsvd0[5]; + }; + + struct msgbuf_rx_event { diff --git a/package/kernel/mac80211/patches/brcm/356-v5.1-0002-brcmfmac-print-firmware-reported-general-status-erro.patch b/package/kernel/mac80211/patches/brcm/356-v5.1-0002-brcmfmac-print-firmware-reported-general-status-erro.patch new file mode 100644 index 00000000000000..313d501e8248b7 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/356-v5.1-0002-brcmfmac-print-firmware-reported-general-status-erro.patch @@ -0,0 +1,69 @@ +From c91377495192cda096e52dc09c266b0d05f16d86 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 21 Feb 2019 11:33:25 +0100 +Subject: [PATCH] brcmfmac: print firmware reported general status errors +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Firmware may report general errors using a special message type. Add +basic support for it by simply decoding & printing an error number. + +A sample situation in which firmware reports a buf error: +CONSOLE: 027084.733 no host response IOCTL buffer available..so fail the request +will now produce a "Firmware reported general error: 9" on the host. + +Signed-off-by: Rafał Miłecki +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/msgbuf.c | 24 +++++++++++++++++++ + 1 file changed, 24 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +@@ -134,6 +134,14 @@ struct msgbuf_completion_hdr { + __le16 flow_ring_id; + }; + ++/* Data struct for the MSGBUF_TYPE_GEN_STATUS */ ++struct msgbuf_gen_status { ++ struct msgbuf_common_hdr msg; ++ struct msgbuf_completion_hdr compl_hdr; ++ __le16 write_idx; ++ __le32 rsvd0[3]; ++}; ++ + /* Data struct for the MSGBUF_TYPE_RING_STATUS */ + struct msgbuf_ring_status { + struct msgbuf_common_hdr msg; +@@ -1194,6 +1202,18 @@ brcmf_msgbuf_process_rx_complete(struct + brcmf_netif_rx(ifp, skb); + } + ++static void brcmf_msgbuf_process_gen_status(struct brcmf_msgbuf *msgbuf, ++ void *buf) ++{ ++ struct msgbuf_gen_status *gen_status = buf; ++ struct brcmf_pub *drvr = msgbuf->drvr; ++ int err; ++ ++ err = le16_to_cpu(gen_status->compl_hdr.status); ++ if (err) ++ bphy_err(drvr, "Firmware reported general error: %d\n", err); ++} ++ + static void brcmf_msgbuf_process_ring_status(struct brcmf_msgbuf *msgbuf, + void *buf) + { +@@ -1273,6 +1293,10 @@ static void brcmf_msgbuf_process_msgtype + + msg = (struct msgbuf_common_hdr *)buf; + switch (msg->msgtype) { ++ case MSGBUF_TYPE_GEN_STATUS: ++ brcmf_dbg(MSGBUF, "MSGBUF_TYPE_GEN_STATUS\n"); ++ brcmf_msgbuf_process_gen_status(msgbuf, buf); ++ break; + case MSGBUF_TYPE_RING_STATUS: + brcmf_dbg(MSGBUF, "MSGBUF_TYPE_RING_STATUS\n"); + brcmf_msgbuf_process_ring_status(msgbuf, buf); diff --git a/package/kernel/mac80211/patches/brcm/360-v5.2-0001-brcmfmac-support-repeated-brcmf_fw_alloc_request-cal.patch b/package/kernel/mac80211/patches/brcm/360-v5.2-0001-brcmfmac-support-repeated-brcmf_fw_alloc_request-cal.patch new file mode 100644 index 00000000000000..ef694f079f6401 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/360-v5.2-0001-brcmfmac-support-repeated-brcmf_fw_alloc_request-cal.patch @@ -0,0 +1,32 @@ +From c9692820710f57c826b2e43a6fb1e4cd307508b0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 26 Feb 2019 14:11:16 +0100 +Subject: [PATCH] brcmfmac: support repeated brcmf_fw_alloc_request() calls +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +During a normal brcmfmac lifetime brcmf_fw_alloc_request() is called +once only during the probe. It's safe to assume provided array is clear. + +Further brcmfmac improvements may require calling it multiple times +though. This patch allows it by fixing invalid firmware paths like: +brcm/brcmfmac4366c-pcie.binbrcm/brcmfmac4366c-pcie.bin + +Signed-off-by: Rafał Miłecki +Reviewed-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -743,6 +743,7 @@ brcmf_fw_alloc_request(u32 chip, u32 chi + + for (j = 0; j < n_fwnames; j++) { + fwreq->items[j].path = fwnames[j].path; ++ fwnames[j].path[0] = '\0'; + /* check if firmware path is provided by module parameter */ + if (brcmf_mp_global.firmware_path[0] != '\0') { + strlcpy(fwnames[j].path, mp_path, diff --git a/package/kernel/mac80211/patches/brcm/360-v5.2-0002-brcmfmac-add-a-function-designated-for-handling-firm.patch b/package/kernel/mac80211/patches/brcm/360-v5.2-0002-brcmfmac-add-a-function-designated-for-handling-firm.patch new file mode 100644 index 00000000000000..ea423e310b5c1a --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/360-v5.2-0002-brcmfmac-add-a-function-designated-for-handling-firm.patch @@ -0,0 +1,79 @@ +From a2ec87ddbf1637f854ffcfff9d12d392fa30758b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 26 Feb 2019 14:11:18 +0100 +Subject: [PATCH] brcmfmac: add a function designated for handling firmware + fails +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This improves handling PCIe firmware halts by printing a clear error +message and replaces a similar code in the SDIO bus support. + +It will also allow further improvements like trying to recover from a +firmware crash. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 2 ++ + .../net/wireless/broadcom/brcm80211/brcmfmac/core.c | 10 ++++++++++ + .../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 2 +- + .../net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 4 ++-- + 4 files changed, 15 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +@@ -262,6 +262,8 @@ void brcmf_detach(struct device *dev); + void brcmf_dev_reset(struct device *dev); + /* Request from bus module to initiate a coredump */ + void brcmf_dev_coredump(struct device *dev); ++/* Indication that firmware has halted or crashed */ ++void brcmf_fw_crashed(struct device *dev); + + /* Configure the "global" bus state used by upper layers */ + void brcmf_bus_change_state(struct brcmf_bus *bus, enum brcmf_bus_state state); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -1298,6 +1298,16 @@ void brcmf_dev_coredump(struct device *d + brcmf_dbg(TRACE, "failed to create coredump\n"); + } + ++void brcmf_fw_crashed(struct device *dev) ++{ ++ struct brcmf_bus *bus_if = dev_get_drvdata(dev); ++ struct brcmf_pub *drvr = bus_if->drvr; ++ ++ bphy_err(drvr, "Firmware has halted or crashed\n"); ++ ++ brcmf_dev_coredump(dev); ++} ++ + void brcmf_detach(struct device *dev) + { + s32 i; +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -730,7 +730,7 @@ static void brcmf_pcie_handle_mb_data(st + } + if (dtoh_mb_data & BRCMF_D2H_DEV_FWHALT) { + brcmf_dbg(PCIE, "D2H_MB_DATA: FW HALT\n"); +- brcmf_dev_coredump(&devinfo->pdev->dev); ++ brcmf_fw_crashed(&devinfo->pdev->dev); + } + } + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -1101,8 +1101,8 @@ static u32 brcmf_sdio_hostmail(struct br + + /* dongle indicates the firmware has halted/crashed */ + if (hmb_data & HMB_DATA_FWHALT) { +- brcmf_err("mailbox indicates firmware halted\n"); +- brcmf_dev_coredump(&sdiod->func1->dev); ++ brcmf_dbg(SDIO, "mailbox indicates firmware halted\n"); ++ brcmf_fw_crashed(&sdiod->func1->dev); + } + + /* Dongle recomposed rx frames, accept them again */ diff --git a/package/kernel/mac80211/patches/brcm/360-v5.2-0003-brcmfmac-reset-PCIe-bus-on-a-firmware-crash.patch b/package/kernel/mac80211/patches/brcm/360-v5.2-0003-brcmfmac-reset-PCIe-bus-on-a-firmware-crash.patch new file mode 100644 index 00000000000000..2179d6e63aa7ef --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/360-v5.2-0003-brcmfmac-reset-PCIe-bus-on-a-firmware-crash.patch @@ -0,0 +1,153 @@ +From 4684997d9eea29380000e062755aa6d368d789a3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 26 Feb 2019 14:11:19 +0100 +Subject: [PATCH] brcmfmac: reset PCIe bus on a firmware crash +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This includes bus reset & reloading a firmware. It should be sufficient +for a user space to (setup and) use a wireless device again. + +Support for reset on USB & SDIO can be added later. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/bus.h | 10 ++++++ + .../broadcom/brcm80211/brcmfmac/core.c | 12 +++++++ + .../broadcom/brcm80211/brcmfmac/core.h | 2 ++ + .../broadcom/brcm80211/brcmfmac/pcie.c | 35 +++++++++++++++++++ + 4 files changed, 59 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +@@ -91,6 +91,7 @@ struct brcmf_bus_ops { + int (*get_fwname)(struct device *dev, const char *ext, + unsigned char *fw_name); + void (*debugfs_create)(struct device *dev); ++ int (*reset)(struct device *dev); + }; + + +@@ -245,6 +246,15 @@ void brcmf_bus_debugfs_create(struct brc + return bus->ops->debugfs_create(bus->dev); + } + ++static inline ++int brcmf_bus_reset(struct brcmf_bus *bus) ++{ ++ if (!bus->ops->reset) ++ return -EOPNOTSUPP; ++ ++ return bus->ops->reset(bus->dev); ++} ++ + /* + * interface functions from common layer + */ +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -1109,6 +1109,14 @@ static int brcmf_revinfo_read(struct seq + return 0; + } + ++static void brcmf_core_bus_reset(struct work_struct *work) ++{ ++ struct brcmf_pub *drvr = container_of(work, struct brcmf_pub, ++ bus_reset); ++ ++ brcmf_bus_reset(drvr->bus_if); ++} ++ + static int brcmf_bus_started(struct brcmf_pub *drvr, struct cfg80211_ops *ops) + { + int ret = -1; +@@ -1180,6 +1188,8 @@ static int brcmf_bus_started(struct brcm + #endif + #endif /* CONFIG_INET */ + ++ INIT_WORK(&drvr->bus_reset, brcmf_core_bus_reset); ++ + /* populate debugfs */ + brcmf_debugfs_add_entry(drvr, "revinfo", brcmf_revinfo_read); + brcmf_feat_debugfs_create(drvr); +@@ -1306,6 +1316,8 @@ void brcmf_fw_crashed(struct device *dev + bphy_err(drvr, "Firmware has halted or crashed\n"); + + brcmf_dev_coredump(dev); ++ ++ schedule_work(&drvr->bus_reset); + } + + void brcmf_detach(struct device *dev) +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +@@ -143,6 +143,8 @@ struct brcmf_pub { + struct notifier_block inet6addr_notifier; + struct brcmf_mp_device *settings; + ++ struct work_struct bus_reset; ++ + u8 clmver[BRCMF_DCMD_SMLEN]; + }; + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -345,6 +345,10 @@ static const u32 brcmf_ring_itemsize[BRC + BRCMF_D2H_MSGRING_RX_COMPLETE_ITEMSIZE + }; + ++static void brcmf_pcie_setup(struct device *dev, int ret, ++ struct brcmf_fw_request *fwreq); ++static struct brcmf_fw_request * ++brcmf_pcie_prepare_fw_request(struct brcmf_pciedev_info *devinfo); + + static u32 + brcmf_pcie_read_reg32(struct brcmf_pciedev_info *devinfo, u32 reg_offset) +@@ -1409,6 +1413,36 @@ int brcmf_pcie_get_fwname(struct device + return 0; + } + ++static int brcmf_pcie_reset(struct device *dev) ++{ ++ struct brcmf_bus *bus_if = dev_get_drvdata(dev); ++ struct brcmf_pciedev *buspub = bus_if->bus_priv.pcie; ++ struct brcmf_pciedev_info *devinfo = buspub->devinfo; ++ struct brcmf_fw_request *fwreq; ++ int err; ++ ++ brcmf_detach(dev); ++ ++ brcmf_pcie_release_irq(devinfo); ++ brcmf_pcie_release_scratchbuffers(devinfo); ++ brcmf_pcie_release_ringbuffers(devinfo); ++ brcmf_pcie_reset_device(devinfo); ++ ++ fwreq = brcmf_pcie_prepare_fw_request(devinfo); ++ if (!fwreq) { ++ dev_err(dev, "Failed to prepare FW request\n"); ++ return -ENOMEM; ++ } ++ ++ err = brcmf_fw_get_firmwares(dev, fwreq, brcmf_pcie_setup); ++ if (err) { ++ dev_err(dev, "Failed to prepare FW request\n"); ++ kfree(fwreq); ++ } ++ ++ return err; ++} ++ + static const struct brcmf_bus_ops brcmf_pcie_bus_ops = { + .txdata = brcmf_pcie_tx, + .stop = brcmf_pcie_down, +@@ -1418,6 +1452,7 @@ static const struct brcmf_bus_ops brcmf_ + .get_ramsize = brcmf_pcie_get_ramsize, + .get_memdump = brcmf_pcie_get_memdump, + .get_fwname = brcmf_pcie_get_fwname, ++ .reset = brcmf_pcie_reset, + }; + + diff --git a/package/kernel/mac80211/patches/brcm/362-v5.2-0002-brcmfmac-remove-pending-parameter-from-brcmf_usb_fre.patch b/package/kernel/mac80211/patches/brcm/362-v5.2-0002-brcmfmac-remove-pending-parameter-from-brcmf_usb_fre.patch new file mode 100644 index 00000000000000..088e731322fca6 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/362-v5.2-0002-brcmfmac-remove-pending-parameter-from-brcmf_usb_fre.patch @@ -0,0 +1,54 @@ +From 2b78e5f5223666d403d4fdb30af4ad65c8da3cdb Mon Sep 17 00:00:00 2001 +From: Piotr Figiel +Date: Fri, 8 Mar 2019 15:25:06 +0000 +Subject: [PATCH] brcmfmac: remove pending parameter from brcmf_usb_free_q + +brcmf_usb_free_q is no longer called with pending=true thus this boolean +parameter is no longer needed. + +Signed-off-by: Piotr Figiel +Signed-off-by: Kalle Valo +--- + .../wireless/broadcom/brcm80211/brcmfmac/usb.c | 15 ++++++--------- + 1 file changed, 6 insertions(+), 9 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -445,9 +445,10 @@ fail: + + } + +-static void brcmf_usb_free_q(struct list_head *q, bool pending) ++static void brcmf_usb_free_q(struct list_head *q) + { + struct brcmf_usbreq *req, *next; ++ + int i = 0; + list_for_each_entry_safe(req, next, q, list) { + if (!req->urb) { +@@ -455,12 +456,8 @@ static void brcmf_usb_free_q(struct list + break; + } + i++; +- if (pending) { +- usb_kill_urb(req->urb); +- } else { +- usb_free_urb(req->urb); +- list_del_init(&req->list); +- } ++ usb_free_urb(req->urb); ++ list_del_init(&req->list); + } + } + +@@ -1029,8 +1026,8 @@ static void brcmf_usb_detach(struct brcm + brcmf_dbg(USB, "Enter, devinfo %p\n", devinfo); + + /* free the URBS */ +- brcmf_usb_free_q(&devinfo->rx_freeq, false); +- brcmf_usb_free_q(&devinfo->tx_freeq, false); ++ brcmf_usb_free_q(&devinfo->rx_freeq); ++ brcmf_usb_free_q(&devinfo->tx_freeq); + + usb_free_urb(devinfo->ctl_urb); + usb_free_urb(devinfo->bulk_urb); diff --git a/package/kernel/mac80211/patches/brcm/362-v5.2-0003-brcmfmac-remove-unused-variable-i-from-brcmf_usb_fre.patch b/package/kernel/mac80211/patches/brcm/362-v5.2-0003-brcmfmac-remove-unused-variable-i-from-brcmf_usb_fre.patch new file mode 100644 index 00000000000000..4c8d073914ec52 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/362-v5.2-0003-brcmfmac-remove-unused-variable-i-from-brcmf_usb_fre.patch @@ -0,0 +1,29 @@ +From 504f06725d015954a0fcafdf1d90a6795ca8f769 Mon Sep 17 00:00:00 2001 +From: Piotr Figiel +Date: Fri, 8 Mar 2019 15:25:09 +0000 +Subject: [PATCH] brcmfmac: remove unused variable i from brcmf_usb_free_q + +Variable i is not used so remove it. + +Signed-off-by: Piotr Figiel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 2 -- + 1 file changed, 2 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -449,13 +449,11 @@ static void brcmf_usb_free_q(struct list + { + struct brcmf_usbreq *req, *next; + +- int i = 0; + list_for_each_entry_safe(req, next, q, list) { + if (!req->urb) { + brcmf_err("bad req\n"); + break; + } +- i++; + usb_free_urb(req->urb); + list_del_init(&req->list); + } diff --git a/package/kernel/mac80211/patches/brcm/366-v5.2-brcmfmac-Use-struct_size-in-kzalloc.patch b/package/kernel/mac80211/patches/brcm/366-v5.2-brcmfmac-Use-struct_size-in-kzalloc.patch new file mode 100644 index 00000000000000..d00a9d796482bf --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/366-v5.2-brcmfmac-Use-struct_size-in-kzalloc.patch @@ -0,0 +1,53 @@ +From 0cf83903aad03dc7f444a47990def48c4a9d3276 Mon Sep 17 00:00:00 2001 +From: "Gustavo A. R. Silva" +Date: Wed, 3 Apr 2019 11:46:11 -0500 +Subject: [PATCH] brcmfmac: Use struct_size() in kzalloc() + +One of the more common cases of allocation size calculations is finding +the size of a structure that has a zero-sized array at the end, along +with memory for some number of elements for that array. For example: + +struct foo { + int stuff; + struct boo entry[]; +}; + +size = sizeof(struct foo) + count * sizeof(struct boo); +instance = kzalloc(size, GFP_KERNEL) + +Instead of leaving these open-coded and prone to type mistakes, we can +now use the new struct_size() helper: + +instance = kzalloc(struct_size(instance, entry, count), GFP_KERNEL) + +Notice that, in this case, variable reqsz is not necessary, +hence it is removed. + +This code was detected with the help of Coccinelle. + +Signed-off-by: Gustavo A. R. Silva +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -711,7 +711,6 @@ brcmf_fw_alloc_request(u32 chip, u32 chi + size_t mp_path_len; + u32 i, j; + char end = '\0'; +- size_t reqsz; + + for (i = 0; i < table_size; i++) { + if (mapping_table[i].chipid == chip && +@@ -726,8 +725,7 @@ brcmf_fw_alloc_request(u32 chip, u32 chi + return NULL; + } + +- reqsz = sizeof(*fwreq) + n_fwnames * sizeof(struct brcmf_fw_item); +- fwreq = kzalloc(reqsz, GFP_KERNEL); ++ fwreq = kzalloc(struct_size(fwreq, items, n_fwnames), GFP_KERNEL); + if (!fwreq) + return NULL; + diff --git a/package/kernel/mac80211/patches/brcm/367-v5.2-brcmfmac-Loading-the-correct-firmware-for-brcm43456.patch b/package/kernel/mac80211/patches/brcm/367-v5.2-brcmfmac-Loading-the-correct-firmware-for-brcm43456.patch new file mode 100644 index 00000000000000..d19284e672af6c --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/367-v5.2-brcmfmac-Loading-the-correct-firmware-for-brcm43456.patch @@ -0,0 +1,35 @@ +From e3062e05e1cfe378bb9b3fa0bef46711372bcf13 Mon Sep 17 00:00:00 2001 +From: Ondrej Jirman +Date: Sat, 6 Apr 2019 01:45:13 +0200 +Subject: [PATCH] brcmfmac: Loading the correct firmware for brcm43456 + +SDIO based brcm43456 is currently misdetected as brcm43455 and the wrong +firmware name is used. Correct the detection and load the correct +firmware file. Chiprev for brcm43456 is "9". + +Signed-off-by: Ondrej Jirman +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -622,6 +622,7 @@ BRCMF_FW_DEF(43430A0, "brcmfmac43430a0-s + /* Note the names are not postfixed with a1 for backward compatibility */ + BRCMF_FW_DEF(43430A1, "brcmfmac43430-sdio"); + BRCMF_FW_DEF(43455, "brcmfmac43455-sdio"); ++BRCMF_FW_DEF(43456, "brcmfmac43456-sdio"); + BRCMF_FW_DEF(4354, "brcmfmac4354-sdio"); + BRCMF_FW_DEF(4356, "brcmfmac4356-sdio"); + BRCMF_FW_DEF(4373, "brcmfmac4373-sdio"); +@@ -642,7 +643,8 @@ static const struct brcmf_firmware_mappi + BRCMF_FW_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339), + BRCMF_FW_ENTRY(BRCM_CC_43430_CHIP_ID, 0x00000001, 43430A0), + BRCMF_FW_ENTRY(BRCM_CC_43430_CHIP_ID, 0xFFFFFFFE, 43430A1), +- BRCMF_FW_ENTRY(BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, 43455), ++ BRCMF_FW_ENTRY(BRCM_CC_4345_CHIP_ID, 0x00000200, 43456), ++ BRCMF_FW_ENTRY(BRCM_CC_4345_CHIP_ID, 0xFFFFFDC0, 43455), + BRCMF_FW_ENTRY(BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, 4354), + BRCMF_FW_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356), + BRCMF_FW_ENTRY(CY_CC_4373_CHIP_ID, 0xFFFFFFFF, 4373), diff --git a/package/kernel/mac80211/patches/brcm/368-v5.2-brcmfmac-fix-leak-of-mypkt-on-error-return-path.patch b/package/kernel/mac80211/patches/brcm/368-v5.2-brcmfmac-fix-leak-of-mypkt-on-error-return-path.patch new file mode 100644 index 00000000000000..a9a9d74c1047be --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/368-v5.2-brcmfmac-fix-leak-of-mypkt-on-error-return-path.patch @@ -0,0 +1,41 @@ +From a927e8d8ab57e696800e20cf09a72b7dfe3bbebb Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Tue, 9 Apr 2019 12:43:33 +0100 +Subject: [PATCH] brcmfmac: fix leak of mypkt on error return path + +Currently if the call to brcmf_sdiod_set_backplane_window fails then +error return path leaks mypkt. Fix this by returning by a new +error path labelled 'out' that calls brcmu_pkt_buf_free_skb to free +mypkt. Also remove redundant check on err before calling +brcmf_sdiod_skbuff_write. + +Addresses-Coverity: ("Resource Leak") +Fixes: a7c3aa1509e2 ("brcmfmac: Remove brcmf_sdiod_addrprep()") +Signed-off-by: Colin Ian King +Reviewed-by: Mukesh Ojha +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +@@ -617,15 +617,13 @@ int brcmf_sdiod_send_buf(struct brcmf_sd + + err = brcmf_sdiod_set_backplane_window(sdiodev, addr); + if (err) +- return err; ++ goto out; + + addr &= SBSDIO_SB_OFT_ADDR_MASK; + addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; + +- if (!err) +- err = brcmf_sdiod_skbuff_write(sdiodev, sdiodev->func2, addr, +- mypkt); +- ++ err = brcmf_sdiod_skbuff_write(sdiodev, sdiodev->func2, addr, mypkt); ++out: + brcmu_pkt_buf_free_skb(mypkt); + + return err; diff --git a/package/kernel/mac80211/patches/brcm/369-v5.2-brcmfmac-Add-DMI-nvram-filename-quirk-for-ACEPC-T8-a.patch b/package/kernel/mac80211/patches/brcm/369-v5.2-brcmfmac-Add-DMI-nvram-filename-quirk-for-ACEPC-T8-a.patch new file mode 100644 index 00000000000000..b0207d8e10c517 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/369-v5.2-brcmfmac-Add-DMI-nvram-filename-quirk-for-ACEPC-T8-a.patch @@ -0,0 +1,70 @@ +From b1a0ba8f772d7a6dcb5aa3e856f5bd8274989ebe Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Mon, 22 Apr 2019 22:41:23 +0200 +Subject: [PATCH] brcmfmac: Add DMI nvram filename quirk for ACEPC T8 and T11 + mini PCs + +The ACEPC T8 and T11 mini PCs contain quite generic names in the sys_vendor +and product_name DMI strings, without this patch brcmfmac will try to load: +"brcmfmac43455-sdio.Default string-Default string.txt" as nvram file which +is way too generic. + +The DMI strings on which we are matching are somewhat generic too, but +"To be filled by O.E.M." is less common then "Default string" and the +system-sku and bios-version strings are pretty unique. Beside the DMI +strings we also check the wifi-module chip-id and revision. I'm confident +that the combination of all this is unique. + +Both the T8 and T11 use the same wifi-module, this commit adds DMI +quirks for both mini PCs pointing to brcmfmac43455-sdio.acepc-t8.txt . + +BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1690852 +Cc: stable@vger.kernel.org +Signed-off-by: Hans de Goede +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/dmi.c | 26 +++++++++++++++++++ + 1 file changed, 26 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c +@@ -31,6 +31,10 @@ struct brcmf_dmi_data { + + /* NOTE: Please keep all entries sorted alphabetically */ + ++static const struct brcmf_dmi_data acepc_t8_data = { ++ BRCM_CC_4345_CHIP_ID, 6, "acepc-t8" ++}; ++ + static const struct brcmf_dmi_data gpd_win_pocket_data = { + BRCM_CC_4356_CHIP_ID, 2, "gpd-win-pocket" + }; +@@ -49,6 +53,28 @@ static const struct brcmf_dmi_data pov_t + + static const struct dmi_system_id dmi_platform_data[] = { + { ++ /* ACEPC T8 Cherry Trail Z8350 mini PC */ ++ .matches = { ++ DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "To be filled by O.E.M."), ++ DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), ++ DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "T8"), ++ /* also match on somewhat unique bios-version */ ++ DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"), ++ }, ++ .driver_data = (void *)&acepc_t8_data, ++ }, ++ { ++ /* ACEPC T11 Cherry Trail Z8350 mini PC, same wifi as the T8 */ ++ .matches = { ++ DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "To be filled by O.E.M."), ++ DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), ++ DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "T11"), ++ /* also match on somewhat unique bios-version */ ++ DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"), ++ }, ++ .driver_data = (void *)&acepc_t8_data, ++ }, ++ { + /* Match for the GPDwin which unfortunately uses somewhat + * generic dmi strings, which is why we test for 4 strings. + * Comparing against 23 other byt/cht boards, board_vendor diff --git a/package/kernel/mac80211/patches/brcm/370-v5.2-brcmfmac-send-mailbox-interrupt-twice-for-specific-h.patch b/package/kernel/mac80211/patches/brcm/370-v5.2-brcmfmac-send-mailbox-interrupt-twice-for-specific-h.patch new file mode 100644 index 00000000000000..c0a1fcd6150b87 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/370-v5.2-brcmfmac-send-mailbox-interrupt-twice-for-specific-h.patch @@ -0,0 +1,32 @@ +From 99d94ef367af67f630b38c93ff46c5819b7d06b6 Mon Sep 17 00:00:00 2001 +From: Wright Feng +Date: Thu, 25 Apr 2019 07:05:46 +0000 +Subject: [PATCH] brcmfmac: send mailbox interrupt twice for specific hardware + device + +For PCIE wireless device with core revision less than 14, device may miss +PCIE to System Backplane Interrupt via PCIEtoSBMailbox. So add sending +mail box interrupt twice as a hardware workaround. + +Signed-off-by: Wright Feng +Reviewed-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -698,7 +698,11 @@ brcmf_pcie_send_mb_data(struct brcmf_pci + + brcmf_pcie_write_tcm32(devinfo, addr, htod_mb_data); + pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_SBMBX, 1); +- pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_SBMBX, 1); ++ ++ /* Send mailbox interrupt twice as a hardware workaround */ ++ core = brcmf_chip_get_core(devinfo->ci, BCMA_CORE_PCIE2); ++ if (core->rev <= 13) ++ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_SBMBX, 1); + + return 0; + } diff --git a/package/kernel/mac80211/patches/brcm/371-v5.2-Revert-brcmfmac-send-mailbox-interrupt-twice-for-spe.patch b/package/kernel/mac80211/patches/brcm/371-v5.2-Revert-brcmfmac-send-mailbox-interrupt-twice-for-spe.patch new file mode 100644 index 00000000000000..8c7e6a8b933a3f --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/371-v5.2-Revert-brcmfmac-send-mailbox-interrupt-twice-for-spe.patch @@ -0,0 +1,30 @@ +From 324f1feb960c79a07df3acde89a119a5aa80cb10 Mon Sep 17 00:00:00 2001 +From: Kalle Valo +Date: Thu, 25 Apr 2019 20:08:31 +0300 +Subject: [PATCH] Revert "brcmfmac: send mailbox interrupt twice for specific + hardware device" + +This reverts commit 99d94ef367af67f630b38c93ff46c5819b7d06b6. I accidentally +applied this broken (failed to compile) patch due to a bug in my patchwork +script. + +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -698,11 +698,7 @@ brcmf_pcie_send_mb_data(struct brcmf_pci + + brcmf_pcie_write_tcm32(devinfo, addr, htod_mb_data); + pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_SBMBX, 1); +- +- /* Send mailbox interrupt twice as a hardware workaround */ +- core = brcmf_chip_get_core(devinfo->ci, BCMA_CORE_PCIE2); +- if (core->rev <= 13) +- pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_SBMBX, 1); ++ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_SBMBX, 1); + + return 0; + } diff --git a/package/kernel/mac80211/patches/brcm/372-v5.2-brcmfmac-send-mailbox-interrupt-twice-for-specific-h.patch b/package/kernel/mac80211/patches/brcm/372-v5.2-brcmfmac-send-mailbox-interrupt-twice-for-specific-h.patch new file mode 100644 index 00000000000000..1fcf8c70c7531d --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/372-v5.2-brcmfmac-send-mailbox-interrupt-twice-for-specific-h.patch @@ -0,0 +1,39 @@ +From 9ef77fbedad9ea8895cd5d7fb7aee16071f527dc Mon Sep 17 00:00:00 2001 +From: Wright Feng +Date: Fri, 26 Apr 2019 03:12:32 +0000 +Subject: [PATCH] brcmfmac: send mailbox interrupt twice for specific hardware + device + +For PCIE wireless device with core revision less than 14, device may miss +PCIE to System Backplane Interrupt via PCIEtoSBMailbox. So add sending +mail box interrupt twice as a hardware workaround. + +Signed-off-by: Wright Feng +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -675,6 +675,7 @@ static int + brcmf_pcie_send_mb_data(struct brcmf_pciedev_info *devinfo, u32 htod_mb_data) + { + struct brcmf_pcie_shared_info *shared; ++ struct brcmf_core *core; + u32 addr; + u32 cur_htod_mb_data; + u32 i; +@@ -698,7 +699,11 @@ brcmf_pcie_send_mb_data(struct brcmf_pci + + brcmf_pcie_write_tcm32(devinfo, addr, htod_mb_data); + pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_SBMBX, 1); +- pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_SBMBX, 1); ++ ++ /* Send mailbox interrupt twice as a hardware workaround */ ++ core = brcmf_chip_get_core(devinfo->ci, BCMA_CORE_PCIE2); ++ if (core->rev <= 13) ++ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_SBMBX, 1); + + return 0; + } diff --git a/package/kernel/mac80211/patches/brcm/374-v5.2-brcmfmac-set-txflow-request-id-from-1-to-pktids-arra.patch b/package/kernel/mac80211/patches/brcm/374-v5.2-brcmfmac-set-txflow-request-id-from-1-to-pktids-arra.patch new file mode 100644 index 00000000000000..6702dd57b6abb8 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/374-v5.2-brcmfmac-set-txflow-request-id-from-1-to-pktids-arra.patch @@ -0,0 +1,49 @@ +From 2d91c8ad068a5cad4d9e7ece8dc811a697c7176a Mon Sep 17 00:00:00 2001 +From: Wright Feng +Date: Fri, 26 Apr 2019 03:41:46 +0000 +Subject: [PATCH] brcmfmac: set txflow request id from 1 to pktids array size + +Some PCIE firmwares drop txstatus if pktid is 0 and make packet held in +host side and never be released. If that packet type is 802.1x, the +pend_8021x_cnt value will be always greater than 0 and show "Timed out +waiting for no pending 802.1x packets" error message when sending key to +dongle every time. + +To be compatible with all firmwares, host should set txflow request id +from 1 instead of from 0. + +Signed-off-by: Wright Feng +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +@@ -375,7 +375,7 @@ brcmf_msgbuf_get_pktid(struct device *de + struct brcmf_msgbuf_pktid *pktid; + struct sk_buff *skb; + +- if (idx >= pktids->array_size) { ++ if (idx < 0 || idx >= pktids->array_size) { + brcmf_err("Invalid packet id %d (max %d)\n", idx, + pktids->array_size); + return NULL; +@@ -747,7 +747,7 @@ static void brcmf_msgbuf_txflow(struct b + tx_msghdr = (struct msgbuf_tx_msghdr *)ret_ptr; + + tx_msghdr->msg.msgtype = MSGBUF_TYPE_TX_POST; +- tx_msghdr->msg.request_id = cpu_to_le32(pktid); ++ tx_msghdr->msg.request_id = cpu_to_le32(pktid + 1); + tx_msghdr->msg.ifidx = brcmf_flowring_ifidx_get(flow, flowid); + tx_msghdr->flags = BRCMF_MSGBUF_PKT_FLAGS_FRAME_802_3; + tx_msghdr->flags |= (skb->priority & 0x07) << +@@ -884,7 +884,7 @@ brcmf_msgbuf_process_txstatus(struct brc + u16 flowid; + + tx_status = (struct msgbuf_tx_status *)buf; +- idx = le32_to_cpu(tx_status->msg.request_id); ++ idx = le32_to_cpu(tx_status->msg.request_id) - 1; + flowid = le16_to_cpu(tx_status->compl_hdr.flow_ring_id); + flowid -= BRCMF_H2D_MSGRING_FLOWRING_IDSTART; + skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev, diff --git a/package/kernel/mac80211/patches/brcm/375-v5.2-brcmfmac-print-firmware-messages-after-a-firmware-cr.patch b/package/kernel/mac80211/patches/brcm/375-v5.2-brcmfmac-print-firmware-messages-after-a-firmware-cr.patch new file mode 100644 index 00000000000000..ceb85055d5e8e7 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/375-v5.2-brcmfmac-print-firmware-messages-after-a-firmware-cr.patch @@ -0,0 +1,90 @@ +From 47dd82e3d25e85a7c7c4e4b0eac9d297d1e5e2d4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sun, 28 Apr 2019 23:38:26 +0200 +Subject: [PATCH] brcmfmac: print firmware messages after a firmware crash +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Normally firmware messages are printed with debugging enabled only. It's +a good idea as firmware may print a lot of messages that normal users +don't need to care about. + +However, on firmware crash, it may be very helpful to log all recent +messages. There is almost always a backtrace available as well as rought +info on the latest actions/state. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/pcie.c | 24 ++++++++++++++----- + 1 file changed, 18 insertions(+), 6 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -764,15 +764,22 @@ static void brcmf_pcie_bus_console_init( + console->base_addr, console->buf_addr, console->bufsize); + } + +- +-static void brcmf_pcie_bus_console_read(struct brcmf_pciedev_info *devinfo) ++/** ++ * brcmf_pcie_bus_console_read - reads firmware messages ++ * ++ * @error: specifies if error has occurred (prints messages unconditionally) ++ */ ++static void brcmf_pcie_bus_console_read(struct brcmf_pciedev_info *devinfo, ++ bool error) + { ++ struct pci_dev *pdev = devinfo->pdev; ++ struct brcmf_bus *bus = dev_get_drvdata(&pdev->dev); + struct brcmf_pcie_console *console; + u32 addr; + u8 ch; + u32 newidx; + +- if (!BRCMF_FWCON_ON()) ++ if (!error && !BRCMF_FWCON_ON()) + return; + + console = &devinfo->shared.console; +@@ -796,7 +803,10 @@ static void brcmf_pcie_bus_console_read( + } + if (ch == '\n') { + console->log_str[console->log_idx] = 0; +- pr_debug("CONSOLE: %s", console->log_str); ++ if (error) ++ brcmf_err(bus, "CONSOLE: %s", console->log_str); ++ else ++ pr_debug("CONSOLE: %s", console->log_str); + console->log_idx = 0; + } + } +@@ -857,7 +867,7 @@ static irqreturn_t brcmf_pcie_isr_thread + &devinfo->pdev->dev); + } + } +- brcmf_pcie_bus_console_read(devinfo); ++ brcmf_pcie_bus_console_read(devinfo, false); + if (devinfo->state == BRCMFMAC_PCIE_STATE_UP) + brcmf_pcie_intr_enable(devinfo); + devinfo->in_irq = false; +@@ -1426,6 +1436,8 @@ static int brcmf_pcie_reset(struct devic + struct brcmf_fw_request *fwreq; + int err; + ++ brcmf_pcie_bus_console_read(devinfo, true); ++ + brcmf_detach(dev); + + brcmf_pcie_release_irq(devinfo); +@@ -1818,7 +1830,7 @@ static void brcmf_pcie_setup(struct devi + if (brcmf_attach(&devinfo->pdev->dev, devinfo->settings) == 0) + return; + +- brcmf_pcie_bus_console_read(devinfo); ++ brcmf_pcie_bus_console_read(devinfo, false); + + fail: + device_release_driver(dev); diff --git a/package/kernel/mac80211/patches/brcm/380-v5.4-0001-brcmfmac-switch-source-files-to-using-SPDX-license-i.patch b/package/kernel/mac80211/patches/brcm/380-v5.4-0001-brcmfmac-switch-source-files-to-using-SPDX-license-i.patch new file mode 100644 index 00000000000000..aef48928a590ef --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/380-v5.4-0001-brcmfmac-switch-source-files-to-using-SPDX-license-i.patch @@ -0,0 +1,1223 @@ +From daeccac2d5e7a6179ffff63e40b4a59bc3376a05 Mon Sep 17 00:00:00 2001 +From: Arend van Spriel +Date: Thu, 16 May 2019 14:04:09 +0200 +Subject: [PATCH] brcmfmac: switch source files to using SPDX license + identifier + +With ISC license text in place under the LICENSES folder switch +to using the SPDX license identifier to refer to the ISC license. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/Makefile | 14 ++------------ + .../broadcom/brcm80211/brcmfmac/Makefile | 14 ++------------ + .../wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 13 +------------ + .../wireless/broadcom/brcm80211/brcmfmac/bcdc.h | 13 +------------ + .../broadcom/brcm80211/brcmfmac/bcmsdh.c | 13 +------------ + .../broadcom/brcm80211/brcmfmac/btcoex.c | 13 +------------ + .../broadcom/brcm80211/brcmfmac/btcoex.h | 13 +------------ + .../wireless/broadcom/brcm80211/brcmfmac/bus.h | 13 +------------ + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 13 +------------ + .../broadcom/brcm80211/brcmfmac/cfg80211.h | 13 +------------ + .../wireless/broadcom/brcm80211/brcmfmac/chip.c | 13 +------------ + .../wireless/broadcom/brcm80211/brcmfmac/chip.h | 13 +------------ + .../broadcom/brcm80211/brcmfmac/common.c | 13 +------------ + .../broadcom/brcm80211/brcmfmac/common.h | 16 +++------------- + .../broadcom/brcm80211/brcmfmac/commonring.c | 16 +++------------- + .../broadcom/brcm80211/brcmfmac/commonring.h | 16 +++------------- + .../wireless/broadcom/brcm80211/brcmfmac/core.c | 13 +------------ + .../wireless/broadcom/brcm80211/brcmfmac/core.h | 13 +------------ + .../wireless/broadcom/brcm80211/brcmfmac/debug.c | 13 +------------ + .../wireless/broadcom/brcm80211/brcmfmac/debug.h | 13 +------------ + .../wireless/broadcom/brcm80211/brcmfmac/dmi.c | 13 +------------ + .../broadcom/brcm80211/brcmfmac/feature.c | 13 +------------ + .../broadcom/brcm80211/brcmfmac/feature.h | 13 +------------ + .../broadcom/brcm80211/brcmfmac/firmware.c | 13 +------------ + .../broadcom/brcm80211/brcmfmac/firmware.h | 13 +------------ + .../broadcom/brcm80211/brcmfmac/flowring.c | 16 +++------------- + .../broadcom/brcm80211/brcmfmac/flowring.h | 16 +++------------- + .../wireless/broadcom/brcm80211/brcmfmac/fweh.c | 13 +------------ + .../wireless/broadcom/brcm80211/brcmfmac/fweh.h | 13 +------------ + .../wireless/broadcom/brcm80211/brcmfmac/fwil.c | 13 +------------ + .../wireless/broadcom/brcm80211/brcmfmac/fwil.h | 13 +------------ + .../broadcom/brcm80211/brcmfmac/fwil_types.h | 13 +------------ + .../broadcom/brcm80211/brcmfmac/fwsignal.c | 13 +------------ + .../broadcom/brcm80211/brcmfmac/fwsignal.h | 14 +------------- + .../broadcom/brcm80211/brcmfmac/msgbuf.c | 16 +++------------- + .../broadcom/brcm80211/brcmfmac/msgbuf.h | 16 +++------------- + .../wireless/broadcom/brcm80211/brcmfmac/of.c | 13 +------------ + .../wireless/broadcom/brcm80211/brcmfmac/of.h | 13 +------------ + .../wireless/broadcom/brcm80211/brcmfmac/p2p.c | 13 +------------ + .../wireless/broadcom/brcm80211/brcmfmac/p2p.h | 13 +------------ + .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 16 +++------------- + .../wireless/broadcom/brcm80211/brcmfmac/pcie.h | 16 +++------------- + .../wireless/broadcom/brcm80211/brcmfmac/pno.c | 13 +------------ + .../wireless/broadcom/brcm80211/brcmfmac/pno.h | 13 +------------ + .../wireless/broadcom/brcm80211/brcmfmac/proto.c | 13 +------------ + .../wireless/broadcom/brcm80211/brcmfmac/proto.h | 13 +------------ + .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 13 +------------ + .../wireless/broadcom/brcm80211/brcmfmac/sdio.h | 13 +------------ + .../broadcom/brcm80211/brcmfmac/tracepoint.c | 13 +------------ + .../broadcom/brcm80211/brcmfmac/tracepoint.h | 13 +------------ + .../wireless/broadcom/brcm80211/brcmfmac/usb.c | 13 +------------ + .../wireless/broadcom/brcm80211/brcmfmac/usb.h | 13 +------------ + .../broadcom/brcm80211/brcmfmac/vendor.c | 13 +------------ + .../broadcom/brcm80211/brcmfmac/vendor.h | 13 +------------ + 54 files changed, 74 insertions(+), 658 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/Makefile ++++ b/drivers/net/wireless/broadcom/brcm80211/Makefile +@@ -1,19 +1,9 @@ ++# SPDX-License-Identifier: ISC + # +-# Makefile fragment for Broadcom 802.11n Networking Device Driver ++# Makefile fragment for Broadcom 802.11 Networking Device Driver + # + # Copyright (c) 2010 Broadcom Corporation + # +-# 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. + + # common flags + subdir-ccflags-$(CPTCFG_BRCMDBG) += -DDEBUG +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile +@@ -1,19 +1,9 @@ ++# SPDX-License-Identifier: ISC + # +-# Makefile fragment for Broadcom 802.11n Networking Device Driver ++# Makefile fragment for Broadcom 802.11 Networking Device Driver + # + # Copyright (c) 2010 Broadcom Corporation + # +-# 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. + + ccflags-y += \ + -I$(backport_srctree)/drivers/net/wireless/broadcom/brcm80211/brcmfmac \ +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2010 Broadcom Corporation +- * +- * 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. + */ + + /******************************************************************************* +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2013 Broadcom Corporation +- * +- * 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. + */ + #ifndef BRCMFMAC_BCDC_H + #define BRCMFMAC_BCDC_H +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2010 Broadcom Corporation +- * +- * 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. + */ + /* ****************** SDIO CARD Interface Functions **************************/ + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/btcoex.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/btcoex.c +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2013 Broadcom Corporation +- * +- * 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 + #include +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/btcoex.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/btcoex.h +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2013 Broadcom Corporation +- * +- * 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. + */ + #ifndef WL_BTCOEX_H_ + #define WL_BTCOEX_H_ +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2010 Broadcom Corporation +- * +- * 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. + */ + + #ifndef BRCMFMAC_BUS_H +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2010 Broadcom Corporation +- * +- * 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. + */ + + /* Toplevel file. Relies on dhd_linux.c to send commands to the dongle. */ +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2010 Broadcom Corporation +- * +- * 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. + */ + + #ifndef BRCMFMAC_CFG80211_H +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2014 Broadcom Corporation +- * +- * 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 + #include +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2014 Broadcom Corporation +- * +- * 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. + */ + #ifndef BRCMF_CHIP_H + #define BRCMF_CHIP_H +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2010 Broadcom Corporation +- * +- * 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 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h +@@ -1,16 +1,6 @@ +-/* Copyright (c) 2014 Broadcom Corporation +- * +- * 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. ++// SPDX-License-Identifier: ISC ++/* ++ * Copyright (c) 2014 Broadcom Corporation + */ + #ifndef BRCMFMAC_COMMON_H + #define BRCMFMAC_COMMON_H +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/commonring.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/commonring.c +@@ -1,16 +1,6 @@ +-/* Copyright (c) 2014 Broadcom Corporation +- * +- * 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. ++// SPDX-License-Identifier: ISC ++/* ++ * Copyright (c) 2014 Broadcom Corporation + */ + + #include +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/commonring.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/commonring.h +@@ -1,16 +1,6 @@ +-/* Copyright (c) 2014 Broadcom Corporation +- * +- * 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. ++// SPDX-License-Identifier: ISC ++/* ++ * Copyright (c) 2014 Broadcom Corporation + */ + #ifndef BRCMFMAC_COMMONRING_H + #define BRCMFMAC_COMMONRING_H +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2010 Broadcom Corporation +- * +- * 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 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2010 Broadcom Corporation +- * +- * 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. + */ + + /**************** +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2012 Broadcom Corporation +- * +- * 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 + #include +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2010 Broadcom Corporation +- * +- * 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. + */ + + #ifndef BRCMFMAC_DEBUG_H +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright 2018 Hans de Goede +- * +- * 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 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2014 Broadcom Corporation +- * +- * 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 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2014 Broadcom Corporation +- * +- * 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. + */ + #ifndef _BRCMF_FEATURE_H + #define _BRCMF_FEATURE_H +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2013 Broadcom Corporation +- * +- * 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 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2013 Broadcom Corporation +- * +- * 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. + */ + #ifndef BRCMFMAC_FIRMWARE_H + #define BRCMFMAC_FIRMWARE_H +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c +@@ -1,16 +1,6 @@ +-/* Copyright (c) 2014 Broadcom Corporation +- * +- * 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. ++// SPDX-License-Identifier: ISC ++/* ++ * Copyright (c) 2014 Broadcom Corporation + */ + + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h +@@ -1,16 +1,6 @@ +-/* Copyright (c) 2014 Broadcom Corporation +- * +- * 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. ++// SPDX-License-Identifier: ISC ++/* ++ * Copyright (c) 2014 Broadcom Corporation + */ + #ifndef BRCMFMAC_FLOWRING_H + #define BRCMFMAC_FLOWRING_H +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2012 Broadcom Corporation +- * +- * 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 + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2012 Broadcom Corporation +- * +- * 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. + */ + + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2012 Broadcom Corporation +- * +- * 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. + */ + + /* FWIL is the Firmware Interface Layer. In this module the support functions +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2012 Broadcom Corporation +- * +- * 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. + */ + + #ifndef _fwil_h_ +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2012 Broadcom Corporation +- * +- * 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. + */ + + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2010 Broadcom Corporation +- * +- * 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 + #include +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h +@@ -1,20 +1,8 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2012 Broadcom Corporation +- * +- * 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. + */ + +- + #ifndef FWSIGNAL_H_ + #define FWSIGNAL_H_ + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +@@ -1,16 +1,6 @@ +-/* Copyright (c) 2014 Broadcom Corporation +- * +- * 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. ++// SPDX-License-Identifier: ISC ++/* ++ * Copyright (c) 2014 Broadcom Corporation + */ + + /******************************************************************************* +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h +@@ -1,16 +1,6 @@ +-/* Copyright (c) 2014 Broadcom Corporation +- * +- * 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. ++// SPDX-License-Identifier: ISC ++/* ++ * Copyright (c) 2014 Broadcom Corporation + */ + #ifndef BRCMFMAC_MSGBUF_H + #define BRCMFMAC_MSGBUF_H +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2014 Broadcom Corporation +- * +- * 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 + #include +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.h +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2014 Broadcom Corporation +- * +- * 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. + */ + #ifdef CONFIG_OF + void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2012 Broadcom Corporation +- * +- * 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 + #include +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2012 Broadcom Corporation +- * +- * 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. + */ + #ifndef WL_CFGP2P_H_ + #define WL_CFGP2P_H_ +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -1,16 +1,6 @@ +-/* Copyright (c) 2014 Broadcom Corporation +- * +- * 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. ++// SPDX-License-Identifier: ISC ++/* ++ * Copyright (c) 2014 Broadcom Corporation + */ + + #include +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.h +@@ -1,16 +1,6 @@ +-/* Copyright (c) 2014 Broadcom Corporation +- * +- * 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. ++// SPDX-License-Identifier: ISC ++/* ++ * Copyright (c) 2014 Broadcom Corporation + */ + #ifndef BRCMFMAC_PCIE_H + #define BRCMFMAC_PCIE_H +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2016 Broadcom +- * +- * 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 + #include +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.h +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2016 Broadcom +- * +- * 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. + */ + #ifndef _BRCMF_PNO_H + #define _BRCMF_PNO_H +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2013 Broadcom Corporation +- * +- * 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. + */ + + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2013 Broadcom Corporation +- * +- * 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. + */ + #ifndef BRCMFMAC_PROTO_H + #define BRCMFMAC_PROTO_H +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2010 Broadcom Corporation +- * +- * 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 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2010 Broadcom Corporation +- * +- * 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. + */ + + #ifndef BRCMFMAC_SDIO_H +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2012 Broadcom Corporation +- * +- * 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 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.h +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2013 Broadcom Corporation +- * +- * 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. + */ + #if !defined(BRCMF_TRACEPOINT_H_) || defined(TRACE_HEADER_MULTI_READ) + #define BRCMF_TRACEPOINT_H_ +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2011 Broadcom Corporation +- * +- * 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 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.h +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2011 Broadcom Corporation +- * +- * 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. + */ + #ifndef BRCMFMAC_USB_H + #define BRCMFMAC_USB_H +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2014 Broadcom Corporation +- * +- * 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 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.h +@@ -1,17 +1,6 @@ ++// SPDX-License-Identifier: ISC + /* + * Copyright (c) 2014 Broadcom Corporation +- * +- * 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. + */ + + #ifndef _vendor_h_ diff --git a/package/kernel/mac80211/patches/brcm/381-v5.4-brcmfmac-fix-typos-in-code-comments.patch b/package/kernel/mac80211/patches/brcm/381-v5.4-brcmfmac-fix-typos-in-code-comments.patch new file mode 100644 index 00000000000000..da359063c68215 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/381-v5.4-brcmfmac-fix-typos-in-code-comments.patch @@ -0,0 +1,24 @@ +From b07e1ae2ce53a60af67009ef199603a588003e07 Mon Sep 17 00:00:00 2001 +From: Weitao Hou +Date: Mon, 20 May 2019 20:28:25 +0800 +Subject: [PATCH] brcmfmac: fix typos in code comments + +fix lengh to length + +Signed-off-by: Weitao Hou +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c +@@ -303,7 +303,7 @@ brcmf_create_bsscfg(s32 bsscfgidx, char + return brcmf_create_iovar(name, data, datalen, buf, buflen); + + prefixlen = strlen(prefix); +- namelen = strlen(name) + 1; /* lengh of iovar name + null */ ++ namelen = strlen(name) + 1; /* length of iovar name + null */ + iolen = prefixlen + namelen + sizeof(bsscfgidx_le) + datalen; + + if (buflen < iolen) { diff --git a/package/kernel/mac80211/patches/brcm/382-v5.4-brcmfmac-use-strlcpy-instead-of-strcpy.patch b/package/kernel/mac80211/patches/brcm/382-v5.4-brcmfmac-use-strlcpy-instead-of-strcpy.patch new file mode 100644 index 00000000000000..d6ddd841ccf290 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/382-v5.4-brcmfmac-use-strlcpy-instead-of-strcpy.patch @@ -0,0 +1,26 @@ +From bbfab331e3abd9fa8767eea6bf5c4684cdd4b934 Mon Sep 17 00:00:00 2001 +From: Neo Jou +Date: Tue, 21 May 2019 17:12:20 +0800 +Subject: [PATCH] brcmfmac: use strlcpy() instead of strcpy() + +The function strcpy() is inherently not safe. Though the function +works without problems here, it would be better to use other safer +function, e.g. strlcpy(), to replace strcpy() still. + +Signed-off-by: Neo Jou +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -258,7 +258,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + + /* query for 'ver' to get version info from firmware */ + memset(buf, 0, sizeof(buf)); +- strcpy(buf, "ver"); ++ strlcpy(buf, "ver", sizeof(buf)); + err = brcmf_fil_iovar_data_get(ifp, "ver", buf, sizeof(buf)); + if (err < 0) { + bphy_err(drvr, "Retrieving version information failed, %d\n", diff --git a/package/kernel/mac80211/patches/brcm/383-v5.4-0001-brcmfmac-add-160MHz-in-chandef_to_chanspec.patch b/package/kernel/mac80211/patches/brcm/383-v5.4-0001-brcmfmac-add-160MHz-in-chandef_to_chanspec.patch new file mode 100644 index 00000000000000..0d38084e9065e6 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/383-v5.4-0001-brcmfmac-add-160MHz-in-chandef_to_chanspec.patch @@ -0,0 +1,56 @@ +From f491645f039420fb7e14283e21b90772571c807c Mon Sep 17 00:00:00 2001 +From: Arend van Spriel +Date: Thu, 11 Jul 2019 10:45:30 +0200 +Subject: [PATCH] brcmfmac: add 160MHz in chandef_to_chanspec() + +The function chandef_to_chanspec() was not handling 160MHz bandwidth +resulting in wrong encoding of the channel. That resulting in firmware +rejecting the provided channel specification. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 21 ++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -276,8 +276,26 @@ static u16 chandef_to_chanspec(struct br + else + ch_inf.sb = BRCMU_CHAN_SB_UU; + break; +- case NL80211_CHAN_WIDTH_80P80: + case NL80211_CHAN_WIDTH_160: ++ ch_inf.bw = BRCMU_CHAN_BW_160; ++ if (primary_offset == -70) ++ ch_inf.sb = BRCMU_CHAN_SB_LLL; ++ else if (primary_offset == -50) ++ ch_inf.sb = BRCMU_CHAN_SB_LLU; ++ else if (primary_offset == -30) ++ ch_inf.sb = BRCMU_CHAN_SB_LUL; ++ else if (primary_offset == -10) ++ ch_inf.sb = BRCMU_CHAN_SB_LUU; ++ else if (primary_offset == 10) ++ ch_inf.sb = BRCMU_CHAN_SB_ULL; ++ else if (primary_offset == 30) ++ ch_inf.sb = BRCMU_CHAN_SB_ULU; ++ else if (primary_offset == 50) ++ ch_inf.sb = BRCMU_CHAN_SB_UUL; ++ else ++ ch_inf.sb = BRCMU_CHAN_SB_UUU; ++ break; ++ case NL80211_CHAN_WIDTH_80P80: + case NL80211_CHAN_WIDTH_5: + case NL80211_CHAN_WIDTH_10: + default: +@@ -296,6 +314,7 @@ static u16 chandef_to_chanspec(struct br + } + d11inf->encchspec(&ch_inf); + ++ brcmf_dbg(TRACE, "chanspec: 0x%x\n", ch_inf.chspec); + return ch_inf.chspec; + } + diff --git a/package/kernel/mac80211/patches/brcm/383-v5.4-0002-brcmfmac-enable-DFS_OFFLOAD-extended-feature-if-supp.patch b/package/kernel/mac80211/patches/brcm/383-v5.4-0002-brcmfmac-enable-DFS_OFFLOAD-extended-feature-if-supp.patch new file mode 100644 index 00000000000000..7048d1c690f279 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/383-v5.4-0002-brcmfmac-enable-DFS_OFFLOAD-extended-feature-if-supp.patch @@ -0,0 +1,63 @@ +From 011a56a3336a5de9c3152c169cd52ff79b8c3f89 Mon Sep 17 00:00:00 2001 +From: Arend van Spriel +Date: Thu, 11 Jul 2019 10:45:31 +0200 +Subject: [PATCH] brcmfmac: enable DFS_OFFLOAD extended feature if supported + +If the firmware supports 802.11h and the device can operate in 5GHz +band we can enable DFS_OFFLOAD extended feature. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 5 +++++ + drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c | 1 + + drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h | 4 +++- + 3 files changed, 9 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -6725,6 +6725,11 @@ static int brcmf_setup_wiphy(struct wiph + } + } + ++ if (wiphy->bands[NL80211_BAND_5GHZ] && ++ brcmf_feat_is_enabled(ifp, BRCMF_FEAT_DOT11H)) ++ wiphy_ext_feature_set(wiphy, ++ NL80211_EXT_FEATURE_DFS_OFFLOAD); ++ + wiphy_read_of_freq_limits(wiphy); + + return 0; +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +@@ -39,6 +39,7 @@ static const struct brcmf_feat_fwcap brc + { BRCMF_FEAT_P2P, "p2p" }, + { BRCMF_FEAT_MONITOR, "monitor" }, + { BRCMF_FEAT_MONITOR_FMT_RADIOTAP, "rtap" }, ++ { BRCMF_FEAT_DOT11H, "802.11h" } + }; + + #ifdef DEBUG +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h +@@ -25,6 +25,7 @@ + * MONITOR: firmware can pass monitor packets to host. + * MONITOR_FMT_RADIOTAP: firmware provides monitor packets with radiotap header + * MONITOR_FMT_HW_RX_HDR: firmware provides monitor packets with hw/ucode header ++ * DOT11H: firmware supports 802.11h + */ + #define BRCMF_FEAT_LIST \ + BRCMF_FEAT_DEF(MBSS) \ +@@ -43,7 +44,8 @@ + BRCMF_FEAT_DEF(FWSUP) \ + BRCMF_FEAT_DEF(MONITOR) \ + BRCMF_FEAT_DEF(MONITOR_FMT_RADIOTAP) \ +- BRCMF_FEAT_DEF(MONITOR_FMT_HW_RX_HDR) ++ BRCMF_FEAT_DEF(MONITOR_FMT_HW_RX_HDR) \ ++ BRCMF_FEAT_DEF(DOT11H) + + /* + * Quirks: diff --git a/package/kernel/mac80211/patches/brcm/383-v5.4-0003-brcmfmac-allow-160MHz-in-custom-regulatory-rules.patch b/package/kernel/mac80211/patches/brcm/383-v5.4-0003-brcmfmac-allow-160MHz-in-custom-regulatory-rules.patch new file mode 100644 index 00000000000000..3df8057ced9033 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/383-v5.4-0003-brcmfmac-allow-160MHz-in-custom-regulatory-rules.patch @@ -0,0 +1,34 @@ +From fa9050927fa885410055ee03c948c2252693d296 Mon Sep 17 00:00:00 2001 +From: Arend van Spriel +Date: Thu, 11 Jul 2019 10:45:32 +0200 +Subject: [PATCH] brcmfmac: allow 160MHz in custom regulatory rules + +The driver has custom regulatory rules which had maximum bandwidth +for 5GHz channels set to 80MHz. As a consequence the driver can +not use 160MHz in AP mode even when the device supports it. So +relax the rules allowing 160MHz. After wiphy_register() the channel +flags are updated according what the device actually supports. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -189,9 +189,9 @@ static const struct ieee80211_regdomain + */ + REG_RULE(2484-10, 2484+10, 20, 6, 20, 0), + /* IEEE 802.11a, channel 36..64 */ +- REG_RULE(5150-10, 5350+10, 80, 6, 20, 0), ++ REG_RULE(5150-10, 5350+10, 160, 6, 20, 0), + /* IEEE 802.11a, channel 100..165 */ +- REG_RULE(5470-10, 5850+10, 80, 6, 20, 0), } ++ REG_RULE(5470-10, 5850+10, 160, 6, 20, 0), } + }; + + /* Note: brcmf_cipher_suites is an array of int defining which cipher suites diff --git a/package/kernel/mac80211/patches/brcm/384-v5.4-0001-Revert-brcmfmac-fix-NULL-pointer-derefence-during-US.patch b/package/kernel/mac80211/patches/brcm/384-v5.4-0001-Revert-brcmfmac-fix-NULL-pointer-derefence-during-US.patch new file mode 100644 index 00000000000000..b01db877bbf397 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/384-v5.4-0001-Revert-brcmfmac-fix-NULL-pointer-derefence-during-US.patch @@ -0,0 +1,168 @@ +From a84a60ccdd65278485fb495f468a5ab91a75c649 Mon Sep 17 00:00:00 2001 +From: Arend van Spriel +Date: Thu, 11 Jul 2019 11:05:06 +0200 +Subject: [PATCH] Revert "brcmfmac: fix NULL pointer derefence during USB + disconnect" + +This reverts commit 5cdb0ef6144f47440850553579aa923c20a63f23. Subsequent +changes make rework the driver code fixing the issue differently. + +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 11 ++--------- + .../wireless/broadcom/brcm80211/brcmfmac/bcdc.h | 6 ++---- + .../wireless/broadcom/brcm80211/brcmfmac/core.c | 4 +--- + .../broadcom/brcm80211/brcmfmac/fwsignal.c | 16 ++++------------ + .../broadcom/brcm80211/brcmfmac/fwsignal.h | 3 +-- + .../wireless/broadcom/brcm80211/brcmfmac/proto.c | 10 ++-------- + .../wireless/broadcom/brcm80211/brcmfmac/proto.h | 3 +-- + 7 files changed, 13 insertions(+), 40 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c +@@ -479,18 +479,11 @@ fail: + return -ENOMEM; + } + +-void brcmf_proto_bcdc_detach_pre_delif(struct brcmf_pub *drvr) +-{ +- struct brcmf_bcdc *bcdc = drvr->proto->pd; +- +- brcmf_fws_detach_pre_delif(bcdc->fws); +-} +- +-void brcmf_proto_bcdc_detach_post_delif(struct brcmf_pub *drvr) ++void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr) + { + struct brcmf_bcdc *bcdc = drvr->proto->pd; + + drvr->proto->pd = NULL; +- brcmf_fws_detach_post_delif(bcdc->fws); ++ brcmf_fws_detach(bcdc->fws); + kfree(bcdc); + } +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h +@@ -7,16 +7,14 @@ + + #ifdef CPTCFG_BRCMFMAC_PROTO_BCDC + int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr); +-void brcmf_proto_bcdc_detach_pre_delif(struct brcmf_pub *drvr); +-void brcmf_proto_bcdc_detach_post_delif(struct brcmf_pub *drvr); ++void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr); + void brcmf_proto_bcdc_txflowblock(struct device *dev, bool state); + void brcmf_proto_bcdc_txcomplete(struct device *dev, struct sk_buff *txp, + bool success); + struct brcmf_fws_info *drvr_to_fws(struct brcmf_pub *drvr); + #else + static inline int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) { return 0; } +-static void brcmf_proto_bcdc_detach_pre_delif(struct brcmf_pub *drvr) {}; +-static inline void brcmf_proto_bcdc_detach_post_delif(struct brcmf_pub *drvr) {} ++static inline void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr) {} + #endif + + #endif /* BRCMFMAC_BCDC_H */ +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -1335,8 +1335,6 @@ void brcmf_detach(struct device *dev) + + brcmf_bus_change_state(bus_if, BRCMF_BUS_DOWN); + +- brcmf_proto_detach_pre_delif(drvr); +- + if (drvr->mon_if) { + brcmf_net_detach(drvr->mon_if->ndev, false); + drvr->mon_if = NULL; +@@ -1351,7 +1349,7 @@ void brcmf_detach(struct device *dev) + + brcmf_bus_stop(drvr->bus_if); + +- brcmf_proto_detach_post_delif(drvr); ++ brcmf_proto_detach(drvr); + + bus_if->drvr = NULL; + wiphy_free(drvr->wiphy); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c +@@ -2432,25 +2432,17 @@ struct brcmf_fws_info *brcmf_fws_attach( + return fws; + + fail: +- brcmf_fws_detach_pre_delif(fws); +- brcmf_fws_detach_post_delif(fws); ++ brcmf_fws_detach(fws); + return ERR_PTR(rc); + } + +-void brcmf_fws_detach_pre_delif(struct brcmf_fws_info *fws) ++void brcmf_fws_detach(struct brcmf_fws_info *fws) + { + if (!fws) + return; +- if (fws->fws_wq) { +- destroy_workqueue(fws->fws_wq); +- fws->fws_wq = NULL; +- } +-} + +-void brcmf_fws_detach_post_delif(struct brcmf_fws_info *fws) +-{ +- if (!fws) +- return; ++ if (fws->fws_wq) ++ destroy_workqueue(fws->fws_wq); + + /* cleanup */ + brcmf_fws_lock(fws); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h +@@ -7,8 +7,7 @@ + #define FWSIGNAL_H_ + + struct brcmf_fws_info *brcmf_fws_attach(struct brcmf_pub *drvr); +-void brcmf_fws_detach_pre_delif(struct brcmf_fws_info *fws); +-void brcmf_fws_detach_post_delif(struct brcmf_fws_info *fws); ++void brcmf_fws_detach(struct brcmf_fws_info *fws); + void brcmf_fws_debugfs_create(struct brcmf_pub *drvr); + bool brcmf_fws_queue_skbs(struct brcmf_fws_info *fws); + bool brcmf_fws_fc_active(struct brcmf_fws_info *fws); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c +@@ -56,22 +56,16 @@ fail: + return -ENOMEM; + } + +-void brcmf_proto_detach_post_delif(struct brcmf_pub *drvr) ++void brcmf_proto_detach(struct brcmf_pub *drvr) + { + brcmf_dbg(TRACE, "Enter\n"); + + if (drvr->proto) { + if (drvr->bus_if->proto_type == BRCMF_PROTO_BCDC) +- brcmf_proto_bcdc_detach_post_delif(drvr); ++ brcmf_proto_bcdc_detach(drvr); + else if (drvr->bus_if->proto_type == BRCMF_PROTO_MSGBUF) + brcmf_proto_msgbuf_detach(drvr); + kfree(drvr->proto); + drvr->proto = NULL; + } + } +- +-void brcmf_proto_detach_pre_delif(struct brcmf_pub *drvr) +-{ +- if (drvr->proto && drvr->bus_if->proto_type == BRCMF_PROTO_BCDC) +- brcmf_proto_bcdc_detach_pre_delif(drvr); +-} +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h +@@ -43,8 +43,7 @@ struct brcmf_proto { + + + int brcmf_proto_attach(struct brcmf_pub *drvr); +-void brcmf_proto_detach_pre_delif(struct brcmf_pub *drvr); +-void brcmf_proto_detach_post_delif(struct brcmf_pub *drvr); ++void brcmf_proto_detach(struct brcmf_pub *drvr); + + static inline int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws, + struct sk_buff *skb, diff --git a/package/kernel/mac80211/patches/brcm/384-v5.4-0002-brcmfmac-change-the-order-of-things-in-brcmf_detach.patch b/package/kernel/mac80211/patches/brcm/384-v5.4-0002-brcmfmac-change-the-order-of-things-in-brcmf_detach.patch new file mode 100644 index 00000000000000..4385dc730edbd2 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/384-v5.4-0002-brcmfmac-change-the-order-of-things-in-brcmf_detach.patch @@ -0,0 +1,72 @@ +From 14fcfd1cc0c05ea58f47dd693fdd13f25dfe995e Mon Sep 17 00:00:00 2001 +From: Arend van Spriel +Date: Thu, 11 Jul 2019 11:05:07 +0200 +Subject: [PATCH] brcmfmac: change the order of things in brcmf_detach() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When brcmf_detach() from the bus layer upon rmmod we can no longer +communicate. Hence we will set the bus state to DOWN and cleanup +the event and protocol layer. The network interfaces need to be +deleted before brcmf_cfg80211_detach() because the latter does the +wiphy_unregister() which issues a warning if there are still network +devices linked to the wiphy instance. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Tested-by: Rafał Miłecki +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/core.c | 27 ++++++++++--------- + 1 file changed, 14 insertions(+), 13 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -1328,12 +1328,11 @@ void brcmf_detach(struct device *dev) + unregister_inet6addr_notifier(&drvr->inet6addr_notifier); + #endif + +- /* stop firmware event handling */ +- brcmf_fweh_detach(drvr); +- if (drvr->config) +- brcmf_p2p_detach(&drvr->config->p2p); +- + brcmf_bus_change_state(bus_if, BRCMF_BUS_DOWN); ++ brcmf_bus_stop(drvr->bus_if); ++ ++ brcmf_fweh_detach(drvr); ++ brcmf_proto_detach(drvr); + + if (drvr->mon_if) { + brcmf_net_detach(drvr->mon_if->ndev, false); +@@ -1341,17 +1340,19 @@ void brcmf_detach(struct device *dev) + } + + /* make sure primary interface removed last */ +- for (i = BRCMF_MAX_IFS-1; i > -1; i--) +- brcmf_remove_interface(drvr->iflist[i], false); +- +- brcmf_cfg80211_detach(drvr->config); +- drvr->config = NULL; +- +- brcmf_bus_stop(drvr->bus_if); ++ for (i = BRCMF_MAX_IFS - 1; i > -1; i--) { ++ if (drvr->iflist[i]) ++ brcmf_del_if(drvr, drvr->iflist[i]->bsscfgidx, false); ++ } + +- brcmf_proto_detach(drvr); ++ if (drvr->config) { ++ brcmf_p2p_detach(&drvr->config->p2p); ++ brcmf_cfg80211_detach(drvr->config); ++ drvr->config = NULL; ++ } + + bus_if->drvr = NULL; ++ + wiphy_free(drvr->wiphy); + } + diff --git a/package/kernel/mac80211/patches/brcm/384-v5.4-0003-brcmfmac-avoid-firmware-command-in-brcmf_netdev_open.patch b/package/kernel/mac80211/patches/brcm/384-v5.4-0003-brcmfmac-avoid-firmware-command-in-brcmf_netdev_open.patch new file mode 100644 index 00000000000000..4c42b2b0c93d24 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/384-v5.4-0003-brcmfmac-avoid-firmware-command-in-brcmf_netdev_open.patch @@ -0,0 +1,30 @@ +From c613085b74941024194e41b200601b9aa6ee388f Mon Sep 17 00:00:00 2001 +From: Arend van Spriel +Date: Thu, 11 Jul 2019 11:05:08 +0200 +Subject: [PATCH] brcmfmac: avoid firmware command in brcmf_netdev_open() when + bus is down + +No point in sending a firmware command when bus is down so make it +conditional checking the state. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -579,7 +579,8 @@ static int brcmf_netdev_stop(struct net_ + + brcmf_cfg80211_down(ndev); + +- brcmf_fil_iovar_data_set(ifp, "arp_hostip_clear", NULL, 0); ++ if (ifp->drvr->bus_if->state == BRCMF_BUS_UP) ++ brcmf_fil_iovar_data_set(ifp, "arp_hostip_clear", NULL, 0); + + brcmf_net_setcarrier(ifp, false); + diff --git a/package/kernel/mac80211/patches/brcm/384-v5.4-0004-brcmfmac-clear-events-in-brcmf_fweh_detach-will-alwa.patch b/package/kernel/mac80211/patches/brcm/384-v5.4-0004-brcmfmac-clear-events-in-brcmf_fweh_detach-will-alwa.patch new file mode 100644 index 00000000000000..d796faa79fa3f1 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/384-v5.4-0004-brcmfmac-clear-events-in-brcmf_fweh_detach-will-alwa.patch @@ -0,0 +1,38 @@ +From c33330ac06fe863289643e7a13ecdb6a2502dad7 Mon Sep 17 00:00:00 2001 +From: Arend van Spriel +Date: Thu, 11 Jul 2019 11:05:09 +0200 +Subject: [PATCH] brcmfmac: clear events in brcmf_fweh_detach() will always + fail + +Clearing firmware events in brcmf_fweh_detach() is always failing +because it is called only upon driver remove and communication +with firmware is no longer possible. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c | 9 --------- + 1 file changed, 9 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c +@@ -303,16 +303,7 @@ void brcmf_fweh_attach(struct brcmf_pub + void brcmf_fweh_detach(struct brcmf_pub *drvr) + { + struct brcmf_fweh_info *fweh = &drvr->fweh; +- struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0); +- s8 eventmask[BRCMF_EVENTING_MASK_LEN]; + +- if (ifp) { +- /* clear all events */ +- memset(eventmask, 0, BRCMF_EVENTING_MASK_LEN); +- (void)brcmf_fil_iovar_data_set(ifp, "event_msgs", +- eventmask, +- BRCMF_EVENTING_MASK_LEN); +- } + /* cancel the worker */ + cancel_work_sync(&fweh->event_work); + WARN_ON(!list_empty(&fweh->event_q)); diff --git a/package/kernel/mac80211/patches/brcm/384-v5.4-0005-brcmfmac-avoid-firmware-commands-when-bus-is-down.patch b/package/kernel/mac80211/patches/brcm/384-v5.4-0005-brcmfmac-avoid-firmware-commands-when-bus-is-down.patch new file mode 100644 index 00000000000000..f366bf8675218d --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/384-v5.4-0005-brcmfmac-avoid-firmware-commands-when-bus-is-down.patch @@ -0,0 +1,79 @@ +From 1ac11ae949dd883854f4523ef8e3a32aabfd6256 Mon Sep 17 00:00:00 2001 +From: Arend van Spriel +Date: Thu, 11 Jul 2019 11:05:10 +0200 +Subject: [PATCH] brcmfmac: avoid firmware commands when bus is down + +Upon rmmod a few attempts are made to inform firmware, but there is +no point as the bus is down and these will fail. Avoid them to keep +the logs clean. + +Reported-by: Stefan Wahren +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 23 +++++++++++-------- + 1 file changed, 13 insertions(+), 10 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -1286,17 +1286,21 @@ static void brcmf_link_down(struct brcmf + { + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy); + struct brcmf_pub *drvr = cfg->pub; ++ bool bus_up = drvr->bus_if->state == BRCMF_BUS_UP; + s32 err = 0; + + brcmf_dbg(TRACE, "Enter\n"); + + if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state)) { +- brcmf_dbg(INFO, "Call WLC_DISASSOC to stop excess roaming\n"); +- err = brcmf_fil_cmd_data_set(vif->ifp, +- BRCMF_C_DISASSOC, NULL, 0); +- if (err) { +- bphy_err(drvr, "WLC_DISASSOC failed (%d)\n", err); ++ if (bus_up) { ++ brcmf_dbg(INFO, "Call WLC_DISASSOC to stop excess roaming\n"); ++ err = brcmf_fil_cmd_data_set(vif->ifp, ++ BRCMF_C_DISASSOC, NULL, 0); ++ if (err) ++ bphy_err(drvr, "WLC_DISASSOC failed (%d)\n", ++ err); + } ++ + if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) || + (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT)) + cfg80211_disconnected(vif->wdev.netdev, reason, NULL, 0, +@@ -1306,7 +1310,8 @@ static void brcmf_link_down(struct brcmf + clear_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status); + brcmf_btcoex_set_mode(vif, BRCMF_BTCOEX_ENABLED, 0); + if (vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_NONE) { +- brcmf_set_pmk(vif->ifp, NULL, 0); ++ if (bus_up) ++ brcmf_set_pmk(vif->ifp, NULL, 0); + vif->profile.use_fwsup = BRCMF_PROFILE_FWSUP_NONE; + } + brcmf_dbg(TRACE, "Exit\n"); +@@ -4996,18 +5001,16 @@ static int brcmf_cfg80211_get_channel(st + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct net_device *ndev = wdev->netdev; + struct brcmf_pub *drvr = cfg->pub; +- struct brcmf_if *ifp; + struct brcmu_chan ch; + enum nl80211_band band = 0; + enum nl80211_chan_width width = 0; + u32 chanspec; + int freq, err; + +- if (!ndev) ++ if (!ndev || drvr->bus_if->state != BRCMF_BUS_UP) + return -ENODEV; +- ifp = netdev_priv(ndev); + +- err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec); ++ err = brcmf_fil_iovar_int_get(netdev_priv(ndev), "chanspec", &chanspec); + if (err) { + bphy_err(drvr, "chanspec failed (%d)\n", err); + return err; diff --git a/package/kernel/mac80211/patches/brcm/384-v5.4-0006-brcmfmac-simply-remove-flowring-if-bus-is-down.patch b/package/kernel/mac80211/patches/brcm/384-v5.4-0006-brcmfmac-simply-remove-flowring-if-bus-is-down.patch new file mode 100644 index 00000000000000..040ab16a6c5f38 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/384-v5.4-0006-brcmfmac-simply-remove-flowring-if-bus-is-down.patch @@ -0,0 +1,33 @@ +From e0bfb9601d4812719167cc4124a0d6db1e2f55e4 Mon Sep 17 00:00:00 2001 +From: Arend van Spriel +Date: Thu, 11 Jul 2019 11:05:11 +0200 +Subject: [PATCH] brcmfmac: simply remove flowring if bus is down + +When the bus is down, eg. due to rmmod, there is no need to +attempt to inform firmware about it. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +@@ -1398,6 +1398,13 @@ void brcmf_msgbuf_delete_flowring(struct + u8 ifidx; + int err; + ++ /* no need to submit if firmware can not be reached */ ++ if (drvr->bus_if->state != BRCMF_BUS_UP) { ++ brcmf_dbg(MSGBUF, "bus down, flowring will be removed\n"); ++ brcmf_msgbuf_remove_flowring(msgbuf, flowid); ++ return; ++ } ++ + commonring = msgbuf->commonrings[BRCMF_H2D_MSGRING_CONTROL_SUBMIT]; + brcmf_commonring_lock(commonring); + ret_ptr = brcmf_commonring_reserve_for_write(commonring); diff --git a/package/kernel/mac80211/patches/brcm/384-v5.4-0007-brcmfmac-remove-unnecessary-strlcpy-upon-obtaining-v.patch b/package/kernel/mac80211/patches/brcm/384-v5.4-0007-brcmfmac-remove-unnecessary-strlcpy-upon-obtaining-v.patch new file mode 100644 index 00000000000000..444546aaf7ae37 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/384-v5.4-0007-brcmfmac-remove-unnecessary-strlcpy-upon-obtaining-v.patch @@ -0,0 +1,28 @@ +From 4b11c915f00caeef3292ed0429acc579b9da762a Mon Sep 17 00:00:00 2001 +From: Arend van Spriel +Date: Thu, 11 Jul 2019 11:05:12 +0200 +Subject: [PATCH] brcmfmac: remove unnecessary strlcpy() upon obtaining "ver" + iovar + +Recently a strcpy() was replaced by strlcpy(). However, the strcpy() +was not needed in the first place. So removing that line of code. + +Reviewed-by: Hante Meuleman +Reviewed-by: Pieter-Paul Giesberts +Reviewed-by: Franky Lin +Signed-off-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -258,7 +258,6 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + + /* query for 'ver' to get version info from firmware */ + memset(buf, 0, sizeof(buf)); +- strlcpy(buf, "ver", sizeof(buf)); + err = brcmf_fil_iovar_data_get(ifp, "ver", buf, sizeof(buf)); + if (err < 0) { + bphy_err(drvr, "Retrieving version information failed, %d\n", diff --git a/package/kernel/mac80211/patches/brcm/385-v5.4-brcmfmac-don-t-net_ratelimit-CONSOLE-messages-on-fir.patch b/package/kernel/mac80211/patches/brcm/385-v5.4-brcmfmac-don-t-net_ratelimit-CONSOLE-messages-on-fir.patch new file mode 100644 index 00000000000000..60f6e4921067e6 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/385-v5.4-brcmfmac-don-t-net_ratelimit-CONSOLE-messages-on-fir.patch @@ -0,0 +1,38 @@ +From e3b1d879ccda9ffd5332777bb1beeb2cc913faa8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sun, 21 Jul 2019 21:52:17 +0200 +Subject: [PATCH] brcmfmac: don't net_ratelimit() CONSOLE messages on firmware + crash +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Firmware crash is a pretty rare event and can't happen too frequently as +it has to be followed by a hardware reinitialization and config reload. +It should be safe to don't use net_ratelimit() when it happens. + +For reporting & debugging purposes it's important to provide a complete +log as the last lines are actually the most important. This change +modifies brcmfmac to print all messages in an unlimited way in that +specific case. With this change there should be finally a backtrace of +firmware finally visible after a crash. + +Signed-off-by: Rafał Miłecki +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -794,7 +794,8 @@ static void brcmf_pcie_bus_console_read( + if (ch == '\n') { + console->log_str[console->log_idx] = 0; + if (error) +- brcmf_err(bus, "CONSOLE: %s", console->log_str); ++ __brcmf_err(bus, __func__, "CONSOLE: %s", ++ console->log_str); + else + pr_debug("CONSOLE: %s", console->log_str); + console->log_idx = 0; diff --git a/package/kernel/mac80211/patches/brcm/386-v5.4-brcmfmac-remove-set-but-not-used-variable-dtim_perio.patch b/package/kernel/mac80211/patches/brcm/386-v5.4-brcmfmac-remove-set-but-not-used-variable-dtim_perio.patch new file mode 100644 index 00000000000000..4ba87ed093376d --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/386-v5.4-brcmfmac-remove-set-but-not-used-variable-dtim_perio.patch @@ -0,0 +1,54 @@ +From cddecd92d1ec2fd05ed1123455e7c6cf6906b5a5 Mon Sep 17 00:00:00 2001 +From: YueHaibing +Date: Wed, 24 Jul 2019 22:12:01 +0800 +Subject: [PATCH] brcmfmac: remove set but not used variable 'dtim_period' + +Fixes gcc '-Wunused-but-set-variable' warning: + +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c: In function brcmf_update_bss_info: +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:2962:5: warning: variable dtim_period set but not used [-Wunused-but-set-variable] +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c: In function brcmf_update_bss_info: +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:2961:6: warning: variable beacon_interval set but not used [-Wunused-but-set-variable] + +They are never used so can be removed. + +Reported-by: Hulk Robot +Signed-off-by: YueHaibing +Signed-off-by: Kalle Valo +--- + .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -2974,8 +2974,6 @@ static s32 brcmf_update_bss_info(struct + struct brcmf_pub *drvr = cfg->pub; + struct brcmf_bss_info_le *bi; + const struct brcmf_tlv *tim; +- u16 beacon_interval; +- u8 dtim_period; + size_t ie_len; + u8 *ie; + s32 err = 0; +@@ -2999,12 +2997,9 @@ static s32 brcmf_update_bss_info(struct + + ie = ((u8 *)bi) + le16_to_cpu(bi->ie_offset); + ie_len = le32_to_cpu(bi->ie_length); +- beacon_interval = le16_to_cpu(bi->beacon_period); + + tim = brcmf_parse_tlvs(ie, ie_len, WLAN_EID_TIM); +- if (tim) +- dtim_period = tim->data[1]; +- else { ++ if (!tim) { + /* + * active scan was done so we could not get dtim + * information out of probe response. +@@ -3016,7 +3011,6 @@ static s32 brcmf_update_bss_info(struct + bphy_err(drvr, "wl dtim_assoc failed (%d)\n", err); + goto update_bss_info_out; + } +- dtim_period = (u8)var; + } + + update_bss_info_out: diff --git a/package/kernel/mac80211/patches/brcm/387-v5.4-brcmfmac-remove-redundant-assignment-to-pointer-hash.patch b/package/kernel/mac80211/patches/brcm/387-v5.4-brcmfmac-remove-redundant-assignment-to-pointer-hash.patch new file mode 100644 index 00000000000000..84573af23eea65 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/387-v5.4-brcmfmac-remove-redundant-assignment-to-pointer-hash.patch @@ -0,0 +1,26 @@ +From 73c742bb9c9ba30871fdd5c730d5ca8b6712833a Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Fri, 9 Aug 2019 18:22:17 +0100 +Subject: [PATCH] brcmfmac: remove redundant assignment to pointer hash + +The pointer hash is being initialized with a value that is never read +and is being re-assigned a little later on. The assignment is +redundant and hence can be removed. + +Addresses-Coverity: ("Unused value") +Signed-off-by: Colin Ian King +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +@@ -1468,7 +1468,6 @@ static int brcmf_msgbuf_stats_read(struc + seq_printf(seq, "\nh2d_flowrings: depth %u\n", + BRCMF_H2D_TXFLOWRING_MAX_ITEM); + seq_puts(seq, "Active flowrings:\n"); +- hash = msgbuf->flow->hash; + for (i = 0; i < msgbuf->flow->nrofrings; i++) { + if (!msgbuf->flow->rings[i]) + continue; diff --git a/package/kernel/mac80211/patches/brcm/388-v5.4-brcmfmac-replace-strncpy-by-strscpy.patch b/package/kernel/mac80211/patches/brcm/388-v5.4-brcmfmac-replace-strncpy-by-strscpy.patch new file mode 100644 index 00000000000000..aad5c428fb608c --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/388-v5.4-brcmfmac-replace-strncpy-by-strscpy.patch @@ -0,0 +1,36 @@ +From 5f42b382ead278c1f6c3854765c97eb20491aa2a Mon Sep 17 00:00:00 2001 +From: Xulin Sun +Date: Fri, 23 Aug 2019 15:47:08 +0800 +Subject: [PATCH] brcmfmac: replace strncpy() by strscpy() + +The strncpy() may truncate the copied string, +replace it by the safer strscpy(). + +To avoid below compile warning with gcc 8.2: + +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:In function 'brcmf_vndr_ie': +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:4227:2: +warning: 'strncpy' output truncated before terminating nul copying 3 bytes from a string of the same length [-Wstringop-truncation] + strncpy(iebuf, add_del_cmd, VNDR_IE_CMD_LEN - 1); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Signed-off-by: Xulin Sun +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -4236,9 +4236,7 @@ next: + static u32 + brcmf_vndr_ie(u8 *iebuf, s32 pktflag, u8 *ie_ptr, u32 ie_len, s8 *add_del_cmd) + { +- +- strncpy(iebuf, add_del_cmd, VNDR_IE_CMD_LEN - 1); +- iebuf[VNDR_IE_CMD_LEN - 1] = '\0'; ++ strscpy(iebuf, add_del_cmd, VNDR_IE_CMD_LEN); + + put_unaligned_le32(1, &iebuf[VNDR_IE_COUNT_OFFSET]); + diff --git a/package/kernel/mac80211/patches/brcm/389-v5.4-brcmfmac-get-chip-s-default-RAM-info-during-PCIe-set.patch b/package/kernel/mac80211/patches/brcm/389-v5.4-brcmfmac-get-chip-s-default-RAM-info-during-PCIe-set.patch new file mode 100644 index 00000000000000..b04e78c70e0486 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/389-v5.4-brcmfmac-get-chip-s-default-RAM-info-during-PCIe-set.patch @@ -0,0 +1,80 @@ +From 82f93cf46d6007ffa003b2d4a2834563b6b84d21 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Thu, 29 Aug 2019 10:27:01 +0200 +Subject: [PATCH] brcmfmac: get chip's default RAM info during PCIe setup +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Getting RAM info just once per driver's lifetime (during chip +recognition) is not enough as it may get adjusted later (depending on +the used firmware). Subsequent inits may load different firmwares so a +full RAM recognition is required on every PCIe setup. This is especially +important since implementing hardware reset on a firmware crash. + +Moreover calling brcmf_chip_get_raminfo() makes sure that RAM core is +up. It's important as having BCMA_CORE_SYS_MEM down on BCM4366 was +resulting in firmware failing to initialize and following error: +[ 65.657546] brcmfmac 0000:01:00.0: brcmf_pcie_download_fw_nvram: Invalid shared RAM address 0x04000001 + +This change makes brcmf_chip_get_raminfo() call during chip recognition +redundant for PCIe devices but SDIO and USB still need it and it's a +very small overhead anyway. + +Fixes: 4684997d9eea ("brcmfmac: reset PCIe bus on a firmware crash") +Signed-off-by: Rafał Miłecki +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 6 ++++-- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h | 1 + + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 6 ++++++ + 3 files changed, 11 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +@@ -696,8 +696,10 @@ static u32 brcmf_chip_tcm_rambase(struct + return 0; + } + +-static int brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci) ++int brcmf_chip_get_raminfo(struct brcmf_chip *pub) + { ++ struct brcmf_chip_priv *ci = container_of(pub, struct brcmf_chip_priv, ++ pub); + struct brcmf_core_priv *mem_core; + struct brcmf_core *mem; + +@@ -979,7 +981,7 @@ static int brcmf_chip_recognition(struct + brcmf_chip_set_passive(&ci->pub); + } + +- return brcmf_chip_get_raminfo(ci); ++ return brcmf_chip_get_raminfo(&ci->pub); + } + + static void brcmf_chip_disable_arm(struct brcmf_chip_priv *chip, u16 id) +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h +@@ -69,6 +69,7 @@ struct brcmf_buscore_ops { + void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec); + }; + ++int brcmf_chip_get_raminfo(struct brcmf_chip *pub); + struct brcmf_chip *brcmf_chip_attach(void *ctx, + const struct brcmf_buscore_ops *ops); + void brcmf_chip_detach(struct brcmf_chip *chip); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -1770,6 +1770,12 @@ static void brcmf_pcie_setup(struct devi + nvram_len = fwreq->items[BRCMF_PCIE_FW_NVRAM].nv_data.len; + kfree(fwreq); + ++ ret = brcmf_chip_get_raminfo(devinfo->ci); ++ if (ret) { ++ brcmf_err(bus, "Failed to get RAM info\n"); ++ goto fail; ++ } ++ + /* Some of the firmwares have the size of the memory of the device + * defined inside the firmware. This is because part of the memory in + * the device is shared and the devision is determined by FW. Parse diff --git a/package/kernel/mac80211/patches/brcm/390-v5.4-0001-brcmfmac-add-stub-version-of-brcmf_debugfs_get_devdi.patch b/package/kernel/mac80211/patches/brcm/390-v5.4-0001-brcmfmac-add-stub-version-of-brcmf_debugfs_get_devdi.patch new file mode 100644 index 00000000000000..3fbf0dedd94667 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/390-v5.4-0001-brcmfmac-add-stub-version-of-brcmf_debugfs_get_devdi.patch @@ -0,0 +1,31 @@ +From cb34212b1c25f7656a315f956d72696777e88340 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sun, 1 Sep 2019 13:34:35 +0200 +Subject: [PATCH] brcmfmac: add stub version of brcmf_debugfs_get_devdir() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +In case of compiling driver without DEBUG expose a stub function to make +writing debug code much simpler (no extra conditions). This will allow +e.g. using debugfs_create_file() without any magic if or #ifdef. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +@@ -121,6 +121,10 @@ int brcmf_debugfs_add_entry(struct brcmf + int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data, + size_t len); + #else ++static inline struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr) ++{ ++ return ERR_PTR(-ENOENT); ++} + static inline + int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn, + int (*read_fn)(struct seq_file *seq, void *data)) diff --git a/package/kernel/mac80211/patches/brcm/390-v5.4-0002-brcmfmac-add-reset-debugfs-entry-for-testing-reset.patch b/package/kernel/mac80211/patches/brcm/390-v5.4-0002-brcmfmac-add-reset-debugfs-entry-for-testing-reset.patch new file mode 100644 index 00000000000000..b3d01477a66dfe --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/390-v5.4-0002-brcmfmac-add-reset-debugfs-entry-for-testing-reset.patch @@ -0,0 +1,59 @@ +From 2f8c8e62cd50d72ac68de884a09c6f5a969a269c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Sun, 1 Sep 2019 13:34:36 +0200 +Subject: [PATCH] brcmfmac: add "reset" debugfs entry for testing reset +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is a trivial debugfs entry for triggering reset just like in case +of firmware crash. It works by writing 1 to it: +echo 1 > reset + +Signed-off-by: Rafał Miłecki +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/core.c | 25 +++++++++++++++++++ + 1 file changed, 25 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -1107,6 +1107,29 @@ static void brcmf_core_bus_reset(struct + brcmf_bus_reset(drvr->bus_if); + } + ++static ssize_t bus_reset_write(struct file *file, const char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct brcmf_pub *drvr = file->private_data; ++ u8 value; ++ ++ if (kstrtou8_from_user(user_buf, count, 0, &value)) ++ return -EINVAL; ++ ++ if (value != 1) ++ return -EINVAL; ++ ++ schedule_work(&drvr->bus_reset); ++ ++ return count; ++} ++ ++static const struct file_operations bus_reset_fops = { ++ .open = simple_open, ++ .llseek = no_llseek, ++ .write = bus_reset_write, ++}; ++ + static int brcmf_bus_started(struct brcmf_pub *drvr, struct cfg80211_ops *ops) + { + int ret = -1; +@@ -1182,6 +1205,8 @@ static int brcmf_bus_started(struct brcm + + /* populate debugfs */ + brcmf_debugfs_add_entry(drvr, "revinfo", brcmf_revinfo_read); ++ debugfs_create_file("reset", 0600, brcmf_debugfs_get_devdir(drvr), drvr, ++ &bus_reset_fops); + brcmf_feat_debugfs_create(drvr); + brcmf_proto_debugfs_create(drvr); + brcmf_bus_debugfs_create(bus_if); diff --git a/package/kernel/mac80211/patches/brcm/391-v5.4-brcmfmac-use-ph-to-print-small-buffer.patch b/package/kernel/mac80211/patches/brcm/391-v5.4-brcmfmac-use-ph-to-print-small-buffer.patch new file mode 100644 index 00000000000000..b42e119126bcae --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/391-v5.4-brcmfmac-use-ph-to-print-small-buffer.patch @@ -0,0 +1,58 @@ +From 0e48b86d9a8f5c695bb02c9c02f6dc7d2ec8f2e2 Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Wed, 4 Sep 2019 20:50:52 +0300 +Subject: [PATCH] brcmfmac: use %*ph to print small buffer + +Use %*ph format to print small buffer as hex string. + +Signed-off-by: Andy Shevchenko +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 18 ++++++------------ + 1 file changed, 6 insertions(+), 12 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -4214,10 +4214,8 @@ brcmf_parse_vndr_ies(const u8 *vndr_ie_b + + vndr_ies->count++; + +- brcmf_dbg(TRACE, "** OUI %02x %02x %02x, type 0x%02x\n", +- parsed_info->vndrie.oui[0], +- parsed_info->vndrie.oui[1], +- parsed_info->vndrie.oui[2], ++ brcmf_dbg(TRACE, "** OUI %3ph, type 0x%02x\n", ++ parsed_info->vndrie.oui, + parsed_info->vndrie.oui_type); + + if (vndr_ies->count >= VNDR_IE_PARSE_LIMIT) +@@ -4341,12 +4339,10 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c + for (i = 0; i < old_vndr_ies.count; i++) { + vndrie_info = &old_vndr_ies.ie_info[i]; + +- brcmf_dbg(TRACE, "DEL ID : %d, Len: %d , OUI:%02x:%02x:%02x\n", ++ brcmf_dbg(TRACE, "DEL ID : %d, Len: %d , OUI:%3ph\n", + vndrie_info->vndrie.id, + vndrie_info->vndrie.len, +- vndrie_info->vndrie.oui[0], +- vndrie_info->vndrie.oui[1], +- vndrie_info->vndrie.oui[2]); ++ vndrie_info->vndrie.oui); + + del_add_ie_buf_len = brcmf_vndr_ie(curr_ie_buf, pktflag, + vndrie_info->ie_ptr, +@@ -4378,12 +4374,10 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c + remained_buf_len -= (vndrie_info->ie_len + + VNDR_IE_VSIE_OFFSET); + +- brcmf_dbg(TRACE, "ADDED ID : %d, Len: %d, OUI:%02x:%02x:%02x\n", ++ brcmf_dbg(TRACE, "ADDED ID : %d, Len: %d, OUI:%3ph\n", + vndrie_info->vndrie.id, + vndrie_info->vndrie.len, +- vndrie_info->vndrie.oui[0], +- vndrie_info->vndrie.oui[1], +- vndrie_info->vndrie.oui[2]); ++ vndrie_info->vndrie.oui); + + del_add_ie_buf_len = brcmf_vndr_ie(curr_ie_buf, pktflag, + vndrie_info->ie_ptr, diff --git a/package/kernel/mac80211/patches/brcm/392-v5.4-0001-brcmfmac-move-cfg80211_ops-pointer-to-another-struct.patch b/package/kernel/mac80211/patches/brcm/392-v5.4-0001-brcmfmac-move-cfg80211_ops-pointer-to-another-struct.patch new file mode 100644 index 00000000000000..a56be4d35ccb44 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/392-v5.4-0001-brcmfmac-move-cfg80211_ops-pointer-to-another-struct.patch @@ -0,0 +1,95 @@ +From ba76ff25ee64d5cfc86209d1fbb3c294b2c04412 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 3 Sep 2019 06:29:26 +0200 +Subject: [PATCH 1/3] brcmfmac: move "cfg80211_ops" pointer to another struct +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This moves "ops" pointer from "struct brcmf_cfg80211_info" to the +"struct brcmf_pub". This movement makes it possible to allocate wiphy +without attaching cfg80211 (brcmf_cfg80211_attach()). It's required for +later separation of wiphy allocation and driver initialization. + +While at it fix also an unlikely memory leak in the brcmf_attach(). + +Signed-off-by: Rafał Miłecki +Signed-off-by: Kalle Valo +--- + .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 1 - + .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h | 1 - + drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 9 ++++++--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h | 1 + + 4 files changed, 7 insertions(+), 5 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -7194,7 +7194,6 @@ void brcmf_cfg80211_detach(struct brcmf_ + brcmf_pno_detach(cfg); + brcmf_btcoex_detach(cfg); + wiphy_unregister(cfg->wiphy); +- kfree(cfg->ops); + wl_deinit_priv(cfg); + brcmf_free_wiphy(cfg->wiphy); + kfree(cfg); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h +@@ -292,7 +292,6 @@ struct brcmf_cfg80211_wowl { + */ + struct brcmf_cfg80211_info { + struct wiphy *wiphy; +- struct cfg80211_ops *ops; + struct brcmf_cfg80211_conf *conf; + struct brcmf_p2p_info p2p; + struct brcmf_btcoex_info *btcoex; +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -1245,12 +1245,15 @@ int brcmf_attach(struct device *dev, str + return -ENOMEM; + + wiphy = wiphy_new(ops, sizeof(*drvr)); +- if (!wiphy) ++ if (!wiphy) { ++ kfree(ops); + return -ENOMEM; ++ } + + set_wiphy_dev(wiphy, dev); + drvr = wiphy_priv(wiphy); + drvr->wiphy = wiphy; ++ drvr->ops = ops; + + for (i = 0; i < ARRAY_SIZE(drvr->if2bss); i++) + drvr->if2bss[i] = BRCMF_BSSIDX_INVALID; +@@ -1283,12 +1286,10 @@ int brcmf_attach(struct device *dev, str + goto fail; + } + +- drvr->config->ops = ops; + return 0; + + fail: + brcmf_detach(dev); +- kfree(ops); + + return ret; + } +@@ -1379,6 +1380,8 @@ void brcmf_detach(struct device *dev) + + bus_if->drvr = NULL; + ++ kfree(drvr->ops); ++ + wiphy_free(drvr->wiphy); + } + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +@@ -97,6 +97,7 @@ struct brcmf_pub { + struct brcmf_bus *bus_if; + struct brcmf_proto *proto; + struct wiphy *wiphy; ++ struct cfg80211_ops *ops; + struct brcmf_cfg80211_info *config; + + /* Internal brcmf items */ diff --git a/package/kernel/mac80211/patches/brcm/392-v5.4-0002-brcmfmac-split-brcmf_attach-and-brcmf_detach-functio.patch b/package/kernel/mac80211/patches/brcm/392-v5.4-0002-brcmfmac-split-brcmf_attach-and-brcmf_detach-functio.patch new file mode 100644 index 00000000000000..e0211fadbd29dc --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/392-v5.4-0002-brcmfmac-split-brcmf_attach-and-brcmf_detach-functio.patch @@ -0,0 +1,266 @@ +From 450914c39f88d1adada26256360dea7050ff4e83 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 3 Sep 2019 06:29:27 +0200 +Subject: [PATCH 2/3] brcmfmac: split brcmf_attach() and brcmf_detach() + functions +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Move code allocating/freeing wiphy out of above functions. This will +allow reinitializing the driver (e.g. on some error) without allocating +a new wiphy. + +Signed-off-by: Rafał Miłecki +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/bus.h | 4 ++- + .../broadcom/brcm80211/brcmfmac/core.c | 33 ++++++++++++++---- + .../broadcom/brcm80211/brcmfmac/pcie.c | 13 +++++-- + .../broadcom/brcm80211/brcmfmac/sdio.c | 15 ++++++-- + .../broadcom/brcm80211/brcmfmac/usb.c | 34 +++++++++++++++---- + 5 files changed, 80 insertions(+), 19 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +@@ -253,10 +253,12 @@ void brcmf_rx_frame(struct device *dev, + /* Receive async event packet from firmware. Callee disposes of rxp. */ + void brcmf_rx_event(struct device *dev, struct sk_buff *rxp); + ++int brcmf_alloc(struct device *dev, struct brcmf_mp_device *settings); + /* Indication from bus module regarding presence/insertion of dongle. */ +-int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings); ++int brcmf_attach(struct device *dev); + /* Indication from bus module regarding removal/absence of dongle */ + void brcmf_detach(struct device *dev); ++void brcmf_free(struct device *dev); + /* Indication from bus module that dongle should be reset */ + void brcmf_dev_reset(struct device *dev); + /* Request from bus module to initiate a coredump */ +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -1230,13 +1230,11 @@ fail: + return ret; + } + +-int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings) ++int brcmf_alloc(struct device *dev, struct brcmf_mp_device *settings) + { + struct wiphy *wiphy; + struct cfg80211_ops *ops; + struct brcmf_pub *drvr = NULL; +- int ret = 0; +- int i; + + brcmf_dbg(TRACE, "Enter\n"); + +@@ -1254,6 +1252,21 @@ int brcmf_attach(struct device *dev, str + drvr = wiphy_priv(wiphy); + drvr->wiphy = wiphy; + drvr->ops = ops; ++ drvr->bus_if = dev_get_drvdata(dev); ++ drvr->bus_if->drvr = drvr; ++ drvr->settings = settings; ++ ++ return 0; ++} ++ ++int brcmf_attach(struct device *dev) ++{ ++ struct brcmf_bus *bus_if = dev_get_drvdata(dev); ++ struct brcmf_pub *drvr = bus_if->drvr; ++ int ret = 0; ++ int i; ++ ++ brcmf_dbg(TRACE, "Enter\n"); + + for (i = 0; i < ARRAY_SIZE(drvr->if2bss); i++) + drvr->if2bss[i] = BRCMF_BSSIDX_INVALID; +@@ -1262,9 +1275,6 @@ int brcmf_attach(struct device *dev, str + + /* Link to bus module */ + drvr->hdrlen = 0; +- drvr->bus_if = dev_get_drvdata(dev); +- drvr->bus_if->drvr = drvr; +- drvr->settings = settings; + + /* Attach and link in the protocol */ + ret = brcmf_proto_attach(drvr); +@@ -1280,7 +1290,7 @@ int brcmf_attach(struct device *dev, str + /* attach firmware event handler */ + brcmf_fweh_attach(drvr); + +- ret = brcmf_bus_started(drvr, ops); ++ ret = brcmf_bus_started(drvr, drvr->ops); + if (ret != 0) { + bphy_err(drvr, "dongle is not responding: err=%d\n", ret); + goto fail; +@@ -1377,6 +1387,15 @@ void brcmf_detach(struct device *dev) + brcmf_cfg80211_detach(drvr->config); + drvr->config = NULL; + } ++} ++ ++void brcmf_free(struct device *dev) ++{ ++ struct brcmf_bus *bus_if = dev_get_drvdata(dev); ++ struct brcmf_pub *drvr = bus_if->drvr; ++ ++ if (!drvr) ++ return; + + bus_if->drvr = NULL; + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -1430,6 +1430,7 @@ static int brcmf_pcie_reset(struct devic + brcmf_pcie_bus_console_read(devinfo, true); + + brcmf_detach(dev); ++ brcmf_free(dev); + + brcmf_pcie_release_irq(devinfo); + brcmf_pcie_release_scratchbuffers(devinfo); +@@ -1824,11 +1825,18 @@ static void brcmf_pcie_setup(struct devi + + brcmf_pcie_intr_enable(devinfo); + brcmf_pcie_hostready(devinfo); +- if (brcmf_attach(&devinfo->pdev->dev, devinfo->settings) == 0) +- return; ++ ++ ret = brcmf_alloc(&devinfo->pdev->dev, devinfo->settings); ++ if (ret) ++ goto fail; ++ ret = brcmf_attach(&devinfo->pdev->dev); ++ if (ret) ++ goto fail; + + brcmf_pcie_bus_console_read(devinfo, false); + ++ return; ++ + fail: + device_release_driver(dev); + } +@@ -1971,6 +1979,7 @@ brcmf_pcie_remove(struct pci_dev *pdev) + brcmf_pcie_intr_disable(devinfo); + + brcmf_detach(&pdev->dev); ++ brcmf_free(&pdev->dev); + + kfree(bus->bus_priv.pcie); + kfree(bus->msgbuf->flowrings); +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -4251,17 +4251,26 @@ static void brcmf_sdio_firmware_callback + sdiod->bus_if->chip = bus->ci->chip; + sdiod->bus_if->chiprev = bus->ci->chiprev; + ++ err = brcmf_alloc(sdiod->dev, sdiod->settings); ++ if (err) { ++ brcmf_err("brcmf_alloc failed\n"); ++ goto claim; ++ } ++ + /* Attach to the common layer, reserve hdr space */ +- err = brcmf_attach(sdiod->dev, sdiod->settings); ++ err = brcmf_attach(sdiod->dev); + if (err != 0) { + brcmf_err("brcmf_attach failed\n"); +- sdio_claim_host(sdiod->func1); +- goto checkdied; ++ goto free; + } + + /* ready */ + return; + ++free: ++ brcmf_free(sdiod->dev); ++claim: ++ sdio_claim_host(sdiod->func1); + checkdied: + brcmf_sdio_checkdied(bus); + release: +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -1178,8 +1178,12 @@ static void brcmf_usb_probe_phase2(struc + if (ret) + goto error; + ++ ret = brcmf_alloc(devinfo->dev, devinfo->settings); ++ if (ret) ++ goto error; ++ + /* Attach to the common driver interface */ +- ret = brcmf_attach(devinfo->dev, devinfo->settings); ++ ret = brcmf_attach(devinfo->dev); + if (ret) + goto error; + +@@ -1251,7 +1255,10 @@ static int brcmf_usb_probe_cb(struct brc + } + + if (!brcmf_usb_dlneeded(devinfo)) { +- ret = brcmf_attach(devinfo->dev, devinfo->settings); ++ ret = brcmf_alloc(devinfo->dev, devinfo->settings); ++ if (ret) ++ goto fail; ++ ret = brcmf_attach(devinfo->dev); + if (ret) + goto fail; + /* we are done */ +@@ -1279,6 +1286,7 @@ static int brcmf_usb_probe_cb(struct brc + + fail: + /* Release resources in reverse order */ ++ brcmf_free(devinfo->dev); + kfree(bus); + brcmf_usb_detach(devinfo); + return ret; +@@ -1292,6 +1300,7 @@ brcmf_usb_disconnect_cb(struct brcmf_usb + brcmf_dbg(USB, "Enter, bus_pub %p\n", devinfo); + + brcmf_detach(devinfo->dev); ++ brcmf_free(devinfo->dev); + kfree(devinfo->bus_pub.bus); + brcmf_usb_detach(devinfo); + } +@@ -1435,10 +1444,12 @@ static int brcmf_usb_suspend(struct usb_ + + brcmf_dbg(USB, "Enter\n"); + devinfo->bus_pub.state = BRCMFMAC_USB_STATE_SLEEP; +- if (devinfo->wowl_enabled) ++ if (devinfo->wowl_enabled) { + brcmf_cancel_all_urbs(devinfo); +- else ++ } else { + brcmf_detach(&usb->dev); ++ brcmf_free(&usb->dev); ++ } + return 0; + } + +@@ -1451,8 +1462,19 @@ static int brcmf_usb_resume(struct usb_i + struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(&usb->dev); + + brcmf_dbg(USB, "Enter\n"); +- if (!devinfo->wowl_enabled) +- return brcmf_attach(devinfo->dev, devinfo->settings); ++ if (!devinfo->wowl_enabled) { ++ int err; ++ ++ err = brcmf_alloc(&usb->dev, devinfo->settings); ++ if (err) ++ return err; ++ ++ err = brcmf_attach(devinfo->dev); ++ if (err) { ++ brcmf_free(devinfo->dev); ++ return err; ++ } ++ } + + devinfo->bus_pub.state = BRCMFMAC_USB_STATE_UP; + brcmf_usb_rx_fill_all(devinfo); diff --git a/package/kernel/mac80211/patches/brcm/392-v5.4-0003-brcmfmac-don-t-realloc-wiphy-during-PCIe-reset.patch b/package/kernel/mac80211/patches/brcm/392-v5.4-0003-brcmfmac-don-t-realloc-wiphy-during-PCIe-reset.patch new file mode 100644 index 00000000000000..511f24dd7214b9 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/392-v5.4-0003-brcmfmac-don-t-realloc-wiphy-during-PCIe-reset.patch @@ -0,0 +1,51 @@ +From a1f5aac1765afbeace9581afa27da34085f68e1d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 3 Sep 2019 06:29:28 +0200 +Subject: [PATCH 3/3] brcmfmac: don't realloc wiphy during PCIe reset +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Providing a new wiphy on every PCIe reset was confusing and was causing +configuration problems for some users (supplicant and authenticators). +Sticking to the existing wiphy should make error recovery much simpler +and more reliable. + +Signed-off-by: Rafał Miłecki +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -1430,7 +1430,6 @@ static int brcmf_pcie_reset(struct devic + brcmf_pcie_bus_console_read(devinfo, true); + + brcmf_detach(dev); +- brcmf_free(dev); + + brcmf_pcie_release_irq(devinfo); + brcmf_pcie_release_scratchbuffers(devinfo); +@@ -1826,9 +1825,6 @@ static void brcmf_pcie_setup(struct devi + brcmf_pcie_intr_enable(devinfo); + brcmf_pcie_hostready(devinfo); + +- ret = brcmf_alloc(&devinfo->pdev->dev, devinfo->settings); +- if (ret) +- goto fail; + ret = brcmf_attach(&devinfo->pdev->dev); + if (ret) + goto fail; +@@ -1931,6 +1927,10 @@ brcmf_pcie_probe(struct pci_dev *pdev, c + bus->wowl_supported = pci_pme_capable(pdev, PCI_D3hot); + dev_set_drvdata(&pdev->dev, bus); + ++ ret = brcmf_alloc(&devinfo->pdev->dev, devinfo->settings); ++ if (ret) ++ goto fail_bus; ++ + fwreq = brcmf_pcie_prepare_fw_request(devinfo); + if (!fwreq) { + ret = -ENOMEM; diff --git a/package/kernel/mac80211/patches/brcm/396-brcmfmac-disable-PCIe-interrupts-before-bus-reset.patch b/package/kernel/mac80211/patches/brcm/396-brcmfmac-disable-PCIe-interrupts-before-bus-reset.patch new file mode 100644 index 00000000000000..a92118a19ab8a6 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/396-brcmfmac-disable-PCIe-interrupts-before-bus-reset.patch @@ -0,0 +1,54 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 18 Nov 2019 11:52:41 +0100 +Subject: [PATCH FIX] brcmfmac: disable PCIe interrupts before bus reset +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Keeping interrupts on could result in brcmfmac freeing some resources +and then IRQ handlers trying to use them. That was obviously a straight +path for crashing a kernel. + +Example: +CPU0 CPU1 +---- ---- +brcmf_pcie_reset + brcmf_pcie_bus_console_read + brcmf_detach + ... + brcmf_fweh_detach + brcmf_proto_detach + brcmf_pcie_isr_thread + ... + brcmf_proto_msgbuf_rx_trigger + ... + drvr->proto->pd + brcmf_pcie_release_irq + +[ 363.789218] Unable to handle kernel NULL pointer dereference at virtual address 00000038 +[ 363.797339] pgd = c0004000 +[ 363.800050] [00000038] *pgd=00000000 +[ 363.803635] Internal error: Oops: 17 [#1] SMP ARM +(...) +[ 364.029209] Backtrace: +[ 364.031725] [] (brcmf_proto_msgbuf_rx_trigger [brcmfmac]) from [] (brcmf_pcie_isr_thread+0x228/0x274 [brcmfmac]) +[ 364.043662] r7:00000001 r6:c8ca0000 r5:00010000 r4:c7b4f800 + +Fixes: 4684997d9eea ("brcmfmac: reset PCIe bus on a firmware crash") +Cc: stable@vger.kernel.org # v5.2+ +Signed-off-by: Rafał Miłecki +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -1427,6 +1427,8 @@ static int brcmf_pcie_reset(struct devic + struct brcmf_fw_request *fwreq; + int err; + ++ brcmf_pcie_intr_disable(devinfo); ++ + brcmf_pcie_bus_console_read(devinfo, true); + + brcmf_detach(dev); diff --git a/package/kernel/mac80211/patches/brcm/397-brcmfmac-remove-monitor-interface-when-detaching.patch b/package/kernel/mac80211/patches/brcm/397-brcmfmac-remove-monitor-interface-when-detaching.patch new file mode 100644 index 00000000000000..6c325ee844c376 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/397-brcmfmac-remove-monitor-interface-when-detaching.patch @@ -0,0 +1,30 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 18 Nov 2019 13:35:20 +0100 +Subject: [PATCH 5.5] brcmfmac: remove monitor interface when detaching +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This fixes a minor WARNING in the cfg80211: +[ 130.658034] ------------[ cut here ]------------ +[ 130.662805] WARNING: CPU: 1 PID: 610 at net/wireless/core.c:954 wiphy_unregister+0xb4/0x198 [cfg80211] + +Signed-off-by: Rafał Miłecki +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -1371,6 +1371,11 @@ void brcmf_detach(struct device *dev) + brcmf_fweh_detach(drvr); + brcmf_proto_detach(drvr); + ++ if (drvr->mon_if) { ++ brcmf_net_detach(drvr->mon_if->ndev, false); ++ drvr->mon_if = NULL; ++ } ++ + /* make sure primary interface removed last */ + for (i = BRCMF_MAX_IFS - 1; i > -1; i--) { + if (drvr->iflist[i]) diff --git a/package/kernel/mac80211/patches/810-b43-gpio-mask-module-option.patch b/package/kernel/mac80211/patches/brcm/810-b43-gpio-mask-module-option.patch similarity index 97% rename from package/kernel/mac80211/patches/810-b43-gpio-mask-module-option.patch rename to package/kernel/mac80211/patches/brcm/810-b43-gpio-mask-module-option.patch index 5ce49d3a075a10..6861667b2be48b 100644 --- a/package/kernel/mac80211/patches/810-b43-gpio-mask-module-option.patch +++ b/package/kernel/mac80211/patches/brcm/810-b43-gpio-mask-module-option.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/broadcom/b43/b43.h +++ b/drivers/net/wireless/broadcom/b43/b43.h -@@ -839,6 +839,7 @@ struct b43_wldev { +@@ -840,6 +840,7 @@ struct b43_wldev { bool qos_enabled; /* TRUE, if QoS is used. */ bool hwcrypto_enabled; /* TRUE, if HW crypto acceleration is enabled. */ bool use_pio; /* TRUE if next init should use PIO */ diff --git a/package/kernel/mac80211/patches/811-b43_no_pio.patch b/package/kernel/mac80211/patches/brcm/811-b43_no_pio.patch similarity index 91% rename from package/kernel/mac80211/patches/811-b43_no_pio.patch rename to package/kernel/mac80211/patches/brcm/811-b43_no_pio.patch index d23387c8cd0945..5eb1dc550a0795 100644 --- a/package/kernel/mac80211/patches/811-b43_no_pio.patch +++ b/package/kernel/mac80211/patches/brcm/811-b43_no_pio.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/broadcom/b43/Makefile +++ b/drivers/net/wireless/broadcom/b43/Makefile -@@ -17,7 +17,7 @@ b43-$(CPTCFG_B43_PHY_AC) += phy_ac.o +@@ -18,7 +18,7 @@ b43-$(CPTCFG_B43_PHY_AC) += phy_ac.o b43-y += sysfs.o b43-y += xmit.o b43-y += dma.o @@ -26,7 +26,7 @@ } --- a/drivers/net/wireless/broadcom/b43/pio.h +++ b/drivers/net/wireless/broadcom/b43/pio.h -@@ -150,7 +150,7 @@ static inline void b43_piorx_write32(str +@@ -151,7 +151,7 @@ static inline void b43_piorx_write32(str b43_write32(q->dev, q->mmio_base + offset, value); } @@ -35,7 +35,7 @@ int b43_pio_init(struct b43_wldev *dev); void b43_pio_free(struct b43_wldev *dev); -@@ -161,5 +161,37 @@ void b43_pio_rx(struct b43_pio_rxqueue * +@@ -162,5 +162,37 @@ void b43_pio_rx(struct b43_pio_rxqueue * void b43_pio_tx_suspend(struct b43_wldev *dev); void b43_pio_tx_resume(struct b43_wldev *dev); @@ -82,5 +82,5 @@ - bool + bool "Broadcom 43xx PIO support" depends on B43 && B43_SSB - select SSB_BLOCKIO + depends on SSB_BLOCKIO default y diff --git a/package/kernel/mac80211/patches/812-b43-add-antenna-control.patch b/package/kernel/mac80211/patches/brcm/812-b43-add-antenna-control.patch similarity index 99% rename from package/kernel/mac80211/patches/812-b43-add-antenna-control.patch rename to package/kernel/mac80211/patches/brcm/812-b43-add-antenna-control.patch index 932c83b48eaa2a..d643d2f82cb68d 100644 --- a/package/kernel/mac80211/patches/812-b43-add-antenna-control.patch +++ b/package/kernel/mac80211/patches/brcm/812-b43-add-antenna-control.patch @@ -120,7 +120,7 @@ SET_IEEE80211_DEV(hw, dev->dev); --- a/drivers/net/wireless/broadcom/b43/b43.h +++ b/drivers/net/wireless/broadcom/b43/b43.h -@@ -840,6 +840,8 @@ struct b43_wldev { +@@ -841,6 +841,8 @@ struct b43_wldev { bool hwcrypto_enabled; /* TRUE, if HW crypto acceleration is enabled. */ bool use_pio; /* TRUE if next init should use PIO */ int gpiomask; /* GPIO LED mask as a module parameter */ diff --git a/package/kernel/mac80211/patches/813-b43-reduce-number-of-RX-slots.patch b/package/kernel/mac80211/patches/brcm/813-b43-reduce-number-of-RX-slots.patch similarity index 88% rename from package/kernel/mac80211/patches/813-b43-reduce-number-of-RX-slots.patch rename to package/kernel/mac80211/patches/brcm/813-b43-reduce-number-of-RX-slots.patch index 5899706896901f..85c52c0282aec5 100644 --- a/package/kernel/mac80211/patches/813-b43-reduce-number-of-RX-slots.patch +++ b/package/kernel/mac80211/patches/brcm/813-b43-reduce-number-of-RX-slots.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/broadcom/b43/dma.h +++ b/drivers/net/wireless/broadcom/b43/dma.h -@@ -169,7 +169,7 @@ struct b43_dmadesc_generic { +@@ -170,7 +170,7 @@ struct b43_dmadesc_generic { /* DMA engine tuning knobs */ #define B43_TXRING_SLOTS 256 diff --git a/package/kernel/mac80211/patches/814-b43-only-use-gpio-0-1-for-led.patch b/package/kernel/mac80211/patches/brcm/814-b43-only-use-gpio-0-1-for-led.patch similarity index 100% rename from package/kernel/mac80211/patches/814-b43-only-use-gpio-0-1-for-led.patch rename to package/kernel/mac80211/patches/brcm/814-b43-only-use-gpio-0-1-for-led.patch diff --git a/package/kernel/mac80211/patches/815-b43-always-take-overlapping-devs.patch b/package/kernel/mac80211/patches/brcm/815-b43-always-take-overlapping-devs.patch similarity index 100% rename from package/kernel/mac80211/patches/815-b43-always-take-overlapping-devs.patch rename to package/kernel/mac80211/patches/brcm/815-b43-always-take-overlapping-devs.patch diff --git a/package/kernel/mac80211/patches/850-brcmsmac-remove-extra-regulation-restriction.patch b/package/kernel/mac80211/patches/brcm/850-brcmsmac-remove-extra-regulation-restriction.patch similarity index 100% rename from package/kernel/mac80211/patches/850-brcmsmac-remove-extra-regulation-restriction.patch rename to package/kernel/mac80211/patches/brcm/850-brcmsmac-remove-extra-regulation-restriction.patch diff --git a/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch b/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch new file mode 100644 index 00000000000000..8194c07695a0d5 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch @@ -0,0 +1,74 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 8 Jun 2015 16:11:40 +0200 +Subject: [PATCH] brcmfmac: register wiphy(s) during module_init +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is needed by OpenWrt which expects all PHYs to be created after +module loads successfully. + +Signed-off-by: Rafał Miłecki +--- + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -1477,6 +1477,7 @@ int __init brcmf_core_init(void) + { + if (!schedule_work(&brcmf_driver_work)) + return -EBUSY; ++ flush_work(&brcmf_driver_work); + + return 0; + } +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -431,6 +431,7 @@ struct brcmf_fw { + struct brcmf_fw_request *req; + u32 curpos; + void (*done)(struct device *dev, int err, struct brcmf_fw_request *req); ++ struct completion *completion; + }; + + static void brcmf_fw_request_done(const struct firmware *fw, void *ctx); +@@ -638,6 +639,8 @@ static void brcmf_fw_request_done(const + fwctx->req = NULL; + } + fwctx->done(fwctx->dev, ret, fwctx->req); ++ if (fwctx->completion) ++ complete(fwctx->completion); + kfree(fwctx); + } + +@@ -662,6 +665,8 @@ int brcmf_fw_get_firmwares(struct device + { + struct brcmf_fw_item *first = &req->items[0]; + struct brcmf_fw *fwctx; ++ struct completion completion; ++ unsigned long time_left; + int ret; + + brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev)); +@@ -678,6 +683,9 @@ int brcmf_fw_get_firmwares(struct device + fwctx->dev = dev; + fwctx->req = req; + fwctx->done = fw_cb; ++ ++ init_completion(&completion); ++ fwctx->completion = &completion; + + ret = request_firmware_nowait(THIS_MODULE, true, first->path, + fwctx->dev, GFP_KERNEL, fwctx, +@@ -685,6 +693,12 @@ int brcmf_fw_get_firmwares(struct device + if (ret < 0) + brcmf_fw_request_done(NULL, fwctx); + ++ ++ time_left = wait_for_completion_timeout(&completion, ++ msecs_to_jiffies(5000)); ++ if (!time_left && fwctx) ++ fwctx->completion = NULL; ++ + return 0; + } + diff --git a/package/kernel/mac80211/patches/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch b/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch similarity index 91% rename from package/kernel/mac80211/patches/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch rename to package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch index 1345e85f6db252..5f0fa7faab8e2a 100644 --- a/package/kernel/mac80211/patches/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch +++ b/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch @@ -10,12 +10,11 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -614,9 +614,37 @@ static struct wireless_dev *brcmf_cfg802 - enum nl80211_iftype type, - struct vif_params *params) - { -+ struct net_device *dev; +@@ -628,8 +628,36 @@ static struct wireless_dev *brcmf_cfg802 + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); + struct brcmf_pub *drvr = cfg->pub; struct wireless_dev *wdev; ++ struct net_device *dev; int err; + /* diff --git a/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch b/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch similarity index 93% rename from package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch rename to package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch index 9b36059079b2c0..c5501b94bfe0b0 100644 --- a/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch +++ b/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch @@ -14,7 +14,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2725,6 +2725,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip +@@ -2787,6 +2787,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip * preference in cfg struct to apply this to * FW later while initializing the dongle */ diff --git a/package/kernel/mac80211/patches/863-brcmfmac-add-in-driver-tables-with-country-codes.patch b/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch similarity index 94% rename from package/kernel/mac80211/patches/863-brcmfmac-add-in-driver-tables-with-country-codes.patch rename to package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch index e7551c3a70368d..2613171a86ec54 100644 --- a/package/kernel/mac80211/patches/863-brcmfmac-add-in-driver-tables-with-country-codes.patch +++ b/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch @@ -12,7 +12,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c -@@ -23,6 +23,36 @@ +@@ -12,6 +12,36 @@ #include "common.h" #include "of.h" @@ -49,9 +49,9 @@ Signed-off-by: Rafał Miłecki void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, struct brcmf_mp_device *settings) { -@@ -32,6 +62,8 @@ void brcmf_of_probe(struct device *dev, - u32 irqf; - u32 val; +@@ -30,6 +60,8 @@ void brcmf_of_probe(struct device *dev, + of_node_put(root); + } + brcmf_of_probe_cc(dev, settings); + diff --git a/package/kernel/mac80211/patches/864-brcmfmac-do-not-use-internal-roaming-engine-by-default.patch b/package/kernel/mac80211/patches/brcm/864-brcmfmac-do-not-use-internal-roaming-engine-by-default.patch similarity index 87% rename from package/kernel/mac80211/patches/864-brcmfmac-do-not-use-internal-roaming-engine-by-default.patch rename to package/kernel/mac80211/patches/brcm/864-brcmfmac-do-not-use-internal-roaming-engine-by-default.patch index 417b6ec86905e5..fe79c40c11cb88 100644 --- a/package/kernel/mac80211/patches/864-brcmfmac-do-not-use-internal-roaming-engine-by-default.patch +++ b/package/kernel/mac80211/patches/brcm/864-brcmfmac-do-not-use-internal-roaming-engine-by-default.patch @@ -9,7 +9,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -@@ -70,7 +70,11 @@ static int brcmf_fcmode; +@@ -59,7 +59,11 @@ static int brcmf_fcmode; module_param_named(fcmode, brcmf_fcmode, int, 0); MODULE_PARM_DESC(fcmode, "Mode of firmware signalled flow control"); @@ -18,6 +18,6 @@ Signed-off-by: Phil Elwell +#else static int brcmf_roamoff; +#endif - module_param_named(roamoff, brcmf_roamoff, int, S_IRUSR); + module_param_named(roamoff, brcmf_roamoff, int, 0400); MODULE_PARM_DESC(roamoff, "Do not use internal roaming engine"); diff --git a/package/kernel/mac80211/patches/000-fix_kconfig.patch b/package/kernel/mac80211/patches/build/000-fix_kconfig.patch similarity index 100% rename from package/kernel/mac80211/patches/000-fix_kconfig.patch rename to package/kernel/mac80211/patches/build/000-fix_kconfig.patch diff --git a/package/kernel/mac80211/patches/001-fix_build.patch b/package/kernel/mac80211/patches/build/001-fix_build.patch similarity index 93% rename from package/kernel/mac80211/patches/001-fix_build.patch rename to package/kernel/mac80211/patches/build/001-fix_build.patch index 9e272e90af0fb9..e57ca190e40109 100644 --- a/package/kernel/mac80211/patches/001-fix_build.patch +++ b/package/kernel/mac80211/patches/build/001-fix_build.patch @@ -27,7 +27,7 @@ @set -e ; test -f local-symbols || ( \ echo "/--------------" ;\ echo "| You shouldn't run make in the backports tree, but only in" ;\ -@@ -60,57 +62,61 @@ mrproper: +@@ -60,58 +62,62 @@ mrproper: echo "| (that isn't currently running.)" ;\ echo "\\--" ;\ false) @@ -56,12 +56,13 @@ - done \ - ) > Kconfig.kernel ;\ - kver=$$($(MAKE) --no-print-directory -C $(KLIB_BUILD) kernelversion | \ -- sed 's/^\(\([3-4]\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\ +- sed 's/^\(\([3-5]\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\ - test "$$kver" != "" || echo "Kernel version parse failed!" ;\ - test "$$kver" != "" ;\ - kvers="$$(seq 14 39 | sed 's/^/2.6./')" ;\ - kvers="$$kvers $$(seq 0 19 | sed 's/^/3./')" ;\ -- kvers="$$kvers $$(seq 0 99 | sed 's/^/4./')" ;\ +- kvers="$$kvers $$(seq 0 20 | sed 's/^/4./')" ;\ +- kvers="$$kvers $$(seq 0 99 | sed 's/^/5./')" ;\ - print=0 ;\ - for v in $$kvers ; do \ - if [ "$$print" = "1" ] ; then \ @@ -112,12 +113,13 @@ + +Kconfig.versions: Kconfig.kernel + @kver=$$($(MAKE) --no-print-directory -C $(KLIB_BUILD) kernelversion | \ -+ sed 's/^\(\([3-4]\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\ ++ sed 's/^\(\([3-5]\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\ + test "$$kver" != "" || echo "Kernel version parse failed!" ;\ + test "$$kver" != "" ;\ + kvers="$$(seq 14 39 | sed 's/^/2.6./')" ;\ + kvers="$$kvers $$(seq 0 19 | sed 's/^/3./')" ;\ -+ kvers="$$kvers $$(seq 0 99 | sed 's/^/4./')" ;\ ++ kvers="$$kvers $$(seq 0 20 | sed 's/^/4./')" ;\ ++ kvers="$$kvers $$(seq 0 99 | sed 's/^/5./')" ;\ + print=0 ;\ + for v in $$kvers ; do \ + if [ "$$print" = "1" ] ; then \ diff --git a/package/kernel/mac80211/patches/002-change_allconfig.patch b/package/kernel/mac80211/patches/build/002-change_allconfig.patch similarity index 100% rename from package/kernel/mac80211/patches/002-change_allconfig.patch rename to package/kernel/mac80211/patches/build/002-change_allconfig.patch diff --git a/package/kernel/mac80211/patches/003-remove_bogus_modparams.patch b/package/kernel/mac80211/patches/build/003-remove_bogus_modparams.patch similarity index 100% rename from package/kernel/mac80211/patches/003-remove_bogus_modparams.patch rename to package/kernel/mac80211/patches/build/003-remove_bogus_modparams.patch diff --git a/package/kernel/mac80211/patches/004-kconfig_backport_fix.patch b/package/kernel/mac80211/patches/build/004-kconfig_backport_fix.patch similarity index 100% rename from package/kernel/mac80211/patches/004-kconfig_backport_fix.patch rename to package/kernel/mac80211/patches/build/004-kconfig_backport_fix.patch diff --git a/package/kernel/mac80211/patches/010-disable_rfkill.patch b/package/kernel/mac80211/patches/build/010-disable_rfkill.patch similarity index 100% rename from package/kernel/mac80211/patches/010-disable_rfkill.patch rename to package/kernel/mac80211/patches/build/010-disable_rfkill.patch diff --git a/package/kernel/mac80211/patches/012-kernel_build_check.patch b/package/kernel/mac80211/patches/build/012-kernel_build_check.patch similarity index 100% rename from package/kernel/mac80211/patches/012-kernel_build_check.patch rename to package/kernel/mac80211/patches/build/012-kernel_build_check.patch diff --git a/package/kernel/mac80211/patches/015-ipw200-mtu.patch b/package/kernel/mac80211/patches/build/015-ipw200-mtu.patch similarity index 86% rename from package/kernel/mac80211/patches/015-ipw200-mtu.patch rename to package/kernel/mac80211/patches/build/015-ipw200-mtu.patch index 8d273a095b1099..d57d821feac086 100644 --- a/package/kernel/mac80211/patches/015-ipw200-mtu.patch +++ b/package/kernel/mac80211/patches/build/015-ipw200-mtu.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c -@@ -11506,6 +11506,15 @@ static const struct attribute_group ipw_ +@@ -11498,6 +11498,15 @@ static const struct attribute_group ipw_ .attrs = ipw_sysfs_entries, }; @@ -16,7 +16,7 @@ #ifdef CPTCFG_IPW2200_PROMISCUOUS static int ipw_prom_open(struct net_device *dev) { -@@ -11554,15 +11563,6 @@ static netdev_tx_t ipw_prom_hard_start_x +@@ -11546,15 +11555,6 @@ static netdev_tx_t ipw_prom_hard_start_x return NETDEV_TX_OK; } diff --git a/package/kernel/mac80211/patches/050-lib80211_option.patch b/package/kernel/mac80211/patches/build/050-lib80211_option.patch similarity index 78% rename from package/kernel/mac80211/patches/050-lib80211_option.patch rename to package/kernel/mac80211/patches/build/050-lib80211_option.patch index 28a0d905b718e1..6282cdab5fc6da 100644 --- a/package/kernel/mac80211/patches/050-lib80211_option.patch +++ b/package/kernel/mac80211/patches/build/050-lib80211_option.patch @@ -1,7 +1,7 @@ --- a/net/wireless/Kconfig +++ b/net/wireless/Kconfig -@@ -181,7 +181,7 @@ config CFG80211_WEXT_EXPORT - wext compatibility symbols to be exported. +@@ -185,7 +185,7 @@ config CFG80211_WEXT_EXPORT + endif # CFG80211 config LIB80211 - tristate @@ -9,7 +9,7 @@ depends on m default n help -@@ -191,15 +191,15 @@ config LIB80211 +@@ -195,15 +195,15 @@ config LIB80211 Drivers should select this themselves if needed. config LIB80211_CRYPT_WEP diff --git a/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch new file mode 100644 index 00000000000000..06636060f7722c --- /dev/null +++ b/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch @@ -0,0 +1,335 @@ +--- a/local-symbols ++++ b/local-symbols +@@ -396,43 +396,6 @@ USB_IPHETH= + USB_SIERRA_NET= + USB_VL600= + USB_NET_CH9200= +-SSB_POSSIBLE= +-SSB= +-SSB_SPROM= +-SSB_BLOCKIO= +-SSB_PCIHOST_POSSIBLE= +-SSB_PCIHOST= +-SSB_B43_PCI_BRIDGE= +-SSB_PCMCIAHOST_POSSIBLE= +-SSB_PCMCIAHOST= +-SSB_SDIOHOST_POSSIBLE= +-SSB_SDIOHOST= +-SSB_HOST_SOC= +-SSB_SERIAL= +-SSB_DRIVER_PCICORE_POSSIBLE= +-SSB_DRIVER_PCICORE= +-SSB_PCICORE_HOSTMODE= +-SSB_DRIVER_MIPS= +-SSB_SFLASH= +-SSB_EMBEDDED= +-SSB_DRIVER_EXTIF= +-SSB_DRIVER_GIGE= +-SSB_DRIVER_GPIO= +-BCMA_POSSIBLE= +-BCMA= +-BCMA_BLOCKIO= +-BCMA_HOST_PCI_POSSIBLE= +-BCMA_HOST_PCI= +-BCMA_HOST_SOC= +-BCMA_DRIVER_PCI= +-BCMA_DRIVER_PCI_HOSTMODE= +-BCMA_DRIVER_MIPS= +-BCMA_PFLASH= +-BCMA_SFLASH= +-BCMA_NFLASH= +-BCMA_DRIVER_GMAC_CMN= +-BCMA_DRIVER_GPIO= +-BCMA_DEBUG= + USB_ACM= + USB_PRINTER= + USB_WDM= +--- a/drivers/net/wireless/broadcom/b43/Kconfig ++++ b/drivers/net/wireless/broadcom/b43/Kconfig +@@ -61,21 +61,21 @@ endchoice + config B43_PCI_AUTOSELECT + bool + depends on B43 && SSB_PCIHOST_POSSIBLE +- select SSB_PCIHOST +- select SSB_B43_PCI_BRIDGE ++ depends on SSB_PCIHOST ++ depends on SSB_B43_PCI_BRIDGE + default y + + # Auto-select SSB PCICORE driver, if possible + config B43_PCICORE_AUTOSELECT + bool + depends on B43 && SSB_DRIVER_PCICORE_POSSIBLE +- select SSB_DRIVER_PCICORE ++ depends on SSB_DRIVER_PCICORE + default y + + config B43_SDIO + bool "Broadcom 43xx SDIO device support" + depends on B43 && B43_SSB && SSB_SDIOHOST_POSSIBLE +- select SSB_SDIOHOST ++ depends on SSB_SDIOHOST + ---help--- + Broadcom 43xx device support for Soft-MAC SDIO devices. + +@@ -94,13 +94,13 @@ config B43_SDIO + config B43_BCMA_PIO + bool + depends on B43 && B43_BCMA +- select BCMA_BLOCKIO ++ depends on BCMA_BLOCKIO + default y + + config B43_PIO + bool + depends on B43 && B43_SSB +- select SSB_BLOCKIO ++ depends on SSB_BLOCKIO + default y + + config B43_PHY_G +--- a/drivers/net/wireless/broadcom/b43/main.c ++++ b/drivers/net/wireless/broadcom/b43/main.c +@@ -2876,7 +2876,7 @@ static struct ssb_device *b43_ssb_gpio_d + { + struct ssb_bus *bus = dev->dev->sdev->bus; + +-#ifdef CPTCFG_SSB_DRIVER_PCICORE ++#ifdef CONFIG_SSB_DRIVER_PCICORE + return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev); + #else + return bus->chipco.dev; +@@ -4893,7 +4893,7 @@ static int b43_wireless_core_init(struct + } + if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW) + hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */ +-#if defined(CPTCFG_B43_SSB) && defined(CPTCFG_SSB_DRIVER_PCICORE) ++#if defined(CPTCFG_B43_SSB) && defined(CONFIG_SSB_DRIVER_PCICORE) + if (dev->dev->bus_type == B43_BUS_SSB && + dev->dev->sdev->bus->bustype == SSB_BUSTYPE_PCI && + dev->dev->sdev->bus->pcicore.dev->id.revision <= 10) +--- a/drivers/net/wireless/broadcom/b43legacy/Kconfig ++++ b/drivers/net/wireless/broadcom/b43legacy/Kconfig +@@ -2,7 +2,7 @@ config B43LEGACY + tristate "Broadcom 43xx-legacy wireless support (mac80211 stack)" + depends on m + depends on SSB_POSSIBLE && MAC80211 && HAS_DMA +- select SSB ++ depends on SSB + depends on FW_LOADER + ---help--- + b43legacy is a driver for 802.11b devices from Broadcom (BCM4301 and +@@ -24,15 +24,15 @@ config B43LEGACY + config B43LEGACY_PCI_AUTOSELECT + bool + depends on B43LEGACY && SSB_PCIHOST_POSSIBLE +- select SSB_PCIHOST +- select SSB_B43_PCI_BRIDGE ++ depends on SSB_PCIHOST ++ depends on SSB_B43_PCI_BRIDGE + default y + + # Auto-select SSB PCICORE driver, if possible + config B43LEGACY_PCICORE_AUTOSELECT + bool + depends on B43LEGACY && SSB_DRIVER_PCICORE_POSSIBLE +- select SSB_DRIVER_PCICORE ++ depends on SSB_DRIVER_PCICORE + default y + + # LED support +--- a/drivers/net/wireless/broadcom/b43legacy/main.c ++++ b/drivers/net/wireless/broadcom/b43legacy/main.c +@@ -1937,7 +1937,7 @@ static int b43legacy_gpio_init(struct b4 + if (dev->dev->id.revision >= 2) + mask |= 0x0010; /* FIXME: This is redundant. */ + +-#ifdef CPTCFG_SSB_DRIVER_PCICORE ++#ifdef CONFIG_SSB_DRIVER_PCICORE + pcidev = bus->pcicore.dev; + #endif + gpiodev = bus->chipco.dev ? : pcidev; +@@ -1956,7 +1956,7 @@ static void b43legacy_gpio_cleanup(struc + struct ssb_bus *bus = dev->dev->bus; + struct ssb_device *gpiodev, *pcidev = NULL; + +-#ifdef CPTCFG_SSB_DRIVER_PCICORE ++#ifdef CONFIG_SSB_DRIVER_PCICORE + pcidev = bus->pcicore.dev; + #endif + gpiodev = bus->chipco.dev ? : pcidev; +--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.h +@@ -22,7 +22,7 @@ struct brcms_led { + bool active_low; + }; + +-#ifdef CPTCFG_BCMA_DRIVER_GPIO ++#ifdef CONFIG_BCMA_DRIVER_GPIO + void brcms_led_unregister(struct brcms_info *wl); + int brcms_led_register(struct brcms_info *wl); + #else +--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/Makefile ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/Makefile +@@ -42,6 +42,6 @@ brcmsmac-y := \ + brcms_trace_events.o \ + debug.o + +-brcmsmac-$(CPTCFG_BCMA_DRIVER_GPIO) += led.o ++brcmsmac-$(CONFIG_BCMA_DRIVER_GPIO) += led.o + + obj-$(CPTCFG_BRCMSMAC) += brcmsmac.o +--- a/drivers/net/wireless/broadcom/brcm80211/Kconfig ++++ b/drivers/net/wireless/broadcom/brcm80211/Kconfig +@@ -7,7 +7,7 @@ config BRCMSMAC + depends on m + depends on MAC80211 + depends on BCMA_POSSIBLE +- select BCMA ++ depends on BCMA + select NEW_LEDS if BCMA_DRIVER_GPIO + select LEDS_CLASS if BCMA_DRIVER_GPIO + select BRCMUTIL +--- a/Kconfig.local ++++ b/Kconfig.local +@@ -1192,117 +1192,6 @@ config BACKPORTED_USB_VL600 + config BACKPORTED_USB_NET_CH9200 + tristate + default USB_NET_CH9200 +-config BACKPORTED_SSB_POSSIBLE +- tristate +- default SSB_POSSIBLE +-config BACKPORTED_SSB +- tristate +- default SSB +-config BACKPORTED_SSB_SPROM +- tristate +- default SSB_SPROM +-config BACKPORTED_SSB_BLOCKIO +- tristate +- default SSB_BLOCKIO +-config BACKPORTED_SSB_PCIHOST_POSSIBLE +- tristate +- default SSB_PCIHOST_POSSIBLE +-config BACKPORTED_SSB_PCIHOST +- tristate +- default SSB_PCIHOST +-config BACKPORTED_SSB_B43_PCI_BRIDGE +- tristate +- default SSB_B43_PCI_BRIDGE +-config BACKPORTED_SSB_PCMCIAHOST_POSSIBLE +- tristate +- default SSB_PCMCIAHOST_POSSIBLE +-config BACKPORTED_SSB_PCMCIAHOST +- tristate +- default SSB_PCMCIAHOST +-config BACKPORTED_SSB_SDIOHOST_POSSIBLE +- tristate +- default SSB_SDIOHOST_POSSIBLE +-config BACKPORTED_SSB_SDIOHOST +- tristate +- default SSB_SDIOHOST +-config BACKPORTED_SSB_HOST_SOC +- tristate +- default SSB_HOST_SOC +-config BACKPORTED_SSB_SERIAL +- tristate +- default SSB_SERIAL +-config BACKPORTED_SSB_DRIVER_PCICORE_POSSIBLE +- tristate +- default SSB_DRIVER_PCICORE_POSSIBLE +-config BACKPORTED_SSB_DRIVER_PCICORE +- tristate +- default SSB_DRIVER_PCICORE +-config BACKPORTED_SSB_PCICORE_HOSTMODE +- tristate +- default SSB_PCICORE_HOSTMODE +-config BACKPORTED_SSB_DRIVER_MIPS +- tristate +- default SSB_DRIVER_MIPS +-config BACKPORTED_SSB_SFLASH +- tristate +- default SSB_SFLASH +-config BACKPORTED_SSB_EMBEDDED +- tristate +- default SSB_EMBEDDED +-config BACKPORTED_SSB_DRIVER_EXTIF +- tristate +- default SSB_DRIVER_EXTIF +-config BACKPORTED_SSB_DRIVER_GIGE +- tristate +- default SSB_DRIVER_GIGE +-config BACKPORTED_SSB_DRIVER_GPIO +- tristate +- default SSB_DRIVER_GPIO +-config BACKPORTED_BCMA_POSSIBLE +- tristate +- default BCMA_POSSIBLE +-config BACKPORTED_BCMA +- tristate +- default BCMA +-config BACKPORTED_BCMA_BLOCKIO +- tristate +- default BCMA_BLOCKIO +-config BACKPORTED_BCMA_HOST_PCI_POSSIBLE +- tristate +- default BCMA_HOST_PCI_POSSIBLE +-config BACKPORTED_BCMA_HOST_PCI +- tristate +- default BCMA_HOST_PCI +-config BACKPORTED_BCMA_HOST_SOC +- tristate +- default BCMA_HOST_SOC +-config BACKPORTED_BCMA_DRIVER_PCI +- tristate +- default BCMA_DRIVER_PCI +-config BACKPORTED_BCMA_DRIVER_PCI_HOSTMODE +- tristate +- default BCMA_DRIVER_PCI_HOSTMODE +-config BACKPORTED_BCMA_DRIVER_MIPS +- tristate +- default BCMA_DRIVER_MIPS +-config BACKPORTED_BCMA_PFLASH +- tristate +- default BCMA_PFLASH +-config BACKPORTED_BCMA_SFLASH +- tristate +- default BCMA_SFLASH +-config BACKPORTED_BCMA_NFLASH +- tristate +- default BCMA_NFLASH +-config BACKPORTED_BCMA_DRIVER_GMAC_CMN +- tristate +- default BCMA_DRIVER_GMAC_CMN +-config BACKPORTED_BCMA_DRIVER_GPIO +- tristate +- default BCMA_DRIVER_GPIO +-config BACKPORTED_BCMA_DEBUG +- tristate +- default BCMA_DEBUG + config BACKPORTED_USB_ACM + tristate + default USB_ACM +--- a/Kconfig.sources ++++ b/Kconfig.sources +@@ -7,9 +7,6 @@ source "$BACKPORT_DIR/net/mac80211/Kconf + source "$BACKPORT_DIR/drivers/net/wireless/Kconfig" + source "$BACKPORT_DIR/drivers/net/usb/Kconfig" + +-source "$BACKPORT_DIR/drivers/ssb/Kconfig" +-source "$BACKPORT_DIR/drivers/bcma/Kconfig" +- + source "$BACKPORT_DIR/drivers/usb/class/Kconfig" + + source "$BACKPORT_DIR/drivers/staging/Kconfig" +--- a/Makefile.kernel ++++ b/Makefile.kernel +@@ -40,8 +40,6 @@ obj-y += compat/ + obj-$(CPTCFG_CFG80211) += net/wireless/ + obj-$(CPTCFG_MAC80211) += net/mac80211/ + obj-$(CPTCFG_WLAN) += drivers/net/wireless/ +-obj-$(CPTCFG_SSB) += drivers/ssb/ +-obj-$(CPTCFG_BCMA) += drivers/bcma/ + obj-$(CPTCFG_USB_NET_RNDIS_WLAN) += drivers/net/usb/ + + obj-$(CPTCFG_USB_WDM) += drivers/usb/class/ diff --git a/package/kernel/mac80211/patches/700-mwl8k-missing-pci-id-for-WNR854T.patch b/package/kernel/mac80211/patches/mwl/700-mwl8k-missing-pci-id-for-WNR854T.patch similarity index 87% rename from package/kernel/mac80211/patches/700-mwl8k-missing-pci-id-for-WNR854T.patch rename to package/kernel/mac80211/patches/mwl/700-mwl8k-missing-pci-id-for-WNR854T.patch index a901a44ba42619..9c5870bef8aadf 100644 --- a/package/kernel/mac80211/patches/700-mwl8k-missing-pci-id-for-WNR854T.patch +++ b/package/kernel/mac80211/patches/mwl/700-mwl8k-missing-pci-id-for-WNR854T.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/marvell/mwl8k.c +++ b/drivers/net/wireless/marvell/mwl8k.c -@@ -5681,6 +5681,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw") +@@ -5691,6 +5691,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw") MODULE_FIRMWARE(MWL8K_8366_AP_FW(MWL8K_8366_AP_FW_API)); static const struct pci_device_id mwl8k_pci_id_table[] = { diff --git a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch b/package/kernel/mac80211/patches/mwl/801-libertas-configure-sysfs-links.patch similarity index 89% rename from package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch rename to package/kernel/mac80211/patches/mwl/801-libertas-configure-sysfs-links.patch index 885bc246babfaa..c3e6db8f05da89 100644 --- a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch +++ b/package/kernel/mac80211/patches/mwl/801-libertas-configure-sysfs-links.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/marvell/libertas/cfg.c +++ b/drivers/net/wireless/marvell/libertas/cfg.c -@@ -2040,6 +2040,8 @@ struct wireless_dev *lbs_cfg_alloc(struc +@@ -2041,6 +2041,8 @@ struct wireless_dev *lbs_cfg_alloc(struc goto err_wiphy_new; } diff --git a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch b/package/kernel/mac80211/patches/mwl/802-libertas-set-wireless-macaddr.patch similarity index 85% rename from package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch rename to package/kernel/mac80211/patches/mwl/802-libertas-set-wireless-macaddr.patch index 089ad2fe789c91..f1966d88e6d11d 100644 --- a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch +++ b/package/kernel/mac80211/patches/mwl/802-libertas-set-wireless-macaddr.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/marvell/libertas/cfg.c +++ b/drivers/net/wireless/marvell/libertas/cfg.c -@@ -2116,6 +2116,8 @@ int lbs_cfg_register(struct lbs_private +@@ -2117,6 +2117,8 @@ int lbs_cfg_register(struct lbs_private wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); wdev->wiphy->reg_notifier = lbs_reg_notifier; diff --git a/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/mwl/940-mwl8k_init_devices_synchronously.patch similarity index 75% rename from package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch rename to package/kernel/mac80211/patches/mwl/940-mwl8k_init_devices_synchronously.patch index a958c78b431a99..ca0b37a8a71598 100644 --- a/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch +++ b/package/kernel/mac80211/patches/mwl/940-mwl8k_init_devices_synchronously.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/marvell/mwl8k.c +++ b/drivers/net/wireless/marvell/mwl8k.c -@@ -6266,6 +6266,8 @@ static int mwl8k_probe(struct pci_dev *p +@@ -6276,6 +6276,8 @@ static int mwl8k_probe(struct pci_dev *p priv->running_bsses = 0; @@ -9,7 +9,7 @@ return rc; err_stop_firmware: -@@ -6299,8 +6301,6 @@ static void mwl8k_remove(struct pci_dev +@@ -6309,8 +6311,6 @@ static void mwl8k_remove(struct pci_dev return; priv = hw->priv; diff --git a/package/kernel/mac80211/patches/rt2x00/001-rt2x00-use-simple_read_from_buffer.patch b/package/kernel/mac80211/patches/rt2x00/001-rt2x00-use-simple_read_from_buffer.patch new file mode 100644 index 00000000000000..1319cc244c3ae2 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/001-rt2x00-use-simple_read_from_buffer.patch @@ -0,0 +1,59 @@ +From f483039cf51acf30494cd754194562c22cf98764 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Wed, 22 Aug 2018 13:41:26 +0300 +Subject: [PATCH 01/28] rt2x00: use simple_read_from_buffer() + +The problem with this copy_to_user() calls is that they don't ensure +that "size" is less than the "length" which the user provided. + +Obviously, this is debugfs and "size" is normally going to be very small +so it probably doesn't matter, but this is the correct thing to do. + +Signed-off-by: Dan Carpenter +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + .../net/wireless/ralink/rt2x00/rt2x00debug.c | 18 +++--------------- + 1 file changed, 3 insertions(+), 15 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c +@@ -464,11 +464,7 @@ static ssize_t rt2x00debug_read_##__name + \ + size = sprintf(line, __format, value); \ + \ +- if (copy_to_user(buf, line, size)) \ +- return -EFAULT; \ +- \ +- *offset += size; \ +- return size; \ ++ return simple_read_from_buffer(buf, length, offset, line, size); \ + } + + #define RT2X00DEBUGFS_OPS_WRITE(__name, __type) \ +@@ -545,11 +541,7 @@ static ssize_t rt2x00debug_read_dev_flag + + size = sprintf(line, "0x%.8x\n", (unsigned int)intf->rt2x00dev->flags); + +- if (copy_to_user(buf, line, size)) +- return -EFAULT; +- +- *offset += size; +- return size; ++ return simple_read_from_buffer(buf, length, offset, line, size); + } + + static const struct file_operations rt2x00debug_fop_dev_flags = { +@@ -574,11 +566,7 @@ static ssize_t rt2x00debug_read_cap_flag + + size = sprintf(line, "0x%.8x\n", (unsigned int)intf->rt2x00dev->cap_flags); + +- if (copy_to_user(buf, line, size)) +- return -EFAULT; +- +- *offset += size; +- return size; ++ return simple_read_from_buffer(buf, length, offset, line, size); + } + + static const struct file_operations rt2x00debug_fop_cap_flags = { diff --git a/package/kernel/mac80211/patches/rt2x00/002-rt2800-move-usb-specific-txdone-txstatus-routines-to.patch b/package/kernel/mac80211/patches/rt2x00/002-rt2800-move-usb-specific-txdone-txstatus-routines-to.patch new file mode 100644 index 00000000000000..a883258a4c684e --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/002-rt2800-move-usb-specific-txdone-txstatus-routines-to.patch @@ -0,0 +1,357 @@ +From 5c656c71b1bf5611ce8262bab338104e04d10b8d Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Wed, 26 Sep 2018 12:24:53 +0200 +Subject: [PATCH 02/28] rt2800: move usb specific txdone/txstatus routines to + rt2800lib + +In order to reuse usb txdone/txstatus routines for mmio, move them +to common rt2800lib.c file. + +Signed-off-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + .../net/wireless/ralink/rt2x00/rt2800lib.c | 138 +++++++++++++++++ + .../net/wireless/ralink/rt2x00/rt2800lib.h | 3 + + .../net/wireless/ralink/rt2x00/rt2800usb.c | 143 +----------------- + 3 files changed, 145 insertions(+), 139 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -957,6 +957,47 @@ static void rt2800_rate_from_status(stru + skbdesc->tx_rate_flags = flags; + } + ++static bool rt2800_txdone_entry_check(struct queue_entry *entry, u32 reg) ++{ ++ __le32 *txwi; ++ u32 word; ++ int wcid, ack, pid; ++ int tx_wcid, tx_ack, tx_pid, is_agg; ++ ++ /* ++ * This frames has returned with an IO error, ++ * so the status report is not intended for this ++ * frame. ++ */ ++ if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags)) ++ return false; ++ ++ wcid = rt2x00_get_field32(reg, TX_STA_FIFO_WCID); ++ ack = rt2x00_get_field32(reg, TX_STA_FIFO_TX_ACK_REQUIRED); ++ pid = rt2x00_get_field32(reg, TX_STA_FIFO_PID_TYPE); ++ is_agg = rt2x00_get_field32(reg, TX_STA_FIFO_TX_AGGRE); ++ ++ /* ++ * Validate if this TX status report is intended for ++ * this entry by comparing the WCID/ACK/PID fields. ++ */ ++ txwi = rt2800_drv_get_txwi(entry); ++ ++ word = rt2x00_desc_read(txwi, 1); ++ tx_wcid = rt2x00_get_field32(word, TXWI_W1_WIRELESS_CLI_ID); ++ tx_ack = rt2x00_get_field32(word, TXWI_W1_ACK); ++ tx_pid = rt2x00_get_field32(word, TXWI_W1_PACKETID); ++ ++ if (wcid != tx_wcid || ack != tx_ack || (!is_agg && pid != tx_pid)) { ++ rt2x00_dbg(entry->queue->rt2x00dev, ++ "TX status report missed for queue %d entry %d\n", ++ entry->queue->qid, entry->entry_idx); ++ return false; ++ } ++ ++ return true; ++} ++ + void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi, + bool match) + { +@@ -1059,6 +1100,103 @@ void rt2800_txdone_entry(struct queue_en + } + EXPORT_SYMBOL_GPL(rt2800_txdone_entry); + ++void rt2800_txdone(struct rt2x00_dev *rt2x00dev) ++{ ++ struct data_queue *queue; ++ struct queue_entry *entry; ++ u32 reg; ++ u8 qid; ++ bool match; ++ ++ while (kfifo_get(&rt2x00dev->txstatus_fifo, ®)) { ++ /* ++ * TX_STA_FIFO_PID_QUEUE is a 2-bit field, thus qid is ++ * guaranteed to be one of the TX QIDs . ++ */ ++ qid = rt2x00_get_field32(reg, TX_STA_FIFO_PID_QUEUE); ++ queue = rt2x00queue_get_tx_queue(rt2x00dev, qid); ++ ++ if (unlikely(rt2x00queue_empty(queue))) { ++ rt2x00_dbg(rt2x00dev, "Got TX status for an empty queue %u, dropping\n", ++ qid); ++ break; ++ } ++ ++ entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); ++ ++ if (unlikely(test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) || ++ !test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags))) { ++ rt2x00_warn(rt2x00dev, "Data pending for entry %u in queue %u\n", ++ entry->entry_idx, qid); ++ break; ++ } ++ ++ match = rt2800_txdone_entry_check(entry, reg); ++ rt2800_txdone_entry(entry, reg, rt2800_drv_get_txwi(entry), match); ++ } ++} ++EXPORT_SYMBOL_GPL(rt2800_txdone); ++ ++static inline bool rt2800_entry_txstatus_timeout(struct queue_entry *entry) ++{ ++ bool tout; ++ ++ if (!test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) ++ return false; ++ ++ tout = time_after(jiffies, entry->last_action + msecs_to_jiffies(500)); ++ if (unlikely(tout)) ++ rt2x00_dbg(entry->queue->rt2x00dev, ++ "TX status timeout for entry %d in queue %d\n", ++ entry->entry_idx, entry->queue->qid); ++ return tout; ++ ++} ++ ++bool rt2800_txstatus_timeout(struct rt2x00_dev *rt2x00dev) ++{ ++ struct data_queue *queue; ++ struct queue_entry *entry; ++ ++ tx_queue_for_each(rt2x00dev, queue) { ++ entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); ++ if (rt2800_entry_txstatus_timeout(entry)) ++ return true; ++ } ++ return false; ++} ++EXPORT_SYMBOL_GPL(rt2800_txstatus_timeout); ++ ++void rt2800_txdone_nostatus(struct rt2x00_dev *rt2x00dev) ++{ ++ struct data_queue *queue; ++ struct queue_entry *entry; ++ ++ /* ++ * Process any trailing TX status reports for IO failures, ++ * we loop until we find the first non-IO error entry. This ++ * can either be a frame which is free, is being uploaded, ++ * or has completed the upload but didn't have an entry ++ * in the TX_STAT_FIFO register yet. ++ */ ++ tx_queue_for_each(rt2x00dev, queue) { ++ while (!rt2x00queue_empty(queue)) { ++ entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); ++ ++ if (test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) || ++ !test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) ++ break; ++ ++ if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags) || ++ rt2800_entry_txstatus_timeout(entry)) ++ rt2x00lib_txdone_noinfo(entry, TXDONE_FAILURE); ++ else ++ break; ++ } ++ } ++} ++EXPORT_SYMBOL_GPL(rt2800_txdone_nostatus); ++ + static unsigned int rt2800_hw_beacon_base(struct rt2x00_dev *rt2x00dev, + unsigned int index) + { +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h +@@ -195,6 +195,9 @@ void rt2800_process_rxwi(struct queue_en + + void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi, + bool match); ++void rt2800_txdone(struct rt2x00_dev *rt2x00dev); ++void rt2800_txdone_nostatus(struct rt2x00_dev *rt2x00dev); ++bool rt2800_txstatus_timeout(struct rt2x00_dev *rt2x00dev); + + void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc); + void rt2800_clear_beacon(struct queue_entry *entry); +--- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c +@@ -116,35 +116,6 @@ static bool rt2800usb_txstatus_pending(s + return false; + } + +-static inline bool rt2800usb_entry_txstatus_timeout(struct queue_entry *entry) +-{ +- bool tout; +- +- if (!test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) +- return false; +- +- tout = time_after(jiffies, entry->last_action + msecs_to_jiffies(500)); +- if (unlikely(tout)) +- rt2x00_dbg(entry->queue->rt2x00dev, +- "TX status timeout for entry %d in queue %d\n", +- entry->entry_idx, entry->queue->qid); +- return tout; +- +-} +- +-static bool rt2800usb_txstatus_timeout(struct rt2x00_dev *rt2x00dev) +-{ +- struct data_queue *queue; +- struct queue_entry *entry; +- +- tx_queue_for_each(rt2x00dev, queue) { +- entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); +- if (rt2800usb_entry_txstatus_timeout(entry)) +- return true; +- } +- return false; +-} +- + #define TXSTATUS_READ_INTERVAL 1000000 + + static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev, +@@ -171,7 +142,7 @@ static bool rt2800usb_tx_sta_fifo_read_c + } + + /* Check if there is any entry that timedout waiting on TX status */ +- if (rt2800usb_txstatus_timeout(rt2x00dev)) ++ if (rt2800_txstatus_timeout(rt2x00dev)) + queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work); + + if (rt2800usb_txstatus_pending(rt2x00dev)) { +@@ -501,123 +472,17 @@ static int rt2800usb_get_tx_data_len(str + /* + * TX control handlers + */ +-static bool rt2800usb_txdone_entry_check(struct queue_entry *entry, u32 reg) +-{ +- __le32 *txwi; +- u32 word; +- int wcid, ack, pid; +- int tx_wcid, tx_ack, tx_pid, is_agg; +- +- /* +- * This frames has returned with an IO error, +- * so the status report is not intended for this +- * frame. +- */ +- if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags)) +- return false; +- +- wcid = rt2x00_get_field32(reg, TX_STA_FIFO_WCID); +- ack = rt2x00_get_field32(reg, TX_STA_FIFO_TX_ACK_REQUIRED); +- pid = rt2x00_get_field32(reg, TX_STA_FIFO_PID_TYPE); +- is_agg = rt2x00_get_field32(reg, TX_STA_FIFO_TX_AGGRE); +- +- /* +- * Validate if this TX status report is intended for +- * this entry by comparing the WCID/ACK/PID fields. +- */ +- txwi = rt2800usb_get_txwi(entry); +- +- word = rt2x00_desc_read(txwi, 1); +- tx_wcid = rt2x00_get_field32(word, TXWI_W1_WIRELESS_CLI_ID); +- tx_ack = rt2x00_get_field32(word, TXWI_W1_ACK); +- tx_pid = rt2x00_get_field32(word, TXWI_W1_PACKETID); +- +- if (wcid != tx_wcid || ack != tx_ack || (!is_agg && pid != tx_pid)) { +- rt2x00_dbg(entry->queue->rt2x00dev, +- "TX status report missed for queue %d entry %d\n", +- entry->queue->qid, entry->entry_idx); +- return false; +- } +- +- return true; +-} +- +-static void rt2800usb_txdone(struct rt2x00_dev *rt2x00dev) +-{ +- struct data_queue *queue; +- struct queue_entry *entry; +- u32 reg; +- u8 qid; +- bool match; +- +- while (kfifo_get(&rt2x00dev->txstatus_fifo, ®)) { +- /* +- * TX_STA_FIFO_PID_QUEUE is a 2-bit field, thus qid is +- * guaranteed to be one of the TX QIDs . +- */ +- qid = rt2x00_get_field32(reg, TX_STA_FIFO_PID_QUEUE); +- queue = rt2x00queue_get_tx_queue(rt2x00dev, qid); +- +- if (unlikely(rt2x00queue_empty(queue))) { +- rt2x00_dbg(rt2x00dev, "Got TX status for an empty queue %u, dropping\n", +- qid); +- break; +- } +- +- entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); +- +- if (unlikely(test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) || +- !test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags))) { +- rt2x00_warn(rt2x00dev, "Data pending for entry %u in queue %u\n", +- entry->entry_idx, qid); +- break; +- } +- +- match = rt2800usb_txdone_entry_check(entry, reg); +- rt2800_txdone_entry(entry, reg, rt2800usb_get_txwi(entry), match); +- } +-} +- +-static void rt2800usb_txdone_nostatus(struct rt2x00_dev *rt2x00dev) +-{ +- struct data_queue *queue; +- struct queue_entry *entry; +- +- /* +- * Process any trailing TX status reports for IO failures, +- * we loop until we find the first non-IO error entry. This +- * can either be a frame which is free, is being uploaded, +- * or has completed the upload but didn't have an entry +- * in the TX_STAT_FIFO register yet. +- */ +- tx_queue_for_each(rt2x00dev, queue) { +- while (!rt2x00queue_empty(queue)) { +- entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); +- +- if (test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) || +- !test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) +- break; +- +- if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags) || +- rt2800usb_entry_txstatus_timeout(entry)) +- rt2x00lib_txdone_noinfo(entry, TXDONE_FAILURE); +- else +- break; +- } +- } +-} +- + static void rt2800usb_work_txdone(struct work_struct *work) + { + struct rt2x00_dev *rt2x00dev = + container_of(work, struct rt2x00_dev, txdone_work); + + while (!kfifo_is_empty(&rt2x00dev->txstatus_fifo) || +- rt2800usb_txstatus_timeout(rt2x00dev)) { ++ rt2800_txstatus_timeout(rt2x00dev)) { + +- rt2800usb_txdone(rt2x00dev); ++ rt2800_txdone(rt2x00dev); + +- rt2800usb_txdone_nostatus(rt2x00dev); ++ rt2800_txdone_nostatus(rt2x00dev); + + /* + * The hw may delay sending the packet after DMA complete diff --git a/package/kernel/mac80211/patches/rt2x00/003-rt2800mmio-use-txdone-txstatus-routines-from-lib.patch b/package/kernel/mac80211/patches/rt2x00/003-rt2800mmio-use-txdone-txstatus-routines-from-lib.patch new file mode 100644 index 00000000000000..48f0c270114483 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/003-rt2800mmio-use-txdone-txstatus-routines-from-lib.patch @@ -0,0 +1,244 @@ +From 0b0d556e0ebb6c966bc993e21a22a156812d8fdf Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Wed, 26 Sep 2018 12:24:54 +0200 +Subject: [PATCH 03/28] rt2800mmio: use txdone/txstatus routines from lib + +Use usb txdone/txstatus routines (now in rt2800libc) for mmio devices. + +Note this also change how we handle INT_SOURCE_CSR_TX_FIFO_STATUS +interrupt. Now it is disabled since IRQ routine till end of the txstatus +tasklet (the same behaviour like others interrupts). Reason to do not +disable this interrupt was not to miss any tx status from 16 entries +FIFO register. Now, since we check for tx status timeout, we can +allow to miss some tx statuses. However this will be improved in further +patch where I also implement read status FIFO register in the tasklet. + +Signed-off-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + .../net/wireless/ralink/rt2x00/rt2800mmio.c | 180 +----------------- + .../net/wireless/ralink/rt2x00/rt2x00queue.c | 1 + + 2 files changed, 9 insertions(+), 172 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c +@@ -175,161 +175,6 @@ static void rt2800mmio_wakeup(struct rt2 + rt2800_config(rt2x00dev, &libconf, IEEE80211_CONF_CHANGE_PS); + } + +-static bool rt2800mmio_txdone_entry_check(struct queue_entry *entry, u32 status) +-{ +- __le32 *txwi; +- u32 word; +- int wcid, tx_wcid; +- +- wcid = rt2x00_get_field32(status, TX_STA_FIFO_WCID); +- +- txwi = rt2800_drv_get_txwi(entry); +- word = rt2x00_desc_read(txwi, 1); +- tx_wcid = rt2x00_get_field32(word, TXWI_W1_WIRELESS_CLI_ID); +- +- return (tx_wcid == wcid); +-} +- +-static bool rt2800mmio_txdone_find_entry(struct queue_entry *entry, void *data) +-{ +- u32 status = *(u32 *)data; +- +- /* +- * rt2800pci hardware might reorder frames when exchanging traffic +- * with multiple BA enabled STAs. +- * +- * For example, a tx queue +- * [ STA1 | STA2 | STA1 | STA2 ] +- * can result in tx status reports +- * [ STA1 | STA1 | STA2 | STA2 ] +- * when the hw decides to aggregate the frames for STA1 into one AMPDU. +- * +- * To mitigate this effect, associate the tx status to the first frame +- * in the tx queue with a matching wcid. +- */ +- if (rt2800mmio_txdone_entry_check(entry, status) && +- !test_bit(ENTRY_DATA_STATUS_SET, &entry->flags)) { +- /* +- * Got a matching frame, associate the tx status with +- * the frame +- */ +- entry->status = status; +- set_bit(ENTRY_DATA_STATUS_SET, &entry->flags); +- return true; +- } +- +- /* Check the next frame */ +- return false; +-} +- +-static bool rt2800mmio_txdone_match_first(struct queue_entry *entry, void *data) +-{ +- u32 status = *(u32 *)data; +- +- /* +- * Find the first frame without tx status and assign this status to it +- * regardless if it matches or not. +- */ +- if (!test_bit(ENTRY_DATA_STATUS_SET, &entry->flags)) { +- /* +- * Got a matching frame, associate the tx status with +- * the frame +- */ +- entry->status = status; +- set_bit(ENTRY_DATA_STATUS_SET, &entry->flags); +- return true; +- } +- +- /* Check the next frame */ +- return false; +-} +-static bool rt2800mmio_txdone_release_entries(struct queue_entry *entry, +- void *data) +-{ +- if (test_bit(ENTRY_DATA_STATUS_SET, &entry->flags)) { +- rt2800_txdone_entry(entry, entry->status, +- rt2800mmio_get_txwi(entry), true); +- return false; +- } +- +- /* No more frames to release */ +- return true; +-} +- +-static bool rt2800mmio_txdone(struct rt2x00_dev *rt2x00dev) +-{ +- struct data_queue *queue; +- u32 status; +- u8 qid; +- int max_tx_done = 16; +- +- while (kfifo_get(&rt2x00dev->txstatus_fifo, &status)) { +- qid = rt2x00_get_field32(status, TX_STA_FIFO_PID_QUEUE); +- if (unlikely(qid >= QID_RX)) { +- /* +- * Unknown queue, this shouldn't happen. Just drop +- * this tx status. +- */ +- rt2x00_warn(rt2x00dev, "Got TX status report with unexpected pid %u, dropping\n", +- qid); +- break; +- } +- +- queue = rt2x00queue_get_tx_queue(rt2x00dev, qid); +- if (unlikely(queue == NULL)) { +- /* +- * The queue is NULL, this shouldn't happen. Stop +- * processing here and drop the tx status +- */ +- rt2x00_warn(rt2x00dev, "Got TX status for an unavailable queue %u, dropping\n", +- qid); +- break; +- } +- +- if (unlikely(rt2x00queue_empty(queue))) { +- /* +- * The queue is empty. Stop processing here +- * and drop the tx status. +- */ +- rt2x00_warn(rt2x00dev, "Got TX status for an empty queue %u, dropping\n", +- qid); +- break; +- } +- +- /* +- * Let's associate this tx status with the first +- * matching frame. +- */ +- if (!rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, +- Q_INDEX, &status, +- rt2800mmio_txdone_find_entry)) { +- /* +- * We cannot match the tx status to any frame, so just +- * use the first one. +- */ +- if (!rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, +- Q_INDEX, &status, +- rt2800mmio_txdone_match_first)) { +- rt2x00_warn(rt2x00dev, "No frame found for TX status on queue %u, dropping\n", +- qid); +- break; +- } +- } +- +- /* +- * Release all frames with a valid tx status. +- */ +- rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, +- Q_INDEX, NULL, +- rt2800mmio_txdone_release_entries); +- +- if (--max_tx_done == 0) +- break; +- } +- +- return !max_tx_done; +-} +- + static inline void rt2800mmio_enable_interrupt(struct rt2x00_dev *rt2x00dev, + struct rt2x00_field32 irq_field) + { +@@ -349,14 +194,14 @@ static inline void rt2800mmio_enable_int + void rt2800mmio_txstatus_tasklet(unsigned long data) + { + struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; +- if (rt2800mmio_txdone(rt2x00dev)) +- tasklet_schedule(&rt2x00dev->txstatus_tasklet); + +- /* +- * No need to enable the tx status interrupt here as we always +- * leave it enabled to minimize the possibility of a tx status +- * register overflow. See comment in interrupt handler. +- */ ++ rt2800_txdone(rt2x00dev); ++ ++ rt2800_txdone_nostatus(rt2x00dev); ++ ++ if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) ++ rt2800mmio_enable_interrupt(rt2x00dev, ++ INT_SOURCE_CSR_TX_FIFO_STATUS); + } + EXPORT_SYMBOL_GPL(rt2800mmio_txstatus_tasklet); + +@@ -440,10 +285,6 @@ static void rt2800mmio_txstatus_interrup + * because we can schedule the tasklet multiple times (when the + * interrupt fires again during tx status processing). + * +- * Furthermore we don't disable the TX_FIFO_STATUS +- * interrupt here but leave it enabled so that the TX_STA_FIFO +- * can also be read while the tx status tasklet gets executed. +- * + * Since we have only one producer and one consumer we don't + * need to lock the kfifo. + */ +@@ -485,13 +326,8 @@ irqreturn_t rt2800mmio_interrupt(int irq + */ + mask = ~reg; + +- if (rt2x00_get_field32(reg, INT_SOURCE_CSR_TX_FIFO_STATUS)) { ++ if (rt2x00_get_field32(reg, INT_SOURCE_CSR_TX_FIFO_STATUS)) + rt2800mmio_txstatus_interrupt(rt2x00dev); +- /* +- * Never disable the TX_FIFO_STATUS interrupt. +- */ +- rt2x00_set_field32(&mask, INT_MASK_CSR_TX_FIFO_STATUS, 1); +- } + + if (rt2x00_get_field32(reg, INT_SOURCE_CSR_PRE_TBTT)) + tasklet_hi_schedule(&rt2x00dev->pretbtt_tasklet); +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c +@@ -113,6 +113,7 @@ int rt2x00queue_map_txskb(struct queue_e + return -ENOMEM; + + skbdesc->flags |= SKBDESC_DMA_MAPPED_TX; ++ rt2x00lib_dmadone(entry); + return 0; + } + EXPORT_SYMBOL_GPL(rt2x00queue_map_txskb); diff --git a/package/kernel/mac80211/patches/rt2x00/004-rt2x00-do-not-check-for-txstatus-timeout-every-time-.patch b/package/kernel/mac80211/patches/rt2x00/004-rt2x00-do-not-check-for-txstatus-timeout-every-time-.patch new file mode 100644 index 00000000000000..3e76379fa4e566 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/004-rt2x00-do-not-check-for-txstatus-timeout-every-time-.patch @@ -0,0 +1,72 @@ +From 5022efb50f625d11fdf18b1fee0f64ebb1863664 Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Wed, 26 Sep 2018 12:24:55 +0200 +Subject: [PATCH 04/28] rt2x00: do not check for txstatus timeout every time on + tasklet + +Do not check for tx status timeout everytime we perform txstatus tasklet. +Perform check once per half a second. + +Signed-off-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 7 +++++++ + drivers/net/wireless/ralink/rt2x00/rt2800mmio.c | 3 ++- + drivers/net/wireless/ralink/rt2x00/rt2x00.h | 2 ++ + drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | 1 + + 4 files changed, 12 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -1158,11 +1158,18 @@ bool rt2800_txstatus_timeout(struct rt2x + struct data_queue *queue; + struct queue_entry *entry; + ++ if (time_before(jiffies, ++ rt2x00dev->last_nostatus_check + msecs_to_jiffies(500))) ++ return false; ++ ++ rt2x00dev->last_nostatus_check = jiffies; ++ + tx_queue_for_each(rt2x00dev, queue) { + entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); + if (rt2800_entry_txstatus_timeout(entry)) + return true; + } ++ + return false; + } + EXPORT_SYMBOL_GPL(rt2800_txstatus_timeout); +--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c +@@ -197,7 +197,8 @@ void rt2800mmio_txstatus_tasklet(unsigne + + rt2800_txdone(rt2x00dev); + +- rt2800_txdone_nostatus(rt2x00dev); ++ if (rt2800_txstatus_timeout(rt2x00dev)) ++ rt2800_txdone_nostatus(rt2x00dev); + + if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) + rt2800mmio_enable_interrupt(rt2x00dev, +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -979,6 +979,8 @@ struct rt2x00_dev { + */ + DECLARE_KFIFO_PTR(txstatus_fifo, u32); + ++ unsigned long last_nostatus_check; ++ + /* + * Timer to ensure tx status reports are read (rt2800usb). + */ +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c +@@ -1042,6 +1042,7 @@ void rt2x00queue_start_queues(struct rt2 + */ + tx_queue_for_each(rt2x00dev, queue) + rt2x00queue_start_queue(queue); ++ rt2x00dev->last_nostatus_check = jiffies; + + rt2x00queue_start_queue(rt2x00dev->rx); + } diff --git a/package/kernel/mac80211/patches/rt2x00/005-rt2x00-use-different-txstatus-timeouts-when-flushing.patch b/package/kernel/mac80211/patches/rt2x00/005-rt2x00-use-different-txstatus-timeouts-when-flushing.patch new file mode 100644 index 00000000000000..f2839941af5ea0 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/005-rt2x00-use-different-txstatus-timeouts-when-flushing.patch @@ -0,0 +1,112 @@ +From adf26a356f132e35093585521ea3e36cd185af83 Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Wed, 26 Sep 2018 12:24:56 +0200 +Subject: [PATCH 05/28] rt2x00: use different txstatus timeouts when flushing + +Use different tx status timeouts for normal operation and when flushing. +This increase timeout to 2s for normal operation as when there are bad +radio conditions and frames are reposted many times device can not provide +the status for quite long. With new timeout we can still get valid status +on such bad conditions. + +Signed-off-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + .../net/wireless/ralink/rt2x00/rt2800lib.c | 31 +++++++++++++------ + drivers/net/wireless/ralink/rt2x00/rt2x00.h | 1 + + .../net/wireless/ralink/rt2x00/rt2x00mac.c | 4 +++ + 3 files changed, 26 insertions(+), 10 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -1137,36 +1137,47 @@ void rt2800_txdone(struct rt2x00_dev *rt + } + EXPORT_SYMBOL_GPL(rt2800_txdone); + +-static inline bool rt2800_entry_txstatus_timeout(struct queue_entry *entry) ++static inline bool rt2800_entry_txstatus_timeout(struct rt2x00_dev *rt2x00dev, ++ struct queue_entry *entry) + { +- bool tout; ++ bool ret; ++ unsigned long tout; + + if (!test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) + return false; + +- tout = time_after(jiffies, entry->last_action + msecs_to_jiffies(500)); +- if (unlikely(tout)) ++ if (test_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags)) ++ tout = msecs_to_jiffies(100); ++ else ++ tout = msecs_to_jiffies(2000); ++ ++ ret = time_after(jiffies, entry->last_action + tout); ++ if (unlikely(ret)) + rt2x00_dbg(entry->queue->rt2x00dev, + "TX status timeout for entry %d in queue %d\n", + entry->entry_idx, entry->queue->qid); +- return tout; +- ++ return ret; + } + + bool rt2800_txstatus_timeout(struct rt2x00_dev *rt2x00dev) + { + struct data_queue *queue; + struct queue_entry *entry; ++ unsigned long tout; ++ ++ if (test_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags)) ++ tout = msecs_to_jiffies(50); ++ else ++ tout = msecs_to_jiffies(1000); + +- if (time_before(jiffies, +- rt2x00dev->last_nostatus_check + msecs_to_jiffies(500))) ++ if (time_before(jiffies, rt2x00dev->last_nostatus_check + tout)) + return false; + + rt2x00dev->last_nostatus_check = jiffies; + + tx_queue_for_each(rt2x00dev, queue) { + entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); +- if (rt2800_entry_txstatus_timeout(entry)) ++ if (rt2800_entry_txstatus_timeout(rt2x00dev, entry)) + return true; + } + +@@ -1195,7 +1206,7 @@ void rt2800_txdone_nostatus(struct rt2x0 + break; + + if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags) || +- rt2800_entry_txstatus_timeout(entry)) ++ rt2800_entry_txstatus_timeout(rt2x00dev, entry)) + rt2x00lib_txdone_noinfo(entry, TXDONE_FAILURE); + else + break; +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -665,6 +665,7 @@ enum rt2x00_state_flags { + DEVICE_STATE_STARTED, + DEVICE_STATE_ENABLED_RADIO, + DEVICE_STATE_SCANNING, ++ DEVICE_STATE_FLUSHING, + + /* + * Driver configuration +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c +@@ -710,8 +710,12 @@ void rt2x00mac_flush(struct ieee80211_hw + if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) + return; + ++ set_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags); ++ + tx_queue_for_each(rt2x00dev, queue) + rt2x00queue_flush_queue(queue, drop); ++ ++ clear_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags); + } + EXPORT_SYMBOL_GPL(rt2x00mac_flush); + diff --git a/package/kernel/mac80211/patches/rt2x00/006-rt2800-flush-and-txstatus-rework-for-rt2800mmio.patch b/package/kernel/mac80211/patches/rt2x00/006-rt2800-flush-and-txstatus-rework-for-rt2800mmio.patch new file mode 100644 index 00000000000000..784fbb16f1f270 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/006-rt2800-flush-and-txstatus-rework-for-rt2800mmio.patch @@ -0,0 +1,238 @@ +From 0240564430c0697d8fde3743d70346a922466b36 Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Wed, 26 Sep 2018 12:24:57 +0200 +Subject: [PATCH 06/28] rt2800: flush and txstatus rework for rt2800mmio + +Implement custom rt2800mmio flush routine and change txstatus +routine to read TX_STA_FIFO also in the tasklet. + +Signed-off-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + .../net/wireless/ralink/rt2x00/rt2800lib.c | 14 +-- + .../net/wireless/ralink/rt2x00/rt2800mmio.c | 118 +++++++++++++----- + .../net/wireless/ralink/rt2x00/rt2800mmio.h | 1 + + .../net/wireless/ralink/rt2x00/rt2800pci.c | 2 +- + 4 files changed, 97 insertions(+), 38 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -1147,7 +1147,7 @@ static inline bool rt2800_entry_txstatus + return false; + + if (test_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags)) +- tout = msecs_to_jiffies(100); ++ tout = msecs_to_jiffies(50); + else + tout = msecs_to_jiffies(2000); + +@@ -1163,15 +1163,13 @@ bool rt2800_txstatus_timeout(struct rt2x + { + struct data_queue *queue; + struct queue_entry *entry; +- unsigned long tout; + +- if (test_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags)) +- tout = msecs_to_jiffies(50); +- else +- tout = msecs_to_jiffies(1000); ++ if (!test_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags)) { ++ unsigned long tout = msecs_to_jiffies(1000); + +- if (time_before(jiffies, rt2x00dev->last_nostatus_check + tout)) +- return false; ++ if (time_before(jiffies, rt2x00dev->last_nostatus_check + tout)) ++ return false; ++ } + + rt2x00dev->last_nostatus_check = jiffies; + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c +@@ -191,21 +191,6 @@ static inline void rt2800mmio_enable_int + spin_unlock_irq(&rt2x00dev->irqmask_lock); + } + +-void rt2800mmio_txstatus_tasklet(unsigned long data) +-{ +- struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; +- +- rt2800_txdone(rt2x00dev); +- +- if (rt2800_txstatus_timeout(rt2x00dev)) +- rt2800_txdone_nostatus(rt2x00dev); +- +- if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) +- rt2800mmio_enable_interrupt(rt2x00dev, +- INT_SOURCE_CSR_TX_FIFO_STATUS); +-} +-EXPORT_SYMBOL_GPL(rt2800mmio_txstatus_tasklet); +- + void rt2800mmio_pretbtt_tasklet(unsigned long data) + { + struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; +@@ -270,12 +255,26 @@ void rt2800mmio_autowake_tasklet(unsigne + } + EXPORT_SYMBOL_GPL(rt2800mmio_autowake_tasklet); + +-static void rt2800mmio_txstatus_interrupt(struct rt2x00_dev *rt2x00dev) ++static void rt2800mmio_txdone(struct rt2x00_dev *rt2x00dev) ++{ ++ bool timeout = false; ++ ++ while (!kfifo_is_empty(&rt2x00dev->txstatus_fifo) || ++ (timeout = rt2800_txstatus_timeout(rt2x00dev))) { ++ ++ rt2800_txdone(rt2x00dev); ++ ++ if (timeout) ++ rt2800_txdone_nostatus(rt2x00dev); ++ } ++} ++ ++static bool rt2800mmio_fetch_txstatus(struct rt2x00_dev *rt2x00dev) + { + u32 status; +- int i; ++ bool more = false; + +- /* ++ /* FIXEME: rewrite this comment + * The TX_FIFO_STATUS interrupt needs special care. We should + * read TX_STA_FIFO but we should do it immediately as otherwise + * the register can overflow and we would lose status reports. +@@ -286,25 +285,37 @@ static void rt2800mmio_txstatus_interrup + * because we can schedule the tasklet multiple times (when the + * interrupt fires again during tx status processing). + * +- * Since we have only one producer and one consumer we don't ++ * txstatus tasklet is called with INT_SOURCE_CSR_TX_FIFO_STATUS ++ * disabled so have only one producer and one consumer - we don't + * need to lock the kfifo. + */ +- for (i = 0; i < rt2x00dev->tx->limit; i++) { ++ while (!kfifo_is_full(&rt2x00dev->txstatus_fifo)) { + status = rt2x00mmio_register_read(rt2x00dev, TX_STA_FIFO); +- + if (!rt2x00_get_field32(status, TX_STA_FIFO_VALID)) + break; + +- if (!kfifo_put(&rt2x00dev->txstatus_fifo, status)) { +- rt2x00_warn(rt2x00dev, "TX status FIFO overrun, drop tx status report\n"); +- break; +- } ++ kfifo_put(&rt2x00dev->txstatus_fifo, status); ++ more = true; + } + +- /* Schedule the tasklet for processing the tx status. */ +- tasklet_schedule(&rt2x00dev->txstatus_tasklet); ++ return more; + } + ++void rt2800mmio_txstatus_tasklet(unsigned long data) ++{ ++ struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; ++ ++ do { ++ rt2800mmio_txdone(rt2x00dev); ++ ++ } while (rt2800mmio_fetch_txstatus(rt2x00dev)); ++ ++ if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) ++ rt2800mmio_enable_interrupt(rt2x00dev, ++ INT_SOURCE_CSR_TX_FIFO_STATUS); ++} ++EXPORT_SYMBOL_GPL(rt2800mmio_txstatus_tasklet); ++ + irqreturn_t rt2800mmio_interrupt(int irq, void *dev_instance) + { + struct rt2x00_dev *rt2x00dev = dev_instance; +@@ -327,8 +338,10 @@ irqreturn_t rt2800mmio_interrupt(int irq + */ + mask = ~reg; + +- if (rt2x00_get_field32(reg, INT_SOURCE_CSR_TX_FIFO_STATUS)) +- rt2800mmio_txstatus_interrupt(rt2x00dev); ++ if (rt2x00_get_field32(reg, INT_SOURCE_CSR_TX_FIFO_STATUS)) { ++ rt2800mmio_fetch_txstatus(rt2x00dev); ++ tasklet_schedule(&rt2x00dev->txstatus_tasklet); ++ } + + if (rt2x00_get_field32(reg, INT_SOURCE_CSR_PRE_TBTT)) + tasklet_hi_schedule(&rt2x00dev->pretbtt_tasklet); +@@ -453,6 +466,53 @@ void rt2800mmio_kick_queue(struct data_q + } + EXPORT_SYMBOL_GPL(rt2800mmio_kick_queue); + ++void rt2800mmio_flush_queue(struct data_queue *queue, bool drop) ++{ ++ struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; ++ bool tx_queue = false; ++ unsigned int i; ++ ++ switch (queue->qid) { ++ case QID_AC_VO: ++ case QID_AC_VI: ++ case QID_AC_BE: ++ case QID_AC_BK: ++ tx_queue = true; ++ break; ++ case QID_RX: ++ break; ++ default: ++ return; ++ } ++ ++ for (i = 0; i < 5; i++) { ++ /* ++ * Check if the driver is already done, otherwise we ++ * have to sleep a little while to give the driver/hw ++ * the oppurtunity to complete interrupt process itself. ++ */ ++ if (rt2x00queue_empty(queue)) ++ break; ++ ++ /* ++ * For TX queues schedule completion tasklet to catch ++ * tx status timeouts, othewise just wait. ++ */ ++ if (tx_queue) { ++ tasklet_disable(&rt2x00dev->txstatus_tasklet); ++ rt2800mmio_txdone(rt2x00dev); ++ tasklet_enable(&rt2x00dev->txstatus_tasklet); ++ } ++ ++ /* ++ * Wait for a little while to give the driver ++ * the oppurtunity to recover itself. ++ */ ++ msleep(50); ++ } ++} ++EXPORT_SYMBOL_GPL(rt2800mmio_flush_queue); ++ + void rt2800mmio_stop_queue(struct data_queue *queue) + { + struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; +--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.h +@@ -148,6 +148,7 @@ void rt2800mmio_toggle_irq(struct rt2x00 + /* Queue handlers */ + void rt2800mmio_start_queue(struct data_queue *queue); + void rt2800mmio_kick_queue(struct data_queue *queue); ++void rt2800mmio_flush_queue(struct data_queue *queue, bool drop); + void rt2800mmio_stop_queue(struct data_queue *queue); + void rt2800mmio_queue_init(struct data_queue *queue); + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800pci.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800pci.c +@@ -364,7 +364,7 @@ static const struct rt2x00lib_ops rt2800 + .start_queue = rt2800mmio_start_queue, + .kick_queue = rt2800mmio_kick_queue, + .stop_queue = rt2800mmio_stop_queue, +- .flush_queue = rt2x00mmio_flush_queue, ++ .flush_queue = rt2800mmio_flush_queue, + .write_tx_desc = rt2800mmio_write_tx_desc, + .write_tx_data = rt2800_write_tx_data, + .write_beacon = rt2800_write_beacon, diff --git a/package/kernel/mac80211/patches/rt2x00/007-rt2x00-rt2400pci-mark-expected-switch-fall-through.patch b/package/kernel/mac80211/patches/rt2x00/007-rt2x00-rt2400pci-mark-expected-switch-fall-through.patch new file mode 100644 index 00000000000000..2161ad9ef3f059 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/007-rt2x00-rt2400pci-mark-expected-switch-fall-through.patch @@ -0,0 +1,25 @@ +From 6eba8fd2235237784dfd01da55c3210d493aebdb Mon Sep 17 00:00:00 2001 +From: "Gustavo A. R. Silva" +Date: Mon, 22 Oct 2018 22:44:34 +0200 +Subject: [PATCH 07/28] rt2x00: rt2400pci: mark expected switch fall-through + +In preparation to enabling -Wimplicit-fallthrough, mark switch cases +where we are expecting to fall through. + +Signed-off-by: Gustavo A. R. Silva +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt2400pci.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c +@@ -1302,7 +1302,7 @@ static void rt2400pci_txdone(struct rt2x + break; + case 2: /* Failure, excessive retries */ + __set_bit(TXDONE_EXCESSIVE_RETRY, &txdesc.flags); +- /* Don't break, this is a failed frame! */ ++ /* Fall through - this is a failed frame! */ + default: /* Failure */ + __set_bit(TXDONE_FAILURE, &txdesc.flags); + } diff --git a/package/kernel/mac80211/patches/rt2x00/008-rt2x00-rt2500pci-mark-expected-switch-fall-through.patch b/package/kernel/mac80211/patches/rt2x00/008-rt2x00-rt2500pci-mark-expected-switch-fall-through.patch new file mode 100644 index 00000000000000..d10de6b0e505a9 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/008-rt2x00-rt2500pci-mark-expected-switch-fall-through.patch @@ -0,0 +1,25 @@ +From 10bb92217747c3384a01ebec005faa2f5e72bbd8 Mon Sep 17 00:00:00 2001 +From: "Gustavo A. R. Silva" +Date: Mon, 22 Oct 2018 22:45:19 +0200 +Subject: [PATCH 08/28] rt2x00: rt2500pci: mark expected switch fall-through + +In preparation to enabling -Wimplicit-fallthrough, mark switch cases +where we are expecting to fall through. + +Signed-off-by: Gustavo A. R. Silva +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt2500pci.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c +@@ -1430,7 +1430,7 @@ static void rt2500pci_txdone(struct rt2x + break; + case 2: /* Failure, excessive retries */ + __set_bit(TXDONE_EXCESSIVE_RETRY, &txdesc.flags); +- /* Don't break, this is a failed frame! */ ++ /* Fall through - this is a failed frame! */ + default: /* Failure */ + __set_bit(TXDONE_FAILURE, &txdesc.flags); + } diff --git a/package/kernel/mac80211/patches/rt2x00/009-rt2x00-rt2800lib-mark-expected-switch-fall-throughs.patch b/package/kernel/mac80211/patches/rt2x00/009-rt2x00-rt2800lib-mark-expected-switch-fall-throughs.patch new file mode 100644 index 00000000000000..99f971b95fdbc6 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/009-rt2x00-rt2800lib-mark-expected-switch-fall-throughs.patch @@ -0,0 +1,44 @@ +From 916e6bbcfcff6cc5d7d33bba8557a30f3af50326 Mon Sep 17 00:00:00 2001 +From: "Gustavo A. R. Silva" +Date: Mon, 22 Oct 2018 22:46:03 +0200 +Subject: [PATCH 09/28] rt2x00: rt2800lib: mark expected switch fall-throughs + +In preparation to enabling -Wimplicit-fallthrough, mark switch cases +where we are expecting to fall through. + +Addresses-Coverity-ID: 145198 ("Missing break in switch") +Signed-off-by: Gustavo A. R. Silva +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -2482,6 +2482,7 @@ static void rt2800_config_channel_rf3052 + switch (rt2x00dev->default_ant.tx_chain_num) { + case 1: + rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 1); ++ /* fall through */ + case 2: + rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 1); + break; +@@ -2490,6 +2491,7 @@ static void rt2800_config_channel_rf3052 + switch (rt2x00dev->default_ant.rx_chain_num) { + case 1: + rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 1); ++ /* fall through */ + case 2: + rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 1); + break; +@@ -9457,8 +9459,10 @@ static int rt2800_probe_hw_mode(struct r + switch (rx_chains) { + case 3: + spec->ht.mcs.rx_mask[2] = 0xff; ++ /* fall through */ + case 2: + spec->ht.mcs.rx_mask[1] = 0xff; ++ /* fall through */ + case 1: + spec->ht.mcs.rx_mask[0] = 0xff; + spec->ht.mcs.rx_mask[4] = 0x1; /* MCS32 */ diff --git a/package/kernel/mac80211/patches/rt2x00/010-rt2x00-rt61pci-mark-expected-switch-fall-through.patch b/package/kernel/mac80211/patches/rt2x00/010-rt2x00-rt61pci-mark-expected-switch-fall-through.patch new file mode 100644 index 00000000000000..5b0f96d2931414 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/010-rt2x00-rt61pci-mark-expected-switch-fall-through.patch @@ -0,0 +1,25 @@ +From 641dd8068ecb078e7d12efe465df202bc16ca5eb Mon Sep 17 00:00:00 2001 +From: "Gustavo A. R. Silva" +Date: Mon, 22 Oct 2018 22:46:47 +0200 +Subject: [PATCH 10/28] rt2x00: rt61pci: mark expected switch fall-through + +In preparation to enabling -Wimplicit-fallthrough, mark switch cases +where we are expecting to fall through. + +Signed-off-by: Gustavo A. R. Silva +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt61pci.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c +@@ -2226,7 +2226,7 @@ static void rt61pci_txdone(struct rt2x00 + break; + case 6: /* Failure, excessive retries */ + __set_bit(TXDONE_EXCESSIVE_RETRY, &txdesc.flags); +- /* Don't break, this is a failed frame! */ ++ /* Fall through - this is a failed frame! */ + default: /* Failure */ + __set_bit(TXDONE_FAILURE, &txdesc.flags); + } diff --git a/package/kernel/mac80211/patches/rt2x00/011-cross-tree-phase-out-dma_zalloc_coherent.patch b/package/kernel/mac80211/patches/rt2x00/011-cross-tree-phase-out-dma_zalloc_coherent.patch new file mode 100644 index 00000000000000..8100eb063b4c97 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/011-cross-tree-phase-out-dma_zalloc_coherent.patch @@ -0,0 +1,40 @@ +From 750afb08ca71310fcf0c4e2cb1565c63b8235b60 Mon Sep 17 00:00:00 2001 +From: Luis Chamberlain +Date: Fri, 4 Jan 2019 09:23:09 +0100 +Subject: [PATCH 11/28] cross-tree: phase out dma_zalloc_coherent() + +We already need to zero out memory for dma_alloc_coherent(), as such +using dma_zalloc_coherent() is superflous. Phase it out. + +This change was generated with the following Coccinelle SmPL patch: + +@ replace_dma_zalloc_coherent @ +expression dev, size, data, handle, flags; +@@ + +-dma_zalloc_coherent(dev, size, handle, flags) ++dma_alloc_coherent(dev, size, handle, flags) + +Suggested-by: Christoph Hellwig +Signed-off-by: Luis Chamberlain +[hch: re-ran the script on the latest tree] +Signed-off-by: Christoph Hellwig +--- + drivers/net/wireless/ralink/rt2x00/rt2x00mmio.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00mmio.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mmio.c +@@ -119,9 +119,9 @@ static int rt2x00mmio_alloc_queue_dma(st + /* + * Allocate DMA memory for descriptor and buffer. + */ +- addr = dma_zalloc_coherent(rt2x00dev->dev, +- queue->limit * queue->desc_size, &dma, +- GFP_KERNEL); ++ addr = dma_alloc_coherent(rt2x00dev->dev, ++ queue->limit * queue->desc_size, &dma, ++ GFP_KERNEL); + if (!addr) + return -ENOMEM; + diff --git a/package/kernel/mac80211/patches/rt2x00/012-rt2x00-reduce-tx-power-to-nominal-level-on-RT6352.patch b/package/kernel/mac80211/patches/rt2x00/012-rt2x00-reduce-tx-power-to-nominal-level-on-RT6352.patch new file mode 100644 index 00000000000000..a07832e97cf531 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/012-rt2x00-reduce-tx-power-to-nominal-level-on-RT6352.patch @@ -0,0 +1,32 @@ +From c2e28ef7711ffcb083474ee5f154264c6ec1ec07 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tomislav=20Po=C5=BEega?= +Date: Thu, 27 Dec 2018 15:05:25 +0100 +Subject: [PATCH 12/28] rt2x00: reduce tx power to nominal level on RT6352 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Current implementation of RT6352 support provides too high tx power +at least on iPA/eLNA devices. Reduce amplification of variable gain +amplifier by 6dB to match board target power of 17dBm. +Transmited signal strength with this patch is similar to that of +stock firmware or pandorabox firmware. Throughput measured with iperf +improves. Device tested: Xiaomi Miwifi Mini. + +Signed-off-by: Tomislav Požega +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -5477,7 +5477,7 @@ static int rt2800_init_registers(struct + rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); + rt2800_register_write(rt2x00dev, MIMO_PS_CFG, 0x00000002); + rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x00150F0F); +- rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x06060606); ++ rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x00000000); + rt2800_register_write(rt2x00dev, TX0_BB_GAIN_ATTEN, 0x0); + rt2800_register_write(rt2x00dev, TX1_BB_GAIN_ATTEN, 0x0); + rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, 0x6C6C666C); diff --git a/package/kernel/mac80211/patches/rt2x00/013-rt2x00-Work-around-a-firmware-bug-with-shared-keys.patch b/package/kernel/mac80211/patches/rt2x00/013-rt2x00-Work-around-a-firmware-bug-with-shared-keys.patch new file mode 100644 index 00000000000000..dc884c17d2f46b --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/013-rt2x00-Work-around-a-firmware-bug-with-shared-keys.patch @@ -0,0 +1,143 @@ +From a4296994eb8061ee3455721a296c387c639bf635 Mon Sep 17 00:00:00 2001 +From: Bernd Edlinger +Date: Tue, 15 Jan 2019 14:01:29 +0000 +Subject: [PATCH 13/28] rt2x00: Work around a firmware bug with shared keys + +Apparently the rt2x61 firmware fails temporarily to decode +broadcast packets if the shared keys are not assigned +in the "correct" sequence. At the same time unicast +packets work fine, since they are encrypted with the +pairwise key. + +At least with WPA2 CCMP mode the shared keys are +set in the following sequence: keyidx=1, 2, 1, 2. +After a while only keyidx 2 gets decrypted, and +keyidx 1 is ignored, probably because there is never +a keyidx 3. + +Symptoms are arping -b works for 10 minutes, since +keyidx=2 is used for broadcast, and then it stops +working for 10 minutes, because keyidx=1 is used. +That failure mode repeats forever. + +Note, the firmware does not even know which keyidx +corresponds to which hw_key_idx so the firmware is +trying to be smarter than the driver, which is bound +to fail. + +As workaround the function rt61pci_config_shared_key +requests software decryption of the shared keys, +by returning EOPNOTSUPP. However, pairwise keys are +still handled by hardware which works just fine. + +Signed-off-by: Bernd Edlinger +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt61pci.c | 93 +------------------- + 1 file changed, 4 insertions(+), 89 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c +@@ -321,97 +321,12 @@ static int rt61pci_config_shared_key(str + struct rt2x00lib_crypto *crypto, + struct ieee80211_key_conf *key) + { +- struct hw_key_entry key_entry; +- struct rt2x00_field32 field; +- u32 mask; +- u32 reg; +- +- if (crypto->cmd == SET_KEY) { +- /* +- * rt2x00lib can't determine the correct free +- * key_idx for shared keys. We have 1 register +- * with key valid bits. The goal is simple, read +- * the register, if that is full we have no slots +- * left. +- * Note that each BSS is allowed to have up to 4 +- * shared keys, so put a mask over the allowed +- * entries. +- */ +- mask = (0xf << crypto->bssidx); +- +- reg = rt2x00mmio_register_read(rt2x00dev, SEC_CSR0); +- reg &= mask; +- +- if (reg && reg == mask) +- return -ENOSPC; +- +- key->hw_key_idx += reg ? ffz(reg) : 0; +- +- /* +- * Upload key to hardware +- */ +- memcpy(key_entry.key, crypto->key, +- sizeof(key_entry.key)); +- memcpy(key_entry.tx_mic, crypto->tx_mic, +- sizeof(key_entry.tx_mic)); +- memcpy(key_entry.rx_mic, crypto->rx_mic, +- sizeof(key_entry.rx_mic)); +- +- reg = SHARED_KEY_ENTRY(key->hw_key_idx); +- rt2x00mmio_register_multiwrite(rt2x00dev, reg, +- &key_entry, sizeof(key_entry)); +- +- /* +- * The cipher types are stored over 2 registers. +- * bssidx 0 and 1 keys are stored in SEC_CSR1 and +- * bssidx 1 and 2 keys are stored in SEC_CSR5. +- * Using the correct defines correctly will cause overhead, +- * so just calculate the correct offset. +- */ +- if (key->hw_key_idx < 8) { +- field.bit_offset = (3 * key->hw_key_idx); +- field.bit_mask = 0x7 << field.bit_offset; +- +- reg = rt2x00mmio_register_read(rt2x00dev, SEC_CSR1); +- rt2x00_set_field32(®, field, crypto->cipher); +- rt2x00mmio_register_write(rt2x00dev, SEC_CSR1, reg); +- } else { +- field.bit_offset = (3 * (key->hw_key_idx - 8)); +- field.bit_mask = 0x7 << field.bit_offset; +- +- reg = rt2x00mmio_register_read(rt2x00dev, SEC_CSR5); +- rt2x00_set_field32(®, field, crypto->cipher); +- rt2x00mmio_register_write(rt2x00dev, SEC_CSR5, reg); +- } +- +- /* +- * The driver does not support the IV/EIV generation +- * in hardware. However it doesn't support the IV/EIV +- * inside the ieee80211 frame either, but requires it +- * to be provided separately for the descriptor. +- * rt2x00lib will cut the IV/EIV data out of all frames +- * given to us by mac80211, but we must tell mac80211 +- * to generate the IV/EIV data. +- */ +- key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; +- } +- + /* +- * SEC_CSR0 contains only single-bit fields to indicate +- * a particular key is valid. Because using the FIELD32() +- * defines directly will cause a lot of overhead, we use +- * a calculation to determine the correct bit directly. ++ * Let the software handle the shared keys, ++ * since the hardware decryption does not work reliably, ++ * because the firmware does not know the key's keyidx. + */ +- mask = 1 << key->hw_key_idx; +- +- reg = rt2x00mmio_register_read(rt2x00dev, SEC_CSR0); +- if (crypto->cmd == SET_KEY) +- reg |= mask; +- else if (crypto->cmd == DISABLE_KEY) +- reg &= ~mask; +- rt2x00mmio_register_write(rt2x00dev, SEC_CSR0, reg); +- +- return 0; ++ return -EOPNOTSUPP; + } + + static int rt61pci_config_pairwise_key(struct rt2x00_dev *rt2x00dev, diff --git a/package/kernel/mac80211/patches/rt2x00/014-rt2x00-no-need-to-check-return-value-of-debugfs_crea.patch b/package/kernel/mac80211/patches/rt2x00/014-rt2x00-no-need-to-check-return-value-of-debugfs_crea.patch new file mode 100644 index 00000000000000..26f2df10e05bf8 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/014-rt2x00-no-need-to-check-return-value-of-debugfs_crea.patch @@ -0,0 +1,107 @@ +From 2587791d57588562c21e5ef7e678f02ab2f3eb82 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Tue, 22 Jan 2019 16:21:34 +0100 +Subject: [PATCH 14/28] rt2x00: no need to check return value of debugfs_create + functions + +When calling debugfs functions, there is no need to ever check the +return value. The function can work or not, but the code logic should +never do something different based on this. + +Cc: Stanislaw Gruszka +Cc: Helmut Schaa +Cc: Kalle Valo +Cc: linux-wireless@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + .../net/wireless/ralink/rt2x00/rt2x00debug.c | 27 ------------------- + 1 file changed, 27 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c +@@ -656,36 +656,24 @@ void rt2x00debug_register(struct rt2x00_ + intf->driver_folder = + debugfs_create_dir(intf->rt2x00dev->ops->name, + rt2x00dev->hw->wiphy->debugfsdir); +- if (IS_ERR(intf->driver_folder) || !intf->driver_folder) +- goto exit; + + intf->driver_entry = + rt2x00debug_create_file_driver("driver", intf, &intf->driver_blob); +- if (IS_ERR(intf->driver_entry) || !intf->driver_entry) +- goto exit; + + intf->chipset_entry = + rt2x00debug_create_file_chipset("chipset", + intf, &intf->chipset_blob); +- if (IS_ERR(intf->chipset_entry) || !intf->chipset_entry) +- goto exit; + + intf->dev_flags = debugfs_create_file("dev_flags", 0400, + intf->driver_folder, intf, + &rt2x00debug_fop_dev_flags); +- if (IS_ERR(intf->dev_flags) || !intf->dev_flags) +- goto exit; + + intf->cap_flags = debugfs_create_file("cap_flags", 0400, + intf->driver_folder, intf, + &rt2x00debug_fop_cap_flags); +- if (IS_ERR(intf->cap_flags) || !intf->cap_flags) +- goto exit; + + intf->register_folder = + debugfs_create_dir("register", intf->driver_folder); +- if (IS_ERR(intf->register_folder) || !intf->register_folder) +- goto exit; + + #define RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(__intf, __name) \ + ({ \ +@@ -695,9 +683,6 @@ void rt2x00debug_register(struct rt2x00_ + 0600, \ + (__intf)->register_folder, \ + &(__intf)->offset_##__name); \ +- if (IS_ERR((__intf)->__name##_off_entry) || \ +- !(__intf)->__name##_off_entry) \ +- goto exit; \ + \ + (__intf)->__name##_val_entry = \ + debugfs_create_file(__stringify(__name) "_value", \ +@@ -705,9 +690,6 @@ void rt2x00debug_register(struct rt2x00_ + (__intf)->register_folder, \ + (__intf), \ + &rt2x00debug_fop_##__name); \ +- if (IS_ERR((__intf)->__name##_val_entry) || \ +- !(__intf)->__name##_val_entry) \ +- goto exit; \ + } \ + }) + +@@ -721,15 +703,10 @@ void rt2x00debug_register(struct rt2x00_ + + intf->queue_folder = + debugfs_create_dir("queue", intf->driver_folder); +- if (IS_ERR(intf->queue_folder) || !intf->queue_folder) +- goto exit; + + intf->queue_frame_dump_entry = + debugfs_create_file("dump", 0400, intf->queue_folder, + intf, &rt2x00debug_fop_queue_dump); +- if (IS_ERR(intf->queue_frame_dump_entry) +- || !intf->queue_frame_dump_entry) +- goto exit; + + skb_queue_head_init(&intf->frame_dump_skbqueue); + init_waitqueue_head(&intf->frame_dump_waitqueue); +@@ -747,10 +724,6 @@ void rt2x00debug_register(struct rt2x00_ + #endif + + return; +- +-exit: +- rt2x00debug_deregister(rt2x00dev); +- rt2x00_err(rt2x00dev, "Failed to register debug handler\n"); + } + + void rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev) diff --git a/package/kernel/mac80211/patches/rt2x00/015-rt2x00-remove-unneeded-check.patch b/package/kernel/mac80211/patches/rt2x00/015-rt2x00-remove-unneeded-check.patch new file mode 100644 index 00000000000000..50e7de085575a9 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/015-rt2x00-remove-unneeded-check.patch @@ -0,0 +1,137 @@ +From 17ae2acd1a6f5148edd80d84194e5d7c80be360e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tomislav=20Po=C5=BEega?= +Date: Wed, 13 Feb 2019 11:09:12 +0100 +Subject: [PATCH 15/28] rt2x00: remove unneeded check +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Remove band check from rf53xx channel config routine since all chips +using it are single band. + +Signed-off-by: Tomislav Požega +Signed-off-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + .../net/wireless/ralink/rt2x00/rt2800lib.c | 103 +++++++++--------- + 1 file changed, 50 insertions(+), 53 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -2966,6 +2966,7 @@ static void rt2800_config_channel_rf53xx + struct channel_info *info) + { + u8 rfcsr; ++ int idx = rf->channel-1; + + rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1); + rt2800_rfcsr_write(rt2x00dev, 9, rf->rf3); +@@ -3003,60 +3004,56 @@ static void rt2800_config_channel_rf53xx + + rt2800_freq_cal_mode1(rt2x00dev); + +- if (rf->channel <= 14) { +- int idx = rf->channel-1; ++ if (rt2x00_has_cap_bt_coexist(rt2x00dev)) { ++ if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) { ++ /* r55/r59 value array of channel 1~14 */ ++ static const char r55_bt_rev[] = {0x83, 0x83, ++ 0x83, 0x73, 0x73, 0x63, 0x53, 0x53, ++ 0x53, 0x43, 0x43, 0x43, 0x43, 0x43}; ++ static const char r59_bt_rev[] = {0x0e, 0x0e, ++ 0x0e, 0x0e, 0x0e, 0x0b, 0x0a, 0x09, ++ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07}; ++ ++ rt2800_rfcsr_write(rt2x00dev, 55, ++ r55_bt_rev[idx]); ++ rt2800_rfcsr_write(rt2x00dev, 59, ++ r59_bt_rev[idx]); ++ } else { ++ static const char r59_bt[] = {0x8b, 0x8b, 0x8b, ++ 0x8b, 0x8b, 0x8b, 0x8b, 0x8a, 0x89, ++ 0x88, 0x88, 0x86, 0x85, 0x84}; + +- if (rt2x00_has_cap_bt_coexist(rt2x00dev)) { +- if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) { +- /* r55/r59 value array of channel 1~14 */ +- static const char r55_bt_rev[] = {0x83, 0x83, +- 0x83, 0x73, 0x73, 0x63, 0x53, 0x53, +- 0x53, 0x43, 0x43, 0x43, 0x43, 0x43}; +- static const char r59_bt_rev[] = {0x0e, 0x0e, +- 0x0e, 0x0e, 0x0e, 0x0b, 0x0a, 0x09, +- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07}; +- +- rt2800_rfcsr_write(rt2x00dev, 55, +- r55_bt_rev[idx]); +- rt2800_rfcsr_write(rt2x00dev, 59, +- r59_bt_rev[idx]); +- } else { +- static const char r59_bt[] = {0x8b, 0x8b, 0x8b, +- 0x8b, 0x8b, 0x8b, 0x8b, 0x8a, 0x89, +- 0x88, 0x88, 0x86, 0x85, 0x84}; ++ rt2800_rfcsr_write(rt2x00dev, 59, r59_bt[idx]); ++ } ++ } else { ++ if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) { ++ static const char r55_nonbt_rev[] = {0x23, 0x23, ++ 0x23, 0x23, 0x13, 0x13, 0x03, 0x03, ++ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}; ++ static const char r59_nonbt_rev[] = {0x07, 0x07, ++ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, ++ 0x07, 0x07, 0x06, 0x05, 0x04, 0x04}; ++ ++ rt2800_rfcsr_write(rt2x00dev, 55, ++ r55_nonbt_rev[idx]); ++ rt2800_rfcsr_write(rt2x00dev, 59, ++ r59_nonbt_rev[idx]); ++ } else if (rt2x00_rt(rt2x00dev, RT5390) || ++ rt2x00_rt(rt2x00dev, RT5392) || ++ rt2x00_rt(rt2x00dev, RT6352)) { ++ static const char r59_non_bt[] = {0x8f, 0x8f, ++ 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8d, ++ 0x8a, 0x88, 0x88, 0x87, 0x87, 0x86}; ++ ++ rt2800_rfcsr_write(rt2x00dev, 59, ++ r59_non_bt[idx]); ++ } else if (rt2x00_rt(rt2x00dev, RT5350)) { ++ static const char r59_non_bt[] = {0x0b, 0x0b, ++ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a, ++ 0x0a, 0x09, 0x08, 0x07, 0x07, 0x06}; + +- rt2800_rfcsr_write(rt2x00dev, 59, r59_bt[idx]); +- } +- } else { +- if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) { +- static const char r55_nonbt_rev[] = {0x23, 0x23, +- 0x23, 0x23, 0x13, 0x13, 0x03, 0x03, +- 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}; +- static const char r59_nonbt_rev[] = {0x07, 0x07, +- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, +- 0x07, 0x07, 0x06, 0x05, 0x04, 0x04}; +- +- rt2800_rfcsr_write(rt2x00dev, 55, +- r55_nonbt_rev[idx]); +- rt2800_rfcsr_write(rt2x00dev, 59, +- r59_nonbt_rev[idx]); +- } else if (rt2x00_rt(rt2x00dev, RT5390) || +- rt2x00_rt(rt2x00dev, RT5392) || +- rt2x00_rt(rt2x00dev, RT6352)) { +- static const char r59_non_bt[] = {0x8f, 0x8f, +- 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8d, +- 0x8a, 0x88, 0x88, 0x87, 0x87, 0x86}; +- +- rt2800_rfcsr_write(rt2x00dev, 59, +- r59_non_bt[idx]); +- } else if (rt2x00_rt(rt2x00dev, RT5350)) { +- static const char r59_non_bt[] = {0x0b, 0x0b, +- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a, +- 0x0a, 0x09, 0x08, 0x07, 0x07, 0x06}; +- +- rt2800_rfcsr_write(rt2x00dev, 59, +- r59_non_bt[idx]); +- } ++ rt2800_rfcsr_write(rt2x00dev, 59, ++ r59_non_bt[idx]); + } + } + } diff --git a/package/kernel/mac80211/patches/rt2x00/016-rt2x00-remove-confusing-AGC-register.patch b/package/kernel/mac80211/patches/rt2x00/016-rt2x00-remove-confusing-AGC-register.patch new file mode 100644 index 00000000000000..8f3791d2ce7fcc --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/016-rt2x00-remove-confusing-AGC-register.patch @@ -0,0 +1,34 @@ +From 5991a2ecd070ce5ef646b4e8e0bc8d99110604ed Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tomislav=20Po=C5=BEega?= +Date: Wed, 13 Feb 2019 11:09:13 +0100 +Subject: [PATCH 16/28] rt2x00: remove confusing AGC register +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Register 66 was causing issues on RT6352 if set to the same value as +in MTK driver. With 1c reg value device was working fine in both HT20 +and HT40 modes. + +Signed-off-by: Tomislav Požega +Signed-off-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -3983,11 +3983,7 @@ static void rt2800_config_channel(struct + rt2800_bbp_write(rt2x00dev, 196, reg); + + /* AGC init */ +- if (rt2x00_rt(rt2x00dev, RT6352)) +- reg = 0x04; +- else +- reg = rf->channel <= 14 ? 0x1c : 0x24; +- ++ reg = rf->channel <= 14 ? 0x1c : 0x24; + reg += 2 * rt2x00dev->lna_gain; + rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); + diff --git a/package/kernel/mac80211/patches/rt2x00/017-rt2800-enable-TX_PIN_CFG_LNA_PE_-bits-per-band.patch b/package/kernel/mac80211/patches/rt2x00/017-rt2800-enable-TX_PIN_CFG_LNA_PE_-bits-per-band.patch new file mode 100644 index 00000000000000..eb82d6275b6da0 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/017-rt2800-enable-TX_PIN_CFG_LNA_PE_-bits-per-band.patch @@ -0,0 +1,47 @@ +From 9ad3b55654455258a9463384edb40077439d879f Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Wed, 13 Feb 2019 11:09:14 +0100 +Subject: [PATCH 17/28] rt2800: enable TX_PIN_CFG_LNA_PE_ bits per band + +Do not enable TX_PIN_CFG_LNA_PE_A* bits for 2.4GHz band and +vice versa TX_PIN_CFG_LNA_PE_G* bits for 5GHz. + +Signed-off-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 18 ++++++++++++------ + 1 file changed, 12 insertions(+), 6 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -3893,18 +3893,24 @@ static void rt2800_config_channel(struct + switch (rt2x00dev->default_ant.rx_chain_num) { + case 3: + /* Turn on tertiary LNAs */ +- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A2_EN, 1); +- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G2_EN, 1); ++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A2_EN, ++ rf->channel > 14); ++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G2_EN, ++ rf->channel <= 14); + /* fall-through */ + case 2: + /* Turn on secondary LNAs */ +- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 1); +- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 1); ++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, ++ rf->channel > 14); ++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, ++ rf->channel <= 14); + /* fall-through */ + case 1: + /* Turn on primary LNAs */ +- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1); +- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, 1); ++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, ++ rf->channel > 14); ++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, ++ rf->channel <= 14); + break; + } + diff --git a/package/kernel/mac80211/patches/rt2x00/018-rt2800-enable-TX_PIN_CFG_RFRX_EN-only-for-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/018-rt2800-enable-TX_PIN_CFG_RFRX_EN-only-for-MT7620.patch new file mode 100644 index 00000000000000..3a4c2cd8e52274 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/018-rt2800-enable-TX_PIN_CFG_RFRX_EN-only-for-MT7620.patch @@ -0,0 +1,41 @@ +From 7aca14885edeab536a8cbe1e7cfeadd4c3310b9b Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Wed, 13 Feb 2019 11:09:15 +0100 +Subject: [PATCH 18/28] rt2800: enable TX_PIN_CFG_RFRX_EN only for MT7620 + +The TX_PIN_CFG_RFRX_EN bit was not set on other devices than MT7620, +restore old behavaviour since setting this bit maight not be +correct for older devices. + +Fixes: 41977e86c984 ("rt2x00: add support for MT7620") +Signed-off-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -3858,10 +3858,12 @@ static void rt2800_config_channel(struct + if (rt2x00_rt(rt2x00dev, RT3572)) + rt2800_rfcsr_write(rt2x00dev, 8, 0); + +- if (rt2x00_rt(rt2x00dev, RT6352)) ++ if (rt2x00_rt(rt2x00dev, RT6352)) { + tx_pin = rt2800_register_read(rt2x00dev, TX_PIN_CFG); +- else ++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFRX_EN, 1); ++ } else { + tx_pin = 0; ++ } + + switch (rt2x00dev->default_ant.tx_chain_num) { + case 3: +@@ -3916,7 +3918,6 @@ static void rt2800_config_channel(struct + + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1); + rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1); +- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFRX_EN, 1); /* mt7620 */ + + rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin); + diff --git a/package/kernel/mac80211/patches/rt2x00/019-rt2800-comment-and-simplify-AGC-init-for-RT6352.patch b/package/kernel/mac80211/patches/rt2x00/019-rt2800-comment-and-simplify-AGC-init-for-RT6352.patch new file mode 100644 index 00000000000000..4d0beb263d9034 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/019-rt2800-comment-and-simplify-AGC-init-for-RT6352.patch @@ -0,0 +1,33 @@ +From c7ff1bfeaf1ca69e3e401be211b55d1738d0c5fc Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Wed, 13 Feb 2019 11:09:16 +0100 +Subject: [PATCH 19/28] rt2800: comment and simplify AGC init for RT6352 + +We do not need separate lines for calculating register values. +Also add comment that value is different than in vendor driver. + +Suggested-by: Daniel Golle +Signed-off-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -3989,9 +3989,12 @@ static void rt2800_config_channel(struct + rt2800_bbp_write(rt2x00dev, 195, 141); + rt2800_bbp_write(rt2x00dev, 196, reg); + +- /* AGC init */ +- reg = rf->channel <= 14 ? 0x1c : 0x24; +- reg += 2 * rt2x00dev->lna_gain; ++ /* AGC init. ++ * Despite the vendor driver using different values here for ++ * RT6352 chip, we use 0x1c for now. This may have to be changed ++ * once TSSI got implemented. ++ */ ++ reg = (rf->channel <= 14 ? 0x1c : 0x24) + 2*rt2x00dev->lna_gain; + rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); + + rt2800_iq_calibrate(rt2x00dev, rf->channel); diff --git a/package/kernel/mac80211/patches/rt2x00/020-cfg80211-add-ratelimited-variants-of-err-and-warn.patch b/package/kernel/mac80211/patches/rt2x00/020-cfg80211-add-ratelimited-variants-of-err-and-warn.patch new file mode 100644 index 00000000000000..8411f00cca86ed --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/020-cfg80211-add-ratelimited-variants-of-err-and-warn.patch @@ -0,0 +1,39 @@ +From patchwork Tue Mar 12 09:51:40 2019 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Stanislaw Gruszka +X-Patchwork-Id: 10848957 +X-Patchwork-Delegate: johannes@sipsolutions.net +From: Stanislaw Gruszka +To: linux-wireless@vger.kernel.org +Cc: =?utf-8?q?Tomislav_Po=C5=BEega?= , + Daniel Golle , Felix Fietkau , + Mathias Kresin +Subject: [PATCH v3 1/4] cfg80211: add ratelimited variants of err and warn +Date: Tue, 12 Mar 2019 10:51:40 +0100 +Message-Id: <1552384303-29529-2-git-send-email-sgruszka@redhat.com> +In-Reply-To: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> +References: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> + +wiphy_{err,warn}_ratelimited will be used by rt2x00 + +Signed-off-by: Stanislaw Gruszka +--- + include/net/cfg80211.h | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -6627,6 +6627,11 @@ bool cfg80211_iftype_allowed(struct wiph + #define wiphy_info(wiphy, format, args...) \ + dev_info(&(wiphy)->dev, format, ##args) + ++#define wiphy_err_ratelimited(wiphy, format, args...) \ ++ dev_err_ratelimited(&(wiphy)->dev, format, ##args) ++#define wiphy_warn_ratelimited(wiphy, format, args...) \ ++ dev_warn_ratelimited(&(wiphy)->dev, format, ##args) ++ + #define wiphy_debug(wiphy, format, args...) \ + wiphy_printk(KERN_DEBUG, wiphy, format, ##args) + diff --git a/package/kernel/mac80211/patches/rt2x00/021-rt2x00-use-ratelimited-variants-dev_warn-dev_err.patch b/package/kernel/mac80211/patches/rt2x00/021-rt2x00-use-ratelimited-variants-dev_warn-dev_err.patch new file mode 100644 index 00000000000000..2d74a71e1f31be --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/021-rt2x00-use-ratelimited-variants-dev_warn-dev_err.patch @@ -0,0 +1,42 @@ +From patchwork Tue Mar 12 09:51:41 2019 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Stanislaw Gruszka +X-Patchwork-Id: 10848959 +X-Patchwork-Delegate: kvalo@adurom.com +From: Stanislaw Gruszka +To: linux-wireless@vger.kernel.org +Cc: =?utf-8?q?Tomislav_Po=C5=BEega?= , + Daniel Golle , Felix Fietkau , + Mathias Kresin +Subject: [PATCH v3 2/4] rt2x00: use ratelimited variants dev_warn/dev_err +Date: Tue, 12 Mar 2019 10:51:41 +0100 +Message-Id: <1552384303-29529-3-git-send-email-sgruszka@redhat.com> +In-Reply-To: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> +References: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> + +As reported by Randy we can overwhelm logs on some USB error conditions. +To avoid that use dev_warn_ratelimited() and dev_err_ratelimitd(). + +Reported-and-tested-by: Randy Oostdyk +Signed-off-by: Stanislaw Gruszka +--- + drivers/net/wireless/ralink/rt2x00/rt2x00.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -69,10 +69,10 @@ + printk(KERN_ERR KBUILD_MODNAME ": %s: Error - " fmt, \ + __func__, ##__VA_ARGS__) + #define rt2x00_err(dev, fmt, ...) \ +- wiphy_err((dev)->hw->wiphy, "%s: Error - " fmt, \ ++ wiphy_err_ratelimited((dev)->hw->wiphy, "%s: Error - " fmt, \ + __func__, ##__VA_ARGS__) + #define rt2x00_warn(dev, fmt, ...) \ +- wiphy_warn((dev)->hw->wiphy, "%s: Warning - " fmt, \ ++ wiphy_warn_ratelimited((dev)->hw->wiphy, "%s: Warning - " fmt, \ + __func__, ##__VA_ARGS__) + #define rt2x00_info(dev, fmt, ...) \ + wiphy_info((dev)->hw->wiphy, "%s: Info - " fmt, \ diff --git a/package/kernel/mac80211/patches/rt2x00/022-rt2x00-check-number-of-EPROTO-errors.patch b/package/kernel/mac80211/patches/rt2x00/022-rt2x00-check-number-of-EPROTO-errors.patch new file mode 100644 index 00000000000000..c1754694bd9733 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/022-rt2x00-check-number-of-EPROTO-errors.patch @@ -0,0 +1,96 @@ +From patchwork Tue Mar 12 09:51:42 2019 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Stanislaw Gruszka +X-Patchwork-Id: 10848961 +X-Patchwork-Delegate: kvalo@adurom.com +From: Stanislaw Gruszka +To: linux-wireless@vger.kernel.org +Cc: =?utf-8?q?Tomislav_Po=C5=BEega?= , + Daniel Golle , Felix Fietkau , + Mathias Kresin +Subject: [PATCH v3 3/4] rt2x00: check number of EPROTO errors +Date: Tue, 12 Mar 2019 10:51:42 +0100 +Message-Id: <1552384303-29529-4-git-send-email-sgruszka@redhat.com> +In-Reply-To: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> +References: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> + +Some USB host devices/drivers on some conditions can always return +EPROTO error on submitted URBs. That can cause infinity loop in the +rt2x00 driver. + +Since we can have single EPROTO errors we can not mark as device as +removed to avoid infinity loop. However we can count consecutive +EPROTO errors and mark device as removed if get lot of it. +I choose number 10 as threshold. + +Reported-and-tested-by: Randy Oostdyk +Signed-off-by: Stanislaw Gruszka +--- + drivers/net/wireless/ralink/rt2x00/rt2x00.h | 1 + + drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | 22 +++++++++++++++++++--- + 2 files changed, 20 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -1016,6 +1016,7 @@ struct rt2x00_dev { + unsigned int extra_tx_headroom; + + struct usb_anchor *anchor; ++ unsigned int num_proto_errs; + + /* Clock for System On Chip devices. */ + struct clk *clk; +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c +@@ -31,6 +31,22 @@ + #include "rt2x00.h" + #include "rt2x00usb.h" + ++static bool rt2x00usb_check_usb_error(struct rt2x00_dev *rt2x00dev, int status) ++{ ++ if (status == -ENODEV || status == -ENOENT) ++ return true; ++ ++ if (status == -EPROTO || status == -ETIMEDOUT) ++ rt2x00dev->num_proto_errs++; ++ else ++ rt2x00dev->num_proto_errs = 0; ++ ++ if (rt2x00dev->num_proto_errs > 3) ++ return true; ++ ++ return false; ++} ++ + /* + * Interfacing with the HW. + */ +@@ -57,7 +73,7 @@ int rt2x00usb_vendor_request(struct rt2x + if (status >= 0) + return 0; + +- if (status == -ENODEV || status == -ENOENT) { ++ if (rt2x00usb_check_usb_error(rt2x00dev, status)) { + /* Device has disappeared. */ + clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); + break; +@@ -321,7 +337,7 @@ static bool rt2x00usb_kick_tx_entry(stru + + status = usb_submit_urb(entry_priv->urb, GFP_ATOMIC); + if (status) { +- if (status == -ENODEV || status == -ENOENT) ++ if (rt2x00usb_check_usb_error(rt2x00dev, status)) + clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); + set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); + rt2x00lib_dmadone(entry); +@@ -410,7 +426,7 @@ static bool rt2x00usb_kick_rx_entry(stru + + status = usb_submit_urb(entry_priv->urb, GFP_ATOMIC); + if (status) { +- if (status == -ENODEV || status == -ENOENT) ++ if (rt2x00usb_check_usb_error(rt2x00dev, status)) + clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); + set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); + rt2x00lib_dmadone(entry); diff --git a/package/kernel/mac80211/patches/rt2x00/023-rt2x00-do-not-print-error-when-queue-is-full.patch b/package/kernel/mac80211/patches/rt2x00/023-rt2x00-do-not-print-error-when-queue-is-full.patch new file mode 100644 index 00000000000000..223abab4f128c6 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/023-rt2x00-do-not-print-error-when-queue-is-full.patch @@ -0,0 +1,43 @@ +From patchwork Tue Mar 12 09:51:43 2019 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Stanislaw Gruszka +X-Patchwork-Id: 10848963 +X-Patchwork-Delegate: kvalo@adurom.com +From: Stanislaw Gruszka +To: linux-wireless@vger.kernel.org +Cc: =?utf-8?q?Tomislav_Po=C5=BEega?= , + Daniel Golle , Felix Fietkau , + Mathias Kresin +Subject: [PATCH v3 4/4] rt2x00: do not print error when queue is full +Date: Tue, 12 Mar 2019 10:51:43 +0100 +Message-Id: <1552384303-29529-5-git-send-email-sgruszka@redhat.com> +In-Reply-To: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> +References: <1552384303-29529-1-git-send-email-sgruszka@redhat.com> + +For unknown reasons printk() on some context can cause CPU hung on +embedded MT7620 AP/router MIPS platforms. What can result on wifi +disconnects. + +This patch move queue full messages to debug level what is consistent +with other mac80211 drivers which drop packet silently if tx queue is +full. This make MT7620 OpenWRT routers more stable, what was reported +by various users. + +Signed-off-by: Stanislaw Gruszka +--- + drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c +@@ -674,7 +674,7 @@ int rt2x00queue_write_tx_frame(struct da + spin_lock(&queue->tx_lock); + + if (unlikely(rt2x00queue_full(queue))) { +- rt2x00_err(queue->rt2x00dev, "Dropping frame due to full tx queue %d\n", ++ rt2x00_dbg(queue->rt2x00dev, "Dropping frame due to full tx queue %d\n", + queue->qid); + ret = -ENOBUFS; + goto out; diff --git a/package/kernel/mac80211/patches/rt2x00/024-rt2800-partially-restore-old-mmio-txstatus-behaviour.patch b/package/kernel/mac80211/patches/rt2x00/024-rt2800-partially-restore-old-mmio-txstatus-behaviour.patch new file mode 100644 index 00000000000000..52314a79ae9281 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/024-rt2800-partially-restore-old-mmio-txstatus-behaviour.patch @@ -0,0 +1,128 @@ +From 91a5340db0526b7263bc8da14b120ea3129b5f28 Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Sat, 9 Feb 2019 12:08:31 +0100 +X-Patchwork-Submitter: Stanislaw Gruszka +X-Patchwork-Id: 10804437 +X-Patchwork-Delegate: kvalo@adurom.com +Subject: [PATCH 21/28] rt2800: partially restore old mmio txstatus behaviour + +Do not disable txstatus interrupt and add quota of processed tx statuses in +one tasklet. Quota is needed to allow to fed device with new frames during +processing of tx statuses. + +Patch fixes about 15% performance degradation on some scenarios coused by +0b0d556e0ebb ("rt2800mmio: use txdone/txstatus routines from lib"). + +Signed-off-by: Stanislaw Gruszka +--- + .../net/wireless/ralink/rt2x00/rt2800lib.c | 4 +-- + .../net/wireless/ralink/rt2x00/rt2800lib.h | 2 +- + .../net/wireless/ralink/rt2x00/rt2800mmio.c | 30 +++++-------------- + .../net/wireless/ralink/rt2x00/rt2800usb.c | 2 +- + 4 files changed, 12 insertions(+), 26 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -1100,7 +1100,7 @@ void rt2800_txdone_entry(struct queue_en + } + EXPORT_SYMBOL_GPL(rt2800_txdone_entry); + +-void rt2800_txdone(struct rt2x00_dev *rt2x00dev) ++void rt2800_txdone(struct rt2x00_dev *rt2x00dev, unsigned int quota) + { + struct data_queue *queue; + struct queue_entry *entry; +@@ -1108,7 +1108,7 @@ void rt2800_txdone(struct rt2x00_dev *rt + u8 qid; + bool match; + +- while (kfifo_get(&rt2x00dev->txstatus_fifo, ®)) { ++ while (quota-- > 0 && kfifo_get(&rt2x00dev->txstatus_fifo, ®)) { + /* + * TX_STA_FIFO_PID_QUEUE is a 2-bit field, thus qid is + * guaranteed to be one of the TX QIDs . +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h +@@ -195,7 +195,7 @@ void rt2800_process_rxwi(struct queue_en + + void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi, + bool match); +-void rt2800_txdone(struct rt2x00_dev *rt2x00dev); ++void rt2800_txdone(struct rt2x00_dev *rt2x00dev, unsigned int quota); + void rt2800_txdone_nostatus(struct rt2x00_dev *rt2x00dev); + bool rt2800_txstatus_timeout(struct rt2x00_dev *rt2x00dev); + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c +@@ -255,20 +255,6 @@ void rt2800mmio_autowake_tasklet(unsigne + } + EXPORT_SYMBOL_GPL(rt2800mmio_autowake_tasklet); + +-static void rt2800mmio_txdone(struct rt2x00_dev *rt2x00dev) +-{ +- bool timeout = false; +- +- while (!kfifo_is_empty(&rt2x00dev->txstatus_fifo) || +- (timeout = rt2800_txstatus_timeout(rt2x00dev))) { +- +- rt2800_txdone(rt2x00dev); +- +- if (timeout) +- rt2800_txdone_nostatus(rt2x00dev); +- } +-} +- + static bool rt2800mmio_fetch_txstatus(struct rt2x00_dev *rt2x00dev) + { + u32 status; +@@ -305,14 +291,11 @@ void rt2800mmio_txstatus_tasklet(unsigne + { + struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; + +- do { +- rt2800mmio_txdone(rt2x00dev); ++ rt2800_txdone(rt2x00dev, 16); + +- } while (rt2800mmio_fetch_txstatus(rt2x00dev)); ++ if (!kfifo_is_empty(&rt2x00dev->txstatus_fifo)) ++ tasklet_schedule(&rt2x00dev->txstatus_tasklet); + +- if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) +- rt2800mmio_enable_interrupt(rt2x00dev, +- INT_SOURCE_CSR_TX_FIFO_STATUS); + } + EXPORT_SYMBOL_GPL(rt2800mmio_txstatus_tasklet); + +@@ -339,8 +322,10 @@ irqreturn_t rt2800mmio_interrupt(int irq + mask = ~reg; + + if (rt2x00_get_field32(reg, INT_SOURCE_CSR_TX_FIFO_STATUS)) { ++ rt2x00_set_field32(&mask, INT_MASK_CSR_TX_FIFO_STATUS, 1); + rt2800mmio_fetch_txstatus(rt2x00dev); +- tasklet_schedule(&rt2x00dev->txstatus_tasklet); ++ if (!kfifo_is_empty(&rt2x00dev->txstatus_fifo)) ++ tasklet_schedule(&rt2x00dev->txstatus_tasklet); + } + + if (rt2x00_get_field32(reg, INT_SOURCE_CSR_PRE_TBTT)) +@@ -500,7 +485,8 @@ void rt2800mmio_flush_queue(struct data_ + */ + if (tx_queue) { + tasklet_disable(&rt2x00dev->txstatus_tasklet); +- rt2800mmio_txdone(rt2x00dev); ++ rt2800_txdone(rt2x00dev, UINT_MAX); ++ rt2800_txdone_nostatus(rt2x00dev); + tasklet_enable(&rt2x00dev->txstatus_tasklet); + } + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c +@@ -480,7 +480,7 @@ static void rt2800usb_work_txdone(struct + while (!kfifo_is_empty(&rt2x00dev->txstatus_fifo) || + rt2800_txstatus_timeout(rt2x00dev)) { + +- rt2800_txdone(rt2x00dev); ++ rt2800_txdone(rt2x00dev, UINT_MAX); + + rt2800_txdone_nostatus(rt2x00dev); + diff --git a/package/kernel/mac80211/patches/rt2x00/025-rt2800-new-flush-implementation-for-SoC-devices.patch b/package/kernel/mac80211/patches/rt2x00/025-rt2800-new-flush-implementation-for-SoC-devices.patch new file mode 100644 index 00000000000000..e3a914a0fae46f --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/025-rt2800-new-flush-implementation-for-SoC-devices.patch @@ -0,0 +1,27 @@ +From 11f8ad1656035176bad9d89de7ea0e7fe6d82c32 Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Sat, 9 Feb 2019 12:08:32 +0100 +X-Patchwork-Submitter: Stanislaw Gruszka +X-Patchwork-Id: 10804439 +X-Patchwork-Delegate: kvalo@adurom.com +Subject: [PATCH 22/28] rt2800: new flush implementation for SoC devices + +Use new flush_queue() calback for SoC devices, what was already done for +PCIe devices. + +Signed-off-by: Stanislaw Gruszka +--- + drivers/net/wireless/ralink/rt2x00/rt2800soc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c +@@ -203,7 +203,7 @@ static const struct rt2x00lib_ops rt2800 + .start_queue = rt2800mmio_start_queue, + .kick_queue = rt2800mmio_kick_queue, + .stop_queue = rt2800mmio_stop_queue, +- .flush_queue = rt2x00mmio_flush_queue, ++ .flush_queue = rt2800mmio_flush_queue, + .write_tx_desc = rt2800mmio_write_tx_desc, + .write_tx_data = rt2800_write_tx_data, + .write_beacon = rt2800_write_beacon, diff --git a/package/kernel/mac80211/patches/rt2x00/026-rt2800-move-txstatus-pending-routine.patch b/package/kernel/mac80211/patches/rt2x00/026-rt2800-move-txstatus-pending-routine.patch new file mode 100644 index 00000000000000..e5bfbecd1e1461 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/026-rt2800-move-txstatus-pending-routine.patch @@ -0,0 +1,106 @@ +From 2bbea7645c3d095014a080db170941818650e141 Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Sat, 9 Feb 2019 12:08:33 +0100 +X-Patchwork-Submitter: Stanislaw Gruszka +X-Patchwork-Id: 10804441 +X-Patchwork-Delegate: kvalo@adurom.com +Subject: [PATCH 23/28] rt2800: move txstatus pending routine + +Move rt2800usb_txstatus_pending routine to rt2800lib. It will be reused +by rt2800mmio code. + +Signed-off-by: Stanislaw Gruszka +--- + .../net/wireless/ralink/rt2x00/rt2800lib.c | 17 ++++++++++++++ + .../net/wireless/ralink/rt2x00/rt2800lib.h | 1 + + .../net/wireless/ralink/rt2x00/rt2800usb.c | 22 +++---------------- + 3 files changed, 21 insertions(+), 19 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -1183,6 +1183,23 @@ bool rt2800_txstatus_timeout(struct rt2x + } + EXPORT_SYMBOL_GPL(rt2800_txstatus_timeout); + ++/* ++ * test if there is an entry in any TX queue for which DMA is done ++ * but the TX status has not been returned yet ++ */ ++bool rt2800_txstatus_pending(struct rt2x00_dev *rt2x00dev) ++{ ++ struct data_queue *queue; ++ ++ tx_queue_for_each(rt2x00dev, queue) { ++ if (rt2x00queue_get_entry(queue, Q_INDEX_DMA_DONE) != ++ rt2x00queue_get_entry(queue, Q_INDEX_DONE)) ++ return true; ++ } ++ return false; ++} ++EXPORT_SYMBOL_GPL(rt2800_txstatus_pending); ++ + void rt2800_txdone_nostatus(struct rt2x00_dev *rt2x00dev) + { + struct data_queue *queue; +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h +@@ -198,6 +198,7 @@ void rt2800_txdone_entry(struct queue_en + void rt2800_txdone(struct rt2x00_dev *rt2x00dev, unsigned int quota); + void rt2800_txdone_nostatus(struct rt2x00_dev *rt2x00dev); + bool rt2800_txstatus_timeout(struct rt2x00_dev *rt2x00dev); ++bool rt2800_txstatus_pending(struct rt2x00_dev *rt2x00dev); + + void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc); + void rt2800_clear_beacon(struct queue_entry *entry); +--- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c +@@ -100,22 +100,6 @@ static void rt2800usb_stop_queue(struct + } + } + +-/* +- * test if there is an entry in any TX queue for which DMA is done +- * but the TX status has not been returned yet +- */ +-static bool rt2800usb_txstatus_pending(struct rt2x00_dev *rt2x00dev) +-{ +- struct data_queue *queue; +- +- tx_queue_for_each(rt2x00dev, queue) { +- if (rt2x00queue_get_entry(queue, Q_INDEX_DMA_DONE) != +- rt2x00queue_get_entry(queue, Q_INDEX_DONE)) +- return true; +- } +- return false; +-} +- + #define TXSTATUS_READ_INTERVAL 1000000 + + static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev, +@@ -145,7 +129,7 @@ static bool rt2800usb_tx_sta_fifo_read_c + if (rt2800_txstatus_timeout(rt2x00dev)) + queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work); + +- if (rt2800usb_txstatus_pending(rt2x00dev)) { ++ if (rt2800_txstatus_pending(rt2x00dev)) { + /* Read register after 1 ms */ + hrtimer_start(&rt2x00dev->txstatus_timer, + TXSTATUS_READ_INTERVAL, +@@ -160,7 +144,7 @@ stop_reading: + * clear_bit someone could do rt2x00usb_interrupt_txdone, so recheck + * here again if status reading is needed. + */ +- if (rt2800usb_txstatus_pending(rt2x00dev) && ++ if (rt2800_txstatus_pending(rt2x00dev) && + !test_and_set_bit(TX_STATUS_READING, &rt2x00dev->flags)) + return true; + else +@@ -489,7 +473,7 @@ static void rt2800usb_work_txdone(struct + * if the medium is busy, thus the TX_STA_FIFO entry is + * also delayed -> use a timer to retrieve it. + */ +- if (rt2800usb_txstatus_pending(rt2x00dev)) ++ if (rt2800_txstatus_pending(rt2x00dev)) + rt2800usb_async_read_tx_status(rt2x00dev); + } + } diff --git a/package/kernel/mac80211/patches/rt2x00/027-rt2800mmio-fetch-tx-status-changes.patch b/package/kernel/mac80211/patches/rt2x00/027-rt2800mmio-fetch-tx-status-changes.patch new file mode 100644 index 00000000000000..4bb62c2288a774 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/027-rt2800mmio-fetch-tx-status-changes.patch @@ -0,0 +1,61 @@ +From f6a9618198e190a2ba09ce3f0aa8e9ee1763bd38 Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Sat, 9 Feb 2019 12:08:34 +0100 +X-Patchwork-Submitter: Stanislaw Gruszka +X-Patchwork-Id: 10804443 +X-Patchwork-Delegate: kvalo@adurom.com +Subject: [PATCH 24/28] rt2800mmio: fetch tx status changes + +Prepare to use rt2800mmio_fetch_txstatus() in concurrent manner and drop +return value since is not longer needed. + +Signed-off-by: Stanislaw Gruszka +--- + drivers/net/wireless/ralink/rt2x00/rt2800mmio.c | 17 +++++++++-------- + 1 file changed, 9 insertions(+), 8 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c +@@ -255,12 +255,12 @@ void rt2800mmio_autowake_tasklet(unsigne + } + EXPORT_SYMBOL_GPL(rt2800mmio_autowake_tasklet); + +-static bool rt2800mmio_fetch_txstatus(struct rt2x00_dev *rt2x00dev) ++static void rt2800mmio_fetch_txstatus(struct rt2x00_dev *rt2x00dev) + { + u32 status; +- bool more = false; ++ unsigned long flags; + +- /* FIXEME: rewrite this comment ++ /* + * The TX_FIFO_STATUS interrupt needs special care. We should + * read TX_STA_FIFO but we should do it immediately as otherwise + * the register can overflow and we would lose status reports. +@@ -271,20 +271,21 @@ static bool rt2800mmio_fetch_txstatus(st + * because we can schedule the tasklet multiple times (when the + * interrupt fires again during tx status processing). + * +- * txstatus tasklet is called with INT_SOURCE_CSR_TX_FIFO_STATUS +- * disabled so have only one producer and one consumer - we don't +- * need to lock the kfifo. ++ * We also read statuses from tx status timeout timer, use ++ * lock to prevent concurent writes to fifo. + */ ++ ++ spin_lock_irqsave(&rt2x00dev->irqmask_lock, flags); ++ + while (!kfifo_is_full(&rt2x00dev->txstatus_fifo)) { + status = rt2x00mmio_register_read(rt2x00dev, TX_STA_FIFO); + if (!rt2x00_get_field32(status, TX_STA_FIFO_VALID)) + break; + + kfifo_put(&rt2x00dev->txstatus_fifo, status); +- more = true; + } + +- return more; ++ spin_unlock_irqrestore(&rt2x00dev->irqmask_lock, flags); + } + + void rt2800mmio_txstatus_tasklet(unsigned long data) diff --git a/package/kernel/mac80211/patches/rt2x00/028-rt2800mmio-use-timer-and-work-for-handling-tx-status.patch b/package/kernel/mac80211/patches/rt2x00/028-rt2800mmio-use-timer-and-work-for-handling-tx-status.patch new file mode 100644 index 00000000000000..bf038a5991b44c --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/028-rt2800mmio-use-timer-and-work-for-handling-tx-status.patch @@ -0,0 +1,194 @@ +From 175c2548332b45b144af673e70fdbb1a947d7aba Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Sat, 9 Feb 2019 12:08:35 +0100 +X-Patchwork-Submitter: Stanislaw Gruszka +X-Patchwork-Id: 10804445 +X-Patchwork-Delegate: kvalo@adurom.com +Subject: [PATCH 25/28] rt2800mmio: use timer and work for handling tx statuses + timeouts + +Sometimes we can get into situation when there are pending statuses, +but we do not get INT_SOURCE_CSR_TX_FIFO_STATUS. Handle this situation +by arming timeout timer and read statuses (it will fix case when +we just do not have irq) and queue work to handle case we missed +statues from hardware FIFO. + +Signed-off-by: Stanislaw Gruszka +--- + .../net/wireless/ralink/rt2x00/rt2800mmio.c | 81 +++++++++++++++++-- + .../net/wireless/ralink/rt2x00/rt2800mmio.h | 1 + + .../net/wireless/ralink/rt2x00/rt2800pci.c | 2 +- + .../net/wireless/ralink/rt2x00/rt2800soc.c | 2 +- + .../net/wireless/ralink/rt2x00/rt2x00dev.c | 4 + + 5 files changed, 82 insertions(+), 8 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c +@@ -426,6 +426,9 @@ void rt2800mmio_start_queue(struct data_ + } + EXPORT_SYMBOL_GPL(rt2800mmio_start_queue); + ++/* 200 ms */ ++#define TXSTATUS_TIMEOUT 200000000 ++ + void rt2800mmio_kick_queue(struct data_queue *queue) + { + struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; +@@ -440,6 +443,8 @@ void rt2800mmio_kick_queue(struct data_q + entry = rt2x00queue_get_entry(queue, Q_INDEX); + rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX(queue->qid), + entry->entry_idx); ++ hrtimer_start(&rt2x00dev->txstatus_timer, ++ TXSTATUS_TIMEOUT, HRTIMER_MODE_REL); + break; + case QID_MGMT: + entry = rt2x00queue_get_entry(queue, Q_INDEX); +@@ -484,12 +489,8 @@ void rt2800mmio_flush_queue(struct data_ + * For TX queues schedule completion tasklet to catch + * tx status timeouts, othewise just wait. + */ +- if (tx_queue) { +- tasklet_disable(&rt2x00dev->txstatus_tasklet); +- rt2800_txdone(rt2x00dev, UINT_MAX); +- rt2800_txdone_nostatus(rt2x00dev); +- tasklet_enable(&rt2x00dev->txstatus_tasklet); +- } ++ if (tx_queue) ++ queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work); + + /* + * Wait for a little while to give the driver +@@ -627,6 +628,10 @@ void rt2800mmio_clear_entry(struct queue + word = rt2x00_desc_read(entry_priv->desc, 1); + rt2x00_set_field32(&word, TXD_W1_DMA_DONE, 1); + rt2x00_desc_write(entry_priv->desc, 1, word); ++ ++ /* If last entry stop txstatus timer */ ++ if (entry->queue->length == 1) ++ hrtimer_cancel(&rt2x00dev->txstatus_timer); + } + } + EXPORT_SYMBOL_GPL(rt2800mmio_clear_entry); +@@ -759,6 +764,70 @@ int rt2800mmio_enable_radio(struct rt2x0 + } + EXPORT_SYMBOL_GPL(rt2800mmio_enable_radio); + ++static void rt2800mmio_work_txdone(struct work_struct *work) ++{ ++ struct rt2x00_dev *rt2x00dev = ++ container_of(work, struct rt2x00_dev, txdone_work); ++ ++ if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) ++ return; ++ ++ while (!kfifo_is_empty(&rt2x00dev->txstatus_fifo) || ++ rt2800_txstatus_timeout(rt2x00dev)) { ++ ++ tasklet_disable(&rt2x00dev->txstatus_tasklet); ++ rt2800_txdone(rt2x00dev, UINT_MAX); ++ rt2800_txdone_nostatus(rt2x00dev); ++ tasklet_enable(&rt2x00dev->txstatus_tasklet); ++ } ++ ++ if (rt2800_txstatus_pending(rt2x00dev)) ++ hrtimer_start(&rt2x00dev->txstatus_timer, ++ TXSTATUS_TIMEOUT, HRTIMER_MODE_REL); ++} ++ ++static enum hrtimer_restart rt2800mmio_tx_sta_fifo_timeout(struct hrtimer *timer) ++{ ++ struct rt2x00_dev *rt2x00dev = ++ container_of(timer, struct rt2x00_dev, txstatus_timer); ++ ++ if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) ++ goto out; ++ ++ if (!rt2800_txstatus_pending(rt2x00dev)) ++ goto out; ++ ++ rt2800mmio_fetch_txstatus(rt2x00dev); ++ if (!kfifo_is_empty(&rt2x00dev->txstatus_fifo)) ++ tasklet_schedule(&rt2x00dev->txstatus_tasklet); ++ else ++ queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work); ++out: ++ return HRTIMER_NORESTART; ++} ++ ++int rt2800mmio_probe_hw(struct rt2x00_dev *rt2x00dev) ++{ ++ int retval; ++ ++ retval = rt2800_probe_hw(rt2x00dev); ++ if (retval) ++ return retval; ++ ++ /* ++ * Set txstatus timer function. ++ */ ++ rt2x00dev->txstatus_timer.function = rt2800mmio_tx_sta_fifo_timeout; ++ ++ /* ++ * Overwrite TX done handler ++ */ ++ INIT_WORK(&rt2x00dev->txdone_work, rt2800mmio_work_txdone); ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(rt2800mmio_probe_hw); ++ + MODULE_AUTHOR(DRV_PROJECT); + MODULE_VERSION(DRV_VERSION); + MODULE_DESCRIPTION("rt2800 MMIO library"); +--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.h +@@ -153,6 +153,7 @@ void rt2800mmio_stop_queue(struct data_q + void rt2800mmio_queue_init(struct data_queue *queue); + + /* Initialization functions */ ++int rt2800mmio_probe_hw(struct rt2x00_dev *rt2x00dev); + bool rt2800mmio_get_entry_state(struct queue_entry *entry); + void rt2800mmio_clear_entry(struct queue_entry *entry); + int rt2800mmio_init_queues(struct rt2x00_dev *rt2x00dev); +--- a/drivers/net/wireless/ralink/rt2x00/rt2800pci.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800pci.c +@@ -346,7 +346,7 @@ static const struct rt2x00lib_ops rt2800 + .tbtt_tasklet = rt2800mmio_tbtt_tasklet, + .rxdone_tasklet = rt2800mmio_rxdone_tasklet, + .autowake_tasklet = rt2800mmio_autowake_tasklet, +- .probe_hw = rt2800_probe_hw, ++ .probe_hw = rt2800mmio_probe_hw, + .get_firmware_name = rt2800pci_get_firmware_name, + .check_firmware = rt2800_check_firmware, + .load_firmware = rt2800_load_firmware, +--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c +@@ -185,7 +185,7 @@ static const struct rt2x00lib_ops rt2800 + .tbtt_tasklet = rt2800mmio_tbtt_tasklet, + .rxdone_tasklet = rt2800mmio_rxdone_tasklet, + .autowake_tasklet = rt2800mmio_autowake_tasklet, +- .probe_hw = rt2800_probe_hw, ++ .probe_hw = rt2800mmio_probe_hw, + .get_firmware_name = rt2800soc_get_firmware_name, + .check_firmware = rt2800soc_check_firmware, + .load_firmware = rt2800soc_load_firmware, +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +@@ -1391,6 +1391,8 @@ int rt2x00lib_probe_dev(struct rt2x00_de + mutex_init(&rt2x00dev->conf_mutex); + INIT_LIST_HEAD(&rt2x00dev->bar_list); + spin_lock_init(&rt2x00dev->bar_list_lock); ++ hrtimer_init(&rt2x00dev->txstatus_timer, CLOCK_MONOTONIC, ++ HRTIMER_MODE_REL); + + set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); + +@@ -1515,6 +1517,8 @@ void rt2x00lib_remove_dev(struct rt2x00_ + cancel_delayed_work_sync(&rt2x00dev->autowakeup_work); + cancel_work_sync(&rt2x00dev->sleep_work); + ++ hrtimer_cancel(&rt2x00dev->txstatus_timer); ++ + /* + * Kill the tx status tasklet. + */ diff --git a/package/kernel/mac80211/patches/rt2x00/029-rt2x00-remove-last_nostatus_check.patch b/package/kernel/mac80211/patches/rt2x00/029-rt2x00-remove-last_nostatus_check.patch new file mode 100644 index 00000000000000..08ac24033d30ad --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/029-rt2x00-remove-last_nostatus_check.patch @@ -0,0 +1,57 @@ +From 6013a91f15c9dabd668d5736652b9bcfb0ef0378 Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Sat, 9 Feb 2019 12:08:36 +0100 +X-Patchwork-Submitter: Stanislaw Gruszka +X-Patchwork-Id: 10804447 +X-Patchwork-Delegate: kvalo@adurom.com +Subject: [PATCH 26/28] rt2x00: remove last_nostatus_check + +We do not any longer check txstatus timeout from tasklet, so do not need +this optimization. + +Signed-off-by: Stanislaw Gruszka +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 9 --------- + drivers/net/wireless/ralink/rt2x00/rt2x00.h | 2 -- + drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | 1 - + 3 files changed, 12 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -1164,15 +1164,6 @@ bool rt2800_txstatus_timeout(struct rt2x + struct data_queue *queue; + struct queue_entry *entry; + +- if (!test_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags)) { +- unsigned long tout = msecs_to_jiffies(1000); +- +- if (time_before(jiffies, rt2x00dev->last_nostatus_check + tout)) +- return false; +- } +- +- rt2x00dev->last_nostatus_check = jiffies; +- + tx_queue_for_each(rt2x00dev, queue) { + entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); + if (rt2800_entry_txstatus_timeout(rt2x00dev, entry)) +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -980,8 +980,6 @@ struct rt2x00_dev { + */ + DECLARE_KFIFO_PTR(txstatus_fifo, u32); + +- unsigned long last_nostatus_check; +- + /* + * Timer to ensure tx status reports are read (rt2800usb). + */ +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c +@@ -1042,7 +1042,6 @@ void rt2x00queue_start_queues(struct rt2 + */ + tx_queue_for_each(rt2x00dev, queue) + rt2x00queue_start_queue(queue); +- rt2x00dev->last_nostatus_check = jiffies; + + rt2x00queue_start_queue(rt2x00dev->rx); + } diff --git a/package/kernel/mac80211/patches/rt2x00/030-rt2x00-remove-not-used-entry-field.patch b/package/kernel/mac80211/patches/rt2x00/030-rt2x00-remove-not-used-entry-field.patch new file mode 100644 index 00000000000000..53134a5bc3110e --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/030-rt2x00-remove-not-used-entry-field.patch @@ -0,0 +1,34 @@ +From 2758f09b22bc08e89e0391486b2d707ad2479599 Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Sat, 9 Feb 2019 12:08:37 +0100 +X-Patchwork-Submitter: Stanislaw Gruszka +X-Patchwork-Id: 10804449 +X-Patchwork-Delegate: kvalo@adurom.com +Subject: [PATCH 27/28] rt2x00: remove not used entry field + +Remove not used any longer queue_entry field and flag. + +Signed-off-by: Stanislaw Gruszka +--- + drivers/net/wireless/ralink/rt2x00/rt2x00queue.h | 3 --- + 1 file changed, 3 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h +@@ -361,7 +361,6 @@ enum queue_entry_flags { + ENTRY_DATA_PENDING, + ENTRY_DATA_IO_FAILED, + ENTRY_DATA_STATUS_PENDING, +- ENTRY_DATA_STATUS_SET, + }; + + /** +@@ -387,8 +386,6 @@ struct queue_entry { + + unsigned int entry_idx; + +- u32 status; +- + void *priv_data; + }; + diff --git a/package/kernel/mac80211/patches/rt2x00/031-rt2x00mmio-remove-legacy-comment.patch b/package/kernel/mac80211/patches/rt2x00/031-rt2x00mmio-remove-legacy-comment.patch new file mode 100644 index 00000000000000..199a6e325516ec --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/031-rt2x00mmio-remove-legacy-comment.patch @@ -0,0 +1,26 @@ +From f44e145869bb517460648e4ed71b7e9001964d06 Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Sat, 9 Feb 2019 12:08:38 +0100 +X-Patchwork-Submitter: Stanislaw Gruszka +X-Patchwork-Id: 10804451 +X-Patchwork-Delegate: kvalo@adurom.com +Subject: [PATCH 28/28] rt2x00mmio: remove legacy comment + +Remove comment about fields that ware removed. + +Signed-off-by: Stanislaw Gruszka +--- + drivers/net/wireless/ralink/rt2x00/rt2x00mmio.h | 2 -- + 1 file changed, 2 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00mmio.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mmio.h +@@ -80,8 +80,6 @@ int rt2x00mmio_regbusy_read(struct rt2x0 + * + * @desc: Pointer to device descriptor + * @desc_dma: DMA pointer to &desc. +- * @data: Pointer to device's entry memory. +- * @data_dma: DMA pointer to &data. + */ + struct queue_entry_priv_mmio { + __le32 *desc; diff --git a/package/kernel/mac80211/patches/rt2x00/050-rt2x00-add-RT3883-support.patch b/package/kernel/mac80211/patches/rt2x00/050-rt2x00-add-RT3883-support.patch new file mode 100644 index 00000000000000..162a20155d704f --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/050-rt2x00-add-RT3883-support.patch @@ -0,0 +1,959 @@ +From d0e61a0f7cca51ce340a5a73595189972122ff25 Mon Sep 17 00:00:00 2001 +From: Gabor Juhos +Date: Wed, 24 Apr 2019 09:49:24 +0200 +Subject: [PATCH] rt2x00: add RT3883 support + +Patch add support for RT3883 chip. Code was taken direclty +from openwrt project and merge into one patch. + +Signed-off-by: Gabor Juhos +Signed-off-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt2800.h | 19 +- + .../net/wireless/ralink/rt2x00/rt2800lib.c | 598 +++++++++++++++++- + .../net/wireless/ralink/rt2x00/rt2800soc.c | 9 +- + 3 files changed, 607 insertions(+), 19 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h +@@ -48,7 +48,8 @@ + * RF2853 2.4G/5G 3T3R + * RF3320 2.4G 1T1R(RT3350/RT3370/RT3390) + * RF3322 2.4G 2T2R(RT3352/RT3371/RT3372/RT3391/RT3392) +- * RF3053 2.4G/5G 3T3R(RT3883/RT3563/RT3573/RT3593/RT3662) ++ * RF3053 2.4G/5G 3T3R(RT3563/RT3573/RT3593) ++ * RF3853 2.4G/5G 3T3R(RT3883/RT3662) + * RF5592 2.4G/5G 2T2R + * RF3070 2.4G 1T1R + * RF5360 2.4G 1T1R +@@ -72,6 +73,7 @@ + #define RF5592 0x000f + #define RF3070 0x3070 + #define RF3290 0x3290 ++#define RF3853 0x3853 + #define RF5350 0x5350 + #define RF5360 0x5360 + #define RF5362 0x5362 +@@ -1726,6 +1728,20 @@ + #define TX_PWR_CFG_9B_STBC_MCS7 FIELD32(0x000000ff) + + /* ++ * TX_TXBF_CFG: ++ */ ++#define TX_TXBF_CFG_0 0x138c ++#define TX_TXBF_CFG_1 0x13a4 ++#define TX_TXBF_CFG_2 0x13a8 ++#define TX_TXBF_CFG_3 0x13ac ++ ++/* ++ * TX_FBK_CFG_3S: ++ */ ++#define TX_FBK_CFG_3S_0 0x13c4 ++#define TX_FBK_CFG_3S_1 0x13c8 ++ ++/* + * RX_FILTER_CFG: RX configuration register. + */ + #define RX_FILTER_CFG 0x1400 +@@ -2296,6 +2312,7 @@ struct mac_iveiv_entry { + /* + * RFCSR 2: + */ ++#define RFCSR2_RESCAL_BP FIELD8(0x40) + #define RFCSR2_RESCAL_EN FIELD8(0x80) + #define RFCSR2_RX2_EN_MT7620 FIELD8(0x02) + #define RFCSR2_TX2_EN_MT7620 FIELD8(0x20) +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -381,7 +381,8 @@ static unsigned int rt2800_eeprom_word_i + wiphy_name(rt2x00dev->hw->wiphy), word)) + return 0; + +- if (rt2x00_rt(rt2x00dev, RT3593)) ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) + map = rt2800_eeprom_map_ext; + else + map = rt2800_eeprom_map; +@@ -590,6 +591,7 @@ void rt2800_get_txwi_rxwi_size(struct rt + { + switch (rt2x00dev->chip.rt) { + case RT3593: ++ case RT3883: + *txwi_size = TXWI_DESC_SIZE_4WORDS; + *rxwi_size = RXWI_DESC_SIZE_5WORDS; + break; +@@ -2180,7 +2182,8 @@ void rt2800_config_ant(struct rt2x00_dev + rt2800_bbp_write(rt2x00dev, 3, r3); + rt2800_bbp_write(rt2x00dev, 1, r1); + +- if (rt2x00_rt(rt2x00dev, RT3593)) { ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) { + if (ant->rx_chain_num == 1) + rt2800_bbp_write(rt2x00dev, 86, 0x00); + else +@@ -2202,7 +2205,8 @@ static void rt2800_config_lna_gain(struc + eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_LNA); + lna_gain = rt2x00_get_field16(eeprom, EEPROM_LNA_A0); + } else if (libconf->rf.channel <= 128) { +- if (rt2x00_rt(rt2x00dev, RT3593)) { ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) { + eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2); + lna_gain = rt2x00_get_field16(eeprom, + EEPROM_EXT_LNA2_A1); +@@ -2212,7 +2216,8 @@ static void rt2800_config_lna_gain(struc + EEPROM_RSSI_BG2_LNA_A1); + } + } else { +- if (rt2x00_rt(rt2x00dev, RT3593)) { ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) { + eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2); + lna_gain = rt2x00_get_field16(eeprom, + EEPROM_EXT_LNA2_A2); +@@ -2880,6 +2885,211 @@ static void rt2800_config_channel_rf3053 + } + } + ++static void rt2800_config_channel_rf3853(struct rt2x00_dev *rt2x00dev, ++ struct ieee80211_conf *conf, ++ struct rf_channel *rf, ++ struct channel_info *info) ++{ ++ u8 rfcsr; ++ u8 bbp; ++ u8 pwr1, pwr2, pwr3; ++ ++ const bool txbf_enabled = false; /* TODO */ ++ ++ /* TODO: add band selection */ ++ ++ if (rf->channel <= 14) ++ rt2800_rfcsr_write(rt2x00dev, 6, 0x40); ++ else if (rf->channel < 132) ++ rt2800_rfcsr_write(rt2x00dev, 6, 0x80); ++ else ++ rt2800_rfcsr_write(rt2x00dev, 6, 0x40); ++ ++ rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1); ++ rt2800_rfcsr_write(rt2x00dev, 9, rf->rf3); ++ ++ if (rf->channel <= 14) ++ rt2800_rfcsr_write(rt2x00dev, 11, 0x46); ++ else ++ rt2800_rfcsr_write(rt2x00dev, 11, 0x48); ++ ++ if (rf->channel <= 14) ++ rt2800_rfcsr_write(rt2x00dev, 12, 0x1a); ++ else ++ rt2800_rfcsr_write(rt2x00dev, 12, 0x52); ++ ++ rt2800_rfcsr_write(rt2x00dev, 13, 0x12); ++ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); ++ rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 0); ++ rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 0); ++ rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 0); ++ rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 0); ++ rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 0); ++ rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 0); ++ rt2x00_set_field8(&rfcsr, RFCSR1_RF_BLOCK_EN, 1); ++ rt2x00_set_field8(&rfcsr, RFCSR1_PLL_PD, 1); ++ ++ switch (rt2x00dev->default_ant.tx_chain_num) { ++ case 3: ++ rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 1); ++ /* fallthrough */ ++ case 2: ++ rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 1); ++ /* fallthrough */ ++ case 1: ++ rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 1); ++ break; ++ } ++ ++ switch (rt2x00dev->default_ant.rx_chain_num) { ++ case 3: ++ rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 1); ++ /* fallthrough */ ++ case 2: ++ rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 1); ++ /* fallthrough */ ++ case 1: ++ rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 1); ++ break; ++ } ++ rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); ++ ++ rt2800_freq_cal_mode1(rt2x00dev); ++ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 30); ++ if (!conf_is_ht40(conf)) ++ rfcsr &= ~(0x06); ++ else ++ rfcsr |= 0x06; ++ rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); ++ ++ if (rf->channel <= 14) ++ rt2800_rfcsr_write(rt2x00dev, 31, 0xa0); ++ else ++ rt2800_rfcsr_write(rt2x00dev, 31, 0x80); ++ ++ if (conf_is_ht40(conf)) ++ rt2800_rfcsr_write(rt2x00dev, 32, 0x80); ++ else ++ rt2800_rfcsr_write(rt2x00dev, 32, 0xd8); ++ ++ if (rf->channel <= 14) ++ rt2800_rfcsr_write(rt2x00dev, 34, 0x3c); ++ else ++ rt2800_rfcsr_write(rt2x00dev, 34, 0x20); ++ ++ /* loopback RF_BS */ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 36); ++ if (rf->channel <= 14) ++ rt2x00_set_field8(&rfcsr, RFCSR36_RF_BS, 1); ++ else ++ rt2x00_set_field8(&rfcsr, RFCSR36_RF_BS, 0); ++ rt2800_rfcsr_write(rt2x00dev, 36, rfcsr); ++ ++ if (rf->channel <= 14) ++ rfcsr = 0x23; ++ else if (rf->channel < 100) ++ rfcsr = 0x36; ++ else if (rf->channel < 132) ++ rfcsr = 0x32; ++ else ++ rfcsr = 0x30; ++ ++ if (txbf_enabled) ++ rfcsr |= 0x40; ++ ++ rt2800_rfcsr_write(rt2x00dev, 39, rfcsr); ++ ++ if (rf->channel <= 14) ++ rt2800_rfcsr_write(rt2x00dev, 44, 0x93); ++ else ++ rt2800_rfcsr_write(rt2x00dev, 44, 0x9b); ++ ++ if (rf->channel <= 14) ++ rfcsr = 0xbb; ++ else if (rf->channel < 100) ++ rfcsr = 0xeb; ++ else if (rf->channel < 132) ++ rfcsr = 0xb3; ++ else ++ rfcsr = 0x9b; ++ rt2800_rfcsr_write(rt2x00dev, 45, rfcsr); ++ ++ if (rf->channel <= 14) ++ rfcsr = 0x8e; ++ else ++ rfcsr = 0x8a; ++ ++ if (txbf_enabled) ++ rfcsr |= 0x20; ++ ++ rt2800_rfcsr_write(rt2x00dev, 49, rfcsr); ++ ++ rt2800_rfcsr_write(rt2x00dev, 50, 0x86); ++ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 51); ++ if (rf->channel <= 14) ++ rt2800_rfcsr_write(rt2x00dev, 51, 0x75); ++ else ++ rt2800_rfcsr_write(rt2x00dev, 51, 0x51); ++ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 52); ++ if (rf->channel <= 14) ++ rt2800_rfcsr_write(rt2x00dev, 52, 0x45); ++ else ++ rt2800_rfcsr_write(rt2x00dev, 52, 0x05); ++ ++ if (rf->channel <= 14) { ++ pwr1 = info->default_power1 & 0x1f; ++ pwr2 = info->default_power2 & 0x1f; ++ pwr3 = info->default_power3 & 0x1f; ++ } else { ++ pwr1 = 0x48 | ((info->default_power1 & 0x18) << 1) | ++ (info->default_power1 & 0x7); ++ pwr2 = 0x48 | ((info->default_power2 & 0x18) << 1) | ++ (info->default_power2 & 0x7); ++ pwr3 = 0x48 | ((info->default_power3 & 0x18) << 1) | ++ (info->default_power3 & 0x7); ++ } ++ ++ rt2800_rfcsr_write(rt2x00dev, 53, pwr1); ++ rt2800_rfcsr_write(rt2x00dev, 54, pwr2); ++ rt2800_rfcsr_write(rt2x00dev, 55, pwr3); ++ ++ rt2x00_dbg(rt2x00dev, "Channel:%d, pwr1:%02x, pwr2:%02x, pwr3:%02x\n", ++ rf->channel, pwr1, pwr2, pwr3); ++ ++ bbp = (info->default_power1 >> 5) | ++ ((info->default_power2 & 0xe0) >> 1); ++ rt2800_bbp_write(rt2x00dev, 109, bbp); ++ ++ bbp = rt2800_bbp_read(rt2x00dev, 110); ++ bbp &= 0x0f; ++ bbp |= (info->default_power3 & 0xe0) >> 1; ++ rt2800_bbp_write(rt2x00dev, 110, bbp); ++ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 57); ++ if (rf->channel <= 14) ++ rt2800_rfcsr_write(rt2x00dev, 57, 0x6e); ++ else ++ rt2800_rfcsr_write(rt2x00dev, 57, 0x3e); ++ ++ /* Enable RF tuning */ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 3); ++ rt2x00_set_field8(&rfcsr, RFCSR3_VCOCAL_EN, 1); ++ rt2800_rfcsr_write(rt2x00dev, 3, rfcsr); ++ ++ udelay(2000); ++ ++ bbp = rt2800_bbp_read(rt2x00dev, 49); ++ /* clear update flag */ ++ rt2800_bbp_write(rt2x00dev, 49, bbp & 0xfe); ++ rt2800_bbp_write(rt2x00dev, 49, bbp); ++ ++ /* TODO: add calibration for TxBF */ ++} ++ + #define POWER_BOUND 0x27 + #define POWER_BOUND_5G 0x2b + +@@ -3683,19 +3893,51 @@ static char rt2800_txpower_to_dev(struct + unsigned int channel, + char txpower) + { +- if (rt2x00_rt(rt2x00dev, RT3593)) ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) + txpower = rt2x00_get_field8(txpower, EEPROM_TXPOWER_ALC); + + if (channel <= 14) + return clamp_t(char, txpower, MIN_G_TXPOWER, MAX_G_TXPOWER); + +- if (rt2x00_rt(rt2x00dev, RT3593)) ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) + return clamp_t(char, txpower, MIN_A_TXPOWER_3593, + MAX_A_TXPOWER_3593); + else + return clamp_t(char, txpower, MIN_A_TXPOWER, MAX_A_TXPOWER); + } + ++static void rt3883_bbp_adjust(struct rt2x00_dev *rt2x00dev, ++ struct rf_channel *rf) ++{ ++ u8 bbp; ++ ++ bbp = (rf->channel > 14) ? 0x48 : 0x38; ++ rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, bbp); ++ ++ rt2800_bbp_write(rt2x00dev, 69, 0x12); ++ ++ if (rf->channel <= 14) { ++ rt2800_bbp_write(rt2x00dev, 70, 0x0a); ++ } else { ++ /* Disable CCK packet detection */ ++ rt2800_bbp_write(rt2x00dev, 70, 0x00); ++ } ++ ++ rt2800_bbp_write(rt2x00dev, 73, 0x10); ++ ++ if (rf->channel > 14) { ++ rt2800_bbp_write(rt2x00dev, 62, 0x1d); ++ rt2800_bbp_write(rt2x00dev, 63, 0x1d); ++ rt2800_bbp_write(rt2x00dev, 64, 0x1d); ++ } else { ++ rt2800_bbp_write(rt2x00dev, 62, 0x2d); ++ rt2800_bbp_write(rt2x00dev, 63, 0x2d); ++ rt2800_bbp_write(rt2x00dev, 64, 0x2d); ++ } ++} ++ + static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, + struct ieee80211_conf *conf, + struct rf_channel *rf, +@@ -3714,6 +3956,12 @@ static void rt2800_config_channel(struct + rt2800_txpower_to_dev(rt2x00dev, rf->channel, + info->default_power3); + ++ switch (rt2x00dev->chip.rt) { ++ case RT3883: ++ rt3883_bbp_adjust(rt2x00dev, rf); ++ break; ++ } ++ + switch (rt2x00dev->chip.rf) { + case RF2020: + case RF3020: +@@ -3734,6 +3982,9 @@ static void rt2800_config_channel(struct + case RF3322: + rt2800_config_channel_rf3322(rt2x00dev, conf, rf, info); + break; ++ case RF3853: ++ rt2800_config_channel_rf3853(rt2x00dev, conf, rf, info); ++ break; + case RF3070: + case RF5350: + case RF5360: +@@ -3815,6 +4066,15 @@ static void rt2800_config_channel(struct + rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); + rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); + rt2800_bbp_write(rt2x00dev, 77, 0x98); ++ } else if (rt2x00_rt(rt2x00dev, RT3883)) { ++ rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); ++ rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); ++ rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); ++ ++ if (rt2x00dev->default_ant.rx_chain_num > 1) ++ rt2800_bbp_write(rt2x00dev, 86, 0x46); ++ else ++ rt2800_bbp_write(rt2x00dev, 86, 0); + } else { + rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); + rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); +@@ -3828,6 +4088,7 @@ static void rt2800_config_channel(struct + !rt2x00_rt(rt2x00dev, RT6352)) { + if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) { + rt2800_bbp_write(rt2x00dev, 82, 0x62); ++ rt2800_bbp_write(rt2x00dev, 82, 0x62); + rt2800_bbp_write(rt2x00dev, 75, 0x46); + } else { + if (rt2x00_rt(rt2x00dev, RT3593)) +@@ -3836,19 +4097,22 @@ static void rt2800_config_channel(struct + rt2800_bbp_write(rt2x00dev, 82, 0x84); + rt2800_bbp_write(rt2x00dev, 75, 0x50); + } +- if (rt2x00_rt(rt2x00dev, RT3593)) ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) + rt2800_bbp_write(rt2x00dev, 83, 0x8a); + } + + } else { + if (rt2x00_rt(rt2x00dev, RT3572)) + rt2800_bbp_write(rt2x00dev, 82, 0x94); +- else if (rt2x00_rt(rt2x00dev, RT3593)) ++ else if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) + rt2800_bbp_write(rt2x00dev, 82, 0x82); + else if (!rt2x00_rt(rt2x00dev, RT6352)) + rt2800_bbp_write(rt2x00dev, 82, 0xf2); + +- if (rt2x00_rt(rt2x00dev, RT3593)) ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) + rt2800_bbp_write(rt2x00dev, 83, 0x9a); + + if (rt2x00_has_cap_external_lna_a(rt2x00dev)) +@@ -3984,6 +4248,23 @@ static void rt2800_config_channel(struct + usleep_range(1000, 1500); + } + ++ if (rt2x00_rt(rt2x00dev, RT3883)) { ++ if (!conf_is_ht40(conf)) ++ rt2800_bbp_write(rt2x00dev, 105, 0x34); ++ else ++ rt2800_bbp_write(rt2x00dev, 105, 0x04); ++ ++ /* AGC init */ ++ if (rf->channel <= 14) ++ reg = 0x2e + rt2x00dev->lna_gain; ++ else ++ reg = 0x20 + ((rt2x00dev->lna_gain * 5) / 3); ++ ++ rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); ++ ++ usleep_range(1000, 1500); ++ } ++ + if (rt2x00_rt(rt2x00dev, RT5592) || rt2x00_rt(rt2x00dev, RT6352)) { + reg = 0x10; + if (!conf_is_ht40(conf)) { +@@ -4243,6 +4524,9 @@ static u8 rt2800_compensate_txpower(stru + if (rt2x00_rt(rt2x00dev, RT3593)) + return min_t(u8, txpower, 0xc); + ++ if (rt2x00_rt(rt2x00dev, RT3883)) ++ return min_t(u8, txpower, 0xf); ++ + if (rt2x00_has_cap_power_limit(rt2x00dev)) { + /* + * Check if eirp txpower exceed txpower_limit. +@@ -5004,7 +5288,8 @@ static void rt2800_config_txpower(struct + struct ieee80211_channel *chan, + int power_level) + { +- if (rt2x00_rt(rt2x00dev, RT3593)) ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) + rt2800_config_txpower_rt3593(rt2x00dev, chan, power_level); + else if (rt2x00_rt(rt2x00dev, RT6352)) + rt2800_config_txpower_rt6352(rt2x00dev, chan, power_level); +@@ -5051,6 +5336,7 @@ void rt2800_vco_calibration(struct rt2x0 + case RF3053: + case RF3070: + case RF3290: ++ case RF3853: + case RF5350: + case RF5360: + case RF5362: +@@ -5251,7 +5537,8 @@ static u8 rt2800_get_default_vgc(struct + else + vgc = 0x2e + rt2x00dev->lna_gain; + } else { /* 5GHZ band */ +- if (rt2x00_rt(rt2x00dev, RT3593)) ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) + vgc = 0x20 + (rt2x00dev->lna_gain * 5) / 3; + else if (rt2x00_rt(rt2x00dev, RT5592)) + vgc = 0x24 + (2 * rt2x00dev->lna_gain); +@@ -5271,7 +5558,8 @@ static inline void rt2800_set_vgc(struct + { + if (qual->vgc_level != vgc_level) { + if (rt2x00_rt(rt2x00dev, RT3572) || +- rt2x00_rt(rt2x00dev, RT3593)) { ++ rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) { + rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, + vgc_level); + } else if (rt2x00_rt(rt2x00dev, RT5592)) { +@@ -5318,6 +5606,11 @@ void rt2800_link_tuner(struct rt2x00_dev + } + break; + ++ case RT3883: ++ if (qual->rssi > -65) ++ vgc += 0x10; ++ break; ++ + case RT5592: + if (qual->rssi > -65) + vgc += 0x20; +@@ -5470,6 +5763,12 @@ static int rt2800_init_registers(struct + rt2800_register_write(rt2x00dev, TX_SW_CFG2, + 0x00000000); + } ++ } else if (rt2x00_rt(rt2x00dev, RT3883)) { ++ rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000402); ++ rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000); ++ rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00040000); ++ rt2800_register_write(rt2x00dev, TX_TXBF_CFG_0, 0x8000fc21); ++ rt2800_register_write(rt2x00dev, TX_TXBF_CFG_3, 0x00009c40); + } else if (rt2x00_rt(rt2x00dev, RT5390) || + rt2x00_rt(rt2x00dev, RT5392) || + rt2x00_rt(rt2x00dev, RT6352)) { +@@ -5683,6 +5982,11 @@ static int rt2800_init_registers(struct + reg = rt2x00_rt(rt2x00dev, RT5592) ? 0x00000082 : 0x00000002; + rt2800_register_write(rt2x00dev, TXOP_HLDR_ET, reg); + ++ if (rt2x00_rt(rt2x00dev, RT3883)) { ++ rt2800_register_write(rt2x00dev, TX_FBK_CFG_3S_0, 0x12111008); ++ rt2800_register_write(rt2x00dev, TX_FBK_CFG_3S_1, 0x16151413); ++ } ++ + reg = rt2800_register_read(rt2x00dev, TX_RTS_CFG); + rt2x00_set_field32(®, TX_RTS_CFG_AUTO_RTS_RETRY_LIMIT, 7); + rt2x00_set_field32(®, TX_RTS_CFG_RTS_THRES, +@@ -6299,6 +6603,47 @@ static void rt2800_init_bbp_3593(struct + rt2800_bbp_write(rt2x00dev, 103, 0xc0); + } + ++static void rt2800_init_bbp_3883(struct rt2x00_dev *rt2x00dev) ++{ ++ rt2800_init_bbp_early(rt2x00dev); ++ ++ rt2800_bbp_write(rt2x00dev, 4, 0x50); ++ rt2800_bbp_write(rt2x00dev, 47, 0x48); ++ ++ rt2800_bbp_write(rt2x00dev, 86, 0x46); ++ rt2800_bbp_write(rt2x00dev, 88, 0x90); ++ ++ rt2800_bbp_write(rt2x00dev, 92, 0x02); ++ ++ rt2800_bbp_write(rt2x00dev, 103, 0xc0); ++ rt2800_bbp_write(rt2x00dev, 104, 0x92); ++ rt2800_bbp_write(rt2x00dev, 105, 0x34); ++ rt2800_bbp_write(rt2x00dev, 106, 0x12); ++ rt2800_bbp_write(rt2x00dev, 120, 0x50); ++ rt2800_bbp_write(rt2x00dev, 137, 0x0f); ++ rt2800_bbp_write(rt2x00dev, 163, 0x9d); ++ ++ /* Set ITxBF timeout to 0x9C40=1000msec */ ++ rt2800_bbp_write(rt2x00dev, 179, 0x02); ++ rt2800_bbp_write(rt2x00dev, 180, 0x00); ++ rt2800_bbp_write(rt2x00dev, 182, 0x40); ++ rt2800_bbp_write(rt2x00dev, 180, 0x01); ++ rt2800_bbp_write(rt2x00dev, 182, 0x9c); ++ ++ rt2800_bbp_write(rt2x00dev, 179, 0x00); ++ ++ /* Reprogram the inband interface to put right values in RXWI */ ++ rt2800_bbp_write(rt2x00dev, 142, 0x04); ++ rt2800_bbp_write(rt2x00dev, 143, 0x3b); ++ rt2800_bbp_write(rt2x00dev, 142, 0x06); ++ rt2800_bbp_write(rt2x00dev, 143, 0xa0); ++ rt2800_bbp_write(rt2x00dev, 142, 0x07); ++ rt2800_bbp_write(rt2x00dev, 143, 0xa1); ++ rt2800_bbp_write(rt2x00dev, 142, 0x08); ++ rt2800_bbp_write(rt2x00dev, 143, 0xa2); ++ rt2800_bbp_write(rt2x00dev, 148, 0xc8); ++} ++ + static void rt2800_init_bbp_53xx(struct rt2x00_dev *rt2x00dev) + { + int ant, div_mode; +@@ -6743,6 +7088,9 @@ static void rt2800_init_bbp(struct rt2x0 + case RT3593: + rt2800_init_bbp_3593(rt2x00dev); + return; ++ case RT3883: ++ rt2800_init_bbp_3883(rt2x00dev); ++ return; + case RT5390: + case RT5392: + rt2800_init_bbp_53xx(rt2x00dev); +@@ -7614,6 +7962,144 @@ static void rt2800_init_rfcsr_5350(struc + rt2800_rfcsr_write(rt2x00dev, 63, 0x00); + } + ++static void rt2800_init_rfcsr_3883(struct rt2x00_dev *rt2x00dev) ++{ ++ u8 rfcsr; ++ ++ /* TODO: get the actual ECO value from the SoC */ ++ const unsigned int eco = 5; ++ ++ rt2800_rf_init_calibration(rt2x00dev, 2); ++ ++ rt2800_rfcsr_write(rt2x00dev, 0, 0xe0); ++ rt2800_rfcsr_write(rt2x00dev, 1, 0x03); ++ rt2800_rfcsr_write(rt2x00dev, 2, 0x50); ++ rt2800_rfcsr_write(rt2x00dev, 3, 0x20); ++ rt2800_rfcsr_write(rt2x00dev, 4, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 5, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 6, 0x40); ++ rt2800_rfcsr_write(rt2x00dev, 7, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 8, 0x5b); ++ rt2800_rfcsr_write(rt2x00dev, 9, 0x08); ++ rt2800_rfcsr_write(rt2x00dev, 10, 0xd3); ++ rt2800_rfcsr_write(rt2x00dev, 11, 0x48); ++ rt2800_rfcsr_write(rt2x00dev, 12, 0x1a); ++ rt2800_rfcsr_write(rt2x00dev, 13, 0x12); ++ rt2800_rfcsr_write(rt2x00dev, 14, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 15, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 16, 0x00); ++ ++ /* RFCSR 17 will be initialized later based on the ++ * frequency offset stored in the EEPROM ++ */ ++ ++ rt2800_rfcsr_write(rt2x00dev, 18, 0x40); ++ rt2800_rfcsr_write(rt2x00dev, 19, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 20, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 21, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 22, 0x20); ++ rt2800_rfcsr_write(rt2x00dev, 23, 0xc0); ++ rt2800_rfcsr_write(rt2x00dev, 24, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 25, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 26, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 27, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 28, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 29, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 30, 0x10); ++ rt2800_rfcsr_write(rt2x00dev, 31, 0x80); ++ rt2800_rfcsr_write(rt2x00dev, 32, 0x80); ++ rt2800_rfcsr_write(rt2x00dev, 33, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 34, 0x20); ++ rt2800_rfcsr_write(rt2x00dev, 35, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 36, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 37, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 38, 0x86); ++ rt2800_rfcsr_write(rt2x00dev, 39, 0x23); ++ rt2800_rfcsr_write(rt2x00dev, 40, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 41, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 42, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 43, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 44, 0x93); ++ rt2800_rfcsr_write(rt2x00dev, 45, 0xbb); ++ rt2800_rfcsr_write(rt2x00dev, 46, 0x60); ++ rt2800_rfcsr_write(rt2x00dev, 47, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 48, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 49, 0x8e); ++ rt2800_rfcsr_write(rt2x00dev, 50, 0x86); ++ rt2800_rfcsr_write(rt2x00dev, 51, 0x51); ++ rt2800_rfcsr_write(rt2x00dev, 52, 0x05); ++ rt2800_rfcsr_write(rt2x00dev, 53, 0x76); ++ rt2800_rfcsr_write(rt2x00dev, 54, 0x76); ++ rt2800_rfcsr_write(rt2x00dev, 55, 0x76); ++ rt2800_rfcsr_write(rt2x00dev, 56, 0xdb); ++ rt2800_rfcsr_write(rt2x00dev, 57, 0x3e); ++ rt2800_rfcsr_write(rt2x00dev, 58, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 59, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 60, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 61, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 62, 0x00); ++ rt2800_rfcsr_write(rt2x00dev, 63, 0x00); ++ ++ /* TODO: rx filter calibration? */ ++ ++ rt2800_bbp_write(rt2x00dev, 137, 0x0f); ++ ++ rt2800_bbp_write(rt2x00dev, 163, 0x9d); ++ ++ rt2800_bbp_write(rt2x00dev, 105, 0x05); ++ ++ rt2800_bbp_write(rt2x00dev, 179, 0x02); ++ rt2800_bbp_write(rt2x00dev, 180, 0x00); ++ rt2800_bbp_write(rt2x00dev, 182, 0x40); ++ rt2800_bbp_write(rt2x00dev, 180, 0x01); ++ rt2800_bbp_write(rt2x00dev, 182, 0x9c); ++ ++ rt2800_bbp_write(rt2x00dev, 179, 0x00); ++ ++ rt2800_bbp_write(rt2x00dev, 142, 0x04); ++ rt2800_bbp_write(rt2x00dev, 143, 0x3b); ++ rt2800_bbp_write(rt2x00dev, 142, 0x06); ++ rt2800_bbp_write(rt2x00dev, 143, 0xa0); ++ rt2800_bbp_write(rt2x00dev, 142, 0x07); ++ rt2800_bbp_write(rt2x00dev, 143, 0xa1); ++ rt2800_bbp_write(rt2x00dev, 142, 0x08); ++ rt2800_bbp_write(rt2x00dev, 143, 0xa2); ++ rt2800_bbp_write(rt2x00dev, 148, 0xc8); ++ ++ if (eco == 5) { ++ rt2800_rfcsr_write(rt2x00dev, 32, 0xd8); ++ rt2800_rfcsr_write(rt2x00dev, 33, 0x32); ++ } ++ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 2); ++ rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_BP, 0); ++ rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_EN, 1); ++ rt2800_rfcsr_write(rt2x00dev, 2, rfcsr); ++ msleep(1); ++ rt2x00_set_field8(&rfcsr, RFCSR2_RESCAL_EN, 0); ++ rt2800_rfcsr_write(rt2x00dev, 2, rfcsr); ++ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 1); ++ rt2x00_set_field8(&rfcsr, RFCSR1_RF_BLOCK_EN, 1); ++ rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); ++ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 6); ++ rfcsr |= 0xc0; ++ rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); ++ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 22); ++ rfcsr |= 0x20; ++ rt2800_rfcsr_write(rt2x00dev, 22, rfcsr); ++ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 46); ++ rfcsr |= 0x20; ++ rt2800_rfcsr_write(rt2x00dev, 46, rfcsr); ++ ++ rfcsr = rt2800_rfcsr_read(rt2x00dev, 20); ++ rfcsr &= ~0xee; ++ rt2800_rfcsr_write(rt2x00dev, 20, rfcsr); ++} ++ + static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev) + { + rt2800_rf_init_calibration(rt2x00dev, 2); +@@ -8456,6 +8942,9 @@ static void rt2800_init_rfcsr(struct rt2 + case RT3390: + rt2800_init_rfcsr_3390(rt2x00dev); + break; ++ case RT3883: ++ rt2800_init_rfcsr_3883(rt2x00dev); ++ break; + case RT3572: + rt2800_init_rfcsr_3572(rt2x00dev); + break; +@@ -8661,7 +9150,8 @@ static u8 rt2800_get_txmixer_gain_24g(st + { + u16 word; + +- if (rt2x00_rt(rt2x00dev, RT3593)) ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) + return 0; + + word = rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG); +@@ -8675,7 +9165,8 @@ static u8 rt2800_get_txmixer_gain_5g(str + { + u16 word; + +- if (rt2x00_rt(rt2x00dev, RT3593)) ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) + return 0; + + word = rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_A); +@@ -8781,7 +9272,8 @@ static int rt2800_validate_eeprom(struct + word = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2); + if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10) + rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0); +- if (!rt2x00_rt(rt2x00dev, RT3593)) { ++ if (!rt2x00_rt(rt2x00dev, RT3593) && ++ !rt2x00_rt(rt2x00dev, RT3883)) { + if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 || + rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff) + rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1, +@@ -8801,7 +9293,8 @@ static int rt2800_validate_eeprom(struct + word = rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2); + if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10) + rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0); +- if (!rt2x00_rt(rt2x00dev, RT3593)) { ++ if (!rt2x00_rt(rt2x00dev, RT3593) && ++ !rt2x00_rt(rt2x00dev, RT3883)) { + if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 || + rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff) + rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2, +@@ -8809,7 +9302,8 @@ static int rt2800_validate_eeprom(struct + } + rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word); + +- if (rt2x00_rt(rt2x00dev, RT3593)) { ++ if (rt2x00_rt(rt2x00dev, RT3593) || ++ rt2x00_rt(rt2x00dev, RT3883)) { + word = rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2); + if (rt2x00_get_field16(word, EEPROM_EXT_LNA2_A1) == 0x00 || + rt2x00_get_field16(word, EEPROM_EXT_LNA2_A1) == 0xff) +@@ -8848,6 +9342,8 @@ static int rt2800_init_eeprom(struct rt2 + rf = rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID); + else if (rt2x00_rt(rt2x00dev, RT3352)) + rf = RF3322; ++ else if (rt2x00_rt(rt2x00dev, RT3883)) ++ rf = RF3853; + else if (rt2x00_rt(rt2x00dev, RT5350)) + rf = RF5350; + else +@@ -8868,6 +9364,7 @@ static int rt2800_init_eeprom(struct rt2 + case RF3290: + case RF3320: + case RF3322: ++ case RF3853: + case RF5350: + case RF5360: + case RF5362: +@@ -9154,6 +9651,66 @@ static const struct rf_channel rf_vals_3 + {14, 0xF0, 2, 0x18}, + }; + ++static const struct rf_channel rf_vals_3853[] = { ++ {1, 241, 6, 2}, ++ {2, 241, 6, 7}, ++ {3, 242, 6, 2}, ++ {4, 242, 6, 7}, ++ {5, 243, 6, 2}, ++ {6, 243, 6, 7}, ++ {7, 244, 6, 2}, ++ {8, 244, 6, 7}, ++ {9, 245, 6, 2}, ++ {10, 245, 6, 7}, ++ {11, 246, 6, 2}, ++ {12, 246, 6, 7}, ++ {13, 247, 6, 2}, ++ {14, 248, 6, 4}, ++ ++ {36, 0x56, 8, 4}, ++ {38, 0x56, 8, 6}, ++ {40, 0x56, 8, 8}, ++ {44, 0x57, 8, 0}, ++ {46, 0x57, 8, 2}, ++ {48, 0x57, 8, 4}, ++ {52, 0x57, 8, 8}, ++ {54, 0x57, 8, 10}, ++ {56, 0x58, 8, 0}, ++ {60, 0x58, 8, 4}, ++ {62, 0x58, 8, 6}, ++ {64, 0x58, 8, 8}, ++ ++ {100, 0x5b, 8, 8}, ++ {102, 0x5b, 8, 10}, ++ {104, 0x5c, 8, 0}, ++ {108, 0x5c, 8, 4}, ++ {110, 0x5c, 8, 6}, ++ {112, 0x5c, 8, 8}, ++ {114, 0x5c, 8, 10}, ++ {116, 0x5d, 8, 0}, ++ {118, 0x5d, 8, 2}, ++ {120, 0x5d, 8, 4}, ++ {124, 0x5d, 8, 8}, ++ {126, 0x5d, 8, 10}, ++ {128, 0x5e, 8, 0}, ++ {132, 0x5e, 8, 4}, ++ {134, 0x5e, 8, 6}, ++ {136, 0x5e, 8, 8}, ++ {140, 0x5f, 8, 0}, ++ ++ {149, 0x5f, 8, 9}, ++ {151, 0x5f, 8, 11}, ++ {153, 0x60, 8, 1}, ++ {157, 0x60, 8, 5}, ++ {159, 0x60, 8, 7}, ++ {161, 0x60, 8, 9}, ++ {165, 0x61, 8, 1}, ++ {167, 0x61, 8, 3}, ++ {169, 0x61, 8, 5}, ++ {171, 0x61, 8, 7}, ++ {173, 0x61, 8, 9}, ++}; ++ + static const struct rf_channel rf_vals_5592_xtal20[] = { + /* Channel, N, K, mod, R */ + {1, 482, 4, 10, 3}, +@@ -9417,6 +9974,11 @@ static int rt2800_probe_hw_mode(struct r + spec->channels = rf_vals_3x; + break; + ++ case RF3853: ++ spec->num_channels = ARRAY_SIZE(rf_vals_3853); ++ spec->channels = rf_vals_3853; ++ break; ++ + case RF5592: + reg = rt2800_register_read(rt2x00dev, MAC_DEBUG_INDEX); + if (rt2x00_get_field32(reg, MAC_DEBUG_INDEX_XTAL)) { +@@ -9536,6 +10098,7 @@ static int rt2800_probe_hw_mode(struct r + case RF3053: + case RF3070: + case RF3290: ++ case RF3853: + case RF5350: + case RF5360: + case RF5362: +@@ -9578,6 +10141,7 @@ static int rt2800_probe_rt(struct rt2x00 + case RT3390: + case RT3572: + case RT3593: ++ case RT3883: + case RT5350: + case RT5390: + case RT5392: +--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c +@@ -51,9 +51,16 @@ static bool rt2800soc_hwcrypt_disabled(s + + static void rt2800soc_disable_radio(struct rt2x00_dev *rt2x00dev) + { ++ u32 reg; ++ + rt2800_disable_radio(rt2x00dev); + rt2x00mmio_register_write(rt2x00dev, PWR_PIN_CFG, 0); +- rt2x00mmio_register_write(rt2x00dev, TX_PIN_CFG, 0); ++ ++ reg = 0; ++ if (rt2x00_rt(rt2x00dev, RT3883)) ++ rt2x00_set_field32(®, TX_PIN_CFG_RFTR_EN, 1); ++ ++ rt2x00mmio_register_write(rt2x00dev, TX_PIN_CFG, reg); + } + + static int rt2800soc_set_device_state(struct rt2x00_dev *rt2x00dev, diff --git a/package/kernel/mac80211/patches/rt2x00/060-rt2x00-allow-to-specify-watchdog-interval.patch b/package/kernel/mac80211/patches/rt2x00/060-rt2x00-allow-to-specify-watchdog-interval.patch new file mode 100644 index 00000000000000..828d3c8b2d99bf --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/060-rt2x00-allow-to-specify-watchdog-interval.patch @@ -0,0 +1,56 @@ +From 9f3e3323e9966d9f21bea0c81b1acb36c0e15cec Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Sat, 15 Jun 2019 12:00:54 +0200 +Subject: [PATCH 01/15] rt2x00: allow to specify watchdog interval + +Allow subdriver to change watchdog interval by intialize +link->watchdog_interval value before rt2x00link_register(). + +Signed-off-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt2x00.h | 1 + + drivers/net/wireless/ralink/rt2x00/rt2x00link.c | 13 +++++++++---- + 2 files changed, 10 insertions(+), 4 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -336,6 +336,7 @@ struct link { + * to bring the device/driver back into the desired state. + */ + struct delayed_work watchdog_work; ++ unsigned int watchdog_interval; + + /* + * Work structure for scheduling periodic AGC adjustments. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00link.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00link.c +@@ -398,7 +398,7 @@ void rt2x00link_start_watchdog(struct rt + rt2x00dev->ops->lib->watchdog) + ieee80211_queue_delayed_work(rt2x00dev->hw, + &link->watchdog_work, +- WATCHDOG_INTERVAL); ++ link->watchdog_interval); + } + + void rt2x00link_stop_watchdog(struct rt2x00_dev *rt2x00dev) +@@ -424,11 +424,16 @@ static void rt2x00link_watchdog(struct w + if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) + ieee80211_queue_delayed_work(rt2x00dev->hw, + &link->watchdog_work, +- WATCHDOG_INTERVAL); ++ link->watchdog_interval); + } + + void rt2x00link_register(struct rt2x00_dev *rt2x00dev) + { +- INIT_DELAYED_WORK(&rt2x00dev->link.watchdog_work, rt2x00link_watchdog); +- INIT_DELAYED_WORK(&rt2x00dev->link.work, rt2x00link_tuner); ++ struct link *link = &rt2x00dev->link; ++ ++ INIT_DELAYED_WORK(&link->work, rt2x00link_tuner); ++ INIT_DELAYED_WORK(&link->watchdog_work, rt2x00link_watchdog); ++ ++ if (link->watchdog_interval == 0) ++ link->watchdog_interval = WATCHDOG_INTERVAL; + } diff --git a/package/kernel/mac80211/patches/rt2x00/061-rt2800-add-helpers-for-reading-dma-done-index.patch b/package/kernel/mac80211/patches/rt2x00/061-rt2800-add-helpers-for-reading-dma-done-index.patch new file mode 100644 index 00000000000000..adfc5c5b5ec378 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/061-rt2800-add-helpers-for-reading-dma-done-index.patch @@ -0,0 +1,144 @@ +From 2034afe4db4a2a4f22541d7f7b426e38d2093d38 Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Sat, 15 Jun 2019 12:00:55 +0200 +Subject: [PATCH 02/15] rt2800: add helpers for reading dma done index + +For mmio we do not properlly trace dma done Q_INDEX_DMA_DONE index +for TX queues. That would require implementing INT_SOURCE_CSR_*_DMA_DONE +interrupts, what is rather not worth to do due to adding extra +CPU load (small but still somewhat not necessary otherwise). + +We can just read TX DMA done indexes from registers directly. What +will be used by watchdog. + +Signed-off-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + .../net/wireless/ralink/rt2x00/rt2800lib.h | 8 +++++ + .../net/wireless/ralink/rt2x00/rt2800mmio.c | 31 +++++++++++++++++++ + .../net/wireless/ralink/rt2x00/rt2800mmio.h | 2 ++ + .../net/wireless/ralink/rt2x00/rt2800pci.c | 1 + + .../net/wireless/ralink/rt2x00/rt2800soc.c | 1 + + .../net/wireless/ralink/rt2x00/rt2800usb.c | 9 ++++++ + 6 files changed, 52 insertions(+) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h +@@ -76,6 +76,7 @@ struct rt2800_ops { + const u8 *data, const size_t len); + int (*drv_init_registers)(struct rt2x00_dev *rt2x00dev); + __le32 *(*drv_get_txwi)(struct queue_entry *entry); ++ unsigned int (*drv_get_dma_done)(struct data_queue *queue); + }; + + static inline u32 rt2800_register_read(struct rt2x00_dev *rt2x00dev, +@@ -177,6 +178,13 @@ static inline __le32 *rt2800_drv_get_txw + return rt2800ops->drv_get_txwi(entry); + } + ++static inline unsigned int rt2800_drv_get_dma_done(struct data_queue *queue) ++{ ++ const struct rt2800_ops *rt2800ops = queue->rt2x00dev->ops->drv; ++ ++ return rt2800ops->drv_get_dma_done(queue); ++} ++ + void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev, + const u8 command, const u8 token, + const u8 arg0, const u8 arg1); +--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c +@@ -36,6 +36,37 @@ + #include "rt2800lib.h" + #include "rt2800mmio.h" + ++unsigned int rt2800mmio_get_dma_done(struct data_queue *queue) ++{ ++ struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; ++ struct queue_entry *entry; ++ int idx, qid; ++ ++ switch (queue->qid) { ++ case QID_AC_VO: ++ case QID_AC_VI: ++ case QID_AC_BE: ++ case QID_AC_BK: ++ qid = queue->qid; ++ idx = rt2x00mmio_register_read(rt2x00dev, TX_DTX_IDX(qid)); ++ break; ++ case QID_MGMT: ++ idx = rt2x00mmio_register_read(rt2x00dev, TX_DTX_IDX(5)); ++ break; ++ case QID_RX: ++ entry = rt2x00queue_get_entry(queue, Q_INDEX_DMA_DONE); ++ idx = entry->entry_idx; ++ break; ++ default: ++ WARN_ON_ONCE(1); ++ idx = 0; ++ break; ++ } ++ ++ return idx; ++} ++EXPORT_SYMBOL_GPL(rt2800mmio_get_dma_done); ++ + /* + * TX descriptor initialization + */ +--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.h +@@ -126,6 +126,8 @@ + #define RXD_W3_PLCP_SIGNAL FIELD32(0x00020000) + #define RXD_W3_PLCP_RSSI FIELD32(0x00040000) + ++unsigned int rt2800mmio_get_dma_done(struct data_queue *queue); ++ + /* TX descriptor initialization */ + __le32 *rt2800mmio_get_txwi(struct queue_entry *entry); + void rt2800mmio_write_tx_desc(struct queue_entry *entry, +--- a/drivers/net/wireless/ralink/rt2x00/rt2800pci.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800pci.c +@@ -337,6 +337,7 @@ static const struct rt2800_ops rt2800pci + .drv_write_firmware = rt2800pci_write_firmware, + .drv_init_registers = rt2800mmio_init_registers, + .drv_get_txwi = rt2800mmio_get_txwi, ++ .drv_get_dma_done = rt2800mmio_get_dma_done, + }; + + static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = { +--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c +@@ -183,6 +183,7 @@ static const struct rt2800_ops rt2800soc + .drv_write_firmware = rt2800soc_write_firmware, + .drv_init_registers = rt2800mmio_init_registers, + .drv_get_txwi = rt2800mmio_get_txwi, ++ .drv_get_dma_done = rt2800mmio_get_dma_done, + }; + + static const struct rt2x00lib_ops rt2800soc_rt2x00_ops = { +--- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c +@@ -390,6 +390,14 @@ static int rt2800usb_set_device_state(st + return retval; + } + ++static unsigned int rt2800usb_get_dma_done(struct data_queue *queue) ++{ ++ struct queue_entry *entry; ++ ++ entry = rt2x00queue_get_entry(queue, Q_INDEX_DMA_DONE); ++ return entry->entry_idx; ++} ++ + /* + * TX descriptor initialization + */ +@@ -672,6 +680,7 @@ static const struct rt2800_ops rt2800usb + .drv_write_firmware = rt2800usb_write_firmware, + .drv_init_registers = rt2800usb_init_registers, + .drv_get_txwi = rt2800usb_get_txwi, ++ .drv_get_dma_done = rt2800usb_get_dma_done, + }; + + static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = { diff --git a/package/kernel/mac80211/patches/rt2x00/062-rt2800-initial-watchdog-implementation.patch b/package/kernel/mac80211/patches/rt2x00/062-rt2800-initial-watchdog-implementation.patch new file mode 100644 index 00000000000000..24032b534b20b3 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/062-rt2800-initial-watchdog-implementation.patch @@ -0,0 +1,158 @@ +From 759c5b599cf4ddb3b56e66d459b1bf0fe2724fb8 Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Sat, 15 Jun 2019 12:00:56 +0200 +Subject: [PATCH 03/15] rt2800: initial watchdog implementation + +Add watchdog for rt2800 devices. For now it only detect hung +and print error. + +[Note: I verified that printing messages from process context is +fine on MT7620 (WT3020) platform that have problem when printk +is called from interrupt context]. + +Signed-off-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + .../net/wireless/ralink/rt2x00/rt2800lib.c | 56 +++++++++++++++++++ + .../net/wireless/ralink/rt2x00/rt2800lib.h | 2 + + .../net/wireless/ralink/rt2x00/rt2800pci.c | 1 + + .../net/wireless/ralink/rt2x00/rt2800soc.c | 1 + + .../net/wireless/ralink/rt2x00/rt2800usb.c | 1 + + .../net/wireless/ralink/rt2x00/rt2x00queue.h | 6 ++ + 6 files changed, 67 insertions(+) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -1223,6 +1223,60 @@ void rt2800_txdone_nostatus(struct rt2x0 + } + EXPORT_SYMBOL_GPL(rt2800_txdone_nostatus); + ++static int rt2800_check_hung(struct data_queue *queue) ++{ ++ unsigned int cur_idx = rt2800_drv_get_dma_done(queue); ++ ++ if (queue->wd_idx != cur_idx) ++ queue->wd_count = 0; ++ else ++ queue->wd_count++; ++ ++ return queue->wd_count > 16; ++} ++ ++void rt2800_watchdog(struct rt2x00_dev *rt2x00dev) ++{ ++ struct data_queue *queue; ++ bool hung_tx = false; ++ bool hung_rx = false; ++ ++ if (test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) ++ return; ++ ++ queue_for_each(rt2x00dev, queue) { ++ switch (queue->qid) { ++ case QID_AC_VO: ++ case QID_AC_VI: ++ case QID_AC_BE: ++ case QID_AC_BK: ++ case QID_MGMT: ++ if (rt2x00queue_empty(queue)) ++ continue; ++ hung_tx = rt2800_check_hung(queue); ++ break; ++ case QID_RX: ++ /* For station mode we should reactive at least ++ * beacons. TODO: need to find good way detect ++ * RX hung for AP mode. ++ */ ++ if (rt2x00dev->intf_sta_count == 0) ++ continue; ++ hung_rx = rt2800_check_hung(queue); ++ break; ++ default: ++ break; ++ } ++ } ++ ++ if (hung_tx) ++ rt2x00_warn(rt2x00dev, "Watchdog TX hung detected\n"); ++ ++ if (hung_rx) ++ rt2x00_warn(rt2x00dev, "Watchdog RX hung detected\n"); ++} ++EXPORT_SYMBOL_GPL(rt2800_watchdog); ++ + static unsigned int rt2800_hw_beacon_base(struct rt2x00_dev *rt2x00dev, + unsigned int index) + { +@@ -10222,6 +10276,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r + __set_bit(REQUIRE_TASKLET_CONTEXT, &rt2x00dev->cap_flags); + } + ++ rt2x00dev->link.watchdog_interval = msecs_to_jiffies(100); ++ + /* + * Set the rssi offset. + */ +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h +@@ -208,6 +208,8 @@ void rt2800_txdone_nostatus(struct rt2x0 + bool rt2800_txstatus_timeout(struct rt2x00_dev *rt2x00dev); + bool rt2800_txstatus_pending(struct rt2x00_dev *rt2x00dev); + ++void rt2800_watchdog(struct rt2x00_dev *rt2x00dev); ++ + void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc); + void rt2800_clear_beacon(struct queue_entry *entry); + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800pci.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800pci.c +@@ -362,6 +362,7 @@ static const struct rt2x00lib_ops rt2800 + .link_tuner = rt2800_link_tuner, + .gain_calibration = rt2800_gain_calibration, + .vco_calibration = rt2800_vco_calibration, ++ .watchdog = rt2800_watchdog, + .start_queue = rt2800mmio_start_queue, + .kick_queue = rt2800mmio_kick_queue, + .stop_queue = rt2800mmio_stop_queue, +--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c +@@ -208,6 +208,7 @@ static const struct rt2x00lib_ops rt2800 + .link_tuner = rt2800_link_tuner, + .gain_calibration = rt2800_gain_calibration, + .vco_calibration = rt2800_vco_calibration, ++ .watchdog = rt2800_watchdog, + .start_queue = rt2800mmio_start_queue, + .kick_queue = rt2800mmio_kick_queue, + .stop_queue = rt2800mmio_stop_queue, +--- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c +@@ -698,6 +698,7 @@ static const struct rt2x00lib_ops rt2800 + .link_tuner = rt2800_link_tuner, + .gain_calibration = rt2800_gain_calibration, + .vco_calibration = rt2800_vco_calibration, ++ .watchdog = rt2800_watchdog, + .start_queue = rt2800usb_start_queue, + .kick_queue = rt2x00usb_kick_queue, + .stop_queue = rt2800usb_stop_queue, +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h +@@ -446,6 +446,9 @@ enum data_queue_flags { + * @length: Number of frames in queue. + * @index: Index pointers to entry positions in the queue, + * use &enum queue_index to get a specific index field. ++ * @wd_count: watchdog counter number of times entry does change ++ * in the queue ++ * @wd_idx: index of queue entry saved by watchdog + * @txop: maximum burst time. + * @aifs: The aifs value for outgoing frames (field ignored in RX queue). + * @cw_min: The cw min value for outgoing frames (field ignored in RX queue). +@@ -473,6 +476,9 @@ struct data_queue { + unsigned short length; + unsigned short index[Q_INDEX_MAX]; + ++ unsigned short wd_count; ++ unsigned int wd_idx; ++ + unsigned short txop; + unsigned short aifs; + unsigned short cw_min; diff --git a/package/kernel/mac80211/patches/rt2x00/063-rt2800-add-pre_reset_hw-callback.patch b/package/kernel/mac80211/patches/rt2x00/063-rt2800-add-pre_reset_hw-callback.patch new file mode 100644 index 00000000000000..f7d3c32ee65442 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/063-rt2800-add-pre_reset_hw-callback.patch @@ -0,0 +1,96 @@ +From 09db3b000619b38d504e1fff66efed33dfacb6c0 Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Sat, 15 Jun 2019 12:00:57 +0200 +Subject: [PATCH 04/15] rt2800: add pre_reset_hw callback + +Add routine to cleanup interfaces data before hw reset as +ieee80211_restart_hw() will do setup interfaces again. + +Signed-off-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + .../net/wireless/ralink/rt2x00/rt2800lib.c | 19 +++++++++++++++++++ + .../net/wireless/ralink/rt2x00/rt2800lib.h | 1 + + .../net/wireless/ralink/rt2x00/rt2800pci.c | 1 + + .../net/wireless/ralink/rt2x00/rt2800soc.c | 1 + + .../net/wireless/ralink/rt2x00/rt2800usb.c | 1 + + drivers/net/wireless/ralink/rt2x00/rt2x00.h | 1 + + 6 files changed, 24 insertions(+) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -1854,6 +1854,25 @@ int rt2800_sta_remove(struct ieee80211_h + } + EXPORT_SYMBOL_GPL(rt2800_sta_remove); + ++void rt2800_pre_reset_hw(struct rt2x00_dev *rt2x00dev) ++{ ++ struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; ++ struct data_queue *queue = rt2x00dev->bcn; ++ struct queue_entry *entry; ++ int i, wcid; ++ ++ for (wcid = WCID_START; wcid < WCID_END; wcid++) { ++ drv_data->wcid_to_sta[wcid - WCID_START] = NULL; ++ __clear_bit(wcid - WCID_START, drv_data->sta_ids); ++ } ++ ++ for (i = 0; i < queue->limit; i++) { ++ entry = &queue->entries[i]; ++ clear_bit(ENTRY_BCN_ASSIGNED, &entry->flags); ++ } ++} ++EXPORT_SYMBOL_GPL(rt2800_pre_reset_hw); ++ + void rt2800_config_filter(struct rt2x00_dev *rt2x00dev, + const unsigned int filter_flags) + { +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h +@@ -268,5 +268,6 @@ void rt2800_disable_wpdma(struct rt2x00_ + void rt2800_get_txwi_rxwi_size(struct rt2x00_dev *rt2x00dev, + unsigned short *txwi_size, + unsigned short *rxwi_size); ++void rt2800_pre_reset_hw(struct rt2x00_dev *rt2x00dev); + + #endif /* RT2800LIB_H */ +--- a/drivers/net/wireless/ralink/rt2x00/rt2800pci.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800pci.c +@@ -379,6 +379,7 @@ static const struct rt2x00lib_ops rt2800 + .config_erp = rt2800_config_erp, + .config_ant = rt2800_config_ant, + .config = rt2800_config, ++ .pre_reset_hw = rt2800_pre_reset_hw, + }; + + static const struct rt2x00_ops rt2800pci_ops = { +--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c +@@ -225,6 +225,7 @@ static const struct rt2x00lib_ops rt2800 + .config_erp = rt2800_config_erp, + .config_ant = rt2800_config_ant, + .config = rt2800_config, ++ .pre_reset_hw = rt2800_pre_reset_hw, + }; + + static const struct rt2x00_ops rt2800soc_ops = { +--- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c +@@ -717,6 +717,7 @@ static const struct rt2x00lib_ops rt2800 + .config_erp = rt2800_config_erp, + .config_ant = rt2800_config_ant, + .config = rt2800_config, ++ .pre_reset_hw = rt2800_pre_reset_hw, + }; + + static void rt2800usb_queue_init(struct data_queue *queue) +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -627,6 +627,7 @@ struct rt2x00lib_ops { + void (*config) (struct rt2x00_dev *rt2x00dev, + struct rt2x00lib_conf *libconf, + const unsigned int changed_flags); ++ void (*pre_reset_hw) (struct rt2x00_dev *rt2x00dev); + int (*sta_add) (struct rt2x00_dev *rt2x00dev, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta); diff --git a/package/kernel/mac80211/patches/rt2x00/064-rt2800-do-not-nullify-initialization-vector-data.patch b/package/kernel/mac80211/patches/rt2x00/064-rt2800-do-not-nullify-initialization-vector-data.patch new file mode 100644 index 00000000000000..df34bfffae2149 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/064-rt2800-do-not-nullify-initialization-vector-data.patch @@ -0,0 +1,51 @@ +From 710e6cc1595e25378c4b9977f7a8b4ad4a72a109 Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Sat, 15 Jun 2019 12:00:58 +0200 +Subject: [PATCH 05/15] rt2800: do not nullify initialization vector data + +If we restart hw we should keep existing IV (initialization vector) +otherwise HW encryption will be broken after restart. + +Also fix some coding style issues on the way. + +Signed-off-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -1658,14 +1658,15 @@ static void rt2800_config_wcid_attr_ciph + + offset = MAC_IVEIV_ENTRY(key->hw_key_idx); + +- memset(&iveiv_entry, 0, sizeof(iveiv_entry)); ++ rt2800_register_multiread(rt2x00dev, offset, ++ &iveiv_entry, sizeof(iveiv_entry)); + if ((crypto->cipher == CIPHER_TKIP) || + (crypto->cipher == CIPHER_TKIP_NO_MIC) || + (crypto->cipher == CIPHER_AES)) + iveiv_entry.iv[3] |= 0x20; + iveiv_entry.iv[3] |= key->keyidx << 6; + rt2800_register_multiwrite(rt2x00dev, offset, +- &iveiv_entry, sizeof(iveiv_entry)); ++ &iveiv_entry, sizeof(iveiv_entry)); + } + + int rt2800_config_shared_key(struct rt2x00_dev *rt2x00dev, +@@ -6090,13 +6091,11 @@ static int rt2800_init_registers(struct + * ASIC will keep garbage value after boot, clear encryption keys. + */ + for (i = 0; i < 4; i++) +- rt2800_register_write(rt2x00dev, +- SHARED_KEY_MODE_ENTRY(i), 0); ++ rt2800_register_write(rt2x00dev, SHARED_KEY_MODE_ENTRY(i), 0); + + for (i = 0; i < 256; i++) { + rt2800_config_wcid(rt2x00dev, NULL, i); + rt2800_delete_wcid_attr(rt2x00dev, i); +- rt2800_register_write(rt2x00dev, MAC_IVEIV_ENTRY(i), 0); + } + + /* diff --git a/package/kernel/mac80211/patches/rt2x00/065-rt2x00-add-restart-hw.patch b/package/kernel/mac80211/patches/rt2x00/065-rt2x00-add-restart-hw.patch new file mode 100644 index 00000000000000..225aed16c4b3fe --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/065-rt2x00-add-restart-hw.patch @@ -0,0 +1,151 @@ +From e403fa31ed71e87de8e5991e23406b8377c9c894 Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Sat, 15 Jun 2019 12:00:59 +0200 +Subject: [PATCH 06/15] rt2x00: add restart hw + +Add ieee80211_restart_hw() to watchdog and debugfs file for testing +if restart works as expected. + +Signed-off-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + .../net/wireless/ralink/rt2x00/rt2800lib.c | 4 +++ + drivers/net/wireless/ralink/rt2x00/rt2x00.h | 7 ++++ + .../net/wireless/ralink/rt2x00/rt2x00debug.c | 35 +++++++++++++++++++ + .../net/wireless/ralink/rt2x00/rt2x00dev.c | 10 ++++-- + 4 files changed, 54 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -1274,6 +1274,9 @@ void rt2800_watchdog(struct rt2x00_dev * + + if (hung_rx) + rt2x00_warn(rt2x00dev, "Watchdog RX hung detected\n"); ++ ++ if (hung_tx || hung_rx) ++ ieee80211_restart_hw(rt2x00dev->hw); + } + EXPORT_SYMBOL_GPL(rt2800_watchdog); + +@@ -10294,6 +10297,7 @@ int rt2800_probe_hw(struct rt2x00_dev *r + __set_bit(REQUIRE_TASKLET_CONTEXT, &rt2x00dev->cap_flags); + } + ++ __set_bit(CAPABILITY_RESTART_HW, &rt2x00dev->cap_flags); + rt2x00dev->link.watchdog_interval = msecs_to_jiffies(100); + + /* +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -723,6 +723,7 @@ enum rt2x00_capability_flags { + CAPABILITY_VCO_RECALIBRATION, + CAPABILITY_EXTERNAL_PA_TX0, + CAPABILITY_EXTERNAL_PA_TX1, ++ CAPABILITY_RESTART_HW, + }; + + /* +@@ -1279,6 +1280,12 @@ rt2x00_has_cap_vco_recalibration(struct + return rt2x00_has_cap_flag(rt2x00dev, CAPABILITY_VCO_RECALIBRATION); + } + ++static inline bool ++rt2x00_has_cap_restart_hw(struct rt2x00_dev *rt2x00dev) ++{ ++ return rt2x00_has_cap_flag(rt2x00dev, CAPABILITY_RESTART_HW); ++} ++ + /** + * rt2x00queue_map_txskb - Map a skb into DMA for TX purposes. + * @entry: Pointer to &struct queue_entry +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c +@@ -63,6 +63,7 @@ struct rt2x00debug_intf { + * - chipset file + * - device state flags file + * - device capability flags file ++ * - hardware restart file + * - register folder + * - csr offset/value files + * - eeprom offset/value files +@@ -79,6 +80,7 @@ struct rt2x00debug_intf { + struct dentry *chipset_entry; + struct dentry *dev_flags; + struct dentry *cap_flags; ++ struct dentry *restart_hw; + struct dentry *register_folder; + struct dentry *csr_off_entry; + struct dentry *csr_val_entry; +@@ -577,6 +579,34 @@ static const struct file_operations rt2x + .llseek = default_llseek, + }; + ++static ssize_t rt2x00debug_write_restart_hw(struct file *file, ++ const char __user *buf, ++ size_t length, ++ loff_t *offset) ++{ ++ struct rt2x00debug_intf *intf = file->private_data; ++ struct rt2x00_dev *rt2x00dev = intf->rt2x00dev; ++ static unsigned long last_reset; ++ ++ if (!rt2x00_has_cap_restart_hw(rt2x00dev)) ++ return -EOPNOTSUPP; ++ ++ if (time_before(jiffies, last_reset + msecs_to_jiffies(2000))) ++ return -EBUSY; ++ ++ last_reset = jiffies; ++ ++ ieee80211_restart_hw(rt2x00dev->hw); ++ return length; ++} ++ ++static const struct file_operations rt2x00debug_restart_hw = { ++ .owner = THIS_MODULE, ++ .write = rt2x00debug_write_restart_hw, ++ .open = simple_open, ++ .llseek = generic_file_llseek, ++}; ++ + static struct dentry *rt2x00debug_create_file_driver(const char *name, + struct rt2x00debug_intf + *intf, +@@ -672,6 +702,10 @@ void rt2x00debug_register(struct rt2x00_ + intf->driver_folder, intf, + &rt2x00debug_fop_cap_flags); + ++ intf->restart_hw = debugfs_create_file("restart_hw", 0200, ++ intf->driver_folder, intf, ++ &rt2x00debug_restart_hw); ++ + intf->register_folder = + debugfs_create_dir("register", intf->driver_folder); + +@@ -753,6 +787,7 @@ void rt2x00debug_deregister(struct rt2x0 + debugfs_remove(intf->csr_off_entry); + debugfs_remove(intf->register_folder); + debugfs_remove(intf->dev_flags); ++ debugfs_remove(intf->restart_hw); + debugfs_remove(intf->cap_flags); + debugfs_remove(intf->chipset_entry); + debugfs_remove(intf->driver_entry); +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +@@ -1269,8 +1269,14 @@ int rt2x00lib_start(struct rt2x00_dev *r + { + int retval; + +- if (test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) +- return 0; ++ if (test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) { ++ /* ++ * This is special case for ieee80211_restart_hw(), otherwise ++ * mac80211 never call start() two times in row without stop(); ++ */ ++ rt2x00dev->ops->lib->pre_reset_hw(rt2x00dev); ++ rt2x00lib_stop(rt2x00dev); ++ } + + /* + * If this is the first interface which is added, diff --git a/package/kernel/mac80211/patches/rt2x00/066-rt2800-do-not-enable-watchdog-by-default.patch b/package/kernel/mac80211/patches/rt2x00/066-rt2800-do-not-enable-watchdog-by-default.patch new file mode 100644 index 00000000000000..37e03dbb5241a8 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/066-rt2800-do-not-enable-watchdog-by-default.patch @@ -0,0 +1,71 @@ +From 0f47aeeada2a1fe296258eab9a08ced258009481 Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Sat, 15 Jun 2019 12:01:00 +0200 +Subject: [PATCH 07/15] rt2800: do not enable watchdog by default + +Make watchdog disabled by default and add module parameter to enable it. + +User will have to create file in /etc/modprobe.d/ with + +options rt2800lib watchdog=1 + +to enable the watchdog or load "rt2800lib watchdog=1" module manually +before loading rt2800{soc,pci,usb} module. + +Signed-off-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 12 ++++++++++-- + drivers/net/wireless/ralink/rt2x00/rt2x00.h | 1 + + drivers/net/wireless/ralink/rt2x00/rt2x00link.c | 2 +- + 3 files changed, 12 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -41,6 +41,10 @@ + #include "rt2800lib.h" + #include "rt2800.h" + ++static bool modparam_watchdog; ++module_param_named(watchdog, modparam_watchdog, bool, S_IRUGO); ++MODULE_PARM_DESC(watchdog, "Enable watchdog to detect tx/rx hangs and reset hardware if detected"); ++ + /* + * Register access. + * All access to the CSR registers will go through the methods +@@ -10297,8 +10301,12 @@ int rt2800_probe_hw(struct rt2x00_dev *r + __set_bit(REQUIRE_TASKLET_CONTEXT, &rt2x00dev->cap_flags); + } + +- __set_bit(CAPABILITY_RESTART_HW, &rt2x00dev->cap_flags); +- rt2x00dev->link.watchdog_interval = msecs_to_jiffies(100); ++ if (modparam_watchdog) { ++ __set_bit(CAPABILITY_RESTART_HW, &rt2x00dev->cap_flags); ++ rt2x00dev->link.watchdog_interval = msecs_to_jiffies(100); ++ } else { ++ rt2x00dev->link.watchdog_disabled = true; ++ } + + /* + * Set the rssi offset. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -337,6 +337,7 @@ struct link { + */ + struct delayed_work watchdog_work; + unsigned int watchdog_interval; ++ bool watchdog_disabled; + + /* + * Work structure for scheduling periodic AGC adjustments. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00link.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00link.c +@@ -395,7 +395,7 @@ void rt2x00link_start_watchdog(struct rt + struct link *link = &rt2x00dev->link; + + if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) && +- rt2x00dev->ops->lib->watchdog) ++ rt2x00dev->ops->lib->watchdog && !link->watchdog_disabled) + ieee80211_queue_delayed_work(rt2x00dev->hw, + &link->watchdog_work, + link->watchdog_interval); diff --git a/package/kernel/mac80211/patches/rt2x00/067-rt2x00usb-fix-rx-queue-hang.patch b/package/kernel/mac80211/patches/rt2x00/067-rt2x00usb-fix-rx-queue-hang.patch new file mode 100644 index 00000000000000..62505cd53b2030 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/067-rt2x00usb-fix-rx-queue-hang.patch @@ -0,0 +1,67 @@ +From 41a531ffa4c5aeb062f892227c00fabb3b4a9c91 Mon Sep 17 00:00:00 2001 +From: Soeren Moch +Date: Mon, 1 Jul 2019 12:53:13 +0200 +Subject: [PATCH 08/15] rt2x00usb: fix rx queue hang + +Since commit ed194d136769 ("usb: core: remove local_irq_save() around + ->complete() handler") the handler rt2x00usb_interrupt_rxdone() is +not running with interrupts disabled anymore. So this completion handler +is not guaranteed to run completely before workqueue processing starts +for the same queue entry. +Be sure to set all other flags in the entry correctly before marking +this entry ready for workqueue processing. This way we cannot miss error +conditions that need to be signalled from the completion handler to the +worker thread. +Note that rt2x00usb_work_rxdone() processes all available entries, not +only such for which queue_work() was called. + +This patch is similar to what commit df71c9cfceea ("rt2x00: fix order +of entry flags modification") did for TX processing. + +This fixes a regression on a RT5370 based wifi stick in AP mode, which +suddenly stopped data transmission after some period of heavy load. Also +stopping the hanging hostapd resulted in the error message "ieee80211 +phy0: rt2x00queue_flush_queue: Warning - Queue 14 failed to flush". +Other operation modes are probably affected as well, this just was +the used testcase. + +Fixes: ed194d136769 ("usb: core: remove local_irq_save() around ->complete() handler") +Cc: stable@vger.kernel.org # 4.20+ +Signed-off-by: Soeren Moch +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c +@@ -383,15 +383,10 @@ static void rt2x00usb_interrupt_rxdone(s + struct queue_entry *entry = (struct queue_entry *)urb->context; + struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; + +- if (!test_and_clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) ++ if (!test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) + return; + + /* +- * Report the frame as DMA done +- */ +- rt2x00lib_dmadone(entry); +- +- /* + * Check if the received data is simply too small + * to be actually valid, or if the urb is signaling + * a problem. +@@ -400,6 +395,11 @@ static void rt2x00usb_interrupt_rxdone(s + set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); + + /* ++ * Report the frame as DMA done ++ */ ++ rt2x00lib_dmadone(entry); ++ ++ /* + * Schedule the delayed work for reading the RX status + * from the device. + */ diff --git a/package/kernel/mac80211/patches/rt2x00/068-rt2x00usb-remove-unnecessary-rx-flag-checks.patch b/package/kernel/mac80211/patches/rt2x00/068-rt2x00usb-remove-unnecessary-rx-flag-checks.patch new file mode 100644 index 00000000000000..3fa5ee6d38a3a5 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/068-rt2x00usb-remove-unnecessary-rx-flag-checks.patch @@ -0,0 +1,51 @@ +From 3b902fa811cf6bf7f9ad0ffb77d0a133e0b3bd61 Mon Sep 17 00:00:00 2001 +From: Soeren Moch +Date: Mon, 1 Jul 2019 12:53:14 +0200 +Subject: [PATCH 09/15] rt2x00usb: remove unnecessary rx flag checks + +In contrast to the TX path, there is no need to separately read the transfer +status from the device after receiving RX data. Consequently, there is no +real STATUS_PENDING RX processing queue entry state. +Remove the unnecessary ENTRY_DATA_STATUS_PENDING flag checks from the RX path. +Also remove the misleading comment about reading RX status from device. + +Suggested-by: Stanislaw Gruszka +Signed-off-by: Soeren Moch +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt2x00usb.c | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c +@@ -360,8 +360,7 @@ static void rt2x00usb_work_rxdone(struct + while (!rt2x00queue_empty(rt2x00dev->rx)) { + entry = rt2x00queue_get_entry(rt2x00dev->rx, Q_INDEX_DONE); + +- if (test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) || +- !test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) ++ if (test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) + break; + + /* +@@ -400,8 +399,7 @@ static void rt2x00usb_interrupt_rxdone(s + rt2x00lib_dmadone(entry); + + /* +- * Schedule the delayed work for reading the RX status +- * from the device. ++ * Schedule the delayed work for processing RX data + */ + queue_work(rt2x00dev->workqueue, &rt2x00dev->rxdone_work); + } +@@ -413,8 +411,7 @@ static bool rt2x00usb_kick_rx_entry(stru + struct queue_entry_priv_usb *entry_priv = entry->priv_data; + int status; + +- if (test_and_set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) || +- test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) ++ if (test_and_set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) + return false; + + rt2x00lib_dmastart(entry); diff --git a/package/kernel/mac80211/patches/rt2x00/069-rt2x00-no-need-to-check-return-value-of-debugfs_crea.patch b/package/kernel/mac80211/patches/rt2x00/069-rt2x00-no-need-to-check-return-value-of-debugfs_crea.patch new file mode 100644 index 00000000000000..d83f9b46c65779 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/069-rt2x00-no-need-to-check-return-value-of-debugfs_crea.patch @@ -0,0 +1,248 @@ +From 1dc244064c47d6df7925ca0895f8365e68d3abd1 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Wed, 3 Jul 2019 13:39:56 +0200 +Subject: [PATCH 10/15] rt2x00: no need to check return value of debugfs_create + functions + +When calling debugfs functions, there is no need to ever check the +return value. The function can work or not, but the code logic should +never do something different based on this. + +Because we don't need to save the individual debugfs files and +directories, remove the local storage of them and just remove the entire +debugfs directory in a single call, making things a lot simpler. + +Cc: Stanislaw Gruszka +Cc: Helmut Schaa +Cc: Kalle Valo +Cc: "David S. Miller" +Cc: linux-wireless@vger.kernel.org +Cc: netdev@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + .../net/wireless/ralink/rt2x00/rt2x00debug.c | 136 +++++------------- + 1 file changed, 35 insertions(+), 101 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c +@@ -76,26 +76,6 @@ struct rt2x00debug_intf { + * - crypto stats file + */ + struct dentry *driver_folder; +- struct dentry *driver_entry; +- struct dentry *chipset_entry; +- struct dentry *dev_flags; +- struct dentry *cap_flags; +- struct dentry *restart_hw; +- struct dentry *register_folder; +- struct dentry *csr_off_entry; +- struct dentry *csr_val_entry; +- struct dentry *eeprom_off_entry; +- struct dentry *eeprom_val_entry; +- struct dentry *bbp_off_entry; +- struct dentry *bbp_val_entry; +- struct dentry *rf_off_entry; +- struct dentry *rf_val_entry; +- struct dentry *rfcsr_off_entry; +- struct dentry *rfcsr_val_entry; +- struct dentry *queue_folder; +- struct dentry *queue_frame_dump_entry; +- struct dentry *queue_stats_entry; +- struct dentry *crypto_stats_entry; + + /* + * The frame dump file only allows a single reader, +@@ -607,39 +587,34 @@ static const struct file_operations rt2x + .llseek = generic_file_llseek, + }; + +-static struct dentry *rt2x00debug_create_file_driver(const char *name, +- struct rt2x00debug_intf +- *intf, +- struct debugfs_blob_wrapper +- *blob) ++static void rt2x00debug_create_file_driver(const char *name, ++ struct rt2x00debug_intf *intf, ++ struct debugfs_blob_wrapper *blob) + { + char *data; + + data = kzalloc(3 * MAX_LINE_LENGTH, GFP_KERNEL); + if (!data) +- return NULL; ++ return; + + blob->data = data; + data += sprintf(data, "driver:\t%s\n", intf->rt2x00dev->ops->name); + data += sprintf(data, "version:\t%s\n", DRV_VERSION); + blob->size = strlen(blob->data); + +- return debugfs_create_blob(name, 0400, intf->driver_folder, blob); ++ debugfs_create_blob(name, 0400, intf->driver_folder, blob); + } + +-static struct dentry *rt2x00debug_create_file_chipset(const char *name, +- struct rt2x00debug_intf +- *intf, +- struct +- debugfs_blob_wrapper +- *blob) ++static void rt2x00debug_create_file_chipset(const char *name, ++ struct rt2x00debug_intf *intf, ++ struct debugfs_blob_wrapper *blob) + { + const struct rt2x00debug *debug = intf->debug; + char *data; + + data = kzalloc(9 * MAX_LINE_LENGTH, GFP_KERNEL); + if (!data) +- return NULL; ++ return; + + blob->data = data; + data += sprintf(data, "rt chip:\t%04x\n", intf->rt2x00dev->chip.rt); +@@ -665,13 +640,15 @@ static struct dentry *rt2x00debug_create + + blob->size = strlen(blob->data); + +- return debugfs_create_blob(name, 0400, intf->driver_folder, blob); ++ debugfs_create_blob(name, 0400, intf->driver_folder, blob); + } + + void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) + { + const struct rt2x00debug *debug = rt2x00dev->ops->debugfs; + struct rt2x00debug_intf *intf; ++ struct dentry *queue_folder; ++ struct dentry *register_folder; + + intf = kzalloc(sizeof(struct rt2x00debug_intf), GFP_KERNEL); + if (!intf) { +@@ -687,43 +664,27 @@ void rt2x00debug_register(struct rt2x00_ + debugfs_create_dir(intf->rt2x00dev->ops->name, + rt2x00dev->hw->wiphy->debugfsdir); + +- intf->driver_entry = +- rt2x00debug_create_file_driver("driver", intf, &intf->driver_blob); +- +- intf->chipset_entry = +- rt2x00debug_create_file_chipset("chipset", +- intf, &intf->chipset_blob); +- +- intf->dev_flags = debugfs_create_file("dev_flags", 0400, +- intf->driver_folder, intf, +- &rt2x00debug_fop_dev_flags); +- +- intf->cap_flags = debugfs_create_file("cap_flags", 0400, +- intf->driver_folder, intf, +- &rt2x00debug_fop_cap_flags); +- +- intf->restart_hw = debugfs_create_file("restart_hw", 0200, +- intf->driver_folder, intf, +- &rt2x00debug_restart_hw); ++ rt2x00debug_create_file_driver("driver", intf, &intf->driver_blob); ++ rt2x00debug_create_file_chipset("chipset", intf, &intf->chipset_blob); ++ debugfs_create_file("dev_flags", 0400, intf->driver_folder, intf, ++ &rt2x00debug_fop_dev_flags); ++ debugfs_create_file("cap_flags", 0400, intf->driver_folder, intf, ++ &rt2x00debug_fop_cap_flags); ++ debugfs_create_file("restart_hw", 0200, intf->driver_folder, intf, ++ &rt2x00debug_restart_hw); + +- intf->register_folder = +- debugfs_create_dir("register", intf->driver_folder); ++ register_folder = debugfs_create_dir("register", intf->driver_folder); + + #define RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(__intf, __name) \ + ({ \ + if (debug->__name.read) { \ +- (__intf)->__name##_off_entry = \ +- debugfs_create_u32(__stringify(__name) "_offset", \ +- 0600, \ +- (__intf)->register_folder, \ +- &(__intf)->offset_##__name); \ ++ debugfs_create_u32(__stringify(__name) "_offset", 0600, \ ++ register_folder, \ ++ &(__intf)->offset_##__name); \ + \ +- (__intf)->__name##_val_entry = \ +- debugfs_create_file(__stringify(__name) "_value", \ +- 0600, \ +- (__intf)->register_folder, \ +- (__intf), \ +- &rt2x00debug_fop_##__name); \ ++ debugfs_create_file(__stringify(__name) "_value", 0600, \ ++ register_folder, (__intf), \ ++ &rt2x00debug_fop_##__name); \ + } \ + }) + +@@ -735,26 +696,21 @@ void rt2x00debug_register(struct rt2x00_ + + #undef RT2X00DEBUGFS_CREATE_REGISTER_ENTRY + +- intf->queue_folder = +- debugfs_create_dir("queue", intf->driver_folder); ++ queue_folder = debugfs_create_dir("queue", intf->driver_folder); + +- intf->queue_frame_dump_entry = +- debugfs_create_file("dump", 0400, intf->queue_folder, +- intf, &rt2x00debug_fop_queue_dump); ++ debugfs_create_file("dump", 0400, queue_folder, intf, ++ &rt2x00debug_fop_queue_dump); + + skb_queue_head_init(&intf->frame_dump_skbqueue); + init_waitqueue_head(&intf->frame_dump_waitqueue); + +- intf->queue_stats_entry = +- debugfs_create_file("queue", 0400, intf->queue_folder, +- intf, &rt2x00debug_fop_queue_stats); ++ debugfs_create_file("queue", 0400, queue_folder, intf, ++ &rt2x00debug_fop_queue_stats); + + #ifdef CPTCFG_RT2X00_LIB_CRYPTO + if (rt2x00_has_cap_hw_crypto(rt2x00dev)) +- intf->crypto_stats_entry = +- debugfs_create_file("crypto", 0444, intf->queue_folder, +- intf, +- &rt2x00debug_fop_crypto_stats); ++ debugfs_create_file("crypto", 0444, queue_folder, intf, ++ &rt2x00debug_fop_crypto_stats); + #endif + + return; +@@ -769,31 +725,7 @@ void rt2x00debug_deregister(struct rt2x0 + + skb_queue_purge(&intf->frame_dump_skbqueue); + +-#ifdef CPTCFG_RT2X00_LIB_CRYPTO +- debugfs_remove(intf->crypto_stats_entry); +-#endif +- debugfs_remove(intf->queue_stats_entry); +- debugfs_remove(intf->queue_frame_dump_entry); +- debugfs_remove(intf->queue_folder); +- debugfs_remove(intf->rfcsr_val_entry); +- debugfs_remove(intf->rfcsr_off_entry); +- debugfs_remove(intf->rf_val_entry); +- debugfs_remove(intf->rf_off_entry); +- debugfs_remove(intf->bbp_val_entry); +- debugfs_remove(intf->bbp_off_entry); +- debugfs_remove(intf->eeprom_val_entry); +- debugfs_remove(intf->eeprom_off_entry); +- debugfs_remove(intf->csr_val_entry); +- debugfs_remove(intf->csr_off_entry); +- debugfs_remove(intf->register_folder); +- debugfs_remove(intf->dev_flags); +- debugfs_remove(intf->restart_hw); +- debugfs_remove(intf->cap_flags); +- debugfs_remove(intf->chipset_entry); +- debugfs_remove(intf->driver_entry); +- debugfs_remove(intf->driver_folder); +- kfree(intf->chipset_blob.data); +- kfree(intf->driver_blob.data); ++ debugfs_remove_recursive(intf->driver_folder); + kfree(intf); + + rt2x00dev->debugfs_intf = NULL; diff --git a/package/kernel/mac80211/patches/rt2x00/070-rt2800usb-Add-new-rt2800usb-device-PLANEX-GW-USMicro.patch b/package/kernel/mac80211/patches/rt2x00/070-rt2800usb-Add-new-rt2800usb-device-PLANEX-GW-USMicro.patch new file mode 100644 index 00000000000000..29fb43541e7c55 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/070-rt2800usb-Add-new-rt2800usb-device-PLANEX-GW-USMicro.patch @@ -0,0 +1,29 @@ +From 706f0182b1add0fc41a8c40662f659b7426f0629 Mon Sep 17 00:00:00 2001 +From: Masanari Iida +Date: Sun, 28 Jul 2019 23:07:42 +0900 +Subject: [PATCH 11/15] rt2800usb: Add new rt2800usb device PLANEX GW-USMicroN + +This patch add a device ID for PLANEX GW-USMicroN. +Without this patch, I had to echo the device IDs in order to +recognize the device. + +# lsusb |grep PLANEX +Bus 002 Device 005: ID 2019:ed14 PLANEX GW-USMicroN + +Signed-off-by: Masanari Iida +Acked-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt2800usb.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c +@@ -1097,6 +1097,7 @@ static const struct usb_device_id rt2800 + { USB_DEVICE(0x0846, 0x9013) }, + { USB_DEVICE(0x0846, 0x9019) }, + /* Planex */ ++ { USB_DEVICE(0x2019, 0xed14) }, + { USB_DEVICE(0x2019, 0xed19) }, + /* Ralink */ + { USB_DEVICE(0x148f, 0x3573) }, diff --git a/package/kernel/mac80211/patches/rt2x00/071-rt2x00-clear-IV-s-on-start-to-fix-AP-mode-regression.patch b/package/kernel/mac80211/patches/rt2x00/071-rt2x00-clear-IV-s-on-start-to-fix-AP-mode-regression.patch new file mode 100644 index 00000000000000..917204f9ca4b12 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/071-rt2x00-clear-IV-s-on-start-to-fix-AP-mode-regression.patch @@ -0,0 +1,102 @@ +From 95844124385eae4bd9ca5f9514a0fc33d561ac3c Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Mon, 19 Aug 2019 13:20:07 +0200 +Subject: [PATCH 12/15] rt2x00: clear IV's on start to fix AP mode regression + +To do not brake HW restart we should keep initialization vectors data. +I assumed that on start the data is already initialized to zeros, but +that not true on some scenarios and we should clear it. So add +additional flag to check if we are under HW restart and clear IV's +data if we are not. + +Patch fixes AP mode regression. + +Reported-and-tested-by: Emil Karlson +Fixes: 710e6cc1595e ("rt2800: do not nullify initialization vector data") +Signed-off-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 9 +++++++++ + drivers/net/wireless/ralink/rt2x00/rt2x00.h | 1 + + drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 13 ++++++++----- + 3 files changed, 18 insertions(+), 5 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -6106,6 +6106,15 @@ static int rt2800_init_registers(struct + } + + /* ++ * Clear encryption initialization vectors on start, but keep them ++ * for watchdog reset. Otherwise we will have wrong IVs and not be ++ * able to keep connections after reset. ++ */ ++ if (!test_bit(DEVICE_STATE_RESET, &rt2x00dev->flags)) ++ for (i = 0; i < 256; i++) ++ rt2800_register_write(rt2x00dev, MAC_IVEIV_ENTRY(i), 0); ++ ++ /* + * Clear all beacons + */ + for (i = 0; i < 8; i++) +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -669,6 +669,7 @@ enum rt2x00_state_flags { + DEVICE_STATE_ENABLED_RADIO, + DEVICE_STATE_SCANNING, + DEVICE_STATE_FLUSHING, ++ DEVICE_STATE_RESET, + + /* + * Driver configuration +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +@@ -1267,13 +1267,14 @@ static int rt2x00lib_initialize(struct r + + int rt2x00lib_start(struct rt2x00_dev *rt2x00dev) + { +- int retval; ++ int retval = 0; + + if (test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) { + /* + * This is special case for ieee80211_restart_hw(), otherwise + * mac80211 never call start() two times in row without stop(); + */ ++ set_bit(DEVICE_STATE_RESET, &rt2x00dev->flags); + rt2x00dev->ops->lib->pre_reset_hw(rt2x00dev); + rt2x00lib_stop(rt2x00dev); + } +@@ -1284,14 +1285,14 @@ int rt2x00lib_start(struct rt2x00_dev *r + */ + retval = rt2x00lib_load_firmware(rt2x00dev); + if (retval) +- return retval; ++ goto out; + + /* + * Initialize the device. + */ + retval = rt2x00lib_initialize(rt2x00dev); + if (retval) +- return retval; ++ goto out; + + rt2x00dev->intf_ap_count = 0; + rt2x00dev->intf_sta_count = 0; +@@ -1300,11 +1301,13 @@ int rt2x00lib_start(struct rt2x00_dev *r + /* Enable the radio */ + retval = rt2x00lib_enable_radio(rt2x00dev); + if (retval) +- return retval; ++ goto out; + + set_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags); + +- return 0; ++out: ++ clear_bit(DEVICE_STATE_RESET, &rt2x00dev->flags); ++ return retval; + } + + void rt2x00lib_stop(struct rt2x00_dev *rt2x00dev) diff --git a/package/kernel/mac80211/patches/rt2x00/072-rt2x00-do-not-set-IEEE80211_TX_STAT_AMPDU_NO_BACK-on.patch b/package/kernel/mac80211/patches/rt2x00/072-rt2x00-do-not-set-IEEE80211_TX_STAT_AMPDU_NO_BACK-on.patch new file mode 100644 index 00000000000000..22c952d8d4724b --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/072-rt2x00-do-not-set-IEEE80211_TX_STAT_AMPDU_NO_BACK-on.patch @@ -0,0 +1,40 @@ +From 567a9b766b47caffe4b1bf74823e7bc18532d875 Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Fri, 23 Aug 2019 09:09:56 +0200 +Subject: [PATCH 13/15] rt2x00: do not set IEEE80211_TX_STAT_AMPDU_NO_BACK on + tx status + +According to documentation IEEE80211_TX_STAT_AMPDU_NO_BACK is suppose +to be used when we do not recive BA (BlockAck). However on rt2x00 we +use it when remote station fail to decode one or more subframes within +AMPDU (some bits are not set in BlockAck bitmap). Setting the flag result +in sent of BAR (BlockAck Request) frame and this might result of abuse +of BA session, since remote station can sent BA with incorrect +sequence numbers after receiving BAR. This problem is visible especially +when connecting two rt2800 devices. + +Previously I observed some performance benefits when using the flag +when connecting with iwlwifi devices. But currently possibly due +to reacent changes in rt2x00 removing the flag has no effect on +those test cases. + +So remove the IEEE80211_TX_STAT_AMPDU_NO_BACK. + +Signed-off-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 3 --- + 1 file changed, 3 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +@@ -382,9 +382,6 @@ static void rt2x00lib_fill_tx_status(str + IEEE80211_TX_CTL_AMPDU; + tx_info->status.ampdu_len = 1; + tx_info->status.ampdu_ack_len = success ? 1 : 0; +- +- if (!success) +- tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; + } + + if (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS) { diff --git a/package/kernel/mac80211/patches/rt2x00/073-rt2x00-clear-up-IV-s-on-key-removal.patch b/package/kernel/mac80211/patches/rt2x00/073-rt2x00-clear-up-IV-s-on-key-removal.patch new file mode 100644 index 00000000000000..de445221b9b728 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/073-rt2x00-clear-up-IV-s-on-key-removal.patch @@ -0,0 +1,46 @@ +From 14d5e14c8a6c257eb322ddeb294ac4c243a7d2e1 Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Fri, 23 Aug 2019 14:48:03 +0200 +Subject: [PATCH 14/15] rt2x00: clear up IV's on key removal + +After looking at code I realized that my previous fix +95844124385e ("rt2x00: clear IV's on start to fix AP mode regression") +was incomplete. We can still have wrong IV's after re-keyring. +To fix that, clear up IV's also on key removal. + +Fixes: 710e6cc1595e ("rt2800: do not nullify initialization vector data") +Signed-off-by: Stanislaw Gruszka +tested-by: Emil Karlson +Signed-off-by: Kalle Valo +--- + .../net/wireless/ralink/rt2x00/rt2800lib.c | 19 ++++++++++++------- + 1 file changed, 12 insertions(+), 7 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -1665,13 +1665,18 @@ static void rt2800_config_wcid_attr_ciph + + offset = MAC_IVEIV_ENTRY(key->hw_key_idx); + +- rt2800_register_multiread(rt2x00dev, offset, +- &iveiv_entry, sizeof(iveiv_entry)); +- if ((crypto->cipher == CIPHER_TKIP) || +- (crypto->cipher == CIPHER_TKIP_NO_MIC) || +- (crypto->cipher == CIPHER_AES)) +- iveiv_entry.iv[3] |= 0x20; +- iveiv_entry.iv[3] |= key->keyidx << 6; ++ if (crypto->cmd == SET_KEY) { ++ rt2800_register_multiread(rt2x00dev, offset, ++ &iveiv_entry, sizeof(iveiv_entry)); ++ if ((crypto->cipher == CIPHER_TKIP) || ++ (crypto->cipher == CIPHER_TKIP_NO_MIC) || ++ (crypto->cipher == CIPHER_AES)) ++ iveiv_entry.iv[3] |= 0x20; ++ iveiv_entry.iv[3] |= key->keyidx << 6; ++ } else { ++ memset(&iveiv_entry, 0, sizeof(iveiv_entry)); ++ } ++ + rt2800_register_multiwrite(rt2x00dev, offset, + &iveiv_entry, sizeof(iveiv_entry)); + } diff --git a/package/kernel/mac80211/patches/rt2x00/074-Revert-rt2800-enable-TX_PIN_CFG_LNA_PE_-bits-per-ban.patch b/package/kernel/mac80211/patches/rt2x00/074-Revert-rt2800-enable-TX_PIN_CFG_LNA_PE_-bits-per-ban.patch new file mode 100644 index 00000000000000..c57fe67cc9b889 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/074-Revert-rt2800-enable-TX_PIN_CFG_LNA_PE_-bits-per-ban.patch @@ -0,0 +1,61 @@ +From 13fa451568ab9e8b3074ef741477c7938c713c42 Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka +Date: Thu, 29 Aug 2019 13:29:59 +0200 +Subject: [PATCH 15/15] Revert "rt2800: enable TX_PIN_CFG_LNA_PE_ bits per + band" + +This reverts commit 9ad3b55654455258a9463384edb40077439d879f. + +As reported by Sergey: + +"I got some problem after upgrade kernel to 5.2 version (debian testing +linux-image-5.2.0-2-amd64). 5Ghz client stopped to see AP. +Some tests with 1metre distance between client-AP: 2.4Ghz -22dBm, for +5Ghz - 53dBm !, for longer distance (8m + walls) 2.4 - 61dBm, 5Ghz not +visible." + +It was identified that rx signal level degradation was caused by +9ad3b5565445 ("rt2800: enable TX_PIN_CFG_LNA_PE_ bits per band"). +So revert this commit. + +Cc: # v5.1+ +Reported-and-tested-by: Sergey Maranchuk +Signed-off-by: Stanislaw Gruszka +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 18 ++++++------------ + 1 file changed, 6 insertions(+), 12 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -4253,24 +4253,18 @@ static void rt2800_config_channel(struct + switch (rt2x00dev->default_ant.rx_chain_num) { + case 3: + /* Turn on tertiary LNAs */ +- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A2_EN, +- rf->channel > 14); +- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G2_EN, +- rf->channel <= 14); ++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A2_EN, 1); ++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G2_EN, 1); + /* fall-through */ + case 2: + /* Turn on secondary LNAs */ +- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, +- rf->channel > 14); +- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, +- rf->channel <= 14); ++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 1); ++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 1); + /* fall-through */ + case 1: + /* Turn on primary LNAs */ +- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, +- rf->channel > 14); +- rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, +- rf->channel <= 14); ++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1); ++ rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, 1); + break; + } + diff --git a/package/kernel/mac80211/patches/rt2x00/075-rt2800-remove-errornous-duplicate-condition.patch b/package/kernel/mac80211/patches/rt2x00/075-rt2800-remove-errornous-duplicate-condition.patch new file mode 100644 index 00000000000000..caa8f809d519bf --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/075-rt2800-remove-errornous-duplicate-condition.patch @@ -0,0 +1,88 @@ +From patchwork Sat Nov 2 17:47:01 2019 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Daniel Golle +X-Patchwork-Id: 11224189 +X-Patchwork-Delegate: kvalo@adurom.com +Return-Path: +Date: Sat, 2 Nov 2019 18:47:01 +0100 +From: Daniel Golle +To: Stanislaw Gruszka +Cc: linux-wireless@vger.kernel.org, Roman Yeryomin , + wbob +Subject: [PATCH v2] rt2800: remove errornous duplicate condition +Message-ID: <20191102174701.GA1489@makrotopia.org> +References: <20191102154639.GA4589@redhat.com> +MIME-Version: 1.0 +Content-Disposition: inline +In-Reply-To: <20191102154639.GA4589@redhat.com> +User-Agent: Mutt/1.12.2 (2019-09-21) +Sender: linux-wireless-owner@vger.kernel.org +Precedence: bulk +List-ID: +X-Mailing-List: linux-wireless@vger.kernel.org + +On 2019-10-28 06:07, wbob wrote: +> Hello Roman, +> +> while reading around drivers/net/wireless/ralink/rt2x00/rt2800lib.c +> I stumbled on what I think is an edit of yours made in error in march +> 2017: +> +> https://github.com/torvalds/linux/commit/41977e86#diff-dae5dc10da180f3b055809a48118e18aR5281 +> +> RT6352 in line 5281 should not have been introduced as the "else if" +> below line 5291 can then not take effect for a RT6352 device. Another +> possibility is for line 5291 to be not for RT6352, but this seems +> very unlikely. Are you able to clarify still after this substantial time? +> +> 5277: static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) +> ... +> 5279: } else if (rt2x00_rt(rt2x00dev, RT5390) || +> 5280: rt2x00_rt(rt2x00dev, RT5392) || +> 5281: rt2x00_rt(rt2x00dev, RT6352)) { +> ... +> 5291: } else if (rt2x00_rt(rt2x00dev, RT6352)) { +> ... + +Hence remove errornous line 5281 to make the driver actually +execute the correct initialization routine for MT7620 chips. + +As it was requested by Stanislaw Gruszka remove setting values of +MIMO_PS_CFG and TX_PIN_CFG. MIMO_PS_CFG is responsible for MIMO +power-safe mode (which is disabled), hence we can drop setting it. +TX_PIN_CFG is set correctly in other functions, and as setting this +value breaks some devices, rather don't set it here during init, but +only modify it later on. + +Fixes: 41977e86c984 ("rt2x00: add support for MT7620") +Reported-by: wbob +Reported-by: Roman Yeryomin +Signed-off-by: Daniel Golle +Acked-by: Stanislaw Gruszka +--- + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -5850,8 +5850,7 @@ static int rt2800_init_registers(struct + rt2800_register_write(rt2x00dev, TX_TXBF_CFG_0, 0x8000fc21); + rt2800_register_write(rt2x00dev, TX_TXBF_CFG_3, 0x00009c40); + } else if (rt2x00_rt(rt2x00dev, RT5390) || +- rt2x00_rt(rt2x00dev, RT5392) || +- rt2x00_rt(rt2x00dev, RT6352)) { ++ rt2x00_rt(rt2x00dev, RT5392)) { + rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404); + rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606); + rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); +@@ -5865,8 +5864,6 @@ static int rt2800_init_registers(struct + rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000401); + rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0000); + rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); +- rt2800_register_write(rt2x00dev, MIMO_PS_CFG, 0x00000002); +- rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x00150F0F); + rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x00000000); + rt2800_register_write(rt2x00dev, TX0_BB_GAIN_ATTEN, 0x0); + rt2800_register_write(rt2x00dev, TX1_BB_GAIN_ATTEN, 0x0); diff --git a/package/kernel/mac80211/patches/030-rt2x00_options.patch b/package/kernel/mac80211/patches/rt2x00/100-rt2x00_options.patch similarity index 100% rename from package/kernel/mac80211/patches/030-rt2x00_options.patch rename to package/kernel/mac80211/patches/rt2x00/100-rt2x00_options.patch diff --git a/package/kernel/mac80211/patches/600-01-rt2x00-allow-to-build-rt2800soc-module-for-RT3883.patch b/package/kernel/mac80211/patches/rt2x00/501-rt2x00-allow-to-build-rt2800soc-module-for-RT3883.patch similarity index 100% rename from package/kernel/mac80211/patches/600-01-rt2x00-allow-to-build-rt2800soc-module-for-RT3883.patch rename to package/kernel/mac80211/patches/rt2x00/501-rt2x00-allow-to-build-rt2800soc-module-for-RT3883.patch diff --git a/package/kernel/mac80211/patches/601-rt2x00-introduce-rt2x00_platform_h.patch b/package/kernel/mac80211/patches/rt2x00/601-rt2x00-introduce-rt2x00_platform_h.patch similarity index 100% rename from package/kernel/mac80211/patches/601-rt2x00-introduce-rt2x00_platform_h.patch rename to package/kernel/mac80211/patches/rt2x00/601-rt2x00-introduce-rt2x00_platform_h.patch diff --git a/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch similarity index 93% rename from package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00eeprom.patch rename to package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch index b0c5d5ba37b33a..4890a1436f9346 100644 --- a/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00eeprom.patch +++ b/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch @@ -1,6 +1,6 @@ --- a/local-symbols +++ b/local-symbols -@@ -296,6 +296,7 @@ RT2X00_LIB_FIRMWARE= +@@ -305,6 +305,7 @@ RT2X00_LIB_FIRMWARE= RT2X00_LIB_CRYPTO= RT2X00_LIB_LEDS= RT2X00_LIB_DEBUGFS= @@ -38,7 +38,7 @@ default y if (RT2X00_LIB=y && LEDS_CLASS=y) || (RT2X00_LIB=m && LEDS_CLASS!=n) --- a/drivers/net/wireless/ralink/rt2x00/Makefile +++ b/drivers/net/wireless/ralink/rt2x00/Makefile -@@ -7,6 +7,7 @@ rt2x00lib-$(CPTCFG_RT2X00_LIB_DEBUGFS) + +@@ -8,6 +8,7 @@ rt2x00lib-$(CPTCFG_RT2X00_LIB_DEBUGFS) + rt2x00lib-$(CPTCFG_RT2X00_LIB_CRYPTO) += rt2x00crypto.o rt2x00lib-$(CPTCFG_RT2X00_LIB_FIRMWARE) += rt2x00firmware.o rt2x00lib-$(CPTCFG_RT2X00_LIB_LEDS) += rt2x00leds.o @@ -57,7 +57,7 @@ struct rt2800_ops { u32 (*register_read)(struct rt2x00_dev *rt2x00dev, const unsigned int offset); -@@ -145,6 +147,15 @@ static inline int rt2800_read_eeprom(str +@@ -146,6 +148,15 @@ static inline int rt2800_read_eeprom(str { const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; @@ -105,7 +105,7 @@ .drv_init_registers = rt2800mmio_init_registers, --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -702,6 +702,7 @@ enum rt2x00_capability_flags { +@@ -706,6 +706,7 @@ enum rt2x00_capability_flags { REQUIRE_HT_TX_DESC, REQUIRE_PS_AUTOWAKE, REQUIRE_DELAYED_RFKILL, @@ -113,7 +113,7 @@ /* * Capabilities -@@ -977,6 +978,11 @@ struct rt2x00_dev { +@@ -982,6 +983,11 @@ struct rt2x00_dev { const struct firmware *fw; /* @@ -127,7 +127,7 @@ DECLARE_KFIFO_PTR(txstatus_fifo, u32); --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -1421,6 +1421,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de +@@ -1429,6 +1429,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup); INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep); @@ -138,7 +138,7 @@ /* * Let the driver probe the device to detect the capabilities. */ -@@ -1562,6 +1566,11 @@ void rt2x00lib_remove_dev(struct rt2x00_ +@@ -1572,6 +1576,11 @@ void rt2x00lib_remove_dev(struct rt2x00_ * Free the driver data. */ kfree(rt2x00dev->drv_data); @@ -152,7 +152,7 @@ --- /dev/null +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c -@@ -0,0 +1,105 @@ +@@ -0,0 +1,106 @@ +/* + Copyright (C) 2004 - 2009 Ivo van Doorn + Copyright (C) 2004 - 2009 Gertjan van Wingerde @@ -255,7 +255,8 @@ + +void rt2x00lib_free_eeprom_file(struct rt2x00_dev *rt2x00dev) +{ -+ release_firmware(rt2x00dev->eeprom_file); ++ if (rt2x00dev->eeprom_file && rt2x00dev->eeprom_file->size) ++ release_firmware(rt2x00dev->eeprom_file); + rt2x00dev->eeprom_file = NULL; +} --- a/drivers/net/wireless/ralink/rt2x00/rt2x00lib.h diff --git a/package/kernel/mac80211/patches/603-rt2x00-of_load_eeprom_filename.patch b/package/kernel/mac80211/patches/rt2x00/603-rt2x00-of_load_eeprom_filename.patch similarity index 100% rename from package/kernel/mac80211/patches/603-rt2x00-of_load_eeprom_filename.patch rename to package/kernel/mac80211/patches/rt2x00/603-rt2x00-of_load_eeprom_filename.patch diff --git a/package/kernel/mac80211/patches/604-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch b/package/kernel/mac80211/patches/rt2x00/604-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch similarity index 96% rename from package/kernel/mac80211/patches/604-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch rename to package/kernel/mac80211/patches/rt2x00/604-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch index a98b49c541f5f7..b3e1220b601ab1 100644 --- a/package/kernel/mac80211/patches/604-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch +++ b/package/kernel/mac80211/patches/rt2x00/604-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch @@ -22,7 +22,7 @@ Signed-off-by: John Crispin Supported chips: RT2880, RT3050, RT3052, RT3350, RT3352. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c -@@ -26,11 +26,73 @@ +@@ -26,11 +26,72 @@ #include #include @@ -84,7 +84,6 @@ Signed-off-by: John Crispin + rt2x00dev->eeprom[i] = swab16(rt2x00dev->eeprom[i]); + + rt2x00dev->eeprom_file = &mtd_fw; -+ mtd_fw.size = len; + mtd_fw.data = (const u8 *) rt2x00dev->eeprom; + + dev_info(rt2x00dev->dev, "loaded eeprom from mtd device \"%s\"\n", part); @@ -96,7 +95,7 @@ Signed-off-by: John Crispin static const char * rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev) { -@@ -58,6 +120,9 @@ static int rt2x00lib_request_eeprom_file +@@ -58,6 +119,9 @@ static int rt2x00lib_request_eeprom_file const char *ee_name; int retval; diff --git a/package/kernel/mac80211/patches/606-rt2x00-allow_disabling_bands_through_platform_data.patch b/package/kernel/mac80211/patches/rt2x00/606-rt2x00-allow_disabling_bands_through_platform_data.patch similarity index 92% rename from package/kernel/mac80211/patches/606-rt2x00-allow_disabling_bands_through_platform_data.patch rename to package/kernel/mac80211/patches/rt2x00/606-rt2x00-allow_disabling_bands_through_platform_data.patch index 202dfc0b89de87..7387872b9f9df0 100644 --- a/package/kernel/mac80211/patches/606-rt2x00-allow_disabling_bands_through_platform_data.patch +++ b/package/kernel/mac80211/patches/rt2x00/606-rt2x00-allow_disabling_bands_through_platform_data.patch @@ -12,7 +12,7 @@ #endif /* _RT2X00_PLATFORM_H */ --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -1026,6 +1026,22 @@ static int rt2x00lib_probe_hw_modes(stru +@@ -1023,6 +1023,22 @@ static int rt2x00lib_probe_hw_modes(stru unsigned int num_rates; unsigned int i; @@ -37,7 +37,7 @@ num_rates += 4; --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -409,6 +409,7 @@ struct hw_mode_spec { +@@ -411,6 +411,7 @@ struct hw_mode_spec { unsigned int supported_bands; #define SUPPORT_BAND_2GHZ 0x00000001 #define SUPPORT_BAND_5GHZ 0x00000002 diff --git a/package/kernel/mac80211/patches/607-rt2x00-add_platform_data_mac_addr.patch b/package/kernel/mac80211/patches/rt2x00/607-rt2x00-add_platform_data_mac_addr.patch similarity index 91% rename from package/kernel/mac80211/patches/607-rt2x00-add_platform_data_mac_addr.patch rename to package/kernel/mac80211/patches/rt2x00/607-rt2x00-add_platform_data_mac_addr.patch index b8b01880400057..bca7be85333f07 100644 --- a/package/kernel/mac80211/patches/607-rt2x00-add_platform_data_mac_addr.patch +++ b/package/kernel/mac80211/patches/rt2x00/607-rt2x00-add_platform_data_mac_addr.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -1004,8 +1004,13 @@ static void rt2x00lib_rate(struct ieee80 +@@ -1001,8 +1001,13 @@ static void rt2x00lib_rate(struct ieee80 void rt2x00lib_set_mac_address(struct rt2x00_dev *rt2x00dev, u8 *eeprom_mac_addr) { diff --git a/package/kernel/mac80211/patches/608-rt2x00-allow_disabling_bands_through_dts.patch b/package/kernel/mac80211/patches/rt2x00/608-rt2x00-allow_disabling_bands_through_dts.patch similarity index 91% rename from package/kernel/mac80211/patches/608-rt2x00-allow_disabling_bands_through_dts.patch rename to package/kernel/mac80211/patches/rt2x00/608-rt2x00-allow_disabling_bands_through_dts.patch index ca66aa8e3beb01..724e626ca92e88 100644 --- a/package/kernel/mac80211/patches/608-rt2x00-allow_disabling_bands_through_dts.patch +++ b/package/kernel/mac80211/patches/rt2x00/608-rt2x00-allow_disabling_bands_through_dts.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -1030,6 +1030,16 @@ static int rt2x00lib_probe_hw_modes(stru +@@ -1027,6 +1027,16 @@ static int rt2x00lib_probe_hw_modes(stru struct ieee80211_rate *rates; unsigned int num_rates; unsigned int i; diff --git a/package/kernel/mac80211/patches/609-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch b/package/kernel/mac80211/patches/rt2x00/609-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch similarity index 94% rename from package/kernel/mac80211/patches/609-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch rename to package/kernel/mac80211/patches/rt2x00/609-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch index 02b66e3bc013e8..51bf548ad57c5a 100644 --- a/package/kernel/mac80211/patches/609-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch +++ b/package/kernel/mac80211/patches/rt2x00/609-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch @@ -13,7 +13,7 @@ Signed-off-by: John Crispin --- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c -@@ -234,10 +234,17 @@ static int rt2800soc_probe(struct platfo +@@ -235,10 +235,17 @@ static int rt2800soc_probe(struct platfo return rt2x00soc_probe(pdev, &rt2800soc_ops); } diff --git a/package/kernel/mac80211/patches/610-rt2x00-change-led-polarity-from-OF.patch b/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch similarity index 95% rename from package/kernel/mac80211/patches/610-rt2x00-change-led-polarity-from-OF.patch rename to package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch index ad70aa7826f23e..88eedec1458bdf 100644 --- a/package/kernel/mac80211/patches/610-rt2x00-change-led-polarity-from-OF.patch +++ b/package/kernel/mac80211/patches/rt2x00/610-rt2x00-change-led-polarity-from-OF.patch @@ -8,7 +8,7 @@ #include "rt2x00.h" #include "rt2800lib.h" -@@ -9285,6 +9286,17 @@ static int rt2800_init_eeprom(struct rt2 +@@ -9542,6 +9543,17 @@ static int rt2800_init_eeprom(struct rt2 rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC); rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY); diff --git a/package/kernel/mac80211/patches/611-rt2x00-add-AP+STA-support.patch b/package/kernel/mac80211/patches/rt2x00/611-rt2x00-add-AP+STA-support.patch similarity index 86% rename from package/kernel/mac80211/patches/611-rt2x00-add-AP+STA-support.patch rename to package/kernel/mac80211/patches/rt2x00/611-rt2x00-add-AP+STA-support.patch index 062b18a63b3d1b..8e43bece879a37 100644 --- a/package/kernel/mac80211/patches/611-rt2x00-add-AP+STA-support.patch +++ b/package/kernel/mac80211/patches/rt2x00/611-rt2x00-add-AP+STA-support.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c -@@ -1361,7 +1361,7 @@ static inline void rt2x00lib_set_if_comb +@@ -1367,7 +1367,7 @@ static inline void rt2x00lib_set_if_comb */ if_limit = &rt2x00dev->if_limits_ap; if_limit->max = rt2x00dev->ops->max_ap_intf; diff --git a/package/kernel/mac80211/patches/rt2x00/650-rt2x00-add-support-for-external-PA-on-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/650-rt2x00-add-support-for-external-PA-on-MT7620.patch new file mode 100644 index 00000000000000..68d990ea50779f --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/650-rt2x00-add-support-for-external-PA-on-MT7620.patch @@ -0,0 +1,107 @@ +From 9782a7f7488443568fa4d6088b73c9aff7eb8510 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Wed, 19 Apr 2017 16:14:53 +0200 +Subject: [PATCH] rt2x00: add support for external PA on MT7620 +To: Stanislaw Gruszka +Cc: Helmut Schaa , + linux-wireless@vger.kernel.org, + Kalle Valo +Content-Type: text/plain; charset="UTF-8" +Content-Transfer-Encoding: quoted-printable + +Signed-off-by: Daniel Golle +Signed-off-by: Tomislav Po=C5=BEega +[pozega.tomislav@gmail.com: use chanreg and dccal helpers.] + +--- + drivers/net/wireless/ralink/rt2x00/rt2800.h | 1 + + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 70 +++++++++++++++++++++++++- + 2 files changed, 70 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h +@@ -2750,6 +2750,7 @@ enum rt2800_eeprom_word { + #define EEPROM_NIC_CONF2_RX_STREAM FIELD16(0x000f) + #define EEPROM_NIC_CONF2_TX_STREAM FIELD16(0x00f0) + #define EEPROM_NIC_CONF2_CRYSTAL FIELD16(0x0600) ++#define EEPROM_NIC_CONF2_EXTERNAL_PA FIELD16(0xc000) + + /* + * EEPROM LNA +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -4370,6 +4370,45 @@ static void rt2800_config_channel(struct + rt2800_iq_calibrate(rt2x00dev, rf->channel); + } + ++ if (rt2x00_rt(rt2x00dev, RT6352)) { ++ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, ++ &rt2x00dev->cap_flags)) { ++ rt2x00_warn(rt2x00dev, "Using incomplete support for " \ ++ "external PA\n"); ++ reg = rt2800_register_read(rt2x00dev, RF_CONTROL3); ++ reg |= 0x00000101; ++ rt2800_register_write(rt2x00dev, RF_CONTROL3, reg); ++ ++ reg = rt2800_register_read(rt2x00dev, RF_BYPASS3); ++ reg |= 0x00000101; ++ rt2800_register_write(rt2x00dev, RF_BYPASS3, reg); ++ ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 43, 0x73); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 44, 0x73); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 45, 0x73); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 46, 0x27); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 47, 0xC8); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 48, 0xA4); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 49, 0x05); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 54, 0x27); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 55, 0xC8); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 56, 0xA4); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 57, 0x05); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 58, 0x27); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 59, 0xC8); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 60, 0xA4); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 61, 0x05); ++ rt2800_rfcsr_write_dccal(rt2x00dev, 05, 0x00); ++ ++ rt2800_register_write(rt2x00dev, TX0_RF_GAIN_CORRECT, ++ 0x36303636); ++ rt2800_register_write(rt2x00dev, TX0_RF_GAIN_ATTEN, ++ 0x6C6C6B6C); ++ rt2800_register_write(rt2x00dev, TX1_RF_GAIN_ATTEN, ++ 0x6C6C6B6C); ++ } ++ } ++ + bbp = rt2800_bbp_read(rt2x00dev, 4); + rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf)); + rt2800_bbp_write(rt2x00dev, 4, bbp); +@@ -9571,7 +9610,8 @@ static int rt2800_init_eeprom(struct rt2 + */ + eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1); + +- if (rt2x00_rt(rt2x00dev, RT3352)) { ++ if (rt2x00_rt(rt2x00dev, RT3352) || ++ rt2x00_rt(rt2x00dev, RT6352)) { + if (rt2x00_get_field16(eeprom, + EEPROM_NIC_CONF1_EXTERNAL_TX0_PA_3352)) + __set_bit(CAPABILITY_EXTERNAL_PA_TX0, +@@ -9582,6 +9622,18 @@ static int rt2800_init_eeprom(struct rt2 + &rt2x00dev->cap_flags); + } + ++ eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF2); ++ ++ if (rt2x00_rt(rt2x00dev, RT6352) && eeprom != 0 && eeprom != 0xffff) { ++ if (rt2x00_get_field16(eeprom, ++ EEPROM_NIC_CONF2_EXTERNAL_PA)) { ++ __set_bit(CAPABILITY_EXTERNAL_PA_TX0, ++ &rt2x00dev->cap_flags); ++ __set_bit(CAPABILITY_EXTERNAL_PA_TX1, ++ &rt2x00dev->cap_flags); ++ } ++ } ++ + return 0; + } + diff --git a/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch b/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch new file mode 100644 index 00000000000000..8a030e01f072b3 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/982-rt2x00-add-rf-self-txdc-calibration.patch @@ -0,0 +1,89 @@ +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -8433,6 +8433,58 @@ static void rt2800_init_rfcsr_5592(struc + rt2800_led_open_drain_enable(rt2x00dev); + } + ++void rt2800_rf_self_txdc_cal(struct rt2x00_dev *rt2x00dev) ++{ ++ u8 rfb5r1_org, rfb7r1_org, rfvalue; ++ u32 mac0518, mac051c, mac0528, mac052c; ++ u8 i; ++ ++ rt2x00_info(rt2x00dev, "RF Tx self calibration start\n"); ++ mac0518 = rt2800_register_read(rt2x00dev, RF_CONTROL0); ++ mac051c = rt2800_register_read(rt2x00dev, RF_BYPASS0); ++ mac0528 = rt2800_register_read(rt2x00dev, RF_CONTROL2); ++ mac052c = rt2800_register_read(rt2x00dev, RF_BYPASS2); ++ ++ rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x0); ++ rt2800_register_write(rt2x00dev, RF_BYPASS2, 0x0); ++ ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0xC); ++ rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x3306); ++ rt2800_register_write(rt2x00dev, RF_CONTROL2, 0x3330); ++ rt2800_register_write(rt2x00dev, RF_BYPASS2, 0xfffff); ++ rfb5r1_org = rt2800_rfcsr_read_bank(rt2x00dev, 5, 1); ++ rfb7r1_org = rt2800_rfcsr_read_bank(rt2x00dev, 7, 1); ++ ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 1, 0x4); ++ for (i = 0; i < 100; i = i + 1) { ++ udelay(50); ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 5, 1); ++ if((rfvalue & 0x04) != 0x4) ++ break; ++ } ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 1, rfb5r1_org); ++ ++ rt2800_rfcsr_write_bank(rt2x00dev, 7, 1, 0x4); ++ for (i = 0; i < 100; i = i + 1) { ++ udelay(50); ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 7, 1); ++ if((rfvalue & 0x04) != 0x4) ++ break; ++ } ++ rt2800_rfcsr_write_bank(rt2x00dev, 7, 1, rfb7r1_org); ++ ++ rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x0); ++ rt2800_register_write(rt2x00dev, RF_BYPASS2, 0x0); ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, mac0518); ++ rt2800_register_write(rt2x00dev, RF_BYPASS0, mac051c); ++ rt2800_register_write(rt2x00dev, RF_CONTROL2, mac0528); ++ rt2800_register_write(rt2x00dev, RF_BYPASS2, mac052c); ++ ++ rt2x00_info(rt2x00dev, "RF Tx self calibration end\n"); ++ ++} ++EXPORT_SYMBOL_GPL(rt2800_rf_self_txdc_cal); ++ + static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, + bool set_bw, bool is_ht40) + { +@@ -9040,6 +9092,7 @@ static void rt2800_init_rfcsr_6352(struc + rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); + rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); + ++ rt2800_rf_self_txdc_cal(rt2x00dev); + rt2800_bw_filter_calibration(rt2x00dev, true); + rt2800_bw_filter_calibration(rt2x00dev, false); + } +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h +@@ -253,6 +253,7 @@ void rt2800_link_tuner(struct rt2x00_dev + const u32 count); + void rt2800_gain_calibration(struct rt2x00_dev *rt2x00dev); + void rt2800_vco_calibration(struct rt2x00_dev *rt2x00dev); ++void rt2800_rf_self_txdc_cal(struct rt2x00_dev *rt2x00dev); + + int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev); + void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev); +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -574,6 +574,7 @@ struct rt2x00lib_ops { + struct link_qual *qual, const u32 count); + void (*gain_calibration) (struct rt2x00_dev *rt2x00dev); + void (*vco_calibration) (struct rt2x00_dev *rt2x00dev); ++ void (*rf_self_txdc_cal) (struct rt2x00_dev *rt2x00dev); + + /* + * Data queue handlers. diff --git a/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch b/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch new file mode 100644 index 00000000000000..6c3a39626a6021 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/983-rt2x00-add-r-calibration.patch @@ -0,0 +1,193 @@ +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -8485,6 +8485,160 @@ void rt2800_rf_self_txdc_cal(struct rt2x + } + EXPORT_SYMBOL_GPL(rt2800_rf_self_txdc_cal); + ++int rt2800_calcrcalibrationcode(struct rt2x00_dev *rt2x00dev, int d1, int d2) ++{ ++ int calcode; ++ calcode = ((d2 - d1) * 1000) / 43; ++ if ((calcode%10) >= 5) ++ calcode += 10; ++ calcode = (calcode / 10); ++ ++ return calcode; ++} ++EXPORT_SYMBOL_GPL(rt2800_calcrcalibrationcode); ++ ++void rt2800_r_calibration(struct rt2x00_dev *rt2x00dev) ++{ ++ u32 savemacsysctrl; ++ u8 saverfb0r1, saverfb0r34, saverfb0r35; ++ u8 saverfb5r4, saverfb5r17, saverfb5r18; ++ u8 saverfb5r19, saverfb5r20; ++ u8 savebbpr22, savebbpr47, savebbpr49; ++ u8 bytevalue = 0; ++ int rcalcode; ++ u8 r_cal_code = 0; ++ char d1 = 0, d2 = 0; ++ u8 rfvalue; ++ u32 MAC_RF_BYPASS0, MAC_RF_CONTROL0, MAC_PWR_PIN_CFG; ++ ++ saverfb0r1 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 1); ++ saverfb0r34 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 34); ++ saverfb0r35 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 35); ++ saverfb5r4 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 4); ++ saverfb5r17 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 17); ++ saverfb5r18 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 18); ++ saverfb5r19 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 19); ++ saverfb5r20 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 20); ++ ++ savebbpr22 = rt2800_bbp_read(rt2x00dev, 22); ++ savebbpr47 = rt2800_bbp_read(rt2x00dev, 47); ++ savebbpr49 = rt2800_bbp_read(rt2x00dev, 49); ++ ++ savemacsysctrl = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); ++ MAC_RF_BYPASS0 = rt2800_register_read(rt2x00dev, RF_BYPASS0); ++ MAC_RF_CONTROL0 = rt2800_register_read(rt2x00dev, RF_CONTROL0); ++ MAC_PWR_PIN_CFG = rt2800_register_read(rt2x00dev, PWR_PIN_CFG); ++ ++ { ++ u32 maccfg, macstatus; ++ int i; ++ ++ maccfg = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); ++ maccfg &= (~0x04); ++ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, maccfg); ++ ++ for (i = 0; i < 10000; i++) { ++ macstatus = rt2800_register_read(rt2x00dev, MAC_STATUS_CFG); ++ if (macstatus & 0x1) ++ udelay(50); ++ else ++ break; ++ } ++ ++ if (i == 10000) ++ rt2x00_warn(rt2x00dev, "Wait MAC Tx Status to MAX !!!\n"); ++ ++ maccfg = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); ++ maccfg &= (~0x04); ++ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, maccfg); ++ ++ for (i = 0; i < 10000; i++) { ++ macstatus = rt2800_register_read(rt2x00dev, MAC_STATUS_CFG); ++ if (macstatus & 0x2) ++ udelay(50); ++ else ++ break; ++ } ++ ++ if (i == 10000) ++ rt2x00_warn(rt2x00dev, "Wait MAC Rx Status to MAX !!!\n"); ++ } ++ ++ rfvalue = (MAC_RF_BYPASS0 | 0x3004); ++ rt2800_register_write(rt2x00dev, RF_BYPASS0, rfvalue); ++ rfvalue = (MAC_RF_CONTROL0 | (~0x3002)); ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, rfvalue); ++ ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, 0x27); ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 17, 0x80); ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 18, 0x83); ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 19, 0x00); ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 20, 0x20); ++ ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, 0x00); ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 34, 0x13); ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 35, 0x00); ++ ++ rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x1); ++ ++ rt2800_bbp_write(rt2x00dev, 47, 0x04); ++ rt2800_bbp_write(rt2x00dev, 22, 0x80); ++ udelay(100); ++ bytevalue = rt2800_bbp_read(rt2x00dev, 49); ++ if (bytevalue > 128) ++ d1 = bytevalue - 256; ++ else ++ d1 = (char)bytevalue; ++ rt2800_bbp_write(rt2x00dev, 22, 0x0); ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 35, 0x01); ++ ++ rt2800_bbp_write(rt2x00dev, 22, 0x80); ++ udelay(100); ++ bytevalue = rt2800_bbp_read(rt2x00dev, 49); ++ if (bytevalue > 128) ++ d2 = bytevalue - 256; ++ else ++ d2 = (char)bytevalue; ++ rt2800_bbp_write(rt2x00dev, 22, 0x0); ++ ++ rcalcode = rt2800_calcrcalibrationcode(rt2x00dev, d1, d2); ++ if (rcalcode < 0) ++ r_cal_code = 256 + rcalcode; ++ else ++ r_cal_code = (u8)rcalcode; ++ ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 7, r_cal_code); ++ ++ rt2800_bbp_write(rt2x00dev, 22, 0x0); ++ ++ bytevalue = rt2800_bbp_read(rt2x00dev, 21); ++ bytevalue |= 0x1; ++ rt2800_bbp_write(rt2x00dev, 21, bytevalue); ++ bytevalue = rt2800_bbp_read(rt2x00dev, 21); ++ bytevalue &= (~0x1); ++ rt2800_bbp_write(rt2x00dev, 21, bytevalue); ++ ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, saverfb0r1); ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 34, saverfb0r34); ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 35, saverfb0r35); ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, saverfb5r4); ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 17, saverfb5r17); ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 18, saverfb5r18); ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 19, saverfb5r19); ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 20, saverfb5r20); ++ ++ rt2800_bbp_write(rt2x00dev, 22, savebbpr22); ++ rt2800_bbp_write(rt2x00dev, 47, savebbpr47); ++ rt2800_bbp_write(rt2x00dev, 49, savebbpr49); ++ ++ rt2800_register_write(rt2x00dev, RF_BYPASS0, MAC_RF_BYPASS0); ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, MAC_RF_CONTROL0); ++ ++ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, savemacsysctrl); ++ rt2800_register_write(rt2x00dev, PWR_PIN_CFG, MAC_PWR_PIN_CFG); ++} ++EXPORT_SYMBOL_GPL(rt2800_r_calibration); ++ + static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, + bool set_bw, bool is_ht40) + { +@@ -9092,6 +9246,7 @@ static void rt2800_init_rfcsr_6352(struc + rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00); + rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C); + ++ rt2800_r_calibration(rt2x00dev); + rt2800_rf_self_txdc_cal(rt2x00dev); + rt2800_bw_filter_calibration(rt2x00dev, true); + rt2800_bw_filter_calibration(rt2x00dev, false); +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h +@@ -254,6 +254,8 @@ void rt2800_link_tuner(struct rt2x00_dev + void rt2800_gain_calibration(struct rt2x00_dev *rt2x00dev); + void rt2800_vco_calibration(struct rt2x00_dev *rt2x00dev); + void rt2800_rf_self_txdc_cal(struct rt2x00_dev *rt2x00dev); ++int rt2800_calcrcalibrationcode(struct rt2x00_dev *rt2x00dev, int d1, int d2); ++void rt2800_r_calibration(struct rt2x00_dev *rt2x00dev); + + int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev); + void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev); +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -575,6 +575,8 @@ struct rt2x00lib_ops { + void (*gain_calibration) (struct rt2x00_dev *rt2x00dev); + void (*vco_calibration) (struct rt2x00_dev *rt2x00dev); + void (*rf_self_txdc_cal) (struct rt2x00_dev *rt2x00dev); ++ int (*calcrcalibrationcode) (struct rt2x00_dev *rt2x00dev, int d1, int d2); ++ void (*r_calibration) (struct rt2x00_dev *rt2x00dev); + + /* + * Data queue handlers. diff --git a/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch b/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch new file mode 100644 index 00000000000000..a6df4f6ded4d4c --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/984-rt2x00-add-rxdcoc-calibration.patch @@ -0,0 +1,102 @@ +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -8639,6 +8639,71 @@ void rt2800_r_calibration(struct rt2x00_ + } + EXPORT_SYMBOL_GPL(rt2800_r_calibration); + ++void rt2800_rxdcoc_calibration(struct rt2x00_dev *rt2x00dev) ++{ ++ u8 bbpreg = 0; ++ u32 macvalue = 0, macvalue1 = 0; ++ u8 saverfb0r2, saverfb5r4, saverfb7r4, rfvalue; ++ int i; ++ ++ saverfb0r2 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 2); ++ rfvalue = saverfb0r2; ++ rfvalue |= 0x03; ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, rfvalue); ++ ++ rt2800_bbp_write(rt2x00dev, 158, 141); ++ bbpreg = rt2800_bbp_read(rt2x00dev, 159); ++ bbpreg |= 0x10; ++ rt2800_bbp_write(rt2x00dev, 159, bbpreg); ++ ++ macvalue = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); ++ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x8); ++ ++ for (i = 0; i < 10000; i++) { ++ macvalue1 = rt2800_register_read(rt2x00dev, MAC_STATUS_CFG); ++ if (macvalue1 & 0x1) ++ udelay(50); ++ else ++ break; ++ } ++ ++ saverfb5r4 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 0); ++ saverfb7r4 = rt2800_rfcsr_read_bank(rt2x00dev, 7, 4); ++ saverfb5r4 = saverfb5r4 & (~0x40); ++ saverfb7r4 = saverfb7r4 & (~0x40); ++ rt2800_rfcsr_write_dccal(rt2x00dev, 4, 0x64); ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, saverfb5r4); ++ rt2800_rfcsr_write_bank(rt2x00dev, 7, 4, saverfb7r4); ++ ++ rt2800_bbp_write(rt2x00dev, 158, 141); ++ bbpreg = rt2800_bbp_read(rt2x00dev, 159); ++ bbpreg = bbpreg & (~0x40); ++ rt2800_bbp_write(rt2x00dev, 159, bbpreg); ++ bbpreg |= 0x48; ++ rt2800_bbp_write(rt2x00dev, 159, bbpreg); ++ ++ for (i = 0; i < 10000; i++) { ++ bbpreg = rt2800_bbp_read(rt2x00dev, 159); ++ if ((bbpreg & 0x40)==0) ++ break; ++ udelay(50); ++ } ++ ++ bbpreg = rt2800_bbp_read(rt2x00dev, 159); ++ bbpreg = bbpreg & (~0x40); ++ rt2800_bbp_write(rt2x00dev, 159, bbpreg); ++ ++ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, macvalue); ++ ++ rt2800_bbp_write(rt2x00dev, 158, 141); ++ bbpreg = rt2800_bbp_read(rt2x00dev, 159); ++ bbpreg &= (~0x10); ++ rt2800_bbp_write(rt2x00dev, 159, bbpreg); ++ ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, saverfb0r2); ++} ++EXPORT_SYMBOL_GPL(rt2800_rxdcoc_calibration); ++ + static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, + bool set_bw, bool is_ht40) + { +@@ -9248,6 +9313,7 @@ static void rt2800_init_rfcsr_6352(struc + + rt2800_r_calibration(rt2x00dev); + rt2800_rf_self_txdc_cal(rt2x00dev); ++ rt2800_rxdcoc_calibration(rt2x00dev); + rt2800_bw_filter_calibration(rt2x00dev, true); + rt2800_bw_filter_calibration(rt2x00dev, false); + } +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h +@@ -256,6 +256,7 @@ void rt2800_vco_calibration(struct rt2x0 + void rt2800_rf_self_txdc_cal(struct rt2x00_dev *rt2x00dev); + int rt2800_calcrcalibrationcode(struct rt2x00_dev *rt2x00dev, int d1, int d2); + void rt2800_r_calibration(struct rt2x00_dev *rt2x00dev); ++void rt2800_rxdcoc_calibration(struct rt2x00_dev *rt2x00dev); + + int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev); + void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev); +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -577,6 +577,7 @@ struct rt2x00lib_ops { + void (*rf_self_txdc_cal) (struct rt2x00_dev *rt2x00dev); + int (*calcrcalibrationcode) (struct rt2x00_dev *rt2x00dev, int d1, int d2); + void (*r_calibration) (struct rt2x00_dev *rt2x00dev); ++ void (*rxdcoc_calibration) (struct rt2x00_dev *rt2x00dev); + + /* + * Data queue handlers. diff --git a/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch b/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch new file mode 100644 index 00000000000000..0a528a0e57e3d0 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/985-rt2x00-add-rxiq-calibration.patch @@ -0,0 +1,417 @@ +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -8704,6 +8704,386 @@ void rt2800_rxdcoc_calibration(struct rt + } + EXPORT_SYMBOL_GPL(rt2800_rxdcoc_calibration); + ++static u32 rt2800_do_sqrt_accumulation(u32 si) { ++ u32 root, root_pre, bit; ++ char i; ++ bit = 1 << 15; ++ root = 0; ++ for (i = 15; i >= 0; i = i - 1) { ++ root_pre = root + bit; ++ if ((root_pre*root_pre) <= si) ++ root = root_pre; ++ bit = bit >> 1; ++ } ++ ++ return root; ++} ++EXPORT_SYMBOL_GPL(rt2800_do_sqrt_accumulation); ++ ++void rt2800_rxiq_calibration(struct rt2x00_dev *rt2x00dev) { ++ u8 rfb0r1, rfb0r2, rfb0r42; ++ u8 rfb4r0, rfb4r19; ++ u8 rfb5r3, rfb5r4, rfb5r17, rfb5r18, rfb5r19, rfb5r20; ++ u8 rfb6r0, rfb6r19; ++ u8 rfb7r3, rfb7r4, rfb7r17, rfb7r18, rfb7r19, rfb7r20; ++ ++ u8 bbp1, bbp4; ++ u8 bbpr241, bbpr242; ++ u32 i; ++ u8 ch_idx; ++ u8 bbpval; ++ u8 rfval, vga_idx = 0; ++ int mi = 0, mq = 0, si = 0, sq = 0, riq = 0; ++ int sigma_i, sigma_q, r_iq, g_rx; ++ int g_imb; ++ int ph_rx; ++ u32 savemacsysctrl = 0; ++ u32 orig_RF_CONTROL0 = 0; ++ u32 orig_RF_BYPASS0 = 0; ++ u32 orig_RF_CONTROL1 = 0; ++ u32 orig_RF_BYPASS1 = 0; ++ u32 orig_RF_CONTROL3 = 0; ++ u32 orig_RF_BYPASS3 = 0; ++ u32 macstatus, bbpval1 = 0; ++ u8 rf_vga_table[] = {0x20, 0x21, 0x22, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f}; ++ ++ savemacsysctrl = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); ++ orig_RF_CONTROL0 = rt2800_register_read(rt2x00dev, RF_CONTROL0); ++ orig_RF_BYPASS0 = rt2800_register_read(rt2x00dev, RF_BYPASS0); ++ orig_RF_CONTROL1 = rt2800_register_read(rt2x00dev, RF_CONTROL1); ++ orig_RF_BYPASS1 = rt2800_register_read(rt2x00dev, RF_BYPASS1); ++ orig_RF_CONTROL3 = rt2800_register_read(rt2x00dev, RF_CONTROL3); ++ orig_RF_BYPASS3 = rt2800_register_read(rt2x00dev, RF_BYPASS3); ++ ++ bbp1 = rt2800_bbp_read(rt2x00dev, 1); ++ bbp4 = rt2800_bbp_read(rt2x00dev, 4); ++ ++ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x0); ++ ++ for (i = 0; i < 10000; i++) { ++ macstatus = rt2800_register_read(rt2x00dev, MAC_STATUS_CFG); ++ if (macstatus & 0x3) ++ udelay(50); ++ else ++ break; ++ } ++ ++ if (i == 10000) ++ rt2x00_warn(rt2x00dev, "Wait MAC Status to MAX !!!\n"); ++ ++ bbpval = bbp4 & (~0x18); ++ bbpval = bbp4 | 0x00; ++ rt2800_bbp_write(rt2x00dev, 4, bbpval); ++ ++ bbpval = rt2800_bbp_read(rt2x00dev, 21); ++ bbpval = bbpval | 1; ++ rt2800_bbp_write(rt2x00dev, 21, bbpval); ++ bbpval = bbpval & 0xfe; ++ rt2800_bbp_write(rt2x00dev, 21, bbpval); ++ ++ rt2800_register_write(rt2x00dev, RF_CONTROL1, 0x00000202); ++ rt2800_register_write(rt2x00dev, RF_BYPASS1, 0x00000303); ++ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { ++ rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x0101); ++ } else { ++ rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x0000); ++ } ++ rt2800_register_write(rt2x00dev, RF_BYPASS3, 0xf1f1); ++ ++ rfb0r1 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 1); ++ rfb0r2 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 2); ++ rfb0r42 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 42); ++ rfb4r0 = rt2800_rfcsr_read_bank(rt2x00dev, 4, 0); ++ rfb4r19 = rt2800_rfcsr_read_bank(rt2x00dev, 4, 19); ++ rfb5r3 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 3); ++ rfb5r4 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 4); ++ rfb5r17 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 17); ++ rfb5r18 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 18); ++ rfb5r19 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 19); ++ rfb5r20 = rt2800_rfcsr_read_bank(rt2x00dev, 5, 20); ++ ++ rfb6r0 = rt2800_rfcsr_read_bank(rt2x00dev, 6, 0); ++ rfb6r19 = rt2800_rfcsr_read_bank(rt2x00dev, 6, 19); ++ rfb7r3 = rt2800_rfcsr_read_bank(rt2x00dev, 7, 3); ++ rfb7r4 = rt2800_rfcsr_read_bank(rt2x00dev, 7, 4); ++ rfb7r17 = rt2800_rfcsr_read_bank(rt2x00dev, 7, 17); ++ rfb7r18 = rt2800_rfcsr_read_bank(rt2x00dev, 7, 18); ++ rfb7r19 = rt2800_rfcsr_read_bank(rt2x00dev, 7, 19); ++ rfb7r20 = rt2800_rfcsr_read_bank(rt2x00dev, 7, 20); ++ ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 0, 0x87); ++ rt2800_rfcsr_write_chanreg(rt2x00dev, 19, 0x27); ++ rt2800_rfcsr_write_dccal(rt2x00dev, 3, 0x38); ++ rt2800_rfcsr_write_dccal(rt2x00dev, 4, 0x38); ++ rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x80); ++ rt2800_rfcsr_write_dccal(rt2x00dev, 18, 0xC1); ++ rt2800_rfcsr_write_dccal(rt2x00dev, 19, 0x60); ++ rt2800_rfcsr_write_dccal(rt2x00dev, 20, 0x00); ++ ++ rt2800_bbp_write(rt2x00dev, 23, 0x0); ++ rt2800_bbp_write(rt2x00dev, 24, 0x0); ++ ++ rt2800_bbp_dcoc_write(rt2x00dev, 5, 0x0); ++ ++ bbpr241 = rt2800_bbp_read(rt2x00dev, 241); ++ bbpr242 = rt2800_bbp_read(rt2x00dev, 242); ++ ++ rt2800_bbp_write(rt2x00dev, 241, 0x10); ++ rt2800_bbp_write(rt2x00dev, 242, 0x84); ++ rt2800_bbp_write(rt2x00dev, 244, 0x31); ++ ++ bbpval = rt2800_bbp_dcoc_read(rt2x00dev, 3); ++ bbpval = bbpval & (~0x7); ++ rt2800_bbp_dcoc_write(rt2x00dev, 3, bbpval); ++ ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00000004); ++ udelay(1); ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00000006); ++ usleep_range(1, 200); ++ rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x00003376); ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00001006); ++ udelay(1); ++ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { ++ rt2800_bbp_write(rt2x00dev, 23, 0x06); ++ rt2800_bbp_write(rt2x00dev, 24, 0x06); ++ } else { ++ rt2800_bbp_write(rt2x00dev, 23, 0x02); ++ rt2800_bbp_write(rt2x00dev, 24, 0x02); ++ } ++ ++ for (ch_idx = 0; ch_idx < 2; ch_idx = ch_idx + 1) { ++ if (ch_idx == 0) { ++ rfval = rfb0r1 & (~0x3); ++ rfval = rfb0r1 | 0x1; ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, rfval); ++ rfval = rfb0r2 & (~0x33); ++ rfval = rfb0r2 | 0x11; ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, rfval); ++ rfval = rfb0r42 & (~0x50); ++ rfval = rfb0r42 | 0x10; ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, rfval); ++ ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00001006); ++ udelay(1); ++ ++ bbpval = bbp1 & (~ 0x18); ++ bbpval = bbpval | 0x00; ++ rt2800_bbp_write(rt2x00dev, 1, bbpval); ++ ++ rt2800_bbp_dcoc_write(rt2x00dev, 1, 0x00); ++ } else { ++ rfval = rfb0r1 & (~0x3); ++ rfval = rfb0r1 | 0x2; ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, rfval); ++ rfval = rfb0r2 & (~0x33); ++ rfval = rfb0r2 | 0x22; ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, rfval); ++ rfval = rfb0r42 & (~0x50); ++ rfval = rfb0r42 | 0x40; ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, rfval); ++ ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00002006); ++ udelay(1); ++ ++ bbpval = bbp1 & (~ 0x18); ++ bbpval = bbpval | 0x08; ++ rt2800_bbp_write(rt2x00dev, 1, bbpval); ++ ++ rt2800_bbp_dcoc_write(rt2x00dev, 1, 0x01); ++ } ++ udelay(500); ++ ++ vga_idx = 0; ++ while (vga_idx < 11) { ++ rt2800_rfcsr_write_dccal(rt2x00dev, 3, rf_vga_table[vga_idx]); ++ rt2800_rfcsr_write_dccal(rt2x00dev, 4, rf_vga_table[vga_idx]); ++ ++ rt2800_bbp_dcoc_write(rt2x00dev, 0, 0x93); ++ ++ for (i = 0; i < 10000; i++) { ++ bbpval = rt2800_bbp_read(rt2x00dev, 159); ++ if ((bbpval & 0xff) == 0x93) ++ udelay(50); ++ else ++ break; ++ } ++ ++ if ((bbpval & 0xff) == 0x93) { ++ rt2x00_warn(rt2x00dev, "Fatal Error: Calibration doesn't finish"); ++ goto restore_value; ++ } ++ ++ for (i = 0; i < 5; i++) { ++ u32 bbptemp = 0; ++ u8 value = 0; ++ int result = 0; ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0x1e); ++ rt2800_bbp_write(rt2x00dev, 159, i); ++ rt2800_bbp_write(rt2x00dev, 158, 0x22); ++ value = rt2800_bbp_read(rt2x00dev, 159); ++ bbptemp = bbptemp + (value << 24); ++ rt2800_bbp_write(rt2x00dev, 158, 0x21); ++ value = rt2800_bbp_read(rt2x00dev, 159); ++ bbptemp = bbptemp + (value << 16); ++ rt2800_bbp_write(rt2x00dev, 158, 0x20); ++ value = rt2800_bbp_read(rt2x00dev, 159); ++ bbptemp = bbptemp + (value << 8); ++ rt2800_bbp_write(rt2x00dev, 158, 0x1f); ++ value = rt2800_bbp_read(rt2x00dev, 159); ++ bbptemp = bbptemp + value; ++ ++ if ((i < 2) && (bbptemp & 0x800000)) ++ result = (bbptemp & 0xffffff) - 0x1000000; ++ else if (i == 4) ++ result = bbptemp; ++ else ++ result = bbptemp; ++ ++ if (i == 0) ++ mi = result/4096; ++ else if (i == 1) ++ mq = result/4096; ++ else if (i == 2) ++ si = bbptemp/4096; ++ else if (i == 3) ++ sq = bbptemp/4096; ++ else ++ riq = result/4096; ++ } ++ ++ bbpval1 = si - mi*mi; ++ rt2x00_dbg(rt2x00dev, "RXIQ si=%d, sq=%d, riq=%d, bbpval %d, vga_idx %d", si, sq, riq, bbpval1, vga_idx); ++ ++ if (bbpval1 >= (100*100)) ++ break; ++ ++ if (bbpval1 <= 100) ++ vga_idx = vga_idx + 9; ++ else if (bbpval1 <= 158) ++ vga_idx = vga_idx + 8; ++ else if (bbpval1 <= 251) ++ vga_idx = vga_idx + 7; ++ else if (bbpval1 <= 398) ++ vga_idx = vga_idx + 6; ++ else if (bbpval1 <= 630) ++ vga_idx = vga_idx + 5; ++ else if (bbpval1 <= 1000) ++ vga_idx = vga_idx + 4; ++ else if (bbpval1 <= 1584) ++ vga_idx = vga_idx + 3; ++ else if (bbpval1 <= 2511) ++ vga_idx = vga_idx + 2; ++ else ++ vga_idx = vga_idx + 1; ++ } ++ ++ sigma_i = rt2800_do_sqrt_accumulation(100*(si - mi*mi)); ++ sigma_q = rt2800_do_sqrt_accumulation(100*(sq - mq*mq)); ++ r_iq = 10*(riq-(mi*mq)); ++ ++ rt2x00_dbg(rt2x00dev, "Sigma_i=%d, Sigma_q=%d, R_iq=%d", sigma_i, sigma_q, r_iq); ++ ++ if (((sigma_i <= 1400 ) && (sigma_i >= 1000)) ++ && ((sigma_i - sigma_q) <= 112) ++ && ((sigma_i - sigma_q) >= -112) ++ && ((mi <= 32) && (mi >= -32)) ++ && ((mq <= 32) && (mq >= -32))) { ++ r_iq = 10*(riq-(mi*mq)); ++ rt2x00_dbg(rt2x00dev, "RXIQ Sigma_i=%d, Sigma_q=%d, R_iq=%d\n", sigma_i, sigma_q, r_iq); ++ ++ g_rx = (1000 * sigma_q) / sigma_i; ++ g_imb = ((-2) * 128 * (1000 - g_rx)) / (1000 + g_rx); ++ ph_rx = (r_iq * 2292) / (sigma_i * sigma_q); ++ rt2x00_info(rt2x00dev, "RXIQ G_imb=%d, Ph_rx=%d\n", g_imb, ph_rx); ++ ++ if ((ph_rx > 20) || (ph_rx < -20)) { ++ ph_rx = 0; ++ rt2x00_warn(rt2x00dev, "RXIQ calibration FAIL"); ++ } ++ ++ if ((g_imb > 12) || (g_imb < -12)) { ++ g_imb = 0; ++ rt2x00_warn(rt2x00dev, "RXIQ calibration FAIL"); ++ } ++ } ++ else { ++ g_imb = 0; ++ ph_rx = 0; ++ rt2x00_dbg(rt2x00dev, "RXIQ Sigma_i=%d, Sigma_q=%d, R_iq=%d\n", sigma_i, sigma_q, r_iq); ++ rt2x00_warn(rt2x00dev, "RXIQ calibration FAIL"); ++ } ++ ++ if (ch_idx == 0) { ++ rt2800_bbp_write(rt2x00dev, 158, 0x37); ++ rt2800_bbp_write(rt2x00dev, 159, g_imb & 0x3f); ++ rt2800_bbp_write(rt2x00dev, 158, 0x35); ++ rt2800_bbp_write(rt2x00dev, 159, ph_rx & 0x3f); ++ } else { ++ rt2800_bbp_write(rt2x00dev, 158, 0x55); ++ rt2800_bbp_write(rt2x00dev, 159, g_imb & 0x3f); ++ rt2800_bbp_write(rt2x00dev, 158, 0x53); ++ rt2800_bbp_write(rt2x00dev, 159, ph_rx & 0x3f); ++ } ++ } ++ ++restore_value: ++ rt2800_bbp_write(rt2x00dev, 158, 0x3); ++ bbpval = rt2800_bbp_read(rt2x00dev, 159); ++ rt2800_bbp_write(rt2x00dev, 159, (bbpval | 0x07)); ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0x00); ++ rt2800_bbp_write(rt2x00dev, 159, 0x00); ++ rt2800_bbp_write(rt2x00dev, 1, bbp1); ++ rt2800_bbp_write(rt2x00dev, 4, bbp4); ++ rt2800_bbp_write(rt2x00dev, 241, bbpr241); ++ rt2800_bbp_write(rt2x00dev, 242, bbpr242); ++ ++ rt2800_bbp_write(rt2x00dev, 244, 0x00); ++ bbpval = rt2800_bbp_read(rt2x00dev, 21); ++ bbpval = (bbpval | 0x1); ++ rt2800_bbp_write(rt2x00dev, 21, bbpval); ++ usleep_range(10, 200); ++ bbpval = (bbpval & 0xfe); ++ rt2800_bbp_write(rt2x00dev, 21, bbpval); ++ ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, rfb0r1); ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, rfb0r2); ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, rfb0r42); ++ ++ rt2800_rfcsr_write_bank(rt2x00dev, 4, 0, rfb4r0); ++ rt2800_rfcsr_write_bank(rt2x00dev, 4, 19, rfb4r19); ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 3, rfb5r3); ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, rfb5r4); ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 17, rfb5r17); ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 18, rfb5r18); ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 19, rfb5r19); ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 20, rfb5r20); ++ ++ rt2800_rfcsr_write_bank(rt2x00dev, 6, 0, rfb6r0); ++ rt2800_rfcsr_write_bank(rt2x00dev, 6, 19, rfb6r19); ++ rt2800_rfcsr_write_bank(rt2x00dev, 7, 3, rfb7r3); ++ rt2800_rfcsr_write_bank(rt2x00dev, 7, 4, rfb7r4); ++ rt2800_rfcsr_write_bank(rt2x00dev, 7, 17, rfb7r17); ++ rt2800_rfcsr_write_bank(rt2x00dev, 7, 18, rfb7r18); ++ rt2800_rfcsr_write_bank(rt2x00dev, 7, 19, rfb7r19); ++ rt2800_rfcsr_write_bank(rt2x00dev, 7, 20, rfb7r20); ++ ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00000006); ++ udelay(1); ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00000004); ++ udelay(1); ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, orig_RF_CONTROL0); ++ udelay(1); ++ rt2800_register_write(rt2x00dev, RF_BYPASS0, orig_RF_BYPASS0); ++ rt2800_register_write(rt2x00dev, RF_CONTROL1, orig_RF_CONTROL1); ++ rt2800_register_write(rt2x00dev, RF_BYPASS1, orig_RF_BYPASS1); ++ rt2800_register_write(rt2x00dev, RF_CONTROL3, orig_RF_CONTROL3); ++ rt2800_register_write(rt2x00dev, RF_BYPASS3, orig_RF_BYPASS3); ++ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, savemacsysctrl); ++} ++EXPORT_SYMBOL_GPL(rt2800_rxiq_calibration); ++ + static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, + bool set_bw, bool is_ht40) + { +@@ -9316,6 +9696,7 @@ static void rt2800_init_rfcsr_6352(struc + rt2800_rxdcoc_calibration(rt2x00dev); + rt2800_bw_filter_calibration(rt2x00dev, true); + rt2800_bw_filter_calibration(rt2x00dev, false); ++ rt2800_rxiq_calibration(rt2x00dev); + } + + static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h +@@ -257,6 +257,7 @@ void rt2800_rf_self_txdc_cal(struct rt2x + int rt2800_calcrcalibrationcode(struct rt2x00_dev *rt2x00dev, int d1, int d2); + void rt2800_r_calibration(struct rt2x00_dev *rt2x00dev); + void rt2800_rxdcoc_calibration(struct rt2x00_dev *rt2x00dev); ++void rt2800_rxiq_calibration(struct rt2x00_dev *rt2x00dev); + + int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev); + void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev); +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -578,6 +578,7 @@ struct rt2x00lib_ops { + int (*calcrcalibrationcode) (struct rt2x00_dev *rt2x00dev, int d1, int d2); + void (*r_calibration) (struct rt2x00_dev *rt2x00dev); + void (*rxdcoc_calibration) (struct rt2x00_dev *rt2x00dev); ++ void (*rxiq_calibration) (struct rt2x00_dev *rt2x00dev); + + /* + * Data queue handlers. diff --git a/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch b/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch new file mode 100644 index 00000000000000..e0bdbf857d24e4 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/986-rt2x00-add-TX-LOFT-calibration.patch @@ -0,0 +1,1002 @@ +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -9084,6 +9084,954 @@ restore_value: + } + EXPORT_SYMBOL_GPL(rt2800_rxiq_calibration); + ++static void rt2800_rf_configstore(struct rt2x00_dev *rt2x00dev, rf_reg_pair rf_reg_record[][13], u8 chain) ++{ ++ u8 rfvalue = 0; ++ ++ if (chain == CHAIN_0) { ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 1); ++ rf_reg_record[CHAIN_0][0].bank = 0; ++ rf_reg_record[CHAIN_0][0].reg = 1; ++ rf_reg_record[CHAIN_0][0].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 2); ++ rf_reg_record[CHAIN_0][1].bank = 0; ++ rf_reg_record[CHAIN_0][1].reg = 2; ++ rf_reg_record[CHAIN_0][1].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 35); ++ rf_reg_record[CHAIN_0][2].bank = 0; ++ rf_reg_record[CHAIN_0][2].reg = 35; ++ rf_reg_record[CHAIN_0][2].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 42); ++ rf_reg_record[CHAIN_0][3].bank = 0; ++ rf_reg_record[CHAIN_0][3].reg = 42; ++ rf_reg_record[CHAIN_0][3].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 4, 0); ++ rf_reg_record[CHAIN_0][4].bank = 4; ++ rf_reg_record[CHAIN_0][4].reg = 0; ++ rf_reg_record[CHAIN_0][4].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 4, 2); ++ rf_reg_record[CHAIN_0][5].bank = 4; ++ rf_reg_record[CHAIN_0][5].reg = 2; ++ rf_reg_record[CHAIN_0][5].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 4, 34); ++ rf_reg_record[CHAIN_0][6].bank = 4; ++ rf_reg_record[CHAIN_0][6].reg = 34; ++ rf_reg_record[CHAIN_0][6].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 5, 3); ++ rf_reg_record[CHAIN_0][7].bank = 5; ++ rf_reg_record[CHAIN_0][7].reg = 3; ++ rf_reg_record[CHAIN_0][7].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 5, 4); ++ rf_reg_record[CHAIN_0][8].bank = 5; ++ rf_reg_record[CHAIN_0][8].reg = 4; ++ rf_reg_record[CHAIN_0][8].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 5, 17); ++ rf_reg_record[CHAIN_0][9].bank = 5; ++ rf_reg_record[CHAIN_0][9].reg = 17; ++ rf_reg_record[CHAIN_0][9].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 5, 18); ++ rf_reg_record[CHAIN_0][10].bank = 5; ++ rf_reg_record[CHAIN_0][10].reg = 18; ++ rf_reg_record[CHAIN_0][10].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 5, 19); ++ rf_reg_record[CHAIN_0][11].bank = 5; ++ rf_reg_record[CHAIN_0][11].reg = 19; ++ rf_reg_record[CHAIN_0][11].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 5, 20); ++ rf_reg_record[CHAIN_0][12].bank = 5; ++ rf_reg_record[CHAIN_0][12].reg = 20; ++ rf_reg_record[CHAIN_0][12].value = rfvalue; ++ } else if (chain == CHAIN_1) { ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 1); ++ rf_reg_record[CHAIN_1][0].bank = 0; ++ rf_reg_record[CHAIN_1][0].reg = 1; ++ rf_reg_record[CHAIN_1][0].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 2); ++ rf_reg_record[CHAIN_1][1].bank = 0; ++ rf_reg_record[CHAIN_1][1].reg = 2; ++ rf_reg_record[CHAIN_1][1].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 35); ++ rf_reg_record[CHAIN_1][2].bank = 0; ++ rf_reg_record[CHAIN_1][2].reg = 35; ++ rf_reg_record[CHAIN_1][2].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 0, 42); ++ rf_reg_record[CHAIN_1][3].bank = 0; ++ rf_reg_record[CHAIN_1][3].reg = 42; ++ rf_reg_record[CHAIN_1][3].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 6, 0); ++ rf_reg_record[CHAIN_1][4].bank = 6; ++ rf_reg_record[CHAIN_1][4].reg = 0; ++ rf_reg_record[CHAIN_1][4].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 6, 2); ++ rf_reg_record[CHAIN_1][5].bank = 6; ++ rf_reg_record[CHAIN_1][5].reg = 2; ++ rf_reg_record[CHAIN_1][5].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 6, 34); ++ rf_reg_record[CHAIN_1][6].bank = 6; ++ rf_reg_record[CHAIN_1][6].reg = 34; ++ rf_reg_record[CHAIN_1][6].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 7, 3); ++ rf_reg_record[CHAIN_1][7].bank = 7; ++ rf_reg_record[CHAIN_1][7].reg = 3; ++ rf_reg_record[CHAIN_1][7].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 7, 4); ++ rf_reg_record[CHAIN_1][8].bank = 7; ++ rf_reg_record[CHAIN_1][8].reg = 4; ++ rf_reg_record[CHAIN_1][8].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 7, 17); ++ rf_reg_record[CHAIN_1][9].bank = 7; ++ rf_reg_record[CHAIN_1][9].reg = 17; ++ rf_reg_record[CHAIN_1][9].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 7, 18); ++ rf_reg_record[CHAIN_1][10].bank = 7; ++ rf_reg_record[CHAIN_1][10].reg = 18; ++ rf_reg_record[CHAIN_1][10].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 7, 19); ++ rf_reg_record[CHAIN_1][11].bank = 7; ++ rf_reg_record[CHAIN_1][11].reg = 19; ++ rf_reg_record[CHAIN_1][11].value = rfvalue; ++ rfvalue = rt2800_rfcsr_read_bank(rt2x00dev, 7, 20); ++ rf_reg_record[CHAIN_1][12].bank = 7; ++ rf_reg_record[CHAIN_1][12].reg = 20; ++ rf_reg_record[CHAIN_1][12].value = rfvalue; ++ } else { ++ rt2x00_warn(rt2x00dev, "Unknown chain = %u\n", chain); ++ return; ++ } ++ ++ return; ++} ++EXPORT_SYMBOL_GPL(rt2800_rf_configstore); ++ ++static void rt2800_rf_configrecover(struct rt2x00_dev *rt2x00dev, rf_reg_pair rf_record[][13]) ++{ ++ u8 chain_index = 0, record_index = 0; ++ u8 bank = 0, rf_register = 0, value = 0; ++ ++ for (chain_index = 0; chain_index < 2; chain_index++) { ++ for (record_index = 0; record_index < 13; record_index++) { ++ bank = rf_record[chain_index][record_index].bank; ++ rf_register = rf_record[chain_index][record_index].reg; ++ value = rf_record[chain_index][record_index].value; ++ rt2800_rfcsr_write_bank(rt2x00dev, bank, rf_register, value); ++ rt2x00_dbg(rt2x00dev, "bank: %d, rf_register: %d, value: %x\n", bank, rf_register, value); ++ } ++ } ++ ++ return; ++} ++EXPORT_SYMBOL_GPL(rt2800_rf_configrecover); ++ ++static void rt2800_setbbptonegenerator(struct rt2x00_dev *rt2x00dev) ++{ ++ rt2800_bbp_write(rt2x00dev, 158, 0xAA); ++ rt2800_bbp_write(rt2x00dev, 159, 0x00); ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0xAB); ++ rt2800_bbp_write(rt2x00dev, 159, 0x0A); ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0xAC); ++ rt2800_bbp_write(rt2x00dev, 159, 0x3F); ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0xAD); ++ rt2800_bbp_write(rt2x00dev, 159, 0x3F); ++ ++ rt2800_bbp_write(rt2x00dev, 244, 0x40); ++ ++ return; ++} ++EXPORT_SYMBOL_GPL(rt2800_setbbptonegenerator); ++ ++u32 rt2800_do_fft_accumulation(struct rt2x00_dev *rt2x00dev, u8 tidx, u8 read_neg) ++{ ++ u32 macvalue = 0; ++ int fftout_i = 0, fftout_q = 0; ++ u32 ptmp=0, pint = 0; ++ u8 bbp = 0; ++ u8 tidxi; ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0x00); ++ rt2800_bbp_write(rt2x00dev, 159, 0x9b); ++ ++ bbp = 0x9b; ++ ++ while (bbp == 0x9b) { ++ udelay(10); ++ bbp = rt2800_bbp_read(rt2x00dev, 159); ++ bbp = bbp & 0xff; ++ } ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0xba); ++ rt2800_bbp_write(rt2x00dev, 159, tidx); ++ rt2800_bbp_write(rt2x00dev, 159, tidx); ++ rt2800_bbp_write(rt2x00dev, 159, tidx); ++ ++ macvalue = rt2800_register_read(rt2x00dev, 0x057C); ++ ++ fftout_i = (macvalue >> 16); ++ fftout_i = (fftout_i & 0x8000) ? (fftout_i - 0x10000) : fftout_i; ++ fftout_q = (macvalue & 0xffff); ++ fftout_q = (fftout_q & 0x8000) ? (fftout_q - 0x10000) : fftout_q; ++ ptmp = (fftout_i * fftout_i); ++ ptmp = ptmp + (fftout_q * fftout_q); ++ pint = ptmp; ++ rt2x00_dbg(rt2x00dev, "I = %d, Q = %d, power = %x\n", fftout_i, fftout_q, pint); ++ if (read_neg) { ++ pint = pint >> 1; ++ tidxi = 0x40 - tidx; ++ tidxi = tidxi & 0x3f; ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0xba); ++ rt2800_bbp_write(rt2x00dev, 159, tidxi); ++ rt2800_bbp_write(rt2x00dev, 159, tidxi); ++ rt2800_bbp_write(rt2x00dev, 159, tidxi); ++ ++ macvalue = rt2800_register_read(rt2x00dev, 0x057C); ++ ++ fftout_i = (macvalue >> 16); ++ fftout_i = (fftout_i & 0x8000) ? (fftout_i - 0x10000) : fftout_i; ++ fftout_q = (macvalue & 0xffff); ++ fftout_q = (fftout_q & 0x8000) ? (fftout_q - 0x10000) : fftout_q; ++ ptmp = (fftout_i * fftout_i); ++ ptmp = ptmp + (fftout_q * fftout_q); ++ ptmp = ptmp >> 1; ++ pint = pint + ptmp; ++ } ++ ++ return pint; ++} ++EXPORT_SYMBOL_GPL(rt2800_do_fft_accumulation); ++ ++u32 rt2800_read_fft_accumulation(struct rt2x00_dev *rt2x00dev, u8 tidx) { ++ u32 macvalue = 0; ++ int fftout_i = 0, fftout_q = 0; ++ u32 ptmp=0, pint = 0; ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0xBA); ++ rt2800_bbp_write(rt2x00dev, 159, tidx); ++ rt2800_bbp_write(rt2x00dev, 159, tidx); ++ rt2800_bbp_write(rt2x00dev, 159, tidx); ++ ++ macvalue = rt2800_register_read(rt2x00dev, 0x057C); ++ ++ fftout_i = (macvalue >> 16); ++ fftout_i = (fftout_i & 0x8000) ? (fftout_i - 0x10000) : fftout_i; ++ fftout_q = (macvalue & 0xffff); ++ fftout_q = (fftout_q & 0x8000) ? (fftout_q - 0x10000) : fftout_q; ++ ptmp = (fftout_i * fftout_i); ++ ptmp = ptmp + (fftout_q * fftout_q); ++ pint = ptmp; ++ rt2x00_info(rt2x00dev, "I = %d, Q = %d, power = %x\n", fftout_i, fftout_q, pint); ++ ++ return pint; ++} ++EXPORT_SYMBOL_GPL(rt2800_read_fft_accumulation); ++ ++static void rt2800_write_dc(struct rt2x00_dev *rt2x00dev, u8 ch_idx, u8 alc, u8 iorq, u8 dc) ++{ ++ u8 bbp = 0; ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0xb0); ++ bbp = alc | 0x80; ++ rt2800_bbp_write(rt2x00dev, 159, bbp); ++ ++ if (ch_idx == 0) ++ bbp = (iorq == 0) ? 0xb1: 0xb2; ++ else ++ bbp = (iorq == 0) ? 0xb8: 0xb9; ++ ++ rt2800_bbp_write(rt2x00dev, 158, bbp); ++ bbp = dc; ++ rt2800_bbp_write(rt2x00dev, 159, bbp); ++ ++ return; ++} ++EXPORT_SYMBOL_GPL(rt2800_write_dc); ++ ++static void rt2800_loft_search(struct rt2x00_dev *rt2x00dev, u8 ch_idx, u8 alc_idx, u8 dc_result[][RF_ALC_NUM][2]) ++{ ++ u32 p0 = 0, p1 = 0, pf = 0; ++ char idx0 = 0, idx1 = 0; ++ u8 idxf[] = {0x00, 0x00}; ++ u8 ibit = 0x20; ++ u8 iorq; ++ char bidx; ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0xb0); ++ rt2800_bbp_write(rt2x00dev, 159, 0x80); ++ ++ for (bidx = 5; bidx >= 0; bidx--) { ++ for (iorq = 0; iorq <= 1; iorq++) { ++ rt2x00_dbg(rt2x00dev, "\n========================================================\n"); ++ ++ if (idxf[iorq] == 0x20) { ++ idx0 = 0x20; ++ p0 = pf; ++ } else { ++ idx0 = idxf[iorq] - ibit; ++ idx0 = idx0 & 0x3F; ++ rt2800_write_dc(rt2x00dev, ch_idx, 0, iorq, idx0); ++ p0 = rt2800_do_fft_accumulation(rt2x00dev, 0x0A, 0); ++ } ++ ++ idx1 = idxf[iorq] + ((bidx == 5) ? 0 : ibit); ++ idx1 = idx1 & 0x3F; ++ rt2800_write_dc(rt2x00dev, ch_idx, 0, iorq, idx1); ++ p1 = rt2800_do_fft_accumulation(rt2x00dev, 0x0A, 0); ++ ++ rt2x00_dbg(rt2x00dev, "alc=%u, IorQ=%u, idx_final=%2x\n", alc_idx, iorq, idxf[iorq]); ++ rt2x00_dbg(rt2x00dev, "p0=%x, p1=%x, pf=%x, idx_0=%x, idx_1=%x, ibit=%x !\n", p0, p1, pf, idx0, idx1, ibit); ++ ++ if ((bidx != 5) && (pf <= p0) && (pf < p1)) { ++ pf = pf; ++ idxf[iorq] = idxf[iorq]; ++ } else if (p0 < p1) { ++ pf = p0; ++ idxf[iorq] = idx0 & 0x3F; ++ } else { ++ pf = p1; ++ idxf[iorq] = idx1 & 0x3F; ++ } ++ rt2x00_dbg(rt2x00dev, "IorQ=%u, idx_final[%u]:%x, pf:%8x\n", iorq, iorq, idxf[iorq], pf); ++ ++ rt2800_write_dc(rt2x00dev, ch_idx, 0, iorq, idxf[iorq]); ++ ++ } ++ ibit = ibit >> 1; ++ } ++ dc_result[ch_idx][alc_idx][0] = idxf[0]; ++ dc_result[ch_idx][alc_idx][1] = idxf[1]; ++ ++ return; ++} ++EXPORT_SYMBOL_GPL(rt2800_loft_search); ++ ++static void rt2800_iq_search(struct rt2x00_dev *rt2x00dev, u8 ch_idx, u8 *ges, u8 *pes) ++{ ++ u32 p0 = 0, p1 = 0, pf = 0; ++ char perr = 0, gerr = 0, iq_err = 0; ++ char pef = 0, gef = 0; ++ char psta, pend; ++ char gsta, gend; ++ ++ u8 ibit = 0x20; ++ u8 first_search = 0x00, touch_neg_max = 0x00; ++ char idx0 = 0, idx1 = 0; ++ u8 gop; ++ u8 bbp = 0; ++ char bidx; ++ ++ rt2x00_info(rt2x00dev, "IQCalibration Start!\n"); ++ for (bidx = 5; bidx >= 1; bidx--) { ++ for (gop = 0; gop < 2; gop++) { ++ rt2x00_dbg(rt2x00dev, "\n========================================================\n"); ++ ++ if ((gop == 1) || (bidx < 4)) { ++ if (gop == 0) ++ iq_err = gerr; ++ else ++ iq_err = perr; ++ ++ first_search = (gop == 0) ? (bidx == 3) : (bidx == 5); ++ touch_neg_max = (gop) ? ((iq_err & 0x0F) == 0x08) : ((iq_err & 0x3F) == 0x20); ++ ++ if (touch_neg_max) { ++ p0 = pf; ++ idx0 = iq_err; ++ } else { ++ idx0 = iq_err - ibit; ++ bbp = (ch_idx == 0) ? ((gop == 0) ? 0x28 : 0x29): ((gop == 0) ? 0x46 : 0x47); ++ ++ rt2800_bbp_write(rt2x00dev, 158, bbp); ++ rt2800_bbp_write(rt2x00dev, 159, idx0); ++ ++ p0 = rt2800_do_fft_accumulation(rt2x00dev, 0x14, 1); ++ } ++ ++ idx1 = iq_err + (first_search ? 0 : ibit); ++ idx1 = (gop == 0) ? (idx1 & 0x0F) : (idx1 & 0x3F); ++ ++ bbp = (ch_idx == 0) ? (gop == 0) ? 0x28 : 0x29 : (gop == 0) ? 0x46 : 0x47; ++ ++ rt2800_bbp_write(rt2x00dev, 158, bbp); ++ rt2800_bbp_write(rt2x00dev, 159, idx1); ++ ++ p1 = rt2800_do_fft_accumulation(rt2x00dev, 0x14, 1); ++ ++ rt2x00_dbg(rt2x00dev, "p0=%x, p1=%x, pwer_final=%x, idx0=%x, idx1=%x, iq_err=%x, gop=%d, ibit=%x !\n", p0, p1, pf, idx0, idx1, iq_err, gop, ibit); ++ ++ if ((!first_search) && (pf <= p0) && (pf < p1)) { ++ pf = pf; ++ } else if (p0 < p1) { ++ pf = p0; ++ iq_err = idx0; ++ } else { ++ pf = p1; ++ iq_err = idx1; ++ } ++ ++ bbp = (ch_idx == 0) ? (gop == 0) ? 0x28 : 0x29 : (gop == 0) ? 0x46 : 0x47; ++ ++ rt2800_bbp_write(rt2x00dev, 158, bbp); ++ rt2800_bbp_write(rt2x00dev, 159, iq_err); ++ ++ if (gop == 0) ++ gerr = iq_err; ++ else ++ perr = iq_err; ++ ++ rt2x00_dbg(rt2x00dev, "IQCalibration pf=%8x (%2x, %2x) !\n", pf, gerr & 0x0F, perr & 0x3F); ++ ++ } ++ } ++ ++ if (bidx > 0) ++ ibit = (ibit >> 1); ++ } ++ gerr = (gerr & 0x08) ? (gerr & 0x0F) - 0x10 : (gerr & 0x0F); ++ perr = (perr & 0x20) ? (perr & 0x3F) - 0x40 : (perr & 0x3F); ++ ++ gerr = (gerr < -0x07) ? -0x07 : (gerr > 0x05) ? 0x05 : gerr; ++ gsta = gerr - 1; ++ gend = gerr + 2; ++ ++ perr = (perr < -0x1f) ? -0x1f : (perr > 0x1d) ? 0x1d : perr; ++ psta = perr - 1; ++ pend = perr + 2; ++ ++ for (gef = gsta; gef <= gend; gef = gef + 1) ++ for (pef = psta; pef <= pend; pef = pef + 1) { ++ bbp = (ch_idx == 0) ? 0x28 : 0x46; ++ rt2800_bbp_write(rt2x00dev, 158, bbp); ++ rt2800_bbp_write(rt2x00dev, 159, gef & 0x0F); ++ ++ bbp = (ch_idx == 0) ? 0x29 : 0x47; ++ rt2800_bbp_write(rt2x00dev, 158, bbp); ++ rt2800_bbp_write(rt2x00dev, 159, pef & 0x3F); ++ ++ p1 = rt2800_do_fft_accumulation(rt2x00dev, 0x14, 1); ++ if ((gef == gsta) && (pef == psta)) { ++ pf = p1; ++ gerr = gef; ++ perr = pef; ++ } ++ else if (pf > p1){ ++ pf = p1; ++ gerr = gef; ++ perr = pef; ++ } ++ rt2x00_dbg(rt2x00dev, "Fine IQCalibration p1=%8x pf=%8x (%2x, %2x) !\n", p1, pf, gef & 0x0F, pef & 0x3F); ++ } ++ ++ ges[ch_idx] = gerr & 0x0F; ++ pes[ch_idx] = perr & 0x3F; ++ ++ rt2x00_info(rt2x00dev, "IQCalibration Done! CH = %u, (gain=%2x, phase=%2x)\n", ch_idx, gerr & 0x0F, perr & 0x3F); ++ ++ return; ++} ++EXPORT_SYMBOL_GPL(rt2800_iq_search); ++ ++static void rt2800_rf_aux_tx0_loopback(struct rt2x00_dev *rt2x00dev) ++{ ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, 0x21); ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, 0x10); ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 35, 0x00); ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, 0x1b); ++ rt2800_rfcsr_write_bank(rt2x00dev, 4, 0, 0x81); ++ rt2800_rfcsr_write_bank(rt2x00dev, 4, 2, 0x81); ++ rt2800_rfcsr_write_bank(rt2x00dev, 4, 34, 0xee); ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 3, 0x2d); ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 4, 0x2d); ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 17, 0x80); ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 18, 0xd7); ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 19, 0xa2); ++ rt2800_rfcsr_write_bank(rt2x00dev, 5, 20, 0x20); ++} ++EXPORT_SYMBOL_GPL(rt2800_rf_aux_tx0_loopback); ++ ++static void rt2800_rf_aux_tx1_loopback(struct rt2x00_dev *rt2x00dev) ++{ ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 1, 0x22); ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 2, 0x20); ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 35, 0x00); ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, 0x4b); ++ rt2800_rfcsr_write_bank(rt2x00dev, 6, 0, 0x81); ++ rt2800_rfcsr_write_bank(rt2x00dev, 6, 2, 0x81); ++ rt2800_rfcsr_write_bank(rt2x00dev, 6, 34, 0xee); ++ rt2800_rfcsr_write_bank(rt2x00dev, 7, 3, 0x2d); ++ rt2800_rfcsr_write_bank(rt2x00dev, 7, 4, 0x2d); ++ rt2800_rfcsr_write_bank(rt2x00dev, 7, 17, 0x80); ++ rt2800_rfcsr_write_bank(rt2x00dev, 7, 18, 0xd7); ++ rt2800_rfcsr_write_bank(rt2x00dev, 7, 19, 0xa2); ++ rt2800_rfcsr_write_bank(rt2x00dev, 7, 20, 0x20); ++} ++EXPORT_SYMBOL_GPL(rt2800_rf_aux_tx1_loopback); ++ ++void rt2800_loft_iq_calibration(struct rt2x00_dev *rt2x00dev) ++{ ++ rf_reg_pair rf_store[CHAIN_NUM][13]; ++ u32 macorg1 = 0; ++ u32 macorg2 = 0; ++ u32 macorg3 = 0; ++ u32 macorg4 = 0; ++ u32 macorg5 = 0; ++ u32 orig528 = 0; ++ u32 orig52c = 0; ++ ++ u32 savemacsysctrl = 0, mtxcycle = 0; ++ u32 macvalue = 0; ++ u32 mac13b8 = 0; ++ u32 p0 = 0, p1 = 0; ++ u32 p0_idx10 = 0, p1_idx10 = 0; ++ ++ u8 rfvalue; ++ u8 loft_dc_search_result[CHAIN_NUM][RF_ALC_NUM][2]; ++ u8 ger[CHAIN_NUM], per[CHAIN_NUM]; ++ u8 rf_gain[] = {0x00, 0x01, 0x02, 0x04, 0x08, 0x0c}; ++ u8 rfvga_gain_table[] = {0x24, 0x25, 0x26, 0x27, 0x28, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3F}; ++ ++ u8 vga_gain[] = {14, 14}; ++ u8 bbp_2324gain[] = {0x16, 0x14, 0x12, 0x10, 0x0c, 0x08}; ++ u8 bbp = 0, ch_idx = 0, rf_alc_idx = 0, idx = 0; ++ u8 bbpr30, rfb0r39, rfb0r42; ++ u8 bbpr1; ++ u8 bbpr4; ++ u8 bbpr241, bbpr242; ++ u8 count_step; ++ ++ savemacsysctrl = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); ++ macorg1 = rt2800_register_read(rt2x00dev, TX_PIN_CFG); ++ macorg2 = rt2800_register_read(rt2x00dev, RF_CONTROL0); ++ macorg3 = rt2800_register_read(rt2x00dev, RF_BYPASS0); ++ macorg4 = rt2800_register_read(rt2x00dev, RF_CONTROL3); ++ macorg5 = rt2800_register_read(rt2x00dev, RF_BYPASS3); ++ mac13b8 = rt2800_register_read(rt2x00dev, 0x13b8); ++ orig528 = rt2800_register_read(rt2x00dev, RF_CONTROL2); ++ orig52c = rt2800_register_read(rt2x00dev, RF_BYPASS2); ++ ++ macvalue = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); ++ macvalue &= (~0x04); ++ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, macvalue); ++ ++ for (mtxcycle = 0; mtxcycle < 10000; mtxcycle++) { ++ macvalue = rt2800_register_read(rt2x00dev, MAC_STATUS_CFG); ++ if (macvalue & 0x01) ++ udelay(50); ++ else ++ break; ++ } ++ ++ macvalue = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); ++ macvalue &= (~0x08); ++ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, macvalue); ++ ++ for (mtxcycle = 0; mtxcycle < 10000; mtxcycle++) { ++ macvalue = rt2800_register_read(rt2x00dev, MAC_STATUS_CFG); ++ if (macvalue & 0x02) ++ udelay(50); ++ else ++ break; ++ } ++ ++ for (ch_idx = 0; ch_idx < 2; ch_idx++) { ++ rt2800_rf_configstore(rt2x00dev, rf_store, ch_idx); ++ } ++ ++ bbpr30 = rt2800_bbp_read(rt2x00dev, 30); ++ rfb0r39 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 39); ++ rfb0r42 = rt2800_rfcsr_read_bank(rt2x00dev, 0, 42); ++ ++ rt2800_bbp_write(rt2x00dev, 30, 0x1F); ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 39, 0x80); ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, 0x5B); ++ ++ rt2800_bbp_write(rt2x00dev, 23, 0x00); ++ rt2800_bbp_write(rt2x00dev, 24, 0x00); ++ ++ rt2800_setbbptonegenerator(rt2x00dev); ++ ++ for (ch_idx = 0; ch_idx < 2; ch_idx ++) { ++ rt2800_bbp_write(rt2x00dev, 23, 0x00); ++ rt2800_bbp_write(rt2x00dev, 24, 0x00); ++ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00); ++ rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x0000000F); ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00000004); ++ rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x00003306); ++ rt2800_register_write(rt2x00dev, 0x13b8, 0x10); ++ udelay(1); ++ ++ if (ch_idx == 0) { ++ rt2800_rf_aux_tx0_loopback(rt2x00dev); ++ } else { ++ rt2800_rf_aux_tx1_loopback(rt2x00dev); ++ } ++ udelay(1); ++ ++ if (ch_idx == 0) { ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00001004); ++ } else { ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00002004); ++ } ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0x05); ++ rt2800_bbp_write(rt2x00dev, 159, 0x00); ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0x01); ++ if (ch_idx == 0) ++ rt2800_bbp_write(rt2x00dev, 159, 0x00); ++ else ++ rt2800_bbp_write(rt2x00dev, 159, 0x01); ++ ++ vga_gain[ch_idx] = 18; ++ for (rf_alc_idx = 0; rf_alc_idx < 3; rf_alc_idx++) { ++ rt2800_bbp_write(rt2x00dev, 23, bbp_2324gain[rf_alc_idx]); ++ rt2800_bbp_write(rt2x00dev, 24, bbp_2324gain[rf_alc_idx]); ++ ++ macvalue = rt2800_register_read(rt2x00dev, RF_CONTROL3); ++ macvalue &= (~0x0000F1F1); ++ macvalue |= (rf_gain[rf_alc_idx] << 4); ++ macvalue |= (rf_gain[rf_alc_idx] << 12); ++ rt2800_register_write(rt2x00dev, RF_CONTROL3, macvalue); ++ macvalue = (0x0000F1F1); ++ rt2800_register_write(rt2x00dev, RF_BYPASS3, macvalue); ++ ++ if (rf_alc_idx == 0) { ++ rt2800_write_dc(rt2x00dev, ch_idx, 0, 1, 0x21); ++ for (;vga_gain[ch_idx] > 0;vga_gain[ch_idx] = vga_gain[ch_idx] - 2) { ++ rfvalue = rfvga_gain_table[vga_gain[ch_idx]]; ++ rt2800_rfcsr_write_dccal(rt2x00dev, 3, rfvalue); ++ rt2800_rfcsr_write_dccal(rt2x00dev, 4, rfvalue); ++ rt2800_write_dc(rt2x00dev, ch_idx, 0, 1, 0x00); ++ rt2800_write_dc(rt2x00dev, ch_idx, 0, 0, 0x00); ++ p0 = rt2800_do_fft_accumulation(rt2x00dev, 0x0A, 0); ++ rt2800_write_dc(rt2x00dev, ch_idx, 0, 0, 0x21); ++ p1 = rt2800_do_fft_accumulation(rt2x00dev, 0x0A, 0); ++ rt2x00_dbg(rt2x00dev, "LOFT AGC %d %d\n", p0, p1); ++ if ((p0 < 7000*7000) && (p1 < (7000*7000))) { ++ break; ++ } ++ } ++ ++ rt2800_write_dc(rt2x00dev, ch_idx, 0, 0, 0x00); ++ rt2800_write_dc(rt2x00dev, ch_idx, 0, 1, 0x00); ++ ++ rt2x00_dbg(rt2x00dev, "Used VGA %d %x\n",vga_gain[ch_idx], rfvga_gain_table[vga_gain[ch_idx]]); ++ ++ if (vga_gain[ch_idx] < 0) ++ vga_gain[ch_idx] = 0; ++ } ++ ++ rfvalue = rfvga_gain_table[vga_gain[ch_idx]]; ++ ++ rt2800_rfcsr_write_dccal(rt2x00dev, 3, rfvalue); ++ rt2800_rfcsr_write_dccal(rt2x00dev, 4, rfvalue); ++ ++ rt2800_loft_search(rt2x00dev, ch_idx, rf_alc_idx, loft_dc_search_result); ++ } ++ } ++ ++ for (rf_alc_idx = 0; rf_alc_idx < 3; rf_alc_idx++) { ++ for (idx = 0; idx < 4; idx++) { ++ rt2800_bbp_write(rt2x00dev, 158, 0xB0); ++ bbp = (idx<<2) + rf_alc_idx; ++ rt2800_bbp_write(rt2x00dev, 159, bbp); ++ rt2x00_dbg(rt2x00dev, " ALC %2x,", bbp); ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0xb1); ++ bbp = loft_dc_search_result[CHAIN_0][rf_alc_idx][0x00]; ++ bbp = bbp & 0x3F; ++ rt2800_bbp_write(rt2x00dev, 159, bbp); ++ rt2x00_dbg(rt2x00dev, " I0 %2x,", bbp); ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0xb2); ++ bbp = loft_dc_search_result[CHAIN_0][rf_alc_idx][0x01]; ++ bbp = bbp & 0x3F; ++ rt2800_bbp_write(rt2x00dev, 159, bbp); ++ rt2x00_dbg(rt2x00dev, " Q0 %2x,", bbp); ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0xb8); ++ bbp = loft_dc_search_result[CHAIN_1][rf_alc_idx][0x00]; ++ bbp = bbp & 0x3F; ++ rt2800_bbp_write(rt2x00dev, 159, bbp); ++ rt2x00_dbg(rt2x00dev, " I1 %2x,", bbp); ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0xb9); ++ bbp = loft_dc_search_result[CHAIN_1][rf_alc_idx][0x01]; ++ bbp = bbp & 0x3F; ++ rt2800_bbp_write(rt2x00dev, 159, bbp); ++ rt2x00_dbg(rt2x00dev, " Q1 %2x\n", bbp); ++ } ++ } ++ ++ rt2800_bbp_write(rt2x00dev, 23, 0x00); ++ rt2800_bbp_write(rt2x00dev, 24, 0x00); ++ ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x04); ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0x00); ++ rt2800_bbp_write(rt2x00dev, 159, 0x00); ++ ++ bbp = 0x00; ++ rt2800_bbp_write(rt2x00dev, 244, 0x00); ++ ++ rt2800_bbp_write(rt2x00dev, 21, 0x01); ++ udelay(1); ++ rt2800_bbp_write(rt2x00dev, 21, 0x00); ++ ++ rt2800_rf_configrecover(rt2x00dev, rf_store); ++ ++ rt2800_register_write(rt2x00dev, TX_PIN_CFG, macorg1); ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x04); ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00); ++ rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x00); ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, macorg2); ++ udelay(1); ++ rt2800_register_write(rt2x00dev, RF_BYPASS0, macorg3); ++ rt2800_register_write(rt2x00dev, RF_CONTROL3, macorg4); ++ rt2800_register_write(rt2x00dev, RF_BYPASS3, macorg5); ++ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, savemacsysctrl); ++ rt2800_register_write(rt2x00dev, RF_CONTROL2, orig528); ++ rt2800_register_write(rt2x00dev, RF_BYPASS2, orig52c); ++ rt2800_register_write(rt2x00dev, 0x13b8, mac13b8); ++ ++ rt2x00_info(rt2x00dev, "LOFT Calibration Done!\n"); ++ ++ savemacsysctrl = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); ++ macorg1 = rt2800_register_read(rt2x00dev, TX_PIN_CFG); ++ macorg2 = rt2800_register_read(rt2x00dev, RF_CONTROL0); ++ macorg3 = rt2800_register_read(rt2x00dev, RF_BYPASS0); ++ macorg4 = rt2800_register_read(rt2x00dev, RF_CONTROL3); ++ macorg5 = rt2800_register_read(rt2x00dev, RF_BYPASS3); ++ ++ bbpr1 = rt2800_bbp_read(rt2x00dev, 1); ++ bbpr4 = rt2800_bbp_read(rt2x00dev, 4); ++ bbpr241 = rt2800_bbp_read(rt2x00dev, 241); ++ bbpr242 = rt2800_bbp_read(rt2x00dev, 242); ++ mac13b8 = rt2800_register_read(rt2x00dev, 0x13b8); ++ ++ macvalue = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); ++ macvalue &= (~0x04); ++ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, macvalue); ++ for (mtxcycle = 0; mtxcycle < 10000; mtxcycle++) { ++ macvalue = rt2800_register_read(rt2x00dev, MAC_STATUS_CFG); ++ if (macvalue & 0x01) ++ udelay(50); ++ else ++ break; ++ } ++ ++ macvalue = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); ++ macvalue &= (~0x08); ++ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, macvalue); ++ for (mtxcycle = 0; mtxcycle < 10000; mtxcycle++) { ++ macvalue = rt2800_register_read(rt2x00dev, MAC_STATUS_CFG); ++ if (macvalue & 0x02) ++ udelay(50); ++ else ++ break; ++ } ++ ++ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { ++ rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x00000101); ++ rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0000F1F1); ++ } ++ ++ rt2800_bbp_write(rt2x00dev, 23, 0x00); ++ rt2800_bbp_write(rt2x00dev, 24, 0x00); ++ ++ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { ++ rt2800_bbp_write(rt2x00dev, 4, bbpr4 & (~0x18)); ++ rt2800_bbp_write(rt2x00dev, 21, 0x01); ++ udelay(1); ++ rt2800_bbp_write(rt2x00dev, 21, 0x00); ++ ++ rt2800_bbp_write(rt2x00dev, 241, 0x14); ++ rt2800_bbp_write(rt2x00dev, 242, 0x80); ++ rt2800_bbp_write(rt2x00dev, 244, 0x31); ++ } else { ++ rt2800_setbbptonegenerator(rt2x00dev); ++ } ++ ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00000004); ++ rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x00003306); ++ udelay(1); ++ ++ rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x0000000F); ++ ++ if (!test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { ++ rt2800_register_write(rt2x00dev, RF_CONTROL3, 0x00000000); ++ rt2800_register_write(rt2x00dev, RF_BYPASS3, 0x0000F1F1); ++ } ++ ++ rt2800_register_write(rt2x00dev, 0x13b8, 0x00000010); ++ ++ for (ch_idx = 0; ch_idx < 2; ch_idx++) { ++ rt2800_rf_configstore(rt2x00dev, rf_store, ch_idx); ++ } ++ ++ rt2800_rfcsr_write_dccal(rt2x00dev, 3, 0x3B); ++ rt2800_rfcsr_write_dccal(rt2x00dev, 4, 0x3B); ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0x03); ++ rt2800_bbp_write(rt2x00dev, 159, 0x60); ++ rt2800_bbp_write(rt2x00dev, 158, 0xB0); ++ rt2800_bbp_write(rt2x00dev, 159, 0x80); ++ ++ for (ch_idx = 0; ch_idx < 2; ch_idx ++) { ++ rt2800_bbp_write(rt2x00dev, 23, 0x00); ++ rt2800_bbp_write(rt2x00dev, 24, 0x00); ++ ++ if (ch_idx == 0) { ++ rt2800_bbp_write(rt2x00dev, 158, 0x01); ++ rt2800_bbp_write(rt2x00dev, 159, 0x00); ++ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { ++ bbp = bbpr1 & (~0x18); ++ bbp = bbp | 0x00; ++ rt2800_bbp_write(rt2x00dev, 1, bbp); ++ } ++ rt2800_rf_aux_tx0_loopback(rt2x00dev); ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00001004); ++ } else { ++ rt2800_bbp_write(rt2x00dev, 158, 0x01); ++ rt2800_bbp_write(rt2x00dev, 159, 0x01); ++ if (test_bit(CAPABILITY_EXTERNAL_PA_TX1, &rt2x00dev->cap_flags)) { ++ bbp = bbpr1 & (~0x18); ++ bbp = bbp | 0x08; ++ rt2800_bbp_write(rt2x00dev, 1, bbp); ++ } ++ rt2800_rf_aux_tx1_loopback(rt2x00dev); ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00002004); ++ } ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0x05); ++ rt2800_bbp_write(rt2x00dev, 159, 0x04); ++ ++ bbp = (ch_idx == 0) ? 0x28 : 0x46; ++ rt2800_bbp_write(rt2x00dev, 158, bbp); ++ rt2800_bbp_write(rt2x00dev, 159, 0x00); ++ ++ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { ++ rt2800_bbp_write(rt2x00dev, 23, 0x06); ++ rt2800_bbp_write(rt2x00dev, 24, 0x06); ++ count_step = 1; ++ } else { ++ rt2800_bbp_write(rt2x00dev, 23, 0x1F); ++ rt2800_bbp_write(rt2x00dev, 24, 0x1F); ++ count_step = 2; ++ } ++ ++ for (;vga_gain[ch_idx] < 19; vga_gain[ch_idx]=(vga_gain[ch_idx] + count_step)) { ++ rfvalue = rfvga_gain_table[vga_gain[ch_idx]]; ++ rt2800_rfcsr_write_dccal(rt2x00dev, 3, rfvalue); ++ rt2800_rfcsr_write_dccal(rt2x00dev, 4, rfvalue); ++ ++ bbp = (ch_idx == 0) ? 0x29 : 0x47; ++ rt2800_bbp_write(rt2x00dev, 158, bbp); ++ rt2800_bbp_write(rt2x00dev, 159, 0x00); ++ p0 = rt2800_do_fft_accumulation(rt2x00dev, 0x14, 0); ++ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { ++ p0_idx10 = rt2800_read_fft_accumulation(rt2x00dev, 0x0A); ++ } ++ ++ bbp = (ch_idx == 0) ? 0x29 : 0x47; ++ rt2800_bbp_write(rt2x00dev, 158, bbp); ++ rt2800_bbp_write(rt2x00dev, 159, 0x21); ++ p1 = rt2800_do_fft_accumulation(rt2x00dev, 0x14, 0); ++ if (test_bit(CAPABILITY_EXTERNAL_PA_TX1, &rt2x00dev->cap_flags)) { ++ p1_idx10 = rt2800_read_fft_accumulation(rt2x00dev, 0x0A); ++ } ++ ++ rt2x00_dbg(rt2x00dev, "IQ AGC %d %d\n", p0, p1); ++ ++ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { ++ rt2x00_dbg(rt2x00dev, "IQ AGC IDX 10 %d %d\n", p0_idx10, p1_idx10); ++ if ((p0_idx10 > 7000*7000) || (p1_idx10 > 7000*7000)) { ++ if (vga_gain[ch_idx]!=0) ++ vga_gain[ch_idx] = vga_gain[ch_idx]-1; ++ break; ++ } ++ } ++ ++ if ((p0 > 2500*2500) || (p1 > 2500*2500)) { ++ break; ++ } ++ } ++ ++ if (vga_gain[ch_idx] > 18) ++ vga_gain[ch_idx] = 18; ++ rt2x00_dbg(rt2x00dev, "Used VGA %d %x\n",vga_gain[ch_idx], rfvga_gain_table[vga_gain[ch_idx]]); ++ ++ bbp = (ch_idx == 0) ? 0x29 : 0x47; ++ rt2800_bbp_write(rt2x00dev, 158, bbp); ++ rt2800_bbp_write(rt2x00dev, 159, 0x00); ++ ++ rt2800_iq_search(rt2x00dev, ch_idx, ger, per); ++ } ++ ++ rt2800_bbp_write(rt2x00dev, 23, 0x00); ++ rt2800_bbp_write(rt2x00dev, 24, 0x00); ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x04); ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0x28); ++ bbp = ger[CHAIN_0] & 0x0F; ++ rt2800_bbp_write(rt2x00dev, 159, bbp); ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0x29); ++ bbp = per[CHAIN_0] & 0x3F; ++ rt2800_bbp_write(rt2x00dev, 159, bbp); ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0x46); ++ bbp = ger[CHAIN_1] & 0x0F; ++ rt2800_bbp_write(rt2x00dev, 159, bbp); ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0x47); ++ bbp = per[CHAIN_1] & 0x3F; ++ rt2800_bbp_write(rt2x00dev, 159, bbp); ++ ++ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { ++ rt2800_bbp_write(rt2x00dev, 1, bbpr1); ++ rt2800_bbp_write(rt2x00dev, 241, bbpr241); ++ rt2800_bbp_write(rt2x00dev, 242, bbpr242); ++ } ++ rt2800_bbp_write(rt2x00dev, 244, 0x00); ++ ++ rt2800_bbp_write(rt2x00dev, 158, 0x00); ++ rt2800_bbp_write(rt2x00dev, 159, 0x00); ++ rt2800_bbp_write(rt2x00dev, 158, 0xB0); ++ rt2800_bbp_write(rt2x00dev, 159, 0x00); ++ ++ rt2800_bbp_write(rt2x00dev, 30, bbpr30); ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 39, rfb0r39); ++ rt2800_rfcsr_write_bank(rt2x00dev, 0, 42, rfb0r42); ++ ++ if (test_bit(CAPABILITY_EXTERNAL_PA_TX0, &rt2x00dev->cap_flags)) { ++ rt2800_bbp_write(rt2x00dev, 4, bbpr4); ++ } ++ ++ rt2800_bbp_write(rt2x00dev, 21, 0x01); ++ udelay(1); ++ rt2800_bbp_write(rt2x00dev, 21, 0x00); ++ ++ rt2800_rf_configrecover(rt2x00dev, rf_store); ++ ++ rt2800_register_write(rt2x00dev, TX_PIN_CFG, macorg1); ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, 0x00); ++ rt2800_register_write(rt2x00dev, RF_BYPASS0, 0x00); ++ rt2800_register_write(rt2x00dev, RF_CONTROL0, macorg2); ++ udelay(1); ++ rt2800_register_write(rt2x00dev, RF_BYPASS0, macorg3); ++ rt2800_register_write(rt2x00dev, RF_CONTROL3, macorg4); ++ rt2800_register_write(rt2x00dev, RF_BYPASS3, macorg5); ++ rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, savemacsysctrl); ++ rt2800_register_write(rt2x00dev, 0x13b8, mac13b8); ++ ++ rt2x00_info(rt2x00dev, "TX IQ Calibration Done!\n"); ++ ++ return; ++} ++EXPORT_SYMBOL_GPL(rt2800_loft_iq_calibration); ++ + static void rt2800_bbp_core_soft_reset(struct rt2x00_dev *rt2x00dev, + bool set_bw, bool is_ht40) + { +@@ -9696,6 +10644,7 @@ static void rt2800_init_rfcsr_6352(struc + rt2800_rxdcoc_calibration(rt2x00dev); + rt2800_bw_filter_calibration(rt2x00dev, true); + rt2800_bw_filter_calibration(rt2x00dev, false); ++ rt2800_loft_iq_calibration(rt2x00dev); + rt2800_rxiq_calibration(rt2x00dev); + } + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h +@@ -28,6 +28,16 @@ + #define WCID_START 33 + #define WCID_END 222 + #define STA_IDS_SIZE (WCID_END - WCID_START + 2) ++#define CHAIN_0 0x0 ++#define CHAIN_1 0x1 ++#define RF_ALC_NUM 6 ++#define CHAIN_NUM 2 ++ ++typedef struct rf_reg_pair { ++ u8 bank; ++ u8 reg; ++ u8 value; ++} rf_reg_pair; + + /* RT2800 driver data structure */ + struct rt2800_drv_data { +@@ -258,6 +268,7 @@ int rt2800_calcrcalibrationcode(struct r + void rt2800_r_calibration(struct rt2x00_dev *rt2x00dev); + void rt2800_rxdcoc_calibration(struct rt2x00_dev *rt2x00dev); + void rt2800_rxiq_calibration(struct rt2x00_dev *rt2x00dev); ++void rt2800_loft_iq_calibration(struct rt2x00_dev *rt2x00dev); + + int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev); + void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev); +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h +@@ -579,6 +579,7 @@ struct rt2x00lib_ops { + void (*r_calibration) (struct rt2x00_dev *rt2x00dev); + void (*rxdcoc_calibration) (struct rt2x00_dev *rt2x00dev); + void (*rxiq_calibration) (struct rt2x00_dev *rt2x00dev); ++ void (*loft_iq_calibration) (struct rt2x00_dev *rt2x00dev); + + /* + * Data queue handlers. diff --git a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch b/package/kernel/mac80211/patches/subsys/100-remove-cryptoapi-dependencies.patch similarity index 95% rename from package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch rename to package/kernel/mac80211/patches/subsys/100-remove-cryptoapi-dependencies.patch index 8d7a39a6dfe82b..0cedfb3ac66f61 100644 --- a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch +++ b/package/kernel/mac80211/patches/subsys/100-remove-cryptoapi-dependencies.patch @@ -1,6 +1,6 @@ --- a/net/mac80211/Makefile +++ b/net/mac80211/Makefile -@@ -6,7 +6,6 @@ mac80211-y := \ +@@ -7,7 +7,6 @@ mac80211-y := \ driver-ops.o \ sta_info.o \ wep.o \ @@ -8,7 +8,7 @@ wpa.o \ scan.o offchannel.o \ ht.o agg-tx.o agg-rx.o \ -@@ -16,8 +15,8 @@ mac80211-y := \ +@@ -18,8 +17,8 @@ mac80211-y := \ rate.o \ michael.o \ tkip.o \ @@ -385,7 +385,7 @@ #endif /* AES_GCM_H */ --- a/net/mac80211/wpa.c +++ b/net/mac80211/wpa.c -@@ -306,7 +306,8 @@ ieee80211_crypto_tkip_decrypt(struct iee +@@ -314,7 +314,8 @@ ieee80211_crypto_tkip_decrypt(struct iee } @@ -395,7 +395,7 @@ { __le16 mask_fc; int a4_included, mgmt; -@@ -336,14 +337,8 @@ static void ccmp_special_blocks(struct s +@@ -344,14 +345,8 @@ static void ccmp_special_blocks(struct s else qos_tid = 0; @@ -412,7 +412,7 @@ /* Nonce: Nonce Flags | A2 | PN * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7) -@@ -351,6 +346,8 @@ static void ccmp_special_blocks(struct s +@@ -359,6 +354,8 @@ static void ccmp_special_blocks(struct s b_0[1] = qos_tid | (mgmt << 4); memcpy(&b_0[2], hdr->addr2, ETH_ALEN); memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN); @@ -421,7 +421,7 @@ /* AAD (extra authenticate-only data) / masked 802.11 header * FC | A1 | A2 | A3 | SC | [A4] | [QC] */ -@@ -407,7 +404,7 @@ static int ccmp_encrypt_skb(struct ieee8 +@@ -415,7 +412,7 @@ static int ccmp_encrypt_skb(struct ieee8 u8 *pos; u8 pn[6]; u64 pn64; @@ -430,7 +430,7 @@ u8 b_0[AES_BLOCK_SIZE]; if (info->control.hw_key && -@@ -462,9 +459,11 @@ static int ccmp_encrypt_skb(struct ieee8 +@@ -470,9 +467,11 @@ static int ccmp_encrypt_skb(struct ieee8 return 0; pos += IEEE80211_CCMP_HDR_LEN; @@ -445,7 +445,7 @@ } -@@ -537,13 +536,13 @@ ieee80211_crypto_ccmp_decrypt(struct iee +@@ -545,13 +544,13 @@ ieee80211_crypto_ccmp_decrypt(struct iee u8 aad[2 * AES_BLOCK_SIZE]; u8 b_0[AES_BLOCK_SIZE]; /* hardware didn't decrypt/verify MIC */ @@ -461,7 +461,7 @@ return RX_DROP_UNUSABLE; } -@@ -639,7 +638,7 @@ static int gcmp_encrypt_skb(struct ieee8 +@@ -646,7 +645,7 @@ static int gcmp_encrypt_skb(struct ieee8 u8 *pos; u8 pn[6]; u64 pn64; @@ -470,7 +470,7 @@ u8 j_0[AES_BLOCK_SIZE]; if (info->control.hw_key && -@@ -696,8 +695,10 @@ static int gcmp_encrypt_skb(struct ieee8 +@@ -703,8 +702,10 @@ static int gcmp_encrypt_skb(struct ieee8 pos += IEEE80211_GCMP_HDR_LEN; gcmp_special_blocks(skb, pn, j_0, aad); @@ -483,7 +483,7 @@ } ieee80211_tx_result -@@ -1121,9 +1122,9 @@ ieee80211_crypto_aes_gmac_encrypt(struct +@@ -1127,9 +1128,9 @@ ieee80211_crypto_aes_gmac_encrypt(struct struct ieee80211_key *key = tx->key; struct ieee80211_mmie_16 *mmie; struct ieee80211_hdr *hdr; @@ -495,12 +495,12 @@ if (WARN_ON(skb_queue_len(&tx->skbs) != 1)) return TX_DROP; -@@ -1169,7 +1170,7 @@ ieee80211_crypto_aes_gmac_decrypt(struct +@@ -1175,7 +1176,7 @@ ieee80211_crypto_aes_gmac_decrypt(struct struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); struct ieee80211_key *key = rx->key; struct ieee80211_mmie_16 *mmie; -- u8 aad[GMAC_AAD_LEN], mic[GMAC_MIC_LEN], ipn[6], nonce[GMAC_NONCE_LEN]; -+ u8 aad[20], mic[16], ipn[6], nonce[12]; +- u8 aad[GMAC_AAD_LEN], *mic, ipn[6], nonce[GMAC_NONCE_LEN]; ++ u8 aad[20], *mic, ipn[6], nonce[12]; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; if (!ieee80211_is_mgmt(hdr->frame_control)) diff --git a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch b/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch similarity index 84% rename from package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch rename to package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch index 3b1fcdf9c82077..6775884a3400a3 100644 --- a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch +++ b/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch @@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -1058,7 +1058,6 @@ static int ieee80211_stop_ap(struct wiph +@@ -1067,7 +1067,6 @@ static int ieee80211_stop_ap(struct wiph sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF; __sta_info_flush(sdata, true); diff --git a/package/kernel/mac80211/patches/120-cfg80211_allow_perm_addr_change.patch b/package/kernel/mac80211/patches/subsys/120-cfg80211_allow_perm_addr_change.patch similarity index 100% rename from package/kernel/mac80211/patches/120-cfg80211_allow_perm_addr_change.patch rename to package/kernel/mac80211/patches/subsys/120-cfg80211_allow_perm_addr_change.patch diff --git a/package/kernel/mac80211/patches/130-disable-fils.patch b/package/kernel/mac80211/patches/subsys/130-disable-fils.patch similarity index 91% rename from package/kernel/mac80211/patches/130-disable-fils.patch rename to package/kernel/mac80211/patches/subsys/130-disable-fils.patch index 1f0358987800ef..f1163764a0045b 100644 --- a/package/kernel/mac80211/patches/130-disable-fils.patch +++ b/package/kernel/mac80211/patches/subsys/130-disable-fils.patch @@ -21,7 +21,7 @@ Disable FILS support, since it pulls in crypto hash support * Copyright 2016, Qualcomm Atheros, Inc. --- a/net/mac80211/main.c +++ b/net/mac80211/main.c -@@ -550,7 +550,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ +@@ -570,7 +570,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ NL80211_FEATURE_MAC_ON_CREATE | NL80211_FEATURE_USERSPACE_MPM | NL80211_FEATURE_FULL_AP_CLIENT_STATE; @@ -29,4 +29,4 @@ Disable FILS support, since it pulls in crypto hash support +#if 0 /* LINUX_VERSION_IS_GEQ(4,3,0) */ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_FILS_STA); #endif - + wiphy_ext_feature_set(wiphy, diff --git a/package/kernel/mac80211/patches/131-Revert-mac80211-aes-cmac-switch-to-shash-CMAC-driver.patch b/package/kernel/mac80211/patches/subsys/131-Revert-mac80211-aes-cmac-switch-to-shash-CMAC-driver.patch similarity index 100% rename from package/kernel/mac80211/patches/131-Revert-mac80211-aes-cmac-switch-to-shash-CMAC-driver.patch rename to package/kernel/mac80211/patches/subsys/131-Revert-mac80211-aes-cmac-switch-to-shash-CMAC-driver.patch diff --git a/package/kernel/mac80211/patches/132-mac80211-remove-cmac-dependency.patch b/package/kernel/mac80211/patches/subsys/132-mac80211-remove-cmac-dependency.patch similarity index 100% rename from package/kernel/mac80211/patches/132-mac80211-remove-cmac-dependency.patch rename to package/kernel/mac80211/patches/subsys/132-mac80211-remove-cmac-dependency.patch diff --git a/package/kernel/mac80211/patches/140-tweak-TSQ-setting.patch b/package/kernel/mac80211/patches/subsys/140-tweak-TSQ-setting.patch similarity index 93% rename from package/kernel/mac80211/patches/140-tweak-TSQ-setting.patch rename to package/kernel/mac80211/patches/subsys/140-tweak-TSQ-setting.patch index 6e9a07a92741bc..f78ba82de352c9 100644 --- a/package/kernel/mac80211/patches/140-tweak-TSQ-setting.patch +++ b/package/kernel/mac80211/patches/subsys/140-tweak-TSQ-setting.patch @@ -1,6 +1,6 @@ --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -3750,6 +3750,12 @@ out: +@@ -3800,6 +3800,12 @@ out: netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev) { diff --git a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch similarity index 80% rename from package/kernel/mac80211/patches/150-disable_addr_notifier.patch rename to package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch index 781dd3c1bc15bf..1581b3400b5b51 100644 --- a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch +++ b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch @@ -1,6 +1,6 @@ --- a/net/mac80211/main.c +++ b/net/mac80211/main.c -@@ -292,7 +292,7 @@ void ieee80211_restart_hw(struct ieee802 +@@ -315,7 +315,7 @@ void ieee80211_restart_hw(struct ieee802 } EXPORT_SYMBOL(ieee80211_restart_hw); @@ -9,7 +9,7 @@ static int ieee80211_ifa_changed(struct notifier_block *nb, unsigned long data, void *arg) { -@@ -351,7 +351,7 @@ static int ieee80211_ifa_changed(struct +@@ -374,7 +374,7 @@ static int ieee80211_ifa_changed(struct } #endif @@ -18,9 +18,9 @@ static int ieee80211_ifa6_changed(struct notifier_block *nb, unsigned long data, void *arg) { -@@ -1114,14 +1114,14 @@ int ieee80211_register_hw(struct ieee802 - if (result) - goto fail_flows; +@@ -1168,14 +1168,14 @@ int ieee80211_register_hw(struct ieee802 + + rtnl_unlock(); -#ifdef CONFIG_INET +#ifdef __disabled__CONFIG_INET @@ -35,7 +35,7 @@ local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed; result = register_inet6addr_notifier(&local->ifa6_notifier); if (result) -@@ -1130,13 +1130,13 @@ int ieee80211_register_hw(struct ieee802 +@@ -1184,13 +1184,13 @@ int ieee80211_register_hw(struct ieee802 return 0; @@ -51,8 +51,8 @@ +#if defined(__disabled__CONFIG_INET) || defined(__disabled__CONFIG_IPV6) fail_ifa: #endif - ieee80211_txq_teardown_flows(local); -@@ -1166,10 +1166,10 @@ void ieee80211_unregister_hw(struct ieee + rtnl_lock(); +@@ -1219,10 +1219,10 @@ void ieee80211_unregister_hw(struct ieee tasklet_kill(&local->tx_pending_tasklet); tasklet_kill(&local->tasklet); diff --git a/package/kernel/mac80211/patches/210-ap_scan.patch b/package/kernel/mac80211/patches/subsys/210-ap_scan.patch similarity index 83% rename from package/kernel/mac80211/patches/210-ap_scan.patch rename to package/kernel/mac80211/patches/subsys/210-ap_scan.patch index 8ade963c9f909d..214ec055390f32 100644 --- a/package/kernel/mac80211/patches/210-ap_scan.patch +++ b/package/kernel/mac80211/patches/subsys/210-ap_scan.patch @@ -1,6 +1,6 @@ --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2215,7 +2215,7 @@ static int ieee80211_scan(struct wiphy * +@@ -2188,7 +2188,7 @@ static int ieee80211_scan(struct wiphy * * the frames sent while scanning on other channel will be * lost) */ diff --git a/package/kernel/mac80211/patches/subsys/300-mac80211-add-stop-start-logic-for-software-TXQs.patch b/package/kernel/mac80211/patches/subsys/300-mac80211-add-stop-start-logic-for-software-TXQs.patch new file mode 100644 index 00000000000000..e57a33ec1f47f3 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/300-mac80211-add-stop-start-logic-for-software-TXQs.patch @@ -0,0 +1,272 @@ +From: Manikanta Pubbisetty +Date: Wed, 11 Jul 2018 00:12:53 +0530 +Subject: [PATCH] mac80211: add stop/start logic for software TXQs + +Sometimes, it is required to stop the transmissions momentarily and +resume it later; stopping the txqs becomes very critical in scenarios where +the packet transmission has to be ceased completely. For example, during +the hardware restart, during off channel operations, +when initiating CSA(upon detecting a radar on the DFS channel), etc. + +The TX queue stop/start logic in mac80211 works well in stopping the TX +when drivers make use of netdev queues, i.e, when Qdiscs in network layer +take care of traffic scheduling. Since the devices implementing +wake_tx_queue can run without Qdiscs, packets will be handed to mac80211 +directly without queueing them in the netdev queues. + +Also, mac80211 does not invoke any of the +netif_stop_*/netif_wake_* APIs if wake_tx_queue is implemented. +Since the queues are not stopped in this case, transmissions can continue +and this will impact negatively on the operation of the wireless device. + +For example, +During hardware restart, we stop the netdev queues so that packets are +not sent to the driver. Since ath10k implements wake_tx_queue, +TX queues will not be stopped and packets might reach the hardware while +it is restarting; this can make hardware unresponsive and the only +possible option for recovery is to reboot the entire system. + +There is another problem to this, it is observed that the packets +were sent on the DFS channel for a prolonged duration after radar +detection impacting the channel closing time. + +We can still invoke netif stop/wake APIs when wake_tx_queue is implemented +but this could lead to packet drops in network layer; adding stop/start +logic for software TXQs in mac80211 instead makes more sense; the change +proposed adds the same in mac80211. + +Signed-off-by: Manikanta Pubbisetty +Signed-off-by: Johannes Berg +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -1504,6 +1504,8 @@ enum ieee80211_vif_flags { + * @drv_priv: data area for driver use, will always be aligned to + * sizeof(void \*). + * @txq: the multicast data TX queue (if driver uses the TXQ abstraction) ++ * @txqs_stopped: per AC flag to indicate that intermediate TXQs are stopped, ++ * protected by fq->lock. + */ + struct ieee80211_vif { + enum nl80211_iftype type; +@@ -1528,6 +1530,8 @@ struct ieee80211_vif { + + unsigned int probe_req_reg; + ++ bool txqs_stopped[IEEE80211_NUM_ACS]; ++ + /* must be last */ + u8 drv_priv[0] __aligned(sizeof(void *)); + }; +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -818,6 +818,7 @@ enum txq_info_flags { + IEEE80211_TXQ_STOP, + IEEE80211_TXQ_AMPDU, + IEEE80211_TXQ_NO_AMSDU, ++ IEEE80211_TXQ_STOP_NETIF_TX, + }; + + /** +@@ -1226,6 +1227,7 @@ struct ieee80211_local { + + struct sk_buff_head pending[IEEE80211_MAX_QUEUES]; + struct tasklet_struct tx_pending_tasklet; ++ struct tasklet_struct wake_txqs_tasklet; + + atomic_t agg_queue_stop[IEEE80211_MAX_QUEUES]; + +@@ -2046,6 +2048,7 @@ void ieee80211_txq_remove_vlan(struct ie + struct ieee80211_sub_if_data *sdata); + void ieee80211_fill_txq_stats(struct cfg80211_txq_stats *txqstats, + struct txq_info *txqi); ++void ieee80211_wake_txqs(unsigned long data); + void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, + u16 transaction, u16 auth_alg, u16 status, + const u8 *extra, size_t extra_len, const u8 *bssid, +--- a/net/mac80211/main.c ++++ b/net/mac80211/main.c +@@ -686,6 +686,10 @@ struct ieee80211_hw *ieee80211_alloc_hw_ + tasklet_init(&local->tx_pending_tasklet, ieee80211_tx_pending, + (unsigned long)local); + ++ if (ops->wake_tx_queue) ++ tasklet_init(&local->wake_txqs_tasklet, ieee80211_wake_txqs, ++ (unsigned long)local); ++ + tasklet_init(&local->tasklet, + ieee80211_tasklet_handler, + (unsigned long) local); +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3485,13 +3485,19 @@ struct sk_buff *ieee80211_tx_dequeue(str + struct ieee80211_tx_info *info; + struct ieee80211_tx_data tx; + ieee80211_tx_result r; +- struct ieee80211_vif *vif; ++ struct ieee80211_vif *vif = txq->vif; + + spin_lock_bh(&fq->lock); + +- if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags)) ++ if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags) || ++ test_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags)) + goto out; + ++ if (vif->txqs_stopped[ieee80211_ac_from_tid(txq->tid)]) { ++ set_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags); ++ goto out; ++ } ++ + /* Make sure fragments stay together. */ + skb = __skb_dequeue(&txqi->frags); + if (skb) +@@ -3586,6 +3592,7 @@ begin: + } + + IEEE80211_SKB_CB(skb)->control.vif = vif; ++ + out: + spin_unlock_bh(&fq->lock); + +--- a/net/mac80211/util.c ++++ b/net/mac80211/util.c +@@ -240,6 +240,99 @@ __le16 ieee80211_ctstoself_duration(stru + } + EXPORT_SYMBOL(ieee80211_ctstoself_duration); + ++static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac) ++{ ++ struct ieee80211_local *local = sdata->local; ++ struct ieee80211_vif *vif = &sdata->vif; ++ struct fq *fq = &local->fq; ++ struct ps_data *ps = NULL; ++ struct txq_info *txqi; ++ struct sta_info *sta; ++ int i; ++ ++ spin_lock_bh(&fq->lock); ++ ++ if (sdata->vif.type == NL80211_IFTYPE_AP) ++ ps = &sdata->bss->ps; ++ ++ sdata->vif.txqs_stopped[ac] = false; ++ ++ list_for_each_entry_rcu(sta, &local->sta_list, list) { ++ if (sdata != sta->sdata) ++ continue; ++ ++ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { ++ struct ieee80211_txq *txq = sta->sta.txq[i]; ++ ++ txqi = to_txq_info(txq); ++ ++ if (ac != txq->ac) ++ continue; ++ ++ if (!test_and_clear_bit(IEEE80211_TXQ_STOP_NETIF_TX, ++ &txqi->flags)) ++ continue; ++ ++ spin_unlock_bh(&fq->lock); ++ drv_wake_tx_queue(local, txqi); ++ spin_lock_bh(&fq->lock); ++ } ++ } ++ ++ if (!vif->txq) ++ goto out; ++ ++ txqi = to_txq_info(vif->txq); ++ ++ if (!test_and_clear_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags) || ++ (ps && atomic_read(&ps->num_sta_ps)) || ac != vif->txq->ac) ++ goto out; ++ ++ spin_unlock_bh(&fq->lock); ++ ++ drv_wake_tx_queue(local, txqi); ++ return; ++out: ++ spin_unlock_bh(&fq->lock); ++} ++ ++void ieee80211_wake_txqs(unsigned long data) ++{ ++ struct ieee80211_local *local = (struct ieee80211_local *)data; ++ struct ieee80211_sub_if_data *sdata; ++ int n_acs = IEEE80211_NUM_ACS; ++ unsigned long flags; ++ int i; ++ ++ rcu_read_lock(); ++ spin_lock_irqsave(&local->queue_stop_reason_lock, flags); ++ ++ if (local->hw.queues < IEEE80211_NUM_ACS) ++ n_acs = 1; ++ ++ for (i = 0; i < local->hw.queues; i++) { ++ if (local->queue_stop_reasons[i]) ++ continue; ++ ++ spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); ++ list_for_each_entry_rcu(sdata, &local->interfaces, list) { ++ int ac; ++ ++ for (ac = 0; ac < n_acs; ac++) { ++ int ac_queue = sdata->vif.hw_queue[ac]; ++ ++ if (ac_queue == i || ++ sdata->vif.cab_queue == i) ++ __ieee80211_wake_txqs(sdata, ac); ++ } ++ } ++ spin_lock_irqsave(&local->queue_stop_reason_lock, flags); ++ } ++ ++ spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); ++ rcu_read_unlock(); ++} ++ + void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue) + { + struct ieee80211_sub_if_data *sdata; +@@ -308,6 +401,9 @@ static void __ieee80211_wake_queue(struc + rcu_read_unlock(); + } else + tasklet_schedule(&local->tx_pending_tasklet); ++ ++ if (local->ops->wake_tx_queue) ++ tasklet_schedule(&local->wake_txqs_tasklet); + } + + void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue, +@@ -351,9 +447,6 @@ static void __ieee80211_stop_queue(struc + if (__test_and_set_bit(reason, &local->queue_stop_reasons[queue])) + return; + +- if (local->ops->wake_tx_queue) +- return; +- + if (local->hw.queues < IEEE80211_NUM_ACS) + n_acs = 1; + +@@ -366,8 +459,15 @@ static void __ieee80211_stop_queue(struc + + for (ac = 0; ac < n_acs; ac++) { + if (sdata->vif.hw_queue[ac] == queue || +- sdata->vif.cab_queue == queue) +- netif_stop_subqueue(sdata->dev, ac); ++ sdata->vif.cab_queue == queue) { ++ if (!local->ops->wake_tx_queue) { ++ netif_stop_subqueue(sdata->dev, ac); ++ continue; ++ } ++ spin_lock(&local->fq.lock); ++ sdata->vif.txqs_stopped[ac] = true; ++ spin_unlock(&local->fq.lock); ++ } + } + } + rcu_read_unlock(); diff --git a/package/kernel/mac80211/patches/subsys/303-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch b/package/kernel/mac80211/patches/subsys/303-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch new file mode 100644 index 00000000000000..5cce4936e14f2d --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/303-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch @@ -0,0 +1,81 @@ +From: Chaitanya T K +Date: Mon, 27 Jun 2016 15:23:26 +0530 +Subject: [PATCH] mac80211: minstrel: Enable STBC and LDPC for VHT Rates + +If peer support reception of STBC and LDPC, enable them for better +performance. + +Signed-off-by: Chaitanya TK +--- + +--- a/include/linux/ieee80211.h ++++ b/include/linux/ieee80211.h +@@ -1659,6 +1659,7 @@ struct ieee80211_mu_edca_param_set { + #define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300 + #define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400 + #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700 ++#define IEEE80211_VHT_CAP_RXSTBC_SHIFT 8 + #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800 + #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 + #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13 +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -1136,13 +1136,14 @@ minstrel_ht_update_caps(void *priv, stru + struct minstrel_ht_sta_priv *msp = priv_sta; + struct minstrel_ht_sta *mi = &msp->ht; + struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs; +- u16 sta_cap = sta->ht_cap.cap; ++ u16 ht_cap = sta->ht_cap.cap; + struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap; + int use_vht; + int n_supported = 0; + int ack_dur; + int stbc; + int i; ++ bool ldpc = false; + + /* fall back to the old minstrel for legacy stations */ + if (!sta->ht_cap.ht_supported) +@@ -1180,16 +1181,24 @@ minstrel_ht_update_caps(void *priv, stru + } + mi->sample_tries = 4; + +- /* TODO tx_flags for vht - ATM the RC API is not fine-grained enough */ + if (!use_vht) { +- stbc = (sta_cap & IEEE80211_HT_CAP_RX_STBC) >> ++ stbc = (ht_cap & IEEE80211_HT_CAP_RX_STBC) >> + IEEE80211_HT_CAP_RX_STBC_SHIFT; +- mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT; + +- if (sta_cap & IEEE80211_HT_CAP_LDPC_CODING) +- mi->tx_flags |= IEEE80211_TX_CTL_LDPC; ++ if (ht_cap & IEEE80211_HT_CAP_LDPC_CODING) ++ ldpc = true; ++ } else { ++ stbc = (vht_cap->cap & IEEE80211_VHT_CAP_RXSTBC_MASK) >> ++ IEEE80211_VHT_CAP_RXSTBC_SHIFT; ++ ++ if (vht_cap->cap & IEEE80211_VHT_CAP_RXLDPC) ++ ldpc = true; + } + ++ mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT; ++ if (ldpc) ++ mi->tx_flags |= IEEE80211_TX_CTL_LDPC; ++ + for (i = 0; i < ARRAY_SIZE(mi->groups); i++) { + u32 gflags = minstrel_mcs_groups[i].flags; + int bw, nss; +@@ -1202,10 +1211,10 @@ minstrel_ht_update_caps(void *priv, stru + + if (gflags & IEEE80211_TX_RC_SHORT_GI) { + if (gflags & IEEE80211_TX_RC_40_MHZ_WIDTH) { +- if (!(sta_cap & IEEE80211_HT_CAP_SGI_40)) ++ if (!(ht_cap & IEEE80211_HT_CAP_SGI_40)) + continue; + } else { +- if (!(sta_cap & IEEE80211_HT_CAP_SGI_20)) ++ if (!(ht_cap & IEEE80211_HT_CAP_SGI_20)) + continue; + } + } diff --git a/package/kernel/mac80211/patches/subsys/304-mac80211-minstrel-remove-unnecessary-debugfs-cleanup.patch b/package/kernel/mac80211/patches/subsys/304-mac80211-minstrel-remove-unnecessary-debugfs-cleanup.patch new file mode 100644 index 00000000000000..855babeccb09e3 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/304-mac80211-minstrel-remove-unnecessary-debugfs-cleanup.patch @@ -0,0 +1,150 @@ +From: Felix Fietkau +Date: Sat, 10 Feb 2018 12:41:51 +0100 +Subject: [PATCH] mac80211: minstrel: remove unnecessary debugfs cleanup + code + +debugfs entries are cleaned up by debugfs_remove_recursive already. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel.c ++++ b/net/mac80211/rc80211_minstrel.c +@@ -689,8 +689,8 @@ minstrel_alloc(struct ieee80211_hw *hw, + + #ifdef CPTCFG_MAC80211_DEBUGFS + mp->fixed_rate_idx = (u32) -1; +- mp->dbg_fixed_rate = debugfs_create_u32("fixed_rate_idx", +- 0666, debugfsdir, &mp->fixed_rate_idx); ++ debugfs_create_u32("fixed_rate_idx", S_IRUGO | S_IWUGO, debugfsdir, ++ &mp->fixed_rate_idx); + #endif + + minstrel_init_cck_rates(mp); +@@ -701,9 +701,6 @@ minstrel_alloc(struct ieee80211_hw *hw, + static void + minstrel_free(void *priv) + { +-#ifdef CPTCFG_MAC80211_DEBUGFS +- debugfs_remove(((struct minstrel_priv *)priv)->dbg_fixed_rate); +-#endif + kfree(priv); + } + +@@ -735,7 +732,6 @@ const struct rate_control_ops mac80211_m + .free_sta = minstrel_free_sta, + #ifdef CPTCFG_MAC80211_DEBUGFS + .add_sta_debugfs = minstrel_add_sta_debugfs, +- .remove_sta_debugfs = minstrel_remove_sta_debugfs, + #endif + .get_expected_throughput = minstrel_get_expected_throughput, + }; +--- a/net/mac80211/rc80211_minstrel.h ++++ b/net/mac80211/rc80211_minstrel.h +@@ -109,11 +109,6 @@ struct minstrel_sta_info { + + /* sampling table */ + u8 *sample_table; +- +-#ifdef CPTCFG_MAC80211_DEBUGFS +- struct dentry *dbg_stats; +- struct dentry *dbg_stats_csv; +-#endif + }; + + struct minstrel_priv { +@@ -137,7 +132,6 @@ struct minstrel_priv { + * - setting will be applied on next update + */ + u32 fixed_rate_idx; +- struct dentry *dbg_fixed_rate; + #endif + }; + +@@ -156,7 +150,6 @@ minstrel_get_ewmsd10(struct minstrel_rat + + extern const struct rate_control_ops mac80211_minstrel; + void minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); +-void minstrel_remove_sta_debugfs(void *priv, void *priv_sta); + + /* Recalculate success probabilities and counters for a given rate using EWMA */ + void minstrel_calc_rate_stats(struct minstrel_rate_stats *mrs); +--- a/net/mac80211/rc80211_minstrel_debugfs.c ++++ b/net/mac80211/rc80211_minstrel_debugfs.c +@@ -214,19 +214,7 @@ minstrel_add_sta_debugfs(void *priv, voi + { + struct minstrel_sta_info *mi = priv_sta; + +- mi->dbg_stats = debugfs_create_file("rc_stats", 0444, dir, mi, +- &minstrel_stat_fops); +- +- mi->dbg_stats_csv = debugfs_create_file("rc_stats_csv", 0444, dir, mi, +- &minstrel_stat_csv_fops); +-} +- +-void +-minstrel_remove_sta_debugfs(void *priv, void *priv_sta) +-{ +- struct minstrel_sta_info *mi = priv_sta; +- +- debugfs_remove(mi->dbg_stats); +- +- debugfs_remove(mi->dbg_stats_csv); ++ debugfs_create_file("rc_stats", S_IRUGO, dir, mi, &minstrel_stat_fops); ++ debugfs_create_file("rc_stats_csv", S_IRUGO, dir, mi, ++ &minstrel_stat_csv_fops); + } +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -1397,7 +1397,6 @@ static const struct rate_control_ops mac + .free = minstrel_ht_free, + #ifdef CPTCFG_MAC80211_DEBUGFS + .add_sta_debugfs = minstrel_ht_add_sta_debugfs, +- .remove_sta_debugfs = minstrel_ht_remove_sta_debugfs, + #endif + .get_expected_throughput = minstrel_ht_get_expected_throughput, + }; +--- a/net/mac80211/rc80211_minstrel_ht.h ++++ b/net/mac80211/rc80211_minstrel_ht.h +@@ -110,17 +110,12 @@ struct minstrel_ht_sta_priv { + struct minstrel_ht_sta ht; + struct minstrel_sta_info legacy; + }; +-#ifdef CPTCFG_MAC80211_DEBUGFS +- struct dentry *dbg_stats; +- struct dentry *dbg_stats_csv; +-#endif + void *ratelist; + void *sample_table; + bool is_ht; + }; + + void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); +-void minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta); + int minstrel_ht_get_tp_avg(struct minstrel_ht_sta *mi, int group, int rate, + int prob_ewma); + +--- a/net/mac80211/rc80211_minstrel_ht_debugfs.c ++++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c +@@ -303,17 +303,8 @@ minstrel_ht_add_sta_debugfs(void *priv, + { + struct minstrel_ht_sta_priv *msp = priv_sta; + +- msp->dbg_stats = debugfs_create_file("rc_stats", 0444, dir, msp, +- &minstrel_ht_stat_fops); +- msp->dbg_stats_csv = debugfs_create_file("rc_stats_csv", 0444, dir, msp, +- &minstrel_ht_stat_csv_fops); +-} +- +-void +-minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta) +-{ +- struct minstrel_ht_sta_priv *msp = priv_sta; +- +- debugfs_remove(msp->dbg_stats); +- debugfs_remove(msp->dbg_stats_csv); ++ debugfs_create_file("rc_stats", S_IRUGO, dir, msp, ++ &minstrel_ht_stat_fops); ++ debugfs_create_file("rc_stats_csv", S_IRUGO, dir, msp, ++ &minstrel_ht_stat_csv_fops); + } diff --git a/package/kernel/mac80211/patches/subsys/305-mac80211-fix-tx-status-for-no-ack-cases.patch b/package/kernel/mac80211/patches/subsys/305-mac80211-fix-tx-status-for-no-ack-cases.patch new file mode 100644 index 00000000000000..3ea78fb4ab9938 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/305-mac80211-fix-tx-status-for-no-ack-cases.patch @@ -0,0 +1,82 @@ +From: Markus Theil +Date: Wed, 18 Dec 2019 15:27:36 +0100 +Subject: [PATCH] mac80211: fix tx status for no ack cases + +Before this patch, frames which where successfully transmitted without +requiring acks where accounted as lost frames. + +Signed-off-by: Markus Theil +Link: https://lore.kernel.org/r/20191218142736.15843-1-markus.theil@tu-ilmenau.de +Signed-off-by: Johannes Berg +--- + +--- a/net/mac80211/status.c ++++ b/net/mac80211/status.c +@@ -881,6 +881,7 @@ static void __ieee80211_tx_status(struct + int rates_idx; + bool send_to_cooked; + bool acked; ++ bool noack_success; + struct ieee80211_bar *bar; + int shift = 0; + int tid = IEEE80211_NUM_TIDS; +@@ -898,6 +899,8 @@ static void __ieee80211_tx_status(struct + clear_sta_flag(sta, WLAN_STA_SP); + + acked = !!(info->flags & IEEE80211_TX_STAT_ACK); ++ noack_success = !!(info->flags & ++ IEEE80211_TX_STAT_NOACK_TRANSMITTED); + + /* mesh Peer Service Period support */ + if (ieee80211_vif_is_mesh(&sta->sdata->vif) && +@@ -962,12 +965,12 @@ static void __ieee80211_tx_status(struct + ieee80211_handle_filtered_frame(local, sta, skb); + return; + } else { +- if (!acked) ++ if (!acked && !noack_success) + sta->status_stats.retry_failed++; + sta->status_stats.retry_count += retry_count; + + if (ieee80211_is_data_present(fc)) { +- if (!acked) ++ if (!acked && !noack_success) + sta->status_stats.msdu_failed[tid]++; + + sta->status_stats.msdu_retries[tid] += +@@ -994,7 +997,7 @@ static void __ieee80211_tx_status(struct + info->status.tx_time, 0); + + if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { +- if (info->flags & IEEE80211_TX_STAT_ACK) { ++ if (acked) { + if (sta->status_stats.lost_packets) + sta->status_stats.lost_packets = 0; + +@@ -1002,6 +1005,8 @@ static void __ieee80211_tx_status(struct + if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) + sta->status_stats.last_tdls_pkt_time = + jiffies; ++ } else if (noack_success) { ++ /* nothing to do here, do not account as lost */ + } else { + ieee80211_lost_packet(sta, info); + } +@@ -1127,7 +1132,7 @@ void ieee80211_tx_status_ext(struct ieee + + sta = container_of(pubsta, struct sta_info, sta); + +- if (!acked) ++ if (!acked && !noack_success) + sta->status_stats.retry_failed++; + sta->status_stats.retry_count += retry_count; + +@@ -1142,6 +1147,8 @@ void ieee80211_tx_status_ext(struct ieee + sta->status_stats.last_tdls_pkt_time = jiffies; + } else if (test_sta_flag(sta, WLAN_STA_PS_STA)) { + return; ++ } else if (noack_success) { ++ /* nothing to do here, do not account as lost */ + } else { + ieee80211_lost_packet(sta, info); + } diff --git a/package/kernel/mac80211/patches/subsys/305-mac80211-minstrel-merge-with-minstrel_ht-always-enab.patch b/package/kernel/mac80211/patches/subsys/305-mac80211-minstrel-merge-with-minstrel_ht-always-enab.patch new file mode 100644 index 00000000000000..fca3189e6dc2e7 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/305-mac80211-minstrel-merge-with-minstrel_ht-always-enab.patch @@ -0,0 +1,575 @@ +From: Felix Fietkau +Date: Sat, 10 Feb 2018 12:43:30 +0100 +Subject: [PATCH] mac80211: minstrel: merge with minstrel_ht, always enable + VHT support + +Legacy-only devices are not very common and the overhead of the extra +code for HT and VHT rates is not big enough to justify all those extra +lines of code to make it optional. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/Kconfig ++++ b/net/mac80211/Kconfig +@@ -25,20 +25,6 @@ config MAC80211_RC_MINSTREL + ---help--- + This option enables the 'minstrel' TX rate control algorithm + +-config MAC80211_RC_MINSTREL_HT +- bool "Minstrel 802.11n support" if EXPERT +- depends on MAC80211_RC_MINSTREL +- default y +- ---help--- +- This option enables the 'minstrel_ht' TX rate control algorithm +- +-config MAC80211_RC_MINSTREL_VHT +- bool "Minstrel 802.11ac support" if EXPERT +- depends on MAC80211_RC_MINSTREL_HT +- default n +- ---help--- +- This option enables VHT in the 'minstrel_ht' TX rate control algorithm +- + choice + prompt "Default rate control algorithm" + depends on MAC80211_HAS_RC +@@ -60,8 +46,7 @@ endchoice + + config MAC80211_RC_DEFAULT + string +- default "minstrel_ht" if MAC80211_RC_DEFAULT_MINSTREL && MAC80211_RC_MINSTREL_HT +- default "minstrel" if MAC80211_RC_DEFAULT_MINSTREL ++ default "minstrel_ht" if MAC80211_RC_DEFAULT_MINSTREL + default "" + + endif +--- a/net/mac80211/Makefile ++++ b/net/mac80211/Makefile +@@ -52,13 +52,14 @@ mac80211-$(CONFIG_PM) += pm.o + + CFLAGS_trace.o := -I$(src) + +-rc80211_minstrel-y := rc80211_minstrel.o +-rc80211_minstrel-$(CPTCFG_MAC80211_DEBUGFS) += rc80211_minstrel_debugfs.o ++rc80211_minstrel-y := \ ++ rc80211_minstrel.o \ ++ rc80211_minstrel_ht.o + +-rc80211_minstrel_ht-y := rc80211_minstrel_ht.o +-rc80211_minstrel_ht-$(CPTCFG_MAC80211_DEBUGFS) += rc80211_minstrel_ht_debugfs.o ++rc80211_minstrel-$(CPTCFG_MAC80211_DEBUGFS) += \ ++ rc80211_minstrel_debugfs.o \ ++ rc80211_minstrel_ht_debugfs.o + + mac80211-$(CPTCFG_MAC80211_RC_MINSTREL) += $(rc80211_minstrel-y) +-mac80211-$(CPTCFG_MAC80211_RC_MINSTREL_HT) += $(rc80211_minstrel_ht-y) + + ccflags-y += -DDEBUG +--- a/net/mac80211/main.c ++++ b/net/mac80211/main.c +@@ -1308,18 +1308,12 @@ static int __init ieee80211_init(void) + if (ret) + return ret; + +- ret = rc80211_minstrel_ht_init(); +- if (ret) +- goto err_minstrel; +- + ret = ieee80211_iface_init(); + if (ret) + goto err_netdev; + + return 0; + err_netdev: +- rc80211_minstrel_ht_exit(); +- err_minstrel: + rc80211_minstrel_exit(); + + return ret; +@@ -1327,7 +1321,6 @@ static int __init ieee80211_init(void) + + static void __exit ieee80211_exit(void) + { +- rc80211_minstrel_ht_exit(); + rc80211_minstrel_exit(); + + ieee80211s_stop(); +--- a/net/mac80211/rate.h ++++ b/net/mac80211/rate.h +@@ -95,18 +95,5 @@ static inline void rc80211_minstrel_exit + } + #endif + +-#ifdef CPTCFG_MAC80211_RC_MINSTREL_HT +-int rc80211_minstrel_ht_init(void); +-void rc80211_minstrel_ht_exit(void); +-#else +-static inline int rc80211_minstrel_ht_init(void) +-{ +- return 0; +-} +-static inline void rc80211_minstrel_ht_exit(void) +-{ +-} +-#endif +- + + #endif /* IEEE80211_RATE_H */ +--- a/net/mac80211/rc80211_minstrel.c ++++ b/net/mac80211/rc80211_minstrel.c +@@ -572,138 +572,6 @@ minstrel_rate_init(void *priv, struct ie + minstrel_update_rates(mp, mi); + } + +-static void * +-minstrel_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) +-{ +- struct ieee80211_supported_band *sband; +- struct minstrel_sta_info *mi; +- struct minstrel_priv *mp = priv; +- struct ieee80211_hw *hw = mp->hw; +- int max_rates = 0; +- int i; +- +- mi = kzalloc(sizeof(struct minstrel_sta_info), gfp); +- if (!mi) +- return NULL; +- +- for (i = 0; i < NUM_NL80211_BANDS; i++) { +- sband = hw->wiphy->bands[i]; +- if (sband && sband->n_bitrates > max_rates) +- max_rates = sband->n_bitrates; +- } +- +- mi->r = kcalloc(max_rates, sizeof(struct minstrel_rate), gfp); +- if (!mi->r) +- goto error; +- +- mi->sample_table = kmalloc_array(max_rates, SAMPLE_COLUMNS, gfp); +- if (!mi->sample_table) +- goto error1; +- +- mi->last_stats_update = jiffies; +- return mi; +- +-error1: +- kfree(mi->r); +-error: +- kfree(mi); +- return NULL; +-} +- +-static void +-minstrel_free_sta(void *priv, struct ieee80211_sta *sta, void *priv_sta) +-{ +- struct minstrel_sta_info *mi = priv_sta; +- +- kfree(mi->sample_table); +- kfree(mi->r); +- kfree(mi); +-} +- +-static void +-minstrel_init_cck_rates(struct minstrel_priv *mp) +-{ +- static const int bitrates[4] = { 10, 20, 55, 110 }; +- struct ieee80211_supported_band *sband; +- u32 rate_flags = ieee80211_chandef_rate_flags(&mp->hw->conf.chandef); +- int i, j; +- +- sband = mp->hw->wiphy->bands[NL80211_BAND_2GHZ]; +- if (!sband) +- return; +- +- for (i = 0, j = 0; i < sband->n_bitrates; i++) { +- struct ieee80211_rate *rate = &sband->bitrates[i]; +- +- if (rate->flags & IEEE80211_RATE_ERP_G) +- continue; +- +- if ((rate_flags & sband->bitrates[i].flags) != rate_flags) +- continue; +- +- for (j = 0; j < ARRAY_SIZE(bitrates); j++) { +- if (rate->bitrate != bitrates[j]) +- continue; +- +- mp->cck_rates[j] = i; +- break; +- } +- } +-} +- +-static void * +-minstrel_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) +-{ +- struct minstrel_priv *mp; +- +- mp = kzalloc(sizeof(struct minstrel_priv), GFP_ATOMIC); +- if (!mp) +- return NULL; +- +- /* contention window settings +- * Just an approximation. Using the per-queue values would complicate +- * the calculations and is probably unnecessary */ +- mp->cw_min = 15; +- mp->cw_max = 1023; +- +- /* number of packets (in %) to use for sampling other rates +- * sample less often for non-mrr packets, because the overhead +- * is much higher than with mrr */ +- mp->lookaround_rate = 5; +- mp->lookaround_rate_mrr = 10; +- +- /* maximum time that the hw is allowed to stay in one MRR segment */ +- mp->segment_size = 6000; +- +- if (hw->max_rate_tries > 0) +- mp->max_retry = hw->max_rate_tries; +- else +- /* safe default, does not necessarily have to match hw properties */ +- mp->max_retry = 7; +- +- if (hw->max_rates >= 4) +- mp->has_mrr = true; +- +- mp->hw = hw; +- mp->update_interval = 100; +- +-#ifdef CPTCFG_MAC80211_DEBUGFS +- mp->fixed_rate_idx = (u32) -1; +- debugfs_create_u32("fixed_rate_idx", S_IRUGO | S_IWUGO, debugfsdir, +- &mp->fixed_rate_idx); +-#endif +- +- minstrel_init_cck_rates(mp); +- +- return mp; +-} +- +-static void +-minstrel_free(void *priv) +-{ +- kfree(priv); +-} +- + static u32 minstrel_get_expected_throughput(void *priv_sta) + { + struct minstrel_sta_info *mi = priv_sta; +@@ -722,28 +590,8 @@ static u32 minstrel_get_expected_through + } + + const struct rate_control_ops mac80211_minstrel = { +- .name = "minstrel", + .tx_status_ext = minstrel_tx_status, + .get_rate = minstrel_get_rate, + .rate_init = minstrel_rate_init, +- .alloc = minstrel_alloc, +- .free = minstrel_free, +- .alloc_sta = minstrel_alloc_sta, +- .free_sta = minstrel_free_sta, +-#ifdef CPTCFG_MAC80211_DEBUGFS +- .add_sta_debugfs = minstrel_add_sta_debugfs, +-#endif + .get_expected_throughput = minstrel_get_expected_throughput, + }; +- +-int __init +-rc80211_minstrel_init(void) +-{ +- return ieee80211_rate_control_register(&mac80211_minstrel); +-} +- +-void +-rc80211_minstrel_exit(void) +-{ +- ieee80211_rate_control_unregister(&mac80211_minstrel); +-} +--- a/net/mac80211/rc80211_minstrel.h ++++ b/net/mac80211/rc80211_minstrel.h +@@ -158,7 +158,5 @@ int minstrel_get_tp_avg(struct minstrel_ + /* debugfs */ + int minstrel_stats_open(struct inode *inode, struct file *file); + int minstrel_stats_csv_open(struct inode *inode, struct file *file); +-ssize_t minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos); +-int minstrel_stats_release(struct inode *inode, struct file *file); + + #endif +--- a/net/mac80211/rc80211_minstrel_debugfs.c ++++ b/net/mac80211/rc80211_minstrel_debugfs.c +@@ -54,22 +54,6 @@ + #include + #include "rc80211_minstrel.h" + +-ssize_t +-minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos) +-{ +- struct minstrel_debugfs_info *ms; +- +- ms = file->private_data; +- return simple_read_from_buffer(buf, len, ppos, ms->buf, ms->len); +-} +- +-int +-minstrel_stats_release(struct inode *inode, struct file *file) +-{ +- kfree(file->private_data); +- return 0; +-} +- + int + minstrel_stats_open(struct inode *inode, struct file *file) + { +@@ -135,14 +119,6 @@ minstrel_stats_open(struct inode *inode, + return 0; + } + +-static const struct file_operations minstrel_stat_fops = { +- .owner = THIS_MODULE, +- .open = minstrel_stats_open, +- .read = minstrel_stats_read, +- .release = minstrel_stats_release, +- .llseek = default_llseek, +-}; +- + int + minstrel_stats_csv_open(struct inode *inode, struct file *file) + { +@@ -200,21 +176,3 @@ minstrel_stats_csv_open(struct inode *in + + return 0; + } +- +-static const struct file_operations minstrel_stat_csv_fops = { +- .owner = THIS_MODULE, +- .open = minstrel_stats_csv_open, +- .read = minstrel_stats_read, +- .release = minstrel_stats_release, +- .llseek = default_llseek, +-}; +- +-void +-minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir) +-{ +- struct minstrel_sta_info *mi = priv_sta; +- +- debugfs_create_file("rc_stats", S_IRUGO, dir, mi, &minstrel_stat_fops); +- debugfs_create_file("rc_stats_csv", S_IRUGO, dir, mi, +- &minstrel_stat_csv_fops); +-} +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -137,12 +137,10 @@ + } \ + } + +-#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT + static bool minstrel_vht_only = true; + module_param(minstrel_vht_only, bool, 0644); + MODULE_PARM_DESC(minstrel_vht_only, + "Use only VHT rates when VHT is supported by sta."); +-#endif + + /* + * To enable sufficiently targeted rate sampling, MCS rates are divided into +@@ -171,7 +169,6 @@ const struct mcs_group minstrel_mcs_grou + + CCK_GROUP, + +-#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT + VHT_GROUP(1, 0, BW_20), + VHT_GROUP(2, 0, BW_20), + VHT_GROUP(3, 0, BW_20), +@@ -195,7 +192,6 @@ const struct mcs_group minstrel_mcs_grou + VHT_GROUP(1, 1, BW_80), + VHT_GROUP(2, 1, BW_80), + VHT_GROUP(3, 1, BW_80), +-#endif + }; + + static u8 sample_table[SAMPLE_COLUMNS][MCS_GROUP_RATES] __read_mostly; +@@ -1151,12 +1147,10 @@ minstrel_ht_update_caps(void *priv, stru + + BUILD_BUG_ON(ARRAY_SIZE(minstrel_mcs_groups) != MINSTREL_GROUPS_NB); + +-#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT + if (vht_cap->vht_supported) + use_vht = vht_cap->vht_mcs.tx_mcs_map != cpu_to_le16(~0); + else +-#endif +- use_vht = 0; ++ use_vht = 0; + + msp->is_ht = true; + memset(mi, 0, sizeof(*mi)); +@@ -1231,10 +1225,9 @@ minstrel_ht_update_caps(void *priv, stru + + /* HT rate */ + if (gflags & IEEE80211_TX_RC_MCS) { +-#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT + if (use_vht && minstrel_vht_only) + continue; +-#endif ++ + mi->supported[i] = mcs->rx_mask[nss - 1]; + if (mi->supported[i]) + n_supported++; +@@ -1353,16 +1346,88 @@ minstrel_ht_free_sta(void *priv, struct + kfree(msp); + } + ++static void ++minstrel_ht_init_cck_rates(struct minstrel_priv *mp) ++{ ++ static const int bitrates[4] = { 10, 20, 55, 110 }; ++ struct ieee80211_supported_band *sband; ++ u32 rate_flags = ieee80211_chandef_rate_flags(&mp->hw->conf.chandef); ++ int i, j; ++ ++ sband = mp->hw->wiphy->bands[NL80211_BAND_2GHZ]; ++ if (!sband) ++ return; ++ ++ for (i = 0, j = 0; i < sband->n_bitrates; i++) { ++ struct ieee80211_rate *rate = &sband->bitrates[i]; ++ ++ if (rate->flags & IEEE80211_RATE_ERP_G) ++ continue; ++ ++ if ((rate_flags & sband->bitrates[i].flags) != rate_flags) ++ continue; ++ ++ for (j = 0; j < ARRAY_SIZE(bitrates); j++) { ++ if (rate->bitrate != bitrates[j]) ++ continue; ++ ++ mp->cck_rates[j] = i; ++ break; ++ } ++ } ++} ++ + static void * + minstrel_ht_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) + { +- return mac80211_minstrel.alloc(hw, debugfsdir); ++ struct minstrel_priv *mp; ++ ++ mp = kzalloc(sizeof(struct minstrel_priv), GFP_ATOMIC); ++ if (!mp) ++ return NULL; ++ ++ /* contention window settings ++ * Just an approximation. Using the per-queue values would complicate ++ * the calculations and is probably unnecessary */ ++ mp->cw_min = 15; ++ mp->cw_max = 1023; ++ ++ /* number of packets (in %) to use for sampling other rates ++ * sample less often for non-mrr packets, because the overhead ++ * is much higher than with mrr */ ++ mp->lookaround_rate = 5; ++ mp->lookaround_rate_mrr = 10; ++ ++ /* maximum time that the hw is allowed to stay in one MRR segment */ ++ mp->segment_size = 6000; ++ ++ if (hw->max_rate_tries > 0) ++ mp->max_retry = hw->max_rate_tries; ++ else ++ /* safe default, does not necessarily have to match hw properties */ ++ mp->max_retry = 7; ++ ++ if (hw->max_rates >= 4) ++ mp->has_mrr = true; ++ ++ mp->hw = hw; ++ mp->update_interval = 100; ++ ++#ifdef CPTCFG_MAC80211_DEBUGFS ++ mp->fixed_rate_idx = (u32) -1; ++ debugfs_create_u32("fixed_rate_idx", S_IRUGO | S_IWUGO, debugfsdir, ++ &mp->fixed_rate_idx); ++#endif ++ ++ minstrel_ht_init_cck_rates(mp); ++ ++ return mp; + } + + static void + minstrel_ht_free(void *priv) + { +- mac80211_minstrel.free(priv); ++ kfree(priv); + } + + static u32 minstrel_ht_get_expected_throughput(void *priv_sta) +@@ -1421,14 +1486,14 @@ static void __init init_sample_table(voi + } + + int __init +-rc80211_minstrel_ht_init(void) ++rc80211_minstrel_init(void) + { + init_sample_table(); + return ieee80211_rate_control_register(&mac80211_minstrel_ht); + } + + void +-rc80211_minstrel_ht_exit(void) ++rc80211_minstrel_exit(void) + { + ieee80211_rate_control_unregister(&mac80211_minstrel_ht); + } +--- a/net/mac80211/rc80211_minstrel_ht.h ++++ b/net/mac80211/rc80211_minstrel_ht.h +@@ -15,11 +15,7 @@ + */ + #define MINSTREL_MAX_STREAMS 3 + #define MINSTREL_HT_STREAM_GROUPS 4 /* BW(=2) * SGI(=2) */ +-#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT + #define MINSTREL_VHT_STREAM_GROUPS 6 /* BW(=3) * SGI(=2) */ +-#else +-#define MINSTREL_VHT_STREAM_GROUPS 0 +-#endif + + #define MINSTREL_HT_GROUPS_NB (MINSTREL_MAX_STREAMS * \ + MINSTREL_HT_STREAM_GROUPS) +@@ -34,11 +30,7 @@ + #define MINSTREL_CCK_GROUP (MINSTREL_HT_GROUP_0 + MINSTREL_HT_GROUPS_NB) + #define MINSTREL_VHT_GROUP_0 (MINSTREL_CCK_GROUP + 1) + +-#ifdef CPTCFG_MAC80211_RC_MINSTREL_VHT + #define MCS_GROUP_RATES 10 +-#else +-#define MCS_GROUP_RATES 8 +-#endif + + struct mcs_group { + u32 flags; +--- a/net/mac80211/rc80211_minstrel_ht_debugfs.c ++++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c +@@ -15,6 +15,22 @@ + #include "rc80211_minstrel.h" + #include "rc80211_minstrel_ht.h" + ++static ssize_t ++minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos) ++{ ++ struct minstrel_debugfs_info *ms; ++ ++ ms = file->private_data; ++ return simple_read_from_buffer(buf, len, ppos, ms->buf, ms->len); ++} ++ ++static int ++minstrel_stats_release(struct inode *inode, struct file *file) ++{ ++ kfree(file->private_data); ++ return 0; ++} ++ + static char * + minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p) + { diff --git a/package/kernel/mac80211/patches/subsys/306-mac80211-minstrel-reduce-minstrel_mcs_groups-size.patch b/package/kernel/mac80211/patches/subsys/306-mac80211-minstrel-reduce-minstrel_mcs_groups-size.patch new file mode 100644 index 00000000000000..019fb77d187af6 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/306-mac80211-minstrel-reduce-minstrel_mcs_groups-size.patch @@ -0,0 +1,368 @@ +From: Felix Fietkau +Date: Sat, 10 Feb 2018 12:45:47 +0100 +Subject: [PATCH] mac80211: minstrel: reduce minstrel_mcs_groups size + +By storing a shift value for all duration values of a group, we can +reduce precision by a neglegible amount to make it fit into a u16 value. +This improves cache footprint and reduces size: + +Before: + text data bss dec hex filename + 10024 116 0 10140 279c rc80211_minstrel_ht.o + +After: + text data bss dec hex filename + 9368 116 0 9484 250c rc80211_minstrel_ht.o + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -52,22 +52,23 @@ + _streams - 1 + + /* MCS rate information for an MCS group */ +-#define MCS_GROUP(_streams, _sgi, _ht40) \ ++#define MCS_GROUP(_streams, _sgi, _ht40, _s) \ + [GROUP_IDX(_streams, _sgi, _ht40)] = { \ + .streams = _streams, \ ++ .shift = _s, \ + .flags = \ + IEEE80211_TX_RC_MCS | \ + (_sgi ? IEEE80211_TX_RC_SHORT_GI : 0) | \ + (_ht40 ? IEEE80211_TX_RC_40_MHZ_WIDTH : 0), \ + .duration = { \ +- MCS_DURATION(_streams, _sgi, _ht40 ? 54 : 26), \ +- MCS_DURATION(_streams, _sgi, _ht40 ? 108 : 52), \ +- MCS_DURATION(_streams, _sgi, _ht40 ? 162 : 78), \ +- MCS_DURATION(_streams, _sgi, _ht40 ? 216 : 104), \ +- MCS_DURATION(_streams, _sgi, _ht40 ? 324 : 156), \ +- MCS_DURATION(_streams, _sgi, _ht40 ? 432 : 208), \ +- MCS_DURATION(_streams, _sgi, _ht40 ? 486 : 234), \ +- MCS_DURATION(_streams, _sgi, _ht40 ? 540 : 260) \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 54 : 26) >> _s, \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 108 : 52) >> _s, \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 162 : 78) >> _s, \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 216 : 104) >> _s, \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 324 : 156) >> _s, \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 432 : 208) >> _s, \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 486 : 234) >> _s, \ ++ MCS_DURATION(_streams, _sgi, _ht40 ? 540 : 260) >> _s \ + } \ + } + +@@ -80,9 +81,10 @@ + #define BW2VBPS(_bw, r3, r2, r1) \ + (_bw == BW_80 ? r3 : _bw == BW_40 ? r2 : r1) + +-#define VHT_GROUP(_streams, _sgi, _bw) \ ++#define VHT_GROUP(_streams, _sgi, _bw, _s) \ + [VHT_GROUP_IDX(_streams, _sgi, _bw)] = { \ + .streams = _streams, \ ++ .shift = _s, \ + .flags = \ + IEEE80211_TX_RC_VHT_MCS | \ + (_sgi ? IEEE80211_TX_RC_SHORT_GI : 0) | \ +@@ -90,25 +92,25 @@ + _bw == BW_40 ? IEEE80211_TX_RC_40_MHZ_WIDTH : 0), \ + .duration = { \ + MCS_DURATION(_streams, _sgi, \ +- BW2VBPS(_bw, 117, 54, 26)), \ ++ BW2VBPS(_bw, 117, 54, 26)) >> _s, \ + MCS_DURATION(_streams, _sgi, \ +- BW2VBPS(_bw, 234, 108, 52)), \ ++ BW2VBPS(_bw, 234, 108, 52)) >> _s, \ + MCS_DURATION(_streams, _sgi, \ +- BW2VBPS(_bw, 351, 162, 78)), \ ++ BW2VBPS(_bw, 351, 162, 78)) >> _s, \ + MCS_DURATION(_streams, _sgi, \ +- BW2VBPS(_bw, 468, 216, 104)), \ ++ BW2VBPS(_bw, 468, 216, 104)) >> _s, \ + MCS_DURATION(_streams, _sgi, \ +- BW2VBPS(_bw, 702, 324, 156)), \ ++ BW2VBPS(_bw, 702, 324, 156)) >> _s, \ + MCS_DURATION(_streams, _sgi, \ +- BW2VBPS(_bw, 936, 432, 208)), \ ++ BW2VBPS(_bw, 936, 432, 208)) >> _s, \ + MCS_DURATION(_streams, _sgi, \ +- BW2VBPS(_bw, 1053, 486, 234)), \ ++ BW2VBPS(_bw, 1053, 486, 234)) >> _s, \ + MCS_DURATION(_streams, _sgi, \ +- BW2VBPS(_bw, 1170, 540, 260)), \ ++ BW2VBPS(_bw, 1170, 540, 260)) >> _s, \ + MCS_DURATION(_streams, _sgi, \ +- BW2VBPS(_bw, 1404, 648, 312)), \ ++ BW2VBPS(_bw, 1404, 648, 312)) >> _s, \ + MCS_DURATION(_streams, _sgi, \ +- BW2VBPS(_bw, 1560, 720, 346)) \ ++ BW2VBPS(_bw, 1560, 720, 346)) >> _s \ + } \ + } + +@@ -121,19 +123,20 @@ + (CCK_DURATION((_bitrate > 10 ? 20 : 10), false, 60) + \ + CCK_DURATION(_bitrate, _short, AVG_PKT_SIZE)) + +-#define CCK_DURATION_LIST(_short) \ +- CCK_ACK_DURATION(10, _short), \ +- CCK_ACK_DURATION(20, _short), \ +- CCK_ACK_DURATION(55, _short), \ +- CCK_ACK_DURATION(110, _short) ++#define CCK_DURATION_LIST(_short, _s) \ ++ CCK_ACK_DURATION(10, _short) >> _s, \ ++ CCK_ACK_DURATION(20, _short) >> _s, \ ++ CCK_ACK_DURATION(55, _short) >> _s, \ ++ CCK_ACK_DURATION(110, _short) >> _s + +-#define CCK_GROUP \ ++#define CCK_GROUP(_s) \ + [MINSTREL_CCK_GROUP] = { \ + .streams = 1, \ + .flags = 0, \ ++ .shift = _s, \ + .duration = { \ +- CCK_DURATION_LIST(false), \ +- CCK_DURATION_LIST(true) \ ++ CCK_DURATION_LIST(false, _s), \ ++ CCK_DURATION_LIST(true, _s) \ + } \ + } + +@@ -151,47 +154,47 @@ MODULE_PARM_DESC(minstrel_vht_only, + * BW -> SGI -> #streams + */ + const struct mcs_group minstrel_mcs_groups[] = { +- MCS_GROUP(1, 0, BW_20), +- MCS_GROUP(2, 0, BW_20), +- MCS_GROUP(3, 0, BW_20), +- +- MCS_GROUP(1, 1, BW_20), +- MCS_GROUP(2, 1, BW_20), +- MCS_GROUP(3, 1, BW_20), +- +- MCS_GROUP(1, 0, BW_40), +- MCS_GROUP(2, 0, BW_40), +- MCS_GROUP(3, 0, BW_40), +- +- MCS_GROUP(1, 1, BW_40), +- MCS_GROUP(2, 1, BW_40), +- MCS_GROUP(3, 1, BW_40), +- +- CCK_GROUP, +- +- VHT_GROUP(1, 0, BW_20), +- VHT_GROUP(2, 0, BW_20), +- VHT_GROUP(3, 0, BW_20), +- +- VHT_GROUP(1, 1, BW_20), +- VHT_GROUP(2, 1, BW_20), +- VHT_GROUP(3, 1, BW_20), +- +- VHT_GROUP(1, 0, BW_40), +- VHT_GROUP(2, 0, BW_40), +- VHT_GROUP(3, 0, BW_40), +- +- VHT_GROUP(1, 1, BW_40), +- VHT_GROUP(2, 1, BW_40), +- VHT_GROUP(3, 1, BW_40), +- +- VHT_GROUP(1, 0, BW_80), +- VHT_GROUP(2, 0, BW_80), +- VHT_GROUP(3, 0, BW_80), +- +- VHT_GROUP(1, 1, BW_80), +- VHT_GROUP(2, 1, BW_80), +- VHT_GROUP(3, 1, BW_80), ++ MCS_GROUP(1, 0, BW_20, 5), ++ MCS_GROUP(2, 0, BW_20, 4), ++ MCS_GROUP(3, 0, BW_20, 4), ++ ++ MCS_GROUP(1, 1, BW_20, 5), ++ MCS_GROUP(2, 1, BW_20, 4), ++ MCS_GROUP(3, 1, BW_20, 4), ++ ++ MCS_GROUP(1, 0, BW_40, 4), ++ MCS_GROUP(2, 0, BW_40, 4), ++ MCS_GROUP(3, 0, BW_40, 4), ++ ++ MCS_GROUP(1, 1, BW_40, 4), ++ MCS_GROUP(2, 1, BW_40, 4), ++ MCS_GROUP(3, 1, BW_40, 4), ++ ++ CCK_GROUP(8), ++ ++ VHT_GROUP(1, 0, BW_20, 5), ++ VHT_GROUP(2, 0, BW_20, 4), ++ VHT_GROUP(3, 0, BW_20, 4), ++ ++ VHT_GROUP(1, 1, BW_20, 5), ++ VHT_GROUP(2, 1, BW_20, 4), ++ VHT_GROUP(3, 1, BW_20, 4), ++ ++ VHT_GROUP(1, 0, BW_40, 4), ++ VHT_GROUP(2, 0, BW_40, 4), ++ VHT_GROUP(3, 0, BW_40, 4), ++ ++ VHT_GROUP(1, 1, BW_40, 4), ++ VHT_GROUP(2, 1, BW_40, 4), ++ VHT_GROUP(3, 1, BW_40, 4), ++ ++ VHT_GROUP(1, 0, BW_80, 4), ++ VHT_GROUP(2, 0, BW_80, 4), ++ VHT_GROUP(3, 0, BW_80, 4), ++ ++ VHT_GROUP(1, 1, BW_80, 4), ++ VHT_GROUP(2, 1, BW_80, 4), ++ VHT_GROUP(3, 1, BW_80, 4), + }; + + static u8 sample_table[SAMPLE_COLUMNS][MCS_GROUP_RATES] __read_mostly; +@@ -308,7 +311,8 @@ minstrel_ht_get_tp_avg(struct minstrel_h + if (group != MINSTREL_CCK_GROUP) + nsecs = 1000 * mi->overhead / MINSTREL_TRUNC(mi->avg_ampdu_len); + +- nsecs += minstrel_mcs_groups[group].duration[rate]; ++ nsecs += minstrel_mcs_groups[group].duration[rate] << ++ minstrel_mcs_groups[group].shift; + + /* + * For the throughput calculation, limit the probability value to 90% to +@@ -756,12 +760,19 @@ minstrel_ht_tx_status(void *priv, struct + minstrel_ht_update_rates(mp, mi); + } + ++static inline int ++minstrel_get_duration(int index) ++{ ++ const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; ++ unsigned int duration = group->duration[index % MCS_GROUP_RATES]; ++ return duration << group->shift; ++} ++ + static void + minstrel_calc_retransmit(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, + int index) + { + struct minstrel_rate_stats *mrs; +- const struct mcs_group *group; + unsigned int tx_time, tx_time_rtscts, tx_time_data; + unsigned int cw = mp->cw_min; + unsigned int ctime = 0; +@@ -780,8 +791,7 @@ minstrel_calc_retransmit(struct minstrel + mrs->retry_count_rtscts = 2; + mrs->retry_updated = true; + +- group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; +- tx_time_data = group->duration[index % MCS_GROUP_RATES] * ampdu_len / 1000; ++ tx_time_data = minstrel_get_duration(index) * ampdu_len / 1000; + + /* Contention time for first 2 tries */ + ctime = (t_slot * cw) >> 1; +@@ -875,20 +885,24 @@ minstrel_ht_get_max_amsdu_len(struct min + int group = mi->max_prob_rate / MCS_GROUP_RATES; + const struct mcs_group *g = &minstrel_mcs_groups[group]; + int rate = mi->max_prob_rate % MCS_GROUP_RATES; ++ unsigned int duration; + + /* Disable A-MSDU if max_prob_rate is bad */ + if (mi->groups[group].rates[rate].prob_ewma < MINSTREL_FRAC(50, 100)) + return 1; + ++ duration = g->duration[rate]; ++ duration <<= g->shift; ++ + /* If the rate is slower than single-stream MCS1, make A-MSDU limit small */ +- if (g->duration[rate] > MCS_DURATION(1, 0, 52)) ++ if (duration > MCS_DURATION(1, 0, 52)) + return 500; + + /* + * If the rate is slower than single-stream MCS4, limit A-MSDU to usual + * data packet size + */ +- if (g->duration[rate] > MCS_DURATION(1, 0, 104)) ++ if (duration > MCS_DURATION(1, 0, 104)) + return 1600; + + /* +@@ -896,7 +910,7 @@ minstrel_ht_get_max_amsdu_len(struct min + * rate success probability is less than 75%, limit A-MSDU to twice the usual + * data packet size + */ +- if (g->duration[rate] > MCS_DURATION(1, 0, 260) || ++ if (duration > MCS_DURATION(1, 0, 260) || + (minstrel_ht_get_prob_ewma(mi, mi->max_tp_rate[0]) < + MINSTREL_FRAC(75, 100))) + return 3200; +@@ -943,13 +957,6 @@ minstrel_ht_update_rates(struct minstrel + rate_control_set_rates(mp->hw, mi->sta, rates); + } + +-static inline int +-minstrel_get_duration(int index) +-{ +- const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; +- return group->duration[index % MCS_GROUP_RATES]; +-} +- + static int + minstrel_get_sample_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) + { +--- a/net/mac80211/rc80211_minstrel_ht.h ++++ b/net/mac80211/rc80211_minstrel_ht.h +@@ -33,9 +33,10 @@ + #define MCS_GROUP_RATES 10 + + struct mcs_group { +- u32 flags; +- unsigned int streams; +- unsigned int duration[MCS_GROUP_RATES]; ++ u16 flags; ++ u8 streams; ++ u8 shift; ++ u16 duration[MCS_GROUP_RATES]; + }; + + extern const struct mcs_group minstrel_mcs_groups[]; +--- a/net/mac80211/rc80211_minstrel_ht_debugfs.c ++++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c +@@ -58,6 +58,7 @@ minstrel_ht_stats_dump(struct minstrel_h + static const int bitrates[4] = { 10, 20, 55, 110 }; + int idx = i * MCS_GROUP_RATES + j; + unsigned int prob_ewmsd; ++ unsigned int duration; + + if (!(mi->supported[i] & BIT(j))) + continue; +@@ -95,7 +96,9 @@ minstrel_ht_stats_dump(struct minstrel_h + p += sprintf(p, " %3u ", idx); + + /* tx_time[rate(i)] in usec */ +- tx_time = DIV_ROUND_CLOSEST(mg->duration[j], 1000); ++ duration = mg->duration[j]; ++ duration <<= mg->shift; ++ tx_time = DIV_ROUND_CLOSEST(duration, 1000); + p += sprintf(p, "%6u ", tx_time); + + tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100)); +@@ -204,6 +207,7 @@ minstrel_ht_stats_csv_dump(struct minstr + static const int bitrates[4] = { 10, 20, 55, 110 }; + int idx = i * MCS_GROUP_RATES + j; + unsigned int prob_ewmsd; ++ unsigned int duration; + + if (!(mi->supported[i] & BIT(j))) + continue; +@@ -238,7 +242,10 @@ minstrel_ht_stats_csv_dump(struct minstr + } + + p += sprintf(p, "%u,", idx); +- tx_time = DIV_ROUND_CLOSEST(mg->duration[j], 1000); ++ ++ duration = mg->duration[j]; ++ duration <<= mg->shift; ++ tx_time = DIV_ROUND_CLOSEST(duration, 1000); + p += sprintf(p, "%u,", tx_time); + + tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100)); diff --git a/package/kernel/mac80211/patches/377-mac80211-minstrel-do-not-sample-rates-3-times-slower.patch b/package/kernel/mac80211/patches/subsys/310-mac80211-minstrel-do-not-sample-rates-3-times-slower.patch similarity index 100% rename from package/kernel/mac80211/patches/377-mac80211-minstrel-do-not-sample-rates-3-times-slower.patch rename to package/kernel/mac80211/patches/subsys/310-mac80211-minstrel-do-not-sample-rates-3-times-slower.patch diff --git a/package/kernel/mac80211/patches/subsys/312-mac80211-minstrel_ht-add-flag-to-indicate-missing-in.patch b/package/kernel/mac80211/patches/subsys/312-mac80211-minstrel_ht-add-flag-to-indicate-missing-in.patch new file mode 100644 index 00000000000000..f221d36bf867fd --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/312-mac80211-minstrel_ht-add-flag-to-indicate-missing-in.patch @@ -0,0 +1,122 @@ +From: Felix Fietkau +Date: Wed, 16 Jan 2019 22:32:12 +0100 +Subject: [PATCH] mac80211: minstrel_ht: add flag to indicate + missing/inaccurate tx A-MPDU length + +Some hardware (e.g. MediaTek MT7603) cannot report A-MPDU length in tx status +information. Add support for a flag to indicate that, to allow minstrel_ht +to use a fixed value in its internal calculation (which gives better results +than just defaulting to 1). + +Signed-off-by: Felix Fietkau +Signed-off-by: Johannes Berg +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -2131,6 +2131,9 @@ struct ieee80211_txq { + * @IEEE80211_HW_DOESNT_SUPPORT_QOS_NDP: The driver (or firmware) doesn't + * support QoS NDP for AP probing - that's most likely a driver bug. + * ++ * @IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN: Driver does not report accurate A-MPDU ++ * length in tx status information ++ * + * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays + */ + enum ieee80211_hw_flags { +@@ -2176,6 +2179,7 @@ enum ieee80211_hw_flags { + IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA, + IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP, + IEEE80211_HW_DOESNT_SUPPORT_QOS_NDP, ++ IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN, + + /* keep last, obviously */ + NUM_IEEE80211_HW_FLAGS +--- a/net/mac80211/debugfs.c ++++ b/net/mac80211/debugfs.c +@@ -214,6 +214,7 @@ static const char *hw_flag_names[] = { + FLAG(SUPPORTS_TDLS_BUFFER_STA), + FLAG(DEAUTH_NEED_MGD_TX_PREP), + FLAG(DOESNT_SUPPORT_QOS_NDP), ++ FLAG(TX_STATUS_NO_AMPDU_LEN), + #undef FLAG + }; + +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -294,6 +294,15 @@ minstrel_get_ratestats(struct minstrel_h + return &mi->groups[index / MCS_GROUP_RATES].rates[index % MCS_GROUP_RATES]; + } + ++static unsigned int ++minstrel_ht_avg_ampdu_len(struct minstrel_ht_sta *mi) ++{ ++ if (!mi->avg_ampdu_len) ++ return AVG_AMPDU_SIZE; ++ ++ return MINSTREL_TRUNC(mi->avg_ampdu_len); ++} ++ + /* + * Return current throughput based on the average A-MPDU length, taking into + * account the expected number of retransmissions and their expected length +@@ -309,7 +318,7 @@ minstrel_ht_get_tp_avg(struct minstrel_h + return 0; + + if (group != MINSTREL_CCK_GROUP) +- nsecs = 1000 * mi->overhead / MINSTREL_TRUNC(mi->avg_ampdu_len); ++ nsecs = 1000 * mi->overhead / minstrel_ht_avg_ampdu_len(mi); + + nsecs += minstrel_mcs_groups[group].duration[rate] << + minstrel_mcs_groups[group].shift; +@@ -503,8 +512,12 @@ minstrel_ht_update_stats(struct minstrel + u16 tmp_cck_tp_rate[MAX_THR_RATES], index; + + if (mi->ampdu_packets > 0) { +- mi->avg_ampdu_len = minstrel_ewma(mi->avg_ampdu_len, +- MINSTREL_FRAC(mi->ampdu_len, mi->ampdu_packets), EWMA_LEVEL); ++ if (!ieee80211_hw_check(mp->hw, TX_STATUS_NO_AMPDU_LEN)) ++ mi->avg_ampdu_len = minstrel_ewma(mi->avg_ampdu_len, ++ MINSTREL_FRAC(mi->ampdu_len, mi->ampdu_packets), ++ EWMA_LEVEL); ++ else ++ mi->avg_ampdu_len = 0; + mi->ampdu_len = 0; + mi->ampdu_packets = 0; + } +@@ -709,7 +722,9 @@ minstrel_ht_tx_status(void *priv, struct + mi->ampdu_len += info->status.ampdu_len; + + if (!mi->sample_wait && !mi->sample_tries && mi->sample_count > 0) { +- mi->sample_wait = 16 + 2 * MINSTREL_TRUNC(mi->avg_ampdu_len); ++ int avg_ampdu_len = minstrel_ht_avg_ampdu_len(mi); ++ ++ mi->sample_wait = 16 + 2 * avg_ampdu_len; + mi->sample_tries = 1; + mi->sample_count--; + } +@@ -777,7 +792,7 @@ minstrel_calc_retransmit(struct minstrel + unsigned int cw = mp->cw_min; + unsigned int ctime = 0; + unsigned int t_slot = 9; /* FIXME */ +- unsigned int ampdu_len = MINSTREL_TRUNC(mi->avg_ampdu_len); ++ unsigned int ampdu_len = minstrel_ht_avg_ampdu_len(mi); + unsigned int overhead = 0, overhead_rtscts = 0; + + mrs = minstrel_get_ratestats(mi, index); +--- a/net/mac80211/rc80211_minstrel_ht_debugfs.c ++++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c +@@ -163,9 +163,10 @@ minstrel_ht_stats_open(struct inode *ino + "lookaround %d\n", + max(0, (int) mi->total_packets - (int) mi->sample_packets), + mi->sample_packets); +- p += sprintf(p, "Average # of aggregated frames per A-MPDU: %d.%d\n", +- MINSTREL_TRUNC(mi->avg_ampdu_len), +- MINSTREL_TRUNC(mi->avg_ampdu_len * 10) % 10); ++ if (mi->avg_ampdu_len) ++ p += sprintf(p, "Average # of aggregated frames per A-MPDU: %d.%d\n", ++ MINSTREL_TRUNC(mi->avg_ampdu_len), ++ MINSTREL_TRUNC(mi->avg_ampdu_len * 10) % 10); + ms->len = p - ms->buf; + WARN_ON(ms->len + sizeof(*ms) > 32768); + diff --git a/package/kernel/mac80211/patches/subsys/313-mac80211-minstrel_ht-fix-per-group-max-throughput-ra.patch b/package/kernel/mac80211/patches/subsys/313-mac80211-minstrel_ht-fix-per-group-max-throughput-ra.patch new file mode 100644 index 00000000000000..5ae29918e7d7ef --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/313-mac80211-minstrel_ht-fix-per-group-max-throughput-ra.patch @@ -0,0 +1,22 @@ +From: Felix Fietkau +Date: Fri, 14 Jun 2019 21:12:04 +0200 +Subject: [PATCH] mac80211: minstrel_ht: fix per-group max throughput rate + initialization + +The group number needs to be multiplied by the number of rates per group +to get the full rate index + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -542,7 +542,7 @@ minstrel_ht_update_stats(struct minstrel + + /* (re)Initialize group rate indexes */ + for(j = 0; j < MAX_THR_RATES; j++) +- tmp_group_tp_rate[j] = group; ++ tmp_group_tp_rate[j] = MCS_GROUP_RATES * group; + + for (i = 0; i < MCS_GROUP_RATES; i++) { + if (!(mi->supported[group] & BIT(i))) diff --git a/package/kernel/mac80211/patches/subsys/314-mac80211-minstrel_ht-reduce-unnecessary-rate-probing.patch b/package/kernel/mac80211/patches/subsys/314-mac80211-minstrel_ht-reduce-unnecessary-rate-probing.patch new file mode 100644 index 00000000000000..ed089afb06517d --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/314-mac80211-minstrel_ht-reduce-unnecessary-rate-probing.patch @@ -0,0 +1,42 @@ +From: Felix Fietkau +Date: Wed, 5 Jun 2019 20:42:49 +0200 +Subject: [PATCH] mac80211: minstrel_ht: reduce unnecessary rate probing + attempts + +On hardware with static fallback tables (e.g. mt76x2), rate probing attempts +can be very expensive. +On such devices, avoid sampling rates slower than the per-group max throughput +rate, based on the assumption that the fallback table will take care of probing +lower rates within that group if the higher rates fail. +To make this work, this also fixes a wrong initialization in the previously +unused per-group sorted rate array. +To further reduce unnecessary probing attempts, skip duplicate attempts on +rates slower than the max throughput rate. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -1028,6 +1028,21 @@ minstrel_get_sample_rate(struct minstrel + minstrel_get_duration(mi->max_prob_rate) * 3 < sample_dur) + return -1; + ++ ++ /* ++ * For devices with no configurable multi-rate retry, skip sampling ++ * below the per-group max throughput rate, and only use one sampling ++ * attempt per rate ++ */ ++ if (mp->hw->max_rates == 1 && ++ (minstrel_get_duration(mg->max_group_tp_rate[0]) < sample_dur || ++ mrs->attempts)) ++ return -1; ++ ++ /* Skip already sampled slow rates */ ++ if (sample_dur >= minstrel_get_duration(tp_rate1) && mrs->attempts) ++ return -1; ++ + /* + * Make sure that lower rates get sampled only occasionally, + * if the link is working perfectly. diff --git a/package/kernel/mac80211/patches/subsys/315-mac80211-minstrel_ht-fix-default-max-throughput-rate.patch b/package/kernel/mac80211/patches/subsys/315-mac80211-minstrel_ht-fix-default-max-throughput-rate.patch new file mode 100644 index 00000000000000..3dcea654a2b833 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/315-mac80211-minstrel_ht-fix-default-max-throughput-rate.patch @@ -0,0 +1,46 @@ +From: Felix Fietkau +Date: Fri, 14 Jun 2019 21:14:22 +0200 +Subject: [PATCH] mac80211: minstrel_ht: fix default max throughput rate + indexes + +Use the first supported rate instead of 0 (which can be invalid) + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -453,7 +453,7 @@ minstrel_ht_assign_best_tp_rates(struct + tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_ewma; + tmp_mcs_tp = minstrel_ht_get_tp_avg(mi, tmp_group, tmp_idx, tmp_prob); + +- if (tmp_cck_tp > tmp_mcs_tp) { ++ if (tmp_cck_tp_rate && tmp_cck_tp > tmp_mcs_tp) { + for(i = 0; i < MAX_THR_RATES; i++) { + minstrel_ht_sort_best_tp_rates(mi, tmp_cck_tp_rate[i], + tmp_mcs_tp_rate); +@@ -525,11 +525,19 @@ minstrel_ht_update_stats(struct minstrel + mi->sample_slow = 0; + mi->sample_count = 0; + +- /* Initialize global rate indexes */ +- for(j = 0; j < MAX_THR_RATES; j++){ +- tmp_mcs_tp_rate[j] = 0; +- tmp_cck_tp_rate[j] = 0; +- } ++ memset(tmp_mcs_tp_rate, 0, sizeof(tmp_mcs_tp_rate)); ++ memset(tmp_cck_tp_rate, 0, sizeof(tmp_cck_tp_rate)); ++ if (mi->supported[MINSTREL_CCK_GROUP]) ++ for (j = 0; j < ARRAY_SIZE(tmp_cck_tp_rate); j++) ++ tmp_cck_tp_rate[j] = MINSTREL_CCK_GROUP * MCS_GROUP_RATES; ++ ++ if (mi->supported[MINSTREL_VHT_GROUP_0]) ++ index = MINSTREL_VHT_GROUP_0 * MCS_GROUP_RATES; ++ else ++ index = MINSTREL_HT_GROUP_0 * MCS_GROUP_RATES; ++ ++ for (j = 0; j < ARRAY_SIZE(tmp_mcs_tp_rate); j++) ++ tmp_mcs_tp_rate[j] = index; + + /* Find best rate sets within all MCS groups*/ + for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) { diff --git a/package/kernel/mac80211/patches/subsys/316-mac80211-minstrel_ht-improve-rate-probing-for-device.patch b/package/kernel/mac80211/patches/subsys/316-mac80211-minstrel_ht-improve-rate-probing-for-device.patch new file mode 100644 index 00000000000000..07d59e0ed73d42 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/316-mac80211-minstrel_ht-improve-rate-probing-for-device.patch @@ -0,0 +1,481 @@ +From: Felix Fietkau +Date: Fri, 14 Jun 2019 21:15:47 +0200 +Subject: [PATCH] mac80211: minstrel_ht: improve rate probing for devices + with static fallback + +On some devices that only support static rate fallback tables sending rate +control probing packets can be really expensive. +Probing lower rates can already hurt throughput quite a bit. What hurts even +more is the fact that on mt76x0/mt76x2, single probing packets can only be +forced by directing packets at a different internal hardware queue, which +causes some heavy reordering and extra latency. +The reordering issue is mainly problematic while pushing lots of packets to +a particular station. If there is little activity, the overhead of probing is +neglegible. + +The static fallback behavior is designed to pretty much only handle rate +control algorithms that use only a very limited set of rates on which the +algorithm switches up/down based on packet error rate. + +In order to better support that kind of hardware, this patch implements a +different approach to rate probing where it switches to a slightly higher rate, +waits for tx status feedback, then updates the stats and switches back to +the new max throughput rate. This only triggers above a packet rate of 100 +per stats interval (~50ms). +For that kind of probing, the code has to reduce the set of probing rates +a lot more compared to single packet probing, so it uses only one packet +per MCS group which is either slightly faster, or as close as possible to +the max throughput rate. +This allows switching between similar rates with different numbers of +streams. The algorithm assumes that the hardware will work its way lower +within an MCS group in case of retransmissions, so that lower rates don't +have to be probed by the high packets per second rate probing code. + +To further reduce the search space, it also does not probe rates with lower +channel bandwidth than the max throughput rate. + +At the moment, these changes will only affect mt76x0/mt76x2. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel.h ++++ b/net/mac80211/rc80211_minstrel.h +@@ -114,6 +114,7 @@ struct minstrel_sta_info { + struct minstrel_priv { + struct ieee80211_hw *hw; + bool has_mrr; ++ u32 sample_switch; + unsigned int cw_min; + unsigned int cw_max; + unsigned int max_retry; +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -21,6 +21,8 @@ + #define AVG_AMPDU_SIZE 16 + #define AVG_PKT_SIZE 1200 + ++#define SAMPLE_SWITCH_THR 100 ++ + /* Number of bits for an average sized packet */ + #define MCS_NBITS ((AVG_PKT_SIZE * AVG_AMPDU_SIZE) << 3) + +@@ -56,6 +58,7 @@ + [GROUP_IDX(_streams, _sgi, _ht40)] = { \ + .streams = _streams, \ + .shift = _s, \ ++ .bw = _ht40, \ + .flags = \ + IEEE80211_TX_RC_MCS | \ + (_sgi ? IEEE80211_TX_RC_SHORT_GI : 0) | \ +@@ -85,6 +88,7 @@ + [VHT_GROUP_IDX(_streams, _sgi, _bw)] = { \ + .streams = _streams, \ + .shift = _s, \ ++ .bw = _bw, \ + .flags = \ + IEEE80211_TX_RC_VHT_MCS | \ + (_sgi ? IEEE80211_TX_RC_SHORT_GI : 0) | \ +@@ -493,6 +497,133 @@ minstrel_ht_prob_rate_reduce_streams(str + } + } + ++static inline int ++minstrel_get_duration(int index) ++{ ++ const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; ++ unsigned int duration = group->duration[index % MCS_GROUP_RATES]; ++ return duration << group->shift; ++} ++ ++static bool ++minstrel_ht_probe_group(struct minstrel_ht_sta *mi, const struct mcs_group *tp_group, ++ int tp_idx, const struct mcs_group *group) ++{ ++ if (group->bw < tp_group->bw) ++ return false; ++ ++ if (group->streams == tp_group->streams) ++ return true; ++ ++ if (tp_idx < 4 && group->streams == tp_group->streams - 1) ++ return true; ++ ++ return group->streams == tp_group->streams + 1; ++} ++ ++static void ++minstrel_ht_find_probe_rates(struct minstrel_ht_sta *mi, u16 *rates, int *n_rates, ++ bool faster_rate) ++{ ++ const struct mcs_group *group, *tp_group; ++ int i, g, max_dur; ++ int tp_idx; ++ ++ tp_group = &minstrel_mcs_groups[mi->max_tp_rate[0] / MCS_GROUP_RATES]; ++ tp_idx = mi->max_tp_rate[0] % MCS_GROUP_RATES; ++ ++ max_dur = minstrel_get_duration(mi->max_tp_rate[0]); ++ if (faster_rate) ++ max_dur -= max_dur / 16; ++ ++ for (g = 0; g < MINSTREL_GROUPS_NB; g++) { ++ u16 supported = mi->supported[g]; ++ ++ if (!supported) ++ continue; ++ ++ group = &minstrel_mcs_groups[g]; ++ if (!minstrel_ht_probe_group(mi, tp_group, tp_idx, group)) ++ continue; ++ ++ for (i = 0; supported; supported >>= 1, i++) { ++ int idx; ++ ++ if (!(supported & 1)) ++ continue; ++ ++ if ((group->duration[i] << group->shift) > max_dur) ++ continue; ++ ++ idx = g * MCS_GROUP_RATES + i; ++ if (idx == mi->max_tp_rate[0]) ++ continue; ++ ++ rates[(*n_rates)++] = idx; ++ break; ++ } ++ } ++} ++ ++static void ++minstrel_ht_rate_sample_switch(struct minstrel_priv *mp, ++ struct minstrel_ht_sta *mi) ++{ ++ struct minstrel_rate_stats *mrs; ++ u16 rates[MINSTREL_GROUPS_NB]; ++ int n_rates = 0; ++ int probe_rate = 0; ++ bool faster_rate; ++ int i; ++ u8 random; ++ ++ /* ++ * Use rate switching instead of probing packets for devices with ++ * little control over retry fallback behavior ++ */ ++ if (mp->hw->max_rates > 1) ++ return; ++ ++ /* ++ * If the current EWMA prob is >75%, look for a rate that's 6.25% ++ * faster than the max tp rate. ++ * If that fails, look again for a rate that is at least as fast ++ */ ++ mrs = minstrel_get_ratestats(mi, mi->max_tp_rate[0]); ++ faster_rate = mrs->prob_ewma > MINSTREL_FRAC(75, 100); ++ minstrel_ht_find_probe_rates(mi, rates, &n_rates, faster_rate); ++ if (!n_rates && faster_rate) ++ minstrel_ht_find_probe_rates(mi, rates, &n_rates, false); ++ ++ /* If no suitable rate was found, try to pick the next one in the group */ ++ if (!n_rates) { ++ int g_idx = mi->max_tp_rate[0] / MCS_GROUP_RATES; ++ u16 supported = mi->supported[g_idx]; ++ ++ supported >>= mi->max_tp_rate[0] % MCS_GROUP_RATES; ++ for (i = 0; supported; i++) { ++ if (!(supported & 1)) ++ continue; ++ ++ probe_rate = mi->max_tp_rate[0] + i; ++ goto out; ++ } ++ ++ return; ++ } ++ ++ i = 0; ++ if (n_rates > 1) { ++ random = prandom_u32(); ++ i = random % n_rates; ++ } ++ probe_rate = rates[i]; ++ ++out: ++ mi->sample_rate = probe_rate; ++ mi->sample_mode = MINSTREL_SAMPLE_ACTIVE; ++} ++ + /* + * Update rate statistics and select new primary rates + * +@@ -503,7 +634,8 @@ minstrel_ht_prob_rate_reduce_streams(str + * higher throughput rates, even if the probablity is a bit lower + */ + static void +-minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) ++minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, ++ bool sample) + { + struct minstrel_mcs_group_data *mg; + struct minstrel_rate_stats *mrs; +@@ -511,6 +643,18 @@ minstrel_ht_update_stats(struct minstrel + u16 tmp_mcs_tp_rate[MAX_THR_RATES], tmp_group_tp_rate[MAX_THR_RATES]; + u16 tmp_cck_tp_rate[MAX_THR_RATES], index; + ++ mi->sample_mode = MINSTREL_SAMPLE_IDLE; ++ ++ if (sample) { ++ mi->total_packets_cur = mi->total_packets - ++ mi->total_packets_last; ++ mi->total_packets_last = mi->total_packets; ++ } ++ if (!mp->sample_switch) ++ sample = false; ++ if (mi->total_packets_cur < SAMPLE_SWITCH_THR && mp->sample_switch != 1) ++ sample = false; ++ + if (mi->ampdu_packets > 0) { + if (!ieee80211_hw_check(mp->hw, TX_STATUS_NO_AMPDU_LEN)) + mi->avg_ampdu_len = minstrel_ewma(mi->avg_ampdu_len, +@@ -597,12 +741,16 @@ minstrel_ht_update_stats(struct minstrel + /* try to sample all available rates during each interval */ + mi->sample_count *= 8; + ++ if (sample) ++ minstrel_ht_rate_sample_switch(mp, mi); ++ + #ifdef CPTCFG_MAC80211_DEBUGFS + /* use fixed index if set */ + if (mp->fixed_rate_idx != -1) { + for (i = 0; i < 4; i++) + mi->max_tp_rate[i] = mp->fixed_rate_idx; + mi->max_prob_rate = mp->fixed_rate_idx; ++ mi->sample_mode = MINSTREL_SAMPLE_IDLE; + } + #endif + +@@ -706,15 +854,17 @@ minstrel_ht_tx_status(void *priv, struct + struct minstrel_ht_sta_priv *msp = priv_sta; + struct minstrel_ht_sta *mi = &msp->ht; + struct ieee80211_tx_rate *ar = info->status.rates; +- struct minstrel_rate_stats *rate, *rate2; ++ struct minstrel_rate_stats *rate, *rate2, *rate_sample = NULL; + struct minstrel_priv *mp = priv; + bool last, update = false; ++ bool sample_status = false; + int i; + + if (!msp->is_ht) + return mac80211_minstrel.tx_status_ext(priv, sband, + &msp->legacy, st); + ++ + /* This packet was aggregated but doesn't carry status info */ + if ((info->flags & IEEE80211_TX_CTL_AMPDU) && + !(info->flags & IEEE80211_TX_STAT_AMPDU)) +@@ -740,12 +890,17 @@ minstrel_ht_tx_status(void *priv, struct + if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) + mi->sample_packets += info->status.ampdu_len; + ++ if (mi->sample_mode != MINSTREL_SAMPLE_IDLE) ++ rate_sample = minstrel_get_ratestats(mi, mi->sample_rate); ++ + last = !minstrel_ht_txstat_valid(mp, &ar[0]); + for (i = 0; !last; i++) { + last = (i == IEEE80211_TX_MAX_RATES - 1) || + !minstrel_ht_txstat_valid(mp, &ar[i + 1]); + + rate = minstrel_ht_get_stats(mp, mi, &ar[i]); ++ if (rate == rate_sample) ++ sample_status = true; + + if (last) + rate->success += info->status.ampdu_ack_len; +@@ -753,44 +908,60 @@ minstrel_ht_tx_status(void *priv, struct + rate->attempts += ar[i].count * info->status.ampdu_len; + } + +- /* +- * check for sudden death of spatial multiplexing, +- * downgrade to a lower number of streams if necessary. +- */ +- rate = minstrel_get_ratestats(mi, mi->max_tp_rate[0]); +- if (rate->attempts > 30 && +- MINSTREL_FRAC(rate->success, rate->attempts) < +- MINSTREL_FRAC(20, 100)) { +- minstrel_downgrade_rate(mi, &mi->max_tp_rate[0], true); ++ switch (mi->sample_mode) { ++ case MINSTREL_SAMPLE_IDLE: ++ break; ++ ++ case MINSTREL_SAMPLE_ACTIVE: ++ if (!sample_status) ++ break; ++ ++ mi->sample_mode = MINSTREL_SAMPLE_PENDING; + update = true; +- } ++ break; ++ ++ case MINSTREL_SAMPLE_PENDING: ++ if (sample_status) ++ break; + +- rate2 = minstrel_get_ratestats(mi, mi->max_tp_rate[1]); +- if (rate2->attempts > 30 && +- MINSTREL_FRAC(rate2->success, rate2->attempts) < +- MINSTREL_FRAC(20, 100)) { +- minstrel_downgrade_rate(mi, &mi->max_tp_rate[1], false); + update = true; ++ minstrel_ht_update_stats(mp, mi, false); ++ break; ++ } ++ ++ ++ if (mp->hw->max_rates > 1) { ++ /* ++ * check for sudden death of spatial multiplexing, ++ * downgrade to a lower number of streams if necessary. ++ */ ++ rate = minstrel_get_ratestats(mi, mi->max_tp_rate[0]); ++ if (rate->attempts > 30 && ++ MINSTREL_FRAC(rate->success, rate->attempts) < ++ MINSTREL_FRAC(20, 100)) { ++ minstrel_downgrade_rate(mi, &mi->max_tp_rate[0], true); ++ update = true; ++ } ++ ++ rate2 = minstrel_get_ratestats(mi, mi->max_tp_rate[1]); ++ if (rate2->attempts > 30 && ++ MINSTREL_FRAC(rate2->success, rate2->attempts) < ++ MINSTREL_FRAC(20, 100)) { ++ minstrel_downgrade_rate(mi, &mi->max_tp_rate[1], false); ++ update = true; ++ } + } + + if (time_after(jiffies, mi->last_stats_update + + (mp->update_interval / 2 * HZ) / 1000)) { + update = true; +- minstrel_ht_update_stats(mp, mi); ++ minstrel_ht_update_stats(mp, mi, true); + } + + if (update) + minstrel_ht_update_rates(mp, mi); + } + +-static inline int +-minstrel_get_duration(int index) +-{ +- const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; +- unsigned int duration = group->duration[index % MCS_GROUP_RATES]; +- return duration << group->shift; +-} +- + static void + minstrel_calc_retransmit(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, + int index) +@@ -955,14 +1126,18 @@ static void + minstrel_ht_update_rates(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) + { + struct ieee80211_sta_rates *rates; ++ u16 first_rate = mi->max_tp_rate[0]; + int i = 0; + ++ if (mi->sample_mode == MINSTREL_SAMPLE_ACTIVE) ++ first_rate = mi->sample_rate; ++ + rates = kzalloc(sizeof(*rates), GFP_ATOMIC); + if (!rates) + return; + + /* Start with max_tp_rate[0] */ +- minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_tp_rate[0]); ++ minstrel_ht_set_rate(mp, mi, rates, i++, first_rate); + + if (mp->hw->max_rates >= 3) { + /* At least 3 tx rates supported, use max_tp_rate[1] next */ +@@ -989,6 +1164,11 @@ minstrel_get_sample_rate(struct minstrel + int tp_rate1, tp_rate2; + int sample_idx = 0; + ++ if (mp->hw->max_rates == 1 && mp->sample_switch && ++ (mi->total_packets_cur >= SAMPLE_SWITCH_THR || ++ mp->sample_switch == 1)) ++ return -1; ++ + if (mi->sample_wait > 0) { + mi->sample_wait--; + return -1; +@@ -1315,7 +1495,7 @@ minstrel_ht_update_caps(void *priv, stru + mi->supported[MINSTREL_CCK_GROUP] |= mi->cck_supported_short << 4; + + /* create an initial rate table with the lowest supported rates */ +- minstrel_ht_update_stats(mp, mi); ++ minstrel_ht_update_stats(mp, mi, true); + minstrel_ht_update_rates(mp, mi); + + return; +@@ -1433,6 +1613,8 @@ minstrel_ht_alloc(struct ieee80211_hw *h + if (!mp) + return NULL; + ++ mp->sample_switch = -1; ++ + /* contention window settings + * Just an approximation. Using the per-queue values would complicate + * the calculations and is probably unnecessary */ +@@ -1464,6 +1646,8 @@ minstrel_ht_alloc(struct ieee80211_hw *h + mp->fixed_rate_idx = (u32) -1; + debugfs_create_u32("fixed_rate_idx", S_IRUGO | S_IWUGO, debugfsdir, + &mp->fixed_rate_idx); ++ debugfs_create_u32("sample_switch", S_IRUGO | S_IWUSR, debugfsdir, ++ &mp->sample_switch); + #endif + + minstrel_ht_init_cck_rates(mp); +--- a/net/mac80211/rc80211_minstrel_ht.h ++++ b/net/mac80211/rc80211_minstrel_ht.h +@@ -36,6 +36,7 @@ struct mcs_group { + u16 flags; + u8 streams; + u8 shift; ++ u8 bw; + u16 duration[MCS_GROUP_RATES]; + }; + +@@ -53,6 +54,12 @@ struct minstrel_mcs_group_data { + struct minstrel_rate_stats rates[MCS_GROUP_RATES]; + }; + ++enum minstrel_sample_mode { ++ MINSTREL_SAMPLE_IDLE, ++ MINSTREL_SAMPLE_ACTIVE, ++ MINSTREL_SAMPLE_PENDING, ++}; ++ + struct minstrel_ht_sta { + struct ieee80211_sta *sta; + +@@ -74,6 +81,8 @@ struct minstrel_ht_sta { + unsigned int overhead; + unsigned int overhead_rtscts; + ++ unsigned int total_packets_last; ++ unsigned int total_packets_cur; + unsigned int total_packets; + unsigned int sample_packets; + +@@ -85,6 +94,9 @@ struct minstrel_ht_sta { + u8 sample_count; + u8 sample_slow; + ++ enum minstrel_sample_mode sample_mode; ++ u16 sample_rate; ++ + /* current MCS group to be sampled */ + u8 sample_group; + diff --git a/package/kernel/mac80211/patches/subsys/317-mac80211-minstrel_ht-fix-infinite-loop-because-suppo.patch b/package/kernel/mac80211/patches/subsys/317-mac80211-minstrel_ht-fix-infinite-loop-because-suppo.patch new file mode 100644 index 00000000000000..59fc726683dc6e --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/317-mac80211-minstrel_ht-fix-infinite-loop-because-suppo.patch @@ -0,0 +1,25 @@ +From: Colin Ian King +Date: Thu, 22 Aug 2019 13:20:34 +0100 +Subject: [PATCH] mac80211: minstrel_ht: fix infinite loop because supported is + not being shifted + +Currently the for-loop will spin forever if variable supported is +non-zero because supported is never changed. Fix this by adding in +the missing right shift of supported. + +Addresses-Coverity: ("Infinite loop") +Fixes: 48cb39522a9d ("mac80211: minstrel_ht: improve rate probing for devices with static fallback") +Signed-off-by: Colin Ian King +--- + +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -601,7 +601,7 @@ minstrel_ht_rate_sample_switch(struct mi + u16 supported = mi->supported[g_idx]; + + supported >>= mi->max_tp_rate[0] % MCS_GROUP_RATES; +- for (i = 0; supported; i++) { ++ for (i = 0; supported; supported >>= 1, i++) { + if (!(supported & 1)) + continue; + diff --git a/package/kernel/mac80211/patches/subsys/320-mac80211-Add-TXQ-scheduling-API.patch b/package/kernel/mac80211/patches/subsys/320-mac80211-Add-TXQ-scheduling-API.patch new file mode 100644 index 00000000000000..4566e99319548a --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/320-mac80211-Add-TXQ-scheduling-API.patch @@ -0,0 +1,292 @@ +From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= +Date: Tue, 18 Dec 2018 17:02:06 -0800 +Subject: [PATCH] mac80211: Add TXQ scheduling API +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This adds an API to mac80211 to handle scheduling of TXQs. The interface +between driver and mac80211 for TXQ handling is changed by adding two new +functions: ieee80211_next_txq(), which will return the next TXQ to schedule +in the current round-robin rotation, and ieee80211_return_txq(), which the +driver uses to indicate that it has finished scheduling a TXQ (which will +then be put back in the scheduling rotation if it isn't empty). + +The driver must call ieee80211_txq_schedule_start() at the start of each +scheduling session, and ieee80211_txq_schedule_end() at the end. The API +then guarantees that the same TXQ is not returned twice in the same +session (so a driver can loop on ieee80211_next_txq() without worrying +about breaking the loop. + +Usage of the new API is optional, so drivers can be ported one at a time. +In this patch, the actual scheduling performed by mac80211 is simple +round-robin, but a subsequent commit adds airtime fairness awareness to the +scheduler. + +Signed-off-by: Toke Høiland-Jørgensen +[minor kernel-doc fix, propagate sparse locking checks out] +Signed-off-by: Johannes Berg +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -107,9 +107,15 @@ + * The driver is expected to initialize its private per-queue data for stations + * and interfaces in the .add_interface and .sta_add ops. + * +- * The driver can't access the queue directly. To dequeue a frame, it calls +- * ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a queue, it +- * calls the .wake_tx_queue driver op. ++ * The driver can't access the queue directly. To dequeue a frame from a ++ * txq, it calls ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a ++ * queue, it calls the .wake_tx_queue driver op. ++ * ++ * Drivers can optionally delegate responsibility for scheduling queues to ++ * mac80211, to take advantage of airtime fairness accounting. In this case, to ++ * obtain the next queue to pull frames from, the driver calls ++ * ieee80211_next_txq(). The driver is then expected to return the txq using ++ * ieee80211_return_txq(). + * + * For AP powersave TIM handling, the driver only needs to indicate if it has + * buffered packets in the driver specific data structures by calling +@@ -5979,7 +5985,8 @@ void ieee80211_unreserve_tid(struct ieee + * ieee80211_tx_dequeue - dequeue a packet from a software tx queue + * + * @hw: pointer as obtained from ieee80211_alloc_hw() +- * @txq: pointer obtained from station or virtual interface ++ * @txq: pointer obtained from station or virtual interface, or from ++ * ieee80211_next_txq() + * + * Returns the skb if successful, %NULL if no frame was available. + */ +@@ -5987,6 +5994,54 @@ struct sk_buff *ieee80211_tx_dequeue(str + struct ieee80211_txq *txq); + + /** ++ * ieee80211_next_txq - get next tx queue to pull packets from ++ * ++ * @hw: pointer as obtained from ieee80211_alloc_hw() ++ * @ac: AC number to return packets from. ++ * ++ * Should only be called between calls to ieee80211_txq_schedule_start() ++ * and ieee80211_txq_schedule_end(). ++ * Returns the next txq if successful, %NULL if no queue is eligible. If a txq ++ * is returned, it should be returned with ieee80211_return_txq() after the ++ * driver has finished scheduling it. ++ */ ++struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac); ++ ++/** ++ * ieee80211_return_txq - return a TXQ previously acquired by ieee80211_next_txq() ++ * ++ * @hw: pointer as obtained from ieee80211_alloc_hw() ++ * @txq: pointer obtained from station or virtual interface ++ * ++ * Should only be called between calls to ieee80211_txq_schedule_start() ++ * and ieee80211_txq_schedule_end(). ++ */ ++void ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq); ++ ++/** ++ * ieee80211_txq_schedule_start - acquire locks for safe scheduling of an AC ++ * ++ * @hw: pointer as obtained from ieee80211_alloc_hw() ++ * @ac: AC number to acquire locks for ++ * ++ * Acquire locks needed to schedule TXQs from the given AC. Should be called ++ * before ieee80211_next_txq() or ieee80211_return_txq(). ++ */ ++void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac) ++ __acquires(txq_lock); ++ ++/** ++ * ieee80211_txq_schedule_end - release locks for safe scheduling of an AC ++ * ++ * @hw: pointer as obtained from ieee80211_alloc_hw() ++ * @ac: AC number to acquire locks for ++ * ++ * Release locks previously acquired by ieee80211_txq_schedule_end(). ++ */ ++void ieee80211_txq_schedule_end(struct ieee80211_hw *hw, u8 ac) ++ __releases(txq_lock); ++ ++/** + * ieee80211_txq_get_depth - get pending frame/byte count of given txq + * + * The values are not guaranteed to be coherent with regard to each other, i.e. +--- a/net/mac80211/agg-tx.c ++++ b/net/mac80211/agg-tx.c +@@ -229,7 +229,7 @@ ieee80211_agg_start_txq(struct sta_info + clear_bit(IEEE80211_TXQ_STOP, &txqi->flags); + local_bh_disable(); + rcu_read_lock(); +- drv_wake_tx_queue(sta->sdata->local, txqi); ++ schedule_and_wake_txq(sta->sdata->local, txqi); + rcu_read_unlock(); + local_bh_enable(); + } +--- a/net/mac80211/driver-ops.h ++++ b/net/mac80211/driver-ops.h +@@ -1176,6 +1176,15 @@ static inline void drv_wake_tx_queue(str + local->ops->wake_tx_queue(&local->hw, &txq->txq); + } + ++static inline void schedule_and_wake_txq(struct ieee80211_local *local, ++ struct txq_info *txqi) ++{ ++ spin_lock_bh(&local->active_txq_lock[txqi->txq.ac]); ++ ieee80211_return_txq(&local->hw, &txqi->txq); ++ spin_unlock_bh(&local->active_txq_lock[txqi->txq.ac]); ++ drv_wake_tx_queue(local, txqi); ++} ++ + static inline int drv_start_nan(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata, + struct cfg80211_nan_conf *conf) +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -829,6 +829,8 @@ enum txq_info_flags { + * a fq_flow which is already owned by a different tin + * @def_cvars: codel vars for @def_flow + * @frags: used to keep fragments created after dequeue ++ * @schedule_order: used with ieee80211_local->active_txqs ++ * @schedule_round: counter to prevent infinite loops on TXQ scheduling + */ + struct txq_info { + struct fq_tin tin; +@@ -836,6 +838,8 @@ struct txq_info { + struct codel_vars def_cvars; + struct codel_stats cstats; + struct sk_buff_head frags; ++ struct list_head schedule_order; ++ u16 schedule_round; + unsigned long flags; + + /* keep last! */ +@@ -1127,6 +1131,11 @@ struct ieee80211_local { + struct codel_vars *cvars; + struct codel_params cparams; + ++ /* protects active_txqs and txqi->schedule_order */ ++ spinlock_t active_txq_lock[IEEE80211_NUM_ACS]; ++ struct list_head active_txqs[IEEE80211_NUM_ACS]; ++ u16 schedule_round[IEEE80211_NUM_ACS]; ++ + const struct ieee80211_ops *ops; + + /* +--- a/net/mac80211/main.c ++++ b/net/mac80211/main.c +@@ -652,6 +652,11 @@ struct ieee80211_hw *ieee80211_alloc_hw_ + spin_lock_init(&local->rx_path_lock); + spin_lock_init(&local->queue_stop_reason_lock); + ++ for (i = 0; i < IEEE80211_NUM_ACS; i++) { ++ INIT_LIST_HEAD(&local->active_txqs[i]); ++ spin_lock_init(&local->active_txq_lock[i]); ++ } ++ + INIT_LIST_HEAD(&local->chanctx_list); + mutex_init(&local->chanctx_mtx); + +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -1244,7 +1244,7 @@ void ieee80211_sta_ps_deliver_wakeup(str + if (!txq_has_queue(sta->sta.txq[i])) + continue; + +- drv_wake_tx_queue(local, to_txq_info(sta->sta.txq[i])); ++ schedule_and_wake_txq(local, to_txq_info(sta->sta.txq[i])); + } + } + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -1441,6 +1441,7 @@ void ieee80211_txq_init(struct ieee80211 + codel_vars_init(&txqi->def_cvars); + codel_stats_init(&txqi->cstats); + __skb_queue_head_init(&txqi->frags); ++ INIT_LIST_HEAD(&txqi->schedule_order); + + txqi->txq.vif = &sdata->vif; + +@@ -1464,6 +1465,9 @@ void ieee80211_txq_purge(struct ieee8021 + + fq_tin_reset(fq, tin, fq_skb_free_func); + ieee80211_purge_tx_queue(&local->hw, &txqi->frags); ++ spin_lock_bh(&local->active_txq_lock[txqi->txq.ac]); ++ list_del_init(&txqi->schedule_order); ++ spin_unlock_bh(&local->active_txq_lock[txqi->txq.ac]); + } + + void ieee80211_txq_set_params(struct ieee80211_local *local) +@@ -1580,7 +1584,7 @@ static bool ieee80211_queue_skb(struct i + ieee80211_txq_enqueue(local, txqi, skb); + spin_unlock_bh(&fq->lock); + +- drv_wake_tx_queue(local, txqi); ++ schedule_and_wake_txq(local, txqi); + + return true; + } +@@ -3600,6 +3604,60 @@ out: + } + EXPORT_SYMBOL(ieee80211_tx_dequeue); + ++struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac) ++{ ++ struct ieee80211_local *local = hw_to_local(hw); ++ struct txq_info *txqi = NULL; ++ ++ lockdep_assert_held(&local->active_txq_lock[ac]); ++ ++ txqi = list_first_entry_or_null(&local->active_txqs[ac], ++ struct txq_info, ++ schedule_order); ++ ++ if (!txqi || txqi->schedule_round == local->schedule_round[ac]) ++ return NULL; ++ ++ list_del_init(&txqi->schedule_order); ++ txqi->schedule_round = local->schedule_round[ac]; ++ return &txqi->txq; ++} ++EXPORT_SYMBOL(ieee80211_next_txq); ++ ++void ieee80211_return_txq(struct ieee80211_hw *hw, ++ struct ieee80211_txq *txq) ++{ ++ struct ieee80211_local *local = hw_to_local(hw); ++ struct txq_info *txqi = to_txq_info(txq); ++ ++ lockdep_assert_held(&local->active_txq_lock[txq->ac]); ++ ++ if (list_empty(&txqi->schedule_order) && ++ (!skb_queue_empty(&txqi->frags) || txqi->tin.backlog_packets)) ++ list_add_tail(&txqi->schedule_order, ++ &local->active_txqs[txq->ac]); ++} ++EXPORT_SYMBOL(ieee80211_return_txq); ++ ++void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac) ++ __acquires(txq_lock) ++{ ++ struct ieee80211_local *local = hw_to_local(hw); ++ ++ spin_lock_bh(&local->active_txq_lock[ac]); ++ local->schedule_round[ac]++; ++} ++EXPORT_SYMBOL(ieee80211_txq_schedule_start); ++ ++void ieee80211_txq_schedule_end(struct ieee80211_hw *hw, u8 ac) ++ __releases(txq_lock) ++{ ++ struct ieee80211_local *local = hw_to_local(hw); ++ ++ spin_unlock_bh(&local->active_txq_lock[ac]); ++} ++EXPORT_SYMBOL(ieee80211_txq_schedule_end); ++ + void __ieee80211_subif_start_xmit(struct sk_buff *skb, + struct net_device *dev, + u32 info_flags) diff --git a/package/kernel/mac80211/patches/subsys/321-cfg80211-Add-airtime-statistics-and-settings.patch b/package/kernel/mac80211/patches/subsys/321-cfg80211-Add-airtime-statistics-and-settings.patch new file mode 100644 index 00000000000000..9dac46842dd2e6 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/321-cfg80211-Add-airtime-statistics-and-settings.patch @@ -0,0 +1,202 @@ +From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= +Date: Tue, 18 Dec 2018 17:02:07 -0800 +Subject: [PATCH] cfg80211: Add airtime statistics and settings +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This adds TX airtime statistics to the cfg80211 station dump (to go along +with the RX info already present), and adds a new parameter to set the +airtime weight of each station. The latter allows userspace to implement +policies for different stations by varying their weights. + +Signed-off-by: Toke Høiland-Jørgensen +[rmanohar@codeaurora.org: fixed checkpatch warnings] +Signed-off-by: Rajkumar Manoharan +[move airtime weight != 0 check into policy] +Signed-off-by: Johannes Berg +--- + +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -988,6 +988,7 @@ enum station_parameters_apply_mask { + * @support_p2p_ps: information if station supports P2P PS mechanism + * @he_capa: HE capabilities of station + * @he_capa_len: the length of the HE capabilities ++ * @airtime_weight: airtime scheduler weight for this station + */ + struct station_parameters { + const u8 *supported_rates; +@@ -1017,6 +1018,7 @@ struct station_parameters { + int support_p2p_ps; + const struct ieee80211_he_cap_elem *he_capa; + u8 he_capa_len; ++ u16 airtime_weight; + }; + + /** +@@ -1284,6 +1286,8 @@ struct cfg80211_tid_stats { + * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received + * from this peer + * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer ++ * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer ++ * @airtime_weight: current airtime scheduling weight + * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last + * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs. + * Note that this doesn't use the @filled bit, but is used if non-NULL. +@@ -1330,12 +1334,15 @@ struct station_info { + + u32 expected_throughput; + +- u64 rx_beacon; ++ u64 tx_duration; + u64 rx_duration; ++ u64 rx_beacon; + u8 rx_beacon_signal_avg; + struct cfg80211_tid_stats *pertid; + s8 ack_signal; + s8 avg_ack_signal; ++ ++ u16 airtime_weight; + }; + + #if IS_ENABLED(CPTCFG_CFG80211) +@@ -2361,6 +2368,8 @@ enum wiphy_params_flags { + WIPHY_PARAM_TXQ_QUANTUM = 1 << 8, + }; + ++#define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256 ++ + /** + * struct cfg80211_pmksa - PMK Security Association + * +--- a/include/uapi/linux/nl80211.h ++++ b/include/uapi/linux/nl80211.h +@@ -2241,6 +2241,9 @@ enum nl80211_commands { + * association request when used with NL80211_CMD_NEW_STATION). Can be set + * only if %NL80211_STA_FLAG_WME is set. + * ++ * @NL80211_ATTR_AIRTIME_WEIGHT: Station's weight when scheduled by the airtime ++ * scheduler. ++ * + * @NUM_NL80211_ATTR: total number of nl80211_attrs available + * @NL80211_ATTR_MAX: highest attribute number currently defined + * @__NL80211_ATTR_AFTER_LAST: internal use +@@ -2682,6 +2685,14 @@ enum nl80211_attrs { + + NL80211_ATTR_HE_CAPABILITY, + ++ /* not backported yet */ ++ NL80211_ATTR_FTM_RESPONDER, ++ NL80211_ATTR_FTM_RESPONDER_STATS, ++ NL80211_ATTR_TIMEOUT, ++ NL80211_ATTR_PEER_MEASUREMENTS, ++ ++ NL80211_ATTR_AIRTIME_WEIGHT, ++ + /* add attributes here, update the policy in nl80211.c */ + + __NL80211_ATTR_AFTER_LAST, +@@ -3052,6 +3063,9 @@ enum nl80211_sta_bss_param { + * @NL80211_STA_INFO_ACK_SIGNAL: signal strength of the last ACK frame(u8, dBm) + * @NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG: avg signal strength of (data) + * ACK frame (s8, dBm) ++ * @NL80211_STA_INFO_TX_DURATION: aggregate PPDU duration for all frames ++ * sent to the station (u64, usec) ++ * @NL80211_STA_INFO_AIRTIME_WEIGHT: current airtime weight for station (u16) + * @__NL80211_STA_INFO_AFTER_LAST: internal + * @NL80211_STA_INFO_MAX: highest possible station info attribute + */ +@@ -3093,6 +3107,14 @@ enum nl80211_sta_info { + NL80211_STA_INFO_ACK_SIGNAL, + NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG, + ++ /* not backported yet */ ++ NL80211_STA_INFO_RX_MPDUS, ++ NL80211_STA_INFO_FCS_ERROR_COUNT, ++ NL80211_STA_INFO_CONNECTED_TO_GATE, ++ ++ NL80211_STA_INFO_TX_DURATION, ++ NL80211_STA_INFO_AIRTIME_WEIGHT, ++ + /* keep last */ + __NL80211_STA_INFO_AFTER_LAST, + NL80211_STA_INFO_MAX = __NL80211_STA_INFO_AFTER_LAST - 1 +@@ -5224,6 +5246,10 @@ enum nl80211_feature_flags { + * except for supported rates from the probe request content if requested + * by the %NL80211_SCAN_FLAG_MIN_PREQ_CONTENT flag. + * ++ * @NL80211_EXT_FEATURE_AIRTIME_FAIRNESS: Driver supports getting airtime ++ * fairness for transmitted packets and has enabled airtime fairness ++ * scheduling. ++ * + * @NUM_NL80211_EXT_FEATURES: number of extended features. + * @MAX_NL80211_EXT_FEATURES: highest extended feature index. + */ +@@ -5260,6 +5286,12 @@ enum nl80211_ext_feature_index { + NL80211_EXT_FEATURE_SCAN_RANDOM_SN, + NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT, + ++ /* --- not backported yet --- */ ++ NL80211_EXT_FEATURE_CAN_REPLACE_PTK0, ++ NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER, ++ ++ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS, ++ + /* add new features before the definition below */ + NUM_NL80211_EXT_FEATURES, + MAX_NL80211_EXT_FEATURES = NUM_NL80211_EXT_FEATURES - 1 +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -463,6 +463,7 @@ static const struct nla_policy nl80211_p + [NL80211_ATTR_TXQ_QUANTUM] = { .type = NLA_U32 }, + [NL80211_ATTR_HE_CAPABILITY] = { .type = NLA_BINARY, + .len = NL80211_HE_MAX_CAPABILITY_LEN }, ++ [NL80211_ATTR_AIRTIME_WEIGHT] = NLA_POLICY_MIN(NLA_U16, 1), + }; + + /* policy for the key attributes */ +@@ -4703,6 +4704,11 @@ static int nl80211_send_station(struct s + PUT_SINFO(PLID, plid, u16); + PUT_SINFO(PLINK_STATE, plink_state, u8); + PUT_SINFO_U64(RX_DURATION, rx_duration); ++ PUT_SINFO_U64(TX_DURATION, tx_duration); ++ ++ if (wiphy_ext_feature_isset(&rdev->wiphy, ++ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) ++ PUT_SINFO(AIRTIME_WEIGHT, airtime_weight, u16); + + switch (rdev->wiphy.signal_type) { + case CFG80211_SIGNAL_TYPE_MBM: +@@ -5339,6 +5345,15 @@ static int nl80211_set_station(struct sk + nla_get_u8(info->attrs[NL80211_ATTR_OPMODE_NOTIF]); + } + ++ if (info->attrs[NL80211_ATTR_AIRTIME_WEIGHT]) ++ params.airtime_weight = ++ nla_get_u16(info->attrs[NL80211_ATTR_AIRTIME_WEIGHT]); ++ ++ if (params.airtime_weight && ++ !wiphy_ext_feature_isset(&rdev->wiphy, ++ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) ++ return -EOPNOTSUPP; ++ + /* Include parameters for TDLS peer (will check later) */ + err = nl80211_set_station_tdls(info, ¶ms); + if (err) +@@ -5477,6 +5492,15 @@ static int nl80211_new_station(struct sk + return -EINVAL; + } + ++ if (info->attrs[NL80211_ATTR_AIRTIME_WEIGHT]) ++ params.airtime_weight = ++ nla_get_u16(info->attrs[NL80211_ATTR_AIRTIME_WEIGHT]); ++ ++ if (params.airtime_weight && ++ !wiphy_ext_feature_isset(&rdev->wiphy, ++ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) ++ return -EOPNOTSUPP; ++ + err = nl80211_parse_sta_channel_info(info, ¶ms); + if (err) + return err; diff --git a/package/kernel/mac80211/patches/subsys/322-mac80211-Add-airtime-accounting-and-scheduling-to-TX.patch b/package/kernel/mac80211/patches/subsys/322-mac80211-Add-airtime-accounting-and-scheduling-to-TX.patch new file mode 100644 index 00000000000000..955ae2a337656e --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/322-mac80211-Add-airtime-accounting-and-scheduling-to-TX.patch @@ -0,0 +1,522 @@ +From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= +Date: Tue, 18 Dec 2018 17:02:08 -0800 +Subject: [PATCH] mac80211: Add airtime accounting and scheduling to TXQs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This adds airtime accounting and scheduling to the mac80211 TXQ +scheduler. A new callback, ieee80211_sta_register_airtime(), is added +that drivers can call to report airtime usage for stations. + +When airtime information is present, mac80211 will schedule TXQs +(through ieee80211_next_txq()) in a way that enforces airtime fairness +between active stations. This scheduling works the same way as the ath9k +in-driver airtime fairness scheduling. If no airtime usage is reported +by the driver, the scheduler will default to round-robin scheduling. + +For drivers that don't control TXQ scheduling in software, a new API +function, ieee80211_txq_may_transmit(), is added which the driver can use +to check if the TXQ is eligible for transmission, or should be throttled to +enforce fairness. Calls to this function must also be enclosed in +ieee80211_txq_schedule_{start,end}() calls to ensure proper locking. + +The API ieee80211_txq_may_transmit() also ensures that TXQ list will be +aligned aginst driver's own round-robin scheduler list. i.e it rotates +the TXQ list till it makes the requested node becomes the first entry +in TXQ list. Thus both the TXQ list and driver's list are in sync. + +Co-developed-by: Rajkumar Manoharan +Signed-off-by: Louie Lu +[added debugfs write op to reset airtime counter] +Signed-off-by: Toke Høiland-Jørgensen +Signed-off-by: Rajkumar Manoharan +Signed-off-by: Johannes Berg +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -2304,6 +2304,9 @@ enum ieee80211_hw_flags { + * supported by HW. + * @max_nan_de_entries: maximum number of NAN DE functions supported by the + * device. ++ * ++ * @weight_multipler: Driver specific airtime weight multiplier used while ++ * refilling deficit of each TXQ. + */ + struct ieee80211_hw { + struct ieee80211_conf conf; +@@ -2339,6 +2342,7 @@ struct ieee80211_hw { + u8 n_cipher_schemes; + const struct ieee80211_cipher_scheme *cipher_schemes; + u8 max_nan_de_entries; ++ u8 weight_multiplier; + }; + + static inline bool _ieee80211_hw_check(struct ieee80211_hw *hw, +@@ -5299,6 +5303,34 @@ void ieee80211_sta_eosp(struct ieee80211 + void ieee80211_send_eosp_nullfunc(struct ieee80211_sta *pubsta, int tid); + + /** ++ * ieee80211_sta_register_airtime - register airtime usage for a sta/tid ++ * ++ * Register airtime usage for a given sta on a given tid. The driver can call ++ * this function to notify mac80211 that a station used a certain amount of ++ * airtime. This information will be used by the TXQ scheduler to schedule ++ * stations in a way that ensures airtime fairness. ++ * ++ * The reported airtime should as a minimum include all time that is spent ++ * transmitting to the remote station, including overhead and padding, but not ++ * including time spent waiting for a TXOP. If the time is not reported by the ++ * hardware it can in some cases be calculated from the rate and known frame ++ * composition. When possible, the time should include any failed transmission ++ * attempts. ++ * ++ * The driver can either call this function synchronously for every packet or ++ * aggregate, or asynchronously as airtime usage information becomes available. ++ * TX and RX airtime can be reported together, or separately by setting one of ++ * them to 0. ++ * ++ * @pubsta: the station ++ * @tid: the TID to register airtime for ++ * @tx_airtime: airtime used during TX (in usec) ++ * @rx_airtime: airtime used during RX (in usec) ++ */ ++void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid, ++ u32 tx_airtime, u32 rx_airtime); ++ ++/** + * ieee80211_iter_keys - iterate keys programmed into the device + * @hw: pointer obtained from ieee80211_alloc_hw() + * @vif: virtual interface to iterate, may be %NULL for all +@@ -6042,6 +6074,33 @@ void ieee80211_txq_schedule_end(struct i + __releases(txq_lock); + + /** ++ * ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit ++ * ++ * This function is used to check whether given txq is allowed to transmit by ++ * the airtime scheduler, and can be used by drivers to access the airtime ++ * fairness accounting without going using the scheduling order enfored by ++ * next_txq(). ++ * ++ * Returns %true if the airtime scheduler thinks the TXQ should be allowed to ++ * transmit, and %false if it should be throttled. This function can also have ++ * the side effect of rotating the TXQ in the scheduler rotation, which will ++ * eventually bring the deficit to positive and allow the station to transmit ++ * again. ++ * ++ * The API ieee80211_txq_may_transmit() also ensures that TXQ list will be ++ * aligned aginst driver's own round-robin scheduler list. i.e it rotates ++ * the TXQ list till it makes the requested node becomes the first entry ++ * in TXQ list. Thus both the TXQ list and driver's list are in sync. If this ++ * function returns %true, the driver is expected to schedule packets ++ * for transmission, and then return the TXQ through ieee80211_return_txq(). ++ * ++ * @hw: pointer as obtained from ieee80211_alloc_hw() ++ * @txq: pointer obtained from station or virtual interface ++ */ ++bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, ++ struct ieee80211_txq *txq); ++ ++/** + * ieee80211_txq_get_depth - get pending frame/byte count of given txq + * + * The values are not guaranteed to be coherent with regard to each other, i.e. +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -1390,6 +1390,9 @@ static int sta_apply_parameters(struct i + if (ieee80211_vif_is_mesh(&sdata->vif)) + sta_apply_mesh_params(local, sta, params); + ++ if (params->airtime_weight) ++ sta->airtime_weight = params->airtime_weight; ++ + /* set the STA state after all sta info from usermode has been set */ + if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) || + set & BIT(NL80211_STA_FLAG_ASSOCIATED)) { +--- a/net/mac80211/debugfs.c ++++ b/net/mac80211/debugfs.c +@@ -380,6 +380,9 @@ void debugfs_hw_add(struct ieee80211_loc + if (local->ops->wake_tx_queue) + DEBUGFS_ADD_MODE(aqm, 0600); + ++ debugfs_create_u16("airtime_flags", 0600, ++ phyd, &local->airtime_flags); ++ + statsd = debugfs_create_dir("statistics", phyd); + + /* if the dir failed, don't put all the other things into the root! */ +--- a/net/mac80211/debugfs_sta.c ++++ b/net/mac80211/debugfs_sta.c +@@ -178,9 +178,9 @@ static ssize_t sta_aqm_read(struct file + txqi->tin.tx_bytes, + txqi->tin.tx_packets, + txqi->flags, +- txqi->flags & (1<flags & (1<flags & (1<flags) ? "STOP" : "RUN", ++ test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags) ? " AMPDU" : "", ++ test_bit(IEEE80211_TXQ_NO_AMSDU, &txqi->flags) ? " NO-AMSDU" : ""); + } + + rcu_read_unlock(); +@@ -192,6 +192,64 @@ static ssize_t sta_aqm_read(struct file + } + STA_OPS(aqm); + ++static ssize_t sta_airtime_read(struct file *file, char __user *userbuf, ++ size_t count, loff_t *ppos) ++{ ++ struct sta_info *sta = file->private_data; ++ struct ieee80211_local *local = sta->sdata->local; ++ size_t bufsz = 200; ++ char *buf = kzalloc(bufsz, GFP_KERNEL), *p = buf; ++ u64 rx_airtime = 0, tx_airtime = 0; ++ s64 deficit[IEEE80211_NUM_ACS]; ++ ssize_t rv; ++ int ac; ++ ++ if (!buf) ++ return -ENOMEM; ++ ++ for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { ++ spin_lock_bh(&local->active_txq_lock[ac]); ++ rx_airtime += sta->airtime[ac].rx_airtime; ++ tx_airtime += sta->airtime[ac].tx_airtime; ++ deficit[ac] = sta->airtime[ac].deficit; ++ spin_unlock_bh(&local->active_txq_lock[ac]); ++ } ++ ++ p += scnprintf(p, bufsz + buf - p, ++ "RX: %llu us\nTX: %llu us\nWeight: %u\n" ++ "Deficit: VO: %lld us VI: %lld us BE: %lld us BK: %lld us\n", ++ rx_airtime, ++ tx_airtime, ++ sta->airtime_weight, ++ deficit[0], ++ deficit[1], ++ deficit[2], ++ deficit[3]); ++ ++ rv = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); ++ kfree(buf); ++ return rv; ++} ++ ++static ssize_t sta_airtime_write(struct file *file, const char __user *userbuf, ++ size_t count, loff_t *ppos) ++{ ++ struct sta_info *sta = file->private_data; ++ struct ieee80211_local *local = sta->sdata->local; ++ int ac; ++ ++ for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { ++ spin_lock_bh(&local->active_txq_lock[ac]); ++ sta->airtime[ac].rx_airtime = 0; ++ sta->airtime[ac].tx_airtime = 0; ++ sta->airtime[ac].deficit = sta->airtime_weight; ++ spin_unlock_bh(&local->active_txq_lock[ac]); ++ } ++ ++ return count; ++} ++STA_OPS_RW(airtime); ++ + static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf, + size_t count, loff_t *ppos) + { +@@ -546,6 +604,10 @@ void ieee80211_sta_debugfs_add(struct st + if (local->ops->wake_tx_queue) + DEBUGFS_ADD(aqm); + ++ if (wiphy_ext_feature_isset(local->hw.wiphy, ++ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) ++ DEBUGFS_ADD(airtime); ++ + if (sizeof(sta->driver_buffered_tids) == sizeof(u32)) + debugfs_create_x32("driver_buffered_tids", 0400, + sta->debugfs_dir, +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -1136,6 +1136,8 @@ struct ieee80211_local { + struct list_head active_txqs[IEEE80211_NUM_ACS]; + u16 schedule_round[IEEE80211_NUM_ACS]; + ++ u16 airtime_flags; ++ + const struct ieee80211_ops *ops; + + /* +--- a/net/mac80211/main.c ++++ b/net/mac80211/main.c +@@ -656,6 +656,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ + INIT_LIST_HEAD(&local->active_txqs[i]); + spin_lock_init(&local->active_txq_lock[i]); + } ++ local->airtime_flags = AIRTIME_USE_TX | AIRTIME_USE_RX; + + INIT_LIST_HEAD(&local->chanctx_list); + mutex_init(&local->chanctx_mtx); +@@ -1142,6 +1143,9 @@ int ieee80211_register_hw(struct ieee802 + if (!local->hw.max_nan_de_entries) + local->hw.max_nan_de_entries = IEEE80211_MAX_NAN_INSTANCE_ID; + ++ if (!local->hw.weight_multiplier) ++ local->hw.weight_multiplier = 1; ++ + result = ieee80211_wep_init(local); + if (result < 0) + wiphy_debug(local->hw.wiphy, "Failed to initialize wep: %d\n", +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -90,7 +90,6 @@ static void __cleanup_single_sta(struct + struct tid_ampdu_tx *tid_tx; + struct ieee80211_sub_if_data *sdata = sta->sdata; + struct ieee80211_local *local = sdata->local; +- struct fq *fq = &local->fq; + struct ps_data *ps; + + if (test_sta_flag(sta, WLAN_STA_PS_STA) || +@@ -115,9 +114,7 @@ static void __cleanup_single_sta(struct + for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { + struct txq_info *txqi = to_txq_info(sta->sta.txq[i]); + +- spin_lock_bh(&fq->lock); + ieee80211_txq_purge(local, txqi); +- spin_unlock_bh(&fq->lock); + } + } + +@@ -381,9 +378,12 @@ struct sta_info *sta_info_alloc(struct i + if (sta_prepare_rate_control(local, sta, gfp)) + goto free_txq; + ++ sta->airtime_weight = IEEE80211_DEFAULT_AIRTIME_WEIGHT; ++ + for (i = 0; i < IEEE80211_NUM_ACS; i++) { + skb_queue_head_init(&sta->ps_tx_buf[i]); + skb_queue_head_init(&sta->tx_filtered[i]); ++ sta->airtime[i].deficit = sta->airtime_weight; + } + + for (i = 0; i < IEEE80211_NUM_TIDS; i++) +@@ -1821,6 +1821,27 @@ void ieee80211_sta_set_buffered(struct i + } + EXPORT_SYMBOL(ieee80211_sta_set_buffered); + ++void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid, ++ u32 tx_airtime, u32 rx_airtime) ++{ ++ struct sta_info *sta = container_of(pubsta, struct sta_info, sta); ++ struct ieee80211_local *local = sta->sdata->local; ++ u8 ac = ieee80211_ac_from_tid(tid); ++ u32 airtime = 0; ++ ++ if (sta->local->airtime_flags & AIRTIME_USE_TX) ++ airtime += tx_airtime; ++ if (sta->local->airtime_flags & AIRTIME_USE_RX) ++ airtime += rx_airtime; ++ ++ spin_lock_bh(&local->active_txq_lock[ac]); ++ sta->airtime[ac].tx_airtime += tx_airtime; ++ sta->airtime[ac].rx_airtime += rx_airtime; ++ sta->airtime[ac].deficit -= airtime; ++ spin_unlock_bh(&local->active_txq_lock[ac]); ++} ++EXPORT_SYMBOL(ieee80211_sta_register_airtime); ++ + int sta_info_move_state(struct sta_info *sta, + enum ieee80211_sta_state new_state) + { +@@ -2187,6 +2208,23 @@ void sta_set_sinfo(struct sta_info *sta, + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED); + } + ++ if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_RX_DURATION))) { ++ for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) ++ sinfo->rx_duration += sta->airtime[ac].rx_airtime; ++ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_DURATION); ++ } ++ ++ if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_TX_DURATION))) { ++ for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) ++ sinfo->tx_duration += sta->airtime[ac].tx_airtime; ++ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_DURATION); ++ } ++ ++ if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_AIRTIME_WEIGHT))) { ++ sinfo->airtime_weight = sta->airtime_weight; ++ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_AIRTIME_WEIGHT); ++ } ++ + sinfo->rx_dropped_misc = sta->rx_stats.dropped; + if (sta->pcpu_rx_stats) { + for_each_possible_cpu(cpu) { +--- a/net/mac80211/sta_info.h ++++ b/net/mac80211/sta_info.h +@@ -127,6 +127,16 @@ enum ieee80211_agg_stop_reason { + AGG_STOP_DESTROY_STA, + }; + ++/* Debugfs flags to enable/disable use of RX/TX airtime in scheduler */ ++#define AIRTIME_USE_TX BIT(0) ++#define AIRTIME_USE_RX BIT(1) ++ ++struct airtime_info { ++ u64 rx_airtime; ++ u64 tx_airtime; ++ s64 deficit; ++}; ++ + struct sta_info; + + /** +@@ -563,6 +573,9 @@ struct sta_info { + } tx_stats; + u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1]; + ++ struct airtime_info airtime[IEEE80211_NUM_ACS]; ++ u16 airtime_weight; ++ + /* + * Aggregation information, locked with lock. + */ +--- a/net/mac80211/status.c ++++ b/net/mac80211/status.c +@@ -825,6 +825,12 @@ static void __ieee80211_tx_status(struct + ieee80211_sta_tx_notify(sta->sdata, (void *) skb->data, + acked, info->status.tx_time); + ++ if (info->status.tx_time && ++ wiphy_ext_feature_isset(local->hw.wiphy, ++ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) ++ ieee80211_sta_register_airtime(&sta->sta, tid, ++ info->status.tx_time, 0); ++ + if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { + if (info->flags & IEEE80211_TX_STAT_ACK) { + if (sta->status_stats.lost_packets) +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -1463,8 +1463,11 @@ void ieee80211_txq_purge(struct ieee8021 + struct fq *fq = &local->fq; + struct fq_tin *tin = &txqi->tin; + ++ spin_lock_bh(&fq->lock); + fq_tin_reset(fq, tin, fq_skb_free_func); + ieee80211_purge_tx_queue(&local->hw, &txqi->frags); ++ spin_unlock_bh(&fq->lock); ++ + spin_lock_bh(&local->active_txq_lock[txqi->txq.ac]); + list_del_init(&txqi->schedule_order); + spin_unlock_bh(&local->active_txq_lock[txqi->txq.ac]); +@@ -3611,11 +3614,28 @@ struct ieee80211_txq *ieee80211_next_txq + + lockdep_assert_held(&local->active_txq_lock[ac]); + ++ begin: + txqi = list_first_entry_or_null(&local->active_txqs[ac], + struct txq_info, + schedule_order); ++ if (!txqi) ++ return NULL; ++ ++ if (txqi->txq.sta) { ++ struct sta_info *sta = container_of(txqi->txq.sta, ++ struct sta_info, sta); ++ ++ if (sta->airtime[txqi->txq.ac].deficit < 0) { ++ sta->airtime[txqi->txq.ac].deficit += ++ sta->airtime_weight; ++ list_move_tail(&txqi->schedule_order, ++ &local->active_txqs[txqi->txq.ac]); ++ goto begin; ++ } ++ } ++ + +- if (!txqi || txqi->schedule_round == local->schedule_round[ac]) ++ if (txqi->schedule_round == local->schedule_round[ac]) + return NULL; + + list_del_init(&txqi->schedule_order); +@@ -3633,12 +3653,74 @@ void ieee80211_return_txq(struct ieee802 + lockdep_assert_held(&local->active_txq_lock[txq->ac]); + + if (list_empty(&txqi->schedule_order) && +- (!skb_queue_empty(&txqi->frags) || txqi->tin.backlog_packets)) +- list_add_tail(&txqi->schedule_order, +- &local->active_txqs[txq->ac]); ++ (!skb_queue_empty(&txqi->frags) || txqi->tin.backlog_packets)) { ++ /* If airtime accounting is active, always enqueue STAs at the ++ * head of the list to ensure that they only get moved to the ++ * back by the airtime DRR scheduler once they have a negative ++ * deficit. A station that already has a negative deficit will ++ * get immediately moved to the back of the list on the next ++ * call to ieee80211_next_txq(). ++ */ ++ if (txqi->txq.sta && ++ wiphy_ext_feature_isset(local->hw.wiphy, ++ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) ++ list_add(&txqi->schedule_order, ++ &local->active_txqs[txq->ac]); ++ else ++ list_add_tail(&txqi->schedule_order, ++ &local->active_txqs[txq->ac]); ++ } + } + EXPORT_SYMBOL(ieee80211_return_txq); + ++bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, ++ struct ieee80211_txq *txq) ++{ ++ struct ieee80211_local *local = hw_to_local(hw); ++ struct txq_info *iter, *tmp, *txqi = to_txq_info(txq); ++ struct sta_info *sta; ++ u8 ac = txq->ac; ++ ++ lockdep_assert_held(&local->active_txq_lock[ac]); ++ ++ if (!txqi->txq.sta) ++ goto out; ++ ++ if (list_empty(&txqi->schedule_order)) ++ goto out; ++ ++ list_for_each_entry_safe(iter, tmp, &local->active_txqs[ac], ++ schedule_order) { ++ if (iter == txqi) ++ break; ++ ++ if (!iter->txq.sta) { ++ list_move_tail(&iter->schedule_order, ++ &local->active_txqs[ac]); ++ continue; ++ } ++ sta = container_of(iter->txq.sta, struct sta_info, sta); ++ if (sta->airtime[ac].deficit < 0) ++ sta->airtime[ac].deficit += sta->airtime_weight; ++ list_move_tail(&iter->schedule_order, &local->active_txqs[ac]); ++ } ++ ++ sta = container_of(txqi->txq.sta, struct sta_info, sta); ++ if (sta->airtime[ac].deficit >= 0) ++ goto out; ++ ++ sta->airtime[ac].deficit += sta->airtime_weight; ++ list_move_tail(&txqi->schedule_order, &local->active_txqs[ac]); ++ ++ return false; ++out: ++ if (!list_empty(&txqi->schedule_order)) ++ list_del_init(&txqi->schedule_order); ++ ++ return true; ++} ++EXPORT_SYMBOL(ieee80211_txq_may_transmit); ++ + void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac) + __acquires(txq_lock) + { diff --git a/package/kernel/mac80211/patches/subsys/323-mac80211-Expose-ieee80211_schedule_txq-function.patch b/package/kernel/mac80211/patches/subsys/323-mac80211-Expose-ieee80211_schedule_txq-function.patch new file mode 100644 index 00000000000000..b5b06cdde95fae --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/323-mac80211-Expose-ieee80211_schedule_txq-function.patch @@ -0,0 +1,73 @@ +From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= +Date: Tue, 22 Jan 2019 15:20:16 +0100 +Subject: [PATCH] mac80211: Expose ieee80211_schedule_txq() function +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Since we reworked ieee80211_return_txq() so it assumes that the caller +takes care of logging, we need another function that can be called without +holding any locks. Introduce ieee80211_schedule_txq() which serves this +purpose. + +Signed-off-by: Toke Høiland-Jørgensen +Signed-off-by: Johannes Berg +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -6074,6 +6074,19 @@ void ieee80211_txq_schedule_end(struct i + __releases(txq_lock); + + /** ++ * ieee80211_schedule_txq - schedule a TXQ for transmission ++ * ++ * @hw: pointer as obtained from ieee80211_alloc_hw() ++ * @txq: pointer obtained from station or virtual interface ++ * ++ * Schedules a TXQ for transmission if it is not already scheduled. Takes a ++ * lock, which means it must *not* be called between ++ * ieee80211_txq_schedule_start() and ieee80211_txq_schedule_end() ++ */ ++void ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq) ++ __acquires(txq_lock) __releases(txq_lock); ++ ++/** + * ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit + * + * This function is used to check whether given txq is allowed to transmit by +--- a/net/mac80211/driver-ops.h ++++ b/net/mac80211/driver-ops.h +@@ -1179,9 +1179,7 @@ static inline void drv_wake_tx_queue(str + static inline void schedule_and_wake_txq(struct ieee80211_local *local, + struct txq_info *txqi) + { +- spin_lock_bh(&local->active_txq_lock[txqi->txq.ac]); +- ieee80211_return_txq(&local->hw, &txqi->txq); +- spin_unlock_bh(&local->active_txq_lock[txqi->txq.ac]); ++ ieee80211_schedule_txq(&local->hw, &txqi->txq); + drv_wake_tx_queue(local, txqi); + } + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3673,6 +3673,19 @@ void ieee80211_return_txq(struct ieee802 + } + EXPORT_SYMBOL(ieee80211_return_txq); + ++void ieee80211_schedule_txq(struct ieee80211_hw *hw, ++ struct ieee80211_txq *txq) ++ __acquires(txq_lock) __releases(txq_lock) ++{ ++ struct ieee80211_local *local = hw_to_local(hw); ++ struct txq_info *txqi = to_txq_info(txq); ++ ++ spin_lock_bh(&local->active_txq_lock[txq->ac]); ++ ieee80211_return_txq(hw, txq); ++ spin_unlock_bh(&local->active_txq_lock[txq->ac]); ++} ++EXPORT_SYMBOL(ieee80211_schedule_txq); ++ + bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, + struct ieee80211_txq *txq) + { diff --git a/package/kernel/mac80211/patches/subsys/350-mac80211-add-hdrlen-to-ieee80211_tx_data.patch b/package/kernel/mac80211/patches/subsys/350-mac80211-add-hdrlen-to-ieee80211_tx_data.patch new file mode 100644 index 00000000000000..7b2a4a1c09f531 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/350-mac80211-add-hdrlen-to-ieee80211_tx_data.patch @@ -0,0 +1,228 @@ +From: Janusz Dziedzic +Date: Fri, 19 Feb 2016 11:01:49 +0100 +Subject: [PATCH] mac80211: add hdrlen to ieee80211_tx_data + +This is preparation for adding support for inserting padding between the +802.11 header and LLC data + +Signed-off-by: Janusz Dziedzic +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -179,6 +179,7 @@ struct ieee80211_tx_data { + struct ieee80211_tx_rate rate; + + unsigned int flags; ++ unsigned int hdrlen; + }; + + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -925,7 +925,7 @@ ieee80211_tx_h_fragment(struct ieee80211 + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + struct ieee80211_hdr *hdr = (void *)skb->data; + int frag_threshold = tx->local->hw.wiphy->frag_threshold; +- int hdrlen; ++ int hdrlen = tx->hdrlen; + int fragnum; + + /* no matter what happens, tx->skb moves to tx->skbs */ +@@ -946,8 +946,6 @@ ieee80211_tx_h_fragment(struct ieee80211 + if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU)) + return TX_DROP; + +- hdrlen = ieee80211_hdrlen(hdr->frame_control); +- + /* internal error, why isn't DONTFRAG set? */ + if (WARN_ON(skb->len + FCS_LEN <= frag_threshold)) + return TX_DROP; +@@ -1178,6 +1176,8 @@ ieee80211_tx_prepare(struct ieee80211_su + + hdr = (struct ieee80211_hdr *) skb->data; + ++ tx->hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ + if (likely(sta)) { + if (!IS_ERR(sta)) + tx->sta = sta; +@@ -3523,6 +3523,7 @@ begin: + tx.local = local; + tx.skb = skb; + tx.sdata = vif_to_sdata(info->control.vif); ++ tx.hdrlen = ieee80211_hdrlen(hdr->frame_control); + + if (txq->sta) + tx.sta = container_of(txq->sta, struct sta_info, sta); +@@ -3549,7 +3550,7 @@ begin: + + if (tx.key && + (tx.key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) +- pn_offs = ieee80211_hdrlen(hdr->frame_control); ++ pn_offs = tx.hdrlen; + + ieee80211_xmit_fast_finish(sta->sdata, sta, pn_offs, + tx.key, skb); +@@ -4006,6 +4007,7 @@ ieee80211_build_data_template(struct iee + hdr = (void *)skb->data; + tx.sta = sta_info_get(sdata, hdr->addr1); + tx.skb = skb; ++ tx.hdrlen = ieee80211_hdrlen(hdr->frame_control); + + if (ieee80211_tx_h_select_key(&tx) != TX_CONTINUE) { + rcu_read_unlock(); +--- a/net/mac80211/util.c ++++ b/net/mac80211/util.c +@@ -1390,6 +1390,7 @@ void ieee80211_send_auth(struct ieee8021 + struct ieee80211_local *local = sdata->local; + struct sk_buff *skb; + struct ieee80211_mgmt *mgmt; ++ unsigned int hdrlen; + int err; + + /* 24 + 6 = header + auth_algo + auth_transaction + status_code */ +@@ -1413,8 +1414,10 @@ void ieee80211_send_auth(struct ieee8021 + skb_put_data(skb, extra, extra_len); + + if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) { ++ hdrlen = ieee80211_hdrlen(mgmt->frame_control); + mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); +- err = ieee80211_wep_encrypt(local, skb, key, key_len, key_idx); ++ err = ieee80211_wep_encrypt(local, skb, hdrlen, key, ++ key_len, key_idx); + WARN_ON(err); + } + +--- a/net/mac80211/wep.c ++++ b/net/mac80211/wep.c +@@ -89,11 +89,11 @@ static void ieee80211_wep_get_iv(struct + + static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local, + struct sk_buff *skb, ++ unsigned int hdrlen, + int keylen, int keyidx) + { + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); +- unsigned int hdrlen; + u8 *newhdr; + + hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); +@@ -101,7 +101,6 @@ static u8 *ieee80211_wep_add_iv(struct i + if (WARN_ON(skb_headroom(skb) < IEEE80211_WEP_IV_LEN)) + return NULL; + +- hdrlen = ieee80211_hdrlen(hdr->frame_control); + newhdr = skb_push(skb, IEEE80211_WEP_IV_LEN); + memmove(newhdr, newhdr + IEEE80211_WEP_IV_LEN, hdrlen); + +@@ -160,6 +159,7 @@ int ieee80211_wep_encrypt_data(struct cr + */ + int ieee80211_wep_encrypt(struct ieee80211_local *local, + struct sk_buff *skb, ++ unsigned int hdrlen, + const u8 *key, int keylen, int keyidx) + { + u8 *iv; +@@ -169,7 +169,7 @@ int ieee80211_wep_encrypt(struct ieee802 + if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN)) + return -1; + +- iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx); ++ iv = ieee80211_wep_add_iv(local, skb, hdrlen, keylen, keyidx); + if (!iv) + return -1; + +@@ -307,13 +307,14 @@ static int wep_encrypt_skb(struct ieee80 + struct ieee80211_key_conf *hw_key = info->control.hw_key; + + if (!hw_key) { +- if (ieee80211_wep_encrypt(tx->local, skb, tx->key->conf.key, ++ if (ieee80211_wep_encrypt(tx->local, skb, tx->hdrlen, ++ tx->key->conf.key, + tx->key->conf.keylen, + tx->key->conf.keyidx)) + return -1; + } else if ((hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) || + (hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)) { +- if (!ieee80211_wep_add_iv(tx->local, skb, ++ if (!ieee80211_wep_add_iv(tx->local, skb, tx->hdrlen, + tx->key->conf.keylen, + tx->key->conf.keyidx)) + return -1; +--- a/net/mac80211/wep.h ++++ b/net/mac80211/wep.h +@@ -22,6 +22,7 @@ int ieee80211_wep_encrypt_data(struct cr + size_t klen, u8 *data, size_t data_len); + int ieee80211_wep_encrypt(struct ieee80211_local *local, + struct sk_buff *skb, ++ unsigned int hdrlen, + const u8 *key, int keylen, int keyidx); + int ieee80211_wep_decrypt_data(struct crypto_cipher *tfm, u8 *rc4key, + size_t klen, u8 *data, size_t data_len); +--- a/net/mac80211/wpa.c ++++ b/net/mac80211/wpa.c +@@ -44,7 +44,7 @@ ieee80211_tx_h_michael_mic_add(struct ie + skb->len < 24 || !ieee80211_is_data_present(hdr->frame_control)) + return TX_CONTINUE; + +- hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ hdrlen = tx->hdrlen; + if (skb->len < hdrlen) + return TX_DROP; + +@@ -195,7 +195,6 @@ mic_fail_no_key: + + static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) + { +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; + struct ieee80211_key *key = tx->key; + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + unsigned int hdrlen; +@@ -210,7 +209,7 @@ static int tkip_encrypt_skb(struct ieee8 + return 0; + } + +- hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ hdrlen = tx->hdrlen; + len = skb->len - hdrlen; + + if (info->control.hw_key) +@@ -428,7 +427,7 @@ static int ccmp_encrypt_skb(struct ieee8 + return 0; + } + +- hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ hdrlen = tx->hdrlen; + len = skb->len - hdrlen; + + if (info->control.hw_key) +@@ -660,7 +659,7 @@ static int gcmp_encrypt_skb(struct ieee8 + return 0; + } + +- hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ hdrlen = tx->hdrlen; + len = skb->len - hdrlen; + + if (info->control.hw_key) +@@ -800,7 +799,6 @@ static ieee80211_tx_result + ieee80211_crypto_cs_encrypt(struct ieee80211_tx_data *tx, + struct sk_buff *skb) + { +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + struct ieee80211_key *key = tx->key; + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + int hdrlen; +@@ -816,8 +814,7 @@ ieee80211_crypto_cs_encrypt(struct ieee8 + pskb_expand_head(skb, iv_len, 0, GFP_ATOMIC))) + return TX_DROP; + +- hdrlen = ieee80211_hdrlen(hdr->frame_control); +- ++ hdrlen = tx->hdrlen; + pos = skb_push(skb, iv_len); + memmove(pos, pos + iv_len, hdrlen); + diff --git a/package/kernel/mac80211/patches/subsys/351-mac80211-add-TX_NEEDS_ALIGNED4_SKBS-hw-flag.patch b/package/kernel/mac80211/patches/subsys/351-mac80211-add-TX_NEEDS_ALIGNED4_SKBS-hw-flag.patch new file mode 100644 index 00000000000000..e1e846e0dfc286 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/351-mac80211-add-TX_NEEDS_ALIGNED4_SKBS-hw-flag.patch @@ -0,0 +1,304 @@ +From: Janusz Dziedzic +Date: Sun, 10 Mar 2019 17:22:08 +0100 +Subject: [PATCH] mac80211: add TX_NEEDS_ALIGNED4_SKBS hw flag + +The driver should set this flag if the hardware requires tx skb data +(starting with the LLC header) to be aligned to 4 bytes. + +Padding is added after ieee80211_hdr, before IV/LLC. + +Before this patch, we have to do memmove(hdrlen) twice in the driver: +Once before we pass this to HW and once again in tx completion +(to fix up the skb for monitor mode). + +With this patch we can skip this memmove() and thus reduce CPU cycles in +the data path. + +Signed-off-by: Janusz Dziedzic +Signed-off-by: Felix Fietkau +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -2140,6 +2140,9 @@ struct ieee80211_txq { + * @IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN: Driver does not report accurate A-MPDU + * length in tx status information + * ++ * @IEEE80211_HW_TX_NEEDS_ALIGNED4_SKBS: Driver need aligned skbs to four-byte. ++ * Padding will be added after ieee80211_hdr, before IV/LLC. ++ * + * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays + */ + enum ieee80211_hw_flags { +@@ -2186,6 +2189,7 @@ enum ieee80211_hw_flags { + IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP, + IEEE80211_HW_DOESNT_SUPPORT_QOS_NDP, + IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN, ++ IEEE80211_HW_TX_NEEDS_ALIGNED4_SKBS, + + /* keep last, obviously */ + NUM_IEEE80211_HW_FLAGS +@@ -2472,6 +2476,40 @@ ieee80211_get_alt_retry_rate(const struc + void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb); + + /** ++ * ieee80211_hdr_padsize - get size of padding between 802.11 header and LLC ++ * @hw: the hardware ++ * @hdrlen: 802.11 header length ++ */ ++static inline unsigned int ++ieee80211_hdr_padsize(struct ieee80211_hw *hw, unsigned int hdrlen) ++{ ++ /* ++ * While hdrlen is already aligned to two-byte boundaries, ++ * simple check with & 2 will return correct padsize. ++ */ ++ if (ieee80211_hw_check(hw, TX_NEEDS_ALIGNED4_SKBS)) ++ return hdrlen & 2; ++ return 0; ++} ++ ++/** ++ * ieee80211_padded_hdrlen - get padded 802.11 header size ++ * @hw: the hardware ++ * @fc: frame control field in little-endian format ++ */ ++static inline unsigned int ++ieee80211_padded_hdrlen(struct ieee80211_hw *hw, __le16 fc) ++{ ++ unsigned int hdrlen; ++ ++ hdrlen = ieee80211_hdrlen(fc); ++ hdrlen += ieee80211_hdr_padsize(hw, hdrlen); ++ ++ return hdrlen; ++} ++ ++ ++/** + * DOC: Hardware crypto acceleration + * + * mac80211 is capable of taking advantage of many hardware +--- a/net/mac80211/iface.c ++++ b/net/mac80211/iface.c +@@ -1871,6 +1871,10 @@ int ieee80211_if_add(struct ieee80211_lo + + 8 /* rfc1042/bridge tunnel */ + - ETH_HLEN /* ethernet hard_header_len */ + + IEEE80211_ENCRYPT_HEADROOM; ++ ++ if (ieee80211_hw_check(&local->hw, TX_NEEDS_ALIGNED4_SKBS)) ++ ndev->needed_headroom += 2; /* padding */ ++ + ndev->needed_tailroom = IEEE80211_ENCRYPT_TAILROOM; + + ret = dev_alloc_name(ndev, ndev->name); +--- a/net/mac80211/mesh_pathtbl.c ++++ b/net/mac80211/mesh_pathtbl.c +@@ -105,13 +105,15 @@ void mesh_path_assign_nexthop(struct mes + static void prepare_for_gate(struct sk_buff *skb, char *dst_addr, + struct mesh_path *gate_mpath) + { ++ struct ieee80211_sub_if_data *sdata = gate_mpath->sdata; ++ struct ieee80211_hw *hw = &sdata->local->hw; + struct ieee80211_hdr *hdr; + struct ieee80211s_hdr *mshdr; + int mesh_hdrlen, hdrlen; + char *next_hop; + + hdr = (struct ieee80211_hdr *) skb->data; +- hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ hdrlen = ieee80211_padded_hdrlen(hw, hdr->frame_control); + mshdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); + + if (!(mshdr->flags & MESH_FLAGS_AE)) { +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -2597,7 +2597,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80 + struct ieee80211_local *local = rx->local; + struct ieee80211_sub_if_data *sdata = rx->sdata; + struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; +- u16 ac, q, hdrlen; ++ u16 ac, q, hdrlen, padsize; + int tailroom = 0; + + hdr = (struct ieee80211_hdr *) skb->data; +@@ -2690,7 +2690,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80 + if (sdata->crypto_tx_tailroom_needed_cnt) + tailroom = IEEE80211_ENCRYPT_TAILROOM; + +- fwd_skb = skb_copy_expand(skb, local->tx_headroom + ++ padsize = ieee80211_hdr_padsize(&local->hw, hdrlen); ++ ++ fwd_skb = skb_copy_expand(skb, local->tx_headroom + padsize + + sdata->encrypt_headroom, + tailroom, GFP_ATOMIC); + if (!fwd_skb) +@@ -2722,6 +2724,12 @@ ieee80211_rx_h_mesh_fwding(struct ieee80 + return RX_DROP_MONITOR; + } + ++ if (padsize) { ++ skb_push(fwd_skb, padsize); ++ memmove(fwd_skb->data, skb->data + padsize, hdrlen); ++ memset(fwd_skb->data + hdrlen, 0, padsize); ++ } ++ + IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames); + ieee80211_add_pending_skb(local, fwd_skb); + out: +--- a/net/mac80211/sta_info.h ++++ b/net/mac80211/sta_info.h +@@ -311,7 +311,7 @@ struct ieee80211_fast_tx { + u8 hdr_len; + u8 sa_offs, da_offs, pn_offs; + u8 band; +- u8 hdr[30 + 2 + IEEE80211_FAST_XMIT_MAX_IV + ++ u8 hdr[30 + 2 + 2 + IEEE80211_FAST_XMIT_MAX_IV + + sizeof(rfc1042_header)] __aligned(2); + + struct rcu_head rcu_head; +--- a/net/mac80211/status.c ++++ b/net/mac80211/status.c +@@ -515,6 +515,7 @@ static void ieee80211_report_used_skb(st + { + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + struct ieee80211_hdr *hdr = (void *)skb->data; ++ struct ieee80211_hw *hw = &local->hw; + bool acked = info->flags & IEEE80211_TX_STAT_ACK; + + if (dropped) +@@ -531,7 +532,7 @@ static void ieee80211_report_used_skb(st + skb->dev = NULL; + } else { + unsigned int hdr_size = +- ieee80211_hdrlen(hdr->frame_control); ++ ieee80211_padded_hdrlen(hw, hdr->frame_control); + + /* Check to see if packet is a TDLS teardown packet */ + if (ieee80211_is_data(hdr->frame_control) && +@@ -655,9 +656,22 @@ void ieee80211_tx_monitor(struct ieee802 + struct sk_buff *skb2; + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + struct ieee80211_sub_if_data *sdata; ++ struct ieee80211_hdr *hdr = (void *)skb->data; + struct net_device *prev_dev = NULL; ++ unsigned int hdrlen, padsize; + int rtap_len; + ++ /* Remove padding if was added */ ++ if (ieee80211_hw_check(&local->hw, TX_NEEDS_ALIGNED4_SKBS)) { ++ hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ padsize = ieee80211_hdr_padsize(&local->hw, hdrlen); ++ ++ if (padsize && skb->len > hdrlen + padsize) { ++ memmove(skb->data + padsize, skb->data, hdrlen); ++ skb_pull(skb, padsize); ++ } ++ } ++ + /* send frame to monitor interfaces now */ + rtap_len = ieee80211_tx_radiotap_len(info); + if (WARN_ON_ONCE(skb_headroom(skb) < rtap_len)) { +--- a/net/mac80211/tkip.c ++++ b/net/mac80211/tkip.c +@@ -201,10 +201,12 @@ void ieee80211_get_tkip_p2k(struct ieee8 + { + struct ieee80211_key *key = (struct ieee80211_key *) + container_of(keyconf, struct ieee80211_key, conf); ++ struct ieee80211_hw *hw = &key->local->hw; + const u8 *tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY]; + struct tkip_ctx *ctx = &key->u.tkip.tx; + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; +- const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control); ++ const u8 *data = (u8 *)hdr + ieee80211_padded_hdrlen(hw, ++ hdr->frame_control); + u32 iv32 = get_unaligned_le32(&data[4]); + u16 iv16 = data[2] | (data[0] << 8); + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -1175,8 +1175,7 @@ ieee80211_tx_prepare(struct ieee80211_su + info->flags &= ~IEEE80211_TX_INTFL_NEED_TXPROCESSING; + + hdr = (struct ieee80211_hdr *) skb->data; +- +- tx->hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ tx->hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control); + + if (likely(sta)) { + if (!IS_ERR(sta)) +@@ -2222,7 +2221,7 @@ netdev_tx_t ieee80211_monitor_start_xmit + goto fail; + + hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr); +- hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control); + + if (skb->len < len_rthdr + hdrlen) + goto fail; +@@ -2440,7 +2439,7 @@ static struct sk_buff *ieee80211_build_h + struct ieee80211_chanctx_conf *chanctx_conf; + struct ieee80211_sub_if_data *ap_sdata; + enum nl80211_band band; +- int ret; ++ int padsize, ret; + + if (IS_ERR(sta)) + sta = NULL; +@@ -2739,7 +2738,9 @@ static struct sk_buff *ieee80211_build_h + } + + skb_pull(skb, skip_header_bytes); ++ padsize = ieee80211_hdr_padsize(&local->hw, hdrlen); + head_need = hdrlen + encaps_len + meshhdrlen - skb_headroom(skb); ++ head_need += padsize; + + /* + * So we need to modify the skb header and hence need a copy of +@@ -2772,6 +2773,9 @@ static struct sk_buff *ieee80211_build_h + memcpy(skb_push(skb, meshhdrlen), &mesh_hdr, meshhdrlen); + #endif + ++ if (padsize) ++ memset(skb_push(skb, padsize), 0, padsize); ++ + if (ieee80211_is_data_qos(fc)) { + __le16 *qos_control; + +@@ -2947,6 +2951,8 @@ void ieee80211_check_fast_xmit(struct st + fc |= cpu_to_le16(IEEE80211_STYPE_QOS_DATA); + } + ++ build.hdr_len += ieee80211_hdr_padsize(&local->hw, build.hdr_len); ++ + /* We store the key here so there's no point in using rcu_dereference() + * but that's fine because the code that changes the pointers will call + * this function after doing so. For a single CPU that would be enough, +@@ -3523,7 +3529,7 @@ begin: + tx.local = local; + tx.skb = skb; + tx.sdata = vif_to_sdata(info->control.vif); +- tx.hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ tx.hdrlen = ieee80211_padded_hdrlen(hw, hdr->frame_control); + + if (txq->sta) + tx.sta = container_of(txq->sta, struct sta_info, sta); +@@ -4007,7 +4013,7 @@ ieee80211_build_data_template(struct iee + hdr = (void *)skb->data; + tx.sta = sta_info_get(sdata, hdr->addr1); + tx.skb = skb; +- tx.hdrlen = ieee80211_hdrlen(hdr->frame_control); ++ tx.hdrlen = ieee80211_padded_hdrlen(&tx.local->hw, hdr->frame_control); + + if (ieee80211_tx_h_select_key(&tx) != TX_CONTINUE) { + rcu_read_unlock(); +--- a/net/mac80211/debugfs.c ++++ b/net/mac80211/debugfs.c +@@ -215,6 +215,7 @@ static const char *hw_flag_names[] = { + FLAG(DEAUTH_NEED_MGD_TX_PREP), + FLAG(DOESNT_SUPPORT_QOS_NDP), + FLAG(TX_STATUS_NO_AMPDU_LEN), ++ FLAG(TX_NEEDS_ALIGNED4_SKBS), + #undef FLAG + }; + diff --git a/package/kernel/mac80211/patches/subsys/352-mac80211-rework-locking-for-txq-scheduling-airtime-f.patch b/package/kernel/mac80211/patches/subsys/352-mac80211-rework-locking-for-txq-scheduling-airtime-f.patch new file mode 100644 index 00000000000000..0404afe7d2308e --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/352-mac80211-rework-locking-for-txq-scheduling-airtime-f.patch @@ -0,0 +1,214 @@ +From: Felix Fietkau +Date: Wed, 13 Mar 2019 19:09:22 +0100 +Subject: [PATCH] mac80211: rework locking for txq scheduling / airtime + fairness + +Holding the lock around the entire duration of tx scheduling can create +some nasty lock contention, especially when processing airtime information +from the tx status or the rx path. +Improve locking by only holding the active_txq_lock for lookups / scheduling +list modifications. + +Signed-off-by: Felix Fietkau +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -6069,8 +6069,6 @@ struct sk_buff *ieee80211_tx_dequeue(str + * @hw: pointer as obtained from ieee80211_alloc_hw() + * @ac: AC number to return packets from. + * +- * Should only be called between calls to ieee80211_txq_schedule_start() +- * and ieee80211_txq_schedule_end(). + * Returns the next txq if successful, %NULL if no queue is eligible. If a txq + * is returned, it should be returned with ieee80211_return_txq() after the + * driver has finished scheduling it. +@@ -6078,51 +6076,41 @@ struct sk_buff *ieee80211_tx_dequeue(str + struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac); + + /** +- * ieee80211_return_txq - return a TXQ previously acquired by ieee80211_next_txq() +- * +- * @hw: pointer as obtained from ieee80211_alloc_hw() +- * @txq: pointer obtained from station or virtual interface +- * +- * Should only be called between calls to ieee80211_txq_schedule_start() +- * and ieee80211_txq_schedule_end(). +- */ +-void ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq); +- +-/** +- * ieee80211_txq_schedule_start - acquire locks for safe scheduling of an AC ++ * ieee80211_txq_schedule_start - start new scheduling round for TXQs + * + * @hw: pointer as obtained from ieee80211_alloc_hw() + * @ac: AC number to acquire locks for + * +- * Acquire locks needed to schedule TXQs from the given AC. Should be called +- * before ieee80211_next_txq() or ieee80211_return_txq(). ++ * Should be called before ieee80211_next_txq() or ieee80211_return_txq(). + */ +-void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac) +- __acquires(txq_lock); ++void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac); ++ ++/* (deprecated) */ ++static inline void ieee80211_txq_schedule_end(struct ieee80211_hw *hw, u8 ac) ++{ ++} + + /** +- * ieee80211_txq_schedule_end - release locks for safe scheduling of an AC ++ * ieee80211_schedule_txq - schedule a TXQ for transmission + * + * @hw: pointer as obtained from ieee80211_alloc_hw() +- * @ac: AC number to acquire locks for ++ * @txq: pointer obtained from station or virtual interface + * +- * Release locks previously acquired by ieee80211_txq_schedule_end(). ++ * Schedules a TXQ for transmission if it is not already scheduled. + */ +-void ieee80211_txq_schedule_end(struct ieee80211_hw *hw, u8 ac) +- __releases(txq_lock); ++void ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq); + + /** +- * ieee80211_schedule_txq - schedule a TXQ for transmission ++ * ieee80211_return_txq - return a TXQ previously acquired by ieee80211_next_txq() + * + * @hw: pointer as obtained from ieee80211_alloc_hw() + * @txq: pointer obtained from station or virtual interface +- * +- * Schedules a TXQ for transmission if it is not already scheduled. Takes a +- * lock, which means it must *not* be called between +- * ieee80211_txq_schedule_start() and ieee80211_txq_schedule_end() + */ +-void ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq) +- __acquires(txq_lock) __releases(txq_lock); ++static inline void ++ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq) ++{ ++ ieee80211_schedule_txq(hw, txq); ++} + + /** + * ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3617,16 +3617,17 @@ EXPORT_SYMBOL(ieee80211_tx_dequeue); + struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac) + { + struct ieee80211_local *local = hw_to_local(hw); ++ struct ieee80211_txq *ret = NULL; + struct txq_info *txqi = NULL; + +- lockdep_assert_held(&local->active_txq_lock[ac]); ++ spin_lock_bh(&local->active_txq_lock[ac]); + + begin: + txqi = list_first_entry_or_null(&local->active_txqs[ac], + struct txq_info, + schedule_order); + if (!txqi) +- return NULL; ++ goto out; + + if (txqi->txq.sta) { + struct sta_info *sta = container_of(txqi->txq.sta, +@@ -3643,21 +3644,25 @@ struct ieee80211_txq *ieee80211_next_txq + + + if (txqi->schedule_round == local->schedule_round[ac]) +- return NULL; ++ goto out; + + list_del_init(&txqi->schedule_order); + txqi->schedule_round = local->schedule_round[ac]; +- return &txqi->txq; ++ ret = &txqi->txq; ++ ++out: ++ spin_unlock_bh(&local->active_txq_lock[ac]); ++ return ret; + } + EXPORT_SYMBOL(ieee80211_next_txq); + +-void ieee80211_return_txq(struct ieee80211_hw *hw, +- struct ieee80211_txq *txq) ++void ieee80211_schedule_txq(struct ieee80211_hw *hw, ++ struct ieee80211_txq *txq) + { + struct ieee80211_local *local = hw_to_local(hw); + struct txq_info *txqi = to_txq_info(txq); + +- lockdep_assert_held(&local->active_txq_lock[txq->ac]); ++ spin_lock_bh(&local->active_txq_lock[txq->ac]); + + if (list_empty(&txqi->schedule_order) && + (!skb_queue_empty(&txqi->frags) || txqi->tin.backlog_packets)) { +@@ -3677,18 +3682,7 @@ void ieee80211_return_txq(struct ieee802 + list_add_tail(&txqi->schedule_order, + &local->active_txqs[txq->ac]); + } +-} +-EXPORT_SYMBOL(ieee80211_return_txq); + +-void ieee80211_schedule_txq(struct ieee80211_hw *hw, +- struct ieee80211_txq *txq) +- __acquires(txq_lock) __releases(txq_lock) +-{ +- struct ieee80211_local *local = hw_to_local(hw); +- struct txq_info *txqi = to_txq_info(txq); +- +- spin_lock_bh(&local->active_txq_lock[txq->ac]); +- ieee80211_return_txq(hw, txq); + spin_unlock_bh(&local->active_txq_lock[txq->ac]); + } + EXPORT_SYMBOL(ieee80211_schedule_txq); +@@ -3701,7 +3695,7 @@ bool ieee80211_txq_may_transmit(struct i + struct sta_info *sta; + u8 ac = txq->ac; + +- lockdep_assert_held(&local->active_txq_lock[ac]); ++ spin_lock_bh(&local->active_txq_lock[ac]); + + if (!txqi->txq.sta) + goto out; +@@ -3731,34 +3725,27 @@ bool ieee80211_txq_may_transmit(struct i + + sta->airtime[ac].deficit += sta->airtime_weight; + list_move_tail(&txqi->schedule_order, &local->active_txqs[ac]); ++ spin_unlock_bh(&local->active_txq_lock[ac]); + + return false; + out: + if (!list_empty(&txqi->schedule_order)) + list_del_init(&txqi->schedule_order); ++ spin_unlock_bh(&local->active_txq_lock[ac]); + + return true; + } + EXPORT_SYMBOL(ieee80211_txq_may_transmit); + + void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac) +- __acquires(txq_lock) + { + struct ieee80211_local *local = hw_to_local(hw); + + spin_lock_bh(&local->active_txq_lock[ac]); + local->schedule_round[ac]++; +-} +-EXPORT_SYMBOL(ieee80211_txq_schedule_start); +- +-void ieee80211_txq_schedule_end(struct ieee80211_hw *hw, u8 ac) +- __releases(txq_lock) +-{ +- struct ieee80211_local *local = hw_to_local(hw); +- + spin_unlock_bh(&local->active_txq_lock[ac]); + } +-EXPORT_SYMBOL(ieee80211_txq_schedule_end); ++EXPORT_SYMBOL(ieee80211_txq_schedule_start); + + void __ieee80211_subif_start_xmit(struct sk_buff *skb, + struct net_device *dev, diff --git a/package/kernel/mac80211/patches/subsys/353-mac80211-mesh-drop-redundant-rcu_read_lock-unlock-ca.patch b/package/kernel/mac80211/patches/subsys/353-mac80211-mesh-drop-redundant-rcu_read_lock-unlock-ca.patch new file mode 100644 index 00000000000000..86300be4edbe4f --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/353-mac80211-mesh-drop-redundant-rcu_read_lock-unlock-ca.patch @@ -0,0 +1,96 @@ +From: Felix Fietkau +Date: Sat, 16 Mar 2019 17:43:58 +0100 +Subject: [PATCH] mac80211: mesh: drop redundant rcu_read_lock/unlock calls + +The callers of these functions are all within RCU locked sections + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/mesh_hwmp.c ++++ b/net/mac80211/mesh_hwmp.c +@@ -1112,16 +1112,13 @@ int mesh_nexthop_resolve(struct ieee8021 + struct mesh_path *mpath; + struct sk_buff *skb_to_free = NULL; + u8 *target_addr = hdr->addr3; +- int err = 0; + + /* Nulls are only sent to peers for PS and should be pre-addressed */ + if (ieee80211_is_qos_nullfunc(hdr->frame_control)) + return 0; + +- rcu_read_lock(); +- err = mesh_nexthop_lookup(sdata, skb); +- if (!err) +- goto endlookup; ++ if (!mesh_nexthop_lookup(sdata, skb)) ++ return 0; + + /* no nexthop found, start resolving */ + mpath = mesh_path_lookup(sdata, target_addr); +@@ -1129,8 +1126,7 @@ int mesh_nexthop_resolve(struct ieee8021 + mpath = mesh_path_add(sdata, target_addr); + if (IS_ERR(mpath)) { + mesh_path_discard_frame(sdata, skb); +- err = PTR_ERR(mpath); +- goto endlookup; ++ return PTR_ERR(mpath); + } + } + +@@ -1143,13 +1139,10 @@ int mesh_nexthop_resolve(struct ieee8021 + info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; + ieee80211_set_qos_hdr(sdata, skb); + skb_queue_tail(&mpath->frame_queue, skb); +- err = -ENOENT; + if (skb_to_free) + mesh_path_discard_frame(sdata, skb_to_free); + +-endlookup: +- rcu_read_unlock(); +- return err; ++ return -ENOENT; + } + + /** +@@ -1169,13 +1162,10 @@ int mesh_nexthop_lookup(struct ieee80211 + struct sta_info *next_hop; + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; + u8 *target_addr = hdr->addr3; +- int err = -ENOENT; + +- rcu_read_lock(); + mpath = mesh_path_lookup(sdata, target_addr); +- + if (!mpath || !(mpath->flags & MESH_PATH_ACTIVE)) +- goto endlookup; ++ return -ENOENT; + + if (time_after(jiffies, + mpath->exp_time - +@@ -1190,12 +1180,10 @@ int mesh_nexthop_lookup(struct ieee80211 + memcpy(hdr->addr1, next_hop->sta.addr, ETH_ALEN); + memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN); + ieee80211_mps_set_frame_flags(sdata, next_hop, hdr); +- err = 0; ++ return 0; + } + +-endlookup: +- rcu_read_unlock(); +- return err; ++ return -ENOENT; + } + + void mesh_path_timer(struct timer_list *t) +--- a/net/mac80211/mesh_pathtbl.c ++++ b/net/mac80211/mesh_pathtbl.c +@@ -219,7 +219,7 @@ static struct mesh_path *mpath_lookup(st + { + struct mesh_path *mpath; + +- mpath = rhashtable_lookup_fast(&tbl->rhead, dst, mesh_rht_params); ++ mpath = rhashtable_lookup(&tbl->rhead, dst, mesh_rht_params); + + if (mpath && mpath_expired(mpath)) { + spin_lock_bh(&mpath->state_lock); diff --git a/package/kernel/mac80211/patches/subsys/354-mac80211-calculate-hash-for-fq-without-holding-fq-lo.patch b/package/kernel/mac80211/patches/subsys/354-mac80211-calculate-hash-for-fq-without-holding-fq-lo.patch new file mode 100644 index 00000000000000..b5a49dbfe01602 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/354-mac80211-calculate-hash-for-fq-without-holding-fq-lo.patch @@ -0,0 +1,140 @@ +From: Felix Fietkau +Date: Sat, 16 Mar 2019 17:57:38 +0100 +Subject: [PATCH] mac80211: calculate hash for fq without holding fq->lock + in itxq enqueue + +Reduces lock contention on enqueue/dequeue of iTXQ packets + +Signed-off-by: Felix Fietkau +--- + +--- a/include/net/fq_impl.h ++++ b/include/net/fq_impl.h +@@ -107,29 +107,31 @@ begin: + return skb; + } + +-static struct fq_flow *fq_flow_classify(struct fq *fq, +- struct fq_tin *tin, +- struct sk_buff *skb, +- fq_flow_get_default_t get_default_func) ++static u32 fq_flow_idx(struct fq *fq, struct sk_buff *skb) + { +- struct fq_flow *flow; +- u32 hash; +- u32 idx; +- +- lockdep_assert_held(&fq->lock); +- + #if LINUX_VERSION_IS_GEQ(5,3,10) || \ + LINUX_VERSION_IN_RANGE(4,19,83, 4,20,0) || \ + LINUX_VERSION_IN_RANGE(4,14,153, 4,15,0) || \ + LINUX_VERSION_IN_RANGE(4,9,200, 4,10,0) || \ + LINUX_VERSION_IN_RANGE(4,4,200, 4,5,0) +- hash = skb_get_hash_perturb(skb, &fq->perturbation); ++ u32 hash = skb_get_hash_perturb(skb, &fq->perturbation); + #else +- hash = skb_get_hash_perturb(skb, fq->perturbation); ++ u32 hash = skb_get_hash_perturb(skb, fq->perturbation); + #endif +- idx = reciprocal_scale(hash, fq->flows_cnt); +- flow = &fq->flows[idx]; + ++ return reciprocal_scale(hash, fq->flows_cnt); ++} ++ ++static struct fq_flow *fq_flow_classify(struct fq *fq, ++ struct fq_tin *tin, u32 idx, ++ struct sk_buff *skb, ++ fq_flow_get_default_t get_default_func) ++{ ++ struct fq_flow *flow; ++ ++ lockdep_assert_held(&fq->lock); ++ ++ flow = &fq->flows[idx]; + if (flow->tin && flow->tin != tin) { + flow = get_default_func(fq, tin, idx, skb); + tin->collisions++; +@@ -161,7 +163,7 @@ static void fq_recalc_backlog(struct fq + } + + static void fq_tin_enqueue(struct fq *fq, +- struct fq_tin *tin, ++ struct fq_tin *tin, u32 idx, + struct sk_buff *skb, + fq_skb_free_t free_func, + fq_flow_get_default_t get_default_func) +@@ -171,7 +173,7 @@ static void fq_tin_enqueue(struct fq *fq + + lockdep_assert_held(&fq->lock); + +- flow = fq_flow_classify(fq, tin, skb, get_default_func); ++ flow = fq_flow_classify(fq, tin, idx, skb, get_default_func); + + flow->tin = tin; + flow->backlog += skb->len; +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -1390,11 +1390,15 @@ static void ieee80211_txq_enqueue(struct + { + struct fq *fq = &local->fq; + struct fq_tin *tin = &txqi->tin; ++ u32 flow_idx = fq_flow_idx(fq, skb); + + ieee80211_set_skb_enqueue_time(skb); +- fq_tin_enqueue(fq, tin, skb, ++ ++ spin_lock_bh(&fq->lock); ++ fq_tin_enqueue(fq, tin, flow_idx, skb, + fq_skb_free_func, + fq_flow_get_default_func); ++ spin_unlock_bh(&fq->lock); + } + + static bool fq_vlan_filter_func(struct fq *fq, struct fq_tin *tin, +@@ -1564,7 +1568,6 @@ static bool ieee80211_queue_skb(struct i + struct sta_info *sta, + struct sk_buff *skb) + { +- struct fq *fq = &local->fq; + struct ieee80211_vif *vif; + struct txq_info *txqi; + +@@ -1582,9 +1585,7 @@ static bool ieee80211_queue_skb(struct i + if (!txqi) + return false; + +- spin_lock_bh(&fq->lock); + ieee80211_txq_enqueue(local, txqi, skb); +- spin_unlock_bh(&fq->lock); + + schedule_and_wake_txq(local, txqi); + +@@ -3198,6 +3199,7 @@ static bool ieee80211_amsdu_aggregate(st + u8 max_subframes = sta->sta.max_amsdu_subframes; + int max_frags = local->hw.max_tx_fragments; + int max_amsdu_len = sta->sta.max_amsdu_len; ++ u32 flow_idx; + int orig_truesize; + __be16 len; + void *data; +@@ -3220,6 +3222,8 @@ static bool ieee80211_amsdu_aggregate(st + max_amsdu_len = min_t(int, max_amsdu_len, + sta->sta.max_rc_amsdu_len); + ++ flow_idx = fq_flow_idx(fq, skb); ++ + spin_lock_bh(&fq->lock); + + /* TODO: Ideally aggregation should be done on dequeue to remain +@@ -3227,7 +3231,8 @@ static bool ieee80211_amsdu_aggregate(st + */ + + tin = &txqi->tin; +- flow = fq_flow_classify(fq, tin, skb, fq_flow_get_default_func); ++ flow = fq_flow_classify(fq, tin, flow_idx, skb, ++ fq_flow_get_default_func); + head = skb_peek_tail(&flow->queue); + if (!head) + goto out; diff --git a/package/kernel/mac80211/patches/subsys/355-mac80211-run-late-dequeue-late-tx-handlers-without-h.patch b/package/kernel/mac80211/patches/subsys/355-mac80211-run-late-dequeue-late-tx-handlers-without-h.patch new file mode 100644 index 00000000000000..ba25458816284f --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/355-mac80211-run-late-dequeue-late-tx-handlers-without-h.patch @@ -0,0 +1,55 @@ +From: Felix Fietkau +Date: Sat, 16 Mar 2019 18:00:12 +0100 +Subject: [PATCH] mac80211: run late dequeue late tx handlers without + holding fq->lock + +Reduces lock contention on enqueue/dequeue of iTXQ packets + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3505,6 +3505,7 @@ struct sk_buff *ieee80211_tx_dequeue(str + ieee80211_tx_result r; + struct ieee80211_vif *vif = txq->vif; + ++begin: + spin_lock_bh(&fq->lock); + + if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags) || +@@ -3521,11 +3522,12 @@ struct sk_buff *ieee80211_tx_dequeue(str + if (skb) + goto out; + +-begin: + skb = fq_tin_dequeue(fq, tin, fq_tin_dequeue_func); + if (!skb) + goto out; + ++ spin_unlock_bh(&fq->lock); ++ + hdr = (struct ieee80211_hdr *)skb->data; + info = IEEE80211_SKB_CB(skb); + +@@ -3571,8 +3573,11 @@ begin: + + skb = __skb_dequeue(&tx.skbs); + +- if (!skb_queue_empty(&tx.skbs)) ++ if (!skb_queue_empty(&tx.skbs)) { ++ spin_lock_bh(&fq->lock); + skb_queue_splice_tail(&tx.skbs, &txqi->frags); ++ spin_unlock_bh(&fq->lock); ++ } + } + + if (skb && skb_has_frag_list(skb) && +@@ -3611,6 +3616,7 @@ begin: + } + + IEEE80211_SKB_CB(skb)->control.vif = vif; ++ return skb; + + out: + spin_unlock_bh(&fq->lock); diff --git a/package/kernel/mac80211/patches/subsys/356-mac80211-set-NETIF_F_LLTX-when-using-intermediate-tx.patch b/package/kernel/mac80211/patches/subsys/356-mac80211-set-NETIF_F_LLTX-when-using-intermediate-tx.patch new file mode 100644 index 00000000000000..95ab3ab9fbd9b9 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/356-mac80211-set-NETIF_F_LLTX-when-using-intermediate-tx.patch @@ -0,0 +1,22 @@ +From: Felix Fietkau +Date: Sat, 16 Mar 2019 18:01:53 +0100 +Subject: [PATCH] mac80211: set NETIF_F_LLTX when using intermediate tx + queues + +When using iTXQ, tx sequence number allocation and statistics are run at +dequeue time. Because of that, it is safe to enable NETIF_F_LLTX, which +allows tx handlers to run on multiple CPUs in parallel. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/iface.c ++++ b/net/mac80211/iface.c +@@ -1301,6 +1301,7 @@ static void ieee80211_if_setup(struct ne + static void ieee80211_if_setup_no_queue(struct net_device *dev) + { + ieee80211_if_setup(dev); ++ dev->features |= NETIF_F_LLTX; + #if LINUX_VERSION_IS_GEQ(4,3,0) + dev->priv_flags |= IFF_NO_QUEUE; + #else diff --git a/package/kernel/mac80211/patches/subsys/357-mac80211-optimize-skb-resizing.patch b/package/kernel/mac80211/patches/subsys/357-mac80211-optimize-skb-resizing.patch new file mode 100644 index 00000000000000..8853ccd0594d9c --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/357-mac80211-optimize-skb-resizing.patch @@ -0,0 +1,202 @@ +From: Felix Fietkau +Date: Sun, 17 Mar 2019 18:11:30 +0100 +Subject: [PATCH] mac80211: optimize skb resizing + +When forwarding unicast packets from ethernet to batman-adv over 802.11s +(with forwarding disabled), the typical required headroom to transmit +encrypted packets on mt76 is 32 (802.11) + 6 (802.11s) + 8 (CCMP) + +2 (padding) + 6 (LLC) + 18 (batman-adv) - 14 (old ethernet header) = 58 bytes. + +On systems where NET_SKB_PAD is 64 this leads to a call to pskb_expand_head +for every packet, since mac80211 also tries to allocate 16 bytes status +headroom for radiotap headers. + +This patch fixes these unnecessary reallocations by only requiring the extra +status headroom in ieee80211_tx_monitor() +If however a reallocation happens before that call, the status headroom gets +added there as well, in order to avoid double reallocation. + +The patch also cleans up the code by moving the headroom calculation to +ieee80211_skb_resize. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -1761,6 +1761,9 @@ void ieee80211_clear_fast_xmit(struct st + int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, + const u8 *buf, size_t len, + const u8 *dest, __be16 proto, bool unencrypted); ++int ieee80211_skb_resize(struct ieee80211_local *local, ++ struct ieee80211_sub_if_data *sdata, ++ struct sk_buff *skb, int hdrlen, int hdr_add); + + /* HT */ + void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, +--- a/net/mac80211/status.c ++++ b/net/mac80211/status.c +@@ -672,6 +672,11 @@ void ieee80211_tx_monitor(struct ieee802 + } + } + ++ if (ieee80211_skb_resize(local, NULL, skb, 0, 0)) { ++ dev_kfree_skb(skb); ++ return; ++ } ++ + /* send frame to monitor interfaces now */ + rtap_len = ieee80211_tx_radiotap_len(info); + if (WARN_ON_ONCE(skb_headroom(skb) < rtap_len)) { +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -1914,37 +1914,53 @@ static bool ieee80211_tx(struct ieee8021 + } + + /* device xmit handlers */ +- +-static int ieee80211_skb_resize(struct ieee80211_sub_if_data *sdata, +- struct sk_buff *skb, +- int head_need, bool may_encrypt) ++int ieee80211_skb_resize(struct ieee80211_local *local, ++ struct ieee80211_sub_if_data *sdata, ++ struct sk_buff *skb, int hdr_len, int hdr_extra) + { +- struct ieee80211_local *local = sdata->local; ++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + struct ieee80211_hdr *hdr; +- bool enc_tailroom; +- int tail_need = 0; +- +- hdr = (struct ieee80211_hdr *) skb->data; +- enc_tailroom = may_encrypt && +- (sdata->crypto_tx_tailroom_needed_cnt || +- ieee80211_is_mgmt(hdr->frame_control)); +- +- if (enc_tailroom) { +- tail_need = IEEE80211_ENCRYPT_TAILROOM; +- tail_need -= skb_tailroom(skb); +- tail_need = max_t(int, tail_need, 0); ++ int head_need, head_max; ++ int tail_need, tail_max; ++ bool enc_tailroom = false; ++ ++ if (sdata && !hdr_len && ++ !(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT)) { ++ hdr = (struct ieee80211_hdr *) skb->data; ++ enc_tailroom = (sdata->crypto_tx_tailroom_needed_cnt || ++ ieee80211_is_mgmt(hdr->frame_control)); ++ hdr_len += sdata->encrypt_headroom; ++ } ++ ++ head_need = head_max = hdr_len; ++ tail_need = tail_max = 0; ++ if (!sdata) { ++ head_need = head_max = local->tx_headroom; ++ } else { ++ head_max += hdr_extra; ++ head_max += max_t(int, local->tx_headroom, ++ local->hw.extra_tx_headroom); ++ head_need += local->hw.extra_tx_headroom; ++ ++ tail_max = IEEE80211_ENCRYPT_TAILROOM; ++ if (enc_tailroom) ++ tail_need = tail_max; + } + + if (skb_cloned(skb) && + (!ieee80211_hw_check(&local->hw, SUPPORTS_CLONED_SKBS) || + !skb_clone_writable(skb, ETH_HLEN) || enc_tailroom)) + I802_DEBUG_INC(local->tx_expand_skb_head_cloned); +- else if (head_need || tail_need) ++ else if (head_need > skb_headroom(skb) || ++ tail_need > skb_tailroom(skb)) + I802_DEBUG_INC(local->tx_expand_skb_head); + else + return 0; + +- if (pskb_expand_head(skb, head_need, tail_need, GFP_ATOMIC)) { ++ head_max = max_t(int, 0, head_max - skb_headroom(skb)); ++ tail_max = max_t(int, 0, tail_max - skb_tailroom(skb)); ++ ++ if (pskb_expand_head(skb, head_max, tail_max, GFP_ATOMIC)) { + wiphy_debug(local->hw.wiphy, + "failed to reallocate TX buffer\n"); + return -ENOMEM; +@@ -1960,18 +1976,8 @@ void ieee80211_xmit(struct ieee80211_sub + struct ieee80211_local *local = sdata->local; + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + struct ieee80211_hdr *hdr; +- int headroom; +- bool may_encrypt; +- +- may_encrypt = !(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT); + +- headroom = local->tx_headroom; +- if (may_encrypt) +- headroom += sdata->encrypt_headroom; +- headroom -= skb_headroom(skb); +- headroom = max_t(int, 0, headroom); +- +- if (ieee80211_skb_resize(sdata, skb, headroom, may_encrypt)) { ++ if (ieee80211_skb_resize(local, sdata, skb, 0, 0)) { + ieee80211_free_txskb(&local->hw, skb); + return; + } +@@ -2740,30 +2746,14 @@ static struct sk_buff *ieee80211_build_h + + skb_pull(skb, skip_header_bytes); + padsize = ieee80211_hdr_padsize(&local->hw, hdrlen); +- head_need = hdrlen + encaps_len + meshhdrlen - skb_headroom(skb); ++ head_need = hdrlen + encaps_len + meshhdrlen; + head_need += padsize; + +- /* +- * So we need to modify the skb header and hence need a copy of +- * that. The head_need variable above doesn't, so far, include +- * the needed header space that we don't need right away. If we +- * can, then we don't reallocate right now but only after the +- * frame arrives at the master device (if it does...) +- * +- * If we cannot, however, then we will reallocate to include all +- * the ever needed space. Also, if we need to reallocate it anyway, +- * make it big enough for everything we may ever need. +- */ +- +- if (head_need > 0 || skb_cloned(skb)) { +- head_need += sdata->encrypt_headroom; +- head_need += local->tx_headroom; +- head_need = max_t(int, 0, head_need); +- if (ieee80211_skb_resize(sdata, skb, head_need, true)) { +- ieee80211_free_txskb(&local->hw, skb); +- skb = NULL; +- return ERR_PTR(-ENOMEM); +- } ++ if (ieee80211_skb_resize(local, sdata, skb, head_need, ++ sdata->encrypt_headroom)) { ++ ieee80211_free_txskb(&local->hw, skb); ++ skb = NULL; ++ return ERR_PTR(-ENOMEM); + } + + if (encaps_data) +@@ -3375,7 +3365,6 @@ static bool ieee80211_xmit_fast(struct i + struct ieee80211_local *local = sdata->local; + u16 ethertype = (skb->data[12] << 8) | skb->data[13]; + int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2); +- int hw_headroom = sdata->local->hw.extra_tx_headroom; + struct ethhdr eth; + struct ieee80211_tx_info *info; + struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; +@@ -3427,10 +3416,7 @@ static bool ieee80211_xmit_fast(struct i + * as the may-encrypt argument for the resize to not account for + * more room than we already have in 'extra_head' + */ +- if (unlikely(ieee80211_skb_resize(sdata, skb, +- max_t(int, extra_head + hw_headroom - +- skb_headroom(skb), 0), +- false))) { ++ if (unlikely(ieee80211_skb_resize(local, sdata, skb, extra_head, 0))) { + kfree_skb(skb); + return true; + } diff --git a/package/kernel/mac80211/patches/subsys/358-mac80211-make-ieee80211_schedule_txq-schedule-empty-.patch b/package/kernel/mac80211/patches/subsys/358-mac80211-make-ieee80211_schedule_txq-schedule-empty-.patch new file mode 100644 index 00000000000000..46dd151f1196c1 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/358-mac80211-make-ieee80211_schedule_txq-schedule-empty-.patch @@ -0,0 +1,105 @@ +From: Felix Fietkau +Date: Sun, 17 Mar 2019 14:26:59 +0100 +Subject: [PATCH] mac80211: make ieee80211_schedule_txq schedule empty TXQs + +Currently there is no way for the driver to signal to mac80211 that it should +schedule a TXQ even if there are no packets on the mac80211 part of that queue. +This is problematic if the driver has an internal retry queue to deal with +software A-MPDU retry. + +This patch changes the behavior of ieee80211_schedule_txq to always schedule +the queue, as its only user (ath9k) seems to expect such behavior already: +it calls this function on tx status and on powersave wakeup whenever its +internal retry queue is not empty. + +Also add an extra argument to ieee80211_return_txq to get the same behavior. + +This fixes an issue on ath9k where tx queues with packets to retry (and no +new packets in mac80211) would not get serviced. + +Fixes: 89cea7493a346 ("ath9k: Switch to mac80211 TXQ scheduling and airtime APIs") +Signed-off-by: Felix Fietkau +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -6090,26 +6090,42 @@ static inline void ieee80211_txq_schedul + { + } + ++void __ieee80211_schedule_txq(struct ieee80211_hw *hw, ++ struct ieee80211_txq *txq, bool force); ++ + /** + * ieee80211_schedule_txq - schedule a TXQ for transmission + * + * @hw: pointer as obtained from ieee80211_alloc_hw() + * @txq: pointer obtained from station or virtual interface + * +- * Schedules a TXQ for transmission if it is not already scheduled. ++ * Schedules a TXQ for transmission if it is not already scheduled, ++ * even if mac80211 does not have any packets buffered. ++ * ++ * The driver may call this function if it has buffered packets for ++ * this TXQ internally. + */ +-void ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq); ++static inline void ++ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq) ++{ ++ __ieee80211_schedule_txq(hw, txq, true); ++} + + /** + * ieee80211_return_txq - return a TXQ previously acquired by ieee80211_next_txq() + * + * @hw: pointer as obtained from ieee80211_alloc_hw() + * @txq: pointer obtained from station or virtual interface ++ * @force: schedule txq even if mac80211 does not have any buffered packets. ++ * ++ * The driver may set force=true if it has buffered packets for this TXQ ++ * internally. + */ + static inline void +-ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq) ++ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq, ++ bool force) + { +- ieee80211_schedule_txq(hw, txq); ++ __ieee80211_schedule_txq(hw, txq, force); + } + + /** +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3653,8 +3653,9 @@ out: + } + EXPORT_SYMBOL(ieee80211_next_txq); + +-void ieee80211_schedule_txq(struct ieee80211_hw *hw, +- struct ieee80211_txq *txq) ++void __ieee80211_schedule_txq(struct ieee80211_hw *hw, ++ struct ieee80211_txq *txq, ++ bool force) + { + struct ieee80211_local *local = hw_to_local(hw); + struct txq_info *txqi = to_txq_info(txq); +@@ -3662,7 +3663,8 @@ void ieee80211_schedule_txq(struct ieee8 + spin_lock_bh(&local->active_txq_lock[txq->ac]); + + if (list_empty(&txqi->schedule_order) && +- (!skb_queue_empty(&txqi->frags) || txqi->tin.backlog_packets)) { ++ (force || !skb_queue_empty(&txqi->frags) || ++ txqi->tin.backlog_packets)) { + /* If airtime accounting is active, always enqueue STAs at the + * head of the list to ensure that they only get moved to the + * back by the airtime DRR scheduler once they have a negative +@@ -3682,7 +3684,7 @@ void ieee80211_schedule_txq(struct ieee8 + + spin_unlock_bh(&local->active_txq_lock[txq->ac]); + } +-EXPORT_SYMBOL(ieee80211_schedule_txq); ++EXPORT_SYMBOL(__ieee80211_schedule_txq); + + bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, + struct ieee80211_txq *txq) diff --git a/package/kernel/mac80211/patches/subsys/359-mac80211-un-schedule-TXQs-on-powersave-start.patch b/package/kernel/mac80211/patches/subsys/359-mac80211-un-schedule-TXQs-on-powersave-start.patch new file mode 100644 index 00000000000000..1abb2db7c2e699 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/359-mac80211-un-schedule-TXQs-on-powersave-start.patch @@ -0,0 +1,31 @@ +From: Felix Fietkau +Date: Tue, 19 Mar 2019 11:36:12 +0100 +Subject: [PATCH] mac80211: un-schedule TXQs on powersave start + +Once a station enters powersave, its queues should not be returned by +ieee80211_next_txq() anymore. They will be re-scheduled again after the +station has woken up again + +Fixes: 1866760096bf4 ("mac80211: Add TXQ scheduling API") +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -1508,7 +1508,15 @@ static void sta_ps_start(struct sta_info + return; + + for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) { +- if (txq_has_queue(sta->sta.txq[tid])) ++ struct ieee80211_txq *txq = sta->sta.txq[tid]; ++ struct txq_info *txqi = to_txq_info(txq); ++ ++ spin_lock(&local->active_txq_lock[txq->ac]); ++ if (!list_empty(&txqi->schedule_order)) ++ list_del_init(&txqi->schedule_order); ++ spin_unlock(&local->active_txq_lock[txq->ac]); ++ ++ if (txq_has_queue(txq)) + set_bit(tid, &sta->txq_buffered_tids); + else + clear_bit(tid, &sta->txq_buffered_tids); diff --git a/package/kernel/mac80211/patches/subsys/360-mac80211-when-using-iTXQ-select-the-queue-in-ieee802.patch b/package/kernel/mac80211/patches/subsys/360-mac80211-when-using-iTXQ-select-the-queue-in-ieee802.patch new file mode 100644 index 00000000000000..6009ab74d8bb1c --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/360-mac80211-when-using-iTXQ-select-the-queue-in-ieee802.patch @@ -0,0 +1,183 @@ +From: Felix Fietkau +Date: Fri, 22 Mar 2019 18:06:03 +0100 +Subject: [PATCH] mac80211: when using iTXQ, select the queue in + ieee80211_subif_start_xmit + +When using iTXQ, the network stack does not need the real queue number, since +mac80211 is using its internal queues anyway. In that case we can defer +selecting the queue and remove a redundant station lookup in the tx path to save +some CPU cycles. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3751,6 +3751,7 @@ void __ieee80211_subif_start_xmit(struct + u32 info_flags) + { + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); ++ struct ieee80211_local *local = sdata->local; + struct sta_info *sta; + struct sk_buff *next; + +@@ -3764,7 +3765,15 @@ void __ieee80211_subif_start_xmit(struct + if (ieee80211_lookup_ra_sta(sdata, skb, &sta)) + goto out_free; + +- if (!IS_ERR_OR_NULL(sta)) { ++ if (IS_ERR(sta)) ++ sta = NULL; ++ ++ if (local->ops->wake_tx_queue) { ++ u16 queue = __ieee80211_select_queue(sdata, sta, skb); ++ skb_set_queue_mapping(skb, queue); ++ } ++ ++ if (sta) { + struct ieee80211_fast_tx *fast_tx; + + /* We need a bit of data queued to build aggregates properly, so +--- a/net/mac80211/wme.c ++++ b/net/mac80211/wme.c +@@ -141,6 +141,42 @@ u16 ieee80211_select_queue_80211(struct + return ieee80211_downgrade_queue(sdata, NULL, skb); + } + ++u16 __ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, ++ struct sta_info *sta, struct sk_buff *skb) ++{ ++ struct mac80211_qos_map *qos_map; ++ bool qos; ++ ++ /* all mesh/ocb stations are required to support WME */ ++ if (sdata->vif.type == NL80211_IFTYPE_MESH_POINT || ++ sdata->vif.type == NL80211_IFTYPE_OCB) ++ qos = true; ++ else if (sta) ++ qos = sta->sta.wme; ++ else ++ qos = false; ++ ++ if (!qos) { ++ skb->priority = 0; /* required for correct WPA/11i MIC */ ++ return IEEE80211_AC_BE; ++ } ++ ++ if (skb->protocol == sdata->control_port_protocol) { ++ skb->priority = 7; ++ goto downgrade; ++ } ++ ++ /* use the data classifier to determine what 802.1d tag the ++ * data frame has */ ++ qos_map = rcu_dereference(sdata->qos_map); ++ skb->priority = cfg80211_classify8021d(skb, qos_map ? ++ &qos_map->qos_map : NULL); ++ ++ downgrade: ++ return ieee80211_downgrade_queue(sdata, sta, skb); ++} ++ ++ + /* Indicate which queue to use. */ + u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, + struct sk_buff *skb) +@@ -148,10 +184,12 @@ u16 ieee80211_select_queue(struct ieee80 + struct ieee80211_local *local = sdata->local; + struct sta_info *sta = NULL; + const u8 *ra = NULL; +- bool qos = false; +- struct mac80211_qos_map *qos_map; + u16 ret; + ++ /* when using iTXQ, we can do this later */ ++ if (local->ops->wake_tx_queue) ++ return 0; ++ + if (local->hw.queues < IEEE80211_NUM_ACS || skb->len < 6) { + skb->priority = 0; /* required for correct WPA/11i MIC */ + return 0; +@@ -161,10 +199,8 @@ u16 ieee80211_select_queue(struct ieee80 + switch (sdata->vif.type) { + case NL80211_IFTYPE_AP_VLAN: + sta = rcu_dereference(sdata->u.vlan.sta); +- if (sta) { +- qos = sta->sta.wme; ++ if (sta) + break; +- } + /* fall through */ + case NL80211_IFTYPE_AP: + ra = skb->data; +@@ -172,56 +208,26 @@ u16 ieee80211_select_queue(struct ieee80 + case NL80211_IFTYPE_WDS: + ra = sdata->u.wds.remote_addr; + break; +-#ifdef CPTCFG_MAC80211_MESH +- case NL80211_IFTYPE_MESH_POINT: +- qos = true; +- break; +-#endif + case NL80211_IFTYPE_STATION: + /* might be a TDLS station */ + sta = sta_info_get(sdata, skb->data); + if (sta) +- qos = sta->sta.wme; ++ break; + + ra = sdata->u.mgd.bssid; + break; + case NL80211_IFTYPE_ADHOC: + ra = skb->data; + break; +- case NL80211_IFTYPE_OCB: +- /* all stations are required to support WME */ +- qos = true; +- break; + default: + break; + } + +- if (!sta && ra && !is_multicast_ether_addr(ra)) { ++ if (!sta && ra && !is_multicast_ether_addr(ra)) + sta = sta_info_get(sdata, ra); +- if (sta) +- qos = sta->sta.wme; +- } + +- if (!qos) { +- skb->priority = 0; /* required for correct WPA/11i MIC */ +- ret = IEEE80211_AC_BE; +- goto out; +- } ++ ret = __ieee80211_select_queue(sdata, sta, skb); + +- if (skb->protocol == sdata->control_port_protocol) { +- skb->priority = 7; +- goto downgrade; +- } +- +- /* use the data classifier to determine what 802.1d tag the +- * data frame has */ +- qos_map = rcu_dereference(sdata->qos_map); +- skb->priority = cfg80211_classify8021d(skb, qos_map ? +- &qos_map->qos_map : NULL); +- +- downgrade: +- ret = ieee80211_downgrade_queue(sdata, sta, skb); +- out: + rcu_read_unlock(); + return ret; + } +--- a/net/mac80211/wme.h ++++ b/net/mac80211/wme.h +@@ -16,6 +16,8 @@ + u16 ieee80211_select_queue_80211(struct ieee80211_sub_if_data *sdata, + struct sk_buff *skb, + struct ieee80211_hdr *hdr); ++u16 __ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, ++ struct sta_info *sta, struct sk_buff *skb); + u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, + struct sk_buff *skb); + void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata, diff --git a/package/kernel/mac80211/patches/subsys/361-mac80211-add-IEEE80211_KEY_FLAG_GENERATE_MMIE-to-iee.patch b/package/kernel/mac80211/patches/subsys/361-mac80211-add-IEEE80211_KEY_FLAG_GENERATE_MMIE-to-iee.patch new file mode 100644 index 00000000000000..f7e022ca0caf64 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/361-mac80211-add-IEEE80211_KEY_FLAG_GENERATE_MMIE-to-iee.patch @@ -0,0 +1,58 @@ +From: Lorenzo Bianconi +Date: Tue, 16 Jul 2019 00:09:19 +0200 +Subject: [PATCH] mac80211: add IEEE80211_KEY_FLAG_GENERATE_MMIE to + ieee80211_key_flags + +Add IEEE80211_KEY_FLAG_GENERATE_MMIE flag to ieee80211_key_flags in order +to allow the driver to notify mac80211 to generate MMIE and that it +requires sequence number generation only. +This is a preliminary patch to add BIP_CMAC_128 hw support to mt7615 +driver + +Signed-off-by: Lorenzo Bianconi +Link: https://lore.kernel.org/r/dfe275f9aa0f1cc6b33085f9efd5d8447f68ad13.1563228405.git.lorenzo@kernel.org +Signed-off-by: Johannes Berg +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -1616,6 +1616,9 @@ struct wireless_dev *ieee80211_vif_to_wd + * @IEEE80211_KEY_FLAG_PUT_MIC_SPACE: This flag should be set by the driver for + * a TKIP key if it only requires MIC space. Do not set together with + * @IEEE80211_KEY_FLAG_GENERATE_MMIC on the same key. ++ * @IEEE80211_KEY_FLAG_GENERATE_MMIE: This flag should be set by the driver ++ * for a AES_CMAC key to indicate that it requires sequence number ++ * generation only + */ + enum ieee80211_key_flags { + IEEE80211_KEY_FLAG_GENERATE_IV_MGMT = BIT(0), +@@ -1627,6 +1630,7 @@ enum ieee80211_key_flags { + IEEE80211_KEY_FLAG_RX_MGMT = BIT(6), + IEEE80211_KEY_FLAG_RESERVE_TAILROOM = BIT(7), + IEEE80211_KEY_FLAG_PUT_MIC_SPACE = BIT(8), ++ IEEE80211_KEY_FLAG_GENERATE_MMIE = BIT(10), + }; + + /** +--- a/net/mac80211/wpa.c ++++ b/net/mac80211/wpa.c +@@ -947,7 +947,8 @@ ieee80211_crypto_aes_cmac_encrypt(struct + + info = IEEE80211_SKB_CB(skb); + +- if (info->control.hw_key) ++ if (info->control.hw_key && ++ !(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIE)) + return TX_CONTINUE; + + if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie))) +@@ -963,6 +964,9 @@ ieee80211_crypto_aes_cmac_encrypt(struct + + bip_ipn_set64(mmie->sequence_number, pn64); + ++ if (info->control.hw_key) ++ return TX_CONTINUE; ++ + bip_aad(skb, aad); + + /* diff --git a/package/kernel/mac80211/patches/subsys/362-mac80211-minstrel-remove-divisions-in-tx-status-path.patch b/package/kernel/mac80211/patches/subsys/362-mac80211-minstrel-remove-divisions-in-tx-status-path.patch new file mode 100644 index 00000000000000..d38d33b41e6505 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/362-mac80211-minstrel-remove-divisions-in-tx-status-path.patch @@ -0,0 +1,61 @@ +From: Felix Fietkau +Date: Sat, 28 Sep 2019 15:44:06 +0200 +Subject: [PATCH] mac80211: minstrel: remove divisions in tx status path + +Use a slightly different threshold for downgrading spatial streams to +make it easier to calculate without divisions. +Slightly reduces CPU overhead. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel.c ++++ b/net/mac80211/rc80211_minstrel.c +@@ -295,8 +295,7 @@ minstrel_tx_status(void *priv, struct ie + if (mi->sample_deferred > 0) + mi->sample_deferred--; + +- if (time_after(jiffies, mi->last_stats_update + +- (mp->update_interval * HZ) / 1000)) ++ if (time_after(jiffies, mi->last_stats_update + mp->update_interval)) + minstrel_update_stats(mp, mi); + } + +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -937,23 +937,21 @@ minstrel_ht_tx_status(void *priv, struct + */ + rate = minstrel_get_ratestats(mi, mi->max_tp_rate[0]); + if (rate->attempts > 30 && +- MINSTREL_FRAC(rate->success, rate->attempts) < +- MINSTREL_FRAC(20, 100)) { ++ rate->success < rate->attempts / 4) { + minstrel_downgrade_rate(mi, &mi->max_tp_rate[0], true); + update = true; + } + + rate2 = minstrel_get_ratestats(mi, mi->max_tp_rate[1]); + if (rate2->attempts > 30 && +- MINSTREL_FRAC(rate2->success, rate2->attempts) < +- MINSTREL_FRAC(20, 100)) { ++ rate2->success < rate2->attempts / 4) { + minstrel_downgrade_rate(mi, &mi->max_tp_rate[1], false); + update = true; + } + } + + if (time_after(jiffies, mi->last_stats_update + +- (mp->update_interval / 2 * HZ) / 1000)) { ++ mp->update_interval / 2)) { + update = true; + minstrel_ht_update_stats(mp, mi, true); + } +@@ -1640,7 +1638,7 @@ minstrel_ht_alloc(struct ieee80211_hw *h + mp->has_mrr = true; + + mp->hw = hw; +- mp->update_interval = 100; ++ mp->update_interval = HZ / 10; + + #ifdef CPTCFG_MAC80211_DEBUGFS + mp->fixed_rate_idx = (u32) -1; diff --git a/package/kernel/mac80211/patches/subsys/363-mac80211-minstrel_ht-replace-rate-stats-ewma-with-a-.patch b/package/kernel/mac80211/patches/subsys/363-mac80211-minstrel_ht-replace-rate-stats-ewma-with-a-.patch new file mode 100644 index 00000000000000..5e2a017865f18d --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/363-mac80211-minstrel_ht-replace-rate-stats-ewma-with-a-.patch @@ -0,0 +1,235 @@ +From: Felix Fietkau +Date: Sat, 28 Sep 2019 15:46:06 +0200 +Subject: [PATCH] mac80211: minstrel_ht: replace rate stats ewma with a + better moving average + +Rate success probability usually fluctuates a lot under normal conditions. +With a simple EWMA, noise and fluctuation can be reduced by increasing the +window length, but that comes at the cost of introducing lag on sudden +changes. + +This change replaces the EWMA implementation with a moving average that's +designed to significantly reduce lag while keeping a bigger window size +by being better at filtering out noise. + +It is only slightly more expensive than the simple EWMA and still avoids +divisions in its calculation. + +The algorithm is adapted from an implementation intended for a completely +different field (stock market trading), where the tradeoff of lag vs +noise filtering is equally important. + +The algorithm works in the same way as the "smoothing filter" from +http://www.stockspotter.com/files/PredictiveIndicators.pdf adapted for +fixed-point math with some constants, using only addition, bit shifts +and multiplication + +To better make use of the filtering and bigger window size, the update +interval is cut in half. + +For testing, the algorithm can be reverted to the older one via debugfs + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel.c ++++ b/net/mac80211/rc80211_minstrel.c +@@ -157,14 +157,18 @@ minstrel_update_rates(struct minstrel_pr + * Recalculate statistics and counters of a given rate + */ + void +-minstrel_calc_rate_stats(struct minstrel_rate_stats *mrs) ++minstrel_calc_rate_stats(struct minstrel_priv *mp, ++ struct minstrel_rate_stats *mrs) + { + unsigned int cur_prob; + + if (unlikely(mrs->attempts > 0)) { + mrs->sample_skipped = 0; + cur_prob = MINSTREL_FRAC(mrs->success, mrs->attempts); +- if (unlikely(!mrs->att_hist)) { ++ if (mp->new_avg) { ++ mrs->prob_ewma = minstrel_filter_avg_add(&mrs->avg, ++ cur_prob); ++ } else if (unlikely(!mrs->att_hist)) { + mrs->prob_ewma = cur_prob; + } else { + /* update exponential weighted moving variance */ +@@ -206,7 +210,7 @@ minstrel_update_stats(struct minstrel_pr + struct minstrel_rate_stats *tmp_mrs = &mi->r[tmp_prob_rate].stats; + + /* Update statistics of success probability per rate */ +- minstrel_calc_rate_stats(mrs); ++ minstrel_calc_rate_stats(mp, mrs); + + /* Sample less often below the 10% chance of success. + * Sample less often above the 95% chance of success. */ +@@ -295,7 +299,8 @@ minstrel_tx_status(void *priv, struct ie + if (mi->sample_deferred > 0) + mi->sample_deferred--; + +- if (time_after(jiffies, mi->last_stats_update + mp->update_interval)) ++ if (time_after(jiffies, mi->last_stats_update + ++ mp->update_interval / (mp->new_avg ? 2 : 1))) + minstrel_update_stats(mp, mi); + } + +--- a/net/mac80211/rc80211_minstrel.h ++++ b/net/mac80211/rc80211_minstrel.h +@@ -22,6 +22,21 @@ + #define MAX_THR_RATES 4 + + /* ++ * Coefficients for moving average with noise filter (period=16), ++ * scaled by 10 bits ++ * ++ * a1 = exp(-pi * sqrt(2) / period) ++ * coeff2 = 2 * a1 * cos(sqrt(2) * 2 * pi / period) ++ * coeff3 = -sqr(a1) ++ * coeff1 = 1 - coeff2 - coeff3 ++ */ ++#define MINSTREL_AVG_COEFF1 (MINSTREL_FRAC(1, 1) - \ ++ MINSTREL_AVG_COEFF2 - \ ++ MINSTREL_AVG_COEFF3) ++#define MINSTREL_AVG_COEFF2 0x00001499 ++#define MINSTREL_AVG_COEFF3 -0x0000092e ++ ++/* + * Perform EWMA (Exponentially Weighted Moving Average) calculation + */ + static inline int +@@ -48,6 +63,41 @@ minstrel_ewmv(int old_ewmv, int cur_prob + return weight * (old_ewmv + MINSTREL_TRUNC(diff * incr)) / EWMA_DIV; + } + ++struct minstrel_avg_ctx { ++ s32 prev[2]; ++}; ++ ++static inline int minstrel_filter_avg_add(struct minstrel_avg_ctx *ctx, s32 in) ++{ ++ s32 out_1 = ctx->prev[0]; ++ s32 out_2 = ctx->prev[1]; ++ s32 val; ++ ++ if (!in) ++ in += 1; ++ ++ if (!out_1) { ++ val = out_1 = in; ++ goto out; ++ } ++ ++ val = MINSTREL_AVG_COEFF1 * in; ++ val += MINSTREL_AVG_COEFF2 * out_1; ++ val += MINSTREL_AVG_COEFF3 * out_2; ++ val >>= MINSTREL_SCALE; ++ ++ if (val > 1 << MINSTREL_SCALE) ++ val = 1 << MINSTREL_SCALE; ++ if (val < 0) ++ val = 1; ++ ++out: ++ ctx->prev[1] = out_1; ++ ctx->prev[0] = val; ++ ++ return val; ++} ++ + struct minstrel_rate_stats { + /* current / last sampling period attempts/success counters */ + u16 attempts, last_attempts; +@@ -56,6 +106,8 @@ struct minstrel_rate_stats { + /* total attempts/success counters */ + u32 att_hist, succ_hist; + ++ struct minstrel_avg_ctx avg; ++ + /* statistis of packet delivery probability + * prob_ewma - exponential weighted moving average of prob + * prob_ewmsd - exp. weighted moving standard deviation of prob */ +@@ -114,6 +166,7 @@ struct minstrel_sta_info { + struct minstrel_priv { + struct ieee80211_hw *hw; + bool has_mrr; ++ bool new_avg; + u32 sample_switch; + unsigned int cw_min; + unsigned int cw_max; +@@ -153,7 +206,8 @@ extern const struct rate_control_ops mac + void minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); + + /* Recalculate success probabilities and counters for a given rate using EWMA */ +-void minstrel_calc_rate_stats(struct minstrel_rate_stats *mrs); ++void minstrel_calc_rate_stats(struct minstrel_priv *mp, ++ struct minstrel_rate_stats *mrs); + int minstrel_get_tp_avg(struct minstrel_rate *mr, int prob_ewma); + + /* debugfs */ +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -704,7 +704,7 @@ minstrel_ht_update_stats(struct minstrel + + mrs = &mg->rates[i]; + mrs->retry_updated = false; +- minstrel_calc_rate_stats(mrs); ++ minstrel_calc_rate_stats(mp, mrs); + cur_prob = mrs->prob_ewma; + + if (minstrel_ht_get_tp_avg(mi, group, i, cur_prob) == 0) +@@ -740,6 +740,8 @@ minstrel_ht_update_stats(struct minstrel + + /* try to sample all available rates during each interval */ + mi->sample_count *= 8; ++ if (mp->new_avg) ++ mi->sample_count /= 2; + + if (sample) + minstrel_ht_rate_sample_switch(mp, mi); +@@ -856,6 +858,7 @@ minstrel_ht_tx_status(void *priv, struct + struct ieee80211_tx_rate *ar = info->status.rates; + struct minstrel_rate_stats *rate, *rate2, *rate_sample = NULL; + struct minstrel_priv *mp = priv; ++ u32 update_interval = mp->update_interval / 2; + bool last, update = false; + bool sample_status = false; + int i; +@@ -910,6 +913,10 @@ minstrel_ht_tx_status(void *priv, struct + + switch (mi->sample_mode) { + case MINSTREL_SAMPLE_IDLE: ++ if (mp->new_avg && ++ (mp->hw->max_rates > 1 || ++ mi->total_packets_cur < SAMPLE_SWITCH_THR)) ++ update_interval /= 2; + break; + + case MINSTREL_SAMPLE_ACTIVE: +@@ -950,8 +957,7 @@ minstrel_ht_tx_status(void *priv, struct + } + } + +- if (time_after(jiffies, mi->last_stats_update + +- mp->update_interval / 2)) { ++ if (time_after(jiffies, mi->last_stats_update + update_interval)) { + update = true; + minstrel_ht_update_stats(mp, mi, true); + } +@@ -1639,6 +1645,7 @@ minstrel_ht_alloc(struct ieee80211_hw *h + + mp->hw = hw; + mp->update_interval = HZ / 10; ++ mp->new_avg = true; + + #ifdef CPTCFG_MAC80211_DEBUGFS + mp->fixed_rate_idx = (u32) -1; +@@ -1646,6 +1653,8 @@ minstrel_ht_alloc(struct ieee80211_hw *h + &mp->fixed_rate_idx); + debugfs_create_u32("sample_switch", S_IRUGO | S_IWUSR, debugfsdir, + &mp->sample_switch); ++ debugfs_create_bool("new_avg", S_IRUGO | S_IWUSR, debugfsdir, ++ &mp->new_avg); + #endif + + minstrel_ht_init_cck_rates(mp); diff --git a/package/kernel/mac80211/patches/subsys/364-mac80211-minstrel_ht-rename-prob_ewma-to-prob_avg-us.patch b/package/kernel/mac80211/patches/subsys/364-mac80211-minstrel_ht-rename-prob_ewma-to-prob_avg-us.patch new file mode 100644 index 00000000000000..c9196435052f7d --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/364-mac80211-minstrel_ht-rename-prob_ewma-to-prob_avg-us.patch @@ -0,0 +1,437 @@ +From: Felix Fietkau +Date: Tue, 8 Oct 2019 18:54:46 +0200 +Subject: [PATCH] mac80211: minstrel_ht: rename prob_ewma to prob_avg, use it + for the new average + +Reduces per-rate data structure size + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rc80211_minstrel.c ++++ b/net/mac80211/rc80211_minstrel.c +@@ -70,7 +70,7 @@ rix_to_ndx(struct minstrel_sta_info *mi, + } + + /* return current EMWA throughput */ +-int minstrel_get_tp_avg(struct minstrel_rate *mr, int prob_ewma) ++int minstrel_get_tp_avg(struct minstrel_rate *mr, int prob_avg) + { + int usecs; + +@@ -79,13 +79,13 @@ int minstrel_get_tp_avg(struct minstrel_ + usecs = 1000000; + + /* reset thr. below 10% success */ +- if (mr->stats.prob_ewma < MINSTREL_FRAC(10, 100)) ++ if (mr->stats.prob_avg < MINSTREL_FRAC(10, 100)) + return 0; + +- if (prob_ewma > MINSTREL_FRAC(90, 100)) ++ if (prob_avg > MINSTREL_FRAC(90, 100)) + return MINSTREL_TRUNC(100000 * (MINSTREL_FRAC(90, 100) / usecs)); + else +- return MINSTREL_TRUNC(100000 * (prob_ewma / usecs)); ++ return MINSTREL_TRUNC(100000 * (prob_avg / usecs)); + } + + /* find & sort topmost throughput rates */ +@@ -98,8 +98,8 @@ minstrel_sort_best_tp_rates(struct minst + + for (j = MAX_THR_RATES; j > 0; --j) { + tmp_mrs = &mi->r[tp_list[j - 1]].stats; +- if (minstrel_get_tp_avg(&mi->r[i], cur_mrs->prob_ewma) <= +- minstrel_get_tp_avg(&mi->r[tp_list[j - 1]], tmp_mrs->prob_ewma)) ++ if (minstrel_get_tp_avg(&mi->r[i], cur_mrs->prob_avg) <= ++ minstrel_get_tp_avg(&mi->r[tp_list[j - 1]], tmp_mrs->prob_avg)) + break; + } + +@@ -166,21 +166,21 @@ minstrel_calc_rate_stats(struct minstrel + mrs->sample_skipped = 0; + cur_prob = MINSTREL_FRAC(mrs->success, mrs->attempts); + if (mp->new_avg) { +- mrs->prob_ewma = minstrel_filter_avg_add(&mrs->avg, +- cur_prob); ++ minstrel_filter_avg_add(&mrs->prob_avg, ++ &mrs->prob_avg_1, cur_prob); + } else if (unlikely(!mrs->att_hist)) { +- mrs->prob_ewma = cur_prob; ++ mrs->prob_avg = cur_prob; + } else { + /* update exponential weighted moving variance */ + mrs->prob_ewmv = minstrel_ewmv(mrs->prob_ewmv, + cur_prob, +- mrs->prob_ewma, ++ mrs->prob_avg, + EWMA_LEVEL); + + /*update exponential weighted moving avarage */ +- mrs->prob_ewma = minstrel_ewma(mrs->prob_ewma, +- cur_prob, +- EWMA_LEVEL); ++ mrs->prob_avg = minstrel_ewma(mrs->prob_avg, ++ cur_prob, ++ EWMA_LEVEL); + } + mrs->att_hist += mrs->attempts; + mrs->succ_hist += mrs->success; +@@ -214,8 +214,8 @@ minstrel_update_stats(struct minstrel_pr + + /* Sample less often below the 10% chance of success. + * Sample less often above the 95% chance of success. */ +- if (mrs->prob_ewma > MINSTREL_FRAC(95, 100) || +- mrs->prob_ewma < MINSTREL_FRAC(10, 100)) { ++ if (mrs->prob_avg > MINSTREL_FRAC(95, 100) || ++ mrs->prob_avg < MINSTREL_FRAC(10, 100)) { + mr->adjusted_retry_count = mrs->retry_count >> 1; + if (mr->adjusted_retry_count > 2) + mr->adjusted_retry_count = 2; +@@ -235,14 +235,14 @@ minstrel_update_stats(struct minstrel_pr + * choose the maximum throughput rate as max_prob_rate + * (2) if all success probabilities < 95%, the rate with + * highest success probability is chosen as max_prob_rate */ +- if (mrs->prob_ewma >= MINSTREL_FRAC(95, 100)) { +- tmp_cur_tp = minstrel_get_tp_avg(mr, mrs->prob_ewma); ++ if (mrs->prob_avg >= MINSTREL_FRAC(95, 100)) { ++ tmp_cur_tp = minstrel_get_tp_avg(mr, mrs->prob_avg); + tmp_prob_tp = minstrel_get_tp_avg(&mi->r[tmp_prob_rate], +- tmp_mrs->prob_ewma); ++ tmp_mrs->prob_avg); + if (tmp_cur_tp >= tmp_prob_tp) + tmp_prob_rate = i; + } else { +- if (mrs->prob_ewma >= tmp_mrs->prob_ewma) ++ if (mrs->prob_avg >= tmp_mrs->prob_avg) + tmp_prob_rate = i; + } + } +@@ -436,7 +436,7 @@ minstrel_get_rate(void *priv, struct iee + * has a probability of >95%, we shouldn't be attempting + * to use it, as this only wastes precious airtime */ + if (!mrr_capable && +- (mi->r[ndx].stats.prob_ewma > MINSTREL_FRAC(95, 100))) ++ (mi->r[ndx].stats.prob_avg > MINSTREL_FRAC(95, 100))) + return; + + mi->prev_sample = true; +@@ -587,7 +587,7 @@ static u32 minstrel_get_expected_through + * computing cur_tp + */ + tmp_mrs = &mi->r[idx].stats; +- tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma) * 10; ++ tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_avg) * 10; + tmp_cur_tp = tmp_cur_tp * 1200 * 8 / 1024; + + return tmp_cur_tp; +--- a/net/mac80211/rc80211_minstrel.h ++++ b/net/mac80211/rc80211_minstrel.h +@@ -63,14 +63,10 @@ minstrel_ewmv(int old_ewmv, int cur_prob + return weight * (old_ewmv + MINSTREL_TRUNC(diff * incr)) / EWMA_DIV; + } + +-struct minstrel_avg_ctx { +- s32 prev[2]; +-}; +- +-static inline int minstrel_filter_avg_add(struct minstrel_avg_ctx *ctx, s32 in) ++static inline int minstrel_filter_avg_add(u16 *prev_1, u16 *prev_2, s32 in) + { +- s32 out_1 = ctx->prev[0]; +- s32 out_2 = ctx->prev[1]; ++ s32 out_1 = *prev_1; ++ s32 out_2 = *prev_2; + s32 val; + + if (!in) +@@ -92,8 +88,8 @@ static inline int minstrel_filter_avg_ad + val = 1; + + out: +- ctx->prev[1] = out_1; +- ctx->prev[0] = val; ++ *prev_2 = out_1; ++ *prev_1 = val; + + return val; + } +@@ -106,14 +102,15 @@ struct minstrel_rate_stats { + /* total attempts/success counters */ + u32 att_hist, succ_hist; + +- struct minstrel_avg_ctx avg; +- + /* statistis of packet delivery probability + * prob_ewma - exponential weighted moving average of prob + * prob_ewmsd - exp. weighted moving standard deviation of prob */ +- u16 prob_ewma; + u16 prob_ewmv; + ++ /* prob_avg - moving average of prob */ ++ u16 prob_avg; ++ u16 prob_avg_1; ++ + /* maximum retry counts */ + u8 retry_count; + u8 retry_count_rtscts; +@@ -208,7 +205,7 @@ void minstrel_add_sta_debugfs(void *priv + /* Recalculate success probabilities and counters for a given rate using EWMA */ + void minstrel_calc_rate_stats(struct minstrel_priv *mp, + struct minstrel_rate_stats *mrs); +-int minstrel_get_tp_avg(struct minstrel_rate *mr, int prob_ewma); ++int minstrel_get_tp_avg(struct minstrel_rate *mr, int prob_avg); + + /* debugfs */ + int minstrel_stats_open(struct inode *inode, struct file *file); +--- a/net/mac80211/rc80211_minstrel_debugfs.c ++++ b/net/mac80211/rc80211_minstrel_debugfs.c +@@ -91,8 +91,9 @@ minstrel_stats_open(struct inode *inode, + p += sprintf(p, "%6u ", mr->perfect_tx_time); + + tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100)); +- tp_avg = minstrel_get_tp_avg(mr, mrs->prob_ewma); +- eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); ++ tp_avg = minstrel_get_tp_avg(mr, mrs->prob_avg); ++ eprob = MINSTREL_TRUNC(mrs->prob_avg * 1000); ++ + prob_ewmsd = minstrel_get_ewmsd10(mrs); + + p += sprintf(p, "%4u.%1u %4u.%1u %3u.%1u %3u.%1u" +@@ -151,8 +152,8 @@ minstrel_stats_csv_open(struct inode *in + p += sprintf(p, "%u,",mr->perfect_tx_time); + + tp_max = minstrel_get_tp_avg(mr, MINSTREL_FRAC(100,100)); +- tp_avg = minstrel_get_tp_avg(mr, mrs->prob_ewma); +- eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); ++ tp_avg = minstrel_get_tp_avg(mr, mrs->prob_avg); ++ eprob = MINSTREL_TRUNC(mrs->prob_avg * 1000); + prob_ewmsd = minstrel_get_ewmsd10(mrs); + + p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u,%u,%u," +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -313,12 +313,12 @@ minstrel_ht_avg_ampdu_len(struct minstre + */ + int + minstrel_ht_get_tp_avg(struct minstrel_ht_sta *mi, int group, int rate, +- int prob_ewma) ++ int prob_avg) + { + unsigned int nsecs = 0; + + /* do not account throughput if sucess prob is below 10% */ +- if (prob_ewma < MINSTREL_FRAC(10, 100)) ++ if (prob_avg < MINSTREL_FRAC(10, 100)) + return 0; + + if (group != MINSTREL_CCK_GROUP) +@@ -332,11 +332,11 @@ minstrel_ht_get_tp_avg(struct minstrel_h + * account for collision related packet error rate fluctuation + * (prob is scaled - see MINSTREL_FRAC above) + */ +- if (prob_ewma > MINSTREL_FRAC(90, 100)) ++ if (prob_avg > MINSTREL_FRAC(90, 100)) + return MINSTREL_TRUNC(100000 * ((MINSTREL_FRAC(90, 100) * 1000) + / nsecs)); + else +- return MINSTREL_TRUNC(100000 * ((prob_ewma * 1000) / nsecs)); ++ return MINSTREL_TRUNC(100000 * ((prob_avg * 1000) / nsecs)); + } + + /* +@@ -356,13 +356,13 @@ minstrel_ht_sort_best_tp_rates(struct mi + + cur_group = index / MCS_GROUP_RATES; + cur_idx = index % MCS_GROUP_RATES; +- cur_prob = mi->groups[cur_group].rates[cur_idx].prob_ewma; ++ cur_prob = mi->groups[cur_group].rates[cur_idx].prob_avg; + cur_tp_avg = minstrel_ht_get_tp_avg(mi, cur_group, cur_idx, cur_prob); + + do { + tmp_group = tp_list[j - 1] / MCS_GROUP_RATES; + tmp_idx = tp_list[j - 1] % MCS_GROUP_RATES; +- tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_ewma; ++ tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_avg; + tmp_tp_avg = minstrel_ht_get_tp_avg(mi, tmp_group, tmp_idx, + tmp_prob); + if (cur_tp_avg < tmp_tp_avg || +@@ -399,7 +399,7 @@ minstrel_ht_set_best_prob_rate(struct mi + + tmp_group = mi->max_prob_rate / MCS_GROUP_RATES; + tmp_idx = mi->max_prob_rate % MCS_GROUP_RATES; +- tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_ewma; ++ tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_avg; + tmp_tp_avg = minstrel_ht_get_tp_avg(mi, tmp_group, tmp_idx, tmp_prob); + + /* if max_tp_rate[0] is from MCS_GROUP max_prob_rate get selected from +@@ -411,11 +411,11 @@ minstrel_ht_set_best_prob_rate(struct mi + + max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES; + max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES; +- max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma; ++ max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_avg; + +- if (mrs->prob_ewma > MINSTREL_FRAC(75, 100)) { ++ if (mrs->prob_avg > MINSTREL_FRAC(75, 100)) { + cur_tp_avg = minstrel_ht_get_tp_avg(mi, cur_group, cur_idx, +- mrs->prob_ewma); ++ mrs->prob_avg); + if (cur_tp_avg > tmp_tp_avg) + mi->max_prob_rate = index; + +@@ -425,9 +425,9 @@ minstrel_ht_set_best_prob_rate(struct mi + if (cur_tp_avg > max_gpr_tp_avg) + mg->max_group_prob_rate = index; + } else { +- if (mrs->prob_ewma > tmp_prob) ++ if (mrs->prob_avg > tmp_prob) + mi->max_prob_rate = index; +- if (mrs->prob_ewma > max_gpr_prob) ++ if (mrs->prob_avg > max_gpr_prob) + mg->max_group_prob_rate = index; + } + } +@@ -449,12 +449,12 @@ minstrel_ht_assign_best_tp_rates(struct + + tmp_group = tmp_cck_tp_rate[0] / MCS_GROUP_RATES; + tmp_idx = tmp_cck_tp_rate[0] % MCS_GROUP_RATES; +- tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_ewma; ++ tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_avg; + tmp_cck_tp = minstrel_ht_get_tp_avg(mi, tmp_group, tmp_idx, tmp_prob); + + tmp_group = tmp_mcs_tp_rate[0] / MCS_GROUP_RATES; + tmp_idx = tmp_mcs_tp_rate[0] % MCS_GROUP_RATES; +- tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_ewma; ++ tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_avg; + tmp_mcs_tp = minstrel_ht_get_tp_avg(mi, tmp_group, tmp_idx, tmp_prob); + + if (tmp_cck_tp_rate && tmp_cck_tp > tmp_mcs_tp) { +@@ -485,7 +485,7 @@ minstrel_ht_prob_rate_reduce_streams(str + continue; + + tmp_idx = mg->max_group_prob_rate % MCS_GROUP_RATES; +- tmp_prob = mi->groups[group].rates[tmp_idx].prob_ewma; ++ tmp_prob = mi->groups[group].rates[tmp_idx].prob_avg; + + if (tmp_tp < minstrel_ht_get_tp_avg(mi, group, tmp_idx, tmp_prob) && + (minstrel_mcs_groups[group].streams < tmp_max_streams)) { +@@ -590,7 +590,7 @@ minstrel_ht_rate_sample_switch(struct mi + * If that fails, look again for a rate that is at least as fast + */ + mrs = minstrel_get_ratestats(mi, mi->max_tp_rate[0]); +- faster_rate = mrs->prob_ewma > MINSTREL_FRAC(75, 100); ++ faster_rate = mrs->prob_avg > MINSTREL_FRAC(75, 100); + minstrel_ht_find_probe_rates(mi, rates, &n_rates, faster_rate); + if (!n_rates && faster_rate) + minstrel_ht_find_probe_rates(mi, rates, &n_rates, false); +@@ -705,7 +705,7 @@ minstrel_ht_update_stats(struct minstrel + mrs = &mg->rates[i]; + mrs->retry_updated = false; + minstrel_calc_rate_stats(mp, mrs); +- cur_prob = mrs->prob_ewma; ++ cur_prob = mrs->prob_avg; + + if (minstrel_ht_get_tp_avg(mi, group, i, cur_prob) == 0) + continue; +@@ -979,7 +979,7 @@ minstrel_calc_retransmit(struct minstrel + unsigned int overhead = 0, overhead_rtscts = 0; + + mrs = minstrel_get_ratestats(mi, index); +- if (mrs->prob_ewma < MINSTREL_FRAC(1, 10)) { ++ if (mrs->prob_avg < MINSTREL_FRAC(1, 10)) { + mrs->retry_count = 1; + mrs->retry_count_rtscts = 1; + return; +@@ -1036,7 +1036,7 @@ minstrel_ht_set_rate(struct minstrel_pri + if (!mrs->retry_updated) + minstrel_calc_retransmit(mp, mi, index); + +- if (mrs->prob_ewma < MINSTREL_FRAC(20, 100) || !mrs->retry_count) { ++ if (mrs->prob_avg < MINSTREL_FRAC(20, 100) || !mrs->retry_count) { + ratetbl->rate[offset].count = 2; + ratetbl->rate[offset].count_rts = 2; + ratetbl->rate[offset].count_cts = 2; +@@ -1070,11 +1070,11 @@ minstrel_ht_set_rate(struct minstrel_pri + } + + static inline int +-minstrel_ht_get_prob_ewma(struct minstrel_ht_sta *mi, int rate) ++minstrel_ht_get_prob_avg(struct minstrel_ht_sta *mi, int rate) + { + int group = rate / MCS_GROUP_RATES; + rate %= MCS_GROUP_RATES; +- return mi->groups[group].rates[rate].prob_ewma; ++ return mi->groups[group].rates[rate].prob_avg; + } + + static int +@@ -1086,7 +1086,7 @@ minstrel_ht_get_max_amsdu_len(struct min + unsigned int duration; + + /* Disable A-MSDU if max_prob_rate is bad */ +- if (mi->groups[group].rates[rate].prob_ewma < MINSTREL_FRAC(50, 100)) ++ if (mi->groups[group].rates[rate].prob_avg < MINSTREL_FRAC(50, 100)) + return 1; + + duration = g->duration[rate]; +@@ -1109,7 +1109,7 @@ minstrel_ht_get_max_amsdu_len(struct min + * data packet size + */ + if (duration > MCS_DURATION(1, 0, 260) || +- (minstrel_ht_get_prob_ewma(mi, mi->max_tp_rate[0]) < ++ (minstrel_ht_get_prob_avg(mi, mi->max_tp_rate[0]) < + MINSTREL_FRAC(75, 100))) + return 3200; + +@@ -1216,7 +1216,7 @@ minstrel_get_sample_rate(struct minstrel + * rate, to avoid wasting airtime. + */ + sample_dur = minstrel_get_duration(sample_idx); +- if (mrs->prob_ewma > MINSTREL_FRAC(95, 100) || ++ if (mrs->prob_avg > MINSTREL_FRAC(95, 100) || + minstrel_get_duration(mi->max_prob_rate) * 3 < sample_dur) + return -1; + +@@ -1679,7 +1679,7 @@ static u32 minstrel_ht_get_expected_thro + + i = mi->max_tp_rate[0] / MCS_GROUP_RATES; + j = mi->max_tp_rate[0] % MCS_GROUP_RATES; +- prob = mi->groups[i].rates[j].prob_ewma; ++ prob = mi->groups[i].rates[j].prob_avg; + + /* convert tp_avg from pkt per second in kbps */ + tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * 10; +--- a/net/mac80211/rc80211_minstrel_ht.h ++++ b/net/mac80211/rc80211_minstrel_ht.h +@@ -122,6 +122,6 @@ struct minstrel_ht_sta_priv { + + void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); + int minstrel_ht_get_tp_avg(struct minstrel_ht_sta *mi, int group, int rate, +- int prob_ewma); ++ int prob_avg); + + #endif +--- a/net/mac80211/rc80211_minstrel_ht_debugfs.c ++++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c +@@ -102,8 +102,8 @@ minstrel_ht_stats_dump(struct minstrel_h + p += sprintf(p, "%6u ", tx_time); + + tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100)); +- tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_ewma); +- eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); ++ tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_avg); ++ eprob = MINSTREL_TRUNC(mrs->prob_avg * 1000); + prob_ewmsd = minstrel_get_ewmsd10(mrs); + + p += sprintf(p, "%4u.%1u %4u.%1u %3u.%1u %3u.%1u" +@@ -250,8 +250,8 @@ minstrel_ht_stats_csv_dump(struct minstr + p += sprintf(p, "%u,", tx_time); + + tp_max = minstrel_ht_get_tp_avg(mi, i, j, MINSTREL_FRAC(100, 100)); +- tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_ewma); +- eprob = MINSTREL_TRUNC(mrs->prob_ewma * 1000); ++ tp_avg = minstrel_ht_get_tp_avg(mi, i, j, mrs->prob_avg); ++ eprob = MINSTREL_TRUNC(mrs->prob_avg * 1000); + prob_ewmsd = minstrel_get_ewmsd10(mrs); + + p += sprintf(p, "%u.%u,%u.%u,%u.%u,%u.%u,%u,%u," diff --git a/package/kernel/mac80211/patches/subsys/365-mac80211-IBSS-send-deauth-when-expiring-inactive-STA.patch b/package/kernel/mac80211/patches/subsys/365-mac80211-IBSS-send-deauth-when-expiring-inactive-STA.patch new file mode 100644 index 00000000000000..61b6d2b8d4e39c --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/365-mac80211-IBSS-send-deauth-when-expiring-inactive-STA.patch @@ -0,0 +1,128 @@ +From 4b08d1b6a994dbb593557bd2095ba4f0c3c47819 Mon Sep 17 00:00:00 2001 +From: Johannes Berg +Date: Fri, 30 Aug 2019 14:24:51 +0300 +Subject: [PATCH] mac80211: IBSS: send deauth when expiring inactive STAs + +When we expire an inactive station, try to send it a deauth. This +helps if it's actually still around, and just has issues with +beacon distribution (or we do), and it will not also remove us. +Then, if we have shared state, this may not be reset properly, +causing problems; for example, we saw a case where aggregation +sessions weren't removed properly (due to the TX start being +offloaded to firmware and it relying on deauth for stop), causing +a lot of traffic to get lost due to the SN reset after remove/add +of the peer. + +Signed-off-by: Johannes Berg +Signed-off-by: Luca Coelho +Link: https://lore.kernel.org/r/20190830112451.21655-9-luca@coelho.fi +Signed-off-by: Johannes Berg +--- + net/mac80211/ibss.c | 8 ++++++++ + net/mac80211/ieee80211_i.h | 3 ++- + net/mac80211/mlme.c | 11 ++++++----- + net/mac80211/util.c | 5 +++-- + 4 files changed, 19 insertions(+), 8 deletions(-) + +--- a/net/mac80211/ibss.c ++++ b/net/mac80211/ibss.c +@@ -1253,6 +1253,7 @@ void ieee80211_ibss_rx_no_sta(struct iee + + static void ieee80211_ibss_sta_expire(struct ieee80211_sub_if_data *sdata) + { ++ struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; + struct ieee80211_local *local = sdata->local; + struct sta_info *sta, *tmp; + unsigned long exp_time = IEEE80211_IBSS_INACTIVITY_LIMIT; +@@ -1269,10 +1270,17 @@ static void ieee80211_ibss_sta_expire(st + if (time_is_before_jiffies(last_active + exp_time) || + (time_is_before_jiffies(last_active + exp_rsn) && + sta->sta_state != IEEE80211_STA_AUTHORIZED)) { ++ u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN]; ++ + sta_dbg(sta->sdata, "expiring inactive %sSTA %pM\n", + sta->sta_state != IEEE80211_STA_AUTHORIZED ? + "not authorized " : "", sta->sta.addr); + ++ ieee80211_send_deauth_disassoc(sdata, sta->sta.addr, ++ ifibss->bssid, ++ IEEE80211_STYPE_DEAUTH, ++ WLAN_REASON_DEAUTH_LEAVING, ++ true, frame_buf); + WARN_ON(__sta_info_destroy(sta)); + } + } +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -2070,7 +2070,8 @@ void ieee80211_send_auth(struct ieee8021 + const u8 *da, const u8 *key, u8 key_len, u8 key_idx, + u32 tx_flags); + void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata, +- const u8 *bssid, u16 stype, u16 reason, ++ const u8 *da, const u8 *bssid, ++ u16 stype, u16 reason, + bool send_frame, u8 *frame_buf); + + enum { +--- a/net/mac80211/mlme.c ++++ b/net/mac80211/mlme.c +@@ -2203,8 +2203,9 @@ static void ieee80211_set_disassoc(struc + !ifmgd->have_beacon) + drv_mgd_prepare_tx(sdata->local, sdata, 0); + +- ieee80211_send_deauth_disassoc(sdata, ifmgd->bssid, stype, +- reason, tx, frame_buf); ++ ieee80211_send_deauth_disassoc(sdata, ifmgd->bssid, ++ ifmgd->bssid, stype, reason, ++ tx, frame_buf); + } + + /* flush out frame - make sure the deauth was actually sent */ +@@ -4369,7 +4370,7 @@ void ieee80211_mgd_quiesce(struct ieee80 + * cfg80211 won't know and won't actually abort those attempts, + * thus we need to do that ourselves. + */ +- ieee80211_send_deauth_disassoc(sdata, bssid, ++ ieee80211_send_deauth_disassoc(sdata, bssid, bssid, + IEEE80211_STYPE_DEAUTH, + WLAN_REASON_DEAUTH_LEAVING, + false, frame_buf); +@@ -5349,7 +5350,7 @@ int ieee80211_mgd_deauth(struct ieee8021 + ieee80211_get_reason_code_string(req->reason_code)); + + drv_mgd_prepare_tx(sdata->local, sdata, 0); +- ieee80211_send_deauth_disassoc(sdata, req->bssid, ++ ieee80211_send_deauth_disassoc(sdata, req->bssid, req->bssid, + IEEE80211_STYPE_DEAUTH, + req->reason_code, tx, + frame_buf); +@@ -5369,7 +5370,7 @@ int ieee80211_mgd_deauth(struct ieee8021 + ieee80211_get_reason_code_string(req->reason_code)); + + drv_mgd_prepare_tx(sdata->local, sdata, 0); +- ieee80211_send_deauth_disassoc(sdata, req->bssid, ++ ieee80211_send_deauth_disassoc(sdata, req->bssid, req->bssid, + IEEE80211_STYPE_DEAUTH, + req->reason_code, tx, + frame_buf); +--- a/net/mac80211/util.c ++++ b/net/mac80211/util.c +@@ -1427,7 +1427,8 @@ void ieee80211_send_auth(struct ieee8021 + } + + void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata, +- const u8 *bssid, u16 stype, u16 reason, ++ const u8 *da, const u8 *bssid, ++ u16 stype, u16 reason, + bool send_frame, u8 *frame_buf) + { + struct ieee80211_local *local = sdata->local; +@@ -1438,7 +1439,7 @@ void ieee80211_send_deauth_disassoc(stru + mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | stype); + mgmt->duration = 0; /* initialize only */ + mgmt->seq_ctrl = 0; /* initialize only */ +- memcpy(mgmt->da, bssid, ETH_ALEN); ++ memcpy(mgmt->da, da, ETH_ALEN); + memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); + memcpy(mgmt->bssid, bssid, ETH_ALEN); + /* u.deauth.reason_code == u.disassoc.reason_code */ diff --git a/package/kernel/mac80211/patches/subsys/366-mac80211-accept-deauth-frames-in-IBSS-mode.patch b/package/kernel/mac80211/patches/subsys/366-mac80211-accept-deauth-frames-in-IBSS-mode.patch new file mode 100644 index 00000000000000..292cf55843cf74 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/366-mac80211-accept-deauth-frames-in-IBSS-mode.patch @@ -0,0 +1,39 @@ +From 95697f9907bfe3eab0ef20265a766b22e27dde64 Mon Sep 17 00:00:00 2001 +From: Johannes Berg +Date: Fri, 4 Oct 2019 15:37:05 +0300 +Subject: [PATCH] mac80211: accept deauth frames in IBSS mode + +We can process deauth frames and all, but we drop them very +early in the RX path today - this could never have worked. + +Fixes: 2cc59e784b54 ("mac80211: reply to AUTH with DEAUTH if sta allocation fails in IBSS") +Signed-off-by: Johannes Berg +Signed-off-by: Luca Coelho +Link: https://lore.kernel.org/r/20191004123706.15768-2-luca@coelho.fi +Signed-off-by: Johannes Berg +--- + net/mac80211/rx.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -3407,9 +3407,18 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_ + case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP): + /* process for all: mesh, mlme, ibss */ + break; ++ case cpu_to_le16(IEEE80211_STYPE_DEAUTH): ++ if (is_multicast_ether_addr(mgmt->da) && ++ !is_broadcast_ether_addr(mgmt->da)) ++ return RX_DROP_MONITOR; ++ ++ /* process only for station/IBSS */ ++ if (sdata->vif.type != NL80211_IFTYPE_STATION && ++ sdata->vif.type != NL80211_IFTYPE_ADHOC) ++ return RX_DROP_MONITOR; ++ break; + case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP): + case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP): +- case cpu_to_le16(IEEE80211_STYPE_DEAUTH): + case cpu_to_le16(IEEE80211_STYPE_DISASSOC): + if (is_multicast_ether_addr(mgmt->da) && + !is_broadcast_ether_addr(mgmt->da)) diff --git a/package/kernel/mac80211/patches/subsys/367-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch b/package/kernel/mac80211/patches/subsys/367-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch new file mode 100644 index 00000000000000..58158b58e627c9 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/367-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch @@ -0,0 +1,38 @@ +From b478e06a16a8baa00c5ecc87c1d636981f2206d5 Mon Sep 17 00:00:00 2001 +From: Johannes Berg +Date: Tue, 29 Oct 2019 10:25:25 +0100 +Subject: [PATCH] mac80211: sta: randomize BA session dialog token allocator + +We currently always start the dialog token generator at zero, +so the first dialog token we use is always 1. This would be +OK if we had a perfect guarantee that we always do a proper +deauth/re-auth handshake, but in IBSS mode this doesn't always +happen properly. + +To make problems with block ack (aggregation) sessions getting +stuck less likely, randomize the dialog token so if we start a +new session but the peer still has old state for us, it can +better detect this. + +This is really just a workaround to make things a bit more +robust than they are now - a better fix would be to do a full +authentication handshake in IBSS mode upon having discovered a +new station, and on the receiver resetting the state (removing +and re-adding the station) on receiving the authentication +packet. + +Signed-off-by: Johannes Berg +--- + net/mac80211/sta_info.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -322,6 +322,7 @@ struct sta_info *sta_info_alloc(struct i + INIT_WORK(&sta->drv_deliver_wk, sta_deliver_ps_frames); + INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work); + mutex_init(&sta->ampdu_mlme.mtx); ++ sta->ampdu_mlme.dialog_token_allocator = prandom_u32_max(U8_MAX); + #ifdef CPTCFG_MAC80211_MESH + if (ieee80211_vif_is_mesh(&sdata->vif)) { + sta->mesh = kzalloc(sizeof(*sta->mesh), gfp); diff --git a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/522-mac80211_configure_antenna_gain.patch similarity index 79% rename from package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch rename to package/kernel/mac80211/patches/subsys/522-mac80211_configure_antenna_gain.patch index 19f0ff2ae9701c..81007b87cc4bf9 100644 --- a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/subsys/522-mac80211_configure_antenna_gain.patch @@ -1,6 +1,6 @@ --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h -@@ -2750,6 +2750,7 @@ struct cfg80211_pmk_conf { +@@ -2968,6 +2968,7 @@ struct cfg80211_external_auth_params { * (as advertised by the nl80211 feature flag.) * @get_tx_power: store the current TX power into the dbm variable; * return 0 if successful @@ -8,7 +8,7 @@ * * @set_wds_peer: set the WDS peer for a WDS interface * -@@ -3041,6 +3042,7 @@ struct cfg80211_ops { +@@ -3268,6 +3269,7 @@ struct cfg80211_ops { enum nl80211_tx_power_setting type, int mbm); int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, int *dbm); @@ -18,7 +18,7 @@ const u8 *addr); --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -1338,6 +1338,7 @@ enum ieee80211_smps_mode { +@@ -1395,6 +1395,7 @@ enum ieee80211_smps_mode { * * @power_level: requested transmit power (in dBm), backward compatibility * value only that is set to the minimum of all interfaces @@ -26,7 +26,7 @@ * * @chandef: the channel definition to tune to * @radar_enabled: whether radar detection is enabled -@@ -1358,6 +1359,7 @@ enum ieee80211_smps_mode { +@@ -1415,6 +1416,7 @@ enum ieee80211_smps_mode { struct ieee80211_conf { u32 flags; int power_level, dynamic_ps_timeout; @@ -36,9 +36,9 @@ u8 ps_dtim_period; --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h -@@ -2153,6 +2153,9 @@ enum nl80211_commands { - * @NL80211_ATTR_PMKR0_NAME: PMK-R0 Name for offloaded FT. - * @NL80211_ATTR_PORT_AUTHORIZED: (reserved) +@@ -2244,6 +2244,9 @@ enum nl80211_commands { + * @NL80211_ATTR_AIRTIME_WEIGHT: Station's weight when scheduled by the airtime + * scheduler. * + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce + * transmit power to stay within regulatory limits. u32, dBi. @@ -46,9 +46,9 @@ * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use -@@ -2579,6 +2582,8 @@ enum nl80211_attrs { - NL80211_ATTR_PMKR0_NAME, - NL80211_ATTR_PORT_AUTHORIZED, +@@ -2693,6 +2696,8 @@ enum nl80211_attrs { + + NL80211_ATTR_AIRTIME_WEIGHT, + NL80211_ATTR_WIPHY_ANTENNA_GAIN, + @@ -57,7 +57,7 @@ __NL80211_ATTR_AFTER_LAST, --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2447,6 +2447,19 @@ static int ieee80211_get_tx_power(struct +@@ -2456,6 +2456,19 @@ static int ieee80211_get_tx_power(struct return 0; } @@ -77,7 +77,7 @@ static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev, const u8 *addr) { -@@ -3721,6 +3734,7 @@ const struct cfg80211_ops mac80211_confi +@@ -3823,6 +3836,7 @@ const struct cfg80211_ops mac80211_confi .set_wiphy_params = ieee80211_set_wiphy_params, .set_tx_power = ieee80211_set_tx_power, .get_tx_power = ieee80211_get_tx_power, @@ -87,7 +87,7 @@ CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd) --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -1348,6 +1348,7 @@ struct ieee80211_local { +@@ -1365,6 +1365,7 @@ struct ieee80211_local { int dynamic_ps_forced_timeout; int user_power_level; /* in dBm, for all interfaces */ @@ -97,7 +97,7 @@ --- a/net/mac80211/main.c +++ b/net/mac80211/main.c -@@ -93,7 +93,7 @@ static u32 ieee80211_hw_conf_chan(struct +@@ -94,7 +94,7 @@ static u32 ieee80211_hw_conf_chan(struct struct ieee80211_sub_if_data *sdata; struct cfg80211_chan_def chandef = {}; u32 changed = 0; @@ -106,7 +106,7 @@ u32 offchannel_flag; offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL; -@@ -150,6 +150,12 @@ static u32 ieee80211_hw_conf_chan(struct +@@ -151,6 +151,12 @@ static u32 ieee80211_hw_conf_chan(struct } rcu_read_unlock(); @@ -119,7 +119,7 @@ if (local->hw.conf.power_level != power) { changed |= IEEE80211_CONF_CHANGE_POWER; local->hw.conf.power_level = power; -@@ -592,6 +598,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ +@@ -626,6 +632,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ IEEE80211_RADIOTAP_MCS_HAVE_BW; local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI | IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH; @@ -129,15 +129,15 @@ local->user_power_level = IEEE80211_UNSET_POWER_LEVEL; --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -420,6 +420,7 @@ static const struct nla_policy nl80211_p - [NL80211_ATTR_FILS_CACHE_ID] = { .len = 2 }, - [NL80211_ATTR_PMK] = { .type = NLA_BINARY, .len = PMK_MAX_LEN }, - [NL80211_ATTR_SCHED_SCAN_MULTI] = { .type = NLA_FLAG }, +@@ -464,6 +464,7 @@ static const struct nla_policy nl80211_p + [NL80211_ATTR_HE_CAPABILITY] = { .type = NLA_BINARY, + .len = NL80211_HE_MAX_CAPABILITY_LEN }, + [NL80211_ATTR_AIRTIME_WEIGHT] = NLA_POLICY_MIN(NLA_U16, 1), + [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 }, }; /* policy for the key attributes */ -@@ -2395,6 +2396,20 @@ static int nl80211_set_wiphy(struct sk_b +@@ -2623,6 +2624,20 @@ static int nl80211_set_wiphy(struct sk_b if (result) return result; } diff --git a/package/kernel/mac80211/patches/subsys/600-mac80211-allow-vht-on-2g.patch b/package/kernel/mac80211/patches/subsys/600-mac80211-allow-vht-on-2g.patch new file mode 100644 index 00000000000000..da9fcd21855845 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/600-mac80211-allow-vht-on-2g.patch @@ -0,0 +1,36 @@ +--- a/net/mac80211/vht.c ++++ b/net/mac80211/vht.c +@@ -135,7 +135,8 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(stru + have_80mhz = false; + for (i = 0; i < sband->n_channels; i++) { + if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED | +- IEEE80211_CHAN_NO_80MHZ)) ++ IEEE80211_CHAN_NO_80MHZ) && ++ (sband->band != NL80211_BAND_2GHZ)) + continue; + + have_80mhz = true; +--- a/net/mac80211/util.c ++++ b/net/mac80211/util.c +@@ -1769,7 +1769,8 @@ static int ieee80211_build_preq_ies_band + /* Check if any channel in this sband supports at least 80 MHz */ + for (i = 0; i < sband->n_channels; i++) { + if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED | +- IEEE80211_CHAN_NO_80MHZ)) ++ IEEE80211_CHAN_NO_80MHZ) && ++ (sband->band != NL80211_BAND_2GHZ)) + continue; + + have_80mhz = true; +--- a/net/mac80211/mlme.c ++++ b/net/mac80211/mlme.c +@@ -4824,7 +4824,8 @@ static int ieee80211_prep_channel(struct + have_80mhz = false; + for (i = 0; i < sband->n_channels; i++) { + if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED | +- IEEE80211_CHAN_NO_80MHZ)) ++ IEEE80211_CHAN_NO_80MHZ) && ++ (sband->band != NL80211_BAND_2GHZ)) + continue; + + have_80mhz = true; diff --git a/package/kernel/mac80211/ralink.mk b/package/kernel/mac80211/ralink.mk new file mode 100644 index 00000000000000..6aca170773b8d1 --- /dev/null +++ b/package/kernel/mac80211/ralink.mk @@ -0,0 +1,172 @@ +PKG_DRIVERS += \ + rt2x00-lib rt2x00-pci rt2x00-usb rt2x00-mmio \ + rt2400-pci rt2500-pci rt2500-usb \ + rt2800-lib rt2800-mmio rt2800-pci rt2800-soc rt2800-usb \ + rt61-pci rt73-usb + +PKG_CONFIG_DEPENDS += \ + CONFIG_PACKAGE_RT2X00_LIB_DEBUGFS \ + CONFIG_PACKAGE_RT2X00_DEBUG + +config-$(call config_package,rt2x00-lib) += RT2X00 RT2X00_LIB +config-$(call config_package,rt2x00-pci) += RT2X00_LIB_PCI +config-$(call config_package,rt2x00-mmio) += RT2X00_LIB_MMIO +config-$(call config_package,rt2x00-usb) += RT2X00_LIB_USB +config-$(CONFIG_PACKAGE_RT2X00_LIB_DEBUGFS) += RT2X00_LIB_DEBUGFS +config-$(CONFIG_PACKAGE_RT2X00_DEBUG) += RT2X00_DEBUG + +config-$(call config_package,rt2400-pci) += RT2400PCI +config-$(call config_package,rt2500-pci) += RT2500PCI +config-$(call config_package,rt2500-usb) += RT2500USB +config-$(call config_package,rt61-pci) += RT61PCI +config-$(call config_package,rt73-usb) += RT73USB + +config-$(call config_package,rt2800-lib) += RT2800_LIB + +config-$(call config_package,rt2800-soc) += RT2800SOC +config-$(call config_package,rt2800-pci) += RT2800PCI +config-y += RT2800PCI_RT33XX RT2800PCI_RT35XX RT2800PCI_RT53XX RT2800PCI_RT3290 + +config-$(call config_package,rt2800-usb) += RT2800USB +config-y += RT2800USB_RT33XX RT2800USB_RT35XX RT2800USB_RT3573 RT2800USB_RT53XX RT2800USB_RT55XX RT2800USB_UNKNOWN + +define KernelPackage/rt2x00/Default + $(call KernelPackage/mac80211/Default) + TITLE:=Ralink Drivers for RT2x00 cards +endef + +define KernelPackage/rt2x00-lib +$(call KernelPackage/rt2x00/Default) + DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-mac80211 + TITLE+= (LIB) + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2x00lib.ko + MENU:=1 +endef + +define KernelPackage/rt2x00-lib/config + if PACKAGE_kmod-rt2x00-lib + + config PACKAGE_RT2X00_LIB_DEBUGFS + bool "Enable rt2x00 debugfs support" + depends on PACKAGE_MAC80211_DEBUGFS + help + Enable creation of debugfs files for the rt2x00 drivers. + These debugfs files support both reading and writing of the + most important register types of the rt2x00 hardware. + + config PACKAGE_RT2X00_DEBUG + bool "Enable rt2x00 debug output" + help + Enable debugging output for all rt2x00 modules + + endif +endef + +define KernelPackage/rt2x00-mmio +$(call KernelPackage/rt2x00/Default) + DEPENDS+= @(PCI_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib + HIDDEN:=1 + TITLE+= (MMIO) + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2x00mmio.ko +endef + +define KernelPackage/rt2x00-pci +$(call KernelPackage/rt2x00/Default) + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-mmio +kmod-rt2x00-lib + HIDDEN:=1 + TITLE+= (PCI) + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2x00pci.ko + AUTOLOAD:=$(call AutoProbe,rt2x00pci) +endef + +define KernelPackage/rt2x00-usb +$(call KernelPackage/rt2x00/Default) + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-lib +kmod-usb-core + HIDDEN:=1 + TITLE+= (USB) + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2x00usb.ko + AUTOLOAD:=$(call AutoProbe,rt2x00usb) +endef + +define KernelPackage/rt2800-lib +$(call KernelPackage/rt2x00/Default) + DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-lib-crc-ccitt +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT + HIDDEN:=1 + TITLE+= (rt2800 LIB) + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800lib.ko +endef + +define KernelPackage/rt2400-pci +$(call KernelPackage/rt2x00/Default) + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci +kmod-eeprom-93cx6 + TITLE+= (RT2400 PCI) + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2400pci.ko + AUTOLOAD:=$(call AutoProbe,rt2400pci) +endef + +define KernelPackage/rt2500-pci +$(call KernelPackage/rt2x00/Default) + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci +kmod-eeprom-93cx6 + TITLE+= (RT2500 PCI) + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2500pci.ko + AUTOLOAD:=$(call AutoProbe,rt2500pci) +endef + +define KernelPackage/rt2500-usb +$(call KernelPackage/rt2x00/Default) + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb + TITLE+= (RT2500 USB) + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2500usb.ko + AUTOLOAD:=$(call AutoProbe,rt2500usb) +endef + +define KernelPackage/rt2800-mmio +$(call KernelPackage/rt2x00/Default) + TITLE += (RT28xx/RT3xxx MMIO) + DEPENDS += +kmod-rt2800-lib +kmod-rt2x00-mmio + HIDDEN:=1 + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800mmio.ko +endef + +define KernelPackage/rt2800-soc +$(call KernelPackage/rt2x00/Default) + DEPENDS += @(TARGET_ramips_rt288x||TARGET_ramips_rt305x||TARGET_ramips_rt3883||TARGET_ramips_mt7620) +kmod-rt2800-mmio +kmod-rt2800-lib + TITLE += (RT28xx/RT3xxx SoC) + FILES := \ + $(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2x00soc.ko \ + $(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800soc.ko + AUTOLOAD:=$(call AutoProbe,rt2800soc) +endef + +define KernelPackage/rt2800-pci +$(call KernelPackage/rt2x00/Default) + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci +kmod-rt2800-lib +kmod-rt2800-mmio +kmod-eeprom-93cx6 +rt2800-pci-firmware + TITLE+= (RT2860 PCI) + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800pci.ko + AUTOLOAD:=$(call AutoProbe,rt2800pci) +endef + +define KernelPackage/rt2800-usb +$(call KernelPackage/rt2x00/Default) + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb +kmod-rt2800-lib +kmod-lib-crc-ccitt +rt2800-usb-firmware + TITLE+= (RT2870 USB) + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800usb.ko + AUTOLOAD:=$(call AutoProbe,rt2800usb) +endef + + +define KernelPackage/rt61-pci +$(call KernelPackage/rt2x00/Default) + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci +kmod-eeprom-93cx6 +kmod-lib-crc-itu-t +rt61-pci-firmware + TITLE+= (RT2x61 PCI) + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt61pci.ko + AUTOLOAD:=$(call AutoProbe,rt61pci) +endef + +define KernelPackage/rt73-usb + $(call KernelPackage/rt2x00/Default) + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb +kmod-lib-crc-itu-t +rt73-usb-firmware + TITLE+= (RT73 USB) + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt73usb.ko + AUTOLOAD:=$(call AutoProbe,rt73usb) +endef diff --git a/package/kernel/mac80211/realtek.mk b/package/kernel/mac80211/realtek.mk new file mode 100644 index 00000000000000..e7eb9e31172ea0 --- /dev/null +++ b/package/kernel/mac80211/realtek.mk @@ -0,0 +1,170 @@ +PKG_DRIVERS += \ + rtl8180 rtl8187 \ + rtlwifi rtlwifi-pci rtlwifi-btcoexist rtlwifi-usb rtl8192c-common \ + rtl8192ce rtl8192se rtl8192de rtl8192cu rtl8821ae \ + rtl8xxxu + +config-$(call config_package,rtl8180) += RTL8180 +config-$(call config_package,rtl8187) += RTL8187 + +config-$(call config_package,rtlwifi) += RTL_CARDS RTLWIFI +config-$(call config_package,rtlwifi-pci) += RTLWIFI_PCI +config-$(call config_package,rtlwifi-btcoexist) += RTLBTCOEXIST +config-$(call config_package,rtlwifi-usb) += RTLWIFI_USB +config-$(call config_package,rtl8192c-common) += RTL8192C_COMMON +config-$(call config_package,rtl8192ce) += RTL8192CE +config-$(call config_package,rtl8192se) += RTL8192SE +config-$(call config_package,rtl8192de) += RTL8192DE +config-$(call config_package,rtl8192cu) += RTL8192CU +config-$(call config_package,rtl8821ae) += RTL8821AE +config-$(CONFIG_PACKAGE_RTLWIFI_DEBUG) += RTLWIFI_DEBUG + +config-$(call config_package,rtl8xxxu) += RTL8XXXU +config-y += RTL8XXXU_UNTESTED + +define KernelPackage/rtl818x/Default + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek Drivers for RTL818x devices + URL:=https://wireless.wiki.kernel.org/en/users/drivers/rtl8187 + DEPENDS+= +kmod-eeprom-93cx6 +kmod-mac80211 +endef + +define KernelPackage/rtl8180 + $(call KernelPackage/rtl818x/Default) + DEPENDS+= @PCI_SUPPORT + TITLE+= (RTL8180 PCI) + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtl818x/rtl8180/rtl818x_pci.ko + AUTOLOAD:=$(call AutoProbe,rtl818x_pci) +endef + +define KernelPackage/rtl8187 +$(call KernelPackage/rtl818x/Default) + DEPENDS+= @USB_SUPPORT +kmod-usb-core + TITLE+= (RTL8187 USB) + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8187.ko + AUTOLOAD:=$(call AutoProbe,rtl8187) +endef + +define KernelPackage/rtlwifi/config + config PACKAGE_RTLWIFI_DEBUG + bool "Realtek wireless debugging" + depends on PACKAGE_kmod-rtlwifi + help + Say Y, if you want to debug realtek wireless drivers. + +endef + +define KernelPackage/rtlwifi + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek common driver part + DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT) +kmod-mac80211 +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtlwifi.ko + HIDDEN:=1 +endef + +define KernelPackage/rtlwifi-pci + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek common driver part (PCI support) + DEPENDS+= @PCI_SUPPORT +kmod-rtlwifi + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl_pci.ko + AUTOLOAD:=$(call AutoProbe,rtl_pci) + HIDDEN:=1 +endef + +define KernelPackage/rtlwifi-btcoexist + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek BT coexist support + DEPENDS+= +kmod-rtlwifi + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/btcoexist/btcoexist.ko + AUTOLOAD:=$(call AutoProbe,btcoexist) + HIDDEN:=1 +endef + +define KernelPackage/rtlwifi-usb + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek common driver part (USB support) + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-rtlwifi + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl_usb.ko + AUTOLOAD:=$(call AutoProbe,rtl_usb) + HIDDEN:=1 +endef + +define KernelPackage/rtl8192c-common + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8192CE/RTL8192CU common support module + DEPENDS+= +kmod-rtlwifi + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8192c/rtl8192c-common.ko + HIDDEN:=1 +endef + +define KernelPackage/rtl8192ce + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8192CE/RTL8188CE support + DEPENDS+= +kmod-rtlwifi-pci +kmod-rtl8192c-common +rtl8192ce-firmware + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/rtl8192ce.ko + AUTOLOAD:=$(call AutoProbe,rtl8192ce) +endef + +define KernelPackage/rtl8192se + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8192SE/RTL8191SE support + DEPENDS+= +kmod-rtlwifi-pci +rtl8192se-firmware + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8192se/rtl8192se.ko + AUTOLOAD:=$(call AutoProbe,rtl8192se) +endef + +define KernelPackage/rtl8192de + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8192DE/RTL8188DE support + DEPENDS+= +kmod-rtlwifi-pci +rtl8192de-firmware + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8192de/rtl8192de.ko + AUTOLOAD:=$(call AutoProbe,rtl8192de) +endef + +define KernelPackage/rtl8192cu + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8192CU/RTL8188CU support + DEPENDS+= +kmod-rtlwifi-usb +kmod-rtl8192c-common +rtl8192cu-firmware + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/rtl8192cu.ko + AUTOLOAD:=$(call AutoProbe,rtl8192cu) +endef + +define KernelPackage/rtl8821ae + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8821AE support + DEPENDS+= +kmod-rtlwifi-btcoexist +kmod-rtlwifi-pci +rtl8821ae-firmware + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/rtl8821ae.ko + AUTOLOAD:=$(call AutoProbe,rtl8821ae) +endef + +define KernelPackage/rtl8xxxu + $(call KernelPackage/mac80211/Default) + TITLE:=alternative Realtek RTL8XXXU support + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-mac80211 + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.ko + AUTOLOAD:=$(call AutoProbe,rtl8xxxu) +endef + +define KernelPackage/rtl8xxxu/description + This is an alternative driver for various Realtek RTL8XXX + parts written to utilize the Linux mac80211 stack. + The driver is known to work with a number of RTL8723AU, + RL8188CU, RTL8188RU, RTL8191CU, and RTL8192CU devices + + This driver is under development and has a limited feature + set. In particular it does not yet support 40MHz channels + and power management. However it should have a smaller + memory footprint than the vendor drivers and benetifs + from the in kernel mac80211 stack. + + It can coexist with drivers from drivers/staging/rtl8723au, + drivers/staging/rtl8192u, and drivers/net/wireless/rtlwifi, + but you will need to control which module you wish to load. + + RTL8XXXU_UNTESTED is enabled + This option enables detection of Realtek 8723/8188/8191/8192 WiFi + USB devices which have not been tested directly by the driver + author or reported to be working by third parties. + + Please report your results! +endef diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 2906849cf1e434..db0bf04d0ad66e 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -8,13 +8,23 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2018-07-13 -PKG_SOURCE_VERSION:=67803752363db5e81c7a74a9491a3041aa776284 -PKG_MIRROR_HASH:=733030674a782d96c5ea2fcbcbc2de5486f645d9fb4a84cfb74246a78b459569 +PKG_SOURCE_DATE:=2019-08-22 +PKG_SOURCE_VERSION:=2a0edbb4473b71dfaa4756f7189abf6cb7f7be8b +PKG_MIRROR_HASH:=a37975c179b929716c40d19fdcd5b131386d7f497eb8cd5d848be74e76d50d21 PKG_MAINTAINER:=Felix Fietkau PKG_BUILD_PARALLEL:=1 +PKG_CONFIG_DEPENDS += \ + CONFIG_PACKAGE_kmod-mt76-usb \ + CONFIG_PACKAGE_kmod-mt76x02-common \ + CONFIG_PACKAGE_kmod-mt76x0-common \ + CONFIG_PACKAGE_kmod-mt76x0u \ + CONFIG_PACKAGE_kmod-mt76x2-common \ + CONFIG_PACKAGE_kmod-mt76x2 \ + CONFIG_PACKAGE_kmod-mt76x2u \ + CONFIG_PACKAGE_kmod-mt7603 + STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h include $(INCLUDE_DIR)/kernel.mk @@ -23,7 +33,7 @@ include $(INCLUDE_DIR)/package.mk define KernelPackage/mt76-default SUBMENU:=Wireless Drivers DEPENDS:= \ - +kmod-mac80211 @PCI_SUPPORT @!LINUX_3_18 \ + +kmod-mac80211 \ +@DRIVER_11AC_SUPPORT +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT endef @@ -37,28 +47,106 @@ endef define KernelPackage/mt76-core $(KernelPackage/mt76-default) TITLE:=MediaTek MT76xx wireless driver + HIDDEN:=1 FILES:=\ $(PKG_BUILD_DIR)/mt76.ko endef +define KernelPackage/mt76-usb + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT76xx wireless driver USB support + DEPENDS += +kmod-usb-core +kmod-mt76-core + HIDDEN:=1 + FILES:=\ + $(PKG_BUILD_DIR)/mt76-usb.ko +endef + +define KernelPackage/mt76x02-usb + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT76x0/MT76x2 USB wireless driver common code + DEPENDS+=+kmod-mt76-usb +kmod-mt76x02-common + HIDDEN:=1 + FILES:=$(PKG_BUILD_DIR)/mt76x02-usb.ko +endef + +define KernelPackage/mt76x02-common + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT76x0/MT76x2 wireless driver common code + DEPENDS+=+kmod-mt76-core + HIDDEN:=1 + FILES:=$(PKG_BUILD_DIR)/mt76x02-lib.ko +endef + +define KernelPackage/mt76x0-common + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT76x0 wireless driver common code + DEPENDS+=+kmod-mt76x02-common + HIDDEN:=1 + FILES:=$(PKG_BUILD_DIR)/mt76x0/mt76x0-common.ko +endef + +define KernelPackage/mt76x0e + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT76x0E wireless driver + DEPENDS+=@PCI_SUPPORT +kmod-mt76x0-common + FILES:=\ + $(PKG_BUILD_DIR)/mt76x0/mt76x0e.ko + AUTOLOAD:=$(call AutoProbe,mt76x0e) +endef + +define KernelPackage/mt76x0u + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT76x0U wireless driver + DEPENDS+=+kmod-mt76x0-common +kmod-mt76x02-usb + FILES:=\ + $(PKG_BUILD_DIR)/mt76x0/mt76x0u.ko + AUTOLOAD:=$(call AutoProbe,mt76x0u) +endef + +define KernelPackage/mt76x2-common + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT76x2 wireless driver common code + DEPENDS+=+kmod-mt76-core +kmod-mt76x02-common + HIDDEN:=1 + FILES:=$(PKG_BUILD_DIR)/mt76x2/mt76x2-common.ko +endef + +define KernelPackage/mt76x2u + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT76x2U wireless driver + DEPENDS+=+kmod-mt76x2-common +kmod-mt76x02-usb + FILES:=\ + $(PKG_BUILD_DIR)/mt76x2/mt76x2u.ko + AUTOLOAD:=$(call AutoProbe,mt76x2u) +endef + define KernelPackage/mt76x2 $(KernelPackage/mt76-default) TITLE:=MediaTek MT76x2 wireless driver - DEPENDS+=+kmod-mt76-core + DEPENDS+=@PCI_SUPPORT +kmod-mt76x2-common FILES:=\ - $(PKG_BUILD_DIR)/mt76x2e.ko + $(PKG_BUILD_DIR)/mt76x2/mt76x2e.ko AUTOLOAD:=$(call AutoProbe,mt76x2e) endef define KernelPackage/mt7603 $(KernelPackage/mt76-default) TITLE:=MediaTek MT7603 wireless driver - DEPENDS+=+kmod-mt76-core + DEPENDS+=@PCI_SUPPORT +kmod-mt76-core FILES:=\ - $(PKG_BUILD_DIR)/mt7603e.ko + $(PKG_BUILD_DIR)/mt7603/mt7603e.ko AUTOLOAD:=$(call AutoProbe,mt7603e) endef +define KernelPackage/mt7615e + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT7615 wireless driver + DEPENDS+=@PCI_SUPPORT +kmod-mt76-core + FILES:=\ + $(PKG_BUILD_DIR)/mt7615/mt7615e.ko + AUTOLOAD:=$(call AutoProbe,mt7615e) +endef + NOSTDINC_FLAGS = \ -I$(PKG_BUILD_DIR) \ -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \ @@ -72,9 +160,44 @@ ifdef CONFIG_PACKAGE_MAC80211_MESH NOSTDINC_FLAGS += -DCONFIG_MAC80211_MESH endif +ifdef CONFIG_PACKAGE_kmod-mt76-usb + PKG_MAKE_FLAGS += CONFIG_MT76_USB=m +endif +ifdef CONFIG_PACKAGE_kmod-mt76x02-common + PKG_MAKE_FLAGS += CONFIG_MT76x02_LIB=m +endif +ifdef CONFIG_PACKAGE_kmod-mt76x02-usb + PKG_MAKE_FLAGS += CONFIG_MT76x02_USB=m +endif +ifdef CONFIG_PACKAGE_kmod-mt76x0-common + PKG_MAKE_FLAGS += CONFIG_MT76x0_COMMON=m +endif +ifdef CONFIG_PACKAGE_kmod-mt76x0e + PKG_MAKE_FLAGS += CONFIG_MT76x0E=m +endif +ifdef CONFIG_PACKAGE_kmod-mt76x0u + PKG_MAKE_FLAGS += CONFIG_MT76x0U=m +endif +ifdef CONFIG_PACKAGE_kmod-mt76x2-common + PKG_MAKE_FLAGS += CONFIG_MT76x2_COMMON=m +endif +ifdef CONFIG_PACKAGE_kmod-mt76x2 + PKG_MAKE_FLAGS += CONFIG_MT76x2E=m +endif +ifdef CONFIG_PACKAGE_kmod-mt76x2u + PKG_MAKE_FLAGS += CONFIG_MT76x2U=m +endif +ifdef CONFIG_PACKAGE_kmod-mt7603 + PKG_MAKE_FLAGS += CONFIG_MT7603E=m +endif +ifdef CONFIG_PACKAGE_kmod-mt7615e + PKG_MAKE_FLAGS += CONFIG_MT7615E=m +endif + define Build/Compile +$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \ $(KERNEL_MAKE_FLAGS) \ + $(PKG_MAKE_FLAGS) \ SUBDIRS="$(PKG_BUILD_DIR)" \ NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \ modules @@ -84,7 +207,14 @@ define Package/kmod-mt76/install true endef -define KernelPackage/mt76x2/install +define KernelPackage/mt76x0-common/install + $(INSTALL_DIR) $(1)/lib/firmware/mediatek + cp \ + $(PKG_BUILD_DIR)/firmware/mt7610e.bin \ + $(1)/lib/firmware/mediatek +endef + +define KernelPackage/mt76x2-common/install $(INSTALL_DIR) $(1)/lib/firmware cp \ $(PKG_BUILD_DIR)/firmware/mt7662_rom_patch.bin \ @@ -92,6 +222,17 @@ define KernelPackage/mt76x2/install $(1)/lib/firmware endef +define KernelPackage/mt76x0u/install + $(INSTALL_DIR) $(1)/lib/firmware/mediatek + ln -sf mt7610e.bin $(1)/lib/firmware/mediatek/mt7610u.bin +endef + +define KernelPackage/mt76x2u/install + $(INSTALL_DIR) $(1)/lib/firmware/mediatek + ln -sf ../mt7662.bin $(1)/lib/firmware/mediatek/mt7662u.bin + ln -sf ../mt7662_rom_patch.bin $(1)/lib/firmware/mediatek/mt7662u_rom_patch.bin +endef + define KernelPackage/mt7603/install $(INSTALL_DIR) $(1)/lib/firmware cp $(if $(CONFIG_TARGET_ramips_mt76x8), \ @@ -104,7 +245,25 @@ define KernelPackage/mt7603/install $(1)/lib/firmware endef +define KernelPackage/mt7615e/install + $(INSTALL_DIR) $(1)/lib/firmware + cp \ + $(PKG_BUILD_DIR)/firmware/mt7615_cr4.bin \ + $(PKG_BUILD_DIR)/firmware/mt7615_n9.bin \ + $(PKG_BUILD_DIR)/firmware/mt7615_rom_patch.bin \ + $(1)/lib/firmware +endef + $(eval $(call KernelPackage,mt76-core)) +$(eval $(call KernelPackage,mt76-usb)) +$(eval $(call KernelPackage,mt76x02-usb)) +$(eval $(call KernelPackage,mt76x02-common)) +$(eval $(call KernelPackage,mt76x0-common)) +$(eval $(call KernelPackage,mt76x0e)) +$(eval $(call KernelPackage,mt76x0u)) +$(eval $(call KernelPackage,mt76x2-common)) +$(eval $(call KernelPackage,mt76x2u)) $(eval $(call KernelPackage,mt76x2)) $(eval $(call KernelPackage,mt7603)) +$(eval $(call KernelPackage,mt7615e)) $(eval $(call KernelPackage,mt76)) diff --git a/package/kernel/mwlwifi/Makefile b/package/kernel/mwlwifi/Makefile index 9e9824afea7a4a..642d8008363381 100644 --- a/package/kernel/mwlwifi/Makefile +++ b/package/kernel/mwlwifi/Makefile @@ -15,9 +15,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/kaloz/mwlwifi PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2018-06-15 -PKG_SOURCE_VERSION:=8683de8e97a31fe01cfd4e63ef6e9867b50aadae -PKG_MIRROR_HASH:=69cd9f7c79564e444edf423133b13dcfbba9f66c051516606049087fa1973a20 +PKG_SOURCE_DATE:=2019-03-02 +PKG_SOURCE_VERSION:=31d9386079b91cc699658c19294e139b62b512bc +PKG_MIRROR_HASH:=7bdd05765d8215a9c293cdcb028d63a04c9e55b337eaac9e8d3659bd86218321 PKG_MAINTAINER:=Imre Kaloz PKG_BUILD_PARALLEL:=1 diff --git a/package/kernel/nat46/Makefile b/package/kernel/nat46/Makefile new file mode 100644 index 00000000000000..755a2958c954a7 --- /dev/null +++ b/package/kernel/nat46/Makefile @@ -0,0 +1,35 @@ +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=nat46 + +PKG_MIRROR_HASH:=3f5ef0a56e9b02c3ec10ec95f3f81c0ed04b983b2d857c16304c379106d6beb6 +PKG_SOURCE_URL:=https://github.com/ayourtch/nat46.git +PKG_SOURCE_DATE:=2017-05-12 +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=683fbd2b765506332a1af141545652bf58f03166 + +PKG_MAINTAINER:=Hans Dedecker +PKG_LICENSE:=GPL-2.0 + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/nat46 + DEPENDS:=@IPV6 + TITLE:=Stateless NAT46 translation kernel module + SECTION:=kernel + SUBMENU:=Network Support + FILES:=$(PKG_BUILD_DIR)/nat46/modules/nat46.ko + AUTOLOAD:=$(call AutoLoad,33,nat46) +endef + +include $(INCLUDE_DIR)/kernel-defaults.mk + +define Build/Compile + $(KERNEL_MAKE) SUBDIRS="$(PKG_BUILD_DIR)/nat46/modules" \ + MODFLAGS="-DMODULE -mlong-calls" \ + EXTRA_CFLAGS="-DNAT46_VERSION=\\\"$(PKG_SOURCE_VERSION)\\\"" \ + modules +endef + +$(eval $(call KernelPackage,nat46)) diff --git a/package/kernel/rotary-gpio-custom/Makefile b/package/kernel/rotary-gpio-custom/Makefile deleted file mode 100644 index f75856736523d6..00000000000000 --- a/package/kernel/rotary-gpio-custom/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -# -# Copyright (C) 2008-2010 OpenWrt.org -# -# 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:=rotary-gpio-custom -PKG_RELEASE:=1 - -include $(INCLUDE_DIR)/package.mk - -define KernelPackage/rotary-gpio-custom - SUBMENU:=Other modules - TITLE:=Custom GPIO-based rotary encoder device - DEPENDS:=@GPIO_SUPPORT +kmod-input-gpio-encoder @LINUX_3_18||LINUX_4_4 - FILES:=$(PKG_BUILD_DIR)/rotary-gpio-custom.ko - KCONFIG:= -endef - -define KernelPackage/rotary-gpio-custom/description - Kernel module for register a custom rotary-gpio-encoder platform device. -endef - -EXTRA_KCONFIG:= \ - CONFIG_ROTARY_GPIO_CUSTOM=m - -EXTRA_CFLAGS:= \ - $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(EXTRA_KCONFIG)))) \ - $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(EXTRA_KCONFIG)))) \ - -MAKE_OPTS:= \ - $(KERNEL_MAKE_FLAGS) \ - SUBDIRS="$(PKG_BUILD_DIR)" \ - EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \ - $(EXTRA_KCONFIG) - -define Build/Compile - $(MAKE) -C "$(LINUX_DIR)" \ - $(MAKE_OPTS) \ - modules -endef - -$(eval $(call KernelPackage,rotary-gpio-custom)) diff --git a/package/kernel/rotary-gpio-custom/src/Kconfig b/package/kernel/rotary-gpio-custom/src/Kconfig deleted file mode 100644 index b4d55d535427af..00000000000000 --- a/package/kernel/rotary-gpio-custom/src/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -config ROTARY_GPIO_CUSTOM - tristate "Custom GPIO-based rotary driver" - depends on GENERIC_GPIO - help - This is a driver to register 1 to 4 custom rotary encoder using - GPIO lines. - - This support is also available as a module. If so, the module - will be called rotary-gpio-custom. diff --git a/package/kernel/rotary-gpio-custom/src/Makefile b/package/kernel/rotary-gpio-custom/src/Makefile deleted file mode 100644 index 133672687b3841..00000000000000 --- a/package/kernel/rotary-gpio-custom/src/Makefile +++ /dev/null @@ -1 +0,0 @@ -obj-${CONFIG_ROTARY_GPIO_CUSTOM} += rotary-gpio-custom.o diff --git a/package/kernel/rotary-gpio-custom/src/rotary-gpio-custom.c b/package/kernel/rotary-gpio-custom/src/rotary-gpio-custom.c deleted file mode 100644 index 9a16e452871808..00000000000000 --- a/package/kernel/rotary-gpio-custom/src/rotary-gpio-custom.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Custom GPIO-based rotary driver - * - * Copyright (C) 2010 Claudio Mignanti - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Strongly based on Custom GPIO-based I2C driver by: - * Copyright (C) 2007-2008 Gabor Juhos - * - * --------------------------------------------------------------------------- - * - * The behaviour of this driver can be altered by setting some parameters - * from the insmod command line. - * - * The following parameters are adjustable: - * - * bus0 These four arguments can be arrays of - * bus1 1-8 unsigned integers as follows: - * bus2 - * bus3 ,,,,, - * - * - * If this driver is built into the kernel, you can use the following kernel - * command line parameters, with the same values as the corresponding module - * parameters listed above: - * - * rotary-gpio-custom.bus0 - * rotary-gpio-custom.bus1 - * rotary-gpio-custom.bus2 - * rotary-gpio-custom.bus3 - */ - -#include -#include -#include -#include -#include -#include - -#define DRV_NAME "rotary-gpio-custom" -#define DRV_DESC "Custom GPIO-based rotary driver" -#define DRV_VERSION "0.1.0" - -#define PFX DRV_NAME ": " - -#define BUS_PARAM_REQUIRED 5 -#define BUS_PARAM_COUNT 6 -#define BUS_COUNT_MAX 4 - -static unsigned int bus0[BUS_PARAM_COUNT] __initdata; -static unsigned int bus1[BUS_PARAM_COUNT] __initdata; -static unsigned int bus2[BUS_PARAM_COUNT] __initdata; -static unsigned int bus3[BUS_PARAM_COUNT] __initdata; - -static unsigned int bus_nump[BUS_COUNT_MAX] __initdata; - -#define BUS_PARM_DESC \ - " config -> id,steps,axis,gpioa,gpiob[,inverted]" - -module_param_array(bus0, uint, &bus_nump[0], 0); -MODULE_PARM_DESC(bus0, "bus0" BUS_PARM_DESC); -module_param_array(bus1, uint, &bus_nump[1], 0); -MODULE_PARM_DESC(bus1, "bus1" BUS_PARM_DESC); -module_param_array(bus2, uint, &bus_nump[2], 0); -MODULE_PARM_DESC(bus2, "bus2" BUS_PARM_DESC); -module_param_array(bus3, uint, &bus_nump[3], 0); -MODULE_PARM_DESC(bus3, "bus3" BUS_PARM_DESC); - -static struct platform_device *devices[BUS_COUNT_MAX]; -static unsigned int nr_devices; - -static void rotary_gpio_custom_cleanup(void) -{ - int i; - - for (i = 0; i < nr_devices; i++) - if (devices[i]) - platform_device_put(devices[i]); -} - -static int __init rotary_gpio_custom_add_one(unsigned int id, - unsigned int *params) -{ - struct platform_device *pdev; - struct rotary_encoder_platform_data pdata; - int err; - - if (!bus_nump[id]) - return 0; - - if (bus_nump[id] < BUS_PARAM_REQUIRED) { - printk(KERN_ERR PFX "not enough parameters for bus%d\n", id); - err = -EINVAL; - goto err; - } - - pdev = platform_device_alloc("rotary-gpio", params[0]); - if (!pdev) { - err = -ENOMEM; - goto err; - } - - pdata.steps = params[1]; - pdata.axis = params[2]; - pdata.relative_axis = false; - pdata.rollover = false; - pdata.gpio_a = params[3]; - pdata.gpio_b = params[4]; - - if (params[5] == 1) { - pdata.inverted_a = 1; - pdata.inverted_b = 1; - } else { - pdata.inverted_a = 0; - pdata.inverted_b = 0; - } - - err = platform_device_add_data(pdev, &pdata, sizeof(pdata)); - if (err) - goto err_put; - - err = platform_device_add(pdev); - if (err) - goto err_put; - - devices[nr_devices++] = pdev; - return 0; - -err_put: - platform_device_put(pdev); -err: - return err; -} - -static int __init rotary_gpio_custom_probe(void) -{ - int err; - - printk(KERN_INFO DRV_DESC " version " DRV_VERSION "\n"); - - err = rotary_gpio_custom_add_one(0, bus0); - if (err) - goto err; - - err = rotary_gpio_custom_add_one(1, bus1); - if (err) - goto err; - - err = rotary_gpio_custom_add_one(2, bus2); - if (err) - goto err; - - err = rotary_gpio_custom_add_one(3, bus3); - if (err) - goto err; - - if (!nr_devices) { - printk(KERN_ERR PFX "no bus parameter(s) specified\n"); - err = -ENODEV; - goto err; - } - - return 0; - -err: - rotary_gpio_custom_cleanup(); - return err; -} - -#ifdef MODULE -static int __init rotary_gpio_custom_init(void) -{ - return rotary_gpio_custom_probe(); -} -module_init(rotary_gpio_custom_init); - -static void __exit rotary_gpio_custom_exit(void) -{ - rotary_gpio_custom_cleanup(); -} -module_exit(rotary_gpio_custom_exit); -#else -subsys_initcall(rotary_gpio_custom_probe); -#endif /* MODULE*/ - -MODULE_LICENSE("GPL v2"); -MODULE_AUTHOR("Gabor Juhos "); -MODULE_AUTHOR("Claudio Mignanti "); -MODULE_DESCRIPTION(DRV_DESC); -MODULE_VERSION(DRV_VERSION); diff --git a/package/kernel/rtc-sd2068/Makefile b/package/kernel/rtc-sd2068/Makefile deleted file mode 100644 index 3cc6720572fa26..00000000000000 --- a/package/kernel/rtc-sd2068/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -# -# Copyright (C) 2017 OpenWrt.org -# -# 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:=rtc-sd2068 -PKG_RELEASE:=1 - -include $(INCLUDE_DIR)/package.mk - -define KernelPackage/rtc-sd2068 - SUBMENU:=Other modules - DEPENDS:=@TARGET_ar71xx - KCONFIG:=CONFIG_RTC_CLASS=y - TITLE:=Driver for RTC SD2068 - AUTOLOAD:=$(call AutoLoad,70,rtc-sd2068) - FILES:=$(PKG_BUILD_DIR)/rtc-sd2068.ko -endef - -define Build/Prepare - mkdir -p $(PKG_BUILD_DIR) - $(CP) ./src/* $(PKG_BUILD_DIR)/ -endef - -define Build/Compile - $(MAKE) -C "$(LINUX_DIR)" \ - CROSS_COMPILE="$(TARGET_CROSS)" \ - ARCH="$(LINUX_KARCH)" \ - SUBDIRS="$(PKG_BUILD_DIR)" \ - EXTRA_CFLAGS="$(BUILDFLAGS)" \ - modules -endef - -$(eval $(call KernelPackage,rtc-sd2068)) diff --git a/package/kernel/rtc-sd2068/src/Makefile b/package/kernel/rtc-sd2068/src/Makefile deleted file mode 100644 index 15b4f4961ce9fe..00000000000000 --- a/package/kernel/rtc-sd2068/src/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# -# Makefile for Real Time Clock driver for SD2068 -# -# Copyright (C) 2017 OpenWrt.org -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version -# 2 of the License, or (at your option) any later version. -# - -obj-m := rtc-sd2068.o - -ifeq ($(MAKING_MODULES),1) - --include $(TOPDIR)/Rules.make -endif diff --git a/package/kernel/rtc-sd2068/src/rtc-sd2068.c b/package/kernel/rtc-sd2068/src/rtc-sd2068.c deleted file mode 100644 index e537ca700d3310..00000000000000 --- a/package/kernel/rtc-sd2068/src/rtc-sd2068.c +++ /dev/null @@ -1,511 +0,0 @@ -/* - * RTC client/driver for the Whwave SD2068 Real-Time Clock over I2C - * - * Copyright (C) 2013 Tang, Haifeng . - * - * base on ds3232 - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - */ -/* - * It would be more efficient to use i2c msgs/i2c_transfer directly but, as - * recommened in .../Documentation/i2c/writing-clients section - * "Sending and receiving", using SMBus level communication is preferred. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#define SD2068_SECONDS 0x00 -#define SD2068_MINUTES 0x01 -#define SD2068_HOURS 0x02 -#define SD2068_AMPM 0x02 -#define SD2068_DAY 0x03 -#define SD2068_DATE 0x04 -#define SD2068_MONTH 0x05 -#define SD2068_YEAR 0x06 - -#define SD2068_ALARM 0x07 /* Alarm 1 BASE */ - -#define SD2068_ALARM_EN 0x0E -# define SD2068_ALARM_EAY 0x40 -# define SD2068_ALARM_EAMO 0x20 -# define SD2068_ALARM_EAD 0x10 -# define SD2068_ALARM_EAW 0x08 -# define SD2068_ALARM_EAH 0x04 -# define SD2068_ALARM_EAMN 0x02 -# define SD2068_ALARM_EAS 0x01 - -#define SD2068_CTR1 0x0F /* Control register 1 */ -# define SD2068_CTR1_WRTC3 0x80 -# define SD2068_CTR1_INTAF 0x20 -# define SD2068_CTR1_INTDF 0x10 -# define SD2068_CTR1_WRTC2 0x04 -# define SD2068_CTR1_RTCF 0x01 - -#define SD2068_CTR2 0x10 -# define SD2068_CTR2_WRTC1 0x80 -# define SD2068_CTR2_IM 0x40 -# define SD2068_CTR2_INTS1 0x20 -# define SD2068_CTR2_INTS0 0x10 -# define SD2068_CTR2_FOBAT 0x08 -# define SD2068_CTR2_INTDE 0x04 -# define SD2068_CTR2_INTAE 0x02 -# define SD2068_CTR2_INTFE 0x01 - -#define SD2068_CTR3 0x11 -# define SD2068_CTR3_ARST 0x80 -# define SD2068_CTR3_TDS1 0x20 -# define SD2068_CTR3_TDS0 0x10 -# define SD2068_CTR3_FS3 0x08 -# define SD2068_CTR3_FS2 0x04 -# define SD2068_CTR3_FS1 0x02 -# define SD2068_CTR3_FS0 0x01 - -#define SD2068_TIME_ADJ 0x12 - -struct sd2068 { - struct i2c_client *client; - struct rtc_device *rtc; - struct work_struct work; - - /* The mutex protects alarm operations, and prevents a race - * between the enable_irq() in the workqueue and the free_irq() - * in the remove function. - */ - struct mutex mutex; - int exiting; -}; - -static void sd2068_write_enable(struct i2c_client *client) -{ - char ret; - - ret = i2c_smbus_read_byte_data(client, SD2068_CTR2); - ret = ret | SD2068_CTR2_WRTC1; - i2c_smbus_write_byte_data(client, SD2068_CTR2, ret); - - ret = i2c_smbus_read_byte_data(client, SD2068_CTR1); - ret = ret | SD2068_CTR1_WRTC3 | SD2068_CTR1_WRTC2; - i2c_smbus_write_byte_data(client, SD2068_CTR1, ret); -} - -static void sd2068_write_disable(struct i2c_client *client) -{ - char ret; - - ret = i2c_smbus_read_byte_data(client, SD2068_CTR1); - ret = ret & (~SD2068_CTR1_WRTC3) & (~SD2068_CTR1_WRTC2); - i2c_smbus_write_byte_data(client, SD2068_CTR1, ret); - - ret = i2c_smbus_read_byte_data(client, SD2068_CTR2); - ret = ret & (~SD2068_CTR2_WRTC1); - i2c_smbus_write_byte_data(client, SD2068_CTR2, ret); -} - -static void sd2068_hw_init(struct i2c_client *client) -{ - char ret; - - sd2068_write_enable(client); - - ret = i2c_smbus_read_byte_data(client, SD2068_CTR2); - ret = ret & (~SD2068_CTR2_IM); /* 只使用单事件报警 */ - ret = ret & ((~SD2068_CTR2_INTS1) | SD2068_CTR2_INTS0); - ret = ret & (~SD2068_CTR2_FOBAT); - ret = ret & (((~SD2068_CTR2_INTDE) | SD2068_CTR2_INTAE) & (~SD2068_CTR2_INTFE)); - i2c_smbus_write_byte_data(client, SD2068_CTR2, ret); - - ret = i2c_smbus_read_byte_data(client, SD2068_CTR3); - ret = ret & (~SD2068_CTR3_ARST); - i2c_smbus_write_byte_data(client, SD2068_CTR3, ret); - - sd2068_write_disable(client); -} - -static int sd2068_read_time(struct device *dev, struct rtc_time *time) -{ - struct i2c_client *client = to_i2c_client(dev); - int ret; - u8 buf[7]; - unsigned char year, month, day, hour, minute, second; - unsigned char week, twelve_hr, am_pm; - - ret = i2c_smbus_read_i2c_block_data(client, SD2068_SECONDS, 7, buf); - if (ret < 0) - return ret; - if (ret < 7) - return -EIO; - - second = buf[0]; - minute = buf[1]; - hour = buf[2]; - week = buf[3]; - day = buf[4]; - month = buf[5]; - year = buf[6]; - - /* Extract additional information for AM/PM */ - twelve_hr = hour & 0x80; - am_pm = hour & 0x20; - - /* Write to rtc_time structure */ - time->tm_sec = bcd2bin(second & 0x7f); - time->tm_min = bcd2bin(minute & 0x7f); - if (twelve_hr) { - time->tm_hour = bcd2bin(hour & 0x3f); - } else { - /* Convert to 24 hr */ - if (am_pm) - time->tm_hour = bcd2bin(hour & 0x1f) + 12; - else - time->tm_hour = bcd2bin(hour & 0x1f); - } - - time->tm_wday = bcd2bin(week & 0x07); - time->tm_mday = bcd2bin(day & 0x3f); - /* linux tm_mon range:0~11, while month range is 1~12 in RTC chip */ - time->tm_mon = bcd2bin(month & 0x7F) - 1; - time->tm_year = bcd2bin(year); - if (time->tm_year < 70) - time->tm_year += 100; - - dev_dbg(dev, "%s secs=%d, mins=%d, " - "hours=%d, mday=%d, mon=%d, year=%d, wday=%d\n", - "read", time->tm_sec, time->tm_min, - time->tm_hour, time->tm_mday, - time->tm_mon, time->tm_year, time->tm_wday); - - return rtc_valid_tm(time); -} - -static int sd2068_set_time(struct device *dev, struct rtc_time *time) -{ - struct i2c_client *client = to_i2c_client(dev); - u8 buf[7]; - - /* Extract time from rtc_time and load into sd2068*/ - sd2068_write_enable(client); - - buf[0] = bin2bcd(time->tm_sec); - buf[1] = bin2bcd(time->tm_min); - buf[2] = bin2bcd(time->tm_hour) | 0x80; /* only 24 hr? */ - buf[3] = bin2bcd(time->tm_wday); - buf[4] = bin2bcd(time->tm_mday); /* Date */ - /* linux tm_mon range:0~11, while month range is 1~12 in RTC chip */ - buf[5] = bin2bcd(time->tm_mon + 1); - buf[6] = bin2bcd(time->tm_year % 100); - - i2c_smbus_write_i2c_block_data(client, SD2068_SECONDS, 7, buf); - i2c_smbus_write_byte_data(client, SD2068_TIME_ADJ, 0x00); - - sd2068_write_disable(client); - - return 0; -} - -/* - * According to linux specification, only support one-shot alarm - * no periodic alarm mode - */ -static int sd2068_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) -{ - struct i2c_client *client = to_i2c_client(dev); - struct sd2068 *sd2068 = i2c_get_clientdata(client); - unsigned char control, alm_en; - unsigned char ret; - u8 buf[7]; - - mutex_lock(&sd2068->mutex); - - ret = i2c_smbus_read_byte_data(client, SD2068_CTR2); - if (ret < 0) - goto out; - control = ret; - alarm->enabled = (control & SD2068_CTR2_INTAE) ? 1 : 0; - - ret = i2c_smbus_read_i2c_block_data(client, SD2068_ALARM, 7, buf); - if (ret < 0) - goto out; - - ret = i2c_smbus_read_byte_data(client, SD2068_ALARM_EN); - if (ret < 0) - goto out; - alm_en = ret; - /* decode the alarm enable field */ - if (alm_en & SD2068_ALARM_EAS) - alarm->time.tm_sec = bcd2bin(buf[0] & 0x7F); - else - alarm->time.tm_sec = -1; - - if (alm_en & SD2068_ALARM_EAMN) - alarm->time.tm_min = bcd2bin(buf[1] & 0x7F); - else - alarm->time.tm_min = -1; - - if (alm_en & SD2068_ALARM_EAH) - alarm->time.tm_hour = bcd2bin(buf[2] & 0x3F); - else - alarm->time.tm_hour = -1; - - if (alm_en & SD2068_ALARM_EAW) - alarm->time.tm_wday = bcd2bin(buf[3] & 0x7F); - else - alarm->time.tm_wday = -1; - - if (alm_en & SD2068_ALARM_EAD) - alarm->time.tm_mday = bcd2bin(buf[4] & 0x3F); - else - alarm->time.tm_mday = -1; - - if (alm_en & SD2068_ALARM_EAMO) - alarm->time.tm_mon = bcd2bin(buf[5] & 0x1F); - else - alarm->time.tm_mon = -1; - - if (alm_en & SD2068_ALARM_EAY) - alarm->time.tm_year = bcd2bin(buf[6]); - else - alarm->time.tm_year = -1; - - ret = 0; -out: - mutex_unlock(&sd2068->mutex); - return ret; -} - -/* - * linux rtc-module does not support wday alarm - * and only 24h time mode supported indeed - */ -static int sd2068_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) -{ - struct i2c_client *client = to_i2c_client(dev); - struct sd2068 *sd2068 = i2c_get_clientdata(client); - int control; - int ret; - u8 buf[7]; - - if (client->irq <= 0) - return -EINVAL; - - mutex_lock(&sd2068->mutex); - - sd2068_write_enable(client); - - buf[0] = bin2bcd(alarm->time.tm_sec); - buf[1] = bin2bcd(alarm->time.tm_min); - buf[2] = bin2bcd(alarm->time.tm_hour); - buf[3] = bin2bcd(alarm->time.tm_wday); - buf[4] = bin2bcd(alarm->time.tm_mday); - buf[5] = bin2bcd(alarm->time.tm_mon); - buf[6] = bin2bcd(alarm->time.tm_year); - - /* clear alarm interrupt enable bit */ - ret = i2c_smbus_read_byte_data(client, SD2068_CTR2); - if (ret < 0) - goto out; - control = ret; - control &= ~(SD2068_CTR2_INTAE); - ret = i2c_smbus_write_byte_data(client, SD2068_CTR2, control); - if (ret < 0) - goto out; - - ret = i2c_smbus_write_i2c_block_data(client, SD2068_ALARM, 7, buf); - - ret = i2c_smbus_write_byte_data(client, SD2068_ALARM_EN, 0x7f); - - if (alarm->enabled) { - control |= SD2068_CTR2_INTAE; - ret = i2c_smbus_write_byte_data(client, SD2068_CTR2, control); - } -out: - sd2068_write_disable(client); - mutex_unlock(&sd2068->mutex); - return ret; -} - -static int sd2068_alarm_irq_enable(struct device *dev, unsigned int enabled) -{ - struct i2c_client *client = to_i2c_client(dev); - struct sd2068 *sd2068 = i2c_get_clientdata(client); - unsigned char control; - - pr_debug("%s: aie=%d\n", __func__, enabled); - - if (client->irq <= 0) - return -EINVAL; - - sd2068_write_enable(client); - - control = i2c_smbus_read_byte_data(client, SD2068_CTR2); - - if (enabled) { - sd2068->rtc->irq_data |= RTC_AF; - control |= SD2068_CTR2_INTAE; - i2c_smbus_write_byte_data(client, SD2068_CTR2, control); - } else { - sd2068->rtc->irq_data &= ~RTC_AF; - control &= ~SD2068_CTR2_INTAE; - i2c_smbus_write_byte_data(client, SD2068_CTR2, control); - } - - sd2068_write_disable(client); - - return 0; -} - -static irqreturn_t sd2068_irq(int irq, void *dev_id) -{ - struct i2c_client *client = dev_id; - struct sd2068 *sd2068 = i2c_get_clientdata(client); - - disable_irq_nosync(irq); - schedule_work(&sd2068->work); - return IRQ_HANDLED; -} - -static void sd2068_work(struct work_struct *work) -{ - struct sd2068 *sd2068 = container_of(work, struct sd2068, work); - struct i2c_client *client = sd2068->client; - - mutex_lock(&sd2068->mutex); - - rtc_update_irq(sd2068->rtc, 1, RTC_AF | RTC_IRQF); - - if (!sd2068->exiting) - enable_irq(client->irq); - - mutex_unlock(&sd2068->mutex); -} - -static const struct rtc_class_ops sd2068_rtc_ops = { - .read_time = sd2068_read_time, - .set_time = sd2068_set_time, - .read_alarm = sd2068_read_alarm, - .set_alarm = sd2068_set_alarm, - .alarm_irq_enable = sd2068_alarm_irq_enable, -}; - -static int sd2068_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - struct sd2068 *sd2068; - struct rtc_time rtc_tm; - int ret; - - sd2068 = kzalloc(sizeof(struct sd2068), GFP_KERNEL); - if (!sd2068) - return -ENOMEM; - - sd2068->client = client; - i2c_set_clientdata(client, sd2068); - - INIT_WORK(&sd2068->work, sd2068_work); - mutex_init(&sd2068->mutex); - - sd2068->rtc = rtc_device_register(client->name, &client->dev, - &sd2068_rtc_ops, THIS_MODULE); - if (IS_ERR(sd2068->rtc)) { - ret = PTR_ERR(sd2068->rtc); - dev_err(&client->dev, "unable to register the class device\n"); - goto out_irq; - } - - if (client->irq >= 0) { - ret = request_irq(client->irq, sd2068_irq, 0, - "sd2068", client); - if (ret) { - dev_err(&client->dev, "unable to request IRQ\n"); - goto out_free; - } - } - - sd2068_hw_init(client); - - /* Check RTC Time */ - sd2068_read_time(&client->dev, &rtc_tm); - - if (rtc_valid_tm(&rtc_tm)) { - rtc_tm.tm_year = 100; - rtc_tm.tm_mon = 0; - rtc_tm.tm_mday = 1; - rtc_tm.tm_hour = 0; - rtc_tm.tm_min = 0; - rtc_tm.tm_sec = 0; - - sd2068_set_time(&client->dev, &rtc_tm); - - dev_warn(&client->dev, "warning: invalid RTC value so initializing it\n"); - } - - return 0; - -out_irq: - if (client->irq >= 0) - free_irq(client->irq, client); - -out_free: - kfree(sd2068); - return ret; -} - -static int sd2068_remove(struct i2c_client *client) -{ - struct sd2068 *sd2068 = i2c_get_clientdata(client); - - if (client->irq >= 0) { - mutex_lock(&sd2068->mutex); - sd2068->exiting = 1; - mutex_unlock(&sd2068->mutex); - - free_irq(client->irq, client); - cancel_work_sync(&sd2068->work); - } - - rtc_device_unregister(sd2068->rtc); - kfree(sd2068); - return 0; -} - -static const struct i2c_device_id sd2068_id[] = { - { "sd2068", 0 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, sd2068_id); - -static struct i2c_driver sd2068_driver = { - .driver = { - .name = "rtc-sd2068", - .owner = THIS_MODULE, - }, - .probe = sd2068_probe, - .remove = sd2068_remove, - .id_table = sd2068_id, -}; - -static int __init sd2068_init(void) -{ - return i2c_add_driver(&sd2068_driver); -} - -static void __exit sd2068_exit(void) -{ - i2c_del_driver(&sd2068_driver); -} - -module_init(sd2068_init); -module_exit(sd2068_exit); - -MODULE_AUTHOR("Loongson-gz "); -MODULE_DESCRIPTION("Whwave SD2068 RTC Driver"); -MODULE_LICENSE("GPL"); diff --git a/package/kernel/rtl8812au-ct/Makefile b/package/kernel/rtl8812au-ct/Makefile new file mode 100644 index 00000000000000..5c70dbd1e7f618 --- /dev/null +++ b/package/kernel/rtl8812au-ct/Makefile @@ -0,0 +1,53 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=rtl8812au-ct +PKG_RELEASE=1 + +PKG_LICENSE:=GPLv2 +PKG_LICENSE_FILES:= + +PKG_SOURCE_URL:=https://github.com/greearb/rtl8812AU_8821AU_linux.git +PKG_MIRROR_HASH:=42b32c56cf31bdf3c9cd4e304c9aac761b623c8737d8c57518117acdc5a84cfe +PKG_SOURCE_PROTO:=git +PKG_SOURCE_DATE:=2018-11-16 +PKG_SOURCE_VERSION:=661268fd174d4a74834c82d7d3987b0a560e6c57 + +PKG_MAINTAINER:=Ben Greear +PKG_BUILD_PARALLEL:=1 +#PKG_EXTMOD_SUBDIRS:=rtl8812au-ct + +STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h + +include $(INCLUDE_DIR)/kernel.mk +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/rtl8812au-ct + SUBMENU:=Wireless Drivers + TITLE:=Driver for Realtek 8812 AU devices comfast 912-ac, etc + DEPENDS:=+kmod-cfg80211 +kmod-usb-core +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT @!LINUX_4_9 + FILES:=\ + $(PKG_BUILD_DIR)/rtl8812au.ko + AUTOLOAD:=$(call AutoProbe,rtl8812au) + PROVIDES:=kmod-rtl8812au +endef + +NOSTDINC_FLAGS = \ + -I$(PKG_BUILD_DIR) \ + -I$(PKG_BUILD_DIR)/include \ + -I$(STAGING_DIR)/usr/include/mac80211-backport \ + -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \ + -I$(STAGING_DIR)/usr/include/mac80211 \ + -I$(STAGING_DIR)/usr/include/mac80211/uapi \ + -include backport/backport.h + +NOSTDINC_FLAGS+=-DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT -DBUILD_OPENWRT + +define Build/Compile + +$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \ + $(KERNEL_MAKE_FLAGS) \ + SUBDIRS="$(PKG_BUILD_DIR)" \ + NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \ + modules +endef + +$(eval $(call KernelPackage,rtl8812au-ct)) diff --git a/package/kernel/rtl8812au-ct/patches/001-use-kernel-byteorder.patch b/package/kernel/rtl8812au-ct/patches/001-use-kernel-byteorder.patch new file mode 100644 index 00000000000000..dd42b12438b878 --- /dev/null +++ b/package/kernel/rtl8812au-ct/patches/001-use-kernel-byteorder.patch @@ -0,0 +1,15 @@ +Fix compile problem when rtw_byteorder.h and asm/byteorder.h gets +included in addition for example indirectly, do not use realtek own copy +of the byteorder headers. + +--- a/include/drv_types.h ++++ b/include/drv_types.h +@@ -30,7 +30,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include diff --git a/package/kernel/spi-gpio-custom/Makefile b/package/kernel/spi-gpio-custom/Makefile index 19aef20ed2f733..b0da3db188c0b6 100644 --- a/package/kernel/spi-gpio-custom/Makefile +++ b/package/kernel/spi-gpio-custom/Makefile @@ -16,7 +16,7 @@ include $(INCLUDE_DIR)/package.mk define KernelPackage/spi-gpio-custom SUBMENU:=SPI Support TITLE:=Custom GPIO-based SPI device - DEPENDS:=@GPIO_SUPPORT +kmod-spi-bitbang +kmod-spi-gpio +kmod-spi-dev + DEPENDS:=@GPIO_SUPPORT +kmod-spi-bitbang +kmod-spi-gpio +kmod-spi-dev @!LINUX_4_19 FILES:=$(PKG_BUILD_DIR)/spi-gpio-custom.ko KCONFIG:= endef diff --git a/package/kernel/trelay/Makefile b/package/kernel/trelay/Makefile index 525a028c35d383..258cbb184ac49d 100644 --- a/package/kernel/trelay/Makefile +++ b/package/kernel/trelay/Makefile @@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=trelay PKG_VERSION:=0.1 -PKG_RELEASE:=1 +PKG_RELEASE:=2 include $(INCLUDE_DIR)/package.mk @@ -41,9 +41,9 @@ endef define KernelPackage/trelay/install $(INSTALL_DIR) $(1)/etc/hotplug.d/net $(1)/etc/init.d $(1)/etc/config - $(INSTALL_DATA) ./files/trelay.hotplug $(1)/etc/hotplug.d/net/50-trelay + $(INSTALL_CONF) ./files/trelay.hotplug $(1)/etc/hotplug.d/net/50-trelay $(INSTALL_BIN) ./files/trelay.init $(1)/etc/init.d/trelay - $(INSTALL_DATA) ./files/trelay.config $(1)/etc/config/trelay + $(INSTALL_CONF) ./files/trelay.config $(1)/etc/config/trelay endef $(eval $(call KernelPackage,trelay)) diff --git a/package/kernel/w1-gpio-custom/Makefile b/package/kernel/w1-gpio-custom/Makefile index 1008cf9736f659..662f65f001938b 100644 --- a/package/kernel/w1-gpio-custom/Makefile +++ b/package/kernel/w1-gpio-custom/Makefile @@ -16,7 +16,7 @@ include $(INCLUDE_DIR)/package.mk define KernelPackage/w1-gpio-custom SUBMENU:=W1 support TITLE:=Custom GPIO-based 1-wire device - DEPENDS:=kmod-w1 +kmod-w1-master-gpio + DEPENDS:=kmod-w1 +kmod-w1-master-gpio @!LINUX_4_19 FILES:=$(PKG_BUILD_DIR)/w1-gpio-custom.ko KCONFIG:= endef diff --git a/package/lean/UnblockNeteaseMusic/Makefile b/package/lean/UnblockNeteaseMusic/Makefile new file mode 100644 index 00000000000000..824246b701c22d --- /dev/null +++ b/package/lean/UnblockNeteaseMusic/Makefile @@ -0,0 +1,59 @@ +# +# Copyright (C) 2015-2020 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v3. +# +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=UnblockNeteaseMusic +PKG_VERSION:=0.24.1 +PKG_RELEASE:=3 + +PKG_LICENSE:=MIT + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/nondanee/UnblockNeteaseMusic.git +PKG_SOURCE_VERSION:=91e631db87920c67f92161a724a2d96472ad33cd + +PKG_SOURCE_SUBDIR:=$(PKG_NAME) +PKG_SOURCE:=$(PKG_SOURCE_SUBDIR)-$(PKG_VERSION).tar.gz +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/$(PKG_NAME) + SECTION:=net + CATEGORY:=Network + TITLE:=Revive Netease Cloud Music (NodeJS) + DEPENDS:=+node + URL:=https://github.com/nondanee/UnblockNeteaseMusic/releases + SUBMENU:=NeteaseMusic + PKGARCH:=all +endef + +define Package/$(PKG_NAME)/description +Revive Netease Cloud Music (NodeJS) +endef + +define Build/Prepare + tar -xzvf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) + mkdir -p $(PKG_BUILD_DIR)/$(PKG_NAME) + echo -e $(PKG_VERSION) > $(PKG_BUILD_DIR)/$(PKG_NAME)/core_ver + echo -e $(PKG_SOURCE_VERSION) > $(PKG_BUILD_DIR)/$(PKG_NAME)/local_ver +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME) + cp -pR $(PKG_BUILD_DIR)/$(PKG_NAME)/* $(1)/usr/share/$(PKG_NAME) +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/package/lean/UnblockNeteaseMusicGo/Makefile b/package/lean/UnblockNeteaseMusicGo/Makefile new file mode 100644 index 00000000000000..0b2a41c5851325 --- /dev/null +++ b/package/lean/UnblockNeteaseMusicGo/Makefile @@ -0,0 +1,65 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=UnblockNeteaseMusicGo +PKG_VERSION:=0.1.9 +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/cnsilvan/UnblockNeteaseMusic.git +PKG_SOURCE_VERSION:=d0ca5dcef952ba77ba1abaf3d0f659e600c8c1f1 +PKG_MAINTAINER:=Silvan + +PKG_SOURCE_SUBDIR:=$(PKG_NAME) +PKG_SOURCE:=$(PKG_SOURCE_SUBDIR)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) + +PKG_BUILD_DEPENDS:=golang/host +PKG_BUILD_PARALLEL:=1 +PKG_USE_MIPS16:=0 + +GO_PKG:=github.com/cnsilvan/UnblockNeteaseMusic +GO_PKG_LDFLAGS:=-s -w +GO_PKG_LDFLAGS_X:= \ + $(GO_PKG)/version.Version=$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk + +define Package/$(PKG_NAME) + SECTION:=net + CATEGORY:=Network + TITLE:=Revive Netease Cloud Music (Golang) + DEPENDS:=$(GO_ARCH_DEPENDS) + URL:=https://github.com/cnsilvan/UnblockNeteaseMusic + SUBMENU:=NeteaseMusic +endef + +define Package/$(PKG_NAME)/description +Revive Netease Cloud Music (Golang) +endef + +define Build/Prepare + tar -zxvf $(DL_DIR)/$(PKG_SOURCE) -C $(BUILD_DIR)/$(PKG_NAME) --strip-components 1 +endef + +define Build/Configure + +endef + +define Build/Compile + $(eval GO_PKG_BUILD_PKG:=$(GO_PKG)) + $(call GoPackage/Build/Configure) + $(call GoPackage/Build/Compile) + $(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/UnblockNeteaseMusic + chmod +wx $(GO_PKG_BUILD_BIN_DIR)/UnblockNeteaseMusic +endef + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(GO_PKG_BUILD_BIN_DIR)/UnblockNeteaseMusic $(1)/usr/bin/UnblockNeteaseMusic + $(INSTALL_DIR) $(1)/usr/share/UnblockNeteaseMusicGo + $(CP) ./files/* $(1)/usr/share/UnblockNeteaseMusicGo/ + +endef +$(eval $(call GoBinPackage,$(PKG_NAME))) +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/package/lean/UnblockNeteaseMusicGo/files/ca.crt b/package/lean/UnblockNeteaseMusicGo/files/ca.crt new file mode 100644 index 00000000000000..4101eb3451c982 --- /dev/null +++ b/package/lean/UnblockNeteaseMusicGo/files/ca.crt @@ -0,0 +1,21 @@ +-----BEGIN CERTIFICATE----- +MIIDdzCCAl+gAwIBAgIJAKX8LdIETDklMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNV +BAYTAkNOMSQwIgYDVQQDDBtVbmJsb2NrTmV0ZWFzZU11c2ljIFJvb3QgQ0ExHTAb +BgNVBAoMFEdpdEh1Yi5jb20gQG5vbmRhbmVlMB4XDTE5MDUxODE2MDU0NVoXDTI0 +MDUxNjE2MDU0NVowUjELMAkGA1UEBhMCQ04xJDAiBgNVBAMMG1VuYmxvY2tOZXRl +YXNlTXVzaWMgUm9vdCBDQTEdMBsGA1UECgwUR2l0SHViLmNvbSBAbm9uZGFuZWUw +ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQD23K6Ti2TfLJToCmpCAVgE +Xb8+qTMfrifCpnKlJ+hrL+4KI1j4vSqTOOatqmxGSXZdF/j2kJuI40YThaokcgYx +GFcPcEftSCYGWy8o20u2hzTkkW3KW9wlsDRIXICFXVIsHeSDwz+aVSudkyJHjfaS +aLNb5pPovE7MRj8tDbp55scaSqhEcOe3m1ZlwlCeeXvD7RLKr3xhBKbGEqlJAjFq +RNGzuqylqyJVBLScNHC7Lcf4n6pKr1yPGOeLePOUrIwtj0ynHUcBfeMuCVCsIKL8 +vy/oNwlDrZaAMfu5QQslzEf87KY1QgtI6Ppii+tzbmVx1ZxnlaCKqiuwlgBoi/5r +AgMBAAGjUDBOMB0GA1UdDgQWBBRDhbGjnXEUouE9wNFS2k9PtgYYjDAfBgNVHSME +GDAWgBRDhbGjnXEUouE9wNFS2k9PtgYYjDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3 +DQEBCwUAA4IBAQDRUh5+JFLEALXQkhPfwrVf4sCXTwLMwVujTPo3NMbhpWiP4cnn +XHGCD5V57bBwjeD6NSrczDIdnN9uTJyFmLNVFMZBguEIeZfLUJLJ6w1ZhfgciX1D +9djyyo6eclkHvi+aPZKfzgMmc5BvHcjyUyS5MzI23kUW6WXUDn3IDIUKrfaH9Mjc +/d4DDZVKQCYrLoBL+XO7pEHUY0u9XZVYWEavQ5tSN8XY1SDrO0yGUpRWET0ltubE +zV7W0LOhuoVCiemboc5H8+njBjCis8obAo1XMmDZzW189L9GPFxHNWlka+KlajZB +tMo90PooZYEOw1rTUrzHb+VZY/tYIAAomGZ0 +-----END CERTIFICATE----- diff --git a/package/lean/UnblockNeteaseMusicGo/files/server.crt b/package/lean/UnblockNeteaseMusicGo/files/server.crt new file mode 100644 index 00000000000000..b58111aee7e5ed --- /dev/null +++ b/package/lean/UnblockNeteaseMusicGo/files/server.crt @@ -0,0 +1,21 @@ +-----BEGIN CERTIFICATE----- +MIIDfTCCAmWgAwIBAgIJAKTlW9B59i1HMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNV +BAYTAkNOMSQwIgYDVQQDDBtVbmJsb2NrTmV0ZWFzZU11c2ljIFJvb3QgQ0ExHTAb +BgNVBAoMFEdpdEh1Yi5jb20gQG5vbmRhbmVlMB4XDTE5MDUxODE2MDYxOFoXDTIw +MDUxNzE2MDYxOFowezELMAkGA1UEBhMCQ04xETAPBgNVBAcMCEhhbmd6aG91MSww +KgYDVQQKDCNOZXRFYXNlIChIYW5nemhvdSkgTmV0d29yayBDby4sIEx0ZDERMA8G +A1UECwwISVQgRGVwdC4xGDAWBgNVBAMMDyoubXVzaWMuMTYzLmNvbTCCASIwDQYJ +KoZIhvcNAQEBBQADggEPADCCAQoCggEBALobECypwEoe8VqM/FJvBRR3p2T+ZWdi +MSPrwfiRJr5p7OMtWBlLveCBV85+R3feidYbQTXlvVTdToY+GN6mFE1x6zG2dvLD +s4UuRnipmvGcFYhIRTX8J4AJiN8VMtW0TNXscRMudpz/FAVtsRrggRaThYg4f/rI +oAPMqKMsS4JoYhxs9ED6E6/tpj3XmSg1ekaXhgacYSYHeyxizZwoOFVCLH3TG5sF +sD6CYNnukYol8bR+VRpvHftIYss5Yz+DyyhYEAMJm1CfQo+xoGR3D0ozbT3hUnzm +fEoOhmSp3sALrFVE4iJSuajoh2/3xhmcyi3xZdWyq4F8hpb+URyaoW0CAwEAAaMt +MCswKQYDVR0RBCIwIIINbXVzaWMuMTYzLmNvbYIPKi5tdXNpYy4xNjMuY29tMA0G +CSqGSIb3DQEBCwUAA4IBAQB32SVz5jHUYv3ZG7SNF/LFJ904/LI8QlTe9R+Abb9z +bpXmQeo4pvNNOk3LgcTyuSIPQSHEFn32hk/MedB6Q2cKaGVKQq7Usne1jsV0JirG +wMx3PTcKPnX+XexRY8s6v6cNKSx5YlMQNFeH7p8MgKqdM/UX/dNCxT04X/ClmP1K +/rKqonXn4i3wmWprl7Q7Z1wqt0ygQRkNJKqdYKTu4oQcPON8/dRcseYdJzSoK2/G +H6cOJwKrRLzuUqQlphe6wyUsyTIbIJiFu1a1Gml6zB4lhLZhL89H2lYwdS8wWlc+ +M+wYi+XTM/ylNHEIoKsOe2nscnwi/hTfHJOPPchHbEuM +-----END CERTIFICATE----- diff --git a/package/lean/UnblockNeteaseMusicGo/files/server.key b/package/lean/UnblockNeteaseMusicGo/files/server.key new file mode 100644 index 00000000000000..ce16c73adc99d8 --- /dev/null +++ b/package/lean/UnblockNeteaseMusicGo/files/server.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEAuhsQLKnASh7xWoz8Um8FFHenZP5lZ2IxI+vB+JEmvmns4y1Y +GUu94IFXzn5Hd96J1htBNeW9VN1Ohj4Y3qYUTXHrMbZ28sOzhS5GeKma8ZwViEhF +NfwngAmI3xUy1bRM1exxEy52nP8UBW2xGuCBFpOFiDh/+sigA8yooyxLgmhiHGz0 +QPoTr+2mPdeZKDV6RpeGBpxhJgd7LGLNnCg4VUIsfdMbmwWwPoJg2e6RiiXxtH5V +Gm8d+0hiyzljP4PLKFgQAwmbUJ9Cj7GgZHcPSjNtPeFSfOZ8Sg6GZKnewAusVUTi +IlK5qOiHb/fGGZzKLfFl1bKrgXyGlv5RHJqhbQIDAQABAoIBAEmAvtalBMlBh1mY +LV/xcTQwPfDpeOtoILhrOOUPjxnNhD4FfrIe9BNjgmaQAXIadp4VjZ/X6PtHnOfw +RqpJNeOQhq/PvRMMsC59pF+rvQKH/wkgYhV8Ta2IFoLlQHqfB2nGRLKquzYumJ28 +QSK4YMOl6CtxBTrrWiemAUTRDdGm8tARiipJH1SEJrS6d/NoRoJx2vixFgD2eS6X +bjnhGjIzvX/w5FWjctqj+SFITP1UI62b6DyWsPOkoosKNteK+Ulz+K6ZFvOx7day +XgUoTcVpwCVr2dVGhJtOrbKPcl1jYCYHJAHwzUZND4x4yftm1mnnsi3bthYqbtHQ +vxLE9YECgYEA9hiZxwiVvLjSe1xT/D75HbB8S1XSnwzpMmqgzStguxCQ0Qg5yiLI +UKRDY8UZvEDV4i2bQGy7mk8lFvX1q2z7Q30+dtT9r2N9a6ujMk5RMfo2BZg/poI6 +yDWe2tKUg9cTwfgni4TutLOYkpz3VDPIQHs3k2mpNh7f+8X4RIybDqkCgYEAwZhp +uWMV38Bb0WytswHXL1dRuwBskKqALUBY61dtXkyBuocj8AuRRxfxfZpgJRrHFxDX +O9bQ2nxpVlwKsR6DJDUdxU3+kvwyPfseU5XUBey8WdkuAKD7cKZOHMhFVWccks0U +YJzykNrxB+rGTiwVKa0MOhipuJ7boerwwaN2SyUCgYBP9Ow5o4tq9q3EUNoksZ0k +zUuE+oxlCr/VlplKL9bM0HQMxlxoVWa59LTEfKyA4pvbUbAIfYtydlZ5oE5CdTUp +105tM4R88Jk2W1y5ooJ093OH29CKW/OXSvyi4hpIv592vRa0GOupoFRpBkDBhdWB +RcdnyMOmht+FIOwp8XkLiQKBgAUK3j4Y6ZnxXbLfvMp70soF4TgYs7s05a/IDEjc +9xlMrthX6sS22GrcocqeucBdqS/dnW2Ok9QNB4VbUl/4pnvL8mGQPYBAl2Jr5wdQ +ULxyxRkmAf+8MbBmdIRlZwDpdaIRO2Wk0OCbA0osgEvK9CYovrfIqqsHYDsgbnLs +ugkNAoGBAJok06BN05caPXXLQ2pMwI/7mjcZFjcOMxSloYi7LFkxlyvoTqReAeSa +yOb6W/7obS1X8ms/EAkqiyzJuPtNZJCW/nvV0iCoZ/NxLuyHnFaO344GBAweol+S +Jx0MY8KuDCyeGErc2xdz/yr3ld2PSTq71dhBluGyba2YX+peJ2Yv +-----END RSA PRIVATE KEY----- diff --git a/package/lean/adbyby/Makefile b/package/lean/adbyby/Makefile new file mode 100644 index 00000000000000..21c782d6b99bab --- /dev/null +++ b/package/lean/adbyby/Makefile @@ -0,0 +1,76 @@ +# +# Copyright (C) 2015-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v3. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=adbyby +PKG_VERSION:=2.7 +PKG_RELEASE:=20200310 + +include $(INCLUDE_DIR)/package.mk + +define Package/$(PKG_NAME) + SECTION:=net + CATEGORY:=Network + TITLE:=Powerful adblock module to block ad. + DEPENDS:=@(x86||x86_64||arm||mipsel||mips||aarch64) + URL:=http://www.adbyby.com/ +endef + +define Package/$(PKG_NAME)/description +Adbyby is a powerful adblock module to block ad,just like adblock. +endef + +ifeq ($(ARCH),x86_64) + ADBYBY_DIR:=amd64 +endif +ifeq ($(ARCH),mipsel) + ADBYBY_DIR:=mipsle +endif +ifeq ($(ARCH),mips) + ADBYBY_DIR:=mips +endif +ifeq ($(ARCH),i386) + ADBYBY_DIR:=x86 +endif +ifeq ($(ARCH),arm) + ADBYBY_DIR:=armv7 + ifeq ($(BOARD),bcm53xx) + ADBYBY_DIR:=arm + endif + ifeq ($(BOARD),kirkwood) + ADBYBY_DIR:=arm + endif +endif +ifeq ($(ARCH),aarch64) + ADBYBY_DIR:=armv7 +endif + +define Build/Prepare +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/usr/share/adbyby + $(INSTALL_BIN) ./files/adbyby.sh $(1)/usr/share/adbyby/ + $(INSTALL_CONF) ./files/adhook.ini $(1)/usr/share/adbyby/ + $(INSTALL_CONF) ./files/user.action $(1)/usr/share/adbyby/ + + $(INSTALL_DIR) $(1)/usr/share/adbyby/data + $(INSTALL_DATA) ./files/data/* $(1)/usr/share/adbyby/data/ + + $(INSTALL_DIR) $(1)/usr/share/adbyby/doc + $(INSTALL_DATA) ./files/doc/* $(1)/usr/share/adbyby/doc/ + + $(INSTALL_BIN) ./files/$(ADBYBY_DIR)/adbyby $(1)/usr/share/adbyby/adbyby +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/package/lean/adbyby/files/adbyby.sh b/package/lean/adbyby/files/adbyby.sh new file mode 100644 index 00000000000000..146a070d1b17a9 --- /dev/null +++ b/package/lean/adbyby/files/adbyby.sh @@ -0,0 +1,16 @@ +#!/bin/sh +PROG_PATH=/usr/share/adbyby +err=0 +until [ $err -ge 5 ]; do + if [ -n "$(pgrep $PROG_PATH/adbyby)" ]; then + iptables-save | grep ADBYBY >/dev/null || \ + /etc/init.d/adbyby add_rule + sleep 10 + err=0 + else + $PROG_PATH/adbyby --no-daemon &>/dev/null & + sleep 1 + err=$((err+1)) + fi +done +/etc/init.d/adbyby del_rule diff --git a/package/lean/adbyby/files/adhook.ini b/package/lean/adbyby/files/adhook.ini new file mode 100644 index 00000000000000..6a7613ea8756a5 --- /dev/null +++ b/package/lean/adbyby/files/adhook.ini @@ -0,0 +1,14 @@ +[cfg] +### 2.1 ### +listen-address=0.0.0.0:8118 +buffer-limit=1024 +keep-alive-timeout=30 +socket-timeout=60 +### 2.5 ### +max_client_connections=0 +### 2.6 ### +stack_size=200 +auto_restart=0 +### 2.7 ### +debug=0 +ipset=0 diff --git a/package/lean/adbyby/files/amd64/adbyby b/package/lean/adbyby/files/amd64/adbyby new file mode 100644 index 00000000000000..76c8fa08403042 Binary files /dev/null and b/package/lean/adbyby/files/amd64/adbyby differ diff --git a/package/lean/adbyby/files/arm/adbyby b/package/lean/adbyby/files/arm/adbyby new file mode 100644 index 00000000000000..a7da1900d9c929 Binary files /dev/null and b/package/lean/adbyby/files/arm/adbyby differ diff --git a/package/lean/adbyby/files/armv7/adbyby b/package/lean/adbyby/files/armv7/adbyby new file mode 100644 index 00000000000000..fbbf33f778309e Binary files /dev/null and b/package/lean/adbyby/files/armv7/adbyby differ diff --git a/package/lean/adbyby/files/data/lazy.bin b/package/lean/adbyby/files/data/lazy.bin new file mode 100644 index 00000000000000..23e6a8d70a4451 Binary files /dev/null and b/package/lean/adbyby/files/data/lazy.bin differ diff --git a/package/lean/adbyby/files/data/lazy.txt b/package/lean/adbyby/files/data/lazy.txt new file mode 100644 index 00000000000000..5d383c7114e8ae --- /dev/null +++ b/package/lean/adbyby/files/data/lazy.txt @@ -0,0 +1,25 @@ +! -----ʱ: 2018-10-08 23:07:52 by:xwhyc----- +.php?ad= +/99rejs/js +/agetsou.js^ +/c@*!25.js|$script +/cococ-66/$script +/defaultts.tc.qq.com/*.ts?index=0&start=0& +/defaultts.tc.qq.com/*.ts?index=0&start=0&end=*&ver=4 +/gg_js/ +/imgs.js?t= +/js/adtop.js| +/js/guanggao_gg.js?d= +/js/sss/ad.js +/static/js/aall.js +/unionjs/$script +/variety.tc.qq.com/*.mp4^*fmt=hd +/variety.tc.qq.com/*.mp4^*fmt=shd +/video.dispatch.tc.qq.com/*.mp4^*sdtfrom= +/view/image/QT_HY.jpg?t= +/view/js/slade.js|$script +/vlive.qqvideo.tc.qq.com/*.mp4^*fmt=hd +/vlive.qqvideo.tc.qq.com/*.mp4^*fmt=shd +/vmind.qqvideo.tc.qq.com/*.mp4^*sdtfrom= +/vmindhls.tc.qq.com/*ugc=0&ga=0&gv=0&start= +/zzhzgg.js \ No newline at end of file diff --git a/package/lean/adbyby/files/data/rules.txt b/package/lean/adbyby/files/data/rules.txt new file mode 100644 index 00000000000000..5c44b0e8c5fa84 --- /dev/null +++ b/package/lean/adbyby/files/data/rules.txt @@ -0,0 +1,15 @@ +! ------------------------------ ADByby 自定义过滤语法简表--------------------------------- +! -------------- 规则基于abp规则,并进行了字符替换部分的扩展----------------------------- +! ABP规则请参考https://adblockplus.org/zh_CN/filters,下面为大致摘要 +! "!" 为行注释符,注释行以该符号起始作为一行注释语义,用于规则描述 +! "*" 为字符通配符,能够匹配0长度或任意长度的字符串,该通配符不能与正则语法混用。 +! "^" 为分隔符,可以是除了字母、数字或者 _ - . % 之外的任何字符。 +! "|" 为管线符号,来表示地址的最前端或最末端 +! "||" 为子域通配符,方便匹配主域名下的所有子域。 +! "~" 为排除标识符,通配符能过滤大多数广告,但同时存在误杀, 可以通过排除标识符修正误杀链接。 +! "##" 为元素选择器标识符,后面跟需要隐藏元素的CSS样式例如 #ad_id .ad_class +!! 元素隐藏暂不支持全局规则和排除规则 +!! 字符替换扩展 +! 文本替换选择器标识符,后面跟需要替换的文本数据,格式:$s@模式字符串@替换后的文本@ +! 支持通配符*和? +! ------------------------------------------------------------------------------------------- diff --git a/package/lean/adbyby/files/data/user.txt b/package/lean/adbyby/files/data/user.txt new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/package/lean/adbyby/files/data/video.txt b/package/lean/adbyby/files/data/video.txt new file mode 100644 index 00000000000000..3991c48fc187af --- /dev/null +++ b/package/lean/adbyby/files/data/video.txt @@ -0,0 +1,30 @@ +! -----ʱ: 2018-10-08 23:06:11 by:xwhyc----------------------------------------------- +! -----淴:http://www.adbyby.com/help.htm QQȺ: 79547134(), 364066294()470705224()534897434,438394572-------------- + + +!------------------------------------------- +/showadv/ +3199.cn###ad640,[id^="ad0"] +76fengyun.com###down_box{display:block!important;}.gggg,.ggao +9553.com##[class="zm"] +962.net##.show_ad,.g-962-ad +amazon.cn##.adv-float-div +downsx.rocks##.adbox,.Left-ad3_fixed,.google-ad2_fixed +edu-acc.cn###doyoo_monitor +fx678.com##[class^="adv-"] +||76fengyun.com/body22233.js +||76fengyun.com/file/$s@onclick="window.open('*');startWait();"@onclick="window.open(document.getElementById('downpage_link').href);startWait();"@ +||atanx.alicdn.com/t/tanxssp.js?_v= +||biquguan.com/guan/$script +||djv99sxoqpv11.cloudfront.net +||jmxlaser.com +||jump2.bdimg.com/p/$s@ +<%+cbi/valuefooter%> diff --git a/package/lean/luci-app-dockerman/luasrc/view/dockerman/cbi/xfvalue.htm b/package/lean/luci-app-dockerman/luasrc/view/dockerman/cbi/xfvalue.htm new file mode 100644 index 00000000000000..04f7bc2ee865b7 --- /dev/null +++ b/package/lean/luci-app-dockerman/luasrc/view/dockerman/cbi/xfvalue.htm @@ -0,0 +1,10 @@ +<%+cbi/valueheader%> + /> + disabled <% end %><%= + attr("id", cbid) .. attr("name", cbid) .. attr("value", self.enabled or 1) .. + ifattr((self:cfgvalue(section) or self.default) == self.enabled, "checked", "checked") + %> /> + > +<%+cbi/valuefooter%> diff --git a/package/lean/luci-app-dockerman/luasrc/view/dockerman/cbi/xsimpleform.htm b/package/lean/luci-app-dockerman/luasrc/view/dockerman/cbi/xsimpleform.htm new file mode 100644 index 00000000000000..7cfe8bf2188cbf --- /dev/null +++ b/package/lean/luci-app-dockerman/luasrc/view/dockerman/cbi/xsimpleform.htm @@ -0,0 +1,89 @@ +<% + if not self.embedded then + %>
> + + + <% + end + + %>
<% + + if self.title and #self.title > 0 then + %>

<%=self.title%>

<% + end + + if self.description and #self.description > 0 then + %>
<%=self.description%>
<% + end + + self:render_children() + + %>
<% + + if self.message then + %>
<%=self.message%>
<% + end + + if self.errmessage then + %>
<%=self.errmessage%>
<% + end + + if not self.embedded then + if type(self.hidden) == "table" then + local k, v + for k, v in pairs(self.hidden) do + %><% + end + end + + local display_back = (self.redirect) + local display_cancel = (self.cancel ~= false and self.on_cancel) + local display_skip = (self.flow and self.flow.skip) + local display_submit = (self.submit ~= false) + local display_reset = (self.reset ~= false) + + if display_back or display_cancel or display_skip or display_submit or display_reset then + %>
<% + + if display_back then + %> <% + end + + if display_cancel then + local label = pcdata(self.cancel or translate("Cancel")) + %> <% + end + + if display_skip then + %> <% + end + + if display_submit then + local label = pcdata(self.submit or translate("Submit")) + %> <% + end + + if display_reset then + local label = pcdata(self.reset or translate("Reset")) + %> <% + end + + %>
<% + end + + %>
<% + end +%> + + diff --git a/package/lean/luci-app-dockerman/luasrc/view/dockerman/container.htm b/package/lean/luci-app-dockerman/luasrc/view/dockerman/container.htm new file mode 100644 index 00000000000000..70e552444da57c --- /dev/null +++ b/package/lean/luci-app-dockerman/luasrc/view/dockerman/container.htm @@ -0,0 +1,25 @@ +
+ + + diff --git a/package/lean/luci-app-dockerman/luasrc/view/dockerman/container_file.htm b/package/lean/luci-app-dockerman/luasrc/view/dockerman/container_file.htm new file mode 100644 index 00000000000000..07e6c7374937b4 --- /dev/null +++ b/package/lean/luci-app-dockerman/luasrc/view/dockerman/container_file.htm @@ -0,0 +1,54 @@ + +
+ +
+ +
+
+ +
+ +
+
+
+ + +
+
+ diff --git a/package/lean/luci-app-dockerman/luasrc/view/dockerman/logs.htm b/package/lean/luci-app-dockerman/luasrc/view/dockerman/logs.htm new file mode 100644 index 00000000000000..6e189c66af2d3b --- /dev/null +++ b/package/lean/luci-app-dockerman/luasrc/view/dockerman/logs.htm @@ -0,0 +1,10 @@ +<% if self.title == translate("Docker Events") then %> +<%+header%> +<% end %> +

<%=self.title%>

+
+ +
+<% if self.title == translate("Docker Events") then %> +<%+footer%> +<% end %> diff --git a/package/lean/luci-app-dockerman/luasrc/view/dockerman/overview.htm b/package/lean/luci-app-dockerman/luasrc/view/dockerman/overview.htm new file mode 100644 index 00000000000000..e9b4431497449e --- /dev/null +++ b/package/lean/luci-app-dockerman/luasrc/view/dockerman/overview.htm @@ -0,0 +1,281 @@ + + +
+
+
+
+
+ + Docker icon + + +
+
+
+

<%:Containers%>

+

+ <%- if self.containers_total ~= "-" then -%><%- end -%> + <%=self.containers_running%> + /<%=self.containers_total%> + <%- if self.containers_total ~= "-" then -%><%- end -%> +

+
+
+
+
+
+
+
+ + + + + +
+
+
+

<%:Images%>

+

+ <%- if self.images_total ~= "-" then -%><%- end -%> + <%=self.images_used%> + /<%=self.images_total%> + <%- if self.images_total ~= "-" then -%><%- end -%> +

+
+
+
+
+
+
+
+ + + + + + + + + +
+
+
+

<%:Networks%>

+

+ <%- if self.networks_total ~= "-" then -%><%- end -%> + <%=self.networks_total%> + + <%- if self.networks_total ~= "-" then -%><%- end -%> +

+
+
+
+
+
+
+
+ + + +
+
+
+

<%:Volumes%>

+

+ <%- if self.volumes_total ~= "-" then -%><%- end -%> + <%=self.volumes_total%> + + <%- if self.volumes_total ~= "-" then -%><%- end -%> +

+
+
+
+
diff --git a/package/lean/luci-app-dockerman/luasrc/view/dockerman/resolv_container.htm b/package/lean/luci-app-dockerman/luasrc/view/dockerman/resolv_container.htm new file mode 100644 index 00000000000000..38abc914c3480e --- /dev/null +++ b/package/lean/luci-app-dockerman/luasrc/view/dockerman/resolv_container.htm @@ -0,0 +1,94 @@ + + +<%+cbi/valueheader%> + + +<%+cbi/valuefooter%> diff --git a/package/lean/luci-app-dockerman/luasrc/view/dockerman/stats.htm b/package/lean/luci-app-dockerman/luasrc/view/dockerman/stats.htm new file mode 100644 index 00000000000000..2016181c58be73 --- /dev/null +++ b/package/lean/luci-app-dockerman/luasrc/view/dockerman/stats.htm @@ -0,0 +1,60 @@ + diff --git a/package/lean/luci-app-dockerman/po/zh-cn/dockerman.po b/package/lean/luci-app-dockerman/po/zh-cn/dockerman.po new file mode 100644 index 00000000000000..9737507ca9b534 --- /dev/null +++ b/package/lean/luci-app-dockerman/po/zh-cn/dockerman.po @@ -0,0 +1,359 @@ +msgid "Containers" +msgstr "容器" + +msgid "Images" +msgstr "镜像" + +msgid "Networks" +msgstr "网络" + +msgid "Volumes" +msgstr "存储卷" + +msgid "Events" +msgstr "事件" + +msgid "Docker Contaienr" +msgstr "Docker 容器" + +msgid "Start" +msgstr "启动" + +msgid "Restart" +msgstr "重启" + +msgid "Stop" +msgstr "停止" + +msgid "Upgrade" +msgstr "升级容器" + +msgid "Duplicate" +msgstr "复制容器" + +msgid "Remove" +msgstr "移除" + +msgid "Name" +msgstr "名称" + +msgid "Image" +msgstr "镜像" + +msgid "Status" +msgstr "状态" + +msgid "Created" +msgstr "创建时间" + +msgid "Start Time" +msgstr "启动时间" + +msgid "Healthy" +msgstr "健康" + +msgid "Restart Policy" +msgstr "重启策略" + +msgid "Update" +msgstr "更新" + +msgid "Device(--device)" +msgstr "设备(--device)" + +msgid "Mount/Volume" +msgstr "挂载/存储卷" + +msgid "Command" +msgstr "启动命令" + +msgid "Setting" +msgstr "设置" + +msgid "Driver" +msgstr "驱动" + +msgid "Env" +msgstr "环境变量" + +msgid "Ports" +msgstr "端口" + +msgid "Links" +msgstr "链接" + +msgid "Disconnect" +msgstr "断开" + +msgid "Connect Network" +msgstr "连接网络" + +msgid "Connect" +msgstr "连接" + +msgid "Info" +msgstr "信息" + +msgid "CPUs" +msgstr "CPU数量" + +msgid "Number of CPUs. Number is a fractional number. 0.000 means no limit." +msgstr "CPU数量,数字是小数,0.000表示没有限制。" + +msgid "CPU Shares Weight" +msgstr "CPU份额权重" + +msgid "CPU shares relative weight, if 0 is set, the system will ignore the value and use the default of 1024." +msgstr "CPU份额相对权重,如果设置为0,则系统将忽略该值,并使用默认值1024。" + +msgid "Memory" +msgstr "内存" + +msgid "Memory limit (format: []). Number is a positive integer. Unit can be one of b, k, m, or g. Minimum is 4M." +msgstr "内存限制 (格式: <容量>[<单位>]). 数字是一个正整数。单位可以是b,k,m或g之一。最小为4M。" + +msgid "Block IO Weight" +msgstr "IO 权重" + +msgid "Block IO weight (relative weight) accepts a weight value between 10 and 1000." +msgstr "IO 权重 (相对权重) 接受10到1000之间的权重值。" + +msgid "Container Logs" +msgstr "容器日志" + +msgid "RepoTags" +msgstr "标签" + +msgid "Size" +msgstr "大小" + +msgid "Force Remove" +msgstr "强制移除" + +msgid "Subnet" +msgstr "子网络" + +msgid "Gateway" +msgstr "网关" + +msgid "New" +msgstr "新建" + +msgid "Resolv CLI" +msgstr "解析命令行" + +msgid "Docker Image" +msgstr "Docker 镜像" + +msgid "User(-u)" +msgstr "用户(-u)" + +msgid "New Container" +msgstr "新容器" + +msgid "Container Name" +msgstr "容器名称" + +msgid "Interactive (-i)" +msgstr "互动式 (-i)" + +msgid "Always pull image first" +msgstr "始终先拉取镜像" + +msgid "Privileged" +msgstr "特权模式(--privileged)" + +msgid "IPv4 Address" +msgstr "IPv4 地址" + +msgid "Links with other containers" +msgstr "与其他容器的链接(--link)" + +msgid "Environmental Variable(-e)" +msgstr "环境变量(-e)" + +msgid "Bind Mount(-v)" +msgstr "挂载(-v)" + +msgid "Exposed Ports(-p)" +msgstr "暴露端口(-p)" + +msgid "Run command" +msgstr "运行命令" + +msgid "Advance" +msgstr "高级" + +msgid "Mount tmpfs directory" +msgstr "挂载tmpfs到容器内部目录" + +msgid "New Network" +msgstr "新网络" + +msgid "Network Name" +msgstr "网络名称" + +msgid "Parent Interface" +msgstr "父接口" + +msgid "Macvlan Mode" +msgstr "Macvlan模式" + +msgid "Ipvlan Mode" +msgstr "Ipvlan模式" + +msgid "Ingress network is the network which provides the routing-mesh in swarm mode." +msgstr "Ingress网络是在群集模式下提供路由网的网络。" + +msgid "Options" +msgstr "选项" + +msgid "Restrict external access to the network" +msgstr "限制外部访问网络" + +msgid "IP range" +msgstr "IP范围" + +msgid "Exclude IPs" +msgstr "排除IP" + +msgid "Enable IPv6" +msgstr "启用IPv6" + +msgid "IPv6 Subnet" +msgstr "IPv6子网" + +msgid "IPv6 Gateway" +msgstr "IPv6网关" + +msgid "Docker Version" +msgstr "Docker版本" + +msgid "Api Version" +msgstr "API版本" + +msgid "Total Memory" +msgstr "总内存" + +msgid "Docker Root Dir" +msgstr "Docker根目录" + +msgid "Index Server Address" +msgstr "默认服务器地址" + +msgid "Socket Path" +msgstr "Socket路径" + +msgid "Action Status Tempfile Path" +msgstr "Docker 动作状态的临时文件路径" + +msgid "Where you want to save the docker status file" +msgstr "保存docker status文件的位置" + +msgid "Enable WAN access Dokcer" +msgstr "允许 WAN 访问 Dokcer" + +msgid "Enable WAN access docker mapped ports (need reload Docker-ce service)" +msgstr "允许 WAN 访问 Dokcer 映射后的端口(易受攻击!)。

如已更改此选项,需要点击应用并保存后重启docker服务。
推荐禁用该选项后,用系统防火墙选择性映射 172.17.0.X:XX 端口到 WAN" + +msgid "Enable Debug" +msgstr "启用调试" + +msgid "For debug, It shows all docker API actions of luci-app-dockerman in Debug Tempfile Path" +msgstr "用于调试,在调试临时文件路径中显示 luci-app-dockerman 的所有 Docker API 操作" + +msgid "Debug Tempfile Path" +msgstr "调试临时文件路径" + +msgid "Where you want to save the debug tempfile" +msgstr "保存调试临时文件的位置" + +msgid "Edit" +msgstr "编辑" + +msgid "Stats" +msgstr "状态" + +msgid "Logs" +msgstr "日志" + +msgid "Network TX/RX" +msgstr "网络发送/接收" + +msgid "CPU Useage" +msgstr "CPU用量" + +msgid "Memory Useage" +msgstr "内存用量" + +msgid "Docker Container" +msgstr "Docker 容器" + +msgid "Overview" +msgstr "概况" + +msgid "Pull Image" +msgstr "拉取镜像" + +msgid "Pull" +msgstr "拉取" + +msgid "Command line" +msgstr "输入命令行" + +msgid "Plese input command line:" +msgstr "请输入 docker run/create ... 命令行:" + +msgid "Network Name" +msgstr "网络名" + +msgid "Set custom DNS servers" +msgstr "自定义 DNS 服务器" + +msgid "The user that commands are run as inside the container.(format: name|uid[:group|gid])" +msgstr "容器内部执行命令的用户(组), 格式: UID:GID" + +msgid "Set environment variables to inside the container" +msgstr "容器内部环境变量" + +msgid "Bind mount a volume" +msgstr "绑定挂载" + +msgid "Publish container's port(s) to the host" +msgstr "将容器的端口发布到宿主" + +msgid "Add host device to the container" +msgstr "添加宿主设备到容器内部" + +msgid "Device" +msgstr "设备" + +msgid "Finish Time" +msgstr "结束时间" + +msgid "Command line Error" +msgstr "命令行错误" + +msgid "Host Name" +msgstr "主机名称" + +msgid "The hostname to use for the container" +msgstr "容器使用的主机名" + +msgid "File" +msgstr "文件" + +msgid "Upload" +msgstr "上传" + +msgid "Download" +msgstr "下载" + +msgid "Path" +msgstr "路径" + +msgid "Upload Error" +msgstr "上传错误" + +msgid "Upload Success" +msgstr "上传成功" diff --git a/package/lean/luci-app-dockerman/root/etc/config/dockerman b/package/lean/luci-app-dockerman/root/etc/config/dockerman new file mode 100644 index 00000000000000..7ed6116633cc4d --- /dev/null +++ b/package/lean/luci-app-dockerman/root/etc/config/dockerman @@ -0,0 +1,6 @@ +config section 'local' + option socket_path '/var/run/docker.sock' + option status_path '/tmp/.docker_action_status' + option wan_mode 'false' + option debug_path '/tmp/.docker_debug' + option debug 'false' diff --git a/package/lean/luci-app-dockerman/root/etc/docker-init b/package/lean/luci-app-dockerman/root/etc/docker-init new file mode 100644 index 00000000000000..45b9769a51d45c --- /dev/null +++ b/package/lean/luci-app-dockerman/root/etc/docker-init @@ -0,0 +1,25 @@ +#!/bin/sh +dtype=`fdisk -l /dev/sda | grep 'Disklabel type' | awk '{print $3}'` +partid="0" + +if [ "$dtype" = "gpt" ] +then + partid=`echo "n + + + +w +" | fdisk /dev/sda | grep 'Created a new partition' | awk '{print $5}'` + +elif [ "$dtype" = "dos" ] +then + partid=`echo "n +p + + + +w +" | fdisk /dev/sda | grep 'Created a new partition' | awk '{print $5}'` +fi + +echo "y" | mkfs.ext4 /dev/sda$partid diff --git a/package/lean/luci-app-dockerman/root/etc/init.d/dockerd b/package/lean/luci-app-dockerman/root/etc/init.d/dockerd new file mode 100644 index 00000000000000..fb3f5e6dd07467 --- /dev/null +++ b/package/lean/luci-app-dockerman/root/etc/init.d/dockerd @@ -0,0 +1,22 @@ +#!/bin/sh /etc/rc.common + +USE_PROCD=1 +START=25 + +start_service() { + local nofile=$(cat /proc/sys/fs/nr_open) + local wanmode=$(uci get dockerman.local.wan_mode) + + if [ $wanmode = "true" ] ;then + dockerwan=" " + else + dockerwan="--iptables=false" + fi + + procd_open_instance + procd_set_param stderr 1 + procd_set_param command /usr/bin/dockerd $dockerwan + procd_set_param limits nofile="${nofile} ${nofile}" + procd_close_instance + +} diff --git a/package/lean/luci-app-familycloud/Makefile b/package/lean/luci-app-familycloud/Makefile new file mode 100644 index 00000000000000..ac8eb34edfe91c --- /dev/null +++ b/package/lean/luci-app-familycloud/Makefile @@ -0,0 +1,18 @@ +# Copyright (C) 2016 Openwrt.org +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI support for FamilyCloudSpeeder +LUCI_DEPENDS:=+coreutils +coreutils-nohup +libreadline +libcurl +libopenssl +bash +curl +wget +openssl-util +ca-certificates +ca-bundle +LUCI_PKGARCH:=all +PKG_NAME:=luci-app-familycloud +PKG_VERSION:=1 +PKG_RELEASE:=6 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + diff --git a/package/lean/luci-app-familycloud/luasrc/controller/familycloud.lua b/package/lean/luci-app-familycloud/luasrc/controller/familycloud.lua new file mode 100644 index 00000000000000..92cf489c49c40c --- /dev/null +++ b/package/lean/luci-app-familycloud/luasrc/controller/familycloud.lua @@ -0,0 +1,23 @@ + +module("luci.controller.familycloud", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/familycloud") then + return + end + + entry({"admin", "services", "familycloud"},firstchild(), _("天翼家庭云/云盘提速"), 80).dependent = false + + entry({"admin", "services", "familycloud", "general"},cbi("familycloud"), _("Base Setting"), 1) + entry({"admin", "services", "familycloud", "log"},form("familycloudlog"), _("Log"), 2) + + entry({"admin","services","familycloud","status"},call("act_status")).leaf=true +end + +function act_status() + local e={} + e.running=luci.sys.call("ps | grep speedup.sh | grep -v grep >/dev/null")==0 + luci.http.prepare_content("application/json") + luci.http.write_json(e) +end + diff --git a/package/lean/luci-app-familycloud/luasrc/model/cbi/familycloud.lua b/package/lean/luci-app-familycloud/luasrc/model/cbi/familycloud.lua new file mode 100644 index 00000000000000..d4a0b64281a5ee --- /dev/null +++ b/package/lean/luci-app-familycloud/luasrc/model/cbi/familycloud.lua @@ -0,0 +1,22 @@ + +mp = Map("familycloud", translate("天翼家庭云/天翼云盘提速")) +mp.description = translate("天翼家庭云/天翼云盘提速 (最高可达500Mbps)") + +mp:section(SimpleSection).template = "familycloud/familycloud_status" + +s = mp:section(TypedSection, "familycloud") +s.anonymous=true +s.addremove=false + +enabled = s:option(Flag, "enabled", translate("启用提速")) +enabled.default = 0 +enabled.rmempty = false + +speedtype = s:option(ListValue, "speedertype", translate("天翼提速包类型")) +speedtype:value("CloudDisk", translate("天翼云盘提速")) +speedtype:value("FamilyCloud", translate("天翼家庭云提速")) + +account = s:option(Value, "token", translate("AccessToken")) +account.datatype = "string" + +return mp diff --git a/package/lean/luci-app-familycloud/luasrc/model/cbi/familycloudlog.lua b/package/lean/luci-app-familycloud/luasrc/model/cbi/familycloudlog.lua new file mode 100644 index 00000000000000..9471b410d2ef02 --- /dev/null +++ b/package/lean/luci-app-familycloud/luasrc/model/cbi/familycloudlog.lua @@ -0,0 +1,14 @@ +local fs = require "nixio.fs" +local conffile = "/tmp/familycloud.log" + +f = SimpleForm("logview") + +t = f:field(TextValue, "conf") +t.rmempty = true +t.rows = 15 +function t.cfgvalue() + return fs.readfile(conffile) or "" +end +t.readonly="readonly" + +return f \ No newline at end of file diff --git a/package/lean/luci-app-familycloud/luasrc/view/familycloud/familycloud_status.htm b/package/lean/luci-app-familycloud/luasrc/view/familycloud/familycloud_status.htm new file mode 100644 index 00000000000000..002565430ad444 --- /dev/null +++ b/package/lean/luci-app-familycloud/luasrc/view/familycloud/familycloud_status.htm @@ -0,0 +1,22 @@ + + +
+

+ <%:Collecting data...%> +

+
\ No newline at end of file diff --git a/package/lean/luci-app-familycloud/root/etc/config/familycloud b/package/lean/luci-app-familycloud/root/etc/config/familycloud new file mode 100644 index 00000000000000..55b9172ee3910e --- /dev/null +++ b/package/lean/luci-app-familycloud/root/etc/config/familycloud @@ -0,0 +1,6 @@ + +config familycloud + option token 'f18a1952289c4659b3722ad54d3d92fb' + option speedertype 'CloudDisk' + option enabled '0' + diff --git a/package/lean/luci-app-familycloud/root/etc/init.d/familycloud b/package/lean/luci-app-familycloud/root/etc/init.d/familycloud new file mode 100644 index 00000000000000..974a81a240310c --- /dev/null +++ b/package/lean/luci-app-familycloud/root/etc/init.d/familycloud @@ -0,0 +1,25 @@ +#!/bin/sh /etc/rc.common + +START=99 +STOP=10 + +TYPE=$(uci get familycloud.@familycloud[0].speedertype) +TOKEN=$(uci get familycloud.@familycloud[0].token) + + +start() +{ + stop + enable=$(uci get familycloud.@familycloud[0].enabled) + [ $enable -eq 0 ] && exit 0 + sed "s/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/$TOKEN/" /usr/share/familycloud/$TYPE/config.ini > /tmp/config.json + bash /usr/share/familycloud/$TYPE/speedup.sh > /tmp/familycloud.log & +} + +stop() +{ + kill -9 $(ps | grep speedup.sh | grep -v grep | awk '{print $1}') >/dev/null 2>&1 +} + + + diff --git a/package/lean/luci-app-familycloud/root/etc/ppp/ip-up.d/familycloud.sh b/package/lean/luci-app-familycloud/root/etc/ppp/ip-up.d/familycloud.sh new file mode 100644 index 00000000000000..60074df64b0ec3 --- /dev/null +++ b/package/lean/luci-app-familycloud/root/etc/ppp/ip-up.d/familycloud.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +sleep 60 && /etc/init.d/familycloud restart diff --git a/package/lean/luci-app-familycloud/root/etc/uci-defaults/familycloud b/package/lean/luci-app-familycloud/root/etc/uci-defaults/familycloud new file mode 100644 index 00000000000000..0251b0eeee516f --- /dev/null +++ b/package/lean/luci-app-familycloud/root/etc/uci-defaults/familycloud @@ -0,0 +1,16 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@familycloud[-1] + add ucitrack familycloud + set ucitrack.@familycloud[-1].init=familycloud + commit ucitrack +EOF + +touch /tmp/config.json + +ln -s /tmp/config.json /usr/share/familycloud/CloudDisk/config.json + +rm -f /tmp/luci-indexcache + +exit 0 diff --git a/package/lean/luci-app-familycloud/root/usr/share/familycloud/CloudDisk/config.ini b/package/lean/luci-app-familycloud/root/usr/share/familycloud/CloudDisk/config.ini new file mode 100644 index 00000000000000..31f0d788a84953 --- /dev/null +++ b/package/lean/luci-app-familycloud/root/usr/share/familycloud/CloudDisk/config.ini @@ -0,0 +1,10 @@ +{ + "accessToken": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "setting": { + "method": "GET", + "rate": 600 + }, + "extra_header": { + "User-Agent": "Apache-HttpClient/UNAVAILABLE (java 1.4)" + } +} \ No newline at end of file diff --git a/package/lean/luci-app-familycloud/root/usr/share/familycloud/CloudDisk/speedup.sh b/package/lean/luci-app-familycloud/root/usr/share/familycloud/CloudDisk/speedup.sh new file mode 100644 index 00000000000000..30006574cf33d7 --- /dev/null +++ b/package/lean/luci-app-familycloud/root/usr/share/familycloud/CloudDisk/speedup.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +base_dir=`dirname $0` +source "$base_dir/utils.sh" +config="$base_dir/config.json" + + +accessToken=`getSingleJsonValue "$config" "accessToken"` +method=`getSingleJsonValue "$config" "method"` +rate=`getSingleJsonValue "$config" "rate"` +UA=`getSingleJsonValue "$config" "User-Agent"` +extra_header="User-Agent:$UA" + + +HOST="http://api.cloud.189.cn" +LOGIN_URL="/loginByOpen189AccessToken.action" +ACCESS_URL="/speed/startSpeedV2.action" +count=0 +echo "*******************************************" +while : +do + count=$((count+1)) + echo "Sending heart_beat package <$count>" + split="~" + headers_string="$extra_header" + headers=`formatHeaderString "$split" "$headers_string"` + result=`get "$HOST$LOGIN_URL?accessToken=$accessToken" "$headers"` + session_key=`echo "$result" | grep -Eo "sessionKey>.*//'` + session_secret=`echo "$result" | grep -Eo "sessionSecret>.*//' | sed 's/<\/sessionSecret//'` + date=`env LANG=C.UTF-8 date -u '+%a, %d %b %Y %T GMT'` + data="SessionKey=$session_key&Operate=$method&RequestURI=$ACCESS_URL&Date=$date" + key="$session_secret" + signature=`hashHmac "sha1" "$data" "$key"` + headers_string="SessionKey:$session_key"${split}"Signature:$signature"${split}"Date:$date"${split}"$extra_header" + headers=`formatHeaderString "$split" "$headers_string"` + qosClientSn="$session_key" + result=`get "$HOST$ACCESS_URL?qosClientSn=$qosClientSn" "$headers"` + echo "heart_beat:" + echo "date:<$date>" + echo -e "response:\n$result" + [[ "`echo ${result} | grep dialAcc`" != "" ]] && hint="succeeded" || hint="failed" + echo "Sending heart_beat package <$count> $hint" + echo "*******************************************" + sleep ${rate} +done diff --git a/package/lean/luci-app-familycloud/root/usr/share/familycloud/CloudDisk/speedup_router.sh b/package/lean/luci-app-familycloud/root/usr/share/familycloud/CloudDisk/speedup_router.sh new file mode 100644 index 00000000000000..769b5a63b52d1f --- /dev/null +++ b/package/lean/luci-app-familycloud/root/usr/share/familycloud/CloudDisk/speedup_router.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +base_dir=`dirname $0` +source "$base_dir/utils.sh" +config="$base_dir/config.json" + +echoToLogreader() { + logger -t CloudDisk "${1}" +} + +accessToken=`getSingleJsonValue "$config" "accessToken"` +method=`getSingleJsonValue "$config" "method"` +UA=`getSingleJsonValue "$config" "User-Agent"` +extra_header="User-Agent:$UA" + + +HOST="http://api.cloud.189.cn" +LOGIN_URL="/loginByOpen189AccessToken.action" +ACCESS_URL="/speed/startSpeedV2.action" +echoToLogreader "*******************************************" +echoToLogreader "Sending Heartbeat Package ..." +split="~" +headers_string="$extra_header" +headers=`formatHeaderString "$split" "$headers_string"` +result=`get "$HOST$LOGIN_URL?accessToken=$accessToken" "$headers"` +session_key=`echo "$result" | grep -Eo "sessionKey>.*//'` +session_secret=`echo "$result" | grep -Eo "sessionSecret>.*//' | sed 's/<\/sessionSecret//'` +date=`env LANG=C.UTF-8 date -u '+%a, %d %b %Y %T GMT'` +data="SessionKey=$session_key&Operate=$method&RequestURI=$ACCESS_URL&Date=$date" +key="$session_secret" +signature=`hashHmac "sha1" "$data" "$key"` +headers_string="SessionKey:$session_key"${split}"Signature:$signature"${split}"Date:$date"${split}"$extra_header" +headers=`formatHeaderString "$split" "$headers_string"` +qosClientSn=`cat /proc/sys/kernel/random/uuid` +result=`get "$HOST$ACCESS_URL?qosClientSn=$qosClientSn" "$headers"` +echoToLogreader "Heartbeat Signature: $signature" +echoToLogreader "Date: $date" +echoToLogreader "Response: $result" +[[ "`echo ${result} | grep dialAcc`" != "" ]] && hint="succeeded" || hint="failed" +echoToLogreader "Heartbeating $hint." +echoToLogreader "*******************************************" diff --git a/package/lean/luci-app-familycloud/root/usr/share/familycloud/CloudDisk/utils.sh b/package/lean/luci-app-familycloud/root/usr/share/familycloud/CloudDisk/utils.sh new file mode 100644 index 00000000000000..d54e1e3a94d287 --- /dev/null +++ b/package/lean/luci-app-familycloud/root/usr/share/familycloud/CloudDisk/utils.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +CONNECTION_TIME="15" +TRANSMISSION_TIME="15" + +formatHeaderString() { + OLD_IFS=$IFS + IFS="$1" + STR="$2" + ARRAY=(${STR}) + for i in "${!ARRAY[@]}" + do + HEADERS="$HEADERS -H '${ARRAY[$i]}'" + done + echo ${HEADERS} | sed 's/^ //' + IFS=${OLD_IFS} +} + +get() { + HEADER="$1" + URL="$2" + eval curl -s --connect-timeout "${CONNECTION_TIME}" -m "${TRANSMISSION_TIME}" "${HEADER}" "${URL}" +} + +post() { + HEADER="$1" + URL="$2" + PAYLOAD="$3" + eval curl -s --connect-timeout "${CONNECTION_TIME}" -m "${TRANSMISSION_TIME}" -X POST "${URL}" "${HEADER}" -w %{http_code} -d "'$PAYLOAD'" +} + +getSingleJsonValue() { + FILE="$1" + KEY="$2" + cat ${FILE} | grep "$KEY" | sed 's/,$//' | awk -F "[:]" '{ print $2 }' | sed 's/ //g' | sed 's/"//g' +} + +hashHmac() { + digest="$1" + data="$2" + key="$3" + echo -n "$data" | openssl dgst "-$digest" -hmac "$key" | sed -e 's/^.* //' | tr 'a-z' 'A-Z' +} diff --git a/package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/config.ini b/package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/config.ini new file mode 100644 index 00000000000000..f83cab7d17caec --- /dev/null +++ b/package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/config.ini @@ -0,0 +1,14 @@ +{ + "accessToken": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "AppKey": "600100885", + "setting": { + "method": "POST", + "rate": 600 +}, + "send_data": { + "prodCode": "76" + }, + "extra_header": { + "User-Agent": "Apache-HttpClient/UNAVAILABLE (java 1.4)" + } +} \ No newline at end of file diff --git a/package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/config.json b/package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/config.json new file mode 100644 index 00000000000000..35e21f5b3e8570 --- /dev/null +++ b/package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/config.json @@ -0,0 +1 @@ +/tmp/config.json \ No newline at end of file diff --git a/package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/speedup.sh b/package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/speedup.sh new file mode 100644 index 00000000000000..d7ade60cf6b266 --- /dev/null +++ b/package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/speedup.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +base_dir=`dirname $0` +source "$base_dir/utils.sh" +config="$base_dir/config.json" + + +accessToken=`getSingleJsonValue "$config" "accessToken"` +AppKey=`getSingleJsonValue "$config" "AppKey"` +method=`getSingleJsonValue "$config" "method"` +rate=`getSingleJsonValue "$config" "rate"` +prodCode=`getSingleJsonValue "$config" "prodCode"` +UA=`getSingleJsonValue "$config" "User-Agent"` +extra_header="User-Agent:$UA" + + +HOST="http://api.cloud.189.cn" +LOGIN_URL="/login4MergedClient.action" +ACCESS_URL="/family/qos/startQos.action" +count=0 +echo "*******************************************" +while : +do + count=$((count+1)) + echo "Sending heart_beat package <$count>" + split="~" + headers_string="AppKey:$AppKey"${split}"$extra_header" + headers=`formatHeaderString "$split" "$headers_string"` + result=`post "$headers" "$HOST$LOGIN_URL?accessToken=$accessToken"` + session_key=`echo "$result" | grep -Eo "familySessionKey>.+//' | sed 's/<\/familySessionKey//'` + session_secret=`echo "$result" | grep -Eo "familySessionSecret>.+//' | sed 's/<\/familySessionSecret//'` + date=`env LANG=C.UTF-8 date -u '+%a, %d %b %Y %T GMT'` + data="SessionKey=$session_key&Operate=$method&RequestURI=$ACCESS_URL&Date=$date" + key="$session_secret" + signature=`hashHmac "sha1" "$data" "$key"` + headers_string="SessionKey:$session_key"${split}"Signature:$signature"${split}"Date:$date"${split}"$extra_header" + headers=`formatHeaderString "$split" "$headers_string"` + send_data="prodCode=$prodCode" + result=`post "$headers" "$HOST$ACCESS_URL" "$send_data"` + echo "heart_beat:" + echo "date:<$date>" + echo "status_code:${result: -3}" + echo -e "response:\n`echo ${result} | sed "s^[0-9]\{3\}$^^"`" + [[ "`echo ${result} | grep dialAcc`" != "" ]] && hint="succeeded" || hint="failed" + echo "Sending heart_beat package <$count> $hint" + echo "*******************************************" + sleep ${rate} +done \ No newline at end of file diff --git a/package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/speedup_router.sh b/package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/speedup_router.sh new file mode 100644 index 00000000000000..721023b0cc9d7e --- /dev/null +++ b/package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/speedup_router.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +base_dir=`dirname $0` +source "$base_dir/utils.sh" +config="$base_dir/config.json" + +echoToLogreader() { + logger -t FamilyCloud "${1}" +} + +accessToken=`getSingleJsonValue "$config" "accessToken"` +AppKey=`getSingleJsonValue "$config" "AppKey"` +method=`getSingleJsonValue "$config" "method"` +prodCode=`getSingleJsonValue "$config" "prodCode"` +UA=`getSingleJsonValue "$config" "User-Agent"` +extra_header="User-Agent:$UA" + + +HOST="http://api.cloud.189.cn" +LOGIN_URL="/login4MergedClient.action" +ACCESS_URL="/family/qos/startQos.action" +echoToLogreader "*******************************************" +echoToLogreader "Sending Heartbeat Package ..." +split="~" +headers_string="AppKey:$AppKey"${split}"$extra_header" +headers=`formatHeaderString "$split" "$headers_string"` +result=`post "$headers" "$HOST$LOGIN_URL?accessToken=$accessToken"` +session_key=`echo "$result" | grep -Eo "familySessionKey>.+//' | sed 's/<\/familySessionKey//'` +session_secret=`echo "$result" | grep -Eo "familySessionSecret>.+//' | sed 's/<\/familySessionSecret//'` +date=`env LANG=C.UTF-8 date -u '+%a, %d %b %Y %T GMT'` +data="SessionKey=$session_key&Operate=$method&RequestURI=$ACCESS_URL&Date=$date" +key="$session_secret" +signature=`hashHmac "sha1" "$data" "$key"` +headers_string="SessionKey:$session_key"${split}"Signature:$signature"${split}"Date:$date"${split}"$extra_header" +headers=`formatHeaderString "$split" "$headers_string"` +send_data="prodCode=$prodCode" +result=`post "$headers" "$HOST$ACCESS_URL" "$send_data"` +echoToLogreader "Heartbeat Signature: $signature" +echoToLogreader "Date: $date" +echoToLogreader "Response: ${result}" +[[ "`echo ${result} | grep dialAcc`" != "" ]] && hint="succeeded" || hint="failed" +echoToLogreader "Heartbeating $hint." +echoToLogreader "*******************************************" diff --git a/package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/utils.sh b/package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/utils.sh new file mode 100644 index 00000000000000..d54e1e3a94d287 --- /dev/null +++ b/package/lean/luci-app-familycloud/root/usr/share/familycloud/FamilyCloud/utils.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +CONNECTION_TIME="15" +TRANSMISSION_TIME="15" + +formatHeaderString() { + OLD_IFS=$IFS + IFS="$1" + STR="$2" + ARRAY=(${STR}) + for i in "${!ARRAY[@]}" + do + HEADERS="$HEADERS -H '${ARRAY[$i]}'" + done + echo ${HEADERS} | sed 's/^ //' + IFS=${OLD_IFS} +} + +get() { + HEADER="$1" + URL="$2" + eval curl -s --connect-timeout "${CONNECTION_TIME}" -m "${TRANSMISSION_TIME}" "${HEADER}" "${URL}" +} + +post() { + HEADER="$1" + URL="$2" + PAYLOAD="$3" + eval curl -s --connect-timeout "${CONNECTION_TIME}" -m "${TRANSMISSION_TIME}" -X POST "${URL}" "${HEADER}" -w %{http_code} -d "'$PAYLOAD'" +} + +getSingleJsonValue() { + FILE="$1" + KEY="$2" + cat ${FILE} | grep "$KEY" | sed 's/,$//' | awk -F "[:]" '{ print $2 }' | sed 's/ //g' | sed 's/"//g' +} + +hashHmac() { + digest="$1" + data="$2" + key="$3" + echo -n "$data" | openssl dgst "-$digest" -hmac "$key" | sed -e 's/^.* //' | tr 'a-z' 'A-Z' +} diff --git a/package/lean/luci-app-filetransfer/Makefile b/package/lean/luci-app-filetransfer/Makefile new file mode 100644 index 00000000000000..dae88c85d2fd7f --- /dev/null +++ b/package/lean/luci-app-filetransfer/Makefile @@ -0,0 +1,18 @@ +# +# Copyright (C) 2008-2014 The LuCI Team +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI page for IPK upload +LUCI_DEPENDS:=+luci-lib-fs +PKG_VERSION:=1 +PKG_RELEASE:=2 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + + diff --git a/package/lean/luci-app-filetransfer/etc/uci-defaults/luci-filetransfer b/package/lean/luci-app-filetransfer/etc/uci-defaults/luci-filetransfer new file mode 100644 index 00000000000000..935d7c8be55d5c --- /dev/null +++ b/package/lean/luci-app-filetransfer/etc/uci-defaults/luci-filetransfer @@ -0,0 +1,6 @@ +#!/bin/sh + +sed -i 's/cbi.submit\"] = true/cbi.submit\"] = \"1\"/g' /usr/lib/lua/luci/dispatcher.lua + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/package/lean/luci-app-filetransfer/luasrc/controller/filetransfer.lua b/package/lean/luci-app-filetransfer/luasrc/controller/filetransfer.lua new file mode 100644 index 00000000000000..986af58085c82b --- /dev/null +++ b/package/lean/luci-app-filetransfer/luasrc/controller/filetransfer.lua @@ -0,0 +1,12 @@ +--[[ +luci-app-filetransfer +Description: File upload / download +Author: yuleniwo xzm2@qq.com QQ:529698939 +Modify: ayongwifi@126.com www.openwrtdl.com +]]-- + +module("luci.controller.filetransfer", package.seeall) + +function index() + entry({"admin", "system", "filetransfer"}, form("updownload"), _("FileTransfer"),89) +end diff --git a/package/lean/luci-app-filetransfer/luasrc/model/cbi/updownload.lua b/package/lean/luci-app-filetransfer/luasrc/model/cbi/updownload.lua new file mode 100644 index 00000000000000..f44a95c736982a --- /dev/null +++ b/package/lean/luci-app-filetransfer/luasrc/model/cbi/updownload.lua @@ -0,0 +1,158 @@ +local fs = require "luci.fs" +local http = luci.http + +ful = SimpleForm("upload", translate("Upload"), nil) +ful.reset = false +ful.submit = false + +sul = ful:section(SimpleSection, "", translate("Upload file to '/tmp/upload/'")) +fu = sul:option(FileUpload, "") +fu.template = "cbi/other_upload" +um = sul:option(DummyValue, "", nil) +um.template = "cbi/other_dvalue" + +fdl = SimpleForm("download", translate("Download"), nil) +fdl.reset = false +fdl.submit = false +sdl = fdl:section(SimpleSection, "", translate("Download file")) +fd = sdl:option(FileUpload, "") +fd.template = "cbi/other_download" +dm = sdl:option(DummyValue, "", nil) +dm.template = "cbi/other_dvalue" + +function Download() + local sPath, sFile, fd, block + sPath = http.formvalue("dlfile") + sFile = nixio.fs.basename(sPath) + if luci.fs.isdirectory(sPath) then + fd = io.popen('tar -C "%s" -cz .' % {sPath}, "r") + sFile = sFile .. ".tar.gz" + else + fd = nixio.open(sPath, "r") + end + if not fd then + dm.value = translate("Couldn't open file: ") .. sPath + return + end + dm.value = nil + http.header('Content-Disposition', 'attachment; filename="%s"' % {sFile}) + http.prepare_content("application/octet-stream") + while true do + block = fd:read(nixio.const.buffersize) + if (not block) or (#block ==0) then + break + else + http.write(block) + end + end + fd:close() + http.close() +end + +local dir, fd +dir = "/tmp/upload/" +nixio.fs.mkdir(dir) +http.setfilehandler( + function(meta, chunk, eof) + if not fd then + if not meta then return end + + if meta and chunk then fd = nixio.open(dir .. meta.file, "w") end + + if not fd then + um.value = translate("Create upload file error.") + return + end + end + if chunk and fd then + fd:write(chunk) + end + if eof and fd then + fd:close() + fd = nil + um.value = translate("File saved to") .. ' "/tmp/upload/' .. meta.file .. '"' + end + end +) + +if luci.http.formvalue("upload") then + + + local f = luci.http.formvalue("ulfile") + if #f <= 0 then + um.value = translate("No specify upload file.") + end +elseif luci.http.formvalue("download") then + Download() +end + +local function getSizeStr(size) + local i = 0 + local byteUnits = {' kB', ' MB', ' GB', ' TB'} + repeat + size = size / 1024 + i = i + 1 + until(size <= 1024) + return string.format("%.1f", size) .. byteUnits[i] +end + +local inits, attr = {} +for i, f in ipairs(fs.glob("/tmp/upload/*")) do + attr = fs.stat(f) + if attr then + inits[i] = {} + inits[i].name = fs.basename(f) + inits[i].mtime = os.date("%Y-%m-%d %H:%M:%S", attr.mtime) + inits[i].modestr = attr.modestr + inits[i].size = getSizeStr(attr.size) + inits[i].remove = 0 + inits[i].install = false + end +end + +form = SimpleForm("filelist", translate("Upload file list"), nil) +form.reset = false +form.submit = false + +tb = form:section(Table, inits) +nm = tb:option(DummyValue, "name", translate("File name")) +mt = tb:option(DummyValue, "mtime", translate("Modify time")) +ms = tb:option(DummyValue, "modestr", translate("Attributes")) +sz = tb:option(DummyValue, "size", translate("Size")) +btnrm = tb:option(Button, "remove", translate("Remove")) +btnrm.render = function(self, section, scope) + self.inputstyle = "remove" + Button.render(self, section, scope) +end + +btnrm.write = function(self, section) + local v = luci.fs.unlink("/tmp/upload/" .. luci.fs.basename(inits[section].name)) + if v then table.remove(inits, section) end + return v +end + +function IsIpkFile(name) + name = name or "" + local ext = string.lower(string.sub(name, -4, -1)) + return ext == ".ipk" +end + +btnis = tb:option(Button, "install", translate("Install")) +btnis.template = "cbi/other_button" +btnis.render = function(self, section, scope) + if not inits[section] then return false end + if IsIpkFile(inits[section].name) then + scope.display = "" + else + scope.display = "none" + end + self.inputstyle = "apply" + Button.render(self, section, scope) +end + +btnis.write = function(self, section) + local r = luci.sys.exec(string.format('opkg --force-depends install "/tmp/upload/%s"', inits[section].name)) + form.description = string.format('%s', r) +end + +return ful, fdl, form diff --git a/package/lean/luci-app-filetransfer/luasrc/view/cbi/other_button.htm b/package/lean/luci-app-filetransfer/luasrc/view/cbi/other_button.htm new file mode 100644 index 00000000000000..1c391ad9842ff4 --- /dev/null +++ b/package/lean/luci-app-filetransfer/luasrc/view/cbi/other_button.htm @@ -0,0 +1,7 @@ +<%+cbi/valueheader%> + <% if self:cfgvalue(section) ~= false then %> + " style="display: <%= display %>" type="submit"<%= attr("name", cbid) .. attr("id", cbid) .. attr("value", self.inputtitle or self.title)%> /> + <% else %> + - + <% end %> +<%+cbi/valuefooter%> diff --git a/package/lean/luci-app-filetransfer/luasrc/view/cbi/other_download.htm b/package/lean/luci-app-filetransfer/luasrc/view/cbi/other_download.htm new file mode 100644 index 00000000000000..c14728632e8c6e --- /dev/null +++ b/package/lean/luci-app-filetransfer/luasrc/view/cbi/other_download.htm @@ -0,0 +1,5 @@ +<%+cbi/valueheader%> + + + +<%+cbi/valuefooter%> diff --git a/package/lean/luci-app-filetransfer/luasrc/view/cbi/other_dvalue.htm b/package/lean/luci-app-filetransfer/luasrc/view/cbi/other_dvalue.htm new file mode 100644 index 00000000000000..296c61e4d640b4 --- /dev/null +++ b/package/lean/luci-app-filetransfer/luasrc/view/cbi/other_dvalue.htm @@ -0,0 +1,8 @@ +<%+cbi/valueheader%> + +<% + local val = self:cfgvalue(section) or self.default or "" + write(pcdata(val)) +%> + +<%+cbi/valuefooter%> diff --git a/package/lean/luci-app-filetransfer/luasrc/view/cbi/other_upload.htm b/package/lean/luci-app-filetransfer/luasrc/view/cbi/other_upload.htm new file mode 100644 index 00000000000000..bb56f444fcc5ed --- /dev/null +++ b/package/lean/luci-app-filetransfer/luasrc/view/cbi/other_upload.htm @@ -0,0 +1,5 @@ +<%+cbi/valueheader%> + + + +<%+cbi/valuefooter%> diff --git a/package/lean/luci-app-filetransfer/po/zh-cn/filetransfer.po b/package/lean/luci-app-filetransfer/po/zh-cn/filetransfer.po new file mode 100644 index 00000000000000..27f40a92a6dd04 --- /dev/null +++ b/package/lean/luci-app-filetransfer/po/zh-cn/filetransfer.po @@ -0,0 +1,56 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +msgid "Choose local file:" +msgstr "选择本地文件:" + +msgid "Couldn't open file:" +msgstr "无法打开文件:" + +msgid "Create upload file error." +msgstr "创建上传文件失败。" + +msgid "Download" +msgstr "下载" + +msgid "Download file" +msgstr "下载文件" + +msgid "File name" +msgstr "文件名" + +msgid "File saved to" +msgstr "文件保存到" + +msgid "FileTransfer" +msgstr "文件传输" + +msgid "Install" +msgstr "安装" + +msgid "Attributes" +msgstr "属性" + +msgid "Modify time" +msgstr "修改时间" + +msgid "No specify upload file." +msgstr "未指定上传文件" + +msgid "Path on Route:" +msgstr "路由上目录" + +msgid "Remove" +msgstr "移除" + +msgid "Size" +msgstr "大小" + +msgid "Upload" +msgstr "上传" + +msgid "Upload file list" +msgstr "上传文件列表" + +msgid "Upload file to '/tmp/upload/'" +msgstr "将文件上传到'/tmp/upload/'" diff --git a/package/lean/luci-app-flowoffload/Makefile b/package/lean/luci-app-flowoffload/Makefile new file mode 100644 index 00000000000000..e63d75f76e6e9e --- /dev/null +++ b/package/lean/luci-app-flowoffload/Makefile @@ -0,0 +1,16 @@ +# Copyright (C) 2016 Openwrt.org +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI support for Flow Offload +LUCI_DEPENDS:=+kmod-ipt-offload +pdnsd-alt +kmod-tcp-bbr @!LINUX_4_9 +LUCI_PKGARCH:=all +PKG_VERSION:=1.0 +PKG_RELEASE:=13 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/package/lean/luci-app-flowoffload/luasrc/controller/flowoffload.lua b/package/lean/luci-app-flowoffload/luasrc/controller/flowoffload.lua new file mode 100644 index 00000000000000..a02807264ceb3e --- /dev/null +++ b/package/lean/luci-app-flowoffload/luasrc/controller/flowoffload.lua @@ -0,0 +1,41 @@ +module("luci.controller.flowoffload", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/flowoffload") then + return + end + local page + page = entry({"admin", "network", "flowoffload"}, cbi("flowoffload"), _("Turbo ACC Center"), 101) + page.i18n = "flowoffload" + page.dependent = true + + entry({"admin", "network", "flowoffload", "status"}, call("action_status")) +end + +local function is_running() + return luci.sys.call("[ `cat /sys/module/xt_FLOWOFFLOAD/refcnt 2>/dev/null` -gt 0 ] 2>/dev/null") == 0 +end + +local function is_bbr() + return luci.sys.call("[ `cat /proc/sys/net/ipv4/tcp_congestion_control 2>/dev/null` = bbr ] 2>/dev/null") == 0 +end + +local function is_fullcone() + return luci.sys.call("[ `cat /sys/module/xt_FULLCONENAT/refcnt 2>/dev/null` -gt 0 ] 2>/dev/null") == 0 +end + +local function is_dns() + return luci.sys.call("pgrep dnscache >/dev/null") == 0 +end + +function action_status() + luci.http.prepare_content("application/json") + luci.http.write_json({ + run_state = is_running(), + down_state = is_bbr(), + up_state = is_fullcone(), + dns_state = is_dns() + }) +end + + diff --git a/package/lean/luci-app-flowoffload/luasrc/model/cbi/flowoffload.lua b/package/lean/luci-app-flowoffload/luasrc/model/cbi/flowoffload.lua new file mode 100644 index 00000000000000..81eff5d4005492 --- /dev/null +++ b/package/lean/luci-app-flowoffload/luasrc/model/cbi/flowoffload.lua @@ -0,0 +1,39 @@ +local m,s,o +local SYS = require "luci.sys" + +m = Map("flowoffload") +m.title = translate("Turbo ACC Acceleration Settings") +m.description = translate("Opensource Linux Flow Offload driver (Fast Path or HWNAT)") +m:append(Template("flow/status")) + +s = m:section(TypedSection, "flow") +s.addremove = false +s.anonymous = true + +flow = s:option(Flag, "flow_offloading", translate("Enable")) +flow.default = 0 +flow.rmempty = false +flow.description = translate("Enable software flow offloading for connections. (decrease cpu load / increase routing throughput)") + +hw = s:option(Flag, "flow_offloading_hw", translate("HWNAT")) +hw.default = 0 +hw.rmempty = true +hw.description = translate("Enable Hardware NAT (depends on hw capability like MTK 762x)") +hw:depends("flow_offloading", 1) + +bbr = s:option(Flag, "bbr", translate("Enable BBR")) +bbr.default = 0 +bbr.rmempty = false +bbr.description = translate("Bottleneck Bandwidth and Round-trip propagation time (BBR)") + +dns = s:option(Flag, "dns", translate("DNS Acceleration")) +dns.default = 0 +dns.rmempty = false +dns.description = translate("Enable DNS Cache Acceleration and anti ISP DNS pollution") + +o = s:option(Value, "dns_server", translate("Upsteam DNS Server")) +o.default = "114.114.114.114,114.114.115.115" +o.description = translate("Muitiple DNS server can saperate with ','") +o:depends("dns", 1) + +return m diff --git a/package/lean/luci-app-flowoffload/luasrc/view/flow/status.htm b/package/lean/luci-app-flowoffload/luasrc/view/flow/status.htm new file mode 100644 index 00000000000000..43f3a02ae142b3 --- /dev/null +++ b/package/lean/luci-app-flowoffload/luasrc/view/flow/status.htm @@ -0,0 +1,24 @@ +
+ <%:Running Status%> + + + + + +
FLOW 加速状态<%:Collecting data...%>
BBR 加速<%:Collecting data...%>
FULLCONE NAT加速<%:Collecting data...%>
DNS 加速<%:Collecting data...%>
+
+ + diff --git a/package/lean/luci-app-flowoffload/po/zh-cn/flowoffload.po b/package/lean/luci-app-flowoffload/po/zh-cn/flowoffload.po new file mode 100644 index 00000000000000..69f0b2d61a062b --- /dev/null +++ b/package/lean/luci-app-flowoffload/po/zh-cn/flowoffload.po @@ -0,0 +1,41 @@ +msgid "Flow Offload ACC" +msgstr "Flow Offload 转发加速" + +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 Linux Flow Offload driver (Fast Path or HWNAT)" +msgstr "开源 Linux Flow Offload 驱动 (支持 Fast Path 或者 HWNAT)" + +msgid "Enable" +msgstr "启用" + +msgid "Enable software flow offloading for connections. (decrease cpu load / increase routing throughput)" +msgstr "开启 Flow Offloading 转发加速. (降低CPU占用 / 增强路由转发性能,和多WAN或者QOS功能可能会冲突)" + +msgid "Enable Hardware NAT (depends on hw capability like MTK 762x)" +msgstr "启用硬件HWNAT加速(依赖特定的硬件,例如 MTK 762x 系列)" + +msgid "Enable BBR" +msgstr "启用 BBR" + +msgid "Bottleneck Bandwidth and Round-trip propagation time (BBR)" +msgstr "BBR拥塞控制算法可以加强TCP应用表现,但会降低路由器本机上的WIFI吞吐性能" + +msgid "DNS Acceleration" +msgstr "DNS 加速" + +msgid "Enable DNS Cache Acceleration and anti ISP DNS pollution" +msgstr "启用DNS多线程查询、缓存,并防止ISP的DNS广告和域名劫持" + +msgid "Upsteam DNS Server" +msgstr "上游 DNS 服务器(国内)" + +msgid "Muitiple DNS server can saperate with ','" +msgstr "支持多个上游DNS服务器,用','分隔(注意用英文逗号).请填写您最快的DNS服务器" diff --git a/package/lean/luci-app-flowoffload/root/etc/config/flowoffload b/package/lean/luci-app-flowoffload/root/etc/config/flowoffload new file mode 100644 index 00000000000000..19bd7422220e1a --- /dev/null +++ b/package/lean/luci-app-flowoffload/root/etc/config/flowoffload @@ -0,0 +1,8 @@ + +config flow + option flow_offloading '1' + option flow_offloading_hw '0' + option dns '0' + option dns_server '114.114.114.114,114.114.115.115' + option bbr '0' + diff --git a/package/lean/luci-app-flowoffload/root/etc/init.d/flowoffload b/package/lean/luci-app-flowoffload/root/etc/init.d/flowoffload new file mode 100644 index 00000000000000..4c1e22ee299aa5 --- /dev/null +++ b/package/lean/luci-app-flowoffload/root/etc/init.d/flowoffload @@ -0,0 +1,199 @@ +#!/bin/sh /etc/rc.common +# Copyright (c) 2011-2015 OpenWrt.org + +START=60 + +USE_PROCD=1 + +PDNSD_BIN="/var/sbin/dnscache" +DNSMASQ_RESTART=N +DNS_SERVER="114.114.114.114,114.114.115.115" + +pdnsd_genconfig() { + DNS_SERVER=$(uci get flowoffload.@flow[0].dns_server 2>/dev/null) + + [ -d /var/etc ] || mkdir -p /var/etc + + 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 + + cat > /var/etc/dnscache.conf </dev/null 2>&1 || kill -9 $(ps | grep dnscache | grep -v grep | awk '{print $1}') >/dev/null 2>&1 + echo "Stop DNS Cache" +} + +change_dns() { + uci delete dhcp.@dnsmasq[0].server >/dev/null 2>&1 + uci add_list dhcp.@dnsmasq[0].server=127.0.0.1#5333 + uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto + uci set dhcp.@dnsmasq[0].noresolv=0 + uci commit dhcp +} + +revert_dns() { + uci del_list dhcp.@dnsmasq[0].server=127.0.0.1#5333 >/dev/null 2>&1 + uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto + uci set dhcp.@dnsmasq[0].noresolv=0 + uci commit dhcp +} + +start_service(){ + dns=$(uci get flowoffload.@flow[0].dns 2>/dev/null) + bbr=$(uci get flowoffload.@flow[0].bbr 2>/dev/null) + if [ $dns -eq 1 ]; then + pdnsd_genconfig + procd_open_instance + procd_set_param command "$PDNSD_BIN" -c /var/etc/dnscache.conf + procd_set_param respawn + procd_set_param stderr 1 + procd_close_instance + change_dns + fi + if [ $bbr -eq 1 ]; then + sysctl -w net.ipv4.tcp_congestion_control=bbr + else + sysctl -w net.ipv4.tcp_congestion_control=cubic + fi + uci set firewall.@defaults[0].flow_offloading=$(uci get flowoffload.@flow[0].flow_offloading) + uci set firewall.@defaults[0].flow_offloading_hw=$(uci get flowoffload.@flow[0].flow_offloading_hw) + uci commit firewall + if [ "$DNSMASQ_RESTART" = N ]; then + /etc/init.d/dnsmasq restart && echo "DNSMASQ change" + /etc/init.d/firewall restart + fi +} + +stop_service(){ + dns=$(uci get firewall.@defaults[0].dns 2>/dev/null) + revert_dns + uci set firewall.@defaults[0].flow_offloading=$(uci get flowoffload.@flow[0].flow_offloading) + uci set firewall.@defaults[0].flow_offloading_hw=$(uci get flowoffload.@flow[0].flow_offloading_hw) + uci commit firewall + if [ "$DNSMASQ_RESTART" = N ]; then + /etc/init.d/dnsmasq restart && echo "DNSMASQ revert" + /etc/init.d/firewall restart + fi +} + +restart(){ + DNSMASQ_RESTART=Y + stop + start + /etc/init.d/dnsmasq restart && echo "DNSMASQ restart" + /etc/init.d/firewall restart +} + diff --git a/package/lean/luci-app-flowoffload/root/etc/uci-defaults/flowoffload b/package/lean/luci-app-flowoffload/root/etc/uci-defaults/flowoffload new file mode 100644 index 00000000000000..246bccfec5ebc8 --- /dev/null +++ b/package/lean/luci-app-flowoffload/root/etc/uci-defaults/flowoffload @@ -0,0 +1,13 @@ +#!/bin/sh + +uci set firewall.@defaults[0].flow_offloading=1 +uci commit firewall + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@flowoffload[-1] + add ucitrack flowoffload + set ucitrack.@flowoffload[-1].init=flowoffload + commit ucitrack +EOF + +exit 0 diff --git a/package/lean/luci-app-flowoffload/root/usr/share/dnscache-watchdog.sh b/package/lean/luci-app-flowoffload/root/usr/share/dnscache-watchdog.sh new file mode 100644 index 00000000000000..bf5161aeeb123e --- /dev/null +++ b/package/lean/luci-app-flowoffload/root/usr/share/dnscache-watchdog.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +dns_enable=$(uci flowoffload.@flow[0].dns 2>/dev/null) + +if [ $dns_enable -eq 1 ]; then + if ! pidof dnscache>/dev/null; then + /etc/init.d/flowoffload restart + fi +fi diff --git a/package/lean/luci-app-frpc/Makefile b/package/lean/luci-app-frpc/Makefile new file mode 100644 index 00000000000000..911ad624d401b3 --- /dev/null +++ b/package/lean/luci-app-frpc/Makefile @@ -0,0 +1,19 @@ +# +# Copyright (C) 2008-2014 The LuCI Team +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI for FRPC +LUCI_DEPENDS:=+wget +frpc +LUCI_PKGARCH:=all +PKG_VERSION:=1.1 +PKG_RELEASE:=2 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + + diff --git a/package/lean/luci-app-frpc/luasrc/controller/frp.lua b/package/lean/luci-app-frpc/luasrc/controller/frp.lua new file mode 100644 index 00000000000000..41df2c8cb27830 --- /dev/null +++ b/package/lean/luci-app-frpc/luasrc/controller/frp.lua @@ -0,0 +1,18 @@ +module("luci.controller.frp", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/frp") then + return + end + + entry({"admin","services","frp"},cbi("frp/frp"), _("Frp Setting"),100).dependent=true + entry({"admin","services","frp","config"},cbi("frp/config")).leaf=true + entry({"admin","services","frp","status"},call("status")).leaf=true +end + +function status() +local e={} +e.running=luci.sys.call("pidof frpc > /dev/null")==0 +luci.http.prepare_content("application/json") +luci.http.write_json(e) +end diff --git a/package/lean/luci-app-frpc/luasrc/i18n/frp.zh-cn.lmo b/package/lean/luci-app-frpc/luasrc/i18n/frp.zh-cn.lmo new file mode 100644 index 00000000000000..f3b95348f88a98 Binary files /dev/null and b/package/lean/luci-app-frpc/luasrc/i18n/frp.zh-cn.lmo differ diff --git a/package/lean/luci-app-frpc/luasrc/model/cbi/frp/config.lua b/package/lean/luci-app-frpc/luasrc/model/cbi/frp/config.lua new file mode 100644 index 00000000000000..48bfe725099d12 --- /dev/null +++ b/package/lean/luci-app-frpc/luasrc/model/cbi/frp/config.lua @@ -0,0 +1,116 @@ +local n="frp" +local i=require"luci.dispatcher" +local o=require"luci.model.network".init() +local m=require"nixio.fs" +local a,t,e +arg[1]=arg[1]or"" +a=Map(n,translate("Frp Domain Config")) +a.redirect=i.build_url("admin","services","frp") +t=a:section(NamedSection,arg[1],"frp",translate("Config Frp Protocol")) +t.addremove=false +t.dynamic=false +t:tab("base",translate("Basic Settings")) +t:tab("other",translate("Other Settings")) +e=t:taboption("base",ListValue,"enable",translate("Enable State")) +e.default="1" +e.rmempty=false +e:value("1",translate("Enable")) +e:value("0",translate("Disable")) +e=t:taboption("base",ListValue, "type", translate("Frp Protocol Type")) +e:value("http",translate("HTTP")) +e:value("https",translate("HTTPS")) +e:value("tcp",translate("TCP")) +e:value("udp",translate("UDP")) +e:value("stcp",translate("STCP")) +e = t:taboption("base",ListValue, "domain_type", translate("Domain Type")) +e.default = "custom_domains" +e:value("custom_domains",translate("Custom Domains")) +e:value("subdomain",translate("SubDomain")) +e:value("both_dtype",translate("Both the above two Domain types")) +e:depends("type","http") +e:depends("type","https") +e = t:taboption("base",Value, "custom_domains", translate("Custom Domains"), translate("If SubDomain is used, Custom Domains couldn't be subdomain or wildcard domain of the maindomain(subdomain_host).")) +e:depends("domain_type","custom_domains") +e:depends("domain_type","both_dtype") +e = t:taboption("base",Value, "subdomain", translate("SubDomain"), translate("subdomain_host must be configured in server: frps in advance.")) +e:depends("domain_type","subdomain") +e:depends("domain_type","both_dtype") +e = t:taboption("base",ListValue, "stcp_role", translate("STCP Role")) +e.default = "server" +e:value("server",translate("STCP Server")) +e:value("visitor",translate("STCP Vistor")) +e:depends("type","stcp") +e = t:taboption("base",Value, "remote_port", translate("Remote Port")) +e.datatype = "port" +e:depends("type","tcp") +e:depends("type","udp") +e = t:taboption("other",Flag, "enable_plugin", translate("Use Plugin"),translate("If plugin is defined, local_ip and local_port is useless, plugin will handle connections got from frps.")) +e.default = "0" +e:depends("type","tcp") +e = t:taboption("base",Value, "local_ip", translate("Local Host Address")) +luci.sys.net.ipv4_hints(function(x,d) +e:value(x,"%s (%s)"%{x,d}) +end) +e.datatype = "ip4addr" +e:depends("type","udp") +e:depends("type","http") +e:depends("type","https") +e:depends("enable_plugin",0) +e = t:taboption("base",Value, "local_port", translate("Local Host Port")) +e.datatype = "port" +e:depends("type","udp") +e:depends("type","http") +e:depends("type","https") +e:depends("enable_plugin",0) +e = t:taboption("base",Value, "stcp_secretkey", translate("STCP Screct Key")) +e.default = "abcdefg" +e:depends("type","stcp") +e = t:taboption("base",Value, "stcp_servername", translate("STCP Server Name"), translate("STCP Server Name is Service Remark Name of STCP Server")) +e.default = "secret_tcp" +e:depends("stcp_role","visitor") +e = t:taboption("other",Flag, "enable_locations", translate("Enable URL routing"), translate("Frp support forward http requests to different backward web services by url routing.")) +e:depends("type","http") +e = t:taboption("other",Value, "locations ", translate("URL routing"), translate("Http requests with url prefix /news will be forwarded to this service.")) +e.default="locations=/" +e:depends("enable_locations",1) +e = t:taboption("other",ListValue, "plugin", translate("Choose Plugin")) +e:value("http_proxy",translate("http_proxy")) +e:value("socks5",translate("socks5")) +e:value("unix_domain_socket",translate("unix_domain_socket")) +e:depends("enable_plugin",1) +e = t:taboption("other",Flag, "enable_plugin_httpuserpw", translate("Proxy Authentication"),translate("Other PCs could access the Internet through frpc's network by using http_proxy plugin.")) +e.default = "0" +e:depends("plugin","http_proxy") +e = t:taboption("other",Value, "plugin_http_user", translate("HTTP Proxy UserName")) +e.default = "abc" +e:depends("enable_plugin_httpuserpw",1) +e = t:taboption("other",Value, "plugin_http_passwd", translate("HTTP Proxy Password")) +e.default = "abc" +e:depends("enable_plugin_httpuserpw",1) +e = t:taboption("other",Value, "plugin_unix_path", translate("Plugin Unix Sock Path")) +e.default = "/var/run/docker.sock" +e:depends("plugin","unix_domain_socket") +e = t:taboption("other",Flag, "enable_http_auth", translate("Password protecting your web service"), translate("Http username and password are safety certification for http protocol.")) +e.default = "0" +e:depends("type","http") +e = t:taboption("other",Value, "http_user", translate("HTTP UserName")) +e.default = "frp" +e:depends("enable_http_auth",1) +e = t:taboption("other",Value, "http_pwd", translate("HTTP PassWord")) +e.default = "frp" +e:depends("enable_http_auth",1) +e = t:taboption("other",Flag, "enable_host_header_rewrite", translate("Rewriting the Host Header"), translate("Frp can rewrite http requests with a modified Host header.")) +e.default = "0" +e:depends("type","http") +e = t:taboption("other",Value, "host_header_rewrite", translate("Host Header"), translate("The Host header will be rewritten to match the hostname portion of the forwarding address.")) +e.default = "dev.yourdomain.com" +e:depends("enable_host_header_rewrite",1) +e = t:taboption("base",Flag, "use_encryption", translate("Use Encryption"), translate("Encrypted the communication between frpc and frps, will effectively prevent the traffic intercepted.")) +e.default = "1" +e.rmempty = false +e = t:taboption("base",Flag, "use_compression", translate("Use Compression"), translate("The contents will be compressed to speed up the traffic forwarding speed, but this will consume some additional cpu resources.")) +e.default = "1" +e.rmempty = false +e = t:taboption("base",Value, "remark", translate("Service Remark Name"), translate("Please ensure the remark name is unique.")) +e.rmempty = false +return a diff --git a/package/lean/luci-app-frpc/luasrc/model/cbi/frp/frp.lua b/package/lean/luci-app-frpc/luasrc/model/cbi/frp/frp.lua new file mode 100644 index 00000000000000..531dd84f6ccfd2 --- /dev/null +++ b/package/lean/luci-app-frpc/luasrc/model/cbi/frp/frp.lua @@ -0,0 +1,160 @@ +local o=require"luci.dispatcher" +local e=require("luci.model.ipkg") +local s=require"nixio.fs" +local e=luci.model.uci.cursor() +local i="frp" +local a,t,e +local n={} +a=Map(i,translate("Frp Setting"), translate("Frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.")) +a:section(SimpleSection).template="frp/frp_status" +t=a:section(NamedSection,"common","frp",translate("Global Setting")) +t.anonymous=true +t.addremove=false +t:tab("base",translate("Basic Settings")) +t:tab("other",translate("Other Settings")) +t:tab("log",translate("Client Log")) +e=t:taboption("base",Flag, "enabled", translate("Enabled")) +e.rmempty=false +e=t:taboption("base",Value, "server_addr", translate("Server")) +e.optional=false +e.rmempty=false +e=t:taboption("base",Value, "server_port", translate("Port")) +e.datatype = "port" +e.optional=false +e.rmempty=false +e=t:taboption("base",Value, "token", translate("Token"), translate("Time duration between server of frpc and frps mustn't exceed 15 minutes.")) +e.optional=false +e.password=true +e.rmempty=false +e=t:taboption("base",Value, "vhost_http_port", translate("Vhost HTTP Port")) +e.datatype = "port" +e.rmempty=false +e=t:taboption("base",Value, "vhost_https_port", translate("Vhost HTTPS Port")) +e.datatype = "port" +e.rmempty=false +e=t:taboption("other",Flag, "login_fail_exit", translate("Exit program when first login failed"),translate("decide if exit program when first login failed, otherwise continuous relogin to frps.")) +e.default = "1" +e.rmempty=false +e=t:taboption("other",Flag, "tcp_mux", translate("TCP Stream Multiplexing"), translate("Default is Ture. This feature in frps.ini and frpc.ini must be same.")) +e.default = "1" +e.rmempty=false +e=t:taboption("other",ListValue, "protocol", translate("Protocol Type"),translate("Frp support kcp protocol since v0.12.0")) +e.default = "tcp" +e:value("tcp",translate("TCP Protocol")) +e:value("kcp",translate("KCP Protocol")) +e=t:taboption("other",Flag, "enable_http_proxy", translate("Connect frps by HTTP PROXY"), translate("frpc can connect frps using HTTP PROXY")) +e.default = "0" +e.rmempty=false +e:depends("protocol","tcp") +e=t:taboption("other",Value, "http_proxy", translate("HTTP PROXY")) +e.datatype="uinteger" +e.placeholder="http://user:pwd@192.168.1.128:8080" +e:depends("enable_http_proxy",1) +e.optional=false +e=t:taboption("other",Flag, "enable_cpool", translate("Enable Connection Pool"), translate("This feature is fit for a large number of short connections.")) +e.rmempty=false +e=t:taboption("other",Value, "pool_count", translate("Connection Pool"), translate("Connections will be established in advance.")) +e.datatype="uinteger" +e.default = "1" +e:depends("enable_cpool",1) +e.optional=false +e=t:taboption("base",Value,"time",translate("Service registration interval"),translate("0 means disable this feature, unit: min")) +e.datatype="range(0,59)" +e.default=30 +e.rmempty=false +e=t:taboption("other",ListValue, "log_level", translate("Log Level")) +e.default = "warn" +e:value("trace",translate("Trace")) +e:value("debug",translate("Debug")) +e:value("info",translate("Info")) +e:value("warn",translate("Warning")) +e:value("error",translate("Error")) +e=t:taboption("other",Value, "log_max_days", translate("Log Keepd Max Days")) +e.datatype = "uinteger" +e.default = "3" +e.rmempty=false +e.optional=false +e=t:taboption("log",TextValue,"log") +e.rows=26 +e.wrap="off" +e.readonly=true +e.cfgvalue=function(t,t) +return s.readfile("/var/etc/frp/frpc.log")or"" +end +e.write=function(e,e,e) +end +t=a:section(TypedSection,"proxy",translate("Services List")) +t.anonymous=true +t.addremove=true +t.template="cbi/tblsection" +t.extedit=o.build_url("admin","services","frp","config","%s") +function t.create(e,t) +new=TypedSection.create(e,t) +luci.http.redirect(e.extedit:format(new)) +end +function t.remove(e,t) +e.map.proceed=true +e.map:del(t) +luci.http.redirect(o.build_url("admin","services","frp")) +end +local o="" +e=t:option(DummyValue,"remark",translate("Service Remark Name")) +e.width="10%" +e=t:option(DummyValue,"type",translate("Frp Protocol Type")) +e.width="10%" +e=t:option(DummyValue,"custom_domains",translate("Domain/Subdomain")) +e.width="20%" +e.cfgvalue=function(t,n) +local t=a.uci:get(i,n,"domain_type")or"" +local m=a.uci:get(i,n,"type")or"" +if t=="custom_domains" then +local b=a.uci:get(i,n,"custom_domains")or"" return b end +if t=="subdomain" then +local b=a.uci:get(i,n,"subdomain")or"" return b end +if t=="both_dtype" then +local b=a.uci:get(i,n,"custom_domains")or"" +local c=a.uci:get(i,n,"subdomain")or"" +b="%s/%s"%{b,c} return b end +if m=="tcp" or m=="udp" then +local b=a.uci:get(i,"common","server_addr")or"" return b end +end +e=t:option(DummyValue,"remote_port",translate("Remote Port")) +e.width="10%" +e.cfgvalue=function(t,b) +local t=a.uci:get(i,b,"type")or"" +if t==""or b==""then return""end +if t=="http" then +local b=a.uci:get(i,"common","vhost_http_port")or"" return b end +if t=="https" then +local b=a.uci:get(i,"common","vhost_https_port")or"" return b end +if t=="tcp" or t=="udp" then +local b=a.uci:get(i,b,"remote_port")or"" return b end +end +e=t:option(DummyValue,"local_ip",translate("Local Host Address")) +e.width="15%" +e=t:option(DummyValue,"local_port",translate("Local Host Port")) +e.width="10%" +e=t:option(DummyValue,"use_encryption",translate("Use Encryption")) +e.width="15%" +e.cfgvalue=function(t,n) +local t=a.uci:get(i,n,"use_encryption")or"" +local b +if t==""or b==""then return""end +if t=="1" then b="ON" +else b="OFF" end +return b +end +e=t:option(DummyValue,"use_compression",translate("Use Compression")) +e.width="15%" +e.cfgvalue=function(t,n) +local t=a.uci:get(i,n,"use_compression")or"" +local b +if t==""or b==""then return""end +if t=="1" then b="ON" +else b="OFF" end +return b +end +e=t:option(Flag,"enable",translate("Enable State")) +e.width="10%" +e.rmempty=false +return a diff --git a/package/lean/luci-app-frpc/luasrc/view/frp/frp_status.htm b/package/lean/luci-app-frpc/luasrc/view/frp/frp_status.htm new file mode 100644 index 00000000000000..a34467172693fb --- /dev/null +++ b/package/lean/luci-app-frpc/luasrc/view/frp/frp_status.htm @@ -0,0 +1,23 @@ + + +
+ <%:Frp Status%> +

+ <%:Collecting data...%> +

+
diff --git a/package/lean/luci-app-frpc/root/etc/config/frp b/package/lean/luci-app-frpc/root/etc/config/frp new file mode 100644 index 00000000000000..736e571f921165 --- /dev/null +++ b/package/lean/luci-app-frpc/root/etc/config/frp @@ -0,0 +1,16 @@ + +config frp 'common' + option log_max_days '3' + option login_fail_exit '0' + option enable_cpool '0' + option time '40' + option tcp_mux '1' + option enabled '0' + option vhost_http_port '80' + option vhost_https_port '443' + option server_addr 'yourdomain.com' + option server_port '7000' + option token '1234567' + option log_level 'info' + option enable_http_proxy '0' + option protocol 'tcp' diff --git a/package/lean/luci-app-frpc/root/etc/init.d/frp b/package/lean/luci-app-frpc/root/etc/init.d/frp new file mode 100644 index 00000000000000..ced13f7bb35bcc --- /dev/null +++ b/package/lean/luci-app-frpc/root/etc/init.d/frp @@ -0,0 +1,214 @@ +#!/bin/sh /etc/rc.common +#Author: monokoo +#Thanks to FW867's help + +START=99 +SERVICE_WRITE_PID=1 +SERVICE_DAEMONIZE=1 + +LOGFILE="/var/etc/frp/frpc.log" + +echo_date(){ + local log=$1 + echo $(date +%Y/%m/%d\ %X): "$log" >> $LOGFILE +} + +Reduce_Log(){ + local log=$1 + [ ! -f "$log" ] && return + local sc=200 + [ -n "$2" ] && sc=$2 + local count=$(grep -c "" $log) + if [ $count -gt $sc ];then + let count=count-$sc + sed -i "1,$count d" $log + fi +} + +conf_proxy_add() { + + local cfg="$1" + local tmpconf="$2" + local enable type domain_type custom_domains remote_port local_ip local_port enable_http_auth enable_host_header_rewrite host_header_rewrite + local subdomain use_encryption use_compression http_user http_pwd remark locations + local enable_plugin plugin plugin_http_user plugin_http_passwd plugin_unix_path stcp_role stcp_secretkey stcp_servername + + config_get_bool enable "$cfg" enable 1 + [ "$enable" -gt 0 ] || return 1 + + config_get type "$cfg" type + config_get custom_domains "$cfg" custom_domains + config_get subdomain "$cfg" subdomain + config_get remote_port "$cfg" remote_port + config_get local_ip "$cfg" local_ip + config_get local_port "$cfg" local_port + config_get locations "$cfg" locations + config_get host_header_rewrite "$cfg" host_header_rewrite + config_get http_user "$cfg" http_user + config_get http_pwd "$cfg" http_pwd + config_get remark "$cfg" remark + config_get plugin "$cfg" plugin + config_get plugin_http_user "$cfg" plugin_http_user + config_get plugin_http_passwd "$cfg" plugin_http_passwd + config_get plugin_unix_path "$cfg" plugin_unix_path + config_get stcp_role "$cfg" stcp_role + config_get stcp_secretkey "$cfg" stcp_secretkey + config_get stcp_servername "$cfg" stcp_servername + + + [ -n "$remark" ] && [ -n "$type" ] || return 1 + + echo "" >>$tmpconf + echo "[$remark]" >>$tmpconf + echo "type=$type" >>$tmpconf + [ -n "$custom_domains" ] && echo "custom_domains=$custom_domains" >>$tmpconf + [ -n "$subdomain" ] && echo "subdomain=$subdomain" >>$tmpconf + [ -n "$remote_port" ] && echo "remote_port=$remote_port" >>$tmpconf + [ -z "$stcp_role" ] && [ -n "$local_ip" ] && echo "local_ip=$local_ip" >>$tmpconf + [ -z "$stcp_role" ] && [ -n "$local_port" ] && echo "local_port=$local_port" >>$tmpconf + [ -n "$locations" ] && echo "locations=$locations" >>$tmpconf + [ -n "$http_user" -a -n "$http_pwd" ] && { + echo "http_user=$http_user" >>$tmpconf + echo "http_pwd=$http_pwd" >>$tmpconf + } + [ -n "$host_header_rewrite" ] && echo "host_header_rewrite=$host_header_rewrite" >>$tmpconf + [ -n "$plugin" ] && echo "plugin=$plugin" >>$tmpconf + [ -n "$plugin_http_user" -a -n "$plugin_http_passwd" ] && { + echo "plugin_http_user=$plugin_http_user" >>$tmpconf + echo "plugin_http_passwd=$plugin_http_passwd" >>$tmpconf + } + [ -n "$plugin_unix_path" ] && echo "plugin_unix_path=$plugin_unix_path" >>$tmpconf + + [ -n "$stcp_role" ] && { + if [ "$stcp_role" == "visitor" ]; then + echo "role=$stcp_role" >>$tmpconf + [ -n "$local_ip" ] && echo "bind_addr=$local_ip" >>$tmpconf + [ -n "$local_port" ] && echo "bind_port=$local_port" >>$tmpconf + [ -n "$stcp_servername" ] && echo "server_name=$stcp_servername" >>$tmpconf || return 1 + else + [ -n "$local_ip" ] && echo "local_ip=$local_ip" >>$tmpconf + [ -n "$local_port" ] && echo "local_port=$local_port" >>$tmpconf + fi + [ -n "$stcp_secretkey" ] && echo "sk=$stcp_secretkey" >>$tmpconf || return 1 + } + + + + frp_write_bool use_encryption $cfg 1 + frp_write_bool use_compression $cfg 1 + +} + +frp_write_bool() { + local opt="$1" + local config="$2" + local def="$3" + local val + + config_get_bool val $config "$opt" "$def" + if [ "$val" -eq 0 ]; then + echo "${opt}=false" >> $tmpconf + else + echo "${opt}=true" >> $tmpconf + fi +} + +frp_add_cru(){ +time=$1 +if [ ! -f "/etc/crontabs/root" ] || [ -z "$(cat /etc/crontabs/root | grep frp)" ]; then + sed -i '/frp/d' /etc/crontabs/root >/dev/null 2>&1 + echo "*/$time * * * * /etc/init.d/frp restart" >> /etc/crontabs/root +fi + +} + +frp_del_cru(){ +if [ ! -f "/etc/crontabs/root" ] || [ -n "$(cat /etc/crontabs/root | grep frp)" ]; then + sed -i '/frp/d' /etc/crontabs/root >/dev/null 2>&1 +fi +} + +download_binary(){ + echo_date "开始下载frpc二进制文件..." + /usr/bin/wget --no-check-certificate --timeout=10 --tries=1 -o $LOGFILE https://github.com/fatedier/frp/releases/download/v0.13.0/frp_0.13.0_linux_arm.tar.gz -O /tmp/frp_0.13.0_linux_arm.tar.gz + [ ! -s "/tmp/frp_0.13.0_linux_arm.tar.gz" ] && /usr/bin/wget -q --no-check-certificate --timeout=10 --tries=1 https://any.mokoo.xyz/app/frp_0.13.0_linux_arm.tar.gz -O /tmp/frp_0.13.0_linux_arm.tar.gz + [ -f "/tmp/frp_0.13.0_linux_arm.tar.gz" ] && tar -xf /tmp/frp_0.13.0_linux_arm.tar.gz -C /tmp && \ + mv /tmp/frp_0.13.0_linux_arm/frpc /usr/bin/frpc + rm -rf /tmp/frp_0.13.0_linux_arm* + if [ -f "/usr/bin/frpc" ]; then + chmod +x /usr/bin/frpc && echo_date "成功下载frpc二进制文件" + else + echo_date "下载frpc二进制文件失败,请重试!" + fi +} + +boot() { + sleep 10s + start +} + +start() { + + config_load "frp" + local enabled server_addr server_port time privilege_token tcp_mux enable_cpool + local pool_count log_level log_max_days login_fail_exit http_proxy protocol + + config_get_bool enabled common enabled 1 + + [ "$enabled" -gt 0 ] || return 1 + + config_get server_addr common server_addr + config_get server_port common server_port + config_get token common token + config_get enable_cpool common enable_cpool + config_get pool_count common pool_count + config_get log_level common log_level + config_get log_max_days common log_max_days + config_get http_proxy common http_proxy + config_get protocol common protocol + config_get time common time + + mkdir -p /var/etc/frp + [ ! -f "$LOGFILE" ] && touch $LOGFILE + + [ ! -f "/usr/bin/frpc" ] && download_binary + [ ! -f "/usr/bin/frpc" ] && logger -t Frp 'Download frpc failed, please retry.' && exit 0 + + local tmpconf="/var/etc/frp/frpc.conf" + + echo "[common]" >$tmpconf + echo "server_addr=${server_addr}" >>$tmpconf + echo "server_port=${server_port}" >>$tmpconf + echo "token=${token}" >>$tmpconf + echo "log_level=${log_level}" >>$tmpconf + echo "log_max_days=${log_max_days}" >>$tmpconf + echo "protocol=${protocol}" >>$tmpconf + echo "log_file=$LOGFILE" >>$tmpconf + [ -n "$http_proxy" ] && echo "http_proxy=$http_proxy" >>$tmpconf + [ -n "$pool_count" ] && echo "pool_count=$pool_count" >>$tmpconf + + config_load "frp" + frp_write_bool tcp_mux common 1 + frp_write_bool login_fail_exit common 1 + config_foreach conf_proxy_add proxy "$tmpconf" + + [ "$(cat "$tmpconf" | grep -c "type=")" -gt 0 ] || (echo_date "frp服务启动失败,请首先添加服务列表!" && exit 0) + logger -t FRPC 'Starting frp service' + SERVICE_DAEMONIZE=1 \ + service_start /usr/bin/frpc -c $tmpconf + + [ "$time" -gt 0 ] && frp_add_cru $time + [ -z "$(pgrep /usr/bin/frpc)" ] && echo_date "frp服务启动失败,请检查服务端 “TCP多路复用(tcp_mux)”设置,确保与客户端完全一致!" + + return 0 +} + +stop() { + frp_del_cru + if [ -n "`pidof frpc`" ]; then + logger -t FRPC 'Shutting down frp service' + service_stop /usr/bin/frpc + Reduce_Log $LOGFILE + fi + return 0 +} diff --git a/package/lean/luci-app-frpc/root/etc/uci-defaults/luci-frp b/package/lean/luci-app-frpc/root/etc/uci-defaults/luci-frp new file mode 100644 index 00000000000000..46016e1c5eb8d6 --- /dev/null +++ b/package/lean/luci-app-frpc/root/etc/uci-defaults/luci-frp @@ -0,0 +1,11 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@frp[-1] + add ucitrack frp + set ucitrack.@frp[-1].init=frp + commit ucitrack +EOF + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/package/lean/luci-app-frps/Makefile b/package/lean/luci-app-frps/Makefile new file mode 100644 index 00000000000000..3637e79ee37909 --- /dev/null +++ b/package/lean/luci-app-frps/Makefile @@ -0,0 +1,39 @@ +# +# Copyright 2020 Weizheng Li +# Licensed to the public under the MIT License. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=luci-app-frps +PKG_VERSION:=0.0.1 +PKG_RELEASE:=1 + +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE + +PKG_MAINTAINER:=Weizheng Li + +LUCI_TITLE:=LuCI support for Frps +LUCI_DEPENDS:=+wget +frps +LUCI_PKGARCH:=all + +define Package/$(PKG_NAME)/conffiles +/etc/config/frps +endef + +include $(TOPDIR)/feeds/luci/luci.mk + +define Package/$(PKG_NAME)/postinst +#!/bin/sh +if [ -z "$${IPKG_INSTROOT}" ]; then + ( . /etc/uci-defaults/40_luci-frps ) && rm -f /etc/uci-defaults/40_luci-frps +fi + +chmod 755 "$${IPKG_INSTROOT}/etc/init.d/frps" >/dev/null 2>&1 +ln -sf "../init.d/frps" \ + "$${IPKG_INSTROOT}/etc/rc.d/S99frps" >/dev/null 2>&1 +exit 0 +endef + +# call BuildPackage - OpenWrt buildroot signature diff --git a/package/lean/luci-app-frps/luasrc/controller/frps.lua b/package/lean/luci-app-frps/luasrc/controller/frps.lua new file mode 100644 index 00000000000000..94916c0bdd0801 --- /dev/null +++ b/package/lean/luci-app-frps/luasrc/controller/frps.lua @@ -0,0 +1,43 @@ +-- Copyright 2020 Weizheng Li +-- Licensed to the public under the MIT License. + +local http = require "luci.http" +local uci = require "luci.model.uci".cursor() +local sys = require "luci.sys" + +module("luci.controller.frps", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/frps") then + return + end + + entry({"admin", "services", "frps"}, + firstchild(), _("Frps")).dependent = false + + entry({"admin", "services", "frps", "common"}, + cbi("frps/common"), _("Settings"), 1) + + entry({"admin", "services", "frps", "server"}, + cbi("frps/server"), _("Server"), 2).leaf = true + + entry({"admin", "services", "frps", "status"}, call("action_status")) +end + + +function action_status() + local running = false + + local client = uci:get("frps", "main", "client_file") + if client and client ~= "" then + local file_name = client:match(".*/([^/]+)$") or "" + if file_name ~= "" then + running = sys.call("pidof %s >/dev/null" % file_name) == 0 + end + end + + http.prepare_content("application/json") + http.write_json({ + running = running + }) +end diff --git a/package/lean/luci-app-frps/luasrc/model/cbi/frps/common.lua b/package/lean/luci-app-frps/luasrc/model/cbi/frps/common.lua new file mode 100644 index 00000000000000..ba42f3da644916 --- /dev/null +++ b/package/lean/luci-app-frps/luasrc/model/cbi/frps/common.lua @@ -0,0 +1,110 @@ +-- Copyright 2020 Weizheng Li +-- Licensed to the public under the MIT License. + +local uci = require "luci.model.uci".cursor() +local util = require "luci.util" +local fs = require "nixio.fs" +local sys = require "luci.sys" + +local m, s, o +local server_table = { } + +local function frps_version() + local file = uci:get("frps", "main", "client_file") + + if not file or file == "" or not fs.stat(file) then + return "%s" % translate("Invalid client file") + end + + if not fs.access(file, "rwx", "rx", "rx") then + fs.chmod(file, 755) + end + + local version = util.trim(sys.exec("%s -v 2>/dev/null" % file)) + if version == "" then + return "%s" % translate("Can't get client version") + end + return translatef("Version: %s", version) +end + +m = Map("frps", "%s - %s" % { translate("Frps"), translate("Common Settings") }, +"

%s

%s

" % { + translate("Frp is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet."), + translatef("For more information, please visit: %s", + "https://github.com/fatedier/frp") +}) + +m:append(Template("frps/status_header")) + +s = m:section(NamedSection, "main", "frps") +s.addremove = false +s.anonymous = true + +s:tab("general", translate("General Options")) +s:tab("advanced", translate("Advanced Options")) +s:tab("dashboard", translate("Dashboard Options")) + +o = s:taboption("general", Flag, "enabled", translate("Enabled")) + +o = s:taboption("general", Value, "client_file", translate("Client file"), frps_version()) +o.datatype = "file" +o.rmempty = false + +o = s:taboption("general", ListValue, "run_user", translate("Run daemon as user")) +o:value("", translate("-- default --")) +local user +for user in util.execi("cat /etc/passwd | cut -d':' -f1") do + o:value(user) +end + +o = s:taboption("general", Flag, "enable_logging", translate("Enable logging")) + +o = s:taboption("general", Value, "log_file", translate("Log file")) +o:depends("enable_logging", "1") +o.placeholder = "/var/log/frps.log" + +o = s:taboption("general", ListValue, "log_level", translate("Log level")) +o:depends("enable_logging", "1") +o:value("trace", translate("Trace")) +o:value("debug", translate("Debug")) +o:value("info", translate("Info")) +o:value("warn", translate("Warn")) +o:value("error", translate("Error")) +o.default = "warn" + +o = s:taboption("general", Value, "log_max_days", translate("Log max days")) +o:depends("enable_logging", "1") +o.datatype = "uinteger" +o.placeholder = '3' + +o = s:taboption("general", Value, "disable_log_color", translate("Disable log color")) +o:depends("enable_logging", "1") +o.enabled = "true" +o.disabled = "false" + +o = s:taboption("advanced", Value, "max_pool_count", translate("Max pool count"), + translate("pool_count in each proxy will change to max_pool_count if they exceed the maximum value")) +o.datatype = "uinteger" + +o = s:taboption("advanced", Value, "max_ports_per_client", translate("Max ports per-client"), + translate("max ports can be used for each client, default value is 0 means no limit")) +o.datatype = "uinteger" +o.defalut = '0' +o.placeholder = '0' + +o = s:taboption("advanced", Value, "subdomain_host", translate("Subdomain host"), + translatef("if subdomain_host is not empty, you can set subdomain when type is http or https in frpc's configure file; when subdomain is test, the host used by routing is test.frps.com")) +o.datatype = "host" + +o = s:taboption("dashboard", Value, "dashboard_addr", translate("Dashboard addr"), translatef("dashboard addr's default value is same with bind_addr")) +o.datatype = "host" + +o = s:taboption("dashboard", Value, "dashboard_port", translate("Dashboard port"), translatef("dashboard is available only if dashboard_port is set")) +o.datatype = "port" + +o = s:taboption("dashboard", Value, "dashboard_user", translate("Dashboard user"), translatef("dashboard user and passwd for basic auth protect, if not set, both default value is admin")) + +o = s:taboption("dashboard", Value, "dashboard_pwd", translate("Dashboard password")) +o.password = true + +return m diff --git a/package/lean/luci-app-frps/luasrc/model/cbi/frps/server.lua b/package/lean/luci-app-frps/luasrc/model/cbi/frps/server.lua new file mode 100644 index 00000000000000..44d4b38ca6d326 --- /dev/null +++ b/package/lean/luci-app-frps/luasrc/model/cbi/frps/server.lua @@ -0,0 +1,43 @@ +-- Copyright 2020 Weizheng Li +-- Licensed to the public under the MIT License. + +local dsp = require "luci.dispatcher" + +local m, s, o + +m = Map("frps", "%s - %s" % { translate("Frps"), translate("FRPS Server setting") }) + +s = m:section(NamedSection, "main", "frps") +s.anonymous = true +s.addremove = false + +o = s:option(Value, "bind_port", translate("Bind port")) +o.datatype = "port" +o.rmempty = false + +o = s:option(Value, "token", translate("Token")) +o.password = true + +o = s:option(Flag, "tcp_mux", translate("TCP mux")) +o.enabled = "true" +o.disabled = "false" +o.defalut = o.enabled +o.rmempty = false + +o = s:option(Value, "bind_udp_port", translate("UDP bind port"), + translatef("Optional: udp port to help make udp hole to penetrate nat")) +o.datatype = "port" + +o = s:option(Value, "kcp_bind_port", translate("KCP bind port"), + translatef("Optional: udp port used for kcp protocol, it can be same with 'bind port'; if not set, kcp is disabled in frps")) +o.datatype = "port" + +o = s:option(Value, "vhost_http_port", translate("vhost http port"), + translatef("Optional: if you want to support virtual host, you must set the http port for listening")) +o.datatype = "port" + +o = s:option(Value, "vhost_https_port", translate("vhost https port"), + translatef("Optional: Note: http port and https port can be same with bind_port")) +o.datatype = "port" + +return m \ No newline at end of file diff --git a/package/lean/luci-app-frps/luasrc/view/frps/status_header.htm b/package/lean/luci-app-frps/luasrc/view/frps/status_header.htm new file mode 100644 index 00000000000000..7df8bf9e64ffab --- /dev/null +++ b/package/lean/luci-app-frps/luasrc/view/frps/status_header.htm @@ -0,0 +1,29 @@ +<%# + Copyright 2020 Weizheng Li + Licensed to the public under the MIT License. +-%> + +<% +local dsp = require "luci.dispatcher" +-%> + +
+

+ <%:Collecting data...%> +

+
+ + diff --git a/package/lean/luci-app-frps/po/zh-cn/frps.po b/package/lean/luci-app-frps/po/zh-cn/frps.po new file mode 100644 index 00000000000000..8f73ccf5de5c0f --- /dev/null +++ b/package/lean/luci-app-frps/po/zh-cn/frps.po @@ -0,0 +1,233 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +#: luasrc/model/cbi/frps/common.lua:54 +msgid "-- default --" +msgstr "-- 默认 --" + +#: luasrc/model/cbi/frps/common.lua:44 +msgid "Advanced Options" +msgstr "高级选项" + +#: luasrc/model/cbi/frps/server.lua:14 +msgid "Bind port" +msgstr "绑定端口" + +#: luasrc/model/cbi/frps/common.lua:25 +msgid "Can't get client version" +msgstr "无法获取到客户端版本" + +#: luasrc/model/cbi/frps/common.lua:49 +msgid "Client file" +msgstr "客户端文件" + +#: luasrc/view/frps/status_header.htm:12 +msgid "Collecting data..." +msgstr "正在收集数据..." + +#: luasrc/model/cbi/frps/common.lua:30 +msgid "Common Settings" +msgstr "通用设置" + +#: luasrc/model/cbi/frps/common.lua:45 +msgid "Dashboard Options" +msgstr "面板选项" + +#: luasrc/model/cbi/frps/common.lua:99 +msgid "Dashboard addr" +msgstr "面板绑定地址" + +#: luasrc/model/cbi/frps/common.lua:107 +msgid "Dashboard password" +msgstr "面板登录密码" + +#: luasrc/model/cbi/frps/common.lua:102 +msgid "Dashboard port" +msgstr "面板绑定端口" + +#: luasrc/model/cbi/frps/common.lua:105 +msgid "Dashboard user" +msgstr "面板登录用户名" + +#: luasrc/model/cbi/frps/common.lua:69 +msgid "Debug" +msgstr "调试" + +#: luasrc/model/cbi/frps/common.lua:80 +msgid "Disable log color" +msgstr "禁用日志颜色" + +#: luasrc/model/cbi/frps/common.lua:60 +msgid "Enable logging" +msgstr "启用日志" + +#: luasrc/model/cbi/frps/common.lua:47 +msgid "Enabled" +msgstr "已启用" + +#: luasrc/model/cbi/frps/common.lua:72 +msgid "Error" +msgstr "错误" + +#: luasrc/model/cbi/frps/server.lua:8 +msgid "FRPS Server setting" +msgstr "Frps 服务器设定" + +#: luasrc/model/cbi/frps/common.lua:33 +msgid "For more information, please visit: %s" +msgstr "获取更多信息,请访问:%s" + +#: luasrc/model/cbi/frps/common.lua:32 +msgid "" +"Frp is a fast reverse proxy to help you expose a local server behind a NAT " +"or firewall to the internet." +msgstr "Frp 是一个可用于内网穿透的高性能的反向代理应用。" + +#: luasrc/controller/frps.lua:16 luasrc/model/cbi/frps/common.lua:30 +#: luasrc/model/cbi/frps/server.lua:8 +msgid "Frps" +msgstr "Frps" + +#: luasrc/model/cbi/frps/common.lua:43 +msgid "General Options" +msgstr "常规选项" + +#: luasrc/model/cbi/frps/common.lua:70 +msgid "Info" +msgstr "信息" + +#: luasrc/model/cbi/frps/common.lua:16 +msgid "Invalid client file" +msgstr "客户端文件无效" + +#: luasrc/model/cbi/frps/server.lua:31 +msgid "KCP bind port" +msgstr "KCP绑定端口" + +#: luasrc/model/cbi/frps/common.lua:62 +msgid "Log file" +msgstr "日志文件" + +#: luasrc/model/cbi/frps/common.lua:66 +msgid "Log level" +msgstr "日志等级" + +#: luasrc/model/cbi/frps/common.lua:75 +msgid "Log max days" +msgstr "日志保存天数" + +#: luasrc/model/cbi/frps/common.lua:85 +msgid "Max pool count" +msgstr "最大连接数" + +#: luasrc/model/cbi/frps/common.lua:89 +msgid "Max ports per-client" +msgstr "单客户端最大端口映射数" + +#: luasrc/view/frps/status_header.htm:26 +msgid "Not Running" +msgstr "服务未运行" + +#: luasrc/model/cbi/frps/server.lua:40 +msgid "Optional: Note: http port and https port can be same with bind_port" +msgstr "(可选)提示:http/https端口可以和绑定端口设定为一致" + +#: luasrc/model/cbi/frps/server.lua:36 +msgid "" +"Optional: if you want to support virtual host, you must set the http port " +"for listening" +msgstr "(可选)如果您希望支持虚拟主机,则必须设定http端口" + +#: luasrc/model/cbi/frps/server.lua:28 +msgid "Optional: udp port to help make udp hole to penetrate nat" +msgstr "(可选)设定UDP端口以帮助UDP协议穿透NAT" + +#: luasrc/model/cbi/frps/server.lua:32 +msgid "" +"Optional: udp port used for kcp protocol, it can be same with 'bind port'; " +"if not set, kcp is disabled in frps" +msgstr "(可选)UDP端口用于KCP协议,可与绑定端口设定为一致;留空以禁用KCP" + +#: luasrc/model/cbi/frps/common.lua:53 +msgid "Run daemon as user" +msgstr "以用户身份运行" + +#: luasrc/view/frps/status_header.htm:25 +msgid "Running" +msgstr "服务正在运行" + +#: luasrc/controller/frps.lua:22 +msgid "Server" +msgstr "服务端" + +#: luasrc/controller/frps.lua:19 +msgid "Settings" +msgstr "设置" + +#: luasrc/model/cbi/frps/common.lua:95 +msgid "Subdomain host" +msgstr "子域名" + +#: luasrc/model/cbi/frps/server.lua:21 +msgid "TCP mux" +msgstr "TCP 复用" + +#: luasrc/model/cbi/frps/server.lua:18 +msgid "Token" +msgstr "令牌" + +#: luasrc/model/cbi/frps/common.lua:68 +msgid "Trace" +msgstr "追踪" + +#: luasrc/model/cbi/frps/server.lua:27 +msgid "UDP bind port" +msgstr "UDP绑定端口" + +#: luasrc/model/cbi/frps/common.lua:27 +msgid "Version: %s" +msgstr "版本:%s" + +#: luasrc/model/cbi/frps/common.lua:71 +msgid "Warn" +msgstr "警告" + +#: luasrc/model/cbi/frps/common.lua:99 +msgid "dashboard addr's default value is same with bind_addr" +msgstr "面板地址默认和绑定地址一致" + +#: luasrc/model/cbi/frps/common.lua:102 +msgid "dashboard is available only if dashboard_port is set" +msgstr "仅在设定面板绑定端口后才可使用面板功能" + +#: luasrc/model/cbi/frps/common.lua:105 +msgid "" +"dashboard user and passwd for basic auth protect, if not set, both default " +"value is admin" +msgstr "面板用户名/密码用于基本安全认证;若留空,则用户名/密码均为admin" + +#: luasrc/model/cbi/frps/common.lua:96 +msgid "" +"if subdomain_host is not empty, you can set subdomain when type is http or " +"https in frpc's configure file; when subdomain is test, the host used by " +"routing is test.frps.com" +msgstr "如果subdomain_host不为空,可以在frpc配置文件中设置类型为http(s)的subdomain;subdomain为test,路由将使用test.frps.com" + +#: luasrc/model/cbi/frps/common.lua:90 +msgid "" +"max ports can be used for each client, default value is 0 means no limit" +msgstr "每个客户端最多可映射端口数,留空则默认为0(不限制)" + +#: luasrc/model/cbi/frps/common.lua:86 +msgid "" +"pool_count in each proxy will change to max_pool_count if they exceed the " +"maximum value" +msgstr "代理连接数(pool_count)超过最大值时将变更为最大连接数(max_pool_count)" + +#: luasrc/model/cbi/frps/server.lua:35 +msgid "vhost http port" +msgstr "虚拟主机http绑定端口" + +#: luasrc/model/cbi/frps/server.lua:39 +msgid "vhost https port" +msgstr "虚拟主机https绑定端口" diff --git a/package/lean/luci-app-frps/root/etc/config/frps b/package/lean/luci-app-frps/root/etc/config/frps new file mode 100644 index 00000000000000..ab15b33851280f --- /dev/null +++ b/package/lean/luci-app-frps/root/etc/config/frps @@ -0,0 +1,6 @@ +config frps 'main' + option enabled '0' + option server 'frps' + option client_file '/usr/bin/frps' + option bind_port '7000' + option tcp_mux 'true' \ No newline at end of file diff --git a/package/lean/luci-app-frps/root/etc/init.d/frps b/package/lean/luci-app-frps/root/etc/init.d/frps new file mode 100644 index 00000000000000..b524c5e0be985e --- /dev/null +++ b/package/lean/luci-app-frps/root/etc/init.d/frps @@ -0,0 +1,189 @@ +#!/bin/sh /etc/rc.common +# +# Copyright 2020 Weizheng Li +# Licensed to the public under the MIT License. +# + +START=99 +USE_PROCD=1 + +NAME="frps" +CONFIG_FOLDER="/var/etc/$NAME" + +_log() { + local level="$1" ; shift + local msg="$@" + logger -p "daemon.$level" -t "$NAME" "$msg" + + echo "[$level] $msg" >&2 +} + +_info() { + _log "info" $@ +} + +_err() { + _log "err" $@ +} + +append_options() { + local file="$1" ; shift + local o v + for o in "$@" ; do + v="$(eval echo "\$$o")" + if [ -n "$v" ] ; then + # add brackets when ipv6 address + if ( echo "$o" | grep -qE 'addr|ip' ) && + ( echo "$v" | grep -q ':' ) ; then + v="[$v]" + fi + + echo "${o} = $v" >>"$file" + fi + done +} + +append_setting() { + local file="$1" ; shift + local s="$1" + if [ -n "$s" ] ; then + echo "$s" >>"$file" + fi +} + +frps_scetion_validate() { + uci_validate_section "$NAME" "frps" "$1" \ + 'enabled:bool:0' \ + 'client_file:file:/usr/bin/frps' \ + 'run_user:string' \ + 'enable_logging:bool:0' \ + 'log_file:string:/var/log/frps.log' \ + 'log_level:or("trace", "debug", "info", "warn", "error"):warn' \ + 'log_max_days:uinteger:3' \ + 'disable_log_color:or("true", "false")' \ + 'max_pool_count:uinteger' \ + 'max_ports_per_client:uinteger:0' \ + 'subdomain_host:host' \ + 'dashboard_addr:host' \ + 'dashboard_port:port' \ + 'dashboard_user:string' \ + 'dashboard_pwd:string' \ + 'bind_port:port' \ + 'token:string' \ + 'tcp_mux:or("true", "false"):true' \ + 'bind_udp_port:port' \ + 'kcp_bind_port:port' \ + 'vhost_http_port:port' \ + 'vhost_https_port:port' +} + +client_file_validate() { + local file="$1" + + test -f "$file" || return 1 + test -x "$file" || chmod 755 "$file" + + eval "$file" -h | grep -q "$NAME" + return $? +} + +add_rule_extra_option() { + append_setting "$2" "$1" +} + +create_config_file() { + local config_file="$1" + local tmp_file="$(mktemp /tmp/frps-XXXXXX)" + + echo "[common]" > "$tmp_file" + + append_options "$tmp_file" \ + "bind_port" "token" "tcp_mux" "bind_udp_port" "kcp_bind_port" "vhost_http_port" "vhost_https_port" + + + if [ "x$enable_logging" = "x1" ] ; then + if [ -z "$log_file" ]; then + log_file="/var/log/frps.log" + fi + + append_options "$tmp_file" \ + "log_file" "log_level" "log_max_days" "disable_log_color" + + if [ -f "$log_file" ] ; then + echo > "$log_file" + else + local log_folder="$(dirname "$log_file")" + + if [ ! -d "$log_folder" ] ; then + mkdir -p "$log_folder" + fi + fi + + if [ -n "$run_user" ] && ( user_exists "$run_user" ) ; then + chmod 644 "$log_file" + chown "$run_user" "$log_file" + else + run_user="" + fi + fi + + append_options "$tmp_file" \ + "max_pool_count" "max_ports_per_client" "subdomain_host" "dashboard_addr" "dashboard_port" "dashboard_user" "dashboard_pwd" + + sed '/^$/d' "$tmp_file" >"$config_file" + + if [ "$?" = "0" ] ; then + rm -f "$tmp_file" + fi +} + +start_instance() { + local section="$1" + + if ! frps_scetion_validate "$section" ; then + _err "Config validate failed." + return 1 + fi + + if [ "x$enabled" != "x1" ] ; then + _info "Instance \"$section\" disabled." + return 1 + fi + + if [ -z "$client_file" ] || ( ! client_file_validate "$client_file" ) ; then + _err "Client file not valid." + return 1 + fi + + test -d "$CONFIG_FOLDER" || mkdir -p "$CONFIG_FOLDER" + + local config_file="$CONFIG_FOLDER/frps.$section.ini" + + create_config_file "$config_file" + + if [ ! -f "$config_file" ] ; then + _err "Could not create config file: \"$config_file\"" + return 1 + fi + + procd_open_instance "$NAME.$section" + procd_set_param command "$client_file" + procd_append_param command -c "$config_file" + procd_set_param respawn + procd_set_param file "$config_file" + + if [ -n "$run_user" ] ; then + procd_set_param user "$run_user" + fi + + procd_close_instance +} + +service_triggers() { + procd_add_reload_trigger "$NAME" +} + +start_service() { + config_load "$NAME" + config_foreach start_instance "frps" +} diff --git a/package/lean/luci-app-frps/root/etc/uci-defaults/40_luci-frps b/package/lean/luci-app-frps/root/etc/uci-defaults/40_luci-frps new file mode 100644 index 00000000000000..b0f9d5783ae112 --- /dev/null +++ b/package/lean/luci-app-frps/root/etc/uci-defaults/40_luci-frps @@ -0,0 +1,25 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@frps[-1] + add ucitrack frps + set ucitrack.@frps[-1].init=frps + commit ucitrack +EOF + +frps=$(uci -q get frps.@frps[-1]) + +if [ -z "$frps" ]; then + uci -q add frps frps +fi + +if [ "x$frps" != "xmain" ]; then + uci -q batch <<-EOF >/dev/null + rename frps.@frps[-1]="main" + set frps.main.enabled="0" + commit frps + EOF +fi + +rm -rf /tmp/luci-indexcache /tmp/luci-modulecache +exit 0 diff --git a/package/lean/luci-app-guest-wifi/Makefile b/package/lean/luci-app-guest-wifi/Makefile new file mode 100644 index 00000000000000..814bac85d9de20 --- /dev/null +++ b/package/lean/luci-app-guest-wifi/Makefile @@ -0,0 +1,17 @@ +# +# Copyright (C) 2018 By-Ameng Openwrt.org +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=luci-app-guest-wifi +LUCI_DEPENDS:= +LUCI_PKGARCH:=all +PKG_VERSION:=1.0 +PKG_RELEASE:=1 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/package/lean/luci-app-guest-wifi/luasrc/controller/guest-wifi.lua b/package/lean/luci-app-guest-wifi/luasrc/controller/guest-wifi.lua new file mode 100644 index 00000000000000..887512f6a634b1 --- /dev/null +++ b/package/lean/luci-app-guest-wifi/luasrc/controller/guest-wifi.lua @@ -0,0 +1,14 @@ +module("luci.controller.guest-wifi", package.seeall) + +function index() + require("luci.i18n") + luci.i18n.loadc("guest-wifi") + if not nixio.fs.access("/etc/config/guest-wifi") then + return + end + + local page = entry({"admin", "network", "guest-wifi"}, cbi("guest-wifi"), translate("Guest-wifi"), 19) + page.i18n = "guest-wifi" + page.dependent = true + +end diff --git a/package/lean/luci-app-guest-wifi/luasrc/model/cbi/guest-wifi.lua b/package/lean/luci-app-guest-wifi/luasrc/model/cbi/guest-wifi.lua new file mode 100644 index 00000000000000..c498af3ce08857 --- /dev/null +++ b/package/lean/luci-app-guest-wifi/luasrc/model/cbi/guest-wifi.lua @@ -0,0 +1,66 @@ + +require("luci.tools.webadmin") + +m = Map("guest-wifi", translate("Guest-wifi")) + +s = m:section(TypedSection, "guest-wifi", translate("Config"), translate("You can set guest wifi here. The wifi will be disconnected when enabling/disabling. When modifying the password, first disable the guest wifi, and then do the modification, save and apply. Finally check both Enable and Create, save and apply.")) +s.anonymous = true +s.addremove = false + +enable = s:option(Flag, "enable", translate("Enable"), translate("Enable or disable guest wifi")) +enable.default = false +enable.optional = false +enable.rmempty = false + +create = s:option(Flag, "create", translate("Create/Remove"), translate("Check to create guest wifi when enabled, or check to remove guest wifi when disabled.")) +create.default = false +create.optional = false +create.rmempty = false + +device = s:option(ListValue, "device", translate("Define device"), translate("Define device of guest wifi")) +device:value("radio0", "radio0") +device:value("radio1", "radio1") +device:value("radio2", "radio2") +device.default = "radio0" + +wifi_name = s:option(Value, "wifi_name", translate("Wifi name"), translate("Define the name of guest wifi")) +wifi_name.default = "Guest-WiFi" +wifi_name.rmempty = true + +interface_name = s:option(Value, "interface_name", translate("Interface name"), translate("Define the interface name of guest wifi")) +interface_name.default = "guest" +interface_name.rmempty = true + +interface_ip = s:option(Value, "interface_ip", translate("Interface IP address"), translate("Define IP address for guest wifi")) +interface_ip.datatype = "ip4addr" +interface_ip.default ="192.168.4.1" + +encryption = s:option(Value, "encryption", translate("Encryption"), translate("Define encryption of guest wifi")) +encryption:value("psk", "WPA-PSK") +encryption:value("psk2", "WPA2-PSK") +encryption:value("none", "No Encryption") +encryption.default = "psk2" +encryption.widget = "select" + +passwd = s:option(Value, "passwd", translate("Password"), translate("Define the password of guest wifi")) +passwd.password = true +passwd.default = "guestnetwork" + +isolate = s:option(ListValue, "isolate", translate("Isolation"), translate("Enalbe or disable isolation")) +isolate:value("1", translate("YES")) +isolate:value("0", translate("NO")) + +start = s:option(Value, "start", translate("Start address"), translate("Lowest leased address as offset from the network address")) +start.default = "50" +start.rmempty = true + +limit = s:option(Value, "limit", translate("Client Limit"), translate("Maximum number of leased addresses")) +limit.default = "200" +limit.rmempty = true + +leasetime = s:option(Value, "leasetime", translate("DHCP lease time"), translate("Expiry time of leased addresses, minimum is 2 minutes (2m)")) +leasetime.default = "1h" +leasetime.rmempty = true + +return m + diff --git a/package/lean/luci-app-guest-wifi/po/zh-cn/guest-wifi.po b/package/lean/luci-app-guest-wifi/po/zh-cn/guest-wifi.po new file mode 100644 index 00000000000000..d5971e7ab1b3f7 --- /dev/null +++ b/package/lean/luci-app-guest-wifi/po/zh-cn/guest-wifi.po @@ -0,0 +1,90 @@ +msgid "guest-wifi" +msgstr "访客网络" + +msgid "Guest-wifi" +msgstr "访客网络" + +msgid "Config" +msgstr "设置" + +msgid "You can set guest wifi here. The wifi will be disconnected when enabling/disabling. When modifying the password, first disable the guest wifi, and then do the modification, save and apply. Finally check both Enable and Create, save and apply." +msgstr "在此可以设置访客网络。启用/禁用访客网络时wifi会断开。当修改访客名称密码时,先禁用访客网络并保存应用,然后修改后保存应用,最后同时勾选启用和创建并保存应用。" + +msgid "Enable" +msgstr "启用" + +msgid "Enable or disable guest wifi" +msgstr "启用/禁用访客网络" + +msgid "Create/Remove" +msgstr"创建/删除" + +msgid "Check to create guest wifi when enabled, or check to remove guest wifi when disabled." +msgstr "与启用同时勾选,可创建和启用访客网络;启用不勾选时勾选,可删除访客网络。" + +msgid "Define device" +msgstr "指定设备" + +msgid "Define device of guest wifi" +msgstr "指定用于访客网络的设备" + +msgid "Wifi name" +msgstr "无线名称" + +msgid "Define the name of guest wifi" +msgstr "指定访客网络的无线名称" + +msgid "Interface name" +msgstr "接口名称" + +msgid "Define the interface name of guest wifi" +msgstr "设置访客网络的接口名称" + +msgid "Interface IP address" +msgstr "接口IP地址" + +msgid "Define IP address for guest wifi" +msgstr "指定访客网络的IP地址(不能与其他LAN的IP地址段相同)" + +msgid "Encryption" +msgstr "加密" + +msgid "Define encryption of guest wifi" +msgstr "设置访客网络的无线加密方式" + +msgid "Password" +msgstr "密码" + +msgid "Define the password of guest wifi" +msgstr "设备访客网络的无线密码" + +msgid "Isolation" +msgstr "隔离" + +msgid "Enalbe or disable isolation" +msgstr "开启或关闭与其它LAN网段的隔离" + +msgid "Start address" +msgstr "起始地址" + +msgid "Lowest leased address as offset from the network address" +msgstr "网络地址分配的起始地址" + +msgid "Client Limit" +msgstr "客户端最大数目" + +msgid "Maximum number of leased addresses" +msgstr "最大地址分配数量" + +msgid "DHCP lease time" +msgstr "DHCP地址租用时间" + +msgid "Expiry time of leased addresses, minimum is 2 minutes (2m)" +msgstr "租用地址的到期时间,最短2分钟(2m)" + +msgid "YES" +msgstr "是" + +msgid "NO" +msgstr "否" + diff --git a/package/lean/luci-app-guest-wifi/root/etc/config/guest-wifi b/package/lean/luci-app-guest-wifi/root/etc/config/guest-wifi new file mode 100644 index 00000000000000..d43f5f5b3c3621 --- /dev/null +++ b/package/lean/luci-app-guest-wifi/root/etc/config/guest-wifi @@ -0,0 +1,14 @@ + +config guest-wifi + option enable '0' + option wifi_name 'Guest-WiFi' + option interface_name 'guest' + option encryption 'psk2' + option passwd 'guestnetwork' + option interface_ip '192.168.4.1' + option isolate '1' + option start '50' + option limit '200' + option leasetime '1h' + option device 'radio0' + option create '0' diff --git a/package/lean/luci-app-guest-wifi/root/etc/init.d/guest-wifi b/package/lean/luci-app-guest-wifi/root/etc/init.d/guest-wifi new file mode 100644 index 00000000000000..18ad8b164be4d2 --- /dev/null +++ b/package/lean/luci-app-guest-wifi/root/etc/init.d/guest-wifi @@ -0,0 +1,213 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2015 +# Must keep author's information if you use this file. + +START=50 + +HISTORY_DIR="/etc/config/guestwifi" +[ -e /etc/config/guestwifi ]||mkdir -p /etc/config/guestwifi + +enabled=$(uci get guest-wifi.@guest-wifi[0].enable) +wifi_name=$(uci get guest-wifi.@guest-wifi[0].wifi_name) +interface_name=$(uci get guest-wifi.@guest-wifi[0].interface_name) +encryption=$(uci get guest-wifi.@guest-wifi[0].encryption) +passwd=$(uci get guest-wifi.@guest-wifi[0].passwd) +interface_ip=$(uci get guest-wifi.@guest-wifi[0].interface_ip) +isolate=$(uci get guest-wifi.@guest-wifi[0].isolate) +start=$(uci get guest-wifi.@guest-wifi[0].start) +limit=$(uci get guest-wifi.@guest-wifi[0].limit) +leasetime=$(uci get guest-wifi.@guest-wifi[0].leasetime) +device=$(uci get guest-wifi.@guest-wifi[0].device) +create=$(uci get guest-wifi.@guest-wifi[0].create) + + +start() { + [ $enabled = 1 ] && { + [ $create = 1 ] && { + [ -f /etc/config/guestwifi/guest_del ] || echo "#! /bin/sh" > ${HISTORY_DIR}/guest_del + chmod 0755 ${HISTORY_DIR}/guest_del + add_interface + add_ssid + mod_dhcp + mod_fw + /etc/init.d/network restart + } + uci set guest-wifi.@guest-wifi[0].create='0' + uci commit guest-wifi + uci del wireless.$interface_name.disabled + uci commit wireless + wifi + } +} + + +stop() { + [ $enabled = 0 ] && { + [ $create = 1 ] && { + ${HISTORY_DIR}/guest_del + rule_c=`uci show firewall |grep "Hide My LAN for $wifi_name"|grep -o "[0-9]*[0-9]"` + uci del firewall.@rule[$rule_c] + uci commit firewall + rule_b=`uci show firewall |grep "Allow DHCP request for $wifi_name"|grep -o "[0-9]*[0-9]"` + uci del firewall.@rule[$rule_b] + uci commit firewall + rule_a=`uci show firewall |grep "Allow DNS Queries for $wifi_name"|grep -o "[0-9]*[0-9]"` + uci del firewall.@rule[$rule_a] + uci commit firewall + /etc/config/guestwifi/guest_del + rm -rf /etc/config/guestwifi/guest_del + /etc/init.d/network restart + } + uci set guest-wifi.@guest-wifi[0].create='0' + uci commit guest-wifi + uci set wireless.$interface_name.disabled='1' + uci commit wireless + wifi + } +} + +restart() { + stop + sleep 2 + start +} + +add_interface() { + name=`uci show network |grep "$interface_ip"` + if [ $? = 1 ]; then + uci set network.$interface_name=interface + uci set network.$interface_name.proto='static' + uci set network.$interface_name.ipaddr="$interface_ip" + uci set network.$interface_name.netmask='255.255.255.0' + echo "uci del network.$interface_name" >> ${HISTORY_DIR}/guest_del + echo "uci commit network" >> ${HISTORY_DIR}/guest_del + uci commit network + fi +} + +add_ssid() { + check_name=`uci show wireless |grep "$wifi_name"` + if [ $? = 1 ]; then + uci set wireless.$interface_name=wifi-iface + uci set wireless.$interface_name.device="$device" + uci set wireless.$interface_name.mode='ap' + uci set wireless.$interface_name.network="$interface_name" + uci set wireless.$interface_name.ssid="$wifi_name" + uci set wireless.$interface_name.encryption="$encryption" + uci set wireless.$interface_name.isolate="$isolate" + if [ "$encryption" != "none" ]; then + uci set wireless.$interface_name.key="$passwd" + fi + echo "uci del wireless.$interface_name" >> ${HISTORY_DIR}/guest_del + echo "uci commit wireless" >> ${HISTORY_DIR}/guest_del + uci commit wireless + fi +} + +mod_dhcp() { + check_dhcp=`uci show dhcp |grep "$interface_name=dhcp"` + if [ $? = 1 ]; then + uci set dhcp.$interface_name=dhcp + uci set dhcp.$interface_name.interface="$interface_name" + uci set dhcp.$interface_name.start="$start" + uci set dhcp.$interface_name.limit="$limit" + uci set dhcp.$interface_name.leasetime="$leasetime" + echo "uci del dhcp.$interface_name" >> ${HISTORY_DIR}/guest_del + echo "uci commit dhcp" >> ${HISTORY_DIR}/guest_del + uci commit dhcp + fi +} + +mod_fw() { + num_a=`uci show firewall |grep '=zone' |wc -l` + num_b=`uci show firewall |grep '=forwarding' |wc -l` + + check_zone=`uci show firewall |grep "name=\'$interface_name\'"` + if [ $? = 1 ]; then + uci add firewall zone + echo "uci del firewall.@zone[$num_a]" >> ${HISTORY_DIR}/guest_del + echo "uci commit firewall" >> ${HISTORY_DIR}/guest_del + uci set firewall.@zone[$num_a]=zone + uci set firewall.@zone[$num_a].name="$interface_name" + uci set firewall.@zone[$num_a].network="$interface_name" + uci set firewall.@zone[$num_a].forward='REJECT' + uci set firewall.@zone[$num_a].output='ACCEPT' + uci set firewall.@zone[$num_a].input='REJECT' + uci commit firewall + fi + + check_forward=`uci show firewall |grep "forwarding\[.*\].src=\'"$interface_name\'""` + if [ $? = 1 ]; then + uci add firewall forwarding + echo "uci del firewall.@forwarding[$num_b]" >> ${HISTORY_DIR}/guest_del + echo "uci commit firewall" >> ${HISTORY_DIR}/guest_del + uci set firewall.@forwarding[$num_b]=forwarding + uci set firewall.@forwarding[$num_b].src="$interface_name" + uci set firewall.@forwarding[$num_b].dest='wan' + uci commit firewall + fi + + check_DNS=`uci show firewall |grep "Allow DNS Queries for $wifi_name"` + if [ $? = 1 ]; then + num_c=`uci show firewall |grep '=rule' |wc -l` + uci add firewall rule + uci set firewall.@rule[$num_c]=rule + uci set firewall.@rule[$num_c].name="Allow DNS Queries for $wifi_name" + uci set firewall.@rule[$num_c].src="$interface_name" + uci set firewall.@rule[$num_c].dest_port='53' + uci set firewall.@rule[$num_c].proto='tcpudp' + uci set firewall.@rule[$num_c].target='ACCEPT' + uci commit firewall + unset num_c + fi + + check_DHCP=`uci show firewall |grep "Allow DHCP request for $wifi_name"` + if [ $? = 1 ]; then + num_c=`uci show firewall |grep '=rule' |wc -l` + uci add firewall rule + uci set firewall.@rule[$num_c]=rule + uci set firewall.@rule[$num_c].name="Allow DHCP request for $wifi_name" + uci set firewall.@rule[$num_c].src="$interface_name" + uci set firewall.@rule[$num_c].src_port='67-68' + uci set firewall.@rule[$num_c].dest_port='67-68' + uci set firewall.@rule[$num_c].proto='udp' + uci set firewall.@rule[$num_c].target='ACCEPT' + uci commit firewall + unset num_c + fi + + check_HIDE=`uci show firewall |grep "Hide My LAN for $wifi_name"` + if [ $? = 1 ]; then + num_c=`uci show firewall |grep '=rule' |wc -l` + uci add firewall rule + uci set firewall.@rule[$num_c]=rule + uci set firewall.@rule[$num_c].enabled='1' + uci set firewall.@rule[$num_c].name="Hide My LAN for $wifi_name" + uci set firewall.@rule[$num_c].proto='all' + uci set firewall.@rule[$num_c].src="$interface_name" + #convert netmask to cidr + local lan_netmask=`uci get network.lan.netmask` + local nbits=0 + local IFS=. + for netmask_dec in $lan_netmask ; do + case $netmask_dec in + 255) let nbits+=8 ;; + 254) let nbits+=7 ;; + 252) let nbits+=6 ;; + 248) let nbits+=5 ;; + 240) let nbits+=4 ;; + 224) let nbits+=3 ;; + 192) let nbits+=2 ;; + 128) let nbits+=1 ;; + 0) ;; + *) echo "Error: $netmask_dec can not be recognised as netmask decimal." && exit 1 ;; + esac + done + unset netmask_dec + uci set firewall.@rule[$num_c].dest_ip="`uci get network.lan.ipaddr`/$nbits" + uci set firewall.@rule[$num_c].target='REJECT' + uci commit firewall + unset num_c + fi +} + diff --git a/package/lean/luci-app-guest-wifi/root/etc/uci-defaults/luci-app-guest-wifi b/package/lean/luci-app-guest-wifi/root/etc/uci-defaults/luci-app-guest-wifi new file mode 100644 index 00000000000000..02ad18b3fe7f88 --- /dev/null +++ b/package/lean/luci-app-guest-wifi/root/etc/uci-defaults/luci-app-guest-wifi @@ -0,0 +1,11 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@guest-wifi[-1] + add ucitrack guest-wifi + set ucitrack.@guest-wifi[-1].init=guest-wifi + commit ucitrack +EOF + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/package/lean/luci-app-haproxy-tcp/Makefile b/package/lean/luci-app-haproxy-tcp/Makefile new file mode 100644 index 00000000000000..0be02c16148952 --- /dev/null +++ b/package/lean/luci-app-haproxy-tcp/Makefile @@ -0,0 +1,27 @@ +# Copyright (C) 2019 Openwrt.org +# +# This is a free software, use it under Apache Licene 2.0 & GNU General Public License v3.0. +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=luci for haproxy and shadowsocks +LUCI_DEPENDS:=+haproxy +LUCI_PKGARCH:=all +PKG_NAME:=luci-app-haproxy-tcp +PKG_VERSION=1.4 +PKG_RELEASE:=2 +PKG_MAINTAINER:=Alex Zhuo <1886090@gmail.com> + +include $(TOPDIR)/feeds/luci/luci.mk + +define Package/$(PKG_NAME)/postinst +#!/bin/sh +rm -rf /tmp/luci* +echo stopping haproxy +/etc/init.d/haproxy stop +/etc/init.d/haproxy disable +echo haproxy disabled +endef + +# call BuildPackage - OpenWrt buildroot signature diff --git a/package/lean/luci-app-haproxy-tcp/README.md b/package/lean/luci-app-haproxy-tcp/README.md new file mode 100644 index 00000000000000..d95f46844e880d --- /dev/null +++ b/package/lean/luci-app-haproxy-tcp/README.md @@ -0,0 +1,54 @@ +# luci-app-haproxy-tcp +OpenWrt HAProxy的Luci配置页面,已在[该固件][A]中使用 + +简介 +--- + +本软件包为OpenWRT HAPrxoy的 LuCI 控制界面,用于Shadowsocks在多服务器条件下实现负载均衡和高可用 + +可以设置多个主服务器或多个备用服务器. 默认监听端口127.0.0.1:2222 后台监控页面端口0.0.0.0:1111,后台监控页面地址192.168.1.1:1111/haproxy + +多主服务器是将所有TCP流量分流,并可以设置每个服务器的分流比例;多备用服务器是在检测到主服务器A宕机之后切换至备用服务器B,B宕机之后切换到服务器C...依次类推,可以防止因为单个服务器或者线路故障导致的断网问题。 +使用效果和更多使用方法请[点击这里][A] + + +依赖 +--- + +显式依赖 `haproxy`, 安装完毕该luci包后会stop并disable当前op的haproxy,点击“保存&应用”后会修改HAProxy默认配置文件/etc/haproxy.cfg并自动重启,支持开机自启. + + +配置 +--- + +如果有需要,可以修改/etc/haproxy_init.sh ,不要直接修改/etc/haproxy.cfg,否则会被覆盖 + +编译 +--- + +从 OpenWrt 的 [SDK][openwrt-sdk] 编译 +```bash +# 解压下载好的 SDK +tar xjf OpenWrt-SDK-ar71xx-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2.tar.bz2 +cd OpenWrt-SDK-ar71xx-* +# Clone 项目 +git clone https://github.com/AlexZhuo/luci-app-haproxy-tcp package/luci-app-haproxy-tcp +# 编译 po2lmo (如果有po2lmo可跳过) +pushd package/luci-app-haproxy-tcp/tools/po2lmo +make && sudo make install +popd +# 选择要编译的包 Utilities -> LuCI -> luci-app-haproxy-tcp +make menuconfig +# 开始编译 +make package/luci-app-haproxy-tcp/compile V=99 +``` + + +截图 +--- +![](https://github.com/AlexZhuo/BreakwallOpenWrt/raw/master/screenshots/haproxy.png) + +[A]: http://www.right.com.cn/forum/thread-198649-1-1.html +[openwrt-sdk]: http://wiki.openwrt.org/doc/howto/obtain.firmware.sdk + + diff --git a/package/lean/luci-app-haproxy-tcp/luasrc/controller/haproxy.lua b/package/lean/luci-app-haproxy-tcp/luasrc/controller/haproxy.lua new file mode 100644 index 00000000000000..5549e754b9170d --- /dev/null +++ b/package/lean/luci-app-haproxy-tcp/luasrc/controller/haproxy.lua @@ -0,0 +1,7 @@ +module("luci.controller.haproxy", package.seeall) +function index() + if not nixio.fs.access("/etc/config/haproxy") then + return + end + entry({"admin", "services", "haproxy"}, cbi("haproxy"), _("HAProxy")).dependent = true +end \ No newline at end of file diff --git a/package/lean/luci-app-haproxy-tcp/luasrc/model/cbi/haproxy.lua b/package/lean/luci-app-haproxy-tcp/luasrc/model/cbi/haproxy.lua new file mode 100644 index 00000000000000..f18122439e1367 --- /dev/null +++ b/package/lean/luci-app-haproxy-tcp/luasrc/model/cbi/haproxy.lua @@ -0,0 +1,67 @@ +--Alex<1886090@gmail.com> +local fs = require "nixio.fs" + +function sync_value_to_file(value, file) --用来写入文件的函数,目前这种方式已经弃用 + value = value:gsub("\r\n?", "\n") + local old_value = nixio.fs.readfile(file) + if value ~= old_value then + nixio.fs.writefile(file, value) + end +end +local state_msg = "" +local haproxy_on = (luci.sys.call("pidof haproxy > /dev/null") == 0) +local router_ip = luci.sys.exec("uci get network.lan.ipaddr") +if haproxy_on then + state_msg = "" .. translate("Running") .. "" +else + state_msg = "" .. translate("Not running") .. "" +end +m=Map("haproxy",translate("HAProxy"),translate("HAProxy能够检测Shadowsocks服务器的连通情况,从而实现负载均衡和高可用的功能,支持主备用服务器宕机自动切换,并且可以设置多个主服务器用于分流,规定每个分流节点的流量比例等。前提条件是你的所有Shadowsocks服务器的【加密方式】和【密码】一致。

使用方法:配置好你的Shadowsocks服务器ip地址和端口,然后开启Shadowsocks服务,将服务器地址填写为【127.0.0.1】,端口【2222】,其他参数和之前一样即可,你可以通过访问【路由器的IP:1111/haproxy】输入用户名admin,密码root来观察各节点健康状况,红色为宕机,绿色正常,使用说明请点击这里") .. "

后台监控页面:" .. router_ip .. ":1111/haproxy 用户名admin,密码root" .. "

状态 - " .. state_msg) +s=m:section(TypedSection,"arguments","") + s.addremove=false + s.anonymous=true + view_enable = s:option(Flag,"enabled",translate("Enable")) + --通过读写配置文件控制HAProxy这种方式已经弃用 + --view_cfg = s:option(TextValue, "1", nil) + --view_cfg.rmempty = false + --view_cfg.rows = 43 + + --function view_cfg.cfgvalue() + -- return nixio.fs.readfile("/etc/haproxy.cfg") or "" + --end + --function view_cfg.write(self, section, value) + -- sync_value_to_file(value, "/etc/haproxy.cfg") + --end +s=m:section(TypedSection,"main_server","" .. translate("Main Server List") .. "") + s.anonymous=true + s.addremove=true + o=s:option(Value,"server_name",translate("Display Name"),translate("Only English Characters,No spaces")) + o.rmempty = false + + o=s:option(Flag,"validate",translate("validate")) + + o=s:option(Value,"server_ip",translate("Proxy Server IP")) + + o=s:option(Value,"server_port",translate("Proxy Server Port")) + o.datatype="uinteger" + o=s:option(Value,"server_weight",translate("Weight")) + o.datatype="uinteger" + +s=m:section(TypedSection,"backup_server","" .. translate("Backup Server List") .. "") + s.anonymous=true + s.addremove=true + o=s:option(Value,"server_name",translate("Display Name"),translate("Only English Characters,No spaces")) + o.rmempty = false + + o=s:option(Flag,"validate",translate("validate")) + + o=s:option(Value,"server_ip",translate("Proxy Server IP")) + + o=s:option(Value,"server_port",translate("Proxy Server Port")) + o.datatype="uinteger" +-- --------------------------------------------------- +local apply = luci.http.formvalue("cbi.apply") +if apply then + os.execute("/etc/haproxy_init.sh restart >/dev/null 2>&1 &") +end +return m diff --git a/package/lean/luci-app-haproxy-tcp/po/zh-cn/haproxy-tcp.po b/package/lean/luci-app-haproxy-tcp/po/zh-cn/haproxy-tcp.po new file mode 100644 index 00000000000000..f0f2aa8370f264 --- /dev/null +++ b/package/lean/luci-app-haproxy-tcp/po/zh-cn/haproxy-tcp.po @@ -0,0 +1,34 @@ +msgid "Running" +msgstr "运行中" + +msgid "Not running" +msgstr "未运行" + +msgid "Main Server List" +msgstr "主服务器列表" + +msgid "Display Name" +msgstr "服务器名称" + +msgid "Only English Characters,No spaces" +msgstr "仅限英文字母,不要有空格" + +msgid "Proxy Server IP" +msgstr "代理服务器IP或域名" + +msgid "Proxy Server Port" +msgstr "代理服务器端口" + +msgid "Weight" +msgstr "分流权重" + +msgid "Backup Server List" +msgstr "备用服务器列表" + +msgid "validate" +msgstr "生效" + + + + + diff --git a/package/lean/luci-app-haproxy-tcp/root/etc/config/haproxy b/package/lean/luci-app-haproxy-tcp/root/etc/config/haproxy new file mode 100644 index 00000000000000..5d324ca3fda1e1 --- /dev/null +++ b/package/lean/luci-app-haproxy-tcp/root/etc/config/haproxy @@ -0,0 +1,29 @@ + +config arguments + option enabled '0' + +config main_server + option server_weight '10' + option server_ip '1.2.3.4' + option server_port '443' + option server_name 'JP1' + option validate '1' + +config backup_server + option server_name 'JP2' + option server_ip '2.2.2.2' + option server_port '8038' + option validate '1' + +config backup_server + option server_name 'JP3' + option server_ip '3.3.3.3' + option server_port '443' + option validate '1' + +config backup_server + option server_name 'JP4' + option server_ip '4.4.4.4' + option server_port '443' + option validate '1' + diff --git a/package/lean/luci-app-haproxy-tcp/root/etc/haproxy_init.sh b/package/lean/luci-app-haproxy-tcp/root/etc/haproxy_init.sh new file mode 100644 index 00000000000000..c3a01dc2d8ca46 --- /dev/null +++ b/package/lean/luci-app-haproxy-tcp/root/etc/haproxy_init.sh @@ -0,0 +1,133 @@ +#!/bin/sh /etc/rc.common + +CFG_FILE=/etc/haproxy.cfg +stop(){ + logger -t alex stopping haproxy + echo "stopping haproxy" + /etc/init.d/haproxy disable + /etc/init.d/haproxy stop + [ -f /etc/haproxy_backup ] && { + cp /etc/haproxy_backup /etc/init.d/haproxy + } + iptables -t nat -D OUTPUT -j HAPROXY &> /dev/null + iptables -t nat -F HAPROXY &> /dev/null + sleep 1 + iptables -t nat -X HAPROXY &> /dev/null +} +start(){ + echo "starting haproxy" + logger -t restarting haproxy + echo global > $CFG_FILE + cat >> $CFG_FILE </dev/null` + local server_name=`uci get haproxy.@main_server[$COUNTER].server_name 2>/dev/null` + local server_port=`uci get haproxy.@main_server[$COUNTER].server_port 2>/dev/null` + local server_weight=`uci get haproxy.@main_server[$COUNTER].server_weight 2>/dev/null` + local validate=`uci get haproxy.@main_server[$COUNTER].validate 2>/dev/null` + if [ -z "$server_ip" ] || [ -z "$server_name" ] || [ -z "$server_port" ] || [ -z "$server_weight" ]; then + echo break + break + fi + echo the main server $COUNTER $server_ip $server_name $server_port $server_weight + [ "$validate" = 1 ] && { + echo server $server_name $server_ip:$server_port weight $server_weight maxconn 1024 check resolvers mydns inter 1500 rise 3 fall 3 >> $CFG_FILE + } + iptables -t nat -A HAPROXY -p tcp -d $server_ip -j ACCEPT + COUNTER=$(($COUNTER+1)) + done + COUNTER=0 + #添加备用服务器 + while true + do + local server_ip=`uci get haproxy.@backup_server[$COUNTER].server_ip 2>/dev/null` + local server_name=`uci get haproxy.@backup_server[$COUNTER].server_name 2>/dev/null` + local server_port=`uci get haproxy.@backup_server[$COUNTER].server_port 2>/dev/null` + local validate=`uci get haproxy.@backup_server[$COUNTER].validate 2>/dev/null` + if [ -z "$server_ip" ] || [ -z "$server_name" ] || [ -z "$server_port" ]; then + echo break + break + fi + echo the backup server $COUNTER $server_ip $server_name $server_port + [ "$validate" = 1 ] && { + echo server $server_name $server_ip:$server_port weight 10 check resolvers mydns backup inter 1500 rise 3 fall 3 >> $CFG_FILE + } + iptables -t nat -A HAPROXY -p tcp -d $server_ip -j ACCEPT + COUNTER=$(($COUNTER+1)) + done + iptables -t nat -I OUTPUT -j HAPROXY + /etc/init.d/haproxy enable + /etc/init.d/haproxy restart + cp /etc/init.d/haproxy /etc/haproxy_backup + cp /etc/haproxy_start /etc/init.d/haproxy +} + +restart(){ + echo luci for haproxy + sleep 1s + local vt_enabled=`uci get haproxy.@arguments[0].enabled 2>/dev/null` + logger -t haproxy is initializing enabled is $vt_enabled + echo $vt_enabled + if [ "$vt_enabled" = 1 ]; then + [ -f /etc/haproxy_backup ] && { + cp /etc/haproxy_backup /etc/init.d/haproxy + } + iptables -t nat -D OUTPUT -j HAPROXY &> /dev/null + iptables -t nat -F HAPROXY &> /dev/null + sleep 1 + iptables -t nat -X HAPROXY &> /dev/null + start; + else + stop; + fi +} \ No newline at end of file diff --git a/package/lean/luci-app-haproxy-tcp/root/etc/haproxy_start b/package/lean/luci-app-haproxy-tcp/root/etc/haproxy_start new file mode 100644 index 00000000000000..f0c9e52b13c2a7 --- /dev/null +++ b/package/lean/luci-app-haproxy-tcp/root/etc/haproxy_start @@ -0,0 +1,73 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2009-2010 OpenWrt.org + +START=99 +STOP=80 + +SERVICE_USE_PID=1 + +HAPROXY_BIN="/usr/sbin/haproxy" +HAPROXY_CONFIG="/etc/haproxy.cfg" +HAPROXY_PID="/var/run/haproxy.pid" + +start() { + service_start $HAPROXY_BIN -q -D -f "$HAPROXY_CONFIG" -p "$HAPROXY_PID" + local COUNTER=0 + #添加主服务器 + iptables -t nat -D OUTPUT -j HAPROXY &> /dev/null + iptables -t nat -X HAPROXY + iptables -t nat -N HAPROXY + iptables -t nat -F HAPROXY + + while true + do + local server_ip=`uci get haproxy.@main_server[$COUNTER].server_ip 2>/dev/null` + local server_name=`uci get haproxy.@main_server[$COUNTER].server_name 2>/dev/null` + local server_port=`uci get haproxy.@main_server[$COUNTER].server_port 2>/dev/null` + local server_weight=`uci get haproxy.@main_server[$COUNTER].server_weight 2>/dev/null` + local validate=`uci get haproxy.@main_server[$COUNTER].validate 2>/dev/null` + if [ -z "$server_ip" ] || [ -z "$server_name" ] || [ -z "$server_port" ] || [ -z "$server_weight" ]; then + echo break + break + fi + echo the main2 server $COUNTER $server_ip $server_name $server_port $server_weight + [ "$validate" = 1 ] && { + iptables -t nat -A HAPROXY -p tcp -d $server_ip -j ACCEPT + } + COUNTER=$(($COUNTER+1)) + done + COUNTER=0 + #添加备用服务器 + while true + do + local server_ip=`uci get haproxy.@backup_server[$COUNTER].server_ip 2>/dev/null` + local server_name=`uci get haproxy.@backup_server[$COUNTER].server_name 2>/dev/null` + local server_port=`uci get haproxy.@backup_server[$COUNTER].server_port 2>/dev/null` + local validate=`uci get haproxy.@backup_server[$COUNTER].validate 2>/dev/null` + if [ -z "$server_ip" ] || [ -z "$server_name" ] || [ -z "$server_port" ]; then + echo break + break + fi + echo the backup2 server $COUNTER $server_ip $server_name $server_port + [ "$validate" = 1 ] && { + iptables -t nat -A HAPROXY -p tcp -d $server_ip -j ACCEPT + } + COUNTER=$(($COUNTER+1)) + done + + iptables -t nat -I OUTPUT -j HAPROXY +} + +stop() { + kill -9 $(cat $HAPROXY_PID | tr "\n" " ") + service_stop $HAPROXY_BIN + iptables -t nat -D OUTPUT -j HAPROXY &> /dev/null + iptables -t nat -F HAPROXY &> /dev/null + sleep 1 + iptables -t nat -X HAPROXY &> /dev/null +} + +reload() { + $HAPROXY_BIN -D -q -f $HAPROXY_CONFIG -p $HAPROXY_PID -sf $(cat $HAPROXY_PID | tr "\n" " ") + #$HAPROXY_BIN -D -q -f $HAPROXY_CONFIG -p $HAPROXY_PID -sf $(cat $HAPROXY_PID) +} diff --git a/package/lean/luci-app-haproxy-tcp/root/etc/uci-defaults/z99-haproxy b/package/lean/luci-app-haproxy-tcp/root/etc/uci-defaults/z99-haproxy new file mode 100644 index 00000000000000..72913f935bc4d5 --- /dev/null +++ b/package/lean/luci-app-haproxy-tcp/root/etc/uci-defaults/z99-haproxy @@ -0,0 +1,7 @@ +#!/bin/sh + +/etc/init.d/haproxy disable +/etc/init.d/haproxy stop + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/package/lean/luci-app-ipsec-vpnd/Makefile b/package/lean/luci-app-ipsec-vpnd/Makefile new file mode 100644 index 00000000000000..b7a83920f5a232 --- /dev/null +++ b/package/lean/luci-app-ipsec-vpnd/Makefile @@ -0,0 +1,18 @@ +# Copyright (C) 2016 Openwrt.org +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI support for IPSec VPN Server (IKEv1 with PSK and Xauth) +LUCI_DEPENDS:=+strongswan-minimal +strongswan-mod-xauth-generic +LUCI_PKGARCH:=all +PKG_VERSION:=1.0 +PKG_RELEASE:=7 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + + diff --git a/package/lean/luci-app-ipsec-vpnd/luasrc/controller/ipsec-server.lua b/package/lean/luci-app-ipsec-vpnd/luasrc/controller/ipsec-server.lua new file mode 100644 index 00000000000000..2925194c626bef --- /dev/null +++ b/package/lean/luci-app-ipsec-vpnd/luasrc/controller/ipsec-server.lua @@ -0,0 +1,19 @@ + +module("luci.controller.ipsec-server", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/ipsec") then + return + end + + entry({"admin", "vpn"}, firstchild(), "VPN", 45).dependent = false + entry({"admin", "vpn", "ipsec-server"}, cbi("ipsec-server/ipsec-server"), _("IPSec VPN Server"), 80).dependent=false + entry({"admin", "vpn", "ipsec-server","status"},call("act_status")).leaf=true +end + +function act_status() + local e={} + e.running=luci.sys.call("pgrep ipsec >/dev/null")==0 + luci.http.prepare_content("application/json") + luci.http.write_json(e) +end diff --git a/package/lean/luci-app-ipsec-vpnd/luasrc/model/cbi/ipsec-server/ipsec-server.lua b/package/lean/luci-app-ipsec-vpnd/luasrc/model/cbi/ipsec-server/ipsec-server.lua new file mode 100644 index 00000000000000..79a47b8bfb9b9b --- /dev/null +++ b/package/lean/luci-app-ipsec-vpnd/luasrc/model/cbi/ipsec-server/ipsec-server.lua @@ -0,0 +1,35 @@ + +mp = Map("ipsec", translate("IPSec VPN Server")) +mp.description = translate("IPSec VPN connectivity using the native built-in VPN Client on iOS or Andriod (IKEv1 with PSK and Xauth)") + +mp:section(SimpleSection).template = "ipsec/ipsec_status" + +s = mp:section(NamedSection, "ipsec", "service") +s.anonymouse = true + +enabled = s:option(Flag, "enabled", translate("Enable")) +enabled.default = 0 +enabled.rmempty = false + +clientip = s:option(Value, "clientip", translate("VPN Client IP")) +clientip.datatype = "ip4addr" +clientip.description = translate("LAN DHCP reserved started IP addresses with the same subnet mask") +clientip.optional = false +clientip.rmempty = false + +clientdns = s:option(Value, "clientdns", translate("VPN Client DNS")) +clientdns.datatype = "ip4addr" +clientdns.description = translate("DNS using in VPN tunnel.Set to the router's LAN IP is recommended") +clientdns.optional = false +clientdns.rmempty = false + +account = s:option(Value, "account", translate("Account")) +account.datatype = "string" + +password = s:option(Value, "password", translate("Password")) +password.password = true + +secret = s:option(Value, "secret", translate("Secret Pre-Shared Key")) +secret.password = true + +return mp diff --git a/package/lean/luci-app-ipsec-vpnd/luasrc/view/ipsec/ipsec_status.htm b/package/lean/luci-app-ipsec-vpnd/luasrc/view/ipsec/ipsec_status.htm new file mode 100644 index 00000000000000..60225b4902a249 --- /dev/null +++ b/package/lean/luci-app-ipsec-vpnd/luasrc/view/ipsec/ipsec_status.htm @@ -0,0 +1,22 @@ + + +
+

+ <%:Collecting data...%> +

+
\ No newline at end of file diff --git a/package/lean/luci-app-ipsec-vpnd/po/zh-cn/ipsec.po b/package/lean/luci-app-ipsec-vpnd/po/zh-cn/ipsec.po new file mode 100644 index 00000000000000..0bf6b62aaab9b3 --- /dev/null +++ b/package/lean/luci-app-ipsec-vpnd/po/zh-cn/ipsec.po @@ -0,0 +1,34 @@ +msgid "IPSec VPN Server" +msgstr "IPSec VPN 服务器" + +msgid "IPSec VPN connectivity using the native built-in VPN Client on iOS or Andriod (IKEv1 with PSK and Xauth)" +msgstr "使用iOS 或者 Andriod (IKEv1 with PSK and Xauth) 原生内置 IPSec VPN 客户端进行连接" + +msgid "VPN Client IP" +msgstr "VPN客户端地址段" + +msgid "LAN DHCP reserved started IP addresses with the same subnet mask" +msgstr "VPN客户端使用DHCP保留空余IP的起始地址,必须和路由器LAN同一个子网掩码,例如 192.168.0.10/24" + +msgid "VPN Client DNS" +msgstr "VPN客户端DNS服务器" + +msgid "DNS using in VPN tunnel.Set to the router's LAN IP is recommended" +msgstr "指定VPN客户端的DNS地址。推荐设置为路由器的LAN IP,例如 192.168.0.1" + +msgid "Account" +msgstr "账户" + +msgid "Secret Pre-Shared Key" +msgstr "PSK密钥" + +msgid "IPSec VPN Server status" +msgstr "IPSec VPN 服务器运行状态" + +msgid "Disable from startup" +msgstr "禁止开机启动" + +msgid "Enable on startup" +msgstr "允许开机启动" + + diff --git a/package/lean/luci-app-ipsec-vpnd/root/etc/config/ipsec b/package/lean/luci-app-ipsec-vpnd/root/etc/config/ipsec new file mode 100644 index 00000000000000..93c21f278502b0 --- /dev/null +++ b/package/lean/luci-app-ipsec-vpnd/root/etc/config/ipsec @@ -0,0 +1,9 @@ + +config service 'ipsec' + option clientdns '192.168.0.1' + option account 'lean' + option secret 'myopenwrt' + option enabled '0' + option password '12345678' + option clientip '192.168.0.10/24' + diff --git a/package/lean/luci-app-ipsec-vpnd/root/etc/init.d/ipsec b/package/lean/luci-app-ipsec-vpnd/root/etc/init.d/ipsec new file mode 100644 index 00000000000000..5a4c6a21709e30 --- /dev/null +++ b/package/lean/luci-app-ipsec-vpnd/root/etc/init.d/ipsec @@ -0,0 +1,427 @@ +#!/bin/sh /etc/rc.common + +START=90 +STOP=10 + +USE_PROCD=1 +PROG=/usr/lib/ipsec/starter + +. $IPKG_INSTROOT/lib/functions.sh +. $IPKG_INSTROOT/lib/functions/network.sh + +IPSEC_SECRETS_FILE=/etc/ipsec.secrets +IPSEC_CONN_FILE=/etc/ipsec.conf +STRONGSWAN_CONF_FILE=/etc/strongswan.conf + +IPSEC_VAR_SECRETS_FILE=/var/ipsec/ipsec.secrets +IPSEC_VAR_CONN_FILE=/var/ipsec/ipsec.conf +STRONGSWAN_VAR_CONF_FILE=/var/ipsec/strongswan.conf + +WAIT_FOR_INTF=0 + +file_reset() { + : > "$1" +} + +xappend() { + local file="$1" + shift + + echo "${@}" >> "${file}" +} + +remove_include() { + local file="$1" + local include="$2" + + sed -i "\_${include}_d" "${file}" +} + +remove_includes() { + remove_include "${IPSEC_CONN_FILE}" "${IPSEC_VAR_CONN_FILE}" + remove_include "${IPSEC_SECRETS_FILE}" "${IPSEC_VAR_SECRETS_FILE}" + remove_include "${STRONGSWAN_CONF_FILE}" "${STRONGSWAN_VAR_CONF_FILE}" +} + +do_include() { + local conf="$1" + local uciconf="$2" + local backup=`mktemp -t -p /tmp/ ipsec-init-XXXXXX` + + [ ! -f "${conf}" ] && rm -rf "${conf}" + touch "${conf}" + + cat "${conf}" | grep -v "${uciconf}" > "${backup}" + mv "${backup}" "${conf}" + xappend "${conf}" "include ${uciconf}" + file_reset "${uciconf}" +} + +ipsec_reset() { + do_include "${IPSEC_CONN_FILE}" "${IPSEC_VAR_CONN_FILE}" +} + +ipsec_xappend() { + xappend "${IPSEC_VAR_CONN_FILE}" "$@" +} + +swan_reset() { + do_include "${STRONGSWAN_CONF_FILE}" "${STRONGSWAN_VAR_CONF_FILE}" +} + +swan_xappend() { + xappend "${STRONGSWAN_VAR_CONF_FILE}" "$@" +} + +secret_reset() { + do_include "${IPSEC_SECRETS_FILE}" "${IPSEC_VAR_SECRETS_FILE}" +} + +secret_xappend() { + xappend "${IPSEC_VAR_SECRETS_FILE}" "$@" +} + +warning() { + echo "WARNING: $@" >&2 +} + +add_crypto_proposal() { + local encryption_algorithm + local hash_algorithm + local dh_group + + config_get encryption_algorithm "$1" encryption_algorithm + config_get hash_algorithm "$1" hash_algorithm + config_get dh_group "$1" dh_group + + [ -n "${encryption_algorithm}" ] && \ + crypto="${crypto:+${crypto},}${encryption_algorithm}${hash_algorithm:+-${hash_algorithm}}${dh_group:+-${dh_group}}" +} + +set_crypto_proposal() { + local conf="$1" + local proposal + + crypto="" + + config_get crypto_proposal "$conf" crypto_proposal "" + for proposal in $crypto_proposal; do + add_crypto_proposal "$proposal" + done + + [ -n "${crypto}" ] && { + local force_crypto_proposal + + config_get_bool force_crypto_proposal "$conf" force_crypto_proposal + + [ "${force_crypto_proposal}" = "1" ] && crypto="${crypto}!" + } + + crypto_proposal="${crypto}" +} + +config_conn() { + # Generic ipsec conn section shared by tunnel and transport + local mode + local local_subnet + local local_nat + local local_sourceip + local local_updown + local local_firewall + local remote_subnet + local remote_sourceip + local remote_updown + local remote_firewall + local ikelifetime + local lifetime + local margintime + local keyingtries + local dpdaction + local dpddelay + local inactivity + local keyexchange + + config_get mode "$1" mode "route" + config_get local_subnet "$1" local_subnet "" + config_get local_nat "$1" local_nat "" + config_get local_sourceip "$1" local_sourceip "" + config_get local_updown "$1" local_updown "" + config_get local_firewall "$1" local_firewall "" + config_get remote_subnet "$1" remote_subnet "" + config_get remote_sourceip "$1" remote_sourceip "" + config_get remote_updown "$1" remote_updown "" + config_get remote_firewall "$1" remote_firewall "" + config_get ikelifetime "$1" ikelifetime "3h" + config_get lifetime "$1" lifetime "1h" + config_get margintime "$1" margintime "9m" + config_get keyingtries "$1" keyingtries "3" + config_get dpdaction "$1" dpdaction "none" + config_get dpddelay "$1" dpddelay "30s" + config_get inactivity "$1" inactivity + config_get keyexchange "$1" keyexchange "ikev2" + + [ -n "$local_nat" ] && local_subnet=$local_nat + + ipsec_xappend "conn $config_name-$1" + ipsec_xappend " left=%any" + ipsec_xappend " right=$remote_gateway" + + [ -n "$local_sourceip" ] && ipsec_xappend " leftsourceip=$local_sourceip" + [ -n "$local_subnet" ] && ipsec_xappend " leftsubnet=$local_subnet" + + [ -n "$local_firewall" ] && ipsec_xappend " leftfirewall=$local_firewall" + [ -n "$remote_firewall" ] && ipsec_xappend " rightfirewall=$remote_firewall" + + ipsec_xappend " ikelifetime=$ikelifetime" + ipsec_xappend " lifetime=$lifetime" + ipsec_xappend " margintime=$margintime" + ipsec_xappend " keyingtries=$keyingtries" + ipsec_xappend " dpdaction=$dpdaction" + ipsec_xappend " dpddelay=$dpddelay" + + [ -n "$inactivity" ] && ipsec_xappend " inactivity=$inactivity" + + if [ "$auth_method" = "psk" ]; then + ipsec_xappend " leftauth=psk" + ipsec_xappend " rightauth=psk" + + [ "$remote_sourceip" != "" ] && ipsec_xappend " rightsourceip=$remote_sourceip" + [ "$remote_subnet" != "" ] && ipsec_xappend " rightsubnet=$remote_subnet" + + ipsec_xappend " auto=$mode" + else + warning "AuthenticationMethod $auth_method not supported" + fi + + [ -n "$local_identifier" ] && ipsec_xappend " leftid=$local_identifier" + [ -n "$remote_identifier" ] && ipsec_xappend " rightid=$remote_identifier" + [ -n "$local_updown" ] && ipsec_xappend " leftupdown=$local_updown" + [ -n "$remote_updown" ] && ipsec_xappend " rightupdown=$remote_updown" + ipsec_xappend " keyexchange=$keyexchange" + + set_crypto_proposal "$1" + [ -n "${crypto_proposal}" ] && ipsec_xappend " esp=$crypto_proposal" + [ -n "${ike_proposal}" ] && ipsec_xappend " ike=$ike_proposal" +} + +config_tunnel() { + config_conn "$1" + + # Specific for the tunnel part + ipsec_xappend " type=tunnel" +} + +config_transport() { + config_conn "$1" + + # Specific for the transport part + ipsec_xappend " type=transport" +} + +config_remote() { + local enabled + local gateway + local pre_shared_key + local auth_method + + config_name=$1 + + config_get_bool enabled "$1" enabled 0 + [ $enabled -eq 0 ] && return + + config_get gateway "$1" gateway + config_get pre_shared_key "$1" pre_shared_key + config_get auth_method "$1" authentication_method + config_get local_identifier "$1" local_identifier "" + config_get remote_identifier "$1" remote_identifier "" + + [ "$gateway" = "any" ] && remote_gateway="%any" || remote_gateway="$gateway" + + [ -z "$local_identifier" ] && { + local ipdest + + [ "$remote_gateway" = "%any" ] && ipdest="1.1.1.1" || ipdest="$remote_gateway" + local_gateway=`ip route get $ipdest | awk -F"src" '/src/{gsub(/ /,"");print $2}'` + } + + [ -n "$local_identifier" ] && secret_xappend -n "$local_identifier " || secret_xappend -n "$local_gateway " + [ -n "$remote_identifier" ] && secret_xappend -n "$remote_identifier " || secret_xappend -n "$remote_gateway " + + secret_xappend ": PSK \"$pre_shared_key\"" + + set_crypto_proposal "$1" + ike_proposal="$crypto_proposal" + + config_list_foreach "$1" tunnel config_tunnel + + config_list_foreach "$1" transport config_transport + + ipsec_xappend "" +} + +config_ipsec() { + local debug + local rtinstall_enabled + local routing_tables_ignored + local routing_table + local routing_table_id + local interface + local device_list + + ipsec_reset + secret_reset + swan_reset + + ipsec_xappend "# generated by /etc/init.d/ipsec" + ipsec_xappend "version 2" + ipsec_xappend "" + + secret_xappend "# generated by /etc/init.d/ipsec" + + config_get debug "$1" debug 0 + config_get_bool rtinstall_enabled "$1" rtinstall_enabled 1 + [ $rtinstall_enabled -eq 1 ] && install_routes=yes || install_routes=no + + # prepare extra charon config option ignore_routing_tables + for routing_table in $(config_get "$1" "ignore_routing_tables"); do + if [ "$routing_table" -ge 0 ] 2>/dev/null; then + routing_table_id=$routing_table + else + routing_table_id=$(sed -n '/[ \t]*[0-9]\+[ \t]\+'$routing_table'[ \t]*$/s/[ \t]*\([0-9]\+\).*/\1/p' /etc/iproute2/rt_tables) + fi + + [ -n "$routing_table_id" ] && append routing_tables_ignored "$routing_table_id" + done + + local interface_list=$(config_get "$1" "interface") + if [ -z "$interface_list" ]; then + WAIT_FOR_INTF=0 + else + for interface in $interface_list; do + network_get_device device $interface + [ -n "$device" ] && append device_list "$device" "," + done + [ -n "$device_list" ] && WAIT_FOR_INTF=0 || WAIT_FOR_INTF=1 + fi + + swan_xappend "# generated by /etc/init.d/ipsec" + swan_xappend "charon {" + swan_xappend " load_modular = yes" + swan_xappend " install_routes = $install_routes" + [ -n "$routing_tables_ignored" ] && swan_xappend " ignore_routing_tables = $routing_tables_ignored" + [ -n "$device_list" ] && swan_xappend " interfaces_use = $device_list" + swan_xappend " plugins {" + swan_xappend " include /etc/strongswan.d/charon/*.conf" + swan_xappend " }" + swan_xappend " syslog {" + swan_xappend " identifier = ipsec" + swan_xappend " daemon {" + swan_xappend " default = $debug" + swan_xappend " }" + swan_xappend " auth {" + swan_xappend " default = $debug" + swan_xappend " }" + swan_xappend " }" + swan_xappend "}" +} + +prepare_env() { + mkdir -p /var/ipsec + remove_includes + config_load ipsec + config_foreach config_ipsec ipsec + config_foreach config_remote remote +} + +service_running() { + ipsec status > /dev/null 2>&1 +} + +reload_service() { + local bool vt_enabled=`uci get ipsec.@service[0].enabled 2>/dev/null` + [ "$vt_enabled" = 0 ] && /etc/init.d/ipsec stop && return + running && { + prepare_env + [ $WAIT_FOR_INTF -eq 0 ] && { + ipsec rereadall + ipsec reload + return + } + } + [ "$vt_enabled" = 1 ] && start +} + +check_ipsec_interface() { + local intf + + for intf in $(config_get "$1" interface); do + procd_add_interface_trigger "interface.*" "$intf" /etc/init.d/ipsec reload + done +} + +service_triggers() { + procd_add_reload_trigger "ipsec" + config load "ipsec" + config_foreach check_ipsec_interface ipsec +} + +start_service() { + local vt_enabled=`uci get ipsec.@service[0].enabled 2>/dev/null` + local vt_clientip=`uci get ipsec.@service[0].clientip` + local vt_clientdns=`uci get ipsec.@service[0].clientdns` + local vt_account=`uci get ipsec.@service[0].account` + local vt_password=`uci get ipsec.@service[0].password 2>/dev/null` + local vt_secret=`uci get ipsec.@service[0].secret 2>/dev/null` + + [ "$vt_enabled" = 0 ] && /etc/init.d/ipsec stop && return + + cat > /etc/ipsec.conf < /etc/ipsec.secrets </dev/null +iptables -D FORWARD -m policy --dir out --pol ipsec --proto esp -j ACCEPT 2>/dev/null +iptables -D INPUT -m policy --dir in --pol ipsec --proto esp -j ACCEPT 2>/dev/null +iptables -D OUTPUT -m policy --dir out --pol ipsec --proto esp -j ACCEPT 2>/dev/null + +iptables -I FORWARD -m policy --dir in --pol ipsec --proto esp -j ACCEPT +iptables -I FORWARD -m policy --dir out --pol ipsec --proto esp -j ACCEPT +iptables -I INPUT -m policy --dir in --pol ipsec --proto esp -j ACCEPT +iptables -I OUTPUT -m policy --dir out --pol ipsec --proto esp -j ACCEPT + +echo 1 > /proc/sys/net/ipv4/conf/br-lan/proxy_arp diff --git a/package/lean/luci-app-ipsec-vpnd/root/etc/uci-defaults/ipsec b/package/lean/luci-app-ipsec-vpnd/root/etc/uci-defaults/ipsec new file mode 100644 index 00000000000000..b9eb66fb81848d --- /dev/null +++ b/package/lean/luci-app-ipsec-vpnd/root/etc/uci-defaults/ipsec @@ -0,0 +1,54 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete firewall.ipsecd + set firewall.ipsecd=include + set firewall.ipsecd.type=script + set firewall.ipsecd.path=/etc/ipsec.include + set firewall.ipsecd.reload=1 + commit firewall +EOF + +uci -q batch <<-EOF >/dev/null + delete firewall.ike + add firewall rule + rename firewall.@rule[-1]="ike" + set firewall.@rule[-1].name="ike" + set firewall.@rule[-1].target="ACCEPT" + set firewall.@rule[-1].src="wan" + set firewall.@rule[-1].proto="udp" + set firewall.@rule[-1].dest_port="500" + delete firewall.ipsec + add firewall rule + rename firewall.@rule[-1]="ipsec" + set firewall.@rule[-1].name="ipsec" + set firewall.@rule[-1].target="ACCEPT" + set firewall.@rule[-1].src="wan" + set firewall.@rule[-1].proto="udp" + set firewall.@rule[-1].dest_port="4500" + delete firewall.ah + add firewall rule + rename firewall.@rule[-1]="ah" + set firewall.@rule[-1].name="ah" + set firewall.@rule[-1].target="ACCEPT" + set firewall.@rule[-1].src="wan" + set firewall.@rule[-1].proto="ah" + delete firewall.esp + add firewall rule + rename firewall.@rule[-1]="esp" + set firewall.@rule[-1].name="esp" + set firewall.@rule[-1].target="ACCEPT" + set firewall.@rule[-1].src="wan" + set firewall.@rule[-1].proto="esp" + commit firewall +EOF + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@ipsec[-1] + add ucitrack ipsec + set ucitrack.@ipsec[-1].init=ipsec + commit ucitrack +EOF + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/package/lean/luci-app-kodexplorer/LICENSE b/package/lean/luci-app-kodexplorer/LICENSE new file mode 100644 index 00000000000000..e72bfddabc15be --- /dev/null +++ b/package/lean/luci-app-kodexplorer/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + 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. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. \ No newline at end of file diff --git a/package/lean/luci-app-kodexplorer/Makefile b/package/lean/luci-app-kodexplorer/Makefile new file mode 100644 index 00000000000000..53271928577ad2 --- /dev/null +++ b/package/lean/luci-app-kodexplorer/Makefile @@ -0,0 +1,16 @@ +# Copyright (C) 2018-2020 Lienol +# +# This is free software, licensed under the GNU General Public License v3. +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI support for KodExplorer +LUCI_DEPENDS:=+nginx +zoneinfo-asia +php7 +php7-fpm +php7-mod-curl +php7-mod-gd +php7-mod-iconv +php7-mod-json +php7-mod-mbstring +php7-mod-opcache +php7-mod-session +php7-mod-zip +LUCI_PKGARCH:=all +PKG_VERSION:=1.1 +PKG_RELEASE:=20200210 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature \ No newline at end of file diff --git a/package/lean/luci-app-kodexplorer/luasrc/controller/kodexplorer.lua b/package/lean/luci-app-kodexplorer/luasrc/controller/kodexplorer.lua new file mode 100644 index 00000000000000..08ec22fba65a1e --- /dev/null +++ b/package/lean/luci-app-kodexplorer/luasrc/controller/kodexplorer.lua @@ -0,0 +1,54 @@ +-- Copyright 2018-2020 Lienol +module("luci.controller.kodexplorer", package.seeall) + +local http = require "luci.http" +local api = require "luci.model.cbi.kodexplorer.api" + +function index() + if not nixio.fs.access("/etc/config/kodexplorer") then return end + + entry({"admin", "nas"}, firstchild(), "NAS", 44).dependent = false + entry({"admin", "nas", "kodexplorer"}, cbi("kodexplorer/settings"), + _("KodExplorer"), 3).dependent = true + + entry({"admin", "nas", "kodexplorer", "check"}, call("action_check")).leaf = + true + entry({"admin", "nas", "kodexplorer", "download"}, call("action_download")).leaf = + true + entry({"admin", "nas", "kodexplorer", "status"}, call("act_status")).leaf = + true +end + +local function http_write_json(content) + http.prepare_content("application/json") + http.write_json(content or {code = 1}) +end + +function act_status() + local e = {} + e.nginx_status = luci.sys.call( + "ps -w | grep nginx | grep kodexplorer | grep -v grep > /dev/null") == + 0 + e.php_status = luci.sys.call( + "ps -w | grep php | grep kodexplorer | grep -v grep > /dev/null") == + 0 + http_write_json(e) +end + +function action_check() + local json = api.to_check() + http_write_json(json) +end + +function action_download() + local json = nil + local task = http.formvalue("task") + if task == "extract" then + json = api.to_extract(http.formvalue("file")) + elseif task == "move" then + json = api.to_move(http.formvalue("file")) + else + json = api.to_download(http.formvalue("url")) + end + http_write_json(json) +end diff --git a/package/lean/luci-app-kodexplorer/luasrc/model/cbi/kodexplorer/api.lua b/package/lean/luci-app-kodexplorer/luasrc/model/cbi/kodexplorer/api.lua new file mode 100644 index 00000000000000..ac00a4cc61d4ae --- /dev/null +++ b/package/lean/luci-app-kodexplorer/luasrc/model/cbi/kodexplorer/api.lua @@ -0,0 +1,205 @@ +local fs = require "nixio.fs" +local sys = require "luci.sys" +local uci = require"luci.model.uci".cursor() +local util = require "luci.util" +local i18n = require "luci.i18n" + +module("luci.model.cbi.kodexplorer.api", package.seeall) + +local appname = "kodexplorer" +local api_url = + "https://api.github.com/repos/kalcaddle/KodExplorer/releases/latest" +local download_url = "https://github.com/kalcaddle/KodExplorer/archive/" + +local wget = "/usr/bin/wget" +local wget_args = { + "--no-check-certificate", "--quiet", "--timeout=10", "--tries=2" +} +local command_timeout = 300 + +function uci_get_type(type, config, default) + value = uci:get(appname, "@" .. type .. "[0]", config) or sys.exec( + "echo -n `uci -q get " .. appname .. ".@" .. type .. "[0]." .. + config .. "`") + if (value == nil or value == "") and (default and default ~= "") then + value = default + end + return value +end + +local function _unpack(t, i) + i = i or 1 + if t[i] ~= nil then return t[i], _unpack(t, i + 1) end +end + +local function exec(cmd, args, writer, timeout) + local os = require "os" + local nixio = require "nixio" + + local fdi, fdo = nixio.pipe() + local pid = nixio.fork() + + if pid > 0 then + fdo:close() + + if writer or timeout then + local starttime = os.time() + while true do + if timeout and os.difftime(os.time(), starttime) >= timeout then + nixio.kill(pid, nixio.const.SIGTERM) + return 1 + end + + if writer then + local buffer = fdi:read(2048) + if buffer and #buffer > 0 then + writer(buffer) + end + end + + local wpid, stat, code = nixio.waitpid(pid, "nohang") + + if wpid and stat == "exited" then return code end + + if not writer and timeout then nixio.nanosleep(1) end + end + else + local wpid, stat, code = nixio.waitpid(pid) + return wpid and stat == "exited" and code + end + elseif pid == 0 then + nixio.dup(fdo, nixio.stdout) + fdi:close() + fdo:close() + nixio.exece(cmd, args, nil) + nixio.stdout:close() + os.exit(1) + end +end + +local function compare_versions(ver1, comp, ver2) + local table = table + + local av1 = util.split(ver1, "[%.%-]", nil, true) + local av2 = util.split(ver2, "[%.%-]", nil, true) + + local max = table.getn(av1) + local n2 = table.getn(av2) + if (max < n2) then max = n2 end + + for i = 1, max, 1 do + local s1 = av1[i] or "" + local s2 = av2[i] or "" + + if comp == "~=" and (s1 ~= s2) then return true end + if (comp == "<" or comp == "<=") and (s1 < s2) then return true end + if (comp == ">" or comp == ">=") and (s1 > s2) then return true end + if (s1 ~= s2) then return false end + end + + return not (comp == "<" or comp == ">") +end + +local function get_api_json(url) + local jsonc = require "luci.jsonc" + + local output = {} + -- exec(wget, { "-O-", url, _unpack(wget_args) }, + -- function(chunk) output[#output + 1] = chunk end) + -- local json_content = util.trim(table.concat(output)) + + local json_content = luci.sys.exec("wget-ssl -q --no-check-certificate -O- " .. url) + + if json_content == "" then return {} end + + return jsonc.parse(json_content) or {} +end + +function get_project_directory() + return uci_get_type("global", "project_directory", "/tmp/kodexplorer") +end + +function to_check() + local json = get_api_json(api_url) + if json.tag_name == nil then + return { + code = 1, + error = i18n.translate("Get remote version info failed.") + } + end + local remote_version = json.tag_name + local html_url = json.html_url + download_url = download_url .. json.tag_name .. ".tar.gz" + if not download_url then + return { + code = 1, + version = remote_version, + html_url = html_url, + error = i18n.translate( + "New version found, but failed to get new version download url.") + } + end + return { + code = 0, + version = remote_version, + url = {html = html_url, download = download_url} + } +end + +function to_download(url) + if not url or url == "" then + return {code = 1, error = i18n.translate("Download url is required.")} + end + + sys.call("/bin/rm -f /tmp/kodexplorer_download.*") + + local tmp_file = util.trim(util.exec( + "mktemp -u -t kodexplorer_download.XXXXXX")) + + local result = exec(wget, {"-O", tmp_file, url, _unpack(wget_args)}, nil, + command_timeout) == 0 + + if not result then + exec("/bin/rm", {"-f", tmp_file}) + return { + code = 1, + error = i18n.translatef("File download failed or timed out: %s", url) + } + end + + return {code = 0, file = tmp_file} +end + +function to_extract(file) + if not file or file == "" or not fs.access(file) then + return {code = 1, error = i18n.translate("File path required.")} + end + + sys.call("/bin/rm -rf /tmp/kodexplorer_extract.*") + local tmp_dir = util.trim(util.exec( + "mktemp -d -t kodexplorer_extract.XXXXXX")) + + local output = {} + exec("/bin/tar", {"-C", tmp_dir, "-zxvf", file}, + function(chunk) output[#output + 1] = chunk end) + + local files = util.split(table.concat(output)) + + exec("/bin/rm", {"-f", file}) + + return {code = 0, file = tmp_dir} +end + +function to_move(file) + if not file or file == "" or not fs.access(file) then + sys.call("/bin/rm -rf /tmp/kodexplorer_extract.*") + return {code = 1, error = i18n.translate("Client file is required.")} + end + + local client_file = get_project_directory() + sys.call("mkdir -p " .. client_file) + sys.call("cp -R " .. file .. "/KodExplorer*/* " .. client_file) + sys.call("/bin/rm -rf /tmp/kodexplorer_extract.*") + + return {code = 0} +end diff --git a/package/lean/luci-app-kodexplorer/luasrc/model/cbi/kodexplorer/settings.lua b/package/lean/luci-app-kodexplorer/luasrc/model/cbi/kodexplorer/settings.lua new file mode 100644 index 00000000000000..0b483e62c6e364 --- /dev/null +++ b/package/lean/luci-app-kodexplorer/luasrc/model/cbi/kodexplorer/settings.lua @@ -0,0 +1,56 @@ +m = Map("kodexplorer", translate("KodExplorer"), translate( + "KodExplorer is a fast and efficient private cloud and online document management system that provides secure, controllable, easy-to-use and highly customizable private cloud products for personal websites, enterprise private cloud deployment, network storage, online document management, and online office. With Windows style interface and operation habits, it can be used quickly without adaptation. It supports online preview of hundreds of common file formats and is extensible and easy to customize.")) +m:append(Template("kodexplorer/status")) + +s = m:section(TypedSection, "global", translate("Global Settings")) +s.anonymous = true +s.addremove = false + +o = s:option(Flag, "enable", translate("Enable")) +o.rmempty = false + +o = s:option(Value, "port", translate("Nginx Port")) +o.datatype = "port" +o.default = 8081 +o.rmempty = false + +o = s:option(Value, "memory_limit", translate("Maximum memory usage"), + translate( + "If your device has a lot of memory, you can increase it.")) +o.default = "8M" +o.rmempty = false + +o = s:option(Value, "post_max_size", translate("Maximum POST capacity"), + translate( + "This value cannot be greater than the maximum memory usage")) +o.default = "12M" +o.rmempty = false + +o = s:option(Value, "upload_max_filesize", + translate("Maximum memory usage for uploading files"), translate( + "This value cannot be greater than the POST maximum capacity")) +o.default = "12M" +o.rmempty = false + +o = s:option(Value, "storage_device_path", translate("Storage device path"), + translate( + "It is recommended to insert a usb flash drive or hard disk and enter the path. For example, /mnt/sda1/")) +o.default = "/mnt/sda1/" +o.rmempty = false + +o = s:option(Value, "project_directory", translate("Project directory"), + translate( + "It is recommended to insert a usb flash drive or hard disk and enter the path. For example, /mnt/sda1/kodexplorer")) +o.default = "/mnt/sda1/kodexplorer" +o.rmempty = false + +s:append(Template("kodexplorer/version")) + +o = s:option(Button, "_download", translate("Manually update"), translate( + "Make sure you have enough space.
Be sure to fill out the device path and store path for the first run, and then save the application. Then manually download, otherwise can not use!")) +o.template = "kodexplorer/download" +o.inputstyle = "apply" +o.btnclick = "downloadClick(this);" +o.id = "download_btn" + +return m diff --git a/package/lean/luci-app-kodexplorer/luasrc/view/kodexplorer/download.htm b/package/lean/luci-app-kodexplorer/luasrc/view/kodexplorer/download.htm new file mode 100644 index 00000000000000..fa271d6a6f1ede --- /dev/null +++ b/package/lean/luci-app-kodexplorer/luasrc/view/kodexplorer/download.htm @@ -0,0 +1,173 @@ +<% +local dsp = require "luci.dispatcher" +-%> + + + +<%+cbi/valueheader%> + <% if self:cfgvalue(section) ~= false then %> + " type="button"<%= + attr("name", cbid) .. + attr("id", self.id or cbid) .. + attr("value", self.inputtitle or self.title) .. + ifattr(self.btnclick, "onclick", self.btnclick) .. + ifattr(self.placeholder, "placeholder") + %> /> + + <% else %> + - + <% end %> +<%+cbi/valuefooter%> \ No newline at end of file diff --git a/package/lean/luci-app-kodexplorer/luasrc/view/kodexplorer/status.htm b/package/lean/luci-app-kodexplorer/luasrc/view/kodexplorer/status.htm new file mode 100644 index 00000000000000..8b0a84b122a97f --- /dev/null +++ b/package/lean/luci-app-kodexplorer/luasrc/view/kodexplorer/status.htm @@ -0,0 +1,31 @@ +<% +local dsp = require "luci.dispatcher" +-%> + +
+ <%:Running Status%> +
+
+ +
<%:Collecting data...%>
+
+
+ +
<%:Collecting data...%>
+
+
+
+ + \ No newline at end of file diff --git a/package/lean/luci-app-kodexplorer/luasrc/view/kodexplorer/version.htm b/package/lean/luci-app-kodexplorer/luasrc/view/kodexplorer/version.htm new file mode 100644 index 00000000000000..1a9c6d61a8d348 --- /dev/null +++ b/package/lean/luci-app-kodexplorer/luasrc/view/kodexplorer/version.htm @@ -0,0 +1,17 @@ +<% +local kodexplorer_path = luci.sys.exec("echo -n `uci get kodexplorer.@global[0].project_directory`") +local kodexplorer_version = luci.sys.exec("[ -f '" .. kodexplorer_path .. "/ChangeLog.md' ] && echo -n `cat " .. kodexplorer_path .. "/ChangeLog.md | head -1 | awk '{print $2}'`") +-%> + +<% if kodexplorer_version ~= nil and kodexplorer_version~="" then %> +
+ +
+
+ 【 <%=kodexplorer_version%> 】 +
+
+
+<% end %> \ No newline at end of file diff --git a/package/lean/luci-app-kodexplorer/po/zh-cn/kodexplorer.po b/package/lean/luci-app-kodexplorer/po/zh-cn/kodexplorer.po new file mode 100644 index 00000000000000..a985306d06ecb4 --- /dev/null +++ b/package/lean/luci-app-kodexplorer/po/zh-cn/kodexplorer.po @@ -0,0 +1,107 @@ +msgid "KodExplorer" +msgstr "可道云" + +msgid "Global Settings" +msgstr "全局设置" + +msgid "KodExplorer is a fast and efficient private cloud and online document management system that provides secure, controllable, easy-to-use and highly customizable private cloud products for personal websites, enterprise private cloud deployment, network storage, online document management, and online office. With Windows style interface and operation habits, it can be used quickly without adaptation. It supports online preview of hundreds of common file formats and is extensible and easy to customize." +msgstr "KodExplorer是一款快捷高效的私有云和在线文档管理系统,为个人网站、企业私有云部署、网络存储、在线文档管理、在线办公等提供安全可控,简便易用、可高度定制的私有云产品。采用windows风格界面、操作习惯,无需适应即可快速上手,支持几百种常用文件格式的在线预览,可扩展易定制。" + +msgid "Nginx Port" +msgstr "Nginx监听端口" + +msgid "Maximum memory usage" +msgstr "内存最大使用" + +msgid "If your device has a lot of memory, you can increase it." +msgstr "如果你的设备内存较大的话,可以适当增加。" + +msgid "Maximum POST capacity" +msgstr "POST最大容量" + +msgid "This value cannot be greater than the maximum memory usage" +msgstr "该值不能大于 内存最大使用" + +msgid "Maximum memory usage for uploading files" +msgstr "上传文件最大使用内存" + +msgid "This value cannot be greater than the POST maximum capacity" +msgstr "该值不能大于 POST最大容量" + +msgid "Storage device path" +msgstr "存储设备路径" + +msgid "It is recommended to insert a usb flash drive or hard disk and enter the path. For example, /mnt/sda1/" +msgstr "建议插入U盘或硬盘,然后输入路径。例如:/mnt/sda1/" + +msgid "Project directory" +msgstr "项目存放目录" + +msgid "It is recommended to insert a usb flash drive or hard disk and enter the path. For example, /mnt/sda1/kodexplorer" +msgstr "建议插入U盘或硬盘,然后输入路径。例如:/mnt/sda1/kodexplorer" + +msgid "Make sure you have enough space.
Be sure to fill out the device path and store path for the first run, and then save the application. Then manually download, otherwise can not use!" +msgstr "请确保具有足够的空间。
第一次运行务必填好设备路径和存放路径,然后保存应用。再手动下载,否则无法使用!" + +msgid "Manually update" +msgstr "手动更新" + +msgid "It is the latest version" +msgstr "已是最新版本" + +msgid "Update successful" +msgstr "更新成功" + +msgid "Click to update" +msgstr "点击更新" + +msgid "Updating..." +msgstr "更新中" + +msgid "Unexpected error" +msgstr "意外错误" + +msgid "Updating, are you sure to close?" +msgstr "正在更新,你确认要关闭吗?" + +msgid "Downloading..." +msgstr "下载中" + +msgid "Unpacking..." +msgstr "解压中" + +msgid "Moving..." +msgstr "移动中" + +msgid "The latest version:" +msgstr "最新版本:" + +msgid "Can't determine ARCH, or ARCH not supported." +msgstr "无法确认ARCH架构,或是不支持。" + +msgid "Get remote version info failed." +msgstr "获取远程版本信息失败。" + +msgid "New version found, but failed to get new version download url." +msgstr "发现新版本,但未能获得新版本的下载地址。" + +msgid "Download url is required." +msgstr "请指定下载地址。" + +msgid "File download failed or timed out: %s" +msgstr "文件下载失败或超时:%s" + +msgid "File path required." +msgstr "请指定文件路径。" + +msgid "Can't find client in file: %s" +msgstr "无法在文件中找到客户端:%s" + +msgid "Client file is required." +msgstr "请指定客户端文件。" + +msgid "The client file is not suitable for current device." +msgstr "客户端文件不适合当前设备。" + +msgid "Can't move new file to path: %s" +msgstr "无法移动新文件到:%s" diff --git a/package/lean/luci-app-kodexplorer/root/etc/config/kodexplorer b/package/lean/luci-app-kodexplorer/root/etc/config/kodexplorer new file mode 100644 index 00000000000000..b049415ba1f538 --- /dev/null +++ b/package/lean/luci-app-kodexplorer/root/etc/config/kodexplorer @@ -0,0 +1,10 @@ + +config global + option port '8080' + option storage_device_path '/opt/kodexplorer/' + option project_directory '/opt/kodexplorer' + option enable '0' + option memory_limit '120M' + option post_max_size '100M' + option upload_max_filesize '100M' + diff --git a/package/lean/luci-app-kodexplorer/root/etc/init.d/kodexplorer b/package/lean/luci-app-kodexplorer/root/etc/init.d/kodexplorer new file mode 100644 index 00000000000000..8c3b4b7d22bf04 --- /dev/null +++ b/package/lean/luci-app-kodexplorer/root/etc/init.d/kodexplorer @@ -0,0 +1,169 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2018-2020 Lienol + +START=99 + +CONFIG="kodexplorer" + +TEMP_PATH="/var/etc/kodexplorer" +NGINX_CONFIG="$TEMP_PATH/nginx.conf" +PHP_FPM_CONFIG="$TEMP_PATH/php-fpm.conf" +PHP_CONFIG="/etc/php.ini" +PHP_BACKUP_CONFIG="/etc/php.ini.backup" + +config_t_get() { + local index=0 + [ -n "$4" ] && index=$4 + local ret=$(uci get $CONFIG.@$1[$index].$2 2>/dev/null) + echo ${ret:=$3} +} + +gen_nginx_config() { + port=$(config_t_get global port) + project_directory=$(config_t_get global project_directory) + cat <<-EOF > $1 + user root root; + worker_processes 1; + pid /var/run/nginx_kodexplorer.pid; + events { + worker_connections 1024; + } + http { + include /etc/nginx/mime.types; + sendfile on; + keepalive_timeout 65; + server { + listen $port; + listen [::]:$port; + server_name localhost; + location / { + root $project_directory; + index index.html index.htm index.php; + } + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root html; + } + location ~ \.php$ { + root $project_directory; + try_files \$uri = 404; # PHP 文件不存在返回404 + fastcgi_pass unix:/var/run/php7-fpm.sock; # 通过 Unix 套接字执行 PHP + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name; # 修复 Nginx fastcgi 漏洞 + include /etc/nginx/fastcgi_params; + } + } + } + EOF +} + +gen_php_config() { + storage_device_path=$(config_t_get global storage_device_path) + memory_limit=$(config_t_get global memory_limit) + post_max_size=$(config_t_get global post_max_size) + upload_max_filesize=$(config_t_get global upload_max_filesize) + cp $PHP_CONFIG $PHP_BACKUP_CONFIG + cat <<-EOF >$PHP_CONFIG + [PHP] + zend.ze1_compatibility_mode = Off + engine = On + precision = 12 + y2k_compliance = On + output_buffering = Off + zlib.output_compression = Off + implicit_flush = Off + unserialize_callback_func = + serialize_precision = 100 + + open_basedir = $storage_device_path:/tmp/:/proc/ + disable_functions = + disable_classes = + expose_php = On + max_execution_time = 30 + max_input_time = 60 + memory_limit = $memory_limit + error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT + + display_errors = On + display_startup_errors = Off + log_errors = Off + log_errors_max_len = 1024 + ignore_repeated_errors = Off + ignore_repeated_source = Off + report_memleaks = On + track_errors = Off + + variables_order = "EGPCS" + request_order = "GP" + register_globals = Off + register_long_arrays = Off + register_argc_argv = On + auto_globals_jit = On + post_max_size = $post_max_size + magic_quotes_runtime = Off + magic_quotes_sybase = Off + auto_prepend_file = + auto_append_file = + default_mimetype = "text/html" + + ;doc_root = "/www" + user_dir = + extension_dir = "/usr/lib/php" + enable_dl = On + cgi.fix_pathinfo=1 + + file_uploads = On + upload_tmp_dir = "/tmp" + upload_max_filesize = $upload_max_filesize + max_file_uploads = 20 + + allow_url_fopen = On + allow_url_include = Off + default_socket_timeout = 60 + EOF + + cat <<-EOF >$PHP_FPM_CONFIG + [global] + pid = /var/run/kodexplorer_php7-fpm.pid + error_log = /var/log/kodexplorer_php7-fpm.log + [www] + user = root + listen = /var/run/php7-fpm.sock + listen.mode = 0666 + listen.allowed_clients = 127.0.0.1 + pm = dynamic + pm.max_children = 5 + pm.start_servers = 2 + pm.min_spare_servers = 1 + pm.max_spare_servers = 3 + chdir = / + EOF +} + +start() { + ENABLED=$(config_t_get global enable 0) + [ "$ENABLED" = "0" ] && return 0 + mkdir -p $TEMP_PATH /var/log/nginx /var/lib/nginx + gen_php_config + /usr/bin/php-fpm -R -y $PHP_FPM_CONFIG -g "/var/run/php7-fpm.pid" + gen_nginx_config $NGINX_CONFIG + /usr/sbin/nginx -c $NGINX_CONFIG >/dev/null 2>&1 & +} + +stop() { + /usr/sbin/nginx -c $NGINX_CONFIG -s stop >/dev/null 2>&1 & + killall -9 php-fpm >/dev/null 2>&1 & + rm -f /var/run/kodexplorer_php7-fpm.pid + rm -f /var/log/kodexplorer_php7-fpm.log + rm -f /var/run/php7-fpm.sock + [ -f "$PHP_BACKUP_CONFIG" -a -f "$PHP_CONFIG" ] && { + rm -f $PHP_CONFIG + cp $PHP_BACKUP_CONFIG $PHP_CONFIG + rm -f $PHP_BACKUP_CONFIG + } +} + +restart() { + stop + start +} \ No newline at end of file diff --git a/package/lean/luci-app-kodexplorer/root/etc/uci-defaults/luci-app-kodexplorer b/package/lean/luci-app-kodexplorer/root/etc/uci-defaults/luci-app-kodexplorer new file mode 100644 index 00000000000000..3b91962769633d --- /dev/null +++ b/package/lean/luci-app-kodexplorer/root/etc/uci-defaults/luci-app-kodexplorer @@ -0,0 +1,12 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@kodexplorer[-1] + add ucitrack kodexplorer + set ucitrack.@kodexplorer[-1].init=kodexplorer + commit ucitrack +EOF + +/etc/init.d/php7-fpm disable && /etc/init.d/php7-fpm stop +rm -f /tmp/luci-indexcache +exit 0 diff --git a/package/lean/luci-app-mwan3helper/Makefile b/package/lean/luci-app-mwan3helper/Makefile new file mode 100644 index 00000000000000..38dedff0544c53 --- /dev/null +++ b/package/lean/luci-app-mwan3helper/Makefile @@ -0,0 +1,18 @@ +# Copyright (C) 2016 Openwrt.org +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI support for MWAN3 Helper +LUCI_DEPENDS:=+luci-app-mwan3 +pdnsd-alt +dnsmasq-full +ipset +LUCI_PKGARCH:=all +PKG_VERSION:=1 +PKG_RELEASE:=3 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + + diff --git a/package/lean/luci-app-mwan3helper/luasrc/controller/mwan3helper.lua b/package/lean/luci-app-mwan3helper/luasrc/controller/mwan3helper.lua new file mode 100644 index 00000000000000..f2068d22849664 --- /dev/null +++ b/package/lean/luci-app-mwan3helper/luasrc/controller/mwan3helper.lua @@ -0,0 +1,27 @@ + +-- Licensed to the public under the GNU General Public License v3. + +module("luci.controller.mwan3helper", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/mwan3helper") then + return + end + + + entry({"admin", "services", "mwan3helper"},alias("admin", "services", "mwan3helper", "client"),_("MWAN3 Helper"), 300).dependent = true + + entry({"admin", "services", "mwan3helper", "client"},cbi("mwan3helper/client"),_("Settings"), 10).leaf = true + + entry({"admin", "services", "mwan3helper", "lists"},cbi("mwan3helper/list"),_("IPSet Lists"), 20).leaf = true + + entry({"admin","services","mwan3helper","status"},call("act_status")).leaf=true + +end + +function act_status() + local e={} + e.running=luci.sys.call("pgrep mwan3dns >/dev/null")==0 + luci.http.prepare_content("application/json") + luci.http.write_json(e) +end diff --git a/package/lean/luci-app-mwan3helper/luasrc/model/cbi/mwan3helper/client.lua b/package/lean/luci-app-mwan3helper/luasrc/model/cbi/mwan3helper/client.lua new file mode 100644 index 00000000000000..466b28c77e3efe --- /dev/null +++ b/package/lean/luci-app-mwan3helper/luasrc/model/cbi/mwan3helper/client.lua @@ -0,0 +1,30 @@ + + +m = Map("mwan3helper") +m.title = translate("MWAN3 Helper") +m.description = translate("MWAN3 Helper generate IPSets") + +m:section(SimpleSection).template = "mwan3helper/mwan3helper_status" + +s = m:section(TypedSection, "mwan3helper") +s.addremove = false +s.anonymous = true + +o = s:option(Flag, "enabled", translate("Enable GFW IPSet")) +o.rmempty = false +o.description = translate("启用 DNS 防污染并打开GFW IPSet(与SSR的GFW列表模式不能同时开启)") + +o = s:option(ListValue, "dns", translate("Anti-pollution DNS Server")) +o:value("208.67.222.222:443", translate("OpenDNS (208.67.222.222)")) +o:value("208.67.220.220:443", translate("OpenDNS (208.67.220.220)")) +o:value("8.8.4.4:53", translate("Google Public DNS (8.8.4.4)")) +o:value("8.8.8.8:53", translate("Google Public DNS (8.8.8.8)")) +o:value("209.244.0.3:53", translate("Level 3 Public DNS (209.244.0.3)")) +o:value("209.244.0.4:53", translate("Level 3 Public DNS (209.244.0.4)")) +o:value("4.2.2.1:53", translate("Level 3 Public DNS (4.2.2.1)")) +o:value("4.2.2.2:53", translate("Level 3 Public DNS (4.2.2.2)")) +o:value("4.2.2.3:53", translate("Level 3 Public DNS (4.2.2.3)")) +o:value("4.2.2.4:53", translate("Level 3 Public DNS (4.2.2.4)")) +o:value("1.1.1.1:53", translate("Cloudflare DNS (1.1.1.1)")) + +return m diff --git a/package/lean/luci-app-mwan3helper/luasrc/model/cbi/mwan3helper/list.lua b/package/lean/luci-app-mwan3helper/luasrc/model/cbi/mwan3helper/list.lua new file mode 100644 index 00000000000000..c908ff19aeae72 --- /dev/null +++ b/package/lean/luci-app-mwan3helper/luasrc/model/cbi/mwan3helper/list.lua @@ -0,0 +1,37 @@ + + +m = Map("mwan3helper") +m.title = translate("MWAN3 IPSets") + +s = m:section(TypedSection, "mwan3helper") +s.addremove = false +s.anonymous = true + +o = s:option(DummyValue, "gfwlist", translate("GFW列表")) +o.description = translate("GFW列表数据: 5207 条,IPSET 名称为 gfwlist") + +o = s:option(DummyValue, "all_cn", translate("中国所有IP地址")) +o.description = translate("中国所有IP地址路由表数据: 8304 条, IPSET 名称为 cn") + +o = s:option(DummyValue, "chinatelecom", translate("中国电信")) +o.description = translate("中国电信路由表数据: 1948 条, IPSET 名称为 ct") + +o = s:option(DummyValue, "unicom_cnc", translate("中国联通/网通")) +o.description = translate("中国联通/网通路由表数据: 895 条, IPSET 名称为 cnc") + +o = s:option(DummyValue, "cmcc", translate("中国移动")) +o.description = translate("中国移动路由表数据: 55 条, IPSET 名称为 cmcc") + +o = s:option(DummyValue, "crtc", translate("中国铁通")) +o.description = translate("中国铁通路由表数据: 16 条, IPSET 名称为 crtc") + +o = s:option(DummyValue, "cernet", translate("中国教育网")) +o.description = translate("中国教育网路由表数据: 162 条, IPSET 名称为 cernet") + +o = s:option(DummyValue, "gwbn", translate("长城宽带/鹏博士")) +o.description = translate("长城宽带/鹏博士: 94 条, IPSET 名称为 gwbn") + +o = s:option(DummyValue, "othernet", translate("中国其他ISP")) +o.description = translate("中国其他ISP: 5134 条, IPSET 名称为 othernet") + +return m diff --git a/package/lean/luci-app-mwan3helper/luasrc/view/mwan3helper/mwan3helper_status.htm b/package/lean/luci-app-mwan3helper/luasrc/view/mwan3helper/mwan3helper_status.htm new file mode 100644 index 00000000000000..44c6a393631f1e --- /dev/null +++ b/package/lean/luci-app-mwan3helper/luasrc/view/mwan3helper/mwan3helper_status.htm @@ -0,0 +1,22 @@ + + +
+

+ <%:Collecting data...%> +

+
\ No newline at end of file diff --git a/package/lean/luci-app-mwan3helper/po/zh-cn/mwan3helper.po b/package/lean/luci-app-mwan3helper/po/zh-cn/mwan3helper.po new file mode 100644 index 00000000000000..ff41800367e19f --- /dev/null +++ b/package/lean/luci-app-mwan3helper/po/zh-cn/mwan3helper.po @@ -0,0 +1,24 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgid "MWAN3 Helper" +msgstr "MWAN3 分流助手" + +msgid "Settings" +msgstr "设置" + +msgid "IPSet Lists" +msgstr "IPSet列表" + +msgid "MWAN3 Helper generate IPSets" +msgstr "自动生成中国地址段和各大ISP运营商的 IPSet 地址段,并解决国外域名的污染问题,帮助MWAN3分流 ISP/WireGuard 等" + +msgid "Enable GFW IPSet" +msgstr "启用 GFW IPSet" \ No newline at end of file diff --git a/package/lean/luci-app-mwan3helper/root/etc/config/mwan3helper b/package/lean/luci-app-mwan3helper/root/etc/config/mwan3helper new file mode 100644 index 00000000000000..f47fff8c1b9204 --- /dev/null +++ b/package/lean/luci-app-mwan3helper/root/etc/config/mwan3helper @@ -0,0 +1,5 @@ + +config mwan3helper 'config' + option dns '208.67.222.222:443' + option enabled '0' + diff --git a/package/lean/luci-app-mwan3helper/root/etc/init.d/mwan3helper b/package/lean/luci-app-mwan3helper/root/etc/init.d/mwan3helper new file mode 100644 index 00000000000000..6247ec2308edb0 --- /dev/null +++ b/package/lean/luci-app-mwan3helper/root/etc/init.d/mwan3helper @@ -0,0 +1,169 @@ +#!/bin/sh /etc/rc.common +# Copyright (c) 2011-2015 OpenWrt.org + +START=60 + +DNSMASQ_RESTART=N +DNS_SERVER="208.67.222.222" + +start_pdnsd() { +# DNS_SERVER=$(uci get flowoffload.@flow[0].dns_server 2>/dev/null) + + [ -d /var/etc ] || mkdir -p /var/etc + + if [ ! -f /var/mwan3dns/pdnsd.cache ]; then + mkdir -p /var/mwan3dns + echo -ne "pd13\000\000\000\000" > /var/mwan3dns/pdnsd.cache + chown -R nobody.nogroup /var/mwan3dns + fi + + cat > /var/etc/mwan3dns.conf </dev/null 2>&1 || kill -9 $(ps | grep mwan3dns | grep -v grep | awk '{print $1}') >/dev/null 2>&1 + echo "Stop MWAN3 Helper DNS" +} + + +start(){ + /etc/mwan3helper/genipset.sh cn '/etc/mwan3helper/all_cn.txt' + /etc/mwan3helper/genipset.sh ct '/etc/mwan3helper/chinatelecom.txt' + /etc/mwan3helper/genipset.sh cnc '/etc/mwan3helper/unicom_cnc.txt' + /etc/mwan3helper/genipset.sh cmcc '/etc/mwan3helper/cmcc.txt' + /etc/mwan3helper/genipset.sh crtc '/etc/mwan3helper/crtc.txt' + /etc/mwan3helper/genipset.sh cernet '/etc/mwan3helper/cernet.txt' + /etc/mwan3helper/genipset.sh gwbn '/etc/mwan3helper/gwbn.txt' + /etc/mwan3helper/genipset.sh othernet '/etc/mwan3helper/othernet.txt' + en=$(uci get mwan3helper.config.enabled 2>/dev/null) + if [ $en -eq 1 ]; then + start_pdnsd + mkdir -p /tmp/etc/dnsmasq-mwan3.d + ipset -N gfwlist hash:net 2>/dev/null + awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"gfwlist"'\n",$0)}' /etc/mwan3helper/gfw.txt > /tmp/etc/dnsmasq-mwan3.d/mwan3_gfwlist.conf + awk '!/^$/&&!/^#/{printf("server=/.%s/'"127.0.0.1#53000"'\n",$0)}' /etc/mwan3helper/gfw.txt >> /tmp/etc/dnsmasq-mwan3.d/mwan3_gfwlist.conf + cat > /tmp/dnsmasq.d/dnsmasq-mwan3.conf </dev/null + +echo "create $1 hash:net family inet hashsize 1024 maxelem 65536" > /tmp/mwan3.ipset +cat $2 | sed -e "s/^/add $1 /" >> /tmp/mwan3.ipset +ipset -! flush $1 +ipset -! restore < /tmp/mwan3.ipset 2>/dev/null +rm -f /tmp/mwan3.ipset diff --git a/package/lean/luci-app-mwan3helper/root/etc/mwan3helper/gfw.txt b/package/lean/luci-app-mwan3helper/root/etc/mwan3helper/gfw.txt new file mode 100644 index 00000000000000..073d0aa7a39ce2 --- /dev/null +++ b/package/lean/luci-app-mwan3helper/root/etc/mwan3helper/gfw.txt @@ -0,0 +1,5205 @@ +030buy.com +0rz.tw +10.tt +1000giri.net +100ke.org +10conditionsoflove.com +10musume.com +123rf.com +12bet.com +12vpn.com +12vpn.net +138.com +141jj.com +141tube.com +1688.com.au +173ng.com +177pic.info +17t17p.com +18board.com +18board.info +18onlygirls.com +18p2p.com +18virginsex.com +1949er.org +1984bbs.com +1984bbs.org +1989report.hkja.org.hk +1991way.com +1998cdp.org +1bao.org +1dumb.com +1e100.net +1eew.com +1mobile.com +1pondo.tv +2-hand.info +2008xianzhang.info +2017.hk +21pron.com +21sextury.com +228.net.tw +233abc.com +24hrs.ca +24smile.org +25u.com +2lipstube.com +2shared.com +2waky.com +3-a.net +30boxes.com +315lz.com +32red.com +36rain.com +3a5a.com +3arabtv.com +3boys2girls.com +3d-game.com +3proxy.ru +3ren.ca +3tui.net +466453.com +4bluestones.biz +4chan.com +4dq.com +4everproxy.com +4irc.com +4mydomain.com +4pu.com +4rbtv.com +4shared.com +51.ca +51jav.org +51luoben.com +5278.cc +56cun04.jigsy.com +5aimiku.com +5i01.com +5isotoi5.org +5maodang.com +63i.com +64museum.org +64tianwang.com +64wiki.com +66.ca +666kb.com +6park.com +6parker.com +7capture.com +7cow.com +8-d.com +85cc.net +85cc.us +85st.com +881903.com +888.com +888poker.com +89-64.org +89.64.charter.constitutionalism.solutions +8news.com.tw +8z1.net +9001700.com +91porn.com +91vps.club +92ccav.com +991.com +99btgc01.com +99cn.info +9bis.com +9bis.net +a-normal-day.com +a248.e.akamai.net +a5.com.ru +aamacau.com +abc.com +abc.net.au +abc.pp.ru +abc.xyz +abchinese.com +abclite.net +abematv.akamaized.net +ablwang.com +aboluowang.com +aboutgfw.com +abs.edu +ac.jiruan.net +accim.org +aceros-de-hispania.com +acevpn.com +acg18.me +acgkj.com +acmedia365.com +acmetoy.com +acnw.com.au +actfortibet.org +actimes.com.au +activpn.com +aculo.us +adcex.com +addictedtocoffee.de +admin.recaptcha.net +admob.com +adpl.org.hk +ads-twitter.com +adsense.com +adult-sex-games.com +adultfriendfinder.com +advanscene.com +advertfan.com +ae.hao123.com +ae.org +aenhancers.com +af.mil +afantibbs.com +aftygh.gov.tw +agnesb.fr +agoogleaday.com +agro.hk +ai-kan.net +ai-wen.net +ai.google +aide.gov.tw +aiph.net +airasia.com +airconsole.com +airvpn.org +aisex.com +aiss.anws.gov.tw +ait.org.tw +aiweiwei.com +aiweiweiblog.com +akiba-online.com +akiba-web.com +akow.org +al-islam.com +al-qimmah.net +alabout.com +alanhou.com +alarab.qa +alasbarricadas.org +alexlur.org +alforattv.net +alhayat.com +alicejapan.co.jp +aliengu.com +alkasir.com +allcoin.com +allconnected.co +alldrawnsex.com +allervpn.com +allfinegirls.com +allgirlmassage.com +allgirlsallowed.org +allgravure.com +alliance.org.hk +allinfa.com +alljackpotscasino.com +allmovie.com +allowed.org +almasdarnews.com +almostmy.com +alphaporno.com +alternate-tools.com +altrec.com +alvinalexander.com +alwaysdata.com +alwaysdata.net +alwaysvpn.com +am730.com.hk +amazon.co.jp +ameblo.jp +americangreencard.com +americanunfinished.com +amiblockedornot.com +amigobbs.net +amitabhafoundation.us +amnesty.org +amnesty.tw +amnestyusa.org +amnyemachen.org +amoiist.com +ampproject.org +amtb-taipei.org +anchorfree.com +ancsconf.org +andfaraway.net +android-x86.org +android.com +androidify.com +andygod.com +angularjs.org +animecrazy.net +animeshippuuden.com +aniscartujo.com +anobii.com +anontext.com +anonymise.us +anonymitynetwork.com +anonymizer.com +anpopo.com +answering-islam.org +anthonycalzadilla.com +anti1984.com +antichristendom.com +antiwave.net +anyporn.com +anysex.com +aobo.com.au +aofriend.com +aojiao.org +aolchannels.aol.com +aomiwang.com +apartmentratings.com +apartments.com +apetube.com +api-secure.recaptcha.net +api-verify.recaptcha.net +api.ai +api.dropboxapi.com +api.linksalpha.com +api.proxlet.com +api.pureapk.com +api.recaptcha.net +apiary.io +apidocs.linksalpha.com +apigee.com +apk-dl.com +apkmirror.com +apkplz.com +apkpure.com +aplusvpn.com +app.box.com +app.heywire.com +app.smartmailcloud.com +app.tutanota.com +appledaily.com +appshopper.com +appsocks.net +appspot.com +appsto.re +aptoide.com +ar.hao123.com +archive.fo +archive.is +archive.li +archive.org +archive.today +archives.gov +arctosia.com +areca-backup.org +arena.taipei +arethusa.su +arlingtoncemetery.mil +army.mil +art4tibet1998.org +arte.gov.tw +artofpeacefoundation.org +artsy.net +asacp.org +asahichinese.com +asg.to +asia-gaming.com +asiaharvest.org +asianews.it +asiansexdiary.com +asianspiss.com +asianwomensfilm.de +asiatgp.com +asiatoday.us +askstudent.com +askynz.net +assembla.com +assimp.org +astrill.com +atc.org.au +atchinese.com +atdmt.com +atgfw.org +athenaeizou.com +atlaspost.com +atnext.com +authorizeddns.net +authorizeddns.org +authorizeddns.us +autodraw.com +av-e-body.com +av.com +av.movie +av.nightlife141.com +avaaz.org +avbody.tv +avcity.tv +avcool.com +avdb.in +avdb.tv +avfantasy.com +avgle.com +avidemux.org +avmo.pw +avmoo.com +avmoo.net +avmoo.pw +avoision.com +avyahoo.com +axureformac.com +azerbaycan.tv +azerimix.com +azubu.tv +b0ne.com +babynet.com.hk +backchina.com +backtotiananmen.com +badiucao.com +badjojo.com +badoo.com +baidu.jp +baijie.org +bailandaily.com +baixing.me +bakgeekhome.tk +banana-vpn.com +bandwagonhost.com +bangbrosnetwork.com +bangchen.net +bangyoulater.com +bankmobilevibe.com +bannedbook.org +bannednews.org +banorte.com +baramangaonline.com +barenakedislam.com +barnabu.co.uk +bartvpn.com +bash-hackers.org +bastillepost.com +bayvoice.net +bb-chat.tv +bbc.co.uk +bbc.com +bbc.in +bbcchinese.com +bbchat.tv +bbci.co.uk +bbg.gov +bbnradio.org +bbs-tw.com +bbs.brockbbs.com +bbs.ecstart.com +bbs.hasi.wang +bbs.huasing.org +bbs.junglobal.net +bbs.kimy.com.tw +bbs.morbell.com +bbs.mychat.to +bbs.netbig.com +bbs.ozchinese.com +bbs.qmzdd.com +bbs.skykiwi.com +bbs.sou-tong.org +bbs.tuitui.info +bbsfeed.com +bbsland.com +bbsmo.com +bbsone.com +bbtoystore.com +bcast.co.nz +bcchinese.net +bcex.ca +bcmorning.com +bdsmvideos.net +beaconevents.com +bebo.com +beeg.com +beevpn.com +behance.net +behindkink.com +beijing1989.com +beijingspring.com +beijingzx.org +belamionline.com +bell.wiki +bemywife.cc +beric.me +berlintwitterwall.com +berm.co.nz +bestforchina.org +bestgore.com +bestpornstardb.com +bestvpn.com +bestvpnanalysis.com +bestvpnserver.com +bestvpnservice.com +bestvpnusa.com +bet365.com +betfair.com +betternet.co +bettervpn.com +bettween.com +betvictor.com +bewww.net +beyondfirewall.com +bfnn.org +bfsh.hk +bgvpn.com +bianlei.com +biantailajiao.com +biantailajiao.in +biblesforamerica.org +bibox.com +bic2011.org +big.one +bigfools.com +bigjapanesesex.com +bigmoney.biz +bignews.org +bigsound.org +biliworld.com +binance.com +binux.me +bipic.net +bird.so +bit-z.com +bit.do +bit.ly +bitcointalk.org +bitcoinworld.com +bitfinex.com +bitinka.com.ar +bitmex.com +bitshare.com +bitsnoop.com +bitvise.com +bizhat.com +bjnewlife.org +bjs.org +bjzc.org +bl-doujinsouko.com +blacklogic.com +blackvpn.com +blewpass.com +blinkx.com +blinw.com +blip.tv +blockcn.com +blockless.com +blog.calibre-ebook.com +blog.cnyes.com +blog.de +blog.exblog.co.jp +blog.excite.co.jp +blog.expofutures.com +blog.fizzik.com +blog.foolsmountain.com +blog.fuckgfw233.org +blog.google +blog.inoreader.com +blog.jackjia.com +blog.jp +blog.kangye.org +blog.lester850.info +blog.martinoei.com +blog.ontrac.com +blog.pathtosharepoint.com +blog.pentalogic.net +blog.sina.com.tw +blog.sogoo.org +blog.soylent.com +blog.taragana.com +blog.tiney.com +blog.xuite.net +blog.youthwant.com.tw +blogblog.com +blogcatalog.com +blogcity.me +blogdns.org +blogger.com +blogimg.jp +bloglines.com +bloglovin.com +blogs.tampabay.com +blogs.yahoo.co.jp +blogspot.com +blogspot.hk +blogspot.jp +blogspot.tw +blogtd.net +blogtd.org +bloodshed.net +bloomberg.cn +bloomberg.com +bloomberg.de +bloombergview.com +bloomfortune.com +blueangellive.com +bmfinn.com +bnews.co +bnrmetal.com +boardreader.com +bod.asia +bodog88.com +bolehvpn.net +bolin.netfirms.com +bonbonme.com +bonbonsex.com +bonfoundation.org +bongacams.com +boobstagram.com +book.com.tw +book.zi5.me +bookepub.com +books.com.tw +booktopia.com.au +boomssr.com +bot.nu +botanwang.com +bowenpress.com +boxpn.com +boxun.com +boxun.tv +boxunblog.com +boxunclub.com +boyangu.com +boyfriendtv.com +boysfood.com +boysmaster.com +br.hao123.com +br.st +brandonhutchinson.com +braumeister.org +bravotube.net +brazzers.com +break.com +breakgfw.com +breaking911.com +breakingtweets.com +breakwall.net +brizzly.com +brkmd.com +broadbook.com +broadpressinc.com +brucewang.net +brutaltgp.com +bt2mag.com +bt95.com +btaia.com +btbtav.com +btcbank.bank +btctrade.im +btdigg.org +btku.me +btku.org +btspread.com +btsynckeys.com +budaedu.org +buddhistchannel.tv +buffered.com +bullog.org +bullogger.com +bunbunhk.com +busayari.com +businessinsider.com +businessweek.com +busytrade.com +buugaa.com +buzzhand.com +buzzhand.net +buzzorange.com +bvpn.com +bwh1.net +bwsj.hk +bx.in.th +bx.tl +bynet.co.il +c-est-simple.com +c-spanvideo.org +c100tibet.org +c1522.mooo.com +c2cx.com +cablegatesearch.net +cachinese.com +cacnw.com +cactusvpn.com +cafepress.com +cahr.org.tw +calebelston.com +calgarychinese.ca +calgarychinese.com +calgarychinese.net +cam4.com +cam4.jp +cam4.sg +camfrog.com +cams.com +cams.org.sg +canadameet.com +canalporno.com +canyu.org +cao.im +caobian.info +caochangqing.com +cap.org.hk +carabinasypistolas.com +cardinalkungfoundation.org +carfax.com +cari.com.my +caribbeancom.com +carmotorshow.com +cartoonmovement.com +casadeltibetbcn.org +casatibet.org.mx +casino.williamhill.com +casinobellini.com +casinoking.com +casinoriva.com +castbox.fm +catch22.net +catchgod.com +catfightpayperview.xxx +catholic.org.hk +catholic.org.tw +cathvoice.org.tw +cattt.com +cbc.ca +cbs.ntu.edu.tw +cbtc.org.hk +cccat.cc +cccat.co +ccdtr.org +cchere.com +ccim.org +cclife.ca +cclife.org +cclifefl.org +ccthere.com +cctmweb.net +ccue.ca +ccue.com +ccvoice.ca +ccw.org.tw +cdbook.org +cdcparty.com +cdef.org +cdig.info +cdjp.org +cdn-images.mailchimp.com +cdn.assets.lfpcontent.com +cdn.helixstudios.net +cdn.printfriendly.com +cdn.seatguru.com +cdn.softlayer.net +cdn.v2ex.com +cdn1.lp.saboom.com +cdnews.com.tw +cdninstagram.com +cdp1989.org +cdp1998.org +cdp2006.org +cdpa.url.tw +cdpeu.org +cdpusa.org +cdpweb.org +cdpwu.org +cdw.com +cecc.gov +cellulo.info +cenews.eu +centauro.com.br +centerforhumanreprod.com +centralnation.com +centurys.net +certificate-transparency.org +certificate.revocationcheck.com +cfhks.org.hk +cfos.de +cftfc.com +cgdepot.org +cgst.edu +ch.shvoong.com +change.org +changeip.name +changeip.net +changeip.org +changp.com +changsa.net +chaoex.com +chapm25.com +chatnook.com +chaturbate.com +chengmingmag.com +chenguangcheng.com +chenpokong.com +chenpokong.net +chenshan20042005.wordpress.com +cherrysave.com +chhongbi.org +chicagoncmtv.com +china-mmm.jp.net +china-mmm.net +china-mmm.sa.com +china-review.com.ua +china-week.com +china.hket.com +china101.com +china18.org +china21.com +china21.org +china5000.us +chinaaffairs.org +chinaaid.me +chinaaid.net +chinaaid.org +chinaaid.us +chinachange.org +chinachannel.hk +chinacitynews.be +chinacomments.org +chinadialogue.net +chinadigitaltimes.net +chinaelections.org +chinaeweekly.com +chinafreepress.org +chinagate.com +chinageeks.org +chinagfw.org +chinagonet.com +chinagreenparty.org +chinahorizon.org +chinahush.com +chinainperspective.com +chinainterimgov.org +chinalaborwatch.org +chinalawandpolicy.com +chinalawtranslate.com +chinamule.com +chinamz.org +chinapress.com.my +chinarightsia.org +chinasocialdemocraticparty.com +chinasoul.org +chinasucks.net +chinatopsex.com +chinatown.com.au +chinatweeps.com +chinaview.wordpress.com +chinaway.org +chinaworker.info +chinayouth.org.hk +chinayuanmin.org +chinaz.com +chinese-hermit.net +chinese-leaders.org +chinese-memorial.org +chinese.donga.com +chinese.engadget.com +chinese.irib.ir +chinese.soifind.com +chinesedaily.com +chinesedailynews.com +chinesedemocracy.com +chinesegay.org +chinesen.de +chinesepen.org +chineseupress.com +chingcheong.com +chinman.net +chithu.org +chn.chosun.com +chobit.cc +chrdnet.com +christianfreedom.org +christianstudy.com +christiantimes.org.hk +chrlawyers.hk +chrome.com +chromecast.com +chromeexperiments.com +chromercise.com +chromestatus.com +chromium.org +chuang-yen.org +chubold.com +chubun.com +chuizi.net +chukuang.gov.tw +chushigangdrug.ch +cienen.com +cineastentreff.de +cipfg.org +circlethebayfortibet.org +cirosantilli.com +citizencn.com +citizenlab.org +citizenscommission.hk +citizensradio.org +city365.ca +city9x.com +citypopulation.de +civicparty.hk +civildisobediencemovement.org +civilhrfront.org +civiliangunner.com +civilmedia.tw +ck101.com +cl.d0z.net +classicalguitarblog.net +clb.org.hk +cldr.unicode.org +cleansite.biz +cleansite.info +cleansite.us +clearharmony.net +clearsurance.com +clearwisdom.net +clementine-player.org +clientservices.googleapis.com +cling.omy.sg +clinica-tibet.ru +clipfish.de +cloakpoint.com +cloud.mail.ru +club1069.com +cmcn.org +cmi.org.tw +cmp.hku.hk +cms.gov +cmule.com +cmule.org +cmx.im +cn-proxy.com +cn.calameo.com +cn.dayabook.com +cn.fmnnow.com +cn.freeones.com +cn.gravatar.com +cn.ibtimes.com +cn.nytstyle.com +cn.sandscotaicentral.com +cn.shafaqna.com +cn.thegay.com +cn.uncyclopedia.wikia.com +cn.uptodown.com +cn.v2ex.com +cn.voa.mobi +cn2.streetvoice.com +cn6.eu +cna.com.tw +cnabc.com +cnbbnews.wordpress.com +cnd.org +cnex.org.cn +cnineu.com +cnpolitics.org +cnproxy.com +co.ng.mil +coat.co.jp +cochina.co +cochina.org +codeshare.io +codeskulptor.org +coin2co.in +coinegg.com +coinex.com +coingi.com +coinrail.co.kr +cointobe.com +coinut.com +collateralmurder.com +collateralmurder.org +com.google +comefromchina.com +comic-mega.me +commandarms.com +commentshk.com +communistcrimes.org +community.windy.com +communitychoicecu.com +compileheart.com +compress.to +connect.facebook.net +connectivitycheck.gstatic.com +conoha.jp +contactmagazine.net +contests.twilio.com +convio.net +coobay.com +coolaler.com +coolder.com +coolloud.org.tw +coolncute.com +coolstuffinc.com +corumcollege.com +cos-moe.com +cosmic.monar.ch +cosplayjav.pl +costco.com +cotweet.com +coursehero.com +cpj.org +cq99.us +crackle.com +crazys.cc +crazyshit.com +crchina.org +crd-net.org +creaders.net +creadersnet.com +creativelab5.com +crisisresponse.google +cristyli.com +crocotube.com +cromotc.nat.gov.tw +crossfire.co.kr +crossthewall.net +crossvpn.net +crrev.com +crucial.com +csdparty.com +csi.gstatic.com +css.pixnet.in +csuchen.de +csw.org.uk +ct.org.tw +ctao.org +ctfriend.net +ctitv.com.tw +cts.com.tw +cuihua.org +cuiweiping.net +culture.tw +cumlouder.com +curvefish.com +cusu.hk +cutscenes.net +cw.com.tw +cwb.gov.tw +cyberghost.natado.com +cyberghostvpn.com +cycab.gov.tw +cynscribe.com +cytode.us +d-fukyu.com +d100.net +d1b183sg0nvnuh.cloudfront.net +d1c37gjwa26taa.cloudfront.net +d2bay.com +d2pass.com +d3c33hcgiwev3.cloudfront.net +d3rhr7kgmtrq1v.cloudfront.net +dabr.co.uk +dabr.eu +dabr.me +dabr.mobi +dadazim.com +dadi360.com +dafabet.com +dafagood.com +dafahao.com +dafoh.org +daftporn.com +dagelijksestandaard.nl +daidostup.ru +dailidaili.com +dailymotion.com +daiphapinfo.net +dajiyuan.com +dajiyuan.de +dajiyuan.eu +dajusha.baywords.com +dalailama-archives.org +dalailama.com +dalailama.mn +dalailama.ru +dalailama.usc.edu +dalailama80.org +dalailamacenter.org +dalailamafellows.org +dalailamafilm.com +dalailamafoundation.org +dalailamahindi.com +dalailamainaustralia.org +dalailamajapanese.com +dalailamaprotesters.info +dalailamaquotes.org +dalailamatrust.org +dalailamavisit.org.nz +dalailamaworld.com +dalianmeng.org +daliulian.org +danbooru.donmai.us +danke4china.net +danwei.org +daodu14.jigsy.com +daolan.net +daozhongxing.org +darktech.org +darktoy.net +darpa.mil +dastrassi.org +data-vocabulary.org +data.flurry.com +data.gov.tw +david-kilgour.com +dawangidc.com +daxa.cn +db.tt +dbnsa.gov.tw +dcard.tw +dcmilitary.com +ddc.com.tw +ddhw.info +ddns.info +ddns.me.uk +ddns.mobi +ddns.ms +ddns.name +ddns.us +de-sci.org +deaftone.com +debug.com +deck.ly +decodet.co +deepmind.com +deezer.com +definebabe.com +deja.com +delcamp.net +demo.opera-mini.net +democrats.org +depositphotos.com +derekhsu.homeip.net +desc.se +design.google +desipro.de +dessci.com +destroy-china.jp +deutsche-welle.de +developers.box.net +devio.us +devpn.com +df.gov.tw +dfas.mil +dfn.org +dharamsalanet.com +dharmakara.net +dhcp.biz +diaoyuislands.org +dictionary.goo.ne.jp +difangwenge.org +digisfera.com +digitalnomadsproject.org +diigo.com +dilber.se +dingchin.com.tw +dipity.com +directcreative.com +discoins.com +discordapp.com +discordapp.net +discuss.com.hk +discuss4u.com +dish.com +disp.cc +disqus.com +dit-inc.us +dizhidizhi.com +dizhuzhishang.com +djangosnippets.org +djorz.com +dl-laby.jp +dl.box.net +dl.google.com +dlsite.com +dlyoutube.com +dm530.net +dmcdn.net +dmm.co.jp +dns-dns.com +dns-stuff.com +dns04.com +dns05.com +dns1.us +dns2.us +dns2go.com +dnscrypt.org +dnset.com +dnsrd.com +dnssec.net +dnvod.tv +doctorvoice.org +dojin.com +dok-forum.net +dolc.de +dolf.org.hk +dollf.com +domain.club.tw +domainhelp.search.com +domains.google +domaintoday.com.au +dongtaiwang.com +dongtaiwang.net +dongyangjing.com +dontfilter.us +dontmovetochina.com +dorjeshugden.com +dotplane.com +dotsub.com +dotvpn.com +doub.io +dougscripts.com +douhokanko.net +doujincafe.com +dowei.org +download.aircrack-ng.org +download.cnet.com +download.ithome.com.tw +download.syniumsoftware.com +dphk.org +dpp.org.tw +dpr.info +dragonex.io +dragonsprings.org +dreamamateurs.com +drepung.org +drgan.net +drmingxia.org +dropbooks.tv +dropbox.com +dropboxusercontent.com +drsunacademy.com +drtuber.com +dscn.info +dsmtp.com +dstk.dk +dtdns.net +dtiblog.com +dtic.mil +dtwang.org +duanzhihu.com +duck.com +duckdns.org +duckduckgo-owned-server.yahoo.net +duckduckgo.com +duckmylife.com +duga.jp +duihua.org +duihuahrjournal.org +dumb1.com +dunyabulteni.net +duoweitimes.com +duping.net +duplicati.com +dupola.com +dupola.net +dushi.ca +dvdpac.com +dvorak.org +dw-world.com +dw-world.de +dw.com +dw.de +dwnews.com +dwnews.net +dynamic-dns.net +dynamicdns.biz +dynamicdns.co.uk +dynamicdns.me.uk +dynamicdns.org.uk +dynawebinc.com +dyndns-ip.com +dyndns-pics.com +dyndns.org +dyndns.pro +dynssl.com +dynu.com +dynu.net +dzze.com +e-classical.com.tw +e-gold.com +e-hentai.org +e-hentaidb.com +e-info.org.tw +e123.hk +earlytibet.com +earthcam.com +earthvpn.com +eastcoast-nsa.gov.tw +eastern-ark.com +easternlightning.org +eastturkestan.com +eastturkistan-gov.org +eastturkistancc.org +eastturkistangovernmentinexile.us +easyca.ca +easypic.com +ebony-beauty.com +ebook.hyread.com.tw +ebookbrowse.com +ebookee.com +ebtcbank.com +ecfa.org.tw +echofon.com +ecimg.tw +ecministry.net +economist.com +edgecastcdn.net +edicypages.com +edmontonchina.cn +edmontonservice.com +edns.biz +edoors.com +edubridge.com +edupro.org +eesti.ee +eevpn.com +efcc.org.hk +effers.com +efksoft.com +efukt.com +eic-av.com +eireinikotaerukai.com +eisbb.com +eksisozluk.com +electionsmeter.com +elgoog.im +elpais.com +eltondisney.com +embr.in +emilylau.org.hk +empfil.com +emule-ed2k.com +emulefans.com +emuparadise.me +en.favotter.net +en.hao123.com +enanyang.my +enewstree.com +enfal.de +engagedaily.org +englishforeveryone.org +englishfromengland.co.uk +englishpen.org +enlighten.org.tw +entermap.com +entnt.com +environment.google +epa.gov.tw +epac.to +episcopalchurch.org +epochhk.com +epochtimes-bg.com +epochtimes-romania.com +epochtimes.co.il +epochtimes.co.kr +epochtimes.com +epochtimes.cz +epochtimes.de +epochtimes.fr +epochtimes.ie +epochtimes.it +epochtimes.jp +epochtimes.ru +epochtimes.se +epochtimestr.com +epochweek.com +epochweekly.com +eporner.com +equinenow.com +erabaru.net +eracom.com.tw +eraysoft.com.tr +erepublik.com +erights.net +eriversoft.com +erktv.com +ernestmandel.org +erodaizensyu.com +erodoujinlog.com +erodoujinworld.com +eromanga-kingdom.com +eromangadouzin.com +eromon.net +eroprofile.com +eroticsaloon.net +erv-nsa.gov.tw +eslite.com +esmtp.biz +esurance.com +etaa.org.au +etadult.com +etaiwannews.com +etherdelta.com +etizer.org +etokki.com +etools.ncol.com +etowns.net +etowns.org +etvonline.hk +eu.org +eucasino.com +eulam.com +eurekavpt.com +evchk.wikia.com +evschool.net +exblog.jp +exchristian.hk +exmo.com +exmormon.org +expatshield.com +expecthim.com +expekt.com +experts-univers.com +exploader.net +expressvpn.com +exrates.me +extmatrix.com +extremetube.com +exx.com +eyevio.jp +eyny.com +ezpeer.com +ezua.com +fa.gov.tw +facebook.br +facebook.com +facebook.design +facebook.hu +facebook.in +facebook.nl +facebook.se +facebookquotes4u.com +faceless.me +facesofnyfw.com +facesoftibetanselfimmolators.info +fail.hk +faith100.org +faithfuleye.com +faiththedog.info +fakku.net +falsefire.com +falun-co.org +falun-ny.net +falun.caltech.edu +falunart.org +falunasia.info +falunau.org +falunaz.net +falundafa-dc.org +falundafa-florida.org +falundafa-nc.org +falundafa-pa.net +falundafa-sacramento.org +falundafa.org +falundafaindia.org +falundafamuseum.org +falungong.club +falungong.de +falungong.org.uk +falunhr.org +faluninfo.de +faluninfo.net +falunpilipinas.net +falunworld.net +familyfed.org +famunion.com +fan-qiang.com +fangbinxing.com +fangeming.com +fangeqiang.com +fanglizhi.info +fangmincn.org +fangong.forums-free.com +fangong.org +fangongheike.com +fanhaodang.com +fanqiang.tk +fanqianghou.com +fanqiangyakexi.net +fanqiangzhe.com +fanswong.com +fanyue.info +fapdu.com +faproxy.com +faqserv.com +fartit.com +farwestchina.com +fast.wistia.com +fastpic.ru +fastssh.com +faststone.org +fatbtc.com +favstar.fm +fawanghuihui.org +fb.com +fb.me +fbaddins.com +fbcdn.net +fbsbx.com +fbworkmail.com +fc2.com +fc2blog.net +fc2china.com +fc2cn.com +fda.gov.tw +fdc64.de +fdc64.org +fdc89.jp +feedburner.com +feeds.fileforum.com +feelssh.com +feer.com +feifeiss.com +feitian-california.org +feitianacademy.org +feministteacher.com +fengzhenghu.com +fengzhenghu.net +fevernet.com +ff.im +fffff.at +fflick.com +ffvpn.com +fgmtv.net +fgmtv.org +fhreports.net +figprayer.com +fileflyer.com +files2me.com +filesor.com +fillthesquare.org +filmingfortibet.org +filthdump.com +financetwitter.com +finchvpn.com +findmespot.com +findyoutube.com +findyoutube.net +fingerdaily.com +finler.net +firearmsworld.net +firebaseio.com +fireofliberty.org +firetweet.io +firstfivefollowers.com +flagsonline.it +flecheinthepeche.fr +fleshbot.com +fleursdeslettres.com +flgg.us +flgjustice.org +flickr.com +flickrhivemind.net +flickriver.com +fling.com +flipboard.com +flipkart.com +flitto.com +flnet.org +flog.tw +flyvpn.com +flyzy2005.com +fnac.be +fnac.com +fochk.org +focustaiwan.tw +focusvpn.com +fofg-europe.net +fofg.org +fofldfradio.org +fonts.googleapis.com +fonts.gstatic.com +fooooo.com +footwiball.com +foreignpolicy.com +forum.baby-kingdom.com +forum.cyberctm.com +forum.idsam.com +forum.my903.com +forum.mymaji.com +forum.omy.sg +forum.palmislife.com +forum.setty.com.tw +forum.sina.com.hk +forum.slime.com.tw +forum.tvb.com +forum4hk.com +fotile.me +fourface.nodesnoop.com +fourthinternational.org +foxdie.us +foxgay.com +foxsub.com +foxtang.com +fpmt-osel.org +fpmt.org +fpmt.tw +fpmtmexico.org +fq.wikia.com +fqok.org +fqrouter.com +franklc.com +freakshare.com +free-gate.org +free-hada-now.org +free-proxy.cz +free-ss.site +free-ssh.com +free4u.com.ar +freealim.com +freebrowser.org +freechal.com +freechina.net +freechinaforum.org +freeddns.com +freeddns.org +freedomchina.info +freedomhouse.org +freedominfonetweb.wordpress.com +freedomsherald.org +freeforums.org +freefq.com +freefuckvids.com +freegao.com +freeilhamtohti.org +freekwonpyong.org +freelotto.com +freeman2.com +freemoren.com +freemorenews.com +freenet-china.org +freenetproject.org +freenewscn.com +freeopenvpn.com +freeoz.org +freessh.us +freetcp.com +freetibet.net +freetibet.org +freetibetanheroes.org +freeviewmovies.com +freevpn.me +freevpn.nl +freewallpaper4.me +freewebs.com +freewechat.com +freewww.biz +freewww.info +freexinwen.com +freeyellow.com +freeyoutubeproxy.net +friendfeed.com +friends-of-tibet.org +friendsoftibet.org +fring.com +fringenetwork.com +from-pr.com +from-sd.com +fromchinatousa.net +frommel.net +frontlinedefenders.org +frootvpn.com +fscked.org +fsurf.com +ftp1.biz +ftpserver.biz +ftv.com.tw +fucd.com +fuckcnnic.net +fuckgfw.org +fullerconsideration.com +fulue.com +funf.tw +funkyimg.com +funp.com +fuq.com +furbo.org +furhhdl.org +furinkan.com +furl.net +futurechinaforum.org +futuremessage.org +fux.com +fuyin.net +fuyindiantai.org +fuyu.org.tw +fw.cm +fxcm-chinese.com +fxnetworks.com +fzh999.com +fzh999.net +fzlm.com +g-area.org +g-queen.com +g.co +g6hentai.com +gabocorp.com +gaeproxy.com +gaforum.org +galaxymacau.com +galenwu.com +galstars.net +game735.com +gamebase.com.tw +gamejolt.com +gamer.com.tw +gamez.com.tw +gamousa.com +ganges.com +gaoming.net +gaopi.net +gaozhisheng.net +gaozhisheng.org +gardennetworks.com +gardennetworks.org +gartlive.com +gate-project.com +gate.io +gatecoin.com +gather.com +gatherproxy.com +gati.org.tw +gaybubble.com +gaycn.net +gayhub.com +gaymap.cc +gaymenring.com +gaytube.com +gaywatch.com +gazotube.com +gcc.org.hk +gclooney.com +gcmasia.com +gcpnews.com +gcr.io +gdzf.org +geek-art.net +geekheart.info +gekikame.com +gelbooru.com +geocities.co.jp +geocities.jp +gerefoundation.org +get.app +get.how +getastrill.com +getchu.com +getcloak.com +getfoxyproxy.org +getfreedur.com +getgom.com +geti2p.net +getiton.com +getlantern.org +getmdl.io +getoutline.org +getsocialscope.com +getsync.com +gettrials.com +gettyimages.com +getuploader.com +gfbv.de +gfgold.com.hk +gfsale.com +gfw.org.ua +gfw.press +ggpht.com +ggssl.com +ghostpath.com +ghut.org +giantessnight.com +gifree.com +giga-web.jp +gigporno.ru +girlbanker.com +gist.github.com +git.io +gizlen.net +gjczz.com +glass8.eu +global.bing.com +globaljihad.net +globalmediaoutreach.com +globalmuseumoncommunism.org +globalrescue.net +globaltm.org +globalvoices.org +globalvoicesonline.org +globalvpn.net +glock.com +gloryhole.com +glorystar.me +glype.com +gmail.com +gmbd.cn +gmhz.org +gmll.org +gmodules.com +gmozomg.izihost.org +gnci.org.hk +go-pki.com +go.nesnode.com +go141.com +goagent.biz +goagent.codeplex.com +goagentplus.com +gobet.cc +godfootsteps.org +godns.work +godoc.org +godsdirectcontact.co.uk +godsdirectcontact.org +godsimmediatecontact.com +gogotunnel.com +gohappy.com.tw +gojet.krtco.com.tw +gokbayrak.com +golang.org +goldbet.com +goldbetsports.com +goldeneyevault.com +goldenfrog.com +goldjizz.com +goldstep.net +goldwave.com +gongm.in +gongmeng.info +gongminliliang.com +gongwt.com +goo.gl +gooday.xyz +gooddns.info +goodreaders.com +goodreads.com +goodtv.com.tw +goodtv.tv +goofind.com +google.ae +google.am +google.as +google.at +google.az +google.ba +google.be +google.bg +google.ca +google.calstate.edu +google.cd +google.ci +google.co.id +google.co.jp +google.co.kr +google.co.ma +google.co.uk +google.com +google.de +google.dj +google.dk +google.es +google.fi +google.fm +google.fr +google.gg +google.gl +google.gr +google.ie +google.is +google.it +google.jo +google.kz +google.lv +google.mn +google.ms +google.nl +google.no +google.nu +google.ro +google.ru +google.rw +google.sc +google.sh +google.sk +google.sm +google.sn +google.tk +google.tm +google.to +google.tt +google.vu +google.ws +googleapis.cn +googleapis.com +googleapps.com +googlearth.com +googleartproject.com +googleblog.com +googlebot.com +googlechinawebmaster.com +googlecode.com +googlecommerce.com +googledomains.com +googledrive.com +googleearth.com +googlegroups.com +googlehosted.com +googleideas.com +googleinsidesearch.com +googlelabs.com +googlemail.com +googlemashups.com +googlepagecreator.com +googleplay.com +googleplus.com +googlescholar.com +googlesile.com +googlesource.com +googleusercontent.com +googlevideo.com +googleweblight.com +googlezip.net +gopetition.com +goproxing.net +gospelherald.com +got-game.org +gotdns.ch +gotgeeks.com +gotrusted.com +gotw.ca +gov.taipei +gov.tw +gr8domain.biz +gr8name.biz +grammaly.com +grandtrial.org +grangorz.org +graphis.ne.jp +graphql.org +grb.gov.tw +greasespot.net +great-firewall.com +great-roc.org +greatfire.org +greatfire.us7.list-manage.com +greatfirewall.biz +greatfirewallofchina.net +greatfirewallofchina.org +greatroc.org +greatroc.tw +greatzhonghua.org +greenfieldbookstore.com.hk +greenparty.org.tw +greenpeace.com.tw +greenpeace.org +greenvpn.net +greenvpn.org +grotty-monday.com +groups.google.cn +grow.google +gs-discuss.com +gsp.target.com +gstatic.com +gtricks.com +gts-vpn.com +gu-chu-sum.org +guaguass.com +guaguass.org +guancha.org +guaneryu.com +guangming.com.my +guardster.com +guishan.org +gumroad.com +gun-world.net +gunsamerica.com +gunsandammo.com +guo.media +guruonline.hk +gutteruncensored.com +gvlib.com +gvm.com.tw +gvt0.com +gvt1.com +gvt3.com +gwtproject.org +gyalwarinpoche.com +gyatsostudio.com +gysd.nyc.gov.tw +gzm.tv +gzone-anime.info +h-china.org +h-moe.com +h1n1china.org +h528.com +h5dm.com +h5galgame.me +hacg.club +hacg.in +hacg.li +hacg.me +hacg.red +hacker.org +hackthatphone.net +hahaxixi.github.io +hahlo.com +hakkatv.org.tw +handcraftedsoftware.org +hanunyi.com +haoel.github.io +haosou.com +happy-vpn.com +haproxy.org +hardsextube.com +harunyahya.com +hautelook.com +hautelookcdn.com +have8.com +haygo.com +hbo.com +hchcc.gov.tw +hclips.com +hdlt.me +hdtvb.net +hdzog.com +heartyit.com +heavy-r.com +hec.su +hecaitou.net +hechaji.com +heeact.edu.tw +hegre-art.com +heix.pp.ru +helloandroid.com +helloqueer.com +helloss.pw +hellotxt.com +help.linksalpha.com +helpeachpeople.com +helplinfen.com +helpster.de +helpzhuling.org +hentai.to +hentaitube.tv +hentaivideoworld.com +heqinglian.net +heungkongdiscuss.com +hexieshe.com +hexieshe.xyz +hexxeh.net +heyzo.com +hgseav.com +hhdcb3office.org +hhthesakyatrizin.org +hi-on.org.tw +hidden-advent.org +hide.me +hidein.net +hideipvpn.com +hideman.net +hideme.nl +hidemy.name +hidemyass.com +hidemycomp.com +higfw.com +highpeakspureearth.com +highrockmedia.com +hihiforum.com +hihistory.net +hiitch.com +hikinggfw.org +hilive.tv +himalayan-foundation.org +himalayanglacier.com +himemix.com +himemix.net +hitbtc.com +hitomi.la +hiwifi.com +hizb-ut-tahrir.info +hizb-ut-tahrir.org +hizbuttahrir.org +hjclub.info +hk-pub.com +hk.geocities.com +hk.hao123img.com +hk.jiepang.com +hk.knowledge.yahoo.com +hk.myblog.yahoo.com +hk.news.yahoo.com +hk.rd.yahoo.com +hk.v2ex.com +hk.yahoo.com +hk01.com +hk32168.com +hka8964.wordpress.com +hkacg.com +hkacg.net +hkanews.wordpress.com +hkatvnews.com +hkbc.net +hkbf.org +hkbookcity.com +hkchurch.org +hkci.org.hk +hkcmi.edu +hkcnews.com +hkcoc.com +hkcoc.weather.com.hk +hkday.net +hkdf.org +hkej.com +hkfaa.com +hkfreezone.com +hkfront.org +hkgolden.com +hkhkhk.com +hkhrc.org.hk +hkhrm.org.hk +hkip.org.uk +hkjc.com +hkjp.org +hklft.com +hklts.org.hk +hkptu.org +hkreporter.com +hkreporter.loved.hk +hkupop.hku.hk +hkusu.net +hkvwet.com +hkwcc.org.hk +hkzone.org +hmonghot.com +hmvdigital.ca +hmvdigital.com +hnjhj.com +hnntube.com +hola.com +hola.org +holymountaincn.com +holyspiritspeaks.org +home.sina.com +homedepot.com +homeperversion.com +homeservershow.com +hongkongfp.com +hongmeimei.com +hongzhi.li +hootsuite.com +hoovers.com +hopedialogue.org +hopto.org +hornygamer.com +hornytrip.com +hotav.tv +hotels.cn +hotfrog.com.tw +hotgoo.com +hotpornshow.com +hotpot.hk +hotshame.com +hotspotshield.com +hotvpn.com +hougaige.com +howtoforge.com +hoxx.com +hpa.gov.tw +hqcdp.org +hqjapanesesex.com +hqmovies.com +hqsbnet.wordpress.com +hqsbonline.wordpress.com +hrcchina.org +hrcir.com +hrea.org +hrichina.org +hrtsea.com +hrw.org +hrweb.org +hsinchu-cc.gov.tw +hsjp.net +hsselite.com +hst.net.tw +hstern.net +hstt.net +ht.ly +htkou.net +htl.li +html5rocks.com +http2.golang.org +https443.net +https443.org +hua-yue.net +huaglad.com +huanghuagang.org +huangyiyu.com +huaren.us +huaren4us.com +huashangnews.com +huaxia-news.com +huaxiabao.org +huaxin.ph +huayuworld.org +hudatoriq.web.id +hudson.org +hugoroy.eu +huhaitai.com +huhamhire.com +huiyi.in +hulkshare.com +hulu.com +huluim.com +humanrightsbriefing.org +hung-ya.com +hungerstrikeforaids.org +huobi.com +huobi.pro +huobipro.com +huping.net +hurgokbayrak.com +hurriyet.com.tr +hustlercash.com +hut2.ru +hutianyi.net +hutong9.net +huyandex.com +hwadzan.tw +hwayue.org.tw +hwinfo.com +hxwk.org +hxwq.org +hybrid-analysis.com +hyperrate.com +i-cable.com +i-part.com.tw +i.lithium.com +i.v2ex.com +i1.hk +i2p2.de +i2runner.com +i818hk.com +iam.soy +iamtopone.com +iask.bz +iask.ca +iav19.com +iblist.com +iblogserv-f.net +ibros.org +ibvpn.com +icams.com +ice.audionow.com +icij.org +icl-fi.org +icoco.com +iconpaper.org +icu-project.org +id.hao123.com +id.heroku.com +iddddg.com +idemocracy.asia +identi.ca +idiomconnection.com +idouga.com +idreamx.com +idv.tw +ieasy5.com +ied2k.net +ienergy1.com +ifan.cz.cc +ifanqiang.com +ifcss.org +ifjc.org +ifreewares.com +ift.tt +igcd.net +igfw.net +igfw.tech +igmg.de +ignitedetroit.net +igoogle.com +igotmail.com.tw +igvita.com +ihakka.net +iicns.com +iipdigital.usembassy.gov +ikstar.com +ikwb.com +illusionfactory.com +ilove80.be +ilovelongtoes.com +im.tv +im88.tw +imageab.com +imagefap.com +imageflea.com +images-gaytube.com +images.comico.tw +imageshack.us +imagevenue.com +imagezilla.net +imb.org +ime.baidu.jp +img.ly +imgchili.net +imkev.com +imlive.com +immigration.gov.tw +immoral.jp +impact.org.au +impp.mn +in-disguise.com +in99.org +incapdns.net +incloak.com +incredibox.fr +indiandefensenews.in +indiemerch.com +iner.gov.tw +info-graf.fr +initiativesforchina.org +inkui.com +inmediahk.net +innermongolia.org +inote.tw +insecam.org +insidevoa.com +instagram.com +instanthq.com +institut-tibetain.org +international-news.newsmagazine.asia +internetdefenseleague.org +internetfreedom.org +internetpopculture.com +investigating.wordpress.com +inxian.com +iownyour.biz +iownyour.org +ip.cn +ip6.static.sl-reverse.com +ipalter.com +ipfire.org +ipfs.io +iphone4hongkong.com +iphonehacks.com +iphonetaiwan.org +iphonix.fr +ipicture.ru +ipjetable.net +iportal.me +ippotv.com +ipredator.se +iptv.com.tw +iptvbin.com +ipvanish.com +iredmail.org +ironbigfools.compython.net +ironpython.net +ironsocket.com +is-a-hunter.com +is.gd +isaacmao.com +isasecret.com +isgreat.org +islahhaber.net +islam.org.hk +islamhouse.com +islamicity.com +islamicpluralism.org +islamtoday.net +ismaelan.com +ismalltits.com +ismprofessional.net +isohunt.com +israbox.com +issuu.com +istars.co.nz +istiqlalhewer.com +istockphoto.com +isunaffairs.com +isuntv.com +itaboo.info +itaiwan.gov.tw +italiatibet.org +itasoftware.com +itemdb.com +ithelp.ithome.com.tw +itsaol.com +itshidden.com +itsky.it +itweet.net +iu45.com +iuhrdf.org +iuksky.com +ivacy.com +iverycd.com +ivpn.net +ixquick.com +ixxx.com +iyouport.com +izaobao.us +izles.net +izlesem.org +j.mp +ja.wikipedia.org +jamaat.org +jamyangnorbu.com +jandyx.com +janwongphoto.com +japan-whores.com +japantimes.co.jp +jav.com +jav101.com +jav2be.com +jav68.tv +javakiba.org +javbus.com +javfor.me +javhd.com +javhip.com +javhub.net +javhuge.com +javlibrary.com +javmobile.net +javmoo.com +javmoo.xyz +javseen.com +javtag.com +javzoo.com +jbtalks.cc +jbtalks.com +jbtalks.my +jcpenney.com +jdwsy.com +jeanyim.com +jetos.com +jex.com +jfqu36.club +jfqu37.xyz +jgoodies.com +jiangweiping.com +jiaoyou8.com +jiehua.cz +jieshibaobao.com +jigglegifs.com +jigong1024.com +jihadintel.meforum.org +jihadology.net +jiji.com +jike.com +jims.net +jinbushe.org +jingpin.org +jingsim.org +jinpianwang.com +jinroukong.com +jinx.com +jitouch.com +jizzthis.com +jjgirls.com +jkb.cc +jkforum.net +jkub.com +jma.go.jp +jmscult.com +joachims.org +jobnewera.wordpress.com +jobso.tv +journalchretien.net +journalofdemocracy.org +joymiihub.com +joyourself.com +jp.hao123.com +jpl.nasa.gov +jpopforum.net +jpush.cn +jtvnw.net +jubushoushen.com +juhuaren.com +jukujo-club.com +juliepost.com +juliereyc.com +junauza.com +june4commemoration.org +junefourth-20.net +jungleheart.com +juoaa.com +justdied.com +justfreevpn.com +justicefortenzin.org +justpaste.it +justtristan.com +juyuange.org +juziyue.com +jwmusic.org +jyxf.net +k-doujin.net +ka-wai.com +kagyu.org +kagyumonlam.org +kagyunews.com.hk +kagyuoffice.org +kaiyuan.de +kakao.com +kalachakralugano.org +kankan.today +kannewyork.com +kanshifang.com +kantie.org +kanzhongguo.com +kanzhongguo.eu +kaotic.com +karayou.com +karkhung.com +karmapa-teachings.org +karmapa.org +kawaiikawaii.jp +kawase.com +kb.monitorware.com +kba-tx.org +kcoolonline.com +kebrum.com +kechara.com +keezmovies.com +kendatire.com +kendincos.net +kenengba.com +keontech.net +kepard.com +kex.com +keycdn.com +kh.google.com +khabdha.org +khatrimaza.org +khm.google.com +khm.googleapis.com +khm0.google.com +khm0.googleapis.com +khm1.google.com +khm1.googleapis.com +khm2.google.com +khm2.googleapis.com +khm3.google.com +khm3.googleapis.com +khmdb.google.com +khmdb.googleapis.com +khmusic.com.tw +kichiku-doujinko.com +kik.com +killwall.com +kindleren.com +kineox.free.fr +kingdomsalvation.org +kinghost.com +kingstone.com.tw +kink.com +kinmen.org.tw +kinmen.travel +kir.jp +kissbbao.cn +kiwi.kz +kk-whys.co.jp +kkbox.com +kknews.cc +klsio.gov.tw +kmseh.gov.tw +kmuh.org.tw +kobo.com +kobobooks.com +kodingen.com +kompozer.net +konachan.com +kone.com +koolsolutions.com +koornk.com +koranmandarin.com +korenan2.com +ksdl.org +ksnews.com.tw +kspcoin.com +ktzhk.com +kucoin.com +kun.im +kurashsultan.com +kurtmunger.com +kusocity.com +kwcg.ca +kwongwah.com.my +kxsw.life +kyofun.com +kyohk.net +kyoyue.com +kyzyhello.com +kzeng.info +la-forum.org +labiennale.org +ladbrokes.com +lagranepoca.com +lalulalu.com +lama.com.tw +lamayeshe.com +lamnia.co.uk +lamrim.com +lanterncn.cn +lantosfoundation.org +laod.cn +laogai.org +laomiu.com +laoyang.info +laptoplockdown.com +laqingdan.net +larsgeorge.com +lastcombat.com +lastfm.es +latelinenews.com +latibet.org +lax.v2ex.com +lbank.info +ld.hao123img.com +le-vpn.com +leafyvpn.net +lecloud.net +lefora.com +left21.hk +legalporno.com +legaltech.law.com +legsjapan.com +leirentv.ca +leisurecafe.ca +leisurepro.com +lematin.ch +lemonde.fr +lenwhite.com +lerosua.org +lers.google +lesoir.be +letou.com +letscorp.net +lflink.com +lflinkup.com +lflinkup.net +lflinkup.org +lhakar.org +lhasocialwork.org +liangyou.net +liangzhichuanmei.com +lianyue.net +liaowangxizang.net +liberal.org.hk +libertytimes.com.tw +lifemiles.com +lighten.org.tw +lightnovel.cn +like.com +limiao.net +line-apps.com +line-scdn.net +line.me +line.naver.jp +linear-abematv.akamaized.net +linglingfa.com +lingvodics.com +link-o-rama.com +linkideo.com +linkuswell.com +linux.org.hk +lionsroar.com +lipuman.com +liquidvpn.com +listentoyoutube.com +listorious.com +liu-xiaobo.org +liudejun.com +liuhanyu.com +liujianshu.com +liuxiaobo.net +liuxiaotong.com +livecoin.net +livedoor.jp +liveleak.com +livestation.com +livestream.com +livevideo.com +livingonline.us +livingstream.com +liwangyang.com +lizhizhuangbi.com +lkcn.net +load.to +lobsangwangyal.com +localdomain.ws +localpresshk.com +lockestek.com +logbot.net +login.target.com +logiqx.com +londonchinese.ca +longhair.hk +longmusic.com +longtermly.net +longtoes.com +lookpic.com +looktoronto.com +lotuslight.org.hk +lotuslight.org.tw +lovetvshow.com +lpsg.com +lrfz.com +lrip.org +lsd.org.hk +lsforum.net +lsm.org +lsmchinese.org +lsmkorean.org +lsmwebcast.com +lsxszzg.com +ltn.com.tw +luke54.com +luke54.org +lungtanhr.gov.tw +lupm.org +lushstories.com +luxebc.com +lvhai.org +lvv2.com +lyfhk.net +lzmtnews.org +m.hkgalden.com +m.me +m.plixi.com +m.slandr.net +ma.hao123.com +macgamestore.com +macrovpn.com +macts.com.tw +mad-ar.ch +madewithcode.com +madonna-av.com +madrau.com +madthumbs.com +magazines.sina.com.tw +magic-net.info +mahabodhi.org +maiio.net +mail-archive.com +maildns.xyz +maiplus.com +maizhong.org +makemymood.com +makkahnewspaper.com +makzhou.warehouse333.com +malaysiakini.com +mamingzhe.com +manchukuo.net +mangafox.com +mangafox.me +maniash.com +manicur4ik.ru +mansion.com +mansionpoker.com +manta.com +maolin-nsa.gov.tw +maplew.com +marc.info +marguerite.su +martau.com +martincartoons.com +martsangkagyuofficial.org +marxist.com +marxist.net +mash.to +maskedip.com +mastodon.host +matainja.com +material.io +mathable.io +mathiew-badimon.com +matome-plus.com +matome-plus.net +matsu-news.gov.tw +matsu-nsa.gov.tw +matsucc.gov.tw +matsushimakaede.com +mattwilcox.net +maturejp.com +maxing.jp +mayimayi.com +mcadforums.com +mcaf.ee +mcfog.com +mcreasite.com +md-t.org +me.youthwant.com.tw +meansys.com +media.nu.nl +media.org.hk +mediachinese.com +mediafreakcity.com +medium.com +meetav.com +meetup.com +mefeedia.com +mefound.com +mega.nz +megaproxy.com +megarotic.com +megavideo.com +megurineluka.com +meirixiaochao.com +meltoday.com +meme.yahoo.com +memehk.com +memorybbs.com +memri.org +memrijttm.org +mercyprophet.org +meridian-trust.org +meripet.biz +meripet.com +merit-times.com.tw +meshrep.com +messenger.com +metarthunter.com +meteorshowersonline.com +metrolife.ca +metroradio.com.hk +meyou.jp +meyul.com +mfxmedia.com +mgoon.com +mgstage.com +mh4u.org +mhradio.org +michaelanti.com +michaelmarketl.com +microvpn.com +middle-way.net +mihr.com +mihua.org +mike.cz.cc +mikesoltys.com +milph.net +milsurps.com +mimiai.net +mimivip.com +mimivv.com +mindrolling.org +minghui-a.org +minghui-b.org +minghui-school.org +minghui.or.kr +minghui.org +minghuiyw.wordpress.com +mingjinglishi.com +mingjingnews.com +mingjingtimes.com +mingpao.com +mingpaocanada.com +mingpaomonthly.com +mingpaonews.com +mingpaony.com +mingpaosf.com +mingpaotor.com +mingpaovan.com +mingshengbao.com +minhhue.net +miniforum.org +ministrybooks.org +minzhuhua.net +minzhuzhanxian.com +minzhuzhongguo.org +miroguide.com +mirrorbooks.com +mist.vip +mitao.com.tw +mitbbs.com +mitbbsau.com +mixero.com +mixpod.com +mixx.com +mizzmona.com +mjib.gov.tw +mk5000.com +mlcool.com +mlzs.work +mm-cg.com +mmaaxx.com +mmmca.com +mnewstv.com +mo.nightlife141.com +mobatek.net +mobile01.com +mobileways.de +moby.to +mobypicture.com +moe.gov.tw +moeaic.gov.tw +moeerolibrary.com +mofa.gov.tw +mofaxiehui.com +mofos.com +mog.com +mohu.club +mohu.ml +mol.gov.tw +molihua.org +mondex.org +money-link.com.tw +moneyhome.biz +monitorchina.org +monster.com +moodyz.com +moonbbs.com +moonbingo.com +morningsun.org +moroneta.com +mos.ru +motherless.com +motor4ik.ru +mousebreaker.com +movements.org +moviefap.com +mp3buscador.com +mp3ye.eu +mpettis.com +mpfinance.com +mpinews.com +mponline.hk +mqxd.org +mrbasic.com +mrbonus.com +mrface.com +mrslove.com +mrtweet.com +msa-it.org +msguancha.com +msha.gov +mswe1.org +mthruf.com +mtw.tl +muchosucko.com +mullvad.net +multiply.com +multiproxy.org +multiupload.com +mummysgold.com +murmur.tw +music.jwmusic.org +musicade.net +muslimvideo.com +muzi.com +muzi.net +muzu.tv +mvdis.gov.tw +mvg.jp +mx.hao123.com +mx981.com +my-formosa.com +my-private-network.co.uk +my-proxy.com +my.mail.ru +my.pcloud.com +my03.com +myanniu.com +myaudiocast.com +mybbs.us +mybet.com +myca168.com +mycanadanow.com +mychinamyhome.com +mychinanet.com +mychinanews.com +mychinese.news +mycnnews.com +mydad.info +myddns.com +myeasytv.com +myeclipseide.com +myforum.com.hk +myforum.com.uk +myfreecams.com +myfreepaysite.com +myfreshnet.com +myftp.info +myftp.name +myiphide.com +mykomica.org +mylftv.com +mymoe.moe +mymom.info +mymusic.net.tw +mynetav.net +mynetav.org +mynumber.org +myparagliding.com +mypicture.info +mypop3.net +mypop3.org +mypopescu.com +myreadingmanga.info +mysecondarydns.com +mysinablog.com +mysite.verizon.net +myspace.com +myspacecdn.com +mytalkbox.com +mytizi.com +myvlog.im.tv +mywww.biz +myz.info +naacoalition.org +naitik.net +nakido.com +nalandabodhi.org +nalandawest.org +namgyal.org +namgyalmonastery.org +namsisi.com +nankan.gov.tw +nanyang.com +nanyangpost.com +nanzao.com +naol.ca +naol.cc +nat.gov.tw +nat.moe +national-lottery.co.uk +nationwide.com +naughtyamerica.com +navyfamily.navy.mil +navyreserve.navy.mil +naweeklytimes.com +nbtvpn.com +nccwatch.org.tw +nch.com.tw +ncn.org +ncree.gov.tw +nde.de +ndr.de +necoast-nsa.gov.tw +ned.org +nekoslovakia.net +neo-miracle.com +nepusoku.com +ner.gov.tw +net-fits.pro +netbirds.com +netcolony.com +netflix.com +netme.cc +netsneak.com +network54.com +networkedblogs.com +networktunnel.net +neue.v2ex.com +neverforget8964.org +new-3lunch.net +new-akiba.com +new96.ca +newcenturymc.com +newcenturynews.com +newchen.com +newgrounds.com +newipnow.com +newlandmagazine.com.au +newnews.ca +news.cnyes.com +news.hk.msn.com +news.hkpeanut.com +news.msn.com.tw +news.now.com +news.omy.sg +news.seehua.com +news.sina.com.hk +news.sina.com.tw +news.sinchew.com.my +news.singtao.ca +news.tvbs.com.tw +news100.com.tw +newsancai.com +newschinacomment.org +newscn.org +newsdetox.ca +newsdh.com +newstamago.com +newstapa.org +newstarnet.com +newtaiwan.com.tw +newtalk.tw +newyorktimes.com +nexon.com +next11.co.jp +nextmag.com.tw +nextmedia.com +nexton-net.jp +nexttv.com.tw +nf.id.au +nfjtyd.com +nflxext.com +nflximg.com +nflximg.net +nflxso.net +nflxvideo.net +nga.mil +ngensis.com +nhentai.net +nhi.gov.tw +nhk-ondemand.jp +nic.cz.cc +nic.google +nic.gov +nighost.org +nikkei.com +ninecommentaries.com +ninjacloak.com +ninjaproxy.ninja +nintendium.com +ninth.biz +niusnews.com +njactb.org +njuice.com +nko.navy.mil +nlfreevpn.com +nmmba.gov.tw +nmp.gov.tw +nmvttc.gov.tw +no-ip.org +nobel.se +nobodycanstop.us +nofile.io +nokogiri.org +nokola.com +noodlevpn.com +norbulingka.org +nordstrom.com +nordstromimage.com +nordstromrack.com +nordvpn.com +northguan-nsa.gov.tw +notify.dropboxapi.com +nottinghampost.com +novelasia.com +now.com +now.im +nownews.com +nowtorrents.com +noypf.com +npa.go.jp +npa.gov.tw +npm.gov.tw +npnt.me +nps.gov +nradio.me +nrk.no +ns01.biz +ns01.info +ns01.us +ns02.biz +ns02.info +ns02.us +ns1.name +ns2.name +ns3.name +nsc.gov.tw +nstm.gov.tw +ntbk.gov.tw +ntbna.gov.tw +ntbt.gov.tw +ntd.tv +ntdmh.gov.tw +ntdtv.ca +ntdtv.co.kr +ntdtv.com +ntdtv.cz +ntdtv.org +ntdtv.ru +ntdtvla.com +ntl.gov.tw +ntrfun.com +ntsec.gov.tw +ntsna.gov.tw +ntuh.gov.tw +nubiles.net +nuexpo.com +nukistream.com +nurgo-software.com +nusatrip.com +nutaku.net +nuuvem.com +nuvid.com +nuzcom.com +nvdst.com +nvquan.org +nvri.gov.tw +nvtongzhisheng.org +nwtca.org +ny.stgloballink.com +ny.visiontimes.com +nyaa.eu +nydus.ca +nylon-angel.com +nylonstockingsonline.com +nyt.com +nytchina.com +nytcn.me +nytco.com +nytimes.com +nytimes.map.fastly.net +nytimg.com +nytstyle.com +nzchinese.com +nzchinese.net.nz +observechina.net +obutu.com +ocaspro.com +occupytiananmen.com +oclp.hk +ocreampies.com +ocry.com +october-review.org +oculus.com +oculuscdn.com +oex.com +offbeatchina.com +officeoftibet.com +ofile.org +ogaoga.org +ogate.org +oiktv.com +oizoblog.com +ok.ru +okayfreedom.com +okex.com +okk.tw +old-cat.net +old.nabble.com +olumpo.com +olympicwatch.org +omgili.com +omni7.jp +omnitalk.com +omnitalk.org +on.cc +on2.com +onapp.com +onedrive.live.com +onedumb.com +onejav.com +onion.city +online.recoveryversion.org +onlinecha.com +onlineyoutube.com +onlytweets.com +onmoon.com +onmoon.net +onmypc.biz +onmypc.info +onmypc.net +onmypc.org +onmypc.us +onthehunt.com +ontrac.com +oopsforum.com +open.com.hk +openallweb.com +opendemocracy.net +opendn.xyz +openervpn.in +openid.net +openleaks.org +openvpn.net +openwebster.com +openwrt.org.cn +opml.radiotime.com +opus-gaming.com +organcare.org.tw +organharvestinvestigation.net +organiccrap.com +orgasm.com +orgfree.com +orient-doll.com +orientaldaily.com.my +orn.jp +orzistic.org +osfoora.com +otcbtc.com +otnd.org +otto.de +otzo.com +ourdearamy.com +ourhobby.com +oursogo.com +oursteps.com.au +oursweb.net +ourtv.hk +overplay.net +oversea.istarshine.com +ow.ly +owl.li +oyax.com +ozvoice.org +ozxw.com +ozyoyo.com +pachosting.com +pacificpoker.com +packetix.net +pacopacomama.com +padmanet.com +page.bid.yahoo.com +page2rss.com +pagespeed.v2ex.com +pagodabox.com +palacemoon.com +paldengyal.com +paljorpublications.com +paltalk.com +panamapapers.sueddeutsche.de +pandapow.co +pandapow.net +pandavpn-jp.com +pandora.com +pandora.tv +panluan.net +panoramio.com +pao-pao.net +paper.li +paperb.us +paradisehill.cc +paradisepoker.com +parkansky.com +partycasino.com +partypoker.com +passion.com +passiontimes.hk +paste.ee +pastebin.com +pastie.org +pbwiki.com +pbworks.com +pbxes.com +pbxes.org +pcanywhere.net +pcc.gov.tw +pcdvd.com.tw +pchome.com.tw +pcij.org +pcstore.com.tw +pct.org.tw +pdetails.com +pdproxy.com +pds.nasa.gov +peace.ca +peacefire.org +peacehall.com +pearlher.org +peeasian.com +pekingduck.org +pemulihan.or.id +pen.io +penchinese.com +penchinese.net +penghu-nsa.gov.tw +pengyulong.com +penisbot.com +penthouse.com +peoplebookcafe.com +peoplenews.tw +peopo.org +percy.in +perfectgirls.net +perfectvpn.net +periscope.tv +persecutionblog.com +persiankitty.com +pfd.org.hk +phapluan.org +phayul.com +philborges.com +philly.com +phmsociety.org +phncdn.com +phosphation13.rssing.com +photodharma.net +photofocus.com +phuquocservices.com +picacomic.com +picacomiccn.com +picasaweb.com +picidae.net +pictures.playboy.com +picturesocial.com +pin-cong.com +pin6.com +ping.fm +pinimg.com +pinkrod.com +pinoy-n.com +pinterest.at +pinterest.co.kr +pinterest.co.uk +pinterest.com +pinterest.de +pinterest.dk +pinterest.fr +pinterest.jp +pinterest.nl +pinterest.se +pioneer-worker.forums-free.com +pipii.tv +piposay.com +piraattilahti.org +piring.com +pixelqi.com +pixiv.net +pixnet.net +pk.com +pki.goog +placemix.com +playboy.com +playboyplus.com +player.fm +playno1.com +playpcesor.com +plays.com.tw +plm.org.hk +plunder.com +plurk.com +plus28.com +plusbb.com +pmatehunter.com +pmates.com +po2b.com +pobieramy.top +podictionary.com +pokerstars.com +pokerstars.net +politicalchina.org +politicalconsultation.org +politiscales.net +poloniex.com +polymer-project.org +polymerhk.com +popo.tw +popvote.hk +popyard.com +popyard.org +porn.com +porn2.com +porn5.com +pornbase.org +pornerbros.com +pornhd.com +pornhost.com +pornhub.com +pornhubdeutsch.net +pornmm.net +pornoxo.com +pornrapidshare.com +pornsharing.com +pornsocket.com +pornstarclub.com +porntube.com +porntubenews.com +porntvblog.com +pornvisit.com +port25.biz +portablevpn.nl +poskotanews.com +post.gov.tw +post01.com +post76.com +post852.com +postadult.com +postimg.org +potvpn.com +power.com +powercx.com +powerphoto.org +prayforchina.net +premeforwindows7.com +premproxy.com +presentationzen.com +presidentlee.tw +prestige-av.com +pride.google +prisoneralert.com +pritunl.com +privacybox.de +privateinternetaccess.com +privatepaste.com +privatetunnel.com +privatevpn.com +procopytips.com +prosiben.de +protonvpn.com +provideocoalition.com +provpnaccounts.com +proxfree.com +proxifier.com +proxomitron.info +proxpn.com +proxyanonimo.es +proxydns.com +proxylist.org.uk +proxynetwork.org.uk +proxypy.net +proxyroad.com +proxytunnel.net +proyectoclubes.com +prozz.net +psblog.name +pscp.tv +psiphon.ca +psiphon.civisec.org +psiphon3.com +psiphontoday.com +pts.org.tw +ptt.cc +pttvan.org +pubu.com.tw +puffinbrowser.com +puffstore.com +pullfolio.com +pulse.yahoo.com +pure18.com +pureconcepts.net +pureinsight.org +purepdf.com +purevpn.com +purplelotus.org +pursuestar.com +pushchinawall.com +pussyspace.com +putihome.org +putty.org +puuko.com +pwned.com +python.com +pytorch.org +qanote.com +qgirl.com.tw +qhigh.com +qi-gong.me +qiandao.today +qiangyou.org +qidian.ca +qienkuen.org +qiwen.lu +qixianglu.cn +qkshare.com +qoos.com +qpoe.com +qq.co.za +qstatus.com +qtrac.eu +qtweeter.com +quannengshen.org +quantumbooter.net +questvisual.com +quitccp.net +quitccp.org +quora.com +quran.com +quranexplorer.com +qusi8.net +qvodzy.org +qxbbs.org +r18.com +ra.gg +radicalparty.org +radiko.jp +radioaustralia.net.au +radiohilight.net +radiovaticana.org +radiovncr.com +rael.org +raggedbanner.com +raidcall.com.tw +raidtalk.com.tw +raizoji.or.jp +ramcity.com.au +rangwang.biz +rangzen.com +rangzen.net +rangzen.org +ranyunfei.com +rapbull.net +rapidmoviez.com +rapidvpn.com +raremovie.cc +raremovie.net +rawgit.com +rawgithub.com +razyboard.com +rcam.target.com +rcinet.ca +rconversation.blogs.com +rd.com +rdio.com +read01.com +read100.com +readingtimes.com.tw +readmoo.com +readydown.com +realcourage.org +realforum.zkiz.com +realitykings.com +realraptalk.com +realsexpass.com +rebatesrule.net +recordhistory.org +recovery.org.tw +recoveryversion.com.tw +red-lang.org +redballoonsolidarity.org +redchinacn.net +redchinacn.org +redd.it +reddit.com +redditmedia.com +redditstatic.com +redhotlabs.com +redirector.gvt1.com +redtube.com +referer.us +reflectivecode.com +registry.google +relaxbbs.com +relay.com.tw +releaseinternational.org +religioustolerance.org +renminbao.com +renyurenquan.org +resilio.com +retweeteffect.com +retweetist.com +retweetrank.com +reuters.com +reutersmedia.net +revleft.com +revver.com +rfa.org +rfachina.com +rfalive1.akacast.akamaistream.net +rfamobile.org +rfaweb.org +rferl.org +rfi.fr +rightbtc.com +rigpa.org +rileyguide.com +riseup.net +ritouki.jp +ritter.vg +rixcloud.com +rixcloud.us +rlwlw.com +rmjdw.com +rmjdw132.info +roadshow.hk +roboforex.com +robustnessiskey.com +rocket-inc.net +rocksdb.org +rojo.com +rolia.net +ronjoneswriter.com +roodo.com +rosechina.net +rotten.com +rsdlmonitor.com +rsf-chinese.org +rsf.org +rsgamen.org +rssmeme.com +rtalabel.org +rthk.hk +rthk.org.hk +rthklive2-lh.akamaihd.net +rti.org.tw +rtycminnesota.org +rukor.org +rushbee.com +ruten.com.tw +rutube.ru +ruyiseek.com +rxhj.net +s-cute.com +s-dragon.org +s1.nudezz.com +s1heng.com +s1s1s1.com +s3-ap-northeast-1.amazonaws.com +s3-ap-southeast-2.amazonaws.com +s8forum.com +sa.hao123.com +sacks.com +sacom.hk +sadistic-v.com +sadpanda.us +safebrowsing.googleapis.com +safervpn.com +safety.google +saintyculture.com +saiq.me +sakuralive.com +sakya.org +salvation.org.hk +sambhota.org +sanmin.com.tw +sapikachu.net +saveliuxiaobo.com +savemedia.com +savethedate.foo +savetibet.de +savetibet.fr +savetibet.nl +savetibet.org +savetibet.ru +savetibetstore.org +savevid.com +say2.info +sbme.me +scache.vzw.com +scache1.vzw.com +scache2.vzw.com +scasino.com +schema.org +sciencenets.com +scieron.com +scmp.com +scmpchinese.com +scramble.io +scribd.com +scriptspot.com +seapuff.com +search.aol.com +search.disconnect.me +search.yahoo.co.jp +searchtruth.com +secretchina.com +secretgarden.no +secretsline.biz +secure.hustler.com +secure.logmein.com +secure.raxcdn.com +securetunnel.com +securityinabox.org +securitykiss.com +seed4.me +seesmic.com +seevpn.com +seezone.net +sejie.com +sellclassics.com +sendsmtp.com +sendspace.com +servehttp.com +serveuser.com +serveusers.com +sesawe.net +sesawe.org +sethwklein.net +setn.com +settv.com.tw +sevenload.com +sex-11.com +sex.com +sex3.com +sex8.cc +sexandsubmission.com +sexbot.com +sexhu.com +sexhuang.com +sexidude.com +sexinsex.net +sextvx.com +sexxxy.biz +sfileydy.com +sfshibao.com +sftindia.org +sftuk.org +shadeyouvpn.com +shadow.ma +shadowsky.xyz +shadowsocks-r.com +shadowsocks.asia +shadowsocks.be +shadowsocks.com +shadowsocks.org +shadowsocks9.com +shambalapost.com +shambhalasun.com +shangfang.org +shapeservices.com +share.dmhy.org +share.youthwant.com.tw +sharebee.com +sharecool.org +sharpdaily.com.hk +sharpdaily.hk +sharpdaily.tw +shat-tibet.com +shattered.io +sheikyermami.com +shellfire.de +shenshou.org +shenyun.com +shenyunperformingarts.org +shenzhoufilm.com +sherabgyaltsen.com +shiatv.net +shicheng.org +shiksha.com +shinychan.com +shipcamouflage.com +shireyishunjian.com +shitaotv.org +shixiao.org +shizhao.org +shodanhq.com +shooshtime.com +shop2000.com.tw +shopping.com +showbiz.omy.sg +showhaotu.com +showtime.jp +shutterstock.com +shwchurch.org +shwchurch3.com +siddharthasintent.org +sidelinesnews.com +sidelinessportseatery.com +sierrafriendsoftibet.org +sijihuisuo.club +sijihuisuo.com +sikaozhe1997.github.io +silkbook.com +simbolostwitter.com +simplecd.me +simplecd.org +simpleproductivityblog.com +singaporepools.com.sg +singfortibet.com +singpao.com.hk +singtao.com +singtaousa.com +sino-monthly.com +sinoants.com +sinocast.com +sinocism.com +sinomontreal.ca +sinonet.ca +sinopitt.info +sinoquebec.com +siraya-nsa.gov.tw +sis.xxx +sis001.com +sis001.us +site.locql.com +site2unblock.com +site90.net +sitebro.tw +sitekreator.com +siteks.uk.to +sitemaps.org +sixth.biz +sjrt.org +sjum.cn +sketchappsources.com +skimtube.com +skybet.com +skyking.com.tw +skyvegas.com +skyxvpn.com +slacker.com +slaytizle.com +sleazydream.com +slheng.com +slickvpn.com +slideshare.net +slinkset.com +slutload.com +slutmoonbeam.com +slyip.com +slyip.net +sm-miracle.com +smartdnsproxy.com +smarthide.com +smchbooks.com +smhric.org +smyxy.org +snapchat.com +snaptu.com +sndcdn.com +sneakme.net +snowlionpub.com +sobees.com +soc.mil +socialwhale.com +socks-proxy.net +sockscap64.com +sockslist.net +socrec.org +sod.co.jp +sodatea.github.io +softether-download.com +softether.co.jp +softether.org +softwarebychuck.com +softwaredownload.gitbooks.io +sogclub.com +sogrady.me +soh.tw +sohcradio.com +sohfrance.org +sokamonline.com +sokmil.com +solarsystem.nasa.gov +solidaritetibet.org +solidfiles.com +somee.com +songjianjun.com +sonicbbs.cc +sonidodelaesperanza.org +sopcast.com +sopcast.org +sorazone.net +sorting-algorithms.com +sos.org +sosreader.com +sostibet.org +soubory.com +soul-plus.net +soulcaliburhentai.net +soumo.info +soundcloud.com +soundofhope.kr +soundofhope.org +soup.io +soupofmedia.com +sourcewadio.com +southnews.com.tw +sowers.org.hk +soylentnews.org +spankbang.com +spankingtube.com +spankwire.com +spb.com +speakerdeck.com +specxinzl.jigsy.com +speedify.com +spem.at +spencertipping.com +spicevpn.com +spideroak.com +spike.com +sports.williamhill.com +spotflux.com +spotify.com +spreadshirt.es +spring4u.info +springboardplatform.com +sprite.org +sproutcore.com +sproxy.info +squirly.info +srocket.us +ss-link.com +ss.carryzhou.com +ss.levyhsu.com +ss7.vzw.com +ssglobal.co +ssglobal.me +ssh91.com +ssl.gstatic.com +ssl.webpack.de +ssl443.org +sspro.ml +ssr.tools +ssrshare.com +sss.camp +sstmlt.moe +sstmlt.net +stage64.hk +standupfortibet.org +starfishfx.com +starp2p.com +startpage.com +startuplivingchina.com +stat.gov.tw +static-economist.com +static.comico.tw +static.shemalez.com +static.soup.io +static.typepad.com +static.v2ex.com +static01.nyt.com +staticflickr.com +statueofdemocracy.org +stc.com.sa +stdtime.gov.tw +steamcommunity.com +steel-storm.com +steganos.com +steganos.net +stepchina.com +stephaniered.com +sthoo.com +stickam.com +stileproject.com +sto.cc +stoporganharvesting.org +stoptibetcrisis.net +storage.googleapis.com +storagenewsletter.com +store.sprite.org +stories.google +storify.com +storm.mg +stormmediagroup.com +stoweboyd.com +stranabg.com +straplessdildo.com +streamingthe.net +strikingly.com +strongvpn.com +strongwindpress.com +studentsforafreetibet.org +stumbleupon.com +stupidvideos.com +subacme.rerouted.org +successfn.com +sugarsync.com +sugobbs.com +sugumiru18.com +suissl.com +sujiatun.wordpress.com +sukebei.nyaa.si +sulian.me +summify.com +sumrando.com +sun1911.com +sunmedia.ca +sunmoonlake.gov.tw +sunporno.com +sunskyforum.com +sunta.com.tw +sunvpn.net +sunwinism.joinbbs.net +suoluo.org +supchina.com +superfreevpn.com +superokayama.com +superpages.com +supervpn.net +superzooi.com +suppig.net +suprememastertv.com +surfeasy.com +suroot.com +surrenderat20.net +sustainability.google +suyangg.com +svsfx.com +swagbucks.com +swissvpn.net +switch1.jp +switchvpn.net +sydneytoday.com +sylfoundation.org +syncback.com +synergyse.com +sysresccd.org +sytes.net +szbbs.net +szetowah.org.hk +t-g.com +t.co +t.me +t.orzdream.com +t35.com +t66y.com +taa-usa.org +taaze.tw +tabtter.jp +tacc.cwb.gov.tw +tacem.org +taconet.com.tw +taedp.org.tw +tafm.org +tagwa.org.au +tagwalk.com +tahr.org.tw +taipei.gov.tw +taipeisociety.org +taitung-house.gov.tw +taiwan-sex.com +taiwanbible.com +taiwancon.com +taiwandaily.net +taiwandc.org +taiwanjobs.gov.tw +taiwanjustice.com +taiwanjustice.net +taiwankiss.com +taiwannation.50webs.com +taiwannation.com +taiwanncf.org.tw +taiwannews.com.tw +taiwantp.net +taiwantt.org.tw +taiwanus.net +taiwanyes.com +taiwanyes.ning.com +talk853.com +talkboxapp.com +talkonly.net +tamiaode.tk +tanc.org +tangben.com +tangren.us +taoism.net +taolun.info +taoyuan.gov.tw +tapanwap.com +tapatalk.com +tascn.com.au +taup.net +taweet.com +tax.nat.gov.tw +tbcollege.org +tbi.org.hk +tbicn.org +tbjyt.org +tbpic.info +tbrc.org +tbs-rainbow.org +tbsec.org +tbskkinabalu.page.tl +tbsmalaysia.org +tbsn.org +tbsseattle.org +tbssqh.org +tbswd.org +tbtemple.org.uk +tbthouston.org +tccwonline.org +tcewf.org +tchrd.org +tcnynj.org +tcpspeed.co +tcpspeed.com +tcsofbc.org +tcsovi.org +tdm.com.mo +teachparentstech.org +teamamericany.com +techviz.net +teck.in +teco-hk.org +teco-mo.org +teddysun.com +teeniefuck.net +teensinasia.com +telecomspace.com +telegram.dog +telegram.me +telegram.org +telegramdownload.com +telegraph.co.uk +telesco.pe +tellme.pw +tenacy.com +tensorflow.org +tenzinpalmo.com +terminus2049.github.io +tew.org +textnow.me +th.hao123.com +thaicn.com +thb.gov.tw +theatrum-belli.com +thebcomplex.com +theblemish.com +thebobs.com +thebodyshop-usa.com +thecenter.mit.edu +thechinabeat.org +thedalailamamovie.com +thedw.us +thefacebook.com +thegly.com +thehots.info +thehousenews.com +thehun.net +theinitium.com +thenewslens.com +thepiratebay.org +theportalwiki.com +thereallove.kr +therock.net.nz +thespeeder.com +thestandnews.com +thetibetcenter.org +thetibetconnection.org +thetibetmuseum.org +thetibetpost.com +thetinhat.com +thetrotskymovie.com +thevivekspot.com +thewgo.org +theync.com +thinkingtaiwan.com +thinkwithgoogle.com +thisav.com +thlib.org +thomasbernhard.org +thongdreams.com +threatchaos.com +throughnightsfire.com +thumbzilla.com +thywords.com +tiananmenduizhi.com +tiananmenmother.org +tiananmenuniv.com +tiananmenuniv.net +tiandixing.org +tianhuayuan.com +tianlawoffice.com +tianti.io +tiantibooks.org +tianyantong.org.cn +tianzhu.org +tibet-envoy.eu +tibet-foundation.org +tibet-house-trust.co.uk +tibet-info.net +tibet-initiative.de +tibet-munich.de +tibet.a.se +tibet.at +tibet.ca +tibet.com +tibet.fr +tibet.net +tibet.nu +tibet.org +tibet.sk +tibet.to +tibet3rdpole.org +tibetaction.net +tibetaid.org +tibetalk.com +tibetan-alliance.org +tibetan.fr +tibetanaidproject.org +tibetanarts.org +tibetanbuddhistinstitute.org +tibetancommunity.org +tibetancommunityuk.net +tibetanculture.org +tibetanfeministcollective.org +tibetanjournal.com +tibetanlanguage.org +tibetanliberation.org +tibetanpaintings.com +tibetanphotoproject.com +tibetanpoliticalreview.org +tibetanreview.net +tibetansports.org +tibetanwomen.org +tibetanyouth.org +tibetanyouthcongress.org +tibetcharity.dk +tibetcharity.in +tibetchild.org +tibetcity.com +tibetcollection.com +tibetcorps.org +tibetexpress.net +tibetfocus.com +tibetfund.org +tibetgermany.com +tibetgermany.de +tibethaus.com +tibetheritagefund.org +tibethouse.jp +tibethouse.org +tibethouse.us +tibetinfonet.net +tibetjustice.org +tibetkomite.dk +tibetlibre.free.fr +tibetmuseum.org +tibetnetwork.org +tibetoffice.ch +tibetoffice.com.au +tibetoffice.eu +tibetoffice.org +tibetonline.com +tibetonline.tv +tibetoralhistory.org +tibetpolicy.eu +tibetrelieffund.co.uk +tibetsites.com +tibetsociety.com +tibetsun.com +tibetsupportgroup.org +tibetswiss.ch +tibettelegraph.com +tibettimes.net +tibetwrites.org +ticket.com.tw +tigervpn.com +tiltbrush.com +timdir.com +time.com +times.hinet.net +timsah.com +tineye.com +tintuc101.com +tiny.cc +tinychat.com +tinypaste.com +tipo.gov.tw +tistory.com +tkcs-collins.com +tma.co.jp +tmagazine.com +tmdfish.com +tmi.me +tmpp.org +tn1.shemalez.com +tn2.shemalez.com +tn3.shemalez.com +tnaflix.com +tngrnow.com +tngrnow.net +tnp.org +to-porno.com +togetter.com +toh.info +tokyo-247.com +tokyo-hot.com +tokyo-porn-tube.com +tokyocn.com +tongil.or.kr +tono-oka.jp +tonyyan.net +toodoc.com +tools.google.com +toonel.net +top.tv +top81.ws +topbtc.com +topic.youthwant.com.tw +topnews.in +toppornsites.com +topshareware.com +topsy.com +toptip.ca +tor.blingblingsquad.net +tor.updatestar.com +tora.to +torcn.com +torguard.net +torproject.org +torrentprivacy.com +torrentproject.se +torrenty.org +torrentz.eu +torvpn.com +tosh.comedycentral.com +totalvpn.com +toutiaoabc.com +towngain.com +toypark.in +toythieves.com +toytractorshow.com +tparents.org +tpde.aide.gov.tw +tphcc.gov.tw +tpi.org.tw +tracfone.com +traffichaus.com +translate.google.cn +translate.googleapis.com +transparency.org +treemall.com.tw +trendsmap.com +trialofccp.org +trickip.net +trickip.org +trimt-nsa.gov.tw +trouw.nl +trt.net.tr +trtc.com.tw +truebuddha-md.org +trulyergonomic.com +truth101.co.tv +truthontour.org +truveo.com +tryheart.jp +tsctv.net +tsdr.uspto.gov +tsemtulku.com +tsquare.tv +tsu.org.tw +tsunagarumon.com +tt-rss.org +tt1069.com +tttan.com +ttvnw.net +tu8964.com +tubaholic.com +tube.com +tube8.com +tube911.com +tubecup.com +tubegals.com +tubeislam.com +tubepornclassic.com +tubestack.com +tubewolf.com +tui.orzdream.com +tuibeitu.net +tuidang.net +tuidang.org +tuidang.se +tuitwit.com +tumblr.com +tumutanzi.com +tumview.com +tunein.com +tunnelbear.com +tunnelr.com +tuo8.blue +tuo8.cc +tuo8.club +tuo8.fit +tuo8.hk +tuo8.in +tuo8.ninja +tuo8.org +tuo8.pw +tuo8.red +tuo8.space +turansam.org +turbobit.net +turbohide.com +turbotwitter.com +turntable.fm +tushycash.com +tuvpn.com +tuzaijidi.com +tv.com +tvants.com +tvboxnow.com +tvider.com +tvmost.com.hk +tvplayvideos.com +tvunetworks.com +tw-blog.com +tw-npo.org +tw.answers.yahoo.com +tw.bid.yahoo.com +tw.gigacircle.com +tw.hao123.com +tw.jiepang.com +tw.knowledge.yahoo.com +tw.mall.yahoo.com +tw.mobi.yahoo.com +tw.money.yahoo.com +tw.myblog.yahoo.com +tw.news.yahoo.com +tw.streetvoice.com +tw.tomonews.net +tw.voa.mobi +tw.yahoo.com +tw01.org +twaitter.com +twapperkeeper.com +twaud.io +twavi.com +twbbs.net.tw +twbbs.org +twbbs.tw +twblogger.com +tweepguide.com +tweeplike.me +tweepmag.com +tweepml.org +tweetbackup.com +tweetboard.com +tweetboner.biz +tweetcs.com +tweetdeck.com +tweetedtimes.com +tweetmylast.fm +tweetphoto.com +tweetrans.com +tweetree.com +tweettunnel.com +tweetwally.com +tweetymail.com +tweez.net +twelve.today +twerkingbutt.com +twftp.org +twgreatdaily.com +twibase.com +twibble.de +twibbon.com +twibs.com +twicountry.org +twicsy.com +twiends.com +twifan.com +twiffo.com +twiggit.org +twilightsex.com +twilog.org +twimbow.com +twimg.com +twindexx.com +twip.me +twipple.jp +twishort.com +twistar.cc +twister.net.co +twisterio.com +twisternow.com +twistory.net +twit2d.com +twitbrowser.net +twitcause.com +twitch.tv +twitchcdn.net +twitgether.com +twitgoo.com +twitiq.com +twitlonger.com +twitmania.com +twitoaster.com +twitonmsn.com +twitpic.com +twitstat.com +twittbot.net +twitter.com +twitter.jp +twitter4j.org +twittercounter.com +twitterfeed.com +twittergadget.com +twitterkr.com +twittermail.com +twitterrific.com +twittertim.es +twitthat.com +twitturk.com +twitturly.com +twitvid.com +twitzap.com +twiyia.com +twnorth.org.tw +twskype.com +twstar.net +twt.tl +twtkr.com +twtr2src.ogaoga.org +twtrland.com +twttr.com +twurl.nl +twyac.org +txxx.com +tycool.com +typepad.com +u9un.com +ub0.cc +ubddns.org +uberproxy.net +uc-japan.org +ucdc1998.org +uderzo.it +udn.com +uforadio.com.tw +ufreevpn.com +ug.m.wikipedia.org +ugo.com +uhdwallpapers.org +uhrp.org +uighur.narod.ru +uighur.nl +uighurbiz.net +ukcdp.co.uk +ukliferadio.co.uk +uku.im +ulike.net +ulop.net +ultravpn.fr +ultraxs.com +uluai.com.cn +unblock-us.com +unblock.cn.com +unblockdmm.com +unblocker.yt +unblocksit.es +uncyclomedia.org +uncyclopedia.hk +uncyclopedia.tw +underwoodammo.com +unholyknight.com +uni.cc +unification.net +unification.org.tw +unirule.cloud +unitedsocialpress.com +unix100.com +unknownspace.org +unodedos.com +unpo.org +unseen.is +untraceable.us +uocn.org +upcoming.yahoo.com +update.googleapis.com +updates.tdesktop.com +upholdjustice.org +upload4u.info +upmedia.mg +upornia.com +uproxy.org +upwill.org +ur7s.com +uraban.me +urbansurvival.com +urchin.com +urlborg.com +urlparser.com +us.to +usacn.com +usaip.eu +userapi.nytlog.com +usfk.mil +ushuarencity.echainhost.com +usinfo.state.gov +usma.edu +usmc.mil +usno.navy.mil +usocctn.com +ustream.tv +usunitednews.com +usus.cc +utopianpal.com +uu-gg.com +uvwxyz.xyz +uwants.com +uwants.net +uyghur-j.org +uyghur.co.uk +uyghuramerican.org +uyghurcanadiansociety.org +uyghurcongress.org +uyghurensemble.co.uk +uyghurpen.org +uyghurpress.com +uyghurstudies.org +uygur.org +v2ex.com +v2ray.com +v6.facebook.com +van001.com +van698.com +vanemu.cn +vanilla-jp.com +vanpeople.com +vansky.com +vatn.org +vcf-online.org +vcfbuilder.org +vegas.williamhill.com +vegasred.com +velkaepocha.sk +venbbs.com +venchina.com +venetianmacao.com +ventureswell.com +veoh.com +vermonttibet.org +versavpn.com +verybs.com +vevo.com +vft.com.tw +vghks.gov.tw +vghtc.gov.tw +vghtpe.gov.tw +viber.com +vica.info +victimsofcommunism.org +vid.me +vidble.com +video.aol.com +video.ap.org +video.fdbox.com +video.foxbusiness.com +video.pbs.org +video.yahoo.com +videobam.com +videodetective.com +videomega.tv +videomo.com +videopediaworld.com +videopress.com +vietdaikynguyen.com +vijayatemple.org +vimeo.com +vimperator.org +vincnd.com +vine.co +vinniev.com +vip-enterprise.com +virtualrealporn.com +visibletweets.com +vital247.org +viu.com +vivahentai4u.net +vivatube.com +vivthomas.com +vizvaz.com +vjav.com +vjmedia.com.hk +vllcs.org +vlog.xuite.net +vmixcore.com +vmpsoft.com +vn.hao123.com +vnet.link +voa-11.akacast.akamaistream.net +voacantonese.com +voachinese.com +voachineseblog.com +voagd.com +voanews.com +voatibetan.com +voatibetanenglish.com +vocativ.com +vocn.tv +vod-abematv.akamaized.net +vod.wwe.com +vot.org +vovo2000.com +voxer.com +voy.com +vpn.ac +vpn.cjb.net +vpn.cmu.edu +vpn.sv.cmu.edu +vpn4all.com +vpnaccount.org +vpnaccounts.com +vpnbook.com +vpncomparison.org +vpncoupons.com +vpncup.com +vpndada.com +vpnfan.com +vpnfire.com +vpnfires.biz +vpnforgame.net +vpngate.jp +vpngate.net +vpngratis.net +vpnhq.com +vpninja.net +vpnintouch.com +vpnintouch.net +vpnjack.com +vpnmaster.com +vpnmentor.com +vpnpick.com +vpnpop.com +vpnpronet.com +vpnreactor.com +vpnreviewz.com +vpnsecure.me +vpnshazam.com +vpnshieldapp.com +vpnsp.com +vpntraffic.com +vpntunnel.com +vpnuk.info +vpnunlimitedapp.com +vpnvip.com +vpnworldwide.com +vporn.com +vpser.net +vraiesagesse.net +vrmtr.com +vrsmash.com +vtunnel.com +vuku.cc +w3schools.com +waffle1999.com +wahas.com +waigaobu.com +wailaike.net +waiwaier.com +wallmama.com +wallornot.org +wallpapercasa.com +wallproxy.com +waltermartin.com +waltermartin.org +wanderinghorse.net +wanfang.gov.tw +wangafu.net +wangjinbo.org +wanglixiong.com +wango.org +wangruoshui.net +want-daily.com +wanz-factory.com +warbler.iconfactory.net +waselpro.com +washeng.net +watch8x.com +watchinese.com +watchmygf.net +wattpad.com +wav.tv +waveprotocol.org +waymo.com +wda.gov.tw +wdf5.com +wearehairy.com +wearn.com +web.dev +web2project.net +webbang.net +webevader.org +webfreer.com +webjb.org +weblagu.com +webmproject.org +webrtc.org +webrush.net +webs-tv.net +website.informer.com +webwarper.net +webworkerdaily.com +weekmag.info +wefightcensorship.org +wefong.com +wego.here.com +weiboleak.com +weiboscope.jmsc.hku.hk +weihuo.org +weijingsheng.org +weiming.info +weiquanwang.org +weisuo.ws +welovecock.com +wemigrate.org +wengewang.com +wengewang.org +wenhui.ch +wenxuecity.com +wenyunchao.com +wenzhao.ca +westca.com +westernshugdensociety.org +westernwolves.com +westkit.net +westpoint.edu +wetplace.com +wetpussygames.com +wexiaobo.org +wezhiyong.org +wezone.net +wforum.com +wha.la +whatblocked.com +whatbrowser.org +whatsapp.com +whatsapp.net +wheatseeds.org +wheelockslatin.com +whereiswerner.com +wheretowatch.com +whippedass.com +whitebear.freebearblog.org +whodns.xyz +whoer.net +whotalking.com +whylover.com +whyx.org +widevine.com +wikaba.com +wiki.cnitter.com +wiki.gamerp.jp +wiki.jqueryui.com +wiki.moegirl.org +wiki.oauth.net +wiki.phonegap.com +wikileaks-forum.com +wikileaks.ch +wikileaks.com +wikileaks.de +wikileaks.eu +wikileaks.lu +wikileaks.org +wikileaks.pl +wikimapia.org +wikiwiki.jp +wildammo.com +williamhill.com +willw.net +windowsphoneme.com +windscribe.com +wingamestore.com +wingy.site +winning11.com +winwhispers.info +wire.com +wiredbytes.com +wiredpen.com +wisdompubs.org +wisevid.com +withgoogle.com +withyoutube.com +witnessleeteaching.com +witopia.net +wizcrafts.net +wjbk.org +wlcnew.jigsy.com +wlx.sowiki.net +wn.com +wnacg.com +wnacg.org +wo.tc +wo3ttt.wordpress.com +woeser.com +wokar.org +wolfax.com +woolyss.com +woopie.jp +woopie.tv +wordpress.com +workatruna.com +workerdemo.org.hk +workerempowerment.org +workersthebig.net +workspace.v2ex.com +worldcat.org +worldjournal.com +worldvpn.net +wow-life.net +wow.com +wowgirls.com +wowlegacy.ml +wowporn.com +wowrk.com +woxinghuiguo.com +woyaolian.org +wozy.in +wp.com +wpoforum.com +wqyd.org +wrchina.org +wretch.cc +writer.zoho.com +wsgzao.github.io +wsj.com +wsj.net +wsjhk.com +wtbn.org +wtfpeople.com +wuerkaixi.com +wufafangwen.com +wufi.org.tw +wuguoguang.com +wujie.net +wujieliulan.com +wukangrui.net +wuu.wikipedia.org +wuw.red +wuyanblog.com +wwitv.com +www.abclite.net +www.ajsands.com +www.americorps.gov +www.antd.org +www.aolnews.com +www.citizenlab.org +www.cmoinc.org +www.dwheeler.com +www.exblog.jp +www.ftchinese.com +www.gmiddle.com +www.gmiddle.net +www.hustlercash.com +www.idlcoyote.com +www.kindleren.com +www.klip.me +www.kodingen.com +www.lamenhu.com +www.lightnovel.cn +www.linksalpha.com +www.m-sport.co.uk +www.monlamit.org +www.moztw.org +www.orchidbbs.com +www.owind.com +www.oxid.it +www.powerpointninja.com +www.s4miniarchive.com +www.shadowsocks.com +www.shwchurch.org +www.taup.org.tw +www.typepad.com +www.v2ex.com +www.wan-press.org +www.wangruowang.org +www.websnapr.com +www1.biz +wwwhost.biz +x-art.com +x-berry.com +x-wall.org +x.company +x1949x.com +x24hr.com +x365x.com +xa.yimg.com +xanga.com +xbabe.com +xbookcn.com +xbtce.com +xcafe.in +xcity.jp +xcritic.com +xerotica.com +xfinity.com +xfm.pp.ru +xgmyd.com +xhamster.com +xianba.net +xianchawang.net +xianjian.tw +xianqiao.net +xiaobaiwu.com +xiaochuncnjp.com +xiaod.in +xiaohexie.com +xiaolan.me +xiaoma.org +xiezhua.com +xihua.es +xijie.wordpress.com +xing.com +xinhuanet.org +xinmiao.com.hk +xinqimeng.over-blog.com +xinsheng.net +xinshijue.com +xinyubbs.net +xiongpian.com +xiuren.org +xizang-zhiye.org +xjp.cc +xjtravelguide.com +xlfmtalk.com +xlfmwz.info +xm.com +xml-training-guide.com +xmovies.com +xn--4gq171p.com +xn--czq75pvv1aj5c.org +xn--i2ru8q2qg.com +xn--ngstr-lra8j.com +xn--oiq.cc +xn--p8j9a0d9c9a.xn--q9jyb4c +xnxx.com +xpdo.net +xpud.org +xrentdvd.com +xskywalker.com +xskywalker.net +xtube.com +xuchao.net +xuchao.org +xuehua.us +xuzhiyong.net +xvideo.cc +xvideos.com +xvideos.es +xx.wwwhost.biz +xxbbx.com +xxlmovies.com +xxuz.com +xxx.com +xxx.xxx +xxxfuckmom.com +xxxx.com.au +xxxy.biz +xxxy.info +xxxymovies.com +xys.dxiong.com +xys.org +xysblogs.org +xyy69.com +xyy69.info +yahoo.cn +yahoo.com.hk +yakbutterblues.com +yam.com +yam.org.tw +yanghengjun.com +yangjianli.com +yasni.co.uk +yatsen.gov.tw +yda.gov.tw +ydy.com +yeahteentube.com +yecl.net +yeelou.com +yeeyi.com +yegle.net +yes-news.com +yes.xxx +yes123.com.tw +yesasia.com +yespornplease.com +yeyeclub.com +ygto.com +yhcw.net +yibada.com +yibaochina.com +yidio.com +yilubbs.com +yingsuoss.com +yipub.com +yizhihongxing.com +yobit.net +yobt.com +yobt.tv +yogichen.org +yolasite.com +yomiuri.co.jp +yong.hu +yorkbbs.ca +youdontcare.com +youjizz.com +youmaker.com +youngpornvideos.com +youngspiration.hk +youpai.org +youporn.com +youporngay.com +your-freedom.net +yourepeat.com +yourlisten.com +yourlust.com +yourprivatevpn.com +yourtrap.com +yousendit.com +youshun12.com +youtu.be +youtube-nocookie.com +youtube.com +youtubecn.com +youtubeeducation.com +youtubegaming.com +youversion.com +youwin.com +youxu.info +yt.be +ytht.net +ytimg.com +ytn.co.kr +yuanming.net +yuanzhengtang.org +yulghun.com +yunchao.net +yuntipub.com +yuvutu.com +yvesgeleyn.com +yx51.net +yyii.org +yzzk.com +zacebook.com +zalmos.com +zannel.com +zaobao.com +zaozon.com +zapto.org +zattoo.com +zb.com +zdnet.com.tw +zello.com +zengjinyan.org +zenmate.com +zeronet.io +zeutch.com +zfreet.com +zgsddh.com +zgzcjj.net +zh-yue.wikipedia.org +zh.bitterwinter.org +zh.ecdm.wikia.com +zh.m.wikipedia.org +zh.pokerstrategy.com +zh.uncyclopedia.wikia.com +zh.wikinews.org +zh.wikipedia.org +zh.wikisource.org +zhanbin.net +zhangboli.net +zhangtianliang.com +zhanlve.org +zhao.1984.city +zhao.jinhai.de +zhenghui.org +zhengjian.org +zhengwunet.org +zhenlibu.info +zhenlibu1984.com +zhenxiang.biz +zhinengluyou.com +zhongguo.ca +zhongguorenquan.org +zhongguotese.net +zhongmeng.org +zhoushuguang.com +zhreader.com +zhuangbi.me +zhuanxing.cn +zhuatieba.com +zhuichaguoji.org +zillionk.com +zim.vn +zinio.com +ziporn.com +zippyshare.com +zkaip.com +zmw.cn +zodgame.us +zomobo.net +zonaeuropa.com +zonghexinwen.com +zonghexinwen.net +zoogvpn.com +zootool.com +zoozle.net +zorrovpn.com +zozotown.com +zpn.im +zspeeder.me +zsrhao.com +zuo.la +zuobiao.me +zuola.com +zvereff.com +zynaima.com +zynamics.com +zyns.com +zyzc9.com +zzcartoon.com +zzux.com diff --git a/package/lean/luci-app-mwan3helper/root/etc/mwan3helper/gwbn.txt b/package/lean/luci-app-mwan3helper/root/etc/mwan3helper/gwbn.txt new file mode 100644 index 00000000000000..21021c28aed8fb --- /dev/null +++ b/package/lean/luci-app-mwan3helper/root/etc/mwan3helper/gwbn.txt @@ -0,0 +1,94 @@ +42.196.0.0/14 +43.242.56.0/22 +43.242.144.0/22 +43.243.148.0/22 +43.247.208.0/22 +45.252.152.0/22 +45.252.200.0/22 +45.252.204.0/22 +45.252.208.0/22 +45.252.212.0/22 +45.252.216.0/22 +45.252.220.0/22 +45.252.224.0/22 +45.253.0.0/22 +45.253.4.0/22 +45.253.8.0/22 +45.253.12.0/22 +45.253.16.0/22 +45.253.20.0/22 +45.253.28.0/22 +45.253.36.0/22 +45.253.40.0/22 +45.253.56.0/22 +45.253.76.0/22 +45.253.80.0/22 +45.253.84.0/22 +45.253.92.0/22 +45.254.28.0/22 +45.254.56.0/22 +45.254.96.0/22 +45.254.132.0/22 +45.254.152.0/22 +45.254.180.0/22 +45.254.200.0/22 +45.254.204.0/22 +45.254.208.0/22 +45.254.212.0/22 +45.254.216.0/22 +45.254.220.0/22 +45.254.224.0/22 +45.254.228.0/22 +49.220.0.0/14 +101.130.0.0/15 +101.244.0.0/14 +103.23.56.0/22 +103.24.184.0/22 +103.38.0.0/22 +103.38.232.0/22 +103.221.88.0/22 +103.221.132.0/22 +103.221.156.0/22 +103.221.180.0/22 +103.221.184.0/22 +103.221.188.0/22 +103.221.192.0/22 +103.221.196.0/22 +103.222.0.0/22 +103.222.4.0/22 +103.222.8.0/22 +103.222.12.0/22 +103.222.16.0/22 +103.222.24.0/22 +103.222.28.0/22 +103.222.36.0/22 +103.222.44.0/22 +103.222.48.0/22 +103.222.56.0/22 +103.222.60.0/22 +103.222.64.0/22 +103.222.68.0/22 +103.222.72.0/22 +103.222.76.0/22 +103.222.80.0/22 +103.222.84.0/22 +103.222.88.0/22 +103.222.92.0/22 +103.222.96.0/22 +103.222.100.0/22 +103.222.104.0/22 +103.222.108.0/22 +103.222.200.0/22 +103.222.204.0/22 +103.222.208.0/22 +103.222.212.0/22 +115.190.0.0/15 +124.14.0.0/15 +124.254.0.0/18 +175.188.0.0/14 +180.88.0.0/14 +203.82.112.0/22 +203.86.64.0/20 +211.164.0.0/14 +220.112.0.0/14 +223.208.0.0/14 diff --git a/package/lean/luci-app-mwan3helper/root/etc/mwan3helper/othernet.txt b/package/lean/luci-app-mwan3helper/root/etc/mwan3helper/othernet.txt new file mode 100644 index 00000000000000..fdf3ade44066fd --- /dev/null +++ b/package/lean/luci-app-mwan3helper/root/etc/mwan3helper/othernet.txt @@ -0,0 +1,5134 @@ +1.1.8.0/24 +1.2.2.0/24 +1.2.4.0/24 +1.2.8.0/24 +1.4.4.0/24 +1.8.0.0/16 +1.12.0.0/14 +1.45.0.0/16 +1.88.0.0/14 +1.92.0.0/15 +1.94.0.0/15 +1.118.0.0/16 +1.119.0.0/17 +1.119.128.0/17 +14.1.24.0/22 +14.1.96.0/22 +14.1.108.0/22 +14.102.156.0/22 +14.102.180.0/22 +14.103.0.0/16 +14.130.0.0/15 +14.192.60.0/22 +14.196.0.0/15 +27.0.160.0/22 +27.0.164.0/22 +27.0.188.0/22 +27.0.204.0/22 +27.0.208.0/22 +27.0.212.0/22 +27.98.208.0/20 +27.99.128.0/17 +27.103.0.0/16 +27.106.128.0/18 +27.106.204.0/22 +27.109.32.0/19 +27.109.124.0/22 +27.112.80.0/20 +27.112.112.0/22 +27.112.116.0/22 +27.113.128.0/18 +27.116.44.0/22 +27.123.232.0/22 +27.131.220.0/22 +27.144.0.0/16 +36.0.8.0/21 +36.0.64.0/18 +36.0.128.0/17 +36.36.0.0/16 +36.51.0.0/16 +36.254.0.0/16 +36.255.116.0/22 +36.255.128.0/22 +36.255.164.0/22 +36.255.172.0/22 +36.255.176.0/22 +36.255.220.0/22 +39.96.0.0/13 +39.104.0.0/14 +39.108.0.0/16 +40.72.0.0/15 +40.125.128.0/17 +40.126.64.0/18 +42.0.128.0/17 +42.50.0.0/16 +42.62.0.0/17 +42.83.128.0/17 +42.96.128.0/17 +42.120.0.0/15 +42.123.128.0/17 +42.128.0.0/12 +42.156.128.0/17 +42.157.0.0/16 +42.158.0.0/16 +42.159.0.0/16 +42.160.0.0/12 +42.186.0.0/16 +42.187.128.0/17 +42.192.0.0/15 +42.194.12.0/22 +42.194.128.0/17 +42.195.0.0/16 +42.201.0.0/17 +42.204.0.0/14 +42.208.0.0/12 +42.240.0.0/17 +42.240.128.0/17 +43.224.44.0/22 +43.224.64.0/22 +43.224.68.0/22 +43.224.72.0/22 +43.224.100.0/22 +43.224.144.0/22 +43.224.176.0/22 +43.224.184.0/22 +43.224.200.0/22 +43.224.204.0/22 +43.224.212.0/22 +43.224.216.0/22 +43.224.240.0/22 +43.225.76.0/22 +43.225.84.0/22 +43.225.124.0/22 +43.225.140.0/22 +43.225.172.0/22 +43.225.180.0/22 +43.225.208.0/22 +43.225.216.0/22 +43.225.220.0/22 +43.225.224.0/22 +43.225.228.0/22 +43.225.232.0/22 +43.225.236.0/22 +43.225.240.0/22 +43.225.244.0/22 +43.225.252.0/22 +43.226.32.0/22 +43.226.36.0/22 +43.226.40.0/22 +43.226.44.0/22 +43.226.48.0/22 +43.226.52.0/22 +43.226.56.0/22 +43.226.60.0/22 +43.226.64.0/22 +43.226.68.0/22 +43.226.72.0/22 +43.226.76.0/22 +43.226.80.0/22 +43.226.84.0/22 +43.226.88.0/22 +43.226.92.0/22 +43.226.112.0/22 +43.226.128.0/22 +43.226.132.0/22 +43.226.136.0/22 +43.226.140.0/22 +43.226.144.0/22 +43.226.148.0/22 +43.226.152.0/22 +43.226.156.0/22 +43.226.168.0/22 +43.226.172.0/22 +43.226.176.0/22 +43.226.180.0/22 +43.226.184.0/22 +43.226.188.0/22 +43.226.192.0/22 +43.226.196.0/22 +43.226.200.0/22 +43.226.204.0/22 +43.226.208.0/22 +43.226.212.0/22 +43.226.240.0/22 +43.226.244.0/22 +43.226.248.0/22 +43.226.252.0/22 +43.227.0.0/22 +43.227.4.0/22 +43.227.8.0/22 +43.227.32.0/22 +43.227.36.0/22 +43.227.40.0/22 +43.227.44.0/22 +43.227.48.0/22 +43.227.52.0/22 +43.227.56.0/22 +43.227.60.0/22 +43.227.64.0/22 +43.227.68.0/22 +43.227.72.0/22 +43.227.76.0/22 +43.227.80.0/22 +43.227.84.0/22 +43.227.88.0/22 +43.227.92.0/22 +43.227.96.0/22 +43.227.100.0/22 +43.227.136.0/22 +43.227.140.0/22 +43.227.144.0/22 +43.227.152.0/22 +43.227.156.0/22 +43.227.160.0/22 +43.227.164.0/22 +43.227.168.0/22 +43.227.172.0/22 +43.227.176.0/22 +43.227.180.0/22 +43.227.188.0/22 +43.227.192.0/22 +43.227.196.0/22 +43.227.200.0/22 +43.227.204.0/22 +43.227.208.0/22 +43.227.212.0/22 +43.227.216.0/22 +43.227.220.0/22 +43.227.232.0/22 +43.227.248.0/22 +43.227.252.0/22 +43.228.0.0/22 +43.228.4.0/22 +43.228.8.0/22 +43.228.12.0/22 +43.228.16.0/22 +43.228.20.0/22 +43.228.24.0/22 +43.228.28.0/22 +43.228.32.0/22 +43.228.36.0/22 +43.228.40.0/22 +43.228.44.0/22 +43.228.48.0/22 +43.228.52.0/22 +43.228.56.0/22 +43.228.60.0/22 +43.228.64.0/22 +43.228.68.0/22 +43.228.76.0/22 +43.228.100.0/22 +43.228.116.0/22 +43.228.120.0/22 +43.228.132.0/22 +43.228.136.0/22 +43.228.148.0/22 +43.228.152.0/22 +43.228.188.0/22 +43.229.16.0/22 +43.229.40.0/22 +43.229.48.0/22 +43.229.56.0/22 +43.229.96.0/22 +43.229.120.0/22 +43.229.136.0/22 +43.229.140.0/22 +43.229.144.0/22 +43.229.184.0/22 +43.229.188.0/22 +43.229.192.0/22 +43.229.196.0/22 +43.229.216.0/22 +43.229.220.0/22 +43.229.232.0/22 +43.230.20.0/22 +43.230.32.0/22 +43.230.68.0/22 +43.230.72.0/22 +43.230.84.0/22 +43.230.124.0/22 +43.230.136.0/22 +43.230.168.0/22 +43.230.220.0/22 +43.230.224.0/22 +43.230.228.0/22 +43.230.232.0/22 +43.230.236.0/22 +43.230.240.0/22 +43.230.244.0/22 +43.230.248.0/22 +43.230.252.0/22 +43.231.32.0/22 +43.231.36.0/22 +43.231.40.0/22 +43.231.44.0/22 +43.231.80.0/22 +43.231.84.0/22 +43.231.88.0/22 +43.231.92.0/22 +43.231.96.0/22 +43.231.100.0/22 +43.231.104.0/22 +43.231.108.0/22 +43.231.136.0/22 +43.231.140.0/22 +43.231.144.0/22 +43.231.148.0/22 +43.231.152.0/22 +43.231.156.0/22 +43.231.160.0/22 +43.231.164.0/22 +43.231.168.0/22 +43.231.172.0/22 +43.231.176.0/22 +43.231.180.0/22 +43.236.0.0/22 +43.236.4.0/22 +43.236.8.0/22 +43.236.12.0/22 +43.236.16.0/22 +43.236.20.0/22 +43.236.24.0/22 +43.236.28.0/22 +43.236.32.0/22 +43.236.36.0/22 +43.236.40.0/22 +43.236.44.0/22 +43.236.48.0/22 +43.236.52.0/22 +43.236.56.0/22 +43.236.60.0/22 +43.236.64.0/22 +43.236.68.0/22 +43.236.72.0/22 +43.236.76.0/22 +43.236.80.0/22 +43.236.84.0/22 +43.236.88.0/22 +43.236.92.0/22 +43.236.96.0/22 +43.236.100.0/22 +43.236.104.0/22 +43.236.108.0/22 +43.236.112.0/22 +43.236.116.0/22 +43.236.120.0/22 +43.236.124.0/22 +43.236.128.0/22 +43.236.132.0/22 +43.236.136.0/22 +43.236.140.0/22 +43.236.144.0/22 +43.236.148.0/22 +43.236.152.0/22 +43.236.156.0/22 +43.236.160.0/22 +43.236.164.0/22 +43.236.168.0/22 +43.236.172.0/22 +43.236.176.0/22 +43.236.180.0/22 +43.236.184.0/22 +43.236.188.0/22 +43.236.192.0/22 +43.236.196.0/22 +43.236.200.0/22 +43.236.204.0/22 +43.236.208.0/22 +43.236.212.0/22 +43.236.216.0/22 +43.236.220.0/22 +43.236.224.0/22 +43.236.228.0/22 +43.236.232.0/22 +43.236.236.0/22 +43.236.240.0/22 +43.236.244.0/22 +43.236.248.0/22 +43.236.252.0/22 +43.237.0.0/22 +43.237.4.0/22 +43.237.8.0/22 +43.237.12.0/22 +43.237.16.0/22 +43.237.20.0/22 +43.237.24.0/22 +43.237.28.0/22 +43.237.32.0/22 +43.237.36.0/22 +43.237.40.0/22 +43.237.44.0/22 +43.237.48.0/22 +43.237.52.0/22 +43.237.56.0/22 +43.237.60.0/22 +43.237.64.0/22 +43.237.68.0/22 +43.237.72.0/22 +43.237.76.0/22 +43.237.80.0/22 +43.237.84.0/22 +43.237.88.0/22 +43.237.92.0/22 +43.237.96.0/22 +43.237.100.0/22 +43.237.104.0/22 +43.237.108.0/22 +43.237.112.0/22 +43.237.116.0/22 +43.237.120.0/22 +43.237.124.0/22 +43.237.128.0/22 +43.237.132.0/22 +43.237.136.0/22 +43.237.140.0/22 +43.237.144.0/22 +43.237.148.0/22 +43.237.152.0/22 +43.237.156.0/22 +43.237.160.0/22 +43.237.164.0/22 +43.237.168.0/22 +43.237.172.0/22 +43.237.176.0/22 +43.237.180.0/22 +43.237.184.0/22 +43.237.188.0/22 +43.237.192.0/22 +43.237.196.0/22 +43.237.200.0/22 +43.237.204.0/22 +43.237.208.0/22 +43.237.212.0/22 +43.237.216.0/22 +43.237.220.0/22 +43.237.224.0/22 +43.237.228.0/22 +43.237.232.0/22 +43.237.236.0/22 +43.237.240.0/22 +43.237.244.0/22 +43.237.248.0/22 +43.237.252.0/22 +43.238.0.0/22 +43.238.4.0/22 +43.238.8.0/22 +43.238.12.0/22 +43.238.16.0/22 +43.238.20.0/22 +43.238.24.0/22 +43.238.28.0/22 +43.238.32.0/22 +43.238.36.0/22 +43.238.40.0/22 +43.238.44.0/22 +43.238.48.0/22 +43.238.52.0/22 +43.238.56.0/22 +43.238.60.0/22 +43.238.64.0/22 +43.238.68.0/22 +43.238.72.0/22 +43.238.76.0/22 +43.238.80.0/22 +43.238.84.0/22 +43.238.88.0/22 +43.238.92.0/22 +43.238.96.0/22 +43.238.100.0/22 +43.238.104.0/22 +43.238.108.0/22 +43.238.112.0/22 +43.238.116.0/22 +43.238.120.0/22 +43.238.124.0/22 +43.238.128.0/22 +43.238.132.0/22 +43.238.136.0/22 +43.238.140.0/22 +43.238.144.0/22 +43.238.148.0/22 +43.238.152.0/22 +43.238.156.0/22 +43.238.160.0/22 +43.238.164.0/22 +43.238.168.0/22 +43.238.172.0/22 +43.238.176.0/22 +43.238.180.0/22 +43.238.184.0/22 +43.238.188.0/22 +43.238.192.0/22 +43.238.196.0/22 +43.238.200.0/22 +43.238.204.0/22 +43.238.208.0/22 +43.238.212.0/22 +43.238.216.0/22 +43.238.220.0/22 +43.238.224.0/22 +43.238.228.0/22 +43.238.232.0/22 +43.238.236.0/22 +43.238.240.0/22 +43.238.244.0/22 +43.238.248.0/22 +43.238.252.0/22 +43.239.0.0/22 +43.239.4.0/22 +43.239.8.0/21 +43.239.16.0/22 +43.239.20.0/22 +43.239.24.0/22 +43.239.28.0/22 +43.239.32.0/22 +43.239.36.0/22 +43.239.40.0/22 +43.239.44.0/22 +43.239.48.0/22 +43.239.116.0/22 +43.239.176.0/22 +43.240.48.0/22 +43.240.56.0/22 +43.240.60.0/22 +43.240.68.0/22 +43.240.76.0/22 +43.240.84.0/22 +43.240.124.0/22 +43.240.128.0/22 +43.240.136.0/22 +43.240.156.0/22 +43.240.160.0/22 +43.240.164.0/22 +43.240.168.0/22 +43.240.172.0/22 +43.240.176.0/22 +43.240.180.0/22 +43.240.184.0/22 +43.240.188.0/22 +43.240.200.0/22 +43.240.208.0/22 +43.240.212.0/22 +43.240.216.0/22 +43.240.220.0/22 +43.240.236.0/22 +43.240.240.0/22 +43.240.244.0/22 +43.240.248.0/22 +43.240.252.0/22 +43.241.0.0/22 +43.241.4.0/22 +43.241.8.0/22 +43.241.12.0/22 +43.241.16.0/22 +43.241.20.0/22 +43.241.76.0/22 +43.241.80.0/22 +43.241.84.0/22 +43.241.88.0/22 +43.241.112.0/22 +43.241.168.0/22 +43.241.172.0/22 +43.241.176.0/22 +43.241.180.0/22 +43.241.196.0/22 +43.241.208.0/22 +43.241.212.0/22 +43.241.216.0/22 +43.241.220.0/22 +43.241.224.0/22 +43.241.228.0/22 +43.241.232.0/22 +43.241.236.0/22 +43.241.240.0/22 +43.241.248.0/22 +43.241.252.0/22 +43.242.8.0/22 +43.242.12.0/22 +43.242.16.0/22 +43.242.20.0/22 +43.242.24.0/22 +43.242.28.0/22 +43.242.44.0/22 +43.242.48.0/22 +43.242.52.0/22 +43.242.60.0/22 +43.242.72.0/22 +43.242.76.0/22 +43.242.80.0/22 +43.242.84.0/22 +43.242.88.0/22 +43.242.92.0/22 +43.242.96.0/22 +43.242.160.0/22 +43.242.168.0/22 +43.242.188.0/22 +43.242.196.0/22 +43.242.204.0/22 +43.242.216.0/22 +43.242.220.0/22 +43.242.252.0/22 +43.243.8.0/22 +43.243.12.0/22 +43.243.24.0/22 +43.243.136.0/22 +43.243.144.0/22 +43.243.168.0/22 +43.243.188.0/22 +43.243.244.0/22 +43.246.0.0/22 +43.246.4.0/22 +43.246.8.0/22 +43.246.12.0/22 +43.246.16.0/22 +43.246.20.0/22 +43.246.24.0/22 +43.246.28.0/22 +43.246.32.0/22 +43.246.36.0/22 +43.246.40.0/22 +43.246.44.0/22 +43.246.48.0/22 +43.246.52.0/22 +43.246.56.0/22 +43.246.60.0/22 +43.246.64.0/22 +43.246.68.0/22 +43.246.72.0/22 +43.246.76.0/22 +43.246.80.0/22 +43.246.84.0/22 +43.246.88.0/22 +43.246.92.0/22 +43.246.96.0/22 +43.246.212.0/22 +43.246.228.0/22 +43.247.4.0/22 +43.247.8.0/22 +43.247.44.0/22 +43.247.48.0/22 +43.247.68.0/22 +43.247.76.0/22 +43.247.84.0/22 +43.247.96.0/22 +43.247.100.0/22 +43.247.108.0/22 +43.247.112.0/22 +43.247.148.0/22 +43.247.152.0/22 +43.247.176.0/22 +43.247.180.0/22 +43.247.184.0/22 +43.247.188.0/22 +43.247.196.0/22 +43.247.200.0/22 +43.247.204.0/22 +43.247.220.0/22 +43.247.224.0/22 +43.247.228.0/22 +43.247.232.0/22 +43.247.236.0/22 +43.247.244.0/22 +43.247.248.0/22 +43.247.252.0/22 +43.248.0.0/22 +43.248.28.0/22 +43.248.76.0/22 +43.248.96.0/22 +43.248.100.0/22 +43.248.104.0/22 +43.248.112.0/22 +43.248.116.0/22 +43.248.120.0/22 +43.248.124.0/22 +43.248.128.0/22 +43.248.132.0/22 +43.248.136.0/22 +43.248.140.0/22 +43.248.144.0/22 +43.248.208.0/22 +43.248.228.0/22 +43.248.232.0/22 +43.249.8.0/22 +43.249.24.0/22 +43.249.120.0/22 +43.249.132.0/22 +43.249.148.0/22 +43.249.152.0/22 +43.249.156.0/22 +43.249.160.0/22 +43.249.164.0/22 +43.249.168.0/22 +43.250.12.0/22 +43.250.16.0/22 +43.250.20.0/22 +43.250.28.0/22 +43.250.36.0/22 +43.250.72.0/22 +43.250.100.0/22 +43.250.104.0/22 +43.250.108.0/22 +43.250.116.0/22 +43.250.148.0/22 +43.250.160.0/22 +43.250.172.0/22 +43.250.176.0/22 +43.250.216.0/22 +43.250.220.0/22 +43.250.236.0/22 +43.251.8.0/22 +43.251.12.0/22 +43.251.100.0/22 +43.251.116.0/22 +43.251.192.0/22 +43.251.236.0/22 +43.252.40.0/22 +43.252.48.0/22 +43.252.56.0/22 +43.252.224.0/22 +43.254.0.0/22 +43.254.4.0/22 +43.254.8.0/22 +43.254.24.0/22 +43.254.36.0/22 +43.254.64.0/22 +43.254.72.0/22 +43.254.84.0/22 +43.254.88.0/22 +43.254.92.0/22 +43.254.100.0/22 +43.254.112.0/22 +43.254.128.0/22 +43.254.140.0/22 +43.254.152.0/22 +43.254.156.0/22 +43.254.168.0/22 +43.254.172.0/22 +43.254.180.0/22 +43.254.184.0/22 +43.254.188.0/22 +43.254.192.0/22 +43.254.196.0/22 +43.254.200.0/22 +43.254.208.0/22 +43.254.224.0/22 +43.254.228.0/22 +43.254.232.0/22 +43.254.236.0/22 +43.254.240.0/22 +43.254.248.0/22 +43.254.252.0/22 +43.255.0.0/22 +43.255.4.0/22 +43.255.8.0/22 +43.255.16.0/22 +43.255.48.0/22 +43.255.64.0/22 +43.255.68.0/22 +43.255.72.0/22 +43.255.76.0/22 +43.255.96.0/22 +43.255.108.0/22 +43.255.144.0/22 +43.255.168.0/22 +43.255.176.0/22 +43.255.184.0/22 +43.255.192.0/22 +43.255.200.0/22 +43.255.208.0/22 +43.255.212.0/22 +43.255.224.0/22 +43.255.228.0/22 +43.255.232.0/22 +43.255.244.0/22 +45.40.192.0/18 +45.65.16.0/22 +45.65.20.0/22 +45.65.24.0/22 +45.65.28.0/22 +45.112.132.0/22 +45.112.188.0/22 +45.112.208.0/22 +45.112.212.0/22 +45.112.216.0/22 +45.112.220.0/22 +45.112.236.0/22 +45.113.12.0/22 +45.113.16.0/22 +45.113.20.0/22 +45.113.40.0/22 +45.113.52.0/22 +45.113.56.0/22 +45.113.72.0/22 +45.113.144.0/22 +45.113.148.0/22 +45.113.168.0/22 +45.113.176.0/22 +45.113.184.0/22 +45.113.204.0/22 +45.113.208.0/22 +45.113.212.0/22 +45.113.216.0/22 +45.113.220.0/22 +45.114.0.0/22 +45.114.12.0/22 +45.114.32.0/22 +45.114.40.0/22 +45.114.52.0/22 +45.114.96.0/22 +45.114.104.0/22 +45.114.108.0/22 +45.114.124.0/22 +45.114.136.0/22 +45.114.196.0/22 +45.114.200.0/22 +45.114.228.0/22 +45.115.44.0/22 +45.115.100.0/22 +45.115.120.0/22 +45.115.132.0/22 +45.115.212.0/22 +45.115.228.0/22 +45.115.236.0/22 +45.115.244.0/22 +45.116.12.0/22 +45.116.16.0/22 +45.116.24.0/22 +45.116.32.0/22 +45.116.36.0/22 +45.116.52.0/22 +45.116.96.0/22 +45.116.100.0/22 +45.116.140.0/22 +45.116.152.0/22 +45.116.208.0/22 +45.117.20.0/22 +45.117.68.0/22 +45.117.252.0/22 +45.119.52.0/22 +45.119.60.0/22 +45.119.72.0/22 +45.119.104.0/22 +45.119.116.0/22 +45.119.232.0/22 +45.120.140.0/22 +45.120.164.0/22 +45.120.220.0/22 +45.120.240.0/22 +45.121.20.0/22 +45.121.64.0/22 +45.121.92.0/22 +45.121.104.0/22 +45.121.212.0/22 +45.121.240.0/22 +45.121.244.0/22 +45.121.248.0/22 +45.121.252.0/22 +45.122.0.0/22 +45.122.4.0/22 +45.122.8.0/22 +45.122.12.0/22 +45.122.16.0/22 +45.122.20.0/22 +45.122.24.0/22 +45.122.28.0/22 +45.122.32.0/22 +45.122.36.0/22 +45.122.40.0/22 +45.122.60.0/22 +45.122.64.0/22 +45.122.68.0/22 +45.122.72.0/22 +45.122.76.0/22 +45.122.80.0/22 +45.122.84.0/22 +45.122.88.0/22 +45.122.92.0/22 +45.122.104.0/22 +45.122.108.0/22 +45.122.112.0/22 +45.122.116.0/22 +45.122.160.0/22 +45.122.164.0/22 +45.122.168.0/22 +45.122.172.0/22 +45.122.176.0/22 +45.122.180.0/22 +45.122.184.0/22 +45.122.188.0/22 +45.122.192.0/22 +45.122.196.0/22 +45.122.200.0/22 +45.122.204.0/22 +45.122.208.0/22 +45.122.212.0/22 +45.122.216.0/22 +45.123.28.0/22 +45.123.32.0/22 +45.123.36.0/22 +45.123.44.0/22 +45.123.48.0/22 +45.123.52.0/22 +45.123.56.0/22 +45.123.60.0/22 +45.123.64.0/22 +45.123.68.0/22 +45.123.72.0/22 +45.123.76.0/22 +45.123.80.0/22 +45.123.84.0/22 +45.123.88.0/22 +45.123.120.0/22 +45.123.128.0/22 +45.123.132.0/22 +45.123.136.0/22 +45.123.148.0/22 +45.123.164.0/22 +45.123.168.0/22 +45.123.172.0/22 +45.123.176.0/22 +45.123.180.0/22 +45.123.184.0/22 +45.123.204.0/22 +45.123.212.0/22 +45.123.224.0/22 +45.123.228.0/22 +45.123.232.0/22 +45.123.236.0/22 +45.123.240.0/22 +45.123.244.0/22 +45.123.248.0/22 +45.123.252.0/22 +45.124.0.0/22 +45.124.28.0/22 +45.124.32.0/22 +45.124.44.0/22 +45.124.76.0/22 +45.124.100.0/22 +45.124.124.0/22 +45.124.172.0/22 +45.124.176.0/22 +45.124.208.0/22 +45.124.248.0/22 +45.124.252.0/22 +45.125.12.0/22 +45.125.16.0/22 +45.125.28.0/22 +45.125.32.0/22 +45.125.52.0/22 +45.125.56.0/22 +45.125.76.0/22 +45.125.80.0/22 +45.125.84.0/22 +45.125.88.0/22 +45.125.92.0/22 +45.125.96.0/22 +45.125.100.0/22 +45.125.104.0/22 +45.125.136.0/22 +45.126.48.0/22 +45.126.52.0/22 +45.126.100.0/22 +45.126.112.0/22 +45.126.116.0/22 +45.126.212.0/22 +45.126.220.0/22 +45.127.8.0/22 +45.127.12.0/22 +45.127.96.0/22 +45.127.116.0/22 +45.127.124.0/22 +45.127.128.0/22 +45.127.144.0/22 +45.127.148.0/22 +45.127.156.0/22 +45.127.216.0/22 +45.248.80.0/22 +45.248.84.0/22 +45.248.88.0/22 +45.248.96.0/22 +45.248.100.0/22 +45.248.104.0/22 +45.248.108.0/22 +45.248.128.0/22 +45.248.132.0/22 +45.248.204.0/22 +45.248.208.0/22 +45.248.212.0/22 +45.248.216.0/22 +45.248.220.0/22 +45.248.224.0/22 +45.248.228.0/22 +45.248.232.0/22 +45.248.236.0/22 +45.248.240.0/22 +45.248.244.0/22 +45.248.248.0/22 +45.248.252.0/22 +45.249.0.0/22 +45.249.4.0/22 +45.249.12.0/22 +45.249.16.0/22 +45.249.20.0/22 +45.249.24.0/22 +45.249.28.0/22 +45.249.32.0/22 +45.249.36.0/22 +45.249.92.0/22 +45.249.180.0/22 +45.249.188.0/22 +45.249.192.0/22 +45.249.196.0/22 +45.249.200.0/22 +45.249.204.0/22 +45.249.208.0/22 +45.249.212.0/22 +45.250.28.0/22 +45.250.152.0/22 +45.250.164.0/22 +45.250.180.0/22 +45.250.184.0/22 +45.250.188.0/22 +45.250.192.0/22 +45.251.0.0/22 +45.251.8.0/22 +45.251.20.0/22 +45.251.52.0/22 +45.251.92.0/22 +45.251.96.0/22 +45.251.100.0/22 +45.251.120.0/22 +45.251.124.0/22 +45.251.136.0/22 +45.251.140.0/22 +45.251.144.0/22 +45.251.148.0/22 +45.251.152.0/22 +45.251.156.0/22 +45.251.160.0/22 +45.251.164.0/22 +45.251.168.0/22 +45.251.172.0/22 +45.251.176.0/22 +45.251.180.0/22 +45.251.184.0/22 +45.251.188.0/22 +45.251.192.0/22 +45.251.196.0/22 +45.251.200.0/22 +45.251.204.0/22 +45.251.208.0/22 +45.251.212.0/22 +45.251.216.0/22 +45.251.220.0/22 +45.251.224.0/22 +45.251.240.0/22 +45.252.0.0/22 +45.252.4.0/22 +45.252.8.0/22 +45.252.12.0/22 +45.252.16.0/22 +45.252.20.0/22 +45.252.24.0/22 +45.252.28.0/22 +45.252.32.0/22 +45.252.36.0/22 +45.252.40.0/22 +45.252.44.0/22 +45.252.48.0/22 +45.252.60.0/22 +45.252.84.0/22 +45.252.88.0/22 +45.252.92.0/22 +45.252.96.0/22 +45.252.100.0/22 +45.252.108.0/22 +45.252.112.0/22 +45.252.116.0/22 +45.252.120.0/22 +45.252.124.0/22 +45.252.128.0/22 +45.252.132.0/22 +45.252.136.0/22 +45.252.140.0/22 +45.252.144.0/22 +45.252.148.0/22 +45.252.156.0/22 +45.252.160.0/22 +45.252.164.0/22 +45.252.168.0/22 +45.252.172.0/22 +45.252.176.0/22 +45.252.192.0/22 +45.252.196.0/22 +45.252.228.0/22 +45.252.232.0/22 +45.253.44.0/22 +45.253.48.0/22 +45.253.52.0/22 +45.253.60.0/22 +45.253.68.0/22 +45.253.96.0/22 +45.253.100.0/22 +45.253.104.0/22 +45.253.108.0/22 +45.253.112.0/22 +45.253.116.0/22 +45.253.120.0/22 +45.253.132.0/22 +45.253.136.0/22 +45.253.140.0/22 +45.253.144.0/22 +45.253.148.0/22 +45.253.152.0/22 +45.253.156.0/22 +45.253.160.0/22 +45.253.164.0/22 +45.253.168.0/22 +45.253.172.0/22 +45.253.176.0/22 +45.253.180.0/22 +45.253.184.0/22 +45.253.188.0/22 +45.253.192.0/22 +45.253.196.0/22 +45.253.200.0/22 +45.253.204.0/22 +45.253.208.0/22 +45.253.212.0/22 +45.253.216.0/22 +45.253.220.0/22 +45.253.224.0/22 +45.253.228.0/22 +45.253.232.0/22 +45.253.236.0/22 +45.253.240.0/22 +45.253.244.0/22 +45.253.248.0/22 +45.253.252.0/22 +45.254.0.0/22 +45.254.4.0/22 +45.254.8.0/22 +45.254.12.0/22 +45.254.16.0/22 +45.254.20.0/22 +45.254.24.0/22 +45.254.40.0/22 +45.254.48.0/22 +45.254.52.0/22 +45.254.60.0/22 +45.254.64.0/22 +45.254.68.0/22 +45.254.72.0/22 +45.254.76.0/22 +45.254.80.0/22 +45.254.84.0/22 +45.254.88.0/22 +45.254.92.0/22 +45.254.100.0/22 +45.254.104.0/22 +45.254.108.0/22 +45.254.112.0/22 +45.254.116.0/22 +45.254.120.0/22 +45.254.124.0/22 +45.254.128.0/22 +45.254.136.0/22 +45.254.140.0/22 +45.254.144.0/22 +45.254.148.0/22 +45.254.156.0/22 +45.254.160.0/22 +45.254.164.0/22 +45.254.168.0/22 +45.254.172.0/22 +45.254.176.0/22 +45.254.184.0/22 +45.254.188.0/22 +45.254.192.0/22 +45.254.196.0/22 +45.254.236.0/22 +45.254.240.0/22 +45.254.248.0/22 +45.255.0.0/22 +45.255.4.0/22 +45.255.8.0/22 +45.255.12.0/22 +45.255.16.0/22 +45.255.20.0/22 +45.255.24.0/22 +45.255.28.0/22 +45.255.32.0/22 +45.255.36.0/22 +45.255.40.0/22 +45.255.44.0/22 +45.255.48.0/22 +45.255.52.0/22 +45.255.56.0/22 +45.255.60.0/22 +45.255.64.0/22 +45.255.68.0/22 +45.255.72.0/22 +45.255.76.0/22 +45.255.80.0/22 +45.255.84.0/22 +45.255.88.0/22 +45.255.92.0/22 +45.255.96.0/22 +45.255.100.0/22 +45.255.104.0/22 +45.255.108.0/22 +45.255.112.0/22 +45.255.116.0/22 +45.255.120.0/22 +45.255.124.0/22 +45.255.132.0/22 +45.255.136.0/22 +45.255.140.0/22 +45.255.144.0/22 +45.255.148.0/22 +45.255.152.0/22 +45.255.156.0/22 +45.255.160.0/22 +45.255.164.0/22 +45.255.168.0/22 +45.255.172.0/22 +45.255.176.0/22 +45.255.180.0/22 +45.255.184.0/22 +45.255.188.0/22 +45.255.192.0/22 +45.255.196.0/22 +45.255.200.0/22 +45.255.204.0/22 +45.255.208.0/22 +45.255.212.0/22 +45.255.216.0/22 +45.255.220.0/22 +45.255.224.0/22 +45.255.228.0/22 +45.255.232.0/22 +45.255.236.0/22 +45.255.240.0/22 +45.255.244.0/22 +45.255.248.0/22 +47.92.0.0/14 +47.96.0.0/11 +49.4.0.0/14 +49.51.0.0/16 +49.128.4.0/22 +49.152.0.0/14 +49.210.0.0/15 +49.232.0.0/14 +49.239.0.0/18 +49.239.192.0/18 +49.246.224.0/19 +52.80.0.0/15 +52.82.0.0/15 +52.130.0.0/15 +54.222.0.0/15 +58.14.0.0/15 +58.66.0.0/15 +58.68.128.0/17 +58.82.0.0/17 +58.83.0.0/17 +58.83.128.0/17 +58.87.64.0/18 +58.99.128.0/17 +58.100.0.0/15 +58.116.0.0/14 +58.128.0.0/13 +59.80.0.0/15 +59.82.0.0/15 +59.107.0.0/17 +59.107.128.0/17 +59.108.0.0/15 +59.110.0.0/15 +59.151.0.0/17 +59.152.16.0/22 +59.152.20.0/22 +59.152.24.0/22 +59.152.28.0/22 +59.152.32.0/22 +59.152.36.0/22 +59.152.64.0/22 +59.152.68.0/22 +59.152.72.0/22 +59.152.76.0/22 +59.152.112.0/22 +59.152.116.0/22 +59.153.4.0/22 +59.153.32.0/22 +59.153.60.0/22 +59.153.64.0/22 +59.153.68.0/22 +59.153.72.0/22 +59.153.92.0/22 +59.153.116.0/22 +59.153.136.0/22 +59.153.152.0/22 +59.153.156.0/22 +59.153.164.0/22 +59.153.168.0/22 +59.153.172.0/22 +59.153.176.0/22 +59.153.180.0/22 +59.153.184.0/22 +59.153.188.0/22 +59.153.192.0/22 +59.155.0.0/16 +59.191.0.0/17 +59.191.240.0/20 +59.192.0.0/10 +60.55.0.0/16 +60.194.0.0/15 +60.200.0.0/14 +60.205.0.0/16 +60.206.0.0/15 +60.232.0.0/15 +60.245.128.0/17 +60.252.0.0/16 +61.4.80.0/22 +61.4.176.0/20 +61.8.160.0/20 +61.14.212.0/22 +61.14.216.0/22 +61.14.220.0/22 +61.29.192.0/19 +61.29.224.0/20 +61.29.240.0/20 +61.47.128.0/18 +61.87.192.0/18 +62.234.0.0/16 +68.79.0.0/18 +69.230.192.0/18 +69.231.128.0/18 +69.234.192.0/18 +69.235.128.0/18 +71.131.192.0/18 +71.132.0.0/18 +71.136.64.0/18 +71.137.0.0/18 +81.68.0.0/14 +82.156.0.0/15 +94.191.0.0/17 +101.32.0.0/14 +101.36.0.0/17 +101.36.128.0/17 +101.37.0.0/16 +101.38.0.0/15 +101.40.0.0/13 +101.48.0.0/15 +101.50.8.0/22 +101.50.12.0/22 +101.52.0.0/16 +101.54.0.0/16 +101.78.32.0/19 +101.96.128.0/17 +101.104.0.0/14 +101.120.0.0/14 +101.124.0.0/15 +101.126.0.0/16 +101.129.0.0/16 +101.132.0.0/14 +101.192.0.0/14 +101.196.0.0/16 +101.197.0.0/16 +101.198.0.0/15 +101.200.0.0/15 +101.236.0.0/14 +101.240.0.0/14 +101.251.64.0/18 +101.251.128.0/17 +101.252.0.0/15 +101.254.0.0/16 +103.1.8.0/22 +103.1.20.0/22 +103.1.24.0/22 +103.1.72.0/22 +103.1.88.0/22 +103.1.168.0/22 +103.2.108.0/22 +103.2.156.0/22 +103.2.164.0/22 +103.2.200.0/22 +103.2.204.0/22 +103.2.208.0/22 +103.2.212.0/22 +103.3.84.0/22 +103.3.88.0/22 +103.3.92.0/22 +103.4.56.0/22 +103.4.168.0/22 +103.4.184.0/22 +103.4.224.0/22 +103.5.36.0/22 +103.5.52.0/22 +103.5.152.0/22 +103.6.76.0/22 +103.6.108.0/22 +103.6.220.0/22 +103.6.228.0/22 +103.7.4.0/22 +103.7.28.0/22 +103.7.140.0/22 +103.7.216.0/22 +103.7.220.0/22 +103.8.0.0/22 +103.8.4.0/22 +103.8.8.0/22 +103.8.32.0/22 +103.8.52.0/22 +103.8.68.0/22 +103.8.108.0/22 +103.8.156.0/22 +103.8.200.0/22 +103.8.204.0/22 +103.8.220.0/22 +103.9.8.0/22 +103.9.24.0/22 +103.9.108.0/22 +103.9.152.0/22 +103.9.192.0/22 +103.10.0.0/22 +103.10.16.0/22 +103.10.84.0/22 +103.10.140.0/22 +103.11.16.0/22 +103.11.168.0/22 +103.11.180.0/22 +103.12.32.0/22 +103.12.92.0/22 +103.12.136.0/22 +103.12.184.0/22 +103.12.232.0/22 +103.13.12.0/22 +103.13.72.0/23 +103.13.124.0/22 +103.13.144.0/22 +103.13.196.0/22 +103.13.220.0/22 +103.13.244.0/22 +103.14.32.0/22 +103.14.100.0/22 +103.14.136.0/22 +103.14.156.0/22 +103.14.240.0/22 +103.15.4.0/22 +103.15.8.0/22 +103.15.16.0/22 +103.15.96.0/22 +103.15.200.0/22 +103.16.52.0/22 +103.16.80.0/22 +103.16.84.0/22 +103.16.88.0/22 +103.16.108.0/22 +103.16.124.0/22 +103.17.40.0/22 +103.17.64.0/22 +103.17.120.0/22 +103.17.136.0/22 +103.17.160.0/22 +103.17.204.0/22 +103.17.228.0/22 +103.18.192.0/22 +103.18.208.0/22 +103.18.212.0/22 +103.19.0.0/22 +103.19.12.0/22 +103.19.40.0/22 +103.19.44.0/22 +103.19.64.0/22 +103.19.68.0/22 +103.19.72.0/22 +103.19.232.0/22 +103.20.12.0/22 +103.20.32.0/22 +103.20.44.0/22 +103.20.68.0/22 +103.20.128.0/22 +103.20.160.0/22 +103.20.248.0/22 +103.21.112.0/22 +103.21.136.0/22 +103.21.140.0/22 +103.21.208.0/22 +103.21.240.0/22 +103.22.228.0/22 +103.22.252.0/22 +103.23.8.0/22 +103.23.160.0/22 +103.23.164.0/22 +103.23.176.0/22 +103.23.228.0/22 +103.24.24.0/22 +103.24.116.0/22 +103.24.128.0/22 +103.24.144.0/22 +103.24.176.0/22 +103.24.220.0/22 +103.24.228.0/22 +103.24.248.0/22 +103.24.252.0/22 +103.25.8.0/23 +103.25.20.0/22 +103.25.24.0/22 +103.25.28.0/22 +103.25.32.0/22 +103.25.36.0/22 +103.25.48.0/22 +103.25.64.0/22 +103.25.68.0/22 +103.25.148.0/22 +103.25.156.0/22 +103.25.216.0/22 +103.26.0.0/22 +103.26.64.0/22 +103.26.76.0/22 +103.26.132.0/22 +103.26.156.0/22 +103.26.160.0/22 +103.26.228.0/22 +103.26.240.0/22 +103.27.12.0/22 +103.27.24.0/22 +103.27.56.0/22 +103.27.96.0/22 +103.27.184.0/22 +103.27.208.0/22 +103.27.212.0/22 +103.28.4.0/22 +103.28.8.0/22 +103.28.184.0/22 +103.28.212.0/22 +103.29.16.0/22 +103.29.132.0/22 +103.29.136.0/22 +103.30.20.0/22 +103.30.96.0/22 +103.30.148.0/22 +103.30.200.0/22 +103.30.228.0/22 +103.30.236.0/22 +103.31.0.0/22 +103.31.48.0/22 +103.31.52.0/22 +103.31.56.0/22 +103.31.60.0/22 +103.31.64.0/22 +103.31.68.0/22 +103.31.148.0/22 +103.31.160.0/22 +103.31.168.0/22 +103.31.236.0/22 +103.32.0.0/22 +103.32.4.0/22 +103.32.8.0/22 +103.32.12.0/22 +103.32.16.0/22 +103.32.20.0/22 +103.32.24.0/22 +103.32.28.0/22 +103.32.32.0/22 +103.32.36.0/22 +103.32.40.0/22 +103.32.44.0/22 +103.32.48.0/22 +103.32.52.0/22 +103.32.56.0/22 +103.32.60.0/22 +103.32.64.0/22 +103.32.68.0/22 +103.32.72.0/22 +103.32.76.0/22 +103.32.80.0/22 +103.32.84.0/22 +103.32.88.0/22 +103.32.92.0/22 +103.32.96.0/22 +103.32.100.0/22 +103.32.104.0/22 +103.32.108.0/22 +103.32.112.0/22 +103.32.116.0/22 +103.32.120.0/22 +103.32.124.0/22 +103.32.128.0/22 +103.32.132.0/22 +103.32.136.0/22 +103.32.140.0/22 +103.32.144.0/22 +103.32.148.0/22 +103.32.152.0/22 +103.32.156.0/22 +103.32.160.0/22 +103.32.164.0/22 +103.32.168.0/22 +103.32.172.0/22 +103.32.176.0/22 +103.32.180.0/22 +103.32.184.0/22 +103.32.188.0/22 +103.32.192.0/22 +103.32.196.0/22 +103.32.200.0/22 +103.32.204.0/22 +103.32.208.0/22 +103.32.212.0/22 +103.32.216.0/22 +103.32.220.0/22 +103.32.224.0/22 +103.32.228.0/22 +103.32.232.0/22 +103.32.236.0/22 +103.32.240.0/22 +103.32.244.0/22 +103.32.248.0/22 +103.32.252.0/22 +103.33.0.0/22 +103.33.4.0/22 +103.33.8.0/22 +103.33.12.0/22 +103.33.16.0/22 +103.33.20.0/22 +103.33.24.0/22 +103.33.28.0/22 +103.33.32.0/22 +103.33.36.0/22 +103.33.40.0/22 +103.33.44.0/22 +103.33.48.0/22 +103.33.52.0/22 +103.33.56.0/22 +103.33.60.0/22 +103.33.64.0/22 +103.33.68.0/22 +103.33.72.0/22 +103.33.76.0/22 +103.33.80.0/22 +103.33.84.0/22 +103.33.88.0/22 +103.33.92.0/22 +103.33.96.0/22 +103.33.100.0/22 +103.33.104.0/22 +103.33.108.0/22 +103.33.112.0/22 +103.33.116.0/22 +103.33.120.0/22 +103.33.124.0/22 +103.33.128.0/22 +103.33.132.0/22 +103.33.136.0/22 +103.33.140.0/22 +103.33.144.0/22 +103.33.148.0/22 +103.33.152.0/22 +103.33.156.0/22 +103.33.160.0/22 +103.33.164.0/22 +103.33.168.0/22 +103.33.172.0/22 +103.33.176.0/22 +103.33.180.0/22 +103.33.184.0/22 +103.33.188.0/22 +103.33.192.0/22 +103.33.196.0/22 +103.33.200.0/22 +103.33.204.0/22 +103.33.208.0/22 +103.33.212.0/22 +103.33.216.0/22 +103.33.220.0/22 +103.33.224.0/22 +103.33.228.0/22 +103.33.232.0/22 +103.33.236.0/22 +103.33.240.0/22 +103.33.244.0/22 +103.33.248.0/22 +103.33.252.0/22 +103.34.0.0/22 +103.34.4.0/22 +103.34.8.0/22 +103.34.12.0/22 +103.34.16.0/22 +103.34.20.0/22 +103.34.24.0/22 +103.34.28.0/22 +103.34.32.0/22 +103.34.36.0/22 +103.34.40.0/22 +103.34.44.0/22 +103.34.48.0/22 +103.34.52.0/22 +103.34.56.0/22 +103.34.60.0/22 +103.34.64.0/22 +103.34.68.0/22 +103.34.72.0/22 +103.34.76.0/22 +103.34.80.0/22 +103.34.84.0/22 +103.34.88.0/22 +103.34.92.0/22 +103.34.96.0/22 +103.34.100.0/22 +103.34.104.0/22 +103.34.108.0/22 +103.34.112.0/22 +103.34.116.0/22 +103.34.120.0/22 +103.34.124.0/22 +103.34.128.0/22 +103.34.132.0/22 +103.34.136.0/22 +103.34.140.0/22 +103.34.144.0/22 +103.34.148.0/22 +103.34.152.0/22 +103.34.156.0/22 +103.34.160.0/22 +103.34.164.0/22 +103.34.168.0/22 +103.34.172.0/22 +103.34.176.0/22 +103.34.180.0/22 +103.34.184.0/22 +103.34.188.0/22 +103.34.192.0/22 +103.34.196.0/22 +103.34.200.0/22 +103.34.204.0/22 +103.34.208.0/22 +103.34.212.0/22 +103.34.216.0/22 +103.34.220.0/22 +103.34.224.0/22 +103.34.228.0/22 +103.34.232.0/22 +103.34.236.0/22 +103.34.240.0/22 +103.34.244.0/22 +103.34.248.0/22 +103.34.252.0/22 +103.35.0.0/22 +103.35.4.0/22 +103.35.8.0/22 +103.35.12.0/22 +103.35.16.0/22 +103.35.20.0/22 +103.35.24.0/22 +103.35.28.0/22 +103.35.32.0/22 +103.35.36.0/22 +103.35.40.0/22 +103.35.44.0/22 +103.35.48.0/22 +103.35.116.0/22 +103.35.180.0/22 +103.35.200.0/22 +103.36.20.0/22 +103.36.28.0/22 +103.36.36.0/22 +103.36.56.0/22 +103.36.60.0/22 +103.36.64.0/22 +103.36.72.0/22 +103.36.96.0/22 +103.36.132.0/22 +103.36.136.0/22 +103.36.160.0/22 +103.36.164.0/22 +103.36.168.0/22 +103.36.172.0/22 +103.36.176.0/22 +103.36.180.0/22 +103.36.184.0/22 +103.36.188.0/22 +103.36.192.0/22 +103.36.196.0/22 +103.36.200.0/22 +103.36.204.0/22 +103.36.212.0/22 +103.36.216.0/22 +103.36.224.0/22 +103.36.228.0/22 +103.36.232.0/22 +103.36.236.0/22 +103.36.240.0/22 +103.36.244.0/22 +103.37.0.0/22 +103.37.12.0/22 +103.37.16.0/22 +103.37.24.0/22 +103.37.52.0/22 +103.37.56.0/22 +103.37.72.0/22 +103.37.104.0/22 +103.37.124.0/22 +103.37.136.0/22 +103.37.140.0/22 +103.37.144.0/22 +103.37.148.0/22 +103.37.152.0/22 +103.37.156.0/22 +103.37.160.0/22 +103.37.164.0/22 +103.37.172.0/22 +103.37.176.0/22 +103.37.188.0/22 +103.37.208.0/22 +103.37.212.0/22 +103.37.216.0/22 +103.37.220.0/22 +103.37.248.0/22 +103.37.252.0/22 +103.38.44.0/22 +103.38.56.0/22 +103.38.84.0/22 +103.38.92.0/22 +103.38.96.0/22 +103.38.116.0/22 +103.38.132.0/22 +103.38.140.0/22 +103.38.224.0/22 +103.38.228.0/22 +103.38.252.0/22 +103.39.16.0/22 +103.39.64.0/22 +103.39.100.0/22 +103.39.104.0/22 +103.39.108.0/22 +103.39.160.0/22 +103.39.164.0/22 +103.39.168.0/22 +103.39.172.0/22 +103.39.176.0/22 +103.39.180.0/22 +103.39.184.0/22 +103.39.188.0/22 +103.39.200.0/22 +103.39.204.0/22 +103.39.208.0/22 +103.39.212.0/22 +103.39.216.0/22 +103.39.220.0/22 +103.39.224.0/22 +103.39.228.0/22 +103.39.232.0/22 +103.40.16.0/22 +103.40.20.0/22 +103.40.24.0/22 +103.40.28.0/22 +103.40.32.0/22 +103.40.36.0/22 +103.40.40.0/22 +103.40.44.0/22 +103.40.88.0/22 +103.40.100.0/22 +103.40.112.0/22 +103.40.220.0/22 +103.40.228.0/22 +103.40.236.0/22 +103.40.240.0/22 +103.40.244.0/22 +103.40.248.0/22 +103.40.252.0/22 +103.41.0.0/22 +103.41.16.0/22 +103.41.52.0/22 +103.41.140.0/22 +103.41.148.0/22 +103.41.152.0/22 +103.41.160.0/22 +103.41.220.0/22 +103.41.224.0/22 +103.41.228.0/22 +103.41.232.0/22 +103.42.8.0/22 +103.42.24.0/22 +103.42.28.0/22 +103.42.32.0/22 +103.42.64.0/22 +103.42.68.0/22 +103.42.76.0/22 +103.42.104.0/22 +103.42.180.0/22 +103.42.232.0/22 +103.43.16.0/22 +103.43.84.0/22 +103.43.96.0/22 +103.43.104.0/22 +103.43.124.0/22 +103.43.184.0/22 +103.43.196.0/22 +103.43.208.0/22 +103.43.220.0/22 +103.43.224.0/22 +103.43.232.0/22 +103.43.240.0/22 +103.44.56.0/22 +103.44.88.0/22 +103.44.120.0/22 +103.44.124.0/22 +103.44.132.0/22 +103.44.144.0/22 +103.44.168.0/22 +103.44.176.0/22 +103.44.180.0/22 +103.44.184.0/22 +103.44.188.0/22 +103.44.192.0/22 +103.44.196.0/22 +103.44.200.0/22 +103.44.204.0/22 +103.44.224.0/22 +103.44.236.0/22 +103.44.240.0/22 +103.44.244.0/22 +103.44.248.0/22 +103.44.252.0/22 +103.45.0.0/22 +103.45.4.0/22 +103.45.8.0/22 +103.45.12.0/22 +103.45.16.0/22 +103.45.20.0/22 +103.45.24.0/22 +103.45.28.0/22 +103.45.32.0/22 +103.45.36.0/22 +103.45.40.0/22 +103.45.44.0/22 +103.45.48.0/22 +103.45.52.0/22 +103.45.56.0/22 +103.45.60.0/22 +103.45.80.0/22 +103.45.84.0/22 +103.45.88.0/22 +103.45.92.0/22 +103.45.96.0/22 +103.45.100.0/22 +103.45.104.0/22 +103.45.108.0/22 +103.45.112.0/22 +103.45.116.0/22 +103.45.120.0/22 +103.45.124.0/22 +103.45.128.0/22 +103.45.132.0/22 +103.45.136.0/22 +103.45.140.0/22 +103.45.144.0/22 +103.45.148.0/22 +103.45.152.0/22 +103.45.156.0/22 +103.45.164.0/22 +103.45.172.0/22 +103.45.176.0/22 +103.45.180.0/22 +103.45.184.0/22 +103.45.188.0/22 +103.45.192.0/22 +103.45.196.0/22 +103.45.200.0/22 +103.45.204.0/22 +103.45.208.0/22 +103.45.212.0/22 +103.45.216.0/22 +103.45.220.0/22 +103.45.248.0/22 +103.46.0.0/22 +103.46.12.0/22 +103.46.16.0/22 +103.46.20.0/22 +103.46.24.0/22 +103.46.28.0/22 +103.46.32.0/22 +103.46.36.0/22 +103.46.40.0/22 +103.46.44.0/22 +103.46.48.0/22 +103.46.52.0/22 +103.46.56.0/22 +103.46.60.0/22 +103.46.64.0/22 +103.46.68.0/22 +103.46.72.0/22 +103.46.76.0/22 +103.46.80.0/22 +103.46.84.0/22 +103.46.88.0/22 +103.46.92.0/22 +103.46.96.0/22 +103.46.100.0/22 +103.46.104.0/22 +103.46.108.0/22 +103.46.112.0/22 +103.46.116.0/22 +103.46.120.0/22 +103.46.124.0/22 +103.46.128.0/22 +103.46.132.0/22 +103.46.136.0/22 +103.46.152.0/22 +103.46.156.0/22 +103.46.160.0/22 +103.46.164.0/22 +103.46.168.0/22 +103.46.172.0/22 +103.46.176.0/22 +103.46.180.0/22 +103.46.244.0/22 +103.46.248.0/22 +103.47.4.0/22 +103.47.20.0/22 +103.47.36.0/22 +103.47.40.0/22 +103.47.48.0/22 +103.47.80.0/22 +103.47.96.0/22 +103.47.108.0/22 +103.47.116.0/22 +103.47.120.0/22 +103.47.136.0/22 +103.47.140.0/22 +103.47.212.0/22 +103.48.20.0/22 +103.48.52.0/22 +103.48.92.0/22 +103.48.144.0/22 +103.48.148.0/22 +103.48.152.0/22 +103.48.156.0/22 +103.48.202.0/23 +103.48.236.0/22 +103.48.240.0/22 +103.48.244.0/22 +103.49.12.0/22 +103.49.20.0/22 +103.49.72.0/22 +103.49.76.0/22 +103.49.92.0/22 +103.49.96.0/22 +103.49.108.0/22 +103.49.128.0/22 +103.49.176.0/22 +103.49.180.0/22 +103.49.196.0/22 +103.49.248.0/22 +103.50.36.0/22 +103.50.44.0/22 +103.50.48.0/22 +103.50.52.0/22 +103.50.56.0/22 +103.50.60.0/22 +103.50.64.0/22 +103.50.68.0/22 +103.50.72.0/22 +103.50.108.0/22 +103.50.112.0/22 +103.50.116.0/22 +103.50.120.0/22 +103.50.124.0/22 +103.50.132.0/22 +103.50.136.0/22 +103.50.140.0/22 +103.50.172.0/22 +103.50.176.0/22 +103.50.180.0/22 +103.50.184.0/22 +103.50.188.0/22 +103.50.192.0/22 +103.50.196.0/22 +103.50.200.0/22 +103.50.220.0/22 +103.50.224.0/22 +103.50.228.0/22 +103.50.232.0/22 +103.50.236.0/22 +103.50.240.0/22 +103.50.244.0/22 +103.50.248.0/22 +103.52.40.0/22 +103.52.72.0/22 +103.52.76.0/22 +103.52.80.0/22 +103.52.84.0/22 +103.52.104.0/22 +103.52.160.0/22 +103.52.164.0/22 +103.52.172.0/22 +103.52.196.0/22 +103.53.4.0/22 +103.53.64.0/22 +103.53.68.0/22 +103.53.92.0/22 +103.53.100.0/22 +103.53.128.0/22 +103.53.132.0/22 +103.53.136.0/22 +103.53.140.0/22 +103.53.144.0/22 +103.53.180.0/22 +103.53.208.0/22 +103.53.212.0/22 +103.53.216.0/22 +103.53.236.0/22 +103.53.248.0/22 +103.54.8.0/22 +103.54.48.0/22 +103.54.60.0/22 +103.54.160.0/22 +103.54.164.0/22 +103.54.212.0/22 +103.55.24.0/22 +103.55.80.0/22 +103.55.120.0/22 +103.55.152.0/22 +103.55.236.0/22 +103.56.8.0/22 +103.56.16.0/22 +103.56.20.0/22 +103.56.52.0/22 +103.56.56.0/22 +103.56.72.0/22 +103.56.76.0/22 +103.56.140.0/22 +103.56.152.0/22 +103.56.184.0/22 +103.56.200.0/22 +103.57.12.0/22 +103.57.52.0/22 +103.57.56.0/22 +103.57.76.0/22 +103.57.136.0/22 +103.58.24.0/22 +103.59.76.0/22 +103.59.100.0/22 +103.59.112.0/22 +103.59.120.0/22 +103.59.128.0/22 +103.59.148.0/22 +103.59.164.0/22 +103.60.32.0/22 +103.60.44.0/22 +103.60.228.0/22 +103.60.236.0/22 +103.61.60.0/22 +103.61.104.0/22 +103.61.140.0/22 +103.61.152.0/22 +103.61.172.0/22 +103.61.184.0/22 +103.61.188.0/22 +103.62.52.0/22 +103.62.72.0/22 +103.62.76.0/22 +103.62.80.0/22 +103.62.84.0/22 +103.62.88.0/22 +103.62.96.0/22 +103.62.100.0/22 +103.62.104.0/22 +103.62.108.0/22 +103.62.112.0/22 +103.62.116.0/22 +103.62.120.0/22 +103.62.124.0/22 +103.62.128.0/22 +103.62.132.0/22 +103.62.156.0/22 +103.62.160.0/22 +103.62.164.0/22 +103.62.168.0/22 +103.62.172.0/22 +103.62.176.0/22 +103.62.180.0/22 +103.62.184.0/22 +103.62.188.0/22 +103.62.192.0/22 +103.62.212.0/22 +103.62.216.0/22 +103.62.220.0/22 +103.62.224.0/22 +103.63.32.0/22 +103.63.36.0/22 +103.63.40.0/22 +103.63.44.0/22 +103.63.48.0/22 +103.63.52.0/22 +103.63.56.0/22 +103.63.60.0/22 +103.63.64.0/22 +103.63.68.0/22 +103.63.72.0/22 +103.63.76.0/22 +103.63.80.0/22 +103.63.84.0/22 +103.63.88.0/22 +103.63.140.0/22 +103.63.144.0/22 +103.63.152.0/22 +103.63.160.0/22 +103.63.164.0/22 +103.63.168.0/22 +103.63.172.0/22 +103.63.176.0/22 +103.63.180.0/22 +103.63.184.0/22 +103.63.192.0/22 +103.63.196.0/22 +103.63.200.0/22 +103.63.204.0/22 +103.63.208.0/22 +103.63.240.0/22 +103.63.244.0/22 +103.63.248.0/22 +103.63.252.0/22 +103.64.0.0/22 +103.64.4.0/22 +103.64.24.0/22 +103.64.28.0/22 +103.64.32.0/22 +103.64.36.0/22 +103.64.40.0/22 +103.64.44.0/22 +103.64.48.0/22 +103.64.52.0/22 +103.64.56.0/22 +103.64.60.0/22 +103.64.64.0/22 +103.64.68.0/22 +103.64.72.0/22 +103.64.76.0/22 +103.64.80.0/22 +103.64.84.0/22 +103.64.88.0/22 +103.64.92.0/22 +103.64.96.0/22 +103.64.100.0/22 +103.64.104.0/22 +103.64.108.0/22 +103.64.112.0/22 +103.64.116.0/22 +103.64.120.0/22 +103.64.124.0/22 +103.64.140.0/22 +103.64.144.0/22 +103.64.152.0/22 +103.64.156.0/22 +103.64.160.0/22 +103.64.164.0/22 +103.64.168.0/22 +103.64.172.0/22 +103.64.176.0/22 +103.64.180.0/22 +103.64.184.0/22 +103.64.188.0/22 +103.64.192.0/22 +103.64.196.0/22 +103.64.200.0/22 +103.64.204.0/22 +103.64.208.0/22 +103.64.212.0/22 +103.64.216.0/22 +103.64.220.0/22 +103.64.224.0/22 +103.64.228.0/22 +103.64.232.0/22 +103.64.236.0/22 +103.64.240.0/22 +103.64.244.0/22 +103.64.248.0/22 +103.64.252.0/22 +103.65.0.0/22 +103.65.4.0/22 +103.65.8.0/22 +103.65.12.0/22 +103.65.16.0/22 +103.65.36.0/22 +103.65.40.0/22 +103.65.48.0/22 +103.65.52.0/22 +103.65.56.0/22 +103.65.60.0/22 +103.65.64.0/22 +103.65.68.0/22 +103.65.72.0/22 +103.65.76.0/22 +103.65.80.0/22 +103.65.84.0/22 +103.65.88.0/22 +103.65.92.0/22 +103.65.100.0/22 +103.65.104.0/22 +103.65.108.0/22 +103.65.112.0/22 +103.65.144.0/22 +103.65.148.0/22 +103.65.152.0/22 +103.65.156.0/22 +103.65.160.0/22 +103.65.164.0/22 +103.65.168.0/22 +103.65.172.0/22 +103.66.32.0/22 +103.66.40.0/22 +103.66.92.0/22 +103.66.108.0/22 +103.66.200.0/22 +103.66.216.0/22 +103.66.240.0/22 +103.66.244.0/22 +103.66.248.0/22 +103.66.252.0/22 +103.67.0.0/22 +103.67.4.0/22 +103.67.8.0/22 +103.67.100.0/22 +103.67.104.0/22 +103.67.108.0/22 +103.67.112.0/22 +103.67.116.0/22 +103.67.120.0/22 +103.67.124.0/22 +103.67.128.0/22 +103.67.132.0/22 +103.67.136.0/22 +103.67.140.0/22 +103.67.144.0/22 +103.67.148.0/22 +103.67.172.0/22 +103.67.192.0/22 +103.67.212.0/22 +103.67.252.0/22 +103.68.64.0/22 +103.68.88.0/22 +103.68.100.0/22 +103.68.128.0/22 +103.68.192.0/22 +103.69.16.0/22 +103.69.116.0/22 +103.69.132.0/22 +103.69.152.0/22 +103.69.212.0/22 +103.70.8.0/22 +103.70.184.0/22 +103.70.220.0/22 +103.70.224.0/22 +103.70.236.0/22 +103.70.252.0/22 +103.71.0.0/22 +103.71.32.0/22 +103.71.48.0/22 +103.71.68.0/22 +103.71.72.0/22 +103.71.80.0/22 +103.71.84.0/22 +103.71.88.0/22 +103.71.120.0/22 +103.71.124.0/22 +103.71.128.0/22 +103.71.144.0/22 +103.71.196.0/22 +103.71.200.0/22 +103.71.232.0/22 +103.72.12.0/22 +103.72.16.0/22 +103.72.20.0/22 +103.72.24.0/22 +103.72.28.0/22 +103.72.32.0/22 +103.72.36.0/22 +103.72.40.0/22 +103.72.44.0/22 +103.72.48.0/22 +103.72.52.0/22 +103.72.116.0/22 +103.72.120.0/22 +103.72.124.0/22 +103.72.128.0/22 +103.72.132.0/22 +103.72.144.0/22 +103.72.148.0/22 +103.72.172.0/22 +103.72.180.0/22 +103.73.48.0/22 +103.73.88.0/22 +103.73.96.0/22 +103.73.116.0/22 +103.73.120.0/22 +103.73.128.0/22 +103.73.132.0/22 +103.73.136.0/22 +103.73.140.0/22 +103.73.168.0/22 +103.73.176.0/22 +103.73.204.0/22 +103.73.208.0/22 +103.73.240.0/22 +103.73.244.0/22 +103.73.248.0/22 +103.74.24.0/22 +103.74.28.0/22 +103.74.32.0/22 +103.74.36.0/22 +103.74.40.0/22 +103.74.44.0/22 +103.74.48.0/22 +103.74.56.0/22 +103.74.60.0/22 +103.74.80.0/22 +103.74.124.0/22 +103.74.148.0/22 +103.74.204.0/22 +103.74.232.0/22 +103.75.16.0/22 +103.75.88.0/22 +103.75.92.0/22 +103.75.104.0/22 +103.75.108.0/22 +103.75.112.0/22 +103.75.120.0/22 +103.75.128.0/22 +103.75.152.0/22 +103.75.236.0/24 +103.76.60.0/22 +103.76.64.0/22 +103.76.68.0/22 +103.76.72.0/22 +103.76.84.0/22 +103.76.92.0/22 +103.76.104.0/22 +103.76.216.0/22 +103.76.220.0/22 +103.76.224.0/22 +103.77.28.0/22 +103.77.52.0/22 +103.77.56.0/22 +103.77.72.0/22 +103.77.88.0/22 +103.77.92.0/22 +103.77.132.0/22 +103.77.148.0/22 +103.77.220.0/22 +103.78.56.0/22 +103.78.60.0/22 +103.78.68.0/22 +103.78.124.0/22 +103.78.172.0/22 +103.78.176.0/22 +103.78.196.0/22 +103.78.228.0/22 +103.79.24.0/22 +103.79.28.0/22 +103.79.36.0/22 +103.79.40.0/22 +103.79.44.0/22 +103.79.52.0/22 +103.79.56.0/22 +103.79.60.0/22 +103.79.64.0/22 +103.79.68.0/22 +103.79.80.0/22 +103.79.84.0/22 +103.79.120.0/22 +103.79.136.0/22 +103.79.188.0/22 +103.79.192.0/22 +103.79.196.0/22 +103.79.200.0/22 +103.79.204.0/22 +103.79.208.0/22 +103.79.212.0/22 +103.79.240.0/22 +103.80.24.0/22 +103.80.28.0/22 +103.80.44.0/22 +103.80.72.0/22 +103.80.176.0/22 +103.80.180.0/22 +103.80.184.0/22 +103.80.192.0/22 +103.80.200.0/22 +103.80.232.0/22 +103.81.4.0/22 +103.81.8.0/22 +103.81.16.0/22 +103.81.20.0/22 +103.81.44.0/22 +103.81.48.0/22 +103.81.96.0/22 +103.81.120.0/22 +103.81.148.0/22 +103.81.164.0/22 +103.81.168.0/22 +103.81.183.0/24 +103.81.184.0/22 +103.81.200.0/22 +103.81.232.0/22 +103.82.52.0/22 +103.82.60.0/22 +103.82.68.0/22 +103.82.84.0/22 +103.82.104.0/22 +103.82.224.0/22 +103.82.236.0/22 +103.83.44.0/22 +103.83.52.0/22 +103.83.60.0/22 +103.83.64.0/22 +103.83.72.0/22 +103.83.112.0/22 +103.83.120.0/22 +103.83.180.0/22 +103.84.0.0/22 +103.84.12.0/22 +103.84.16.0/22 +103.84.20.0/22 +103.84.24.0/22 +103.84.28.0/22 +103.84.48.0/22 +103.84.64.0/22 +103.84.72.0/22 +103.84.92.0/22 +103.84.108.0/22 +103.84.136.0/22 +103.85.20.0/22 +103.85.24.0/22 +103.85.44.0/22 +103.85.48.0/22 +103.85.136.0/22 +103.85.144.0/22 +103.85.164.0/22 +103.85.168.0/22 +103.85.172.0/22 +103.85.176.0/22 +103.85.224.0/22 +103.86.28.0/22 +103.86.32.0/22 +103.86.44.0/22 +103.86.60.0/22 +103.86.68.0/22 +103.86.80.0/22 +103.86.84.0/22 +103.86.88.0/22 +103.86.204.0/22 +103.86.208.0/22 +103.86.212.0/22 +103.86.216.0/22 +103.86.220.0/22 +103.86.224.0/22 +103.86.228.0/22 +103.86.232.0/22 +103.86.236.0/22 +103.86.240.0/22 +103.86.244.0/22 +103.86.248.0/22 +103.86.252.0/22 +103.87.0.0/22 +103.87.4.0/22 +103.87.20.0/22 +103.87.32.0/22 +103.87.72.0/22 +103.87.96.0/22 +103.87.132.0/22 +103.87.180.0/22 +103.87.224.0/22 +103.88.4.0/22 +103.88.8.0/22 +103.88.12.0/22 +103.88.16.0/22 +103.88.20.0/22 +103.88.32.0/22 +103.88.36.0/22 +103.88.60.0/22 +103.88.64.0/22 +103.88.72.0/22 +103.88.96.0/22 +103.88.100.0/22 +103.88.164.0/22 +103.88.176.0/22 +103.88.184.0/22 +103.88.188.0/22 +103.88.212.0/22 +103.89.28.0/22 +103.89.96.0/22 +103.89.100.0/22 +103.89.104.0/22 +103.89.108.0/22 +103.89.112.0/22 +103.89.116.0/22 +103.89.148.0/22 +103.89.172.0/22 +103.89.184.0/22 +103.89.188.0/22 +103.89.192.0/22 +103.89.196.0/22 +103.89.200.0/22 +103.89.204.0/22 +103.89.208.0/22 +103.89.212.0/22 +103.89.216.0/22 +103.89.220.0/22 +103.89.224.0/22 +103.89.228.0/22 +103.90.52.0/22 +103.90.100.0/22 +103.90.104.0/22 +103.90.108.0/22 +103.90.112.0/22 +103.90.116.0/22 +103.90.120.0/22 +103.90.124.0/22 +103.90.128.0/22 +103.90.132.0/22 +103.90.152.0/22 +103.90.168.0/22 +103.90.173.0/24 +103.90.176.0/22 +103.90.192.0/22 +103.91.36.0/22 +103.91.40.0/22 +103.91.152.0/22 +103.91.200.0/22 +103.91.212.0/22 +103.91.219.0/24 +103.91.236.0/22 +103.91.252.0/22 +103.92.0.0/22 +103.92.4.0/22 +103.92.8.0/22 +103.92.12.0/22 +103.92.48.0/22 +103.92.52.0/22 +103.92.56.0/22 +103.92.60.0/22 +103.92.64.0/22 +103.92.68.0/22 +103.92.72.0/22 +103.92.76.0/22 +103.92.80.0/22 +103.92.86.0/24 +103.92.88.0/22 +103.92.108.0/22 +103.92.124.0/22 +103.92.128.0/24 +103.92.156.0/22 +103.92.164.0/22 +103.92.168.0/22 +103.92.172.0/22 +103.92.176.0/22 +103.92.180.0/22 +103.92.184.0/22 +103.92.188.0/22 +103.92.192.0/22 +103.92.236.0/22 +103.92.240.0/22 +103.92.244.0/22 +103.92.248.0/22 +103.92.252.0/22 +103.93.0.0/22 +103.93.4.0/22 +103.93.28.0/22 +103.93.76.0/22 +103.93.84.0/22 +103.93.121.0/24 +103.93.152.0/22 +103.93.204.0/22 +103.94.12.0/22 +103.94.20.0/22 +103.94.28.0/22 +103.94.32.0/22 +103.94.36.0/22 +103.94.40.0/22 +103.94.44.0/22 +103.94.72.0/22 +103.94.88.0/22 +103.94.116.0/22 +103.94.160.0/22 +103.94.180.0/22 +103.94.200.0/22 +103.95.28.0/22 +103.95.52.0/22 +103.95.64.0/22 +103.95.68.0/22 +103.95.88.0/22 +103.95.92.0/22 +103.95.116.0/22 +103.95.128.0/22 +103.95.136.0/22 +103.95.140.0/22 +103.95.144.0/22 +103.95.152.0/22 +103.95.207.0/24 +103.95.216.0/22 +103.95.224.0/22 +103.95.236.0/22 +103.95.240.0/22 +103.95.244.0/22 +103.95.248.0/22 +103.95.252.0/22 +103.96.0.0/22 +103.96.8.0/22 +103.96.80.0/22 +103.96.124.0/22 +103.96.136.0/22 +103.96.140.0/24 +103.96.148.0/22 +103.96.152.0/22 +103.96.156.0/22 +103.96.160.0/22 +103.96.164.0/22 +103.96.168.0/22 +103.96.172.0/22 +103.96.176.0/22 +103.96.180.0/22 +103.96.184.0/22 +103.96.188.0/22 +103.96.192.0/22 +103.96.196.0/22 +103.96.200.0/22 +103.96.204.0/22 +103.96.208.0/22 +103.96.212.0/22 +103.96.216.0/22 +103.97.8.0/22 +103.97.12.0/22 +103.97.16.0/22 +103.97.20.0/22 +103.97.24.0/22 +103.97.28.0/22 +103.97.32.0/22 +103.97.36.0/22 +103.97.40.0/22 +103.97.56.0/22 +103.97.60.0/22 +103.97.64.0/22 +103.97.68.0/22 +103.97.72.0/22 +103.97.80.0/22 +103.97.112.0/22 +103.97.116.0/22 +103.97.128.0/22 +103.97.144.0/22 +103.97.148.0/22 +103.97.188.0/22 +103.97.192.0/22 +103.97.224.0/22 +103.97.228.0/23 +103.98.28.0/23 +103.98.40.0/22 +103.98.48.0/22 +103.98.56.0/22 +103.98.80.0/22 +103.98.88.0/22 +103.98.92.0/22 +103.98.96.0/22 +103.98.100.0/22 +103.98.124.0/22 +103.98.136.0/22 +103.98.140.0/22 +103.98.144.0/22 +103.98.164.0/22 +103.98.180.0/22 +103.98.196.0/22 +103.98.216.0/22 +103.98.224.0/22 +103.98.228.0/22 +103.98.232.0/22 +103.98.240.0/22 +103.98.244.0/22 +103.98.248.0/22 +103.98.252.0/22 +103.99.40.0/23 +103.99.52.0/22 +103.99.56.0/22 +103.99.60.0/22 +103.99.76.0/22 +103.99.104.0/22 +103.99.116.0/22 +103.99.120.0/22 +103.99.152.0/22 +103.99.220.0/22 +103.99.232.0/22 +103.99.236.0/22 +103.100.0.0/22 +103.100.32.0/22 +103.100.40.0/22 +103.100.48.0/22 +103.100.52.0/22 +103.100.56.0/22 +103.100.60.0/22 +103.100.64.0/22 +103.100.68.0/22 +103.100.88.0/22 +103.100.116.0/22 +103.100.140.0/22 +103.100.144.0/22 +103.100.236.0/22 +103.100.240.0/22 +103.100.248.0/22 +103.100.252.0/22 +103.101.4.0/22 +103.101.8.0/22 +103.101.12.0/22 +103.101.28.0/22 +103.101.60.0/22 +103.101.120.0/22 +103.101.124.0/22 +103.101.144.0/22 +103.101.148.0/22 +103.101.153.0/24 +103.101.180.0/22 +103.101.184.0/22 +103.102.76.0/22 +103.102.80.0/22 +103.102.168.0/22 +103.102.172.0/22 +103.102.180.0/22 +103.102.184.0/22 +103.102.188.0/22 +103.102.192.0/22 +103.102.196.0/22 +103.102.200.0/22 +103.102.208.0/22 +103.102.212.0/22 +103.103.12.0/22 +103.103.16.0/22 +103.103.36.0/22 +103.103.68.0/22 +103.103.72.0/22 +103.103.176.0/22 +103.103.188.0/22 +103.103.200.0/22 +103.103.204.0/22 +103.103.220.0/22 +103.103.224.0/22 +103.103.228.0/22 +103.103.232.0/22 +103.103.248.0/22 +103.103.252.0/22 +103.104.0.0/22 +103.104.4.0/22 +103.104.36.0/22 +103.104.40.0/22 +103.104.64.0/22 +103.104.104.0/22 +103.104.152.0/22 +103.104.168.0/22 +103.104.172.0/22 +103.104.188.0/22 +103.104.198.0/23 +103.104.252.0/22 +103.105.0.0/22 +103.105.4.0/22 +103.105.12.0/22 +103.105.16.0/22 +103.105.23.0/24 +103.105.56.0/22 +103.105.60.0/22 +103.105.116.0/22 +103.105.132.0/22 +103.105.180.0/22 +103.105.184.0/22 +103.105.200.0/22 +103.105.204.0/22 +103.105.220.0/22 +103.106.36.0/22 +103.106.40.0/22 +103.106.44.0/22 +103.106.60.0/22 +103.106.68.0/22 +103.106.96.0/22 +103.106.120.0/22 +103.106.128.0/22 +103.106.132.0/22 +103.106.160.0/22 +103.106.188.0/22 +103.106.196.0/22 +103.106.202.0/23 +103.106.212.0/22 +103.106.244.0/22 +103.106.252.0/22 +103.107.0.0/22 +103.107.8.0/24 +103.107.28.0/22 +103.107.32.0/22 +103.107.44.0/22 +103.107.72.0/22 +103.107.108.0/22 +103.107.164.0/22 +103.107.168.0/22 +103.107.188.0/22 +103.107.192.0/22 +103.107.208.0/22 +103.107.216.0/22 +103.107.220.0/22 +103.108.52.0/22 +103.108.64.0/22 +103.108.160.0/22 +103.108.164.0/22 +103.108.184.0/23 +103.108.188.0/23 +103.108.192.0/22 +103.108.196.0/22 +103.108.208.0/22 +103.108.212.0/22 +103.108.224.0/22 +103.108.251.0/24 +103.109.20.0/22 +103.109.48.0/22 +103.109.88.0/22 +103.109.106.0/23 +103.109.248.0/22 +103.110.32.0/22 +103.110.80.0/23 +103.110.92.0/22 +103.110.100.0/22 +103.110.116.0/22 +103.110.127.0/24 +103.110.128.0/23 +103.110.131.0/24 +103.110.132.0/22 +103.110.136.0/22 +103.110.152.0/22 +103.110.188.0/22 +103.110.204.0/22 +103.111.38.0/23 +103.111.64.0/22 +103.111.172.0/22 +103.111.252.0/22 +103.112.28.0/22 +103.112.68.0/22 +103.112.72.0/22 +103.112.88.0/22 +103.112.92.0/22 +103.112.96.0/22 +103.112.108.0/22 +103.112.112.0/22 +103.112.116.0/22 +103.112.140.0/22 +103.112.172.0/22 +103.112.184.0/22 +103.112.208.0/22 +103.113.4.0/22 +103.113.92.0/22 +103.113.144.0/22 +103.113.220.0/22 +103.113.232.0/22 +103.113.236.0/22 +103.114.4.0/22 +103.114.28.0/22 +103.114.68.0/22 +103.114.72.0/22 +103.114.100.0/22 +103.114.132.0/22 +103.114.148.0/22 +103.114.156.0/22 +103.114.176.0/22 +103.114.212.0/22 +103.114.236.0/22 +103.114.240.0/22 +103.115.16.0/22 +103.115.40.0/22 +103.115.44.0/22 +103.115.48.0/22 +103.115.52.0/22 +103.115.56.0/22 +103.115.60.0/22 +103.115.64.0/22 +103.115.68.0/22 +103.115.92.0/22 +103.115.120.0/22 +103.115.148.0/22 +103.115.204.0/23 +103.115.248.0/22 +103.116.20.0/22 +103.116.40.0/22 +103.116.64.0/22 +103.116.72.0/22 +103.116.76.0/22 +103.116.92.0/22 +103.116.120.0/22 +103.116.128.0/22 +103.116.132.0/23 +103.116.148.0/22 +103.116.184.0/22 +103.116.206.0/23 +103.116.220.0/22 +103.116.224.0/22 +103.116.228.0/22 +103.117.16.0/22 +103.117.72.0/22 +103.117.88.0/22 +103.117.132.0/22 +103.117.136.0/22 +103.117.220.0/22 +103.118.19.0/24 +103.118.36.0/22 +103.118.52.0/22 +103.118.56.0/22 +103.118.60.0/22 +103.118.64.0/22 +103.118.68.0/22 +103.118.72.0/22 +103.118.88.0/22 +103.118.173.0/24 +103.118.192.0/22 +103.118.196.0/22 +103.118.200.0/22 +103.118.204.0/22 +103.118.208.0/22 +103.118.212.0/22 +103.118.216.0/22 +103.118.220.0/22 +103.118.240.0/22 +103.118.244.0/22 +103.118.248.0/22 +103.118.252.0/22 +103.119.0.0/22 +103.119.12.0/22 +103.119.16.0/22 +103.119.28.0/22 +103.119.44.0/22 +103.119.104.0/22 +103.119.115.0/24 +103.119.156.0/22 +103.119.180.0/22 +103.119.200.0/22 +103.119.224.0/22 +103.120.52.0/22 +103.120.72.0/22 +103.120.76.0/24 +103.120.88.0/22 +103.120.96.0/22 +103.120.100.0/22 +103.120.140.0/22 +103.120.196.0/22 +103.120.224.0/22 +103.121.52.0/22 +103.121.92.0/22 +103.121.160.0/22 +103.121.164.0/22 +103.121.250.0/24 +103.121.252.0/22 +103.122.48.0/22 +103.122.176.0/22 +103.122.192.0/22 +103.122.240.0/22 +103.123.4.0/22 +103.123.88.0/22 +103.123.92.0/22 +103.123.116.0/22 +103.123.160.0/22 +103.123.176.0/22 +103.123.200.0/22 +103.123.204.0/22 +103.123.208.0/22 +103.123.212.0/22 +103.124.24.0/22 +103.124.48.0/22 +103.124.64.0/22 +103.124.212.0/22 +103.124.216.0/22 +103.125.20.0/22 +103.125.44.0/22 +103.125.132.0/22 +103.125.164.0/22 +103.125.196.0/22 +103.125.236.0/22 +103.125.248.0/22 +103.126.0.0/22 +103.126.16.0/22 +103.126.44.0/22 +103.129.52.0/22 +103.129.148.0/22 +103.130.132.0/22 +103.130.152.0/24 +103.130.160.0/22 +103.130.228.0/22 +103.131.20.0/22 +103.131.36.0/22 +103.131.152.0/22 +103.131.168.0/22 +103.131.176.0/22 +103.131.224.0/22 +103.131.228.0/22 +103.131.240.0/22 +103.192.8.0/22 +103.192.12.0/22 +103.192.16.0/22 +103.192.20.0/22 +103.192.24.0/22 +103.192.28.0/22 +103.192.48.0/22 +103.192.52.0/22 +103.192.56.0/22 +103.192.84.0/22 +103.192.88.0/22 +103.192.92.0/22 +103.192.96.0/22 +103.192.100.0/22 +103.192.104.0/22 +103.192.108.0/22 +103.192.112.0/22 +103.192.128.0/22 +103.192.136.0/22 +103.192.140.0/22 +103.192.164.0/22 +103.192.208.0/22 +103.192.216.0/22 +103.192.252.0/22 +103.193.40.0/22 +103.193.44.0/22 +103.193.120.0/22 +103.193.124.0/22 +103.193.144.0/22 +103.193.148.0/22 +103.193.160.0/22 +103.193.188.0/22 +103.193.192.0/22 +103.193.212.0/22 +103.193.216.0/22 +103.193.220.0/22 +103.193.224.0/22 +103.193.228.0/22 +103.193.232.0/22 +103.193.236.0/22 +103.193.240.0/22 +103.194.16.0/22 +103.195.104.0/22 +103.195.112.0/22 +103.195.136.0/22 +103.195.148.0/22 +103.195.152.0/22 +103.195.160.0/22 +103.195.192.0/22 +103.196.60.0/22 +103.196.64.0/22 +103.196.72.0/22 +103.196.88.0/22 +103.196.92.0/22 +103.196.96.0/22 +103.196.168.0/22 +103.196.204.0/22 +103.197.180.0/22 +103.197.228.0/22 +103.198.20.0/22 +103.198.60.0/22 +103.198.64.0/22 +103.198.72.0/22 +103.198.124.0/22 +103.198.156.0/22 +103.198.180.0/22 +103.198.196.0/22 +103.198.200.0/22 +103.198.216.0/22 +103.198.220.0/22 +103.198.224.0/22 +103.198.228.0/22 +103.198.232.0/22 +103.198.236.0/22 +103.198.240.0/22 +103.198.244.0/22 +103.199.164.0/22 +103.199.196.0/22 +103.199.228.0/22 +103.199.248.0/22 +103.199.252.0/22 +103.200.28.0/22 +103.200.32.0/22 +103.200.52.0/22 +103.200.64.0/22 +103.200.68.0/22 +103.200.136.0/22 +103.200.140.0/22 +103.200.144.0/22 +103.200.148.0/22 +103.200.152.0/22 +103.200.156.0/22 +103.200.160.0/22 +103.200.164.0/22 +103.200.168.0/22 +103.200.172.0/22 +103.200.176.0/22 +103.200.180.0/22 +103.200.184.0/22 +103.200.188.0/22 +103.200.192.0/22 +103.200.220.0/22 +103.200.224.0/22 +103.200.228.0/22 +103.200.232.0/22 +103.200.236.0/22 +103.200.240.0/22 +103.200.244.0/22 +103.200.248.0/22 +103.200.252.0/22 +103.201.0.0/22 +103.201.4.0/22 +103.201.8.0/22 +103.201.12.0/22 +103.201.16.0/22 +103.201.20.0/22 +103.201.28.0/22 +103.201.32.0/22 +103.201.36.0/22 +103.201.40.0/22 +103.201.44.0/22 +103.201.48.0/22 +103.201.52.0/22 +103.201.56.0/22 +103.201.60.0/22 +103.201.64.0/22 +103.201.76.0/22 +103.201.80.0/22 +103.201.84.0/22 +103.201.88.0/22 +103.201.92.0/22 +103.201.96.0/22 +103.201.100.0/22 +103.201.104.0/22 +103.201.108.0/22 +103.201.112.0/22 +103.201.116.0/22 +103.201.120.0/22 +103.201.152.0/22 +103.201.156.0/22 +103.201.160.0/22 +103.201.164.0/22 +103.201.168.0/22 +103.201.172.0/22 +103.201.176.0/22 +103.201.180.0/22 +103.201.184.0/22 +103.201.188.0/22 +103.201.192.0/22 +103.201.196.0/22 +103.201.200.0/22 +103.201.204.0/22 +103.201.208.0/22 +103.201.212.0/22 +103.201.216.0/22 +103.201.220.0/22 +103.201.224.0/22 +103.201.228.0/22 +103.201.232.0/22 +103.201.236.0/22 +103.201.240.0/22 +103.201.244.0/22 +103.201.248.0/22 +103.201.252.0/22 +103.202.0.0/22 +103.202.4.0/22 +103.202.8.0/22 +103.202.12.0/22 +103.202.16.0/22 +103.202.20.0/22 +103.202.24.0/22 +103.202.28.0/22 +103.202.32.0/22 +103.202.36.0/22 +103.202.40.0/22 +103.202.44.0/22 +103.202.56.0/22 +103.202.60.0/22 +103.202.64.0/22 +103.202.68.0/22 +103.202.72.0/22 +103.202.76.0/22 +103.202.80.0/22 +103.202.84.0/22 +103.202.88.0/22 +103.202.92.0/22 +103.202.96.0/22 +103.202.100.0/22 +103.202.104.0/22 +103.202.108.0/22 +103.202.112.0/22 +103.202.116.0/22 +103.202.120.0/22 +103.202.124.0/22 +103.202.128.0/22 +103.202.132.0/22 +103.202.136.0/22 +103.202.140.0/22 +103.202.144.0/22 +103.202.152.0/22 +103.202.156.0/22 +103.202.160.0/22 +103.202.164.0/22 +103.202.168.0/22 +103.202.172.0/22 +103.202.176.0/22 +103.202.180.0/22 +103.202.184.0/22 +103.202.188.0/22 +103.202.192.0/22 +103.202.196.0/22 +103.202.200.0/21 +103.202.212.0/22 +103.202.228.0/22 +103.202.236.0/22 +103.202.240.0/22 +103.202.244.0/22 +103.202.248.0/22 +103.202.252.0/22 +103.203.0.0/22 +103.203.4.0/22 +103.203.8.0/22 +103.203.12.0/22 +103.203.16.0/22 +103.203.20.0/22 +103.203.24.0/22 +103.203.28.0/22 +103.203.32.0/22 +103.203.52.0/22 +103.203.56.0/22 +103.203.96.0/22 +103.203.100.0/22 +103.203.104.0/22 +103.203.108.0/22 +103.203.112.0/22 +103.203.116.0/22 +103.203.120.0/22 +103.203.124.0/22 +103.203.128.0/22 +103.203.140.0/22 +103.203.192.0/22 +103.203.200.0/22 +103.203.212.0/22 +103.203.216.0/22 +103.204.24.0/22 +103.204.88.0/22 +103.204.112.0/22 +103.204.140.0/22 +103.204.144.0/22 +103.204.148.0/22 +103.204.152.0/22 +103.204.196.0/22 +103.204.232.0/22 +103.204.236.0/22 +103.205.8.0/22 +103.205.40.0/22 +103.205.44.0/22 +103.205.52.0/22 +103.205.120.0/22 +103.205.136.0/22 +103.205.162.0/24 +103.205.188.0/22 +103.205.196.0/22 +103.205.200.0/22 +103.205.236.0/22 +103.205.248.0/22 +103.206.0.0/22 +103.206.44.0/22 +103.206.108.0/22 +103.206.148.0/22 +103.207.48.0/22 +103.207.104.0/22 +103.207.164.0/22 +103.207.188.0/22 +103.207.192.0/22 +103.207.196.0/22 +103.207.200.0/22 +103.207.204.0/22 +103.207.208.0/22 +103.207.212.0/22 +103.207.220.0/22 +103.208.12.0/22 +103.208.16.0/22 +103.208.28.0/22 +103.208.40.0/22 +103.208.44.0/22 +103.208.48.0/22 +103.208.148.0/22 +103.209.112.0/22 +103.209.136.0/22 +103.209.200.0/22 +103.209.208.0/22 +103.209.216.0/22 +103.210.0.0/22 +103.210.20.0/22 +103.210.96.0/22 +103.210.156.0/22 +103.210.160.0/22 +103.210.164.0/22 +103.210.168.0/22 +103.210.172.0/22 +103.210.176.0/22 +103.210.180.0/22 +103.210.188.0/22 +103.210.216.0/22 +103.211.100.0/22 +103.211.156.0/22 +103.211.164.0/22 +103.211.192.0/22 +103.211.224.0/22 +103.211.248.0/22 +103.212.0.0/22 +103.212.4.0/22 +103.212.8.0/22 +103.212.12.0/22 +103.212.32.0/22 +103.212.44.0/22 +103.212.48.0/22 +103.212.84.0/22 +103.212.104.0/22 +103.212.148.0/22 +103.212.164.0/22 +103.212.196.0/22 +103.212.200.0/22 +103.212.228.0/22 +103.212.252.0/22 +103.213.40.0/22 +103.213.44.0/22 +103.213.48.0/22 +103.213.52.0/22 +103.213.56.0/22 +103.213.60.0/22 +103.213.64.0/22 +103.213.68.0/22 +103.213.72.0/22 +103.213.76.0/22 +103.213.80.0/22 +103.213.84.0/22 +103.213.88.0/22 +103.213.92.0/22 +103.213.136.0/22 +103.213.140.0/22 +103.213.144.0/22 +103.213.148.0/22 +103.213.152.0/22 +103.213.156.0/22 +103.213.160.0/22 +103.213.164.0/22 +103.213.168.0/22 +103.213.172.0/22 +103.213.176.0/22 +103.213.180.0/22 +103.213.184.0/22 +103.213.188.0/22 +103.213.248.0/22 +103.214.32.0/22 +103.214.84.0/22 +103.214.168.0/22 +103.214.212.0/22 +103.214.240.0/22 +103.214.244.0/22 +103.215.28.0/22 +103.215.32.0/22 +103.215.44.0/22 +103.215.48.0/22 +103.215.100.0/22 +103.215.104.0/22 +103.215.108.0/22 +103.215.116.0/22 +103.215.120.0/22 +103.215.140.0/22 +103.215.184.0/22 +103.215.228.0/22 +103.216.4.0/22 +103.216.8.0/22 +103.216.12.0/22 +103.216.16.0/22 +103.216.20.0/22 +103.216.24.0/22 +103.216.28.0/22 +103.216.32.0/22 +103.216.36.0/22 +103.216.40.0/22 +103.216.44.0/22 +103.216.64.0/22 +103.216.108.0/22 +103.216.136.0/22 +103.216.224.0/22 +103.216.228.0/22 +103.216.240.0/22 +103.216.244.0/22 +103.216.248.0/22 +103.217.0.0/22 +103.217.4.0/22 +103.217.8.0/22 +103.217.12.0/22 +103.217.16.0/22 +103.217.20.0/22 +103.217.24.0/22 +103.217.28.0/22 +103.217.32.0/22 +103.217.36.0/22 +103.217.40.0/22 +103.217.44.0/22 +103.217.48.0/22 +103.217.52.0/22 +103.217.56.0/22 +103.217.60.0/22 +103.217.168.0/22 +103.217.180.0/22 +103.217.184.0/22 +103.217.188.0/22 +103.217.192.0/22 +103.217.196.0/22 +103.217.200.0/22 +103.217.204.0/22 +103.218.0.0/22 +103.218.92.0/22 +103.218.184.0/22 +103.218.192.0/22 +103.218.196.0/22 +103.218.200.0/22 +103.218.204.0/22 +103.218.208.0/22 +103.218.212.0/22 +103.218.216.0/22 +103.219.24.0/22 +103.219.64.0/22 +103.219.84.0/22 +103.219.88.0/22 +103.219.92.0/22 +103.219.96.0/22 +103.219.100.0/22 +103.219.176.0/22 +103.219.184.0/22 +103.220.56.0/22 +103.220.60.0/22 +103.220.64.0/22 +103.220.92.0/22 +103.220.96.0/22 +103.220.100.0/22 +103.220.104.0/22 +103.220.108.0/22 +103.220.116.0/22 +103.220.120.0/22 +103.220.124.0/22 +103.220.128.0/22 +103.220.132.0/22 +103.220.136.0/22 +103.220.140.0/22 +103.220.144.0/22 +103.220.148.0/22 +103.220.152.0/22 +103.220.160.0/22 +103.220.164.0/22 +103.220.168.0/22 +103.220.172.0/22 +103.220.176.0/22 +103.220.180.0/22 +103.220.184.0/22 +103.220.188.0/22 +103.220.192.0/22 +103.220.196.0/22 +103.220.200.0/22 +103.220.240.0/22 +103.220.244.0/22 +103.220.248.0/22 +103.220.252.0/22 +103.221.0.0/22 +103.221.4.0/22 +103.221.8.0/22 +103.221.12.0/22 +103.221.16.0/22 +103.221.20.0/22 +103.221.24.0/22 +103.221.28.0/22 +103.221.32.0/22 +103.221.36.0/22 +103.221.40.0/22 +103.221.44.0/22 +103.221.48.0/22 +103.221.92.0/22 +103.221.96.0/22 +103.221.100.0/22 +103.221.104.0/22 +103.221.108.0/22 +103.221.112.0/22 +103.221.116.0/22 +103.221.120.0/22 +103.221.124.0/22 +103.221.128.0/22 +103.221.136.0/22 +103.221.144.0/22 +103.221.148.0/22 +103.221.152.0/22 +103.221.160.0/22 +103.221.164.0/22 +103.221.168.0/22 +103.221.172.0/22 +103.221.176.0/22 +103.221.200.0/22 +103.221.204.0/22 +103.222.52.0/22 +103.222.112.0/22 +103.222.116.0/22 +103.222.120.0/22 +103.222.124.0/22 +103.222.128.0/22 +103.222.132.0/22 +103.222.136.0/22 +103.222.140.0/22 +103.222.144.0/22 +103.222.148.0/22 +103.222.152.0/22 +103.222.156.0/22 +103.222.160.0/22 +103.222.168.0/22 +103.222.176.0/22 +103.222.180.0/22 +103.222.184.0/22 +103.222.188.0/22 +103.222.192.0/22 +103.222.216.0/22 +103.222.220.0/22 +103.222.224.0/22 +103.222.228.0/22 +103.222.232.0/22 +103.222.240.0/22 +103.222.244.0/22 +103.223.16.0/22 +103.223.20.0/22 +103.223.24.0/22 +103.223.28.0/22 +103.223.32.0/22 +103.223.36.0/22 +103.223.40.0/22 +103.223.44.0/22 +103.223.48.0/22 +103.223.52.0/22 +103.223.56.0/22 +103.223.60.0/22 +103.223.64.0/22 +103.223.68.0/22 +103.223.72.0/22 +103.223.76.0/22 +103.223.80.0/22 +103.223.84.0/22 +103.223.88.0/22 +103.223.92.0/22 +103.223.96.0/22 +103.223.100.0/22 +103.223.104.0/22 +103.223.108.0/22 +103.223.112.0/22 +103.223.116.0/22 +103.223.120.0/22 +103.223.124.0/22 +103.223.128.0/22 +103.223.132.0/22 +103.223.144.0/22 +103.223.148.0/22 +103.223.152.0/22 +103.223.156.0/22 +103.223.160.0/22 +103.223.164.0/22 +103.223.168.0/22 +103.223.172.0/22 +103.223.176.0/22 +103.223.180.0/22 +103.223.192.0/22 +103.223.196.0/22 +103.223.200.0/22 +103.223.204.0/22 +103.223.208.0/22 +103.223.212.0/22 +103.223.216.0/22 +103.223.220.0/22 +103.223.224.0/22 +103.223.228.0/22 +103.223.232.0/22 +103.223.236.0/22 +103.223.240.0/22 +103.223.244.0/22 +103.223.248.0/22 +103.223.252.0/22 +103.224.0.0/22 +103.224.40.0/22 +103.224.44.0/22 +103.224.60.0/22 +103.224.80.0/22 +103.224.220.0/22 +103.224.224.0/22 +103.224.232.0/22 +103.225.84.0/22 +103.226.16.0/22 +103.226.40.0/22 +103.226.56.0/22 +103.226.60.0/22 +103.226.80.0/22 +103.226.132.0/22 +103.226.156.0/22 +103.226.180.0/22 +103.226.196.0/22 +103.227.48.0/22 +103.227.72.0/22 +103.227.76.0/22 +103.227.80.0/22 +103.227.100.0/22 +103.227.132.0/22 +103.227.196.0/22 +103.227.204.0/22 +103.227.212.0/22 +103.227.228.0/22 +103.228.12.0/22 +103.228.28.0/22 +103.228.68.0/22 +103.228.88.0/22 +103.228.128.0/22 +103.228.136.0/22 +103.228.160.0/22 +103.228.176.0/22 +103.228.208.0/22 +103.228.228.0/22 +103.228.232.0/22 +103.229.20.0/22 +103.229.60.0/22 +103.229.136.0/22 +103.229.172.0/22 +103.229.216.0/22 +103.229.220.0/22 +103.229.228.0/22 +103.229.236.0/22 +103.229.240.0/22 +103.230.0.0/22 +103.230.28.0/22 +103.230.44.0/22 +103.230.96.0/22 +103.230.200.0/22 +103.230.204.0/22 +103.230.212.0/22 +103.231.16.0/22 +103.231.20.0/22 +103.231.64.0/22 +103.231.68.0/22 +103.231.144.0/22 +103.231.180.0/22 +103.231.184.0/22 +103.231.244.0/22 +103.232.4.0/22 +103.232.144.0/22 +103.232.188.0/22 +103.232.212.0/22 +103.233.4.0/22 +103.233.44.0/22 +103.233.52.0/22 +103.233.104.0/22 +103.233.128.0/22 +103.233.136.0/22 +103.234.0.0/22 +103.234.20.0/22 +103.234.128.0/22 +103.234.172.0/22 +103.234.180.0/22 +103.235.16.0/22 +103.235.48.0/22 +103.235.56.0/22 +103.235.60.0/22 +103.235.80.0/22 +103.235.84.0/22 +103.235.128.0/22 +103.235.132.0/22 +103.235.136.0/22 +103.235.140.0/22 +103.235.144.0/22 +103.235.148.0/22 +103.235.184.0/22 +103.235.192.0/22 +103.235.200.0/22 +103.235.220.0/22 +103.235.224.0/22 +103.235.228.0/22 +103.235.232.0/22 +103.235.236.0/22 +103.235.240.0/22 +103.235.244.0/22 +103.235.248.0/22 +103.235.252.0/22 +103.236.0.0/22 +103.236.4.0/22 +103.236.8.0/22 +103.236.12.0/22 +103.236.16.0/22 +103.236.20.0/22 +103.236.24.0/22 +103.236.28.0/22 +103.236.32.0/22 +103.236.36.0/22 +103.236.40.0/22 +103.236.44.0/22 +103.236.48.0/22 +103.236.52.0/22 +103.236.56.0/22 +103.236.60.0/22 +103.236.64.0/22 +103.236.68.0/22 +103.236.72.0/22 +103.236.76.0/22 +103.236.80.0/22 +103.236.84.0/22 +103.236.88.0/22 +103.236.92.0/22 +103.236.96.0/22 +103.236.184.0/22 +103.236.220.0/22 +103.236.232.0/22 +103.236.244.0/22 +103.236.248.0/22 +103.237.0.0/22 +103.237.4.0/22 +103.237.8.0/22 +103.237.12.0/22 +103.237.24.0/22 +103.237.28.0/22 +103.237.68.0/22 +103.237.88.0/22 +103.237.152.0/22 +103.237.176.0/22 +103.237.180.0/22 +103.237.184.0/22 +103.237.188.0/22 +103.237.192.0/22 +103.237.196.0/22 +103.237.200.0/22 +103.237.204.0/22 +103.237.208.0/22 +103.237.212.0/22 +103.237.216.0/22 +103.237.220.0/22 +103.237.224.0/22 +103.237.228.0/22 +103.237.232.0/22 +103.237.236.0/22 +103.237.240.0/22 +103.237.244.0/22 +103.237.248.0/22 +103.237.252.0/22 +103.238.0.0/22 +103.238.4.0/22 +103.238.16.0/22 +103.238.20.0/22 +103.238.24.0/22 +103.238.36.0/22 +103.238.40.0/22 +103.238.44.0/22 +103.238.48.0/22 +103.238.52.0/22 +103.238.56.0/22 +103.238.88.0/22 +103.238.92.0/22 +103.238.96.0/22 +103.238.132.0/22 +103.238.164.0/22 +103.238.168.0/22 +103.238.172.0/22 +103.238.176.0/22 +103.238.180.0/22 +103.238.188.0/22 +103.238.196.0/22 +103.238.204.0/22 +103.238.252.0/22 +103.239.0.0/22 +103.239.44.0/22 +103.239.68.0/22 +103.239.96.0/22 +103.239.156.0/22 +103.239.176.0/22 +103.239.180.0/22 +103.239.184.0/22 +103.239.192.0/22 +103.239.196.0/22 +103.239.204.0/22 +103.239.208.0/22 +103.239.224.0/22 +103.240.16.0/22 +103.240.156.0/22 +103.240.188.0/22 +103.240.244.0/22 +103.241.12.0/22 +103.241.72.0/22 +103.241.92.0/22 +103.241.96.0/22 +103.241.160.0/22 +103.241.184.0/22 +103.241.188.0/22 +103.241.220.0/22 +103.242.64.0/22 +103.242.128.0/22 +103.242.132.0/22 +103.242.160.0/22 +103.242.168.0/22 +103.242.172.0/22 +103.242.176.0/22 +103.242.200.0/22 +103.242.212.0/22 +103.242.220.0/22 +103.242.240.0/22 +103.243.136.0/22 +103.243.252.0/22 +103.244.16.0/22 +103.244.58.0/23 +103.244.60.0/22 +103.244.64.0/22 +103.244.68.0/22 +103.244.72.0/22 +103.244.76.0/22 +103.244.80.0/22 +103.244.84.0/22 +103.244.116.0/22 +103.244.164.0/22 +103.244.232.0/22 +103.244.252.0/22 +103.245.23.0/24 +103.245.52.0/22 +103.245.60.0/22 +103.245.80.0/22 +103.245.124.0/22 +103.245.128.0/22 +103.246.12.0/22 +103.246.120.0/22 +103.246.124.0/22 +103.246.132.0/22 +103.246.156.0/22 +103.247.168.0/22 +103.247.172.0/22 +103.247.176.0/22 +103.247.200.0/22 +103.247.212.0/22 +103.248.0.0/23 +103.248.64.0/22 +103.248.124.0/22 +103.248.168.0/22 +103.248.192.0/22 +103.248.212.0/22 +103.248.220.0/22 +103.248.224.0/22 +103.249.8.0/22 +103.249.12.0/22 +103.249.52.0/22 +103.249.104.0/22 +103.249.128.0/22 +103.249.136.0/22 +103.249.144.0/22 +103.249.164.0/22 +103.249.168.0/22 +103.249.172.0/22 +103.249.176.0/22 +103.249.188.0/22 +103.249.192.0/22 +103.249.244.0/22 +103.249.252.0/22 +103.250.224.0/22 +103.250.236.0/22 +103.250.252.0/22 +103.251.36.0/22 +103.251.84.0/22 +103.251.128.0/22 +103.251.192.0/22 +103.251.204.0/22 +103.251.236.0/22 +103.252.28.0/22 +103.252.36.0/22 +103.252.64.0/22 +103.252.96.0/22 +103.252.104.0/22 +103.252.172.0/22 +103.253.4.0/22 +103.253.204.0/22 +103.253.220.0/22 +103.253.224.0/22 +103.253.232.0/22 +103.254.8.0/22 +103.254.20.0/22 +103.254.64.0/22 +103.254.68.0/22 +103.254.72.0/22 +103.254.76.0/22 +103.254.112.0/22 +103.254.176.0/22 +103.254.196.0/24 +103.254.220.0/22 +103.255.56.0/22 +103.255.68.0/22 +103.255.92.0/22 +103.255.136.0/22 +103.255.140.0/22 +103.255.184.0/22 +103.255.212.0/22 +103.255.228.0/22 +106.0.44.0/22 +106.2.0.0/15 +106.11.0.0/16 +106.12.0.0/14 +106.50.0.0/16 +106.52.0.0/14 +106.74.0.0/16 +106.75.0.0/16 +109.244.0.0/16 +110.34.40.0/22 +110.34.44.0/22 +110.40.0.0/14 +110.44.144.0/20 +110.48.0.0/16 +110.51.0.0/16 +110.56.0.0/13 +110.75.0.0/17 +110.75.128.0/19 +110.75.160.0/19 +110.75.192.0/18 +110.76.0.0/19 +110.76.32.0/19 +110.76.132.0/22 +110.76.192.0/18 +110.77.0.0/17 +110.92.68.0/22 +110.165.32.0/19 +110.172.192.0/18 +110.173.0.0/19 +110.173.32.0/20 +110.173.96.0/19 +110.173.192.0/19 +110.232.32.0/19 +111.66.0.0/16 +111.67.192.0/20 +111.68.64.0/19 +111.91.192.0/19 +111.92.248.0/22 +111.92.252.0/22 +111.118.200.0/21 +111.119.64.0/18 +111.119.128.0/19 +111.128.0.0/11 +111.208.0.0/14 +111.212.0.0/14 +111.221.28.0/24 +111.221.128.0/17 +111.222.0.0/16 +111.223.4.0/22 +111.223.8.0/22 +111.223.16.0/22 +111.223.240.0/22 +111.223.248.0/22 +111.228.0.0/14 +111.235.96.0/19 +111.235.160.0/19 +112.73.0.0/16 +112.74.0.0/15 +112.124.0.0/14 +112.128.0.0/14 +113.11.192.0/19 +113.21.232.0/22 +113.21.236.0/22 +113.31.0.0/16 +113.44.0.0/14 +113.48.0.0/14 +113.52.160.0/19 +113.52.228.0/22 +113.130.96.0/20 +113.130.112.0/21 +113.197.100.0/22 +113.202.0.0/16 +113.208.96.0/19 +113.212.0.0/18 +113.212.100.0/22 +113.214.0.0/15 +114.28.0.0/16 +114.31.64.0/22 +114.31.68.0/22 +114.64.0.0/14 +114.68.0.0/16 +114.110.0.0/20 +114.110.64.0/18 +114.111.0.0/19 +114.111.160.0/19 +114.112.0.0/14 +114.116.0.0/16 +114.117.0.0/16 +114.118.0.0/16 +114.119.128.0/18 +114.119.192.0/21 +114.119.200.0/22 +114.119.204.0/22 +114.119.208.0/20 +114.132.0.0/16 +114.141.80.0/22 +114.141.84.0/22 +114.141.128.0/18 +114.196.0.0/15 +114.208.0.0/14 +114.215.0.0/16 +115.28.0.0/15 +115.31.64.0/22 +115.31.68.0/22 +115.31.72.0/22 +115.31.76.0/22 +115.32.0.0/14 +115.42.56.0/22 +115.44.0.0/15 +115.47.0.0/16 +115.84.0.0/18 +115.84.192.0/19 +115.100.0.0/14 +115.104.0.0/14 +115.120.0.0/14 +115.124.16.0/20 +115.159.0.0/16 +115.182.0.0/16 +115.183.0.0/16 +115.187.0.0/22 +115.187.4.0/22 +115.187.8.0/22 +115.187.12.0/22 +116.58.128.0/20 +116.58.208.0/20 +116.66.0.0/17 +116.66.176.0/22 +116.68.136.0/22 +116.68.140.0/22 +116.68.176.0/22 +116.68.180.0/22 +116.69.0.0/16 +116.76.0.0/15 +116.85.0.0/16 +116.89.144.0/20 +116.89.240.0/22 +116.90.80.0/20 +116.90.184.0/21 +116.193.16.0/20 +116.193.32.0/19 +116.193.152.0/22 +116.193.164.0/22 +116.196.0.0/16 +116.197.160.0/22 +116.197.164.0/22 +116.198.0.0/16 +116.199.128.0/19 +116.204.0.0/17 +116.204.132.0/22 +116.204.168.0/22 +116.204.216.0/22 +116.205.0.0/16 +116.206.92.0/22 +116.206.100.0/22 +116.206.176.0/22 +116.212.160.0/20 +116.213.44.0/22 +116.213.64.0/18 +116.213.128.0/17 +116.214.64.0/20 +116.214.128.0/17 +116.215.0.0/16 +116.251.64.0/18 +116.254.104.0/22 +116.254.108.0/22 +117.48.0.0/14 +117.53.48.0/20 +117.53.176.0/20 +117.58.0.0/17 +117.59.0.0/16 +117.72.0.0/15 +117.74.128.0/17 +117.103.16.0/20 +117.103.128.0/20 +117.106.0.0/15 +117.112.0.0/13 +117.120.64.0/18 +117.120.128.0/17 +117.121.0.0/17 +117.121.192.0/21 +117.124.0.0/14 +118.24.0.0/15 +118.26.0.0/19 +118.26.32.0/22 +118.26.36.0/22 +118.26.40.0/21 +118.26.56.0/21 +118.26.64.0/19 +118.26.96.0/21 +118.26.104.0/21 +118.26.112.0/21 +118.26.120.0/21 +118.26.128.0/17 +118.28.0.0/15 +118.30.0.0/16 +118.31.0.0/16 +118.64.0.0/15 +118.66.0.0/16 +118.67.112.0/20 +118.89.0.0/16 +118.91.240.0/20 +118.102.16.0/20 +118.103.164.0/22 +118.103.172.0/22 +118.103.176.0/22 +118.107.180.0/22 +118.126.0.0/16 +118.178.0.0/16 +118.184.0.0/17 +118.184.128.0/17 +118.186.0.0/15 +118.188.0.0/16 +118.190.0.0/16 +118.191.0.0/16 +118.192.0.0/16 +118.193.0.0/21 +118.193.8.0/21 +118.193.32.0/19 +118.193.64.0/20 +118.193.96.0/19 +118.193.128.0/17 +118.194.0.0/17 +118.194.128.0/17 +118.195.0.0/17 +118.195.128.0/17 +118.196.0.0/14 +118.242.0.0/16 +119.2.0.0/19 +119.2.128.0/17 +119.3.0.0/16 +119.8.0.0/16 +119.10.0.0/17 +119.15.136.0/21 +119.16.0.0/16 +119.18.192.0/20 +119.18.208.0/21 +119.18.224.0/20 +119.18.240.0/20 +119.19.0.0/16 +119.20.0.0/14 +119.27.160.0/19 +119.27.192.0/18 +119.28.0.0/15 +119.30.48.0/20 +119.31.192.0/19 +119.37.192.0/18 +119.38.128.0/18 +119.38.192.0/20 +119.38.208.0/20 +119.38.224.0/19 +119.40.0.0/18 +119.40.64.0/20 +119.42.52.0/22 +119.42.136.0/21 +119.57.0.0/16 +119.58.0.0/16 +119.61.0.0/16 +119.63.32.0/19 +119.75.208.0/20 +119.78.0.0/15 +119.80.0.0/16 +119.88.0.0/14 +119.161.120.0/22 +119.161.124.0/22 +119.161.128.0/17 +119.235.128.0/18 +119.253.0.0/16 +119.254.0.0/15 +120.24.0.0/14 +120.30.0.0/16 +120.31.0.0/16 +120.44.0.0/14 +120.48.0.0/15 +120.52.0.0/16 +120.53.0.0/16 +120.54.0.0/15 +120.64.0.0/14 +120.72.32.0/19 +120.72.128.0/17 +120.76.0.0/14 +120.92.0.0/16 +120.132.0.0/17 +120.132.128.0/17 +120.134.0.0/15 +120.136.16.0/22 +120.136.20.0/22 +120.136.128.0/18 +120.137.0.0/17 +121.0.16.0/20 +121.4.0.0/15 +121.36.0.0/16 +121.37.0.0/16 +121.38.0.0/15 +121.40.0.0/14 +121.46.0.0/18 +121.46.76.0/22 +121.46.128.0/17 +121.47.0.0/16 +121.51.0.0/16 +121.52.208.0/20 +121.54.188.0/22 +121.58.144.0/20 +121.79.128.0/18 +121.89.0.0/16 +121.101.208.0/20 +121.196.0.0/14 +121.255.0.0/16 +122.0.64.0/18 +122.0.128.0/17 +122.8.0.0/16 +122.9.0.0/16 +122.10.128.0/22 +122.10.132.0/23 +122.10.134.0/23 +122.10.136.0/23 +122.10.138.0/23 +122.10.140.0/22 +122.10.144.0/20 +122.10.160.0/19 +122.10.192.0/20 +122.10.208.0/21 +122.10.216.0/22 +122.10.220.0/22 +122.10.224.0/19 +122.11.0.0/17 +122.12.0.0/16 +122.14.0.0/17 +122.14.128.0/18 +122.14.192.0/18 +122.48.0.0/16 +122.49.0.0/18 +122.51.0.0/16 +122.102.0.0/20 +122.112.0.0/18 +122.112.64.0/18 +122.112.128.0/17 +122.113.0.0/16 +122.114.0.0/16 +122.115.0.0/17 +122.115.128.0/19 +122.115.160.0/19 +122.115.192.0/19 +122.115.224.0/19 +122.119.0.0/16 +122.128.100.0/22 +122.144.128.0/17 +122.152.192.0/18 +122.198.0.0/16 +122.200.40.0/22 +122.200.44.0/22 +122.200.64.0/18 +122.201.48.0/20 +122.248.48.0/20 +123.0.128.0/18 +123.49.128.0/17 +123.56.0.0/15 +123.58.0.0/20 +123.58.16.0/20 +123.58.32.0/19 +123.58.64.0/19 +123.58.96.0/19 +123.58.128.0/18 +123.58.192.0/19 +123.58.224.0/20 +123.58.240.0/20 +123.59.0.0/16 +123.60.0.0/16 +123.61.0.0/16 +123.62.0.0/16 +123.99.128.0/17 +123.108.128.0/20 +123.108.208.0/20 +123.136.80.0/20 +123.137.0.0/16 +123.176.60.0/22 +123.199.128.0/17 +123.206.0.0/15 +123.242.0.0/17 +123.242.192.0/22 +123.242.196.0/22 +123.249.0.0/16 +123.254.96.0/22 +123.254.100.0/22 +124.16.0.0/15 +124.22.0.0/15 +124.28.192.0/18 +124.29.0.0/17 +124.40.112.0/20 +124.40.128.0/18 +124.40.240.0/22 +124.42.0.0/17 +124.47.0.0/18 +124.108.8.0/21 +124.108.40.0/21 +124.126.0.0/15 +124.147.128.0/17 +124.150.137.0/24 +124.151.0.0/16 +124.174.0.0/15 +124.192.0.0/15 +124.196.0.0/16 +124.200.0.0/13 +124.220.0.0/14 +124.240.0.0/17 +124.242.0.0/16 +124.243.192.0/18 +124.248.0.0/17 +124.249.0.0/16 +124.250.0.0/15 +125.31.192.0/18 +125.58.128.0/17 +125.61.128.0/17 +125.62.0.0/18 +125.96.0.0/15 +125.98.0.0/16 +125.169.0.0/16 +125.210.0.0/16 +125.213.0.0/17 +125.215.0.0/18 +125.254.128.0/18 +125.254.192.0/18 +128.108.0.0/16 +129.28.0.0/16 +129.204.0.0/16 +129.211.0.0/16 +132.232.0.0/16 +134.175.0.0/16 +137.59.59.0/24 +137.59.88.0/22 +139.5.56.0/22 +139.5.60.0/22 +139.5.80.0/22 +139.5.92.0/22 +139.5.108.0/22 +139.5.128.0/22 +139.5.160.0/22 +139.5.192.0/22 +139.5.208.0/22 +139.5.244.0/22 +139.9.0.0/16 +139.129.0.0/16 +139.148.0.0/16 +139.155.0.0/16 +139.159.0.0/16 +139.176.0.0/16 +139.183.0.0/16 +139.186.0.0/16 +139.196.0.0/14 +139.217.0.0/16 +139.219.0.0/16 +139.220.0.0/15 +139.224.0.0/16 +140.143.0.0/16 +140.179.0.0/16 +140.205.0.0/16 +140.210.0.0/16 +144.48.8.0/22 +144.48.88.0/22 +144.48.156.0/22 +144.48.180.0/22 +144.48.184.0/22 +144.48.204.0/22 +144.48.208.0/22 +144.48.212.0/22 +144.48.220.0/22 +144.48.252.0/22 +146.56.192.0/18 +146.196.72.0/22 +146.196.92.0/22 +146.196.112.0/22 +146.196.116.0/22 +146.196.124.0/22 +148.70.0.0/16 +150.129.192.0/22 +150.129.216.0/22 +150.158.0.0/16 +150.242.0.0/22 +150.242.4.0/22 +150.242.8.0/22 +150.242.28.0/22 +150.242.44.0/22 +150.242.48.0/22 +150.242.52.0/22 +150.242.56.0/22 +150.242.76.0/22 +150.242.80.0/22 +150.242.92.0/22 +150.242.96.0/22 +150.242.112.0/22 +150.242.116.0/22 +150.242.120.0/22 +150.242.156.0/22 +150.242.160.0/22 +150.242.164.0/22 +150.242.168.0/22 +150.242.184.0/22 +150.242.188.0/22 +150.242.192.0/22 +150.242.212.0/22 +150.242.224.0/22 +150.242.228.0/22 +150.242.236.0/22 +150.242.240.0/22 +150.242.244.0/22 +150.242.248.0/22 +152.104.128.0/17 +152.136.0.0/16 +154.8.128.0/17 +157.119.0.0/22 +157.119.8.0/22 +157.119.12.0/22 +157.119.16.0/22 +157.119.28.0/22 +157.119.68.0/22 +157.119.112.0/22 +157.119.132.0/22 +157.119.136.0/22 +157.119.140.0/22 +157.119.144.0/22 +157.119.148.0/22 +157.119.152.0/22 +157.119.156.0/22 +157.119.160.0/22 +157.119.164.0/22 +157.119.172.0/22 +157.119.192.0/22 +157.119.196.0/22 +157.119.240.0/22 +157.119.252.0/22 +159.75.0.0/16 +159.226.0.0/16 +160.19.208.0/22 +160.19.216.0/22 +160.20.48.0/22 +160.202.168.0/22 +160.202.216.0/22 +160.202.220.0/22 +160.202.224.0/22 +160.202.228.0/22 +160.202.232.0/22 +160.202.236.0/22 +160.202.240.0/22 +160.202.244.0/22 +160.202.248.0/22 +160.202.252.0/22 +160.238.64.0/22 +161.189.0.0/16 +161.207.0.0/16 +162.14.0.0/16 +162.105.0.0/16 +163.47.4.0/22 +163.53.0.0/22 +163.53.4.0/22 +163.53.8.0/22 +163.53.12.0/22 +163.53.36.0/22 +163.53.40.0/22 +163.53.44.0/22 +163.53.56.0/22 +163.53.60.0/22 +163.53.64.0/22 +163.53.88.0/22 +163.53.92.0/22 +163.53.96.0/22 +163.53.100.0/22 +163.53.104.0/22 +163.53.108.0/22 +163.53.112.0/22 +163.53.116.0/22 +163.53.120.0/22 +163.53.124.0/22 +163.53.128.0/22 +163.53.132.0/22 +163.53.136.0/22 +163.53.160.0/22 +163.53.164.0/22 +163.53.172.0/22 +163.53.188.0/22 +163.53.240.0/22 +164.52.0.0/17 +166.111.0.0/16 +167.139.0.0/16 +167.189.0.0/16 +167.220.244.0/22 +168.160.0.0/16 +170.179.0.0/16 +171.84.0.0/14 +172.81.192.0/18 +175.24.0.0/14 +175.46.0.0/15 +175.48.0.0/12 +175.64.0.0/11 +175.102.0.0/16 +175.111.144.0/22 +175.111.148.0/22 +175.111.152.0/22 +175.111.156.0/22 +175.111.160.0/22 +175.111.164.0/22 +175.111.168.0/22 +175.111.172.0/22 +175.111.184.0/22 +175.158.96.0/22 +175.176.156.0/22 +175.176.176.0/22 +175.176.192.0/22 +175.178.0.0/16 +180.76.0.0/16 +180.78.0.0/15 +180.86.0.0/16 +180.94.56.0/21 +180.94.96.0/20 +180.94.120.0/22 +180.94.124.0/22 +180.148.224.0/19 +180.149.236.0/22 +180.150.160.0/19 +180.178.112.0/22 +180.178.116.0/22 +180.178.192.0/18 +180.184.0.0/14 +180.188.0.0/17 +180.200.252.0/22 +180.202.0.0/15 +180.210.212.0/22 +180.210.224.0/19 +180.222.224.0/19 +180.233.0.0/18 +180.233.64.0/19 +180.233.144.0/22 +180.235.64.0/19 +180.235.112.0/22 +180.235.136.0/22 +182.16.144.0/22 +182.16.148.0/22 +182.16.192.0/19 +182.18.0.0/17 +182.48.96.0/19 +182.49.0.0/16 +182.50.0.0/20 +182.50.112.0/20 +182.51.0.0/16 +182.54.244.0/22 +182.61.0.0/16 +182.80.0.0/14 +182.92.0.0/16 +182.157.0.0/16 +182.160.64.0/19 +182.174.0.0/15 +182.236.128.0/17 +182.237.24.0/22 +182.237.28.0/22 +182.238.0.0/16 +182.239.0.0/19 +182.254.0.0/16 +182.255.32.0/22 +182.255.36.0/22 +182.255.60.0/22 +183.78.160.0/22 +183.78.164.0/22 +183.81.172.0/22 +183.81.180.0/22 +183.84.0.0/15 +183.91.128.0/22 +183.91.144.0/20 +183.182.0.0/19 +188.131.128.0/17 +192.55.46.0/24 +192.55.68.0/22 +192.102.204.0/23 +192.140.128.0/22 +192.140.132.0/22 +192.140.136.0/22 +192.140.156.0/22 +192.140.160.0/22 +192.140.164.0/22 +192.140.168.0/22 +192.140.172.0/22 +192.140.176.0/22 +192.140.180.0/22 +192.140.184.0/22 +192.140.188.0/22 +192.140.192.0/22 +192.140.196.0/22 +192.140.200.0/22 +192.140.204.0/22 +192.144.128.0/17 +193.112.0.0/16 +198.175.100.0/22 +202.4.252.0/22 +202.5.208.0/22 +202.5.212.0/22 +202.5.216.0/22 +202.8.128.0/19 +202.10.64.0/20 +202.10.112.0/22 +202.10.116.0/22 +202.10.120.0/22 +202.10.124.0/22 +202.12.19.0/24 +202.14.172.0/22 +202.14.235.0/24 +202.14.236.0/23 +202.14.238.0/24 +202.20.126.0/24 +202.21.48.0/22 +202.21.52.0/22 +202.21.56.0/22 +202.21.60.0/22 +202.22.248.0/22 +202.22.252.0/22 +202.27.12.0/24 +202.27.14.0/24 +202.36.226.0/24 +202.38.8.0/21 +202.38.128.0/23 +202.38.132.0/23 +202.38.134.0/24 +202.38.135.0/24 +202.38.138.0/24 +202.38.146.0/23 +202.38.152.0/23 +202.38.160.0/23 +202.38.164.0/22 +202.38.171.0/24 +202.38.176.0/23 +202.41.152.0/21 +202.41.196.0/22 +202.41.200.0/22 +202.41.240.0/20 +202.43.76.0/22 +202.43.144.0/20 +202.44.48.0/22 +202.44.97.0/24 +202.46.32.0/19 +202.46.224.0/20 +202.47.96.0/22 +202.47.100.0/22 +202.47.104.0/22 +202.47.108.0/22 +202.52.33.0/24 +202.52.34.0/24 +202.52.47.0/24 +202.52.143.0/24 +202.53.140.0/24 +202.53.143.0/24 +202.57.192.0/22 +202.57.196.0/22 +202.57.200.0/22 +202.57.204.0/22 +202.57.212.0/22 +202.57.216.0/22 +202.58.104.0/22 +202.58.112.0/22 +202.59.1.0/24 +202.59.240.0/24 +202.60.112.0/20 +202.61.68.0/22 +202.61.76.0/22 +202.61.88.0/22 +202.61.123.0/24 +202.61.127.0/24 +202.63.80.0/24 +202.63.160.0/19 +202.63.248.0/22 +202.63.253.0/24 +202.65.96.0/22 +202.65.100.0/22 +202.65.104.0/22 +202.65.108.0/22 +202.66.168.0/22 +202.69.4.0/22 +202.69.16.0/20 +202.70.0.0/19 +202.71.32.0/22 +202.71.36.0/22 +202.71.40.0/22 +202.71.44.0/22 +202.72.112.0/22 +202.72.116.0/22 +202.72.120.0/22 +202.72.124.0/22 +202.73.240.0/22 +202.73.244.0/22 +202.73.248.0/22 +202.73.252.0/22 +202.74.36.0/24 +202.74.42.0/24 +202.74.52.0/24 +202.74.232.0/22 +202.81.176.0/22 +202.81.180.0/22 +202.81.184.0/22 +202.81.188.0/22 +202.84.0.0/22 +202.84.16.0/23 +202.84.22.0/24 +202.85.208.0/20 +202.88.32.0/22 +202.89.108.0/22 +202.89.119.0/24 +202.89.232.0/21 +202.90.0.0/22 +202.90.16.0/22 +202.90.20.0/22 +202.90.24.0/22 +202.90.28.0/22 +202.90.37.0/24 +202.90.96.0/22 +202.90.100.0/22 +202.90.104.0/22 +202.90.108.0/22 +202.90.193.0/24 +202.90.205.0/24 +202.90.224.0/20 +202.91.36.0/22 +202.91.128.0/22 +202.91.176.0/20 +202.91.224.0/19 +202.93.0.0/22 +202.93.252.0/22 +202.94.74.0/24 +202.94.81.0/24 +202.95.252.0/22 +202.101.192.0/19 +202.101.232.0/21 +202.101.240.0/20 +202.122.0.0/21 +202.122.32.0/21 +202.122.64.0/19 +202.122.112.0/21 +202.123.96.0/20 +202.123.116.0/22 +202.123.120.0/22 +202.125.109.0/24 +202.125.176.0/20 +202.127.0.0/23 +202.127.2.0/24 +202.127.3.0/24 +202.127.4.0/24 +202.127.5.0/24 +202.127.6.0/23 +202.127.12.0/22 +202.127.16.0/20 +202.127.40.0/21 +202.127.48.0/20 +202.127.144.0/20 +202.127.160.0/21 +202.127.192.0/23 +202.127.200.0/21 +202.127.208.0/24 +202.129.208.0/24 +202.130.0.0/19 +202.130.39.0/24 +202.131.16.0/21 +202.131.48.0/20 +202.131.208.0/20 +202.134.208.0/22 +202.134.212.0/22 +202.134.216.0/22 +202.134.220.0/22 +202.136.48.0/20 +202.136.208.0/20 +202.136.224.0/20 +202.136.248.0/22 +202.140.140.0/22 +202.140.144.0/22 +202.140.148.0/22 +202.140.152.0/22 +202.140.156.0/22 +202.141.160.0/19 +202.142.16.0/20 +202.143.16.0/20 +202.143.100.0/22 +202.143.104.0/22 +202.144.196.0/22 +202.146.186.0/24 +202.148.96.0/19 +202.149.160.0/19 +202.149.224.0/19 +202.150.16.0/20 +202.151.33.0/24 +202.152.176.0/20 +202.153.7.0/24 +202.153.48.0/20 +202.158.160.0/19 +202.158.242.0/24 +202.160.156.0/22 +202.160.176.0/20 +202.164.0.0/20 +202.165.176.0/20 +202.165.208.0/20 +202.168.80.0/22 +202.168.128.0/22 +202.168.132.0/22 +202.168.136.0/22 +202.168.140.0/22 +202.168.160.0/20 +202.168.176.0/20 +202.170.216.0/21 +202.171.232.0/24 +202.172.7.0/24 +202.173.6.0/24 +202.173.8.0/21 +202.173.112.0/22 +202.174.124.0/22 +202.179.160.0/22 +202.179.164.0/22 +202.179.168.0/22 +202.179.172.0/22 +202.180.128.0/19 +202.181.8.0/22 +202.181.28.0/22 +202.181.112.0/20 +202.189.0.0/18 +202.189.80.0/20 +203.16.63.0/24 +203.17.249.0/24 +203.19.1.0/24 +203.19.147.0/24 +203.20.44.0/24 +203.56.231.0/24 +203.76.208.0/22 +203.76.212.0/22 +203.76.216.0/22 +203.76.244.0/22 +203.78.156.0/22 +203.79.0.0/20 +203.79.32.0/20 +203.80.129.0/24 +203.80.144.0/20 +203.81.16.0/20 +203.81.244.0/22 +203.82.116.0/22 +203.82.120.0/22 +203.82.124.0/22 +203.82.224.0/22 +203.82.228.0/22 +203.82.232.0/22 +203.82.236.0/22 +203.83.8.0/22 +203.83.12.0/22 +203.83.56.0/21 +203.86.0.0/19 +203.86.32.0/19 +203.86.80.0/20 +203.86.250.0/24 +203.88.32.0/19 +203.88.192.0/19 +203.89.0.0/22 +203.89.100.0/22 +203.89.133.0/24 +203.89.144.0/24 +203.90.0.0/22 +203.90.12.0/22 +203.90.128.0/19 +203.90.160.0/19 +203.90.192.0/19 +203.91.32.0/19 +203.91.96.0/20 +203.92.6.0/24 +203.92.160.0/19 +203.94.0.0/22 +203.94.4.0/22 +203.94.8.0/21 +203.94.16.0/20 +203.95.0.0/21 +203.95.96.0/20 +203.95.112.0/20 +203.95.128.0/18 +203.95.200.0/22 +203.95.204.0/22 +203.95.208.0/22 +203.99.16.0/20 +203.99.80.0/20 +203.100.32.0/20 +203.100.58.0/24 +203.100.60.0/24 +203.100.80.0/20 +203.100.96.0/19 +203.100.192.0/20 +203.107.0.0/17 +203.110.160.0/19 +203.114.80.0/22 +203.114.84.0/22 +203.114.88.0/22 +203.114.92.0/22 +203.114.244.0/22 +203.118.192.0/19 +203.118.248.0/22 +203.119.24.0/21 +203.119.32.0/22 +203.119.80.0/22 +203.119.85.0/24 +203.119.128.0/17 +203.123.58.0/24 +203.128.32.0/19 +203.128.96.0/19 +203.132.32.0/19 +203.134.240.0/21 +203.135.96.0/20 +203.135.112.0/20 +203.142.219.0/24 +203.148.0.0/18 +203.148.64.0/20 +203.152.64.0/19 +203.156.192.0/18 +203.158.16.0/21 +203.160.52.0/22 +203.161.180.0/24 +203.161.183.0/24 +203.161.192.0/19 +203.167.28.0/22 +203.171.208.0/24 +203.171.224.0/20 +203.174.6.0/24 +203.174.7.0/24 +203.174.96.0/19 +203.175.128.0/19 +203.175.192.0/18 +203.176.0.0/18 +203.176.168.0/21 +203.184.80.0/20 +203.185.189.0/24 +203.187.160.0/19 +203.189.232.0/22 +203.189.240.0/22 +203.190.96.0/20 +203.191.2.0/24 +203.191.5.0/24 +203.191.7.0/24 +203.191.16.0/20 +203.191.64.0/18 +203.191.133.0/24 +203.191.144.0/21 +203.191.152.0/21 +203.192.0.0/19 +203.195.128.0/17 +203.196.0.0/21 +203.196.28.0/22 +203.201.181.0/24 +203.201.182.0/24 +203.205.128.0/17 +203.207.64.0/20 +203.207.80.0/21 +203.207.88.0/22 +203.207.92.0/22 +203.207.96.0/20 +203.207.112.0/20 +203.207.128.0/18 +203.207.192.0/21 +203.207.200.0/21 +203.207.208.0/20 +203.207.224.0/19 +203.208.0.0/20 +203.208.16.0/22 +203.208.32.0/19 +203.209.224.0/19 +203.212.80.0/20 +203.217.164.0/22 +203.222.192.0/20 +210.2.0.0/20 +210.2.16.0/20 +210.5.0.0/19 +210.5.144.0/20 +210.7.56.0/22 +210.7.60.0/22 +210.14.64.0/19 +210.14.112.0/20 +210.14.128.0/19 +210.15.64.0/19 +210.16.104.0/22 +210.16.128.0/18 +210.23.32.0/19 +210.72.0.0/17 +210.72.128.0/19 +210.72.192.0/18 +210.73.0.0/19 +210.73.32.0/19 +210.73.64.0/18 +210.73.128.0/17 +210.74.0.0/19 +210.74.32.0/19 +210.74.160.0/19 +210.74.192.0/18 +210.76.0.0/19 +210.76.32.0/19 +210.76.64.0/18 +210.76.128.0/17 +210.78.32.0/19 +210.78.64.0/18 +210.78.128.0/19 +210.79.224.0/19 +210.87.128.0/20 +210.87.144.0/20 +210.87.160.0/19 +211.88.0.0/16 +211.89.0.0/16 +211.99.0.0/18 +211.99.64.0/19 +211.99.96.0/19 +211.99.128.0/17 +211.101.0.0/18 +211.101.64.0/18 +211.101.128.0/17 +211.102.0.0/16 +211.103.128.0/17 +211.146.0.0/16 +211.147.0.0/16 +211.148.0.0/14 +211.152.0.0/15 +211.155.0.0/18 +211.155.64.0/19 +211.155.96.0/19 +211.155.128.0/17 +211.156.0.0/14 +211.160.0.0/14 +212.64.0.0/17 +212.129.128.0/17 +216.250.108.0/22 +218.96.0.0/15 +218.98.128.0/18 +218.98.192.0/19 +218.98.224.0/19 +218.99.0.0/16 +218.108.0.0/16 +218.109.0.0/16 +218.185.192.0/19 +218.240.0.0/14 +218.244.0.0/15 +218.246.0.0/15 +218.249.0.0/16 +219.72.0.0/16 +219.82.0.0/16 +219.83.128.0/17 +219.90.68.0/22 +219.90.72.0/22 +219.90.76.0/22 +219.238.0.0/15 +220.101.192.0/18 +220.154.0.0/15 +220.231.128.0/17 +220.232.64.0/18 +221.122.0.0/15 +221.128.128.0/17 +221.129.0.0/16 +221.133.224.0/19 +221.136.0.0/16 +222.125.0.0/16 +222.126.128.0/17 +222.248.0.0/16 +222.249.0.0/17 +222.249.128.0/19 +222.249.160.0/20 +222.249.176.0/20 +222.249.192.0/18 +223.0.0.0/15 +223.4.0.0/14 +223.20.0.0/15 +223.29.208.0/22 +223.29.252.0/22 +223.160.0.0/14 +223.192.0.0/15 +223.201.0.0/16 +223.202.0.0/15 +223.212.0.0/15 +223.223.176.0/20 +223.223.192.0/20 +223.248.0.0/14 +223.252.128.0/17 +223.254.0.0/16 +223.255.0.0/17 +223.255.236.0/22 diff --git a/package/lean/luci-app-mwan3helper/root/etc/mwan3helper/unicom_cnc.txt b/package/lean/luci-app-mwan3helper/root/etc/mwan3helper/unicom_cnc.txt new file mode 100644 index 00000000000000..b5c9a29bb305bd --- /dev/null +++ b/package/lean/luci-app-mwan3helper/root/etc/mwan3helper/unicom_cnc.txt @@ -0,0 +1,895 @@ +1.24.0.0/13 +1.56.0.0/13 +1.116.0.0/15 +1.188.0.0/14 +14.204.0.0/15 +27.0.128.0/22 +27.0.132.0/22 +27.8.0.0/13 +27.36.0.0/14 +27.40.0.0/13 +27.50.128.0/17 +27.54.192.0/18 +27.98.224.0/19 +27.112.0.0/18 +27.115.0.0/17 +27.192.0.0/11 +36.32.0.0/14 +36.248.0.0/14 +39.64.0.0/11 +42.1.128.0/17 +42.4.0.0/14 +42.48.0.0/15 +42.51.0.0/16 +42.52.0.0/14 +42.56.0.0/14 +42.63.0.0/16 +42.84.0.0/14 +42.176.0.0/13 +42.224.0.0/12 +43.224.12.0/22 +43.224.24.0/22 +43.224.52.0/22 +43.224.56.0/22 +43.224.80.0/22 +43.224.160.0/22 +43.224.208.0/22 +43.225.120.0/22 +43.226.96.0/22 +43.226.100.0/22 +43.226.104.0/22 +43.226.108.0/22 +43.226.116.0/22 +43.226.120.0/22 +43.226.160.0/22 +43.226.164.0/22 +43.226.236.0/22 +43.227.104.0/22 +43.229.168.0/22 +43.229.172.0/22 +43.229.176.0/22 +43.229.180.0/22 +43.229.236.0/22 +43.239.120.0/22 +43.240.0.0/22 +43.240.72.0/22 +43.240.132.0/22 +43.240.192.0/22 +43.240.196.0/22 +43.240.204.0/22 +43.241.48.0/22 +43.241.92.0/22 +43.241.184.0/22 +43.242.64.0/22 +43.242.148.0/22 +43.242.152.0/22 +43.242.156.0/22 +43.242.164.0/22 +43.242.180.0/22 +43.243.4.0/22 +43.243.16.0/22 +43.243.88.0/22 +43.243.128.0/22 +43.243.156.0/22 +43.243.180.0/22 +43.243.228.0/22 +43.246.112.0/22 +43.247.88.0/22 +43.247.92.0/22 +43.247.212.0/22 +43.247.216.0/22 +43.248.4.0/22 +43.248.20.0/22 +43.248.48.0/22 +43.248.80.0/22 +43.248.84.0/22 +43.248.88.0/22 +43.248.92.0/22 +43.248.108.0/22 +43.248.148.0/22 +43.248.176.0/22 +43.248.180.0/22 +43.248.184.0/22 +43.248.188.0/22 +43.248.192.0/22 +43.248.196.0/22 +43.248.200.0/22 +43.248.204.0/22 +43.248.244.0/22 +43.249.4.0/22 +43.249.136.0/22 +43.249.144.0/22 +43.249.192.0/22 +43.249.236.0/22 +43.250.4.0/22 +43.250.32.0/22 +43.250.96.0/22 +43.250.112.0/22 +43.250.128.0/22 +43.250.144.0/22 +43.250.168.0/22 +43.250.200.0/22 +43.250.212.0/22 +43.250.244.0/22 +43.251.4.0/22 +43.251.36.0/22 +43.251.232.0/22 +43.254.44.0/22 +43.254.52.0/22 +43.254.104.0/22 +43.254.116.0/22 +43.254.136.0/22 +43.254.144.0/22 +43.254.148.0/22 +43.254.220.0/22 +43.255.84.0/22 +43.255.204.0/22 +45.112.228.0/22 +45.112.232.0/22 +45.113.24.0/22 +45.113.28.0/22 +45.113.200.0/22 +45.113.240.0/22 +45.113.252.0/22 +45.115.144.0/22 +45.115.156.0/22 +45.115.164.0/22 +45.115.200.0/22 +45.115.248.0/22 +45.117.8.0/22 +45.117.124.0/22 +45.119.64.0/22 +45.119.68.0/22 +45.120.100.0/22 +45.121.52.0/22 +45.121.96.0/22 +45.123.156.0/22 +45.124.20.0/22 +45.124.68.0/22 +45.124.80.0/22 +45.125.44.0/22 +45.126.108.0/22 +45.126.120.0/22 +45.248.8.0/22 +45.249.112.0/22 +45.250.32.0/22 +45.250.36.0/22 +45.250.40.0/22 +45.251.16.0/22 +45.251.84.0/22 +45.251.88.0/22 +45.252.104.0/22 +45.253.24.0/22 +45.253.32.0/22 +45.253.64.0/22 +58.16.0.0/16 +58.17.0.0/17 +58.17.128.0/17 +58.18.0.0/16 +58.19.0.0/16 +58.20.0.0/16 +58.21.0.0/16 +58.22.0.0/15 +58.24.0.0/15 +58.30.0.0/15 +58.144.0.0/16 +58.240.0.0/15 +58.242.0.0/15 +58.244.0.0/15 +58.246.0.0/15 +58.248.0.0/13 +60.0.0.0/13 +60.8.0.0/15 +60.10.0.0/16 +60.11.0.0/16 +60.12.0.0/16 +60.13.0.0/18 +60.13.64.0/18 +60.13.128.0/17 +60.14.0.0/15 +60.16.0.0/13 +60.24.0.0/14 +60.28.0.0/15 +60.30.0.0/16 +60.31.0.0/16 +60.63.0.0/16 +60.204.0.0/16 +60.208.0.0/13 +60.216.0.0/15 +60.218.0.0/15 +60.220.0.0/14 +60.253.128.0/17 +60.255.0.0/16 +61.28.0.0/20 +61.28.16.0/20 +61.28.32.0/19 +61.28.64.0/18 +61.45.128.0/18 +61.48.0.0/14 +61.52.0.0/15 +61.54.0.0/16 +61.55.0.0/16 +61.133.0.0/17 +61.134.96.0/19 +61.134.128.0/18 +61.134.192.0/18 +61.135.0.0/16 +61.136.0.0/18 +61.136.64.0/18 +61.137.128.0/17 +61.138.0.0/18 +61.138.64.0/18 +61.138.128.0/18 +61.139.128.0/18 +61.148.0.0/15 +61.156.0.0/16 +61.158.0.0/17 +61.158.128.0/17 +61.159.0.0/18 +61.161.0.0/18 +61.161.128.0/17 +61.162.0.0/16 +61.163.0.0/16 +61.167.0.0/16 +61.168.0.0/16 +61.176.0.0/16 +61.179.0.0/16 +61.180.128.0/17 +61.181.0.0/16 +61.182.0.0/16 +61.189.0.0/17 +61.240.0.0/14 +101.16.0.0/12 +101.64.0.0/13 +101.72.0.0/14 +101.204.0.0/14 +101.232.0.0/15 +103.3.96.0/22 +103.3.100.0/22 +103.3.104.0/22 +103.3.108.0/22 +103.3.112.0/22 +103.3.116.0/22 +103.3.120.0/22 +103.3.124.0/22 +103.3.132.0/22 +103.3.136.0/22 +103.3.140.0/22 +103.3.148.0/22 +103.3.152.0/22 +103.3.156.0/22 +103.5.56.0/22 +103.5.168.0/22 +103.5.192.0/22 +103.5.252.0/22 +103.7.212.0/22 +103.9.248.0/22 +103.9.252.0/22 +103.14.84.0/22 +103.14.132.0/22 +103.18.224.0/22 +103.21.116.0/22 +103.22.188.0/22 +103.25.40.0/22 +103.27.4.0/22 +103.27.240.0/22 +103.28.204.0/22 +103.31.200.0/22 +103.35.220.0/22 +103.36.208.0/22 +103.36.220.0/22 +103.37.44.0/22 +103.37.100.0/22 +103.38.32.0/22 +103.38.40.0/22 +103.39.88.0/22 +103.40.12.0/22 +103.40.192.0/22 +103.40.212.0/22 +103.40.232.0/22 +103.41.164.0/22 +103.43.100.0/22 +103.43.192.0/22 +103.44.80.0/22 +103.45.72.0/22 +103.45.76.0/22 +103.45.160.0/22 +103.45.168.0/22 +103.45.224.0/22 +103.48.216.0/22 +103.48.220.0/22 +103.48.224.0/22 +103.48.228.0/22 +103.48.232.0/22 +103.52.96.0/22 +103.52.100.0/22 +103.52.176.0/22 +103.52.184.0/22 +103.53.124.0/22 +103.53.204.0/22 +103.55.172.0/22 +103.55.204.0/22 +103.55.208.0/22 +103.55.228.0/22 +103.56.32.0/22 +103.56.60.0/22 +103.57.196.0/22 +103.59.116.0/22 +103.59.124.0/22 +103.60.164.0/22 +103.61.176.0/22 +103.70.148.0/22 +103.72.224.0/22 +103.72.228.0/22 +103.72.232.0/22 +103.72.236.0/22 +103.72.240.0/22 +103.72.244.0/22 +103.72.248.0/22 +103.72.252.0/22 +103.73.0.0/22 +103.73.4.0/22 +103.73.8.0/22 +103.73.12.0/22 +103.73.16.0/22 +103.73.20.0/22 +103.73.24.0/22 +103.73.28.0/22 +103.73.144.0/22 +103.78.64.0/22 +103.85.84.0/22 +103.90.92.0/22 +103.90.188.0/22 +103.91.108.0/22 +103.91.176.0/22 +103.91.208.0/22 +103.92.132.0/22 +103.93.180.0/22 +103.95.220.0/22 +103.98.44.0/22 +103.98.168.0/22 +103.98.220.0/22 +103.107.212.0/22 +103.108.244.0/22 +103.110.156.0/22 +103.117.188.0/22 +103.123.56.0/22 +103.192.4.0/22 +103.192.132.0/22 +103.192.188.0/22 +103.192.212.0/22 +103.203.168.0/22 +103.204.72.0/22 +103.204.136.0/22 +103.205.4.0/22 +103.205.192.0/22 +103.205.252.0/22 +103.207.184.0/22 +103.207.228.0/22 +103.207.232.0/22 +103.210.184.0/22 +103.211.44.0/22 +103.211.96.0/22 +103.211.220.0/22 +103.213.96.0/22 +103.213.132.0/22 +103.214.48.0/22 +103.215.36.0/22 +103.216.152.0/22 +103.216.252.0/22 +103.219.28.0/22 +103.219.32.0/22 +103.219.36.0/22 +103.220.48.0/22 +103.220.52.0/22 +103.221.140.0/22 +103.222.32.0/22 +103.222.40.0/22 +103.222.164.0/22 +103.222.172.0/22 +103.223.140.0/22 +103.223.188.0/22 +103.224.228.0/22 +103.227.120.0/22 +103.227.136.0/22 +103.228.204.0/22 +103.229.148.0/22 +103.229.212.0/22 +103.230.196.0/22 +103.230.236.0/22 +103.233.228.0/22 +103.234.56.0/22 +103.234.244.0/22 +103.236.120.0/22 +103.236.240.0/22 +103.236.252.0/22 +103.238.28.0/22 +103.238.32.0/22 +103.238.140.0/22 +103.238.144.0/22 +103.238.160.0/22 +103.238.184.0/22 +103.239.152.0/22 +103.239.244.0/22 +103.240.36.0/22 +103.240.72.0/22 +103.240.84.0/22 +103.240.124.0/22 +103.240.172.0/22 +103.246.8.0/22 +103.246.152.0/22 +103.248.100.0/22 +103.248.152.0/22 +103.250.32.0/22 +103.250.104.0/22 +103.250.124.0/22 +103.250.180.0/22 +103.250.192.0/22 +103.250.216.0/22 +103.250.248.0/22 +103.251.32.0/22 +103.251.96.0/22 +103.251.124.0/22 +103.251.160.0/22 +103.251.240.0/22 +103.252.204.0/22 +103.252.208.0/22 +103.252.232.0/22 +103.252.248.0/22 +103.253.60.0/22 +103.255.88.0/22 +103.255.200.0/22 +106.48.0.0/15 +110.6.0.0/15 +110.16.0.0/14 +110.44.12.0/22 +110.52.0.0/15 +110.72.0.0/15 +110.228.0.0/14 +110.236.0.0/15 +110.240.0.0/12 +111.85.0.0/16 +111.160.0.0/13 +111.192.0.0/12 +111.223.12.0/22 +112.64.0.0/15 +112.80.0.0/13 +112.88.0.0/13 +112.96.0.0/15 +112.109.128.0/17 +112.111.0.0/16 +112.122.0.0/15 +112.132.0.0/16 +112.192.0.0/14 +112.224.0.0/11 +113.0.0.0/13 +113.8.0.0/15 +113.18.0.0/16 +113.56.0.0/15 +113.58.0.0/16 +113.59.0.0/17 +113.194.0.0/15 +113.200.0.0/15 +113.204.0.0/14 +113.213.0.0/17 +113.224.0.0/12 +114.54.0.0/15 +114.60.0.0/14 +114.119.0.0/17 +114.119.224.0/19 +114.240.0.0/12 +115.46.0.0/16 +115.48.0.0/12 +115.85.192.0/18 +115.172.0.0/14 +116.2.0.0/15 +116.60.0.0/14 +116.70.0.0/17 +116.78.0.0/15 +116.95.0.0/16 +116.112.0.0/14 +116.116.0.0/15 +116.128.0.0/10 +116.194.0.0/15 +116.199.0.0/17 +116.214.32.0/19 +116.216.0.0/14 +116.242.0.0/15 +116.244.0.0/15 +116.254.128.0/17 +116.255.128.0/17 +117.8.0.0/13 +117.74.64.0/20 +117.75.0.0/16 +117.76.0.0/14 +117.100.0.0/15 +117.121.128.0/18 +118.26.48.0/21 +118.72.0.0/13 +118.80.0.0/15 +118.88.32.0/19 +118.88.64.0/18 +118.88.128.0/17 +118.103.168.0/22 +118.132.0.0/14 +118.144.0.0/14 +118.212.0.0/16 +118.224.0.0/14 +118.244.0.0/14 +119.4.0.0/14 +119.27.64.0/18 +119.32.0.0/14 +119.36.0.0/16 +119.37.0.0/17 +119.37.128.0/18 +119.38.0.0/17 +119.39.0.0/16 +119.40.128.0/17 +119.42.0.0/19 +119.42.224.0/19 +119.44.0.0/15 +119.48.0.0/13 +119.59.128.0/17 +119.62.0.0/16 +119.108.0.0/15 +119.112.0.0/13 +119.148.160.0/20 +119.162.0.0/15 +119.164.0.0/14 +119.176.0.0/12 +119.232.0.0/15 +119.248.0.0/14 +119.252.240.0/20 +120.0.0.0/12 +120.80.0.0/13 +120.128.0.0/14 +120.133.0.0/16 +121.16.0.0/13 +121.24.0.0/14 +121.28.0.0/15 +121.30.0.0/16 +121.31.0.0/16 +121.52.224.0/19 +121.55.0.0/18 +121.68.0.0/14 +121.76.0.0/15 +121.100.128.0/17 +121.201.0.0/16 +122.13.0.0/16 +122.96.0.0/15 +122.102.64.0/20 +122.136.0.0/13 +122.156.0.0/14 +122.188.0.0/14 +122.192.0.0/14 +123.4.0.0/14 +123.8.0.0/13 +123.98.0.0/17 +123.100.0.0/19 +123.112.0.0/12 +123.128.0.0/13 +123.138.0.0/15 +123.144.0.0/14 +123.148.0.0/16 +123.152.0.0/13 +123.176.80.0/20 +123.188.0.0/14 +123.196.0.0/15 +123.232.0.0/14 +124.6.64.0/18 +124.20.0.0/16 +124.21.0.0/20 +124.21.16.0/20 +124.21.32.0/19 +124.21.64.0/18 +124.21.128.0/17 +124.42.128.0/17 +124.64.0.0/15 +124.66.0.0/17 +124.67.0.0/16 +124.68.0.0/14 +124.88.0.0/16 +124.89.0.0/17 +124.89.128.0/17 +124.90.0.0/15 +124.92.0.0/14 +124.128.0.0/13 +124.152.0.0/16 +124.160.0.0/16 +124.161.0.0/16 +124.162.0.0/16 +124.163.0.0/16 +124.164.0.0/14 +124.172.0.0/15 +124.240.128.0/18 +125.32.0.0/16 +125.33.0.0/16 +125.34.0.0/16 +125.35.0.0/17 +125.35.128.0/17 +125.36.0.0/14 +125.40.0.0/13 +125.211.0.0/16 +125.214.96.0/19 +139.170.0.0/16 +139.208.0.0/13 +139.226.0.0/15 +140.206.0.0/15 +144.48.64.0/22 +146.196.56.0/22 +146.196.68.0/22 +150.129.136.0/22 +150.129.252.0/22 +150.242.152.0/22 +150.242.232.0/22 +150.255.0.0/16 +153.0.0.0/16 +153.3.0.0/16 +153.34.0.0/15 +153.36.0.0/15 +153.99.0.0/16 +153.101.0.0/16 +157.0.0.0/16 +157.18.0.0/16 +157.61.0.0/16 +157.122.0.0/16 +157.148.0.0/16 +157.156.0.0/16 +157.255.0.0/16 +160.19.212.0/22 +160.202.60.0/22 +160.202.148.0/22 +160.202.152.0/22 +160.202.212.0/22 +163.0.0.0/16 +163.53.48.0/22 +163.53.52.0/22 +163.53.168.0/22 +163.125.0.0/16 +163.142.0.0/16 +163.177.0.0/16 +163.179.0.0/16 +163.204.0.0/16 +171.34.0.0/15 +171.36.0.0/14 +171.116.0.0/14 +171.120.0.0/13 +175.16.0.0/13 +175.42.0.0/15 +175.44.0.0/16 +175.106.128.0/17 +175.146.0.0/15 +175.148.0.0/14 +175.152.0.0/14 +175.160.0.0/12 +175.184.128.0/18 +180.77.0.0/16 +180.95.128.0/17 +180.129.128.0/17 +180.130.0.0/16 +180.189.148.0/22 +180.223.0.0/16 +182.54.0.0/17 +182.88.0.0/14 +182.112.0.0/12 +183.92.0.0/14 +183.184.0.0/13 +192.140.208.0/22 +192.140.212.0/22 +202.74.8.0/21 +202.75.208.0/20 +202.89.96.0/22 +202.92.0.0/22 +202.96.0.0/18 +202.96.64.0/21 +202.96.72.0/21 +202.96.80.0/20 +202.97.128.0/18 +202.97.192.0/19 +202.97.224.0/21 +202.97.232.0/21 +202.97.240.0/20 +202.98.0.0/21 +202.98.8.0/21 +202.98.16.0/20 +202.99.0.0/18 +202.99.64.0/19 +202.99.96.0/21 +202.99.104.0/21 +202.99.112.0/20 +202.99.128.0/19 +202.99.160.0/21 +202.99.168.0/21 +202.99.176.0/20 +202.99.192.0/21 +202.99.200.0/21 +202.99.208.0/20 +202.99.224.0/21 +202.99.232.0/21 +202.99.240.0/20 +202.101.128.0/18 +202.102.128.0/21 +202.102.136.0/21 +202.102.144.0/20 +202.102.160.0/19 +202.102.224.0/21 +202.102.232.0/21 +202.102.240.0/20 +202.106.0.0/16 +202.107.0.0/17 +202.108.0.0/16 +202.110.0.0/18 +202.110.64.0/18 +202.110.192.0/18 +202.111.128.0/19 +202.111.160.0/19 +202.115.32.0/19 +202.115.64.0/18 +202.122.128.0/24 +202.127.112.0/20 +202.127.209.0/24 +202.130.224.0/19 +202.160.140.0/22 +202.170.128.0/19 +203.76.240.0/22 +203.93.0.0/22 +203.93.4.0/22 +203.93.8.0/24 +203.93.9.0/24 +203.93.10.0/23 +203.93.12.0/22 +203.93.16.0/20 +203.93.32.0/19 +203.93.64.0/18 +203.93.128.0/21 +203.93.136.0/22 +203.93.140.0/24 +203.93.141.0/24 +203.93.142.0/23 +203.93.144.0/20 +203.93.160.0/19 +203.93.192.0/18 +203.135.160.0/20 +203.166.160.0/19 +203.223.0.0/20 +210.5.128.0/20 +210.12.0.0/18 +210.12.64.0/18 +210.12.128.0/18 +210.12.192.0/18 +210.13.0.0/18 +210.13.64.0/18 +210.13.128.0/17 +210.14.160.0/19 +210.14.192.0/19 +210.14.224.0/19 +210.15.0.0/19 +210.15.32.0/19 +210.15.96.0/19 +210.15.128.0/18 +210.21.0.0/17 +210.21.128.0/17 +210.22.0.0/16 +210.51.0.0/16 +210.52.0.0/18 +210.52.64.0/18 +210.52.128.0/17 +210.53.0.0/17 +210.53.128.0/17 +210.56.192.0/19 +210.72.160.0/19 +210.74.64.0/19 +210.74.96.0/19 +210.74.128.0/19 +210.78.0.0/19 +210.78.160.0/19 +210.78.192.0/18 +210.79.64.0/18 +210.82.0.0/15 +211.90.0.0/15 +211.92.0.0/15 +211.94.0.0/15 +211.96.0.0/15 +211.144.0.0/15 +218.7.0.0/16 +218.8.0.0/15 +218.10.0.0/16 +218.11.0.0/16 +218.12.0.0/16 +218.21.128.0/17 +218.24.0.0/15 +218.26.0.0/16 +218.27.0.0/16 +218.28.0.0/15 +218.56.0.0/14 +218.60.0.0/15 +218.62.0.0/17 +218.67.128.0/17 +218.68.0.0/15 +218.98.0.0/17 +218.104.0.0/17 +218.104.128.0/19 +218.104.160.0/19 +218.104.192.0/21 +218.104.200.0/21 +218.104.208.0/20 +218.104.224.0/19 +218.105.0.0/16 +218.106.0.0/15 +219.154.0.0/15 +219.156.0.0/15 +219.158.0.0/17 +219.158.128.0/17 +219.159.0.0/18 +219.232.0.0/14 +220.152.128.0/17 +220.158.240.0/22 +220.192.0.0/15 +220.194.0.0/15 +220.196.0.0/14 +220.200.0.0/13 +220.231.0.0/18 +220.234.0.0/16 +220.248.0.0/14 +220.252.0.0/16 +221.0.0.0/15 +221.2.0.0/16 +221.3.0.0/17 +221.3.128.0/17 +221.4.0.0/16 +221.5.0.0/17 +221.5.128.0/17 +221.6.0.0/16 +221.7.0.0/19 +221.7.32.0/19 +221.7.64.0/19 +221.7.96.0/19 +221.7.128.0/17 +221.8.0.0/15 +221.10.0.0/16 +221.11.0.0/17 +221.11.128.0/18 +221.11.192.0/19 +221.11.224.0/19 +221.12.0.0/17 +221.12.128.0/18 +221.13.0.0/18 +221.13.64.0/19 +221.13.96.0/19 +221.13.128.0/17 +221.14.0.0/15 +221.137.0.0/16 +221.192.0.0/15 +221.194.0.0/16 +221.195.0.0/16 +221.196.0.0/15 +221.198.0.0/16 +221.199.0.0/19 +221.199.32.0/20 +221.199.48.0/20 +221.199.64.0/18 +221.199.128.0/18 +221.199.192.0/20 +221.199.224.0/19 +221.200.0.0/14 +221.204.0.0/15 +221.206.0.0/16 +221.207.0.0/18 +221.207.64.0/18 +221.207.128.0/17 +221.208.0.0/14 +221.212.0.0/16 +221.213.0.0/16 +221.214.0.0/15 +221.216.0.0/13 +222.128.0.0/14 +222.132.0.0/14 +222.136.0.0/13 +222.160.0.0/15 +222.162.0.0/16 +222.163.0.0/19 +222.163.32.0/19 +222.163.64.0/18 +222.163.128.0/17 +223.27.184.0/22 +223.166.0.0/15 diff --git a/package/lean/luci-app-mwan3helper/root/etc/uci-defaults/mwan3helper b/package/lean/luci-app-mwan3helper/root/etc/uci-defaults/mwan3helper new file mode 100644 index 00000000000000..426cd55ba980fc --- /dev/null +++ b/package/lean/luci-app-mwan3helper/root/etc/uci-defaults/mwan3helper @@ -0,0 +1,11 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@mwan3helper[-1] + add ucitrack mwan3helper + set ucitrack.@mwan3helper[-1].init=mwan3helper + commit ucitrack +EOF + +rm -f /tmp/luci* +exit 0 diff --git a/package/lean/luci-app-n2n_v2/Makefile b/package/lean/luci-app-n2n_v2/Makefile new file mode 100644 index 00000000000000..a92981d3be4136 --- /dev/null +++ b/package/lean/luci-app-n2n_v2/Makefile @@ -0,0 +1,17 @@ +# +# Copyright (C) 2008-2014 The LuCI Team +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=n2n_v2 VPN Configuration module +LUCI_DEPENDS:=+n2n_v2 +LUCI_PKGARCH:=all +PKG_VERSION:=1.0 +PKG_RELEASE:=3 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/package/lean/luci-app-n2n_v2/luasrc/controller/n2n_v2.lua b/package/lean/luci-app-n2n_v2/luasrc/controller/n2n_v2.lua new file mode 100644 index 00000000000000..b761feec5d5e45 --- /dev/null +++ b/package/lean/luci-app-n2n_v2/luasrc/controller/n2n_v2.lua @@ -0,0 +1,26 @@ +--[[ +N2N V2 Luci configuration page.Made by 981213 +]]-- + +module("luci.controller.n2n_v2", package.seeall) + +function index() + + if not nixio.fs.access("/etc/config/n2n_v2") then + return + end + + entry({"admin", "vpn"}, firstchild(), "VPN", 45).dependent = false + entry({"admin", "vpn", "n2n_v2", "status"}, call("n2n_status")).leaf = true + + local page + page = entry({"admin", "vpn", "n2n_v2"}, cbi("n2n_v2"), _("N2N v2 VPN"), 45) + page.dependent = true +end + +function n2n_status() + local status = {} + status.running = luci.sys.call("pgrep edge >/dev/null")==0 + luci.http.prepare_content("application/json") + luci.http.write_json(status) +end diff --git a/package/lean/luci-app-n2n_v2/luasrc/model/cbi/n2n_v2.lua b/package/lean/luci-app-n2n_v2/luasrc/model/cbi/n2n_v2.lua new file mode 100644 index 00000000000000..83e09a48768aff --- /dev/null +++ b/package/lean/luci-app-n2n_v2/luasrc/model/cbi/n2n_v2.lua @@ -0,0 +1,65 @@ +--[[ +--N2N VPN(V2) configuration page. Made by 981213 +-- +]]-- + +local fs = require "nixio.fs" + +m = Map("n2n_v2", translate("N2N v2 VPN"), + translatef("n2n is a layer-two peer-to-peer virtual private network (VPN) which allows users to exploit features typical of P2P applications at network instead of application level.")) + +m:section(SimpleSection).template = "n2n_v2/status" + +s = m:section(TypedSection, "edge", translate("N2N Edge Settings")) +s.anonymous = true +s.addremove = true + +switch = s:option(Flag, "enabled", translate("Enable")) +switch.rmempty = false + +tunname = s:option(Value, "tunname", translate("TUN desvice name")) +tunname.optional = false + +mode = s:option(ListValue, "mode", translate("Interface mode")) +mode:value("dhcp") +mode:value("static") + +ipaddr = s:option(Value, "ipaddr", translate("Interface IP address")) +ipaddr.optional = false + +netmask = s:option(Value, "netmask", translate("Interface netmask")) +netmask.optional = false + +mtu = s:option(Value, "mtu", translate("MTU")) +mtu.datatype = "range(1,1500)" +mtu.optional = false + +supernode = s:option(Value, "supernode", translate("Supernode IP address")) +supernode.optional = false + +port = s:option(Value, "port", translate("Supernode Port")) +port.datatype = "range(0,65535)" +port.optional = false + +community = s:option(Value, "community", translate("N2N Community name")) +community.optional = false + +s:option(Value, "key", translate("Encryption key")) + +route = s:option(Flag, "route", translate("Enable packet forwarding")) +route.rmempty = false + +s2 = m:section(TypedSection, "supernode", translate("N2N Supernode Settings")) +s2.anonymous = true +s2.addremove = true + +switch = s2:option(Flag, "enabled", translate("Enable")) +switch.rmempty = false + +port = s2:option(Value, "port", translate("Port")) +port.datatype = "range(0,65535)" +port.optional = false + +return m + + diff --git a/package/lean/luci-app-n2n_v2/luasrc/view/n2n_v2/status.htm b/package/lean/luci-app-n2n_v2/luasrc/view/n2n_v2/status.htm new file mode 100644 index 00000000000000..b6e57da76d169c --- /dev/null +++ b/package/lean/luci-app-n2n_v2/luasrc/view/n2n_v2/status.htm @@ -0,0 +1,20 @@ + +
+

+ <%:Collecting data...%> +

+
\ No newline at end of file diff --git a/package/lean/luci-app-n2n_v2/po/zh-cn/n2n_v2.po b/package/lean/luci-app-n2n_v2/po/zh-cn/n2n_v2.po new file mode 100644 index 00000000000000..93e86e0a9ddc88 --- /dev/null +++ b/package/lean/luci-app-n2n_v2/po/zh-cn/n2n_v2.po @@ -0,0 +1,60 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-10-01\n" +"PO-Revision-Date: 2014-10-01\n" +"Last-Translator: 981213 \n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgid "n2n is a layer-two peer-to-peer virtual private network (VPN) which allows users to exploit features typical of P2P applications at network instead of application level." +msgstr "N2N是一个第二层点对点VPN程序,它可以让用户在网络层而不是应用层使用一些点对点服务。" + +msgid "N2N Edge Settings" +msgstr "N2N Edge节点设置" + +msgid "TUN desvice name" +msgstr "隧道设备名称" + +msgid "Enable" +msgstr "启用" + +msgid "Interface mode" +msgstr "接口模式" + +msgid "Interface IP address" +msgstr "接口IP地址" + +msgid "Interface netmask" +msgstr "接口子网掩码" + +msgid "Supernode IP address" +msgstr "Supernode节点IP地址" + +msgid "N2N Community name" +msgstr "N2N网络组名称" + +msgid "Enable packet forwarding" +msgstr "启用数据包转发" + +msgid "N2N Supernode Settings" +msgstr "N2N Supernode节点设置" + +msgid "Port" +msgstr "端口" + +msgid "Supernode Port" +msgstr "Supernode节点端口" + +msgid "Encryption key" +msgstr "加密密钥" + +msgid "N2N v2 VPN is running." +msgstr "N2N v2 VPN 运行中" + +msgid "N2N v2 VPN is not running." +msgstr "N2N v2 VPN 未运行" diff --git a/package/lean/luci-app-n2n_v2/root/etc/uci-defaults/luci-n2n_v2 b/package/lean/luci-app-n2n_v2/root/etc/uci-defaults/luci-n2n_v2 new file mode 100644 index 00000000000000..145579d5578167 --- /dev/null +++ b/package/lean/luci-app-n2n_v2/root/etc/uci-defaults/luci-n2n_v2 @@ -0,0 +1,11 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@n2n_v2[-1] + add ucitrack n2n_v2 + set ucitrack.@n2n_v2[-1].init=n2n_v2 + commit ucitrack +EOF + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/package/lean/luci-app-netdata/Makefile b/package/lean/luci-app-netdata/Makefile new file mode 100644 index 00000000000000..8794d5a4da7829 --- /dev/null +++ b/package/lean/luci-app-netdata/Makefile @@ -0,0 +1,16 @@ +# Copyright (C) 2016 Openwrt.org +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI support for Netdata +LUCI_DEPENDS:=+netdata +LUCI_PKGARCH:=all +PKG_VERSION:=1.0 +PKG_RELEASE:=3 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/package/lean/luci-app-netdata/luasrc/controller/netdata.lua b/package/lean/luci-app-netdata/luasrc/controller/netdata.lua new file mode 100644 index 00000000000000..b9c8a4448012c0 --- /dev/null +++ b/package/lean/luci-app-netdata/luasrc/controller/netdata.lua @@ -0,0 +1,6 @@ +module("luci.controller.netdata", package.seeall) + +function index() + + entry({"admin","status","netdata"},template("netdata"),_("NetData"),10).leaf=true +end \ No newline at end of file diff --git a/package/lean/luci-app-netdata/luasrc/view/netdata.htm b/package/lean/luci-app-netdata/luasrc/view/netdata.htm new file mode 100644 index 00000000000000..a6620e64d72aaf --- /dev/null +++ b/package/lean/luci-app-netdata/luasrc/view/netdata.htm @@ -0,0 +1,9 @@ +<%+header%> +
+

<%=translate("NetData")%>

+ +
+ +<%+footer%> diff --git a/package/lean/luci-app-netdata/po/zh-cn/netdata.po b/package/lean/luci-app-netdata/po/zh-cn/netdata.po new file mode 100644 index 00000000000000..e8966b815d9f47 --- /dev/null +++ b/package/lean/luci-app-netdata/po/zh-cn/netdata.po @@ -0,0 +1,5 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +msgid "NetData" +msgstr "实时监控" diff --git a/package/lean/luci-app-nft-qos/Makefile b/package/lean/luci-app-nft-qos/Makefile new file mode 100644 index 00000000000000..1452dac4296b27 --- /dev/null +++ b/package/lean/luci-app-nft-qos/Makefile @@ -0,0 +1,17 @@ +# +# Copyright (C) 2008-2014 The LuCI Team +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=Qos over Nftables +LUCI_DEPENDS:=+nft-qos +LUCI_PKGARCH:=all +PKG_VERSION:=1.0 +PKG_RELEASE:=2 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/package/lean/luci-app-nft-qos/luasrc/controller/nft-qos.lua b/package/lean/luci-app-nft-qos/luasrc/controller/nft-qos.lua new file mode 100644 index 00000000000000..637eb117363af1 --- /dev/null +++ b/package/lean/luci-app-nft-qos/luasrc/controller/nft-qos.lua @@ -0,0 +1,55 @@ +-- Copyright 2018 Rosy Song +-- Licensed to the public under the Apache License 2.0. + +module("luci.controller.nft-qos", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/nft-qos") then + return + end + + entry({"admin", "status", "realtime", "rate"}, + template("nft-qos/rate"), _("Rate"), 5).leaf = true + entry({"admin", "status", "realtime", "rate_status"}, + call("action_rate")).leaf = true + entry({"admin", "services", "nft-qos"}, cbi("nft-qos/nft-qos"), + _("Qos over Nftables"), 60) +end + +function _action_rate(rv, n) + local c = nixio.fs.access("/proc/net/ipv6_route") and + io.popen("nft list chain inet nft-qos-monitor " .. n .. " 2>/dev/null") or + io.popen("nft list chain ip nft-qos-monitor " .. n .. " 2>/dev/null") + + if c then + for l in c:lines() do + local _, i, p, b = l:match( + '^%s+ip ([^%s]+) ([^%s]+) counter packets (%d+) bytes (%d+)' + ) + if i and p and b then + -- handle expression + rv[#rv + 1] = { + rule = { + family = "inet", + table = "nft-qos-monitor", + chain = n, + handle = 0, + expr = { + { match = { right = i } }, + { counter = { packets = p, bytes = b } } + } + } + } + end + end + c:close() + end +end + +function action_rate() + luci.http.prepare_content("application/json") + local data = { nftables = {} } + _action_rate(data.nftables, "upload") + _action_rate(data.nftables, "download") + luci.http.write_json(data) +end diff --git a/package/lean/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua b/package/lean/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua new file mode 100644 index 00000000000000..61a6d76a7d2178 --- /dev/null +++ b/package/lean/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua @@ -0,0 +1,229 @@ +-- Copyright 2018 Rosy Song +-- Licensed to the public under the Apache License 2.0. + +local uci = require("luci.model.uci").cursor() +local wa = require("luci.tools.webadmin") +local fs = require("nixio.fs") +local ipc = require("luci.ip") + +local def_rate_dl = uci:get("nft-qos", "default", "static_rate_dl") +local def_rate_ul = uci:get("nft-qos", "default", "static_rate_ul") +local def_unit_dl = uci:get("nft-qos", "default", "static_unit_dl") +local def_unit_ul = uci:get("nft-qos", "default", "static_unit_ul") + +local def_up = uci:get("nft-qos", "default", "dynamic_bw_up") +local def_down = uci:get("nft-qos", "default", "dynamic_bw_down") + +local limit_enable = uci:get("nft-qos", "default", "limit_enable") +local limit_type = uci:get("nft-qos", "default", "limit_type") +local enable_priority = uci:get("nft-qos", "default", "priority_enable") + +local has_ipv6 = fs.access("/proc/net/ipv6_route") + +m = Map("nft-qos", translate("Qos over Nftables")) + +-- +-- Taboptions +-- +s = m:section(TypedSection, "default", translate("NFT-QoS Settings")) +s.addremove = false +s.anonymous = true + +s:tab("limit", "Limit Rate") +s:tab("priority", "Traffic Priority") + +-- +-- Static +-- +o = s:taboption("limit", Flag, "limit_enable", translate("Limit Enable"), translate("Enable Limit Rate Feature")) +o.default = limit_enable or o.enabled +o.rmempty = false + +o = s:taboption("limit", ListValue, "limit_type", translate("Limit Type"), translate("Type of Limit Rate")) +o.default = limit_static or "static" +o:depends("limit_enable","1") +o:value("static", "Static") +o:value("dynamic", "Dynamic") + +o = s:taboption("limit", Value, "static_rate_dl", translate("Default Download Rate"), translate("Default value for download rate")) +o.datatype = "uinteger" +o.default = def_rate_dl or '50' +o:depends("limit_type","static") + +o = s:taboption("limit", ListValue, "static_unit_dl", translate("Default Download Unit"), translate("Default unit for download rate")) +o.default = def_unit_dl or "kbytes" +o:depends("limit_type","static") +o:value("bytes", "Bytes/s") +o:value("kbytes", "KBytes/s") +o:value("mbytes", "MBytes/s") + +o = s:taboption("limit", Value, "static_rate_ul", translate("Default Upload Rate"), translate("Default value for upload rate")) +o.datatype = "uinteger" +o.default = def_rate_ul or '50' +o:depends("limit_type","static") + +o = s:taboption("limit", ListValue, "static_unit_ul", translate("Default Upload Unit"), translate("Default unit for upload rate")) +o.default = def_unit_ul or "kbytes" +o:depends("limit_type","static") +o:value("bytes", "Bytes/s") +o:value("kbytes", "KBytes/s") +o:value("mbytes", "MBytes/s") + +-- +-- Dynamic +-- +o = s:taboption("limit", Value, "dynamic_bw_down", translate("Download Bandwidth (Mbps)"), translate("Default value for download bandwidth")) +o.default = def_up or '100' +o.datatype = "uinteger" +o:depends("limit_type","dynamic") + +o = s:taboption("limit", Value, "dynamic_bw_up", translate("Upload Bandwidth (Mbps)"), translate("Default value for upload bandwidth")) +o.default = def_down or '100' +o.datatype = "uinteger" +o:depends("limit_type","dynamic") + +o = s:taboption("limit", Value, "dynamic_cidr", translate("Target Network (IPv4/MASK)"), translate("Network to be apply, e.g. 192.168.1.0/24, 10.2.0.0/16, etc")) +o.datatype = "cidr4" +ipc.routes({ family = 4, type = 1 }, function(rt) o.default = rt.dest end) +o:depends("limit_type","dynamic") + +if has_ipv6 then + o = s:taboption("limit", Value, "dynamic_cidr6", translate("Target Network6 (IPv6/MASK)"), translate("Network to be apply, e.g. AAAA::BBBB/64, CCCC::1/128, etc")) + o.datatype = "cidr6" + o:depends("limit_type","dynamic") +end + +o = s:taboption("limit", DynamicList, "limit_whitelist", translate("White List for Limit Rate")) +o.datatype = "ipaddr" +o:depends("limit_enable","1") + +-- +-- Priority +-- +o = s:taboption("priority", Flag, "priority_enable", translate("Enable Traffic Priority"), translate("Enable this feature")) +o.default = enable_priority or o.enabled +o.rmempty = false + +o = s:taboption("priority", ListValue, "priority_netdev", translate("Default Network Interface"), translate("Network Interface for Traffic Shaping, e.g. br-lan, eth0.1, eth0, etc")) +o:depends("priority_enable", "1") +wa.cbi_add_networks(o) + +-- +-- Static Limit Rate - Download Rate +-- +if limit_enable == "1" and limit_type == "static" then + +x = m:section(TypedSection, "download", translate("Static QoS-Download Rate")) +x.anonymous = true +x.addremove = true +x.template = "cbi/tblsection" + +o = x:option(Value, "hostname", translate("Hostname")) +o.datatype = "hostname" +o.default = 'undefined' + +if has_ipv6 then + o = x:option(Value, "ipaddr", translate("IP Address(V4 / V6)")) +else + o = x:option(Value, "ipaddr", translate("IP Address(V4 Only)")) +end +o.datatype = "ipaddr" +if nixio.fs.access("/tmp/dhcp.leases") or nixio.fs.access("/var/dhcp6.leases") then + o.titleref = luci.dispatcher.build_url("admin", "status", "overview") +end + +o = x:option(Value, "macaddr", translate("MAC (optional)")) +o.rmempty = true +o.datatype = "macaddr" + +o = x:option(Value, "rate", translate("Rate")) +o.default = def_rate_dl or '50' +o.size = 4 +o.datatype = "uinteger" + +o = x:option(ListValue, "unit", translate("Unit")) +o.default = def_unit_dl or "kbytes" +o:value("bytes", "Bytes/s") +o:value("kbytes", "KBytes/s") +o:value("mbytes", "MBytes/s") + +-- +-- Static Limit Rate - Upload Rate +-- +y = m:section(TypedSection, "upload", translate("Static QoS-Upload Rate")) +y.anonymous = true +y.addremove = true +y.template = "cbi/tblsection" + +o = y:option(Value, "hostname", translate("Hostname")) +o.datatype = "hostname" +o.default = 'undefined' + +if has_ipv6 then + o = y:option(Value, "ipaddr", translate("IP Address(V4 / V6)")) +else + o = y:option(Value, "ipaddr", translate("IP Address(V4 Only)")) +end +o.datatype = "ipaddr" +if nixio.fs.access("/tmp/dhcp.leases") or nixio.fs.access("/var/dhcp6.leases") then + o.titleref = luci.dispatcher.build_url("admin", "status", "overview") +end + +o = y:option(Value, "macaddr", translate("MAC (optional)")) +o.rmempty = true +o.datatype = "macaddr" + +o = y:option(Value, "rate", translate("Rate")) +o.default = def_rate_ul or '50' +o.size = 4 +o.datatype = "uinteger" + +o = y:option(ListValue, "unit", translate("Unit")) +o.default = def_unit_ul or "kbytes" +o:value("bytes", "Bytes/s") +o:value("kbytes", "KBytes/s") +o:value("mbytes", "MBytes/s") + +end + +-- +-- Traffic Priority Settings +-- +if enable_priority == "1" then + +s = m:section(TypedSection, "priority", translate("Traffic Priority Settings")) +s.anonymous = true +s.addremove = true +s.template = "cbi/tblsection" + +o = s:option(ListValue, "protocol", translate("Protocol")) +o.default = "tcp" +o:value("tcp", "TCP") +o:value("udp", "UDP") +o:value("udplite", "UDP-Lite") +o:value("sctp", "SCTP") +o:value("dccp", "DCCP") + +o = s:option(ListValue, "priority", translate("Priority")) +o.default = "1" +o:value("-400", "1") +o:value("-300", "2") +o:value("-225", "3") +o:value("-200", "4") +o:value("-150", "5") +o:value("-100", "6") +o:value("0", "7") +o:value("50", "8") +o:value("100", "9") +o:value("225", "10") +o:value("300", "11") + +o = s:option(Value, "service", translate("Service"), translate("e.g. https, 23, (separator is comma)")) +o.default = '?' + +o = s:option(Value, "comment", translate("Comment")) +o.default = '?' + +end + +return m diff --git a/package/lean/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm b/package/lean/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm new file mode 100644 index 00000000000000..5f9cb57d205ff6 --- /dev/null +++ b/package/lean/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm @@ -0,0 +1,167 @@ +<%# + Copyright 2018 Rosy Song + Licensed to the public under the Apache License 2.0. +-%> + +<%+header%> + + + +

<%:Realtime Rate%>

+ +
<%:This page gives an overview over currently download/upload rate.%>
+ +
+ <%:Realtime Download Rate%> +
+
+
+
<%:IP Address%>
+
<%:Download Rate%>
+
<%:Bytes Total%>
+
<%:Packets Total%>
+
+
+
+ <%:Collecting data...%> +
+
+
+
+
+ +
+ <%:Realtime Upload Rate%> +
+
+
+
<%:IP Address%>
+
<%:Upload Rate%>
+
<%:Bytes Total%>
+
<%:Packets Total%>
+
+
+
+ <%:Collecting data...%> +
+
+
+
+
+ +<%+footer%> diff --git a/package/lean/luci-app-nft-qos/po/es/nft-qos.po b/package/lean/luci-app-nft-qos/po/es/nft-qos.po new file mode 100644 index 00000000000000..2d729e001e47a0 --- /dev/null +++ b/package/lean/luci-app-nft-qos/po/es/nft-qos.po @@ -0,0 +1,241 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Project-Id-Version: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 2.2.1\n" +"Last-Translator: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: es\n" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:136 +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:155 +msgid "Bytes Total" +msgstr "Total de bytes" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:141 +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:160 +msgid "Collecting data..." +msgstr "Recolectando datos..." + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:224 +msgid "Comment" +msgstr "Comentario" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:48 +msgid "Default Download Rate" +msgstr "Velocidad de descarga predeterminada" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:53 +msgid "Default Download Unit" +msgstr "Unidad de descarga predeterminada" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:107 +msgid "Default Network Interface" +msgstr "Interfaz de red predeterminada" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:60 +msgid "Default Upload Rate" +msgstr "Velocidad de carga predeterminada" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:65 +msgid "Default Upload Unit" +msgstr "Unidad de carga predeterminada" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:53 +msgid "Default unit for download rate" +msgstr "Unidad predeterminada para la velocidad de descarga" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:65 +msgid "Default unit for upload rate" +msgstr "Unidad predeterminada para la velocidad de carga" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:75 +msgid "Default value for download bandwidth" +msgstr "Valor predeterminado para el ancho de banda de descarga" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:48 +msgid "Default value for download rate" +msgstr "Valor predeterminado para la velocidad de descarga" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:80 +msgid "Default value for upload bandwidth" +msgstr "Valor predeterminado para el ancho de banda de carga" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:60 +msgid "Default value for upload rate" +msgstr "Valor predeterminado para la velocidad de carga" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:75 +msgid "Download Bandwidth (Mbps)" +msgstr "Ancho de banda de descarga (Mbps)" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:135 +msgid "Download Rate" +msgstr "Velocidad de descarga" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:38 +msgid "Enable Limit Rate Feature" +msgstr "Habilitar función de límite de velocidad" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:103 +msgid "Enable Traffic Priority" +msgstr "Habilitar prioridad de tráfico" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:103 +msgid "Enable this feature" +msgstr "Habilitar esta característica" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:121 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:158 +msgid "Hostname" +msgstr "Nombre de host" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:134 +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:153 +msgid "IP Address" +msgstr "Dirección IP" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:126 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:163 +msgid "IP Address(V4 / V6)" +msgstr "Dirección IP (v4/v6)" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:128 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:165 +msgid "IP Address(V4 Only)" +msgstr "Dirección IP (sólo v4)" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:38 +msgid "Limit Enable" +msgstr "Habilitar límite" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:42 +msgid "Limit Type" +msgstr "Tipo de límite" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:135 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:172 +msgid "MAC (optional)" +msgstr "MAC (opcional)" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:48 +msgid "MB" +msgstr "MB" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:28 +msgid "NFT-QoS Settings" +msgstr "Configuración de NFT-QoS" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:107 +msgid "Network Interface for Traffic Shaping, e.g. br-lan, eth0.1, eth0, etc" +msgstr "Interfaz de red para configuración de tráfico, por ejemplo, br-lan, eth0.1, eth0, etc." + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:85 +msgid "Network to be apply, e.g. 192.168.1.0/24, 10.2.0.0/16, etc" +msgstr "Red a aplicar, por ejemplo. 192.168.1.0/24, 10.2.0.0/16, etc." + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:91 +msgid "Network to be apply, e.g. AAAA::BBBB/64, CCCC::1/128, etc" +msgstr "Red a aplicar, por ejemplo. AAAA::BBBB/64, CCCC::1/128, etc." + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:65 +msgid "No information available" +msgstr "No hay información disponible" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:137 +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:156 +msgid "Packets Total" +msgstr "Paquetes totales" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:207 +msgid "Priority" +msgstr "Prioridad" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:199 +msgid "Protocol" +msgstr "Protocolo" + +#: applications/luci-app-nft-qos/luasrc/controller/nft-qos.lua:16 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:23 +msgid "Qos over Nftables" +msgstr "Qos sobre Nftables" + +#: applications/luci-app-nft-qos/luasrc/controller/nft-qos.lua:12 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:139 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:176 +msgid "Rate" +msgstr "Velocidad" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:130 +msgid "Realtime Download Rate" +msgstr "Velocidad de descarga en tiempo real" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:125 +msgid "Realtime Rate" +msgstr "Velocidad en tiempo real" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:149 +msgid "Realtime Upload Rate" +msgstr "Velocidad de carga en tiempo real" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:221 +msgid "Service" +msgstr "Servicio" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:116 +msgid "Static QoS-Download Rate" +msgstr "Velocidad de descarga de QoS estática" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:153 +msgid "Static QoS-Upload Rate" +msgstr "Velocidad de carga de QoS estática" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:85 +msgid "Target Network (IPv4/MASK)" +msgstr "Red de destino (IPv4 / MASK)" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:91 +msgid "Target Network6 (IPv6/MASK)" +msgstr "Red de destino 6 (IPv6/MÁSCARA)" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:127 +msgid "This page gives an overview over currently download/upload rate." +msgstr "Esta página ofrece una vista general sobre la velocidad de descarga/carga actual." + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:194 +msgid "Traffic Priority Settings" +msgstr "Ajustes de prioridad de tráfico" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:42 +msgid "Type of Limit Rate" +msgstr "Tipo de límite de velocidad" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:144 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:181 +msgid "Unit" +msgstr "Unidad" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:80 +msgid "Upload Bandwidth (Mbps)" +msgstr "Ancho de banda de carga (Mbps)" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:154 +msgid "Upload Rate" +msgstr "Velocidad de carga" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:96 +msgid "White List for Limit Rate" +msgstr "Lista blanca para el límite de velocidad" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:221 +msgid "e.g. https, 23, (separator is comma)" +msgstr "p.ej. https, 23, (el separador es una coma)" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:44 +msgid "kB" +msgstr "kB" diff --git a/package/lean/luci-app-nft-qos/po/templates/nft-qos.pot b/package/lean/luci-app-nft-qos/po/templates/nft-qos.pot new file mode 100644 index 00000000000000..8fecfa073a1f27 --- /dev/null +++ b/package/lean/luci-app-nft-qos/po/templates/nft-qos.pot @@ -0,0 +1,230 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:136 +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:155 +msgid "Bytes Total" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:141 +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:160 +msgid "Collecting data..." +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:224 +msgid "Comment" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:48 +msgid "Default Download Rate" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:53 +msgid "Default Download Unit" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:107 +msgid "Default Network Interface" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:60 +msgid "Default Upload Rate" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:65 +msgid "Default Upload Unit" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:53 +msgid "Default unit for download rate" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:65 +msgid "Default unit for upload rate" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:75 +msgid "Default value for download bandwidth" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:48 +msgid "Default value for download rate" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:80 +msgid "Default value for upload bandwidth" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:60 +msgid "Default value for upload rate" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:75 +msgid "Download Bandwidth (Mbps)" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:135 +msgid "Download Rate" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:38 +msgid "Enable Limit Rate Feature" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:103 +msgid "Enable Traffic Priority" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:103 +msgid "Enable this feature" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:121 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:158 +msgid "Hostname" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:134 +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:153 +msgid "IP Address" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:126 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:163 +msgid "IP Address(V4 / V6)" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:128 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:165 +msgid "IP Address(V4 Only)" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:38 +msgid "Limit Enable" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:42 +msgid "Limit Type" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:135 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:172 +msgid "MAC (optional)" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:48 +msgid "MB" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:28 +msgid "NFT-QoS Settings" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:107 +msgid "Network Interface for Traffic Shaping, e.g. br-lan, eth0.1, eth0, etc" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:85 +msgid "Network to be apply, e.g. 192.168.1.0/24, 10.2.0.0/16, etc" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:91 +msgid "Network to be apply, e.g. AAAA::BBBB/64, CCCC::1/128, etc" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:65 +msgid "No information available" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:137 +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:156 +msgid "Packets Total" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:207 +msgid "Priority" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:199 +msgid "Protocol" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/controller/nft-qos.lua:16 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:23 +msgid "Qos over Nftables" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/controller/nft-qos.lua:12 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:139 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:176 +msgid "Rate" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:130 +msgid "Realtime Download Rate" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:125 +msgid "Realtime Rate" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:149 +msgid "Realtime Upload Rate" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:221 +msgid "Service" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:116 +msgid "Static QoS-Download Rate" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:153 +msgid "Static QoS-Upload Rate" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:85 +msgid "Target Network (IPv4/MASK)" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:91 +msgid "Target Network6 (IPv6/MASK)" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:127 +msgid "This page gives an overview over currently download/upload rate." +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:194 +msgid "Traffic Priority Settings" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:42 +msgid "Type of Limit Rate" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:144 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:181 +msgid "Unit" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:80 +msgid "Upload Bandwidth (Mbps)" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:154 +msgid "Upload Rate" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:96 +msgid "White List for Limit Rate" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:221 +msgid "e.g. https, 23, (separator is comma)" +msgstr "" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:44 +msgid "kB" +msgstr "" diff --git a/package/lean/luci-app-nft-qos/po/zh-cn/nft-qos.po b/package/lean/luci-app-nft-qos/po/zh-cn/nft-qos.po new file mode 100644 index 00000000000000..73ce11f5d011fe --- /dev/null +++ b/package/lean/luci-app-nft-qos/po/zh-cn/nft-qos.po @@ -0,0 +1,244 @@ +# +# Yangfl , 2019. +# +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Project-Id-Version: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: 2019-01-03 22:28+0800\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Gtranslator 3.30.1\n" +"Last-Translator: Yangfl \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"Language: zh_CN\n" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:136 +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:155 +msgid "Bytes Total" +msgstr "字节总数" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:141 +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:160 +msgid "Collecting data..." +msgstr "正在收集数据…" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:224 +msgid "Comment" +msgstr "注释" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:48 +msgid "Default Download Rate" +msgstr "默认下载速率" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:53 +msgid "Default Download Unit" +msgstr "默认下载速率单位" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:107 +msgid "Default Network Interface" +msgstr "默认网络接口" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:60 +msgid "Default Upload Rate" +msgstr "默认上传速率" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:65 +msgid "Default Upload Unit" +msgstr "默认上传速率单位" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:53 +msgid "Default unit for download rate" +msgstr "默认的下载速率单位" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:65 +msgid "Default unit for upload rate" +msgstr "默认的上传速率单位" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:75 +msgid "Default value for download bandwidth" +msgstr "下载带宽的默认值" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:48 +msgid "Default value for download rate" +msgstr "下载速率的默认值" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:80 +msgid "Default value for upload bandwidth" +msgstr "上传带宽的默认值" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:60 +msgid "Default value for upload rate" +msgstr "上传速率的默认值" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:75 +msgid "Download Bandwidth (Mbps)" +msgstr "下载带宽(Mbps)" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:135 +msgid "Download Rate" +msgstr "下载速率" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:38 +msgid "Enable Limit Rate Feature" +msgstr "开启速率限制功能" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:103 +msgid "Enable Traffic Priority" +msgstr "开启流量优先级" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:103 +msgid "Enable this feature" +msgstr "开启这个功能" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:121 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:158 +msgid "Hostname" +msgstr "主机名" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:134 +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:153 +msgid "IP Address" +msgstr "IP 地址" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:126 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:163 +msgid "IP Address(V4 / V6)" +msgstr "IP 地址(V4 / V6)" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:128 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:165 +msgid "IP Address(V4 Only)" +msgstr "IP 地址(仅 V4)" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:38 +msgid "Limit Enable" +msgstr "限速开启" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:42 +msgid "Limit Type" +msgstr "限速类型" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:135 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:172 +msgid "MAC (optional)" +msgstr "物理地址(可选)" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:48 +msgid "MB" +msgstr "MB" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:28 +msgid "NFT-QoS Settings" +msgstr "NFT-QoS 设置" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:107 +msgid "Network Interface for Traffic Shaping, e.g. br-lan, eth0.1, eth0, etc" +msgstr "流量整形的目标网络接口,例如br-lan、eth0.1、eth0等" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:85 +msgid "Network to be apply, e.g. 192.168.1.0/24, 10.2.0.0/16, etc" +msgstr "将要应用规则的网络,例如192.168.1.0/24、10.2.0.0/16等" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:91 +msgid "Network to be apply, e.g. AAAA::BBBB/64, CCCC::1/128, etc" +msgstr "将要应用规则的网络,例如AAAA::BBBB/64、CCCC::1/128等" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:65 +msgid "No information available" +msgstr "没有更多的信息" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:137 +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:156 +msgid "Packets Total" +msgstr "数据包总数" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:207 +msgid "Priority" +msgstr "优先级" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:199 +msgid "Protocol" +msgstr "协议" + +#: applications/luci-app-nft-qos/luasrc/controller/nft-qos.lua:16 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:23 +msgid "Qos over Nftables" +msgstr "QoS Nftables 版" + +#: applications/luci-app-nft-qos/luasrc/controller/nft-qos.lua:12 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:139 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:176 +msgid "Rate" +msgstr "速率" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:130 +msgid "Realtime Download Rate" +msgstr "实时下载速率" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:125 +msgid "Realtime Rate" +msgstr "实时速率显示" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:149 +msgid "Realtime Upload Rate" +msgstr "实时上传速率" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:221 +msgid "Service" +msgstr "服务" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:116 +msgid "Static QoS-Download Rate" +msgstr "静态 QoS-下载速率" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:153 +msgid "Static QoS-Upload Rate" +msgstr "静态 QoS-上传速率" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:85 +msgid "Target Network (IPv4/MASK)" +msgstr "目标网络(IPv4 地址/掩码)" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:91 +msgid "Target Network6 (IPv6/MASK)" +msgstr "目标网络 v6(IPv6 地址/掩码)" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:127 +msgid "This page gives an overview over currently download/upload rate." +msgstr "该页面提供了当前上传和下载速率的一个总览。" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:194 +msgid "Traffic Priority Settings" +msgstr "流量优先级设置" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:42 +msgid "Type of Limit Rate" +msgstr "限速的类型" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:144 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:181 +msgid "Unit" +msgstr "单位" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:80 +msgid "Upload Bandwidth (Mbps)" +msgstr "上传带宽(Mbps)" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:154 +msgid "Upload Rate" +msgstr "上传速率" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:96 +msgid "White List for Limit Rate" +msgstr "限速白名单" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:221 +msgid "e.g. https, 23, (separator is comma)" +msgstr "例如https, 23(用逗号分隔)" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:44 +msgid "kB" +msgstr "kB" diff --git a/package/lean/luci-app-nft-qos/po/zh-tw/nft-qos.po b/package/lean/luci-app-nft-qos/po/zh-tw/nft-qos.po new file mode 100644 index 00000000000000..5be9d8abf66d01 --- /dev/null +++ b/package/lean/luci-app-nft-qos/po/zh-tw/nft-qos.po @@ -0,0 +1,244 @@ +# +# Yangfl , 2019. +# +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Project-Id-Version: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: 2019-01-03 22:28+0800\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Gtranslator 3.30.1\n" +"Last-Translator: Yangfl \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"Language: zh_TW\n" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:136 +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:155 +msgid "Bytes Total" +msgstr "位元組總數" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:141 +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:160 +msgid "Collecting data..." +msgstr "正在收集資料…" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:224 +msgid "Comment" +msgstr "註釋" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:48 +msgid "Default Download Rate" +msgstr "預設下載速率" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:53 +msgid "Default Download Unit" +msgstr "預設下載速率單位" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:107 +msgid "Default Network Interface" +msgstr "預設網路介面" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:60 +msgid "Default Upload Rate" +msgstr "預設上傳速率" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:65 +msgid "Default Upload Unit" +msgstr "預設上傳速率單位" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:53 +msgid "Default unit for download rate" +msgstr "預設的下載速率單位" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:65 +msgid "Default unit for upload rate" +msgstr "預設的上傳速率單位" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:75 +msgid "Default value for download bandwidth" +msgstr "下載頻寬的預設值" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:48 +msgid "Default value for download rate" +msgstr "下載速率的預設值" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:80 +msgid "Default value for upload bandwidth" +msgstr "上傳頻寬的預設值" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:60 +msgid "Default value for upload rate" +msgstr "上傳速率的預設值" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:75 +msgid "Download Bandwidth (Mbps)" +msgstr "下載頻寬(Mbps)" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:135 +msgid "Download Rate" +msgstr "下載速率" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:38 +msgid "Enable Limit Rate Feature" +msgstr "開啟速率限制功能" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:103 +msgid "Enable Traffic Priority" +msgstr "開啟流量優先順序" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:103 +msgid "Enable this feature" +msgstr "開啟這個功能" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:121 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:158 +msgid "Hostname" +msgstr "主機名" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:134 +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:153 +msgid "IP Address" +msgstr "IP 位址" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:126 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:163 +msgid "IP Address(V4 / V6)" +msgstr "IP 位址(V4 / V6)" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:128 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:165 +msgid "IP Address(V4 Only)" +msgstr "IP 位址(僅 V4)" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:38 +msgid "Limit Enable" +msgstr "限速開啟" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:42 +msgid "Limit Type" +msgstr "限速型別" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:135 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:172 +msgid "MAC (optional)" +msgstr "實體位址(可選)" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:48 +msgid "MB" +msgstr "MB" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:28 +msgid "NFT-QoS Settings" +msgstr "NFT-QoS 設定" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:107 +msgid "Network Interface for Traffic Shaping, e.g. br-lan, eth0.1, eth0, etc" +msgstr "流量整形的目標網路介面,例如br-lan、eth0.1、eth0等" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:85 +msgid "Network to be apply, e.g. 192.168.1.0/24, 10.2.0.0/16, etc" +msgstr "將要應用規則的網路,例如192.168.1.0/24、10.2.0.0/16等" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:91 +msgid "Network to be apply, e.g. AAAA::BBBB/64, CCCC::1/128, etc" +msgstr "將要應用規則的網路,例如AAAA::BBBB/64、CCCC::1/128等" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:65 +msgid "No information available" +msgstr "沒有更多的資訊" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:137 +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:156 +msgid "Packets Total" +msgstr "資料包總數" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:207 +msgid "Priority" +msgstr "優先順序" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:199 +msgid "Protocol" +msgstr "協議" + +#: applications/luci-app-nft-qos/luasrc/controller/nft-qos.lua:16 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:23 +msgid "Qos over Nftables" +msgstr "QoS Nftables 版" + +#: applications/luci-app-nft-qos/luasrc/controller/nft-qos.lua:12 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:139 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:176 +msgid "Rate" +msgstr "速率" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:130 +msgid "Realtime Download Rate" +msgstr "實時下載速率" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:125 +msgid "Realtime Rate" +msgstr "實時速率顯示" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:149 +msgid "Realtime Upload Rate" +msgstr "實時上傳速率" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:221 +msgid "Service" +msgstr "服務" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:116 +msgid "Static QoS-Download Rate" +msgstr "靜態 QoS-下載速率" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:153 +msgid "Static QoS-Upload Rate" +msgstr "靜態 QoS-上傳速率" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:85 +msgid "Target Network (IPv4/MASK)" +msgstr "目標網路(IPv4 位址/掩碼)" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:91 +msgid "Target Network6 (IPv6/MASK)" +msgstr "目標網路 v6(IPv6 位址/掩碼)" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:127 +msgid "This page gives an overview over currently download/upload rate." +msgstr "該頁面提供了當前上傳和下載速率的一個總覽。" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:194 +msgid "Traffic Priority Settings" +msgstr "流量優先順序設定" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:42 +msgid "Type of Limit Rate" +msgstr "限速的型別" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:144 +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:181 +msgid "Unit" +msgstr "單位" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:80 +msgid "Upload Bandwidth (Mbps)" +msgstr "上傳頻寬(Mbps)" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:154 +msgid "Upload Rate" +msgstr "上傳速率" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:96 +msgid "White List for Limit Rate" +msgstr "限速白名單" + +#: applications/luci-app-nft-qos/luasrc/model/cbi/nft-qos/nft-qos.lua:221 +msgid "e.g. https, 23, (separator is comma)" +msgstr "例如https, 23(用逗號分隔)" + +#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:44 +msgid "kB" +msgstr "kB" diff --git a/package/lean/luci-app-nps/Makefile b/package/lean/luci-app-nps/Makefile new file mode 100644 index 00000000000000..6f3ec99fc80814 --- /dev/null +++ b/package/lean/luci-app-nps/Makefile @@ -0,0 +1,17 @@ +# +# Copyright (C) 2008-2014 The LuCI Team +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI for Nps +LUCI_DEPENDS:=+wget +npc +LUCI_PKGARCH:=all +PKG_VERSION:=1.1 +PKG_RELEASE:=4 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/package/lean/luci-app-nps/luasrc/controller/nps.lua b/package/lean/luci-app-nps/luasrc/controller/nps.lua new file mode 100644 index 00000000000000..04fb7ced2330d3 --- /dev/null +++ b/package/lean/luci-app-nps/luasrc/controller/nps.lua @@ -0,0 +1,17 @@ +module("luci.controller.nps",package.seeall) +function index() +if not nixio.fs.access("/etc/config/nps")then +return +end +local e +e=entry({"admin","services","nps"},cbi("nps"),_("Nps Setting"),100) +e.i18n="nps" +e.dependent=true +entry({"admin","services","nps","status"},call("status")).leaf=true +end +function status() +local e={} +e.running=luci.sys.call("pgrep npc > /dev/null")==0 +luci.http.prepare_content("application/json") +luci.http.write_json(e) +end diff --git a/package/lean/luci-app-nps/luasrc/model/cbi/nps.lua b/package/lean/luci-app-nps/luasrc/model/cbi/nps.lua new file mode 100644 index 00000000000000..829e1bea3e207f --- /dev/null +++ b/package/lean/luci-app-nps/luasrc/model/cbi/nps.lua @@ -0,0 +1,45 @@ +m=Map("nps") +m.title=translate("Nps Setting") +m.description=translate("Nps is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.") + +m:section(SimpleSection).template="nps/nps_status" + +s=m:section(TypedSection,"nps") +s.addremove=false +s.anonymous=true + +s:tab("basic",translate("Basic Setting")) +enable=s:taboption("basic",Flag,"enabled",translate("Enable")) +enable.rmempty=false +server=s:taboption("basic",Value,"server_addr",translate("Server"),translate("Must an IPv4 address")) +server.datatype="ipaddr" +server.optional=false +server.rmempty=false +port=s:taboption("basic",Value,"server_port",translate("Port")) +port.datatype="port" +port.default="8024" +port.optional=false +port.rmempty=false +protocol=s:taboption("basic",ListValue,"protocol",translate("Protocol Type")) +protocol.default="tcp" +protocol:value("tcp",translate("TCP Protocol")) +protocol:value("kcp",translate("KCP Protocol")) +vkey=s:taboption("basic",Value,"vkey",translate("vkey")) +vkey.optional=false +vkey.password=true +vkey.rmempty=false +compress=s:taboption("basic",Flag,"compress",translate("Enable Compression"),translate("The contents will be compressed to speed up the traffic forwarding speed, but this will consume some additional cpu resources.")) +compress.default="1" +compress.rmempty=false +crypt=s:taboption("basic",Flag,"crypt",translate("Enable Encryption"),translate("Encrypted the communication between Npc and Nps, will effectively prevent the traffic intercepted.")) +crypt.default="1" +crypt.rmempty=false +log_level=s:taboption("basic",ListValue,"log_level",translate("Log Level")) +log_level:value(0,"Emergency") +log_level:value(2,"Critical") +log_level:value(3,"Error") +log_level:value(4,"Warning") +log_level:value(7,"Debug") +log_level.default="3" + +return m diff --git a/package/lean/luci-app-nps/luasrc/view/nps/nps_status.htm b/package/lean/luci-app-nps/luasrc/view/nps/nps_status.htm new file mode 100644 index 00000000000000..aef743b9cf2637 --- /dev/null +++ b/package/lean/luci-app-nps/luasrc/view/nps/nps_status.htm @@ -0,0 +1,22 @@ + + +
+

+ <%:Collecting data...%> +

+
diff --git a/package/lean/luci-app-nps/po/zh-cn/nps.po b/package/lean/luci-app-nps/po/zh-cn/nps.po new file mode 100644 index 00000000000000..4fb9ad411e2d97 --- /dev/null +++ b/package/lean/luci-app-nps/po/zh-cn/nps.po @@ -0,0 +1,29 @@ +msgid "Nps Setting" +msgstr "Nps 内网穿透" + +msgid "Nps is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet." +msgstr "Nps 是一种快速反向代理,可帮助您将 NAT 或防火墙后面的本地服务器公开到 Internet。" + +msgid "Must an IPv4 address" +msgstr "必须是 IPv4 地址" + +msgid "vkey" +msgstr "密钥(vkey)" + +msgid "Enable Compression" +msgstr "使用压缩传输" + +msgid "Enable Encryption" +msgstr "使用加密传输" + +msgid "The contents will be compressed to speed up the traffic forwarding speed, but this will consume some additional cpu resources." +msgstr "压缩传输内容,加快流量转发速度,会额外消耗 CPU 资源。" + +msgid "Encrypted the communication between Npc and Nps, will effectively prevent the traffic intercepted." +msgstr "加密传输 npc 与 nps 之间的通信内容,会有效防止流量被拦截。" + +msgid "Nps is running." +msgstr "Nps 运行中" + +msgid "Nps is not running." +msgstr "Nps 未运行" \ No newline at end of file diff --git a/package/lean/luci-app-nps/root/etc/config/nps b/package/lean/luci-app-nps/root/etc/config/nps new file mode 100644 index 00000000000000..b5b8be8782d9db --- /dev/null +++ b/package/lean/luci-app-nps/root/etc/config/nps @@ -0,0 +1,11 @@ + +config nps + option enabled '0' + option server_addr '1.1.1.1' + option server_port '8024' + option protocol 'tcp' + option compress '1' + option crypt '1' + option vkey 'aaa' + option log_level '4' + diff --git a/package/lean/luci-app-nps/root/etc/init.d/nps b/package/lean/luci-app-nps/root/etc/init.d/nps new file mode 100644 index 00000000000000..3ea722b618c073 --- /dev/null +++ b/package/lean/luci-app-nps/root/etc/init.d/nps @@ -0,0 +1,70 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=50 +USE_PROCD=1 + +LOGFILE="/tmp/nps.log" +tmpconf="/tmp/etc/nps.conf" + +nps_header() { + local enabled server_addr server_port protocol vkey compress crypt log_level + + config_get enabled $1 enabled + config_get server_addr $1 server_addr + config_get server_port $1 server_port + config_get protocol $1 protocol + config_get vkey $1 vkey + config_get compress $1 compress + config_get crypt $1 crypt + config_get log_level $1 log_level + + [ -f $tmpconf ] && rm $tmpconf + echo "[common]" >$tmpconf + echo "server_addr=${server_addr}:${server_port}" >>$tmpconf + echo "conn_type=${protocol}" >>$tmpconf + echo "vkey=${vkey}" >>$tmpconf + echo "auto_reconnection=true" >>$tmpconf + + nps_write_bool compress $1 + nps_write_bool crypt $1 + + Log_level=$log_level + Enabled=$enabled +} + +nps_write_bool() { + local opt="$1" + local config="$2" + local val + + config_get_bool val $config "$opt" + if [ "$val" -eq 0 ]; then + echo "${opt}=false" >> $tmpconf + else + echo "${opt}=true" >> $tmpconf + fi +} + +start_service() { + config_load nps + config_foreach nps_header nps + + if [ "$Enabled" = "1" ];then + logger -t FRPC 'Starting Nps service' + procd_open_instance + procd_set_param command /usr/bin/npc -config=$tmpconf -log_level=$Log_level -log_path=$LOGFILE + #procd_set_param file $tmpconf + procd_set_param respawn + procd_set_param stdout 1 + procd_set_param stderr 1 + procd_close_instance + fi +} + +reload_service() +{ + stop + start +} + diff --git a/package/lean/luci-app-nps/root/etc/uci-defaults/luci-nps b/package/lean/luci-app-nps/root/etc/uci-defaults/luci-nps new file mode 100644 index 00000000000000..f4f0996aa2f7d6 --- /dev/null +++ b/package/lean/luci-app-nps/root/etc/uci-defaults/luci-nps @@ -0,0 +1,11 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@nps[-1] + add ucitrack nps + set ucitrack.@nps[-1].init=nps + commit ucitrack +EOF + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/package/lean/luci-app-openvpn-server/Makefile b/package/lean/luci-app-openvpn-server/Makefile new file mode 100644 index 00000000000000..4e51de6440847d --- /dev/null +++ b/package/lean/luci-app-openvpn-server/Makefile @@ -0,0 +1,21 @@ +# Copyright (C) 2016 Openwrt.org +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI support for OpenVPN Server +LUCI_DEPENDS:=+openvpn-openssl +openvpn-easy-rsa +kmod-tun +LUCI_PKGARCH:=all +PKG_NAME:=luci-app-openvpn-server +PKG_VERSION:=2.0 +PKG_RELEASE:=18 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + + + + diff --git a/package/lean/luci-app-openvpn-server/luasrc/controller/openvpn-server.lua b/package/lean/luci-app-openvpn-server/luasrc/controller/openvpn-server.lua new file mode 100644 index 00000000000000..3d05765f3f2f6f --- /dev/null +++ b/package/lean/luci-app-openvpn-server/luasrc/controller/openvpn-server.lua @@ -0,0 +1,22 @@ + +module("luci.controller.openvpn-server", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/openvpn") then + return + end + + entry({"admin", "vpn"}, firstchild(), "VPN", 45).dependent = false + + local page + + entry({"admin", "vpn", "openvpn-server"}, cbi("openvpn-server/openvpn-server"), _("OpenVPN Server"), 80).dependent=false + entry({"admin", "vpn", "openvpn-server","status"},call("act_status")).leaf=true +end + +function act_status() + local e={} + e.running=luci.sys.call("pgrep openvpn >/dev/null")==0 + luci.http.prepare_content("application/json") + luci.http.write_json(e) +end \ No newline at end of file diff --git a/package/lean/luci-app-openvpn-server/luasrc/model/cbi/openvpn-server/openvpn-server.lua b/package/lean/luci-app-openvpn-server/luasrc/model/cbi/openvpn-server/openvpn-server.lua new file mode 100644 index 00000000000000..1ffb2098893948 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/luasrc/model/cbi/openvpn-server/openvpn-server.lua @@ -0,0 +1,105 @@ + +--require("luci.tools.webadmin") + +mp = Map("openvpn", "OpenVPN Server",translate("An easy config OpenVPN Server Web-UI")) + +mp:section(SimpleSection).template = "openvpn/openvpn_status" + +s = mp:section(TypedSection, "openvpn") +s.anonymous = true +s.addremove = false + +s:tab("basic", translate("Base Setting")) + +o = s:taboption("basic", Flag, "enabled", translate("Enable")) + +proto = s:taboption("basic",Value,"proto", translate("Proto")) +proto:value("tcp4", translate("TCP Server IPv4")) +proto:value("udp4", translate("UDP Server IPv4")) +proto:value("tcp6", translate("TCP Server IPv6")) +proto:value("udp6", translate("UDP Server IPv6")) + +port = s:taboption("basic", Value, "port", translate("Port")) +port.datatype = "range(1,65535)" + +ddns = s:taboption("basic", Value, "ddns", translate("WAN DDNS or IP")) +ddns.datatype = "string" +ddns.default = "exmple.com" +ddns.rmempty = false + +localnet = s:taboption("basic", Value, "server", translate("Client Network")) +localnet.datatype = "string" +localnet.description = translate("VPN Client Network IP with subnet") + +list = s:taboption("basic", DynamicList, "push") +list.title = translate("Client Settings") +list.datatype = "string" +list.description = translate("Set route 192.168.0.0 255.255.255.0 and dhcp-option DNS 192.168.0.1 base on your router") + + +local o +o = s:taboption("basic", Button,"certificate",translate("OpenVPN Client config file")) +o.inputtitle = translate("Download .ovpn file") +o.description = translate("If you are using IOS client, please download this .ovpn file and send it via QQ or Email to your IOS device") +o.inputstyle = "reload" +o.write = function() + luci.sys.call("sh /etc/genovpn.sh 2>&1 >/dev/null") + Download() +end + +s:tab("code", translate("Special Code")) + +local conf = "/etc/ovpnadd.conf" +local NXFS = require "nixio.fs" +o = s:taboption("code", TextValue, "conf") +o.description = translate("(!)Special Code you know that add in to client .ovpn file") +o.rows = 13 +o.wrap = "off" +o.cfgvalue = function(self, section) + return NXFS.readfile(conf) or "" +end +o.write = function(self, section, value) + NXFS.writefile(conf, value:gsub("\r\n", "\n")) +end + + +local pid = luci.util.exec("/usr/bin/pgrep openvpn") + +function openvpn_process_status() + local status = "OpenVPN is not running now " + + if pid ~= "" then + status = "OpenVPN is running with the PID " .. pid .. "" + end + + local status = { status=status } + local table = { pid=status } + return table +end + + + +function Download() + local t,e + t=nixio.open("/tmp/my.ovpn","r") + luci.http.header('Content-Disposition','attachment; filename="my.ovpn"') + luci.http.prepare_content("application/octet-stream") + while true do + e=t:read(nixio.const.buffersize) + if(not e)or(#e==0)then + break + else + luci.http.write(e) + end + end + t:close() + luci.http.close() +end + +function mp.on_after_commit(self) + os.execute("uci set firewall.openvpn.dest_port=$(uci get openvpn.myvpn.port) && uci commit firewall && /etc/init.d/firewall restart") + os.execute("/etc/init.d/openvpn restart") +end + + +return mp diff --git a/package/lean/luci-app-openvpn-server/luasrc/view/openvpn/openvpn_status.htm b/package/lean/luci-app-openvpn-server/luasrc/view/openvpn/openvpn_status.htm new file mode 100644 index 00000000000000..752abd4d0b4c8e --- /dev/null +++ b/package/lean/luci-app-openvpn-server/luasrc/view/openvpn/openvpn_status.htm @@ -0,0 +1,22 @@ + + +
+

+ <%:Collecting data...%> +

+
\ No newline at end of file diff --git a/package/lean/luci-app-openvpn-server/po/zh-cn/openvpn-server.po b/package/lean/luci-app-openvpn-server/po/zh-cn/openvpn-server.po new file mode 100644 index 00000000000000..b13d6a896714c5 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/po/zh-cn/openvpn-server.po @@ -0,0 +1,53 @@ +msgid "OpenVPN Server" +msgstr "OpenVPN 服务器" + +msgid "An easy config OpenVPN Server Web-UI" +msgstr "易于使用的 OpenVPN 服务器 Web-UI" + +msgid "Base Setting" +msgstr "基本设置" + +msgid "Enable" +msgstr "启用" + +msgid "Port" +msgstr "端口" + +msgid "WAN DDNS or IP" +msgstr "WAN口的 DDNS域名 或者 IP" + + +msgid "Client Network" +msgstr "客户端网段" + +msgid "VPN Client Network IP with subnet" +msgstr "客户端分配的网段地址(默认为 10.8.0.0 255.255.255.0)" + + +msgid "Client Settings" +msgstr "客户端推送配置" + +msgid "OpenVPN Client config file" +msgstr "OpenVPN 客户端配置文件" + + +msgid "Download .ovpn file" +msgstr "一键下载 .ovpn 文件" + +msgid "If you are using IOS client, please download this .ovpn file and send it via QQ or Email to your IOS device" +msgstr "如果你使用的是 iOS 设备,你可以使用 QQ 或者邮件发送到自己的设备上用 OpenVPN 客户端打开导入" + +msgid "Special Code" +msgstr "特殊代码" + +msgid "(!)Special Code you know that add in to client .ovpn file" +msgstr "(!)特殊代码将自动合并到客户端的 .ovpn 配置文件中" + +msgid "Set route 192.168.0.0 255.255.255.0 and dhcp-option DNS 192.168.0.1 base on your router" +msgstr "根据路由的实际LAN IP 修改 route 192.168.0.0 255.255.255.0 和 dhcp-option DNS 192.168.0.1 这两行" + +msgid "OpenVPN status" +msgstr "OpenVPN 服务器运行状态" + +msgid "Proto" +msgstr "协议" diff --git a/package/lean/luci-app-openvpn-server/root/etc/config/openvpn b/package/lean/luci-app-openvpn-server/root/etc/config/openvpn new file mode 100644 index 00000000000000..6a829f4e609235 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/config/openvpn @@ -0,0 +1,28 @@ + +config openvpn 'myvpn' + option enabled '0' + option proto 'tcp-server' + option port '1194' + option ddns example.com + option dev 'tun' + option topology 'subnet' + option server '10.8.0.0 255.255.255.0' + option comp_lzo 'adaptive' + option ca '/etc/openvpn/ca.crt' + option dh '/etc/openvpn/dh1024.pem' + option cert '/etc/openvpn/server.crt' + option key '/etc/openvpn/server.key' + option persist_key '1' + option persist_tun '1' + option user 'nobody' + option group 'nogroup' + option max_clients '10' + option keepalive '10 120' + option verb '3' + option status '/var/log/openvpn_status.log' + option log '/tmp/openvpn.log' + list push 'route 192.168.0.0 255.255.255.0' + list push 'comp-lzo adaptive' + list push 'redirect-gateway def1 bypass-dhcp' + list push 'dhcp-option DNS 192.168.0.1' + diff --git a/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/01.pem b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/01.pem new file mode 100644 index 00000000000000..a73a757e94886e --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/01.pem @@ -0,0 +1,74 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha256WithRSAEncryption + Issuer: C=CN, ST=ZJ, L=ZJ, O=ZJ, OU=ZJ, CN=ZJ CA/name=EasyRSA/emailAddress=ZJ@ZJ.com + Validity + Not Before: Aug 23 14:26:42 2017 GMT + Not After : Aug 21 14:26:42 2027 GMT + Subject: C=CN, ST=ZJ, L=ZJ, O=ZJ, OU=ZJ, CN=server/name=EasyRSA/emailAddress=ZJ@ZJ.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (1024 bit) + Modulus: + 00:e0:67:2e:33:ab:4f:4f:a1:78:c6:32:ba:d3:1d: + 71:73:34:ba:45:40:88:87:76:03:fb:87:d8:4e:4e: + 7c:7d:95:22:7d:8e:70:dc:68:10:27:fe:7d:f0:79: + 93:86:83:ef:a9:16:78:ae:86:5e:ea:42:74:38:4d: + 37:0d:c9:34:a6:84:5e:64:ad:dd:91:dd:df:02:bf: + 53:f8:fb:c0:9b:cb:bd:93:7c:26:ab:bd:0a:c6:c3: + 5d:da:5d:b3:c0:ff:72:a1:2f:1e:0b:f6:a6:71:77: + f9:00:38:8a:ae:ab:c0:86:11:ab:12:de:1e:82:13: + e8:c3:d5:bb:6f:2e:bf:6e:c1 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:FALSE + Netscape Cert Type: + SSL Server + Netscape Comment: + Easy-RSA Generated Server Certificate + X509v3 Subject Key Identifier: + 1C:06:47:33:61:0E:15:84:D5:08:5A:40:E6:C9:23:EF:87:F3:EE:F9 + X509v3 Authority Key Identifier: + keyid:8D:D5:04:79:10:05:4F:1B:12:63:11:AC:00:D4:FC:CC:31:00:B8:09 + DirName:/C=CN/ST=ZJ/L=ZJ/O=ZJ/OU=ZJ/CN=ZJ CA/name=EasyRSA/emailAddress=ZJ@ZJ.com + serial:AE:18:A1:E1:3D:52:4D:F0 + + X509v3 Extended Key Usage: + TLS Web Server Authentication + X509v3 Key Usage: + Digital Signature, Key Encipherment + Signature Algorithm: sha256WithRSAEncryption + aa:b5:0d:7a:b3:09:7a:d4:e6:df:46:0d:54:39:e2:34:da:4f: + 9b:92:d6:41:db:10:b9:ed:66:34:7f:9d:a9:fa:af:6a:80:b4: + 1f:13:d3:39:a6:72:93:5a:6b:e8:4f:ba:95:f9:83:10:58:b3: + fe:12:3f:a9:e8:31:04:e0:8e:d8:4c:c1:f7:7e:fc:7a:ba:17: + d8:2e:76:ab:7c:17:ca:a4:1d:3d:c5:bc:df:02:e5:2e:91:c4: + b2:6c:40:a1:e2:3d:64:15:da:a6:b0:e4:1d:66:11:54:c0:49: + 05:91:c4:69:68:2d:bc:d5:f6:32:43:3c:18:c4:97:54:45:52: + 28:36 +-----BEGIN CERTIFICATE----- +MIIDvzCCAyigAwIBAgIBATANBgkqhkiG9w0BAQsFADB9MQswCQYDVQQGEwJDTjEL +MAkGA1UECBMCWkoxCzAJBgNVBAcTAlpKMQswCQYDVQQKEwJaSjELMAkGA1UECxMC +WkoxDjAMBgNVBAMTBVpKIENBMRAwDgYDVQQpEwdFYXN5UlNBMRgwFgYJKoZIhvcN +AQkBFglaSkBaSi5jb20wHhcNMTcwODIzMTQyNjQyWhcNMjcwODIxMTQyNjQyWjB+ +MQswCQYDVQQGEwJDTjELMAkGA1UECBMCWkoxCzAJBgNVBAcTAlpKMQswCQYDVQQK +EwJaSjELMAkGA1UECxMCWkoxDzANBgNVBAMTBnNlcnZlcjEQMA4GA1UEKRMHRWFz +eVJTQTEYMBYGCSqGSIb3DQEJARYJWkpAWkouY29tMIGfMA0GCSqGSIb3DQEBAQUA +A4GNADCBiQKBgQDgZy4zq09PoXjGMrrTHXFzNLpFQIiHdgP7h9hOTnx9lSJ9jnDc +aBAn/n3weZOGg++pFniuhl7qQnQ4TTcNyTSmhF5krd2R3d8Cv1P4+8Cby72TfCar +vQrGw13aXbPA/3KhLx4L9qZxd/kAOIquq8CGEasS3h6CE+jD1btvLr9uwQIDAQAB +o4IBTDCCAUgwCQYDVR0TBAIwADARBglghkgBhvhCAQEEBAMCBkAwNAYJYIZIAYb4 +QgENBCcWJUVhc3ktUlNBIEdlbmVyYXRlZCBTZXJ2ZXIgQ2VydGlmaWNhdGUwHQYD +VR0OBBYEFBwGRzNhDhWE1QhaQObJI++H8+75MIGwBgNVHSMEgagwgaWAFI3VBHkQ +BU8bEmMRrADU/MwxALgJoYGBpH8wfTELMAkGA1UEBhMCQ04xCzAJBgNVBAgTAlpK +MQswCQYDVQQHEwJaSjELMAkGA1UEChMCWkoxCzAJBgNVBAsTAlpKMQ4wDAYDVQQD +EwVaSiBDQTEQMA4GA1UEKRMHRWFzeVJTQTEYMBYGCSqGSIb3DQEJARYJWkpAWkou +Y29tggkArhih4T1STfAwEwYDVR0lBAwwCgYIKwYBBQUHAwEwCwYDVR0PBAQDAgWg +MA0GCSqGSIb3DQEBCwUAA4GBAKq1DXqzCXrU5t9GDVQ54jTaT5uS1kHbELntZjR/ +nan6r2qAtB8T0zmmcpNaa+hPupX5gxBYs/4SP6noMQTgjthMwfd+/Hq6F9gudqt8 +F8qkHT3FvN8C5S6RxLJsQKHiPWQV2qaw5B1mEVTASQWRxGloLbzV9jJDPBjEl1RF +Uig2 +-----END CERTIFICATE----- diff --git a/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/02.pem b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/02.pem new file mode 100644 index 00000000000000..c757880eaaa831 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/02.pem @@ -0,0 +1,71 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 2 (0x2) + Signature Algorithm: sha256WithRSAEncryption + Issuer: C=CN, ST=ZJ, L=ZJ, O=ZJ, OU=ZJ, CN=ZJ CA/name=EasyRSA/emailAddress=ZJ@ZJ.com + Validity + Not Before: Aug 23 14:26:58 2017 GMT + Not After : Aug 21 14:26:58 2027 GMT + Subject: C=CN, ST=ZJ, L=ZJ, O=ZJ, OU=ZJ, CN=client1/name=EasyRSA/emailAddress=ZJ@ZJ.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (1024 bit) + Modulus: + 00:b7:6b:40:0b:c1:ef:a7:c3:fa:54:32:c2:d7:87: + fa:ac:85:18:ae:af:44:ba:dd:57:0f:43:73:eb:df: + 37:5e:5e:8f:ad:43:7a:87:dd:a6:bd:6a:0b:68:8d: + 75:0c:fe:49:39:e1:54:11:53:0f:b5:63:10:5b:21: + 98:7f:53:32:b3:d6:b0:3d:23:fc:1d:ad:06:b0:f0: + fb:10:27:83:e1:5e:5a:b4:f6:7c:02:87:4c:73:86: + 7b:79:07:ca:a7:1c:18:2c:70:e3:9d:e6:f0:89:06: + 4b:25:2c:09:39:51:c3:d4:44:ef:81:5e:aa:e0:63: + d8:11:c6:9c:e0:6f:d8:66:11 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:FALSE + Netscape Comment: + Easy-RSA Generated Certificate + X509v3 Subject Key Identifier: + E8:15:F9:71:C4:A7:C2:41:A3:AF:F5:C5:93:51:8E:5D:67:9B:12:E2 + X509v3 Authority Key Identifier: + keyid:8D:D5:04:79:10:05:4F:1B:12:63:11:AC:00:D4:FC:CC:31:00:B8:09 + DirName:/C=CN/ST=ZJ/L=ZJ/O=ZJ/OU=ZJ/CN=ZJ CA/name=EasyRSA/emailAddress=ZJ@ZJ.com + serial:AE:18:A1:E1:3D:52:4D:F0 + + X509v3 Extended Key Usage: + TLS Web Client Authentication + X509v3 Key Usage: + Digital Signature + Signature Algorithm: sha256WithRSAEncryption + 5b:63:c2:e5:e4:04:ad:f4:b6:76:24:df:94:a5:b0:a2:99:38: + f9:e7:b4:2f:79:91:51:1b:06:4b:33:fc:4c:74:ce:47:3e:54: + 1b:da:ea:43:e3:6d:6e:ec:b4:cd:77:86:ea:ea:48:a1:79:70: + 5c:ff:99:0e:fb:bd:fc:0d:89:a6:2e:13:fe:86:82:69:33:4c: + 28:21:0d:a8:ba:1a:3e:c7:2e:2d:97:0c:5a:ed:e3:af:73:fc: + bb:c9:58:05:c5:26:56:13:1c:3e:8f:90:c7:e8:d9:e5:0b:1f: + 40:9a:fa:15:49:b9:d8:8e:6a:fd:71:f4:3c:df:a1:11:af:fb: + ea:a8 +-----BEGIN CERTIFICATE----- +MIIDpjCCAw+gAwIBAgIBAjANBgkqhkiG9w0BAQsFADB9MQswCQYDVQQGEwJDTjEL +MAkGA1UECBMCWkoxCzAJBgNVBAcTAlpKMQswCQYDVQQKEwJaSjELMAkGA1UECxMC +WkoxDjAMBgNVBAMTBVpKIENBMRAwDgYDVQQpEwdFYXN5UlNBMRgwFgYJKoZIhvcN +AQkBFglaSkBaSi5jb20wHhcNMTcwODIzMTQyNjU4WhcNMjcwODIxMTQyNjU4WjB/ +MQswCQYDVQQGEwJDTjELMAkGA1UECBMCWkoxCzAJBgNVBAcTAlpKMQswCQYDVQQK +EwJaSjELMAkGA1UECxMCWkoxEDAOBgNVBAMTB2NsaWVudDExEDAOBgNVBCkTB0Vh +c3lSU0ExGDAWBgkqhkiG9w0BCQEWCVpKQFpKLmNvbTCBnzANBgkqhkiG9w0BAQEF +AAOBjQAwgYkCgYEAt2tAC8Hvp8P6VDLC14f6rIUYrq9Eut1XD0Nz6983Xl6PrUN6 +h92mvWoLaI11DP5JOeFUEVMPtWMQWyGYf1Mys9awPSP8Ha0GsPD7ECeD4V5atPZ8 +AodMc4Z7eQfKpxwYLHDjnebwiQZLJSwJOVHD1ETvgV6q4GPYEcac4G/YZhECAwEA +AaOCATIwggEuMAkGA1UdEwQCMAAwLQYJYIZIAYb4QgENBCAWHkVhc3ktUlNBIEdl +bmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQU6BX5ccSnwkGjr/XFk1GOXWeb +EuIwgbAGA1UdIwSBqDCBpYAUjdUEeRAFTxsSYxGsANT8zDEAuAmhgYGkfzB9MQsw +CQYDVQQGEwJDTjELMAkGA1UECBMCWkoxCzAJBgNVBAcTAlpKMQswCQYDVQQKEwJa +SjELMAkGA1UECxMCWkoxDjAMBgNVBAMTBVpKIENBMRAwDgYDVQQpEwdFYXN5UlNB +MRgwFgYJKoZIhvcNAQkBFglaSkBaSi5jb22CCQCuGKHhPVJN8DATBgNVHSUEDDAK +BggrBgEFBQcDAjALBgNVHQ8EBAMCB4AwDQYJKoZIhvcNAQELBQADgYEAW2PC5eQE +rfS2diTflKWwopk4+ee0L3mRURsGSzP8THTORz5UG9rqQ+Ntbuy0zXeG6upIoXlw +XP+ZDvu9/A2Jpi4T/oaCaTNMKCENqLoaPscuLZcMWu3jr3P8u8lYBcUmVhMcPo+Q +x+jZ5QsfQJr6FUm52I5q/XH0PN+hEa/76qg= +-----END CERTIFICATE----- diff --git a/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/ca.crt b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/ca.crt new file mode 100644 index 00000000000000..7b7ba5ef817816 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/ca.crt @@ -0,0 +1,20 @@ +-----BEGIN CERTIFICATE----- +MIIDXDCCAsWgAwIBAgIJAK4YoeE9Uk3wMA0GCSqGSIb3DQEBCwUAMH0xCzAJBgNV +BAYTAkNOMQswCQYDVQQIEwJaSjELMAkGA1UEBxMCWkoxCzAJBgNVBAoTAlpKMQsw +CQYDVQQLEwJaSjEOMAwGA1UEAxMFWkogQ0ExEDAOBgNVBCkTB0Vhc3lSU0ExGDAW +BgkqhkiG9w0BCQEWCVpKQFpKLmNvbTAeFw0xNzA4MjMxNDE4MDVaFw0yNzA4MjEx +NDE4MDVaMH0xCzAJBgNVBAYTAkNOMQswCQYDVQQIEwJaSjELMAkGA1UEBxMCWkox +CzAJBgNVBAoTAlpKMQswCQYDVQQLEwJaSjEOMAwGA1UEAxMFWkogQ0ExEDAOBgNV +BCkTB0Vhc3lSU0ExGDAWBgkqhkiG9w0BCQEWCVpKQFpKLmNvbTCBnzANBgkqhkiG +9w0BAQEFAAOBjQAwgYkCgYEAsLBNLkjfNUK4Rb3xgJD0EEgzp6b+5zkiibT3wdS9 +SKZqkqJRcM/z7Ifc79LKXDDHrVnajkyc8QSaXOKVW8pTx75fYnoHjNbeU9JZHoTg +9GgRWq5HHUJlxhsdbcGeTxOHrMRz2d+VzvNvs5KOLJaqGkRmm/KMb7nTRnwjhx4A +pWsCAwEAAaOB4zCB4DAdBgNVHQ4EFgQUjdUEeRAFTxsSYxGsANT8zDEAuAkwgbAG +A1UdIwSBqDCBpYAUjdUEeRAFTxsSYxGsANT8zDEAuAmhgYGkfzB9MQswCQYDVQQG +EwJDTjELMAkGA1UECBMCWkoxCzAJBgNVBAcTAlpKMQswCQYDVQQKEwJaSjELMAkG +A1UECxMCWkoxDjAMBgNVBAMTBVpKIENBMRAwDgYDVQQpEwdFYXN5UlNBMRgwFgYJ +KoZIhvcNAQkBFglaSkBaSi5jb22CCQCuGKHhPVJN8DAMBgNVHRMEBTADAQH/MA0G +CSqGSIb3DQEBCwUAA4GBAAAN0aRmQGNsF23CxShEnj3ohgpYA20F2FwEWYmCCWXe +CKxuPGtPZAeLmToIMgn75QlyuvVG+Uoe7I6ylbEK3XoeNStcS61wAXL8hIPfMcUX +fDsImBvc+Bo+LxQMWMSz0r88+B8784KELyaQKOnvPlTrnTuyP9RftjUWpjy23Kjd +-----END CERTIFICATE----- diff --git a/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/ca.key b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/ca.key new file mode 100644 index 00000000000000..796fbf10ea9592 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/ca.key @@ -0,0 +1,16 @@ +-----BEGIN PRIVATE KEY----- +MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBALCwTS5I3zVCuEW9 +8YCQ9BBIM6em/uc5Iom098HUvUimapKiUXDP8+yH3O/Sylwwx61Z2o5MnPEEmlzi +lVvKU8e+X2J6B4zW3lPSWR6E4PRoEVquRx1CZcYbHW3Bnk8Th6zEc9nflc7zb7OS +jiyWqhpEZpvyjG+500Z8I4ceAKVrAgMBAAECgYBfiTRyTlzCg6z3qNioV7hgBWpI +wHcbtz0BkKRWXh1q5vDBEJtQkGCoCF5iHmvkpUuSY/9U6gACIicFCk8QLrpVZGzY +1SgOQS796La2gYR0clCvtsf8Kg4BYCKkF40jGDGZTGKtWa9mPuOZXZFhSMZJiCQi +UIfTN3D9Ngt/nLFMwQJBANwavdYXnPxGr/0rL1ct0RUjsZLyd9kmr1gD4Nq+/uwC +FQrNHl/ieXOsSeD0eVNtuTFzmt8sTz963SXmbPv01dMCQQDNgPioq4M/1sluGUdI +yK5bantPAD7A7wTb+uryP7lNMuDSGTXgLsh+RrhBuDlUdi+OPc0dIJV1fTjEiLbI +fLsJAkEAoSSe6Zh+IaDrBfJRBYWQtuZcApasMfqFk227eMsuvcFEgJTt8QtRGeQA +bsbt8Ku7Uz4tG8lH99TPBglurwRwawJAALVrJhnBUB0LgMexiTy37TTGzBTyInQw +jhmlacRyfSOpxs+zcdx3cIgJ5qAeAn6N1227IViVa1xNL9BQ4QwdEQJBAJjLcCYS +twmgoyOj4K5+8+aAuuXWj7lpxEakOZbghrBmy0GytiRKN9wb/x8QF6EtrJAmYltL +wMMDUDE0zd+hc2Q= +-----END PRIVATE KEY----- diff --git a/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/client1.crt b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/client1.crt new file mode 100644 index 00000000000000..c757880eaaa831 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/client1.crt @@ -0,0 +1,71 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 2 (0x2) + Signature Algorithm: sha256WithRSAEncryption + Issuer: C=CN, ST=ZJ, L=ZJ, O=ZJ, OU=ZJ, CN=ZJ CA/name=EasyRSA/emailAddress=ZJ@ZJ.com + Validity + Not Before: Aug 23 14:26:58 2017 GMT + Not After : Aug 21 14:26:58 2027 GMT + Subject: C=CN, ST=ZJ, L=ZJ, O=ZJ, OU=ZJ, CN=client1/name=EasyRSA/emailAddress=ZJ@ZJ.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (1024 bit) + Modulus: + 00:b7:6b:40:0b:c1:ef:a7:c3:fa:54:32:c2:d7:87: + fa:ac:85:18:ae:af:44:ba:dd:57:0f:43:73:eb:df: + 37:5e:5e:8f:ad:43:7a:87:dd:a6:bd:6a:0b:68:8d: + 75:0c:fe:49:39:e1:54:11:53:0f:b5:63:10:5b:21: + 98:7f:53:32:b3:d6:b0:3d:23:fc:1d:ad:06:b0:f0: + fb:10:27:83:e1:5e:5a:b4:f6:7c:02:87:4c:73:86: + 7b:79:07:ca:a7:1c:18:2c:70:e3:9d:e6:f0:89:06: + 4b:25:2c:09:39:51:c3:d4:44:ef:81:5e:aa:e0:63: + d8:11:c6:9c:e0:6f:d8:66:11 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:FALSE + Netscape Comment: + Easy-RSA Generated Certificate + X509v3 Subject Key Identifier: + E8:15:F9:71:C4:A7:C2:41:A3:AF:F5:C5:93:51:8E:5D:67:9B:12:E2 + X509v3 Authority Key Identifier: + keyid:8D:D5:04:79:10:05:4F:1B:12:63:11:AC:00:D4:FC:CC:31:00:B8:09 + DirName:/C=CN/ST=ZJ/L=ZJ/O=ZJ/OU=ZJ/CN=ZJ CA/name=EasyRSA/emailAddress=ZJ@ZJ.com + serial:AE:18:A1:E1:3D:52:4D:F0 + + X509v3 Extended Key Usage: + TLS Web Client Authentication + X509v3 Key Usage: + Digital Signature + Signature Algorithm: sha256WithRSAEncryption + 5b:63:c2:e5:e4:04:ad:f4:b6:76:24:df:94:a5:b0:a2:99:38: + f9:e7:b4:2f:79:91:51:1b:06:4b:33:fc:4c:74:ce:47:3e:54: + 1b:da:ea:43:e3:6d:6e:ec:b4:cd:77:86:ea:ea:48:a1:79:70: + 5c:ff:99:0e:fb:bd:fc:0d:89:a6:2e:13:fe:86:82:69:33:4c: + 28:21:0d:a8:ba:1a:3e:c7:2e:2d:97:0c:5a:ed:e3:af:73:fc: + bb:c9:58:05:c5:26:56:13:1c:3e:8f:90:c7:e8:d9:e5:0b:1f: + 40:9a:fa:15:49:b9:d8:8e:6a:fd:71:f4:3c:df:a1:11:af:fb: + ea:a8 +-----BEGIN CERTIFICATE----- +MIIDpjCCAw+gAwIBAgIBAjANBgkqhkiG9w0BAQsFADB9MQswCQYDVQQGEwJDTjEL +MAkGA1UECBMCWkoxCzAJBgNVBAcTAlpKMQswCQYDVQQKEwJaSjELMAkGA1UECxMC +WkoxDjAMBgNVBAMTBVpKIENBMRAwDgYDVQQpEwdFYXN5UlNBMRgwFgYJKoZIhvcN +AQkBFglaSkBaSi5jb20wHhcNMTcwODIzMTQyNjU4WhcNMjcwODIxMTQyNjU4WjB/ +MQswCQYDVQQGEwJDTjELMAkGA1UECBMCWkoxCzAJBgNVBAcTAlpKMQswCQYDVQQK +EwJaSjELMAkGA1UECxMCWkoxEDAOBgNVBAMTB2NsaWVudDExEDAOBgNVBCkTB0Vh +c3lSU0ExGDAWBgkqhkiG9w0BCQEWCVpKQFpKLmNvbTCBnzANBgkqhkiG9w0BAQEF +AAOBjQAwgYkCgYEAt2tAC8Hvp8P6VDLC14f6rIUYrq9Eut1XD0Nz6983Xl6PrUN6 +h92mvWoLaI11DP5JOeFUEVMPtWMQWyGYf1Mys9awPSP8Ha0GsPD7ECeD4V5atPZ8 +AodMc4Z7eQfKpxwYLHDjnebwiQZLJSwJOVHD1ETvgV6q4GPYEcac4G/YZhECAwEA +AaOCATIwggEuMAkGA1UdEwQCMAAwLQYJYIZIAYb4QgENBCAWHkVhc3ktUlNBIEdl +bmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQU6BX5ccSnwkGjr/XFk1GOXWeb +EuIwgbAGA1UdIwSBqDCBpYAUjdUEeRAFTxsSYxGsANT8zDEAuAmhgYGkfzB9MQsw +CQYDVQQGEwJDTjELMAkGA1UECBMCWkoxCzAJBgNVBAcTAlpKMQswCQYDVQQKEwJa +SjELMAkGA1UECxMCWkoxDjAMBgNVBAMTBVpKIENBMRAwDgYDVQQpEwdFYXN5UlNB +MRgwFgYJKoZIhvcNAQkBFglaSkBaSi5jb22CCQCuGKHhPVJN8DATBgNVHSUEDDAK +BggrBgEFBQcDAjALBgNVHQ8EBAMCB4AwDQYJKoZIhvcNAQELBQADgYEAW2PC5eQE +rfS2diTflKWwopk4+ee0L3mRURsGSzP8THTORz5UG9rqQ+Ntbuy0zXeG6upIoXlw +XP+ZDvu9/A2Jpi4T/oaCaTNMKCENqLoaPscuLZcMWu3jr3P8u8lYBcUmVhMcPo+Q +x+jZ5QsfQJr6FUm52I5q/XH0PN+hEa/76qg= +-----END CERTIFICATE----- diff --git a/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/client1.csr b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/client1.csr new file mode 100644 index 00000000000000..a3549ca15ea69a --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/client1.csr @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIBvzCCASgCAQAwfzELMAkGA1UEBhMCQ04xCzAJBgNVBAgTAlpKMQswCQYDVQQH +EwJaSjELMAkGA1UEChMCWkoxCzAJBgNVBAsTAlpKMRAwDgYDVQQDEwdjbGllbnQx +MRAwDgYDVQQpEwdFYXN5UlNBMRgwFgYJKoZIhvcNAQkBFglaSkBaSi5jb20wgZ8w +DQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALdrQAvB76fD+lQywteH+qyFGK6vRLrd +Vw9Dc+vfN15ej61Deofdpr1qC2iNdQz+STnhVBFTD7VjEFshmH9TMrPWsD0j/B2t +BrDw+xAng+FeWrT2fAKHTHOGe3kHyqccGCxw453m8IkGSyUsCTlRw9RE74FequBj +2BHGnOBv2GYRAgMBAAGgADANBgkqhkiG9w0BAQsFAAOBgQBfvn2fP2Tj8FTZH+Xk +9u04rYaQdspSyL61F4QIEiP5UOUzbnSSU/B72KF5gm8b0irXGnTbHlXeMv6WXaAS +VF1fEeM+gsGJIDOvomT5PKfudezr6DpGrUammQnRY3tho078Ao0Mkq8PAWpiVWGV +Z7rsqHhI3mWYLNyne9n8K224pg== +-----END CERTIFICATE REQUEST----- diff --git a/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/client1.key b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/client1.key new file mode 100644 index 00000000000000..076ce4e72b1654 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/client1.key @@ -0,0 +1,16 @@ +-----BEGIN PRIVATE KEY----- +MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBALdrQAvB76fD+lQy +wteH+qyFGK6vRLrdVw9Dc+vfN15ej61Deofdpr1qC2iNdQz+STnhVBFTD7VjEFsh +mH9TMrPWsD0j/B2tBrDw+xAng+FeWrT2fAKHTHOGe3kHyqccGCxw453m8IkGSyUs +CTlRw9RE74FequBj2BHGnOBv2GYRAgMBAAECgYBhWatEkkqA4KOczNRdUO7bYkkX +bi8sfw4WK9b6+h6JF+dqLsZ6FkrJfd9QPsRBgTWcYtwb1dogi9PCirJF4gKmSsv1 +h/BISW4lrXJPf08aJAuBF0ym8XZUgVLLptn8KdXX3xc6YF6K336AnNNLZ80X4El8 +m7X4d8Y3F4k3Dj04AQJBAN9NkHYwevaZ8jfv5rZSTKECmdk1DZITd756+sObFAs1 +vX9VfunwVw6xWmaUyMt8oPFqb0wKES9zqrViaMhU9YkCQQDSRqV3ldHcaZJ6sTgm +T8ZKm+UpbC4zat4rGSBYKaoeLRPh5nxP892rOfBAevkoIQzW7LfVfoMImM/i1J6T +lNJJAkAHSOZ/lJFOXjNSs9bY99JcJlOSjHKG42+ynRx1KSf8PaKS9t0PELImXo7O +begnC0fM2GYNGv74h1N4W1+DuZHRAkEAlNov3jSvh+EwMSxs/Cnyy/QJyEXteraH +KWkzDVYJOC1e6sZXb93JKKHuIicrY63pwed2x2o0ZgyO9RrgWsa6CQJBAMogPcRO +jUGjYs3IYXW6Suf1bRJN2aS81gx7lqyLQE3ignH6e9kMxcrzG4AzzePCLouY3waL +HS1KW8V9I5c4qTs= +-----END PRIVATE KEY----- diff --git a/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/client1.p12 b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/client1.p12 new file mode 100644 index 00000000000000..1511e1d0af47ec Binary files /dev/null and b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/client1.p12 differ diff --git a/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/dh1024.pem b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/dh1024.pem new file mode 100644 index 00000000000000..01eba3e5a18c34 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/dh1024.pem @@ -0,0 +1,5 @@ +-----BEGIN DH PARAMETERS----- +MIGHAoGBAMzJWsEtMQ76G81O8RzEweDaPrio4NihRBo0fmNuh3IjJtFJ++URPW4y +HHtnGOkPoMwQjGQ3GQV+lfcR7QGWojET4NskXOk6mdFU+/nYB9s5YY7RR4qyln9b +dNMp3KnMLtILNH1rJRoqYbSNoz3Z2cS59Ejp1dgXqN8kSP8wiqDjAgEC +-----END DH PARAMETERS----- diff --git a/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/index.txt b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/index.txt new file mode 100644 index 00000000000000..4bb34b80fcdbc3 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/index.txt @@ -0,0 +1,2 @@ +V 270821142642Z 01 unknown /C=CN/ST=ZJ/L=ZJ/O=ZJ/OU=ZJ/CN=server/name=EasyRSA/emailAddress=ZJ@ZJ.com +V 270821142658Z 02 unknown /C=CN/ST=ZJ/L=ZJ/O=ZJ/OU=ZJ/CN=client1/name=EasyRSA/emailAddress=ZJ@ZJ.com diff --git a/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/index.txt.attr b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/index.txt.attr new file mode 100644 index 00000000000000..8f7e63a3475ce8 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/index.txt.attr @@ -0,0 +1 @@ +unique_subject = yes diff --git a/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/index.txt.attr.old b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/index.txt.attr.old new file mode 100644 index 00000000000000..8f7e63a3475ce8 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/index.txt.attr.old @@ -0,0 +1 @@ +unique_subject = yes diff --git a/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/index.txt.old b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/index.txt.old new file mode 100644 index 00000000000000..d74831ee49b96c --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/index.txt.old @@ -0,0 +1 @@ +V 270821142642Z 01 unknown /C=CN/ST=ZJ/L=ZJ/O=ZJ/OU=ZJ/CN=server/name=EasyRSA/emailAddress=ZJ@ZJ.com diff --git a/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/serial b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/serial new file mode 100644 index 00000000000000..75016ea3625245 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/serial @@ -0,0 +1 @@ +03 diff --git a/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/serial.old b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/serial.old new file mode 100644 index 00000000000000..9e22bcb8e34408 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/serial.old @@ -0,0 +1 @@ +02 diff --git a/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/server.crt b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/server.crt new file mode 100644 index 00000000000000..a73a757e94886e --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/server.crt @@ -0,0 +1,74 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha256WithRSAEncryption + Issuer: C=CN, ST=ZJ, L=ZJ, O=ZJ, OU=ZJ, CN=ZJ CA/name=EasyRSA/emailAddress=ZJ@ZJ.com + Validity + Not Before: Aug 23 14:26:42 2017 GMT + Not After : Aug 21 14:26:42 2027 GMT + Subject: C=CN, ST=ZJ, L=ZJ, O=ZJ, OU=ZJ, CN=server/name=EasyRSA/emailAddress=ZJ@ZJ.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (1024 bit) + Modulus: + 00:e0:67:2e:33:ab:4f:4f:a1:78:c6:32:ba:d3:1d: + 71:73:34:ba:45:40:88:87:76:03:fb:87:d8:4e:4e: + 7c:7d:95:22:7d:8e:70:dc:68:10:27:fe:7d:f0:79: + 93:86:83:ef:a9:16:78:ae:86:5e:ea:42:74:38:4d: + 37:0d:c9:34:a6:84:5e:64:ad:dd:91:dd:df:02:bf: + 53:f8:fb:c0:9b:cb:bd:93:7c:26:ab:bd:0a:c6:c3: + 5d:da:5d:b3:c0:ff:72:a1:2f:1e:0b:f6:a6:71:77: + f9:00:38:8a:ae:ab:c0:86:11:ab:12:de:1e:82:13: + e8:c3:d5:bb:6f:2e:bf:6e:c1 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:FALSE + Netscape Cert Type: + SSL Server + Netscape Comment: + Easy-RSA Generated Server Certificate + X509v3 Subject Key Identifier: + 1C:06:47:33:61:0E:15:84:D5:08:5A:40:E6:C9:23:EF:87:F3:EE:F9 + X509v3 Authority Key Identifier: + keyid:8D:D5:04:79:10:05:4F:1B:12:63:11:AC:00:D4:FC:CC:31:00:B8:09 + DirName:/C=CN/ST=ZJ/L=ZJ/O=ZJ/OU=ZJ/CN=ZJ CA/name=EasyRSA/emailAddress=ZJ@ZJ.com + serial:AE:18:A1:E1:3D:52:4D:F0 + + X509v3 Extended Key Usage: + TLS Web Server Authentication + X509v3 Key Usage: + Digital Signature, Key Encipherment + Signature Algorithm: sha256WithRSAEncryption + aa:b5:0d:7a:b3:09:7a:d4:e6:df:46:0d:54:39:e2:34:da:4f: + 9b:92:d6:41:db:10:b9:ed:66:34:7f:9d:a9:fa:af:6a:80:b4: + 1f:13:d3:39:a6:72:93:5a:6b:e8:4f:ba:95:f9:83:10:58:b3: + fe:12:3f:a9:e8:31:04:e0:8e:d8:4c:c1:f7:7e:fc:7a:ba:17: + d8:2e:76:ab:7c:17:ca:a4:1d:3d:c5:bc:df:02:e5:2e:91:c4: + b2:6c:40:a1:e2:3d:64:15:da:a6:b0:e4:1d:66:11:54:c0:49: + 05:91:c4:69:68:2d:bc:d5:f6:32:43:3c:18:c4:97:54:45:52: + 28:36 +-----BEGIN CERTIFICATE----- +MIIDvzCCAyigAwIBAgIBATANBgkqhkiG9w0BAQsFADB9MQswCQYDVQQGEwJDTjEL +MAkGA1UECBMCWkoxCzAJBgNVBAcTAlpKMQswCQYDVQQKEwJaSjELMAkGA1UECxMC +WkoxDjAMBgNVBAMTBVpKIENBMRAwDgYDVQQpEwdFYXN5UlNBMRgwFgYJKoZIhvcN +AQkBFglaSkBaSi5jb20wHhcNMTcwODIzMTQyNjQyWhcNMjcwODIxMTQyNjQyWjB+ +MQswCQYDVQQGEwJDTjELMAkGA1UECBMCWkoxCzAJBgNVBAcTAlpKMQswCQYDVQQK +EwJaSjELMAkGA1UECxMCWkoxDzANBgNVBAMTBnNlcnZlcjEQMA4GA1UEKRMHRWFz +eVJTQTEYMBYGCSqGSIb3DQEJARYJWkpAWkouY29tMIGfMA0GCSqGSIb3DQEBAQUA +A4GNADCBiQKBgQDgZy4zq09PoXjGMrrTHXFzNLpFQIiHdgP7h9hOTnx9lSJ9jnDc +aBAn/n3weZOGg++pFniuhl7qQnQ4TTcNyTSmhF5krd2R3d8Cv1P4+8Cby72TfCar +vQrGw13aXbPA/3KhLx4L9qZxd/kAOIquq8CGEasS3h6CE+jD1btvLr9uwQIDAQAB +o4IBTDCCAUgwCQYDVR0TBAIwADARBglghkgBhvhCAQEEBAMCBkAwNAYJYIZIAYb4 +QgENBCcWJUVhc3ktUlNBIEdlbmVyYXRlZCBTZXJ2ZXIgQ2VydGlmaWNhdGUwHQYD +VR0OBBYEFBwGRzNhDhWE1QhaQObJI++H8+75MIGwBgNVHSMEgagwgaWAFI3VBHkQ +BU8bEmMRrADU/MwxALgJoYGBpH8wfTELMAkGA1UEBhMCQ04xCzAJBgNVBAgTAlpK +MQswCQYDVQQHEwJaSjELMAkGA1UEChMCWkoxCzAJBgNVBAsTAlpKMQ4wDAYDVQQD +EwVaSiBDQTEQMA4GA1UEKRMHRWFzeVJTQTEYMBYGCSqGSIb3DQEJARYJWkpAWkou +Y29tggkArhih4T1STfAwEwYDVR0lBAwwCgYIKwYBBQUHAwEwCwYDVR0PBAQDAgWg +MA0GCSqGSIb3DQEBCwUAA4GBAKq1DXqzCXrU5t9GDVQ54jTaT5uS1kHbELntZjR/ +nan6r2qAtB8T0zmmcpNaa+hPupX5gxBYs/4SP6noMQTgjthMwfd+/Hq6F9gudqt8 +F8qkHT3FvN8C5S6RxLJsQKHiPWQV2qaw5B1mEVTASQWRxGloLbzV9jJDPBjEl1RF +Uig2 +-----END CERTIFICATE----- diff --git a/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/server.csr b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/server.csr new file mode 100644 index 00000000000000..c83aadabec1bed --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/server.csr @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIBvjCCAScCAQAwfjELMAkGA1UEBhMCQ04xCzAJBgNVBAgTAlpKMQswCQYDVQQH +EwJaSjELMAkGA1UEChMCWkoxCzAJBgNVBAsTAlpKMQ8wDQYDVQQDEwZzZXJ2ZXIx +EDAOBgNVBCkTB0Vhc3lSU0ExGDAWBgkqhkiG9w0BCQEWCVpKQFpKLmNvbTCBnzAN +BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA4GcuM6tPT6F4xjK60x1xczS6RUCIh3YD ++4fYTk58fZUifY5w3GgQJ/598HmThoPvqRZ4roZe6kJ0OE03Dck0poReZK3dkd3f +Ar9T+PvAm8u9k3wmq70KxsNd2l2zwP9yoS8eC/amcXf5ADiKrqvAhhGrEt4eghPo +w9W7by6/bsECAwEAAaAAMA0GCSqGSIb3DQEBCwUAA4GBAMrytQrG3MGVTD2vsZkw +hJn9U4MYmikqFxEcSJ+JEeDJ0w3NTn95XJmFtmuT/CwsrnP9g+1neSpCXsZewozd +QRisYBF9Rl9qw9fH2o1S/GIVpTDIiTtWjegZA6FPkhQQyY387LU9Lp4vG9hdNbuz +QNDs6cI9T0U53PZiq7R65rGV +-----END CERTIFICATE REQUEST----- diff --git a/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/server.key b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/server.key new file mode 100644 index 00000000000000..3aab5cd4bbd1c7 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/keys/server.key @@ -0,0 +1,16 @@ +-----BEGIN PRIVATE KEY----- +MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAOBnLjOrT0+heMYy +utMdcXM0ukVAiId2A/uH2E5OfH2VIn2OcNxoECf+ffB5k4aD76kWeK6GXupCdDhN +Nw3JNKaEXmSt3ZHd3wK/U/j7wJvLvZN8Jqu9CsbDXdpds8D/cqEvHgv2pnF3+QA4 +iq6rwIYRqxLeHoIT6MPVu28uv27BAgMBAAECgYEAqno4g1BVxG0rT4cin1fy5E7e +Y9YO4ropdGFTVsoRkWZG+ZPI8eisvXV9P79c8AgzfgVwUUYLvXQWzt76QCLnN11x +pBURloJbEReEEzIF6z3LiT9CKgVWY4vtC6f5OW4Kd+EZxXMftFz8kMzRuRQLvOzR +WeU+3GD42mIwYjsXBrECQQD2P6azeZJ1ZIEf+9Ys19tSQ6uxbXyvghlTfhmZfBW3 +bshNRH4+L4lnnbm75pFkWqR0gYSAD3toRymccctN2K9jAkEA6UoRwURTjIER8yZO +6gLTFtzb841jv6TPErOY7CzNZ/TYBUdUBmM/NB4+RgBpBNFXB3uqweNVPO6mhyQP +zB88iwJBAOeH6YGOqTpfiVk9PJ9lRf4PSnvE6htLQ+zQ/9jkZrbWHtcns1tc7uDR +2DToEYQ+BarVrHOMGwhtAJ7sD6/eMOkCQFjn8XxGHdEeH0kbAFgOW4QLB4f6Clmu +5XurFkxrhpxnoyvf0xXcHOov3GuxHFTJsvEXICxkBsgB61T1WU/hV6ECQGzk5Eqo +uik2OAYMOb7NPGYMWS68DpmP11QDuvoj5zm2vdzohXHyBM7mO12MLSrTpxfgjWhQ +pqwEbErchuKkzN4= +-----END PRIVATE KEY----- diff --git a/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/openssl-1.0.0.cnf b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/openssl-1.0.0.cnf new file mode 100644 index 00000000000000..93ac6eaba8f469 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/openssl-1.0.0.cnf @@ -0,0 +1,286 @@ +# For use with easy-rsa version 2.0 and OpenSSL 1.0.0* + +# This definition stops the following lines choking if HOME isn't +# defined. +HOME = . +RANDFILE = $ENV::HOME/.rnd +openssl_conf = openssl_init + +[ openssl_init ] +# Extra OBJECT IDENTIFIER info: +#oid_file = $ENV::HOME/.oid +oid_section = new_oids +engines = engine_section + +# To use this configuration file with the "-extfile" option of the +# "openssl x509" utility, name here the section containing the +# X.509v3 extensions to use: +# extensions = +# (Alternatively, use a configuration file that has only +# X.509v3 extensions in its main [= default] section.) + +[ new_oids ] + +# We can add new OIDs in here for use by 'ca' and 'req'. +# Add a simple OID like this: +# testoid1=1.2.3.4 +# Or use config file substitution like this: +# testoid2=${testoid1}.5.6 + +#################################################################### +[ ca ] +default_ca = CA_default # The default ca section + +#################################################################### +[ CA_default ] + +dir = $ENV::KEY_DIR # Where everything is kept +certs = $dir # Where the issued certs are kept +crl_dir = $dir # Where the issued crl are kept +database = $dir/index.txt # database index file. +new_certs_dir = $dir # default place for new certs. + +certificate = $dir/ca.crt # The CA certificate +serial = $dir/serial # The current serial number +crl = $dir/crl.pem # The current CRL +private_key = $dir/ca.key # The private key +RANDFILE = $dir/.rand # private random number file + +x509_extensions = usr_cert # The extentions to add to the cert + +# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs +# so this is commented out by default to leave a V1 CRL. +# crl_extensions = crl_ext + +default_days = 3650 # how long to certify for +default_crl_days= 30 # how long before next CRL +default_md = sha256 # use public key default MD +preserve = no # keep passed DN ordering + +# A few difference way of specifying how similar the request should look +# For type CA, the listed attributes must be the same, and the optional +# and supplied fields are just that :-) +policy = policy_anything + +# For the CA policy +[ policy_match ] +countryName = match +stateOrProvinceName = match +organizationName = match +organizationalUnitName = optional +commonName = supplied +name = optional +emailAddress = optional + +# For the 'anything' policy +# At this point in time, you must list all acceptable 'object' +# types. +[ policy_anything ] +countryName = optional +stateOrProvinceName = optional +localityName = optional +organizationName = optional +organizationalUnitName = optional +commonName = supplied +name = optional +emailAddress = optional + +#################################################################### +[ req ] +default_bits = $ENV::KEY_SIZE +default_keyfile = privkey.pem +default_md = sha256 +distinguished_name = req_distinguished_name +attributes = req_attributes +x509_extensions = v3_ca # The extentions to add to the self signed cert + +# Passwords for private keys if not present they will be prompted for +# input_password = secret +# output_password = secret + +# This sets a mask for permitted string types. There are several options. +# default: PrintableString, T61String, BMPString. +# pkix : PrintableString, BMPString (PKIX recommendation after 2004). +# utf8only: only UTF8Strings (PKIX recommendation after 2004). +# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings). +# MASK:XXXX a literal mask value. +string_mask = nombstr + +# req_extensions = v3_req # The extensions to add to a certificate request + +[ req_distinguished_name ] +countryName = Country Name (2 letter code) +countryName_default = $ENV::KEY_COUNTRY +countryName_min = 2 +countryName_max = 2 + +stateOrProvinceName = State or Province Name (full name) +stateOrProvinceName_default = $ENV::KEY_PROVINCE + +localityName = Locality Name (eg, city) +localityName_default = $ENV::KEY_CITY + +0.organizationName = Organization Name (eg, company) +0.organizationName_default = $ENV::KEY_ORG + +# we can do this but it is not needed normally :-) +#1.organizationName = Second Organization Name (eg, company) +#1.organizationName_default = World Wide Web Pty Ltd + +organizationalUnitName = Organizational Unit Name (eg, section) +#organizationalUnitName_default = + +commonName = Common Name (eg, your name or your server\'s hostname) +commonName_max = 64 + +name = Name +name_max = 64 + +emailAddress = Email Address +emailAddress_default = $ENV::KEY_EMAIL +emailAddress_max = 40 + +# JY -- added for batch mode +organizationalUnitName_default = $ENV::KEY_OU +commonName_default = $ENV::KEY_CN +name_default = $ENV::KEY_NAME + + +# SET-ex3 = SET extension number 3 + +[ req_attributes ] +challengePassword = A challenge password +challengePassword_min = 4 +challengePassword_max = 20 + +unstructuredName = An optional company name + +[ usr_cert ] + +# These extensions are added when 'ca' signs a request. + +# This goes against PKIX guidelines but some CAs do it and some software +# requires this to avoid interpreting an end user certificate as a CA. + +basicConstraints=CA:FALSE + +# Here are some examples of the usage of nsCertType. If it is omitted +# the certificate can be used for anything *except* object signing. + +# This is OK for an SSL server. +# nsCertType = server + +# For an object signing certificate this would be used. +# nsCertType = objsign + +# For normal client use this is typical +# nsCertType = client, email + +# and for everything including object signing: +# nsCertType = client, email, objsign + +# This is typical in keyUsage for a client certificate. +# keyUsage = nonRepudiation, digitalSignature, keyEncipherment + +# This will be displayed in Netscape's comment listbox. +nsComment = "Easy-RSA Generated Certificate" + +# PKIX recommendations harmless if included in all certificates. +subjectKeyIdentifier=hash +authorityKeyIdentifier=keyid,issuer:always +extendedKeyUsage=clientAuth +keyUsage = digitalSignature + + +# This stuff is for subjectAltName and issuerAltname. +# Import the email address. +# subjectAltName=email:copy + +# Copy subject details +# issuerAltName=issuer:copy + +#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem +#nsBaseUrl +#nsRevocationUrl +#nsRenewalUrl +#nsCaPolicyUrl +#nsSslServerName + +[ server ] + +# JY ADDED -- Make a cert with nsCertType set to "server" +basicConstraints=CA:FALSE +nsCertType = server +nsComment = "Easy-RSA Generated Server Certificate" +subjectKeyIdentifier=hash +authorityKeyIdentifier=keyid,issuer:always +extendedKeyUsage=serverAuth +keyUsage = digitalSignature, keyEncipherment + +[ v3_req ] + +# Extensions to add to a certificate request + +basicConstraints = CA:FALSE +keyUsage = nonRepudiation, digitalSignature, keyEncipherment + +[ v3_ca ] + + +# Extensions for a typical CA + + +# PKIX recommendation. + +subjectKeyIdentifier=hash + +authorityKeyIdentifier=keyid:always,issuer:always + +# This is what PKIX recommends but some broken software chokes on critical +# extensions. +#basicConstraints = critical,CA:true +# So we do this instead. +basicConstraints = CA:true + +# Key usage: this is typical for a CA certificate. However since it will +# prevent it being used as an test self-signed certificate it is best +# left out by default. +# keyUsage = cRLSign, keyCertSign + +# Some might want this also +# nsCertType = sslCA, emailCA + +# Include email address in subject alt name: another PKIX recommendation +# subjectAltName=email:copy +# Copy issuer details +# issuerAltName=issuer:copy + +# DER hex encoding of an extension: beware experts only! +# obj=DER:02:03 +# Where 'obj' is a standard or added object +# You can even override a supported extension: +# basicConstraints= critical, DER:30:03:01:01:FF + +[ crl_ext ] + +# CRL extensions. +# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL. + +# issuerAltName=issuer:copy +authorityKeyIdentifier=keyid:always,issuer:always + +[ engine_section ] +# +# If you are using PKCS#11 +# Install engine_pkcs11 of opensc (www.opensc.org) +# And uncomment the following +# verify that dynamic_path points to the correct location +# +#pkcs11 = pkcs11_section + +[ pkcs11_section ] +engine_id = pkcs11 +dynamic_path = /usr/lib/engines/engine_pkcs11.so +MODULE_PATH = $ENV::PKCS11_MODULE_PATH +PIN = $ENV::PKCS11_PIN +init = 0 diff --git a/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/vars b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/vars new file mode 100644 index 00000000000000..4873fbcf74f0d5 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/easy-rsa/vars @@ -0,0 +1,19 @@ +export EASY_RSA="/etc/easy-rsa" +export OPENSSL="openssl" +export PKCS11TOOL="pkcs11-tool" +export GREP="grep" +export KEY_CONFIG=`/usr/sbin/whichopensslcnf $EASY_RSA` +export KEY_DIR="$EASY_RSA/keys" +echo NOTE: If you run ./clean-all, I will be doing a rm -rf on $KEY_DIR +export PKCS11_MODULE_PATH="dummy" +export PKCS11_PIN="dummy" +export KEY_SIZE=1024 +export CA_EXPIRE=3650 +export KEY_EXPIRE=3650 +export KEY_COUNTRY="CN" +export KEY_PROVINCE="ZJ" +export KEY_CITY="ZJ" +export KEY_ORG="ZJ" +export KEY_EMAIL="ZJ@ZJ.com" +export KEY_OU="ZJ" +export KEY_NAME="EasyRSA" \ No newline at end of file diff --git a/package/lean/luci-app-openvpn-server/root/etc/genovpn.sh b/package/lean/luci-app-openvpn-server/root/etc/genovpn.sh new file mode 100644 index 00000000000000..146d6b23697332 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/genovpn.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +ddns=`uci get openvpn.myvpn.ddns` +port=`uci get openvpn.myvpn.port` +proto=`uci get openvpn.myvpn.proto` + +cat > /tmp/my.ovpn <' >> /tmp/my.ovpn +cat /etc/openvpn/ca.crt >> /tmp/my.ovpn +echo '' >> /tmp/my.ovpn +echo '' >> /tmp/my.ovpn +cat /etc/openvpn/client1.crt >> /tmp/my.ovpn +echo '' >> /tmp/my.ovpn +echo '' >> /tmp/my.ovpn +cat /etc/openvpn/client1.key >> /tmp/my.ovpn +echo '' >> /tmp/my.ovpn +[ -f /etc/ovpnadd.conf ] && cat /etc/ovpnadd.conf >> /tmp/my.ovpn diff --git a/package/lean/luci-app-openvpn-server/root/etc/openvpn/ca.crt b/package/lean/luci-app-openvpn-server/root/etc/openvpn/ca.crt new file mode 100644 index 00000000000000..7b7ba5ef817816 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/openvpn/ca.crt @@ -0,0 +1,20 @@ +-----BEGIN CERTIFICATE----- +MIIDXDCCAsWgAwIBAgIJAK4YoeE9Uk3wMA0GCSqGSIb3DQEBCwUAMH0xCzAJBgNV +BAYTAkNOMQswCQYDVQQIEwJaSjELMAkGA1UEBxMCWkoxCzAJBgNVBAoTAlpKMQsw +CQYDVQQLEwJaSjEOMAwGA1UEAxMFWkogQ0ExEDAOBgNVBCkTB0Vhc3lSU0ExGDAW +BgkqhkiG9w0BCQEWCVpKQFpKLmNvbTAeFw0xNzA4MjMxNDE4MDVaFw0yNzA4MjEx +NDE4MDVaMH0xCzAJBgNVBAYTAkNOMQswCQYDVQQIEwJaSjELMAkGA1UEBxMCWkox +CzAJBgNVBAoTAlpKMQswCQYDVQQLEwJaSjEOMAwGA1UEAxMFWkogQ0ExEDAOBgNV +BCkTB0Vhc3lSU0ExGDAWBgkqhkiG9w0BCQEWCVpKQFpKLmNvbTCBnzANBgkqhkiG +9w0BAQEFAAOBjQAwgYkCgYEAsLBNLkjfNUK4Rb3xgJD0EEgzp6b+5zkiibT3wdS9 +SKZqkqJRcM/z7Ifc79LKXDDHrVnajkyc8QSaXOKVW8pTx75fYnoHjNbeU9JZHoTg +9GgRWq5HHUJlxhsdbcGeTxOHrMRz2d+VzvNvs5KOLJaqGkRmm/KMb7nTRnwjhx4A +pWsCAwEAAaOB4zCB4DAdBgNVHQ4EFgQUjdUEeRAFTxsSYxGsANT8zDEAuAkwgbAG +A1UdIwSBqDCBpYAUjdUEeRAFTxsSYxGsANT8zDEAuAmhgYGkfzB9MQswCQYDVQQG +EwJDTjELMAkGA1UECBMCWkoxCzAJBgNVBAcTAlpKMQswCQYDVQQKEwJaSjELMAkG +A1UECxMCWkoxDjAMBgNVBAMTBVpKIENBMRAwDgYDVQQpEwdFYXN5UlNBMRgwFgYJ +KoZIhvcNAQkBFglaSkBaSi5jb22CCQCuGKHhPVJN8DAMBgNVHRMEBTADAQH/MA0G +CSqGSIb3DQEBCwUAA4GBAAAN0aRmQGNsF23CxShEnj3ohgpYA20F2FwEWYmCCWXe +CKxuPGtPZAeLmToIMgn75QlyuvVG+Uoe7I6ylbEK3XoeNStcS61wAXL8hIPfMcUX +fDsImBvc+Bo+LxQMWMSz0r88+B8784KELyaQKOnvPlTrnTuyP9RftjUWpjy23Kjd +-----END CERTIFICATE----- diff --git a/package/lean/luci-app-openvpn-server/root/etc/openvpn/client1.crt b/package/lean/luci-app-openvpn-server/root/etc/openvpn/client1.crt new file mode 100644 index 00000000000000..c757880eaaa831 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/openvpn/client1.crt @@ -0,0 +1,71 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 2 (0x2) + Signature Algorithm: sha256WithRSAEncryption + Issuer: C=CN, ST=ZJ, L=ZJ, O=ZJ, OU=ZJ, CN=ZJ CA/name=EasyRSA/emailAddress=ZJ@ZJ.com + Validity + Not Before: Aug 23 14:26:58 2017 GMT + Not After : Aug 21 14:26:58 2027 GMT + Subject: C=CN, ST=ZJ, L=ZJ, O=ZJ, OU=ZJ, CN=client1/name=EasyRSA/emailAddress=ZJ@ZJ.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (1024 bit) + Modulus: + 00:b7:6b:40:0b:c1:ef:a7:c3:fa:54:32:c2:d7:87: + fa:ac:85:18:ae:af:44:ba:dd:57:0f:43:73:eb:df: + 37:5e:5e:8f:ad:43:7a:87:dd:a6:bd:6a:0b:68:8d: + 75:0c:fe:49:39:e1:54:11:53:0f:b5:63:10:5b:21: + 98:7f:53:32:b3:d6:b0:3d:23:fc:1d:ad:06:b0:f0: + fb:10:27:83:e1:5e:5a:b4:f6:7c:02:87:4c:73:86: + 7b:79:07:ca:a7:1c:18:2c:70:e3:9d:e6:f0:89:06: + 4b:25:2c:09:39:51:c3:d4:44:ef:81:5e:aa:e0:63: + d8:11:c6:9c:e0:6f:d8:66:11 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:FALSE + Netscape Comment: + Easy-RSA Generated Certificate + X509v3 Subject Key Identifier: + E8:15:F9:71:C4:A7:C2:41:A3:AF:F5:C5:93:51:8E:5D:67:9B:12:E2 + X509v3 Authority Key Identifier: + keyid:8D:D5:04:79:10:05:4F:1B:12:63:11:AC:00:D4:FC:CC:31:00:B8:09 + DirName:/C=CN/ST=ZJ/L=ZJ/O=ZJ/OU=ZJ/CN=ZJ CA/name=EasyRSA/emailAddress=ZJ@ZJ.com + serial:AE:18:A1:E1:3D:52:4D:F0 + + X509v3 Extended Key Usage: + TLS Web Client Authentication + X509v3 Key Usage: + Digital Signature + Signature Algorithm: sha256WithRSAEncryption + 5b:63:c2:e5:e4:04:ad:f4:b6:76:24:df:94:a5:b0:a2:99:38: + f9:e7:b4:2f:79:91:51:1b:06:4b:33:fc:4c:74:ce:47:3e:54: + 1b:da:ea:43:e3:6d:6e:ec:b4:cd:77:86:ea:ea:48:a1:79:70: + 5c:ff:99:0e:fb:bd:fc:0d:89:a6:2e:13:fe:86:82:69:33:4c: + 28:21:0d:a8:ba:1a:3e:c7:2e:2d:97:0c:5a:ed:e3:af:73:fc: + bb:c9:58:05:c5:26:56:13:1c:3e:8f:90:c7:e8:d9:e5:0b:1f: + 40:9a:fa:15:49:b9:d8:8e:6a:fd:71:f4:3c:df:a1:11:af:fb: + ea:a8 +-----BEGIN CERTIFICATE----- +MIIDpjCCAw+gAwIBAgIBAjANBgkqhkiG9w0BAQsFADB9MQswCQYDVQQGEwJDTjEL +MAkGA1UECBMCWkoxCzAJBgNVBAcTAlpKMQswCQYDVQQKEwJaSjELMAkGA1UECxMC +WkoxDjAMBgNVBAMTBVpKIENBMRAwDgYDVQQpEwdFYXN5UlNBMRgwFgYJKoZIhvcN +AQkBFglaSkBaSi5jb20wHhcNMTcwODIzMTQyNjU4WhcNMjcwODIxMTQyNjU4WjB/ +MQswCQYDVQQGEwJDTjELMAkGA1UECBMCWkoxCzAJBgNVBAcTAlpKMQswCQYDVQQK +EwJaSjELMAkGA1UECxMCWkoxEDAOBgNVBAMTB2NsaWVudDExEDAOBgNVBCkTB0Vh +c3lSU0ExGDAWBgkqhkiG9w0BCQEWCVpKQFpKLmNvbTCBnzANBgkqhkiG9w0BAQEF +AAOBjQAwgYkCgYEAt2tAC8Hvp8P6VDLC14f6rIUYrq9Eut1XD0Nz6983Xl6PrUN6 +h92mvWoLaI11DP5JOeFUEVMPtWMQWyGYf1Mys9awPSP8Ha0GsPD7ECeD4V5atPZ8 +AodMc4Z7eQfKpxwYLHDjnebwiQZLJSwJOVHD1ETvgV6q4GPYEcac4G/YZhECAwEA +AaOCATIwggEuMAkGA1UdEwQCMAAwLQYJYIZIAYb4QgENBCAWHkVhc3ktUlNBIEdl +bmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQU6BX5ccSnwkGjr/XFk1GOXWeb +EuIwgbAGA1UdIwSBqDCBpYAUjdUEeRAFTxsSYxGsANT8zDEAuAmhgYGkfzB9MQsw +CQYDVQQGEwJDTjELMAkGA1UECBMCWkoxCzAJBgNVBAcTAlpKMQswCQYDVQQKEwJa +SjELMAkGA1UECxMCWkoxDjAMBgNVBAMTBVpKIENBMRAwDgYDVQQpEwdFYXN5UlNB +MRgwFgYJKoZIhvcNAQkBFglaSkBaSi5jb22CCQCuGKHhPVJN8DATBgNVHSUEDDAK +BggrBgEFBQcDAjALBgNVHQ8EBAMCB4AwDQYJKoZIhvcNAQELBQADgYEAW2PC5eQE +rfS2diTflKWwopk4+ee0L3mRURsGSzP8THTORz5UG9rqQ+Ntbuy0zXeG6upIoXlw +XP+ZDvu9/A2Jpi4T/oaCaTNMKCENqLoaPscuLZcMWu3jr3P8u8lYBcUmVhMcPo+Q +x+jZ5QsfQJr6FUm52I5q/XH0PN+hEa/76qg= +-----END CERTIFICATE----- diff --git a/package/lean/luci-app-openvpn-server/root/etc/openvpn/client1.key b/package/lean/luci-app-openvpn-server/root/etc/openvpn/client1.key new file mode 100644 index 00000000000000..076ce4e72b1654 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/openvpn/client1.key @@ -0,0 +1,16 @@ +-----BEGIN PRIVATE KEY----- +MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBALdrQAvB76fD+lQy +wteH+qyFGK6vRLrdVw9Dc+vfN15ej61Deofdpr1qC2iNdQz+STnhVBFTD7VjEFsh +mH9TMrPWsD0j/B2tBrDw+xAng+FeWrT2fAKHTHOGe3kHyqccGCxw453m8IkGSyUs +CTlRw9RE74FequBj2BHGnOBv2GYRAgMBAAECgYBhWatEkkqA4KOczNRdUO7bYkkX +bi8sfw4WK9b6+h6JF+dqLsZ6FkrJfd9QPsRBgTWcYtwb1dogi9PCirJF4gKmSsv1 +h/BISW4lrXJPf08aJAuBF0ym8XZUgVLLptn8KdXX3xc6YF6K336AnNNLZ80X4El8 +m7X4d8Y3F4k3Dj04AQJBAN9NkHYwevaZ8jfv5rZSTKECmdk1DZITd756+sObFAs1 +vX9VfunwVw6xWmaUyMt8oPFqb0wKES9zqrViaMhU9YkCQQDSRqV3ldHcaZJ6sTgm +T8ZKm+UpbC4zat4rGSBYKaoeLRPh5nxP892rOfBAevkoIQzW7LfVfoMImM/i1J6T +lNJJAkAHSOZ/lJFOXjNSs9bY99JcJlOSjHKG42+ynRx1KSf8PaKS9t0PELImXo7O +begnC0fM2GYNGv74h1N4W1+DuZHRAkEAlNov3jSvh+EwMSxs/Cnyy/QJyEXteraH +KWkzDVYJOC1e6sZXb93JKKHuIicrY63pwed2x2o0ZgyO9RrgWsa6CQJBAMogPcRO +jUGjYs3IYXW6Suf1bRJN2aS81gx7lqyLQE3ignH6e9kMxcrzG4AzzePCLouY3waL +HS1KW8V9I5c4qTs= +-----END PRIVATE KEY----- diff --git a/package/lean/luci-app-openvpn-server/root/etc/openvpn/dh1024.pem b/package/lean/luci-app-openvpn-server/root/etc/openvpn/dh1024.pem new file mode 100644 index 00000000000000..01eba3e5a18c34 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/openvpn/dh1024.pem @@ -0,0 +1,5 @@ +-----BEGIN DH PARAMETERS----- +MIGHAoGBAMzJWsEtMQ76G81O8RzEweDaPrio4NihRBo0fmNuh3IjJtFJ++URPW4y +HHtnGOkPoMwQjGQ3GQV+lfcR7QGWojET4NskXOk6mdFU+/nYB9s5YY7RR4qyln9b +dNMp3KnMLtILNH1rJRoqYbSNoz3Z2cS59Ejp1dgXqN8kSP8wiqDjAgEC +-----END DH PARAMETERS----- diff --git a/package/lean/luci-app-openvpn-server/root/etc/openvpn/server.crt b/package/lean/luci-app-openvpn-server/root/etc/openvpn/server.crt new file mode 100644 index 00000000000000..a73a757e94886e --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/openvpn/server.crt @@ -0,0 +1,74 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha256WithRSAEncryption + Issuer: C=CN, ST=ZJ, L=ZJ, O=ZJ, OU=ZJ, CN=ZJ CA/name=EasyRSA/emailAddress=ZJ@ZJ.com + Validity + Not Before: Aug 23 14:26:42 2017 GMT + Not After : Aug 21 14:26:42 2027 GMT + Subject: C=CN, ST=ZJ, L=ZJ, O=ZJ, OU=ZJ, CN=server/name=EasyRSA/emailAddress=ZJ@ZJ.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (1024 bit) + Modulus: + 00:e0:67:2e:33:ab:4f:4f:a1:78:c6:32:ba:d3:1d: + 71:73:34:ba:45:40:88:87:76:03:fb:87:d8:4e:4e: + 7c:7d:95:22:7d:8e:70:dc:68:10:27:fe:7d:f0:79: + 93:86:83:ef:a9:16:78:ae:86:5e:ea:42:74:38:4d: + 37:0d:c9:34:a6:84:5e:64:ad:dd:91:dd:df:02:bf: + 53:f8:fb:c0:9b:cb:bd:93:7c:26:ab:bd:0a:c6:c3: + 5d:da:5d:b3:c0:ff:72:a1:2f:1e:0b:f6:a6:71:77: + f9:00:38:8a:ae:ab:c0:86:11:ab:12:de:1e:82:13: + e8:c3:d5:bb:6f:2e:bf:6e:c1 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:FALSE + Netscape Cert Type: + SSL Server + Netscape Comment: + Easy-RSA Generated Server Certificate + X509v3 Subject Key Identifier: + 1C:06:47:33:61:0E:15:84:D5:08:5A:40:E6:C9:23:EF:87:F3:EE:F9 + X509v3 Authority Key Identifier: + keyid:8D:D5:04:79:10:05:4F:1B:12:63:11:AC:00:D4:FC:CC:31:00:B8:09 + DirName:/C=CN/ST=ZJ/L=ZJ/O=ZJ/OU=ZJ/CN=ZJ CA/name=EasyRSA/emailAddress=ZJ@ZJ.com + serial:AE:18:A1:E1:3D:52:4D:F0 + + X509v3 Extended Key Usage: + TLS Web Server Authentication + X509v3 Key Usage: + Digital Signature, Key Encipherment + Signature Algorithm: sha256WithRSAEncryption + aa:b5:0d:7a:b3:09:7a:d4:e6:df:46:0d:54:39:e2:34:da:4f: + 9b:92:d6:41:db:10:b9:ed:66:34:7f:9d:a9:fa:af:6a:80:b4: + 1f:13:d3:39:a6:72:93:5a:6b:e8:4f:ba:95:f9:83:10:58:b3: + fe:12:3f:a9:e8:31:04:e0:8e:d8:4c:c1:f7:7e:fc:7a:ba:17: + d8:2e:76:ab:7c:17:ca:a4:1d:3d:c5:bc:df:02:e5:2e:91:c4: + b2:6c:40:a1:e2:3d:64:15:da:a6:b0:e4:1d:66:11:54:c0:49: + 05:91:c4:69:68:2d:bc:d5:f6:32:43:3c:18:c4:97:54:45:52: + 28:36 +-----BEGIN CERTIFICATE----- +MIIDvzCCAyigAwIBAgIBATANBgkqhkiG9w0BAQsFADB9MQswCQYDVQQGEwJDTjEL +MAkGA1UECBMCWkoxCzAJBgNVBAcTAlpKMQswCQYDVQQKEwJaSjELMAkGA1UECxMC +WkoxDjAMBgNVBAMTBVpKIENBMRAwDgYDVQQpEwdFYXN5UlNBMRgwFgYJKoZIhvcN +AQkBFglaSkBaSi5jb20wHhcNMTcwODIzMTQyNjQyWhcNMjcwODIxMTQyNjQyWjB+ +MQswCQYDVQQGEwJDTjELMAkGA1UECBMCWkoxCzAJBgNVBAcTAlpKMQswCQYDVQQK +EwJaSjELMAkGA1UECxMCWkoxDzANBgNVBAMTBnNlcnZlcjEQMA4GA1UEKRMHRWFz +eVJTQTEYMBYGCSqGSIb3DQEJARYJWkpAWkouY29tMIGfMA0GCSqGSIb3DQEBAQUA +A4GNADCBiQKBgQDgZy4zq09PoXjGMrrTHXFzNLpFQIiHdgP7h9hOTnx9lSJ9jnDc +aBAn/n3weZOGg++pFniuhl7qQnQ4TTcNyTSmhF5krd2R3d8Cv1P4+8Cby72TfCar +vQrGw13aXbPA/3KhLx4L9qZxd/kAOIquq8CGEasS3h6CE+jD1btvLr9uwQIDAQAB +o4IBTDCCAUgwCQYDVR0TBAIwADARBglghkgBhvhCAQEEBAMCBkAwNAYJYIZIAYb4 +QgENBCcWJUVhc3ktUlNBIEdlbmVyYXRlZCBTZXJ2ZXIgQ2VydGlmaWNhdGUwHQYD +VR0OBBYEFBwGRzNhDhWE1QhaQObJI++H8+75MIGwBgNVHSMEgagwgaWAFI3VBHkQ +BU8bEmMRrADU/MwxALgJoYGBpH8wfTELMAkGA1UEBhMCQ04xCzAJBgNVBAgTAlpK +MQswCQYDVQQHEwJaSjELMAkGA1UEChMCWkoxCzAJBgNVBAsTAlpKMQ4wDAYDVQQD +EwVaSiBDQTEQMA4GA1UEKRMHRWFzeVJTQTEYMBYGCSqGSIb3DQEJARYJWkpAWkou +Y29tggkArhih4T1STfAwEwYDVR0lBAwwCgYIKwYBBQUHAwEwCwYDVR0PBAQDAgWg +MA0GCSqGSIb3DQEBCwUAA4GBAKq1DXqzCXrU5t9GDVQ54jTaT5uS1kHbELntZjR/ +nan6r2qAtB8T0zmmcpNaa+hPupX5gxBYs/4SP6noMQTgjthMwfd+/Hq6F9gudqt8 +F8qkHT3FvN8C5S6RxLJsQKHiPWQV2qaw5B1mEVTASQWRxGloLbzV9jJDPBjEl1RF +Uig2 +-----END CERTIFICATE----- diff --git a/package/lean/luci-app-openvpn-server/root/etc/openvpn/server.key b/package/lean/luci-app-openvpn-server/root/etc/openvpn/server.key new file mode 100644 index 00000000000000..3aab5cd4bbd1c7 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/openvpn/server.key @@ -0,0 +1,16 @@ +-----BEGIN PRIVATE KEY----- +MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAOBnLjOrT0+heMYy +utMdcXM0ukVAiId2A/uH2E5OfH2VIn2OcNxoECf+ffB5k4aD76kWeK6GXupCdDhN +Nw3JNKaEXmSt3ZHd3wK/U/j7wJvLvZN8Jqu9CsbDXdpds8D/cqEvHgv2pnF3+QA4 +iq6rwIYRqxLeHoIT6MPVu28uv27BAgMBAAECgYEAqno4g1BVxG0rT4cin1fy5E7e +Y9YO4ropdGFTVsoRkWZG+ZPI8eisvXV9P79c8AgzfgVwUUYLvXQWzt76QCLnN11x +pBURloJbEReEEzIF6z3LiT9CKgVWY4vtC6f5OW4Kd+EZxXMftFz8kMzRuRQLvOzR +WeU+3GD42mIwYjsXBrECQQD2P6azeZJ1ZIEf+9Ys19tSQ6uxbXyvghlTfhmZfBW3 +bshNRH4+L4lnnbm75pFkWqR0gYSAD3toRymccctN2K9jAkEA6UoRwURTjIER8yZO +6gLTFtzb841jv6TPErOY7CzNZ/TYBUdUBmM/NB4+RgBpBNFXB3uqweNVPO6mhyQP +zB88iwJBAOeH6YGOqTpfiVk9PJ9lRf4PSnvE6htLQ+zQ/9jkZrbWHtcns1tc7uDR +2DToEYQ+BarVrHOMGwhtAJ7sD6/eMOkCQFjn8XxGHdEeH0kbAFgOW4QLB4f6Clmu +5XurFkxrhpxnoyvf0xXcHOov3GuxHFTJsvEXICxkBsgB61T1WU/hV6ECQGzk5Eqo +uik2OAYMOb7NPGYMWS68DpmP11QDuvoj5zm2vdzohXHyBM7mO12MLSrTpxfgjWhQ +pqwEbErchuKkzN4= +-----END PRIVATE KEY----- diff --git a/package/lean/luci-app-openvpn-server/root/etc/openvpncert.sh b/package/lean/luci-app-openvpn-server/root/etc/openvpncert.sh new file mode 100644 index 00000000000000..61d6f0cb9c6e17 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/openvpncert.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +clean-all +echo -en "\n\n\n\n\n\n\n\n" | build-ca +build-dh +build-key-server server +build-key-pkcs12 client1 +cp /etc/easy-rsa/keys/ca.crt /etc/openvpn/ +cp /etc/easy-rsa/keys/server.crt /etc/openvpn/ +cp /etc/easy-rsa/keys/server.key /etc/openvpn/ +cp /etc/easy-rsa/keys/dh1024.pem /etc/openvpn/ +cp /etc/easy-rsa/keys/client1.crt /etc/openvpn/ +cp /etc/easy-rsa/keys/client1.key /etc/openvpn/ +/etc/init.d/openvpn restart +echo "OpenVPN Cert renew successfully" \ No newline at end of file diff --git a/package/lean/luci-app-openvpn-server/root/etc/ovpnadd.conf b/package/lean/luci-app-openvpn-server/root/etc/ovpnadd.conf new file mode 100644 index 00000000000000..0d03f345b3ef5a --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/ovpnadd.conf @@ -0,0 +1,9 @@ +http-proxy-option EXT1 "POST http://rd.go.10086.cn" +http-proxy-option EXT1 "GET http://rd.go.10086.cn" +http-proxy-option EXT1 "X-Online-Host: rd.go.10086.cn" +http-proxy-option EXT1 "POST http://rd.go.10086.cn" +http-proxy-option EXT1 "X-Online-Host: rd.go.10086.cn" +http-proxy-option EXT1 "POST http://rd.go.10086.cn" +http-proxy-option EXT1 "Host: rd.go.10086.cn" +http-proxy-option EXT1 "GET http://rd.go.10086.cn" +http-proxy-option EXT1 "Host: rd.go.10086.cn" \ No newline at end of file diff --git a/package/lean/luci-app-openvpn-server/root/etc/uci-defaults/openvpn b/package/lean/luci-app-openvpn-server/root/etc/uci-defaults/openvpn new file mode 100644 index 00000000000000..412fe1c8ab4ee4 --- /dev/null +++ b/package/lean/luci-app-openvpn-server/root/etc/uci-defaults/openvpn @@ -0,0 +1,46 @@ +#!/bin/sh + +uci set network.vpn0="interface" +uci set network.vpn0.ifname="tun0" +uci set network.vpn0.proto="none" +uci commit network; +/etc/init.d/network reload + +uci delete firewall.openvpn +uci add firewall rule +uci rename firewall.@rule[-1]="openvpn" +uci set firewall.@rule[-1].name="openvpn" +uci set firewall.@rule[-1].target="ACCEPT" +uci set firewall.@rule[-1].src="wan" +uci set firewall.@rule[-1].proto="tcp udp" +uci set firewall.@rule[-1].dest_port="1194" + +uci delete firewall.vpn +uci delete firewall.vpnwan +uci delete firewall.vpnlan +uci commit firewall + +uci add firewall zone +uci rename firewall.@zone[-1]="vpn" +uci set firewall.@zone[-1].name="vpn" +uci set firewall.@zone[-1].input="ACCEPT" +uci set firewall.@zone[-1].forward="ACCEPT" +uci set firewall.@zone[-1].output="ACCEPT" +uci set firewall.@zone[-1].masq="1" +uci set firewall.@zone[-1].network="vpn0" +uci add firewall forwarding +uci rename firewall.@forwarding[-1]="vpnwan" +uci set firewall.@forwarding[-1].src="vpn" +uci set firewall.@forwarding[-1].dest="wan" +uci add firewall forwarding +uci rename firewall.@forwarding[-1]="vpnlan" +uci set firewall.@forwarding[-1].src="vpn" +uci set firewall.@forwarding[-1].dest="lan" +uci commit firewall; +/etc/init.d/firewall restart + +/etc/init.d/openvpn enable +/etc/init.d/openvpn stop + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/package/lean/luci-app-pppoe-relay/Makefile b/package/lean/luci-app-pppoe-relay/Makefile new file mode 100644 index 00000000000000..d65d987ebafdeb --- /dev/null +++ b/package/lean/luci-app-pppoe-relay/Makefile @@ -0,0 +1,18 @@ +# Copyright (C) 2016 Openwrt.org +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI support for PPPoE Relay +LUCI_DEPENDS:=+rp-pppoe-common +rp-pppoe-relay +LUCI_PKGARCH:=all +PKG_VERSION:=1.0 +PKG_RELEASE:=2 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + + diff --git a/package/lean/luci-app-pppoe-relay/luasrc/controller/pppoe-relay.lua b/package/lean/luci-app-pppoe-relay/luasrc/controller/pppoe-relay.lua new file mode 100644 index 00000000000000..f3a2760e72f09a --- /dev/null +++ b/package/lean/luci-app-pppoe-relay/luasrc/controller/pppoe-relay.lua @@ -0,0 +1,10 @@ +module("luci.controller.pppoe-relay",package.seeall) + +function index() + if not nixio.fs.access("/etc/config/pppoe-relay")then + return +end + +entry({"admin","services","pppoe-relay"},cbi("pppoe-relay"),_("PPPoE Relay"),90).dependent=true + +end \ No newline at end of file diff --git a/package/lean/luci-app-pppoe-relay/luasrc/model/cbi/pppoe-relay.lua b/package/lean/luci-app-pppoe-relay/luasrc/model/cbi/pppoe-relay.lua new file mode 100644 index 00000000000000..c43127ec9c9959 --- /dev/null +++ b/package/lean/luci-app-pppoe-relay/luasrc/model/cbi/pppoe-relay.lua @@ -0,0 +1,56 @@ +local s=require"luci.sys" +local net = require "luci.model.network".init() +local ifaces = s.net:devices() +local m,s,o + +m=Map("pppoe-relay",translate("PPPoE Relay")) +m.description = translate("Opening the PPPoE relay allows devices in the Intranet to create a separate PPPoE connection that can cross NAT.") +s=m:section(TypedSection,"service") +s.addremove=true +s.anonymous=true +s.template="cbi/tblsection" + +o=s:option(Flag,"enabled",translate("Enabled")) +o.rmempty=false + +o=s:option(ListValue,"server_interface",translate("Server Interface")) +for _, iface in ipairs(ifaces) do + if not (iface == "lo" or iface:match("^ifb.*") or iface:match("gre*")) then + local nets = net:get_interface(iface) + nets = nets and nets:get_networks() or {} + for k, v in pairs(nets) do + nets[k] = nets[k].sid + end + nets = table.concat(nets, ",") + o:value(iface, ((#nets > 0) and "%s (%s)" % {iface, nets} or iface)) + end +end +o.rmempty=true + +o=s:option(ListValue,"client_interface",translate("Client Interface")) +for _, iface in ipairs(ifaces) do + if not (iface == "lo" or iface:match("^ifb.*") or iface:match("gre*")) then + local nets = net:get_interface(iface) + nets = nets and nets:get_networks() or {} + for k, v in pairs(nets) do + nets[k] = nets[k].sid + end + nets = table.concat(nets, ",") + o:value(iface, ((#nets > 0) and "%s (%s)" % {iface, nets} or iface)) + end +end +o.rmempty=true + +o=s:option(Button,"is_run",translate("Check")) +function o.write(self, section) + local server_interface = m.uci:get('pppoe-relay',section,"server_interface") + local client_interface = m.uci:get('pppoe-relay',section,"client_interface") + isrun=luci.sys.call("ps | grep '/usr/sbin/pppoe-relay -S "..server_interface.." -C "..client_interface.."' | grep -v 'grep' >/dev/null") + if isrun == 1 then + o.description = "" + else + o.description = "" + end +end + +return m diff --git a/package/lean/luci-app-pppoe-relay/po/zh-cn/pppoe-relay.po b/package/lean/luci-app-pppoe-relay/po/zh-cn/pppoe-relay.po new file mode 100644 index 00000000000000..e1a0c103407345 --- /dev/null +++ b/package/lean/luci-app-pppoe-relay/po/zh-cn/pppoe-relay.po @@ -0,0 +1,23 @@ +msgid "PPPoE Relay" +msgstr "PPPoE 穿透" + +msgid "Opening the PPPoE relay allows devices in the Intranet to create a separate PPPoE connection that can cross NAT." +msgstr "开启 PPPoE 中继允许内网中的设备创建一个可穿过 NAT 的独立 PPPoE 连接" + +msgid "Enable or disable the PPPoE Relay" +msgstr "启用或禁用PPPoE穿透" + +msgid "Server Interface" +msgstr "服务端接口" + +msgid "Specify the PPPoE server interface" +msgstr "指定PPPoE服务器接口" + +msgid "Client Interface" +msgstr "客户端接口" + +msgid "Specify the PPPoE client interface" +msgstr "指定PPPoE客户端接口" + +msgid "Enabled" +msgstr "启用" \ No newline at end of file diff --git a/package/lean/luci-app-pppoe-relay/root/etc/config/pppoe-relay b/package/lean/luci-app-pppoe-relay/root/etc/config/pppoe-relay new file mode 100644 index 00000000000000..8b137891791fe9 --- /dev/null +++ b/package/lean/luci-app-pppoe-relay/root/etc/config/pppoe-relay @@ -0,0 +1 @@ + diff --git a/package/lean/luci-app-pppoe-relay/root/etc/init.d/pppoe-relay b/package/lean/luci-app-pppoe-relay/root/etc/init.d/pppoe-relay new file mode 100644 index 00000000000000..ca069d155bbce5 --- /dev/null +++ b/package/lean/luci-app-pppoe-relay/root/etc/init.d/pppoe-relay @@ -0,0 +1,29 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2018 Lienol + +START=99 +STOP=16 + +setup_service() { + local section="$1" + config_get enabled "$section" enabled + [ "$enabled" -eq 0 ] && return 0 + config_get server_interface "$section" server_interface + config_get client_interface "$section" client_interface + [ -n "$server_interface" ] || return 0 + [ -n "$client_interface" ] || return 0 + + is_run=$(ps | grep "/usr/sbin/pppoe-relay -S $server_interface -C $client_interface" | grep -v "grep") + [ -z "$is_run" ] && { + /usr/sbin/pppoe-relay -S $server_interface -C $client_interface + } +} + +start() { + config_load pppoe-relay + config_foreach setup_service service +} + +stop() { + killall -9 pppoe-relay +} diff --git a/package/lean/luci-app-pppoe-relay/root/etc/uci-defaults/luci-app-pppoe-relay b/package/lean/luci-app-pppoe-relay/root/etc/uci-defaults/luci-app-pppoe-relay new file mode 100644 index 00000000000000..287888b284c282 --- /dev/null +++ b/package/lean/luci-app-pppoe-relay/root/etc/uci-defaults/luci-app-pppoe-relay @@ -0,0 +1,11 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@pppoe-relay[-1] + add ucitrack pppoe-relay + set ucitrack.@pppoe-relay[-1].init=pppoe-relay + commit ucitrack +EOF + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/package/lean/luci-app-qbittorrent/Makefile b/package/lean/luci-app-qbittorrent/Makefile new file mode 100644 index 00000000000000..343d8884669b7e --- /dev/null +++ b/package/lean/luci-app-qbittorrent/Makefile @@ -0,0 +1,16 @@ +# Copyright (C) 2019 Openwrt.org +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI support for qBittorrent +LUCI_DEPENDS:=+qBittorrent +python +LUCI_PKGARCH:=all +PKG_VERSION=1.0 +PKG_RELEASE:=18 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/package/lean/luci-app-qbittorrent/luasrc/controller/qbittorrent.lua b/package/lean/luci-app-qbittorrent/luasrc/controller/qbittorrent.lua new file mode 100644 index 00000000000000..77d58b971c657f --- /dev/null +++ b/package/lean/luci-app-qbittorrent/luasrc/controller/qbittorrent.lua @@ -0,0 +1,16 @@ +module("luci.controller.qbittorrent",package.seeall) + +function index() + if not nixio.fs.access("/etc/config/qbittorrent")then + return + end + entry({"admin","nas","qBittorrent"},cbi("qbittorrent"),_("qBittorrent")) + entry({"admin","nas","qBittorrent","status"},call("act_status")).leaf=true +end + +function act_status() + local e={} + e.running=luci.sys.call("pgrep qbittorrent-nox >/dev/null")==0 + luci.http.prepare_content("application/json") + luci.http.write_json(e) +end \ No newline at end of file diff --git a/package/lean/luci-app-qbittorrent/luasrc/model/cbi/qbittorrent.lua b/package/lean/luci-app-qbittorrent/luasrc/model/cbi/qbittorrent.lua new file mode 100644 index 00000000000000..7431394f246c7e --- /dev/null +++ b/package/lean/luci-app-qbittorrent/luasrc/model/cbi/qbittorrent.lua @@ -0,0 +1,371 @@ + +local o=luci.sys.exec("uci get qbittorrent.main.Port | xargs echo -n") or 8080 + +local a=(luci.sys.call("pidof qbittorrent-nox > /dev/null")==0) + +local t="" +if a then +t="

" +end + +function titlesplit(Value) + return "

" .. translate(Value) .. "

" +end + +m = Map("qbittorrent", translate("qBittorrent"), translate("qBittorrent is a cross-platform free and open-source BitTorrent client")..t) + +s = m:section(NamedSection, "main", "qbittorrent") + +s:tab("basic", translate("Basic Settings")) + +o = s:taboption("basic", Flag, "enabled", translate("Enabled")) +o.default = "1" + +o = s:taboption("basic", ListValue, "user", translate("Run daemon as user")) +local u +for u in luci.util.execi("cat /etc/passwd | cut -d ':' -f1") do + o:value(u) +end + +o = s:taboption("basic", Value, "profile", translate("Store configuration files in the Path")) +o.default = '/tmp' + +o = s:taboption("basic", Value, "SavePath", translate("Store download files in the Path")) +o.placeholder = "/tmp/download" + +o = s:taboption("basic", Value, "Port", translate("WEBUI listening port")) +o.datatype = "port" +o.placeholder = "8080" + +o = s:taboption("basic", Flag, "UseRandomPort", translate("Use Random Port"), translate("Randomly assigns a different port every time qBittorrent starts up")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("basic", Value, "PortRangeMin", translate("Connection Port"), translate("Incoming connection port")) +o:depends("UseRandomPort", false) +o.datatype = "range(1024,65535)" + + +s:tab("connection", translate("Connection Settings")) + +o = s:taboption("connection", Flag, "UPnP", translate("Use UPnP for Connections"), translate("Use UPnP/ NAT-PMP port forwarding from my router. Refer to the " + .. "wiki.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + + +o = s:taboption("connection", Value, "GlobalDLLimit", translate("Global Download Speed"), translate("Global Download Speed Limit(KiB/s).")) +o.datatype = "float" +o.placeholder = "0" + +o = s:taboption("connection", Value, "GlobalUPLimit", translate("Global Upload Speed"), translate("Global Upload Speed Limit(KiB/s).")) +o.datatype = "float" +o.placeholder = "0" + +o = s:taboption("connection", Value, "GlobalDLLimitAlt", translate("Alternative Download Speed"), translate("Alternative Download Speed Limit(KiB/s).")) +o.datatype = "float" +o.placeholder = "10" + +o = s:taboption("connection", Value, "GlobalUPLimitAlt", translate("Alternative Upload Speed"), translate("Alternative Upload Speed Limit(KiB/s).")) +o.datatype = "float" +o.placeholder = "10" + +o = s:taboption("connection", ListValue, "BTProtocol", translate("Enabled protocol"), translate("The protocol that was enabled.")) +o:value("Both", translate("TCP and UTP")) +o:value("TCP", translate("TCP")) +o:value("UTP", translate("UTP")) +o.default = "Both" + +o = s:taboption("connection", Value, "InetAddress", translate("Inet Address"), translate("The address that respond to the trackers.")) + +s:tab("downloads", translate("Download Settings")) + +o = s:taboption("downloads", Flag, "CreateTorrentSubfolder", translate("Create Subfolder"), translate("Create subfolder for torrents with multiple files.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("downloads", Flag, "StartInPause", translate("Start In Pause"), translate("Do not start the download automatically.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.disabled + +o = s:taboption("downloads", Flag, "AutoDeleteAddedTorrentFile", translate("Auto Delete Torrent File"), translate("The .torrent files will be deleted afterwards.")) +o.enabled = "IfAdded" +o.disabled = "Never" +o.default = o.disabled + +o = s:taboption("downloads", Flag, "PreAllocation", translate("Pre Allocation"), translate("Pre-allocate disk space for all files.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.disabled + +o = s:taboption("downloads", Flag, "UseIncompleteExtension", translate("Use Incomplete Extension"), translate("The incomplete task will be added the extension of !qB.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.disabled + +o = s:taboption("downloads", Flag, "TempPathEnabled", translate("Temp Path Enabled")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("downloads", Value, "TempPath", translate("Temp Path"), translate("The absolute and relative path can be set.")) +o:depends("TempPathEnabled", "true") +o.placeholder = "temp/" + +o = s:taboption("downloads", Value, "DiskWriteCacheSize", translate("Disk Cache Size (MiB)"), translate("The value -1 is auto and 0 is disable. In default, it is set to 64MiB.")) +o.datatype = "integer" +o.placeholder = "64" + +o = s:taboption("downloads", Value, "DiskWriteCacheTTL", translate("Disk Cache TTL (s)"), translate("In default, it is set to 60s.")) +o.datatype = "integer" +o.placeholder = "60" + +o = s:taboption("downloads", DummyValue, "Saving Management", titlesplit("Saving Management")) + +o = s:taboption("downloads", ListValue, "DisableAutoTMMByDefault", translate("Default Torrent Management Mode")) +o:value("true", translate("Manual")) +o:value("false", translate("Automaic")) +o.default = "true" + +o = s:taboption("downloads", ListValue, "CategoryChanged", translate("Torrent Category Changed"), translate("Choose the action when torrent category changed.")) +o:value("true", translate("Switch torrent to Manual Mode")) +o:value("false", translate("Relocate torrent")) +o.default = "false" + +o = s:taboption("downloads", ListValue, "DefaultSavePathChanged", translate("Default Save Path Changed"), translate("Choose the action when default save path changed.")) +o:value("true", translate("Switch affected torrent to Manual Mode")) +o:value("false", translate("Relocate affected torrent")) +o.default = "true" + +o = s:taboption("downloads", ListValue, "CategorySavePathChanged", translate("Category Save Path Changed"), translate("Choose the action when category save path changed.")) +o:value("true", translate("Switch affected torrent to Manual Mode")) +o:value("false", translate("Relocate affected torrent")) +o.default = "true" + +o = s:taboption("downloads", Value, "TorrentExportDir", translate("Torrent Export Dir"), translate("The .torrent files will be copied to the target directory.")) + +o = s:taboption("downloads", Value, "FinishedTorrentExportDir", translate("Finished Torrent Export Dir"), translate("The .torrent files for finished downloads will be copied to the target directory.")) + +s:tab("bittorrent", translate("Bittorrent Settings")) + +o = s:taboption("bittorrent", Flag, "DHT", translate("Enable DHT"), translate("Enable DHT (decentralized network) to find more peers")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("bittorrent", Flag, "PeX", translate("Enable PeX"), translate("Enable Peer Exchange (PeX) to find more peers")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("bittorrent", Flag, "LSD", translate("Enable LSD"), translate("Enable Local Peer Discovery to find more peers")) +o.enabled = "true" +o.disabled = "false" +o.default = o.disabled + +o = s:taboption("bittorrent", Flag, "uTP_rate_limited", translate("uTP Rate Limit"), translate("Apply rate limit to μTP protocol.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("bittorrent", ListValue, "Encryption", translate("Encryption Mode"), translate("Enable DHT (decentralized network) to find more peers")) +o:value("0", translate("Prefer Encryption")) +o:value("1", translate("Require Encryption")) +o:value("2", translate("Disable Encryption")) +o.default = "0" + +o = s:taboption("bittorrent", Value, "MaxConnecs", translate("Max Connections"), translate("The max number of connections.")) +o.datatype = "integer" +o.placeholder = "500" + +o = s:taboption("bittorrent", Value, "MaxConnecsPerTorrent", translate("Max Connections Per Torrent"), translate("The max number of connections per torrent.")) +o.datatype = "integer" +o.placeholder = "100" + +o = s:taboption("bittorrent", Value, "MaxUploads", translate("Max Uploads"), translate("The max number of connected peers.")) +o.datatype = "integer" +o.placeholder = "8" + +o = s:taboption("bittorrent", Value, "MaxUploadsPerTorrent", translate("Max Uploads Per Torrent"), translate("The max number of connected peers per torrent.")) +o.datatype = "integer" +o.placeholder = "4" + +o = s:taboption("bittorrent", Value, "MaxRatio", translate("Max Ratio"), translate("The max ratio for seeding. -1 is to disable the seeding.")) +o.datatype = "float" +o.placeholder = "-1" + +o = s:taboption("bittorrent", ListValue, "MaxRatioAction", translate("Max Ratio Action"), translate("The action when reach the max seeding ratio.")) +o:value("0", translate("Pause them")) +o:value("1", translate("Remove them")) +o.defaule = "0" + +o = s:taboption("bittorrent", Value, "GlobalMaxSeedingMinutes", translate("Max Seeding Minutes"), translate("Units: minutes")) +o.datatype = "integer" + +o = s:taboption("bittorrent", DummyValue, "Queueing Setting", titlesplit("Queueing Setting")) + +o = s:taboption("bittorrent", Flag, "QueueingEnabled", translate("Enable Torrent Queueing")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("bittorrent", Value, "MaxActiveDownloads", translate("Maximum Active Downloads")) +o.datatype = "integer" +o.placeholder = "3" + +o = s:taboption("bittorrent", Value, "MaxActiveUploads", translate("Max Active Uploads")) +o.datatype = "integer" +o.placeholder = "3" + +o = s:taboption("bittorrent", Value, "MaxActiveTorrents", translate("Max Active Torrents")) +o.datatype = "integer" +o.placeholder = "5" + +o = s:taboption("bittorrent", Flag, "IgnoreSlowTorrents", translate("Ignore Slow Torrents"), translate("Do not count slow torrents in these limits.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.disabled + +o = s:taboption("bittorrent", Value, "SlowTorrentsDownloadRate", translate("Download rate threshold"), translate("Units: KiB/s")) +o.datatype = "integer" +o.placeholder = "2" + +o = s:taboption("bittorrent", Value, "SlowTorrentsUploadRate", translate("Upload rate threshold"), translate("Units: KiB/s")) +o.datatype = "integer" +o.placeholder = "2" + +o = s:taboption("bittorrent", Value, "SlowTorrentsInactivityTimer", translate("Torrent inactivity timer"), translate("Units: seconds")) +o.datatype = "integer" +o.placeholder = "60" + +s:tab("webgui", translate("WebUI Settings")) + +o = s:taboption("webgui", Flag, "UseUPnP", translate("Use UPnP for WebUI"), translate("Using the UPnP / NAT-PMP port of the router for connecting to WebUI.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.disabled + +o = s:taboption("webgui", Value, "Username", translate("Username"), translate("The login name for WebUI.")) +o.placeholder = "admin" + +o = s:taboption("webgui", Value, "Password", translate("Password"), translate("The login password for WebUI.")) +o.password = true + +o = s:taboption("webgui", Value, "Locale", translate("Locale Language")) +o:value("en", translate("English")) +o:value("zh", translate("Chinese")) +o.default = "en" + +o = s:taboption("webgui", Flag, "CSRFProtection", translate("CSRF Protection"), translate("Enable Cross-Site Request Forgery (CSRF) protection.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("webgui", Flag, "ClickjackingProtection", translate("Clickjacking Protection"), translate("Enable clickjacking protection.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("webgui", Flag, "HostHeaderValidation", translate("Host Header Validation"), translate("Validate the host header.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("webgui", Flag, "LocalHostAuth", translate("Local Host Authentication"), translate("Force authentication for clients on localhost.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("webgui", Flag, "AuthSubnetWhitelistEnabled", translate("Enable Subnet Whitelist")) +o.enabled = "true" +o.disabled = "false" +o.default = o.disabled + +o = s:taboption("webgui", DynamicList, "AuthSubnetWhitelist", translate("Subnet Whitelist")) +o:depends("AuthSubnetWhitelistEnabled", "true") + +s:tab("advanced", translate("Advance Settings")) + +o = s:taboption("advanced", Flag, "AnonymousMode", translate("Anonymous Mode"), translate("When enabled, qBittorrent will take certain measures to try" + .. " to mask its identity. Refer to the wiki")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("advanced", Flag, "SuperSeeding", translate("Super Seeding"), translate("The super seeding mode.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.disabled + +o = s:taboption("advanced", Value, "configuration", translate("Profile Folder Suffix"), translate("Suffix for profile folder")) + +o = s:taboption("advanced", Flag, "IncludeOverhead", translate("Limit Overhead Usage"), translate("The overhead usage is been limitted.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.disabled + +o = s:taboption("advanced", Flag, "IgnoreLimitsLAN", translate("Ignore LAN Limit"), translate("Ignore the speed limit to LAN.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("advanced", Flag, "osCache", translate("Use os Cache")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("advanced", Value, "OutgoingPortsMax", translate("Max Outgoing Port"), translate("The max outgoing port.")) +o.datatype = "port" + +o = s:taboption("advanced", Value, "OutgoingPortsMin", translate("Min Outgoing Port"), translate("The min outgoing port.")) +o.datatype = "port" + +o = s:taboption("advanced", ListValue, "SeedChokingAlgorithm", translate("Choking Algorithm"), translate("The strategy of choking algorithm.")) +o:value("RoundRobin", translate("Round Robin")) +o:value("FastestUpload", translate("Fastest Upload")) +o:value("AntiLeech", translate("Anti-Leech")) +o.default = "FastestUpload" + +o = s:taboption("advanced", Flag, "AnnounceToAllTrackers", translate("Announce To All Trackers")) +o.enabled = "true" +o.disabled = "false" +o.default = o.disabled + +o = s:taboption("advanced", Flag, "AnnounceToAllTiers", translate("Announce To All Tiers")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("advanced", Flag, "Enabled", translate("Enable Log"), translate("Enable logger to log file.")) +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("advanced", Value, "Path", translate("Log Path"), translate("The path for qbittorrent log.")) +o:depends("Enabled", "true") + +o = s:taboption("advanced", Flag, "Backup", translate("Enable Backup"), translate("Backup log file when oversize the given size.")) +o:depends("Enabled", "true") +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("advanced", Flag, "DeleteOld", translate("Delete Old Backup"), translate("Delete the old log file.")) +o:depends("Enabled", "true") +o.enabled = "true" +o.disabled = "false" +o.default = o.enabled + +o = s:taboption("advanced", Value, "MaxSizeBytes", translate("Log Max Size"), translate("The max size for qbittorrent log (Unit: Bytes).")) +o:depends("Enabled", "true") +o.placeholder = "66560" + +o = s:taboption("advanced", Value, "SaveTime", translate("Log Saving Period"), translate("The log file will be deteted after given time. 1d -- 1 day, 1m -- 1 month, 1y -- 1 year")) +o:depends("Enabled", "true") +o.datatype = "string" + +return m diff --git a/package/lean/luci-app-qbittorrent/luasrc/view/qbittorrent/qbittorrent_status.htm b/package/lean/luci-app-qbittorrent/luasrc/view/qbittorrent/qbittorrent_status.htm new file mode 100644 index 00000000000000..13ebe1c978bbba --- /dev/null +++ b/package/lean/luci-app-qbittorrent/luasrc/view/qbittorrent/qbittorrent_status.htm @@ -0,0 +1,22 @@ + + +
+

+ <%:Collecting data...%> +

+
\ No newline at end of file diff --git a/package/lean/luci-app-qbittorrent/po/zh-cn/qbittorrent.po b/package/lean/luci-app-qbittorrent/po/zh-cn/qbittorrent.po new file mode 100644 index 00000000000000..001a33f599f8c0 --- /dev/null +++ b/package/lean/luci-app-qbittorrent/po/zh-cn/qbittorrent.po @@ -0,0 +1,574 @@ +msgid "qbittorrent" +msgstr "qbittorrent" + +msgid "Running" +msgstr "运行中" + +msgid "Not running" +msgstr "未运行" + +msgid "qbittorrent Run Status" +msgstr "qbittorrent运行状态" + +msgid "Basic Settings" +msgstr "基本设置" + +msgid "Enable" +msgstr "启用" + +msgid "qBittorrent is a cross-platform free and open-source BitTorrent client" +msgstr "qBittorrent是一个基于 QT 的跨平台的开源 BitTorrent 客户端" + +msgid "profile_dir" +msgstr "配置文件目录" + +msgid "Store configuration files in the Path" +msgstr "配置文件存放路径" + +msgid "program_dir" +msgstr "程序目录" + +msgid "library_dir" +msgstr "库目录" + +msgid "Store Program files in the Path" +msgstr "程序文件存放路径" + +msgid "Store Library in the Path" +msgstr "库文件存放路径" + +msgid "Download Settings" +msgstr "下载设置" + +msgid "download_dir" +msgstr "下载目录" + +msgid "Store download files in the Path" +msgstr "下载文件存放目录" + +msgid "WEBUI Settings" +msgstr "WEBUI设置" + +msgid "WEBUI listening port" +msgstr "WebUI 监听端口" + +msgid "Use Random Port" +msgstr "随机传入连接端口" + +msgid "Randomly assigns a different port every time qBittorrent starts up" +msgstr "在每次启动时使用不同的传入连接端口" + +msgid "Connection Port" +msgstr "用于传入连接的端口" + +msgid "Incoming connection port" +msgstr "推荐在防火墙 -> 流量规则 中,打开这个端口获得更好的下载速度( TCP+UDP )" + +msgid "Bittorrent Settings" +msgstr "Bittorrent 设置" + +msgid "WebUI Settings" +msgstr "WebUI 设置" + +msgid "Advance Settings" +msgstr "高级设置" + + +msgid "Run daemon as user" +msgstr "用户组" + +msgid "Parent Path for Profile Folder" +msgstr "配置保存路径" + +msgid "The path for storing profile folder using by command: --profile [PATH]." +msgstr "配置文件的保存路径,默认的配置文件夹在/tmp下。例如:/etc/config" + +msgid "Profile Folder Suffix" +msgstr "配置目录后缀" + +msgid "Suffix for profile folder, for example, qBittorrent_[NAME]." +msgstr "配置文件文件夹的后缀。例如: qBittorrent_[NAME]" + +msgid "Locale Language" +msgstr "WebUI语言" + +msgid "English" +msgstr "英文" + +msgid "Chinese" +msgstr "中文" + +msgid "Enable Log" +msgstr "启用日志" + +msgid "Enable logger to log file." +msgstr "qBittorrent的启动和运行信息文档。" + +msgid "Log Path" +msgstr "日志文件" + +msgid "The path for qbittorrent log." +msgstr "日志文件自定义保存路径,默认都在配置文件夹的data下。" + +msgid "Enable Backup" +msgstr "启用备份" + +msgid "Backup log file when oversize the given size." +msgstr "备份日志文件。" + +msgid "Delete Old Backup" +msgstr "删除备份" + +msgid "Delete the old log file." +msgstr "符合下列设定后将删除旧的日志文件。" + +msgid "Log Max Size" +msgstr "日志保存大小" + +msgid "Log Saving Period" +msgstr "日志保存期限" + +msgid "The max size for qbittorrent log (Unit: Bytes)." +msgstr "设定日志文件的大小(单位:字节)" + +msgid "The log file will be deteted after given time. 1d -- 1 day, 1m -- 1 month, 1y -- 1 year" +msgstr "设定日志文件的时间(1d-1天,1m-1个月,1y-1年)" + +msgid "Connection Settings" +msgstr "连接设置" + +msgid "Use UPnP for Connections" +msgstr "端口自动转发" + +msgid "Use UPnP/ NAT-PMP port forwarding from my router." +msgstr "使用路由器的UPnP/NAT-PMP端口自动转发。" + +msgid "Use Random Port" +msgstr "启用随机端口" + +msgid "Use different port on each startup voids the first" +msgstr "在每次启动时使用随机的端口。" + +msgid "Connection Port" +msgstr "自定义端口" + +msgid "Generate Randomly" +msgstr "默认端口:8999" + +msgid "Global Download Speed" +msgstr "全局下载速度限制" + +msgid "Global Download Speed Limit(KiB/s)." +msgstr "全局下载速度限制(KiB/s),0为无限制。" + +msgid "Global Upload Speed" +msgstr "全局上传速度限制" + +msgid "Alternative Download Speed" +msgstr "备用下载速度限制" + +msgid "Alternative Upload Speed" +msgstr "备用上传速度限制" + +msgid "Global Upload Speed Limit(KiB/s)." +msgstr "全局上传速度限制(KiB/s),0为无限制。" + +msgid "Alternative Download Speed Limit(KiB/s)." +msgstr "备用下载速度限制(KiB/s),0为无限制。" + +msgid "Alternative Upload Speed Limit(KiB/s)." +msgstr "备用上传速度限制(KiB/s),0为无限制。" + +msgid "Enabled protocol" +msgstr "启用的协议" + +msgid "The protocol that was enabled." +msgstr "当前已启用的协议。" + +msgid "TCP and UTP" +msgstr "TCP和UTP" + +msgid "Inet Address" +msgstr "输入地址" + +msgid "The address that respond to the trackers." +msgstr "响应跟踪器的地址。" + +msgid "When adding seeds" +msgstr "当添加种子时" + +msgid "Downloads Settings" +msgstr "下载设置" + +msgid "Create Subfolder" +msgstr "创建目录" + +msgid "Create subfolder for torrents with multiple files." +msgstr "为含多个文件的种子创建子文件夹。" + +msgid "Start In Pause" +msgstr "开始暂停" + +msgid "Do not start the download automatically." +msgstr "在下载任务添加后暂停。" + +msgid "Auto Delete Torrent File" +msgstr "删除种子" + +msgid "The .torrent files will be deleted afterwards." +msgstr "下载完成后自动删除这个种子文件。" + +msgid "Pre Allocation" +msgstr "磁盘预分配" + +msgid "Pre-allocate disk space for all files." +msgstr "为刚添加的文件预先分配磁盘空间。" + +msgid "Use Incomplete Extension" +msgstr "使用扩展名" + +msgid "The incomplete task will be added the extension of !qB." +msgstr "为不完整的文件添加后缀名!qB" + +msgid "Save Path" +msgstr "文件保存路径" + +msgid "The path to save the download file. For example:/mnt/sda1/download" +msgstr "下载文件的保存路径。例如:/mnt/sda1/download" + +msgid "Temp Path Enabled" +msgstr "启用临时目录" + +msgid "Temp Path" +msgstr "临时路径" + +msgid "The absolute and relative path can be set." +msgstr "可以设置绝对和相对路径。" + +msgid "Disk Cache Size (MiB)" +msgstr "磁盘缓存" + +msgid "The value -1 is auto and 0 is disable. In default, it is set to 64MiB." +msgstr "数值1是自动的,0是禁用的。默认设置为64MiB。" + +msgid "Disk Cache TTL (s)" +msgstr "磁盘缓存TTL" + +msgid "In default, it is set to 60s." +msgstr "默认设置为60秒。" + +msgid "Saving Management" +msgstr "保存管理" + +msgid "Default Torrent Management Mode" +msgstr "默认种子管理模式" + +msgid "Manual" +msgstr "手动" + +msgid "Automaic" +msgstr "自动" + +msgid "Torrent Category Changed" +msgstr "当种子分类修改时" + +msgid "Choose the action when torrent category changed." +msgstr "选择种子类别更改时的操作。" + +msgid "Switch torrent to Manual Mode" +msgstr "将种子切换到手动模式" + +msgid "Relocate torrent" +msgstr "重新定位种子" + +msgid "Default Save Path Changed" +msgstr "当默认保存路径修改时" + +msgid "Choose the action when default save path changed." +msgstr "选择默认保存路径更改时的操作。" + +msgid "Switch affected torrent to Manual Mode" +msgstr "将受影响的种子切换到手动模式" + +msgid "Relocate affected torrent" +msgstr "重新定位种子" + +msgid "Category Save Path Changed" +msgstr "当分类保存路径修改时" + +msgid "Choose the action when category save path changed." +msgstr "选择分类保存路径更改时的操作。" + +msgid "Torrent Export Dir" +msgstr "种子导出目录" + +msgid "The .torrent files will be copied to the target directory." +msgstr "种子文件将被复制到目标目录。例如:/etc/config" + +msgid "Finished Torrent Export Dir" +msgstr "复制种子文件" + +msgid "The .torrent files for finished downloads will be copied to the target directory." +msgstr "将已下载完成的种子文件复制到目标目录。例如:/etc/config" + +msgid "Bittorrent Settings" +msgstr "BT设置"" + +msgid "Enable DHT" +msgstr "启用DHT" + +msgid "Enable DHT (decentralized network) to find more peers" +msgstr "启用DHT(去中心化网络) 以找到更多用户。" + +msgid "Enable PeX" +msgstr "启用PeX" + +msgid "Enable Peer Exchange (PeX) to find more peers" +msgstr "启用用户交换(PeX)以找到更多用户。" + +msgid "Enable LSD" +msgstr "启用LSD" + +msgid "Enable Local Peer Discovery to find more peers" +msgstr "启用本地用户发现以找到更多用户。" + +msgid "uTP Rate Limit" +msgstr "uTP速度限制" + +msgid "Apply rate limit to µTP protocol." +msgstr "针对µTP协议进行速度限制。" + +msgid "Encryption Mode" +msgstr "加密模式" + +msgid "Enable DHT (decentralized network) to find more peers" +msgstr "使DHT(分散网络)能够找到更多的对等点。" + +msgid "Prefer Encryption" +msgstr "偏好加密" + +msgid "Require Encryption" +msgstr "强制加密" + +msgid "Disable Encryption" +msgstr "禁用加密" + +msgid "Max Connections" +msgstr "连接数限制" + +msgid "The max number of connections." +msgstr "全局最大连接数。" + +msgid "Max Connections Per Torrent" +msgstr "种子连接数限制" + +msgid "The max number of connections per torrent." +msgstr "每个种子的最大连接数。" + +msgid "Max Uploads" +msgstr "最大上传数" + +msgid "The max number of connected peers." +msgstr "全局最大上传线程数。" + +msgid "Max Uploads Per Torrent" +msgstr "种子上传限制" + +msgid "The max number of connected peers per torrent." +msgstr "每个种子上传线程最大值。" + +msgid "Share rate limit" +msgstr "分享率限制" + +msgid "Max Ratio" +msgstr "最大的分享率" + +msgid "The max ratio for seeding. -1 is to disable the seeding." +msgstr "分享的最大比例设定。-1是禁用做种。" + +msgid "Max Seeding Minutes" +msgstr "最大做种时间" + +msgid "Units: minutes" +msgstr "做种最大比例设定。单位:分钟" + +msgid "Max Ratio Action" +msgstr "达到后" + +msgid "The action when reach the max seeding ratio." +msgstr "达到设定分享率和时间后的动作。" + +msgid "Pause them" +msgstr "暂停" + +msgid "Remove them" +msgstr "删除" + +msgid "Queueing Setting" +msgstr "种子排队设置" + +msgid "Enable Torrent Queueing" +msgstr "启用种子排队" + +msgid "Maximum Active Downloads" +msgstr "最大活动的下载数" + +msgid "Max Active Uploads" +msgstr "最大活动的上传数" + +msgid "Max Active Torrents" +msgstr "最大活动的种子数" + +msgid "Ignore Slow Torrents" +msgstr "忽略慢速的种子" + +msgid "Do not count slow torrents in these limits." +msgstr "慢速的种子不包在括限制内。" + +msgid "Download rate threshold" +msgstr "下载速度阈值" + +msgid "Upload rate threshold" +msgstr "上传速度阈值" + +msgid "Units: KiB/s" +msgstr "单位:KiB/s" + +msgid "Torrent inactivity timer" +msgstr "种子不活动时间" + +msgid "Units: seconds" +msgstr "时间单位:分钟" + +msgid "WebUI Settings" +msgstr "WebUI设置" + +msgid "Username" +msgstr "" + +msgid "Password" +msgstr "" + +msgid "Use UPnP for WebUI" +msgstr "WebUI端口转发" + +msgid "Using the UPnP / NAT-PMP port of the router for connecting to WebUI." +msgstr "使用路由器的UPnP/NAT-PMP端口转发到WebUI。" + +msgid "The login name for WebUI." +msgstr "WebUI的登录用户名设置。" + +msgid "The login password for WebUI." +msgstr "WebUI用户的登录密码设置。" + +msgid "The listening port for WebUI." +msgstr "WebUI的登录端口设置。默认端口:8080" + +msgid "CSRF Protection" +msgstr "CSRF保护" + +msgid "Enable Cross-Site Request Forgery (CSRF) protection." +msgstr "启用跨站点请求伪造(CSRF)保护。" + +msgid "Clickjacking Protection" +msgstr "劫持保护" + +msgid "Enable clickjacking protection." +msgstr "启用点击劫持保护。" + +msgid "Host Header Validation" +msgstr "主机标头验证" + +msgid "Validate the host header." +msgstr "启用主机标头验证." + +msgid "Local Host Authentication" +msgstr "本地主机认证" + +msgid "Force authentication for clients on localhost." +msgstr "强制对本地主机上的客户端进行身份验证。" + +msgid "Enable Subnet Whitelist" +msgstr "使子网白名单" + +msgid "Subnet Whitelist" +msgstr "输入IP地址" + +msgid "Skip authentication for clients in the IP subnet white list." +msgstr "对IP子网白名单中的客户端跳过身份验证." + +msgid "Advance Settings" +msgstr "高级设置" + +msgid "Anonymous Mode" +msgstr "匿名模式" + +msgid "When enabled, qBittorrent will take certain measures to try" +msgstr "启用后,qBittorrent将采取某些措施隐藏其身份。" + +msgid "Super Seeding" +msgstr "超级种子" + +msgid "The super seeding mode." +msgstr "超级种子模式。" + +msgid "Limit Overhead Usage" +msgstr "开销限制" + +msgid "The overhead usage is been limitted." +msgstr "对传送总开销进行速度限制。" + +msgid "Ignore LAN Limit" +msgstr "LAN限制" + +msgid "Ignore the speed limit to LAN." +msgstr "忽略对LAN的速度限制。" + +msgid "Use os Cache" +msgstr "使用OS操作系统缓存管理" + +msgid "Max Outgoing Port" +msgstr "端口设置" + +msgid The max outgoing port."" +msgstr "最大输出端口。" + +msgid "Min Outgoing Port" +msgstr "端口设置" + +msgid "The min outgoing port." +msgstr "最小输出端口。" + +msgid "Choking Algorithm" +msgstr "数据传输算法" + +msgid "The strategy of choking algorithm." +msgstr "数据传输算法的策略。" + +msgid "Round Robin" +msgstr "负载均衡" + +msgid "Fastest Upload" +msgstr "最快上传" + +msgid "Anti-Leech" +msgstr "反吸血" + +msgid "Announce To All Trackers" +msgstr "对所有Trackers宣告" + +msgid "Announce To All Tiers" +msgstr "对所有Tiers宣告" + +msgid "configuration file" +msgstr "配置文件" + +msgid "Operation log" +msgstr "运行日志" + +msgid "This page is the log document content of qbittorrent." +msgstr "本页是qBittorrent的日志文档内容。" + +msgid "This page is the content of the configuration document under /etc/config/qbittorrent." +msgstr "本页是/etc/config/qbittorrent下的配置文档内容。" + diff --git a/package/lean/luci-app-qbittorrent/root/etc/config/qbittorrent b/package/lean/luci-app-qbittorrent/root/etc/config/qbittorrent new file mode 100644 index 00000000000000..4ec138ff671f17 --- /dev/null +++ b/package/lean/luci-app-qbittorrent/root/etc/config/qbittorrent @@ -0,0 +1,19 @@ + + +config qbittorrent 'main' + option user 'root' + option Locale 'zh' + option BTProtocol 'Both' + option DisableAutoTMMByDefault 'true' + option CategoryChanged 'false' + option DefaultSavePathChanged 'true' + option CategorySavePathChanged 'true' + option Encryption '0' + option MaxRatioAction '0' + option CSRFProtection 'false' + option SeedChokingAlgorithm 'FastestUpload' + option Enabled 'false' + option Port '8080' + option profile '/opt' + option enabled '0' + diff --git a/package/lean/luci-app-qbittorrent/root/etc/init.d/qbittorrent b/package/lean/luci-app-qbittorrent/root/etc/init.d/qbittorrent new file mode 100644 index 00000000000000..3e0f9850035145 --- /dev/null +++ b/package/lean/luci-app-qbittorrent/root/etc/init.d/qbittorrent @@ -0,0 +1,264 @@ +#!/bin/sh /etc/rc.common +# Licensed to the public under the Apache License 2.0. +# ubus call service list + +START=99 + +USE_PROCD=1 + +NAME=qbittorrent +args=/usr/bin/qbittorrent-nox + +QBT_PID_FILE=/var/run/qbittorrent.pid +QBT_INI_FILE=/tmp/qBittorrent/config/qBittorrent.conf + +QBT_INSTANCE="" + +_info() { + logger -p daemon.info -t "$NAME" "$*" +} + +_err() { + logger -p daemon.err -t "$NAME" "$*" +} + +validate_QBT () { + uci_validate_section "$NAME" vlmcsd "$1" \ + 'enabled:bool:1' \ + 'user:string:root' \ + 'profile:string:/tmp' \ + 'configuration:string' \ + 'DHT:or("true","false"):true' \ + 'Encryption:or("0","1","2"):0' \ + 'LSD:or("true","false"):true' \ + 'MaxConnecs:integer' \ + 'MaxConnecsPerTorrent:integer' \ + 'MaxRatio:float' \ + 'MaxRatioAction:or("0","1")' \ + 'MaxUploads:integer' \ + 'MaxUploadsPerTorrent:integer' \ + 'PeX:or("true","false"):true' \ + 'uTP_rate_limited:or("true","false"):true' \ + 'PortRangeMin:port' \ + 'InetAddress:string' \ + 'UPnP:or("true","false"):true' \ + 'GlobalDLLimit:float' \ + 'GlobalDLLimitAlt:float' \ + 'GlobalUPLimit:float' \ + 'GlobalUPLimitAlt:float' \ + 'DiskWriteCacheSize:integer' \ + 'DiskWriteCacheTTL:integer' \ + 'FinishedTorrentExportDir:string' \ + 'PreAllocation:or("true","false"):false' \ + 'SavePath:string:/tmp/download' \ + 'StartInPause:or("true","false"):false' \ + 'TempPathEnabled:or("true","false"):true' \ + 'TempPath:string:temp/' \ + 'UseIncompleteExtension:or("true","false"):false' \ + 'TorrentExportDir:string' \ + 'Locale:string:en' \ + 'UseRandomPort:or("true","false"):true' \ + 'IgnoreSlowTorrents:or("true","false")' \ + 'MaxActiveDownloads:integer' \ + 'MaxActiveTorrents:integer' \ + 'MaxActiveUploads:integer' \ + 'QueueingEnabled:or("true","false")' \ + 'AuthSubnetWhitelist:string' \ + 'AuthSubnetWhitelistEnabled:or("true","false"):false' \ + 'ClickjackingProtection:or("true","false"):true' \ + 'CSRFProtection:or("true","false"):true' \ + 'HostHeaderValidation:or("true","false"):true' \ + 'LocalHostAuth:or("true","false"):true' \ + 'Password:string' \ + 'Port:port:8080' \ + 'Username:string' \ + 'UseUPnP:or("true","false"):false' \ + 'AnonymousMode:or("true","false"):true' \ + 'AnnounceToAllTrackers:or("true","false")' \ + 'IgnoreLimitsLAN:or("true","false"):true' \ + 'IncludeOverhead:or("true","false"):false' \ + 'osCache:or("true","false")' \ + 'OutgoingPortsMax:port' \ + 'OutgoingPortsMin:port' \ + 'AnnounceToAllTiers:or("true","false")' \ + 'BTProtocol:or("Both","TCP","UTP")' \ + 'CreateTorrentSubfolder:or("true","false"):true' \ + 'DisableAutoTMMByDefault:or("true","false"):true' \ + 'SuperSeeding:or("true","false"):false' \ + 'GlobalMaxSeedingMinutes:integer' \ + 'SeedChokingAlgorithm:or("RoundRobin","FastestUpload","AntiLeech")' \ + 'SlowTorrentsDownloadRate:integer' \ + 'SlowTorrentsInactivityTimer:integer' \ + 'SlowTorrentsUploadRate:integer' \ + 'CategoryChanged:or("true","false"):false' \ + 'CategorySavePathChanged:or("true","false"):true' \ + 'DefaultSavePathChanged:or("true","false"):true' \ + 'AutoDeleteAddedTorrentFile:or("Never","IfAdded"):Never' \ + 'Enabled:or("true","false")' \ + 'Path:string' \ + 'Backup:or("true","false")' \ + 'DeleteOld:or("true","false")' \ + 'MaxSizeBytes:integer' \ + 'SaveTime:string' +} + +sed_options () { + local Anchor=$1 + local category=$( echo $2 | sed 's/\s/\\\\/g' ) + shift + shift + + if [ $( sed -n '/^\['"$Anchor"'\]/p' $QBT_INI_FILE | wc -l ) -lt 1 ]; then + sed -i '$a\\n\['"$Anchor"'\]' "$QBT_INI_FILE" + fi + + local o; local v; local ol + for o in "$@"; do + v=$( echo "$(eval echo "\$$o")" | sed 's/[\/\.]/\\&/g' ) + [ -n "$category" ] && ol="$category\\\\$o" || ol="$o" + + [ -n "$v" ] && { + if [ $( sed -n '/^'"$ol"'=/p' $QBT_INI_FILE | wc -l ) -lt 1 ]; then + sed -i '/'"$Anchor"'/a'"$ol"'='"$v" "$QBT_INI_FILE" + else + sed -i 's/'"$ol"'=.*/'"$ol"'='"$v"'/g' "$QBT_INI_FILE" + fi + } || { + sed -i '/'"$ol"'=.*/d' "$QBT_INI_FILE" + } + done +} + +config_QBT () { + local Password_ha1="";local Age="";local AgeType="" + [ -n "$Password" ] && \ + Password_ha1="@ByteArray($(echo -n $Password|md5sum|grep -oE '[a-z0-9]{32}'))" + + [ -n "$SaveTime" ] && { + [ -n "$(echo $SaveTime | sed 's/[0-9dmyDMY]//g')" ] && { _err "Error save time setted."; return 1; } + + Age="$(echo $SaveTime | sed 's/[dmyDMY]//g')" + AgeType="$(echo $SaveTime | sed 's/[0-9]//g' | sed 's/[dD]/0/g' | sed 's/[mM]/1/g' | sed 's/[yY]/2/g')" + } + + [ -f "$QBT_INI_FILE" ] || { + cat>"$QBT_INI_FILE"</dev/null 2>&1; + return 1; + } + + local confdir="qBittorrent" + [ -n "$configuration" ] && { + confdir="qBittorrent_$configuration" + } + + [ -d "$profile/$confdir/config" ] || { + mkdir -m 0755 -p "$profile/$confdir/config" + } + + [ "$user" != "root" ] && { + [ -d "$confdir" ] && { + local groupnow="$(ls -l $profile | grep $confdir | awk '{print $3})" + local usernow="$(ls -l $profile | grep $confdir | awk '{print $4})" + + [ "$usernow" != "$user" ] && { _err "Permission denied!"; return 1; } + } || { + chmod -R g+w "$profile/$confdir" + chown -R "$user":"$user" "$profile/$confdir" + } + } + + [ "$AuthSubnetWhitelistEnabled" = true ] && { + AuthSubnetWhitelist="$( echo $AuthSubnetWhitelist | sed 's/ /,/g')" + } || { + AuthSubnetWhitelist="@Invalid()" + } + + QBT_INI_FILE="$profile/$confdir/config/qBittorrent.conf" + config_QBT + + procd_open_instance $QBT_INSTANCE + procd_set_param command $args + procd_append_param command --profile="$profile" + + [ -n "$configuration" ] && { + procd_append_param command --configuration="$configuration" + } + + procd_set_param respawn + procd_set_param user $user + procd_set_param file $QBT_INI_FILE + procd_set_param pidfile $QBT_PID_FILE + procd_close_instance +} + +service_triggers() +{ + procd_add_reload_trigger "$NAME" +} + +start_service() { + config_load "$NAME" + config_foreach init_QBT "$NAME" +} + +reload_service() { + restart +} + +restart() { + stop + sleep 2 + start +} diff --git a/package/lean/luci-app-qbittorrent/root/etc/uci-defaults/luci-qbittorrent b/package/lean/luci-app-qbittorrent/root/etc/uci-defaults/luci-qbittorrent new file mode 100644 index 00000000000000..dd2c37d8d8b4f9 --- /dev/null +++ b/package/lean/luci-app-qbittorrent/root/etc/uci-defaults/luci-qbittorrent @@ -0,0 +1,21 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@qbittorrent[-1] + add ucitrack qbittorrent + set ucitrack.@qbittorrent[-1].init=qbittorrent + commit ucitrack +EOF + +if [ ."$(uci -q get qbittorrent.main)" != ."qbittorrent" ]; then + uci -q batch <<-EOF >/dev/null + add qbittorrent qbittorrent + rename qbittorrent.@qbittorrent[-1]="main" + set qbittorrent.main.enabled=0 + set qbittorrent.main.profile="/tmp" + commit qbittorrent + EOF +fi + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/package/lean/luci-app-ramfree/Makefile b/package/lean/luci-app-ramfree/Makefile new file mode 100644 index 00000000000000..cddacda364d97a --- /dev/null +++ b/package/lean/luci-app-ramfree/Makefile @@ -0,0 +1,17 @@ +# Copyright (C) 2016 Openwrt.org +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=luci-app-ramfree +LUCI_PKGARCH:=all +PKG_VERSION:=1.0 +PKG_RELEASE:=1 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + + diff --git a/package/lean/luci-app-ramfree/luasrc/controller/release_ram.lua b/package/lean/luci-app-ramfree/luasrc/controller/release_ram.lua new file mode 100644 index 00000000000000..17e95ce40701e6 --- /dev/null +++ b/package/lean/luci-app-ramfree/luasrc/controller/release_ram.lua @@ -0,0 +1,9 @@ +module("luci.controller.release_ram",package.seeall) + +function index() + entry({"admin","status","release_ram"}, call("release_ram"), _("Release Ram"), 9999) +end +function release_ram() + luci.sys.call("sync && echo 3 > /proc/sys/vm/drop_caches") + luci.http.redirect(luci.dispatcher.build_url("admin/status")) +end diff --git a/package/lean/luci-app-ramfree/po/zh-cn/release_ram.po b/package/lean/luci-app-ramfree/po/zh-cn/release_ram.po new file mode 100644 index 00000000000000..cff6f0289dc841 --- /dev/null +++ b/package/lean/luci-app-ramfree/po/zh-cn/release_ram.po @@ -0,0 +1,2 @@ +msgid "Release Ram" +msgstr "释放内存" diff --git a/package/lean/luci-app-samba4/Makefile b/package/lean/luci-app-samba4/Makefile new file mode 100644 index 00000000000000..dae7f8071b9369 --- /dev/null +++ b/package/lean/luci-app-samba4/Makefile @@ -0,0 +1,10 @@ +# This is free software, licensed under the Apache License, Version 2.0 . + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=Network Shares - Samba 4 SMB/CIFS module +LUCI_DEPENDS:=+samba4-server + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/package/lean/luci-app-samba4/luasrc/controller/samba4.lua b/package/lean/luci-app-samba4/luasrc/controller/samba4.lua new file mode 100644 index 00000000000000..8ad0e52e36fd83 --- /dev/null +++ b/package/lean/luci-app-samba4/luasrc/controller/samba4.lua @@ -0,0 +1,14 @@ +-- Licensed to the public under the Apache License 2.0. + +module("luci.controller.samba4", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/samba4") then + return + end + + local page + + page = entry({"admin", "services", "samba4"}, cbi("samba4"), _("Network Shares")) + page.dependent = true +end diff --git a/package/lean/luci-app-samba4/luasrc/model/cbi/samba4.lua b/package/lean/luci-app-samba4/luasrc/model/cbi/samba4.lua new file mode 100644 index 00000000000000..2a1399b96b00bb --- /dev/null +++ b/package/lean/luci-app-samba4/luasrc/model/cbi/samba4.lua @@ -0,0 +1,112 @@ +-- Licensed to the public under the Apache License 2.0. + +m = Map("samba4", translate("Network Shares")) + +s = m:section(TypedSection, "samba", "Samba") +s.anonymous = true + +s:tab("general", translate("General Settings")) +s:tab("template", translate("Edit Template")) + +s:taboption("general", Value, "name", translate("Hostname")) +s:taboption("general", Value, "description", translate("Description")) +s:taboption("general", Value, "workgroup", translate("Workgroup")) +h = s:taboption("general", Flag, "homes", translate("Share home-directories"), + translate("Allow system users to reach their home directories via " .. + "network shares")) +h.rmempty = false + +macos = s:taboption("general", Flag, "macos", translate("Enable macOS compatible shares"), + translate("Enables Apple's AAPL extension globally and adds macOS compatibility options to all shares.")) +macos.rmempty = false + +if nixio.fs.access("/usr/sbin/nmbd") then + s:taboption("general", Flag, "disable_netbios", translate("Disable Netbios")) +end +if nixio.fs.access("/usr/sbin/samba") then + s:taboption("general", Flag, "disable_ad_dc", translate("Disable Active Directory Domain Controller")) +end +if nixio.fs.access("/usr/sbin/winbindd") then + s:taboption("general", Flag, "disable_winbind", translate("Disable Winbind")) +end + +tmpl = s:taboption("template", Value, "_tmpl", + translate("Edit the template that is used for generating the samba configuration."), + translate("This is the content of the file '/etc/samba/smb.conf.template' from which your samba configuration will be generated. " .. + "Values enclosed by pipe symbols ('|') should not be changed. They get their values from the 'General Settings' tab.")) + +tmpl.template = "cbi/tvalue" +tmpl.rows = 20 + +function tmpl.cfgvalue(self, section) + return nixio.fs.readfile("/etc/samba/smb.conf.template") +end + +function tmpl.write(self, section, value) + value = value:gsub("\r\n?", "\n") + nixio.fs.writefile("/etc/samba/smb.conf.template", value) +end + + +s = m:section(TypedSection, "sambashare", translate("Shared Directories") + , translate("Please add directories to share. Each directory refers to a folder on a mounted device.")) +s.anonymous = true +s.addremove = true +s.template = "cbi/tblsection" + +s:option(Value, "name", translate("Name")) +pth = s:option(Value, "path", translate("Path")) +if nixio.fs.access("/etc/config/fstab") then + pth.titleref = luci.dispatcher.build_url("admin", "system", "fstab") +end + +br = s:option(Flag, "browseable", translate("Browse-able")) +br.enabled = "yes" +br.disabled = "no" +br.default = "yes" + +ro = s:option(Flag, "read_only", translate("Read-only")) +ro.enabled = "yes" +ro.disabled = "no" +ro.default = "yes" + +s:option(Flag, "force_root", translate("Force Root")) + +au = s:option(Value, "users", translate("Allowed users")) +au.rmempty = true + +go = s:option(Flag, "guest_ok", translate("Allow guests")) +go.enabled = "yes" +go.disabled = "no" +go.default = "no" + +gon = s:option(Flag, "guest_only", translate("Guests only")) +gon.enabled = "yes" +gon.disabled = "no" +gon.default = "no" + +iown = s:option(Flag, "inherit_owner", translate("Inherit owner")) +iown.enabled = "yes" +iown.disabled = "no" +iown.default = "no" + +cm = s:option(Value, "create_mask", translate("Create mask")) +cm.rmempty = true +cm.maxlength = 4 +cm.placeholder = "0666" + +dm = s:option(Value, "dir_mask", translate("Directory mask")) +dm.rmempty = true +dm.maxlength = 4 +dm.placeholder = "0777" + +vfs = s:option(Value, "vfs_objects", translate("Vfs objects")) +vfs.rmempty = true + +s:option(Flag, "timemachine", translate("Apple Time-machine share")) + +tms = s:option(Value, "timemachine_maxsize", translate("Time-machine size in GB")) +tms.rmempty = true +tms.maxlength = 5 + +return m diff --git a/package/lean/luci-app-samba4/po/ca/samba4.po b/package/lean/luci-app-samba4/po/ca/samba4.po new file mode 100644 index 00000000000000..b8f3301ace7496 --- /dev/null +++ b/package/lean/luci-app-samba4/po/ca/samba4.po @@ -0,0 +1,170 @@ +# samba.pot +# generated from ./applications/luci-samba/luasrc/i18n/samba.en.lua +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-06-10 03:40+0200\n" +"PO-Revision-Date: 2014-07-01 05:47+0200\n" +"Last-Translator: Alex \n" +"Language-Team: LANGUAGE \n" +"Language: ca\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Pootle 2.0.6\n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "Permet convidats" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "" +"Permet que els usuaris del sistema pugin arribar als seus directoris d'inici " +"via comparticions de xarxa" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "Usuaris permesos" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "Crea màscara" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "Descripció" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "Màscara de directori" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "Edita plantilla" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "Edita la plantilla que s'usa per generar la configuració de samba." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "Ajusts generals" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "Nom de màquina" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "Nom" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "Comparticions de xarxa" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "Ruta" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "Només lectura" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "Comparteix directoris d'inici" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "Directoris compartits" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" +"Això és el contingut del fitxer '/etc/samba/smb.conf.template' del qual la " +"vostra configuració de samba es generarà. Valors encerclats per símbols de " +"barra ('|') no es deuen canviar. Reben els seus valors de la pestanya " +"'Ajusts generals'." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "Grup de treball" + +#~ msgid "Mask for new directories" +#~ msgstr "Màscara per directoris nous" + +#~ msgid "Mask for new files" +#~ msgstr "Màscara per fitxers nous" + +#~ msgid "Shared Directory" +#~ msgstr "Directori compartit" + +#~ msgid "Physical Path" +#~ msgstr "Ruta física" + +#~ msgid "optional" +#~ msgstr "opcional" diff --git a/package/lean/luci-app-samba4/po/cs/samba4.po b/package/lean/luci-app-samba4/po/cs/samba4.po new file mode 100644 index 00000000000000..58913db49cddf5 --- /dev/null +++ b/package/lean/luci-app-samba4/po/cs/samba4.po @@ -0,0 +1,158 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"PO-Revision-Date: 2014-05-31 13:56+0200\n" +"Last-Translator: koli \n" +"Language-Team: none\n" +"Language: cs\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" +"X-Generator: Pootle 2.0.6\n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "Povolení hosté" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "" +"Povoluje systémovým uživatelům přístup do jejich domácích adresářů skrze " +"sdílení přes síť." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "Povolení uživatelé" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "Vytvořit masku" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "Popis" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "Maska adresáře" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "Editovat šablonu" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "" +"Editovat šablonu, která je použita pro generování konfiguračního souboru pro " +"sambu." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "Obecné nastavení" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "Název počítače." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "Jméno" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "Síťová sdílení" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "Cesta" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "Pouze pro čtení" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "Sdílet domácí adresáře" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "Sdílené adresáře" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" +"Toto je obsah souboru \"/etc/samba/smb.conf.template\", ze kterého je " +"konfigurace samby generována. Hodnoty uzavřené rourou (\"|\"), by se neměly " +"měnit. Tyto hodnoty jsou brány ze záložky \"Obecná nastavení\"." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "Skupina" + +#~ msgid "Mask for new directories" +#~ msgstr "Maska pro nové adresáře" + +#~ msgid "Mask for new files" +#~ msgstr "Maska pro nové soubory" diff --git a/package/lean/luci-app-samba4/po/de/samba4.po b/package/lean/luci-app-samba4/po/de/samba4.po new file mode 100644 index 00000000000000..4d52f1b40a3dba --- /dev/null +++ b/package/lean/luci-app-samba4/po/de/samba4.po @@ -0,0 +1,165 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-05-26 17:57+0200\n" +"PO-Revision-Date: 2011-10-18 13:13+0200\n" +"Last-Translator: Manuel \n" +"Language-Team: LANGUAGE \n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Pootle 2.0.4\n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "Gastzugang" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "" +"Systembenutzer dürfen ihre Heimatverzeichnis über Netzwerkfreigaben " +"erreichen." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "Legitimierte Benutzer" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "Durchsuchbar" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "Berechtigungs-maske für neue Dateien" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "Beschreibung" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "Verzeichnis-maske" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "Deaktiviere Active Directory Domain Controller" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "Deaktiviere Netbios" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "Deaktiviere Winbind" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "Template bearbeiten" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "" +"Hier kann das Template bearbeitet werden, das zur Erstellung der Samba-" +"Konfigurationsdateien verwendet wird." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "Allgemeine Einstellungen" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "Nur Gaeste" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "Hostname" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "Besitzer Erben" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "Name" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "Netzwerk-freigaben" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "Pfad" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "Nur Lesen" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "Heimat-verzeichnisse freigeben" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "Freigegebene Verzeichnisse" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" +"Dieses Fenster zeigt den Inhalt der Datei '/etc/samba/smb.conf.template', " +"die als Template zum Erstellen der Samba-Konfiguration verwendet wird. Werte " +"die von Pipe Symbolen (|) eingeschlossen sind sollten nicht verändert " +"werden, da diese beim Erstellen der Konfiguration mit den Werten aus dem Tab " +"'Allgemeine Einstellungen' ersetzt werden." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "Arbeitsgruppe" + +#~ msgid "Browseable" +#~ msgstr "Suchbar" + +#~ msgid "Mask for new directories" +#~ msgstr "Maske für neue Verzeichnisse" + +#~ msgid "Mask for new files" +#~ msgstr "Maske für neue Dateien" diff --git a/package/lean/luci-app-samba4/po/el/samba4.po b/package/lean/luci-app-samba4/po/el/samba4.po new file mode 100644 index 00000000000000..f022250942236d --- /dev/null +++ b/package/lean/luci-app-samba4/po/el/samba4.po @@ -0,0 +1,147 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-05-28 02:08+0200\n" +"PO-Revision-Date: 2012-03-18 15:31+0200\n" +"Last-Translator: Vasilis \n" +"Language-Team: LANGUAGE \n" +"Language: el\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Pootle 2.0.4\n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "Όνομα" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "" diff --git a/package/lean/luci-app-samba4/po/en/samba4.po b/package/lean/luci-app-samba4/po/en/samba4.po new file mode 100644 index 00000000000000..0e515052fa2f57 --- /dev/null +++ b/package/lean/luci-app-samba4/po/en/samba4.po @@ -0,0 +1,157 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-03-22 15:23+0100\n" +"PO-Revision-Date: 2011-10-25 21:26+0200\n" +"Last-Translator: awm1 \n" +"Language-Team: LANGUAGE \n" +"Language: en\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Pootle 2.0.4\n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "Allow guests" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "Allow system users to reach their home directories via network shares" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "Allowed users" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "Create mask" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "Description" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "Directory mask" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "Edit template" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "Edit the template that is used for generating the Samba configuration." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "General settings" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "Hostname" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "Name" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "Network Shares" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "Path" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "Read-only" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "Share home-directories" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "Shared Directories" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your Samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"settings' tab." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "Workgroup" + +#~ msgid "Mask for new directories" +#~ msgstr "Mask for new directories" + +#~ msgid "Mask for new files" +#~ msgstr "Mask for new files" diff --git a/package/lean/luci-app-samba4/po/es/samba4.po b/package/lean/luci-app-samba4/po/es/samba4.po new file mode 100644 index 00000000000000..bd28e52f2cc545 --- /dev/null +++ b/package/lean/luci-app-samba4/po/es/samba4.po @@ -0,0 +1,167 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-06-10 03:41+0200\n" +"PO-Revision-Date: 2012-08-22 17:45+0200\n" +"Last-Translator: José Vicente \n" +"Language-Team: LANGUAGE \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Pootle 2.0.6\n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "Permitir invitados" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "" +"Permitir a los usuarios acceder a sus directorios de inicio vía " +"comparticiones de red" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "Usuarios permitidos" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "Crear máscara" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "Descripción" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "Máscara de directorio" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "Editar plantilla" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "Editar la plantilla usada para generar la configuración de samba." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "Configuración general" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "Nombre de máquina" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "Nombre" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "Comparticiones de red" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "Dirección" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "Solo lectura" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "Compartir directorios personales" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "Directorios compartidos" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" +"Contenido del fichero '/etc/samba/smb.conf.template' desde el que se " +"generará la configuración de samba. Los valores entre tuberías ('|') no " +"deben cambiarse. Su valor se toma desde la pestaña 'Configuración General'." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "Grupo de trabajo" + +#~ msgid "Mask for new directories" +#~ msgstr "Máscara para directorios nuevos" + +#~ msgid "Mask for new files" +#~ msgstr "Máscara para archivos nuevos" + +#~ msgid "Shared Directory" +#~ msgstr "Directorio compatido" + +#~ msgid "Physical Path" +#~ msgstr "Ruta Física" + +#~ msgid "optional" +#~ msgstr "opcional" diff --git a/package/lean/luci-app-samba4/po/fr/samba4.po b/package/lean/luci-app-samba4/po/fr/samba4.po new file mode 100644 index 00000000000000..3375bfb9c72d6b --- /dev/null +++ b/package/lean/luci-app-samba4/po/fr/samba4.po @@ -0,0 +1,159 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-05-19 19:36+0200\n" +"PO-Revision-Date: 2011-11-23 22:36+0200\n" +"Last-Translator: fredb \n" +"Language-Team: LANGUAGE \n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"X-Generator: Pootle 2.0.4\n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "Invités autorisés" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "" +"Autoriser les utilisateurs système à atteindre leurs dossiers personnels via " +"les partages réseau" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "Utilisateurs autorisés" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "Maque de création" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "Description" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "Masque des dossiers" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "Éditer le modèle" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "Éditer le modèle utilisé pour générer la configuration Samba." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "Paramètres généraux" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "Nom d'hôte" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "Nom" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "Partages réseau" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "Chemin" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "Lecture seule" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "Partager les dossiers personnels" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "Dossiers partagés" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" +"Voici le contenu du fichier '/etc/samba/smb.conf.template' d'où sera généré " +"votre configuration Samba. Les valeurs entre les symboles barre-verticale " +" (« | ») ne doivent pas être modifiées, elles proviennent de l'onglet " +"« Paramètres généraux »." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "Groupe de travail" + +#~ msgid "Mask for new directories" +#~ msgstr "Masque pour les nouveaux dossiers" + +#~ msgid "Mask for new files" +#~ msgstr "Masque pour les nouveaux fichiers" diff --git a/package/lean/luci-app-samba4/po/he/samba4.po b/package/lean/luci-app-samba4/po/he/samba4.po new file mode 100644 index 00000000000000..49f38a87d859b3 --- /dev/null +++ b/package/lean/luci-app-samba4/po/he/samba4.po @@ -0,0 +1,142 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "" diff --git a/package/lean/luci-app-samba4/po/hu/samba4.po b/package/lean/luci-app-samba4/po/hu/samba4.po new file mode 100644 index 00000000000000..ebd0f7dbaf459c --- /dev/null +++ b/package/lean/luci-app-samba4/po/hu/samba4.po @@ -0,0 +1,159 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"PO-Revision-Date: 2012-04-06 10:56+0200\n" +"Last-Translator: juhosg \n" +"Language-Team: none\n" +"Language: hu\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Pootle 2.0.4\n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "Vendég hozzáférés" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "" +"A rendszerfelhasználók hálózati megosztáson keresztül hozzáférhetnek a home " +"könyvtárukhoz." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "Engedélyezett felhasználók" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "Létrehozási maszk" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "Leírás" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "Könyvtár maszk" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "Sablon szerkesztése" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "" +"Itt szerkesztheti a sablont, ami a végleges samba konfiguráció " +"elkészítéséhez kerül felhasználásra." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "Általános beállítások" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "Gépnév" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "Név" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "Hálózati megosztások" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "Elérési út" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "Csak olvasható" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "Home könyvtárak megosztása" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "Megosztott könyvtárak" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" +"Itt látható a /etc/samba/smb.conf.template file tartalma, ami a samba " +"konfiguráció előállításához kerül felhasználásra. A pipe szimbólumok ('|') " +"közé zárt értékek módosítása nem szükséges, az értéküket az általános " +"beállítások fülről kapják." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "Munkacsoport" + +#~ msgid "Mask for new directories" +#~ msgstr "Új könyvtárak maszkja" + +#~ msgid "Mask for new files" +#~ msgstr "Új fájlok maszkja" diff --git a/package/lean/luci-app-samba4/po/it/samba4.po b/package/lean/luci-app-samba4/po/it/samba4.po new file mode 100644 index 00000000000000..6a6fd03b68f587 --- /dev/null +++ b/package/lean/luci-app-samba4/po/it/samba4.po @@ -0,0 +1,165 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-05-19 19:36+0200\n" +"PO-Revision-Date: 2017-09-06 01:28+0200\n" +"Last-Translator: bubu83 \n" +"Language-Team: LANGUAGE \n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Pootle 2.0.4\n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "Permetti ospiti" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "" +"Autorizza gli utenti del sistema a raggiungere la loro cartella home " +"attraverso le condivisioni di rete" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "Utenti ammessi" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "Crea maschera" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "Descrizione" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "Maschera della cartella" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "Modifica Template" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "" +"Modifica il template utilizzato per generare la configurazione di samba." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "Opzioni Generali" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "Hostname" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "Nome" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "Condivisioni di rete" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "Percorso" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" +"Per favore aggiungi le directory da condividere. Ogni directory si riferisce " +"a una cartella su un dispositivo montato." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "Solo lettura" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "Condividi cartelle home" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "Cartelle Condivise" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" +"Questo è il contenuto del file '/etc/samba/smb.conf.template' dal quale sarà " +"generata la tua configurazione di samba. I valori racchiusi tra il simbolo " +"('|') non dovrebbero essere toccati. Essi vengono generati dalla schermata " +"'Opzioni Generali'." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "Gruppo di lavoro" + +#~ msgid "Browseable" +#~ msgstr "Sfogliabile" + +#~ msgid "Mask for new directories" +#~ msgstr "Maschera per le nuove cartelle" + +#~ msgid "Mask for new files" +#~ msgstr "Maschera per i nuovi files" diff --git a/package/lean/luci-app-samba4/po/ja/samba4.po b/package/lean/luci-app-samba4/po/ja/samba4.po new file mode 100644 index 00000000000000..95d7c01c744aa4 --- /dev/null +++ b/package/lean/luci-app-samba4/po/ja/samba4.po @@ -0,0 +1,158 @@ +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-05-19 19:36+0200\n" +"PO-Revision-Date: 2018-08-06 05:17+0900\n" +"Last-Translator: INAGAKI Hiroshi \n" +"Language: ja\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 2.1.1\n" +"Language-Team: \n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "ゲストアクセスを許可" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "sambaを介してユーザーのホームディレクトリへのアクセスを許可します" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "許可されたユーザー" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "マスクの作成" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "説明" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "ディレクトリのマスク" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "Active Directory ドメインコントローラを無効化" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "Netbios を無効化" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "Winbind を無効化" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "テンプレートの編集" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "samba設定を生成するテンプレートを編集します。" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "一般設定" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "ゲストのみ" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "ホスト名" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "オーナーの継承" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "名前" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "ネットワーク共有" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "パス" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" +"共有するディレクトリを追加してください。マウントされたデバイス等のディレクト" +"リを設定し、公開することができます。" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "読み込みのみ" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "ホームディレクトリの共有" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "共有ディレクトリ" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" +"これは、samba設定を生成するための'/etc/samba/smb.conf.template' ファイルの内" +"容です。パイプ('|')で閉じられた値は変更しないでください。これらの値は'一般設" +"定'タブ内の値によって置き換えられます。" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "ワークグループ" + +#~ msgid "Mask for new directories" +#~ msgstr "新規ディレクトリのマスク" + +#~ msgid "Mask for new files" +#~ msgstr "新規ファイルのマスク" diff --git a/package/lean/luci-app-samba4/po/ms/samba4.po b/package/lean/luci-app-samba4/po/ms/samba4.po new file mode 100644 index 00000000000000..ab8a5a8542f792 --- /dev/null +++ b/package/lean/luci-app-samba4/po/ms/samba4.po @@ -0,0 +1,141 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "" diff --git a/package/lean/luci-app-samba4/po/no/samba4.po b/package/lean/luci-app-samba4/po/no/samba4.po new file mode 100644 index 00000000000000..e8276b9835776e --- /dev/null +++ b/package/lean/luci-app-samba4/po/no/samba4.po @@ -0,0 +1,147 @@ +msgid "" +msgstr "" +"Last-Translator: Lars Hardy \n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "Tillat gjester" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "Tillat systembrukere å nå sine hjemmekataloger via nettverks mapper." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "Tillatte brukere" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "Opprett Maske" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "Beskrivelse" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "Katalog maske" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "Rediger Mal" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "Rediger malen som brukes til å generere samba konfigurasjonen." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "Generelle Innstillinger" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "Vertsnavn" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "Navn" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "Nettverks Mapper" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "Fysisk bane" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "Skrivebeskyttet" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "Del Hjemmekataloger" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "Delte Kataloger" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" +"Dette er innholdet av filen '/etc/samba/smb.conf.template' som din samba " +"konfigurasjon vil bli generert fra. Verdier omsluttet av ('|') bør ikke " +"endres. De får sine verdier fra 'Generelle Innstillinger' fanen." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "Arbeidsgruppe" + +#~ msgid "Mask for new directories" +#~ msgstr "Maske for nye kataloger" + +#~ msgid "Mask for new files" +#~ msgstr "Maske for nye filer" diff --git a/package/lean/luci-app-samba4/po/pl/samba4.po b/package/lean/luci-app-samba4/po/pl/samba4.po new file mode 100644 index 00000000000000..120ecd8570caa3 --- /dev/null +++ b/package/lean/luci-app-samba4/po/pl/samba4.po @@ -0,0 +1,158 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"PO-Revision-Date: 2011-08-26 09:51+0200\n" +"Last-Translator: Staszek \n" +"Language-Team: none\n" +"Language: pl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2);\n" +"X-Generator: Pootle 2.0.4\n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "Zezwalaj Gościom" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "" +"Użytkownicy systemu mogą dostać się do swoich katalogów domowych za " +"pośrednictwem udziałów sieciowych." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "Użytkownicy z prawem dostępu" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "Utwórz maskę" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "Opis" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "Maska katalogu" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "Edytuj szablon" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "Edytuj szablon, który jest używany do generowania konfiguracji samby." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "Ustawienia ogólne" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "Nazwa hosta" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "Nazwa" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "Udziały sieciowe" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "Ścieżka" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "Tylko do odczytu" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "Udostępniaj katalogi domowe" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "Udostępniane katalogi" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" +"To jest zawartość pliku '/etc/samba/smb.conf.template\", na podstawie " +"którego zostanie wygenerowana konfiguracja samby. Wartości otoczone symbolem " +"kreski pionowej ('|') nie powinny być zmieniane. Wartości ich zostaną " +"pobrane z zakładki \"Ustawienia ogólne\"." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "Grupa robocza" + +#~ msgid "Mask for new directories" +#~ msgstr "Maska dla nowych katalogów" + +#~ msgid "Mask for new files" +#~ msgstr "Maska dla nowych plików" diff --git a/package/lean/luci-app-samba4/po/pt-br/samba4.po b/package/lean/luci-app-samba4/po/pt-br/samba4.po new file mode 100644 index 00000000000000..f6b6677dd288a6 --- /dev/null +++ b/package/lean/luci-app-samba4/po/pt-br/samba4.po @@ -0,0 +1,172 @@ +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-06-10 03:41+0200\n" +"PO-Revision-Date: 2018-09-20 19:48-0300\n" +"Last-Translator: Luiz Angelo Daros de Luca \n" +"Language: pt_BR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"X-Generator: Poedit 2.1.1\n" +"Language-Team: \n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "Permitir convidados" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "" +"Usuários do sistema poderão acessar seu diretório home através dos " +"compartilhamentos de rede" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "Usuários permitidos" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "Compartilhamento Time Machine da Apple" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "Navegável" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "Máscara de criação" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "Descrição" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "Máscara do diretório" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "Desabilitar o Controlador de Domínios AD" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "Desabilitar o NetBIOS" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "Desabilitar o Winbind" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "Editar modelo" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "Edita o modelo que é usado para gerar a configuração do samba." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "Habilitar compartilhamentos compatíveis com MacOS" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" +"Habilitar globalmente a extensão AAPL da Apple e adicione a opção de " +"compatibilidade com MacOS em todos os compartilhamentos." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "Forçar Usuário Root" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "Configurações Gerais" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "Somente convidados" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "Nome do equipamento" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "Herdar o dono" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "Nome" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "Compartilhamentos de Rede" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "Caminho" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" +"Por favor, adicione diretórios para compartilhar. Cada diretório refere-se a " +"uma porta em um dispositivo montado." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "Somente leitura" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "Compartilhar diretórios home" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "Diretórios Compartilhados" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" +"Este é o conteúdo do arquivo '/etc/samba/smb.conf.template' a partir do qual " +"sua configuração do samba será gerada. Valores entre simbolos de pipe ('|') " +"não devem ser alterados. Estes valores serão obtidos a partir da aba " +"'Configurações Gerais'." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "Tamanho do Time Machine em GB" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "Objetos VFS" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "Grupo de trabalho" + +#~ msgid "Mask for new directories" +#~ msgstr "Máscara para novos diretórios" + +#~ msgid "Mask for new files" +#~ msgstr "Máscara para novos arquivos" + +#~ msgid "Shared Directory" +#~ msgstr "Diretório Compartilhado" + +#~ msgid "Physical Path" +#~ msgstr "Caminho Físico" + +#~ msgid "optional" +#~ msgstr "opcional" diff --git a/package/lean/luci-app-samba4/po/pt/samba4.po b/package/lean/luci-app-samba4/po/pt/samba4.po new file mode 100644 index 00000000000000..d68ab66803b72c --- /dev/null +++ b/package/lean/luci-app-samba4/po/pt/samba4.po @@ -0,0 +1,168 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-05-26 19:03+0200\n" +"PO-Revision-Date: 2013-05-01 01:13+0200\n" +"Last-Translator: pedromrgoncalves \n" +"Language-Team: LANGUAGE \n" +"Language: pt\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Pootle 2.0.6\n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "Permitir Convidados" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "" +"Utilizadores do sistema poderão aceder ao seu directório home através das " +"partilhas de rede." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "Utilizadores Permitidos" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "Criar Máscara" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "Descrição" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "Máscara do Directório" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "Editar Template" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "Editar a template que é utilizada para gerar a configuração samba" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "Definições Gerais" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "Nome do host" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "Nome" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "Partilhas da Rede" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "Caminho" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "Apenas Leitura" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "Partilha de directórios home" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "Directórios Partilhados" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" +"Isto é o conteúdo do ficheiro 'etc/samba/smb.conf.template' a partir do qual " +"será gerado o ficheiro de configuração do samba. Os valores entre o símbolo " +"| não devem ser alterados. Eles recebem os valores do separador 'Definições " +"Gerais'." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "Grupo de trabalho" + +#~ msgid "Mask for new directories" +#~ msgstr "Máscara para novos directórios" + +#~ msgid "Mask for new files" +#~ msgstr "Máscara para novos ficheiros" + +#~ msgid "Shared Directory" +#~ msgstr "Diretório Compartilhado" + +#~ msgid "Physical Path" +#~ msgstr "Caminho Físico" + +#~ msgid "optional" +#~ msgstr "opcional" diff --git a/package/lean/luci-app-samba4/po/ro/samba4.po b/package/lean/luci-app-samba4/po/ro/samba4.po new file mode 100644 index 00000000000000..2e1ecdaf6c023c --- /dev/null +++ b/package/lean/luci-app-samba4/po/ro/samba4.po @@ -0,0 +1,157 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"PO-Revision-Date: 2011-10-07 17:16+0200\n" +"Last-Translator: Daniel \n" +"Language-Team: none\n" +"Language: ro\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < " +"20)) ? 1 : 2);;\n" +"X-Generator: Pootle 2.0.4\n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "Permite oaspeti" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "" +"Permite utilizatorii de sistem sa acceseze directoarele lor peste " +"partajarile de retea" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "Utilizatori acceptati" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "Creaza masca" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "Descriere" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "Masca director" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "Editeaza sablon" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "Editeaza sablonul care e folosit pentru generarea configuratiei samba." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "Setari generale" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "Numele de host" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "Nume" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "Partajari pe retea" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "Cale" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "Doar citire" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "Partajeaza directoarele proprii" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "Directoare partajate" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" +"Acesta este continutul fisierului '/etc/samba/smb.conf.template' din care se " +"genereaza configuratia samba. Valorile dintre liniuta verticala ('|') n-ar " +"trebui schimbate, ele iau valorile direct din tab-ul de \"Setari generale\"." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "Workgroup" + +#~ msgid "Mask for new directories" +#~ msgstr "Masca pentru directoarele noi" + +#~ msgid "Mask for new files" +#~ msgstr "Masca pentru fisierele noi" diff --git a/package/lean/luci-app-samba4/po/ru/samba4.po b/package/lean/luci-app-samba4/po/ru/samba4.po new file mode 100644 index 00000000000000..9829dc50bbbab0 --- /dev/null +++ b/package/lean/luci-app-samba4/po/ru/samba4.po @@ -0,0 +1,166 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Project-Id-Version: LuCI: samba\n" +"POT-Creation-Date: 2009-05-19 19:36+0200\n" +"PO-Revision-Date: 2018-01-14 11:43+0300\n" +"Language-Team: http://cyber-place.ru\n" +"MIME-Version: 1.0\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.8.7.1\n" +"Last-Translator: Vladimir aka sunny \n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"Language: ru\n" +"Project-Info: Это технический перевод, не дословный. Главное-удобный русский " +"интерфейс, все проверялось в графическом режиме, совместим с другими apps\n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "Разрешить гостевой вход" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "" +"Разрешить пользователям получать доступ к их домашним папкам, через " +"локальную сеть." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "Разрешенные пользователи" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "Создать маску" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "Описание" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "Маска папок" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "Настройка config файла" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "Настройка config
файла samba." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "Основные настройки" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "Имя хоста" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "Имя" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "Сетевые ресурсы" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "Путь" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" +"Добавьте папки для совместного доступа. Каждая папка - соответствует разделу " +"на подключенном устройстве." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "Только для чтения" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "Совместно использовать домашние папки" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "Совместно используемые папки" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" +"Это содержимое файла '/etc/samba/smb.conf.template', из которого " +"генерируется config файл - samba.
Значения, заключенные в символы " +"('|'), не должны быть изменены.
Они будут автоматически заменены на " +"значения со страницы 'Основные настройки'." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "Рабочая группа" + +#~ msgid "Browseable" +#~ msgstr "Виден в списке доступных ресурсов" + +#~ msgid "Mask for new directories" +#~ msgstr "Маска для новых папок" + +#~ msgid "Mask for new files" +#~ msgstr "Маска для новых файлов" diff --git a/package/lean/luci-app-samba4/po/sk/samba4.po b/package/lean/luci-app-samba4/po/sk/samba4.po new file mode 100644 index 00000000000000..a1c1d38a3c6d4c --- /dev/null +++ b/package/lean/luci-app-samba4/po/sk/samba4.po @@ -0,0 +1,142 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Project-Id-Version: PACKAGE VERSION\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"MIME-Version: 1.0\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "" diff --git a/package/lean/luci-app-samba4/po/sv/samba4.po b/package/lean/luci-app-samba4/po/sv/samba4.po new file mode 100644 index 00000000000000..756fa6a27301e4 --- /dev/null +++ b/package/lean/luci-app-samba4/po/sv/samba4.po @@ -0,0 +1,150 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Project-Id-Version: PACKAGE VERSION\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: sv\n" +"MIME-Version: 1.0\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "Tillåt gäster" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "Tillåt systemanvändare att nå deras hem-mappar via nätverksdelningar" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "Tillåtna användare" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "Skapa mask" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "Beskrivning" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "Mask för mapp" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "Redigera mall" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "" +"Redigera mallen som används för att generera konfigurationen för samba." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "Generella inställningar" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "Värdnamn" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "Namn" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "Nätverksdelningar" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "Genväg" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "Endast läsbar" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "Dela hem-mappar" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "Delade mappar" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "Arbetsgrupp" + +#~ msgid "Mask for new directories" +#~ msgstr "Mask för nya mappar" + +#~ msgid "Mask for new files" +#~ msgstr "Mask för nya filer" diff --git a/package/lean/luci-app-samba4/po/templates/samba4.pot b/package/lean/luci-app-samba4/po/templates/samba4.pot new file mode 100644 index 00000000000000..d930c139ed0d0c --- /dev/null +++ b/package/lean/luci-app-samba4/po/templates/samba4.pot @@ -0,0 +1,135 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "" diff --git a/package/lean/luci-app-samba4/po/tr/samba4.po b/package/lean/luci-app-samba4/po/tr/samba4.po new file mode 100644 index 00000000000000..570ad2f384b195 --- /dev/null +++ b/package/lean/luci-app-samba4/po/tr/samba4.po @@ -0,0 +1,142 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "" diff --git a/package/lean/luci-app-samba4/po/uk/samba4.po b/package/lean/luci-app-samba4/po/uk/samba4.po new file mode 100644 index 00000000000000..5acd96cee798d2 --- /dev/null +++ b/package/lean/luci-app-samba4/po/uk/samba4.po @@ -0,0 +1,159 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"PO-Revision-Date: 2012-03-18 20:35+0200\n" +"Last-Translator: YuriPet \n" +"Language-Team: none\n" +"Language: uk\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%" +"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"X-Generator: Pootle 2.0.4\n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "Дозволити гостьовий вхід" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "" +"Дозволити користувачам системи досягати своїх домашніх каталогів через " +"загальні мережеві ресурси" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "Дозволені користувачі" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "Створити маску" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "Опис" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "Маска каталогу" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "Редагувати шаблон" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "" +"Редагувати шаблон, який використовується для створення конфігурації samba." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "Загальні настройки" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "Назва (ім'я) вузла" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "Ім'я" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "Загальні мережеві ресурси" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "Шлях" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "Тільки читання" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "Спільно використовувати домашні каталоги" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "Загальні каталоги" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" +"Це вміст файлу '/etc/samba/smb.conf.template', з якого буде генеруватися " +"ваша конфігурація samba. Значення, укладені в символи \"вертикальна риска" +"\" (\"|\") не повинні змінюватися. Вони отримують свої значення з вкладки " +"\"Загальні налаштування\"." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "Робоча група" + +#~ msgid "Mask for new directories" +#~ msgstr "Маска для нових каталогів" + +#~ msgid "Mask for new files" +#~ msgstr "Маска для нових файлів" diff --git a/package/lean/luci-app-samba4/po/vi/samba4.po b/package/lean/luci-app-samba4/po/vi/samba4.po new file mode 100644 index 00000000000000..2920759f41420f --- /dev/null +++ b/package/lean/luci-app-samba4/po/vi/samba4.po @@ -0,0 +1,171 @@ +# samba.pot +# generated from ./applications/luci-samba/luasrc/i18n/samba.en.lua +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-08-16 06:59+0200\n" +"PO-Revision-Date: 2009-08-13 03:54+0200\n" +"Last-Translator: Hong Phuc Dang \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Pootle 1.1.0\n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +#, fuzzy +msgid "Allow guests" +msgstr "Cho phép khách" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +#, fuzzy +msgid "Allow system users to reach their home directories via network shares" +msgstr "" +"Những người sử dụng hệ thống có thể tiếp cận những thư mục tại nhà thông qua " +"mạng lưới chia sẻ trực tuyến." + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +#, fuzzy +msgid "Allowed users" +msgstr "Người sử dụng được cho phép" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +#, fuzzy +msgid "Create mask" +msgstr "Tạo Mask" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "Mô tả" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +#, fuzzy +msgid "Directory mask" +msgstr "Thư mục Mask" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "tên máy chủ" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "Mạng chia sẻ" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +#, fuzzy +msgid "Read-only" +msgstr "Chỉ đọc " + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "Chia sẻ danh bạ chính" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "Thư mục chia sẻ" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "Nhóm làm việc " + +#~ msgid "Mask for new directories" +#~ msgstr "Mask cho thư mục mới" + +#~ msgid "Mask for new files" +#~ msgstr "Mask cho tập tin mới" + +#~ msgid "Shared Directory" +#~ msgstr "Đã chia sẻ thư mục" + +#~ msgid "Physical Path" +#~ msgstr "Đường dẫn vật lý" + +#~ msgid "optional" +#~ msgstr "Tùy thích" diff --git a/package/lean/luci-app-samba4/po/zh-cn/samba4.po b/package/lean/luci-app-samba4/po/zh-cn/samba4.po new file mode 100644 index 00000000000000..f1d681ecbf0293 --- /dev/null +++ b/package/lean/luci-app-samba4/po/zh-cn/samba4.po @@ -0,0 +1,164 @@ +# +# Yangfl , 2017, 2018. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-06-10 03:40+0200\n" +"PO-Revision-Date: 2018-10-01 11:12+0800\n" +"Last-Translator: Yangfl \n" +"Language-Team: \n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Gtranslator 2.91.7\n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "允许匿名用户" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "允许系统用户通过网络共享访问他们的家目录" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "允许用户" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "Apple Time-machine 共享" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "可浏览" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "创建权限掩码" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "描述" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "目录权限掩码" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "禁用 Active Directory 域控制器" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "禁用 Netbios" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "禁用 Winbind" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "编辑模板" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "编辑用来生成 samba 设置的模板" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "启用 macOS 兼容共享" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "全局启用 Apple 的 AAPL 扩展,并为所有共享添加 macOS 兼容性选项。" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "强制 Root" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "基本设置" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "仅来宾用户" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "主机名" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "继承所有者" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "共享名" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "网络共享" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "目录" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "请添加要共享的目录。每个目录指到已挂载设备上的文件夹。" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "只读" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "共享家目录" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "共享目录" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" +"这是将从其上生成 samba 配置的文件“/etc/samba/smb.conf.template”的内容。由管道" +"符(“|”)包围的值不应更改。它们将从“常规设置”标签中获取其值。" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "Time-machine 大小(GB)" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "VFS 对象" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "工作组" + +#~ msgid "Browseable" +#~ msgstr "可浏览" + +#~ msgid "Mask for new directories" +#~ msgstr "新目录权限掩码" + +#~ msgid "Mask for new files" +#~ msgstr "新文件权限掩码" + +#~ msgid "Physical Path" +#~ msgstr "物理路径" diff --git a/package/lean/luci-app-samba4/po/zh-tw/samba4.po b/package/lean/luci-app-samba4/po/zh-tw/samba4.po new file mode 100644 index 00000000000000..9e6fcfdff73c1f --- /dev/null +++ b/package/lean/luci-app-samba4/po/zh-tw/samba4.po @@ -0,0 +1,164 @@ +# +# Yangfl , 2017, 2018. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-06-10 03:40+0200\n" +"PO-Revision-Date: 2018-10-01 11:12+0800\n" +"Last-Translator: Yangfl \n" +"Language-Team: \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Gtranslator 2.91.7\n" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:78 +msgid "Allow guests" +msgstr "允許匿名使用者" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:15 +msgid "Allow system users to reach their home directories via network shares" +msgstr "允許系統使用者通過網路共享訪問他們的家目錄" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:75 +msgid "Allowed users" +msgstr "允許使用者" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:106 +msgid "Apple Time-machine share" +msgstr "Apple Time-machine 共享" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:63 +msgid "Browse-able" +msgstr "可瀏覽" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:93 +msgid "Create mask" +msgstr "建立權限掩碼" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:12 +msgid "Description" +msgstr "描述" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:98 +msgid "Directory mask" +msgstr "目錄權限掩碼" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:27 +msgid "Disable Active Directory Domain Controller" +msgstr "禁用 Active Directory 域控制器" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:24 +msgid "Disable Netbios" +msgstr "禁用 Netbios" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:30 +msgid "Disable Winbind" +msgstr "禁用 Winbind" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:9 +msgid "Edit Template" +msgstr "編輯模板" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:34 +msgid "Edit the template that is used for generating the samba configuration." +msgstr "編輯用來生成 samba 設定的模板" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:19 +msgid "Enable macOS compatible shares" +msgstr "啟用 macOS 相容共享" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:20 +msgid "" +"Enables Apple's AAPL extension globally and adds macOS compatibility options " +"to all shares." +msgstr "全域性啟用 Apple 的 AAPL 擴充套件,併為所有共享新增 macOS 相容性選項。" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:73 +msgid "Force Root" +msgstr "強制 Root" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:8 +msgid "General Settings" +msgstr "基本設定" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:83 +msgid "Guests only" +msgstr "僅來賓使用者" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:11 +msgid "Hostname" +msgstr "主機名" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:88 +msgid "Inherit owner" +msgstr "繼承所有者" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:57 +msgid "Name" +msgstr "共享名" + +#: applications/luci-app-samba4/luasrc/controller/samba4.lua:12 +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:3 +msgid "Network Shares" +msgstr "網路共享" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:58 +msgid "Path" +msgstr "目錄" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:52 +msgid "" +"Please add directories to share. Each directory refers to a folder on a " +"mounted device." +msgstr "請新增要共享的目錄。每個目錄指到已掛載裝置上的資料夾。" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:68 +msgid "Read-only" +msgstr "只讀" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:14 +msgid "Share home-directories" +msgstr "共享家目錄" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:51 +msgid "Shared Directories" +msgstr "共享目錄" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:35 +msgid "" +"This is the content of the file '/etc/samba/smb.conf.template' from which " +"your samba configuration will be generated. Values enclosed by pipe symbols " +"('|') should not be changed. They get their values from the 'General " +"Settings' tab." +msgstr "" +"這是將從其上生成 samba 配置的檔案“/etc/samba/smb.conf.template”的內容。由管道" +"符(“|”)包圍的值不應更改。它們將從“常規設定”標籤中獲取其值。" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:108 +msgid "Time-machine size in GB" +msgstr "Time-machine 大小(GB)" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:103 +msgid "Vfs objects" +msgstr "VFS 物件" + +#: applications/luci-app-samba4/luasrc/model/cbi/samba4.lua:13 +msgid "Workgroup" +msgstr "工作組" + +#~ msgid "Browseable" +#~ msgstr "可瀏覽" + +#~ msgid "Mask for new directories" +#~ msgstr "新目錄權限掩碼" + +#~ msgid "Mask for new files" +#~ msgstr "新檔案權限掩碼" + +#~ msgid "Physical Path" +#~ msgstr "物理路徑" diff --git a/package/lean/luci-app-sfe/Makefile b/package/lean/luci-app-sfe/Makefile new file mode 100644 index 00000000000000..210529c785fd79 --- /dev/null +++ b/package/lean/luci-app-sfe/Makefile @@ -0,0 +1,17 @@ +# Copyright (C) 2016 Openwrt.org +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI support for Turbo ACC (SFE) +LUCI_DEPENDS:=+kmod-fast-classifier +pdnsd-alt +kmod-tcp-bbr @LINUX_4_9 +LUCI_PKGARCH:=all +PKG_VERSION:=1.0 +PKG_RELEASE:=12 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + diff --git a/package/lean/luci-app-sfe/luasrc/controller/sfe.lua b/package/lean/luci-app-sfe/luasrc/controller/sfe.lua new file mode 100644 index 00000000000000..10e9dd82b0bbd8 --- /dev/null +++ b/package/lean/luci-app-sfe/luasrc/controller/sfe.lua @@ -0,0 +1,39 @@ +module("luci.controller.sfe", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/sfe") then + return + end + local page + page = entry({"admin", "network", "sfe"}, cbi("sfe"), _("Turbo ACC Center"), 100) + page.i18n = "sfe" + page.dependent = true + + entry({"admin", "network", "sfe", "status"}, call("action_status")) +end + +local function is_running() + return luci.sys.call("lsmod | grep fast_classifier >/dev/null") == 0 +end + +local function is_bbr() + return luci.sys.call("sysctl net.ipv4.tcp_congestion_control | grep bbr >/dev/null") == 0 +end + +local function is_fullcone() + return luci.sys.call("iptables -t nat -L -n --line-numbers | grep FULLCONENAT >/dev/null") == 0 +end + +local function is_dns() + return luci.sys.call("pgrep dnscache >/dev/null") == 0 +end + +function action_status() + luci.http.prepare_content("application/json") + luci.http.write_json({ + run_state = is_running(), + down_state = is_bbr(), + up_state = is_fullcone(), + dns_state = is_dns() + }) +end \ No newline at end of file diff --git a/package/lean/luci-app-sfe/luasrc/model/cbi/sfe.lua b/package/lean/luci-app-sfe/luasrc/model/cbi/sfe.lua new file mode 100644 index 00000000000000..bb4c476168c854 --- /dev/null +++ b/package/lean/luci-app-sfe/luasrc/model/cbi/sfe.lua @@ -0,0 +1,45 @@ + +m = Map("sfe") +m.title = translate("Turbo ACC Acceleration Settings") +m.description = translate("Opensource Qualcomm Shortcut FE driver (Fast Path)") + +m:append(Template("sfe/status")) + +s = m:section(TypedSection, "sfe", "") +s.addremove = false +s.anonymous = true + + +enable = s:option(Flag, "enabled", translate("Enable SFE Fast Path")) +enable.default = 0 +enable.rmempty = false +enable.description = translate("Enable Fast Path offloading for connections. (decrease cpu load / increase routing throughput)") + +wifi = s:option(Flag, "wifi", translate("Bridge Acceleration")) +wifi.default = 0 +wifi.rmempty = false +wifi.description = translate("Enable Bridge Acceleration (may be functional conflict with bridge-mode VPN Server)") +wifi:depends("enabled", 1) + +ipv6 = s:option(Flag, "ipv6", translate("IPv6 Acceleration")) +ipv6.default = 0 +ipv6.rmempty = false +ipv6.description = translate("Enable IPv6 Acceleration") +ipv6:depends("enabled", 1) + +bbr = s:option(Flag, "bbr", translate("Enable BBR")) +bbr.default = 0 +bbr.rmempty = false +bbr.description = translate("Bottleneck Bandwidth and Round-trip propagation time (BBR)") + +dns = s:option(Flag, "dns", translate("DNS Acceleration")) +dns.default = 0 +dns.rmempty = false +dns.description = translate("Enable DNS Cache Acceleration and anti ISP DNS pollution") + +o = s:option(Value, "dns_server", translate("Upsteam DNS Server")) +o.default = "114.114.114.114,114.114.115.115" +o.description = translate("Muitiple DNS server can saperate with ','") +o:depends("dns", 1) + +return m diff --git a/package/lean/luci-app-sfe/luasrc/view/sfe/status.htm b/package/lean/luci-app-sfe/luasrc/view/sfe/status.htm new file mode 100644 index 00000000000000..6d35265acb9199 --- /dev/null +++ b/package/lean/luci-app-sfe/luasrc/view/sfe/status.htm @@ -0,0 +1,24 @@ +
+ <%:Running Status%> + + + + + +
SFE 加速状态<%:Collecting data...%>
BBR 加速<%:Collecting data...%>
FULLCONE NAT加速<%:Collecting data...%>
DNS 加速<%:Collecting data...%>
+
+ + diff --git a/package/lean/luci-app-sfe/po/zh-cn/sfe.po b/package/lean/luci-app-sfe/po/zh-cn/sfe.po new file mode 100644 index 00000000000000..044d2f63097bac --- /dev/null +++ b/package/lean/luci-app-sfe/po/zh-cn/sfe.po @@ -0,0 +1,53 @@ +msgid "SFE Acceleration" +msgstr "SFE 转发加速" + +msgid "Turbo ACC Center" +msgstr "Turbo ACC 网络加速" + +msgid "Turbo ACC Acceleration Settings" +msgstr "Turbo ACC 网络加速设置" + +msgid "Shortcut Forwarding Engine Acceleration Settings" +msgstr "SFE 转发加速引擎设置" + +msgid "Opensource Qualcomm Shortcut FE driver (Fast Path)" +msgstr "来自高通开源的 Shortcut FE 转发加速引擎 (Fast Path)" + +msgid "Enable" +msgstr "启用" + +msgid "Enable SFE Fast Path" +msgstr "启用 SFE Fast Path 加速" + +msgid "Enable Fast Path offloading for connections. (decrease cpu load / increase routing throughput)" +msgstr "开启 Fast Path 转发加速. (降低CPU占用 / 增强路由转发性能,和多WAN或者QOS功能可能会冲突)" + +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 "Enable BBR" +msgstr "启用 BBR" + +msgid "Bottleneck Bandwidth and Round-trip propagation time (BBR)" +msgstr "BBR拥塞控制算法可以加强TCP应用表现,但会降低路由器本机上的WIFI吞吐性能" + +msgid "DNS Acceleration" +msgstr "DNS 加速" + +msgid "Enable DNS Cache Acceleration and anti ISP DNS pollution" +msgstr "启用DNS多线程查询、缓存,并防止ISP的DNS广告和域名劫持" + +msgid "Upsteam DNS Server" +msgstr "上游 DNS 服务器(国内)" + +msgid "Muitiple DNS server can saperate with ','" +msgstr "支持多个上游DNS服务器,用','分隔(注意用英文逗号).请填写您最快的DNS服务器" diff --git a/package/lean/luci-app-sfe/root/etc/config/sfe b/package/lean/luci-app-sfe/root/etc/config/sfe new file mode 100644 index 00000000000000..fc0b52ec418672 --- /dev/null +++ b/package/lean/luci-app-sfe/root/etc/config/sfe @@ -0,0 +1,9 @@ + +config sfe 'config' + option enabled '1' + option ipv6 '0' + option wifi '0' + option bbr '0' + option dns '0' + option dns_server '114.114.114.114,114.114.115.115' + diff --git a/package/lean/luci-app-sfe/root/etc/init.d/sfe b/package/lean/luci-app-sfe/root/etc/init.d/sfe new file mode 100644 index 00000000000000..f00256dd7be7d5 --- /dev/null +++ b/package/lean/luci-app-sfe/root/etc/init.d/sfe @@ -0,0 +1,206 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2007-2012 OpenWrt.org + +START=90 + +USE_PROCD=1 + +PDNSD_BIN="/var/sbin/dnscache" +DNSMASQ_RESTART=N +DNS_SERVER="114.114.114.114,114.114.115.115" + +pdnsd_genconfig() { + DNS_SERVER=$(uci get sfe.config.dns_server 2>/dev/null) + + [ -d /var/etc ] || mkdir -p /var/etc + + 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 + + cat > /var/etc/dnscache.conf </dev/null 2>&1 + uci add_list dhcp.@dnsmasq[0].server=127.0.0.1#5333 + uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto + uci set dhcp.@dnsmasq[0].noresolv=0 + uci commit dhcp +} + +revert_dns() { + uci del_list dhcp.@dnsmasq[0].server=127.0.0.1#5333 >/dev/null 2>&1 + uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto + uci set dhcp.@dnsmasq[0].noresolv=0 + uci commit dhcp +} + +start_service() { + enable=$(uci get sfe.config.enabled 2>/dev/null) + wifi=$(uci get sfe.config.wifi) + ipv6=$(uci get sfe.config.ipv6) + dns=$(uci get sfe.config.dns 2>/dev/null) + bbr=$(uci get sfe.config.bbr 2>/dev/null) + + if [ $enable -eq 1 ]; then + ! (lsmod | grep fast_classifier >/dev/null) && (modprobe fast_classifier) + if [ $wifi -eq 1 ] ; then + echo 1 > /sys/fast_classifier/skip_to_bridge_ingress + else + echo 0 > /sys/fast_classifier/skip_to_bridge_ingress + fi + if [ $ipv6 -eq 1 ]; then + sfe_ipv6=$(cat /sys/sfe_ipv6/debug_dev) + [ ! -f /dev/sfe_ipv6 ] && mknod /dev/sfe_ipv6 c $sfe_ipv6 0 + else + rm -f /dev/sfe_ipv6 + fi + else + rmmod fast_classifier >/dev/null 2>&1 + fi + + if [ $dns -eq 1 ]; then + pdnsd_genconfig + procd_open_instance + procd_set_param command "$PDNSD_BIN" -c /var/etc/dnscache.conf + procd_set_param respawn + procd_set_param stderr 1 + procd_close_instance + change_dns + fi + + if [ $bbr -eq 1 ]; then + sysctl -w net.ipv4.tcp_congestion_control=bbr + else + sysctl -w net.ipv4.tcp_congestion_control=cubic + fi + if [ "$DNSMASQ_RESTART" = N ]; then + /etc/init.d/dnsmasq restart + fi +} + +stop_service(){ + enable=$(uci get sfe.config.enabled 2>/dev/null) + [ $enable -ne 1 ] && rmmod fast_classifier >/dev/null 2>&1 + revert_dns + if [ "$DNSMASQ_RESTART" = N ]; then + /etc/init.d/dnsmasq restart + fi +} + +restart(){ + DNSMASQ_RESTART=Y + stop + start + /etc/init.d/dnsmasq restart && echo "DNSMASQ restart" +} \ No newline at end of file diff --git a/package/lean/luci-app-sfe/root/etc/uci-defaults/sfe b/package/lean/luci-app-sfe/root/etc/uci-defaults/sfe new file mode 100644 index 00000000000000..50adb160fda688 --- /dev/null +++ b/package/lean/luci-app-sfe/root/etc/uci-defaults/sfe @@ -0,0 +1,14 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@sfe[-1] + add ucitrack sfe + set ucitrack.@sfe[-1].init=sfe + commit ucitrack +EOF + +[ ! -f /usr/sbin/dnscache ] && ln /usr/sbin/pdnsd /usr/sbin/dnscache +/etc/init.d/sfe enable + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/package/lean/luci-app-sfe/root/usr/share/dnscache-watchdog.sh b/package/lean/luci-app-sfe/root/usr/share/dnscache-watchdog.sh new file mode 100644 index 00000000000000..4bde67d5775960 --- /dev/null +++ b/package/lean/luci-app-sfe/root/usr/share/dnscache-watchdog.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +dns_enable=$(uci get sfe.config.dns 2>/dev/null) + +if [ $dns_enable -eq 1 ]; then + if ! pidof dnscache>/dev/null; then + /etc/init.d/sfe restart + fi +fi diff --git a/package/lean/luci-app-softethervpn/Makefile b/package/lean/luci-app-softethervpn/Makefile new file mode 100644 index 00000000000000..236ed1e7ba1876 --- /dev/null +++ b/package/lean/luci-app-softethervpn/Makefile @@ -0,0 +1,18 @@ +# Copyright (C) 2018-2019 Lienol +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI support for SoftEtherVPN +LUCI_DEPENDS:=+zlib +libpthread +librt +libreadline +libncurses +libiconv-full +kmod-tun +libopenssl +softethervpn5-bridge +softethervpn5-client +softethervpn5-server +LUCI_PKGARCH:=all +PKG_VERSION:=1.0 +PKG_RELEASE:=3 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + + diff --git a/package/lean/luci-app-softethervpn/luasrc/controller/softethervpn.lua b/package/lean/luci-app-softethervpn/luasrc/controller/softethervpn.lua new file mode 100644 index 00000000000000..d4ec9bc88c4e7b --- /dev/null +++ b/package/lean/luci-app-softethervpn/luasrc/controller/softethervpn.lua @@ -0,0 +1,18 @@ +module("luci.controller.softethervpn",package.seeall) + +function index() + if not nixio.fs.access("/etc/config/softethervpn")then + return + end + + entry({"admin","vpn"}, firstchild(), "VPN", 45).dependent = false + entry({"admin","vpn","softethervpn"},cbi("softethervpn"),_("SoftEther VPN"),50).dependent=true + entry({"admin","vpn","softethervpn","status"},call("status")).leaf=true +end + +function status() + local e={} + e.status=luci.sys.call("pidof %s >/dev/null"%"vpnserver")==0 + luci.http.prepare_content("application/json") + luci.http.write_json(e) +end diff --git a/package/lean/luci-app-softethervpn/luasrc/model/cbi/softethervpn.lua b/package/lean/luci-app-softethervpn/luasrc/model/cbi/softethervpn.lua new file mode 100644 index 00000000000000..5529c82fb0636d --- /dev/null +++ b/package/lean/luci-app-softethervpn/luasrc/model/cbi/softethervpn.lua @@ -0,0 +1,14 @@ +local s=require"luci.sys" +local m,s,o +m=Map("softethervpn",translate("SoftEther VPN")) +m.description = translate("SoftEther VPN is an open source, cross-platform, multi-protocol virtual private network solution developed by university of tsukuba graduate student Daiyuu Nobori for master's thesis.
can easily set up OpenVPN, IPsec, L2TP, ms-sstp, L2TPv3 and EtherIP servers on the router using the console.") +m.template="softethervpn/index" +s=m:section(TypedSection,"softether") +s.anonymous=true +o=s:option(DummyValue,"softethervpn_status",translate("Current Condition")) +o.template="softethervpn/status" +o.value=translate("Collecting data...") +o=s:option(Flag,"enable",translate("Enabled")) +o.rmempty=false +o=s:option(DummyValue,"moreinfo",translate("控制台下载:
Windows-x86_x64-intel.exe

macos-x86-32bit.pkg
")) +return m diff --git a/package/lean/luci-app-softethervpn/luasrc/view/softethervpn/index.htm b/package/lean/luci-app-softethervpn/luasrc/view/softethervpn/index.htm new file mode 100644 index 00000000000000..273f604eab71fd --- /dev/null +++ b/package/lean/luci-app-softethervpn/luasrc/view/softethervpn/index.htm @@ -0,0 +1,18 @@ +<%# + Copyright (C) 2018-2019 Lienol + Licensed to the public under the Apache License 2.0. +-%> + +<% include("cbi/map") %> + diff --git a/package/lean/luci-app-softethervpn/luasrc/view/softethervpn/status.htm b/package/lean/luci-app-softethervpn/luasrc/view/softethervpn/status.htm new file mode 100644 index 00000000000000..055b112ec1e187 --- /dev/null +++ b/package/lean/luci-app-softethervpn/luasrc/view/softethervpn/status.htm @@ -0,0 +1,3 @@ +<%+cbi/valueheader%> +<%=pcdata(self:cfgvalue(section) or self.default or "")%> +<%+cbi/valuefooter%> diff --git a/package/lean/luci-app-softethervpn/po/zh-cn/softethervpn.po b/package/lean/luci-app-softethervpn/po/zh-cn/softethervpn.po new file mode 100644 index 00000000000000..8d17b15070fb1b --- /dev/null +++ b/package/lean/luci-app-softethervpn/po/zh-cn/softethervpn.po @@ -0,0 +1,23 @@ +msgid "SoftEther VPN" +msgstr "SoftEther VPN 服务器" + +msgid "SoftEther VPN is an open source, cross-platform, multi-protocol virtual private network solution developed by university of tsukuba graduate student Daiyuu Nobori for master's thesis.
can easily set up OpenVPN, IPsec, L2TP, ms-sstp, L2TPv3 and EtherIP servers on the router using the console." +msgstr "SoftEther VPN是由筑波大学研究生Daiyuu Nobori因硕士论文开发的开源,跨平台,多重协定的虚拟私人网路方案。
使用控制台可以轻松在路由器上搭建OpenVPN, IPsec, L2TP, MS-SSTP, L2TPv3 和 EtherIP服务器。" + +msgid "PPTP VPN Server status" +msgstr "PPTP VPN 服务器运行状态" + +msgid "Current Condition" +msgstr "当前状态" + +msgid "Enabled" +msgstr "启用" + +msgid "Open L2TP/IPSec firewall" +msgstr "开启L2TP/IPSec防火墙" + +msgid "Open the MS-SSTP firewall" +msgstr "开启MS-SSTP防火墙" + +msgid "Open the OpenVPN firewall" +msgstr "开启OpenVPN防火墙" \ No newline at end of file diff --git a/package/lean/luci-app-softethervpn/root/etc/config/softethervpn b/package/lean/luci-app-softethervpn/root/etc/config/softethervpn new file mode 100644 index 00000000000000..90732c533925dd --- /dev/null +++ b/package/lean/luci-app-softethervpn/root/etc/config/softethervpn @@ -0,0 +1,4 @@ + +config softether + option enable '0' + diff --git a/package/lean/luci-app-softethervpn/root/etc/init.d/softethervpn b/package/lean/luci-app-softethervpn/root/etc/init.d/softethervpn new file mode 100644 index 00000000000000..d724d5b8c54a59 --- /dev/null +++ b/package/lean/luci-app-softethervpn/root/etc/init.d/softethervpn @@ -0,0 +1,45 @@ +#!/bin/sh /etc/rc.common +# +# Copyright (C) 2015 OpenWrt-dist +# Copyright (C) 2016 Chen RuiWei +# Copyright (C) 2018-2019 Lienol +# +# This is free software, licensed under the GNU General Public License v3. +# See /LICENSE for more information. +# + +START=99 +STOP=10 + +CONFIG=softethervpn + +get_config() +{ + config_get_bool enable $1 enable 0 +} + +uci_get_by_type() { + local index=0 + if [ -n $4 ]; then + index=$4 + fi + local ret=$(uci get $CONFIG.@$1[$index].$2 2>/dev/null) + echo ${ret:=$3} +} + +start() +{ + config_load softethervpn + config_foreach get_config softether + [ $enable -ne 1 ] && exit 0 + logger -t 'softethervpn' "Starting softether vpnserver service." + /usr/bin/env LANG=en_US.UTF-8 /usr/libexec/softethervpn/vpnserver start > /dev/null 2>&1 + fw3 reload +} + +stop() +{ + logger -t 'softethervpn' "Stopping softether vpnserver service." + /usr/bin/env LANG=en_US.UTF-8 /usr/libexec/softethervpn/vpnserver stop > /dev/null 2>&1 + fw3 reload +} diff --git a/package/lean/luci-app-softethervpn/root/etc/uci-defaults/luci-app-softethervpn b/package/lean/luci-app-softethervpn/root/etc/uci-defaults/luci-app-softethervpn new file mode 100644 index 00000000000000..1f6e2bdf4a242c --- /dev/null +++ b/package/lean/luci-app-softethervpn/root/etc/uci-defaults/luci-app-softethervpn @@ -0,0 +1,25 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete firewall.softethervpn + set firewall.softethervpn=include + set firewall.softethervpn.type=script + set firewall.softethervpn.path=/usr/share/softethervpn/firewall.include + set firewall.softethervpn.reload=1 +EOF + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@softethervpn[-1] + add ucitrack softethervpn + set ucitrack.@softethervpn[-1].init=softethervpn + commit ucitrack +EOF + +/etc/init.d/softethervpnbridge disable && /etc/init.d/softethervpnbridge stop +/etc/init.d/softethervpnclient disable && /etc/init.d/softethervpnclient stop +/etc/init.d/softethervpnserver disable && /etc/init.d/softethervpnserver stop + +chmod a+x /usr/share/softethervpn/* >/dev/null 2>&1 + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/package/lean/luci-app-softethervpn/root/usr/share/softethervpn/firewall.include b/package/lean/luci-app-softethervpn/root/usr/share/softethervpn/firewall.include new file mode 100644 index 00000000000000..3c2fd6dfe600e7 --- /dev/null +++ b/package/lean/luci-app-softethervpn/root/usr/share/softethervpn/firewall.include @@ -0,0 +1,22 @@ +#!/bin/sh + +openvpnport=$(cat /usr/libexec/softethervpn/vpn_server.config 2>/dev/null|grep OpenVPN_UdpPortList | awk -F " " '{print $3}') +[ -z "$openvpnport" ] && openvpnport=1194 +iptables -D INPUT -p udp -m multiport --dports 500,1701,4500 -m comment --comment "Rule For SoftEther VPN Server" -j ACCEPT 2>/dev/null +[ -n "$openvpnport" ] && iptables -D INPUT -p udp --dport $openvpnport -m comment --comment "Rule For SoftEther VPN Server" -j ACCEPT 2>/dev/null +[ -n "$openvpnport" ] && iptables -D INPUT -p tcp --dport $openvpnport -m comment --comment "Rule For SoftEther VPN Server" -j ACCEPT 2>/dev/null +iptables -D INPUT -p tcp --dport 443 -m comment --comment "Rule For SoftEther VPN Server" -j ACCEPT 2>/dev/null +iptables -D INPUT -p tcp --dport 5555 -m comment --comment "Rule For SoftEther VPN Server" -j ACCEPT 2>/dev/null +iptables -D INPUT -p tcp --dport 8888 -m comment --comment "Rule For SoftEther VPN Server" -j ACCEPT 2>/dev/null +iptables -D INPUT -p tcp --dport 992 -m comment --comment "Rule For SoftEther VPN Server" -j ACCEPT 2>/dev/null + +enable=$(uci get softethervpn.@softether[0].enable) +if [ $enable -eq 1 ]; then + iptables -I INPUT -p udp -m multiport --dports 500,1701,4500 -m comment --comment "Rule For SoftEther VPN Server" -j ACCEPT 2>/dev/null + iptables -I INPUT -p udp --dport $openvpnport -m comment --comment "Rule For SoftEther VPN Server" -j ACCEPT + iptables -I INPUT -p tcp --dport $openvpnport -m comment --comment "Rule For SoftEther VPN Server" -j ACCEPT + iptables -I INPUT -p tcp --dport 443 -m comment --comment "Rule For SoftEther VPN Server" -j ACCEPT + iptables -I INPUT -p tcp --dport 5555 -m comment --comment "Rule For SoftEther VPN Server" -j ACCEPT + iptables -I INPUT -p tcp --dport 8888 -m comment --comment "Rule For SoftEther VPN Server" -j ACCEPT + iptables -I INPUT -p tcp --dport 992 -m comment --comment "Rule For SoftEther VPN Server" -j ACCEPT +fi diff --git a/package/lean/luci-app-ssr-plus/Makefile b/package/lean/luci-app-ssr-plus/Makefile new file mode 100644 index 00000000000000..40e3829c7b46e7 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/Makefile @@ -0,0 +1,148 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=luci-app-ssr-plus +PKG_VERSION:=165 +PKG_RELEASE:=2 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/$(PKG_NAME)/config +config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks + bool "Include Shadowsocks New Version" + default y if x86||x86_64||arm||aarch64 + +config PACKAGE_$(PKG_NAME)_INCLUDE_Simple_obfs + bool "Include Shadowsocks Simple-obfs Plugin" + default y if x86||x86_64||arm||aarch64 + +config PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_plugin + bool "Include Shadowsocks V2ray Plugin" + default y if x86||x86_64||arm||aarch64 + +config PACKAGE_$(PKG_NAME)_INCLUDE_V2ray + bool "Include V2ray" + default y if x86||x86_64||arm||aarch64 + +config PACKAGE_$(PKG_NAME)_INCLUDE_Trojan + bool "Include Trojan" + default y if x86||x86_64||arm||aarch64 + +config PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2 + bool "Include Redsocks2" + default y if x86||x86_64||arm||aarch64 + +config PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun + bool "Include Kcptun" + default n + +config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server + bool "Include ShadowsocksR Server" + default y if x86||x86_64||arm||aarch64 + +config PACKAGE_$(PKG_NAME)_INCLUDE_DNS2SOCKS + bool "Include DNS2SOCKS" + default y if x86||x86_64||arm||aarch64 +endef + +define Package/$(PKG_NAME) + SECTION:=luci + CATEGORY:=LuCI + SUBMENU:=3. Applications + TITLE:=SS/SSR/V2Ray/Trojan LuCI interface + PKGARCH:=all + DEPENDS:=+shadowsocksr-libev-alt +ipset +ip-full +iptables-mod-tproxy +dnsmasq-full +coreutils +coreutils-base64 +pdnsd-alt +wget +lua +microsocks +ipt2socks \ + +PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-redir \ + +PACKAGE_$(PKG_NAME)_INCLUDE_Simple_obfs:simple-obfs \ + +PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_plugin:v2ray-plugin \ + +PACKAGE_$(PKG_NAME)_INCLUDE_V2ray:v2ray \ + +PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:trojan \ + +PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2:redsocks2 \ + +PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:kcptun-client \ + +PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server:shadowsocksr-libev-server \ + +PACKAGE_$(PKG_NAME)_INCLUDE_DNS2SOCKS:dns2socks +endef + +define Build/Prepare +endef + +define Build/Compile +endef + +define Package/$(PKG_NAME)/conffiles +/etc/china_ssr.txt +/etc/config/shadowsocksr +/etc/config/white.list +/etc/config/black.list +/etc/dnsmasq.ssr/ad.conf +/etc/dnsmasq.ssr/gfw_list.conf +endef + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DATA) ./root/etc/china_ssr.txt $(1)/etc/china_ssr.txt + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./root/etc/config/shadowsocksr $(1)/etc/config/shadowsocksr + $(INSTALL_DATA) ./root/etc/config/*.list $(1)/etc/config/ + + $(INSTALL_DIR) $(1)/etc/dnsmasq.oversea + $(INSTALL_DATA) ./root/etc/dnsmasq.oversea/* $(1)/etc/dnsmasq.oversea/ + + $(INSTALL_DIR) $(1)/etc/dnsmasq.ssr + $(INSTALL_DATA) ./root/etc/dnsmasq.ssr/* $(1)/etc/dnsmasq.ssr/ + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./root/etc/init.d/* $(1)/etc/init.d/ + + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) ./root/etc/uci-defaults/* $(1)/etc/uci-defaults/ + + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) ./root/usr/bin/* $(1)/usr/bin/ + + $(INSTALL_DIR) $(1)/usr/share/shadowsocksr + $(INSTALL_BIN) ./root/usr/share/shadowsocksr/*.sh $(1)/usr/share/shadowsocksr/ + $(INSTALL_DATA) ./root/usr/share/shadowsocksr/*.lua $(1)/usr/share/shadowsocksr/ + + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller + $(INSTALL_DATA) ./luasrc/controller/*.lua $(1)/usr/lib/lua/luci/controller/ + + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/shadowsocksr + $(INSTALL_DATA) ./luasrc/model/cbi/shadowsocksr/*.lua $(1)/usr/lib/lua/luci/model/cbi/shadowsocksr/ + + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/shadowsocksr + $(INSTALL_DATA) ./luasrc/view/shadowsocksr/* $(1)/usr/lib/lua/luci/view/shadowsocksr/ + + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n + po2lmo ./po/zh-cn/ssr-plus.po $(1)/usr/lib/lua/luci/i18n/ssr-plus.zh-cn.lmo +endef + +define Package/$(PKG_NAME)/postinst +#!/bin/sh +if [ -z "$${IPKG_INSTROOT}" ]; then + ( . /etc/uci-defaults/luci-ssr-plus ) && rm -f /etc/uci-defaults/luci-ssr-plus + rm -f /tmp/luci-indexcache + /etc/init.d/shadowsocksr enable >/dev/null 2>&1 +fi +exit 0 +endef + +define Package/$(PKG_NAME)/prerm +#!/bin/sh +if [ -z "$${IPKG_INSTROOT}" ]; then + /etc/init.d/shadowsocksr disable + /etc/init.d/shadowsocksr stop +fi +exit 0 +endef + +define Package/$(PKG_NAME)/postrm +#!/bin/sh +rm -rf /etc/china_ssr.txt /etc/dnsmasq.ssr /etc/dnsmasq.oversea /etc/config/shadowsocksr /etc/config/black.list \ + /etc/config/gfw.list /etc/config/white.list >/dev/null 2>&1 +exit 0 +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/package/lean/luci-app-ssr-plus/luasrc/controller/shadowsocksr.lua b/package/lean/luci-app-ssr-plus/luasrc/controller/shadowsocksr.lua new file mode 100644 index 00000000000000..6d050bf4303620 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/luasrc/controller/shadowsocksr.lua @@ -0,0 +1,184 @@ +-- Copyright (C) 2017 yushi studio +-- Licensed to the public under the GNU General Public License v3. + +module("luci.controller.shadowsocksr", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/shadowsocksr") then + return + end + entry({"admin", "services", "shadowsocksr"}, alias("admin", "services", "shadowsocksr", "client"),_("ShadowSocksR Plus+"), 10).dependent = true + entry({"admin", "services", "shadowsocksr", "client"}, cbi("shadowsocksr/client"),_("SSR Client"), 10).leaf = true + entry({"admin", "services", "shadowsocksr", "servers"}, arcombine(cbi("shadowsocksr/servers", {autoapply=true}), cbi("shadowsocksr/client-config")),_("Severs Nodes"), 20).leaf = true + entry({"admin", "services", "shadowsocksr", "control"},cbi("shadowsocksr/control"), _("Access Control"), 30).leaf = true + entry({"admin", "services", "shadowsocksr", "advanced"},cbi("shadowsocksr/advanced"),_("Advanced Settings"), 50).leaf = true + if nixio.fs.access("/usr/bin/ssr-server") then + entry({"admin", "services", "shadowsocksr", "server"},arcombine(cbi("shadowsocksr/server"), cbi("shadowsocksr/server-config")),_("SSR Server"), 60).leaf = true + end + entry({"admin", "services", "shadowsocksr", "status"},form("shadowsocksr/status"),_("Status"), 70).leaf = true + entry({"admin", "services", "shadowsocksr", "check"}, call("check_status")) + entry({"admin", "services", "shadowsocksr", "refresh"}, call("refresh_data")) + entry({"admin", "services", "shadowsocksr", "subscribe"}, call("subscribe")) + entry({"admin", "services", "shadowsocksr", "checkport"}, call("check_port")) + entry({"admin", "services", "shadowsocksr", "log"},form("shadowsocksr/log"),_("Log"), 80).leaf = true + entry({"admin", "services", "shadowsocksr","run"},call("act_status")).leaf=true + entry({"admin", "services", "shadowsocksr", "ping"}, call("act_ping")).leaf=true +end + +function subscribe() + luci.sys.call("/usr/bin/lua /usr/share/shadowsocksr/subscribe.lua >> /tmp/ssrplus.log 2>&1") + luci.http.prepare_content("application/json") + luci.http.write_json({ ret = 1 }) +end + +function act_status() + local e={} + e.running=luci.sys.call("busybox ps -w | grep ssr-retcp | grep -v grep >/dev/null")==0 + luci.http.prepare_content("application/json") + luci.http.write_json(e) +end + +function act_ping() + local e = {} + local domain = luci.http.formvalue("domain") + local port = luci.http.formvalue("port") + e.index = luci.http.formvalue("index") + local iret = luci.sys.call(" ipset add ss_spec_wan_ac " .. domain .. " 2>/dev/null") + local socket = nixio.socket("inet", "stream") + socket:setopt("socket", "rcvtimeo", 3) + socket:setopt("socket", "sndtimeo", 3) + e.socket = socket:connect(domain, port) + socket:close() + e.ping = luci.sys.exec("ping -c 1 -W 1 %q 2>&1 | grep -o 'time=[0-9]*.[0-9]' | awk -F '=' '{print$2}'" % domain) + if (iret == 0) then + luci.sys.call(" ipset del ss_spec_wan_ac " .. domain) + end + luci.http.prepare_content("application/json") + luci.http.write_json(e) +end + +function check_status() + local set = "/usr/bin/ssr-check www." .. luci.http.formvalue("set") .. ".com 80 3 1" + sret = luci.sys.call(set) + if sret == 0 then + retstring ="0" + else + retstring ="1" + end + luci.http.prepare_content("application/json") + luci.http.write_json({ ret=retstring }) +end + +function refresh_data() +local set =luci.http.formvalue("set") +local icount =0 + +if set == "gfw_data" then + refresh_cmd="wget-ssl --no-check-certificate https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt -O /tmp/gfw.b64" + sret=luci.sys.call(refresh_cmd .. " 2>/dev/null") + if sret== 0 then + luci.sys.call("/usr/bin/ssr-gfw") + icount = luci.sys.exec("cat /tmp/gfwnew.txt | wc -l") + if tonumber(icount)>1000 then + oldcount=luci.sys.exec("cat /etc/dnsmasq.ssr/gfw_list.conf | wc -l") + if tonumber(icount) ~= tonumber(oldcount) then + luci.sys.exec("cp -f /tmp/gfwnew.txt /etc/dnsmasq.ssr/gfw_list.conf") + luci.sys.exec("cp -f /tmp/gfwnew.txt /tmp/dnsmasq.ssr/gfw_list.conf") + luci.sys.call("/etc/init.d/dnsmasq restart") + retstring=tostring(math.ceil(tonumber(icount)/2)) + else + retstring ="0" + end + else + retstring ="-1" + end + luci.sys.exec("rm -f /tmp/gfwnew.txt ") +else + retstring ="-1" +end +elseif set == "ip_data" then + if (luci.model.uci.cursor():get_first('shadowsocksr', 'global', 'chnroute', '0') == '1') then + refresh_cmd="wget-ssl --no-check-certificate -O - " .. luci.model.uci.cursor():get_first('shadowsocksr', 'global', 'chnroute_url', 'https://ispip.clang.cn/all_cn.txt') .. ' > /tmp/china_ssr.txt 2>/dev/null' + else + refresh_cmd="wget -O- 'http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest' 2>/dev/null| awk -F\\| '/CN\\|ipv4/ { printf(\"%s/%d\\n\", $4, 32-log($5)/log(2)) }' > /tmp/china_ssr.txt" + end + sret=luci.sys.call(refresh_cmd) + icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l") + if sret== 0 and tonumber(icount)>1000 then + oldcount=luci.sys.exec("cat /etc/china_ssr.txt | wc -l") + if tonumber(icount) ~= tonumber(oldcount) then + luci.sys.exec("cp -f /tmp/china_ssr.txt /etc/china_ssr.txt") + retstring=tostring(tonumber(icount)) + else + retstring ="0" + end + else + retstring ="-1" + end + luci.sys.exec("rm -f /tmp/china_ssr.txt ") +else +if nixio.fs.access("/usr/bin/wget-ssl") then + refresh_cmd="wget-ssl --no-check-certificate -O - ".. luci.model.uci.cursor():get_first('shadowsocksr', 'global', 'adblock_url','https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt') .." > /tmp/adnew.conf" +end +sret=luci.sys.call(refresh_cmd .. " 2>/dev/null") +if sret== 0 then + luci.sys.call("/usr/bin/ssr-ad") + icount = luci.sys.exec("cat /tmp/ad.conf | wc -l") + if tonumber(icount)>1000 then + if nixio.fs.access("/etc/dnsmasq.ssr/ad.conf") then + oldcount=luci.sys.exec("cat /etc/dnsmasq.ssr/ad.conf | wc -l") + else + oldcount=0 + end + if tonumber(icount) ~= tonumber(oldcount) then + luci.sys.exec("cp -f /tmp/ad.conf /etc/dnsmasq.ssr/ad.conf") + luci.sys.exec("cp -f /tmp/ad.conf /tmp/dnsmasq.ssr/ad.conf") + luci.sys.call("/etc/init.d/dnsmasq restart") + retstring=tostring(math.ceil(tonumber(icount))) + else + retstring ="0" + end + else + retstring ="-1" + end + luci.sys.exec("rm -f /tmp/ad.conf") +else + retstring ="-1" +end +end +luci.http.prepare_content("application/json") +luci.http.write_json({ ret=retstring ,retcount=icount}) +end + +function check_port() +local set="" +local retstring="

" +local s +local server_name = "" +local shadowsocksr = "shadowsocksr" +local uci = luci.model.uci.cursor() +local iret=1 +uci:foreach(shadowsocksr, "servers", function(s) + if s.alias then + server_name=s.alias + elseif s.server and s.server_port then + server_name= "%s:%s" %{s.server, s.server_port} + end + iret=luci.sys.call(" ipset add ss_spec_wan_ac " .. s.server .. " 2>/dev/null") + socket = nixio.socket("inet", "stream") + socket:setopt("socket", "rcvtimeo", 3) + socket:setopt("socket", "sndtimeo", 3) + ret=socket:connect(s.server,s.server_port) + if tostring(ret) == "true" then + socket:close() + retstring =retstring .. "[" .. server_name .. "] OK.
" + else + retstring =retstring .. "[" .. server_name .. "] Error.
" + end + if iret== 0 then + luci.sys.call(" ipset del ss_spec_wan_ac " .. s.server) + end +end) +luci.http.prepare_content("application/json") +luci.http.write_json({ ret=retstring }) +end diff --git a/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/advanced.lua b/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/advanced.lua new file mode 100644 index 00000000000000..8f2c63966944f6 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/advanced.lua @@ -0,0 +1,79 @@ + +m = Map("shadowsocksr") +-- [[ global ]]-- +s = m:section(TypedSection, "global", translate("Server failsafe auto swith and custom update settings")) +s.anonymous = true + +o = s:option(Flag, "monitor_enable", translate("Enable Process Deamon")) +o.rmempty = false +o.default = "1" + +o = s:option(Flag, "enable_switch", translate("Enable Auto Switch")) +o.rmempty = false +o.default = "1" + +o = s:option(Value, "switch_time", translate("Switch check cycly(second)")) +o.datatype = "uinteger" +o:depends("enable_switch", "1") +o.default = 667 + +o = s:option(Value, "switch_timeout", translate("Check timout(second)")) +o.datatype = "uinteger" +o:depends("enable_switch", "1") +o.default = 5 + +o = s:option(Value, "switch_try_count", translate("Check Try Count")) +o.datatype = "uinteger" +o:depends("enable_switch", "1") +o.default = 3 + +o = s:option(Flag, "chnroute", translate("Enable Custom Chnroute")) +o.rmempty = false + +o = s:option(Value, "chnroute_url", translate("Chnroute Update url")) +o.default = "https://ispip.clang.cn/all_cn.txt" +o:depends("chnroute", "1") + +o = s:option(Flag, "adblock", translate("Enable adblock")) +o.rmempty = false + +o = s:option(Value, "adblock_url", translate("adblock_url")) +o.default = "https://gitee.com/privacy-protection-tools/anti-ad/raw/master/anti-ad-for-dnsmasq.conf" +o:depends("adblock", "1") +o.description = translate("Support AdGuardHome and DNSMASQ format list") + +-- [[ SOCKS Proxy ]]-- +if nixio.fs.access("/usr/bin/microsocks") then +s = m:section(TypedSection, "socks5_proxy", translate("SOCKS5 Proxy Server Settings")) +s.anonymous = true + +o = s:option(Flag, "socks", translate("Enable SOCKS5 Proxy Server")) +o.rmempty = false + +o = s:option(Value, "local_port", translate("Local Port")) +o.datatype = "port" +o.default = 10800 +o.rmempty = true +o:depends("socks", "1") + +o = s:option(Flag, "auth_enable", translate("Enable Authentication")) +o.rmempty = false +o.default = "0" +o:depends("socks", "1") + +o = s:option(Value, "username", translate("Username")) +o.default = "username" +o:depends("auth_enable", "1") + +o = s:option(Value, "password", translate("Password")) +o.password = true +o.default = "password" +o:depends("auth_enable", "1") + +o = s:option(Flag, "wan_enable", translate("Enable WAN Access")) +o.rmempty = true +o.default = "0" +o:depends("auth_enable", "1") + +end +return m diff --git a/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua b/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua new file mode 100644 index 00000000000000..f42822f5806063 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua @@ -0,0 +1,500 @@ +-- Copyright (C) 2017 yushi studio github.com/ywb94 +-- Licensed to the public under the GNU General Public License v3. + +local m, s, o,kcp_enable +local shadowsocksr = "shadowsocksr" +local uci = luci.model.uci.cursor() +local fs = require "nixio.fs" +local sys = require "luci.sys" +local sid = arg[1] +local uuid = luci.sys.exec("cat /proc/sys/kernel/random/uuid") +local http = require "luci.http" + +local function isKcptun(file) + if not fs.access(file, "rwx", "rx", "rx") then + fs.chmod(file, 755) + end + + local str = sys.exec(file .. " -v | awk '{printf $1}'") + return (str:lower() == "kcptun") +end + + +local server_table = {} +local encrypt_methods = { + "none", + "table", + "rc4", + "rc4-md5-6", + "rc4-md5", + "aes-128-cfb", + "aes-192-cfb", + "aes-256-cfb", + "aes-128-ctr", + "aes-192-ctr", + "aes-256-ctr", + "bf-cfb", + "camellia-128-cfb", + "camellia-192-cfb", + "camellia-256-cfb", + "cast5-cfb", + "des-cfb", + "idea-cfb", + "rc2-cfb", + "seed-cfb", + "salsa20", + "chacha20", + "chacha20-ietf", +} + +local encrypt_methods_ss = { + -- aead + "aes-128-gcm", + "aes-192-gcm", + "aes-256-gcm", + "chacha20-ietf-poly1305", + "xchacha20-ietf-poly1305", + -- stream + "table", + "rc4", + "rc4-md5", + "aes-128-cfb", + "aes-192-cfb", + "aes-256-cfb", + "aes-128-ctr", + "aes-192-ctr", + "aes-256-ctr", + "bf-cfb", + "camellia-128-cfb", + "camellia-192-cfb", + "camellia-256-cfb", + "salsa20", + "chacha20", + "chacha20-ietf", +} + +local protocol = { + "origin", + "verify_deflate", + "auth_sha1_v4", + "auth_aes128_sha1", + "auth_aes128_md5", + "auth_chain_a", + "auth_chain_b", + "auth_chain_c", + "auth_chain_d", + "auth_chain_e", + "auth_chain_f", +} + +obfs = { + "plain", + "http_simple", + "http_post", + "random_head", + "tls1.2_ticket_auth", +} + +local securitys = { + "auto", + "none", + "aes-128-gcm", + "chacha20-poly1305" +} + + +m = Map(shadowsocksr, translate("Edit ShadowSocksR Server")) +m.redirect = luci.dispatcher.build_url("admin/services/shadowsocksr/servers") +if m.uci:get(shadowsocksr, sid) ~= "servers" then + luci.http.redirect(m.redirect) + return +end + +-- [[ Servers Setting ]]-- +s = m:section(NamedSection, sid, "servers") +s.anonymous = true +s.addremove = false + +o = s:option(DummyValue,"ssr_url","SS/SSR/V2RAY/TROJAN URL") +o.rawhtml = true +o.template = "shadowsocksr/ssrurl" +o.value =sid + +o = s:option(ListValue, "type", translate("Server Node Type")) +o:value("ssr", translate("ShadowsocksR")) +if nixio.fs.access("/usr/bin/ss-redir") then +o:value("ss", translate("Shadowsocks New Version")) +end +if nixio.fs.access("/usr/bin/v2ray/v2ray") or nixio.fs.access("/usr/bin/v2ray") then +o:value("v2ray", translate("V2Ray")) +end +if nixio.fs.access("/usr/sbin/trojan") then +o:value("trojan", translate("Trojan")) +end +if nixio.fs.access("/usr/sbin/redsocks2") then +o:value("socks5", translate("Socks5")) +o:value("tun", translate("Network Tunnel")) +end +o.description = translate("Using incorrect encryption mothod may causes service fail to start") + +o = s:option(Value, "alias", translate("Alias(optional)")) + +o = s:option(ListValue, "iface", translate("Network interface to use")) +for _, e in ipairs(sys.net.devices()) do + if e ~= "lo" then o:value(e) end +end +o:depends("type", "tun") +o.description = translate("Redirect traffic to this network interface") + +o = s:option(Value, "server", translate("Server Address")) +o.datatype = "host" +o.rmempty = false +o:depends("type", "ssr") +o:depends("type", "ss") +o:depends("type", "v2ray") +o:depends("type", "trojan") +o:depends("type", "socks5") + +o = s:option(Value, "server_port", translate("Server Port")) +o.datatype = "port" +o.rmempty = false +o:depends("type", "ssr") +o:depends("type", "ss") +o:depends("type", "v2ray") +o:depends("type", "trojan") +o:depends("type", "socks5") + +o = s:option(Flag, "auth_enable", translate("Enable Authentication")) +o.rmempty = false +o.default = "0" +o:depends("type", "socks5") + +o = s:option(Value, "username", translate("Username")) +o.rmempty = true +o:depends("type", "socks5") + +o = s:option(Value, "password", translate("Password")) +o.password = true +o.rmempty = true +o:depends("type", "ssr") +o:depends("type", "ss") +o:depends("type", "trojan") +o:depends("type", "socks5") + +o = s:option(ListValue, "encrypt_method", translate("Encrypt Method")) +for _, v in ipairs(encrypt_methods) do o:value(v) end +o.rmempty = true +o:depends("type", "ssr") + +o = s:option(ListValue, "encrypt_method_ss", translate("Encrypt Method")) +for _, v in ipairs(encrypt_methods_ss) do o:value(v) end +o.rmempty = true +o:depends("type", "ss") + +-- Shadowsocks Plugin +o = s:option(Value, "plugin", translate("Plugin")) +o.rmempty = true +o:depends("type", "ss") + +o = s:option(Value, "plugin_opts", translate("Plugin Opts")) +o.rmempty = true +o:depends("type", "ss") + +o = s:option(ListValue, "protocol", translate("Protocol")) +for _, v in ipairs(protocol) do o:value(v) end +o.rmempty = true +o:depends("type", "ssr") + +o = s:option(Value, "protocol_param", translate("Protocol param(optional)")) +o:depends("type", "ssr") + +o = s:option(ListValue, "obfs", translate("Obfs")) +for _, v in ipairs(obfs) do o:value(v) end +o.rmempty = true +o:depends("type", "ssr") + +o = s:option(Value, "obfs_param", translate("Obfs param(optional)")) +o:depends("type", "ssr") + +-- AlterId +o = s:option(Value, "alter_id", translate("AlterId")) +o.datatype = "port" +o.default = 16 +o.rmempty = true +o:depends("type", "v2ray") + +-- VmessId +o = s:option(Value, "vmess_id", translate("VmessId (UUID)")) +o.rmempty = true +o.default = uuid +o:depends("type", "v2ray") + +-- 加密方式 +o = s:option(ListValue, "security", translate("Encrypt Method")) +for _, v in ipairs(securitys) do o:value(v, v:upper()) end +o.rmempty = true +o:depends("type", "v2ray") + +-- 传输协议 +o = s:option(ListValue, "transport", translate("Transport")) +o:value("tcp", "TCP") +o:value("kcp", "mKCP") +o:value("ws", "WebSocket") +o:value("h2", "HTTP/2") +o:value("quic", "QUIC") +o.rmempty = true +o:depends("type", "v2ray") + +-- [[ TCP部分 ]]-- + +-- TCP伪装 +o = s:option(ListValue, "tcp_guise", translate("Camouflage Type")) +o:depends("transport", "tcp") +o:value("http", "HTTP") +o:value("none", translate("None")) +o.rmempty = true + +-- HTTP域名 +o = s:option(Value, "http_host", translate("HTTP Host")) +o:depends("tcp_guise", "http") +o.rmempty = true + +-- HTTP路径 +o = s:option(Value, "http_path", translate("HTTP Path")) +o:depends("tcp_guise", "http") +o.rmempty = true + +-- [[ WS部分 ]]-- + +-- WS域名 +o = s:option(Value, "ws_host", translate("WebSocket Host")) +o:depends("transport", "ws") +o.rmempty = true + +-- WS路径 +o = s:option(Value, "ws_path", translate("WebSocket Path")) +o:depends("transport", "ws") +o.rmempty = true + +-- [[ H2部分 ]]-- + +-- H2域名 +o = s:option(Value, "h2_host", translate("HTTP/2 Host")) +o:depends("transport", "h2") +o.rmempty = true + +-- H2路径 +o = s:option(Value, "h2_path", translate("HTTP/2 Path")) +o:depends("transport", "h2") +o.rmempty = true + +-- [[ QUIC部分 ]]-- + +o = s:option(ListValue, "quic_security", translate("QUIC Security")) +o:depends("transport", "quic") +o.rmempty = true +o:value("none", translate("None")) +o:value("aes-128-gcm", translate("aes-128-gcm")) +o:value("chacha20-poly1305", translate("chacha20-poly1305")) + +o = s:option(Value, "quic_key", translate("QUIC Key")) +o:depends("transport", "quic") +o.rmempty = true + +o = s:option(ListValue, "quic_guise", translate("Header")) +o:depends("transport", "quic") +o.rmempty = true +o:value("none", translate("None")) +o:value("srtp", translate("VideoCall (SRTP)")) +o:value("utp", translate("BitTorrent (uTP)")) +o:value("wechat-video", translate("WechatVideo")) +o:value("dtls", "DTLS 1.2") +o:value("wireguard", "WireGuard") + +-- [[ mKCP部分 ]]-- + +o = s:option(ListValue, "kcp_guise", translate("Camouflage Type")) +o:depends("transport", "kcp") +o:value("none", translate("None")) +o:value("srtp", translate("VideoCall (SRTP)")) +o:value("utp", translate("BitTorrent (uTP)")) +o:value("wechat-video", translate("WechatVideo")) +o:value("dtls", "DTLS 1.2") +o:value("wireguard", "WireGuard") +o.rmempty = true + +o = s:option(Value, "mtu", translate("MTU")) +o.datatype = "uinteger" +o:depends("transport", "kcp") +o.default = 1350 +o.rmempty = true + +o = s:option(Value, "tti", translate("TTI")) +o.datatype = "uinteger" +o:depends("transport", "kcp") +o.default = 50 +o.rmempty = true + +o = s:option(Value, "uplink_capacity", translate("Uplink Capacity")) +o.datatype = "uinteger" +o:depends("transport", "kcp") +o.default = 5 +o.rmempty = true + +o = s:option(Value, "downlink_capacity", translate("Downlink Capacity")) +o.datatype = "uinteger" +o:depends("transport", "kcp") +o.default = 20 +o.rmempty = true + +o = s:option(Value, "read_buffer_size", translate("Read Buffer Size")) +o.datatype = "uinteger" +o:depends("transport", "kcp") +o.default = 2 +o.rmempty = true + +o = s:option(Value, "write_buffer_size", translate("Write Buffer Size")) +o.datatype = "uinteger" +o:depends("transport", "kcp") +o.default = 2 +o.rmempty = true + +o = s:option(Flag, "congestion", translate("Congestion")) +o:depends("transport", "kcp") +o.rmempty = true + +-- [[ allowInsecure ]]-- +o = s:option(Flag, "insecure", translate("allowInsecure")) +o.rmempty = true +o:depends("type", "v2ray") +o:depends("type", "trojan") +o.default = "1" + +-- [[ TLS ]]-- +o = s:option(Flag, "tls", translate("TLS")) +o.rmempty = true +o.default = "0" +o:depends("type", "v2ray") +o:depends("type", "trojan") + +o = s:option(Value, "tls_host", translate("TLS Host")) +--o:depends("type", "trojan") +o:depends("tls", "1") +o.rmempty = true + +-- [[ Mux ]]-- +o = s:option(Flag, "mux", translate("Mux")) +o.rmempty = true +o.default = "0" +o:depends("type", "v2ray") + +o = s:option(Value, "concurrency", translate("Concurrency")) +o.datatype = "uinteger" +o.rmempty = true +o.default = "8" +o:depends("mux", "1") + +-- [[ Cert ]]-- +o = s:option(Flag, "certificate", translate("Self-signed Certificate")) +o.rmempty = true +o.default = "0" +o:depends("type", "trojan") +o:depends("type", "v2ray") +o.description = translate("If you have a self-signed certificate,please check the box") + +o = s:option(DummyValue, "upload", translate("Upload")) +o.template = "shadowsocksr/certupload" +o:depends("certificate", 1) + +cert_dir = "/etc/ssl/private/" +local path + +http.setfilehandler( + function(meta, chunk, eof) + if not fd then + if (not meta) or (not meta.name) or (not meta.file) then return end + fd = nixio.open(cert_dir .. meta.file, "w") + if not fd then + path = translate("Create upload file error.") + return + end + end + if chunk and fd then + fd:write(chunk) + end + if eof and fd then + fd:close() + fd = nil + path = '/etc/ssl/private/' .. meta.file .. '' + end + end + ) +if luci.http.formvalue("upload") then + local f = luci.http.formvalue("ulfile") + if #f <= 0 then + path = translate("No specify upload file.") + end +end + +o = s:option(Value, "certpath", translate("Current Certificate Path")) +o:depends("certificate", 1) +o:value("/etc/ssl/private/") +o.description = translate("Please confirm the current certificate path") +o.default = "/etc/ssl/private/" + +o = s:option(Flag, "fast_open", translate("TCP Fast Open")) +o.rmempty = true +o.default = "0" +o:depends("type", "ssr") +o:depends("type", "ss") +o:depends("type", "trojan") + +o = s:option(Flag, "switch_enable", translate("Enable Auto Switch")) +o.rmempty = false +o.default = "1" + +o = s:option(Value, "local_port", translate("Local Port")) +o.datatype = "port" +o.default = 1234 +o.rmempty = false + +if nixio.fs.access("/usr/bin/kcptun-client") then + +kcp_enable = s:option(Flag, "kcp_enable", translate("KcpTun Enable"), translate("bin:/usr/bin/kcptun-client")) +kcp_enable.rmempty = true +kcp_enable.default = "0" +kcp_enable:depends("type", "ssr") +kcp_enable:depends("type", "ss") + +o = s:option(Value, "kcp_port", translate("KcpTun Port")) +o.datatype = "port" +o.default = 4000 +function o.validate(self, value, section) + local kcp_file="/usr/bin/kcptun-client" + local enable = kcp_enable:formvalue(section) or kcp_enable.disabled + if enable == kcp_enable.enabled then + if not fs.access(kcp_file) then + return nil, translate("Haven't a Kcptun executable file") + elseif not isKcptun(kcp_file) then + return nil, translate("Not a Kcptun executable file") + end + end + + return value +end +o:depends("type", "ssr") +o:depends("type", "ss") + +o = s:option(Value, "kcp_password", translate("KcpTun Password")) +o.password = true +o:depends("type", "ssr") +o:depends("type", "ss") + +o = s:option(Value, "kcp_param", translate("KcpTun Param")) +o.default = "--nocomp" +o:depends("type", "ssr") +o:depends("type", "ss") + +end + +return m diff --git a/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client.lua b/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client.lua new file mode 100644 index 00000000000000..5e6ededd9a5497 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client.lua @@ -0,0 +1,97 @@ +-- Copyright (C) 2017 yushi studio github.com/ywb94 +-- Copyright (C) 2018 lean github.com/coolsnowwolf +-- Licensed to the public under the GNU General Public License v3. + +local m, s, sec, o, kcp_enable +local shadowsocksr = "shadowsocksr" +local uci = luci.model.uci.cursor() + +local sys = require "luci.sys" + +m = Map(shadowsocksr, translate("ShadowSocksR Plus+ Settings")) + +m:section(SimpleSection).template = "shadowsocksr/status" + +local server_table = {} +uci:foreach(shadowsocksr, "servers", function(s) + if s.alias then + server_table[s[".name"]] = "[%s]:%s" %{string.upper(s.type), s.alias} + elseif s.server and s.server_port then + server_table[s[".name"]] = "[%s]:%s:%s" %{string.upper(s.type), s.server, s.server_port} + end +end) + +local key_table = {} +for key,_ in pairs(server_table) do + table.insert(key_table,key) +end + +table.sort(key_table) + +-- [[ Global Setting ]]-- +s = m:section(TypedSection, "global") +s.anonymous = true + +o = s:option(ListValue, "global_server", translate("Main Server")) +o:value("nil", translate("Disable")) +for _,key in pairs(key_table) do o:value(key,server_table[key]) end +o.default = "nil" +o.rmempty = false + +o = s:option(ListValue, "udp_relay_server", translate("Game Mode UDP Server")) +o:value("", translate("Disable")) +o:value("same", translate("Same as Global Server")) +for _,key in pairs(key_table) do o:value(key,server_table[key]) end + +o = s:option(ListValue, "threads", translate("Multi Threads Option")) +o:value("0", translate("Auto Threads")) +o:value("1", translate("1 Thread")) +o:value("2", translate("2 Threads")) +o:value("4", translate("4 Threads")) +o:value("8", translate("8 Threads")) +o:value("16", translate("16 Threads")) +o:value("32", translate("32 Threads")) +o:value("64", translate("64 Threads")) +o:value("128", translate("128 Threads")) +o.default = "0" +o.rmempty = false + +o = s:option(ListValue, "run_mode", translate("Running Mode")) +o:value("gfw", translate("GFW List Mode")) +o:value("router", translate("IP Route Mode")) +o:value("all", translate("Global Mode")) +o:value("oversea", translate("Oversea Mode")) +o.default = gfw + +o = s:option(ListValue, "dports", translate("Proxy Ports")) +o:value("1", translate("All Ports")) +o:value("2", translate("Only Common Ports")) +o.default = 1 + +o = s:option(ListValue, "pdnsd_enable", translate("Resolve Dns Mode")) +o:value("1", translate("Use Pdnsd tcp query and cache")) +if nixio.fs.access("/usr/bin/dns2socks") then +o:value("2", translate("Use DNS2SOCKS query and cache")) +end +o:value("0", translate("Use Local DNS Service listen port 5335")) +o.default = 1 + +o = s:option(Value, "tunnel_forward", translate("Anti-pollution DNS Server")) +o:value("8.8.4.4:53", translate("Google Public DNS (8.8.4.4)")) +o:value("8.8.8.8:53", translate("Google Public DNS (8.8.8.8)")) +o:value("208.67.222.222:53", translate("OpenDNS (208.67.222.222)")) +o:value("208.67.220.220:53", translate("OpenDNS (208.67.220.220)")) +o:value("209.244.0.3:53", translate("Level 3 Public DNS (209.244.0.3)")) +o:value("209.244.0.4:53", translate("Level 3 Public DNS (209.244.0.4)")) +o:value("4.2.2.1:53", translate("Level 3 Public DNS (4.2.2.1)")) +o:value("4.2.2.2:53", translate("Level 3 Public DNS (4.2.2.2)")) +o:value("4.2.2.3:53", translate("Level 3 Public DNS (4.2.2.3)")) +o:value("4.2.2.4:53", translate("Level 3 Public DNS (4.2.2.4)")) +o:value("1.1.1.1:53", translate("Cloudflare DNS (1.1.1.1)")) +o:value("114.114.114.114:53", translate("Oversea Mode DNS-1 (114.114.114.114)")) +o:value("114.114.115.115:53", translate("Oversea Mode DNS-2 (114.114.115.115)")) +o:depends("pdnsd_enable", "1") +o:depends("pdnsd_enable", "2") +o.description = translate("Custom DNS Server format as IP:PORT (default: 8.8.4.4:53)") + +return m diff --git a/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/control.lua b/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/control.lua new file mode 100644 index 00000000000000..91cf55d756908e --- /dev/null +++ b/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/control.lua @@ -0,0 +1,104 @@ +local m, s, o +local NXFS = require "nixio.fs" + +m = Map("shadowsocksr", translate("IP black-and-white list")) + +s = m:section(TypedSection, "access_control") +s.anonymous = true + +-- Part of WAN +s:tab("wan_ac", translate("WAN IP AC")) + +o = s:taboption("wan_ac", DynamicList, "wan_bp_ips", translate("WAN White List IP")) +o.datatype = "ip4addr" + +o = s:taboption("wan_ac", DynamicList, "wan_fw_ips", translate("WAN Force Proxy IP")) +o.datatype = "ip4addr" + +-- Part of LAN +s:tab("lan_ac", translate("LAN IP AC")) + +o = s:taboption("lan_ac", ListValue, "lan_ac_mode", translate("LAN Access Control")) +o:value("0", translate("Disable")) +o:value("w", translate("Allow listed only")) +o:value("b", translate("Allow all except listed")) +o.rmempty = false + +o = s:taboption("lan_ac", DynamicList, "lan_ac_ips", translate("LAN Host List")) +o.datatype = "ipaddr" +luci.ip.neighbors({ family = 4 }, function(entry) + if entry.reachable then + o:value(entry.dest:string()) + end +end) +o:depends("lan_ac_mode", "w") +o:depends("lan_ac_mode", "b") + +o = s:taboption("lan_ac", DynamicList, "lan_bp_ips", translate("LAN Bypassed Host List")) +o.datatype = "ipaddr" +luci.ip.neighbors({ family = 4 }, function(entry) + if entry.reachable then + o:value(entry.dest:string()) + end +end) + +o = s:taboption("lan_ac", DynamicList, "lan_fp_ips", translate("LAN Force Proxy Host List")) +o.datatype = "ipaddr" +luci.ip.neighbors({ family = 4 }, function(entry) + if entry.reachable then + o:value(entry.dest:string()) + end +end) + +o = s:taboption("lan_ac", DynamicList, "lan_gm_ips", translate("Game Mode Host List")) +o.datatype = "ipaddr" +luci.ip.neighbors({ family = 4 }, function(entry) + if entry.reachable then + o:value(entry.dest:string()) + end +end) + +-- Part of Self +-- s:tab("self_ac", translate("Router Self AC")) +-- o = s:taboption("self_ac",ListValue, "router_proxy", translate("Router Self Proxy")) +-- o:value("1", translatef("Normal Proxy")) +-- o:value("0", translatef("Bypassed Proxy")) +-- o:value("2", translatef("Forwarded Proxy")) +-- o.rmempty = false + +s:tab("esc", translate("Bypass Domain List")) + +local escconf = "/etc/config/white.list" +o = s:taboption("esc", TextValue, "escconf") +o.rows = 13 +o.wrap = "off" +o.rmempty = true +o.cfgvalue = function(self, section) + return NXFS.readfile(escconf) or "" +end +o.write = function(self, section, value) + NXFS.writefile(escconf, value:gsub("\r\n", "\n")) +end +o.remove = function(self, section, value) + NXFS.writefile(escconf, "") +end + + +s:tab("block", translate("Black Domain List")) + +local blockconf = "/etc/config/black.list" +o = s:taboption("block", TextValue, "blockconf") +o.rows = 13 +o.wrap = "off" +o.rmempty = true +o.cfgvalue = function(self, section) + return NXFS.readfile(blockconf) or " " +end +o.write = function(self, section, value) + NXFS.writefile(blockconf, value:gsub("\r\n", "\n")) +end +o.remove = function(self, section, value) + NXFS.writefile(blockconf, "") +end + +return m diff --git a/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/log.lua b/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/log.lua new file mode 100644 index 00000000000000..7492bd1878d4f4 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/log.lua @@ -0,0 +1,17 @@ +f = SimpleForm("logview") +f.reset = false +f.submit = false +t = f:field(TextValue, "conf") +t.rmempty = true +t.rows = 20 +function t.cfgvalue() +local logs = luci.util.execi("cat /tmp/ssrplus.log") +local s = "" +for line in logs do +s = line .. "\n" .. s +end +return s +end +t.readonly="readonly" + +return f diff --git a/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/server-config.lua b/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/server-config.lua new file mode 100644 index 00000000000000..c1c29373da2d36 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/server-config.lua @@ -0,0 +1,95 @@ +-- Copyright (C) 2017 yushi studio +-- Licensed to the public under the GNU General Public License v3. + +local m, s, o +local shadowsocksr = "shadowsocksr" +local sid = arg[1] + +local encrypt_methods = { + "rc4-md5", + "rc4-md5-6", + "rc4", + "table", + "aes-128-cfb", + "aes-192-cfb", + "aes-256-cfb", + "aes-128-ctr", + "aes-192-ctr", + "aes-256-ctr", + "bf-cfb", + "camellia-128-cfb", + "camellia-192-cfb", + "camellia-256-cfb", + "cast5-cfb", + "des-cfb", + "idea-cfb", + "rc2-cfb", + "seed-cfb", + "salsa20", + "chacha20", + "chacha20-ietf", +} + +local protocol = { + "origin", +} + +obfs = { + "plain", + "http_simple", + "http_post", +} + +m = Map(shadowsocksr, translate("Edit ShadowSocksR Server")) + +m.redirect = luci.dispatcher.build_url("admin/services/shadowsocksr/server") +if m.uci:get(shadowsocksr, sid) ~= "server_config" then + luci.http.redirect(m.redirect) + return +end + + + + +-- [[ Server Setting ]]-- +s = m:section(NamedSection, sid, "server_config") +s.anonymous = true +s.addremove = false + +o = s:option(Flag, "enable", translate("Enable")) +o.default = 1 +o.rmempty = false + +o = s:option(Value, "server_port", translate("Server Port")) +o.datatype = "port" +o.default = 8388 +o.rmempty = false + +o = s:option(Value, "timeout", translate("Connection Timeout")) +o.datatype = "uinteger" +o.default = 60 +o.rmempty = false + +o = s:option(Value, "password", translate("Password")) +o.password = true +o.rmempty = false + +o = s:option(ListValue, "encrypt_method", translate("Encrypt Method")) +for _, v in ipairs(encrypt_methods) do o:value(v) end +o.rmempty = false + +o = s:option(ListValue, "protocol", translate("Protocol")) +for _, v in ipairs(protocol) do o:value(v) end +o.rmempty = false + + +o = s:option(ListValue, "obfs", translate("Obfs")) +for _, v in ipairs(obfs) do o:value(v) end +o.rmempty = false + +o = s:option(Value, "obfs_param", translate("Obfs param(optional)")) + +o = s:option(Flag, "fast_open", translate("TCP Fast Open")) +o.rmempty = false + +return m diff --git a/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/server.lua b/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/server.lua new file mode 100644 index 00000000000000..af00e96e599ce9 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/server.lua @@ -0,0 +1,102 @@ +-- Copyright (C) 2017 yushi studio +-- Licensed to the public under the GNU General Public License v3. + +local m, sec, o +local shadowsocksr = "shadowsocksr" +local uci = luci.model.uci.cursor() + + +m = Map(shadowsocksr, translate("ShadowSocksR Server")) + +local encrypt_methods = { + "table", + "rc4", + "rc4-md5", + "rc4-md5-6", + "aes-128-cfb", + "aes-192-cfb", + "aes-256-cfb", + "aes-128-ctr", + "aes-192-ctr", + "aes-256-ctr", + "bf-cfb", + "camellia-128-cfb", + "camellia-192-cfb", + "camellia-256-cfb", + "cast5-cfb", + "des-cfb", + "idea-cfb", + "rc2-cfb", + "seed-cfb", + "salsa20", + "chacha20", + "chacha20-ietf", +} + +local protocol = { + "origin", + "verify_deflate", + "auth_sha1_v4", + "auth_aes128_sha1", + "auth_aes128_md5", + "auth_chain_a", +} + +obfs = { + "plain", + "http_simple", + "http_post", + "random_head", + "tls1.2_ticket_auth", + "tls1.2_ticket_fastauth", +} + +-- [[ Global Setting ]]-- +sec = m:section(TypedSection, "server_global", translate("Global Setting")) +sec.anonymous = true + +o = sec:option(Flag, "enable_server", translate("Enable Server")) +o.rmempty = false + +-- [[ Server Setting ]]-- +sec = m:section(TypedSection, "server_config", translate("Server Setting")) +sec.anonymous = true +sec.addremove = true +sec.template = "cbi/tblsection" +sec.extedit = luci.dispatcher.build_url("admin/services/shadowsocksr/server/%s") +function sec.create(...) + local sid = TypedSection.create(...) + if sid then + luci.http.redirect(sec.extedit % sid) + return + end +end + +o = sec:option(Flag, "enable", translate("Enable")) +function o.cfgvalue(...) + return Value.cfgvalue(...) or translate("0") +end +o.rmempty = false + +o = sec:option(DummyValue, "server_port", translate("Server Port")) +function o.cfgvalue(...) + return Value.cfgvalue(...) or "?" +end + +o = sec:option(DummyValue, "encrypt_method", translate("Encrypt Method")) +function o.cfgvalue(...) + local v = Value.cfgvalue(...) + return v and v:upper() or "?" +end + +o = sec:option(DummyValue, "protocol", translate("Protocol")) +function o.cfgvalue(...) + return Value.cfgvalue(...) or "?" +end + +o = sec:option(DummyValue, "obfs", translate("Obfs")) +function o.cfgvalue(...) + return Value.cfgvalue(...) or "?" +end + +return m diff --git a/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/servers.lua b/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/servers.lua new file mode 100644 index 00000000000000..ce3c05b6890da5 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/servers.lua @@ -0,0 +1,123 @@ +-- Licensed to the public under the GNU General Public License v3. + +local m, s, o +local shadowsocksr = "shadowsocksr" + +local uci = luci.model.uci.cursor() +local server_count = 0 +uci:foreach("shadowsocksr", "servers", function(s) + server_count = server_count + 1 +end) + +local fs = require "nixio.fs" +local sys = require "luci.sys" + +m = Map(shadowsocksr, translate("Servers subscription and manage")) + +-- Server Subscribe + +s = m:section(TypedSection, "server_subscribe") +s.anonymous = true + +o = s:option(Flag, "auto_update", translate("Auto Update")) +o.rmempty = false +o.description = translate("Auto Update Server subscription, GFW list and CHN route") + + +o = s:option(ListValue, "auto_update_time", translate("Update time (every day)")) +for t = 0,23 do +o:value(t, t..":00") +end +o.default=2 +o.rmempty = false + +o = s:option(DynamicList, "subscribe_url", translate("Subscribe URL")) +o.rmempty = true + +o = s:option(Button,"update_Sub",translate("Update Subscribe List")) +o.inputstyle = "reload" +o.description = translate("Update subscribe url list first") +o.write = function() + luci.http.redirect(luci.dispatcher.build_url("admin", "services", "shadowsocksr", "servers")) +end + +o = s:option(Flag, "switch", translate("Subscribe Default Auto-Switch")) +o.rmempty = false +o.description = translate("Subscribe new add server default Auto-Switch on") +o.default="1" + +o = s:option(Flag, "proxy", translate("Through proxy update")) +o.rmempty = false +o.description = translate("Through proxy update list, Not Recommended ") + + +o = s:option(Button,"subscribe", translate("Update All Subscribe Severs")) +o.rawhtml = true +o.template = "shadowsocksr/subscribe" + +o = s:option(Button,"delete",translate("Delete All Subscribe Severs")) +o.inputstyle = "reset" +o.description = string.format(translate("Server Count") .. ": %d", server_count) +o.write = function() +uci:delete_all("shadowsocksr", "servers", function(s) + if s.hashkey or s.isSubscribe then + return true + else + return false + end +end) +uci:save("shadowsocksr") +uci:commit("shadowsocksr") +luci.sys.init.stop("shadowsocksr") +luci.sys.init.start("shadowsocksr") +luci.http.redirect(luci.dispatcher.build_url("admin", "services", "shadowsocksr", "servers")) +return +end + +-- [[ Servers Manage ]]-- +s = m:section(TypedSection, "servers") +s.anonymous = true +s.addremove = true +s.sortable = false +s.template = "cbi/tblsection" +s.sortable = true +s.extedit = luci.dispatcher.build_url("admin/services/shadowsocksr/servers/%s") +function s.create(...) + local sid = TypedSection.create(...) + if sid then + luci.http.redirect(s.extedit % sid) + return + end +end + +o = s:option(DummyValue, "type", translate("Type")) +function o.cfgvalue(...) + return Value.cfgvalue(...) or translate("") +end + +o = s:option(DummyValue, "alias", translate("Alias")) +function o.cfgvalue(...) + return Value.cfgvalue(...) or translate("None") +end + +o = s:option(DummyValue, "server_port", translate("Server Port")) +function o.cfgvalue(...) + return Value.cfgvalue(...) or "N/A" +end + +o = s:option(DummyValue, "switch_enable", translate("Auto Switch")) +function o.cfgvalue(...) + return Value.cfgvalue(...) or "1" +end + +o = s:option(DummyValue, "server_port", translate("Socket Connected")) +o.template="shadowsocksr/socket" +o.width="10%" + +o = s:option(DummyValue, "server", translate("Ping Latency")) +o.template="shadowsocksr/ping" +o.width="10%" + +m:append(Template("shadowsocksr/server_list")) + +return m diff --git a/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/status.lua b/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/status.lua new file mode 100644 index 00000000000000..e276bb5a9db435 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/status.lua @@ -0,0 +1,183 @@ +-- Copyright (C) 2017 yushi studio +-- Licensed to the public under the GNU General Public License v3. + +local IPK_Version="3.0.9" +local m, s, o +local redir_run=0 +local reudp_run=0 +local sock5_run=0 +local server_run=0 +local kcptun_run=0 +local tunnel_run=0 +local udp2raw_run=0 +local udpspeeder_run=0 +local gfw_count=0 +local ad_count=0 +local ip_count=0 +local ucic = luci.model.uci.cursor() +local shadowsocksr = "shadowsocksr" +-- html constants +font_blue = [[]] +font_off = [[]] +bold_on = [[]] +bold_off = [[]] + +local fs = require "nixio.fs" +local sys = require "luci.sys" +local kcptun_version=translate("Unknown") +local kcp_file="/usr/bin/kcptun-client" +if not fs.access(kcp_file) then +kcptun_version=translate("Not exist") +else +if not fs.access(kcp_file, "rwx", "rx", "rx") then +fs.chmod(kcp_file, 755) +end +kcptun_version=sys.exec(kcp_file .. " -v | awk '{printf $3}'") +if not kcptun_version or kcptun_version == "" then +kcptun_version = translate("Unknown") +end + +end + +if nixio.fs.access("/etc/dnsmasq.ssr/gfw_list.conf") then +gfw_count = tonumber(sys.exec("cat /etc/dnsmasq.ssr/gfw_list.conf | wc -l"))/2 +end + +if nixio.fs.access("/etc/dnsmasq.ssr/ad.conf") then +ad_count=tonumber(sys.exec("cat /etc/dnsmasq.ssr/ad.conf | wc -l")) +end + +if nixio.fs.access("/etc/china_ssr.txt") then +ip_count = sys.exec("cat /etc/china_ssr.txt | wc -l") +end + +local icount=sys.exec("busybox ps -w | grep ssr-reudp |grep -v grep| wc -l") +if tonumber(icount)>0 then +reudp_run=1 +else +icount=sys.exec("busybox ps -w | grep ssr-retcp |grep \"\\-u\"|grep -v grep| wc -l") +if tonumber(icount)>0 then +reudp_run=1 +end +end + +if luci.sys.call("busybox ps -w | grep ssr-retcp | grep -v grep >/dev/null") == 0 then +redir_run=1 +end + +if luci.sys.call("busybox ps -w | grep ssr-socks | grep -v grep >/dev/null") == 0 then +sock5_run=1 +end + +if luci.sys.call("pidof kcptun-client >/dev/null") == 0 then +kcptun_run=1 +end + +if luci.sys.call("pidof ssr-server >/dev/null") == 0 then +server_run=1 +end + +if luci.sys.call("busybox ps -w | grep ssr-tunnel |grep -v grep >/dev/null") == 0 then +tunnel_run=1 +end + +if luci.sys.call("pidof pdnsd >/dev/null") == 0 or (luci.sys.call("busybox ps -w | grep ssr-dns |grep -v grep >/dev/null") == 0 and luci.sys.call("pidof dns2socks >/dev/null") == 0)then +pdnsd_run=1 +end + +m = SimpleForm("Version") +m.reset = false +m.submit = false + +s=m:field(DummyValue,"redir_run",translate("Global Client")) +s.rawhtml = true +if redir_run == 1 then +s.value =font_blue .. bold_on .. translate("Running") .. bold_off .. font_off +else +s.value = translate("Not Running") +end + +s=m:field(DummyValue,"reudp_run",translate("Game Mode UDP Relay")) +s.rawhtml = true +if reudp_run == 1 then +s.value =font_blue .. bold_on .. translate("Running") .. bold_off .. font_off +else +s.value = translate("Not Running") +end + +if ucic:get_first(shadowsocksr, 'global', 'pdnsd_enable', '0') ~= '0' then +s=m:field(DummyValue,"pdnsd_run",translate("DNS Anti-pollution")) +s.rawhtml = true +if pdnsd_run == 1 then +s.value =font_blue .. bold_on .. translate("Running") .. bold_off .. font_off +else +s.value = translate("Not Running") +end +end + +if ucic:get_first(shadowsocksr, 'socks5_proxy', 'socks', '0') == '1' then +if nixio.fs.access("/usr/bin/microsocks") then +s=m:field(DummyValue,"sock5_run",translate("SOCKS5 Proxy Server")) +s.rawhtml = true +if sock5_run == 1 then +s.value =font_blue .. bold_on .. translate("Running") .. bold_off .. font_off +else +s.value = translate("Not Running") +end +end +end + +if nixio.fs.access("/usr/bin/ssr-server") then +s=m:field(DummyValue,"server_run",translate("Global SSR Server")) +s.rawhtml = true +if server_run == 1 then +s.value =font_blue .. bold_on .. translate("Running") .. bold_off .. font_off +else +s.value = translate("Not Running") +end +end + +if nixio.fs.access("/usr/bin/kcptun-client") then +s=m:field(DummyValue,"kcp_version",translate("KcpTun Version")) +s.rawhtml = true +s.value =kcptun_version + +s=m:field(DummyValue,"kcptun_run",translate("KcpTun")) +s.rawhtml = true +if kcptun_run == 1 then +s.value =font_blue .. bold_on .. translate("Running") .. bold_off .. font_off +else +s.value = translate("Not Running") +end +end + +s=m:field(DummyValue,"google",translate("Google Connectivity")) +s.value = translate("No Check") +s.template = "shadowsocksr/check" + +s=m:field(DummyValue,"baidu",translate("Baidu Connectivity")) +s.value = translate("No Check") +s.template = "shadowsocksr/check" + +s=m:field(DummyValue,"gfw_data",translate("GFW List Data")) +s.rawhtml = true +s.template = "shadowsocksr/refresh" +s.value =tostring(math.ceil(gfw_count)) .. " " .. translate("Records") + +s=m:field(DummyValue,"ip_data",translate("China IP Data")) +s.rawhtml = true +s.template = "shadowsocksr/refresh" +s.value =ip_count .. " " .. translate("Records") + +if ucic:get_first(shadowsocksr, 'global', 'adblock', '0') == '1' then +s=m:field(DummyValue,"ad_data",translate("Advertising Data")) +s.rawhtml = true +s.template = "shadowsocksr/refresh" +s.value =ad_count .. " " .. translate("Records") +end + +s=m:field(DummyValue,"check_port",translate("Check Server Port")) +s.template = "shadowsocksr/checkport" +s.value =translate("No Check") + +return m diff --git a/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/certupload.htm b/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/certupload.htm new file mode 100644 index 00000000000000..f34f04d7b88e37 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/certupload.htm @@ -0,0 +1,4 @@ +<%+cbi/valueheader%> + + +<%+cbi/valuefooter%> diff --git a/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/check.htm b/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/check.htm new file mode 100644 index 00000000000000..c75056a80a5bf5 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/check.htm @@ -0,0 +1,30 @@ +<%+cbi/valueheader%> + + +<%=self.value%> + +<%+cbi/valuefooter%> diff --git a/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/checkport.htm b/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/checkport.htm new file mode 100644 index 00000000000000..ed91a2f22c1bda --- /dev/null +++ b/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/checkport.htm @@ -0,0 +1,36 @@ +<%+cbi/valueheader%> + + + +<%=self.value%> + + + +<%+cbi/valuefooter%> \ No newline at end of file diff --git a/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/ping.htm b/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/ping.htm new file mode 100644 index 00000000000000..5b396f7ceecd5d --- /dev/null +++ b/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/ping.htm @@ -0,0 +1,3 @@ +<%+cbi/valueheader%> +-- ms +<%+cbi/valuefooter%> diff --git a/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/refresh.htm b/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/refresh.htm new file mode 100644 index 00000000000000..3e610d9ee2d8e6 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/refresh.htm @@ -0,0 +1,35 @@ +<%+cbi/valueheader%> + + +<%=self.value%> +<%+cbi/valuefooter%> diff --git a/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/server_list.htm b/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/server_list.htm new file mode 100644 index 00000000000000..ca9b70db8415e0 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/server_list.htm @@ -0,0 +1,51 @@ +<%# + Copyright 2018-2019 Lienol + Licensed to the public under the Apache License 2.0. +-%> +<% +local dsp = require "luci.dispatcher" +-%> + \ No newline at end of file diff --git a/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/socket.htm b/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/socket.htm new file mode 100644 index 00000000000000..714fb56bf9cc2c --- /dev/null +++ b/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/socket.htm @@ -0,0 +1,3 @@ +<%+cbi/valueheader%> +wait +<%+cbi/valuefooter%> diff --git a/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/ssrurl.htm b/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/ssrurl.htm new file mode 100644 index 00000000000000..67aad5f5343383 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/ssrurl.htm @@ -0,0 +1,297 @@ +<%+cbi/valueheader%> + + + +<%+cbi/valuefooter%> diff --git a/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/status.htm b/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/status.htm new file mode 100644 index 00000000000000..0dab4d55024b73 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/status.htm @@ -0,0 +1,22 @@ + + +
+

+ <%:Collecting data...%> +

+
diff --git a/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/subscribe.htm b/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/subscribe.htm new file mode 100644 index 00000000000000..6bbc7d54b7b31b --- /dev/null +++ b/package/lean/luci-app-ssr-plus/luasrc/view/shadowsocksr/subscribe.htm @@ -0,0 +1,18 @@ +<%+cbi/valueheader%> + + + +<%+cbi/valuefooter%> diff --git a/package/lean/luci-app-ssr-plus/po/zh-cn/ssr-plus.po b/package/lean/luci-app-ssr-plus/po/zh-cn/ssr-plus.po new file mode 100644 index 00000000000000..01c8c7213a6f81 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/po/zh-cn/ssr-plus.po @@ -0,0 +1,641 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8\n" + +msgid "ShadowSocksR Client" +msgstr "ShadowSocksR 客户端" + +msgid "Enable" +msgstr "启用" + +msgid "Disable" +msgstr "停用" + +msgid "Log" +msgstr "日志" + +msgid "ShadowSocksR is running" +msgstr "ShadowSocksR 客户端运行中" + +msgid "ShadowSocksR is not running" +msgstr "ShadowSocksR 客户端未运行" + +msgid "Global Setting" +msgstr "全局设置" + +msgid "Global Server" +msgstr "全局服务器" + +msgid "ShadowSocksR SOCK5 Proxy is running" +msgstr "ShadowSocksR SOCK5代理运行中" + +msgid "UDP Relay Server" +msgstr "UDP中继服务器" + +msgid "Same as Global Server" +msgstr "与全局服务器相同" + +msgid "Servers Setting" +msgstr "服务器配置" + +msgid "Alias(optional)" +msgstr "别名(可选)" + +msgid "Onetime Authentication" +msgstr "一次验证" + +msgid "Server Address" +msgstr "服务器地址" + +msgid "Server Port" +msgstr "端口" + +msgid "Local Port" +msgstr "本地端口" + +msgid "Connection Timeout" +msgstr "连接超时" + +msgid "Password" +msgstr "密码" + +msgid "Encrypt Method" +msgstr "加密方式" + +msgid "Protocol" +msgstr "传输协议" + +msgid "Protocol param(optional)" +msgstr "传输协议参数(可选)" + +msgid "Obfs" +msgstr "混淆插件" + +msgid "Obfs param(optional)" +msgstr "混淆参数(可选)" + +msgid "Enable Tunnel(DNS)" +msgstr "启用隧道(DNS)转发" + +msgid "Tunnel Port" +msgstr "隧道(DNS)本地端口" + +msgid "Forwarding Tunnel" +msgstr "隧道(DNS)转发地址" + +msgid "Access Control" +msgstr "访问控制" + +msgid "Interfaces - WAN" +msgstr "接口 - WAN" + +msgid "Bypassed IP List" +msgstr "被忽略IP列表" + +msgid "NULL - As Global Proxy" +msgstr "留空 - 作为全局代理" + +msgid "Bypassed IP" +msgstr "额外被忽略IP" + +msgid "Forwarded IP" +msgstr "强制走代理IP" + +msgid "Interfaces - LAN" +msgstr "接口 - LAN" + +msgid "LAN Access Control" +msgstr "内网客户端分流代理控制" + +msgid "Allow listed only" +msgstr "仅允许列表内主机" + +msgid "Allow all except listed" +msgstr "除列表外主机皆允许" + +msgid "LAN Host List" +msgstr "内网主机列表" + +msgid "SSR Client" +msgstr "客户端" + +msgid "SSR Server" +msgstr "服务端" + +msgid "ShadowSocksR Server" +msgstr "ShadowSocksR 服务端" + +msgid "ShadowSocksR Server is running" +msgstr "ShadowSocksR 服务端运行中" + +msgid "ShadowSocksR Server is not running" +msgstr "ShadowSocksR 服务端未运行" + +msgid "Enable Server" +msgstr "启动服务端" + +msgid "Server Setting" +msgstr "服务端配置" + +msgid "KcpTun Enable" +msgstr "KcpTun 启用" + +msgid "bin:/usr/bin/kcptun-client" +msgstr "二进制文件:/usr/bin/kcptun-client" + +msgid "KcpTun Port" +msgstr "KcpTun 端口" + +msgid "KcpTun Param" +msgstr "KcpTun 参数" + +msgid "KcpTun Password" +msgstr "KcpTun 密码" + +msgid "Haven't a Kcptun executable file" +msgstr "不存在Kcptun可执行文件,请下载Kcptun可执行文件并改名放入/usr/bin/kcptun-client" + +msgid "Not a Kcptun executable file" +msgstr "Kcptun可执行文件格式不正确,请确认是否正确下载了路由器对应的可执行文件" + +msgid "Enable Process Monitor" +msgstr "启用进程监控" + +msgid "Edit ShadowSocksR Server" +msgstr "编辑服务器配置" + +msgid "Alias" +msgstr "别名" + +msgid "SOCKS Proxy" +msgstr "SOCKS(4/5)代理" + +msgid "Enable SOCKS Proxy" +msgstr "启用 SOCKS 代理" + +msgid "Server" +msgstr "服务器" + +msgid "TCP Fast Open" +msgstr "TCP快速打开" + +msgid "Status" +msgstr "状态" + +msgid "Unknown" +msgstr "未知" + +msgid "Running Status" +msgstr "运行状态" + +msgid "Global Client" +msgstr "TCP透明代理" + +msgid "Global SSR Server" +msgstr "SSR服务端" + +msgid "DNS Tunnel" +msgstr "DNS 隧道" + +msgid "IPK Version" +msgstr "IPK 版本号" + +msgid "KcpTun Version" +msgstr "KcpTun 版本号" + +msgid "Not exist" +msgstr "未安装可执行文件" + +msgid "IPK Installation Time" +msgstr "IPK 安装时间" + +msgid "Project" +msgstr "项目地址" + +msgid "Not Running" +msgstr "未运行" + +msgid "Running" +msgstr "运行中" + +msgid "Enable GFW mode" +msgstr "启用 GFW 模式" + +msgid "Running Mode" +msgstr "运行模式" + +msgid "IP Route Mode" +msgstr "绕过中国大陆IP模式" + +msgid "GFW List Mode" +msgstr "GFW列表模式" + +msgid "Global Mode" +msgstr "全局模式" + +msgid "Oversea Mode" +msgstr "海外用户回国模式" + +msgid "Router Proxy" +msgstr "路由器访问控制" + +msgid "Normal Proxy" +msgstr "正常代理" + +msgid "Bypassed Proxy" +msgstr "不走代理" + +msgid "Forwarded Proxy" +msgstr "强制走代理" + +msgid "UDP Relay" +msgstr "UDP中继" + +msgid "Google Connectivity" +msgstr "【谷歌】连通性检查" + +msgid "Baidu Connectivity" +msgstr "【百度】连通性检查" + +msgid "No Check" +msgstr "未检查" + +msgid "Check" +msgstr "检查" + +msgid "Connect OK" +msgstr "连接正常" + +msgid "Connect Error" +msgstr "连接错误" + +msgid "Check..." +msgstr "正在检查.." + +msgid "Proxy Check" +msgstr "代理检查" + +msgid "GFW List Data" +msgstr "【GFW列表】数据库" + +msgid "China IP Data" +msgstr "【国内IP段】数据库" + +msgid "Records" +msgstr "条记录" + +msgid "Refresh Data" +msgstr "更新数据库" + +msgid "Refresh..." +msgstr "正在更新,请稍候.." + +msgid "Refresh OK!" +msgstr "更新成功!" + +msgid "Refresh Error!" +msgstr "更新失败!" + +msgid "No new data!" +msgstr "你已经是最新数据,无需更新!" + +msgid "Total Records:" +msgstr "新的总纪录数:" + +msgid "Check Server Port" +msgstr "【服务器端口】检查" + +msgid "Check Connect" +msgstr "检查连通性" + +msgid "Check Server" +msgstr "检查服务器" + +msgid "Auto Switch" +msgstr "自动切换" + +msgid "Enable Auto Switch" +msgstr "启用自动切换" + +msgid "Switch check cycly(second)" +msgstr "自动切换检查周期(秒)" + +msgid "Check timout(second)" +msgstr "切换检查超时时间(秒)" + +msgid "Check Try Count" +msgstr "切换检查重试次数" + +msgid "Enable adblock" +msgstr "启用广告屏蔽" + +msgid "adblock_url" +msgstr "广告屏蔽订阅" + +msgid "Enable Process Deamon" +msgstr "启用进程自动守护" + +msgid "Advertising Data" +msgstr "【广告屏蔽】数据库" + +msgid "Chnroute Setting" +msgstr "国内IP段数据库更新设置" + +msgid "Enable custom chnroute" +msgstr "启用自定义更新地址" + +msgid "Update url" +msgstr "更新链接" + +msgid "DNS Server IP and Port" +msgstr "DNS服务器地址和端口" + +msgid "Resolve Dns Mode" +msgstr "DNS解析方式" + +msgid "Use SSR DNS Tunnel" +msgstr "使用SSR-DNS隧道" + +msgid "Use Pdnsd" +msgstr "使用Pdnsd" + +msgid "DNS Anti-pollution" +msgstr "DNS 防污染服务" + +msgid "Use Other DNS Tunnel(Need to install)" +msgstr "使用其他DNS转发(需要自己安装)" + +msgid "Import SSR" +msgstr "导入ssr配置信息" + +msgid "Export SSR" +msgstr "导出ssr配置信息" + +msgid "Import SSR successfully." +msgstr "成功导入SSR。" + +msgid "Invalid SSR format." +msgstr "无效的SSR格式。" + +msgid "User cancelled." +msgstr "用户已取消。" + +msgid "Paste ssr url here" +msgstr "在此处粘贴ssr://网址" + +msgid "Unable to copy SSR to clipboard." +msgstr "无法复制SSR网址到剪贴板。" + +msgid "Copy SSR to clipboard successfully." +msgstr "成功复制SSR网址到剪贴板。" + +msgid "Servers Manage" +msgstr "服务器管理" + +msgid "Auto Update" +msgstr "自动更新" + +msgid "Through proxy update" +msgstr "通过代理更新" + +msgid "GFW List" +msgstr "GFW列表" + +msgid "ShadowSocksR Plus+ Settings" +msgstr "ShadowSocksR Plus+ 设置(支持SS/SSR/V2RAY/TROJAN/SOCKS5/TUN)" + +msgid "Main Server" +msgstr "主服务器" + +msgid "Anti-pollution DNS Server" +msgstr "访问国外域名DNS服务器" + +msgid "Custom DNS Server format as IP:PORT (default: 8.8.4.4:53)" +msgstr "格式为 IP:PORT (默认: 8.8.4.4:53)" + +msgid "Use Pdnsd tcp query and cache" +msgstr "使用PDNSD TCP查询并缓存" + +msgid "Use DNS2SOCKS query and cache" +msgstr "使用 DNS2SOCKS 查询并缓存" + +msgid "DNS Server IP:Port" +msgstr "DNS服务器 IP:Port" + +msgid "Update time (every day)" +msgstr "更新时间 (每天)" + +msgid "Auto Update Server subscription, GFW list and CHN route" +msgstr "自动更新服务器订阅、GFW列表和 CHN路由表" + +msgid "Subscribe URL" +msgstr "SS/SSR/V2/TROJAN订阅URL" + +msgid "Update" +msgstr "更新" + +msgid "Server Count" +msgstr "服务器节点数量" + +msgid "IP black-and-white list" +msgstr "黑白名单" + +msgid "WAN IP AC" +msgstr "WAN IP访问控制" + +msgid "WAN White List IP" +msgstr "不走代理的WAN IP" + +msgid "WAN Force Proxy IP" +msgstr "强制走代理的WAN IP" + +msgid "LAN Bypassed Host List" +msgstr "不走代理的局域网LAN IP" + +msgid "LAN Force Proxy Host List" +msgstr "全局代理的LAN IP" + +msgid "Router Self AC" +msgstr "路由器自身代理设置" + +msgid "Router Self Proxy" +msgstr "路由器自身代理方式" + +msgid "Normal Proxy" +msgstr "跟随全局设置" + +msgid "Bypassed Proxy" +msgstr "不走代理" + +msgid "Forwarded Proxy" +msgstr "全局代理" + +msgid "GFW Custom List" +msgstr "GFW 用户自定义列表" + +msgid "Please refer to the following writing" +msgstr "每行一个域名,无需写前面的 HTTP(S):// ,提交后即时生效" + +msgid "Servers subscription and manage" +msgstr "服务器节点订阅与管理(支持订阅和手动导入SSR链接)" + +msgid "Through proxy update list, Not Recommended" +msgstr "通过路由器自身代理更新订阅" + +msgid "LAN IP AC" +msgstr "LAN IP访问控制" + +msgid "Game Mode UDP Server" +msgstr "游戏模式UDP中继服务器" + +msgid "Game Mode UDP Relay" +msgstr "游戏模式UDP中继" + +msgid "adblock settings" +msgstr "广告屏蔽设置" + +msgid "Server failsafe auto swith and custom update settings" +msgstr "服务器节点故障自动切换/广告屏蔽/国内IP段数据库更新设置" + +msgid "Support AdGuardHome and DNSMASQ format list" +msgstr "同时支持 AdGuard Home 和 DNSMASQ 格式的过滤列表" + +msgid "Enable Custom Chnroute" +msgstr "自定义国内IP段数据库更新" + +msgid "Chnroute Update url" +msgstr "国内IP段数据库更新URL" + +msgid "Delete all severs" +msgstr "删除所有服务器节点" + +msgid "Delete All Subscribe Severs" +msgstr "删除所有订阅服务器节点" + +msgid "Severs Nodes" +msgstr "服务器节点" + +msgid "Use Local DNS Service listen port 5335" +msgstr "使用本机端口为5335的DNS服务" + +msgid "Server Node Type" +msgstr "服务器节点类型" + +msgid "Using incorrect encryption mothod may causes service fail to start" +msgstr "输入不正确的参数组合可能会导致服务无法启动" + +msgid "Game Mode Host List" +msgstr "增强游戏模式客户端LAN IP" + +msgid "Multi Threads Option" +msgstr "多线程并发转发" + +msgid "Auto Threads" +msgstr "自动(CPU线程数)" + +msgid "1 Thread" +msgstr "单线程" + +msgid "2 Threads" +msgstr "2 线程" + +msgid "4 Threads" +msgstr "4 线程" + +msgid "8 Threads" +msgstr "8 线程" + +msgid "16 Threads" +msgstr "16 线程" + +msgid "32 Threads" +msgstr "32 线程" + +msgid "64 Threads" +msgstr "64 线程" + +msgid "128 Threads" +msgstr "128 线程" + +msgid "Proxy Ports" +msgstr "需要代理的端口" + +msgid "All Ports" +msgstr "所有端口(默认)" + +msgid "Only Common Ports" +msgstr "仅常用端口(不走P2P流量到代理)" + +msgid "Socket Connected" +msgstr "连接测试" + +msgid "Ping Latency" +msgstr "Ping延迟" + +msgid "Bypass Domain List" +msgstr "不走代理的域名" + +msgid "Black Domain List" +msgstr "强制走代理的域名" + +msgid "Update Subscribe List" +msgstr "更新订阅URL列表" + +msgid "Update subscribe url list first" +msgstr "订阅服务器节点前,请先更新订阅URL列表" + +msgid "Update All Subscribe Severs" +msgstr "更新所有订阅服务器节点" + +msgid "Plugin" +msgstr "插件" + +msgid "Plugin Opts" +msgstr "插件参数" + +msgid "Self-signed Certificate" +msgstr "自签证书" + +msgid "If you have a self-signed certificate,please check the box" +msgstr "如果你使用自签证书,请选择" + +msgid "upload" +msgstr "上传" + +msgid "Upload" +msgstr "上传" + +msgid "No specify upload file." +msgstr "没有上传证书" + +msgid "Current Certificate Path" +msgstr "当前证书路径" + +msgid "Please confirm the current certificate path" +msgstr "请选择确认所传证书,证书不正确将无法运行" + +msgid "Subscribe Default Auto-Switch" +msgstr "订阅新节点自动切换设置" + +msgid "Subscribe new add server default Auto-Switch on" +msgstr "订阅加入的新节点默认开启自动切换" + +msgid "SOCKS5 Proxy Server Settings" +msgstr "SOCKS5 代理服务端设置" + +msgid "SOCKS5 Proxy Server" +msgstr "SOCKS5 代理服务端" + +msgid "Enable SOCKS5 Proxy Server" +msgstr "启用 SOCKS5 代理服务" + +msgid "Enable Authentication" +msgstr "启用用户名/密码认证" + +msgid "Enable SOCKS5 Proxy Server" +msgstr "启用 SOCKS5 代理服务" + +msgid "Enable WAN Access" +msgstr "允许从 WAN 访问" + +msgid "Redirect traffic to this network interface" +msgstr "分流到这个网络接口" diff --git a/package/lean/luci-app-ssr-plus/root/etc/china_ssr.txt b/package/lean/luci-app-ssr-plus/root/etc/china_ssr.txt new file mode 100644 index 00000000000000..075487f8dae507 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/root/etc/china_ssr.txt @@ -0,0 +1,8473 @@ +1.0.1.0/24 +1.0.2.0/23 +1.0.8.0/21 +1.0.32.0/19 +1.1.0.0/24 +1.1.2.0/23 +1.1.4.0/22 +1.1.8.0/24 +1.1.9.0/24 +1.1.10.0/23 +1.1.12.0/22 +1.1.16.0/20 +1.1.32.0/19 +1.2.0.0/23 +1.2.2.0/24 +1.2.4.0/24 +1.2.5.0/24 +1.2.6.0/23 +1.2.8.0/24 +1.2.9.0/24 +1.2.10.0/23 +1.2.12.0/22 +1.2.16.0/20 +1.2.32.0/19 +1.2.64.0/18 +1.3.0.0/16 +1.4.1.0/24 +1.4.2.0/23 +1.4.4.0/24 +1.4.5.0/24 +1.4.6.0/23 +1.4.8.0/21 +1.4.16.0/20 +1.4.32.0/19 +1.4.64.0/18 +1.8.0.0/16 +1.10.0.0/21 +1.10.8.0/23 +1.10.11.0/24 +1.10.12.0/22 +1.10.16.0/20 +1.10.32.0/19 +1.10.64.0/18 +1.12.0.0/14 +1.24.0.0/13 +1.45.0.0/16 +1.48.0.0/15 +1.50.0.0/16 +1.51.0.0/16 +1.56.0.0/13 +1.68.0.0/14 +1.80.0.0/13 +1.88.0.0/14 +1.92.0.0/15 +1.94.0.0/15 +1.116.0.0/15 +1.118.0.0/16 +1.119.0.0/17 +1.119.128.0/17 +1.180.0.0/14 +1.184.0.0/15 +1.188.0.0/14 +1.192.0.0/13 +1.202.0.0/15 +1.204.0.0/14 +14.0.0.0/21 +14.0.12.0/22 +14.1.0.0/22 +14.1.24.0/22 +14.1.96.0/22 +14.1.108.0/22 +14.16.0.0/12 +14.102.128.0/22 +14.102.156.0/22 +14.102.180.0/22 +14.103.0.0/16 +14.104.0.0/13 +14.112.0.0/12 +14.130.0.0/15 +14.134.0.0/15 +14.144.0.0/12 +14.192.60.0/22 +14.192.76.0/22 +14.196.0.0/15 +14.204.0.0/15 +14.208.0.0/12 +27.0.128.0/22 +27.0.132.0/22 +27.0.160.0/22 +27.0.164.0/22 +27.0.188.0/22 +27.0.204.0/22 +27.0.208.0/22 +27.0.212.0/22 +27.8.0.0/13 +27.16.0.0/12 +27.34.232.0/21 +27.36.0.0/14 +27.40.0.0/13 +27.50.40.0/21 +27.50.128.0/17 +27.54.72.0/21 +27.54.152.0/21 +27.54.192.0/18 +27.98.208.0/20 +27.98.224.0/19 +27.99.128.0/17 +27.103.0.0/16 +27.106.128.0/18 +27.106.204.0/22 +27.109.32.0/19 +27.109.124.0/22 +27.112.0.0/18 +27.112.80.0/20 +27.112.112.0/22 +27.112.116.0/22 +27.113.128.0/18 +27.115.0.0/17 +27.116.44.0/22 +27.121.72.0/21 +27.121.120.0/21 +27.128.0.0/15 +27.131.220.0/22 +27.144.0.0/16 +27.148.0.0/14 +27.152.0.0/13 +27.184.0.0/13 +27.192.0.0/11 +27.224.0.0/14 +36.0.0.0/22 +36.0.8.0/21 +36.0.16.0/20 +36.0.32.0/19 +36.0.64.0/18 +36.0.128.0/17 +36.1.0.0/16 +36.4.0.0/14 +36.16.0.0/12 +36.32.0.0/14 +36.36.0.0/16 +36.37.0.0/19 +36.37.36.0/23 +36.37.39.0/24 +36.37.40.0/21 +36.37.48.0/20 +36.40.0.0/13 +36.48.0.0/15 +36.51.0.0/16 +36.56.0.0/13 +36.96.0.0/11 +36.128.0.0/10 +36.192.0.0/11 +36.248.0.0/14 +36.254.0.0/16 +36.255.116.0/22 +36.255.128.0/22 +36.255.164.0/22 +36.255.172.0/22 +36.255.176.0/22 +39.0.0.0/24 +39.0.2.0/23 +39.0.4.0/22 +39.0.8.0/21 +39.0.16.0/20 +39.0.32.0/19 +39.0.64.0/18 +39.0.128.0/17 +39.64.0.0/11 +39.96.0.0/13 +39.104.0.0/14 +39.108.0.0/16 +39.128.0.0/10 +40.72.0.0/15 +40.125.128.0/17 +40.126.64.0/18 +42.0.0.0/22 +42.0.8.0/21 +42.0.16.0/21 +42.0.24.0/22 +42.0.32.0/19 +42.0.128.0/17 +42.1.0.0/19 +42.1.32.0/20 +42.1.48.0/21 +42.1.56.0/22 +42.1.128.0/17 +42.4.0.0/14 +42.48.0.0/15 +42.50.0.0/16 +42.51.0.0/16 +42.52.0.0/14 +42.56.0.0/14 +42.62.0.0/17 +42.62.128.0/19 +42.62.160.0/20 +42.62.180.0/22 +42.62.184.0/21 +42.63.0.0/16 +42.80.0.0/15 +42.83.64.0/20 +42.83.80.0/22 +42.83.88.0/21 +42.83.96.0/19 +42.83.128.0/17 +42.84.0.0/14 +42.88.0.0/13 +42.96.64.0/19 +42.96.96.0/21 +42.96.108.0/22 +42.96.112.0/20 +42.96.128.0/17 +42.97.0.0/16 +42.99.0.0/18 +42.99.64.0/19 +42.99.96.0/20 +42.99.112.0/22 +42.99.120.0/21 +42.100.0.0/14 +42.120.0.0/15 +42.122.0.0/16 +42.123.0.0/19 +42.123.36.0/22 +42.123.40.0/21 +42.123.48.0/20 +42.123.64.0/18 +42.123.128.0/17 +42.128.0.0/12 +42.156.0.0/19 +42.156.36.0/22 +42.156.40.0/21 +42.156.48.0/20 +42.156.64.0/18 +42.156.128.0/17 +42.157.0.0/16 +42.158.0.0/16 +42.159.0.0/16 +42.160.0.0/12 +42.176.0.0/13 +42.184.0.0/15 +42.186.0.0/16 +42.187.0.0/18 +42.187.64.0/19 +42.187.96.0/20 +42.187.112.0/21 +42.187.120.0/22 +42.187.128.0/17 +42.192.0.0/15 +42.194.0.0/21 +42.194.8.0/22 +42.194.12.0/22 +42.194.16.0/20 +42.194.32.0/19 +42.194.64.0/18 +42.194.128.0/17 +42.195.0.0/16 +42.196.0.0/14 +42.201.0.0/17 +42.202.0.0/15 +42.204.0.0/14 +42.208.0.0/12 +42.224.0.0/12 +42.240.0.0/17 +42.240.128.0/17 +42.242.0.0/15 +42.244.0.0/14 +42.248.0.0/13 +43.224.12.0/22 +43.224.24.0/22 +43.224.44.0/22 +43.224.52.0/22 +43.224.56.0/22 +43.224.64.0/22 +43.224.68.0/22 +43.224.72.0/22 +43.224.80.0/22 +43.224.100.0/22 +43.224.144.0/22 +43.224.160.0/22 +43.224.176.0/22 +43.224.184.0/22 +43.224.200.0/22 +43.224.204.0/22 +43.224.208.0/22 +43.224.212.0/22 +43.224.216.0/22 +43.224.240.0/22 +43.225.76.0/22 +43.225.84.0/22 +43.225.120.0/22 +43.225.124.0/22 +43.225.140.0/22 +43.225.172.0/22 +43.225.180.0/22 +43.225.208.0/22 +43.225.216.0/22 +43.225.220.0/22 +43.225.224.0/22 +43.225.228.0/22 +43.225.232.0/22 +43.225.236.0/22 +43.225.240.0/22 +43.225.244.0/22 +43.225.252.0/22 +43.226.32.0/22 +43.226.36.0/22 +43.226.40.0/22 +43.226.44.0/22 +43.226.48.0/22 +43.226.52.0/22 +43.226.56.0/22 +43.226.60.0/22 +43.226.64.0/22 +43.226.68.0/22 +43.226.72.0/22 +43.226.76.0/22 +43.226.80.0/22 +43.226.84.0/22 +43.226.88.0/22 +43.226.92.0/22 +43.226.96.0/22 +43.226.100.0/22 +43.226.104.0/22 +43.226.108.0/22 +43.226.112.0/22 +43.226.116.0/22 +43.226.120.0/22 +43.226.128.0/22 +43.226.132.0/22 +43.226.136.0/22 +43.226.140.0/22 +43.226.144.0/22 +43.226.148.0/22 +43.226.152.0/22 +43.226.156.0/22 +43.226.160.0/22 +43.226.164.0/22 +43.226.168.0/22 +43.226.172.0/22 +43.226.176.0/22 +43.226.180.0/22 +43.226.184.0/22 +43.226.188.0/22 +43.226.192.0/22 +43.226.196.0/22 +43.226.200.0/22 +43.226.204.0/22 +43.226.208.0/22 +43.226.212.0/22 +43.226.236.0/22 +43.226.240.0/22 +43.226.244.0/22 +43.226.248.0/22 +43.226.252.0/22 +43.227.0.0/22 +43.227.4.0/22 +43.227.8.0/22 +43.227.32.0/22 +43.227.36.0/22 +43.227.40.0/22 +43.227.44.0/22 +43.227.48.0/22 +43.227.52.0/22 +43.227.56.0/22 +43.227.60.0/22 +43.227.64.0/22 +43.227.68.0/22 +43.227.72.0/22 +43.227.76.0/22 +43.227.80.0/22 +43.227.84.0/22 +43.227.88.0/22 +43.227.92.0/22 +43.227.96.0/22 +43.227.100.0/22 +43.227.104.0/22 +43.227.136.0/22 +43.227.140.0/22 +43.227.144.0/22 +43.227.152.0/22 +43.227.156.0/22 +43.227.160.0/22 +43.227.164.0/22 +43.227.168.0/22 +43.227.172.0/22 +43.227.176.0/22 +43.227.180.0/22 +43.227.188.0/22 +43.227.192.0/22 +43.227.196.0/22 +43.227.200.0/22 +43.227.204.0/22 +43.227.208.0/22 +43.227.212.0/22 +43.227.216.0/22 +43.227.220.0/22 +43.227.232.0/22 +43.227.248.0/22 +43.227.252.0/22 +43.228.0.0/22 +43.228.4.0/22 +43.228.8.0/22 +43.228.12.0/22 +43.228.16.0/22 +43.228.20.0/22 +43.228.24.0/22 +43.228.28.0/22 +43.228.32.0/22 +43.228.36.0/22 +43.228.40.0/22 +43.228.44.0/22 +43.228.48.0/22 +43.228.52.0/22 +43.228.56.0/22 +43.228.60.0/22 +43.228.64.0/22 +43.228.68.0/22 +43.228.76.0/22 +43.228.100.0/22 +43.228.116.0/22 +43.228.120.0/22 +43.228.132.0/22 +43.228.136.0/22 +43.228.148.0/22 +43.228.152.0/22 +43.228.188.0/22 +43.229.40.0/22 +43.229.48.0/22 +43.229.56.0/22 +43.229.96.0/22 +43.229.120.0/22 +43.229.136.0/22 +43.229.140.0/22 +43.229.144.0/22 +43.229.168.0/22 +43.229.172.0/22 +43.229.176.0/22 +43.229.180.0/22 +43.229.184.0/22 +43.229.188.0/22 +43.229.192.0/22 +43.229.196.0/22 +43.229.216.0/22 +43.229.220.0/22 +43.229.232.0/22 +43.229.236.0/22 +43.230.20.0/22 +43.230.32.0/22 +43.230.68.0/22 +43.230.72.0/22 +43.230.84.0/22 +43.230.124.0/22 +43.230.136.0/22 +43.230.220.0/22 +43.230.224.0/22 +43.230.228.0/22 +43.230.232.0/22 +43.230.236.0/22 +43.230.240.0/22 +43.230.244.0/22 +43.230.248.0/22 +43.230.252.0/22 +43.231.32.0/22 +43.231.36.0/22 +43.231.40.0/22 +43.231.44.0/22 +43.231.80.0/22 +43.231.84.0/22 +43.231.88.0/22 +43.231.92.0/22 +43.231.96.0/22 +43.231.100.0/22 +43.231.104.0/22 +43.231.108.0/22 +43.231.136.0/22 +43.231.140.0/22 +43.231.144.0/22 +43.231.148.0/22 +43.231.152.0/22 +43.231.156.0/22 +43.231.160.0/22 +43.231.164.0/22 +43.231.168.0/22 +43.231.172.0/22 +43.231.176.0/22 +43.231.180.0/22 +43.236.0.0/22 +43.236.4.0/22 +43.236.8.0/22 +43.236.12.0/22 +43.236.16.0/22 +43.236.20.0/22 +43.236.24.0/22 +43.236.28.0/22 +43.236.32.0/22 +43.236.36.0/22 +43.236.40.0/22 +43.236.44.0/22 +43.236.48.0/22 +43.236.52.0/22 +43.236.56.0/22 +43.236.60.0/22 +43.236.64.0/22 +43.236.68.0/22 +43.236.72.0/22 +43.236.76.0/22 +43.236.80.0/22 +43.236.84.0/22 +43.236.88.0/22 +43.236.92.0/22 +43.236.96.0/22 +43.236.100.0/22 +43.236.104.0/22 +43.236.108.0/22 +43.236.112.0/22 +43.236.116.0/22 +43.236.120.0/22 +43.236.124.0/22 +43.236.128.0/22 +43.236.132.0/22 +43.236.136.0/22 +43.236.140.0/22 +43.236.144.0/22 +43.236.148.0/22 +43.236.152.0/22 +43.236.156.0/22 +43.236.160.0/22 +43.236.164.0/22 +43.236.168.0/22 +43.236.172.0/22 +43.236.176.0/22 +43.236.180.0/22 +43.236.184.0/22 +43.236.188.0/22 +43.236.192.0/22 +43.236.196.0/22 +43.236.200.0/22 +43.236.204.0/22 +43.236.208.0/22 +43.236.212.0/22 +43.236.216.0/22 +43.236.220.0/22 +43.236.224.0/22 +43.236.228.0/22 +43.236.232.0/22 +43.236.236.0/22 +43.236.240.0/22 +43.236.244.0/22 +43.236.248.0/22 +43.236.252.0/22 +43.237.0.0/22 +43.237.4.0/22 +43.237.8.0/22 +43.237.12.0/22 +43.237.16.0/22 +43.237.20.0/22 +43.237.24.0/22 +43.237.28.0/22 +43.237.32.0/22 +43.237.36.0/22 +43.237.40.0/22 +43.237.44.0/22 +43.237.48.0/22 +43.237.52.0/22 +43.237.56.0/22 +43.237.60.0/22 +43.237.64.0/22 +43.237.68.0/22 +43.237.72.0/22 +43.237.76.0/22 +43.237.80.0/22 +43.237.84.0/22 +43.237.88.0/22 +43.237.92.0/22 +43.237.96.0/22 +43.237.100.0/22 +43.237.104.0/22 +43.237.108.0/22 +43.237.112.0/22 +43.237.116.0/22 +43.237.120.0/22 +43.237.124.0/22 +43.237.128.0/22 +43.237.132.0/22 +43.237.136.0/22 +43.237.140.0/22 +43.237.144.0/22 +43.237.148.0/22 +43.237.152.0/22 +43.237.156.0/22 +43.237.160.0/22 +43.237.164.0/22 +43.237.168.0/22 +43.237.172.0/22 +43.237.176.0/22 +43.237.180.0/22 +43.237.184.0/22 +43.237.188.0/22 +43.237.192.0/22 +43.237.196.0/22 +43.237.200.0/22 +43.237.204.0/22 +43.237.208.0/22 +43.237.212.0/22 +43.237.216.0/22 +43.237.220.0/22 +43.237.224.0/22 +43.237.228.0/22 +43.237.232.0/22 +43.237.236.0/22 +43.237.240.0/22 +43.237.244.0/22 +43.237.248.0/22 +43.237.252.0/22 +43.238.0.0/22 +43.238.4.0/22 +43.238.8.0/22 +43.238.12.0/22 +43.238.16.0/22 +43.238.20.0/22 +43.238.24.0/22 +43.238.28.0/22 +43.238.32.0/22 +43.238.36.0/22 +43.238.40.0/22 +43.238.44.0/22 +43.238.48.0/22 +43.238.52.0/22 +43.238.56.0/22 +43.238.60.0/22 +43.238.64.0/22 +43.238.68.0/22 +43.238.72.0/22 +43.238.76.0/22 +43.238.80.0/22 +43.238.84.0/22 +43.238.88.0/22 +43.238.92.0/22 +43.238.96.0/22 +43.238.100.0/22 +43.238.104.0/22 +43.238.108.0/22 +43.238.112.0/22 +43.238.116.0/22 +43.238.120.0/22 +43.238.124.0/22 +43.238.128.0/22 +43.238.132.0/22 +43.238.136.0/22 +43.238.140.0/22 +43.238.144.0/22 +43.238.148.0/22 +43.238.152.0/22 +43.238.156.0/22 +43.238.160.0/22 +43.238.164.0/22 +43.238.168.0/22 +43.238.172.0/22 +43.238.176.0/22 +43.238.180.0/22 +43.238.184.0/22 +43.238.188.0/22 +43.238.192.0/22 +43.238.196.0/22 +43.238.200.0/22 +43.238.204.0/22 +43.238.208.0/22 +43.238.212.0/22 +43.238.216.0/22 +43.238.220.0/22 +43.238.224.0/22 +43.238.228.0/22 +43.238.232.0/22 +43.238.236.0/22 +43.238.240.0/22 +43.238.244.0/22 +43.238.248.0/22 +43.238.252.0/22 +43.239.0.0/22 +43.239.4.0/22 +43.239.8.0/21 +43.239.16.0/22 +43.239.20.0/22 +43.239.24.0/22 +43.239.28.0/22 +43.239.32.0/22 +43.239.36.0/22 +43.239.40.0/22 +43.239.44.0/22 +43.239.48.0/22 +43.239.116.0/22 +43.239.120.0/22 +43.239.172.0/22 +43.239.176.0/22 +43.240.0.0/22 +43.240.56.0/22 +43.240.60.0/22 +43.240.68.0/22 +43.240.72.0/22 +43.240.76.0/22 +43.240.84.0/22 +43.240.124.0/22 +43.240.128.0/22 +43.240.132.0/22 +43.240.136.0/22 +43.240.144.0/22 +43.240.156.0/22 +43.240.160.0/22 +43.240.164.0/22 +43.240.168.0/22 +43.240.172.0/22 +43.240.176.0/22 +43.240.180.0/22 +43.240.184.0/22 +43.240.188.0/22 +43.240.192.0/22 +43.240.196.0/22 +43.240.200.0/22 +43.240.204.0/22 +43.240.208.0/22 +43.240.212.0/22 +43.240.216.0/22 +43.240.220.0/22 +43.240.236.0/22 +43.240.240.0/22 +43.240.244.0/22 +43.240.248.0/22 +43.240.252.0/22 +43.241.0.0/22 +43.241.4.0/22 +43.241.8.0/22 +43.241.12.0/22 +43.241.16.0/22 +43.241.20.0/22 +43.241.48.0/22 +43.241.76.0/22 +43.241.80.0/22 +43.241.84.0/22 +43.241.88.0/22 +43.241.92.0/22 +43.241.112.0/22 +43.241.168.0/22 +43.241.172.0/22 +43.241.176.0/22 +43.241.180.0/22 +43.241.184.0/22 +43.241.196.0/22 +43.241.208.0/22 +43.241.212.0/22 +43.241.216.0/22 +43.241.220.0/22 +43.241.224.0/22 +43.241.228.0/22 +43.241.232.0/22 +43.241.236.0/22 +43.241.240.0/22 +43.241.248.0/22 +43.241.252.0/22 +43.242.8.0/22 +43.242.12.0/22 +43.242.16.0/22 +43.242.20.0/22 +43.242.24.0/22 +43.242.28.0/22 +43.242.44.0/22 +43.242.48.0/22 +43.242.52.0/22 +43.242.56.0/22 +43.242.60.0/22 +43.242.64.0/22 +43.242.72.0/22 +43.242.76.0/22 +43.242.80.0/22 +43.242.84.0/22 +43.242.88.0/22 +43.242.92.0/22 +43.242.96.0/22 +43.242.144.0/22 +43.242.148.0/22 +43.242.152.0/22 +43.242.156.0/22 +43.242.160.0/22 +43.242.164.0/22 +43.242.168.0/22 +43.242.180.0/22 +43.242.188.0/22 +43.242.192.0/22 +43.242.196.0/22 +43.242.204.0/22 +43.242.216.0/22 +43.242.220.0/22 +43.242.252.0/22 +43.243.4.0/22 +43.243.8.0/22 +43.243.12.0/22 +43.243.16.0/22 +43.243.24.0/22 +43.243.88.0/22 +43.243.128.0/22 +43.243.136.0/22 +43.243.144.0/22 +43.243.148.0/22 +43.243.156.0/22 +43.243.168.0/22 +43.243.180.0/22 +43.243.188.0/22 +43.243.228.0/22 +43.243.232.0/22 +43.243.244.0/22 +43.246.0.0/22 +43.246.4.0/22 +43.246.8.0/22 +43.246.12.0/22 +43.246.16.0/22 +43.246.20.0/22 +43.246.24.0/22 +43.246.28.0/22 +43.246.32.0/22 +43.246.36.0/22 +43.246.40.0/22 +43.246.44.0/22 +43.246.48.0/22 +43.246.52.0/22 +43.246.56.0/22 +43.246.60.0/22 +43.246.64.0/22 +43.246.68.0/22 +43.246.72.0/22 +43.246.76.0/22 +43.246.80.0/22 +43.246.84.0/22 +43.246.88.0/22 +43.246.92.0/22 +43.246.96.0/22 +43.246.112.0/22 +43.246.212.0/22 +43.246.228.0/22 +43.247.4.0/22 +43.247.8.0/22 +43.247.44.0/22 +43.247.48.0/22 +43.247.68.0/22 +43.247.76.0/22 +43.247.84.0/22 +43.247.88.0/22 +43.247.92.0/22 +43.247.96.0/22 +43.247.100.0/22 +43.247.108.0/22 +43.247.112.0/22 +43.247.148.0/22 +43.247.152.0/22 +43.247.176.0/22 +43.247.180.0/22 +43.247.184.0/22 +43.247.188.0/22 +43.247.196.0/22 +43.247.200.0/22 +43.247.204.0/22 +43.247.208.0/22 +43.247.212.0/22 +43.247.216.0/22 +43.247.220.0/22 +43.247.224.0/22 +43.247.228.0/22 +43.247.232.0/22 +43.247.236.0/22 +43.247.240.0/22 +43.247.244.0/22 +43.247.248.0/22 +43.247.252.0/22 +43.248.0.0/22 +43.248.4.0/22 +43.248.20.0/22 +43.248.28.0/22 +43.248.48.0/22 +43.248.76.0/22 +43.248.80.0/22 +43.248.84.0/22 +43.248.88.0/22 +43.248.92.0/22 +43.248.96.0/22 +43.248.100.0/22 +43.248.104.0/22 +43.248.108.0/22 +43.248.112.0/22 +43.248.116.0/22 +43.248.120.0/22 +43.248.124.0/22 +43.248.128.0/22 +43.248.132.0/22 +43.248.136.0/22 +43.248.140.0/22 +43.248.144.0/22 +43.248.148.0/22 +43.248.176.0/22 +43.248.180.0/22 +43.248.184.0/22 +43.248.188.0/22 +43.248.192.0/22 +43.248.196.0/22 +43.248.200.0/22 +43.248.204.0/22 +43.248.208.0/22 +43.248.228.0/22 +43.248.232.0/22 +43.248.244.0/22 +43.249.4.0/22 +43.249.8.0/22 +43.249.120.0/22 +43.249.132.0/22 +43.249.136.0/22 +43.249.144.0/22 +43.249.148.0/22 +43.249.152.0/22 +43.249.156.0/22 +43.249.160.0/22 +43.249.164.0/22 +43.249.168.0/22 +43.249.192.0/22 +43.249.236.0/22 +43.250.4.0/22 +43.250.12.0/22 +43.250.16.0/22 +43.250.20.0/22 +43.250.28.0/22 +43.250.32.0/22 +43.250.36.0/22 +43.250.72.0/22 +43.250.96.0/22 +43.250.100.0/22 +43.250.104.0/22 +43.250.108.0/22 +43.250.112.0/22 +43.250.116.0/22 +43.250.128.0/22 +43.250.144.0/22 +43.250.148.0/22 +43.250.160.0/22 +43.250.168.0/22 +43.250.172.0/22 +43.250.176.0/22 +43.250.200.0/22 +43.250.212.0/22 +43.250.216.0/22 +43.250.220.0/22 +43.250.236.0/22 +43.250.244.0/22 +43.251.4.0/22 +43.251.8.0/22 +43.251.36.0/22 +43.251.100.0/22 +43.251.116.0/22 +43.251.192.0/22 +43.251.232.0/22 +43.251.236.0/22 +43.251.244.0/22 +43.252.40.0/22 +43.252.48.0/22 +43.252.56.0/22 +43.252.224.0/22 +43.254.0.0/22 +43.254.4.0/22 +43.254.8.0/22 +43.254.24.0/22 +43.254.36.0/22 +43.254.44.0/22 +43.254.52.0/22 +43.254.64.0/22 +43.254.72.0/22 +43.254.84.0/22 +43.254.88.0/22 +43.254.92.0/22 +43.254.100.0/22 +43.254.104.0/22 +43.254.112.0/22 +43.254.116.0/22 +43.254.128.0/22 +43.254.136.0/22 +43.254.140.0/22 +43.254.144.0/22 +43.254.148.0/22 +43.254.152.0/22 +43.254.156.0/22 +43.254.168.0/22 +43.254.172.0/22 +43.254.180.0/22 +43.254.184.0/22 +43.254.188.0/22 +43.254.192.0/22 +43.254.196.0/22 +43.254.200.0/22 +43.254.208.0/22 +43.254.220.0/22 +43.254.224.0/22 +43.254.228.0/22 +43.254.232.0/22 +43.254.236.0/22 +43.254.240.0/22 +43.254.248.0/22 +43.254.252.0/22 +43.255.0.0/22 +43.255.4.0/22 +43.255.8.0/22 +43.255.16.0/22 +43.255.48.0/22 +43.255.64.0/22 +43.255.68.0/22 +43.255.72.0/22 +43.255.76.0/22 +43.255.84.0/22 +43.255.96.0/22 +43.255.108.0/22 +43.255.144.0/22 +43.255.168.0/22 +43.255.176.0/22 +43.255.184.0/22 +43.255.192.0/22 +43.255.200.0/22 +43.255.204.0/22 +43.255.208.0/22 +43.255.212.0/22 +43.255.224.0/22 +43.255.228.0/22 +43.255.232.0/22 +43.255.244.0/22 +45.40.192.0/18 +45.65.16.0/22 +45.65.20.0/22 +45.65.24.0/22 +45.65.28.0/22 +45.112.132.0/22 +45.112.188.0/22 +45.112.208.0/21 +45.112.216.0/22 +45.112.220.0/22 +45.112.228.0/22 +45.112.232.0/22 +45.112.236.0/22 +45.113.12.0/22 +45.113.16.0/22 +45.113.20.0/22 +45.113.24.0/22 +45.113.28.0/22 +45.113.40.0/22 +45.113.52.0/22 +45.113.56.0/22 +45.113.72.0/22 +45.113.144.0/22 +45.113.148.0/22 +45.113.168.0/22 +45.113.176.0/22 +45.113.184.0/22 +45.113.200.0/22 +45.113.204.0/22 +45.113.208.0/22 +45.113.212.0/22 +45.113.216.0/22 +45.113.220.0/22 +45.113.240.0/22 +45.113.252.0/22 +45.114.0.0/22 +45.114.12.0/22 +45.114.32.0/22 +45.114.40.0/22 +45.114.52.0/22 +45.114.96.0/22 +45.114.104.0/22 +45.114.108.0/22 +45.114.124.0/22 +45.114.136.0/22 +45.114.196.0/22 +45.114.200.0/22 +45.114.228.0/22 +45.114.252.0/22 +45.115.44.0/22 +45.115.100.0/22 +45.115.120.0/22 +45.115.132.0/22 +45.115.144.0/22 +45.115.156.0/22 +45.115.164.0/22 +45.115.200.0/22 +45.115.212.0/22 +45.115.228.0/22 +45.115.236.0/22 +45.115.244.0/22 +45.115.248.0/22 +45.116.16.0/22 +45.116.24.0/22 +45.116.32.0/22 +45.116.36.0/22 +45.116.52.0/22 +45.116.96.0/22 +45.116.100.0/22 +45.116.140.0/22 +45.116.152.0/22 +45.116.208.0/22 +45.117.8.0/22 +45.117.20.0/22 +45.117.68.0/22 +45.117.124.0/22 +45.117.252.0/22 +45.119.52.0/22 +45.119.60.0/22 +45.119.64.0/22 +45.119.68.0/22 +45.119.72.0/22 +45.119.104.0/22 +45.119.116.0/22 +45.119.232.0/22 +45.120.100.0/22 +45.120.140.0/22 +45.120.164.0/22 +45.120.220.0/22 +45.120.240.0/22 +45.121.20.0/22 +45.121.52.0/22 +45.121.64.0/22 +45.121.68.0/22 +45.121.72.0/22 +45.121.92.0/22 +45.121.96.0/22 +45.121.172.0/22 +45.121.176.0/22 +45.121.212.0/22 +45.121.240.0/22 +45.121.244.0/22 +45.121.248.0/22 +45.121.252.0/22 +45.122.0.0/22 +45.122.4.0/22 +45.122.8.0/22 +45.122.12.0/22 +45.122.16.0/22 +45.122.20.0/22 +45.122.24.0/22 +45.122.28.0/22 +45.122.32.0/22 +45.122.36.0/22 +45.122.40.0/22 +45.122.60.0/22 +45.122.64.0/22 +45.122.68.0/22 +45.122.72.0/22 +45.122.76.0/22 +45.122.80.0/22 +45.122.84.0/22 +45.122.88.0/22 +45.122.92.0/22 +45.122.96.0/21 +45.122.104.0/22 +45.122.108.0/22 +45.122.112.0/22 +45.122.116.0/22 +45.122.160.0/22 +45.122.164.0/22 +45.122.168.0/22 +45.122.172.0/22 +45.122.176.0/22 +45.122.180.0/22 +45.122.184.0/22 +45.122.188.0/22 +45.122.192.0/22 +45.122.196.0/22 +45.122.200.0/22 +45.122.204.0/22 +45.122.208.0/22 +45.122.212.0/22 +45.122.216.0/22 +45.123.28.0/22 +45.123.32.0/22 +45.123.36.0/22 +45.123.44.0/22 +45.123.48.0/22 +45.123.52.0/22 +45.123.56.0/22 +45.123.60.0/22 +45.123.64.0/22 +45.123.68.0/22 +45.123.72.0/22 +45.123.76.0/22 +45.123.80.0/22 +45.123.84.0/22 +45.123.88.0/22 +45.123.120.0/22 +45.123.128.0/22 +45.123.132.0/22 +45.123.136.0/22 +45.123.148.0/22 +45.123.152.0/22 +45.123.156.0/22 +45.123.164.0/22 +45.123.168.0/22 +45.123.172.0/22 +45.123.176.0/22 +45.123.180.0/22 +45.123.184.0/22 +45.123.204.0/22 +45.123.212.0/22 +45.123.224.0/22 +45.123.228.0/22 +45.123.232.0/22 +45.123.236.0/22 +45.123.240.0/22 +45.123.244.0/22 +45.123.248.0/22 +45.123.252.0/22 +45.124.0.0/22 +45.124.20.0/22 +45.124.28.0/22 +45.124.32.0/22 +45.124.36.0/22 +45.124.44.0/22 +45.124.68.0/22 +45.124.76.0/22 +45.124.80.0/22 +45.124.100.0/22 +45.124.124.0/22 +45.124.172.0/22 +45.124.176.0/22 +45.124.208.0/22 +45.124.248.0/22 +45.125.12.0/22 +45.125.16.0/22 +45.125.24.0/22 +45.125.28.0/22 +45.125.32.0/22 +45.125.44.0/22 +45.125.52.0/22 +45.125.56.0/22 +45.125.76.0/22 +45.125.80.0/22 +45.125.84.0/22 +45.125.88.0/22 +45.125.92.0/22 +45.125.96.0/22 +45.125.100.0/22 +45.125.104.0/22 +45.125.136.0/22 +45.126.48.0/22 +45.126.52.0/22 +45.126.100.0/22 +45.126.108.0/22 +45.126.112.0/22 +45.126.116.0/22 +45.126.120.0/22 +45.126.212.0/22 +45.126.220.0/22 +45.127.8.0/22 +45.127.12.0/22 +45.127.96.0/22 +45.127.116.0/22 +45.127.124.0/22 +45.127.128.0/22 +45.127.144.0/22 +45.127.148.0/22 +45.127.156.0/22 +45.127.216.0/22 +45.248.8.0/22 +45.248.80.0/22 +45.248.84.0/22 +45.248.88.0/22 +45.248.96.0/22 +45.248.100.0/22 +45.248.104.0/22 +45.248.108.0/22 +45.248.128.0/22 +45.248.132.0/22 +45.248.204.0/22 +45.248.208.0/22 +45.248.212.0/22 +45.248.216.0/22 +45.248.220.0/22 +45.248.224.0/22 +45.248.228.0/22 +45.248.232.0/22 +45.248.236.0/22 +45.248.240.0/22 +45.248.244.0/22 +45.248.248.0/22 +45.248.252.0/22 +45.249.0.0/22 +45.249.4.0/22 +45.249.12.0/22 +45.249.16.0/22 +45.249.20.0/22 +45.249.24.0/22 +45.249.28.0/22 +45.249.32.0/22 +45.249.36.0/22 +45.249.92.0/22 +45.249.112.0/22 +45.249.180.0/22 +45.249.188.0/22 +45.249.192.0/22 +45.249.196.0/22 +45.249.200.0/22 +45.249.204.0/22 +45.249.208.0/22 +45.249.212.0/22 +45.250.12.0/22 +45.250.16.0/22 +45.250.28.0/22 +45.250.32.0/22 +45.250.36.0/22 +45.250.40.0/22 +45.250.76.0/22 +45.250.80.0/22 +45.250.84.0/22 +45.250.88.0/22 +45.250.92.0/22 +45.250.96.0/22 +45.250.104.0/22 +45.250.108.0/22 +45.250.112.0/22 +45.250.116.0/22 +45.250.120.0/22 +45.250.124.0/22 +45.250.128.0/22 +45.250.132.0/22 +45.250.136.0/22 +45.250.140.0/22 +45.250.144.0/22 +45.250.148.0/22 +45.250.152.0/22 +45.250.164.0/22 +45.250.180.0/22 +45.250.184.0/22 +45.250.188.0/22 +45.250.192.0/22 +45.251.0.0/22 +45.251.8.0/22 +45.251.16.0/22 +45.251.20.0/22 +45.251.52.0/22 +45.251.84.0/22 +45.251.88.0/22 +45.251.92.0/22 +45.251.96.0/22 +45.251.100.0/22 +45.251.120.0/22 +45.251.124.0/22 +45.251.136.0/22 +45.251.140.0/22 +45.251.144.0/22 +45.251.148.0/22 +45.251.152.0/22 +45.251.156.0/22 +45.251.160.0/22 +45.251.164.0/22 +45.251.168.0/22 +45.251.172.0/22 +45.251.176.0/22 +45.251.180.0/22 +45.251.184.0/22 +45.251.188.0/22 +45.251.192.0/22 +45.251.196.0/22 +45.251.200.0/22 +45.251.204.0/22 +45.251.208.0/22 +45.251.212.0/22 +45.251.216.0/22 +45.251.220.0/22 +45.251.224.0/22 +45.251.240.0/22 +45.252.0.0/22 +45.252.4.0/22 +45.252.8.0/22 +45.252.12.0/22 +45.252.16.0/22 +45.252.20.0/22 +45.252.24.0/22 +45.252.28.0/22 +45.252.32.0/22 +45.252.36.0/22 +45.252.40.0/22 +45.252.44.0/22 +45.252.48.0/22 +45.252.60.0/22 +45.252.84.0/22 +45.252.88.0/22 +45.252.92.0/22 +45.252.96.0/22 +45.252.100.0/22 +45.252.104.0/22 +45.252.108.0/22 +45.252.112.0/22 +45.252.116.0/22 +45.252.120.0/22 +45.252.124.0/22 +45.252.128.0/22 +45.252.132.0/22 +45.252.136.0/22 +45.252.140.0/22 +45.252.144.0/22 +45.252.148.0/22 +45.252.152.0/22 +45.252.156.0/22 +45.252.160.0/22 +45.252.164.0/22 +45.252.168.0/22 +45.252.172.0/22 +45.252.176.0/22 +45.252.192.0/22 +45.252.196.0/22 +45.252.200.0/22 +45.252.204.0/22 +45.252.208.0/22 +45.252.212.0/22 +45.252.216.0/22 +45.252.220.0/22 +45.252.224.0/22 +45.252.228.0/22 +45.252.232.0/22 +45.253.0.0/22 +45.253.4.0/22 +45.253.8.0/22 +45.253.12.0/22 +45.253.16.0/22 +45.253.20.0/22 +45.253.24.0/22 +45.253.28.0/22 +45.253.32.0/22 +45.253.36.0/22 +45.253.40.0/22 +45.253.44.0/22 +45.253.48.0/22 +45.253.52.0/22 +45.253.56.0/22 +45.253.60.0/22 +45.253.64.0/22 +45.253.68.0/22 +45.253.72.0/22 +45.253.76.0/22 +45.253.80.0/22 +45.253.84.0/22 +45.253.92.0/22 +45.253.96.0/22 +45.253.100.0/22 +45.253.104.0/22 +45.253.108.0/22 +45.253.112.0/22 +45.253.116.0/22 +45.253.120.0/22 +45.253.132.0/22 +45.253.136.0/22 +45.253.140.0/22 +45.253.144.0/22 +45.253.148.0/22 +45.253.152.0/22 +45.253.156.0/22 +45.253.160.0/22 +45.253.164.0/22 +45.253.168.0/22 +45.253.172.0/22 +45.253.176.0/22 +45.253.180.0/22 +45.253.184.0/22 +45.253.188.0/22 +45.253.192.0/22 +45.253.196.0/22 +45.253.200.0/22 +45.253.204.0/22 +45.253.208.0/22 +45.253.212.0/22 +45.253.216.0/22 +45.253.220.0/22 +45.253.224.0/22 +45.253.228.0/22 +45.253.232.0/22 +45.253.236.0/22 +45.253.240.0/22 +45.254.0.0/22 +45.254.4.0/22 +45.254.8.0/22 +45.254.12.0/22 +45.254.16.0/22 +45.254.20.0/22 +45.254.24.0/22 +45.254.28.0/22 +45.254.40.0/22 +45.254.48.0/22 +45.254.52.0/22 +45.254.56.0/22 +45.254.60.0/22 +45.254.64.0/22 +45.254.68.0/22 +45.254.72.0/22 +45.254.76.0/22 +45.254.80.0/22 +45.254.84.0/22 +45.254.88.0/22 +45.254.92.0/22 +45.254.96.0/22 +45.254.100.0/22 +45.254.104.0/22 +45.254.108.0/22 +45.254.112.0/22 +45.254.116.0/22 +45.254.120.0/22 +45.254.124.0/22 +45.254.128.0/22 +45.254.132.0/22 +45.254.136.0/22 +45.254.140.0/22 +45.254.144.0/22 +45.254.148.0/22 +45.254.152.0/22 +45.254.156.0/22 +45.254.160.0/22 +45.254.164.0/22 +45.254.168.0/22 +45.254.172.0/22 +45.254.176.0/22 +45.254.180.0/22 +45.254.184.0/22 +45.254.188.0/22 +45.254.192.0/22 +45.254.196.0/22 +45.254.200.0/22 +45.254.204.0/22 +45.254.208.0/22 +45.254.212.0/22 +45.254.216.0/22 +45.254.220.0/22 +45.254.224.0/22 +45.254.228.0/22 +45.254.236.0/22 +45.254.240.0/22 +45.254.248.0/22 +45.255.0.0/22 +45.255.4.0/22 +45.255.8.0/22 +45.255.12.0/22 +45.255.16.0/22 +45.255.20.0/22 +45.255.24.0/22 +45.255.28.0/22 +45.255.32.0/22 +45.255.36.0/22 +45.255.40.0/22 +45.255.44.0/22 +45.255.48.0/22 +45.255.52.0/22 +45.255.56.0/22 +45.255.60.0/22 +45.255.64.0/22 +45.255.68.0/22 +45.255.72.0/22 +45.255.76.0/22 +45.255.80.0/22 +45.255.84.0/22 +45.255.88.0/22 +45.255.92.0/22 +45.255.96.0/22 +45.255.100.0/22 +45.255.104.0/22 +45.255.108.0/22 +45.255.112.0/22 +45.255.116.0/22 +45.255.120.0/22 +45.255.124.0/22 +45.255.132.0/22 +45.255.136.0/22 +45.255.140.0/22 +45.255.144.0/22 +45.255.148.0/22 +45.255.152.0/22 +45.255.156.0/22 +45.255.160.0/22 +45.255.164.0/22 +45.255.168.0/22 +45.255.172.0/22 +45.255.176.0/22 +45.255.180.0/22 +45.255.184.0/22 +45.255.188.0/22 +45.255.192.0/22 +45.255.196.0/22 +45.255.200.0/22 +45.255.204.0/22 +45.255.208.0/22 +45.255.212.0/22 +45.255.216.0/22 +45.255.220.0/22 +45.255.224.0/22 +45.255.228.0/22 +45.255.232.0/22 +45.255.236.0/22 +45.255.240.0/22 +45.255.244.0/22 +45.255.248.0/22 +47.92.0.0/14 +47.96.0.0/11 +49.4.0.0/14 +49.51.0.0/16 +49.52.0.0/14 +49.64.0.0/11 +49.112.0.0/13 +49.120.0.0/14 +49.128.0.0/24 +49.128.2.0/23 +49.128.4.0/22 +49.140.0.0/15 +49.152.0.0/14 +49.208.0.0/15 +49.210.0.0/15 +49.220.0.0/14 +49.232.0.0/14 +49.239.0.0/18 +49.239.192.0/18 +49.246.224.0/19 +52.80.0.0/15 +52.82.0.0/15 +52.130.0.0/15 +54.222.0.0/15 +58.14.0.0/15 +58.16.0.0/16 +58.17.0.0/17 +58.17.128.0/17 +58.18.0.0/16 +58.19.0.0/16 +58.20.0.0/16 +58.21.0.0/16 +58.22.0.0/15 +58.24.0.0/15 +58.30.0.0/15 +58.32.0.0/13 +58.40.0.0/15 +58.42.0.0/16 +58.43.0.0/16 +58.44.0.0/14 +58.48.0.0/13 +58.56.0.0/15 +58.58.0.0/16 +58.59.0.0/17 +58.59.128.0/17 +58.60.0.0/14 +58.65.232.0/21 +58.66.0.0/15 +58.68.128.0/17 +58.82.0.0/17 +58.83.0.0/17 +58.83.128.0/17 +58.87.64.0/18 +58.99.128.0/17 +58.100.0.0/15 +58.116.0.0/14 +58.128.0.0/13 +58.144.0.0/16 +58.154.0.0/15 +58.192.0.0/15 +58.194.0.0/15 +58.196.0.0/15 +58.198.0.0/15 +58.200.0.0/13 +58.208.0.0/12 +58.240.0.0/15 +58.242.0.0/15 +58.244.0.0/15 +58.246.0.0/15 +58.248.0.0/13 +59.32.0.0/13 +59.40.0.0/15 +59.42.0.0/16 +59.43.0.0/16 +59.44.0.0/14 +59.48.0.0/16 +59.49.0.0/17 +59.49.128.0/17 +59.50.0.0/16 +59.51.0.0/17 +59.51.128.0/17 +59.52.0.0/14 +59.56.0.0/14 +59.60.0.0/15 +59.62.0.0/15 +59.64.0.0/14 +59.68.0.0/14 +59.72.0.0/15 +59.74.0.0/15 +59.76.0.0/16 +59.77.0.0/16 +59.78.0.0/15 +59.80.0.0/15 +59.82.0.0/15 +59.107.0.0/17 +59.107.128.0/17 +59.108.0.0/15 +59.110.0.0/15 +59.151.0.0/17 +59.152.16.0/22 +59.152.20.0/22 +59.152.24.0/22 +59.152.28.0/22 +59.152.32.0/22 +59.152.36.0/22 +59.152.64.0/22 +59.152.68.0/22 +59.152.72.0/22 +59.152.76.0/22 +59.152.112.0/22 +59.152.116.0/22 +59.153.4.0/22 +59.153.32.0/22 +59.153.60.0/22 +59.153.64.0/22 +59.153.68.0/22 +59.153.72.0/22 +59.153.92.0/22 +59.153.116.0/22 +59.153.136.0/22 +59.153.152.0/22 +59.153.156.0/22 +59.153.164.0/22 +59.153.168.0/22 +59.153.172.0/22 +59.153.176.0/22 +59.153.180.0/22 +59.153.184.0/22 +59.153.188.0/22 +59.153.192.0/22 +59.155.0.0/16 +59.172.0.0/15 +59.174.0.0/15 +59.191.0.0/17 +59.191.240.0/20 +59.192.0.0/10 +60.0.0.0/13 +60.8.0.0/15 +60.10.0.0/16 +60.11.0.0/16 +60.12.0.0/16 +60.13.0.0/18 +60.13.64.0/18 +60.13.128.0/17 +60.14.0.0/15 +60.16.0.0/13 +60.24.0.0/14 +60.28.0.0/15 +60.30.0.0/16 +60.31.0.0/16 +60.55.0.0/16 +60.63.0.0/16 +60.160.0.0/15 +60.162.0.0/15 +60.164.0.0/15 +60.166.0.0/15 +60.168.0.0/13 +60.176.0.0/12 +60.194.0.0/15 +60.200.0.0/14 +60.204.0.0/16 +60.205.0.0/16 +60.206.0.0/15 +60.208.0.0/13 +60.216.0.0/15 +60.218.0.0/15 +60.220.0.0/14 +60.232.0.0/15 +60.235.0.0/16 +60.245.128.0/17 +60.247.0.0/16 +60.252.0.0/16 +60.253.128.0/17 +60.255.0.0/16 +61.4.80.0/22 +61.4.84.0/22 +61.4.88.0/21 +61.4.176.0/20 +61.8.160.0/20 +61.14.212.0/22 +61.14.216.0/22 +61.14.220.0/22 +61.14.240.0/22 +61.14.244.0/22 +61.28.0.0/20 +61.28.16.0/20 +61.28.32.0/19 +61.28.64.0/18 +61.29.128.0/18 +61.29.192.0/19 +61.29.224.0/20 +61.45.128.0/18 +61.45.224.0/20 +61.47.128.0/18 +61.48.0.0/14 +61.52.0.0/15 +61.54.0.0/16 +61.55.0.0/16 +61.87.192.0/18 +61.128.0.0/15 +61.130.0.0/15 +61.132.0.0/16 +61.133.0.0/17 +61.133.128.0/17 +61.134.0.0/18 +61.134.64.0/19 +61.134.96.0/19 +61.134.128.0/18 +61.134.192.0/18 +61.135.0.0/16 +61.136.0.0/18 +61.136.64.0/18 +61.136.128.0/17 +61.137.0.0/17 +61.137.128.0/17 +61.138.0.0/18 +61.138.64.0/18 +61.138.128.0/18 +61.138.192.0/18 +61.139.0.0/17 +61.139.128.0/18 +61.139.192.0/18 +61.140.0.0/14 +61.144.0.0/14 +61.148.0.0/15 +61.150.0.0/15 +61.152.0.0/16 +61.153.0.0/16 +61.154.0.0/15 +61.156.0.0/16 +61.157.0.0/16 +61.158.0.0/17 +61.158.128.0/17 +61.159.0.0/18 +61.159.64.0/18 +61.159.128.0/17 +61.160.0.0/16 +61.161.0.0/18 +61.161.64.0/18 +61.161.128.0/17 +61.162.0.0/16 +61.163.0.0/16 +61.164.0.0/16 +61.165.0.0/16 +61.166.0.0/16 +61.167.0.0/16 +61.168.0.0/16 +61.169.0.0/16 +61.170.0.0/15 +61.172.0.0/14 +61.176.0.0/16 +61.177.0.0/16 +61.178.0.0/16 +61.179.0.0/16 +61.180.0.0/17 +61.180.128.0/17 +61.181.0.0/16 +61.182.0.0/16 +61.183.0.0/16 +61.184.0.0/14 +61.188.0.0/16 +61.189.0.0/17 +61.189.128.0/17 +61.190.0.0/15 +61.232.0.0/14 +61.236.0.0/15 +61.240.0.0/14 +62.234.0.0/16 +68.79.0.0/18 +69.230.192.0/18 +69.231.128.0/18 +69.234.192.0/18 +69.235.128.0/18 +71.131.192.0/18 +71.132.0.0/18 +71.136.64.0/18 +71.137.0.0/18 +81.68.0.0/14 +82.156.0.0/15 +94.191.0.0/17 +101.0.0.0/22 +101.1.0.0/22 +101.2.172.0/22 +101.4.0.0/14 +101.16.0.0/12 +101.33.128.0/17 +101.34.0.0/15 +101.36.0.0/17 +101.36.128.0/17 +101.37.0.0/16 +101.38.0.0/15 +101.40.0.0/15 +101.42.0.0/15 +101.44.0.0/14 +101.48.0.0/15 +101.50.8.0/22 +101.50.12.0/22 +101.50.56.0/22 +101.52.0.0/16 +101.53.100.0/22 +101.54.0.0/16 +101.55.224.0/21 +101.64.0.0/13 +101.72.0.0/14 +101.76.0.0/15 +101.78.0.0/22 +101.78.32.0/19 +101.80.0.0/12 +101.96.0.0/21 +101.96.8.0/22 +101.96.16.0/20 +101.96.128.0/17 +101.99.96.0/19 +101.101.64.0/19 +101.101.100.0/24 +101.101.102.0/23 +101.101.104.0/21 +101.101.112.0/20 +101.102.64.0/19 +101.102.100.0/23 +101.102.102.0/24 +101.102.104.0/21 +101.102.112.0/20 +101.104.0.0/14 +101.110.64.0/19 +101.110.96.0/20 +101.110.116.0/22 +101.110.120.0/21 +101.120.0.0/14 +101.124.0.0/15 +101.126.0.0/16 +101.128.0.0/22 +101.128.8.0/21 +101.128.16.0/20 +101.128.32.0/19 +101.129.0.0/16 +101.130.0.0/15 +101.132.0.0/14 +101.144.0.0/12 +101.192.0.0/14 +101.196.0.0/16 +101.197.0.0/16 +101.198.0.0/15 +101.200.0.0/15 +101.203.128.0/19 +101.203.160.0/21 +101.203.172.0/22 +101.203.176.0/20 +101.204.0.0/14 +101.224.0.0/13 +101.232.0.0/15 +101.234.64.0/21 +101.234.76.0/22 +101.234.80.0/20 +101.234.96.0/19 +101.236.0.0/14 +101.240.0.0/14 +101.244.0.0/14 +101.248.0.0/15 +101.251.0.0/22 +101.251.8.0/21 +101.251.16.0/20 +101.251.32.0/19 +101.251.64.0/18 +101.251.128.0/17 +101.252.0.0/15 +101.254.0.0/16 +103.1.8.0/22 +103.1.20.0/22 +103.1.24.0/22 +103.1.72.0/22 +103.1.88.0/22 +103.1.168.0/22 +103.2.108.0/22 +103.2.156.0/22 +103.2.164.0/22 +103.2.200.0/22 +103.2.204.0/22 +103.2.208.0/22 +103.2.212.0/22 +103.3.84.0/22 +103.3.88.0/22 +103.3.92.0/22 +103.3.96.0/22 +103.3.100.0/22 +103.3.104.0/22 +103.3.108.0/22 +103.3.112.0/22 +103.3.116.0/22 +103.3.120.0/22 +103.3.124.0/22 +103.3.128.0/22 +103.3.132.0/22 +103.3.136.0/22 +103.3.140.0/22 +103.3.148.0/22 +103.3.152.0/22 +103.3.156.0/22 +103.4.56.0/22 +103.4.168.0/22 +103.4.184.0/22 +103.4.224.0/22 +103.5.36.0/22 +103.5.52.0/22 +103.5.56.0/22 +103.5.152.0/22 +103.5.168.0/22 +103.5.192.0/22 +103.5.252.0/22 +103.6.76.0/22 +103.6.108.0/22 +103.6.220.0/22 +103.6.228.0/22 +103.7.4.0/22 +103.7.28.0/22 +103.7.140.0/22 +103.7.212.0/22 +103.7.216.0/22 +103.7.220.0/22 +103.8.0.0/22 +103.8.4.0/22 +103.8.8.0/22 +103.8.32.0/22 +103.8.52.0/22 +103.8.68.0/22 +103.8.108.0/22 +103.8.156.0/22 +103.8.200.0/22 +103.8.204.0/22 +103.8.220.0/22 +103.9.8.0/22 +103.9.24.0/22 +103.9.108.0/22 +103.9.152.0/22 +103.9.192.0/22 +103.9.248.0/22 +103.9.252.0/22 +103.10.0.0/22 +103.10.16.0/22 +103.10.84.0/22 +103.10.140.0/22 +103.11.16.0/22 +103.11.168.0/22 +103.11.180.0/22 +103.12.32.0/22 +103.12.68.0/22 +103.12.92.0/22 +103.12.136.0/22 +103.12.184.0/22 +103.12.232.0/22 +103.13.12.0/22 +103.13.124.0/22 +103.13.144.0/22 +103.13.196.0/22 +103.13.220.0/22 +103.13.244.0/22 +103.14.32.0/22 +103.14.84.0/22 +103.14.100.0/22 +103.14.132.0/22 +103.14.136.0/22 +103.14.156.0/22 +103.14.240.0/22 +103.15.4.0/22 +103.15.8.0/22 +103.15.16.0/22 +103.15.96.0/22 +103.15.200.0/22 +103.16.52.0/22 +103.16.80.0/22 +103.16.84.0/22 +103.16.88.0/22 +103.16.108.0/22 +103.16.124.0/22 +103.17.40.0/22 +103.17.64.0/22 +103.17.120.0/22 +103.17.136.0/22 +103.17.160.0/22 +103.17.204.0/22 +103.17.228.0/22 +103.18.192.0/22 +103.18.208.0/22 +103.18.212.0/22 +103.18.224.0/22 +103.19.0.0/22 +103.19.12.0/22 +103.19.40.0/22 +103.19.44.0/22 +103.19.64.0/22 +103.19.68.0/22 +103.19.72.0/22 +103.19.232.0/22 +103.20.12.0/22 +103.20.32.0/22 +103.20.44.0/22 +103.20.68.0/22 +103.20.112.0/22 +103.20.128.0/22 +103.20.160.0/22 +103.20.248.0/22 +103.21.112.0/22 +103.21.116.0/22 +103.21.136.0/22 +103.21.140.0/22 +103.21.176.0/22 +103.21.208.0/22 +103.21.240.0/22 +103.22.0.0/22 +103.22.4.0/22 +103.22.8.0/22 +103.22.12.0/22 +103.22.16.0/22 +103.22.20.0/22 +103.22.24.0/22 +103.22.28.0/22 +103.22.32.0/22 +103.22.36.0/22 +103.22.40.0/22 +103.22.44.0/22 +103.22.48.0/22 +103.22.52.0/22 +103.22.56.0/22 +103.22.60.0/22 +103.22.64.0/22 +103.22.68.0/22 +103.22.72.0/22 +103.22.76.0/22 +103.22.80.0/22 +103.22.84.0/22 +103.22.88.0/22 +103.22.92.0/22 +103.22.100.0/22 +103.22.104.0/22 +103.22.108.0/22 +103.22.112.0/22 +103.22.116.0/22 +103.22.120.0/22 +103.22.124.0/22 +103.22.188.0/22 +103.22.228.0/22 +103.22.252.0/22 +103.23.8.0/22 +103.23.56.0/22 +103.23.160.0/22 +103.23.164.0/22 +103.23.176.0/22 +103.23.228.0/22 +103.24.24.0/22 +103.24.116.0/22 +103.24.128.0/22 +103.24.144.0/22 +103.24.176.0/22 +103.24.184.0/22 +103.24.220.0/22 +103.24.228.0/22 +103.24.248.0/22 +103.24.252.0/22 +103.25.8.0/23 +103.25.20.0/22 +103.25.24.0/22 +103.25.28.0/22 +103.25.32.0/22 +103.25.36.0/22 +103.25.40.0/22 +103.25.48.0/22 +103.25.64.0/22 +103.25.68.0/22 +103.25.148.0/22 +103.25.156.0/22 +103.25.216.0/22 +103.26.0.0/22 +103.26.64.0/22 +103.26.76.0/22 +103.26.132.0/22 +103.26.156.0/22 +103.26.160.0/22 +103.26.228.0/22 +103.26.240.0/22 +103.27.4.0/22 +103.27.12.0/22 +103.27.24.0/22 +103.27.56.0/22 +103.27.96.0/22 +103.27.184.0/22 +103.27.208.0/22 +103.27.212.0/22 +103.27.240.0/22 +103.28.4.0/22 +103.28.8.0/22 +103.28.184.0/22 +103.28.204.0/22 +103.28.212.0/22 +103.29.16.0/22 +103.29.128.0/22 +103.29.132.0/22 +103.29.136.0/22 +103.30.20.0/22 +103.30.96.0/22 +103.30.148.0/22 +103.30.200.0/22 +103.30.228.0/22 +103.30.236.0/22 +103.31.0.0/22 +103.31.48.0/22 +103.31.52.0/22 +103.31.56.0/22 +103.31.60.0/22 +103.31.64.0/22 +103.31.68.0/22 +103.31.148.0/22 +103.31.160.0/22 +103.31.168.0/22 +103.31.200.0/22 +103.31.236.0/22 +103.32.0.0/22 +103.32.4.0/22 +103.32.8.0/22 +103.32.12.0/22 +103.32.16.0/22 +103.32.20.0/22 +103.32.24.0/22 +103.32.28.0/22 +103.32.32.0/22 +103.32.36.0/22 +103.32.40.0/22 +103.32.44.0/22 +103.32.48.0/22 +103.32.52.0/22 +103.32.56.0/22 +103.32.60.0/22 +103.32.64.0/22 +103.32.68.0/22 +103.32.72.0/22 +103.32.76.0/22 +103.32.80.0/22 +103.32.84.0/22 +103.32.88.0/22 +103.32.92.0/22 +103.32.96.0/22 +103.32.100.0/22 +103.32.104.0/22 +103.32.108.0/22 +103.32.112.0/22 +103.32.116.0/22 +103.32.120.0/22 +103.32.124.0/22 +103.32.128.0/22 +103.32.132.0/22 +103.32.136.0/22 +103.32.140.0/22 +103.32.144.0/22 +103.32.148.0/22 +103.32.152.0/22 +103.32.156.0/22 +103.32.160.0/22 +103.32.164.0/22 +103.32.168.0/22 +103.32.172.0/22 +103.32.176.0/22 +103.32.180.0/22 +103.32.184.0/22 +103.32.188.0/22 +103.32.192.0/22 +103.32.196.0/22 +103.32.200.0/22 +103.32.204.0/22 +103.32.208.0/22 +103.32.212.0/22 +103.32.216.0/22 +103.32.220.0/22 +103.32.224.0/22 +103.32.228.0/22 +103.32.232.0/22 +103.32.236.0/22 +103.32.240.0/22 +103.32.244.0/22 +103.32.248.0/22 +103.32.252.0/22 +103.33.0.0/22 +103.33.4.0/22 +103.33.8.0/22 +103.33.12.0/22 +103.33.16.0/22 +103.33.20.0/22 +103.33.24.0/22 +103.33.28.0/22 +103.33.32.0/22 +103.33.36.0/22 +103.33.40.0/22 +103.33.44.0/22 +103.33.48.0/22 +103.33.52.0/22 +103.33.56.0/22 +103.33.60.0/22 +103.33.64.0/22 +103.33.68.0/22 +103.33.72.0/22 +103.33.76.0/22 +103.33.80.0/22 +103.33.84.0/22 +103.33.88.0/22 +103.33.92.0/22 +103.33.96.0/22 +103.33.100.0/22 +103.33.104.0/22 +103.33.108.0/22 +103.33.112.0/22 +103.33.116.0/22 +103.33.120.0/22 +103.33.124.0/22 +103.33.128.0/22 +103.33.132.0/22 +103.33.136.0/22 +103.33.140.0/22 +103.33.144.0/22 +103.33.148.0/22 +103.33.152.0/22 +103.33.156.0/22 +103.33.160.0/22 +103.33.164.0/22 +103.33.168.0/22 +103.33.172.0/22 +103.33.176.0/22 +103.33.180.0/22 +103.33.184.0/22 +103.33.188.0/22 +103.33.192.0/22 +103.33.196.0/22 +103.33.200.0/22 +103.33.204.0/22 +103.33.208.0/22 +103.33.212.0/22 +103.33.216.0/22 +103.33.220.0/22 +103.33.224.0/22 +103.33.228.0/22 +103.33.232.0/22 +103.33.236.0/22 +103.33.240.0/22 +103.33.244.0/22 +103.33.248.0/22 +103.33.252.0/22 +103.34.0.0/22 +103.34.4.0/22 +103.34.8.0/22 +103.34.12.0/22 +103.34.16.0/22 +103.34.20.0/22 +103.34.24.0/22 +103.34.28.0/22 +103.34.32.0/22 +103.34.36.0/22 +103.34.40.0/22 +103.34.44.0/22 +103.34.48.0/22 +103.34.52.0/22 +103.34.56.0/22 +103.34.60.0/22 +103.34.64.0/22 +103.34.68.0/22 +103.34.72.0/22 +103.34.76.0/22 +103.34.80.0/22 +103.34.84.0/22 +103.34.88.0/22 +103.34.92.0/22 +103.34.96.0/22 +103.34.100.0/22 +103.34.104.0/22 +103.34.108.0/22 +103.34.112.0/22 +103.34.116.0/22 +103.34.120.0/22 +103.34.124.0/22 +103.34.128.0/22 +103.34.132.0/22 +103.34.136.0/22 +103.34.140.0/22 +103.34.144.0/22 +103.34.148.0/22 +103.34.152.0/22 +103.34.156.0/22 +103.34.160.0/22 +103.34.164.0/22 +103.34.168.0/22 +103.34.172.0/22 +103.34.176.0/22 +103.34.180.0/22 +103.34.184.0/22 +103.34.188.0/22 +103.34.192.0/22 +103.34.196.0/22 +103.34.200.0/22 +103.34.204.0/22 +103.34.208.0/22 +103.34.212.0/22 +103.34.216.0/22 +103.34.220.0/22 +103.34.224.0/22 +103.34.228.0/22 +103.34.232.0/22 +103.34.236.0/22 +103.34.240.0/22 +103.34.244.0/22 +103.34.248.0/22 +103.34.252.0/22 +103.35.0.0/22 +103.35.4.0/22 +103.35.8.0/22 +103.35.12.0/22 +103.35.16.0/22 +103.35.20.0/22 +103.35.24.0/22 +103.35.28.0/22 +103.35.32.0/22 +103.35.36.0/22 +103.35.40.0/22 +103.35.44.0/22 +103.35.48.0/22 +103.35.104.0/22 +103.35.116.0/22 +103.35.180.0/22 +103.35.200.0/22 +103.35.220.0/22 +103.36.28.0/22 +103.36.36.0/22 +103.36.56.0/22 +103.36.60.0/22 +103.36.64.0/22 +103.36.72.0/22 +103.36.96.0/22 +103.36.132.0/22 +103.36.136.0/22 +103.36.160.0/22 +103.36.164.0/22 +103.36.168.0/22 +103.36.172.0/22 +103.36.176.0/22 +103.36.180.0/22 +103.36.184.0/22 +103.36.188.0/22 +103.36.192.0/22 +103.36.196.0/22 +103.36.200.0/22 +103.36.204.0/22 +103.36.208.0/22 +103.36.212.0/22 +103.36.216.0/22 +103.36.220.0/22 +103.36.224.0/22 +103.36.228.0/22 +103.36.232.0/22 +103.36.236.0/22 +103.36.240.0/22 +103.36.244.0/22 +103.37.0.0/22 +103.37.12.0/22 +103.37.16.0/22 +103.37.24.0/22 +103.37.44.0/22 +103.37.52.0/22 +103.37.56.0/22 +103.37.72.0/22 +103.37.100.0/22 +103.37.104.0/22 +103.37.124.0/22 +103.37.136.0/22 +103.37.140.0/22 +103.37.144.0/22 +103.37.148.0/22 +103.37.152.0/22 +103.37.156.0/22 +103.37.160.0/22 +103.37.164.0/22 +103.37.172.0/22 +103.37.176.0/22 +103.37.188.0/22 +103.37.208.0/22 +103.37.212.0/22 +103.37.216.0/22 +103.37.220.0/22 +103.37.248.0/22 +103.37.252.0/22 +103.38.0.0/22 +103.38.32.0/22 +103.38.40.0/22 +103.38.44.0/22 +103.38.56.0/22 +103.38.76.0/22 +103.38.84.0/22 +103.38.92.0/22 +103.38.96.0/22 +103.38.116.0/22 +103.38.132.0/22 +103.38.140.0/22 +103.38.224.0/22 +103.38.228.0/22 +103.38.232.0/22 +103.38.252.0/22 +103.39.16.0/22 +103.39.64.0/22 +103.39.88.0/22 +103.39.100.0/22 +103.39.104.0/22 +103.39.108.0/22 +103.39.160.0/22 +103.39.164.0/22 +103.39.168.0/22 +103.39.172.0/22 +103.39.176.0/22 +103.39.180.0/22 +103.39.184.0/22 +103.39.188.0/22 +103.39.200.0/22 +103.39.204.0/22 +103.39.208.0/22 +103.39.212.0/22 +103.39.216.0/22 +103.39.220.0/22 +103.39.224.0/22 +103.39.228.0/22 +103.39.232.0/22 +103.40.12.0/22 +103.40.16.0/22 +103.40.20.0/22 +103.40.24.0/22 +103.40.28.0/22 +103.40.32.0/22 +103.40.36.0/22 +103.40.40.0/22 +103.40.44.0/22 +103.40.88.0/22 +103.40.100.0/22 +103.40.192.0/22 +103.40.212.0/22 +103.40.220.0/22 +103.40.228.0/22 +103.40.232.0/22 +103.40.236.0/22 +103.40.240.0/22 +103.40.244.0/22 +103.40.248.0/22 +103.40.252.0/22 +103.41.0.0/22 +103.41.16.0/22 +103.41.52.0/22 +103.41.140.0/22 +103.41.148.0/22 +103.41.152.0/22 +103.41.160.0/22 +103.41.164.0/22 +103.41.220.0/22 +103.41.224.0/22 +103.41.228.0/22 +103.41.232.0/22 +103.42.8.0/22 +103.42.24.0/22 +103.42.28.0/22 +103.42.32.0/22 +103.42.64.0/22 +103.42.68.0/22 +103.42.76.0/22 +103.42.104.0/22 +103.42.180.0/22 +103.42.232.0/22 +103.43.16.0/22 +103.43.84.0/22 +103.43.96.0/22 +103.43.100.0/22 +103.43.104.0/22 +103.43.124.0/22 +103.43.184.0/22 +103.43.192.0/22 +103.43.196.0/22 +103.43.208.0/22 +103.43.220.0/22 +103.43.224.0/22 +103.43.240.0/22 +103.44.56.0/22 +103.44.80.0/22 +103.44.88.0/22 +103.44.120.0/22 +103.44.124.0/22 +103.44.132.0/22 +103.44.144.0/22 +103.44.168.0/22 +103.44.176.0/22 +103.44.180.0/22 +103.44.184.0/22 +103.44.188.0/22 +103.44.192.0/22 +103.44.196.0/22 +103.44.200.0/22 +103.44.204.0/22 +103.44.224.0/22 +103.44.236.0/22 +103.44.240.0/22 +103.44.244.0/22 +103.44.248.0/22 +103.44.252.0/22 +103.45.0.0/22 +103.45.4.0/22 +103.45.8.0/22 +103.45.12.0/22 +103.45.16.0/22 +103.45.20.0/22 +103.45.24.0/22 +103.45.28.0/22 +103.45.32.0/22 +103.45.36.0/22 +103.45.40.0/22 +103.45.44.0/22 +103.45.48.0/22 +103.45.52.0/22 +103.45.56.0/22 +103.45.60.0/22 +103.45.72.0/22 +103.45.76.0/22 +103.45.80.0/22 +103.45.84.0/22 +103.45.88.0/22 +103.45.92.0/22 +103.45.96.0/22 +103.45.100.0/22 +103.45.104.0/22 +103.45.108.0/22 +103.45.112.0/22 +103.45.116.0/22 +103.45.120.0/22 +103.45.124.0/22 +103.45.128.0/22 +103.45.132.0/22 +103.45.136.0/22 +103.45.140.0/22 +103.45.144.0/22 +103.45.148.0/22 +103.45.152.0/22 +103.45.156.0/22 +103.45.160.0/22 +103.45.164.0/22 +103.45.168.0/22 +103.45.172.0/22 +103.45.176.0/22 +103.45.180.0/22 +103.45.184.0/22 +103.45.188.0/22 +103.45.192.0/22 +103.45.196.0/22 +103.45.200.0/22 +103.45.204.0/22 +103.45.208.0/22 +103.45.212.0/22 +103.45.216.0/22 +103.45.220.0/22 +103.45.224.0/22 +103.45.248.0/22 +103.46.0.0/22 +103.46.12.0/22 +103.46.16.0/22 +103.46.20.0/22 +103.46.24.0/22 +103.46.28.0/22 +103.46.32.0/22 +103.46.36.0/22 +103.46.40.0/22 +103.46.44.0/22 +103.46.48.0/22 +103.46.52.0/22 +103.46.56.0/22 +103.46.60.0/22 +103.46.64.0/22 +103.46.68.0/22 +103.46.72.0/22 +103.46.76.0/22 +103.46.80.0/22 +103.46.84.0/22 +103.46.88.0/22 +103.46.92.0/22 +103.46.96.0/22 +103.46.100.0/22 +103.46.104.0/22 +103.46.108.0/22 +103.46.112.0/22 +103.46.116.0/22 +103.46.120.0/22 +103.46.124.0/22 +103.46.128.0/22 +103.46.132.0/22 +103.46.136.0/22 +103.46.152.0/22 +103.46.156.0/22 +103.46.160.0/22 +103.46.164.0/22 +103.46.168.0/22 +103.46.172.0/22 +103.46.176.0/22 +103.46.180.0/22 +103.46.244.0/22 +103.46.248.0/22 +103.47.4.0/22 +103.47.20.0/22 +103.47.36.0/22 +103.47.40.0/22 +103.47.48.0/22 +103.47.80.0/22 +103.47.96.0/22 +103.47.108.0/22 +103.47.116.0/22 +103.47.120.0/22 +103.47.136.0/22 +103.47.140.0/22 +103.47.212.0/22 +103.48.52.0/22 +103.48.92.0/22 +103.48.144.0/22 +103.48.148.0/22 +103.48.152.0/22 +103.48.156.0/22 +103.48.202.0/23 +103.48.216.0/22 +103.48.220.0/22 +103.48.224.0/22 +103.48.228.0/22 +103.48.232.0/22 +103.48.236.0/22 +103.48.240.0/22 +103.48.244.0/22 +103.49.12.0/22 +103.49.20.0/22 +103.49.72.0/22 +103.49.76.0/22 +103.49.92.0/22 +103.49.96.0/22 +103.49.108.0/22 +103.49.128.0/22 +103.49.176.0/22 +103.49.180.0/22 +103.49.196.0/22 +103.50.36.0/22 +103.50.44.0/22 +103.50.48.0/22 +103.50.52.0/22 +103.50.56.0/22 +103.50.60.0/22 +103.50.64.0/22 +103.50.68.0/22 +103.50.72.0/22 +103.50.108.0/22 +103.50.112.0/22 +103.50.116.0/22 +103.50.120.0/22 +103.50.124.0/22 +103.50.132.0/22 +103.50.136.0/22 +103.50.140.0/22 +103.50.172.0/22 +103.50.176.0/22 +103.50.180.0/22 +103.50.184.0/22 +103.50.188.0/22 +103.50.192.0/22 +103.50.196.0/22 +103.50.200.0/22 +103.50.220.0/22 +103.50.224.0/22 +103.50.228.0/22 +103.50.232.0/22 +103.50.236.0/22 +103.50.240.0/22 +103.50.244.0/22 +103.50.248.0/22 +103.52.40.0/22 +103.52.72.0/22 +103.52.76.0/22 +103.52.80.0/22 +103.52.84.0/22 +103.52.96.0/22 +103.52.100.0/22 +103.52.104.0/22 +103.52.160.0/22 +103.52.164.0/22 +103.52.172.0/22 +103.52.176.0/22 +103.52.184.0/22 +103.52.196.0/22 +103.53.4.0/22 +103.53.64.0/22 +103.53.68.0/22 +103.53.92.0/22 +103.53.100.0/22 +103.53.124.0/22 +103.53.128.0/22 +103.53.132.0/22 +103.53.136.0/22 +103.53.140.0/22 +103.53.144.0/22 +103.53.180.0/22 +103.53.204.0/22 +103.53.208.0/22 +103.53.212.0/22 +103.53.216.0/22 +103.53.236.0/22 +103.53.248.0/22 +103.54.8.0/22 +103.54.48.0/22 +103.54.60.0/22 +103.54.160.0/22 +103.54.164.0/22 +103.54.212.0/22 +103.54.240.0/22 +103.55.24.0/22 +103.55.80.0/22 +103.55.120.0/22 +103.55.152.0/22 +103.55.172.0/22 +103.55.204.0/22 +103.55.208.0/22 +103.55.228.0/22 +103.55.236.0/22 +103.56.8.0/22 +103.56.16.0/22 +103.56.20.0/22 +103.56.32.0/22 +103.56.52.0/22 +103.56.56.0/22 +103.56.60.0/22 +103.56.72.0/22 +103.56.76.0/22 +103.56.140.0/22 +103.56.152.0/22 +103.56.184.0/22 +103.56.200.0/22 +103.57.12.0/22 +103.57.52.0/22 +103.57.56.0/22 +103.57.76.0/22 +103.57.136.0/22 +103.57.196.0/22 +103.58.24.0/22 +103.59.76.0/22 +103.59.100.0/22 +103.59.112.0/22 +103.59.116.0/22 +103.59.120.0/22 +103.59.124.0/22 +103.59.128.0/22 +103.59.148.0/22 +103.59.164.0/22 +103.60.32.0/22 +103.60.44.0/22 +103.60.164.0/22 +103.60.228.0/22 +103.60.236.0/22 +103.61.60.0/22 +103.61.104.0/22 +103.61.140.0/22 +103.61.152.0/22 +103.61.156.0/22 +103.61.160.0/22 +103.61.172.0/22 +103.61.176.0/22 +103.61.184.0/22 +103.61.188.0/22 +103.62.24.0/22 +103.62.52.0/22 +103.62.72.0/22 +103.62.76.0/22 +103.62.80.0/22 +103.62.84.0/22 +103.62.88.0/22 +103.62.96.0/22 +103.62.100.0/22 +103.62.104.0/22 +103.62.108.0/22 +103.62.112.0/22 +103.62.116.0/22 +103.62.120.0/22 +103.62.124.0/22 +103.62.128.0/22 +103.62.132.0/22 +103.62.156.0/22 +103.62.160.0/22 +103.62.164.0/22 +103.62.168.0/22 +103.62.172.0/22 +103.62.176.0/22 +103.62.180.0/22 +103.62.184.0/22 +103.62.188.0/22 +103.62.192.0/22 +103.62.204.0/22 +103.62.208.0/22 +103.62.212.0/22 +103.62.216.0/22 +103.62.220.0/22 +103.62.224.0/22 +103.63.32.0/22 +103.63.36.0/22 +103.63.40.0/22 +103.63.44.0/22 +103.63.48.0/22 +103.63.52.0/22 +103.63.56.0/22 +103.63.60.0/22 +103.63.64.0/22 +103.63.68.0/22 +103.63.72.0/22 +103.63.76.0/22 +103.63.80.0/22 +103.63.84.0/22 +103.63.88.0/22 +103.63.140.0/22 +103.63.144.0/22 +103.63.152.0/22 +103.63.160.0/22 +103.63.164.0/22 +103.63.168.0/22 +103.63.172.0/22 +103.63.176.0/22 +103.63.180.0/22 +103.63.184.0/22 +103.63.192.0/22 +103.63.196.0/22 +103.63.200.0/22 +103.63.204.0/22 +103.63.208.0/22 +103.63.240.0/22 +103.63.244.0/22 +103.63.248.0/22 +103.63.252.0/22 +103.64.0.0/22 +103.64.4.0/22 +103.64.24.0/22 +103.64.28.0/22 +103.64.32.0/22 +103.64.36.0/22 +103.64.40.0/22 +103.64.44.0/22 +103.64.48.0/22 +103.64.52.0/22 +103.64.56.0/22 +103.64.60.0/22 +103.64.64.0/22 +103.64.68.0/22 +103.64.72.0/22 +103.64.76.0/22 +103.64.80.0/22 +103.64.84.0/22 +103.64.88.0/22 +103.64.92.0/22 +103.64.96.0/22 +103.64.100.0/22 +103.64.104.0/22 +103.64.108.0/22 +103.64.112.0/22 +103.64.116.0/22 +103.64.120.0/22 +103.64.124.0/22 +103.64.140.0/22 +103.64.144.0/22 +103.64.152.0/22 +103.64.156.0/22 +103.64.160.0/22 +103.64.164.0/22 +103.64.168.0/22 +103.64.172.0/22 +103.64.176.0/22 +103.64.180.0/22 +103.64.184.0/22 +103.64.188.0/22 +103.64.192.0/22 +103.64.196.0/22 +103.64.200.0/22 +103.64.204.0/22 +103.64.208.0/22 +103.64.212.0/22 +103.64.216.0/22 +103.64.220.0/22 +103.64.224.0/22 +103.64.228.0/22 +103.64.232.0/22 +103.64.236.0/22 +103.64.240.0/22 +103.64.244.0/22 +103.64.248.0/22 +103.64.252.0/22 +103.65.0.0/22 +103.65.4.0/22 +103.65.8.0/22 +103.65.12.0/22 +103.65.16.0/22 +103.65.36.0/22 +103.65.40.0/22 +103.65.48.0/22 +103.65.52.0/22 +103.65.56.0/22 +103.65.60.0/22 +103.65.64.0/22 +103.65.68.0/22 +103.65.72.0/22 +103.65.76.0/22 +103.65.80.0/22 +103.65.84.0/22 +103.65.88.0/22 +103.65.92.0/22 +103.65.100.0/22 +103.65.104.0/22 +103.65.108.0/22 +103.65.112.0/22 +103.65.144.0/22 +103.65.148.0/22 +103.65.152.0/22 +103.65.156.0/22 +103.65.160.0/22 +103.65.164.0/22 +103.65.168.0/22 +103.65.172.0/22 +103.66.32.0/22 +103.66.40.0/22 +103.66.92.0/22 +103.66.108.0/22 +103.66.200.0/22 +103.66.216.0/22 +103.66.240.0/22 +103.66.244.0/22 +103.66.248.0/22 +103.66.252.0/22 +103.67.0.0/22 +103.67.4.0/22 +103.67.8.0/22 +103.67.100.0/22 +103.67.104.0/22 +103.67.108.0/22 +103.67.112.0/22 +103.67.116.0/22 +103.67.120.0/22 +103.67.124.0/22 +103.67.128.0/22 +103.67.132.0/22 +103.67.136.0/22 +103.67.140.0/22 +103.67.144.0/22 +103.67.148.0/22 +103.67.172.0/22 +103.67.192.0/22 +103.67.212.0/22 +103.67.252.0/22 +103.68.64.0/22 +103.68.88.0/22 +103.68.100.0/22 +103.68.128.0/22 +103.68.192.0/22 +103.69.16.0/22 +103.69.116.0/22 +103.69.132.0/22 +103.69.152.0/22 +103.69.212.0/22 +103.70.8.0/22 +103.70.148.0/22 +103.70.184.0/22 +103.70.220.0/22 +103.70.224.0/22 +103.70.236.0/22 +103.70.252.0/22 +103.71.0.0/22 +103.71.32.0/22 +103.71.48.0/22 +103.71.68.0/22 +103.71.72.0/22 +103.71.80.0/22 +103.71.84.0/22 +103.71.88.0/22 +103.71.120.0/22 +103.71.124.0/22 +103.71.128.0/22 +103.71.144.0/22 +103.71.196.0/22 +103.71.200.0/22 +103.71.232.0/22 +103.72.12.0/22 +103.72.16.0/22 +103.72.20.0/22 +103.72.24.0/22 +103.72.28.0/22 +103.72.32.0/22 +103.72.36.0/22 +103.72.40.0/22 +103.72.44.0/22 +103.72.48.0/22 +103.72.52.0/22 +103.72.112.0/22 +103.72.116.0/22 +103.72.120.0/22 +103.72.124.0/22 +103.72.128.0/22 +103.72.132.0/22 +103.72.144.0/22 +103.72.148.0/22 +103.72.172.0/22 +103.72.180.0/22 +103.72.224.0/22 +103.72.228.0/22 +103.72.232.0/22 +103.72.236.0/22 +103.72.240.0/22 +103.72.244.0/22 +103.72.248.0/22 +103.72.252.0/22 +103.73.0.0/22 +103.73.4.0/22 +103.73.8.0/22 +103.73.12.0/22 +103.73.16.0/22 +103.73.20.0/22 +103.73.24.0/22 +103.73.28.0/22 +103.73.48.0/22 +103.73.88.0/22 +103.73.96.0/22 +103.73.116.0/22 +103.73.120.0/22 +103.73.128.0/22 +103.73.132.0/22 +103.73.136.0/22 +103.73.140.0/22 +103.73.144.0/22 +103.73.168.0/22 +103.73.176.0/22 +103.73.204.0/22 +103.73.208.0/22 +103.73.240.0/22 +103.73.244.0/22 +103.73.248.0/22 +103.74.24.0/22 +103.74.28.0/22 +103.74.32.0/22 +103.74.36.0/22 +103.74.40.0/22 +103.74.44.0/22 +103.74.48.0/22 +103.74.56.0/22 +103.74.60.0/22 +103.74.80.0/22 +103.74.124.0/22 +103.74.148.0/22 +103.74.152.0/22 +103.74.156.0/22 +103.74.204.0/22 +103.74.232.0/22 +103.75.16.0/22 +103.75.88.0/22 +103.75.92.0/22 +103.75.104.0/22 +103.75.108.0/22 +103.75.112.0/22 +103.75.120.0/22 +103.75.128.0/22 +103.75.144.0/22 +103.75.152.0/22 +103.75.236.0/24 +103.76.60.0/22 +103.76.64.0/22 +103.76.68.0/22 +103.76.72.0/22 +103.76.84.0/22 +103.76.92.0/22 +103.76.216.0/22 +103.76.220.0/22 +103.76.224.0/22 +103.77.28.0/22 +103.77.52.0/22 +103.77.56.0/22 +103.77.72.0/22 +103.77.88.0/22 +103.77.92.0/22 +103.77.132.0/22 +103.77.148.0/22 +103.77.220.0/22 +103.78.56.0/22 +103.78.60.0/22 +103.78.64.0/22 +103.78.68.0/22 +103.78.124.0/22 +103.78.172.0/22 +103.78.176.0/22 +103.78.196.0/22 +103.78.228.0/22 +103.79.24.0/22 +103.79.28.0/22 +103.79.36.0/22 +103.79.40.0/22 +103.79.44.0/22 +103.79.52.0/22 +103.79.56.0/22 +103.79.60.0/22 +103.79.64.0/22 +103.79.68.0/22 +103.79.80.0/22 +103.79.84.0/22 +103.79.120.0/22 +103.79.136.0/22 +103.79.188.0/22 +103.79.192.0/22 +103.79.196.0/22 +103.79.200.0/22 +103.79.204.0/22 +103.79.208.0/22 +103.79.212.0/22 +103.79.240.0/22 +103.80.24.0/22 +103.80.28.0/22 +103.80.44.0/22 +103.80.72.0/22 +103.80.176.0/22 +103.80.180.0/22 +103.80.184.0/22 +103.80.192.0/22 +103.80.200.0/22 +103.80.232.0/22 +103.81.4.0/22 +103.81.8.0/22 +103.81.16.0/22 +103.81.20.0/22 +103.81.44.0/22 +103.81.48.0/22 +103.81.96.0/22 +103.81.120.0/22 +103.81.148.0/22 +103.81.164.0/22 +103.81.168.0/22 +103.81.183.0/24 +103.81.184.0/22 +103.81.200.0/22 +103.81.232.0/22 +103.82.52.0/22 +103.82.60.0/22 +103.82.68.0/22 +103.82.84.0/22 +103.82.104.0/22 +103.82.224.0/22 +103.82.236.0/22 +103.83.44.0/22 +103.83.52.0/22 +103.83.60.0/22 +103.83.64.0/22 +103.83.72.0/22 +103.83.112.0/22 +103.83.120.0/22 +103.83.180.0/22 +103.84.0.0/22 +103.84.12.0/22 +103.84.16.0/22 +103.84.20.0/22 +103.84.24.0/22 +103.84.28.0/22 +103.84.48.0/22 +103.84.64.0/22 +103.84.72.0/22 +103.84.92.0/22 +103.84.108.0/22 +103.84.136.0/22 +103.85.20.0/22 +103.85.24.0/22 +103.85.44.0/22 +103.85.48.0/22 +103.85.84.0/22 +103.85.136.0/22 +103.85.144.0/22 +103.85.164.0/22 +103.85.168.0/22 +103.85.172.0/22 +103.85.176.0/22 +103.85.224.0/22 +103.86.28.0/22 +103.86.32.0/22 +103.86.44.0/22 +103.86.60.0/22 +103.86.68.0/22 +103.86.80.0/22 +103.86.84.0/22 +103.86.88.0/22 +103.86.204.0/22 +103.86.208.0/22 +103.86.212.0/22 +103.86.216.0/22 +103.86.220.0/22 +103.86.224.0/22 +103.86.228.0/22 +103.86.232.0/22 +103.86.236.0/22 +103.86.240.0/22 +103.86.244.0/22 +103.86.248.0/22 +103.86.252.0/22 +103.87.0.0/22 +103.87.4.0/22 +103.87.20.0/22 +103.87.32.0/22 +103.87.72.0/22 +103.87.96.0/22 +103.87.132.0/22 +103.87.180.0/22 +103.87.224.0/22 +103.88.4.0/22 +103.88.8.0/22 +103.88.12.0/22 +103.88.16.0/22 +103.88.20.0/22 +103.88.32.0/22 +103.88.36.0/22 +103.88.60.0/22 +103.88.64.0/22 +103.88.72.0/22 +103.88.96.0/22 +103.88.100.0/22 +103.88.164.0/22 +103.88.176.0/22 +103.88.184.0/22 +103.88.188.0/22 +103.88.212.0/22 +103.89.28.0/22 +103.89.96.0/22 +103.89.100.0/22 +103.89.104.0/22 +103.89.108.0/22 +103.89.112.0/22 +103.89.116.0/22 +103.89.148.0/22 +103.89.172.0/22 +103.89.184.0/22 +103.89.188.0/22 +103.89.192.0/22 +103.89.196.0/22 +103.89.200.0/22 +103.89.204.0/22 +103.89.208.0/22 +103.89.212.0/22 +103.89.216.0/22 +103.89.220.0/22 +103.89.224.0/22 +103.89.228.0/22 +103.90.52.0/22 +103.90.92.0/22 +103.90.100.0/22 +103.90.104.0/22 +103.90.108.0/22 +103.90.112.0/22 +103.90.116.0/22 +103.90.120.0/22 +103.90.124.0/22 +103.90.128.0/22 +103.90.132.0/22 +103.90.152.0/22 +103.90.168.0/22 +103.90.173.0/24 +103.90.176.0/22 +103.90.188.0/22 +103.90.192.0/22 +103.91.36.0/22 +103.91.40.0/22 +103.91.108.0/22 +103.91.152.0/22 +103.91.176.0/22 +103.91.200.0/22 +103.91.208.0/22 +103.91.212.0/22 +103.91.219.0/24 +103.91.236.0/22 +103.91.252.0/22 +103.92.0.0/22 +103.92.4.0/22 +103.92.8.0/22 +103.92.12.0/22 +103.92.48.0/22 +103.92.52.0/22 +103.92.56.0/22 +103.92.60.0/22 +103.92.64.0/22 +103.92.68.0/22 +103.92.72.0/22 +103.92.76.0/22 +103.92.80.0/22 +103.92.86.0/24 +103.92.88.0/22 +103.92.108.0/22 +103.92.124.0/22 +103.92.128.0/24 +103.92.132.0/22 +103.92.156.0/22 +103.92.164.0/22 +103.92.168.0/22 +103.92.172.0/22 +103.92.176.0/22 +103.92.180.0/22 +103.92.184.0/22 +103.92.188.0/22 +103.92.192.0/22 +103.92.236.0/22 +103.92.240.0/22 +103.92.244.0/22 +103.92.248.0/22 +103.92.252.0/22 +103.93.0.0/22 +103.93.4.0/22 +103.93.28.0/22 +103.93.76.0/22 +103.93.84.0/22 +103.93.121.0/24 +103.93.152.0/22 +103.93.180.0/22 +103.93.204.0/22 +103.94.12.0/22 +103.94.20.0/22 +103.94.28.0/22 +103.94.32.0/22 +103.94.36.0/22 +103.94.40.0/22 +103.94.44.0/22 +103.94.72.0/22 +103.94.88.0/22 +103.94.116.0/22 +103.94.160.0/22 +103.94.180.0/22 +103.94.200.0/22 +103.95.28.0/22 +103.95.52.0/22 +103.95.64.0/22 +103.95.68.0/22 +103.95.88.0/22 +103.95.92.0/22 +103.95.116.0/22 +103.95.128.0/22 +103.95.136.0/22 +103.95.140.0/22 +103.95.144.0/22 +103.95.152.0/22 +103.95.207.0/24 +103.95.216.0/22 +103.95.220.0/22 +103.95.224.0/22 +103.95.236.0/22 +103.95.240.0/22 +103.95.244.0/22 +103.95.248.0/22 +103.95.252.0/22 +103.96.0.0/22 +103.96.8.0/22 +103.96.80.0/22 +103.96.124.0/22 +103.96.136.0/22 +103.96.140.0/24 +103.96.148.0/22 +103.96.152.0/22 +103.96.156.0/22 +103.96.160.0/22 +103.96.164.0/22 +103.96.168.0/22 +103.96.172.0/22 +103.96.176.0/22 +103.96.180.0/22 +103.96.184.0/22 +103.96.188.0/22 +103.96.192.0/22 +103.96.196.0/22 +103.96.200.0/22 +103.96.204.0/22 +103.96.208.0/22 +103.96.212.0/22 +103.96.216.0/22 +103.97.8.0/22 +103.97.12.0/22 +103.97.16.0/22 +103.97.20.0/22 +103.97.24.0/22 +103.97.28.0/22 +103.97.32.0/22 +103.97.36.0/22 +103.97.40.0/22 +103.97.56.0/22 +103.97.60.0/22 +103.97.64.0/22 +103.97.68.0/22 +103.97.72.0/22 +103.97.80.0/22 +103.97.112.0/22 +103.97.116.0/22 +103.97.128.0/22 +103.97.144.0/22 +103.97.148.0/22 +103.97.188.0/22 +103.97.192.0/22 +103.97.224.0/22 +103.97.228.0/23 +103.98.28.0/23 +103.98.40.0/22 +103.98.44.0/22 +103.98.48.0/22 +103.98.56.0/22 +103.98.80.0/22 +103.98.88.0/22 +103.98.92.0/22 +103.98.96.0/22 +103.98.100.0/22 +103.98.124.0/22 +103.98.136.0/22 +103.98.140.0/22 +103.98.144.0/22 +103.98.164.0/22 +103.98.168.0/22 +103.98.180.0/22 +103.98.196.0/22 +103.98.216.0/22 +103.98.220.0/22 +103.98.224.0/22 +103.98.228.0/22 +103.98.232.0/22 +103.98.240.0/22 +103.98.244.0/22 +103.98.248.0/22 +103.98.252.0/22 +103.99.40.0/23 +103.99.52.0/22 +103.99.56.0/22 +103.99.60.0/22 +103.99.76.0/22 +103.99.104.0/22 +103.99.116.0/22 +103.99.120.0/22 +103.99.152.0/22 +103.99.220.0/22 +103.99.232.0/22 +103.99.236.0/22 +103.100.0.0/22 +103.100.32.0/22 +103.100.40.0/22 +103.100.48.0/22 +103.100.52.0/22 +103.100.56.0/22 +103.100.60.0/22 +103.100.64.0/22 +103.100.68.0/22 +103.100.88.0/22 +103.100.116.0/22 +103.100.140.0/22 +103.100.144.0/22 +103.100.236.0/22 +103.100.240.0/22 +103.100.248.0/22 +103.100.252.0/22 +103.101.4.0/22 +103.101.8.0/22 +103.101.12.0/22 +103.101.28.0/22 +103.101.60.0/22 +103.101.120.0/22 +103.101.124.0/22 +103.101.144.0/22 +103.101.148.0/22 +103.101.153.0/24 +103.101.180.0/22 +103.101.184.0/22 +103.102.76.0/22 +103.102.80.0/22 +103.102.168.0/22 +103.102.172.0/22 +103.102.180.0/22 +103.102.184.0/22 +103.102.188.0/22 +103.102.192.0/22 +103.102.196.0/22 +103.102.200.0/22 +103.102.208.0/22 +103.102.212.0/22 +103.103.12.0/22 +103.103.16.0/22 +103.103.36.0/22 +103.103.68.0/22 +103.103.72.0/22 +103.103.176.0/22 +103.103.188.0/22 +103.103.200.0/22 +103.103.204.0/22 +103.103.220.0/22 +103.103.224.0/22 +103.103.228.0/22 +103.103.232.0/22 +103.103.248.0/22 +103.103.252.0/22 +103.104.0.0/22 +103.104.4.0/22 +103.104.36.0/22 +103.104.40.0/22 +103.104.64.0/22 +103.104.104.0/22 +103.104.152.0/22 +103.104.168.0/22 +103.104.172.0/22 +103.104.188.0/22 +103.104.198.0/23 +103.104.252.0/22 +103.105.0.0/22 +103.105.4.0/22 +103.105.12.0/22 +103.105.16.0/22 +103.105.23.0/24 +103.105.56.0/22 +103.105.60.0/22 +103.105.116.0/22 +103.105.132.0/22 +103.105.180.0/22 +103.105.184.0/22 +103.105.200.0/22 +103.105.204.0/22 +103.105.220.0/22 +103.106.36.0/22 +103.106.40.0/22 +103.106.44.0/22 +103.106.60.0/22 +103.106.68.0/22 +103.106.96.0/22 +103.106.120.0/22 +103.106.128.0/22 +103.106.132.0/22 +103.106.160.0/22 +103.106.188.0/22 +103.106.196.0/22 +103.106.202.0/23 +103.106.212.0/22 +103.106.244.0/22 +103.106.252.0/22 +103.107.0.0/22 +103.107.8.0/24 +103.107.28.0/22 +103.107.32.0/22 +103.107.44.0/22 +103.107.72.0/22 +103.107.108.0/22 +103.107.164.0/22 +103.107.168.0/22 +103.107.188.0/22 +103.107.192.0/22 +103.107.208.0/22 +103.107.212.0/22 +103.107.216.0/22 +103.107.220.0/22 +103.108.52.0/22 +103.108.64.0/22 +103.108.160.0/22 +103.108.164.0/22 +103.108.184.0/23 +103.108.188.0/23 +103.108.192.0/22 +103.108.196.0/22 +103.108.208.0/22 +103.108.212.0/22 +103.108.224.0/22 +103.108.244.0/22 +103.108.251.0/24 +103.109.20.0/22 +103.109.48.0/22 +103.109.88.0/22 +103.109.106.0/23 +103.109.248.0/22 +103.110.32.0/22 +103.110.80.0/23 +103.110.92.0/22 +103.110.100.0/22 +103.110.116.0/22 +103.110.127.0/24 +103.110.128.0/23 +103.110.131.0/24 +103.110.132.0/22 +103.110.136.0/22 +103.110.152.0/22 +103.110.156.0/22 +103.110.188.0/22 +103.110.204.0/22 +103.111.38.0/23 +103.111.64.0/22 +103.111.172.0/22 +103.111.252.0/22 +103.112.28.0/22 +103.112.68.0/22 +103.112.72.0/22 +103.112.88.0/22 +103.112.92.0/22 +103.112.96.0/22 +103.112.108.0/22 +103.112.112.0/22 +103.112.116.0/22 +103.112.140.0/22 +103.112.172.0/22 +103.112.184.0/22 +103.112.208.0/22 +103.113.4.0/22 +103.113.92.0/22 +103.113.144.0/22 +103.113.220.0/22 +103.113.232.0/22 +103.113.236.0/22 +103.114.4.0/22 +103.114.28.0/22 +103.114.68.0/22 +103.114.72.0/22 +103.114.100.0/22 +103.114.132.0/22 +103.114.148.0/22 +103.114.156.0/22 +103.114.176.0/22 +103.114.212.0/22 +103.114.236.0/22 +103.114.240.0/22 +103.115.16.0/22 +103.115.40.0/22 +103.115.44.0/22 +103.115.48.0/22 +103.115.52.0/22 +103.115.56.0/22 +103.115.60.0/22 +103.115.64.0/22 +103.115.68.0/22 +103.115.92.0/22 +103.115.120.0/22 +103.115.148.0/22 +103.115.204.0/23 +103.115.248.0/22 +103.116.20.0/22 +103.116.40.0/22 +103.116.64.0/22 +103.116.72.0/22 +103.116.76.0/22 +103.116.92.0/22 +103.116.120.0/22 +103.116.128.0/22 +103.116.132.0/23 +103.116.148.0/22 +103.116.184.0/22 +103.116.206.0/23 +103.116.220.0/22 +103.116.224.0/22 +103.116.228.0/22 +103.117.16.0/22 +103.117.72.0/22 +103.117.88.0/22 +103.117.132.0/22 +103.117.136.0/22 +103.117.188.0/22 +103.117.220.0/22 +103.118.19.0/24 +103.118.36.0/22 +103.118.52.0/22 +103.118.56.0/22 +103.118.60.0/22 +103.118.64.0/22 +103.118.68.0/22 +103.118.72.0/22 +103.118.88.0/22 +103.118.173.0/24 +103.118.192.0/22 +103.118.196.0/22 +103.118.200.0/22 +103.118.204.0/22 +103.118.208.0/22 +103.118.212.0/22 +103.118.216.0/22 +103.118.220.0/22 +103.118.240.0/22 +103.118.244.0/22 +103.118.248.0/22 +103.118.252.0/22 +103.119.0.0/22 +103.119.12.0/22 +103.119.16.0/22 +103.119.28.0/22 +103.119.44.0/22 +103.119.104.0/22 +103.119.115.0/24 +103.119.156.0/22 +103.119.180.0/22 +103.119.200.0/22 +103.119.224.0/22 +103.120.52.0/22 +103.120.72.0/22 +103.120.76.0/24 +103.120.88.0/22 +103.120.96.0/22 +103.120.100.0/22 +103.120.140.0/22 +103.120.196.0/22 +103.120.224.0/22 +103.121.52.0/22 +103.121.92.0/22 +103.121.160.0/22 +103.121.164.0/22 +103.121.250.0/24 +103.121.252.0/22 +103.122.48.0/22 +103.122.176.0/22 +103.122.192.0/22 +103.122.240.0/22 +103.123.4.0/22 +103.123.56.0/22 +103.123.88.0/22 +103.123.92.0/22 +103.123.116.0/22 +103.123.160.0/22 +103.123.176.0/22 +103.123.200.0/22 +103.123.204.0/22 +103.123.208.0/22 +103.123.212.0/22 +103.124.24.0/22 +103.124.48.0/22 +103.124.64.0/22 +103.124.212.0/22 +103.124.216.0/22 +103.125.20.0/22 +103.125.44.0/22 +103.125.132.0/22 +103.125.164.0/22 +103.125.196.0/22 +103.125.236.0/22 +103.125.248.0/22 +103.126.0.0/22 +103.126.16.0/22 +103.126.44.0/22 +103.126.100.0/22 +103.126.124.0/22 +103.126.128.0/22 +103.126.132.0/22 +103.126.208.0/22 +103.126.241.0/24 +103.129.52.0/22 +103.130.132.0/22 +103.130.152.0/24 +103.130.160.0/22 +103.130.228.0/22 +103.131.20.0/22 +103.131.36.0/22 +103.131.152.0/22 +103.131.168.0/22 +103.131.176.0/22 +103.131.224.0/22 +103.131.228.0/22 +103.131.240.0/22 +103.132.60.0/22 +103.132.64.0/22 +103.132.68.0/22 +103.132.72.0/22 +103.132.76.0/22 +103.132.80.0/22 +103.132.104.0/22 +103.132.108.0/22 +103.132.112.0/22 +103.132.116.0/22 +103.132.120.0/22 +103.132.160.0/22 +103.132.164.0/22 +103.132.188.0/22 +103.132.208.0/22 +103.132.212.0/22 +103.132.234.0/23 +103.133.12.0/22 +103.133.40.0/22 +103.133.128.0/22 +103.133.136.0/22 +103.133.176.0/22 +103.133.232.0/22 +103.134.12.0/24 +103.134.196.0/22 +103.135.80.0/22 +103.135.124.0/22 +103.135.148.0/22 +103.135.156.0/22 +103.135.160.0/22 +103.135.164.0/22 +103.135.176.0/22 +103.135.184.0/22 +103.135.192.0/22 +103.135.196.0/22 +103.135.236.0/22 +103.136.128.0/22 +103.136.232.0/22 +103.137.58.0/23 +103.137.60.0/24 +103.137.76.0/22 +103.137.136.0/23 +103.137.149.0/24 +103.137.180.0/22 +103.137.236.0/22 +103.138.2.0/23 +103.138.12.0/23 +103.138.80.0/22 +103.138.134.0/23 +103.138.156.0/23 +103.138.208.0/23 +103.138.220.0/23 +103.138.246.0/23 +103.138.248.0/23 +103.139.0.0/23 +103.139.2.0/23 +103.139.22.0/23 +103.139.113.0/24 +103.139.134.0/23 +103.139.136.0/23 +103.139.172.0/23 +103.139.200.0/23 +103.139.204.0/23 +103.139.212.0/23 +103.140.8.0/23 +103.140.14.0/23 +103.140.46.0/23 +103.140.70.0/23 +103.140.126.0/23 +103.140.140.0/23 +103.140.144.0/23 +103.140.152.0/23 +103.140.192.0/23 +103.140.194.0/23 +103.140.228.0/23 +103.141.10.0/23 +103.141.36.0/23 +103.141.58.0/23 +103.141.128.0/23 +103.141.186.0/23 +103.141.190.0/23 +103.141.242.0/23 +103.142.0.0/23 +103.142.28.0/23 +103.142.58.0/23 +103.142.82.0/23 +103.142.96.0/23 +103.142.102.0/23 +103.142.122.0/23 +103.142.126.0/24 +103.142.128.0/23 +103.142.140.0/23 +103.142.154.0/23 +103.142.156.0/23 +103.142.172.0/23 +103.142.180.0/23 +103.142.186.0/23 +103.142.190.0/23 +103.142.220.0/23 +103.142.230.0/24 +103.142.234.0/23 +103.142.238.0/23 +103.142.248.0/23 +103.143.16.0/23 +103.143.18.0/23 +103.143.31.0/24 +103.143.74.0/23 +103.143.120.0/23 +103.143.124.0/23 +103.143.132.0/23 +103.143.134.0/23 +103.143.174.0/23 +103.143.228.0/23 +103.144.40.0/23 +103.144.52.0/23 +103.144.66.0/23 +103.144.70.0/23 +103.144.72.0/23 +103.144.88.0/24 +103.144.108.0/23 +103.144.136.0/23 +103.144.148.0/23 +103.144.158.0/23 +103.144.240.0/23 +103.145.38.0/23 +103.145.40.0/23 +103.145.42.0/23 +103.145.60.0/23 +103.145.72.0/23 +103.145.80.0/23 +103.145.86.0/23 +103.145.92.0/23 +103.145.94.0/23 +103.145.98.0/23 +103.145.106.0/23 +103.145.122.0/23 +103.145.188.0/23 +103.145.190.0/23 +103.146.6.0/23 +103.146.72.0/23 +103.146.88.0/23 +103.146.90.0/23 +103.146.124.0/23 +103.146.126.0/23 +103.146.138.0/23 +103.146.147.0/24 +103.146.230.0/23 +103.146.236.0/23 +103.146.252.0/23 +103.147.12.0/23 +103.147.124.0/23 +103.147.198.0/23 +103.147.206.0/23 +103.147.211.0/24 +103.148.174.0/23 +103.149.6.0/23 +103.192.0.0/22 +103.192.4.0/22 +103.192.8.0/22 +103.192.12.0/22 +103.192.16.0/22 +103.192.20.0/22 +103.192.24.0/22 +103.192.28.0/22 +103.192.48.0/22 +103.192.52.0/22 +103.192.56.0/22 +103.192.84.0/22 +103.192.88.0/22 +103.192.92.0/22 +103.192.96.0/22 +103.192.100.0/22 +103.192.104.0/22 +103.192.108.0/22 +103.192.112.0/22 +103.192.128.0/22 +103.192.132.0/22 +103.192.136.0/22 +103.192.140.0/22 +103.192.144.0/22 +103.192.164.0/22 +103.192.188.0/22 +103.192.208.0/22 +103.192.212.0/22 +103.192.216.0/22 +103.192.252.0/22 +103.193.40.0/22 +103.193.44.0/22 +103.193.120.0/22 +103.193.124.0/22 +103.193.140.0/22 +103.193.144.0/22 +103.193.148.0/22 +103.193.160.0/22 +103.193.188.0/22 +103.193.192.0/22 +103.193.212.0/22 +103.193.216.0/22 +103.193.220.0/22 +103.193.224.0/22 +103.193.228.0/22 +103.193.232.0/22 +103.193.236.0/22 +103.193.240.0/22 +103.194.16.0/22 +103.195.104.0/22 +103.195.112.0/22 +103.195.136.0/22 +103.195.148.0/22 +103.195.152.0/22 +103.195.160.0/22 +103.195.192.0/22 +103.196.60.0/22 +103.196.64.0/22 +103.196.72.0/22 +103.196.88.0/22 +103.196.92.0/22 +103.196.96.0/22 +103.196.168.0/22 +103.196.204.0/22 +103.197.180.0/22 +103.197.228.0/22 +103.198.20.0/22 +103.198.60.0/22 +103.198.64.0/22 +103.198.72.0/22 +103.198.124.0/22 +103.198.156.0/22 +103.198.180.0/22 +103.198.196.0/22 +103.198.200.0/22 +103.198.216.0/22 +103.198.220.0/22 +103.198.224.0/22 +103.198.228.0/22 +103.198.232.0/22 +103.198.236.0/22 +103.198.240.0/22 +103.198.244.0/22 +103.199.164.0/22 +103.199.196.0/22 +103.199.228.0/22 +103.199.248.0/22 +103.199.252.0/22 +103.200.28.0/22 +103.200.32.0/22 +103.200.52.0/22 +103.200.64.0/22 +103.200.68.0/22 +103.200.136.0/22 +103.200.140.0/22 +103.200.144.0/22 +103.200.148.0/22 +103.200.152.0/22 +103.200.156.0/22 +103.200.160.0/22 +103.200.164.0/22 +103.200.168.0/22 +103.200.172.0/22 +103.200.176.0/22 +103.200.180.0/22 +103.200.184.0/22 +103.200.188.0/22 +103.200.192.0/22 +103.200.220.0/22 +103.200.224.0/22 +103.200.228.0/22 +103.200.232.0/22 +103.200.236.0/22 +103.200.240.0/22 +103.200.244.0/22 +103.200.248.0/22 +103.200.252.0/22 +103.201.0.0/22 +103.201.4.0/22 +103.201.8.0/22 +103.201.12.0/22 +103.201.16.0/22 +103.201.20.0/22 +103.201.28.0/22 +103.201.32.0/22 +103.201.36.0/22 +103.201.40.0/22 +103.201.44.0/22 +103.201.48.0/22 +103.201.52.0/22 +103.201.56.0/22 +103.201.60.0/22 +103.201.64.0/22 +103.201.76.0/22 +103.201.80.0/22 +103.201.84.0/22 +103.201.88.0/22 +103.201.92.0/22 +103.201.96.0/22 +103.201.100.0/22 +103.201.104.0/22 +103.201.108.0/22 +103.201.112.0/22 +103.201.116.0/22 +103.201.120.0/22 +103.201.152.0/22 +103.201.156.0/22 +103.201.160.0/22 +103.201.164.0/22 +103.201.168.0/22 +103.201.172.0/22 +103.201.176.0/22 +103.201.180.0/22 +103.201.184.0/22 +103.201.188.0/22 +103.201.192.0/22 +103.201.196.0/22 +103.201.200.0/22 +103.201.204.0/22 +103.201.208.0/22 +103.201.212.0/22 +103.201.216.0/22 +103.201.220.0/22 +103.201.224.0/22 +103.201.228.0/22 +103.201.232.0/22 +103.201.236.0/22 +103.201.240.0/22 +103.201.244.0/22 +103.201.248.0/22 +103.201.252.0/22 +103.202.0.0/22 +103.202.4.0/22 +103.202.8.0/22 +103.202.12.0/22 +103.202.16.0/22 +103.202.20.0/22 +103.202.24.0/22 +103.202.28.0/22 +103.202.32.0/22 +103.202.36.0/22 +103.202.40.0/22 +103.202.44.0/22 +103.202.56.0/22 +103.202.60.0/22 +103.202.64.0/22 +103.202.68.0/22 +103.202.72.0/22 +103.202.76.0/22 +103.202.80.0/22 +103.202.84.0/22 +103.202.88.0/22 +103.202.92.0/22 +103.202.96.0/22 +103.202.100.0/22 +103.202.104.0/22 +103.202.108.0/22 +103.202.112.0/22 +103.202.116.0/22 +103.202.120.0/22 +103.202.124.0/22 +103.202.128.0/22 +103.202.132.0/22 +103.202.136.0/22 +103.202.140.0/22 +103.202.144.0/22 +103.202.152.0/22 +103.202.156.0/22 +103.202.160.0/22 +103.202.164.0/22 +103.202.168.0/22 +103.202.172.0/22 +103.202.176.0/22 +103.202.180.0/22 +103.202.184.0/22 +103.202.188.0/22 +103.202.192.0/22 +103.202.196.0/22 +103.202.200.0/21 +103.202.212.0/22 +103.202.228.0/22 +103.202.236.0/22 +103.202.240.0/22 +103.202.244.0/22 +103.202.248.0/22 +103.202.252.0/22 +103.203.0.0/22 +103.203.4.0/22 +103.203.8.0/22 +103.203.12.0/22 +103.203.16.0/22 +103.203.20.0/22 +103.203.24.0/22 +103.203.28.0/22 +103.203.32.0/22 +103.203.52.0/22 +103.203.56.0/22 +103.203.96.0/22 +103.203.100.0/22 +103.203.104.0/22 +103.203.108.0/22 +103.203.112.0/22 +103.203.116.0/22 +103.203.120.0/22 +103.203.124.0/22 +103.203.128.0/22 +103.203.140.0/22 +103.203.164.0/22 +103.203.168.0/22 +103.203.192.0/22 +103.203.200.0/22 +103.203.212.0/22 +103.203.216.0/22 +103.204.24.0/22 +103.204.72.0/22 +103.204.88.0/22 +103.204.112.0/22 +103.204.136.0/22 +103.204.140.0/22 +103.204.144.0/22 +103.204.148.0/22 +103.204.152.0/22 +103.204.196.0/22 +103.204.232.0/22 +103.204.236.0/22 +103.205.4.0/22 +103.205.8.0/22 +103.205.40.0/22 +103.205.44.0/22 +103.205.52.0/22 +103.205.108.0/22 +103.205.116.0/22 +103.205.120.0/22 +103.205.136.0/22 +103.205.162.0/24 +103.205.188.0/22 +103.205.192.0/22 +103.205.196.0/22 +103.205.200.0/22 +103.205.236.0/22 +103.205.248.0/22 +103.205.252.0/22 +103.206.0.0/22 +103.206.44.0/22 +103.206.108.0/22 +103.206.148.0/22 +103.207.48.0/22 +103.207.104.0/22 +103.207.164.0/22 +103.207.184.0/22 +103.207.188.0/22 +103.207.192.0/22 +103.207.196.0/22 +103.207.200.0/22 +103.207.204.0/22 +103.207.208.0/22 +103.207.212.0/22 +103.207.220.0/22 +103.207.228.0/22 +103.207.232.0/22 +103.208.12.0/22 +103.208.16.0/22 +103.208.28.0/22 +103.208.40.0/22 +103.208.44.0/22 +103.208.48.0/22 +103.208.148.0/22 +103.209.112.0/22 +103.209.136.0/22 +103.209.200.0/22 +103.209.208.0/22 +103.209.216.0/22 +103.210.0.0/22 +103.210.20.0/22 +103.210.96.0/22 +103.210.156.0/22 +103.210.160.0/22 +103.210.164.0/22 +103.210.168.0/22 +103.210.172.0/22 +103.210.176.0/22 +103.210.180.0/22 +103.210.184.0/22 +103.210.188.0/22 +103.210.216.0/22 +103.211.44.0/22 +103.211.96.0/22 +103.211.100.0/22 +103.211.156.0/22 +103.211.164.0/22 +103.211.192.0/22 +103.211.220.0/22 +103.211.224.0/22 +103.211.248.0/22 +103.212.0.0/22 +103.212.4.0/22 +103.212.8.0/22 +103.212.12.0/22 +103.212.32.0/22 +103.212.44.0/22 +103.212.48.0/22 +103.212.84.0/22 +103.212.100.0/22 +103.212.104.0/22 +103.212.108.0/22 +103.212.148.0/22 +103.212.164.0/22 +103.212.196.0/22 +103.212.200.0/22 +103.212.228.0/22 +103.212.252.0/22 +103.213.40.0/22 +103.213.44.0/22 +103.213.48.0/22 +103.213.52.0/22 +103.213.56.0/22 +103.213.60.0/22 +103.213.64.0/22 +103.213.68.0/22 +103.213.72.0/22 +103.213.76.0/22 +103.213.80.0/22 +103.213.84.0/22 +103.213.88.0/22 +103.213.92.0/22 +103.213.96.0/22 +103.213.132.0/22 +103.213.136.0/22 +103.213.140.0/22 +103.213.144.0/22 +103.213.148.0/22 +103.213.152.0/22 +103.213.156.0/22 +103.213.160.0/22 +103.213.164.0/22 +103.213.168.0/22 +103.213.172.0/22 +103.213.176.0/22 +103.213.180.0/22 +103.213.184.0/22 +103.213.188.0/22 +103.213.248.0/22 +103.214.32.0/22 +103.214.48.0/22 +103.214.84.0/22 +103.214.168.0/22 +103.214.212.0/22 +103.214.240.0/22 +103.214.244.0/22 +103.215.28.0/22 +103.215.32.0/22 +103.215.36.0/22 +103.215.44.0/22 +103.215.48.0/22 +103.215.100.0/22 +103.215.104.0/22 +103.215.108.0/22 +103.215.116.0/22 +103.215.120.0/22 +103.215.140.0/22 +103.215.184.0/22 +103.215.228.0/22 +103.216.4.0/22 +103.216.8.0/22 +103.216.12.0/22 +103.216.16.0/22 +103.216.20.0/22 +103.216.24.0/22 +103.216.28.0/22 +103.216.32.0/22 +103.216.36.0/22 +103.216.40.0/22 +103.216.44.0/22 +103.216.64.0/22 +103.216.108.0/22 +103.216.136.0/22 +103.216.152.0/22 +103.216.224.0/22 +103.216.228.0/22 +103.216.240.0/22 +103.216.244.0/22 +103.216.248.0/22 +103.216.252.0/22 +103.217.0.0/22 +103.217.4.0/22 +103.217.8.0/22 +103.217.12.0/22 +103.217.16.0/22 +103.217.20.0/22 +103.217.24.0/22 +103.217.28.0/22 +103.217.32.0/22 +103.217.36.0/22 +103.217.40.0/22 +103.217.44.0/22 +103.217.48.0/22 +103.217.52.0/22 +103.217.56.0/22 +103.217.60.0/22 +103.217.168.0/22 +103.217.180.0/22 +103.217.184.0/22 +103.217.188.0/22 +103.217.192.0/22 +103.217.196.0/22 +103.217.200.0/22 +103.217.204.0/22 +103.218.0.0/22 +103.218.8.0/22 +103.218.12.0/22 +103.218.16.0/22 +103.218.20.0/22 +103.218.28.0/22 +103.218.32.0/22 +103.218.36.0/22 +103.218.40.0/22 +103.218.44.0/22 +103.218.48.0/22 +103.218.52.0/22 +103.218.56.0/22 +103.218.60.0/22 +103.218.64.0/22 +103.218.68.0/22 +103.218.72.0/22 +103.218.76.0/22 +103.218.80.0/22 +103.218.84.0/22 +103.218.88.0/22 +103.218.92.0/22 +103.218.184.0/22 +103.218.192.0/22 +103.218.196.0/22 +103.218.200.0/22 +103.218.204.0/22 +103.218.208.0/22 +103.218.212.0/22 +103.218.216.0/22 +103.219.24.0/22 +103.219.28.0/22 +103.219.32.0/22 +103.219.36.0/22 +103.219.64.0/22 +103.219.84.0/22 +103.219.88.0/22 +103.219.92.0/22 +103.219.96.0/22 +103.219.100.0/22 +103.219.176.0/22 +103.219.184.0/22 +103.220.48.0/22 +103.220.52.0/22 +103.220.56.0/22 +103.220.60.0/22 +103.220.64.0/22 +103.220.92.0/22 +103.220.96.0/22 +103.220.100.0/22 +103.220.104.0/22 +103.220.108.0/22 +103.220.116.0/22 +103.220.120.0/22 +103.220.124.0/22 +103.220.128.0/22 +103.220.132.0/22 +103.220.136.0/22 +103.220.140.0/22 +103.220.144.0/22 +103.220.148.0/22 +103.220.152.0/22 +103.220.160.0/22 +103.220.164.0/22 +103.220.168.0/22 +103.220.172.0/22 +103.220.176.0/22 +103.220.180.0/22 +103.220.184.0/22 +103.220.188.0/22 +103.220.192.0/22 +103.220.196.0/22 +103.220.200.0/22 +103.220.240.0/22 +103.220.244.0/22 +103.220.248.0/22 +103.220.252.0/22 +103.221.0.0/22 +103.221.4.0/22 +103.221.8.0/22 +103.221.12.0/22 +103.221.16.0/22 +103.221.20.0/22 +103.221.24.0/22 +103.221.28.0/22 +103.221.32.0/22 +103.221.36.0/22 +103.221.40.0/22 +103.221.44.0/22 +103.221.48.0/22 +103.221.88.0/22 +103.221.92.0/22 +103.221.96.0/22 +103.221.100.0/22 +103.221.104.0/22 +103.221.108.0/22 +103.221.112.0/22 +103.221.116.0/22 +103.221.120.0/22 +103.221.124.0/22 +103.221.128.0/22 +103.221.132.0/22 +103.221.136.0/22 +103.221.140.0/22 +103.221.144.0/22 +103.221.148.0/22 +103.221.152.0/22 +103.221.156.0/22 +103.221.160.0/22 +103.221.164.0/22 +103.221.168.0/22 +103.221.172.0/22 +103.221.176.0/22 +103.221.180.0/22 +103.221.184.0/22 +103.221.188.0/22 +103.221.192.0/22 +103.221.196.0/22 +103.221.200.0/22 +103.221.204.0/22 +103.222.0.0/22 +103.222.4.0/22 +103.222.8.0/22 +103.222.12.0/22 +103.222.16.0/22 +103.222.24.0/22 +103.222.28.0/22 +103.222.32.0/22 +103.222.36.0/22 +103.222.40.0/22 +103.222.44.0/22 +103.222.48.0/22 +103.222.52.0/22 +103.222.56.0/22 +103.222.60.0/22 +103.222.64.0/22 +103.222.68.0/22 +103.222.72.0/22 +103.222.76.0/22 +103.222.80.0/22 +103.222.84.0/22 +103.222.88.0/22 +103.222.92.0/22 +103.222.96.0/22 +103.222.100.0/22 +103.222.104.0/22 +103.222.108.0/22 +103.222.112.0/22 +103.222.116.0/22 +103.222.120.0/22 +103.222.124.0/22 +103.222.128.0/22 +103.222.132.0/22 +103.222.136.0/22 +103.222.140.0/22 +103.222.144.0/22 +103.222.148.0/22 +103.222.152.0/22 +103.222.156.0/22 +103.222.160.0/22 +103.222.164.0/22 +103.222.168.0/22 +103.222.172.0/22 +103.222.176.0/22 +103.222.180.0/22 +103.222.184.0/22 +103.222.188.0/22 +103.222.192.0/22 +103.222.196.0/22 +103.222.200.0/22 +103.222.204.0/22 +103.222.208.0/22 +103.222.212.0/22 +103.222.216.0/22 +103.222.220.0/22 +103.222.224.0/22 +103.222.228.0/22 +103.222.232.0/22 +103.222.240.0/22 +103.222.244.0/22 +103.223.16.0/22 +103.223.20.0/22 +103.223.24.0/22 +103.223.28.0/22 +103.223.32.0/22 +103.223.36.0/22 +103.223.40.0/22 +103.223.44.0/22 +103.223.48.0/22 +103.223.52.0/22 +103.223.56.0/22 +103.223.60.0/22 +103.223.64.0/22 +103.223.68.0/22 +103.223.72.0/22 +103.223.76.0/22 +103.223.80.0/22 +103.223.84.0/22 +103.223.88.0/22 +103.223.92.0/22 +103.223.96.0/22 +103.223.100.0/22 +103.223.104.0/22 +103.223.108.0/22 +103.223.112.0/22 +103.223.116.0/22 +103.223.120.0/22 +103.223.124.0/22 +103.223.128.0/22 +103.223.132.0/22 +103.223.140.0/22 +103.223.144.0/22 +103.223.148.0/22 +103.223.152.0/22 +103.223.156.0/22 +103.223.160.0/22 +103.223.164.0/22 +103.223.168.0/22 +103.223.172.0/22 +103.223.176.0/22 +103.223.180.0/22 +103.223.188.0/22 +103.223.192.0/22 +103.223.196.0/22 +103.223.200.0/22 +103.223.204.0/22 +103.223.208.0/22 +103.223.212.0/22 +103.223.216.0/22 +103.223.220.0/22 +103.223.224.0/22 +103.223.228.0/22 +103.223.232.0/22 +103.223.236.0/22 +103.223.240.0/22 +103.223.244.0/22 +103.223.248.0/22 +103.223.252.0/22 +103.224.0.0/22 +103.224.40.0/22 +103.224.44.0/22 +103.224.60.0/22 +103.224.80.0/22 +103.224.220.0/22 +103.224.224.0/22 +103.224.228.0/22 +103.224.232.0/22 +103.225.84.0/22 +103.226.16.0/22 +103.226.40.0/22 +103.226.56.0/22 +103.226.60.0/22 +103.226.80.0/22 +103.226.132.0/22 +103.226.156.0/22 +103.226.180.0/22 +103.226.196.0/22 +103.227.48.0/22 +103.227.72.0/22 +103.227.76.0/22 +103.227.80.0/22 +103.227.100.0/22 +103.227.120.0/22 +103.227.132.0/22 +103.227.136.0/22 +103.227.196.0/22 +103.227.204.0/22 +103.227.212.0/22 +103.227.228.0/22 +103.228.12.0/22 +103.228.28.0/22 +103.228.88.0/22 +103.228.128.0/22 +103.228.136.0/22 +103.228.160.0/22 +103.228.176.0/22 +103.228.204.0/22 +103.228.208.0/22 +103.228.228.0/22 +103.228.232.0/22 +103.229.20.0/22 +103.229.60.0/22 +103.229.136.0/22 +103.229.148.0/22 +103.229.172.0/22 +103.229.212.0/22 +103.229.216.0/22 +103.229.220.0/22 +103.229.228.0/22 +103.229.236.0/22 +103.229.240.0/22 +103.230.0.0/22 +103.230.28.0/22 +103.230.44.0/22 +103.230.96.0/22 +103.230.196.0/22 +103.230.200.0/22 +103.230.204.0/22 +103.230.212.0/22 +103.230.236.0/22 +103.231.16.0/22 +103.231.20.0/22 +103.231.64.0/22 +103.231.68.0/22 +103.231.144.0/22 +103.231.180.0/22 +103.231.184.0/22 +103.231.244.0/22 +103.232.4.0/22 +103.232.144.0/22 +103.232.188.0/22 +103.232.212.0/22 +103.233.4.0/22 +103.233.44.0/22 +103.233.52.0/22 +103.233.104.0/22 +103.233.128.0/22 +103.233.136.0/22 +103.233.228.0/22 +103.234.0.0/22 +103.234.20.0/22 +103.234.56.0/22 +103.234.128.0/22 +103.234.172.0/22 +103.234.180.0/22 +103.234.244.0/22 +103.235.16.0/22 +103.235.48.0/22 +103.235.56.0/22 +103.235.60.0/22 +103.235.80.0/22 +103.235.84.0/22 +103.235.128.0/22 +103.235.132.0/22 +103.235.136.0/22 +103.235.140.0/22 +103.235.144.0/22 +103.235.148.0/22 +103.235.184.0/22 +103.235.192.0/22 +103.235.200.0/22 +103.235.220.0/22 +103.235.224.0/22 +103.235.228.0/22 +103.235.232.0/22 +103.235.236.0/22 +103.235.240.0/22 +103.235.244.0/22 +103.235.248.0/22 +103.235.252.0/22 +103.236.0.0/22 +103.236.4.0/22 +103.236.8.0/22 +103.236.12.0/22 +103.236.16.0/22 +103.236.20.0/22 +103.236.24.0/22 +103.236.28.0/22 +103.236.32.0/22 +103.236.36.0/22 +103.236.40.0/22 +103.236.44.0/22 +103.236.48.0/22 +103.236.52.0/22 +103.236.56.0/22 +103.236.60.0/22 +103.236.64.0/22 +103.236.68.0/22 +103.236.72.0/22 +103.236.76.0/22 +103.236.80.0/22 +103.236.84.0/22 +103.236.88.0/22 +103.236.92.0/22 +103.236.96.0/22 +103.236.120.0/22 +103.236.184.0/22 +103.236.220.0/22 +103.236.232.0/22 +103.236.240.0/22 +103.236.244.0/22 +103.236.248.0/22 +103.236.252.0/22 +103.237.0.0/22 +103.237.4.0/22 +103.237.8.0/22 +103.237.12.0/22 +103.237.24.0/22 +103.237.28.0/22 +103.237.68.0/22 +103.237.88.0/22 +103.237.152.0/22 +103.237.176.0/22 +103.237.180.0/22 +103.237.184.0/22 +103.237.188.0/22 +103.237.192.0/22 +103.237.196.0/22 +103.237.200.0/22 +103.237.204.0/22 +103.237.208.0/22 +103.237.212.0/22 +103.237.216.0/22 +103.237.220.0/22 +103.237.224.0/22 +103.237.228.0/22 +103.237.232.0/22 +103.237.236.0/22 +103.237.240.0/22 +103.237.244.0/22 +103.237.248.0/22 +103.237.252.0/22 +103.238.0.0/22 +103.238.4.0/22 +103.238.16.0/22 +103.238.20.0/22 +103.238.24.0/22 +103.238.28.0/22 +103.238.32.0/22 +103.238.36.0/22 +103.238.40.0/22 +103.238.44.0/22 +103.238.48.0/22 +103.238.52.0/22 +103.238.56.0/22 +103.238.88.0/22 +103.238.92.0/22 +103.238.96.0/22 +103.238.132.0/22 +103.238.140.0/22 +103.238.144.0/22 +103.238.160.0/22 +103.238.164.0/22 +103.238.168.0/22 +103.238.172.0/22 +103.238.176.0/22 +103.238.180.0/22 +103.238.184.0/22 +103.238.188.0/22 +103.238.196.0/22 +103.238.204.0/22 +103.238.252.0/22 +103.239.0.0/22 +103.239.44.0/22 +103.239.68.0/22 +103.239.96.0/22 +103.239.152.0/22 +103.239.156.0/22 +103.239.176.0/22 +103.239.180.0/22 +103.239.184.0/22 +103.239.192.0/22 +103.239.196.0/22 +103.239.204.0/22 +103.239.208.0/22 +103.239.224.0/22 +103.239.244.0/22 +103.240.16.0/22 +103.240.36.0/22 +103.240.72.0/22 +103.240.84.0/22 +103.240.124.0/22 +103.240.156.0/22 +103.240.172.0/22 +103.240.188.0/22 +103.240.244.0/22 +103.241.12.0/22 +103.241.72.0/22 +103.241.92.0/22 +103.241.96.0/22 +103.241.160.0/22 +103.241.184.0/22 +103.241.188.0/22 +103.241.220.0/22 +103.242.64.0/22 +103.242.128.0/22 +103.242.132.0/22 +103.242.160.0/22 +103.242.168.0/22 +103.242.172.0/22 +103.242.176.0/22 +103.242.200.0/22 +103.242.212.0/22 +103.242.220.0/22 +103.242.240.0/22 +103.243.136.0/22 +103.243.252.0/22 +103.244.16.0/22 +103.244.58.0/23 +103.244.60.0/22 +103.244.64.0/22 +103.244.68.0/22 +103.244.72.0/22 +103.244.76.0/22 +103.244.80.0/22 +103.244.84.0/22 +103.244.116.0/22 +103.244.164.0/22 +103.244.232.0/22 +103.244.252.0/22 +103.245.23.0/24 +103.245.52.0/22 +103.245.60.0/22 +103.245.80.0/22 +103.245.124.0/22 +103.245.128.0/22 +103.246.8.0/22 +103.246.12.0/22 +103.246.120.0/22 +103.246.124.0/22 +103.246.132.0/22 +103.246.152.0/22 +103.246.156.0/22 +103.247.168.0/22 +103.247.172.0/22 +103.247.176.0/22 +103.247.200.0/22 +103.247.212.0/22 +103.248.0.0/23 +103.248.64.0/22 +103.248.100.0/22 +103.248.124.0/22 +103.248.152.0/22 +103.248.168.0/22 +103.248.192.0/22 +103.248.212.0/22 +103.248.220.0/22 +103.248.224.0/22 +103.249.8.0/22 +103.249.12.0/22 +103.249.52.0/22 +103.249.104.0/22 +103.249.128.0/22 +103.249.136.0/22 +103.249.144.0/22 +103.249.164.0/22 +103.249.168.0/22 +103.249.172.0/22 +103.249.176.0/22 +103.249.188.0/22 +103.249.192.0/22 +103.249.244.0/22 +103.249.252.0/22 +103.250.32.0/22 +103.250.104.0/22 +103.250.124.0/22 +103.250.180.0/22 +103.250.192.0/22 +103.250.216.0/22 +103.250.224.0/22 +103.250.236.0/22 +103.250.248.0/22 +103.250.252.0/22 +103.251.32.0/22 +103.251.36.0/22 +103.251.84.0/22 +103.251.96.0/22 +103.251.124.0/22 +103.251.128.0/22 +103.251.160.0/22 +103.251.192.0/22 +103.251.204.0/22 +103.251.236.0/22 +103.251.240.0/22 +103.252.28.0/22 +103.252.36.0/22 +103.252.64.0/22 +103.252.96.0/22 +103.252.104.0/22 +103.252.172.0/22 +103.252.204.0/22 +103.252.208.0/22 +103.252.232.0/22 +103.252.248.0/22 +103.253.4.0/22 +103.253.60.0/22 +103.253.204.0/22 +103.253.220.0/22 +103.253.224.0/22 +103.253.232.0/22 +103.254.8.0/22 +103.254.20.0/22 +103.254.64.0/22 +103.254.68.0/22 +103.254.72.0/22 +103.254.76.0/22 +103.254.112.0/22 +103.254.176.0/22 +103.254.188.0/22 +103.254.196.0/24 +103.254.220.0/22 +103.255.56.0/22 +103.255.68.0/22 +103.255.88.0/22 +103.255.92.0/22 +103.255.136.0/22 +103.255.140.0/22 +103.255.184.0/22 +103.255.200.0/22 +103.255.212.0/22 +103.255.228.0/22 +106.0.0.0/24 +106.0.2.0/23 +106.0.4.0/22 +106.0.8.0/21 +106.0.16.0/20 +106.0.44.0/22 +106.0.64.0/18 +106.2.0.0/15 +106.4.0.0/14 +106.8.0.0/15 +106.11.0.0/16 +106.12.0.0/15 +106.14.0.0/15 +106.16.0.0/12 +106.32.0.0/12 +106.48.0.0/15 +106.50.0.0/16 +106.52.0.0/14 +106.56.0.0/13 +106.74.0.0/16 +106.75.0.0/16 +106.80.0.0/12 +106.108.0.0/14 +106.112.0.0/13 +106.120.0.0/13 +106.224.0.0/12 +109.244.0.0/16 +110.6.0.0/15 +110.16.0.0/14 +110.34.40.0/22 +110.34.44.0/22 +110.40.0.0/14 +110.44.12.0/22 +110.44.144.0/20 +110.48.0.0/16 +110.51.0.0/16 +110.52.0.0/15 +110.56.0.0/13 +110.64.0.0/15 +110.72.0.0/15 +110.75.0.0/17 +110.75.128.0/19 +110.75.160.0/19 +110.75.192.0/18 +110.76.0.0/19 +110.76.32.0/19 +110.76.132.0/22 +110.76.156.0/22 +110.76.184.0/22 +110.76.192.0/18 +110.77.0.0/17 +110.80.0.0/13 +110.88.0.0/14 +110.92.68.0/22 +110.93.32.0/19 +110.94.0.0/15 +110.96.0.0/11 +110.152.0.0/14 +110.156.0.0/15 +110.165.32.0/19 +110.166.0.0/15 +110.172.192.0/18 +110.173.0.0/19 +110.173.32.0/20 +110.173.64.0/19 +110.173.96.0/19 +110.173.192.0/19 +110.176.0.0/13 +110.184.0.0/13 +110.192.0.0/11 +110.228.0.0/14 +110.232.32.0/19 +110.236.0.0/15 +110.240.0.0/12 +111.0.0.0/10 +111.66.0.0/16 +111.67.192.0/20 +111.68.64.0/19 +111.72.0.0/13 +111.85.0.0/16 +111.91.192.0/19 +111.92.248.0/22 +111.92.252.0/22 +111.112.0.0/15 +111.114.0.0/15 +111.116.0.0/15 +111.118.200.0/21 +111.119.64.0/18 +111.119.128.0/19 +111.120.0.0/14 +111.124.0.0/16 +111.126.0.0/15 +111.128.0.0/11 +111.160.0.0/13 +111.170.0.0/16 +111.172.0.0/14 +111.176.0.0/13 +111.186.0.0/15 +111.192.0.0/12 +111.208.0.0/14 +111.212.0.0/14 +111.221.28.0/24 +111.221.128.0/17 +111.222.0.0/16 +111.223.4.0/22 +111.223.8.0/22 +111.223.12.0/22 +111.223.16.0/22 +111.223.240.0/22 +111.223.248.0/22 +111.224.0.0/14 +111.228.0.0/14 +111.235.96.0/19 +111.235.156.0/22 +111.235.160.0/19 +112.0.0.0/10 +112.64.0.0/15 +112.66.0.0/15 +112.73.0.0/16 +112.74.0.0/15 +112.80.0.0/13 +112.88.0.0/13 +112.96.0.0/15 +112.98.0.0/15 +112.100.0.0/14 +112.109.128.0/17 +112.111.0.0/16 +112.112.0.0/14 +112.116.0.0/15 +112.122.0.0/15 +112.124.0.0/14 +112.128.0.0/14 +112.132.0.0/16 +112.137.48.0/21 +112.192.0.0/14 +112.224.0.0/11 +113.0.0.0/13 +113.8.0.0/15 +113.11.192.0/19 +113.12.0.0/14 +113.16.0.0/15 +113.18.0.0/16 +113.21.232.0/22 +113.21.236.0/22 +113.24.0.0/14 +113.31.0.0/16 +113.44.0.0/14 +113.48.0.0/14 +113.52.160.0/19 +113.52.228.0/22 +113.54.0.0/15 +113.56.0.0/15 +113.58.0.0/16 +113.59.0.0/17 +113.59.224.0/22 +113.62.0.0/15 +113.64.0.0/11 +113.96.0.0/12 +113.112.0.0/13 +113.120.0.0/13 +113.128.0.0/15 +113.130.96.0/20 +113.130.112.0/21 +113.132.0.0/14 +113.136.0.0/13 +113.194.0.0/15 +113.197.100.0/22 +113.200.0.0/15 +113.202.0.0/16 +113.204.0.0/14 +113.208.96.0/19 +113.208.128.0/17 +113.209.0.0/16 +113.212.0.0/18 +113.212.64.0/22 +113.212.88.0/22 +113.212.100.0/22 +113.212.184.0/21 +113.213.0.0/17 +113.214.0.0/15 +113.218.0.0/15 +113.220.0.0/14 +113.224.0.0/12 +113.240.0.0/13 +113.248.0.0/14 +114.28.0.0/16 +114.31.64.0/22 +114.31.68.0/22 +114.54.0.0/15 +114.60.0.0/14 +114.64.0.0/14 +114.68.0.0/16 +114.79.64.0/18 +114.80.0.0/12 +114.96.0.0/13 +114.104.0.0/14 +114.110.0.0/20 +114.110.64.0/18 +114.111.0.0/19 +114.111.160.0/19 +114.112.0.0/14 +114.116.0.0/16 +114.117.0.0/16 +114.118.0.0/16 +114.119.0.0/17 +114.119.192.0/21 +114.119.200.0/22 +114.119.204.0/22 +114.119.208.0/20 +114.119.224.0/19 +114.132.0.0/16 +114.135.0.0/16 +114.138.0.0/15 +114.141.64.0/21 +114.141.80.0/22 +114.141.84.0/22 +114.141.128.0/18 +114.196.0.0/15 +114.198.248.0/21 +114.208.0.0/14 +114.212.0.0/15 +114.214.0.0/16 +114.215.0.0/16 +114.216.0.0/13 +114.224.0.0/12 +114.240.0.0/12 +115.24.0.0/14 +115.28.0.0/15 +115.31.64.0/22 +115.31.68.0/22 +115.31.72.0/22 +115.31.76.0/22 +115.32.0.0/14 +115.42.56.0/22 +115.44.0.0/15 +115.46.0.0/16 +115.47.0.0/16 +115.48.0.0/12 +115.69.64.0/20 +115.84.0.0/18 +115.84.192.0/19 +115.85.192.0/18 +115.100.0.0/14 +115.104.0.0/14 +115.120.0.0/14 +115.124.16.0/20 +115.148.0.0/14 +115.152.0.0/15 +115.154.0.0/15 +115.156.0.0/15 +115.158.0.0/16 +115.159.0.0/16 +115.166.64.0/19 +115.168.0.0/14 +115.172.0.0/14 +115.180.0.0/15 +115.182.0.0/16 +115.183.0.0/16 +115.187.0.0/22 +115.187.4.0/22 +115.187.8.0/22 +115.187.12.0/22 +115.190.0.0/15 +115.192.0.0/11 +115.224.0.0/12 +116.0.8.0/21 +116.0.24.0/21 +116.1.0.0/16 +116.2.0.0/15 +116.4.0.0/14 +116.8.0.0/14 +116.13.0.0/16 +116.16.0.0/12 +116.50.0.0/20 +116.52.0.0/14 +116.56.0.0/15 +116.58.128.0/20 +116.58.208.0/20 +116.60.0.0/14 +116.66.0.0/17 +116.66.176.0/22 +116.68.136.0/22 +116.68.140.0/22 +116.68.176.0/22 +116.68.180.0/22 +116.69.0.0/16 +116.70.0.0/17 +116.76.0.0/15 +116.78.0.0/15 +116.85.0.0/16 +116.89.144.0/20 +116.89.240.0/22 +116.90.80.0/20 +116.90.184.0/21 +116.95.0.0/16 +116.112.0.0/14 +116.116.0.0/15 +116.128.0.0/10 +116.192.0.0/16 +116.193.16.0/20 +116.193.32.0/19 +116.193.152.0/22 +116.193.164.0/22 +116.193.176.0/21 +116.194.0.0/15 +116.196.0.0/16 +116.197.160.0/22 +116.197.164.0/22 +116.198.0.0/16 +116.199.0.0/17 +116.199.128.0/19 +116.204.0.0/17 +116.204.132.0/22 +116.204.168.0/22 +116.204.216.0/22 +116.204.232.0/22 +116.204.236.0/22 +116.204.244.0/22 +116.205.0.0/16 +116.206.92.0/22 +116.206.176.0/22 +116.207.0.0/16 +116.208.0.0/14 +116.212.160.0/20 +116.213.44.0/22 +116.213.64.0/18 +116.213.128.0/17 +116.214.32.0/19 +116.214.64.0/20 +116.214.128.0/17 +116.215.0.0/16 +116.216.0.0/14 +116.224.0.0/12 +116.242.0.0/15 +116.244.0.0/15 +116.246.0.0/15 +116.248.0.0/15 +116.251.64.0/18 +116.252.0.0/15 +116.254.104.0/22 +116.254.108.0/22 +116.254.128.0/17 +116.255.128.0/17 +117.8.0.0/13 +117.21.0.0/16 +117.22.0.0/15 +117.24.0.0/13 +117.32.0.0/13 +117.40.0.0/14 +117.44.0.0/15 +117.48.0.0/17 +117.48.128.0/17 +117.49.0.0/16 +117.50.0.0/15 +117.53.48.0/20 +117.53.176.0/20 +117.57.0.0/16 +117.58.0.0/17 +117.59.0.0/16 +117.60.0.0/14 +117.64.0.0/13 +117.72.0.0/15 +117.74.64.0/20 +117.74.80.0/20 +117.74.128.0/17 +117.75.0.0/16 +117.76.0.0/14 +117.80.0.0/12 +117.100.0.0/15 +117.103.16.0/20 +117.103.40.0/21 +117.103.72.0/21 +117.103.128.0/20 +117.104.168.0/21 +117.106.0.0/15 +117.112.0.0/13 +117.120.64.0/18 +117.120.128.0/17 +117.121.0.0/17 +117.121.128.0/18 +117.121.192.0/21 +117.122.128.0/17 +117.124.0.0/14 +117.128.0.0/10 +118.24.0.0/15 +118.26.0.0/19 +118.26.32.0/22 +118.26.36.0/22 +118.26.40.0/21 +118.26.48.0/21 +118.26.56.0/21 +118.26.64.0/19 +118.26.96.0/21 +118.26.104.0/21 +118.26.112.0/21 +118.26.120.0/21 +118.26.128.0/17 +118.28.0.0/15 +118.30.0.0/16 +118.31.0.0/16 +118.64.0.0/15 +118.66.0.0/16 +118.67.112.0/20 +118.72.0.0/13 +118.80.0.0/15 +118.84.0.0/15 +118.88.32.0/19 +118.88.64.0/18 +118.88.128.0/17 +118.89.0.0/16 +118.91.240.0/20 +118.102.16.0/20 +118.102.32.0/21 +118.103.164.0/22 +118.103.168.0/22 +118.103.172.0/22 +118.103.176.0/22 +118.107.180.0/22 +118.112.0.0/13 +118.120.0.0/14 +118.124.0.0/15 +118.126.0.0/16 +118.127.128.0/19 +118.132.0.0/14 +118.144.0.0/14 +118.178.0.0/16 +118.180.0.0/14 +118.184.0.0/17 +118.184.128.0/17 +118.186.0.0/15 +118.188.0.0/16 +118.190.0.0/16 +118.191.0.0/21 +118.191.8.0/22 +118.191.12.0/24 +118.191.16.0/21 +118.191.64.0/20 +118.191.80.0/22 +118.191.128.0/19 +118.191.176.0/20 +118.191.192.0/20 +118.191.208.0/24 +118.191.216.0/22 +118.191.223.0/24 +118.191.224.0/24 +118.191.240.0/20 +118.192.0.0/16 +118.193.0.0/21 +118.193.8.0/21 +118.193.32.0/19 +118.193.64.0/20 +118.193.96.0/19 +118.193.128.0/17 +118.194.0.0/17 +118.194.128.0/17 +118.195.0.0/17 +118.195.128.0/17 +118.196.0.0/14 +118.202.0.0/15 +118.204.0.0/14 +118.212.0.0/16 +118.213.0.0/16 +118.215.192.0/18 +118.224.0.0/14 +118.228.0.0/15 +118.230.0.0/16 +118.239.0.0/16 +118.242.0.0/16 +118.244.0.0/14 +118.248.0.0/13 +119.0.0.0/15 +119.2.0.0/19 +119.2.128.0/17 +119.3.0.0/16 +119.4.0.0/14 +119.10.0.0/17 +119.15.136.0/21 +119.16.0.0/16 +119.18.192.0/20 +119.18.208.0/21 +119.18.224.0/20 +119.18.240.0/20 +119.19.0.0/16 +119.20.0.0/14 +119.27.64.0/18 +119.27.128.0/19 +119.27.160.0/19 +119.27.192.0/18 +119.28.0.0/15 +119.30.48.0/20 +119.31.192.0/19 +119.32.0.0/14 +119.36.0.0/16 +119.37.0.0/17 +119.37.128.0/18 +119.37.192.0/18 +119.38.0.0/17 +119.38.128.0/18 +119.38.192.0/20 +119.38.208.0/20 +119.38.224.0/19 +119.39.0.0/16 +119.40.0.0/18 +119.40.64.0/20 +119.40.128.0/17 +119.41.0.0/16 +119.42.0.0/19 +119.42.52.0/22 +119.42.128.0/21 +119.42.136.0/21 +119.42.224.0/19 +119.44.0.0/15 +119.48.0.0/13 +119.57.0.0/16 +119.58.0.0/16 +119.59.128.0/17 +119.60.0.0/16 +119.61.0.0/16 +119.62.0.0/16 +119.63.32.0/19 +119.75.208.0/20 +119.78.0.0/15 +119.80.0.0/16 +119.82.208.0/20 +119.84.0.0/14 +119.88.0.0/14 +119.96.0.0/13 +119.108.0.0/15 +119.112.0.0/13 +119.120.0.0/13 +119.128.0.0/12 +119.144.0.0/14 +119.148.160.0/20 +119.148.176.0/20 +119.151.192.0/18 +119.160.200.0/21 +119.161.120.0/22 +119.161.124.0/22 +119.161.128.0/17 +119.162.0.0/15 +119.164.0.0/14 +119.176.0.0/12 +119.232.0.0/15 +119.235.128.0/18 +119.248.0.0/14 +119.252.96.0/21 +119.252.240.0/20 +119.253.0.0/16 +119.254.0.0/15 +120.0.0.0/12 +120.24.0.0/14 +120.30.0.0/16 +120.31.0.0/16 +120.32.0.0/13 +120.40.0.0/14 +120.44.0.0/14 +120.48.0.0/15 +120.52.0.0/16 +120.53.0.0/16 +120.54.0.0/15 +120.64.0.0/14 +120.68.0.0/14 +120.72.32.0/19 +120.72.128.0/17 +120.76.0.0/14 +120.80.0.0/13 +120.88.8.0/21 +120.90.0.0/15 +120.92.0.0/16 +120.94.0.0/16 +120.95.0.0/16 +120.128.0.0/14 +120.132.0.0/17 +120.132.128.0/17 +120.133.0.0/16 +120.134.0.0/15 +120.136.16.0/22 +120.136.20.0/22 +120.136.128.0/18 +120.137.0.0/17 +120.143.128.0/19 +120.192.0.0/10 +121.0.8.0/21 +121.0.16.0/20 +121.4.0.0/15 +121.8.0.0/13 +121.16.0.0/13 +121.24.0.0/14 +121.28.0.0/15 +121.30.0.0/16 +121.31.0.0/16 +121.32.0.0/14 +121.36.0.0/16 +121.37.0.0/16 +121.38.0.0/15 +121.40.0.0/14 +121.46.0.0/18 +121.46.76.0/22 +121.46.128.0/17 +121.47.0.0/16 +121.48.0.0/15 +121.50.8.0/21 +121.51.0.0/16 +121.52.160.0/19 +121.52.208.0/20 +121.52.224.0/19 +121.54.176.0/21 +121.54.188.0/22 +121.55.0.0/18 +121.56.0.0/15 +121.58.0.0/17 +121.58.136.0/21 +121.58.144.0/20 +121.58.160.0/21 +121.59.0.0/16 +121.60.0.0/14 +121.68.0.0/14 +121.76.0.0/15 +121.79.128.0/18 +121.89.0.0/16 +121.100.128.0/17 +121.101.0.0/18 +121.101.208.0/20 +121.192.0.0/16 +121.193.0.0/16 +121.194.0.0/15 +121.196.0.0/14 +121.200.192.0/21 +121.201.0.0/16 +121.204.0.0/14 +121.224.0.0/12 +121.248.0.0/14 +121.255.0.0/16 +122.0.64.0/18 +122.0.128.0/17 +122.4.0.0/14 +122.8.0.0/16 +122.9.0.0/16 +122.10.128.0/22 +122.10.132.0/23 +122.10.136.0/23 +122.10.164.0/22 +122.10.168.0/21 +122.10.176.0/20 +122.10.192.0/22 +122.10.200.0/21 +122.10.208.0/21 +122.10.216.0/22 +122.10.228.0/22 +122.10.232.0/21 +122.10.240.0/22 +122.11.0.0/17 +122.12.0.0/16 +122.13.0.0/16 +122.14.0.0/17 +122.14.128.0/18 +122.14.192.0/18 +122.48.0.0/16 +122.49.0.0/18 +122.51.0.0/16 +122.64.0.0/11 +122.96.0.0/15 +122.102.0.0/20 +122.102.64.0/20 +122.102.80.0/20 +122.112.0.0/18 +122.112.64.0/18 +122.112.128.0/17 +122.113.0.0/16 +122.114.0.0/16 +122.115.0.0/17 +122.115.128.0/19 +122.115.160.0/19 +122.115.192.0/19 +122.115.224.0/19 +122.119.0.0/16 +122.128.100.0/22 +122.128.120.0/21 +122.136.0.0/13 +122.144.128.0/17 +122.152.192.0/18 +122.156.0.0/14 +122.188.0.0/14 +122.192.0.0/14 +122.198.0.0/16 +122.200.40.0/22 +122.200.44.0/22 +122.200.64.0/18 +122.201.48.0/20 +122.204.0.0/14 +122.224.0.0/12 +122.240.0.0/13 +122.248.24.0/21 +122.248.48.0/20 +122.255.64.0/21 +123.0.128.0/18 +123.4.0.0/14 +123.8.0.0/13 +123.49.128.0/17 +123.50.160.0/19 +123.52.0.0/14 +123.56.0.0/15 +123.58.0.0/20 +123.58.16.0/20 +123.58.32.0/19 +123.58.64.0/19 +123.58.96.0/19 +123.58.128.0/18 +123.58.192.0/19 +123.58.224.0/20 +123.58.240.0/20 +123.59.0.0/16 +123.60.0.0/16 +123.61.0.0/16 +123.62.0.0/16 +123.64.0.0/11 +123.96.0.0/15 +123.98.0.0/17 +123.99.128.0/17 +123.100.0.0/19 +123.101.0.0/16 +123.103.0.0/17 +123.108.128.0/20 +123.108.208.0/20 +123.112.0.0/12 +123.128.0.0/13 +123.136.80.0/20 +123.137.0.0/16 +123.138.0.0/15 +123.144.0.0/14 +123.148.0.0/16 +123.149.0.0/16 +123.150.0.0/15 +123.152.0.0/13 +123.160.0.0/14 +123.164.0.0/14 +123.168.0.0/14 +123.172.0.0/15 +123.174.0.0/15 +123.176.60.0/22 +123.176.80.0/20 +123.177.0.0/16 +123.178.0.0/15 +123.180.0.0/14 +123.184.0.0/14 +123.188.0.0/14 +123.196.0.0/15 +123.199.128.0/17 +123.206.0.0/15 +123.232.0.0/14 +123.242.0.0/17 +123.242.192.0/22 +123.242.196.0/22 +123.244.0.0/14 +123.249.0.0/16 +123.253.108.0/22 +123.253.240.0/22 +123.254.96.0/22 +123.254.100.0/22 +124.6.64.0/18 +124.14.0.0/15 +124.16.0.0/15 +124.20.0.0/16 +124.21.0.0/20 +124.21.16.0/20 +124.21.32.0/19 +124.21.64.0/18 +124.21.128.0/17 +124.22.0.0/15 +124.28.192.0/18 +124.29.0.0/17 +124.31.0.0/16 +124.40.112.0/20 +124.40.128.0/18 +124.40.192.0/19 +124.40.240.0/22 +124.42.0.0/17 +124.42.128.0/17 +124.47.0.0/18 +124.64.0.0/15 +124.66.0.0/17 +124.67.0.0/16 +124.68.0.0/15 +124.70.0.0/15 +124.72.0.0/16 +124.73.0.0/16 +124.74.0.0/15 +124.76.0.0/14 +124.88.0.0/16 +124.89.0.0/17 +124.89.128.0/17 +124.90.0.0/15 +124.92.0.0/14 +124.108.8.0/21 +124.108.40.0/21 +124.109.96.0/21 +124.112.0.0/15 +124.114.0.0/15 +124.116.0.0/16 +124.117.0.0/16 +124.118.0.0/15 +124.126.0.0/15 +124.128.0.0/13 +124.147.128.0/17 +124.150.137.0/24 +124.151.0.0/16 +124.152.0.0/16 +124.160.0.0/16 +124.161.0.0/16 +124.162.0.0/16 +124.163.0.0/16 +124.164.0.0/14 +124.172.0.0/15 +124.174.0.0/15 +124.192.0.0/15 +124.196.0.0/16 +124.200.0.0/13 +124.220.0.0/14 +124.224.0.0/16 +124.225.0.0/16 +124.226.0.0/15 +124.228.0.0/14 +124.232.0.0/15 +124.234.0.0/15 +124.236.0.0/14 +124.240.0.0/17 +124.240.128.0/18 +124.242.0.0/16 +124.243.192.0/18 +124.248.0.0/17 +124.249.0.0/16 +124.250.0.0/15 +124.254.0.0/18 +125.31.192.0/18 +125.32.0.0/16 +125.33.0.0/16 +125.34.0.0/16 +125.35.0.0/17 +125.35.128.0/17 +125.36.0.0/14 +125.40.0.0/13 +125.58.128.0/17 +125.61.128.0/17 +125.62.0.0/18 +125.64.0.0/13 +125.72.0.0/16 +125.73.0.0/16 +125.74.0.0/15 +125.76.0.0/17 +125.76.128.0/17 +125.77.0.0/16 +125.78.0.0/15 +125.80.0.0/13 +125.88.0.0/13 +125.96.0.0/15 +125.98.0.0/16 +125.104.0.0/13 +125.112.0.0/12 +125.169.0.0/16 +125.171.0.0/16 +125.208.0.0/18 +125.210.0.0/16 +125.211.0.0/16 +125.213.0.0/17 +125.214.96.0/19 +125.215.0.0/18 +125.216.0.0/15 +125.218.0.0/16 +125.219.0.0/16 +125.220.0.0/15 +125.222.0.0/15 +125.254.128.0/18 +125.254.192.0/18 +128.108.0.0/16 +129.28.0.0/16 +129.204.0.0/16 +129.211.0.0/16 +132.232.0.0/16 +134.175.0.0/16 +137.59.59.0/24 +137.59.88.0/22 +139.5.56.0/22 +139.5.60.0/22 +139.5.80.0/22 +139.5.92.0/22 +139.5.108.0/22 +139.5.128.0/22 +139.5.160.0/22 +139.5.192.0/22 +139.5.204.0/22 +139.5.208.0/22 +139.5.212.0/22 +139.5.244.0/22 +139.9.0.0/16 +139.129.0.0/16 +139.148.0.0/16 +139.155.0.0/16 +139.159.0.0/16 +139.170.0.0/16 +139.176.0.0/16 +139.183.0.0/16 +139.186.0.0/16 +139.189.0.0/16 +139.196.0.0/14 +139.200.0.0/13 +139.208.0.0/13 +139.217.0.0/16 +139.219.0.0/16 +139.220.0.0/15 +139.224.0.0/16 +139.226.0.0/15 +140.75.0.0/16 +140.143.0.0/16 +140.179.0.0/16 +140.205.0.0/16 +140.206.0.0/15 +140.210.0.0/16 +140.224.0.0/16 +140.237.0.0/16 +140.240.0.0/16 +140.243.0.0/16 +140.246.0.0/16 +140.249.0.0/16 +140.250.0.0/16 +140.255.0.0/16 +144.0.0.0/16 +144.7.0.0/16 +144.12.0.0/16 +144.48.8.0/22 +144.48.64.0/22 +144.48.88.0/22 +144.48.156.0/22 +144.48.180.0/22 +144.48.184.0/22 +144.48.204.0/22 +144.48.208.0/22 +144.48.212.0/22 +144.48.220.0/22 +144.48.252.0/22 +144.52.0.0/16 +144.123.0.0/16 +144.255.0.0/16 +146.56.192.0/18 +146.196.56.0/22 +146.196.68.0/22 +146.196.72.0/22 +146.196.92.0/22 +146.196.112.0/22 +146.196.116.0/22 +146.196.124.0/22 +148.70.0.0/16 +150.0.0.0/16 +150.115.0.0/16 +150.121.0.0/16 +150.122.0.0/16 +150.129.136.0/22 +150.129.192.0/22 +150.129.216.0/22 +150.129.252.0/22 +150.138.0.0/15 +150.158.0.0/16 +150.223.0.0/16 +150.242.0.0/22 +150.242.4.0/22 +150.242.8.0/22 +150.242.28.0/22 +150.242.44.0/22 +150.242.48.0/22 +150.242.52.0/22 +150.242.56.0/22 +150.242.76.0/22 +150.242.80.0/22 +150.242.92.0/22 +150.242.96.0/22 +150.242.112.0/22 +150.242.116.0/22 +150.242.120.0/22 +150.242.152.0/22 +150.242.156.0/22 +150.242.160.0/22 +150.242.164.0/22 +150.242.168.0/22 +150.242.184.0/22 +150.242.188.0/22 +150.242.192.0/22 +150.242.212.0/22 +150.242.224.0/22 +150.242.228.0/22 +150.242.232.0/22 +150.242.236.0/22 +150.242.240.0/22 +150.242.244.0/22 +150.242.248.0/22 +150.255.0.0/16 +152.104.128.0/17 +152.136.0.0/16 +153.0.0.0/16 +153.3.0.0/16 +153.34.0.0/15 +153.36.0.0/15 +153.99.0.0/16 +153.101.0.0/16 +153.118.0.0/15 +154.8.128.0/17 +157.0.0.0/16 +157.18.0.0/16 +157.61.0.0/16 +157.119.0.0/22 +157.119.8.0/22 +157.119.12.0/22 +157.119.16.0/22 +157.119.28.0/22 +157.119.68.0/22 +157.119.112.0/22 +157.119.132.0/22 +157.119.136.0/22 +157.119.140.0/22 +157.119.144.0/22 +157.119.148.0/22 +157.119.152.0/22 +157.119.156.0/22 +157.119.160.0/22 +157.119.164.0/22 +157.119.172.0/22 +157.119.192.0/22 +157.119.196.0/22 +157.119.240.0/22 +157.119.252.0/22 +157.122.0.0/16 +157.148.0.0/16 +157.156.0.0/16 +157.255.0.0/16 +159.75.0.0/16 +159.226.0.0/16 +160.19.208.0/22 +160.19.212.0/22 +160.19.216.0/22 +160.20.48.0/22 +160.202.60.0/22 +160.202.148.0/22 +160.202.152.0/22 +160.202.168.0/22 +160.202.212.0/22 +160.202.216.0/22 +160.202.220.0/22 +160.202.224.0/22 +160.202.228.0/22 +160.202.232.0/22 +160.202.236.0/22 +160.202.240.0/22 +160.202.244.0/22 +160.202.248.0/22 +160.202.252.0/22 +160.238.64.0/22 +161.189.0.0/16 +161.207.0.0/16 +162.14.0.0/16 +162.105.0.0/16 +163.0.0.0/16 +163.47.4.0/22 +163.53.0.0/22 +163.53.4.0/22 +163.53.8.0/22 +163.53.12.0/22 +163.53.36.0/22 +163.53.40.0/22 +163.53.44.0/22 +163.53.48.0/22 +163.53.52.0/22 +163.53.56.0/22 +163.53.60.0/22 +163.53.64.0/22 +163.53.88.0/22 +163.53.92.0/22 +163.53.96.0/22 +163.53.100.0/22 +163.53.104.0/22 +163.53.108.0/22 +163.53.112.0/22 +163.53.116.0/22 +163.53.120.0/22 +163.53.124.0/22 +163.53.128.0/22 +163.53.132.0/22 +163.53.136.0/22 +163.53.160.0/22 +163.53.164.0/22 +163.53.168.0/22 +163.53.172.0/22 +163.53.188.0/22 +163.53.220.0/22 +163.53.240.0/22 +163.125.0.0/16 +163.142.0.0/16 +163.177.0.0/16 +163.179.0.0/16 +163.204.0.0/16 +164.52.0.0/17 +166.111.0.0/16 +167.139.0.0/16 +167.189.0.0/16 +167.220.244.0/22 +168.160.0.0/16 +170.179.0.0/16 +171.8.0.0/13 +171.34.0.0/15 +171.36.0.0/14 +171.40.0.0/13 +171.80.0.0/14 +171.84.0.0/14 +171.88.0.0/13 +171.104.0.0/13 +171.112.0.0/14 +171.116.0.0/14 +171.120.0.0/13 +171.208.0.0/12 +172.81.192.0/18 +175.0.0.0/12 +175.16.0.0/13 +175.24.0.0/14 +175.30.0.0/15 +175.42.0.0/15 +175.44.0.0/16 +175.46.0.0/15 +175.48.0.0/12 +175.64.0.0/11 +175.102.0.0/16 +175.106.128.0/17 +175.111.144.0/22 +175.111.148.0/22 +175.111.152.0/22 +175.111.156.0/22 +175.111.160.0/22 +175.111.164.0/22 +175.111.168.0/22 +175.111.172.0/22 +175.111.184.0/22 +175.146.0.0/15 +175.148.0.0/14 +175.152.0.0/14 +175.158.96.0/22 +175.160.0.0/12 +175.176.156.0/22 +175.176.176.0/22 +175.176.188.0/22 +175.176.192.0/22 +175.178.0.0/16 +175.184.128.0/18 +175.185.0.0/16 +175.186.0.0/15 +175.188.0.0/14 +180.76.0.0/16 +180.77.0.0/16 +180.78.0.0/15 +180.84.0.0/15 +180.86.0.0/16 +180.88.0.0/14 +180.94.56.0/21 +180.94.96.0/20 +180.94.120.0/22 +180.94.124.0/22 +180.95.128.0/17 +180.96.0.0/11 +180.129.128.0/17 +180.130.0.0/16 +180.136.0.0/13 +180.148.16.0/21 +180.148.152.0/21 +180.148.216.0/21 +180.148.224.0/19 +180.149.128.0/19 +180.149.236.0/22 +180.150.160.0/19 +180.152.0.0/13 +180.160.0.0/12 +180.178.112.0/22 +180.178.116.0/22 +180.178.192.0/18 +180.184.0.0/15 +180.186.0.0/16 +180.187.0.0/16 +180.188.0.0/17 +180.189.148.0/22 +180.200.252.0/22 +180.201.0.0/16 +180.202.0.0/15 +180.208.0.0/15 +180.210.212.0/22 +180.210.224.0/19 +180.212.0.0/15 +180.222.224.0/19 +180.223.0.0/16 +180.233.0.0/18 +180.233.64.0/19 +180.233.144.0/22 +180.235.64.0/19 +180.235.112.0/22 +182.16.144.0/22 +182.16.148.0/22 +182.16.192.0/19 +182.18.0.0/17 +182.23.184.0/21 +182.23.200.0/21 +182.32.0.0/12 +182.48.96.0/19 +182.49.0.0/16 +182.50.0.0/20 +182.50.112.0/20 +182.51.0.0/16 +182.54.0.0/17 +182.54.244.0/22 +182.61.0.0/16 +182.80.0.0/14 +182.84.0.0/14 +182.88.0.0/14 +182.92.0.0/16 +182.96.0.0/12 +182.112.0.0/12 +182.128.0.0/12 +182.144.0.0/13 +182.157.0.0/16 +182.160.64.0/19 +182.174.0.0/15 +182.200.0.0/13 +182.236.128.0/17 +182.237.24.0/22 +182.237.28.0/22 +182.238.0.0/16 +182.239.0.0/19 +182.240.0.0/13 +182.254.0.0/16 +182.255.32.0/22 +182.255.36.0/22 +182.255.60.0/22 +183.0.0.0/10 +183.64.0.0/13 +183.78.160.0/22 +183.78.164.0/22 +183.78.180.0/22 +183.81.172.0/22 +183.81.180.0/22 +183.84.0.0/15 +183.91.128.0/22 +183.91.136.0/21 +183.91.144.0/20 +183.92.0.0/14 +183.128.0.0/11 +183.160.0.0/13 +183.168.0.0/15 +183.170.0.0/16 +183.172.0.0/14 +183.182.0.0/19 +183.184.0.0/13 +183.192.0.0/10 +185.203.36.0/22 +188.131.128.0/17 +192.51.188.0/24 +192.55.46.0/24 +192.55.68.0/22 +192.102.204.0/23 +192.124.154.0/24 +192.140.128.0/22 +192.140.132.0/22 +192.140.136.0/22 +192.140.156.0/22 +192.140.160.0/22 +192.140.164.0/22 +192.140.168.0/22 +192.140.172.0/22 +192.140.176.0/22 +192.140.180.0/22 +192.140.184.0/22 +192.140.188.0/22 +192.140.192.0/22 +192.140.196.0/22 +192.140.200.0/22 +192.140.204.0/22 +192.140.208.0/22 +192.140.212.0/22 +192.144.128.0/17 +192.197.113.0/24 +193.112.0.0/16 +198.175.100.0/22 +199.212.57.0/24 +202.0.100.0/23 +202.0.122.0/23 +202.0.176.0/22 +202.3.128.0/23 +202.3.134.0/24 +202.4.128.0/19 +202.4.252.0/22 +202.5.208.0/22 +202.5.212.0/22 +202.5.216.0/22 +202.6.6.0/23 +202.6.66.0/23 +202.6.72.0/23 +202.6.87.0/24 +202.6.88.0/23 +202.6.92.0/23 +202.6.103.0/24 +202.6.108.0/24 +202.6.110.0/23 +202.6.114.0/24 +202.6.176.0/20 +202.8.0.0/24 +202.8.2.0/23 +202.8.4.0/23 +202.8.12.0/24 +202.8.24.0/24 +202.8.77.0/24 +202.8.120.0/22 +202.8.128.0/19 +202.8.192.0/20 +202.9.32.0/24 +202.9.34.0/23 +202.9.48.0/23 +202.9.51.0/24 +202.9.52.0/23 +202.9.54.0/24 +202.9.57.0/24 +202.9.58.0/23 +202.10.64.0/20 +202.10.112.0/22 +202.10.116.0/22 +202.10.120.0/22 +202.10.124.0/22 +202.12.1.0/24 +202.12.2.0/24 +202.12.17.0/24 +202.12.18.0/24 +202.12.19.0/24 +202.12.72.0/24 +202.12.84.0/23 +202.12.96.0/24 +202.12.98.0/23 +202.12.106.0/24 +202.12.111.0/24 +202.12.116.0/24 +202.14.64.0/23 +202.14.69.0/24 +202.14.73.0/24 +202.14.74.0/23 +202.14.76.0/24 +202.14.78.0/23 +202.14.88.0/24 +202.14.97.0/24 +202.14.104.0/23 +202.14.108.0/23 +202.14.111.0/24 +202.14.114.0/23 +202.14.118.0/23 +202.14.124.0/23 +202.14.127.0/24 +202.14.129.0/24 +202.14.135.0/24 +202.14.136.0/24 +202.14.149.0/24 +202.14.151.0/24 +202.14.157.0/24 +202.14.158.0/23 +202.14.169.0/24 +202.14.170.0/23 +202.14.172.0/22 +202.14.176.0/24 +202.14.184.0/23 +202.14.208.0/23 +202.14.213.0/24 +202.14.219.0/24 +202.14.220.0/24 +202.14.222.0/23 +202.14.225.0/24 +202.14.226.0/23 +202.14.231.0/24 +202.14.235.0/24 +202.14.236.0/23 +202.14.238.0/24 +202.14.239.0/24 +202.14.246.0/24 +202.14.251.0/24 +202.20.66.0/24 +202.20.79.0/24 +202.20.87.0/24 +202.20.88.0/23 +202.20.90.0/24 +202.20.94.0/23 +202.20.114.0/24 +202.20.117.0/24 +202.20.120.0/24 +202.20.125.0/24 +202.20.126.0/24 +202.20.127.0/24 +202.21.48.0/22 +202.21.52.0/22 +202.21.56.0/22 +202.21.60.0/22 +202.21.131.0/24 +202.21.132.0/24 +202.21.141.0/24 +202.21.142.0/24 +202.21.147.0/24 +202.21.148.0/24 +202.21.150.0/23 +202.21.152.0/23 +202.21.154.0/24 +202.21.156.0/24 +202.22.248.0/22 +202.22.252.0/22 +202.27.12.0/24 +202.27.14.0/24 +202.27.136.0/23 +202.36.226.0/24 +202.38.0.0/23 +202.38.2.0/23 +202.38.8.0/21 +202.38.48.0/20 +202.38.64.0/19 +202.38.96.0/19 +202.38.128.0/23 +202.38.130.0/23 +202.38.132.0/23 +202.38.134.0/24 +202.38.135.0/24 +202.38.136.0/23 +202.38.138.0/24 +202.38.140.0/23 +202.38.142.0/23 +202.38.146.0/23 +202.38.149.0/24 +202.38.150.0/23 +202.38.152.0/23 +202.38.154.0/23 +202.38.156.0/24 +202.38.158.0/23 +202.38.160.0/23 +202.38.164.0/22 +202.38.168.0/23 +202.38.170.0/24 +202.38.171.0/24 +202.38.176.0/23 +202.38.184.0/21 +202.38.192.0/18 +202.40.4.0/23 +202.40.7.0/24 +202.40.15.0/24 +202.40.135.0/24 +202.40.136.0/24 +202.40.140.0/24 +202.40.143.0/24 +202.40.144.0/23 +202.40.150.0/24 +202.40.155.0/24 +202.40.156.0/24 +202.40.158.0/23 +202.40.162.0/24 +202.41.8.0/23 +202.41.11.0/24 +202.41.12.0/23 +202.41.128.0/24 +202.41.130.0/23 +202.41.152.0/21 +202.41.192.0/24 +202.41.196.0/22 +202.41.200.0/22 +202.41.240.0/20 +202.43.76.0/22 +202.43.144.0/20 +202.44.16.0/20 +202.44.48.0/22 +202.44.67.0/24 +202.44.74.0/24 +202.44.97.0/24 +202.44.129.0/24 +202.44.132.0/23 +202.44.146.0/23 +202.45.0.0/23 +202.45.2.0/24 +202.45.15.0/24 +202.45.16.0/20 +202.46.16.0/23 +202.46.18.0/24 +202.46.20.0/23 +202.46.32.0/19 +202.46.128.0/24 +202.46.224.0/20 +202.47.82.0/23 +202.47.96.0/22 +202.47.100.0/22 +202.47.104.0/22 +202.47.108.0/22 +202.47.126.0/24 +202.47.128.0/24 +202.47.130.0/23 +202.52.33.0/24 +202.52.34.0/24 +202.52.47.0/24 +202.52.143.0/24 +202.52.144.0/24 +202.53.140.0/24 +202.53.143.0/24 +202.57.192.0/22 +202.57.196.0/22 +202.57.200.0/22 +202.57.204.0/22 +202.57.212.0/22 +202.57.216.0/22 +202.57.240.0/20 +202.58.0.0/24 +202.58.101.0/24 +202.58.104.0/22 +202.58.112.0/22 +202.59.0.0/24 +202.59.1.0/24 +202.59.212.0/22 +202.59.236.0/24 +202.59.240.0/24 +202.60.48.0/21 +202.60.96.0/21 +202.60.112.0/20 +202.60.132.0/22 +202.60.136.0/21 +202.60.144.0/20 +202.61.68.0/22 +202.61.76.0/22 +202.61.88.0/22 +202.61.123.0/24 +202.61.127.0/24 +202.62.112.0/22 +202.62.248.0/22 +202.62.252.0/24 +202.62.255.0/24 +202.63.80.0/24 +202.63.81.0/24 +202.63.82.0/23 +202.63.84.0/22 +202.63.88.0/21 +202.63.160.0/19 +202.63.248.0/22 +202.63.253.0/24 +202.65.0.0/21 +202.65.8.0/23 +202.65.96.0/22 +202.65.100.0/22 +202.65.104.0/22 +202.65.108.0/22 +202.66.168.0/22 +202.67.0.0/22 +202.69.4.0/22 +202.69.16.0/20 +202.70.0.0/19 +202.70.96.0/20 +202.70.192.0/20 +202.71.32.0/22 +202.71.36.0/22 +202.71.40.0/22 +202.71.44.0/22 +202.72.40.0/21 +202.72.80.0/20 +202.72.112.0/22 +202.72.116.0/22 +202.72.120.0/22 +202.72.124.0/22 +202.73.128.0/22 +202.73.240.0/22 +202.73.244.0/22 +202.73.248.0/22 +202.73.252.0/22 +202.74.8.0/21 +202.74.36.0/24 +202.74.42.0/24 +202.74.52.0/24 +202.74.80.0/20 +202.74.232.0/22 +202.74.254.0/23 +202.75.208.0/20 +202.75.252.0/22 +202.76.252.0/22 +202.77.80.0/21 +202.77.92.0/22 +202.78.8.0/21 +202.79.224.0/21 +202.79.248.0/22 +202.80.192.0/21 +202.80.200.0/21 +202.81.0.0/22 +202.81.176.0/22 +202.81.180.0/22 +202.81.184.0/22 +202.81.188.0/22 +202.83.252.0/22 +202.84.0.0/22 +202.84.4.0/22 +202.84.8.0/21 +202.84.16.0/23 +202.84.22.0/24 +202.84.24.0/21 +202.85.208.0/20 +202.86.249.0/24 +202.86.252.0/22 +202.87.80.0/20 +202.88.32.0/22 +202.89.8.0/21 +202.89.96.0/22 +202.89.108.0/22 +202.89.119.0/24 +202.89.232.0/21 +202.90.0.0/22 +202.90.16.0/22 +202.90.20.0/22 +202.90.24.0/22 +202.90.28.0/22 +202.90.37.0/24 +202.90.96.0/22 +202.90.100.0/22 +202.90.104.0/22 +202.90.108.0/22 +202.90.112.0/20 +202.90.193.0/24 +202.90.196.0/24 +202.90.205.0/24 +202.90.224.0/20 +202.91.0.0/22 +202.91.36.0/22 +202.91.96.0/20 +202.91.128.0/22 +202.91.176.0/20 +202.91.224.0/19 +202.92.0.0/22 +202.92.8.0/21 +202.92.48.0/20 +202.92.252.0/22 +202.93.0.0/22 +202.93.252.0/22 +202.94.68.0/24 +202.94.74.0/24 +202.94.81.0/24 +202.94.92.0/22 +202.95.240.0/21 +202.95.252.0/22 +202.96.0.0/18 +202.96.64.0/21 +202.96.72.0/21 +202.96.80.0/20 +202.96.96.0/21 +202.96.104.0/21 +202.96.112.0/20 +202.96.128.0/21 +202.96.136.0/21 +202.96.144.0/20 +202.96.160.0/21 +202.96.168.0/21 +202.96.176.0/20 +202.96.192.0/21 +202.96.200.0/21 +202.96.208.0/20 +202.96.224.0/21 +202.96.232.0/21 +202.96.240.0/20 +202.97.0.0/21 +202.97.8.0/21 +202.97.16.0/20 +202.97.32.0/19 +202.97.64.0/19 +202.97.96.0/20 +202.97.112.0/20 +202.97.128.0/18 +202.97.192.0/19 +202.97.224.0/21 +202.97.232.0/21 +202.97.240.0/20 +202.98.0.0/21 +202.98.8.0/21 +202.98.16.0/20 +202.98.32.0/21 +202.98.40.0/21 +202.98.48.0/20 +202.98.64.0/19 +202.98.96.0/21 +202.98.104.0/21 +202.98.112.0/20 +202.98.128.0/19 +202.98.160.0/21 +202.98.168.0/21 +202.98.176.0/20 +202.98.192.0/21 +202.98.200.0/21 +202.98.208.0/20 +202.98.224.0/21 +202.98.232.0/21 +202.98.240.0/20 +202.99.0.0/18 +202.99.64.0/19 +202.99.96.0/21 +202.99.104.0/21 +202.99.112.0/20 +202.99.128.0/19 +202.99.160.0/21 +202.99.168.0/21 +202.99.176.0/20 +202.99.192.0/21 +202.99.200.0/21 +202.99.208.0/20 +202.99.224.0/21 +202.99.232.0/21 +202.99.240.0/20 +202.100.0.0/21 +202.100.8.0/21 +202.100.16.0/20 +202.100.32.0/19 +202.100.64.0/21 +202.100.72.0/21 +202.100.80.0/20 +202.100.96.0/21 +202.100.104.0/21 +202.100.112.0/20 +202.100.128.0/21 +202.100.136.0/21 +202.100.144.0/20 +202.100.160.0/21 +202.100.168.0/21 +202.100.176.0/20 +202.100.192.0/21 +202.100.200.0/21 +202.100.208.0/20 +202.100.224.0/19 +202.101.0.0/18 +202.101.64.0/19 +202.101.96.0/19 +202.101.128.0/18 +202.101.192.0/19 +202.101.224.0/21 +202.101.232.0/21 +202.101.240.0/20 +202.102.0.0/19 +202.102.32.0/19 +202.102.64.0/18 +202.102.128.0/21 +202.102.136.0/21 +202.102.144.0/20 +202.102.160.0/19 +202.102.192.0/21 +202.102.200.0/21 +202.102.208.0/20 +202.102.224.0/21 +202.102.232.0/21 +202.102.240.0/20 +202.103.0.0/21 +202.103.8.0/21 +202.103.16.0/20 +202.103.32.0/19 +202.103.64.0/19 +202.103.96.0/21 +202.103.104.0/21 +202.103.112.0/20 +202.103.128.0/18 +202.103.192.0/19 +202.103.224.0/21 +202.103.232.0/21 +202.103.240.0/20 +202.104.0.0/15 +202.106.0.0/16 +202.107.0.0/17 +202.107.128.0/17 +202.108.0.0/16 +202.109.0.0/16 +202.110.0.0/18 +202.110.64.0/18 +202.110.128.0/18 +202.110.192.0/18 +202.111.0.0/17 +202.111.128.0/19 +202.111.160.0/19 +202.111.192.0/18 +202.112.0.0/16 +202.113.0.0/20 +202.113.16.0/20 +202.113.32.0/19 +202.113.64.0/18 +202.113.128.0/18 +202.113.192.0/19 +202.113.224.0/20 +202.113.240.0/20 +202.114.0.0/19 +202.114.32.0/19 +202.114.64.0/18 +202.114.128.0/17 +202.115.0.0/19 +202.115.32.0/19 +202.115.64.0/18 +202.115.128.0/17 +202.116.0.0/19 +202.116.32.0/20 +202.116.48.0/20 +202.116.64.0/19 +202.116.96.0/19 +202.116.128.0/17 +202.117.0.0/18 +202.117.64.0/18 +202.117.128.0/17 +202.118.0.0/19 +202.118.32.0/19 +202.118.64.0/18 +202.118.128.0/17 +202.119.0.0/19 +202.119.32.0/19 +202.119.64.0/20 +202.119.80.0/20 +202.119.96.0/19 +202.119.128.0/17 +202.120.0.0/18 +202.120.64.0/18 +202.120.128.0/17 +202.121.0.0/16 +202.122.0.0/21 +202.122.32.0/21 +202.122.64.0/19 +202.122.112.0/21 +202.122.120.0/21 +202.122.128.0/24 +202.122.132.0/24 +202.123.96.0/20 +202.123.116.0/22 +202.123.120.0/22 +202.124.16.0/21 +202.124.24.0/22 +202.125.107.0/24 +202.125.109.0/24 +202.125.112.0/20 +202.125.176.0/20 +202.127.0.0/23 +202.127.2.0/24 +202.127.3.0/24 +202.127.4.0/24 +202.127.5.0/24 +202.127.6.0/23 +202.127.12.0/22 +202.127.16.0/20 +202.127.40.0/21 +202.127.48.0/20 +202.127.112.0/20 +202.127.128.0/20 +202.127.144.0/20 +202.127.160.0/21 +202.127.192.0/23 +202.127.194.0/23 +202.127.196.0/22 +202.127.200.0/21 +202.127.208.0/24 +202.127.209.0/24 +202.127.212.0/22 +202.127.216.0/21 +202.127.224.0/19 +202.129.208.0/24 +202.130.0.0/19 +202.130.39.0/24 +202.130.224.0/19 +202.131.16.0/21 +202.131.48.0/20 +202.131.208.0/20 +202.133.32.0/20 +202.134.58.0/24 +202.134.128.0/20 +202.134.208.0/22 +202.134.212.0/22 +202.134.216.0/22 +202.134.220.0/22 +202.136.48.0/20 +202.136.208.0/20 +202.136.224.0/20 +202.136.248.0/22 +202.137.231.0/24 +202.140.140.0/22 +202.140.144.0/22 +202.140.148.0/22 +202.140.152.0/22 +202.140.156.0/22 +202.141.160.0/19 +202.142.16.0/20 +202.143.4.0/22 +202.143.16.0/20 +202.143.32.0/20 +202.143.56.0/21 +202.143.100.0/22 +202.143.104.0/22 +202.144.196.0/22 +202.146.160.0/20 +202.146.186.0/24 +202.146.188.0/22 +202.146.196.0/22 +202.146.200.0/21 +202.147.144.0/20 +202.148.32.0/20 +202.148.64.0/19 +202.148.96.0/19 +202.149.32.0/19 +202.149.160.0/19 +202.149.224.0/19 +202.150.16.0/20 +202.150.32.0/20 +202.150.56.0/22 +202.150.192.0/20 +202.150.224.0/19 +202.151.0.0/22 +202.151.33.0/24 +202.151.128.0/19 +202.152.176.0/20 +202.153.0.0/22 +202.153.7.0/24 +202.153.48.0/20 +202.157.192.0/19 +202.158.160.0/19 +202.158.242.0/24 +202.160.140.0/22 +202.160.156.0/22 +202.160.176.0/20 +202.162.67.0/24 +202.162.75.0/24 +202.164.0.0/20 +202.164.96.0/19 +202.165.176.0/20 +202.165.208.0/20 +202.165.239.0/24 +202.165.240.0/23 +202.165.243.0/24 +202.165.245.0/24 +202.165.251.0/24 +202.165.252.0/22 +202.166.224.0/19 +202.168.80.0/22 +202.168.128.0/22 +202.168.132.0/22 +202.168.136.0/22 +202.168.140.0/22 +202.168.160.0/20 +202.168.176.0/20 +202.170.128.0/19 +202.170.216.0/21 +202.170.224.0/19 +202.171.216.0/21 +202.171.232.0/24 +202.171.235.0/24 +202.172.0.0/22 +202.172.7.0/24 +202.173.0.0/22 +202.173.6.0/24 +202.173.8.0/21 +202.173.112.0/22 +202.173.224.0/19 +202.174.64.0/20 +202.174.124.0/22 +202.176.224.0/19 +202.179.160.0/22 +202.179.164.0/22 +202.179.168.0/22 +202.179.172.0/22 +202.179.240.0/20 +202.180.128.0/19 +202.180.208.0/21 +202.181.8.0/22 +202.181.28.0/22 +202.181.112.0/20 +202.182.32.0/20 +202.182.192.0/19 +202.189.0.0/18 +202.189.80.0/20 +202.189.184.0/21 +202.191.0.0/24 +202.191.68.0/22 +202.191.72.0/21 +202.191.80.0/20 +202.192.0.0/13 +202.200.0.0/14 +202.204.0.0/14 +203.0.4.0/22 +203.0.10.0/23 +203.0.18.0/24 +203.0.24.0/24 +203.0.42.0/23 +203.0.45.0/24 +203.0.46.0/23 +203.0.81.0/24 +203.0.82.0/23 +203.0.90.0/23 +203.0.96.0/23 +203.0.104.0/21 +203.0.114.0/23 +203.0.122.0/24 +203.0.128.0/24 +203.0.130.0/23 +203.0.132.0/22 +203.0.137.0/24 +203.0.142.0/24 +203.0.144.0/24 +203.0.146.0/24 +203.0.148.0/24 +203.0.150.0/23 +203.0.152.0/24 +203.0.177.0/24 +203.0.224.0/24 +203.1.4.0/22 +203.1.18.0/24 +203.1.26.0/23 +203.1.65.0/24 +203.1.66.0/23 +203.1.70.0/23 +203.1.76.0/23 +203.1.90.0/24 +203.1.97.0/24 +203.1.98.0/23 +203.1.100.0/22 +203.1.108.0/24 +203.1.253.0/24 +203.1.254.0/24 +203.2.64.0/21 +203.2.73.0/24 +203.2.112.0/21 +203.2.126.0/23 +203.2.140.0/24 +203.2.150.0/24 +203.2.152.0/22 +203.2.156.0/23 +203.2.160.0/21 +203.2.180.0/23 +203.2.196.0/23 +203.2.209.0/24 +203.2.214.0/23 +203.2.226.0/23 +203.2.229.0/24 +203.2.236.0/23 +203.3.68.0/24 +203.3.72.0/23 +203.3.75.0/24 +203.3.80.0/21 +203.3.96.0/22 +203.3.105.0/24 +203.3.112.0/21 +203.3.120.0/24 +203.3.123.0/24 +203.3.135.0/24 +203.3.139.0/24 +203.3.143.0/24 +203.4.132.0/23 +203.4.134.0/24 +203.4.151.0/24 +203.4.152.0/22 +203.4.174.0/23 +203.4.180.0/24 +203.4.186.0/24 +203.4.205.0/24 +203.4.208.0/22 +203.4.227.0/24 +203.4.230.0/23 +203.5.4.0/23 +203.5.7.0/24 +203.5.8.0/23 +203.5.11.0/24 +203.5.21.0/24 +203.5.22.0/24 +203.5.44.0/24 +203.5.46.0/23 +203.5.52.0/22 +203.5.56.0/23 +203.5.60.0/23 +203.5.114.0/23 +203.5.118.0/24 +203.5.120.0/24 +203.5.172.0/24 +203.5.180.0/23 +203.5.182.0/24 +203.5.185.0/24 +203.5.186.0/24 +203.5.188.0/23 +203.5.190.0/24 +203.5.195.0/24 +203.5.214.0/23 +203.5.218.0/23 +203.6.131.0/24 +203.6.136.0/24 +203.6.138.0/23 +203.6.142.0/24 +203.6.150.0/23 +203.6.157.0/24 +203.6.159.0/24 +203.6.224.0/20 +203.6.248.0/23 +203.7.129.0/24 +203.7.138.0/23 +203.7.147.0/24 +203.7.150.0/23 +203.7.158.0/24 +203.7.192.0/23 +203.7.200.0/24 +203.8.0.0/24 +203.8.8.0/24 +203.8.23.0/24 +203.8.70.0/24 +203.8.82.0/24 +203.8.86.0/23 +203.8.91.0/24 +203.8.110.0/23 +203.8.115.0/24 +203.8.166.0/23 +203.8.169.0/24 +203.8.173.0/24 +203.8.184.0/24 +203.8.186.0/23 +203.8.190.0/23 +203.8.192.0/24 +203.8.197.0/24 +203.8.198.0/23 +203.8.203.0/24 +203.8.209.0/24 +203.8.210.0/23 +203.8.212.0/22 +203.8.217.0/24 +203.8.220.0/24 +203.9.32.0/24 +203.9.36.0/23 +203.9.57.0/24 +203.9.63.0/24 +203.9.65.0/24 +203.9.70.0/23 +203.9.72.0/24 +203.9.75.0/24 +203.9.76.0/23 +203.9.96.0/22 +203.9.100.0/23 +203.9.108.0/24 +203.9.158.0/24 +203.10.34.0/24 +203.10.56.0/24 +203.10.74.0/23 +203.10.84.0/22 +203.10.88.0/24 +203.10.95.0/24 +203.10.125.0/24 +203.11.70.0/24 +203.11.76.0/22 +203.11.82.0/24 +203.11.84.0/22 +203.11.100.0/22 +203.11.109.0/24 +203.11.117.0/24 +203.11.122.0/24 +203.11.126.0/24 +203.11.136.0/22 +203.11.141.0/24 +203.11.142.0/23 +203.11.180.0/22 +203.11.208.0/22 +203.12.16.0/24 +203.12.19.0/24 +203.12.24.0/24 +203.12.57.0/24 +203.12.65.0/24 +203.12.66.0/24 +203.12.70.0/23 +203.12.87.0/24 +203.12.100.0/23 +203.12.103.0/24 +203.12.114.0/24 +203.12.118.0/24 +203.12.130.0/24 +203.12.137.0/24 +203.12.196.0/22 +203.12.211.0/24 +203.12.219.0/24 +203.12.226.0/24 +203.12.240.0/22 +203.13.18.0/24 +203.13.24.0/24 +203.13.44.0/23 +203.13.88.0/23 +203.13.92.0/22 +203.13.173.0/24 +203.13.224.0/23 +203.13.227.0/24 +203.13.233.0/24 +203.14.24.0/22 +203.14.33.0/24 +203.14.56.0/24 +203.14.61.0/24 +203.14.62.0/24 +203.14.104.0/24 +203.14.114.0/23 +203.14.118.0/24 +203.14.162.0/24 +203.14.192.0/24 +203.14.194.0/23 +203.14.214.0/24 +203.14.231.0/24 +203.14.246.0/24 +203.15.0.0/20 +203.15.20.0/23 +203.15.22.0/24 +203.15.87.0/24 +203.15.88.0/23 +203.15.105.0/24 +203.15.112.0/21 +203.15.130.0/23 +203.15.149.0/24 +203.15.151.0/24 +203.15.156.0/22 +203.15.174.0/24 +203.15.227.0/24 +203.15.232.0/21 +203.15.240.0/23 +203.15.246.0/24 +203.16.10.0/24 +203.16.12.0/23 +203.16.16.0/21 +203.16.27.0/24 +203.16.38.0/24 +203.16.49.0/24 +203.16.50.0/23 +203.16.58.0/24 +203.16.63.0/24 +203.16.133.0/24 +203.16.161.0/24 +203.16.162.0/24 +203.16.186.0/23 +203.16.228.0/24 +203.16.238.0/24 +203.16.240.0/24 +203.16.245.0/24 +203.17.2.0/24 +203.17.18.0/24 +203.17.28.0/24 +203.17.39.0/24 +203.17.56.0/24 +203.17.74.0/23 +203.17.88.0/23 +203.17.136.0/24 +203.17.164.0/24 +203.17.187.0/24 +203.17.190.0/23 +203.17.231.0/24 +203.17.233.0/24 +203.17.248.0/24 +203.17.249.0/24 +203.17.255.0/24 +203.18.2.0/23 +203.18.4.0/24 +203.18.7.0/24 +203.18.31.0/24 +203.18.37.0/24 +203.18.48.0/23 +203.18.52.0/24 +203.18.72.0/22 +203.18.80.0/23 +203.18.87.0/24 +203.18.100.0/23 +203.18.105.0/24 +203.18.107.0/24 +203.18.110.0/24 +203.18.129.0/24 +203.18.131.0/24 +203.18.132.0/23 +203.18.144.0/24 +203.18.153.0/24 +203.18.199.0/24 +203.18.208.0/24 +203.18.211.0/24 +203.18.215.0/24 +203.19.1.0/24 +203.19.18.0/24 +203.19.24.0/24 +203.19.30.0/24 +203.19.32.0/21 +203.19.41.0/24 +203.19.44.0/23 +203.19.46.0/24 +203.19.58.0/24 +203.19.60.0/23 +203.19.64.0/24 +203.19.68.0/24 +203.19.72.0/24 +203.19.101.0/24 +203.19.111.0/24 +203.19.131.0/24 +203.19.133.0/24 +203.19.144.0/24 +203.19.147.0/24 +203.19.149.0/24 +203.19.156.0/24 +203.19.176.0/24 +203.19.178.0/23 +203.19.208.0/24 +203.19.228.0/22 +203.19.233.0/24 +203.19.242.0/24 +203.19.248.0/23 +203.19.255.0/24 +203.20.17.0/24 +203.20.40.0/23 +203.20.44.0/24 +203.20.48.0/24 +203.20.61.0/24 +203.20.65.0/24 +203.20.84.0/23 +203.20.89.0/24 +203.20.106.0/23 +203.20.115.0/24 +203.20.117.0/24 +203.20.118.0/23 +203.20.122.0/24 +203.20.126.0/23 +203.20.135.0/24 +203.20.136.0/21 +203.20.150.0/24 +203.20.230.0/24 +203.20.232.0/24 +203.20.236.0/24 +203.21.0.0/23 +203.21.2.0/24 +203.21.8.0/24 +203.21.10.0/24 +203.21.18.0/24 +203.21.33.0/24 +203.21.34.0/24 +203.21.41.0/24 +203.21.44.0/24 +203.21.68.0/24 +203.21.82.0/24 +203.21.96.0/22 +203.21.124.0/24 +203.21.136.0/23 +203.21.145.0/24 +203.21.206.0/24 +203.22.24.0/24 +203.22.28.0/23 +203.22.31.0/24 +203.22.68.0/24 +203.22.76.0/24 +203.22.78.0/24 +203.22.84.0/24 +203.22.87.0/24 +203.22.92.0/22 +203.22.99.0/24 +203.22.106.0/24 +203.22.122.0/23 +203.22.131.0/24 +203.22.163.0/24 +203.22.166.0/24 +203.22.170.0/24 +203.22.176.0/21 +203.22.194.0/24 +203.22.242.0/23 +203.22.245.0/24 +203.22.246.0/24 +203.22.252.0/23 +203.23.0.0/24 +203.23.47.0/24 +203.23.61.0/24 +203.23.62.0/23 +203.23.73.0/24 +203.23.85.0/24 +203.23.92.0/22 +203.23.98.0/24 +203.23.107.0/24 +203.23.112.0/24 +203.23.130.0/24 +203.23.140.0/23 +203.23.172.0/24 +203.23.182.0/24 +203.23.186.0/23 +203.23.192.0/24 +203.23.197.0/24 +203.23.198.0/24 +203.23.204.0/22 +203.23.224.0/24 +203.23.226.0/23 +203.23.228.0/22 +203.23.249.0/24 +203.23.251.0/24 +203.24.13.0/24 +203.24.18.0/24 +203.24.27.0/24 +203.24.43.0/24 +203.24.56.0/24 +203.24.58.0/24 +203.24.67.0/24 +203.24.74.0/24 +203.24.79.0/24 +203.24.80.0/23 +203.24.84.0/23 +203.24.86.0/24 +203.24.90.0/24 +203.24.111.0/24 +203.24.112.0/24 +203.24.116.0/24 +203.24.122.0/23 +203.24.145.0/24 +203.24.152.0/23 +203.24.157.0/24 +203.24.161.0/24 +203.24.167.0/24 +203.24.186.0/23 +203.24.199.0/24 +203.24.202.0/24 +203.24.212.0/23 +203.24.217.0/24 +203.24.219.0/24 +203.24.244.0/24 +203.25.19.0/24 +203.25.20.0/23 +203.25.46.0/24 +203.25.48.0/21 +203.25.64.0/23 +203.25.91.0/24 +203.25.99.0/24 +203.25.100.0/24 +203.25.106.0/24 +203.25.131.0/24 +203.25.135.0/24 +203.25.138.0/24 +203.25.147.0/24 +203.25.153.0/24 +203.25.154.0/23 +203.25.164.0/24 +203.25.166.0/24 +203.25.174.0/23 +203.25.180.0/24 +203.25.182.0/24 +203.25.191.0/24 +203.25.199.0/24 +203.25.200.0/24 +203.25.202.0/23 +203.25.208.0/20 +203.25.229.0/24 +203.25.235.0/24 +203.25.236.0/24 +203.25.242.0/24 +203.26.12.0/24 +203.26.34.0/24 +203.26.49.0/24 +203.26.50.0/24 +203.26.55.0/24 +203.26.56.0/23 +203.26.60.0/24 +203.26.65.0/24 +203.26.68.0/24 +203.26.76.0/24 +203.26.80.0/24 +203.26.84.0/24 +203.26.97.0/24 +203.26.102.0/23 +203.26.115.0/24 +203.26.116.0/24 +203.26.129.0/24 +203.26.143.0/24 +203.26.144.0/24 +203.26.148.0/23 +203.26.154.0/24 +203.26.158.0/23 +203.26.170.0/24 +203.26.173.0/24 +203.26.176.0/24 +203.26.185.0/24 +203.26.202.0/23 +203.26.210.0/24 +203.26.214.0/24 +203.26.222.0/24 +203.26.224.0/24 +203.26.228.0/24 +203.26.232.0/24 +203.27.0.0/24 +203.27.10.0/24 +203.27.15.0/24 +203.27.16.0/24 +203.27.20.0/24 +203.27.22.0/23 +203.27.40.0/24 +203.27.45.0/24 +203.27.53.0/24 +203.27.65.0/24 +203.27.66.0/24 +203.27.81.0/24 +203.27.88.0/24 +203.27.102.0/24 +203.27.109.0/24 +203.27.117.0/24 +203.27.121.0/24 +203.27.122.0/23 +203.27.125.0/24 +203.27.200.0/24 +203.27.202.0/24 +203.27.233.0/24 +203.27.241.0/24 +203.27.250.0/24 +203.28.10.0/24 +203.28.12.0/24 +203.28.33.0/24 +203.28.34.0/23 +203.28.43.0/24 +203.28.44.0/24 +203.28.54.0/24 +203.28.56.0/24 +203.28.73.0/24 +203.28.74.0/24 +203.28.76.0/24 +203.28.86.0/24 +203.28.88.0/24 +203.28.112.0/24 +203.28.131.0/24 +203.28.136.0/24 +203.28.140.0/24 +203.28.145.0/24 +203.28.165.0/24 +203.28.169.0/24 +203.28.170.0/24 +203.28.178.0/23 +203.28.185.0/24 +203.28.187.0/24 +203.28.196.0/24 +203.28.226.0/23 +203.28.239.0/24 +203.29.2.0/24 +203.29.8.0/23 +203.29.13.0/24 +203.29.14.0/24 +203.29.28.0/24 +203.29.46.0/24 +203.29.57.0/24 +203.29.61.0/24 +203.29.63.0/24 +203.29.69.0/24 +203.29.73.0/24 +203.29.81.0/24 +203.29.90.0/24 +203.29.95.0/24 +203.29.100.0/24 +203.29.103.0/24 +203.29.112.0/24 +203.29.120.0/22 +203.29.182.0/23 +203.29.187.0/24 +203.29.189.0/24 +203.29.190.0/24 +203.29.205.0/24 +203.29.210.0/24 +203.29.217.0/24 +203.29.227.0/24 +203.29.231.0/24 +203.29.233.0/24 +203.29.234.0/24 +203.29.248.0/24 +203.29.254.0/23 +203.30.16.0/23 +203.30.25.0/24 +203.30.27.0/24 +203.30.29.0/24 +203.30.66.0/24 +203.30.81.0/24 +203.30.87.0/24 +203.30.111.0/24 +203.30.121.0/24 +203.30.123.0/24 +203.30.152.0/24 +203.30.156.0/24 +203.30.162.0/24 +203.30.173.0/24 +203.30.175.0/24 +203.30.187.0/24 +203.30.194.0/24 +203.30.217.0/24 +203.30.220.0/24 +203.30.222.0/24 +203.30.232.0/23 +203.30.235.0/24 +203.30.240.0/23 +203.30.246.0/24 +203.30.250.0/23 +203.31.45.0/24 +203.31.46.0/24 +203.31.49.0/24 +203.31.51.0/24 +203.31.54.0/23 +203.31.69.0/24 +203.31.72.0/24 +203.31.80.0/24 +203.31.85.0/24 +203.31.97.0/24 +203.31.105.0/24 +203.31.106.0/24 +203.31.108.0/23 +203.31.124.0/24 +203.31.162.0/24 +203.31.174.0/24 +203.31.177.0/24 +203.31.181.0/24 +203.31.187.0/24 +203.31.189.0/24 +203.31.204.0/24 +203.31.220.0/24 +203.31.222.0/23 +203.31.225.0/24 +203.31.229.0/24 +203.31.248.0/23 +203.31.253.0/24 +203.32.20.0/24 +203.32.48.0/23 +203.32.56.0/24 +203.32.60.0/24 +203.32.62.0/24 +203.32.68.0/23 +203.32.76.0/24 +203.32.81.0/24 +203.32.84.0/23 +203.32.95.0/24 +203.32.102.0/24 +203.32.105.0/24 +203.32.130.0/24 +203.32.133.0/24 +203.32.140.0/24 +203.32.152.0/24 +203.32.186.0/23 +203.32.192.0/24 +203.32.196.0/24 +203.32.203.0/24 +203.32.204.0/23 +203.32.212.0/24 +203.33.4.0/24 +203.33.7.0/24 +203.33.8.0/21 +203.33.21.0/24 +203.33.26.0/24 +203.33.32.0/24 +203.33.63.0/24 +203.33.64.0/24 +203.33.67.0/24 +203.33.68.0/24 +203.33.73.0/24 +203.33.79.0/24 +203.33.100.0/24 +203.33.122.0/24 +203.33.129.0/24 +203.33.131.0/24 +203.33.145.0/24 +203.33.156.0/24 +203.33.158.0/23 +203.33.174.0/24 +203.33.185.0/24 +203.33.200.0/24 +203.33.202.0/23 +203.33.204.0/24 +203.33.206.0/23 +203.33.214.0/23 +203.33.224.0/23 +203.33.226.0/24 +203.33.233.0/24 +203.33.243.0/24 +203.33.250.0/24 +203.34.4.0/24 +203.34.21.0/24 +203.34.27.0/24 +203.34.39.0/24 +203.34.48.0/23 +203.34.54.0/24 +203.34.56.0/23 +203.34.67.0/24 +203.34.69.0/24 +203.34.76.0/24 +203.34.92.0/24 +203.34.106.0/24 +203.34.113.0/24 +203.34.147.0/24 +203.34.150.0/24 +203.34.152.0/23 +203.34.161.0/24 +203.34.162.0/24 +203.34.187.0/24 +203.34.192.0/21 +203.34.204.0/22 +203.34.232.0/24 +203.34.240.0/24 +203.34.242.0/24 +203.34.245.0/24 +203.34.251.0/24 +203.55.2.0/23 +203.55.4.0/24 +203.55.10.0/24 +203.55.13.0/24 +203.55.22.0/24 +203.55.30.0/24 +203.55.93.0/24 +203.55.101.0/24 +203.55.109.0/24 +203.55.110.0/24 +203.55.116.0/23 +203.55.119.0/24 +203.55.128.0/23 +203.55.146.0/23 +203.55.192.0/24 +203.55.196.0/24 +203.55.218.0/23 +203.55.221.0/24 +203.55.224.0/24 +203.56.1.0/24 +203.56.4.0/24 +203.56.12.0/24 +203.56.24.0/24 +203.56.38.0/24 +203.56.40.0/24 +203.56.46.0/24 +203.56.48.0/21 +203.56.68.0/23 +203.56.82.0/23 +203.56.84.0/23 +203.56.95.0/24 +203.56.110.0/24 +203.56.121.0/24 +203.56.161.0/24 +203.56.169.0/24 +203.56.172.0/23 +203.56.175.0/24 +203.56.183.0/24 +203.56.185.0/24 +203.56.187.0/24 +203.56.192.0/24 +203.56.198.0/24 +203.56.201.0/24 +203.56.208.0/23 +203.56.210.0/24 +203.56.214.0/24 +203.56.216.0/24 +203.56.227.0/24 +203.56.228.0/24 +203.56.231.0/24 +203.56.232.0/24 +203.56.240.0/24 +203.56.252.0/24 +203.56.254.0/24 +203.57.5.0/24 +203.57.6.0/24 +203.57.12.0/23 +203.57.28.0/24 +203.57.39.0/24 +203.57.46.0/24 +203.57.58.0/24 +203.57.61.0/24 +203.57.66.0/24 +203.57.69.0/24 +203.57.70.0/23 +203.57.73.0/24 +203.57.90.0/24 +203.57.101.0/24 +203.57.109.0/24 +203.57.123.0/24 +203.57.157.0/24 +203.57.200.0/24 +203.57.202.0/24 +203.57.206.0/24 +203.57.222.0/24 +203.57.224.0/20 +203.57.246.0/23 +203.57.249.0/24 +203.57.253.0/24 +203.57.254.0/23 +203.62.2.0/24 +203.62.131.0/24 +203.62.139.0/24 +203.62.161.0/24 +203.62.197.0/24 +203.62.228.0/22 +203.62.234.0/24 +203.62.246.0/24 +203.76.160.0/22 +203.76.168.0/22 +203.76.208.0/22 +203.76.212.0/22 +203.76.216.0/22 +203.76.240.0/22 +203.76.244.0/22 +203.77.180.0/22 +203.78.48.0/20 +203.78.156.0/22 +203.79.0.0/20 +203.79.32.0/20 +203.80.4.0/23 +203.80.32.0/20 +203.80.57.0/24 +203.80.129.0/24 +203.80.132.0/22 +203.80.136.0/21 +203.80.144.0/20 +203.81.0.0/21 +203.81.16.0/20 +203.81.244.0/22 +203.82.0.0/23 +203.82.16.0/21 +203.82.112.0/22 +203.82.116.0/22 +203.82.120.0/22 +203.82.124.0/22 +203.82.224.0/22 +203.82.228.0/22 +203.82.232.0/22 +203.82.236.0/22 +203.83.0.0/22 +203.83.8.0/22 +203.83.12.0/22 +203.83.56.0/21 +203.83.224.0/20 +203.86.0.0/19 +203.86.32.0/19 +203.86.64.0/20 +203.86.80.0/20 +203.86.96.0/19 +203.86.250.0/24 +203.86.254.0/23 +203.88.32.0/19 +203.88.100.0/22 +203.88.192.0/19 +203.89.0.0/22 +203.89.8.0/21 +203.89.100.0/22 +203.89.133.0/24 +203.89.136.0/22 +203.89.144.0/24 +203.90.0.0/22 +203.90.8.0/22 +203.90.12.0/22 +203.90.128.0/19 +203.90.160.0/19 +203.90.192.0/19 +203.91.32.0/19 +203.91.96.0/20 +203.91.120.0/21 +203.92.0.0/22 +203.92.6.0/24 +203.92.160.0/19 +203.93.0.0/22 +203.93.4.0/22 +203.93.8.0/24 +203.93.9.0/24 +203.93.10.0/23 +203.93.12.0/22 +203.93.16.0/20 +203.93.32.0/19 +203.93.64.0/18 +203.93.128.0/21 +203.93.136.0/22 +203.93.140.0/24 +203.93.141.0/24 +203.93.142.0/23 +203.93.144.0/20 +203.93.160.0/19 +203.93.192.0/18 +203.94.0.0/22 +203.94.4.0/22 +203.94.8.0/21 +203.94.16.0/20 +203.95.0.0/21 +203.95.96.0/20 +203.95.112.0/20 +203.95.128.0/18 +203.95.200.0/22 +203.95.204.0/22 +203.95.208.0/22 +203.95.224.0/19 +203.99.8.0/21 +203.99.16.0/20 +203.99.80.0/20 +203.100.32.0/20 +203.100.48.0/21 +203.100.58.0/24 +203.100.60.0/24 +203.100.63.0/24 +203.100.80.0/20 +203.100.96.0/19 +203.100.192.0/20 +203.104.32.0/20 +203.105.96.0/19 +203.105.128.0/19 +203.107.0.0/17 +203.110.160.0/19 +203.110.208.0/20 +203.110.232.0/23 +203.110.234.0/24 +203.114.80.0/22 +203.114.84.0/22 +203.114.88.0/22 +203.114.92.0/22 +203.114.244.0/22 +203.118.192.0/19 +203.118.241.0/24 +203.118.248.0/22 +203.119.24.0/21 +203.119.32.0/22 +203.119.80.0/22 +203.119.85.0/24 +203.119.113.0/24 +203.119.114.0/23 +203.119.116.0/22 +203.119.120.0/21 +203.119.128.0/17 +203.123.58.0/24 +203.128.32.0/19 +203.128.96.0/19 +203.128.224.0/21 +203.129.8.0/21 +203.130.32.0/19 +203.132.32.0/19 +203.134.240.0/21 +203.135.96.0/20 +203.135.112.0/20 +203.135.160.0/20 +203.142.219.0/24 +203.142.224.0/19 +203.144.96.0/19 +203.145.0.0/19 +203.148.0.0/18 +203.148.64.0/20 +203.148.80.0/22 +203.148.86.0/23 +203.149.92.0/22 +203.152.64.0/19 +203.152.128.0/19 +203.153.0.0/22 +203.156.192.0/18 +203.158.16.0/21 +203.160.52.0/22 +203.160.104.0/21 +203.160.129.0/24 +203.160.192.0/19 +203.161.0.0/22 +203.161.180.0/24 +203.161.183.0/24 +203.161.192.0/19 +203.166.160.0/19 +203.167.28.0/22 +203.168.0.0/19 +203.170.58.0/23 +203.171.0.0/22 +203.171.208.0/24 +203.171.224.0/20 +203.174.4.0/24 +203.174.6.0/24 +203.174.7.0/24 +203.174.96.0/19 +203.175.128.0/19 +203.175.192.0/18 +203.176.0.0/18 +203.176.64.0/19 +203.176.168.0/21 +203.184.80.0/20 +203.185.189.0/24 +203.187.160.0/19 +203.189.0.0/23 +203.189.6.0/23 +203.189.112.0/22 +203.189.192.0/19 +203.189.232.0/22 +203.189.240.0/22 +203.190.96.0/20 +203.190.249.0/24 +203.191.0.0/23 +203.191.2.0/24 +203.191.5.0/24 +203.191.7.0/24 +203.191.16.0/20 +203.191.64.0/18 +203.191.133.0/24 +203.191.144.0/21 +203.191.152.0/21 +203.192.0.0/19 +203.193.224.0/19 +203.194.120.0/21 +203.195.64.0/19 +203.195.112.0/21 +203.195.128.0/17 +203.196.0.0/21 +203.196.8.0/21 +203.196.28.0/22 +203.201.181.0/24 +203.201.182.0/24 +203.202.236.0/22 +203.205.64.0/19 +203.205.128.0/17 +203.207.64.0/20 +203.207.80.0/21 +203.207.88.0/22 +203.207.92.0/22 +203.207.96.0/20 +203.207.112.0/20 +203.207.128.0/18 +203.207.192.0/21 +203.207.200.0/21 +203.207.208.0/20 +203.207.224.0/19 +203.208.0.0/20 +203.208.16.0/22 +203.208.32.0/19 +203.209.224.0/19 +203.212.0.0/20 +203.212.80.0/20 +203.215.232.0/21 +203.217.164.0/22 +203.223.0.0/20 +203.223.16.0/21 +204.52.191.0/24 +210.2.0.0/20 +210.2.16.0/20 +210.5.0.0/19 +210.5.56.0/21 +210.5.128.0/20 +210.5.144.0/20 +210.7.56.0/22 +210.7.60.0/22 +210.12.0.0/18 +210.12.64.0/18 +210.12.128.0/18 +210.12.192.0/18 +210.13.0.0/18 +210.13.64.0/18 +210.13.128.0/17 +210.14.64.0/19 +210.14.112.0/20 +210.14.128.0/19 +210.14.160.0/19 +210.14.192.0/19 +210.14.224.0/19 +210.15.0.0/19 +210.15.32.0/19 +210.15.64.0/19 +210.15.96.0/19 +210.15.128.0/18 +210.16.104.0/22 +210.16.128.0/18 +210.21.0.0/17 +210.21.128.0/17 +210.22.0.0/16 +210.23.32.0/19 +210.25.0.0/16 +210.26.0.0/15 +210.28.0.0/14 +210.32.0.0/14 +210.36.0.0/14 +210.40.0.0/13 +210.51.0.0/16 +210.52.0.0/18 +210.52.64.0/18 +210.52.128.0/17 +210.53.0.0/17 +210.53.128.0/17 +210.56.192.0/19 +210.72.0.0/17 +210.72.128.0/19 +210.72.160.0/19 +210.72.192.0/18 +210.73.0.0/19 +210.73.32.0/19 +210.73.64.0/18 +210.73.128.0/17 +210.74.0.0/19 +210.74.32.0/19 +210.74.64.0/19 +210.74.96.0/19 +210.74.128.0/19 +210.74.160.0/19 +210.74.192.0/18 +210.75.0.0/16 +210.76.0.0/19 +210.76.32.0/19 +210.76.64.0/18 +210.76.128.0/17 +210.77.0.0/16 +210.78.0.0/19 +210.78.32.0/19 +210.78.64.0/18 +210.78.128.0/19 +210.78.160.0/19 +210.78.192.0/18 +210.79.64.0/18 +210.79.224.0/19 +210.82.0.0/15 +210.87.128.0/20 +210.87.144.0/20 +210.87.160.0/19 +210.185.192.0/18 +210.192.96.0/19 +211.64.0.0/14 +211.68.0.0/15 +211.70.0.0/15 +211.80.0.0/16 +211.81.0.0/16 +211.82.0.0/16 +211.83.0.0/16 +211.84.0.0/15 +211.86.0.0/15 +211.88.0.0/16 +211.89.0.0/16 +211.90.0.0/15 +211.92.0.0/15 +211.94.0.0/15 +211.96.0.0/15 +211.98.0.0/16 +211.99.0.0/18 +211.99.64.0/19 +211.99.96.0/19 +211.99.128.0/17 +211.100.0.0/16 +211.101.0.0/18 +211.101.64.0/18 +211.101.128.0/17 +211.102.0.0/16 +211.103.0.0/17 +211.103.128.0/17 +211.136.0.0/14 +211.140.0.0/15 +211.142.0.0/17 +211.142.128.0/17 +211.143.0.0/16 +211.144.0.0/15 +211.146.0.0/16 +211.147.0.0/16 +211.148.0.0/14 +211.152.0.0/15 +211.154.0.0/16 +211.155.0.0/18 +211.155.64.0/19 +211.155.96.0/19 +211.155.128.0/17 +211.156.0.0/14 +211.160.0.0/14 +211.164.0.0/14 +212.64.0.0/17 +212.129.128.0/17 +218.0.0.0/16 +218.1.0.0/16 +218.2.0.0/15 +218.4.0.0/15 +218.6.0.0/16 +218.7.0.0/16 +218.8.0.0/15 +218.10.0.0/16 +218.11.0.0/16 +218.12.0.0/16 +218.13.0.0/16 +218.14.0.0/15 +218.16.0.0/14 +218.20.0.0/16 +218.21.0.0/17 +218.21.128.0/17 +218.22.0.0/15 +218.24.0.0/15 +218.26.0.0/16 +218.27.0.0/16 +218.28.0.0/15 +218.30.0.0/15 +218.56.0.0/14 +218.60.0.0/15 +218.62.0.0/17 +218.62.128.0/17 +218.63.0.0/16 +218.64.0.0/15 +218.66.0.0/16 +218.67.0.0/17 +218.67.128.0/17 +218.68.0.0/15 +218.70.0.0/15 +218.72.0.0/14 +218.76.0.0/15 +218.78.0.0/15 +218.80.0.0/14 +218.84.0.0/14 +218.88.0.0/13 +218.96.0.0/15 +218.98.0.0/17 +218.98.128.0/18 +218.98.192.0/19 +218.98.224.0/19 +218.99.0.0/16 +218.100.88.0/21 +218.100.96.0/19 +218.100.128.0/17 +218.104.0.0/17 +218.104.128.0/19 +218.104.160.0/19 +218.104.192.0/21 +218.104.200.0/21 +218.104.208.0/20 +218.104.224.0/19 +218.105.0.0/16 +218.106.0.0/15 +218.108.0.0/16 +218.109.0.0/16 +218.185.192.0/19 +218.185.240.0/21 +218.192.0.0/16 +218.193.0.0/16 +218.194.0.0/16 +218.195.0.0/16 +218.196.0.0/14 +218.200.0.0/14 +218.204.0.0/15 +218.206.0.0/15 +218.240.0.0/14 +218.244.0.0/15 +218.246.0.0/15 +218.249.0.0/16 +219.72.0.0/16 +219.82.0.0/16 +219.83.128.0/17 +219.90.68.0/22 +219.90.72.0/22 +219.90.76.0/22 +219.128.0.0/12 +219.144.0.0/14 +219.148.0.0/16 +219.149.0.0/17 +219.149.128.0/18 +219.149.192.0/18 +219.150.0.0/19 +219.150.32.0/19 +219.150.64.0/19 +219.150.96.0/20 +219.150.112.0/20 +219.150.128.0/17 +219.151.0.0/19 +219.151.32.0/19 +219.151.64.0/18 +219.151.128.0/17 +219.152.0.0/15 +219.154.0.0/15 +219.156.0.0/15 +219.158.0.0/17 +219.158.128.0/17 +219.159.0.0/18 +219.159.64.0/18 +219.159.128.0/17 +219.216.0.0/15 +219.218.0.0/15 +219.220.0.0/16 +219.221.0.0/16 +219.222.0.0/15 +219.224.0.0/15 +219.226.0.0/16 +219.227.0.0/16 +219.228.0.0/15 +219.230.0.0/15 +219.232.0.0/14 +219.236.0.0/15 +219.238.0.0/15 +219.242.0.0/15 +219.244.0.0/14 +220.101.192.0/18 +220.112.0.0/14 +220.152.128.0/17 +220.154.0.0/15 +220.158.240.0/22 +220.160.0.0/11 +220.192.0.0/15 +220.194.0.0/15 +220.196.0.0/14 +220.200.0.0/13 +220.231.0.0/18 +220.231.128.0/17 +220.232.64.0/18 +220.234.0.0/16 +220.242.0.0/15 +220.247.136.0/21 +220.248.0.0/14 +220.252.0.0/16 +221.0.0.0/15 +221.2.0.0/16 +221.3.0.0/17 +221.3.128.0/17 +221.4.0.0/16 +221.5.0.0/17 +221.5.128.0/17 +221.6.0.0/16 +221.7.0.0/19 +221.7.32.0/19 +221.7.64.0/19 +221.7.96.0/19 +221.7.128.0/17 +221.8.0.0/15 +221.10.0.0/16 +221.11.0.0/17 +221.11.128.0/18 +221.11.192.0/19 +221.11.224.0/19 +221.12.0.0/17 +221.12.128.0/18 +221.13.0.0/18 +221.13.64.0/19 +221.13.96.0/19 +221.13.128.0/17 +221.14.0.0/15 +221.122.0.0/15 +221.128.128.0/17 +221.129.0.0/16 +221.130.0.0/15 +221.133.224.0/19 +221.136.0.0/16 +221.137.0.0/16 +221.172.0.0/14 +221.176.0.0/13 +221.192.0.0/15 +221.194.0.0/16 +221.195.0.0/16 +221.196.0.0/15 +221.198.0.0/16 +221.199.0.0/19 +221.199.32.0/20 +221.199.48.0/20 +221.199.64.0/18 +221.199.128.0/18 +221.199.192.0/20 +221.199.224.0/19 +221.200.0.0/14 +221.204.0.0/15 +221.206.0.0/16 +221.207.0.0/18 +221.207.64.0/18 +221.207.128.0/17 +221.208.0.0/14 +221.212.0.0/16 +221.213.0.0/16 +221.214.0.0/15 +221.216.0.0/13 +221.224.0.0/13 +221.232.0.0/14 +221.236.0.0/15 +221.238.0.0/16 +221.239.0.0/17 +221.239.128.0/17 +222.16.0.0/15 +222.18.0.0/15 +222.20.0.0/15 +222.22.0.0/16 +222.23.0.0/16 +222.24.0.0/15 +222.26.0.0/15 +222.28.0.0/14 +222.32.0.0/11 +222.64.0.0/13 +222.72.0.0/15 +222.74.0.0/16 +222.75.0.0/16 +222.76.0.0/14 +222.80.0.0/15 +222.82.0.0/16 +222.83.0.0/17 +222.83.128.0/17 +222.84.0.0/16 +222.85.0.0/17 +222.85.128.0/17 +222.86.0.0/15 +222.88.0.0/15 +222.90.0.0/15 +222.92.0.0/14 +222.125.0.0/16 +222.126.128.0/17 +222.128.0.0/14 +222.132.0.0/14 +222.136.0.0/13 +222.160.0.0/15 +222.162.0.0/16 +222.163.0.0/19 +222.163.32.0/19 +222.163.64.0/18 +222.163.128.0/17 +222.168.0.0/15 +222.170.0.0/15 +222.172.0.0/17 +222.172.128.0/17 +222.173.0.0/16 +222.174.0.0/15 +222.176.0.0/13 +222.184.0.0/13 +222.192.0.0/14 +222.196.0.0/15 +222.198.0.0/16 +222.199.0.0/16 +222.200.0.0/14 +222.204.0.0/15 +222.206.0.0/15 +222.208.0.0/13 +222.216.0.0/15 +222.218.0.0/16 +222.219.0.0/16 +222.220.0.0/15 +222.222.0.0/15 +222.240.0.0/13 +222.248.0.0/16 +222.249.0.0/17 +222.249.128.0/19 +222.249.160.0/20 +222.249.176.0/20 +222.249.192.0/18 +223.0.0.0/15 +223.2.0.0/15 +223.4.0.0/14 +223.8.0.0/13 +223.20.0.0/15 +223.27.184.0/22 +223.29.208.0/22 +223.29.252.0/22 +223.64.0.0/11 +223.96.0.0/12 +223.112.0.0/14 +223.116.0.0/15 +223.120.128.0/17 +223.121.128.0/17 +223.122.0.0/15 +223.124.0.0/14 +223.128.0.0/15 +223.144.0.0/12 +223.160.0.0/14 +223.166.0.0/15 +223.192.0.0/15 +223.198.0.0/15 +223.201.0.0/16 +223.202.0.0/15 +223.208.0.0/14 +223.212.0.0/15 +223.214.0.0/15 +223.220.0.0/15 +223.223.176.0/20 +223.223.192.0/20 +223.240.0.0/13 +223.248.0.0/14 +223.252.128.0/17 +223.254.0.0/16 +223.255.0.0/17 +223.255.236.0/22 +223.255.252.0/23 diff --git a/package/lean/luci-app-ssr-plus/root/etc/config/black.list b/package/lean/luci-app-ssr-plus/root/etc/config/black.list new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/package/lean/luci-app-ssr-plus/root/etc/config/shadowsocksr b/package/lean/luci-app-ssr-plus/root/etc/config/shadowsocksr new file mode 100644 index 00000000000000..63cbef98fcbe42 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/root/etc/config/shadowsocksr @@ -0,0 +1,42 @@ + +config global + option tunnel_forward '8.8.4.4:53' + option tunnel_address '0.0.0.0' + option run_mode 'gfw' + option pdnsd_enable '1' + option monitor_enable '1' + option global_server 'nil' + option enable_switch '1' + option switch_timeout '5' + option switch_time '667' + option switch_try_count '3' + option adblock '0' + option adblock_url 'https://gitee.com/privacy-protection-tools/anti-ad/raw/master/anti-ad-for-dnsmasq.conf' + option chnroute '0' + option chnroute_url 'https://ispip.clang.cn/all_cn.txt' + +config socks5_proxy + option socks '0' + option local_port '1080' + option local_address '0.0.0.0' + +config access_control + option wan_bp_list '/etc/china_ssr.txt' + option lan_ac_mode 'b' + option router_proxy '1' + list wan_fw_ips '149.154.160.0/20' + list wan_fw_ips '67.198.55.0/24' + list wan_fw_ips '91.108.4.0/22' + list wan_fw_ips '91.108.56.0/22' + list wan_fw_ips '109.239.140.0/24' + +config server_global + option enable_server '0' + +config server_subscribe + option proxy '0' + option auto_update_time '2' + option auto_update '1' + + + diff --git a/package/lean/luci-app-ssr-plus/root/etc/config/white.list b/package/lean/luci-app-ssr-plus/root/etc/config/white.list new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/package/lean/luci-app-ssr-plus/root/etc/dnsmasq.oversea/oversea_list.conf b/package/lean/luci-app-ssr-plus/root/etc/dnsmasq.oversea/oversea_list.conf new file mode 100644 index 00000000000000..ae50fb90d0a83a --- /dev/null +++ b/package/lean/luci-app-ssr-plus/root/etc/dnsmasq.oversea/oversea_list.conf @@ -0,0 +1,192 @@ +server=/v.youku.com/127.0.0.1#5335 +server=/api.youku.com/127.0.0.1#5335 +server=/v2.tudou.com/127.0.0.1#5335 +server=/www.tudou.com/127.0.0.1#5335 +server=/s.plcloud.music.qq.com/127.0.0.1#5335 +server=/i.y.qq.com/127.0.0.1#5335 +server=/hot.vrs.sohu.com/127.0.0.1#5335 +server=/live.tv.sohu.com/127.0.0.1#5335 +server=/pad.tv.sohu.com/127.0.0.1#5335 +server=/my.tv.sohu.com/127.0.0.1#5335 +server=/hot.vrs.letv.com/127.0.0.1#5335 +server=/data.video.qiyi.com/127.0.0.1#5335 +server=/cache.video.qiyi.com/127.0.0.1#5335 +server=/cache.vip.qiyi.com/127.0.0.1#5335 +server=/vv.video.qq.com/127.0.0.1#5335 +server=/tt.video.qq.com/127.0.0.1#5335 +server=/ice.video.qq.com/127.0.0.1#5335 +server=/tjsa.video.qq.com/127.0.0.1#5335 +server=/a10.video.qq.com/127.0.0.1#5335 +server=/xyy.video.qq.com/127.0.0.1#5335 +server=/vcq.video.qq.com/127.0.0.1#5335 +server=/vsh.video.qq.com/127.0.0.1#5335 +server=/vbj.video.qq.com/127.0.0.1#5335 +server=/bobo.video.qq.com/127.0.0.1#5335 +server=/flvs.video.qq.com/127.0.0.1#5335 +server=/bkvv.video.qq.com/127.0.0.1#5335 +server=/info.zb.qq.com/127.0.0.1#5335 +server=/geo.js.kankan.xunlei.com/127.0.0.1#5335 +server=/web-play.pptv.com/127.0.0.1#5335 +server=/web-play.pplive.cn/127.0.0.1#5335 +server=/dyn.ugc.pps.tv/127.0.0.1#5335 +server=/v.pps.tv/127.0.0.1#5335 +server=/inner.kandian.com/127.0.0.1#5335 +server=/ipservice.163.com/127.0.0.1#5335 +server=/so.open.163.com/127.0.0.1#5335 +server=/zb.s.qq.com/127.0.0.1#5335 +server=/ip.kankan.xunlei.com/127.0.0.1#5335 +server=/vxml.56.com/127.0.0.1#5335 +server=/music.sina.com.cn/127.0.0.1#5335 +server=/play.baidu.com/127.0.0.1#5335 +server=/v.iask.com/127.0.0.1#5335 +server=/tv.weibo.com/127.0.0.1#5335 +server=/wtv.v.iask.com/127.0.0.1#5335 +server=/video.sina.com.cn/127.0.0.1#5335 +server=/www.yinyuetai.com/127.0.0.1#5335 +server=/api.letv.com/127.0.0.1#5335 +server=/live.gslb.letv.com/127.0.0.1#5335 +server=/static.itv.letv.com/127.0.0.1#5335 +server=/ip.apps.cntv.cn/127.0.0.1#5335 +server=/vdn.apps.cntv.cn/127.0.0.1#5335 +server=/vdn.live.cntv.cn/127.0.0.1#5335 +server=/vip.sports.cntv.cn/127.0.0.1#5335 +server=/a.play.api.3g.youku.com/127.0.0.1#5335 +server=/i.play.api.3g.youku.com/127.0.0.1#5335 +server=/api.3g.youku.com/127.0.0.1#5335 +server=/tv.api.3g.youku.com/127.0.0.1#5335 +server=/play.api.3g.youku.com/127.0.0.1#5335 +server=/play.api.3g.tudou.com/127.0.0.1#5335 +server=/tv.api.3g.tudou.com/127.0.0.1#5335 +server=/api.3g.tudou.com/127.0.0.1#5335 +server=/api.tv.sohu.com/127.0.0.1#5335 +server=/access.tv.sohu.com/127.0.0.1#5335 +server=/iface.iqiyi.com/127.0.0.1#5335 +server=/iface2.iqiyi.com/127.0.0.1#5335 +server=/cache.m.iqiyi.com/127.0.0.1#5335 +server=/dynamic.app.m.letv.com/127.0.0.1#5335 +server=/dynamic.meizi.app.m.letv.com/127.0.0.1#5335 +server=/dynamic.search.app.m.letv.com/127.0.0.1#5335 +server=/dynamic.live.app.m.letv.com/127.0.0.1#5335 +server=/listso.m.areainfo.ppstream.com/127.0.0.1#5335 +server=/epg.api.pptv.com/127.0.0.1#5335 +server=/play.api.pptv.com/127.0.0.1#5335 +server=/m.letv.com/127.0.0.1#5335 +server=/interface.bilibili.com/127.0.0.1#5335 +server=/3g.music.qq.com/127.0.0.1#5335 +server=/mqqplayer.3g.qq.com/127.0.0.1#5335 +server=/proxy.music.qq.com/127.0.0.1#5335 +server=/proxymc.qq.com/127.0.0.1#5335 +server=/ip2.kugou.com/127.0.0.1#5335 +server=/ip.kugou.com/127.0.0.1#5335 +server=/client.api.ttpod.com/127.0.0.1#5335 +server=/mobi.kuwo.cn/127.0.0.1#5335 +server=/mobilefeedback.kugou.com/127.0.0.1#5335 +server=/tingapi.ting.baidu.com/127.0.0.1#5335 +server=/music.baidu.com/127.0.0.1#5335 +server=/serviceinfo.sdk.duomi.com/127.0.0.1#5335 +server=/music.163.com/127.0.0.1#5335 +server=/www.xiami.com/127.0.0.1#5335 +server=/spark.api.xiami.com/127.0.0.1#5335 +server=/iplocation.geo.qiyi.com/127.0.0.1#5335 +server=/sns.video.qq.com/127.0.0.1#5335 +server=/v5.pc.duomi.com/127.0.0.1#5335 +server=/tms.is.ysten.com/127.0.0.1#5335 +server=/internal.check.duokanbox.com/127.0.0.1#5335 +server=/openapi.youku.com/127.0.0.1#5335 +server=/y.qq.com/127.0.0.1#5335 +ipset=/v.youku.com/oversea +ipset=/api.youku.com/oversea +ipset=/v2.tudou.com/oversea +ipset=/www.tudou.com/oversea +ipset=/s.plcloud.music.qq.com/oversea +ipset=/i.y.qq.com/oversea +ipset=/hot.vrs.sohu.com/oversea +ipset=/live.tv.sohu.com/oversea +ipset=/pad.tv.sohu.com/oversea +ipset=/my.tv.sohu.com/oversea +ipset=/hot.vrs.letv.com/oversea +ipset=/data.video.qiyi.com/oversea +ipset=/cache.video.qiyi.com/oversea +ipset=/cache.vip.qiyi.com/oversea +ipset=/vv.video.qq.com/oversea +ipset=/tt.video.qq.com/oversea +ipset=/ice.video.qq.com/oversea +ipset=/tjsa.video.qq.com/oversea +ipset=/a10.video.qq.com/oversea +ipset=/xyy.video.qq.com/oversea +ipset=/vcq.video.qq.com/oversea +ipset=/vsh.video.qq.com/oversea +ipset=/vbj.video.qq.com/oversea +ipset=/bobo.video.qq.com/oversea +ipset=/flvs.video.qq.com/oversea +ipset=/bkvv.video.qq.com/oversea +ipset=/info.zb.qq.com/oversea +ipset=/geo.js.kankan.xunlei.com/oversea +ipset=/web-play.pptv.com/oversea +ipset=/web-play.pplive.cn/oversea +ipset=/dyn.ugc.pps.tv/oversea +ipset=/v.pps.tv/oversea +ipset=/inner.kandian.com/oversea +ipset=/ipservice.163.com/oversea +ipset=/so.open.163.com/oversea +ipset=/zb.s.qq.com/oversea +ipset=/ip.kankan.xunlei.com/oversea +ipset=/vxml.56.com/oversea +ipset=/music.sina.com.cn/oversea +ipset=/play.baidu.com/oversea +ipset=/v.iask.com/oversea +ipset=/tv.weibo.com/oversea +ipset=/wtv.v.iask.com/oversea +ipset=/video.sina.com.cn/oversea +ipset=/www.yinyuetai.com/oversea +ipset=/api.letv.com/oversea +ipset=/live.gslb.letv.com/oversea +ipset=/static.itv.letv.com/oversea +ipset=/ip.apps.cntv.cn/oversea +ipset=/vdn.apps.cntv.cn/oversea +ipset=/vdn.live.cntv.cn/oversea +ipset=/vip.sports.cntv.cn/oversea +ipset=/a.play.api.3g.youku.com/oversea +ipset=/i.play.api.3g.youku.com/oversea +ipset=/api.3g.youku.com/oversea +ipset=/tv.api.3g.youku.com/oversea +ipset=/play.api.3g.youku.com/oversea +ipset=/play.api.3g.tudou.com/oversea +ipset=/tv.api.3g.tudou.com/oversea +ipset=/api.3g.tudou.com/oversea +ipset=/api.tv.sohu.com/oversea +ipset=/access.tv.sohu.com/oversea +ipset=/iface.iqiyi.com/oversea +ipset=/iface2.iqiyi.com/oversea +ipset=/cache.m.iqiyi.com/oversea +ipset=/dynamic.app.m.letv.com/oversea +ipset=/dynamic.meizi.app.m.letv.com/oversea +ipset=/dynamic.search.app.m.letv.com/oversea +ipset=/dynamic.live.app.m.letv.com/oversea +ipset=/listso.m.areainfo.ppstream.com/oversea +ipset=/epg.api.pptv.com/oversea +ipset=/play.api.pptv.com/oversea +ipset=/m.letv.com/oversea +ipset=/interface.bilibili.com/oversea +ipset=/3g.music.qq.com/oversea +ipset=/mqqplayer.3g.qq.com/oversea +ipset=/proxy.music.qq.com/oversea +ipset=/proxymc.qq.com/oversea +ipset=/ip2.kugou.com/oversea +ipset=/ip.kugou.com/oversea +ipset=/client.api.ttpod.com/oversea +ipset=/mobi.kuwo.cn/oversea +ipset=/mobilefeedback.kugou.com/oversea +ipset=/tingapi.ting.baidu.com/oversea +ipset=/music.baidu.com/oversea +ipset=/serviceinfo.sdk.duomi.com/oversea +ipset=/music.163.com/oversea +ipset=/www.xiami.com/oversea +ipset=/spark.api.xiami.com/oversea +ipset=/iplocation.geo.qiyi.com/oversea +ipset=/sns.video.qq.com/oversea +ipset=/v5.pc.duomi.com/oversea +ipset=/tms.is.ysten.com/oversea +ipset=/internal.check.duokanbox.com/oversea +ipset=/openapi.youku.com/oversea +ipset=/y.qq.com/oversea diff --git a/package/lean/luci-app-ssr-plus/root/etc/dnsmasq.ssr/ad.conf b/package/lean/luci-app-ssr-plus/root/etc/dnsmasq.ssr/ad.conf new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/package/lean/luci-app-ssr-plus/root/etc/dnsmasq.ssr/gfw_base.conf b/package/lean/luci-app-ssr-plus/root/etc/dnsmasq.ssr/gfw_base.conf new file mode 100644 index 00000000000000..9c64cc143e4e8f --- /dev/null +++ b/package/lean/luci-app-ssr-plus/root/etc/dnsmasq.ssr/gfw_base.conf @@ -0,0 +1,108 @@ +ipset=/.91smartyun.pt/gfwlist +ipset=/.adobe.com/gfwlist +ipset=/.amazonaws.com/gfwlist +ipset=/.ampproject.org/gfwlist +ipset=/.apple.news/gfwlist +ipset=/.aws.amazon.com/gfwlist +ipset=/.azureedge.net/gfwlist +ipset=/.backpackers.com.tw/gfwlist +ipset=/.bitfinex.com/gfwlist +ipset=/.buzzfeed.com/gfwlist +ipset=/.clockwise.ee/gfwlist +ipset=/.cloudfront.net/gfwlist +ipset=/.coindesk.com/gfwlist +ipset=/.coinsquare.io/gfwlist +ipset=/.cryptocompare.com/gfwlist +ipset=/.dropboxstatic.com/gfwlist +ipset=/.eurecom.fr/gfwlist +ipset=/.gdax.com/gfwlist +ipset=/.github.com/gfwlist +ipset=/.kknews.cc/gfwlist +ipset=/.nutaq.com/gfwlist +ipset=/.openairinterface.org/gfwlist +ipset=/.skype.com/gfwlist +ipset=/.sublimetext.com/gfwlist +ipset=/.textnow.com/gfwlist +ipset=/.textnow.me/gfwlist +ipset=/.trouter.io/gfwlist +ipset=/.t66y.com/gfwlist +ipset=/.uploaded.net/gfwlist +ipset=/.whatsapp.com/gfwlist +ipset=/.whatsapp.net/gfwlist +ipset=/.wsj.net/gfwlist +ipset=/.google.com/gfwlist +ipset=/.google.com.hk/gfwlist +ipset=/.gstatic.com/gfwlist +ipset=/.googleusercontent.com/gfwlist +ipset=/.googlepages.com/gfwlist +ipset=/.googlevideo.com/gfwlist +ipset=/.googlecode.com/gfwlist +ipset=/.googleapis.com/gfwlist +ipset=/.googlesource.com/gfwlist +ipset=/.googledrive.com/gfwlist +ipset=/.ggpht.com/gfwlist +ipset=/.youtube.com/gfwlist +ipset=/.youtu.be/gfwlist +ipset=/.ytimg.com/gfwlist +ipset=/.twitter.com/gfwlist +ipset=/.facebook.com/gfwlist +ipset=/.fastly.net/gfwlist +ipset=/.akamai.net/gfwlist +ipset=/.akamaiedge.net/gfwlist +ipset=/.akamaihd.net/gfwlist +ipset=/.edgesuite.net/gfwlist +ipset=/.edgekey.net/gfwlist +server=/.91smartyun.pt/127.0.0.1#5335 +server=/.adobe.com/127.0.0.1#5335 +server=/.amazonaws.com/127.0.0.1#5335 +server=/.ampproject.org/127.0.0.1#5335 +server=/.apple.news/127.0.0.1#5335 +server=/.aws.amazon.com/127.0.0.1#5335 +server=/.azureedge.net/127.0.0.1#5335 +server=/.backpackers.com.tw/127.0.0.1#5335 +server=/.bitfinex.com/127.0.0.1#5335 +server=/.buzzfeed.com/127.0.0.1#5335 +server=/.clockwise.ee/127.0.0.1#5335 +server=/.cloudfront.net/127.0.0.1#5335 +server=/.coindesk.com/127.0.0.1#5335 +server=/.coinsquare.io/127.0.0.1#5335 +server=/.cryptocompare.com/127.0.0.1#5335 +server=/.dropboxstatic.com/127.0.0.1#5335 +server=/.eurecom.fr/127.0.0.1#5335 +server=/.gdax.com/127.0.0.1#5335 +server=/.github.com/127.0.0.1#5335 +server=/.kknews.cc/127.0.0.1#5335 +server=/.nutaq.com/127.0.0.1#5335 +server=/.openairinterface.org/127.0.0.1#5335 +server=/.skype.com/127.0.0.1#5335 +server=/.sublimetext.com/127.0.0.1#5335 +server=/.textnow.com/127.0.0.1#5335 +server=/.textnow.me/127.0.0.1#5335 +server=/.trouter.io/127.0.0.1#5335 +server=/.t66y.com/127.0.0.1#5335 +server=/.uploaded.net/127.0.0.1#5335 +server=/.whatsapp.com/127.0.0.1#5335 +server=/.whatsapp.net/127.0.0.1#5335 +server=/.wsj.net/127.0.0.1#5335 +server=/.google.com/127.0.0.1#5335 +server=/.google.com.hk/127.0.0.1#5335 +server=/.gstatic.com/127.0.0.1#5335 +server=/.googleusercontent.com/127.0.0.1#5335 +server=/.googlepages.com/127.0.0.1#5335 +server=/.googlevideo.com/127.0.0.1#5335 +server=/.googlecode.com/127.0.0.1#5335 +server=/.googleapis.com/127.0.0.1#5335 +server=/.googlesource.com/127.0.0.1#5335 +server=/.googledrive.com/127.0.0.1#5335 +server=/.ggpht.com/127.0.0.1#5335 +server=/.youtube.com/127.0.0.1#5335 +server=/.youtu.be/127.0.0.1#5335 +server=/.ytimg.com/127.0.0.1#5335 +server=/.twitter.com/127.0.0.1#5335 +server=/.facebook.com/127.0.0.1#5335 +server=/.fastly.net/127.0.0.1#5335 +server=/.akamai.net/127.0.0.1#5335 +server=/.akamaiedge.net/127.0.0.1#5335 +server=/.akamaihd.net/127.0.0.1#5335 +server=/.edgesuite.net/127.0.0.1#5335 +server=/.edgekey.net/127.0.0.1#5335 diff --git a/package/lean/luci-app-ssr-plus/root/etc/dnsmasq.ssr/gfw_list.conf b/package/lean/luci-app-ssr-plus/root/etc/dnsmasq.ssr/gfw_list.conf new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr b/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr new file mode 100644 index 00000000000000..b7d13350a0c9c5 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr @@ -0,0 +1,587 @@ +#!/bin/sh /etc/rc.common +# +# Copyright (C) 2017 openwrt-ssr +# Copyright (C) 2017 yushi studio +# Copyright (C) 2018 lean +# +# This is free software, licensed under the GNU General Public License v3. +# See /LICENSE for more information. +# + +START=90 +STOP=15 + +SERVICE_DAEMONIZE=1 +NAME=shadowsocksr +EXTRA_COMMANDS=rules +CONFIG_FILE=/var/etc/${NAME}.json +CONFIG_UDP_FILE=/var/etc/${NAME}_u.json +CONFIG_SOCK5_FILE=/var/etc/${NAME}_s.json +server_count=0 +redir_tcp=0 +redir_udp=0 +tunnel_enable=0 +local_enable=0 +kcp_enable_flag=0 +kcp_flag=0 +pdnsd_enable_flag=0 +switch_enable=0 +switch_server=$1 +MAXFD=32768 +CRON_FILE=/etc/crontabs/root +threads=1 + +uci_get_by_name() { + local ret=$(uci get $NAME.$1.$2 2>/dev/null) + echo ${ret:=$3} +} + +uci_get_by_type() { + local ret=$(uci get $NAME.@$1[0].$2 2>/dev/null) + echo ${ret:=$3} +} + +add_cron() { + sed -i '/shadowsocksr/d' $CRON_FILE + sed -i '/ssrplus.log/d' $CRON_FILE && echo '0 1 * * * echo "" > /tmp/ssrplus.log' >>$CRON_FILE + [ $(uci_get_by_type server_subscribe auto_update 0) -eq 1 ] && echo "0 $(uci_get_by_type server_subscribe auto_update_time) * * * /usr/bin/lua /usr/share/shadowsocksr/subscribe.lua" >>$CRON_FILE + [ $(uci_get_by_type server_subscribe auto_update 0) -eq 1 ] && echo "0 5 * * * /usr/bin/lua /usr/share/shadowsocksr/update.lua" >>$CRON_FILE + crontab $CRON_FILE +} + +del_cron() { + sed -i '/shadowsocksr/d' $CRON_FILE + sed -i '/ssrplus.log/d' $CRON_FILE + /etc/init.d/cron restart +} + +run_mode=$(uci_get_by_type global run_mode) + +gen_config_file() { + local host=$(uci_get_by_name $1 server) + if echo $host | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" >/dev/null; then + hostip=$host + elif [ "$host" != "${host#*:[0-9a-fA-F]}" ]; then + hostip=$host + else + hostip=$(ping $host -W 1 -s 1 -c 1 | grep PING | cut -d'(' -f 2 | cut -d')' -f1) + if echo $hostip | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" >/dev/null; then + hostip=$hostip + else + hostip=$(cat /etc/ssr_ip) + fi + fi + [ "$2" == "0" -a "$kcp_flag" == "1" ] && hostip="127.0.0.1" + if [ "$2" == "0" ]; then + config_file=$CONFIG_FILE + elif [ "$2" == "1" ]; then + config_file=$CONFIG_UDP_FILE + else + config_file=$CONFIG_SOCK5_FILE + fi + if [ $(uci_get_by_name $1 fast_open 0) == "1" ]; then + fastopen="true" + else + fastopen="false" + fi + local stype=$(uci_get_by_name $1 type) + if [ "$stype" == "ss" ]; then + cat <<-EOF >$config_file + { + "server": "$hostip", + "server_port": $(uci_get_by_name $1 server_port), + "local_address": "0.0.0.0", + "local_port": $(uci_get_by_name $1 local_port), + "password": "$(uci_get_by_name $1 password)", + "timeout": $(uci_get_by_name $1 timeout 60), + "method": "$(uci_get_by_name $1 encrypt_method_ss)", + "reuse_port": true, + "fast_open": $fastopen + } + EOF + local plugin=$(uci_get_by_name $1 plugin) + if [ -n "$plugin" ] && [ "$plugin" == "simple-obfs" ]; then + plugin="obfs-local" + fi + if [ -n "$plugin" -a -x "/usr/bin/$plugin" ]; then + sed -i "s@$hostip\",@$hostip\",\n\"plugin\": \"$plugin\",\n\"plugin_opts\": \"$(uci_get_by_name $1 plugin_opts)\",@" $config_file + fi + elif [ "$stype" == "ssr" ]; then + cat <<-EOF >$config_file + { + "server": "$hostip", + "server_port": $(uci_get_by_name $1 server_port), + "local_address": "0.0.0.0", + "local_port": $(uci_get_by_name $1 local_port), + "password": "$(uci_get_by_name $1 password)", + "timeout": $(uci_get_by_name $1 timeout 60), + "method": "$(uci_get_by_name $1 encrypt_method)", + "protocol": "$(uci_get_by_name $1 protocol)", + "protocol_param": "$(uci_get_by_name $1 protocol_param)", + "obfs": "$(uci_get_by_name $1 obfs)", + "obfs_param": "$(uci_get_by_name $1 obfs_param)", + "reuse_port": true, + "fast_open": $fastopen + } + EOF + elif [ "$stype" == "v2ray" ]; then + lua /usr/share/shadowsocksr/genv2config.lua $GLOBAL_SERVER tcp $(uci_get_by_name $1 local_port) >/var/etc/v2-ssr-retcp.json + sed -i 's/\\//g' /var/etc/v2-ssr-retcp.json + elif [ "$stype" == "trojan" ]; then + lua /usr/share/shadowsocksr/gentrojanconfig.lua $GLOBAL_SERVER nat $(uci_get_by_name $1 local_port) >/var/etc/trojan-ssr-retcp.json + sed -i 's/\\//g' /var/etc/trojan-ssr-retcp.json + fi +} + +get_arg_out() { + case "$(uci_get_by_type access_control router_proxy 1)" in + 1) echo "-o" ;; + 2) echo "-O" ;; + esac +} + +start_rules() { + local server=$(uci_get_by_name $GLOBAL_SERVER server) + #resolve name + if echo $server | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" >/dev/null; then + server=$server + elif [ "$server" != "${server#*:[0-9a-fA-F]}" ]; then + server=$server + else + server=$(ping $server -W 1 -s 1 -c 1 | grep PING | cut -d'(' -f 2 | cut -d')' -f1) + if echo $server | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" >/dev/null; then + echo $server >/etc/ssr_ip + else + server=$(cat /etc/ssr_ip) + fi + fi + kcp_server=$server + local kcp_enable=$(uci_get_by_name $GLOBAL_SERVER kcp_enable 0) + if [ $kcp_enable == "1" ]; then + kcp_flag=1 + fi + local local_port=$(uci_get_by_name $GLOBAL_SERVER local_port) + local lan_ac_ips=$(uci_get_by_type access_control lan_ac_ips) + local lan_ac_mode=$(uci_get_by_type access_control lan_ac_mode) + local router_proxy=$(uci_get_by_type access_control router_proxy) + if [ "$GLOBAL_SERVER" == "$UDP_RELAY_SERVER" -a "$kcp_flag" == "0" ]; then + ARG_UDP="-u" + elif [ -n "$UDP_RELAY_SERVER" ]; then + ARG_UDP="-U" + local udp_server=$(uci_get_by_name $UDP_RELAY_SERVER server) + local udp_local_port=$(uci_get_by_name $UDP_RELAY_SERVER local_port) + fi + if [ -n "$lan_ac_ips" ]; then + case "$lan_ac_mode" in + w | W | b | B) local ac_ips="$lan_ac_mode$lan_ac_ips" ;; + esac + fi + + #deal gfw firewall rule + local gfwmode="" + if [ "$run_mode" == "gfw" ]; then + gfwmode="-g" + elif [ "$run_mode" == "router" ]; then + gfwmode="-r" + elif [ "$run_mode" == "oversea" ]; then + gfwmode="-c" + elif [ "$run_mode" == "all" ]; then + gfwmode="-z" + fi + local dports=$(uci_get_by_type global dports 1) + if [ $dports == "1" ]; then + proxyport=" " + else + proxyport="-m multiport --dports 22,53,587,465,995,993,143,80,443" + fi + /usr/bin/ssr-rules \ + -s "$server" \ + -l "$local_port" \ + -S "$udp_server" \ + -L "$udp_local_port" \ + -a "$ac_ips" \ + -i "$(uci_get_by_type access_control wan_bp_list)" \ + -b "$(uci_get_by_type access_control wan_bp_ips)" \ + -w "$(uci_get_by_type access_control wan_fw_ips)" \ + -B "$(uci_get_by_type access_control lan_bp_ips)" \ + -p "$(uci_get_by_type access_control lan_fp_ips)" \ + -G "$(uci_get_by_type access_control lan_gm_ips)" \ + -D "$proxyport" \ + $(get_arg_out) $gfwmode $ARG_UDP + return $? +} + +start_pdnsd() { + local usr_dns="$1" + local usr_port="$2" + local tcp_dns_list="208.67.222.222, 208.67.220.220" + [ -z "$usr_dns" ] && usr_dns="8.8.8.8" + [ -z "$usr_port" ] && usr_port="53" + [ -d /var/etc ] || mkdir -p /var/etc + if [ ! -d /var/pdnsd ]; then + mkdir -p /var/pdnsd + echo -ne "pd13\000\000\000\000" >/var/pdnsd/pdnsd.cache + chown -R nobody:nogroup /var/pdnsd + fi + cat <<-EOF >/var/etc/pdnsd.conf + global{ + perm_cache=1024; + cache_dir="/var/pdnsd"; + pid_file="/var/run/pdnsd.pid"; + run_as="nobody"; + server_ip=127.0.0.1; + server_port=5335; + status_ctl=on; + query_method=tcp_only; + min_ttl=1h; + max_ttl=1w; + timeout=10; + neg_domain_pol=on; + proc_limit=2; + procq_limit=8; + par_queries=1; + } + server{ + label="ssr-usrdns"; + ip=$usr_dns; + port=$usr_port; + timeout=6; + uptest=none; + interval=10m; + purge_cache=off; + } + EOF + /usr/sbin/pdnsd -c /var/etc/pdnsd.conf -d & +} + +start_redir() { + case "$(uci_get_by_name $GLOBAL_SERVER auth_enable)" in + 1 | on | true | yes | enabled) ARG_OTA="-A" ;; + *) ARG_OTA="" ;; + esac + #deal kcp + local kcp_enable=$(uci_get_by_name $GLOBAL_SERVER kcp_enable 0) + if [ "$kcp_enable" == "1" ]; then + [ ! -f "/usr/bin/kcptun-client" ] && return 1 + local kcp_str=$(/usr/bin/kcptun-client -v | grep kcptun | wc -l) + [ "0" == "$kcp_str" ] && return 1 + local kcp_port=$(uci_get_by_name $GLOBAL_SERVER kcp_port) + local server_port=$(uci_get_by_name $GLOBAL_SERVER server_port) + local password=$(uci_get_by_name $GLOBAL_SERVER kcp_password) + local kcp_param=$(uci_get_by_name $GLOBAL_SERVER kcp_param) + [ "$password" != "" ] && password="--key "$password + service_start /usr/bin/kcptun-client \ + -r $kcp_server:$kcp_port \ + -l :$server_port $password $kcp_param + kcp_enable_flag=1 + fi + gen_config_file $GLOBAL_SERVER 0 + local stype=$(uci_get_by_name $GLOBAL_SERVER type) + if [ "$stype" == "ss" ]; then + sscmd="/usr/bin/ss-redir" + elif [ "$stype" == "ssr" ]; then + sscmd="/usr/bin/ssr-redir" + elif [ "$stype" == "v2ray" ]; then + sscmd="/usr/bin/v2ray/v2ray" + [ ! -f "$sscmd" ] && sscmd="/usr/bin/v2ray" + elif [ "$stype" == "trojan" ]; then + sscmd="/usr/sbin/trojan" + elif [ "$stype" == "socks5" ]; then + sscmd="/usr/sbin/redsocks2" + elif [ "$stype" == "tun" ]; then + sscmd="/usr/sbin/redsocks2" + fi + local utype=$(uci_get_by_name $UDP_RELAY_SERVER type) + if [ "$utype" == "ss" ]; then + ucmd="/usr/bin/ss-redir" + elif [ "$utype" == "ssr" ]; then + ucmd="/usr/bin/ssr-redir" + elif [ "$utype" == "v2ray" ]; then + ucmd="/usr/bin/v2ray/v2ray" + [ ! -f "$ucmd" ] && ucmd="/usr/bin/v2ray" + elif [ "$utype" == "trojan" ]; then + ucmd="/usr/sbin/trojan" + elif [ "$stype" == "socks5" ]; then + ucmd="/usr/sbin/redsocks2" + elif [ "$stype" == "tun" ]; then + ucmd="/usr/sbin/redsocks2" + fi + if [ "$(uci_get_by_type global threads 0)" == "0" ]; then + threads=$(cat /proc/cpuinfo | grep 'processor' | wc -l) + else + threads=$(uci_get_by_type global threads) + fi + redir_tcp=1 + if [ "$stype" == "ss" -o "$stype" == "ssr" ]; then + local last_config_file=$CONFIG_FILE + local pid_file="/var/run/ssr-retcp.pid" + for i in $(seq 1 $threads); do + $sscmd -c $CONFIG_FILE $ARG_OTA -f /var/run/ssr-retcp_$i.pid >/dev/null 2>&1 + done + echo "$(date "+%Y-%m-%d %H:%M:%S") Shadowsocks/ShadowsocksR $threads Threads Started!" >>/tmp/ssrplus.log + elif [ "$stype" == "v2ray" ]; then + $sscmd -config /var/etc/v2-ssr-retcp.json >/dev/null 2>&1 & + echo "$(date "+%Y-%m-%d %H:%M:%S") $($sscmd -version | head -1) Started!" >>/tmp/ssrplus.log + elif [ "$stype" == "trojan" ]; then + for i in $(seq 1 $threads); do + $sscmd --config /var/etc/trojan-ssr-retcp.json >/dev/null 2>&1 & + done + echo "$(date "+%Y-%m-%d %H:%M:%S") $($sscmd --version 2>&1 | head -1) , $threads Threads Started!" >>/tmp/ssrplus.log + elif [ "$stype" == "socks5" ]; then + /usr/share/shadowsocksr/genred2config.sh "/var/etc/redsocks-ssr-retcp.conf" socks5 tcp $(uci_get_by_name $GLOBAL_SERVER local_port) $(uci_get_by_name $GLOBAL_SERVER server) $(uci_get_by_name $GLOBAL_SERVER server_port) \ + $(uci_get_by_name $GLOBAL_SERVER auth_enable 0) $(uci_get_by_name $GLOBAL_SERVER username) $(uci_get_by_name $GLOBAL_SERVER password) + for i in $(seq 1 $threads); do + $sscmd -c /var/etc/redsocks-ssr-retcp.conf >/dev/null 2>&1 + done + echo "$(date "+%Y-%m-%d %H:%M:%S") Socks5 REDIRECT/TPROXY $threads Threads Started!" >>/tmp/ssrplus.log + elif [ "$stype" == "tun" ]; then + /usr/share/shadowsocksr/genred2config.sh "/var/etc/redsocks-ssr-retcp.conf" vpn $(uci_get_by_name $GLOBAL_SERVER iface "br-lan") $(uci_get_by_name $GLOBAL_SERVER local_port) + for i in $(seq 1 $threads); do + $sscmd -c /var/etc/redsocks-ssr-retcp.conf >/dev/null 2>&1 + done + echo "$(date "+%Y-%m-%d %H:%M:%S") Network Tunnel REDIRECT $threads Threads Started!" >>/tmp/ssrplus.log + fi + if [ -n "$UDP_RELAY_SERVER" ]; then + redir_udp=1 + if [ "$utype" == "ss" -o "$utype" == "ssr" ]; then + case "$(uci_get_by_name $UDP_RELAY_SERVER auth_enable)" in + 1 | on | true | yes | enabled) ARG_OTA="-A" ;; + *) ARG_OTA="" ;; + esac + gen_config_file $UDP_RELAY_SERVER 1 + last_config_file=$CONFIG_UDP_FILE + pid_file="/var/run/ssr-reudp.pid" + $ucmd -c $last_config_file $ARG_OTA -U -f /var/run/ssr-reudp.pid >/dev/null 2>&1 + elif [ "$utype" == "v2ray" ]; then + lua /usr/share/shadowsocksr/genv2config.lua $UDP_RELAY_SERVER udp $(uci_get_by_name $UDP_RELAY_SERVER local_port) >/var/etc/v2-ssr-reudp.json + sed -i 's/\\//g' /var/etc/v2-ssr-reudp.json + $ucmd -config /var/etc/v2-ssr-reudp.json >/dev/null 2>&1 & + elif [ "$stype" == "trojan" ]; then + lua /usr/share/shadowsocksr/gentrojanconfig.lua $GLOBAL_SERVER client 10801 >/var/etc/trojan-ssr-reudp.json + sed -i 's/\\//g' /var/etc/trojan-ssr-reudp.json + $ucmd --config /var/etc/trojan-ssr-reudp.json >/dev/null 2>&1 & + ipt2socks -U -b 0.0.0.0 -4 -s 127.0.0.1 -p 10801 -l $(uci_get_by_name $UDP_RELAY_SERVER local_port) >/dev/null 2>&1 & + elif [ "$utype" == "socks5" ]; then + /usr/share/shadowsocksr/genred2config.sh "/var/etc/redsocks-ssr-reudp.conf" socks5 udp $(uci_get_by_name $UDP_RELAY_SERVER local_port) $(uci_get_by_name $UDP_RELAY_SERVER server) $(uci_get_by_name $UDP_RELAY_SERVER server_port) \ + $(uci_get_by_name $UDP_RELAY_SERVER auth_enable 0) $(uci_get_by_name $UDP_RELAY_SERVER username) $(uci_get_by_name $UDP_RELAY_SERVER password) + $ucmd -c /var/etc/redsocks-ssr-reudp.conf >/dev/null 2>&1 + elif [ "$stype" == "tun" ]; then + redir_udp=0 + echo "$(date "+%Y-%m-%d %H:%M:%S") Network Tunnel UDP TPROXY Relay not supported!" >>/tmp/ssrplus.log + fi + fi + #deal with dns + local ssr_dns="$(uci_get_by_type global pdnsd_enable 0)" + local dnsstr="$(uci_get_by_type global tunnel_forward 8.8.4.4:53)" + local dnsserver=$(echo "$dnsstr" | awk -F ':' '{print $1}') + local dnsport=$(echo "$dnsstr" | awk -F ':' '{print $2}') + if [ "$ssr_dns" == "1" ]; then + if [ "$run_mode" == "gfw" ]; then + ipset add gfwlist $dnsserver 2>/dev/null + elif [ "$run_mode" == "oversea" ]; then + ipset add oversea $dnsserver 2>/dev/null + else + ipset add ss_spec_wan_ac $dnsserver nomatch 2>/dev/null + fi + start_pdnsd $dnsserver $dnsport + pdnsd_enable_flag=1 + elif [ "$ssr_dns" == "2" ]; then + microsocks -i 127.0.0.1 -p 10802 ssr-dns >/dev/null 2>&1 & + dns2socks 127.0.0.1:10802 $dnsserver:$dnsport 127.0.0.1:5335 -q >/dev/null 2>&1 & + pdnsd_enable_flag=2 + fi + if [ "$(uci_get_by_type global enable_switch)" == "1" ]; then + if [ "$(uci_get_by_name $GLOBAL_SERVER switch_enable 1)" == "1" ]; then + if [ -z "$switch_server" ]; then + local switch_time=$(uci_get_by_type global switch_time) + local switch_timeout=$(uci_get_by_type global switch_timeout) + service_start /usr/bin/ssr-switch start $switch_time $switch_timeout + switch_enable=1 + fi + fi + fi + add_cron + return $? +} + +gen_service_file() { + if [ $(uci_get_by_name $1 fast_open) == "1" ]; then + fastopen="true" + else + fastopen="false" + fi + cat <<-EOF >$2 + { + "server": "0.0.0.0", + "server_port": $(uci_get_by_name $1 server_port), + "password": "$(uci_get_by_name $1 password)", + "timeout": $(uci_get_by_name $1 timeout 60), + "method": "$(uci_get_by_name $1 encrypt_method)", + "protocol": "$(uci_get_by_name $1 protocol)", + "protocol_param": "$(uci_get_by_name $1 protocol_param)", + "obfs": "$(uci_get_by_name $1 obfs)", + "obfs_param": "$(uci_get_by_name $1 obfs_param)", + "fast_open": $fastopen + } + EOF +} + +start_service() { + [ $(uci_get_by_name $1 enable 0) == "0" ] && return 1 + let server_count=server_count+1 + if [ "$server_count" == "1" ]; then + if ! (iptables-save -t filter | grep SSR-SERVER-RULE >/dev/null); then + iptables -N SSR-SERVER-RULE && \ + iptables -t filter -I INPUT -j SSR-SERVER-RULE + fi + fi + gen_service_file $1 /var/etc/${NAME}_$server_count.json + /usr/bin/ssr-server -c /var/etc/${NAME}_$server_count.json -u -f /var/run/ssr-server$server_count.pid >/dev/null 2>&1 + iptables -t filter -A SSR-SERVER-RULE -p tcp --dport $(uci_get_by_name $1 server_port) -j ACCEPT + iptables -t filter -A SSR-SERVER-RULE -p udp --dport $(uci_get_by_name $1 server_port) -j ACCEPT + return 0 +} + +gen_serv_include() { + FWI=$(uci get firewall.shadowsocksr.path 2>/dev/null) + [ -n "$FWI" ] || return 0 + if [ ! -f $FWI ]; then + echo '#!/bin/sh' >$FWI + fi + extract_rules() { + echo "*filter" + iptables-save -t filter | grep SSR-SERVER-RULE | sed -e "s/^-A INPUT/-I INPUT/" + echo 'COMMIT' + } + cat <<-EOF >>$FWI + iptables-save -c | grep -v "SSR-SERVER" | iptables-restore -c + iptables-restore -n <<-EOT + $(extract_rules) + EOT + EOF +} + +start_server() { + SERVER_ENABLE=$(uci_get_by_type server_global enable_server 0) + [ "$SERVER_ENABLE" == "0" ] && return 0 + mkdir -p /var/run /var/etc + config_load $NAME + config_foreach start_service server_config + gen_serv_include + return 0 +} + +start_local() { + local local_server=$(uci_get_by_type socks5_proxy socks 0) + [ "$local_server" == "0" ] && return 0 + local auth_enable=$(uci_get_by_type socks5_proxy auth_enable 0) + local socks_port=$(uci_get_by_type socks5_proxy local_port 1080) + if [ "$auth_enable" == "1" ]; then + microsocks -i :: -p $socks_port -1 -u $(uci_get_by_type socks5_proxy username) -P $(uci_get_by_type socks5_proxy password) ssr-socks >/dev/null 2>&1 & + else + microsocks -i :: -p $socks_port ssr-socks >/dev/null 2>&1 & + fi + local_enable=1 + if [ "$(uci_get_by_type socks5_proxy wan_enable 0)" == "1" ]; then + if ! (iptables-save -t filter | grep SSR-SERVER-RULE >/dev/null); then + iptables -N SSR-SERVER-RULE && \ + iptables -t filter -I INPUT -j SSR-SERVER-RULE + fi + iptables -t filter -A SSR-SERVER-RULE -p tcp --dport $socks_port -j ACCEPT + iptables -t filter -A SSR-SERVER-RULE -p udp --dport $socks_port -j ACCEPT + gen_serv_include + fi +} + +rules() { + [ "$GLOBAL_SERVER" == "nil" ] && return 1 + mkdir -p /var/run /var/etc + UDP_RELAY_SERVER=$(uci_get_by_type global udp_relay_server) + [ "$UDP_RELAY_SERVER" == "same" ] && UDP_RELAY_SERVER=$GLOBAL_SERVER + if start_rules; then + return 0 + else + return 1 + fi +} + +start() { + if [ -z "$switch_server" ]; then + GLOBAL_SERVER=$(uci_get_by_type global global_server) + else + GLOBAL_SERVER=$switch_server + switch_enable=1 + fi + if rules; then + start_redir + mkdir -p /tmp/dnsmasq.d && cp -a /etc/dnsmasq.ssr /tmp/ && cp -a /etc/dnsmasq.oversea /tmp/ + if ! [ "$run_mode" == "oversea" ]; then + cat <<-EOF >/tmp/dnsmasq.d/dnsmasq-ssr.conf + conf-dir=/tmp/dnsmasq.ssr + EOF + else + cat <<-EOF >/tmp/dnsmasq.d/dnsmasq-ssr.conf + conf-dir=/tmp/dnsmasq.oversea + EOF + fi + if [ $(uci_get_by_type global adblock 0) == "0" ]; then + rm -f /tmp/dnsmasq.ssr/ad.conf + fi + /usr/share/shadowsocksr/gfw2ipset.sh + /etc/init.d/dnsmasq restart >/dev/null 2>&1 + fi + start_server + start_local + if [ $(uci_get_by_type global monitor_enable 0) == "1" ]; then + let total_count=server_count+redir_tcp+redir_udp+tunnel_enable+kcp_enable_flag+local_enable+pdnsd_enable_flag+switch_enable + if [ $total_count -gt 0 ]; then + #param:server(count) redir_tcp(0:no,1:yes) redir_udp tunnel kcp local gfw + service_start /usr/bin/ssr-monitor $server_count $redir_tcp $redir_udp $tunnel_enable $kcp_enable_flag $local_enable $pdnsd_enable_flag $switch_enable + fi + fi + ENABLE_SERVER=$(uci_get_by_type global global_server nil) + [ "$ENABLE_SERVER" == "nil" ] && return 1 +} + +boot() { + (/usr/share/shadowsocksr/chinaipset.sh && sleep 3 && start >/dev/null 2>&1) & +} + +stop() { + /usr/bin/ssr-rules -f + srulecount=$(iptables -L | grep SSR-SERVER-RULE | wc -l) + if [ $srulecount -gt 0 ]; then + iptables -F SSR-SERVER-RULE + iptables -t filter -D INPUT -j SSR-SERVER-RULE + iptables -X SSR-SERVER-RULE 2>/dev/null + fi + if [ -z "$switch_server" ]; then + kill -9 $(busybox ps -w | grep ssr-switch | grep -v grep | awk '{print $1}') >/dev/null 2>&1 + fi + if [ $(uci_get_by_type global monitor_enable 0) == "1" ]; then + kill -9 $(busybox ps -w | grep ssr-monitor | grep -v grep | awk '{print $1}') >/dev/null 2>&1 + fi + killall -q -9 ssr-monitor + killall -q -9 ss-redir + killall -q -9 obfs-local + killall -q -9 v2ray-plugin + killall -q -9 ssr-redir + killall -q -9 v2ray + killall -q -9 trojan + killall -q -9 ipt2socks + killall -q -9 ssr-server + killall -q -9 kcptun-client + killall -q -9 dns2socks + killall -q -9 microsocks + killall -q -9 redsocks2 + if [ -f /var/run/pdnsd.pid ]; then + kill $(cat /var/run/pdnsd.pid) >/dev/null 2>&1 + else + kill -9 $(busybox ps -w | grep pdnsd | grep -v grep | awk '{print $1}') >/dev/null 2>&1 + fi + if [ -f "/tmp/dnsmasq.d/dnsmasq-ssr.conf" ]; then + rm -f /tmp/dnsmasq.d/dnsmasq-ssr.conf + /etc/init.d/dnsmasq restart >/dev/null 2>&1 + fi + del_cron +} diff --git a/package/lean/luci-app-ssr-plus/root/etc/uci-defaults/luci-ssr-plus b/package/lean/luci-app-ssr-plus/root/etc/uci-defaults/luci-ssr-plus new file mode 100644 index 00000000000000..d4a3835695ad8f --- /dev/null +++ b/package/lean/luci-app-ssr-plus/root/etc/uci-defaults/luci-ssr-plus @@ -0,0 +1,19 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@shadowsocksr[-1] + add ucitrack shadowsocksr + set ucitrack.@shadowsocksr[-1].init=shadowsocksr + commit ucitrack + delete firewall.shadowsocksr + set firewall.shadowsocksr=include + set firewall.shadowsocksr.type=script + set firewall.shadowsocksr.path=/var/etc/shadowsocksr.include + set firewall.shadowsocksr.reload=1 + commit firewall +EOF + +killall -q -9 ssr-monitor ss-redir ssr-redir v2ray trojan ipt2socks ssr-server kcptun-client srelay +/usr/share/shadowsocksr/gfw2ipset.sh +rm -f /tmp/luci-indexcache +exit 0 diff --git a/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-ad b/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-ad new file mode 100644 index 00000000000000..2c7ffef057ac21 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-ad @@ -0,0 +1,9 @@ +#!/bin/sh -e +if [ -f /tmp/adnew.conf ]; then + if (grep -wq "address=" /tmp/adnew.conf) ; then + cp /tmp/adnew.conf /tmp/ad.conf + else + cat /tmp/adnew.conf | grep ^\|\|[^\*]*\^$ | sed -e 's:||:address\=\/:' -e 's:\^:/0\.0\.0\.0:' > /tmp/ad.conf + fi +fi +rm -f /tmp/adnew.conf diff --git a/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-gfw b/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-gfw new file mode 100644 index 00000000000000..07ee49c45887b2 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-gfw @@ -0,0 +1,25 @@ +#!/bin/sh -e + +generate_china_banned() { + cat $1 | base64 -d >/tmp/gfwlist.txt + rm -f $1 + sed -i '/^@@|/d' /tmp/gfwlist.txt + cat /tmp/gfwlist.txt | sort -u | + sed 's#!.\+##; s#|##g; s#@##g; s#http:\/\/##; s#https:\/\/##;' | + sed '/\*/d; /apple\.com/d; /sina\.cn/d; /sina\.com\.cn/d; /baidu\.com/d; /byr\.cn/d; /jlike\.com/d; /weibo\.com/d; /zhongsou\.com/d; /youdao\.com/d; /sogou\.com/d; /so\.com/d; /soso\.com/d; /aliyun\.com/d; /taobao\.com/d; /jd\.com/d; /qq\.com/d' | + sed '/^[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+$/d' | + grep '^[0-9a-zA-Z\.-]\+$' | grep '\.' | sed 's#^\.\+##' | sort -u | + awk 'BEGIN { prev = "________"; } { + cur = $0; + if (index(cur, prev) == 1 && substr(cur, 1 + length(prev) ,1) == ".") { + } else { + print cur; + prev = cur; + } + }' | sort -u +} + +generate_china_banned /tmp/gfw.b64 >/tmp/gfw.txt +rm -f /tmp/gfwlist.txt +sed '/.*/s/.*/server=\/\.&\/127.0.0.1#5335\nipset=\/\.&\/gfwlist/' /tmp/gfw.txt >/tmp/gfwnew.txt +rm -f /tmp/gfw.txt diff --git a/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-monitor b/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-monitor new file mode 100644 index 00000000000000..d4b58129350d2d --- /dev/null +++ b/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-monitor @@ -0,0 +1,139 @@ +#!/bin/sh +# +# Copyright (C) 2017 openwrt-ssr +# Copyright (C) 2017 yushi studio +# +# This is free software, licensed under the GNU General Public License v3. +# See /LICENSE for more information. +# + +NAME=shadowsocksr + +uci_get_by_name() { + local ret=$(uci get $NAME.$1.$2 2>/dev/null) + echo ${ret:=$3} +} + +uci_get_by_type() { + local ret=$(uci get $NAME.@$1[0].$2 2>/dev/null) + echo ${ret:=$3} +} + +server_process_count=$1 +redir_tcp_process=$2 +redir_udp_process=$3 +tunnel_process=$4 +kcp_process=$5 +local_process=$6 +pdnsd_process=$7 +if [ -z "$pdnsd_process" ]; then + pdnsd_process=0 +fi + +i=0 + +GLOBAL_SERVER=$(uci_get_by_type global global_server) +server=$(uci_get_by_name $GLOBAL_SERVER server) +lkcp_port=$(uci_get_by_name $GLOBAL_SERVER kcp_port) +server_port=$(uci_get_by_name $GLOBAL_SERVER server_port) +password=$(uci_get_by_name $GLOBAL_SERVER kcp_password) +kcp_param=$(uci_get_by_name $GLOBAL_SERVER kcp_param) +[ "$password" != "" ] && password="--key "${password} + +if echo "$server" | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" >/dev/null; then + server=${server} +else + server=$(cat /etc/ssr_ip) +fi + +while [ "1" == "1" ]; do #死循环 + sleep 30 + #redir tcp + if [ "$redir_tcp_process" -gt 0 ]; then + icount=$(busybox ps -w | grep ssr-retcp | grep -v grep | wc -l) + if [ "$icount" == 0 ]; then + logger -t "$NAME" "ssr redir tcp error.restart!" + /etc/init.d/shadowsocksr restart + exit 0 + fi + fi + #redir udp + if [ "$redir_udp_process" -gt 0 ]; then + icount=$(busybox ps -w | grep ssr-reudp | grep -v grep | wc -l) + if [ "$icount" == 0 ]; then + logger -t "$NAME" "ssr redir udp error.restart!" + /etc/init.d/shadowsocksr restart + exit 0 + fi + fi + #tunnel + if [ "$tunnel_process" -gt 0 ]; then + icount=$(busybox ps -w | grep ssr-tunnel | grep -v grep | wc -l) + if [ "$icount" == 0 ]; then + logger -t "$NAME" "ssr tunnel error.restart!" + /etc/init.d/shadowsocksr restart + exit 0 + fi + fi + #server + if [ "$server_process_count" -gt 0 ]; then + icount=$(busybox ps -w | grep ssr-server | grep -v grep | wc -l) + if [ "$icount" -lt "$server_process_count" ]; then #如果进程挂掉就重启它 + logger -t "$NAME" "ssr server error.restart!" + killall -q -9 ssr-server + for i in $(seq $server_process_count); do + /usr/bin/ssr-server -c /var/etc/shadowsocksr_$i.json -u -f /var/run/ssr-server$i.pid + done + fi + fi + #kcptun + if [ "$kcp_process" -gt 0 ]; then + icount=$(busybox ps -w | grep kcptun-client | grep -v grep | wc -l) + if [ "$icount" -lt "$kcp_process" ]; then #如果进程挂掉就重启它 + logger -t "$NAME" "ssr kcptun error.restart!" + killall -q -9 kcptun-client + (/usr/bin/kcptun-client -r $server:$kcp_port -l :$server_port $password $kcp_param &) + fi + fi + #localsocks + if [ "$local_process" -gt 0 ]; then + icount=$(busybox ps -w | grep ssr-socks | grep -v grep | wc -l) + if [ "$icount" -lt "$local_process" ]; then #如果进程挂掉就重启它 + logger -t "$NAME" "microsocks error.restart!" + kill -9 $(busybox ps -w | grep ssr-socks | grep -v grep | awk '{print $1}') >/dev/null 2>&1 + auth_enable=$(uci_get_by_type socks5_proxy auth_enable 0) + if [ "$auth_enable" == "1" ]; then + microsocks -i 0.0.0.0 -p $(uci_get_by_type socks5_proxy local_port 1080) -1 -u $(uci_get_by_type socks5_proxy username) -P $(uci_get_by_type socks5_proxy password) ssr-socks >/dev/null 2>&1 & + else + microsocks -i 0.0.0.0 -p $(uci_get_by_type socks5_proxy local_port 1080) ssr-socks >/dev/null 2>&1 & + fi + fi + fi + #pdnsd + if [ "$pdnsd_process" -eq 1 ]; then + icount=$(busybox ps -w | grep pdnsd | grep -v grep | wc -l) + if [ "$icount" -lt "$pdnsd_process" ]; then #如果进程挂掉就重启它 + logger -t "$NAME" "pdnsd tunnel error.restart!" + if [ -f /var/run/pdnsd.pid ]; then + kill $(cat /var/run/pdnsd.pid) >/dev/null 2>&1 + else + kill -9 $(ps | grep pdnsd | grep -v grep | awk '{print $1}') >/dev/null 2>&1 + fi + (/usr/sbin/pdnsd -c /var/etc/pdnsd.conf -d &) + fi + fi + #dns2socks + if [ "$pdnsd_process" -eq 2 ]; then + icount=$(busybox ps -w | grep -e ssr-dns -e dns2socks | grep -v grep | wc -l) + if [ "$icount" -lt 2 ]; then #如果进程挂掉就重启它 + logger -t "$NAME" "dns2socks $dnsstr tunnel error.restart!" + dnsstr=$(uci_get_by_type global tunnel_forward 8.8.4.4:53) + dnsserver=$(echo "$dnsstr" | awk -F ':' '{print $1}') + dnsport=$(echo "$dnsstr" | awk -F ':' '{print $2}') + killall -q -9 dns2socks + kill -9 $(busybox ps -w | grep ssr-dns | grep -v grep | awk '{print $1}') >/dev/null 2>&1 + microsocks -i 127.0.0.1 -p 10802 ssr-dns >/dev/null 2>&1 & + dns2socks 127.0.0.1:10802 $dnsserver:$dnsport 127.0.0.1:5335 -q >/dev/null 2>&1 & + fi + fi +done diff --git a/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-rules b/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-rules new file mode 100644 index 00000000000000..140da4ce60091b --- /dev/null +++ b/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-rules @@ -0,0 +1,378 @@ +#!/bin/sh +# +# Copyright (C) 2017 openwrt-ssr +# Copyright (C) 2017 yushi studio +# +# This is free software, licensed under the GNU General Public License v3. +# See /LICENSE for more information. +# + +TAG="_SS_SPEC_RULE_" # comment tag +IPT="iptables -t nat" # alias of iptables +FWI=$(uci get firewall.shadowsocksr.path 2>/dev/null) # firewall include file + +usage() { + cat <<-EOF +Usage: ssr-rules [options] + +Valid options are: + + -s ip address of shadowsocksr remote server + -l port number of shadowsocksr local server + -S ip address of shadowsocksr remote UDP server + -L port number of shadowsocksr local UDP server + -i a file content is bypassed ip list + -a lan ip of access control, need a prefix to + define access control mode + -b wan ip of will be bypassed + -w wan ip of will be forwarded + -B lan ip of will be bypassed proxy + -p lan ip of will be global proxy + -G lan ip of will be game mode proxy + -D proxy ports + -e extra options for iptables + -o apply the rules to the OUTPUT chain + -O apply the global rules to the OUTPUT chain + -u enable udprelay mode, TPROXY is required + -U enable udprelay mode, using different IP + and ports for TCP and UDP + -f flush the rules + -g gfw list mode + -r return china mode + -h show this help message and exit + EOF + exit $1 +} + +loger() { + # 1.alert 2.crit 3.err 4.warn 5.notice 6.info 7.debug + logger -st ssr-rules[$$] -p$1 $2 +} + +flush_r() { + flush_iptables() { + local ipt="iptables -t $1" + local DAT=$(iptables-save -t $1) + eval $(echo "$DAT" | grep "$TAG" | sed -e 's/^-A/$ipt -D/' -e 's/$/;/') + for chain in $(echo "$DAT" | awk '/^:SS_SPEC/{print $1}'); do + $ipt -F ${chain:1} 2>/dev/null && $ipt -X ${chain:1} + done + } + flush_iptables nat + flush_iptables mangle + ip rule del fwmark 0x01/0x01 table 100 2>/dev/null + ip route del local 0.0.0.0/0 dev lo table 100 2>/dev/null + ipset -X ss_spec_lan_ac 2>/dev/null + ipset -X ss_spec_wan_ac 2>/dev/null + ipset -X ssr_gen_router 2>/dev/null + ipset -X fplan 2>/dev/null + ipset -X bplan 2>/dev/null + ipset -X gmlan 2>/dev/null + ipset -X oversea 2>/dev/null + ipset -X whitelist 2>/dev/null + ipset -X blacklist 2>/dev/null + [ -n "$FWI" ] && echo '#!/bin/sh' >$FWI + return 0 +} + +ipset_r() { + ipset -N gmlan hash:net 2>/dev/null + for ip in $LAN_GM_IP; do ipset -! add gmlan $ip; done + if [ "$RUNMODE" == "router" ]; then + ipset -! -R <<-EOF || return 1 + create ss_spec_wan_ac hash:net + $(gen_iplist | sed -e "s/^/add ss_spec_wan_ac /") + EOF + ipset -N gfwlist hash:net 2>/dev/null + $IPT -N SS_SPEC_WAN_AC + $IPT -I SS_SPEC_WAN_AC -p tcp ! --dport 53 -d $server -j RETURN + $IPT -A SS_SPEC_WAN_AC -m set --match-set ss_spec_wan_ac dst -j RETURN + $IPT -A SS_SPEC_WAN_AC -j SS_SPEC_WAN_FW + elif [ "$RUNMODE" == "gfw" ]; then + ipset -N gfwlist hash:net 2>/dev/null + $IPT -N SS_SPEC_WAN_AC + $IPT -A SS_SPEC_WAN_AC -m set --match-set gfwlist dst -j SS_SPEC_WAN_FW + $IPT -A SS_SPEC_WAN_AC -m set --match-set gmlan src -m set ! --match-set china dst -j SS_SPEC_WAN_FW + $IPT -A SS_SPEC_WAN_AC -m set --match-set china dst -j RETURN + $IPT -I SS_SPEC_WAN_AC -p tcp ! --dport 53 -d $server -j RETURN + elif [ "$RUNMODE" == "oversea" ]; then + ipset -N oversea hash:net 2>/dev/null + $IPT -N SS_SPEC_WAN_AC + ipset -N gmlan hash:net 2>/dev/null + for ip in $LAN_GM_IP; do ipset -! add gmlan $ip; done + $IPT -A SS_SPEC_WAN_AC -m set --match-set china dst -j SS_SPEC_WAN_FW + $IPT -I SS_SPEC_WAN_AC -p tcp ! --dport 53 -d $server -j RETURN + elif [ "$RUNMODE" == "all" ]; then + $IPT -N SS_SPEC_WAN_AC + $IPT -A SS_SPEC_WAN_AC -j SS_SPEC_WAN_FW + $IPT -I SS_SPEC_WAN_AC -p tcp ! --dport 53 -d $server -j RETURN + fi + ipset -N fplan hash:net 2>/dev/null + for ip in $LAN_FP_IP; do ipset -! add fplan $ip; done + $IPT -I SS_SPEC_WAN_AC -m set --match-set fplan src -j SS_SPEC_WAN_FW + ipset -N bplan hash:net 2>/dev/null + for ip in $LAN_BP_IP; do ipset -! add bplan $ip; done + $IPT -I SS_SPEC_WAN_AC -m set --match-set bplan src -j RETURN + ipset -N whitelist hash:net 2>/dev/null + ipset -N blacklist hash:net 2>/dev/null + $IPT -I SS_SPEC_WAN_AC -m set --match-set blacklist dst -j SS_SPEC_WAN_FW + $IPT -I SS_SPEC_WAN_AC -m set --match-set whitelist dst -j RETURN + for ip in $WAN_BP_IP; do ipset -! add whitelist $ip; done + for ip in $WAN_FW_IP; do ipset -! add blacklist $ip; done + return $? +} + +fw_rule() { + $IPT -N SS_SPEC_WAN_FW + $IPT -A SS_SPEC_WAN_FW -d 0.0.0.0/8 -j RETURN + $IPT -A SS_SPEC_WAN_FW -d 10.0.0.0/8 -j RETURN + $IPT -A SS_SPEC_WAN_FW -d 127.0.0.0/8 -j RETURN + $IPT -A SS_SPEC_WAN_FW -d 169.254.0.0/16 -j RETURN + $IPT -A SS_SPEC_WAN_FW -d 172.16.0.0/12 -j RETURN + $IPT -A SS_SPEC_WAN_FW -d 192.168.0.0/16 -j RETURN + $IPT -A SS_SPEC_WAN_FW -d 224.0.0.0/4 -j RETURN + $IPT -A SS_SPEC_WAN_FW -d 240.0.0.0/4 -j RETURN + $IPT -A SS_SPEC_WAN_FW -p tcp $PROXY_PORTS \ + -j REDIRECT --to-ports $local_port 2>/dev/null || { + loger 3 "Can't redirect, please check the iptables." + exit 1 + } + return $? +} + +ac_rule() { + if [ -n "$LAN_AC_IP" ]; then + case "${LAN_AC_IP:0:1}" in + w | W) + MATCH_SET="-m set --match-set ss_spec_lan_ac src" + ;; + b | B) + MATCH_SET="-m set ! --match-set ss_spec_lan_ac src" + ;; + *) + loger 3 "Bad argument \`-a $LAN_AC_IP\`." + return 2 + ;; + esac + fi + IFNAME=$(uci get -P/var/state network.lan.ifname 2>/dev/null) + ipset -! -R <<-EOF || return 1 + create ss_spec_lan_ac hash:net + $(for ip in ${LAN_AC_IP:1}; do echo "add ss_spec_lan_ac $ip"; done) + EOF + $IPT -I PREROUTING 1 ${IFNAME:+-i $IFNAME} -p tcp $EXT_ARGS $MATCH_SET \ + -m comment --comment "$TAG" -j SS_SPEC_WAN_AC + if [ "$OUTPUT" = 1 ]; then + $IPT -I OUTPUT 1 -p tcp $EXT_ARGS \ + -m comment --comment "$TAG" -j SS_SPEC_WAN_AC + elif [ "$OUTPUT" = 2 ]; then + ipset -! -R <<-EOF || return 1 + create ssr_gen_router hash:net + $(gen_spec_iplist | sed -e "s/^/add ssr_gen_router /") + EOF + $IPT -N SS_SPEC_ROUTER && \ + $IPT -A SS_SPEC_ROUTER -m set --match-set ssr_gen_router dst -j RETURN && \ + $IPT -A SS_SPEC_ROUTER -j SS_SPEC_WAN_FW + $IPT -I OUTPUT 1 -p tcp -m comment --comment "$TAG" -j SS_SPEC_ROUTER + fi + return $? +} + +tp_rule() { + [ -n "$TPROXY" ] || return 0 + ip rule add fwmark 0x01/0x01 table 100 + ip route add local 0.0.0.0/0 dev lo table 100 + local ipt="iptables -t mangle" + $ipt -N SS_SPEC_TPROXY + $ipt -A SS_SPEC_TPROXY -p udp --dport 443 -j DROP + $ipt -A SS_SPEC_TPROXY -p udp --dport 53 -j RETURN + $ipt -A SS_SPEC_TPROXY -p udp -d 0.0.0.0/8 -j RETURN + $ipt -A SS_SPEC_TPROXY -p udp -d 10.0.0.0/8 -j RETURN + $ipt -A SS_SPEC_TPROXY -p udp -d 127.0.0.0/8 -j RETURN + $ipt -A SS_SPEC_TPROXY -p udp -d 169.254.0.0/16 -j RETURN + $ipt -A SS_SPEC_TPROXY -p udp -d 172.16.0.0/12 -j RETURN + $ipt -A SS_SPEC_TPROXY -p udp -d 192.168.0.0/16 -j RETURN + $ipt -A SS_SPEC_TPROXY -p udp -d 224.0.0.0/4 -j RETURN + $ipt -A SS_SPEC_TPROXY -p udp -d 240.0.0.0/4 -j RETURN + $ipt -A SS_SPEC_TPROXY -p udp ! --dport 53 -d $server -j RETURN + $ipt -A SS_SPEC_TPROXY -p udp -m set --match-set bplan src -j RETURN + $ipt -A SS_SPEC_TPROXY -p udp $PROXY_PORTS -m set --match-set fplan src \ + -j TPROXY --on-port "$LOCAL_PORT" --tproxy-mark 0x01/0x01 + if [ "$RUNMODE" == "router" ]; then + $ipt -A SS_SPEC_TPROXY -p udp -m set --match-set gmlan src -m set ! --match-set china dst \ + -j TPROXY --on-port "$LOCAL_PORT" --tproxy-mark 0x01/0x01 + $ipt -A SS_SPEC_TPROXY -p udp $PROXY_PORTS -m set ! --match-set ss_spec_wan_ac dst \ + -j TPROXY --on-port "$LOCAL_PORT" --tproxy-mark 0x01/0x01 + elif [ "$RUNMODE" == "gfw" ]; then + $ipt -A SS_SPEC_TPROXY -p udp -m set --match-set china dst -j RETURN + $ipt -A SS_SPEC_TPROXY -p udp -m set --match-set gmlan src -m set ! --match-set china dst \ + -j TPROXY --on-port "$LOCAL_PORT" --tproxy-mark 0x01/0x01 + $ipt -A SS_SPEC_TPROXY -p udp -m set $PROXY_PORTS --match-set gfwlist dst \ + -j TPROXY --on-port "$LOCAL_PORT" --tproxy-mark 0x01/0x01 + elif [ "$RUNMODE" == "oversea" ]; then + $ipt -A SS_SPEC_TPROXY -p udp $PROXY_PORTS -m set --match-set china dst \ + -j TPROXY --on-port "$LOCAL_PORT" --tproxy-mark 0x01/0x01 + elif [ "$RUNMODE" == "all" ]; then + $ipt -A SS_SPEC_TPROXY -p udp $PROXY_PORTS -j TPROXY --on-port "$LOCAL_PORT" --tproxy-mark 0x01/0x01 + fi + $ipt -I PREROUTING 1 ${IFNAME:+-i $IFNAME} -p udp $EXT_ARGS $MATCH_SET \ + -m comment --comment "$TAG" -j SS_SPEC_TPROXY + return $? +} + +get_wan_ip() { + cat <<-EOF | grep -E "^([0-9]{1,3}\.){3}[0-9]{1,3}" + $server + $SERVER + $WAN_BP_IP + EOF +} + +gen_iplist() { + cat <<-EOF + 0.0.0.0/8 + 10.0.0.0/8 + 100.64.0.0/10 + 127.0.0.0/8 + 169.254.0.0/16 + 172.16.0.0/12 + 192.0.0.0/24 + 192.0.2.0/24 + 192.88.99.0/24 + 192.168.0.0/16 + 198.18.0.0/15 + 198.51.100.0/24 + 203.0.113.0/24 + 224.0.0.0/4 + 240.0.0.0/4 + 255.255.255.255 + $(get_wan_ip) + $(cat ${IGNORE_LIST:=/dev/null} 2>/dev/null) + EOF +} + +gen_spec_iplist() { + cat <<-EOF + 0.0.0.0/8 + 10.0.0.0/8 + 100.64.0.0/10 + 127.0.0.0/8 + 169.254.0.0/16 + 172.16.0.0/12 + 192.0.0.0/24 + 192.0.2.0/24 + 192.88.99.0/24 + 192.168.0.0/16 + 198.18.0.0/15 + 198.51.100.0/24 + 203.0.113.0/24 + 224.0.0.0/4 + 240.0.0.0/4 + 255.255.255.255 + $(get_wan_ip) + EOF +} + +gen_include() { + [ -n "$FWI" ] || return 0 + extract_rules() { + echo "*$1" + iptables-save -t $1 | grep SS_SPEC_ | \ + sed -e "s/^-A \(OUTPUT\|PREROUTING\)/-I \1 1/" + echo 'COMMIT' + } + cat <<-EOF >>$FWI + iptables-save -c | grep -v "SS_SPEC" | iptables-restore -c + iptables-restore -n <<-EOT + $(extract_rules nat) + $(extract_rules mangle) + EOT + EOF + return 0 +} + +while getopts ":s:l:S:L:i:e:a:B:b:w:p:G:D:oOuUfgrczh" arg; do + case "$arg" in + s) + server=$OPTARG + ;; + l) + local_port=$OPTARG + ;; + S) + SERVER=$OPTARG + ;; + L) + LOCAL_PORT=$OPTARG + ;; + i) + IGNORE_LIST=$OPTARG + ;; + e) + EXT_ARGS=$OPTARG + ;; + a) + LAN_AC_IP=$OPTARG + ;; + B) + LAN_BP_IP=$OPTARG + ;; + b) + WAN_BP_IP=$(for ip in $OPTARG; do echo $ip; done) + ;; + w) + WAN_FW_IP=$OPTARG + ;; + p) + LAN_FP_IP=$OPTARG + ;; + G) + LAN_GM_IP=$OPTARG + ;; + D) + PROXY_PORTS=$OPTARG + ;; + o) + OUTPUT=1 + ;; + O) + OUTPUT=2 + ;; + u) + TPROXY=1 + ;; + U) + TPROXY=2 + ;; + g) + RUNMODE=gfw + ;; + r) + RUNMODE=router + ;; + c) + RUNMODE=oversea + ;; + z) + RUNMODE=all + ;; + f) + flush_r + exit 0 + ;; + h) usage 0 ;; + esac +done +if [ -z "$server" -o -z "$local_port" ]; then + usage 2 +fi +if [ "$TPROXY" == 1 ]; then + SERVER=$server + LOCAL_PORT=$local_port +elif [ "$TPROXY" == 2 ]; then + : ${SERVER:?"You must assign an ip for the udp relay server."} + : ${LOCAL_PORT:?"You must assign a port for the udp relay server."} +fi +flush_r && fw_rule && ipset_r && ac_rule && tp_rule && gen_include +[ "$?" == 0 ] || loger 3 "Start failed!" +exit $? diff --git a/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-switch b/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-switch new file mode 100644 index 00000000000000..b9cdd54aaa47ae --- /dev/null +++ b/package/lean/luci-app-ssr-plus/root/usr/bin/ssr-switch @@ -0,0 +1,168 @@ +#!/bin/sh /etc/rc.common +# +# Copyright (C) 2017 openwrt-ssr +# Copyright (C) 2017 yushi studio +# +# This is free software, licensed under the GNU General Public License v3. +# See /LICENSE for more information. +# + +cycle_time=60 +switch_time=3 +normal_flag=0 +server_locate=0 +server_count=0 +NAME=shadowsocksr +ENABLE_SERVER=nil +CONFIG_SWTICH_FILE=/var/etc/${NAME}_t.json + +[ -n "$1" ] && cycle_time=$1 +[ -n "$2" ] && switch_time=$2 + +uci_get_by_name() { + local ret=$(uci get $NAME.$1.$2 2>/dev/null) + echo ${ret:=$3} +} + +uci_get_by_type() { + local ret=$(uci get $NAME.@$1[0].$2 2>/dev/null) + echo ${ret:=$3} +} + +DEFAULT_SERVER=$(uci_get_by_type global global_server) +CURRENT_SERVER=$DEFAULT_SERVER + +#判断代理是否正常 +check_proxy() { + local result=0 + local try_count=$(uci_get_by_type global switch_try_count 3) + for i in $(seq 1 $try_count); do + /usr/bin/ssr-check www.google.com 80 $switch_time 1 + if [ "$?" == "0" ]; then + # echo "$(date "+%Y-%m-%d %H:%M:%S") Check Google Proxy Success, count=$i" >> /tmp/ssrplus.log + result=0 + break + else + # echo "$(date "+%Y-%m-%d %H:%M:%S") Check Google Proxy Fail, count=$i" >> /tmp/ssrplus.log + /usr/bin/ssr-check www.baidu.com 80 $switch_time 1 + if [ "$?" == "0" ]; then + result=1 + else + result=2 + fi + fi + sleep 1 + done + return $result +} + +test_proxy() { + local servername=$(uci_get_by_name $1 server) + local serverport=$(uci_get_by_name $1 server_port) + ret=$(ping -c 3 $servername | grep 'loss' | awk -F ',' '{ print $3 }' | awk -F "%" '{ print $1 }') + [ -z "$ret" ] && return 1 + [ "$ret" -gt "50" ] && return 1 + ipset add ss_spec_wan_ac $servername 2>/dev/null + ret=$? + /usr/bin/ssr-check $servername $serverport $switch_time + local ret2=$? + if [ "$ret" == "0" ]; then + ipset del ss_spec_wan_ac $servername 2>/dev/null + fi + if [ "$ret2" == "0" ]; then + return 0 + else + return 1 + fi +} + +search_proxy() { + let server_count=server_count+1 + [ "$normal_flag" == "1" -a "$server_count" -le "$server_locate" ] && return 0 + [ "$(uci_get_by_name $1 switch_enable)" != "1" ] && return 1 + [ $ENABLE_SERVER != nil ] && return 0 + [ "$1" == "$CURRENT_SERVER" ] && return 0 + local servername=$(uci_get_by_name $1 server) + local serverport=$(uci_get_by_name $1 server_port) + ipset add ss_spec_wan_ac $servername 2>/dev/null + ret=$? + /usr/bin/ssr-check $servername $serverport $switch_time + local ret2=$? + if [ "$ret" == "0" ]; then + ipset del ss_spec_wan_ac $servername 2>/dev/null + fi + if [ "$ret2" == "0" ]; then + server_locate=$server_count + ENABLE_SERVER=$1 + return 0 + else + return 1 + fi + +} +#选择可用的代理 +select_proxy() { + config_load $NAME + ENABLE_SERVER=nil + mkdir -p /var/run /var/etc + server_count=0 + config_foreach search_proxy servers +} + +#切换代理 +switch_proxy() { + /etc/init.d/shadowsocksr restart $1 + return 0 +} + +start() { + #不支持kcptun启用时的切换 + [ $(uci_get_by_name $DEFAULT_SERVER kcp_enable) = "1" ] && return 1 + + while [ "1" == "1" ]; do #死循环 + sleep $cycle_time + LOGTIME=$(date "+%Y-%m-%d %H:%M:%S") + #判断当前代理是否为缺省服务器 + if [ "$CURRENT_SERVER" != "$DEFAULT_SERVER" ]; then + #echo "not default proxy" + echo "$(date "+%Y-%m-%d %H:%M:%S") Current server is not default Main server, try to switch back." >>/tmp/ssrplus.log + #检查缺省服务器是否正常 + if test_proxy $DEFAULT_SERVER; then + #echo "switch to default proxy" + echo "$(date "+%Y-%m-%d %H:%M:%S") Main server is avilable." >>/tmp/ssrplus.log + #缺省服务器正常,切换回来 + CURRENT_SERVER=$DEFAULT_SERVER + switch_proxy $CURRENT_SERVER + echo "$(date "+%Y-%m-%d %H:%M:%S") switch to default ["$(uci_get_by_name $CURRENT_SERVER server)"] proxy!" >>/tmp/ssrplus.log + continue + else + echo "$(date "+%Y-%m-%d %H:%M:%S") Main server is NOT avilable.Continue using current server." >>/tmp/ssrplus.log + fi + fi + #判断当前代理是否正常 + check_proxy + current_ret=$? + if [ "$current_ret" == "1" ]; then + #当前代理错误,判断有无可用的服务器 + #echo "current error" + echo "$(date "+%Y-%m-%d %H:%M:%S") Current server error, try to switch another server." >>/tmp/ssrplus.log + select_proxy + if [ "$ENABLE_SERVER" != nil ]; then + #有其他服务器可用,进行切换 + #echo $(uci_get_by_name $new_proxy server) + echo "$(date "+%Y-%m-%d %H:%M:%S") Another server is avilable, now switching server." >>/tmp/ssrplus.log + CURRENT_SERVER=$ENABLE_SERVER + switch_proxy $CURRENT_SERVER + normal_flag=1 + echo "$(date "+%Y-%m-%d %H:%M:%S") ShadowsocksR server switch OK" >>/tmp/ssrplus.log + else + switch_proxy $CURRENT_SERVER + normal_flag=1 + echo "$(date "+%Y-%m-%d %H:%M:%S") Try restart current server." >>/tmp/ssrplus.log + fi + else + normal_flag=0 + echo "$(date "+%Y-%m-%d %H:%M:%S") ShadowsocksR No Problem." >>/tmp/ssrplus.log + fi + done +} diff --git a/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/chinaipset.sh b/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/chinaipset.sh new file mode 100644 index 00000000000000..044d524d94cffc --- /dev/null +++ b/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/chinaipset.sh @@ -0,0 +1,5 @@ +echo "create china hash:net family inet hashsize 1024 maxelem 65536" > /tmp/china.ipset +awk '!/^$/&&!/^#/{printf("add china %s'" "'\n",$0)}' /etc/china_ssr.txt >> /tmp/china.ipset +ipset -! flush china +ipset -! restore < /tmp/china.ipset 2>/dev/null +rm -f /tmp/china.ipset diff --git a/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/genred2config.sh b/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/genred2config.sh new file mode 100644 index 00000000000000..a36f48f897d704 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/genred2config.sh @@ -0,0 +1,72 @@ +#!/bin/sh + +cat <<-EOF >$1 +base { + log_debug = off; + log_info = off; + log = stderr; + daemon = on; + redirector = iptables; + reuseport = on; +} +EOF + +if [ "$2" == "socks5" ]; then + if [ "$3" == "tcp" ]; then + if [ "$7" == "0" ]; then + cat <<-EOF >>$1 +redsocks { + bind = "0.0.0.0:$4"; + relay = "$5:$6"; + type = socks5; + autoproxy = 0; + timeout = 10; +} +EOF + else + cat <<-EOF >>$1 +redsocks { + bind = "0.0.0.0:$4"; + relay = "$5:$6"; + type = socks5; + autoproxy = 0; + timeout = 10; + login = "$8"; + password = "$9"; +} +EOF + fi + else + if [ "$7" == "0" ]; then + cat <<-EOF >>$1 +redudp { + bind = "0.0.0.0:$4"; + relay = "$5:$6"; + type = socks5; + udp_timeout = 10; +} +EOF + else + cat <<-EOF >>$1 +redudp { + bind = "0.0.0.0:$4"; + relay = "$5:$6"; + type = socks5; + udp_timeout = 10; + login = "$8"; + password = "$9"; +} +EOF + fi + fi +else + cat <<-EOF >>$1 +redsocks { + bind = "0.0.0.0:$4"; + type = direct; + interface = $3; + autoproxy = 0; + timeout = 10; +} +EOF +fi diff --git a/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/gentrojanconfig.lua b/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/gentrojanconfig.lua new file mode 100644 index 00000000000000..8cb979bef82756 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/gentrojanconfig.lua @@ -0,0 +1,40 @@ +local ucursor = require "luci.model.uci".cursor() +local json = require "luci.jsonc" +local server_section = arg[1] +local proto = arg[2] +local local_port = arg[3] + +local server = ucursor:get_all("shadowsocksr", server_section) + +local trojan = { + log_level = 3, + run_type = proto, + local_addr = "0.0.0.0", + local_port = tonumber(local_port), + remote_addr = server.server, + remote_port = tonumber(server.server_port), + udp_timeout = 60, + -- 传入连接 + password = {server.password}, + -- 传出连接 + ssl = { + verify = (server.insecure == "0") and true or false, + verify_hostname = (server.tls == "1") and true or false, + cert = "", + cipher = "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:AES128-SHA:AES256-SHA:DES-CBC3-SHA", + cipher_tls13 = "TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384", + sni = server.tls_host, + alpn = {"h2", "http/1.1"}, + curve = "", + reuse_session = true, + session_ticket = false, + }, + tcp = { + no_delay = true, + keep_alive = true, + reuse_port = true, + fast_open = (server.fast_open == "1") and true or false, + fast_open_qlen = 20 + } +} +print(json.stringify(trojan, 1)) diff --git a/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/genv2config.lua b/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/genv2config.lua new file mode 100644 index 00000000000000..0ea059a5e3312a --- /dev/null +++ b/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/genv2config.lua @@ -0,0 +1,95 @@ +local ucursor = require "luci.model.uci".cursor() +local json = require "luci.jsonc" +local server_section = arg[1] +local proto = arg[2] +local local_port = arg[3] + +local server = ucursor:get_all("shadowsocksr", server_section) + +local v2ray = { +log = { + -- error = "/var/ssrplus.log", + loglevel = "warning" +}, + -- 传入连接 + inbound = { + port = local_port, + protocol = "dokodemo-door", + settings = { + network = proto, + followRedirect = true + }, + sniffing = { + enabled = true, + destOverride = { "http", "tls" } + } + }, + -- 传出连接 + outbound = { + protocol = "vmess", + settings = { + vnext = { + { + address = server.server, + port = tonumber(server.server_port), + users = { + { + id = server.vmess_id, + alterId = tonumber(server.alter_id), + security = server.security + } + } + } + } + }, + -- 底层传输配置 + streamSettings = { + network = server.transport, + security = (server.tls == '1') and "tls" or "none", + tlsSettings = {allowInsecure = (server.insecure == "1") and true or false,serverName=server.tls_host,}, + kcpSettings = (server.transport == "kcp") and { + mtu = tonumber(server.mtu), + tti = tonumber(server.tti), + uplinkCapacity = tonumber(server.uplink_capacity), + downlinkCapacity = tonumber(server.downlink_capacity), + congestion = (server.congestion == "1") and true or false, + readBufferSize = tonumber(server.read_buffer_size), + writeBufferSize = tonumber(server.write_buffer_size), + header = { + type = server.kcp_guise + } + } or nil, + wsSettings = (server.transport == "ws") and (server.ws_path ~= nil or server.ws_host ~= nil) and { + path = server.ws_path, + headers = (server.ws_host ~= nil) and { + Host = server.ws_host + } or nil, + } or nil, + httpSettings = (server.transport == "h2") and { + path = server.h2_path, + host = server.h2_host, + } or nil, + quicSettings = (server.transport == "quic") and { + security = server.quic_security, + key = server.quic_key, + header = { + type = server.quic_guise + } + } or nil + }, + mux = { + enabled = (server.mux == "1") and true or false, + concurrency = tonumber(server.concurrency) + } + }, + + -- 额外传出连接 + outboundDetour = { + { + protocol = "freedom", + tag = "direct", + settings = { keep = "" } + } + } +} +print(json.stringify(v2ray, 1)) diff --git a/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/gfw2ipset.sh b/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/gfw2ipset.sh new file mode 100644 index 00000000000000..c5decd28cef7df --- /dev/null +++ b/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/gfw2ipset.sh @@ -0,0 +1,5 @@ +#!/bin/sh +mkdir -p /tmp/dnsmasq.ssr +awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"blacklist"'\n",$0)}' /etc/config/black.list > /tmp/dnsmasq.ssr/blacklist_forward.conf +awk '!/^$/&&!/^#/{printf("server=/.%s/'"127.0.0.1#5335"'\n",$0)}' /etc/config/black.list >> /tmp/dnsmasq.ssr/blacklist_forward.conf +awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"whitelist"'\n",$0)}' /etc/config/white.list > /tmp/dnsmasq.ssr/whitelist_forward.conf diff --git a/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua b/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua new file mode 100644 index 00000000000000..f2fd862152c94e --- /dev/null +++ b/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua @@ -0,0 +1,437 @@ +#!/usr/bin/lua +------------------------------------------------ +-- This file is part of the luci-app-ssr-plus subscribe.lua +-- @author William Chan +------------------------------------------------ +require 'nixio' +require 'luci.util' +require 'luci.jsonc' +require 'luci.sys' +require 'uci' +-- these global functions are accessed all the time by the event handler +-- so caching them is worth the effort +local luci = luci +local tinsert = table.insert +local ssub, slen, schar, sbyte, sformat, sgsub = string.sub, string.len, string.char, string.byte, string.format, string.gsub +local jsonParse, jsonStringify = luci.jsonc.parse, luci.jsonc.stringify +local b64decode = nixio.bin.b64decode +local cache = {} +local nodeResult = setmetatable({}, { __index = cache }) -- update result +local name = 'shadowsocksr' +local uciType = 'servers' +local ucic = uci.cursor() +local proxy = ucic:get_first(name, 'server_subscribe', 'proxy', '0') +local switch = ucic:get_first(name, 'server_subscribe', 'switch', '1') +local subscribe_url = ucic:get_first(name, 'server_subscribe', 'subscribe_url', {}) + +local log = function(...) + print(os.date("%Y-%m-%d %H:%M:%S ") .. table.concat({ ... }, " ")) +end +-- 分割字符串 +local function split(full, sep) + full = full:gsub("%z", "") -- 这里不是很清楚 有时候结尾带个\0 + local off, result = 1, {} + while true do + local nStart, nEnd = full:find(sep, off) + if not nEnd then + local res = ssub(full, off, slen(full)) + if #res > 0 then -- 过滤掉 \0 + tinsert(result, res) + end + break + else + tinsert(result, ssub(full, off, nStart - 1)) + off = nEnd + 1 + end + end + return result +end +-- urlencode +local function get_urlencode(c) + return sformat("%%%02X", sbyte(c)) +end + +local function urlEncode(szText) + local str = szText:gsub("([^0-9a-zA-Z ])", get_urlencode) + str = str:gsub(" ", "+") + return str +end + +local function get_urldecode(h) + return schar(tonumber(h, 16)) +end +local function UrlDecode(szText) + return szText:gsub("+", " "):gsub("%%(%x%x)", get_urldecode) +end + +-- trim +local function trim(text) + if not text or text == "" then + return "" + end + return (sgsub(text, "^%s*(.-)%s*$", "%1")) +end +-- md5 +local function md5(content) + local stdout = luci.sys.exec('echo \"' .. urlEncode(content) .. '\" | md5sum | cut -d \" \" -f1') + -- assert(nixio.errno() == 0) + return trim(stdout) +end +-- base64 +local function base64Decode(text) + local raw = text + if not text then return '' end + text = text:gsub("%z", "") + text = text:gsub("_", "/") + text = text:gsub("-", "+") + local mod4 = #text % 4 + text = text .. string.sub('====', mod4 + 1) + local result = b64decode(text) + if result then + return result:gsub("%z", "") + else + return raw + end +end +-- 处理数据 +local function processData(szType, content) + local result = { + type = szType, + local_port = 1234, + kcp_param = '--nocomp' + } + if szType == 'ssr' then + local dat = split(content, "/%?") + local hostInfo = split(dat[1], ':') + result.server = hostInfo[1] + result.server_port = hostInfo[2] + result.protocol = hostInfo[3] + result.encrypt_method = hostInfo[4] + result.obfs = hostInfo[5] + result.password = base64Decode(hostInfo[6]) + local params = {} + for _, v in pairs(split(dat[2], '&')) do + local t = split(v, '=') + params[t[1]] = t[2] + end + result.obfs_param = base64Decode(params.obfsparam) + result.protocol_param = base64Decode(params.protoparam) + local group = base64Decode(params.group) + if group then + result.alias = "[" .. group .. "] " + end + result.alias = result.alias .. base64Decode(params.remarks) + elseif szType == 'vmess' then + local info = jsonParse(content) + result.type = 'v2ray' + result.server = info.add + result.server_port = info.port + result.transport = info.net + result.alter_id = info.aid + result.vmess_id = info.id + result.alias = info.ps + result.insecure = 1 + -- result.mux = 1 + -- result.concurrency = 8 + if info.net == 'ws' then + result.ws_host = info.host + result.ws_path = info.path + end + if info.net == 'h2' then + result.h2_host = info.host + result.h2_path = info.path + end + if info.net == 'tcp' then + result.tcp_guise = info.type + result.http_host = info.host + result.http_path = info.path + end + if info.net == 'kcp' then + result.kcp_guise = info.type + result.mtu = 1350 + result.tti = 50 + result.uplink_capacity = 5 + result.downlink_capacity = 20 + result.read_buffer_size = 2 + result.write_buffer_size = 2 + end + if info.net == 'quic' then + result.quic_guise = info.type + result.quic_key = info.key + result.quic_security = info.securty + end + if info.security then + result.security = info.security + end + if info.tls == "tls" or info.tls == "1" then + result.tls = "1" + result.tls_host = info.host + else + result.tls = "0" + end + elseif szType == "ss" then + local idx_sp = 0 + local alias = "" + if content:find("#") then + idx_sp = content:find("#") + alias = content:sub(idx_sp + 1, -1) + end + local info = content:sub(1, idx_sp - 1) + local hostInfo = split(base64Decode(info), "@") + local host = split(hostInfo[2], ":") + local userinfo = base64Decode(hostInfo[1]) + local method = userinfo:sub(1, userinfo:find(":") - 1) + local password = userinfo:sub(userinfo:find(":") + 1, #userinfo) + result.alias = UrlDecode(alias) + result.type = "ss" + result.server = host[1] + if host[2]:find("/%?") then + local query = split(host[2], "/%?") + result.server_port = query[1] + local params = {} + for _, v in pairs(split(query[2], '&')) do + local t = split(v, '=') + params[t[1]] = t[2] + end + if params.plugin then + local plugin_info = UrlDecode(params.plugin) + local idx_pn = plugin_info:find(";") + if idx_pn then + result.plugin = plugin_info:sub(1, idx_pn - 1) + result.plugin_opts = plugin_info:sub(idx_pn + 1, #plugin_info) + else + result.plugin = plugin_info + end + end + else + result.server_port = host[2] + end + result.encrypt_method_ss = method + result.password = password + elseif szType == "ssd" then + result.type = "ss" + result.server = content.server + result.server_port = content.port + result.password = content.password + result.encrypt_method_ss = content.encryption + result.plugin = content.plugin + result.plugin_opts = content.plugin_options + result.alias = "[" .. content.airport .. "] " .. content.remarks + elseif szType == "trojan" then + local idx_sp = 0 + local alias = "" + if content:find("#") then + idx_sp = content:find("#") + alias = content:sub(idx_sp + 1, -1) + end + local info = content:sub(1, idx_sp - 1) + local hostInfo = split(info, "@") + local host = split(hostInfo[2], ":") + local userinfo = hostInfo[1] + local password = userinfo + result.alias = UrlDecode(alias) + result.type = "trojan" + result.server = host[1] + -- 按照官方的建议 默认验证ssl证书 + result.insecure = "0" + result.tls = "1" + if host[2]:find("?") then + local query = split(host[2], "?") + result.server_port = query[1] + local params = {} + for _, v in pairs(split(query[2], '&')) do + local t = split(v, '=') + params[t[1]] = t[2] + end + + if params.peer then + -- 未指定peer(sni)默认使用remote addr + result.tls_host = params.peer + end + + if params.allowInsecure == "1" then + result.insecure = "1" + else + result.insecure = "0" + end + else + result.server_port = host[2] + end + result.password = password + end + if not result.alias then + result.alias = result.server .. ':' .. result.server_port + end + -- alias 不参与 hashkey 计算 + local alias = result.alias + result.alias = nil + local switch_enable = result.switch_enable + result.switch_enable = nil + result.hashkey = md5(jsonStringify(result)) + result.alias = alias + result.switch_enable = switch_enable + return result +end +-- wget +local function wget(url) + local stdout = luci.sys.exec('wget-ssl --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36" --no-check-certificate -t 3 -T 10 -O- "' .. url .. '"') + return trim(stdout) +end + +local execute = function() + -- exec + do + if proxy == '0' then -- 不使用代理更新的话先暂停 + log('服务正在暂停') + luci.sys.init.stop(name) + end + for k, url in ipairs(subscribe_url) do + local raw = wget(url) + if #raw > 0 then + local nodes, szType + local groupHash = md5(url) + cache[groupHash] = {} + tinsert(nodeResult, {}) + local index = #nodeResult + -- SSD 似乎是这种格式 ssd:// 开头的 + if raw:find('ssd://') then + szType = 'ssd' + local nEnd = select(2, raw:find('ssd://')) + nodes = base64Decode(raw:sub(nEnd + 1, #raw)) + nodes = jsonParse(nodes) + local extra = { + airport = nodes.airport, + port = nodes.port, + encryption = nodes.encryption, + password = nodes.password + } + local servers = {} + -- SS里面包着 干脆直接这样 + for _, server in ipairs(nodes.servers) do + tinsert(servers, setmetatable(server, { __index = extra })) + end + nodes = servers + else + -- ssd 外的格式 + nodes = split(base64Decode(raw):gsub(" ", "\n"), "\n") + end + for _, v in ipairs(nodes) do + if v then + local result + if szType == 'ssd' then + result = processData(szType, v) + elseif not szType then + local node = trim(v) + local dat = split(node, "://") + if dat and dat[1] and dat[2] then + if dat[1] == 'ss' or dat[1] == 'trojan' then + result = processData(dat[1], dat[2]) + else + result = processData(dat[1], base64Decode(dat[2])) + end + end + else + log('跳过未知类型: ' .. szType) + end + -- log(result) + if result then + if result.alias:find("过期时间") or + result.alias:find("剩余流量") or + result.alias:find("QQ群") or + result.alias:find("官网") or + result.alias:find("防失联地址") or + not result.server or + result.server:match("[^0-9a-zA-Z%-%.%s]") -- 中文做地址的 也没有人拿中文域名搞,就算中文域也有Puny Code SB 机场 + then + log('丢弃无效节点: ' .. result.type ..' 节点, ' .. result.alias) + else + log('成功解析: ' .. result.type ..' 节点, ' .. result.alias) + result.grouphashkey = groupHash + tinsert(nodeResult[index], result) + cache[groupHash][result.hashkey] = nodeResult[index][#nodeResult[index]] + end + end + end + end + log('成功解析节点数量: ' ..#nodes) + else + log(url .. ': 获取内容为空') + end + end + end + -- diff + do + if next(nodeResult) == nil then + log("更新失败,没有可用的节点信息") + return + end + local add, del = 0, 0 + ucic:foreach(name, uciType, function(old) + if old.grouphashkey or old.hashkey then -- 没有 hash 的不参与删除 + if not nodeResult[old.grouphashkey] or not nodeResult[old.grouphashkey][old.hashkey] then + ucic:delete(name, old['.name']) + del = del + 1 + else + local dat = nodeResult[old.grouphashkey][old.hashkey] + ucic:tset(name, old['.name'], dat) + -- 标记一下 + setmetatable(nodeResult[old.grouphashkey][old.hashkey], { __index = { _ignore = true } }) + end + else + if not old.alias then + old.alias = old.server .. ':' .. old.server_port + end + log('忽略手动添加的节点: ' .. old.alias) + end + + end) + for k, v in ipairs(nodeResult) do + for kk, vv in ipairs(v) do + if not vv._ignore then + local section = ucic:add(name, uciType) + ucic:tset(name, section, vv) + ucic:set(name, section, "switch_enable", switch) + add = add + 1 + end + end + end + ucic:commit(name) + -- 如果原有服务器节点已经不见了就尝试换为第一个节点 + local globalServer = ucic:get_first(name, 'global', 'global_server', '') + local firstServer = ucic:get_first(name, uciType) + if firstServer then + if not ucic:get(name, globalServer) then + luci.sys.call("/etc/init.d/" .. name .. " stop > /dev/null 2>&1 &") + ucic:commit(name) + ucic:set(name, ucic:get_first(name, 'global'), 'global_server', ucic:get_first(name, uciType)) + ucic:commit(name) + log('当前主服务器节点已被删除,正在自动更换为第一个节点。') + luci.sys.call("/etc/init.d/" .. name .. " start > /dev/null 2>&1 &") + else + log('维持当前主服务器节点。') + luci.sys.call("/etc/init.d/" .. name .." restart > /dev/null 2>&1 &") + end + else + log('没有服务器节点了,停止服务') + luci.sys.call("/etc/init.d/" .. name .. " stop > /dev/null 2>&1 &") + end + log('新增节点数量: ' ..add, '删除节点数量: ' .. del) + log('订阅更新成功') + end +end + +if subscribe_url and #subscribe_url > 0 then + xpcall(execute, function(e) + log(e) + log(debug.traceback()) + log('发生错误, 正在恢复服务') + local firstServer = ucic:get_first(name, uciType) + if firstServer then + luci.sys.call("/etc/init.d/" .. name .." restart > /dev/null 2>&1 &") -- 不加&的话日志会出现的更早 + log('重启服务成功') + else + luci.sys.call("/etc/init.d/" .. name .." stop > /dev/null 2>&1 &") -- 不加&的话日志会出现的更早 + log('停止服务成功') + end + end) +end diff --git a/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/update.lua b/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/update.lua new file mode 100644 index 00000000000000..639417da983442 --- /dev/null +++ b/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/update.lua @@ -0,0 +1,97 @@ +#!/usr/bin/lua +------------------------------------------------ +-- This file is part of the luci-app-ssr-plus update.lua +-- By Mattraks +------------------------------------------------ +require 'nixio' +require 'luci.util' +require 'luci.jsonc' +require 'luci.sys' +local icount =0 +local ucic = luci.model.uci.cursor() + +local log = function(...) + print(os.date("%Y-%m-%d %H:%M:%S ") .. table.concat({ ... }, " ")) +end + +log('正在更新【GFW列表】数据库') + refresh_cmd="wget-ssl --no-check-certificate https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt -O /tmp/gfw.b64" + sret=luci.sys.call(refresh_cmd .. " 2>/dev/null") + if sret== 0 then + luci.sys.call("/usr/bin/ssr-gfw") + icount = luci.sys.exec("cat /tmp/gfwnew.txt | wc -l") + if tonumber(icount)>1000 then + oldcount=luci.sys.exec("cat /etc/dnsmasq.ssr/gfw_list.conf | wc -l") + if tonumber(icount) ~= tonumber(oldcount) then + luci.sys.exec("cp -f /tmp/gfwnew.txt /etc/dnsmasq.ssr/gfw_list.conf") + luci.sys.exec("cp -f /tmp/gfwnew.txt /tmp/dnsmasq.ssr/gfw_list.conf") + log('更新成功! 新的总纪录数:'.. icount) + else + log('你已经是最新数据,无需更新!') + end + else + log('更新失败!') + end + luci.sys.exec("rm -f /tmp/gfwnew.txt") +else + log('更新失败!') +end + +log('正在更新【国内IP段】数据库') +if (ucic:get_first('shadowsocksr', 'global', 'chnroute','0') == '1' ) then + refresh_cmd="wget-ssl --no-check-certificate -O - ".. ucic:get_first('shadowsocksr', 'global', 'chnroute_url','https://ispip.clang.cn/all_cn.txt') .." > /tmp/china_ssr.txt 2>/dev/null" +else + refresh_cmd="wget -O- 'http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest' 2>/dev/null| awk -F\\| '/CN\\|ipv4/ { printf(\"%s/%d\\n\", $4, 32-log($5)/log(2)) }' > /tmp/china_ssr.txt" +end +sret=luci.sys.call(refresh_cmd) +icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l") +if sret== 0 then + icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l") + if tonumber(icount)>1000 then + oldcount=luci.sys.exec("cat /etc/china_ssr.txt | wc -l") + if tonumber(icount) ~= tonumber(oldcount) then + luci.sys.exec("cp -f /tmp/china_ssr.txt /etc/china_ssr.txt") + log('更新成功! 新的总纪录数:'.. icount) + else + log('你已经是最新数据,无需更新!') + end + else + log('更新失败!') + end + luci.sys.exec("rm -f /tmp/china_ssr.txt") +else + log('更新失败!') +end + +if ucic:get_first('shadowsocksr', 'global', 'adblock','0') == "1" then +log('正在更新【广告屏蔽】数据库') +if nixio.fs.access("/usr/bin/wget-ssl") then + refresh_cmd="wget-ssl --no-check-certificate -O - ".. ucic:get_first('shadowsocksr', 'global', 'adblock_url','https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt') .." > /tmp/adnew.conf" +end +sret=luci.sys.call(refresh_cmd .. " 2>/dev/null") +if sret== 0 then + luci.sys.call("/usr/bin/ssr-ad") + icount = luci.sys.exec("cat /tmp/ad.conf | wc -l") + if tonumber(icount)>1000 then + if nixio.fs.access("/etc/dnsmasq.ssr/ad.conf") then + oldcount=luci.sys.exec("cat /etc/dnsmasq.ssr/ad.conf | wc -l") + else + oldcount=0 + end + if tonumber(icount) ~= tonumber(oldcount) then + luci.sys.exec("cp -f /tmp/ad.conf /etc/dnsmasq.ssr/ad.conf") + luci.sys.exec("cp -f /tmp/ad.conf /tmp/dnsmasq.ssr/ad.conf") + log('更新成功! 新的总纪录数:'.. icount) + else + log('你已经是最新数据,无需更新!') + end + else + log('更新失败!') + end + luci.sys.exec("rm -f /tmp/ad.conf") +else + log('更新失败!') +end +end + +luci.sys.call("/etc/init.d/dnsmasq restart") diff --git a/package/lean/luci-app-ssrserver-python/Makefile b/package/lean/luci-app-ssrserver-python/Makefile new file mode 100644 index 00000000000000..7d7a317550c47f --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/Makefile @@ -0,0 +1,19 @@ +# +# Copyright (C) 2008-2014 The LuCI Team +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI for SSR Server Python +LUCI_DEPENDS:=+python +LUCI_PKGARCH:=all +PKG_VERSION:=3.2.0 +PKG_RELEASE:=6 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + + diff --git a/package/lean/luci-app-ssrserver-python/luasrc/controller/ssrs.lua b/package/lean/luci-app-ssrserver-python/luasrc/controller/ssrs.lua new file mode 100644 index 00000000000000..01095ec597310c --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/luasrc/controller/ssrs.lua @@ -0,0 +1,21 @@ +module("luci.controller.ssrs",package.seeall) + +function index() +if not nixio.fs.access("/etc/config/ssrs")then + return +end + +entry({"admin", "vpn"}, firstchild(), "VPN", 45).dependent = false + +local page + +entry({"admin","vpn","ssrs"},cbi("ssrs"),_("SSR Python Server"),4).dependent=true +entry({"admin","vpn","ssrs","status"},call("act_status")).leaf=true +end + +function act_status() + local e={} + e.running=luci.sys.call("ps | grep server.py |grep -v grep >/dev/null") == 0 + luci.http.prepare_content("application/json") + luci.http.write_json(e) +end diff --git a/package/lean/luci-app-ssrserver-python/luasrc/model/cbi/ssrs.lua b/package/lean/luci-app-ssrserver-python/luasrc/model/cbi/ssrs.lua new file mode 100644 index 00000000000000..889aca8a68f0fa --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/luasrc/model/cbi/ssrs.lua @@ -0,0 +1,75 @@ +local a,t,e +local m, s +local o=require"nixio.fs" +local n={ +"none", +"aes-128-ctr", +"aes-192-ctr", +"aes-256-ctr", +"aes-128-cfb", +"aes-192-cfb", +"aes-256-cfb", +"rc4", +"rc4-md5", +"rc4-md5-6", +} +local s={ +"origin", +"verify_deflate", +"auth_sha1_v4", +"auth_aes128_md5", +"auth_aes128_sha1", +"auth_chain_a", +"auth_chain_b", +"auth_chain_c", +"auth_chain_d", +"auth_chain_e", +"auth_chain_f", +} +local i={ +"plain", +"http_simple", +"http_post", +"random_head", +"tls1.2_ticket_auth", +"tls1.2_ticket_fastauth", +} +local o={ +"false", +"true", +} + +a= Map("ssrs", translate("ShadowSocksR Server Config")) +a.description = translate("ShadowsocksR Python Server is a fork of the Shadowsocks project, claimed to be superior in terms of security and stability") + +a:section(SimpleSection).template = "ssrs/ssrs_status" + +t=a:section(TypedSection,"server",translate("")) +t.anonymous=true +t.addremove=false + +e=t:option(Flag,"enable",translate("Enable")) +e.rmempty=false + +e=t:option(Value,"server_port",translate("Server Port")) +e.datatype="port" +e.rmempty=false +e.default=139 + +e=t:option(Value,"password",translate("Password")) +e.password=true +e.rmempty=false + +e=t:option(ListValue,"encrypt_method",translate("Encrypt Method")) +for a,t in ipairs(n)do e:value(t)end +e.rmempty=false + +e=t:option(ListValue,"protocol",translate("Protocol")) +for a,t in ipairs(s)do e:value(t)end +e.rmempty=false + +e=t:option(ListValue,"obfs",translate("Obfs")) +for a,t in ipairs(i)do e:value(t)end +e.rmempty=false + +return a diff --git a/package/lean/luci-app-ssrserver-python/luasrc/view/ssrs/ssrs_status.htm b/package/lean/luci-app-ssrserver-python/luasrc/view/ssrs/ssrs_status.htm new file mode 100644 index 00000000000000..043620d08a1dac --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/luasrc/view/ssrs/ssrs_status.htm @@ -0,0 +1,22 @@ + + +
+

+ <%:Collecting data...%> +

+
\ No newline at end of file diff --git a/package/lean/luci-app-ssrserver-python/po/zh-cn/ssrs.po b/package/lean/luci-app-ssrserver-python/po/zh-cn/ssrs.po new file mode 100644 index 00000000000000..e3b31875f2f709 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/po/zh-cn/ssrs.po @@ -0,0 +1,35 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8\n" + +msgid "SSR Python Server" +msgstr "SSR Python 服务器" + +msgid "ShadowSocksR Server Config" +msgstr "ShadowsocksR Python 服务器设置" + +msgid "Global Setting" +msgstr "全局设置" + +msgid "Encrypt Method" +msgstr "加密" + +msgid "Protocol_param" +msgstr "协议参数" + +msgid "Obfs" +msgstr "混淆" + +msgid "Obfs_param" +msgstr "混淆参数" + +msgid "redirect" +msgstr "重定向" + +msgid "Connection Timeout" +msgstr "连接超时时间" + +msgid "ShadowsocksR Python Server is a fork of the Shadowsocks project, claimed to be superior in terms of security and stability" +msgstr "ShadowsocksR Python 服务器是一个增加了协议参数和混淆的全功能版本" + +msgid "ShadowsocksR Python Server" +msgstr "ShadowsocksR Python 服务器" diff --git a/package/lean/luci-app-ssrserver-python/root/etc/config/ssrs b/package/lean/luci-app-ssrserver-python/root/etc/config/ssrs new file mode 100644 index 00000000000000..a85b5ca5e11bd7 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/etc/config/ssrs @@ -0,0 +1,11 @@ + +config server 'ssrs' + option password '12345678' + option timeout '300' + option fast_open 'true' + option encrypt_method 'rc4-md5' + option protocol 'auth_sha1_v4' + option obfs 'http_simple' + option server_port '10240' + option enable '0' + diff --git a/package/lean/luci-app-ssrserver-python/root/etc/init.d/ssrs b/package/lean/luci-app-ssrserver-python/root/etc/init.d/ssrs new file mode 100644 index 00000000000000..63a473b3f3cbd2 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/etc/init.d/ssrs @@ -0,0 +1,95 @@ +#!/bin/sh /etc/rc.common +# +# Copyright (C) 2015 OpenWrt-dist +# +# This is free software, licensed under the GNU General Public License v3. +# See /LICENSE for more information. +# + +START=91 + +CONFIG=ssrs +CONFIG_FILE=/var/etc/$CONFIG.json +PID_FILE=/var/run/$CONFIG.pid +LOG_FILE=/var/log/$CONFIG.log + +uci_get_by_type() { + local index=0 + if [ -n $4 ]; then + index=$4 + fi + local ret=$(uci get $CONFIG.@$1[$index].$2 2>/dev/null) + echo ${ret:=$3} +} + +is_true() { + case $1 in + 1|on|true|yes|enabled) echo 0;; + *) echo 1;; + esac +} + +load_config() { + ENABLED=$(uci_get_by_type server enable) + return $(is_true $ENABLED) +} + +start_server() { + mkdir -p /var/etc + /usr/bin/python \ + /usr/share/ssr/shadowsocks/server.py \ + -c $CONFIG_FILE \ + --pid-file $PID_FILE \ + --log-file $LOG_FILE \ + -d start \ + >/dev/null 2>&1 & +} + +gen_config_file() { + cat <<-EOF >$CONFIG_FILE + { + "server": "0.0.0.0", + "server_port": $(uci_get_by_type server server_port), + "local_address":"127.0.0.1", + "local_port":1086, + "password": "$(uci_get_by_type server password)", + "timeout": $(uci_get_by_type server timeout 60), + "method": "$(uci_get_by_type server encrypt_method)", + "protocol": "$(uci_get_by_type server protocol)", + "protocol_param": "$(uci_get_by_type server protocol_param)", + "obfs": "$(uci_get_by_type server obfs)", + "obfs_param": "$(uci_get_by_type server obfs_param)", + "redirect": "$(uci_get_by_type server redirect)", + "fast_open": "$(uci_get_by_type server fast_open)" + } +EOF +} + + +add_rule() { + serverport=$(uci_get_by_type server server_port) + uci set firewall.ssrs.dest_port=$serverport && uci commit firewall && /etc/init.d/firewall restart +} + +del_rule() { + serverport=$(uci_get_by_type server server_port) +} + +start() { + ! load_config && exit 0 + gen_config_file "server" + start_server + add_rule +} + +stop() { + del_rule + /usr/bin/python \ + /usr/share/ssr/shadowsocks/server.py \ + -c $CONFIG_FILE \ + --pid-file $PID_FILE \ + --log-file $LOG_FILE \ + -d stop \ + >/dev/null 2>&1 & + rm -f $LOG_FILE +} \ No newline at end of file diff --git a/package/lean/luci-app-ssrserver-python/root/etc/uci-defaults/luci-app-ssrs b/package/lean/luci-app-ssrserver-python/root/etc/uci-defaults/luci-app-ssrs new file mode 100644 index 00000000000000..a3875909873758 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/etc/uci-defaults/luci-app-ssrs @@ -0,0 +1,19 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@ssrs[-1] + add ucitrack ssrs + set ucitrack.@ssrs[-1].init=ssrs + commit ucitrack + delete firewall.ssrs + add firewall rule + rename firewall.@rule[-1]="ssrs" + set firewall.@rule[-1].name="ssrs" + set firewall.@rule[-1].target="ACCEPT" + set firewall.@rule[-1].src="wan" + set firewall.@rule[-1].proto="tcp" + set firewall.@rule[-1].dest_port="10240" +EOF + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/.travis.yml b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/.travis.yml new file mode 100644 index 00000000000000..014fa07145412f --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/.travis.yml @@ -0,0 +1,21 @@ +language: python +python: + - 2.6 + - 2.7 + - 3.3 + - 3.4 +cache: + directories: + - dante-1.4.0 +before_install: + - sudo apt-get update -qq + - sudo apt-get install -qq build-essential dnsutils iproute nginx bc + - sudo dd if=/dev/urandom of=/usr/share/nginx/www/file bs=1M count=10 + - sudo sh -c "echo '127.0.0.1 localhost' > /etc/hosts" + - sudo service nginx restart + - pip install pep8 pyflakes nose coverage PySocks cymysql + - sudo tests/socksify/install.sh + - sudo tests/libsodium/install.sh + - sudo tests/setup_tc.sh +script: + - tests/jenkins.sh diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/CHANGES b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/CHANGES new file mode 100644 index 00000000000000..0cd91768ea2692 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/CHANGES @@ -0,0 +1,342 @@ +3.4.0 2017-07-27 +- add auth_chain_b +- add initmudbjson.sh +- allow set speed limit in runtime +- fix bugs & mem leak + +3.3.3 2017-06-03 +- add DNS cache +- add tls1.2_ticket_fastauth +- fix bugs + +3.3.2 2017-05-20 +- revert http reply +- refine tls1.2_ticket_auth error detector + +3.3.1 2017-05-18 +- fix stop script +- Async DNS query under UDP +- fix old version of OpenSSL +- http reply + +3.3.0 2017-05-11 +- connect_log include local addr & port +- fix auth_chain_a UDP bug +- add "additional_ports_only" +- add interface legendsockssr +- run with newest python version +- parse comment in hosts +- update mujson_mgr +- add cymysql setup script +- new speed tester +- fix leaks +- bugs fixed + +3.2.0 2017-04-27 +- add auth_chain_a +- remove auth_aes128, auth_sha1, auth_sha1_v2, verify_simple, auth_simple, verify_sha1 + +3.1.2 2017-04-07 +- display UID +- auto adjust TCP MSS + +3.1.1 2017-03-25 +- add "New session ticket" +- ignore bind 10.0.0.0/8 and 192.168.0.0/16 by default +- improve rand size under auth_aes128_* +- fix bugs + +3.1.0 2017-03-16 +- add "glzjinmod" interface +- rate limit +- add additional_ports in config + +3.0.4 2017-01-08 +- multi-user in single port + +3.0.1 2017-01-03 +- remove auth_aes128_*_compatible + +3.0.0 2016-12-23 +- http_simple fix bugs +- tls1.2_ticket_auth fix bug & defaule time diff set to 86400s + +2.9.7 2016-11-22 +- manage client with LRUCache +- catch bind error +- fix import error of resource on windows +- print RLIMIT_NOFILE +- always close cymysql objects +- add init script + +2.9.6 2016-10-17 +- tls1.2_ticket_auth random packet size + +2.9.5.1 2016-10-16 +- UDP bind address + +2.9.5 2016-10-13 +- add auth_aes128_md5 and auth_aes128_sha1 + +2.9.4 2016-10-11 +- sync client version + +2.6.13 2015-11-02 +- add protocol setting + +2.6.12 2015-10-27 +- IPv6 first +- Fix mem leaks +- auth_simple plugin +- remove FORCE_NEW_PROTOCOL +- optimize code + +2.6.11 2015-10-20 +- Obfs plugin +- Obfs parameters +- UDP over TCP +- TCP over UDP (experimental) +- Fix socket leaks +- Catch abnormal UDP package + +2.6.10 2015-06-08 +- Optimize LRU cache +- Refine logging + +2.6.9 2015-05-19 +- Fix a stability issue on Windows + +2.6.8 2015-02-10 +- Support multiple server ip on client side +- Support --version +- Minor fixes + +2.6.7 2015-02-02 +- Support --user +- Support CIDR format in --forbidden-ip +- Minor fixes + +2.6.6 2015-01-23 +- Fix a crash in forbidden list + +2.6.5 2015-01-18 +- Try both 32 bit and 64 bit dll on Windows + +2.6.4 2015-01-14 +- Also search lib* when searching libraries + +2.6.3 2015-01-12 +- Support --forbidden-ip to ban some IP, i.e. localhost +- Search OpenSSL and libsodium harder +- Now works on OpenWRT + +2.6.2 2015-01-03 +- Log client IP + +2.6.1 2014-12-26 +- Fix a problem with TCP Fast Open on local side +- Fix sometimes daemon_start returns wrong exit status + +2.6 2014-12-21 +- Add daemon support + +2.5 2014-12-11 +- Add salsa20 and chacha20 + +2.4.3 2014-11-10 +- Fix an issue on Python 3 +- Fix an issue with IPv6 + +2.4.2 2014-11-06 +- Fix command line arguments on Python 3 +- Support table on Python 3 +- Fix TCP Fast Open on Python 3 + +2.4.1 2014-11-01 +- Fix setup.py for non-utf8 locales on Python 3 + +2.4 2014-11-01 +- Python 3 support +- Performance improvement +- Fix LRU cache behavior + +2.3.2 2014-10-11 +- Fix OpenSSL on Windows + +2.3.1 2014-10-09 +- Does not require M2Crypto any more + +2.3 2014-09-23 +- Support CFB1, CFB8 and CTR mode of AES +- Do not require password config when using port_password +- Use SIGTERM instead of SIGQUIT on Windows + +2.2.2 2014-09-14 +- Fix when multiple DNS set, IPv6 only sites are broken + +2.2.1 2014-09-10 +- Support graceful shutdown +- Fix some bugs + +2.2.0 2014-09-09 +- Add RC4-MD5 encryption + +2.1.0 2014-08-10 +- Use only IPv4 DNS server +- Does not ship config.json +- Better error message + +2.0.12 2014-07-26 +- Support -q quiet mode +- Exit 0 when showing help with -h + +2.0.11 2014-07-12 +- Prefers IP addresses over hostnames, more friendly with socksify and openvpn + +2.0.10 2014-07-11 +- Fix UDP on local + +2.0.9 2014-07-06 +- Fix EWOULDBLOCK on Windows +- Fix Unicode config problem on some platforms + +2.0.8 2014-06-23 +- Use multiple DNS to query hostnames + +2.0.7 2014-06-21 +- Fix fastopen on local +- Fallback when fastopen is not available +- Add verbose logging mode -vv +- Verify if hostname is valid + +2.0.6 2014-06-19 +- Fix CPU 100% on POLL_HUP +- More friendly logging + +2.0.5 2014-06-18 +- Support a simple config format for multiple ports + +2.0.4 2014-06-12 +- Fix worker master + +2.0.3 2014-06-11 +- Fix table encryption with UDP + +2.0.2 2014-06-11 +- Add asynchronous DNS in TCP relay + +2.0.1 2014-06-05 +- Better logging +- Maybe fix bad file descriptor + +2.0 2014-06-05 +- Use a new event model +- Remove gevent +- Refuse to use default password +- Fix a problem when using multiple passwords with table encryption + +1.4.5 2014-05-24 +- Add timeout in TCP server +- Close sockets in master process + +1.4.4 2014-05-17 +- Support multiple workers + +1.4.3 2014-05-13 +- Fix Windows + +1.4.2 2014-05-10 +- Add salsa20-ctr cipher + +1.4.1 2014-05-03 +- Fix error log +- Fix EINPROGESS with some version of gevent + +1.4.0 2014-05-02 +- Adds UDP relay +- TCP fast open support on Linux 3.7+ + +1.3.7 2014-04-10 +- Fix a typo in help + +1.3.6 2014-04-10 +- Fix a typo in help + +1.3.5 2014-04-07 +- Add help +- Change default local binding address into 127.0.0.1 + +1.3.4 2014-02-17 +- Fix a bug when no config file exists +- Client now support multiple server ports and multiple server/port pairs +- Better error message with bad config.json format and wrong password + +1.3.3 2013-07-09 +- Fix default key length of rc2 + +1.3.2 2013-07-04 +- Server will listen at server IP specified in config +- Check config file and show some warning messages + +1.3.1 2013-06-29 +- Fix -c arg + +1.3.0 2013-06-22 +- Move to pypi + +1.2.3 2013-06-14 +- add bind address + +1.2.2 2013-05-31 +- local can listen at ::0 with -6 arg; bump 1.2.2 + +1.2.1 2013-05-23 +- Fix an OpenSSL crash + +1.2 2013-05-22 +- Use random iv, we finally have strong encryption + +1.1.1 2013-05-21 +- Add encryption, AES, blowfish, etc. + +1.1 2013-05-16 +- Support IPv6 addresses (type 4) +- Drop Python 2.5 support + +1.0 2013-04-03 +- Fix -6 IPv6 + +0.9.4 2013-03-04 +- Support Python 2.5 + +0.9.3 2013-01-14 +- Fix conn termination null data + +0.9.2 2013-01-05 +- Change default timeout + +0.9.1 2013-01-05 +- Add Travis-CI test + +0.9 2012-12-30 +- Replace send with sendall, fix FreeBSD + +0.6 2012-12-06 +- Support args + +0.5 2012-11-08 +- Fix encryption with negative md5sum + +0.4 2012-11-02 +- Move config into a JSON file +- Auto-detect config path + +0.3 2012-06-06 +- Move socks5 negotiation to local + +0.2 2012-05-11 +- Add -6 arg for IPv6 +- Fix socket.error + +0.1 2012-04-20 +- Initial version diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/CONTRIBUTING.md b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/CONTRIBUTING.md new file mode 100644 index 00000000000000..fbdb9c11b222df --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/CONTRIBUTING.md @@ -0,0 +1,29 @@ +How to Contribute +================= + +Pull Requests +------------- + +1. Pull requests are welcome. If you would like to add a large feature +or make a significant change, make sure to open an issue to discuss with +people first. +2. Follow PEP8. +3. Make sure to pass the unit tests. Write unit tests for new modules if +needed. + +Issues +------ + +1. Only bugs and feature requests are accepted here. +2. We'll only work on important features. If the feature you're asking only +benefits a few people, you'd better implement the feature yourself and send us +a pull request, or ask some of your friends to do so. +3. We don't answer questions of any other types here. Since very few people +are watching the issue tracker here, you'll probably get no help from here. +Read [Troubleshooting] and get help from forums or [mailing lists]. +4. Issues in languages other than English will be Google translated into English +later. + + +[Troubleshooting]: https://github.com/clowwindy/shadowsocks/wiki/Troubleshooting +[mailing lists]: https://groups.google.com/forum/#!forum/shadowsocks diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/Dockerfile b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/Dockerfile new file mode 100644 index 00000000000000..ec7b2c6e712ab5 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/Dockerfile @@ -0,0 +1,31 @@ +FROM alpine:3.6 + +ENV SERVER_ADDR 0.0.0.0 +ENV SERVER_PORT 51348 +ENV PASSWORD psw +ENV METHOD aes-128-ctr +ENV PROTOCOL auth_aes128_md5 +ENV PROTOCOLPARAM 32 +ENV OBFS tls1.2_ticket_auth_compatible +ENV TIMEOUT 300 +ENV DNS_ADDR 8.8.8.8 +ENV DNS_ADDR_2 8.8.4.4 + +ARG BRANCH=manyuser +ARG WORK=~ + + +RUN apk --no-cache add python \ + libsodium \ + wget + + +RUN mkdir -p $WORK && \ + wget -qO- --no-check-certificate https://github.com/shadowsocksr/shadowsocksr/archive/$BRANCH.tar.gz | tar -xzf - -C $WORK + + +WORKDIR $WORK/shadowsocksr-$BRANCH/shadowsocks + + +EXPOSE $SERVER_PORT +CMD python server.py -p $SERVER_PORT -k $PASSWORD -m $METHOD -O $PROTOCOL -o $OBFS -G $PROTOCOLPARAM diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/LICENSE b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/LICENSE new file mode 100644 index 00000000000000..d645695673349e --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/MANIFEST.in b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/MANIFEST.in new file mode 100644 index 00000000000000..1882dd7dcef69b --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/MANIFEST.in @@ -0,0 +1,3 @@ +recursive-include shadowsocks *.py +include README.rst +include LICENSE diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/README.md b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/README.md new file mode 100644 index 00000000000000..53eafeaa8ef5f3 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/README.md @@ -0,0 +1,105 @@ +ShadowsocksR +=========== + +[![Build Status]][Travis CI] + +A fast tunnel proxy that helps you bypass firewalls. + +Server +------ + +### Install + +Debian / Ubuntu: + + apt-get install git + git clone https://github.com/shadowsocksr/shadowsocksr.git + +CentOS: + + yum install git + git clone https://github.com/shadowsocksr/shadowsocksr.git + +Windows: + + git clone https://github.com/shadowsocksr/shadowsocksr.git + +### Usage for single user on linux platform + +If you clone it into "~/shadowsocksr" +move to "~/shadowsocksr", then run: + + bash initcfg.sh + +move to "~/shadowsocksr/shadowsocks", then run: + + python server.py -p 443 -k password -m aes-128-cfb -O auth_aes128_md5 -o tls1.2_ticket_auth_compatible + +Check all the options via `-h`. + +You can also use a configuration file instead (recommend), move to "~/shadowsocksr" and edit the file "user-config.json", then move to "~/shadowsocksr/shadowsocks" again, just run: + + python server.py + +To run in the background: + + ./logrun.sh + +To stop: + + ./stop.sh + +To monitor the log: + + ./tail.sh + + +Client +------ + +* [Windows] / [macOS] +* [Android] / [iOS] +* [OpenWRT] + +Use GUI clients on your local PC/phones. Check the README of your client +for more information. + +Documentation +------------- + +You can find all the documentation in the [Wiki]. + +License +------- + +Copyright 2015 clowwindy + +Licensed under the Apache License, Version 2.0 (the "License"); you may +not use this file except in compliance with the License. You may obtain +a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations +under the License. + +Bugs and Issues +---------------- + +* [Issue Tracker] + + + +[Android]: https://github.com/shadowsocksr/shadowsocksr-android +[Build Status]: https://travis-ci.org/shadowsocksr/shadowsocksr.svg?branch=manyuser +[Debian sid]: https://packages.debian.org/unstable/python/shadowsocks +[iOS]: https://github.com/shadowsocks/shadowsocks-iOS/wiki/Help +[Issue Tracker]: https://github.com/shadowsocksr/shadowsocksr/issues?state=open +[OpenWRT]: https://github.com/shadowsocks/openwrt-shadowsocks +[macOS]: https://github.com/shadowsocksr/ShadowsocksX-NG +[Travis CI]: https://travis-ci.org/shadowsocksr/shadowsocksr +[Windows]: https://github.com/shadowsocksr/shadowsocksr-csharp +[Wiki]: https://github.com/breakwa11/shadowsocks-rss/wiki diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/README.rst b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/README.rst new file mode 100644 index 00000000000000..bf2a3ec32d0224 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/README.rst @@ -0,0 +1,113 @@ +shadowsocks +=========== + +|PyPI version| |Build Status| |Coverage Status| + +A fast tunnel proxy that helps you bypass firewalls. + +Server +------ + +Install +~~~~~~~ + +Debian / Ubuntu: + +:: + + apt-get install python-pip + pip install shadowsocks + +CentOS: + +:: + + yum install python-setuptools && easy_install pip + pip install shadowsocks + +Windows: + +See `Install Server on +Windows `__ + +Usage +~~~~~ + +:: + + ssserver -p 443 -k password -m rc4-md5 + +To run in the background: + +:: + + sudo ssserver -p 443 -k password -m rc4-md5 --user nobody -d start + +To stop: + +:: + + sudo ssserver -d stop + +To check the log: + +:: + + sudo less /var/log/shadowsocks.log + +Check all the options via ``-h``. You can also use a +`Configuration `__ +file instead. + +Client +------ + +- `Windows `__ + / `OS + X `__ +- `Android `__ + / `iOS `__ +- `OpenWRT `__ + +Use GUI clients on your local PC/phones. Check the README of your client +for more information. + +Documentation +------------- + +You can find all the documentation in the +`Wiki `__. + +License +------- + +Copyright 2015 clowwindy + +Licensed under the Apache License, Version 2.0 (the "License"); you may +not use this file except in compliance with the License. You may obtain +a copy of the License at + +:: + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Bugs and Issues +--------------- + +- `Troubleshooting `__ +- `Issue + Tracker `__ +- `Mailing list `__ + +.. |PyPI version| image:: https://img.shields.io/pypi/v/shadowsocks.svg?style=flat + :target: https://pypi.python.org/pypi/shadowsocks +.. |Build Status| image:: https://img.shields.io/travis/shadowsocks/shadowsocks/master.svg?style=flat + :target: https://travis-ci.org/shadowsocks/shadowsocks +.. |Coverage Status| image:: https://jenkins.shadowvpn.org/result/shadowsocks + :target: https://jenkins.shadowvpn.org/job/Shadowsocks/ws/PYENV/py34/label/linux/htmlcov/index.html diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/apiconfig.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/apiconfig.py new file mode 100644 index 00000000000000..5ee8be127f91a0 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/apiconfig.py @@ -0,0 +1,15 @@ +# Config +API_INTERFACE = 'sspanelv2' #mudbjson, sspanelv2, sspanelv3, sspanelv3ssr, glzjinmod, legendsockssr, muapiv2(not support) +UPDATE_TIME = 60 +SERVER_PUB_ADDR = '127.0.0.1' # mujson_mgr need this to generate ssr link + +#mudb +MUDB_FILE = 'mudb.json' + +# Mysql +MYSQL_CONFIG = 'usermysql.json' + +# API +MUAPI_CONFIG = 'usermuapi.json' + + diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/asyncmgr.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/asyncmgr.py new file mode 100644 index 00000000000000..9bf4d093607b24 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/asyncmgr.py @@ -0,0 +1,99 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Copyright (c) 2014 clowwindy +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +import time +import os +import socket +import struct +import re +import logging +from shadowsocks import common +from shadowsocks import lru_cache +from shadowsocks import eventloop +import server_pool +import Config + +class ServerMgr(object): + + def __init__(self): + self._loop = None + self._request_id = 1 + self._hosts = {} + self._hostname_status = {} + self._hostname_to_cb = {} + self._cb_to_hostname = {} + self._last_time = time.time() + self._sock = None + self._servers = None + + def add_to_loop(self, loop): + if self._loop: + raise Exception('already add to loop') + self._loop = loop + # TODO when dns server is IPv6 + self._sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, + socket.SOL_UDP) + self._sock.bind((Config.MANAGE_BIND_IP, Config.MANAGE_PORT)) + self._sock.setblocking(False) + loop.add(self._sock, eventloop.POLL_IN, self) + + def _handle_data(self, sock): + data, addr = sock.recvfrom(128) + #manage pwd:port:passwd:action + args = data.split(':') + if len(args) < 4: + return + if args[0] == Config.MANAGE_PASS: + if args[3] == '0': + server_pool.ServerPool.get_instance().cb_del_server(args[1]) + elif args[3] == '1': + server_pool.ServerPool.get_instance().new_server(args[1], args[2]) + + def handle_event(self, sock, fd, event): + if sock != self._sock: + return + if event & eventloop.POLL_ERR: + logging.error('mgr socket err') + self._loop.remove(self._sock) + self._sock.close() + # TODO when dns server is IPv6 + self._sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, + socket.SOL_UDP) + self._sock.setblocking(False) + self._loop.add(self._sock, eventloop.POLL_IN, self) + else: + self._handle_data(sock) + + def close(self): + if self._sock: + if self._loop: + self._loop.remove(self._sock) + self._sock.close() + self._sock = None + + +def test(): + pass + +if __name__ == '__main__': + test() diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/config.json b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/config.json new file mode 100644 index 00000000000000..55f12b5f4c9ce4 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/config.json @@ -0,0 +1,25 @@ +{ + "server": "0.0.0.0", + "server_ipv6": "::", + "server_port": 8388, + "local_address": "127.0.0.1", + "local_port": 1080, + + "password": "m", + "method": "aes-128-ctr", + "protocol": "auth_aes128_md5", + "protocol_param": "", + "obfs": "tls1.2_ticket_auth_compatible", + "obfs_param": "", + "speed_limit_per_con": 0, + "speed_limit_per_user": 0, + + "additional_ports" : {}, // only works under multi-user mode + "additional_ports_only" : false, // only works under multi-user mode + "timeout": 120, + "udp_timeout": 60, + "dns_ipv6": false, + "connect_verbose_info": 0, + "redirect": "", + "fast_open": false +} diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/configloader.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/configloader.py new file mode 100644 index 00000000000000..cf9d61961bb8a0 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/configloader.py @@ -0,0 +1,15 @@ +#!/usr/bin/python +# -*- coding: UTF-8 -*- +import importloader + +g_config = None + +def load_config(): + global g_config + g_config = importloader.loads(['userapiconfig', 'apiconfig']) + +def get_config(): + return g_config + +load_config() + diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/db_transfer.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/db_transfer.py new file mode 100644 index 00000000000000..67bda608341d7d --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/db_transfer.py @@ -0,0 +1,631 @@ +#!/usr/bin/python +# -*- coding: UTF-8 -*- + +import logging +import time +import sys +from server_pool import ServerPool +import traceback +from shadowsocks import common, shell, lru_cache, obfs +from configloader import load_config, get_config +import importloader + +switchrule = None +db_instance = None + +class TransferBase(object): + def __init__(self): + import threading + self.event = threading.Event() + self.key_list = ['port', 'u', 'd', 'transfer_enable', 'passwd', 'enable'] + self.last_get_transfer = {} #上一次的实际流量 + self.last_update_transfer = {} #上一次更新到的流量(小于等于实际流量) + self.force_update_transfer = set() #强制推入数据库的ID + self.port_uid_table = {} #端口到uid的映射(仅v3以上有用) + self.onlineuser_cache = lru_cache.LRUCache(timeout=60*30) #用户在线状态记录 + self.pull_ok = False #记录是否已经拉出过数据 + self.mu_ports = {} + + def load_cfg(self): + pass + + def push_db_all_user(self): + if self.pull_ok is False: + return + #更新用户流量到数据库 + last_transfer = self.last_update_transfer + curr_transfer = ServerPool.get_instance().get_servers_transfer() + #上次和本次的增量 + dt_transfer = {} + for id in self.force_update_transfer: #此表中的用户统计上次未计入的流量 + if id in self.last_get_transfer and id in last_transfer: + dt_transfer[id] = [self.last_get_transfer[id][0] - last_transfer[id][0], self.last_get_transfer[id][1] - last_transfer[id][1]] + + for id in curr_transfer.keys(): + if id in self.force_update_transfer or id in self.mu_ports: + continue + #算出与上次记录的流量差值,保存于dt_transfer表 + if id in last_transfer: + if curr_transfer[id][0] + curr_transfer[id][1] - last_transfer[id][0] - last_transfer[id][1] <= 0: + continue + dt_transfer[id] = [curr_transfer[id][0] - last_transfer[id][0], + curr_transfer[id][1] - last_transfer[id][1]] + else: + if curr_transfer[id][0] + curr_transfer[id][1] <= 0: + continue + dt_transfer[id] = [curr_transfer[id][0], curr_transfer[id][1]] + + #有流量的,先记录在线状态 + if id in self.last_get_transfer: + if curr_transfer[id][0] + curr_transfer[id][1] > self.last_get_transfer[id][0] + self.last_get_transfer[id][1]: + self.onlineuser_cache[id] = curr_transfer[id][0] + curr_transfer[id][1] + else: + self.onlineuser_cache[id] = curr_transfer[id][0] + curr_transfer[id][1] + + self.onlineuser_cache.sweep() + + update_transfer = self.update_all_user(dt_transfer) #返回有更新的表 + for id in update_transfer.keys(): #其增量加在此表 + if id not in self.force_update_transfer: #但排除在force_update_transfer内的 + last = self.last_update_transfer.get(id, [0,0]) + self.last_update_transfer[id] = [last[0] + update_transfer[id][0], last[1] + update_transfer[id][1]] + self.last_get_transfer = curr_transfer + for id in self.force_update_transfer: + if id in self.last_update_transfer: + del self.last_update_transfer[id] + if id in self.last_get_transfer: + del self.last_get_transfer[id] + self.force_update_transfer = set() + + def del_server_out_of_bound_safe(self, last_rows, rows): + #停止超流量的服务 + #启动没超流量的服务 + try: + switchrule = importloader.load('switchrule') + except Exception as e: + logging.error('load switchrule.py fail') + cur_servers = {} + new_servers = {} + allow_users = {} + mu_servers = {} + config = shell.get_config(False) + for row in rows: + try: + allow = switchrule.isTurnOn(row) and row['enable'] == 1 and row['u'] + row['d'] < row['transfer_enable'] + except Exception as e: + allow = False + + port = row['port'] + passwd = common.to_bytes(row['passwd']) + if hasattr(passwd, 'encode'): + passwd = passwd.encode('utf-8') + cfg = {'password': passwd} + if 'id' in row: + self.port_uid_table[row['port']] = row['id'] + + read_config_keys = ['method', 'obfs', 'obfs_param', 'protocol', 'protocol_param', 'forbidden_ip', 'forbidden_port', 'speed_limit_per_con', 'speed_limit_per_user'] + for name in read_config_keys: + if name in row and row[name]: + cfg[name] = row[name] + + merge_config_keys = ['password'] + read_config_keys + for name in cfg.keys(): + if hasattr(cfg[name], 'encode'): + try: + cfg[name] = cfg[name].encode('utf-8') + except Exception as e: + logging.warning('encode cfg key "%s" fail, val "%s"' % (name, cfg[name])) + + if port not in cur_servers: + cur_servers[port] = passwd + else: + logging.error('more than one user use the same port [%s]' % (port,)) + continue + + if 'protocol' in cfg and 'protocol_param' in cfg and common.to_str(cfg['protocol']) in obfs.mu_protocol(): + if '#' in common.to_str(cfg['protocol_param']): + mu_servers[port] = passwd + allow = True + + if allow: + if port not in mu_servers: + allow_users[port] = cfg + + cfgchange = False + if port in ServerPool.get_instance().tcp_servers_pool: + relay = ServerPool.get_instance().tcp_servers_pool[port] + for name in merge_config_keys: + if name in cfg and not self.cmp(cfg[name], relay._config[name]): + cfgchange = True + break + if not cfgchange and port in ServerPool.get_instance().tcp_ipv6_servers_pool: + relay = ServerPool.get_instance().tcp_ipv6_servers_pool[port] + for name in merge_config_keys: + if (name in cfg) and ((name not in relay._config) or not self.cmp(cfg[name], relay._config[name])): + cfgchange = True + break + + if port in mu_servers: + if ServerPool.get_instance().server_is_run(port) > 0: + if cfgchange: + logging.info('db stop server at port [%s] reason: config changed: %s' % (port, cfg)) + ServerPool.get_instance().cb_del_server(port) + self.force_update_transfer.add(port) + new_servers[port] = (passwd, cfg) + else: + self.new_server(port, passwd, cfg) + else: + if ServerPool.get_instance().server_is_run(port) > 0: + if config['additional_ports_only'] or not allow: + logging.info('db stop server at port [%s]' % (port,)) + ServerPool.get_instance().cb_del_server(port) + self.force_update_transfer.add(port) + else: + if cfgchange: + logging.info('db stop server at port [%s] reason: config changed: %s' % (port, cfg)) + ServerPool.get_instance().cb_del_server(port) + self.force_update_transfer.add(port) + new_servers[port] = (passwd, cfg) + + elif not config['additional_ports_only'] and allow and port > 0 and port < 65536 and ServerPool.get_instance().server_run_status(port) is False: + self.new_server(port, passwd, cfg) + + for row in last_rows: + if row['port'] in cur_servers: + pass + else: + logging.info('db stop server at port [%s] reason: port not exist' % (row['port'])) + ServerPool.get_instance().cb_del_server(row['port']) + self.clear_cache(row['port']) + if row['port'] in self.port_uid_table: + del self.port_uid_table[row['port']] + + if len(new_servers) > 0: + from shadowsocks import eventloop + self.event.wait(eventloop.TIMEOUT_PRECISION + eventloop.TIMEOUT_PRECISION / 2) + for port in new_servers.keys(): + passwd, cfg = new_servers[port] + self.new_server(port, passwd, cfg) + + logging.debug('db allow users %s \nmu_servers %s' % (allow_users, mu_servers)) + for port in mu_servers: + ServerPool.get_instance().update_mu_users(port, allow_users) + + self.mu_ports = mu_servers + + def clear_cache(self, port): + if port in self.force_update_transfer: del self.force_update_transfer[port] + if port in self.last_get_transfer: del self.last_get_transfer[port] + if port in self.last_update_transfer: del self.last_update_transfer[port] + + def new_server(self, port, passwd, cfg): + protocol = cfg.get('protocol', ServerPool.get_instance().config.get('protocol', 'origin')) + method = cfg.get('method', ServerPool.get_instance().config.get('method', 'None')) + obfs = cfg.get('obfs', ServerPool.get_instance().config.get('obfs', 'plain')) + logging.info('db start server at port [%s] pass [%s] protocol [%s] method [%s] obfs [%s]' % (port, passwd, protocol, method, obfs)) + ServerPool.get_instance().new_server(port, cfg) + + def cmp(self, val1, val2): + if type(val1) is bytes: + val1 = common.to_str(val1) + if type(val2) is bytes: + val2 = common.to_str(val2) + return val1 == val2 + + @staticmethod + def del_servers(): + for port in [v for v in ServerPool.get_instance().tcp_servers_pool.keys()]: + if ServerPool.get_instance().server_is_run(port) > 0: + ServerPool.get_instance().cb_del_server(port) + for port in [v for v in ServerPool.get_instance().tcp_ipv6_servers_pool.keys()]: + if ServerPool.get_instance().server_is_run(port) > 0: + ServerPool.get_instance().cb_del_server(port) + + @staticmethod + def thread_db(obj): + import socket + import time + global db_instance + timeout = 60 + socket.setdefaulttimeout(timeout) + last_rows = [] + db_instance = obj() + ServerPool.get_instance() + shell.log_shadowsocks_version() + + try: + import resource + logging.info('current process RLIMIT_NOFILE resource: soft %d hard %d' % resource.getrlimit(resource.RLIMIT_NOFILE)) + except: + pass + + try: + while True: + load_config() + db_instance.load_cfg() + try: + db_instance.push_db_all_user() + rows = db_instance.pull_db_all_user() + if rows: + db_instance.pull_ok = True + config = shell.get_config(False) + for port in config['additional_ports']: + val = config['additional_ports'][port] + val['port'] = int(port) + val['enable'] = 1 + val['transfer_enable'] = 1024 ** 7 + val['u'] = 0 + val['d'] = 0 + if "password" in val: + val["passwd"] = val["password"] + rows.append(val) + db_instance.del_server_out_of_bound_safe(last_rows, rows) + last_rows = rows + except Exception as e: + trace = traceback.format_exc() + logging.error(trace) + #logging.warn('db thread except:%s' % e) + if db_instance.event.wait(get_config().UPDATE_TIME) or not ServerPool.get_instance().thread.is_alive(): + break + except KeyboardInterrupt as e: + pass + db_instance.del_servers() + ServerPool.get_instance().stop() + db_instance = None + + @staticmethod + def thread_db_stop(): + global db_instance + db_instance.event.set() + +class DbTransfer(TransferBase): + def __init__(self): + super(DbTransfer, self).__init__() + self.user_pass = {} #记录更新此用户流量时被跳过多少次 + self.cfg = { + "host": "127.0.0.1", + "port": 3306, + "user": "ss", + "password": "pass", + "db": "shadowsocks", + "node_id": 0, + "transfer_mul": 1.0, + "ssl_enable": 0, + "ssl_ca": "", + "ssl_cert": "", + "ssl_key": ""} + self.load_cfg() + + def load_cfg(self): + import json + config_path = get_config().MYSQL_CONFIG + cfg = None + with open(config_path, 'rb+') as f: + cfg = json.loads(f.read().decode('utf8')) + + if cfg: + self.cfg.update(cfg) + + def update_all_user(self, dt_transfer): + import cymysql + update_transfer = {} + + query_head = 'UPDATE user' + query_sub_when = '' + query_sub_when2 = '' + query_sub_in = None + last_time = time.time() + + for id in dt_transfer.keys(): + transfer = dt_transfer[id] + #小于最低更新流量的先不更新 + update_trs = 1024 * (2048 - self.user_pass.get(id, 0) * 64) + if transfer[0] + transfer[1] < update_trs and id not in self.force_update_transfer: + self.user_pass[id] = self.user_pass.get(id, 0) + 1 + continue + if id in self.user_pass: + del self.user_pass[id] + + query_sub_when += ' WHEN %s THEN u+%s' % (id, int(transfer[0] * self.cfg["transfer_mul"])) + query_sub_when2 += ' WHEN %s THEN d+%s' % (id, int(transfer[1] * self.cfg["transfer_mul"])) + update_transfer[id] = transfer + + if query_sub_in is not None: + query_sub_in += ',%s' % id + else: + query_sub_in = '%s' % id + + if query_sub_when == '': + return update_transfer + query_sql = query_head + ' SET u = CASE port' + query_sub_when + \ + ' END, d = CASE port' + query_sub_when2 + \ + ' END, t = ' + str(int(last_time)) + \ + ' WHERE port IN (%s)' % query_sub_in + if self.cfg["ssl_enable"] == 1: + conn = cymysql.connect(host=self.cfg["host"], port=self.cfg["port"], + user=self.cfg["user"], passwd=self.cfg["password"], + db=self.cfg["db"], charset='utf8', + ssl={'ca':self.cfg["ssl_ca"],'cert':self.cfg["ssl_cert"],'key':self.cfg["ssl_key"]}) + else: + conn = cymysql.connect(host=self.cfg["host"], port=self.cfg["port"], + user=self.cfg["user"], passwd=self.cfg["password"], + db=self.cfg["db"], charset='utf8') + + try: + cur = conn.cursor() + try: + cur.execute(query_sql) + except Exception as e: + logging.error(e) + update_transfer = {} + + cur.close() + conn.commit() + except Exception as e: + logging.error(e) + update_transfer = {} + finally: + conn.close() + + return update_transfer + + def pull_db_all_user(self): + import cymysql + #数据库所有用户信息 + if self.cfg["ssl_enable"] == 1: + conn = cymysql.connect(host=self.cfg["host"], port=self.cfg["port"], + user=self.cfg["user"], passwd=self.cfg["password"], + db=self.cfg["db"], charset='utf8', + ssl={'ca':self.cfg["ssl_ca"],'cert':self.cfg["ssl_cert"],'key':self.cfg["ssl_key"]}) + else: + conn = cymysql.connect(host=self.cfg["host"], port=self.cfg["port"], + user=self.cfg["user"], passwd=self.cfg["password"], + db=self.cfg["db"], charset='utf8') + + try: + rows = self.pull_db_users(conn) + finally: + conn.close() + + if not rows: + logging.warn('no user in db') + return rows + + def pull_db_users(self, conn): + try: + switchrule = importloader.load('switchrule') + keys = switchrule.getKeys(self.key_list) + except Exception as e: + keys = self.key_list + + cur = conn.cursor() + cur.execute("SELECT " + ','.join(keys) + " FROM user") + rows = [] + for r in cur.fetchall(): + d = {} + for column in range(len(keys)): + d[keys[column]] = r[column] + rows.append(d) + cur.close() + return rows + +class Dbv3Transfer(DbTransfer): + def __init__(self): + super(Dbv3Transfer, self).__init__() + self.update_node_state = True if get_config().API_INTERFACE != 'legendsockssr' else False + if self.update_node_state: + self.key_list += ['id'] + self.key_list += ['method'] + if self.update_node_state: + self.ss_node_info_name = 'ss_node_info_log' + if get_config().API_INTERFACE == 'sspanelv3ssr': + self.key_list += ['obfs', 'protocol'] + if get_config().API_INTERFACE == 'glzjinmod': + self.key_list += ['obfs', 'protocol'] + self.ss_node_info_name = 'ss_node_info' + else: + self.key_list += ['obfs', 'protocol'] + self.start_time = time.time() + + def update_all_user(self, dt_transfer): + import cymysql + update_transfer = {} + + query_head = 'UPDATE user' + query_sub_when = '' + query_sub_when2 = '' + query_sub_in = None + last_time = time.time() + + alive_user_count = len(self.onlineuser_cache) + bandwidth_thistime = 0 + + if self.cfg["ssl_enable"] == 1: + conn = cymysql.connect(host=self.cfg["host"], port=self.cfg["port"], + user=self.cfg["user"], passwd=self.cfg["password"], + db=self.cfg["db"], charset='utf8', + ssl={'ca':self.cfg["ssl_ca"],'cert':self.cfg["ssl_cert"],'key':self.cfg["ssl_key"]}) + else: + conn = cymysql.connect(host=self.cfg["host"], port=self.cfg["port"], + user=self.cfg["user"], passwd=self.cfg["password"], + db=self.cfg["db"], charset='utf8') + conn.autocommit(True) + + for id in dt_transfer.keys(): + transfer = dt_transfer[id] + bandwidth_thistime = bandwidth_thistime + transfer[0] + transfer[1] + + update_trs = 1024 * (2048 - self.user_pass.get(id, 0) * 64) + if transfer[0] + transfer[1] < update_trs: + self.user_pass[id] = self.user_pass.get(id, 0) + 1 + continue + if id in self.user_pass: + del self.user_pass[id] + + query_sub_when += ' WHEN %s THEN u+%s' % (id, int(transfer[0] * self.cfg["transfer_mul"])) + query_sub_when2 += ' WHEN %s THEN d+%s' % (id, int(transfer[1] * self.cfg["transfer_mul"])) + update_transfer[id] = transfer + + if self.update_node_state: + cur = conn.cursor() + try: + if id in self.port_uid_table: + cur.execute("INSERT INTO `user_traffic_log` (`id`, `user_id`, `u`, `d`, `node_id`, `rate`, `traffic`, `log_time`) VALUES (NULL, '" + \ + str(self.port_uid_table[id]) + "', '" + str(transfer[0]) + "', '" + str(transfer[1]) + "', '" + \ + str(self.cfg["node_id"]) + "', '" + str(self.cfg["transfer_mul"]) + "', '" + \ + self.traffic_format((transfer[0] + transfer[1]) * self.cfg["transfer_mul"]) + "', unix_timestamp()); ") + except: + logging.warn('no `user_traffic_log` in db') + cur.close() + + if query_sub_in is not None: + query_sub_in += ',%s' % id + else: + query_sub_in = '%s' % id + + if query_sub_when != '': + query_sql = query_head + ' SET u = CASE port' + query_sub_when + \ + ' END, d = CASE port' + query_sub_when2 + \ + ' END, t = ' + str(int(last_time)) + \ + ' WHERE port IN (%s)' % query_sub_in + cur = conn.cursor() + try: + cur.execute(query_sql) + except Exception as e: + logging.error(e) + cur.close() + + if self.update_node_state: + try: + cur = conn.cursor() + try: + cur.execute("INSERT INTO `ss_node_online_log` (`id`, `node_id`, `online_user`, `log_time`) VALUES (NULL, '" + \ + str(self.cfg["node_id"]) + "', '" + str(alive_user_count) + "', unix_timestamp()); ") + except Exception as e: + logging.error(e) + cur.close() + + cur = conn.cursor() + try: + cur.execute("INSERT INTO `" + self.ss_node_info_name + "` (`id`, `node_id`, `uptime`, `load`, `log_time`) VALUES (NULL, '" + \ + str(self.cfg["node_id"]) + "', '" + str(self.uptime()) + "', '" + \ + str(self.load()) + "', unix_timestamp()); ") + except Exception as e: + logging.error(e) + cur.close() + except: + logging.warn('no `ss_node_online_log` or `" + self.ss_node_info_name + "` in db') + + conn.close() + return update_transfer + + def pull_db_users(self, conn): + try: + switchrule = importloader.load('switchrule') + keys = switchrule.getKeys(self.key_list) + except Exception as e: + keys = self.key_list + + cur = conn.cursor() + + if self.update_node_state: + node_info_keys = ['traffic_rate'] + try: + cur.execute("SELECT " + ','.join(node_info_keys) +" FROM ss_node where `id`='" + str(self.cfg["node_id"]) + "'") + nodeinfo = cur.fetchone() + except Exception as e: + logging.error(e) + nodeinfo = None + + if nodeinfo == None: + rows = [] + cur.close() + conn.commit() + logging.warn('None result when select node info from ss_node in db, maybe you set the incorrect node id') + return rows + cur.close() + + node_info_dict = {} + for column in range(len(nodeinfo)): + node_info_dict[node_info_keys[column]] = nodeinfo[column] + self.cfg['transfer_mul'] = float(node_info_dict['traffic_rate']) + + cur = conn.cursor() + try: + rows = [] + cur.execute("SELECT " + ','.join(keys) + " FROM user") + for r in cur.fetchall(): + d = {} + for column in range(len(keys)): + d[keys[column]] = r[column] + rows.append(d) + except Exception as e: + logging.error(e) + cur.close() + return rows + + def load(self): + import os + return os.popen("cat /proc/loadavg | awk '{ print $1\" \"$2\" \"$3 }'").readlines()[0] + + def uptime(self): + return time.time() - self.start_time + + def traffic_format(self, traffic): + if traffic < 1024 * 8: + return str(int(traffic)) + "B"; + + if traffic < 1024 * 1024 * 2: + return str(round((traffic / 1024.0), 2)) + "KB"; + + return str(round((traffic / 1048576.0), 2)) + "MB"; + +class MuJsonTransfer(TransferBase): + def __init__(self): + super(MuJsonTransfer, self).__init__() + + def update_all_user(self, dt_transfer): + import json + rows = None + + config_path = get_config().MUDB_FILE + with open(config_path, 'rb+') as f: + rows = json.loads(f.read().decode('utf8')) + for row in rows: + if "port" in row: + port = row["port"] + if port in dt_transfer: + row["u"] += dt_transfer[port][0] + row["d"] += dt_transfer[port][1] + + if rows: + output = json.dumps(rows, sort_keys=True, indent=4, separators=(',', ': ')) + with open(config_path, 'r+') as f: + f.write(output) + f.truncate() + + return dt_transfer + + def pull_db_all_user(self): + import json + rows = None + + config_path = get_config().MUDB_FILE + with open(config_path, 'rb+') as f: + rows = json.loads(f.read().decode('utf8')) + for row in rows: + try: + if 'forbidden_ip' in row: + row['forbidden_ip'] = common.IPNetwork(row['forbidden_ip']) + except Exception as e: + logging.error(e) + try: + if 'forbidden_port' in row: + row['forbidden_port'] = common.PortRange(row['forbidden_port']) + except Exception as e: + logging.error(e) + + if not rows: + logging.warn('no user in json file') + return rows + diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/changelog b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/changelog new file mode 100644 index 00000000000000..4e7ad163f6dc08 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/changelog @@ -0,0 +1,5 @@ +shadowsocks (2.1.0-1) unstable; urgency=low + + * Initial release (Closes: #758900) + + -- Shell.Xu Sat, 23 Aug 2014 00:56:04 +0800 diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/compat b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/compat new file mode 100644 index 00000000000000..45a4fb75db8640 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/compat @@ -0,0 +1 @@ +8 diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/config.json b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/config.json new file mode 100644 index 00000000000000..35cb14a6ccb31a --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/config.json @@ -0,0 +1,11 @@ +{ + "server":"my_server_ip", + "server_port":8388, + "local_address": "127.0.0.1", + "local_port":1080, + "password":"mypassword", + "timeout":300, + "method":"aes-256-cfb", + "fast_open": false, + "workers": 1 +} \ No newline at end of file diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/control b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/control new file mode 100644 index 00000000000000..da0092004d4989 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/control @@ -0,0 +1,19 @@ +Source: shadowsocks +Section: python +Priority: extra +Maintainer: Shell.Xu +Build-Depends: debhelper (>= 8), python-all (>= 2.6.6-3~), python-setuptools +Standards-Version: 3.9.5 +Homepage: https://github.com/clowwindy/shadowsocks +Vcs-Git: git://github.com/shell909090/shadowsocks.git +Vcs-Browser: http://github.com/shell909090/shadowsocks + +Package: shadowsocks +Architecture: all +Pre-Depends: dpkg (>= 1.15.6~) +Depends: ${misc:Depends}, ${python:Depends}, python-pkg-resources, python-m2crypto +Description: Fast tunnel proxy that helps you bypass firewalls + A secure socks5 proxy, designed to protect your Internet traffic. + . + This package contain local and server part of shadowsocks, a fast, + powerful tunnel proxy to bypass firewalls. \ No newline at end of file diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/copyright b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/copyright new file mode 100644 index 00000000000000..7be81625ef0e10 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/copyright @@ -0,0 +1,30 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: shadowsocks +Source: https://github.com/clowwindy/shadowsocks + +Files: debian/* +Copyright: 2014 Shell.Xu +License: Expat + +Files: * +Copyright: 2014 clowwindy +License: Expat + +License: Expat + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/docs b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/docs new file mode 100644 index 00000000000000..0208fc1fed8206 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/docs @@ -0,0 +1,2 @@ +README.md +README.rst diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/init.d b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/init.d new file mode 100644 index 00000000000000..2f4f3521e3c1b8 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/init.d @@ -0,0 +1,149 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: shadowsocks +# Required-Start: $network $local_fs $remote_fs +# Required-Stop: $network $local_fs $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Fast tunnel proxy that helps you bypass firewalls +# Description: A secure socks5 proxy, designed to protect your Internet traffic. +# This package contain local and server part of shadowsocks, a fast, +# powerful tunnel proxy to bypass firewalls. +### END INIT INFO + +# Author: Shell.Xu + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC=shadowsocks # Introduce a short description here +NAME=shadowsocks # Introduce the short server's name here +DAEMON=/usr/bin/ssserver # Introduce the server's location here +DAEMON_ARGS="" # Arguments to run the daemon with +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME +LOGFILE=/var/log/$NAME.log + +# Exit if the package is not installed +[ -x $DAEMON ] || exit 0 + +# Read configuration variable file if it is present +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +# Load the VERBOSE setting and other rcS variables +. /lib/init/vars.sh + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. +. /lib/lsb/init-functions + +# +# Function that starts the daemon/service +# +do_start() +{ + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \ + --background --make-pidfile --chdir / --chuid $USERID --no-close --test > /dev/null \ + || return 1 + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \ + --background --make-pidfile --chdir / --chuid $USERID --no-close -- \ + $DAEMON_ARGS $DAEMON_OPTS >> $LOGFILE 2>&1 \ + || return 2 + # Add code here, if necessary, that waits for the process to be ready + # to handle requests from services started subsequently which depend + # on this one. As a last resort, sleep for some time. +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE + RETVAL="$?" + [ "$RETVAL" = 2 ] && return 2 + # Many daemons don't delete their pidfiles when they exit. + rm -f $PIDFILE + return "$RETVAL" +} + +# +# Function that sends a SIGHUP to the daemon/service +# +do_reload() { + # + # If the daemon can reload its configuration without + # restarting (for example, when it is sent a SIGHUP), + # then implement that here. + # + start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME + return 0 +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + #reload|force-reload) + # + # If do_reload() is not implemented then leave this commented out + # and leave 'force-reload' as an alias for 'restart'. + # + #log_daemon_msg "Reloading $DESC" "$NAME" + #do_reload + #log_end_msg $? + #;; + restart|force-reload) + # + # If the "reload" option is implemented then remove the + # 'force-reload' alias + # + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/install b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/install new file mode 100644 index 00000000000000..a61486462f691e --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/install @@ -0,0 +1 @@ +debian/config.json etc/shadowsocks/ \ No newline at end of file diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/rules b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/rules new file mode 100644 index 00000000000000..62e2bb6f6f845b --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/rules @@ -0,0 +1,5 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +%: + dh $@ --with python2 --buildsystem=python_distutils diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/shadowsocks.default b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/shadowsocks.default new file mode 100644 index 00000000000000..a5206027975467 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/shadowsocks.default @@ -0,0 +1,12 @@ +# Defaults for shadowsocks initscript +# sourced by /etc/init.d/shadowsocks +# installed at /etc/default/shadowsocks by the maintainer scripts + +USERID="nobody" + +# +# This is a POSIX shell fragment +# + +# Additional options that are passed to the Daemon. +DAEMON_OPTS="-q -c /etc/shadowsocks/config.json" diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/shadowsocks.manpages b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/shadowsocks.manpages new file mode 100644 index 00000000000000..3df8a3341b35a0 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/shadowsocks.manpages @@ -0,0 +1,2 @@ +debian/sslocal.1 +debian/ssserver.1 \ No newline at end of file diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/source/format b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/source/format new file mode 100644 index 00000000000000..163aaf8d82b6c5 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/sslocal.1 b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/sslocal.1 new file mode 100644 index 00000000000000..0c2cf516596b6f --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/sslocal.1 @@ -0,0 +1,59 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" (C) Copyright 2014 Shell.Xu , +.\" +.TH SHADOWSOCKS 1 "August 23, 2014" +.SH NAME +shadowsocks \- Fast tunnel proxy that helps you bypass firewalls +.SH SYNOPSIS +.B ssserver +.RI [ options ] +.br +.B sslocal +.RI [ options ] +.SH DESCRIPTION +shadowsocks is a tunnel proxy helps you bypass firewall. +.B ssserver +is the server part, and +.B sslocal +is the local part. +.SH OPTIONS +.TP +.B \-h, \-\-help +Show this help message and exit. +.TP +.B \-s SERVER_ADDR +Server address, default: 0.0.0.0. +.TP +.B \-p SERVER_PORT +Server port, default: 8388. +.TP +.B \-k PASSWORD +Password. +.TP +.B \-m METHOD +Encryption method, default: aes-256-cfb. +.TP +.B \-t TIMEOUT +Timeout in seconds, default: 300. +.TP +.B \-c CONFIG +Path to config file. +.TP +.B \-\-fast-open +Use TCP_FASTOPEN, requires Linux 3.7+. +.TP +.B \-\-workers WORKERS +Number of workers, available on Unix/Linux. +.TP +.B \-v, \-vv +Verbose mode. +.TP +.B \-q, \-qq +Quiet mode, only show warnings/errors. +.SH SEE ALSO +.br +The programs are documented fully by +.IR "Shell Xu " +and +.IR "Clowwindy ", +available via the Info system. diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/ssserver.1 b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/ssserver.1 new file mode 100644 index 00000000000000..0c2cf516596b6f --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/debian/ssserver.1 @@ -0,0 +1,59 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" (C) Copyright 2014 Shell.Xu , +.\" +.TH SHADOWSOCKS 1 "August 23, 2014" +.SH NAME +shadowsocks \- Fast tunnel proxy that helps you bypass firewalls +.SH SYNOPSIS +.B ssserver +.RI [ options ] +.br +.B sslocal +.RI [ options ] +.SH DESCRIPTION +shadowsocks is a tunnel proxy helps you bypass firewall. +.B ssserver +is the server part, and +.B sslocal +is the local part. +.SH OPTIONS +.TP +.B \-h, \-\-help +Show this help message and exit. +.TP +.B \-s SERVER_ADDR +Server address, default: 0.0.0.0. +.TP +.B \-p SERVER_PORT +Server port, default: 8388. +.TP +.B \-k PASSWORD +Password. +.TP +.B \-m METHOD +Encryption method, default: aes-256-cfb. +.TP +.B \-t TIMEOUT +Timeout in seconds, default: 300. +.TP +.B \-c CONFIG +Path to config file. +.TP +.B \-\-fast-open +Use TCP_FASTOPEN, requires Linux 3.7+. +.TP +.B \-\-workers WORKERS +Number of workers, available on Unix/Linux. +.TP +.B \-v, \-vv +Verbose mode. +.TP +.B \-q, \-qq +Quiet mode, only show warnings/errors. +.SH SEE ALSO +.br +The programs are documented fully by +.IR "Shell Xu " +and +.IR "Clowwindy ", +available via the Info system. diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/importloader.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/importloader.py new file mode 100644 index 00000000000000..c917cb7d953aaa --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/importloader.py @@ -0,0 +1,24 @@ +#!/usr/bin/python +# -*- coding: UTF-8 -*- + +def load(name): + try: + obj = __import__(name) + reload(obj) + return obj + except: + pass + + try: + import importlib + obj = importlib.__import__(name) + importlib.reload(obj) + return obj + except: + pass + +def loads(namelist): + for name in namelist: + obj = load(name) + if obj is not None: + return obj diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/initcfg.bat b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/initcfg.bat new file mode 100644 index 00000000000000..6d0bce695a9185 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/initcfg.bat @@ -0,0 +1,4 @@ +@echo off +If Not Exist "userapiconfig.py" Copy "apiconfig.py" "userapiconfig.py" +If Not Exist "user-config.json" Copy "config.json" "user-config.json" +If Not Exist "usermysql.json" Copy "mysql.json" "usermysql.json" diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/initcfg.sh b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/initcfg.sh new file mode 100644 index 00000000000000..862d1abed11607 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/initcfg.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +chmod +x *.sh +chmod +x shadowsocks/*.sh +cp -n apiconfig.py userapiconfig.py +cp -n config.json user-config.json +cp -n mysql.json usermysql.json + diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/initmudbjson.sh b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/initmudbjson.sh new file mode 100644 index 00000000000000..09b07f3322107e --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/initmudbjson.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +bash initcfg.sh +sed -i "s/API_INTERFACE = .\+\?\#/API_INTERFACE = \'mudbjson\' \#/g" userapiconfig.py +ip_addr=`ifconfig -a|grep inet|grep -v inet6|grep -v "127.0.0."|grep -v -e "192\.168\..[0-9]\+\.[0-9]\+"|grep -v -e "10\.[0-9]\+\.[0-9]\+\.[0-9]\+"|awk '{print $2}'|tr -d "addr:"` +ip_count=`echo $ip_addr|grep -e "^[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+$" -c` + +if [[ $ip_count == 1 ]]; then + ip_addr=`ip a|grep inet|grep -v inet6|grep -v "127.0.0."|grep -v -e "192\.168\..[0-9]\+\.[0-9]\+"|grep -v -e "10\.[0-9]\+\.[0-9]\+\.[0-9]\+"|awk '{print $2}'` + ip_addr=${ip_addr%/*} + ip_count=`echo $ip_addr|grep -e "^[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+$" -c` +fi +if [[ $ip_count == 1 ]]; then + echo "server IP is "${ip_addr} + sed -i "s/SERVER_PUB_ADDR = .\+/SERVER_PUB_ADDR = \'"${ip_addr}"\'/g" userapiconfig.py + user_count=`python mujson_mgr.py -l|grep -c -e "[0-9]"` + if [[ $user_count == 0 ]]; then + port=`python -c 'import random;print(random.randint(10000, 65536))'` + python mujson_mgr.py -a -p ${port} + fi +else + echo "unable to detect server IP" +fi + diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/logrun.sh b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/logrun.sh new file mode 100644 index 00000000000000..94153fe9e2d234 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/logrun.sh @@ -0,0 +1,7 @@ +#!/bin/bash +cd `dirname $0` +python_ver=$(ls /usr/bin|grep -e "^python[23]\.[1-9]\+$"|tail -1) +eval $(ps -ef | grep "[0-9] ${python_ver} server\\.py m" | awk '{print "kill "$2}') +ulimit -n 512000 +nohup ${python_ver} server.py m>> ssserver.log 2>&1 & + diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/mudb.json b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/mudb.json new file mode 100644 index 00000000000000..0d4f101c7a37a4 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/mudb.json @@ -0,0 +1,2 @@ +[ +] diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/mujson_mgr.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/mujson_mgr.py new file mode 100644 index 00000000000000..2eb05d59d14475 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/mujson_mgr.py @@ -0,0 +1,358 @@ +#!/usr/bin/python +# -*- coding: UTF-8 -*- + +import traceback +from shadowsocks import shell, common +from configloader import load_config, get_config +import random +import getopt +import sys +import json +import base64 + + +class MuJsonLoader(object): + def __init__(self): + self.json = None + + def load(self, path): + l = "[]" + try: + with open(path, 'rb+') as f: + l = f.read().decode('utf8') + except: + pass + self.json = json.loads(l) + + def save(self, path): + if self.json is not None: + output = json.dumps(self.json, sort_keys=True, indent=4, separators=(',', ': ')) + with open(path, 'a'): + pass + with open(path, 'rb+') as f: + f.write(output.encode('utf8')) + f.truncate() + + +class MuMgr(object): + def __init__(self): + self.config_path = get_config().MUDB_FILE + try: + self.server_addr = get_config().SERVER_PUB_ADDR + except: + self.server_addr = '127.0.0.1' + self.data = MuJsonLoader() + + if self.server_addr == '127.0.0.1': + self.server_addr = self.getipaddr() + + def getipaddr(self, ifname='eth0'): + import socket + import struct + ret = '127.0.0.1' + try: + ret = socket.gethostbyname(socket.getfqdn(socket.gethostname())) + except: + pass + if ret == '127.0.0.1': + try: + import fcntl + s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + ret = socket.inet_ntoa(fcntl.ioctl(s.fileno(), 0x8915, struct.pack('256s', ifname[:15]))[20:24]) + except: + pass + return ret + + def ssrlink(self, user, encode, muid): + protocol = user.get('protocol', '') + obfs = user.get('obfs', '') + protocol = protocol.replace("_compatible", "") + obfs = obfs.replace("_compatible", "") + protocol_param = '' + if muid is not None: + protocol_param_ = user.get('protocol_param', '') + param = protocol_param_.split('#') + if len(param) == 2: + for row in self.data.json: + if int(row['port']) == muid: + param = str(muid) + ':' + row['passwd'] + protocol_param = '/?protoparam=' + common.to_str(base64.urlsafe_b64encode(common.to_bytes(param))).replace("=", "") + break + link = ("%s:%s:%s:%s:%s:%s" % (self.server_addr, user['port'], protocol, user['method'], obfs, common.to_str(base64.urlsafe_b64encode(common.to_bytes(user['passwd']))).replace("=", ""))) + protocol_param + return "ssr://" + (encode and common.to_str(base64.urlsafe_b64encode(common.to_bytes(link))).replace("=", "") or link) + + def userinfo(self, user, muid = None): + ret = "" + key_list = ['user', 'port', 'method', 'passwd', 'protocol', 'protocol_param', 'obfs', 'obfs_param', 'transfer_enable', 'u', 'd'] + for key in sorted(user): + if key not in key_list: + key_list.append(key) + for key in key_list: + if key in ['enable'] or key not in user: + continue + ret += '\n' + if (muid is not None) and (key in ['protocol_param']): + for row in self.data.json: + if int(row['port']) == muid: + ret += " %s : %s" % (key, str(muid) + ':' + row['passwd']) + break + elif key in ['transfer_enable', 'u', 'd']: + if muid is not None: + for row in self.data.json: + if int(row['port']) == muid: + val = row[key] + break + else: + val = user[key] + if val / 1024 < 4: + ret += " %s : %s" % (key, val) + elif val / 1024 ** 2 < 4: + val /= float(1024) + ret += " %s : %s K Bytes" % (key, val) + elif val / 1024 ** 3 < 4: + val /= float(1024 ** 2) + ret += " %s : %s M Bytes" % (key, val) + else: + val /= float(1024 ** 3) + ret += " %s : %s G Bytes" % (key, val) + else: + ret += " %s : %s" % (key, user[key]) + ret += "\n " + self.ssrlink(user, False, muid) + ret += "\n " + self.ssrlink(user, True, muid) + return ret + + def rand_pass(self): + return ''.join([random.choice('''ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789~-_=+(){}[]^&%$@''') for i in range(8)]) + + def add(self, user): + up = {'enable': 1, 'u': 0, 'd': 0, 'method': "aes-128-ctr", + 'protocol': "auth_aes128_md5", + 'obfs': "tls1.2_ticket_auth_compatible", + 'transfer_enable': 9007199254740992} + up['passwd'] = self.rand_pass() + up.update(user) + + self.data.load(self.config_path) + for row in self.data.json: + match = False + if 'user' in user and row['user'] == user['user']: + match = True + if 'port' in user and row['port'] == user['port']: + match = True + if match: + print("user [%s] port [%s] already exist" % (row['user'], row['port'])) + return + self.data.json.append(up) + print("### add user info %s" % self.userinfo(up)) + self.data.save(self.config_path) + + def edit(self, user): + self.data.load(self.config_path) + for row in self.data.json: + match = True + if 'user' in user and row['user'] != user['user']: + match = False + if 'port' in user and row['port'] != user['port']: + match = False + if match: + print("edit user [%s]" % (row['user'],)) + row.update(user) + print("### new user info %s" % self.userinfo(row)) + break + self.data.save(self.config_path) + + def delete(self, user): + self.data.load(self.config_path) + index = 0 + for row in self.data.json: + match = True + if 'user' in user and row['user'] != user['user']: + match = False + if 'port' in user and row['port'] != user['port']: + match = False + if match: + print("delete user [%s]" % row['user']) + del self.data.json[index] + break + index += 1 + self.data.save(self.config_path) + + def clear_ud(self, user): + up = {'u': 0, 'd': 0} + self.data.load(self.config_path) + for row in self.data.json: + match = True + if 'user' in user and row['user'] != user['user']: + match = False + if 'port' in user and row['port'] != user['port']: + match = False + if match: + row.update(up) + print("clear user [%s]" % row['user']) + self.data.save(self.config_path) + + def list_user(self, user): + self.data.load(self.config_path) + if not user: + for row in self.data.json: + print("user [%s] port %s" % (row['user'], row['port'])) + return + for row in self.data.json: + match = True + if 'user' in user and row['user'] != user['user']: + match = False + if 'port' in user and row['port'] != user['port']: + match = False + if match: + muid = None + if 'muid' in user: + muid = user['muid'] + print("### user [%s] info %s" % (row['user'], self.userinfo(row, muid))) + + +def print_server_help(): + print('''usage: python mujson_manage.py -a|-d|-e|-c|-l [OPTION]... + +Actions: + -a add/edit a user + -d delete a user + -e edit a user + -c set u&d to zero + -l display a user infomation or all users infomation + +Options: + -u USER the user name + -p PORT server port (only this option must be set if add a user) + -k PASSWORD password + -m METHOD encryption method, default: aes-128-ctr + -O PROTOCOL protocol plugin, default: auth_aes128_md5 + -o OBFS obfs plugin, default: tls1.2_ticket_auth_compatible + -G PROTOCOL_PARAM protocol plugin param + -g OBFS_PARAM obfs plugin param + -t TRANSFER max transfer for G bytes, default: 8388608 (8 PB or 8192 TB) + -f FORBID set forbidden ports. Example (ban 1~79 and 81~100): -f "1-79,81-100" + -i MUID set sub id to display (only work with -l) + -s SPEED set speed_limit_per_con + -S SPEED set speed_limit_per_user + +General options: + -h, --help show this help message and exit +''') + + +def main(): + shortopts = 'adeclu:i:p:k:O:o:G:g:m:t:f:hs:S:' + longopts = ['help'] + action = None + user = {} + fast_set_obfs = {'0': 'plain', + '+1': 'http_simple_compatible', + '1': 'http_simple', + '+2': 'tls1.2_ticket_auth_compatible', + '2': 'tls1.2_ticket_auth'} + fast_set_protocol = {'0': 'origin', + 's4': 'auth_sha1_v4', + '+s4': 'auth_sha1_v4_compatible', + 'am': 'auth_aes128_md5', + 'as': 'auth_aes128_sha1', + 'ca': 'auth_chain_a', + } + fast_set_method = {'0': 'none', + 'a1c': 'aes-128-cfb', + 'a2c': 'aes-192-cfb', + 'a3c': 'aes-256-cfb', + 'r': 'rc4-md5', + 'r6': 'rc4-md5-6', + 'c': 'chacha20', + 'ci': 'chacha20-ietf', + 's': 'salsa20', + 'a1': 'aes-128-ctr', + 'a2': 'aes-192-ctr', + 'a3': 'aes-256-ctr'} + try: + optlist, args = getopt.getopt(sys.argv[1:], shortopts, longopts) + for key, value in optlist: + if key == '-a': + action = 1 + elif key == '-d': + action = 2 + elif key == '-e': + action = 3 + elif key == '-l': + action = 4 + elif key == '-c': + action = 0 + elif key == '-u': + user['user'] = value + elif key == '-i': + user['muid'] = int(value) + elif key == '-p': + user['port'] = int(value) + elif key == '-k': + user['passwd'] = value + elif key == '-o': + if value in fast_set_obfs: + user['obfs'] = fast_set_obfs[value] + else: + user['obfs'] = value + elif key == '-O': + if value in fast_set_protocol: + user['protocol'] = fast_set_protocol[value] + else: + user['protocol'] = value + elif key == '-g': + user['obfs_param'] = value + elif key == '-G': + user['protocol_param'] = value + elif key == '-s': + user['speed_limit_per_con'] = int(value) + elif key == '-S': + user['speed_limit_per_user'] = int(value) + elif key == '-m': + if value in fast_set_method: + user['method'] = fast_set_method[value] + else: + user['method'] = value + elif key == '-f': + user['forbidden_port'] = value + elif key == '-t': + val = float(value) + try: + val = int(value) + except: + pass + user['transfer_enable'] = int(val * 1024) * (1024 ** 2) + elif key in ('-h', '--help'): + print_server_help() + sys.exit(0) + except getopt.GetoptError as e: + print(e) + sys.exit(2) + + manage = MuMgr() + if action == 0: + manage.clear_ud(user) + elif action == 1: + if 'user' not in user and 'port' in user: + user['user'] = str(user['port']) + if 'user' in user and 'port' in user: + manage.add(user) + else: + print("You have to set the port with -p") + elif action == 2: + if 'user' in user or 'port' in user: + manage.delete(user) + else: + print("You have to set the user name or port with -u/-p") + elif action == 3: + if 'user' in user or 'port' in user: + manage.edit(user) + else: + print("You have to set the user name or port with -u/-p") + elif action == 4: + manage.list_user(user) + elif action is None: + print_server_help() + +if __name__ == '__main__': + main() diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/mysql.json b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/mysql.json new file mode 100644 index 00000000000000..1849e9e81672ec --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/mysql.json @@ -0,0 +1,13 @@ +{ + "host": "127.0.0.1", + "port": 3306, + "user": "ss", + "password": "pass", + "db": "sspanel", + "node_id": 0, + "transfer_mul": 1.0, + "ssl_enable": 0, + "ssl_ca": "", + "ssl_cert": "", + "ssl_key": "" +} diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/run.sh b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/run.sh new file mode 100644 index 00000000000000..0de8d204ce3acf --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/run.sh @@ -0,0 +1,7 @@ +#!/bin/bash +cd `dirname $0` +python_ver=$(ls /usr/bin|grep -e "^python[23]\.[1-9]\+$"|tail -1) +eval $(ps -ef | grep "[0-9] ${python_ver} server\\.py m" | awk '{print "kill "$2}') +ulimit -n 512000 +nohup ${python_ver} server.py m>> /dev/null 2>&1 & + diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/server.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/server.py new file mode 100644 index 00000000000000..ba863b68402495 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/server.py @@ -0,0 +1,66 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright 2015 breakwall +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import time +import sys +import threading +import os + +if __name__ == '__main__': + import inspect + os.chdir(os.path.dirname(os.path.realpath(inspect.getfile(inspect.currentframe())))) + +import server_pool +import db_transfer +from shadowsocks import shell +from configloader import load_config, get_config + +class MainThread(threading.Thread): + def __init__(self, obj): + super(MainThread, self).__init__() + self.daemon = True + self.obj = obj + + def run(self): + self.obj.thread_db(self.obj) + + def stop(self): + self.obj.thread_db_stop() + +def main(): + shell.check_python() + if False: + db_transfer.DbTransfer.thread_db() + else: + if get_config().API_INTERFACE == 'mudbjson': + thread = MainThread(db_transfer.MuJsonTransfer) + elif get_config().API_INTERFACE == 'sspanelv2': + thread = MainThread(db_transfer.DbTransfer) + else: + thread = MainThread(db_transfer.Dbv3Transfer) + thread.start() + try: + while thread.is_alive(): + thread.join(10.0) + except (KeyboardInterrupt, IOError, OSError) as e: + import traceback + traceback.print_exc() + thread.stop() + +if __name__ == '__main__': + main() + diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/server_pool.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/server_pool.py new file mode 100644 index 00000000000000..d159817a3f5e5d --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/server_pool.py @@ -0,0 +1,293 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Copyright (c) 2014 clowwindy +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +import os +import logging +import struct +import time +from shadowsocks import shell, eventloop, tcprelay, udprelay, asyncdns, common +import threading +import sys +import traceback +from socket import * +from configloader import load_config, get_config + +class MainThread(threading.Thread): + def __init__(self, params): + super(MainThread, self).__init__() + self.params = params + + def run(self): + ServerPool._loop(*self.params) + +class ServerPool(object): + + instance = None + + def __init__(self): + shell.check_python() + self.config = shell.get_config(False) + self.dns_resolver = asyncdns.DNSResolver() + if not self.config.get('dns_ipv6', False): + asyncdns.IPV6_CONNECTION_SUPPORT = False + + self.mgr = None #asyncmgr.ServerMgr() + + self.tcp_servers_pool = {} + self.tcp_ipv6_servers_pool = {} + self.udp_servers_pool = {} + self.udp_ipv6_servers_pool = {} + self.stat_counter = {} + + self.loop = eventloop.EventLoop() + self.thread = MainThread( (self.loop, self.dns_resolver, self.mgr) ) + self.thread.start() + + @staticmethod + def get_instance(): + if ServerPool.instance is None: + ServerPool.instance = ServerPool() + return ServerPool.instance + + def stop(self): + self.loop.stop() + + @staticmethod + def _loop(loop, dns_resolver, mgr): + try: + if mgr is not None: + mgr.add_to_loop(loop) + dns_resolver.add_to_loop(loop) + loop.run() + except (KeyboardInterrupt, IOError, OSError) as e: + logging.error(e) + traceback.print_exc() + os.exit(0) + except Exception as e: + logging.error(e) + traceback.print_exc() + + def server_is_run(self, port): + port = int(port) + ret = 0 + if port in self.tcp_servers_pool: + ret = 1 + if port in self.tcp_ipv6_servers_pool: + ret |= 2 + return ret + + def server_run_status(self, port): + if 'server' in self.config: + if port not in self.tcp_servers_pool: + return False + if 'server_ipv6' in self.config: + if port not in self.tcp_ipv6_servers_pool: + return False + return True + + def new_server(self, port, user_config): + ret = True + port = int(port) + ipv6_ok = False + + if 'server_ipv6' in self.config: + if port in self.tcp_ipv6_servers_pool: + logging.info("server already at %s:%d" % (self.config['server_ipv6'], port)) + return 'this port server is already running' + else: + a_config = self.config.copy() + a_config.update(user_config) + if len(a_config['server_ipv6']) > 2 and a_config['server_ipv6'][0] == "[" and a_config['server_ipv6'][-1] == "]": + a_config['server_ipv6'] = a_config['server_ipv6'][1:-1] + a_config['server'] = a_config['server_ipv6'] + a_config['server_port'] = port + a_config['max_connect'] = 128 + a_config['method'] = common.to_str(a_config['method']) + try: + logging.info("starting server at [%s]:%d" % (common.to_str(a_config['server']), port)) + + tcp_server = tcprelay.TCPRelay(a_config, self.dns_resolver, False, stat_counter=self.stat_counter) + tcp_server.add_to_loop(self.loop) + self.tcp_ipv6_servers_pool.update({port: tcp_server}) + + udp_server = udprelay.UDPRelay(a_config, self.dns_resolver, False, stat_counter=self.stat_counter) + udp_server.add_to_loop(self.loop) + self.udp_ipv6_servers_pool.update({port: udp_server}) + + if common.to_str(a_config['server_ipv6']) == "::": + ipv6_ok = True + except Exception as e: + logging.warn("IPV6 %s " % (e,)) + + if 'server' in self.config: + if port in self.tcp_servers_pool: + logging.info("server already at %s:%d" % (common.to_str(self.config['server']), port)) + return 'this port server is already running' + else: + a_config = self.config.copy() + a_config.update(user_config) + a_config['server_port'] = port + a_config['max_connect'] = 128 + a_config['method'] = common.to_str(a_config['method']) + try: + logging.info("starting server at %s:%d" % (common.to_str(a_config['server']), port)) + + tcp_server = tcprelay.TCPRelay(a_config, self.dns_resolver, False) + tcp_server.add_to_loop(self.loop) + self.tcp_servers_pool.update({port: tcp_server}) + + udp_server = udprelay.UDPRelay(a_config, self.dns_resolver, False) + udp_server.add_to_loop(self.loop) + self.udp_servers_pool.update({port: udp_server}) + + except Exception as e: + if not ipv6_ok: + logging.warn("IPV4 %s " % (e,)) + + return True + + def del_server(self, port): + port = int(port) + logging.info("del server at %d" % port) + try: + udpsock = socket(AF_INET, SOCK_DGRAM) + udpsock.sendto('%s:%s:0:0' % (get_config().MANAGE_PASS, port), (get_config().MANAGE_BIND_IP, get_config().MANAGE_PORT)) + udpsock.close() + except Exception as e: + logging.warn(e) + return True + + def cb_del_server(self, port): + port = int(port) + + if port not in self.tcp_servers_pool: + logging.info("stopped server at %s:%d already stop" % (self.config['server'], port)) + else: + logging.info("stopped server at %s:%d" % (self.config['server'], port)) + try: + self.tcp_servers_pool[port].close(True) + del self.tcp_servers_pool[port] + except Exception as e: + logging.warn(e) + try: + self.udp_servers_pool[port].close(True) + del self.udp_servers_pool[port] + except Exception as e: + logging.warn(e) + + if 'server_ipv6' in self.config: + if port not in self.tcp_ipv6_servers_pool: + logging.info("stopped server at [%s]:%d already stop" % (self.config['server_ipv6'], port)) + else: + logging.info("stopped server at [%s]:%d" % (self.config['server_ipv6'], port)) + try: + self.tcp_ipv6_servers_pool[port].close(True) + del self.tcp_ipv6_servers_pool[port] + except Exception as e: + logging.warn(e) + try: + self.udp_ipv6_servers_pool[port].close(True) + del self.udp_ipv6_servers_pool[port] + except Exception as e: + logging.warn(e) + + return True + + def update_mu_users(self, port, users): + port = int(port) + if port in self.tcp_servers_pool: + try: + self.tcp_servers_pool[port].update_users(users) + except Exception as e: + logging.warn(e) + try: + self.udp_servers_pool[port].update_users(users) + except Exception as e: + logging.warn(e) + if port in self.tcp_ipv6_servers_pool: + try: + self.tcp_ipv6_servers_pool[port].update_users(users) + except Exception as e: + logging.warn(e) + try: + self.udp_ipv6_servers_pool[port].update_users(users) + except Exception as e: + logging.warn(e) + + def get_server_transfer(self, port): + port = int(port) + uid = struct.pack(' 63: + return None + results.append(common.chr(l)) + results.append(label) + results.append(b'\0') + return b''.join(results) + + +def build_request(address, qtype): + request_id = os.urandom(2) + header = struct.pack('!BBHHHH', 1, 0, 1, 0, 0, 0) + addr = build_address(address) + qtype_qclass = struct.pack('!HH', qtype, QCLASS_IN) + return request_id + header + addr + qtype_qclass + + +def parse_ip(addrtype, data, length, offset): + if addrtype == QTYPE_A: + return socket.inet_ntop(socket.AF_INET, data[offset:offset + length]) + elif addrtype == QTYPE_AAAA: + return socket.inet_ntop(socket.AF_INET6, data[offset:offset + length]) + elif addrtype in [QTYPE_CNAME, QTYPE_NS]: + return parse_name(data, offset)[1] + else: + return data[offset:offset + length] + + +def parse_name(data, offset): + p = offset + labels = [] + l = common.ord(data[p]) + while l > 0: + if (l & (128 + 64)) == (128 + 64): + # pointer + pointer = struct.unpack('!H', data[p:p + 2])[0] + pointer &= 0x3FFF + r = parse_name(data, pointer) + labels.append(r[1]) + p += 2 + # pointer is the end + return p - offset, b'.'.join(labels) + else: + labels.append(data[p + 1:p + 1 + l]) + p += 1 + l + l = common.ord(data[p]) + return p - offset + 1, b'.'.join(labels) + + +# rfc1035 +# record +# 1 1 1 1 1 1 +# 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +# +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +# | | +# / / +# / NAME / +# | | +# +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +# | TYPE | +# +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +# | CLASS | +# +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +# | TTL | +# | | +# +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +# | RDLENGTH | +# +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| +# / RDATA / +# / / +# +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +def parse_record(data, offset, question=False): + nlen, name = parse_name(data, offset) + if not question: + record_type, record_class, record_ttl, record_rdlength = struct.unpack( + '!HHiH', data[offset + nlen:offset + nlen + 10] + ) + ip = parse_ip(record_type, data, record_rdlength, offset + nlen + 10) + return nlen + 10 + record_rdlength, \ + (name, ip, record_type, record_class, record_ttl) + else: + record_type, record_class = struct.unpack( + '!HH', data[offset + nlen:offset + nlen + 4] + ) + return nlen + 4, (name, None, record_type, record_class, None, None) + + +def parse_header(data): + if len(data) >= 12: + header = struct.unpack('!HBBHHHH', data[:12]) + res_id = header[0] + res_qr = header[1] & 128 + res_tc = header[1] & 2 + res_ra = header[2] & 128 + res_rcode = header[2] & 15 + # assert res_tc == 0 + # assert res_rcode in [0, 3] + res_qdcount = header[3] + res_ancount = header[4] + res_nscount = header[5] + res_arcount = header[6] + return (res_id, res_qr, res_tc, res_ra, res_rcode, res_qdcount, + res_ancount, res_nscount, res_arcount) + return None + + +def parse_response(data): + try: + if len(data) >= 12: + header = parse_header(data) + if not header: + return None + res_id, res_qr, res_tc, res_ra, res_rcode, res_qdcount, \ + res_ancount, res_nscount, res_arcount = header + + qds = [] + ans = [] + offset = 12 + for i in range(0, res_qdcount): + l, r = parse_record(data, offset, True) + offset += l + if r: + qds.append(r) + for i in range(0, res_ancount): + l, r = parse_record(data, offset) + offset += l + if r: + ans.append(r) + for i in range(0, res_nscount): + l, r = parse_record(data, offset) + offset += l + for i in range(0, res_arcount): + l, r = parse_record(data, offset) + offset += l + response = DNSResponse() + if qds: + response.hostname = qds[0][0] + for an in qds: + response.questions.append((an[1], an[2], an[3])) + for an in ans: + response.answers.append((an[1], an[2], an[3])) + return response + except Exception as e: + shell.print_exception(e) + return None + + +def is_valid_hostname(hostname): + if len(hostname) > 255: + return False + if hostname[-1] == b'.': + hostname = hostname[:-1] + return all(VALID_HOSTNAME.match(x) for x in hostname.split(b'.')) + + +class DNSResponse(object): + def __init__(self): + self.hostname = None + self.questions = [] # each: (addr, type, class) + self.answers = [] # each: (addr, type, class) + + def __str__(self): + return '%s: %s' % (self.hostname, str(self.answers)) + + +STATUS_IPV4 = 0 +STATUS_IPV6 = 1 + + +class DNSResolver(object): + def __init__(self, black_hostname_list=None): + self._loop = None + self._hosts = {} + self._hostname_status = {} + self._hostname_to_cb = {} + self._cb_to_hostname = {} + self._cache = lru_cache.LRUCache(timeout=300) + # read black_hostname_list from config + if type(black_hostname_list) != list: + self._black_hostname_list = [] + else: + self._black_hostname_list = list(map( + (lambda t: t if type(t) == bytes else t.encode('utf8')), + black_hostname_list + )) + logging.info('black_hostname_list init as : ' + str(self._black_hostname_list)) + self._sock = None + self._servers = None + self._parse_resolv() + self._parse_hosts() + # TODO monitor hosts change and reload hosts + # TODO parse /etc/gai.conf and follow its rules + + def _parse_resolv(self): + self._servers = [] + try: + with open('dns.conf', 'rb') as f: + content = f.readlines() + for line in content: + line = line.strip() + if line: + parts = line.split(b' ', 1) + if len(parts) >= 2: + server = parts[0] + port = int(parts[1]) + else: + server = parts[0] + port = 53 + if common.is_ip(server) == socket.AF_INET: + if type(server) != str: + server = server.decode('utf8') + self._servers.append((server, port)) + except IOError: + pass + if not self._servers: + try: + with open('/etc/resolv.conf', 'rb') as f: + content = f.readlines() + for line in content: + line = line.strip() + if line: + if line.startswith(b'nameserver'): + parts = line.split() + if len(parts) >= 2: + server = parts[1] + if common.is_ip(server) == socket.AF_INET: + if type(server) != str: + server = server.decode('utf8') + self._servers.append((server, 53)) + except IOError: + pass + if not self._servers: + self._servers = [('8.8.4.4', 53), ('8.8.8.8', 53)] + logging.info('dns server: %s' % (self._servers,)) + + def _parse_hosts(self): + etc_path = '/etc/hosts' + if 'WINDIR' in os.environ: + etc_path = os.environ['WINDIR'] + '/system32/drivers/etc/hosts' + try: + with open(etc_path, 'rb') as f: + for line in f.readlines(): + line = line.strip() + if b"#" in line: + line = line[:line.find(b'#')] + parts = line.split() + if len(parts) >= 2: + ip = parts[0] + if common.is_ip(ip): + for i in range(1, len(parts)): + hostname = parts[i] + if hostname: + self._hosts[hostname] = ip + except IOError: + self._hosts['localhost'] = '127.0.0.1' + + def add_to_loop(self, loop): + if self._loop: + raise Exception('already add to loop') + self._loop = loop + # TODO when dns server is IPv6 + self._sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, + socket.SOL_UDP) + self._sock.setblocking(False) + loop.add(self._sock, eventloop.POLL_IN, self) + loop.add_periodic(self.handle_periodic) + + def _call_callback(self, hostname, ip, error=None): + callbacks = self._hostname_to_cb.get(hostname, []) + for callback in callbacks: + if callback in self._cb_to_hostname: + del self._cb_to_hostname[callback] + if ip or error: + callback((hostname, ip), error) + else: + callback((hostname, None), + Exception('unable to parse hostname %s' % hostname)) + if hostname in self._hostname_to_cb: + del self._hostname_to_cb[hostname] + if hostname in self._hostname_status: + del self._hostname_status[hostname] + + def _handle_data(self, data): + response = parse_response(data) + if response and response.hostname: + hostname = response.hostname + ip = None + for answer in response.answers: + if answer[1] in (QTYPE_A, QTYPE_AAAA) and \ + answer[2] == QCLASS_IN: + ip = answer[0] + break + if IPV6_CONNECTION_SUPPORT: + if not ip and self._hostname_status.get(hostname, STATUS_IPV4) \ + == STATUS_IPV6: + self._hostname_status[hostname] = STATUS_IPV4 + self._send_req(hostname, QTYPE_A) + else: + if ip: + self._cache[hostname] = ip + self._call_callback(hostname, ip) + elif self._hostname_status.get(hostname, None) == STATUS_IPV4: + for question in response.questions: + if question[1] == QTYPE_A: + self._call_callback(hostname, None) + break + else: + if not ip and self._hostname_status.get(hostname, STATUS_IPV6) \ + == STATUS_IPV4: + self._hostname_status[hostname] = STATUS_IPV6 + self._send_req(hostname, QTYPE_AAAA) + else: + if ip: + self._cache[hostname] = ip + self._call_callback(hostname, ip) + elif self._hostname_status.get(hostname, None) == STATUS_IPV6: + for question in response.questions: + if question[1] == QTYPE_AAAA: + self._call_callback(hostname, None) + break + + def handle_event(self, sock, fd, event): + if sock != self._sock: + return + if event & eventloop.POLL_ERR: + logging.error('dns socket err') + self._loop.remove(self._sock) + self._sock.close() + # TODO when dns server is IPv6 + self._sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, + socket.SOL_UDP) + self._sock.setblocking(False) + self._loop.add(self._sock, eventloop.POLL_IN, self) + else: + data, addr = sock.recvfrom(1024) + if addr not in self._servers: + logging.warn('received a packet other than our dns') + return + self._handle_data(data) + + def handle_periodic(self): + self._cache.sweep() + + def remove_callback(self, callback): + hostname = self._cb_to_hostname.get(callback) + if hostname: + del self._cb_to_hostname[callback] + arr = self._hostname_to_cb.get(hostname, None) + if arr: + arr.remove(callback) + if not arr: + del self._hostname_to_cb[hostname] + if hostname in self._hostname_status: + del self._hostname_status[hostname] + + def _send_req(self, hostname, qtype): + req = build_request(hostname, qtype) + for server in self._servers: + logging.debug('resolving %s with type %d using server %s', + hostname, qtype, server) + self._sock.sendto(req, server) + + def resolve(self, hostname, callback): + if type(hostname) != bytes: + hostname = hostname.encode('utf8') + if not hostname: + callback(None, Exception('empty hostname')) + elif common.is_ip(hostname): + callback((hostname, hostname), None) + elif hostname in self._hosts: + logging.debug('hit hosts: %s', hostname) + ip = self._hosts[hostname] + callback((hostname, ip), None) + elif hostname in self._cache: + logging.debug('hit cache: %s ==>> %s', hostname, self._cache[hostname]) + ip = self._cache[hostname] + callback((hostname, ip), None) + elif any(hostname.endswith(t) for t in self._black_hostname_list): + callback(None, Exception('hostname <%s> is block by the black hostname list' % hostname)) + return + else: + if not is_valid_hostname(hostname): + callback(None, Exception('invalid hostname: %s' % hostname)) + return + if False: + addrs = socket.getaddrinfo(hostname, 0, 0, + socket.SOCK_DGRAM, socket.SOL_UDP) + if addrs: + af, socktype, proto, canonname, sa = addrs[0] + logging.debug('DNS resolve %s %s' % (hostname, sa[0])) + self._cache[hostname] = sa[0] + callback((hostname, sa[0]), None) + return + arr = self._hostname_to_cb.get(hostname, None) + if not arr: + if IPV6_CONNECTION_SUPPORT: + self._hostname_status[hostname] = STATUS_IPV6 + self._send_req(hostname, QTYPE_AAAA) + else: + self._hostname_status[hostname] = STATUS_IPV4 + self._send_req(hostname, QTYPE_A) + self._hostname_to_cb[hostname] = [callback] + self._cb_to_hostname[callback] = hostname + else: + arr.append(callback) + # TODO send again only if waited too long + if IPV6_CONNECTION_SUPPORT: + self._send_req(hostname, QTYPE_AAAA) + else: + self._send_req(hostname, QTYPE_A) + + def close(self): + if self._sock: + if self._loop: + self._loop.remove_periodic(self.handle_periodic) + self._loop.remove(self._sock) + self._sock.close() + self._sock = None + + +def test(): + black_hostname_list = [ + 'baidu.com', + 'yahoo.com', + ] + dns_resolver = DNSResolver(black_hostname_list=black_hostname_list) + loop = eventloop.EventLoop() + dns_resolver.add_to_loop(loop) + + global counter + counter = 0 + + def make_callback(): + global counter + + def callback(result, error): + global counter + # TODO: what can we assert? + print(result, error) + counter += 1 + if counter == 12: + dns_resolver.close() + loop.stop() + + a_callback = callback + return a_callback + + assert (make_callback() != make_callback()) + + dns_resolver.resolve(b'google.com', make_callback()) + dns_resolver.resolve('google.com', make_callback()) + dns_resolver.resolve('baidu.com', make_callback()) + dns_resolver.resolve('map.baidu.com', make_callback()) + dns_resolver.resolve('yahoo.com', make_callback()) + dns_resolver.resolve('example.com', make_callback()) + dns_resolver.resolve('ipv6.google.com', make_callback()) + dns_resolver.resolve('www.facebook.com', make_callback()) + dns_resolver.resolve('ns2.google.com', make_callback()) + dns_resolver.resolve('invalid.@!#$%^&$@.hostname', make_callback()) + dns_resolver.resolve('toooooooooooooooooooooooooooooooooooooooooooooooooo' + 'ooooooooooooooooooooooooooooooooooooooooooooooooooo' + 'long.hostname', make_callback()) + dns_resolver.resolve('toooooooooooooooooooooooooooooooooooooooooooooooooo' + 'ooooooooooooooooooooooooooooooooooooooooooooooooooo' + 'ooooooooooooooooooooooooooooooooooooooooooooooooooo' + 'ooooooooooooooooooooooooooooooooooooooooooooooooooo' + 'ooooooooooooooooooooooooooooooooooooooooooooooooooo' + 'ooooooooooooooooooooooooooooooooooooooooooooooooooo' + 'long.hostname', make_callback()) + loop.run() + # test black_hostname_list + dns_resolver = DNSResolver(black_hostname_list=[]) + assert type(dns_resolver._black_hostname_list) == list + assert len(dns_resolver._black_hostname_list) == 0 + dns_resolver.close() + dns_resolver = DNSResolver(black_hostname_list=123) + assert type(dns_resolver._black_hostname_list) == list + assert len(dns_resolver._black_hostname_list) == 0 + dns_resolver.close() + dns_resolver = DNSResolver(black_hostname_list=None) + assert type(dns_resolver._black_hostname_list) == list + assert len(dns_resolver._black_hostname_list) == 0 + dns_resolver.close() + dns_resolver = DNSResolver() + assert type(dns_resolver._black_hostname_list) == list + assert dns_resolver._black_hostname_list.__len__() == 0 + dns_resolver.close() + + +if __name__ == '__main__': + test() diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/common.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/common.py new file mode 100644 index 00000000000000..c4484c04670249 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/common.py @@ -0,0 +1,418 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright 2013-2015 clowwindy +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from __future__ import absolute_import, division, print_function, \ + with_statement + +import socket +import struct +import logging +import binascii +import re + +from shadowsocks import lru_cache + +def compat_ord(s): + if type(s) == int: + return s + return _ord(s) + + +def compat_chr(d): + if bytes == str: + return _chr(d) + return bytes([d]) + + +_ord = ord +_chr = chr +ord = compat_ord +chr = compat_chr + +connect_log = logging.debug + +def to_bytes(s): + if bytes != str: + if type(s) == str: + return s.encode('utf-8') + return s + + +def to_str(s): + if bytes != str: + if type(s) == bytes: + return s.decode('utf-8') + return s + +def int32(x): + if x > 0xFFFFFFFF or x < 0: + x &= 0xFFFFFFFF + if x > 0x7FFFFFFF: + x = int(0x100000000 - x) + if x < 0x80000000: + return -x + else: + return -2147483648 + return x + +def inet_ntop(family, ipstr): + if family == socket.AF_INET: + return to_bytes(socket.inet_ntoa(ipstr)) + elif family == socket.AF_INET6: + import re + v6addr = ':'.join(('%02X%02X' % (ord(i), ord(j))).lstrip('0') + for i, j in zip(ipstr[::2], ipstr[1::2])) + v6addr = re.sub('::+', '::', v6addr, count=1) + return to_bytes(v6addr) + + +def inet_pton(family, addr): + addr = to_str(addr) + if family == socket.AF_INET: + return socket.inet_aton(addr) + elif family == socket.AF_INET6: + if '.' in addr: # a v4 addr + v4addr = addr[addr.rindex(':') + 1:] + v4addr = socket.inet_aton(v4addr) + v4addr = ['%02X' % ord(x) for x in v4addr] + v4addr.insert(2, ':') + newaddr = addr[:addr.rindex(':') + 1] + ''.join(v4addr) + return inet_pton(family, newaddr) + dbyts = [0] * 8 # 8 groups + grps = addr.split(':') + for i, v in enumerate(grps): + if v: + dbyts[i] = int(v, 16) + else: + for j, w in enumerate(grps[::-1]): + if w: + dbyts[7 - j] = int(w, 16) + else: + break + break + return b''.join((chr(i // 256) + chr(i % 256)) for i in dbyts) + else: + raise RuntimeError("What family?") + + +def is_ip(address): + for family in (socket.AF_INET, socket.AF_INET6): + try: + if type(address) != str: + address = address.decode('utf8') + inet_pton(family, address) + return family + except (TypeError, ValueError, OSError, IOError): + pass + return False + + +def match_regex(regex, text): + regex = re.compile(regex) + for item in regex.findall(text): + return True + return False + + +def patch_socket(): + if not hasattr(socket, 'inet_pton'): + socket.inet_pton = inet_pton + + if not hasattr(socket, 'inet_ntop'): + socket.inet_ntop = inet_ntop + + +patch_socket() + + +ADDRTYPE_IPV4 = 1 +ADDRTYPE_IPV6 = 4 +ADDRTYPE_HOST = 3 + + +def pack_addr(address): + address_str = to_str(address) + for family in (socket.AF_INET, socket.AF_INET6): + try: + r = socket.inet_pton(family, address_str) + if family == socket.AF_INET6: + return b'\x04' + r + else: + return b'\x01' + r + except (TypeError, ValueError, OSError, IOError): + pass + if len(address) > 255: + address = address[:255] # TODO + return b'\x03' + chr(len(address)) + address + +def pre_parse_header(data): + if not data: + return None + datatype = ord(data[0]) + if datatype == 0x80: + if len(data) <= 2: + return None + rand_data_size = ord(data[1]) + if rand_data_size + 2 >= len(data): + logging.warn('header too short, maybe wrong password or ' + 'encryption method') + return None + data = data[rand_data_size + 2:] + elif datatype == 0x81: + data = data[1:] + elif datatype == 0x82: + if len(data) <= 3: + return None + rand_data_size = struct.unpack('>H', data[1:3])[0] + if rand_data_size + 3 >= len(data): + logging.warn('header too short, maybe wrong password or ' + 'encryption method') + return None + data = data[rand_data_size + 3:] + elif datatype == 0x88 or (~datatype & 0xff) == 0x88: + if len(data) <= 7 + 7: + return None + data_size = struct.unpack('>H', data[1:3])[0] + ogn_data = data + data = data[:data_size] + crc = binascii.crc32(data) & 0xffffffff + if crc != 0xffffffff: + logging.warn('uncorrect CRC32, maybe wrong password or ' + 'encryption method') + return None + start_pos = 3 + ord(data[3]) + data = data[start_pos:-4] + if data_size < len(ogn_data): + data += ogn_data[data_size:] + return data + +def parse_header(data): + addrtype = ord(data[0]) + dest_addr = None + dest_port = None + header_length = 0 + connecttype = (addrtype & 0x8) and 1 or 0 + addrtype &= ~0x8 + if addrtype == ADDRTYPE_IPV4: + if len(data) >= 7: + dest_addr = socket.inet_ntoa(data[1:5]) + dest_port = struct.unpack('>H', data[5:7])[0] + header_length = 7 + else: + logging.warn('header is too short') + elif addrtype == ADDRTYPE_HOST: + if len(data) > 2: + addrlen = ord(data[1]) + if len(data) >= 4 + addrlen: + dest_addr = data[2:2 + addrlen] + dest_port = struct.unpack('>H', data[2 + addrlen:4 + + addrlen])[0] + header_length = 4 + addrlen + else: + logging.warn('header is too short') + else: + logging.warn('header is too short') + elif addrtype == ADDRTYPE_IPV6: + if len(data) >= 19: + dest_addr = socket.inet_ntop(socket.AF_INET6, data[1:17]) + dest_port = struct.unpack('>H', data[17:19])[0] + header_length = 19 + else: + logging.warn('header is too short') + else: + logging.warn('unsupported addrtype %d, maybe wrong password or ' + 'encryption method' % addrtype) + if dest_addr is None: + return None + return connecttype, addrtype, to_bytes(dest_addr), dest_port, header_length + + +class IPNetwork(object): + ADDRLENGTH = {socket.AF_INET: 32, socket.AF_INET6: 128, False: 0} + + def __init__(self, addrs): + self.addrs_str = addrs + self._network_list_v4 = [] + self._network_list_v6 = [] + if type(addrs) == str: + addrs = addrs.split(',') + list(map(self.add_network, addrs)) + + def add_network(self, addr): + if addr is "": + return + block = addr.split('/') + addr_family = is_ip(block[0]) + addr_len = IPNetwork.ADDRLENGTH[addr_family] + if addr_family is socket.AF_INET: + ip, = struct.unpack("!I", socket.inet_aton(block[0])) + elif addr_family is socket.AF_INET6: + hi, lo = struct.unpack("!QQ", inet_pton(addr_family, block[0])) + ip = (hi << 64) | lo + else: + raise Exception("Not a valid CIDR notation: %s" % addr) + if len(block) is 1: + prefix_size = 0 + while (ip & 1) == 0 and ip is not 0: + ip >>= 1 + prefix_size += 1 + logging.warn("You did't specify CIDR routing prefix size for %s, " + "implicit treated as %s/%d" % (addr, addr, addr_len)) + elif block[1].isdigit() and int(block[1]) <= addr_len: + prefix_size = addr_len - int(block[1]) + ip >>= prefix_size + else: + raise Exception("Not a valid CIDR notation: %s" % addr) + if addr_family is socket.AF_INET: + self._network_list_v4.append((ip, prefix_size)) + else: + self._network_list_v6.append((ip, prefix_size)) + + def __contains__(self, addr): + addr_family = is_ip(addr) + if addr_family is socket.AF_INET: + ip, = struct.unpack("!I", socket.inet_aton(addr)) + return any(map(lambda n_ps: n_ps[0] == ip >> n_ps[1], + self._network_list_v4)) + elif addr_family is socket.AF_INET6: + hi, lo = struct.unpack("!QQ", inet_pton(addr_family, addr)) + ip = (hi << 64) | lo + return any(map(lambda n_ps: n_ps[0] == ip >> n_ps[1], + self._network_list_v6)) + else: + return False + + def __cmp__(self, other): + return cmp(self.addrs_str, other.addrs_str) + + def __eq__(self, other): + return self.addrs_str == other.addrs_str + + def __ne__(self, other): + return self.addrs_str != other.addrs_str + +class PortRange(object): + def __init__(self, range_str): + self.range_str = to_str(range_str) + self.range = set() + range_str = to_str(range_str).split(',') + for item in range_str: + try: + int_range = item.split('-') + if len(int_range) == 1: + if item: + self.range.add(int(item)) + elif len(int_range) == 2: + int_range[0] = int(int_range[0]) + int_range[1] = int(int_range[1]) + if int_range[0] < 0: + int_range[0] = 0 + if int_range[1] > 65535: + int_range[1] = 65535 + i = int_range[0] + while i <= int_range[1]: + self.range.add(i) + i += 1 + except Exception as e: + logging.error(e) + + def __contains__(self, val): + return val in self.range + + def __cmp__(self, other): + return cmp(self.range_str, other.range_str) + + def __eq__(self, other): + return self.range_str == other.range_str + + def __ne__(self, other): + return self.range_str != other.range_str + +class UDPAsyncDNSHandler(object): + dns_cache = lru_cache.LRUCache(timeout=1800) + def __init__(self, params): + self.params = params + self.remote_addr = None + self.call_back = None + + def resolve(self, dns_resolver, remote_addr, call_back): + if remote_addr in UDPAsyncDNSHandler.dns_cache: + if call_back: + call_back("", remote_addr, UDPAsyncDNSHandler.dns_cache[remote_addr], self.params) + else: + self.call_back = call_back + self.remote_addr = remote_addr + dns_resolver.resolve(remote_addr[0], self._handle_dns_resolved) + UDPAsyncDNSHandler.dns_cache.sweep() + + def _handle_dns_resolved(self, result, error): + if error: + logging.error("%s when resolve DNS" % (error,)) #drop + return self.call_back(error, self.remote_addr, None, self.params) + if result: + ip = result[1] + if ip: + return self.call_back("", self.remote_addr, ip, self.params) + logging.warning("can't resolve %s" % (self.remote_addr,)) + return self.call_back("fail to resolve", self.remote_addr, None, self.params) + +def test_inet_conv(): + ipv4 = b'8.8.4.4' + b = inet_pton(socket.AF_INET, ipv4) + assert inet_ntop(socket.AF_INET, b) == ipv4 + ipv6 = b'2404:6800:4005:805::1011' + b = inet_pton(socket.AF_INET6, ipv6) + assert inet_ntop(socket.AF_INET6, b) == ipv6 + + +def test_parse_header(): + assert parse_header(b'\x03\x0ewww.google.com\x00\x50') == \ + (0, b'www.google.com', 80, 18) + assert parse_header(b'\x01\x08\x08\x08\x08\x00\x35') == \ + (0, b'8.8.8.8', 53, 7) + assert parse_header((b'\x04$\x04h\x00@\x05\x08\x05\x00\x00\x00\x00\x00' + b'\x00\x10\x11\x00\x50')) == \ + (0, b'2404:6800:4005:805::1011', 80, 19) + + +def test_pack_header(): + assert pack_addr(b'8.8.8.8') == b'\x01\x08\x08\x08\x08' + assert pack_addr(b'2404:6800:4005:805::1011') == \ + b'\x04$\x04h\x00@\x05\x08\x05\x00\x00\x00\x00\x00\x00\x10\x11' + assert pack_addr(b'www.google.com') == b'\x03\x0ewww.google.com' + + +def test_ip_network(): + ip_network = IPNetwork('127.0.0.0/24,::ff:1/112,::1,192.168.1.1,192.0.2.0') + assert '127.0.0.1' in ip_network + assert '127.0.1.1' not in ip_network + assert ':ff:ffff' in ip_network + assert '::ffff:1' not in ip_network + assert '::1' in ip_network + assert '::2' not in ip_network + assert '192.168.1.1' in ip_network + assert '192.168.1.2' not in ip_network + assert '192.0.2.1' in ip_network + assert '192.0.3.1' in ip_network # 192.0.2.0 is treated as 192.0.2.0/23 + assert 'www.google.com' not in ip_network + + +if __name__ == '__main__': + test_inet_conv() + test_parse_header() + test_pack_header() + test_ip_network() diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/crypto/__init__.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/crypto/__init__.py new file mode 100644 index 00000000000000..401c7b726e6d62 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/crypto/__init__.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python +# +# Copyright 2015 clowwindy +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from __future__ import absolute_import, division, print_function, \ + with_statement diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/crypto/ctypes_libsodium.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/crypto/ctypes_libsodium.py new file mode 100644 index 00000000000000..efecfd415d40ab --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/crypto/ctypes_libsodium.py @@ -0,0 +1,135 @@ +#!/usr/bin/env python + +# Copyright (c) 2014 clowwindy +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +from __future__ import absolute_import, division, print_function, \ + with_statement + +import logging +from ctypes import CDLL, c_char_p, c_int, c_ulonglong, byref, \ + create_string_buffer, c_void_p + +__all__ = ['ciphers'] + +libsodium = None +loaded = False + +buf_size = 2048 + +# for salsa20 and chacha20 +BLOCK_SIZE = 64 + + +def load_libsodium(): + global loaded, libsodium, buf + + from ctypes.util import find_library + for p in ('sodium',): + libsodium_path = find_library(p) + if libsodium_path: + break + else: + raise Exception('libsodium not found') + logging.info('loading libsodium from %s', libsodium_path) + libsodium = CDLL(libsodium_path) + libsodium.sodium_init.restype = c_int + libsodium.crypto_stream_salsa20_xor_ic.restype = c_int + libsodium.crypto_stream_salsa20_xor_ic.argtypes = (c_void_p, c_char_p, + c_ulonglong, + c_char_p, c_ulonglong, + c_char_p) + libsodium.crypto_stream_chacha20_xor_ic.restype = c_int + libsodium.crypto_stream_chacha20_xor_ic.argtypes = (c_void_p, c_char_p, + c_ulonglong, + c_char_p, c_ulonglong, + c_char_p) + + libsodium.sodium_init() + + buf = create_string_buffer(buf_size) + loaded = True + + +class Salsa20Crypto(object): + def __init__(self, cipher_name, key, iv, op): + if not loaded: + load_libsodium() + self.key = key + self.iv = iv + self.key_ptr = c_char_p(key) + self.iv_ptr = c_char_p(iv) + if cipher_name == b'salsa20': + self.cipher = libsodium.crypto_stream_salsa20_xor_ic + elif cipher_name == b'chacha20': + self.cipher = libsodium.crypto_stream_chacha20_xor_ic + else: + raise Exception('Unknown cipher') + # byte counter, not block counter + self.counter = 0 + + def update(self, data): + global buf_size, buf + l = len(data) + + # we can only prepend some padding to make the encryption align to + # blocks + padding = self.counter % BLOCK_SIZE + if buf_size < padding + l: + buf_size = (padding + l) * 2 + buf = create_string_buffer(buf_size) + + if padding: + data = (b'\0' * padding) + data + self.cipher(byref(buf), c_char_p(data), padding + l, + self.iv_ptr, int(self.counter / BLOCK_SIZE), self.key_ptr) + self.counter += l + # buf is copied to a str object when we access buf.raw + # strip off the padding + return buf.raw[padding:padding + l] + + +ciphers = { + b'salsa20': (32, 8, Salsa20Crypto), + b'chacha20': (32, 8, Salsa20Crypto), +} + + +def test_salsa20(): + from shadowsocks.crypto import util + + cipher = Salsa20Crypto(b'salsa20', b'k' * 32, b'i' * 16, 1) + decipher = Salsa20Crypto(b'salsa20', b'k' * 32, b'i' * 16, 0) + + util.run_cipher(cipher, decipher) + + +def test_chacha20(): + from shadowsocks.crypto import util + + cipher = Salsa20Crypto(b'chacha20', b'k' * 32, b'i' * 16, 1) + decipher = Salsa20Crypto(b'chacha20', b'k' * 32, b'i' * 16, 0) + + util.run_cipher(cipher, decipher) + + +if __name__ == '__main__': + test_chacha20() + test_salsa20() diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/crypto/ctypes_openssl.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/crypto/ctypes_openssl.py new file mode 100644 index 00000000000000..0ef8ce0f8c69c0 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/crypto/ctypes_openssl.py @@ -0,0 +1,188 @@ +#!/usr/bin/env python + +# Copyright (c) 2014 clowwindy +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +from __future__ import absolute_import, division, print_function, \ + with_statement + +import logging +from ctypes import CDLL, c_char_p, c_int, c_long, byref,\ + create_string_buffer, c_void_p + +__all__ = ['ciphers'] + +libcrypto = None +loaded = False + +buf_size = 2048 + + +def load_openssl(): + global loaded, libcrypto, buf + + from ctypes.util import find_library + for p in ('crypto', 'eay32', 'libeay32'): + libcrypto_path = find_library(p) + if libcrypto_path: + break + else: + raise Exception('libcrypto(OpenSSL) not found') + logging.info('loading libcrypto from %s', libcrypto_path) + libcrypto = CDLL(libcrypto_path) + libcrypto.EVP_get_cipherbyname.restype = c_void_p + libcrypto.EVP_CIPHER_CTX_new.restype = c_void_p + + libcrypto.EVP_CipherInit_ex.argtypes = (c_void_p, c_void_p, c_char_p, + c_char_p, c_char_p, c_int) + + libcrypto.EVP_CipherUpdate.argtypes = (c_void_p, c_void_p, c_void_p, + c_char_p, c_int) + + libcrypto.EVP_CIPHER_CTX_cleanup.argtypes = (c_void_p,) + libcrypto.EVP_CIPHER_CTX_free.argtypes = (c_void_p,) + if hasattr(libcrypto, 'OpenSSL_add_all_ciphers'): + libcrypto.OpenSSL_add_all_ciphers() + + buf = create_string_buffer(buf_size) + loaded = True + + +def load_cipher(cipher_name): + func_name = b'EVP_' + cipher_name.replace(b'-', b'_') + if bytes != str: + func_name = str(func_name, 'utf-8') + cipher = getattr(libcrypto, func_name, None) + if cipher: + cipher.restype = c_void_p + return cipher() + return None + + +class CtypesCrypto(object): + def __init__(self, cipher_name, key, iv, op): + if not loaded: + load_openssl() + self._ctx = None + cipher = libcrypto.EVP_get_cipherbyname(cipher_name) + if not cipher: + cipher = load_cipher(cipher_name) + if not cipher: + raise Exception('cipher %s not found in libcrypto' % cipher_name) + key_ptr = c_char_p(key) + iv_ptr = c_char_p(iv) + self._ctx = libcrypto.EVP_CIPHER_CTX_new() + if not self._ctx: + raise Exception('can not create cipher context') + r = libcrypto.EVP_CipherInit_ex(self._ctx, cipher, None, + key_ptr, iv_ptr, c_int(op)) + if not r: + self.clean() + raise Exception('can not initialize cipher context') + + def update(self, data): + global buf_size, buf + cipher_out_len = c_long(0) + l = len(data) + if buf_size < l: + buf_size = l * 2 + buf = create_string_buffer(buf_size) + libcrypto.EVP_CipherUpdate(self._ctx, byref(buf), + byref(cipher_out_len), c_char_p(data), l) + # buf is copied to a str object when we access buf.raw + return buf.raw[:cipher_out_len.value] + + def __del__(self): + self.clean() + + def clean(self): + if self._ctx: + libcrypto.EVP_CIPHER_CTX_cleanup(self._ctx) + libcrypto.EVP_CIPHER_CTX_free(self._ctx) + + +ciphers = { + b'aes-128-cfb': (16, 16, CtypesCrypto), + b'aes-192-cfb': (24, 16, CtypesCrypto), + b'aes-256-cfb': (32, 16, CtypesCrypto), + b'aes-128-ofb': (16, 16, CtypesCrypto), + b'aes-192-ofb': (24, 16, CtypesCrypto), + b'aes-256-ofb': (32, 16, CtypesCrypto), + b'aes-128-ctr': (16, 16, CtypesCrypto), + b'aes-192-ctr': (24, 16, CtypesCrypto), + b'aes-256-ctr': (32, 16, CtypesCrypto), + b'aes-128-cfb8': (16, 16, CtypesCrypto), + b'aes-192-cfb8': (24, 16, CtypesCrypto), + b'aes-256-cfb8': (32, 16, CtypesCrypto), + b'aes-128-cfb1': (16, 16, CtypesCrypto), + b'aes-192-cfb1': (24, 16, CtypesCrypto), + b'aes-256-cfb1': (32, 16, CtypesCrypto), + b'bf-cfb': (16, 8, CtypesCrypto), + b'camellia-128-cfb': (16, 16, CtypesCrypto), + b'camellia-192-cfb': (24, 16, CtypesCrypto), + b'camellia-256-cfb': (32, 16, CtypesCrypto), + b'cast5-cfb': (16, 8, CtypesCrypto), + b'des-cfb': (8, 8, CtypesCrypto), + b'idea-cfb': (16, 8, CtypesCrypto), + b'rc2-cfb': (16, 8, CtypesCrypto), + b'rc4': (16, 0, CtypesCrypto), + b'seed-cfb': (16, 16, CtypesCrypto), +} + + +def run_method(method): + from shadowsocks.crypto import util + + cipher = CtypesCrypto(method, b'k' * 32, b'i' * 16, 1) + decipher = CtypesCrypto(method, b'k' * 32, b'i' * 16, 0) + + util.run_cipher(cipher, decipher) + + +def test_aes_128_cfb(): + run_method(b'aes-128-cfb') + + +def test_aes_256_cfb(): + run_method(b'aes-256-cfb') + + +def test_aes_128_cfb8(): + run_method(b'aes-128-cfb8') + + +def test_aes_256_ofb(): + run_method(b'aes-256-ofb') + + +def test_aes_256_ctr(): + run_method(b'aes-256-ctr') + + +def test_bf_cfb(): + run_method(b'bf-cfb') + + +def test_rc4(): + run_method(b'rc4') + + +if __name__ == '__main__': + test_aes_128_cfb() diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/crypto/openssl.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/crypto/openssl.py new file mode 100644 index 00000000000000..0a8ca53fb8d434 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/crypto/openssl.py @@ -0,0 +1,199 @@ +#!/usr/bin/env python +# +# Copyright 2015 clowwindy +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from __future__ import absolute_import, division, print_function, \ + with_statement + +from ctypes import c_char_p, c_int, c_long, byref,\ + create_string_buffer, c_void_p + +from shadowsocks import common +from shadowsocks.crypto import util + +__all__ = ['ciphers'] + +libcrypto = None +loaded = False + +buf_size = 2048 + + +def load_openssl(): + global loaded, libcrypto, buf + + libcrypto = util.find_library(('crypto', 'eay32'), + 'EVP_get_cipherbyname', + 'libcrypto') + if libcrypto is None: + raise Exception('libcrypto(OpenSSL) not found') + + libcrypto.EVP_get_cipherbyname.restype = c_void_p + libcrypto.EVP_CIPHER_CTX_new.restype = c_void_p + + libcrypto.EVP_CipherInit_ex.argtypes = (c_void_p, c_void_p, c_char_p, + c_char_p, c_char_p, c_int) + + libcrypto.EVP_CipherUpdate.argtypes = (c_void_p, c_void_p, c_void_p, + c_char_p, c_int) + + if hasattr(libcrypto, "EVP_CIPHER_CTX_cleanup"): + libcrypto.EVP_CIPHER_CTX_cleanup.argtypes = (c_void_p,) + else: + libcrypto.EVP_CIPHER_CTX_reset.argtypes = (c_void_p,) + libcrypto.EVP_CIPHER_CTX_free.argtypes = (c_void_p,) + + libcrypto.RAND_bytes.restype = c_int + libcrypto.RAND_bytes.argtypes = (c_void_p, c_int) + + if hasattr(libcrypto, 'OpenSSL_add_all_ciphers'): + libcrypto.OpenSSL_add_all_ciphers() + + buf = create_string_buffer(buf_size) + loaded = True + + +def load_cipher(cipher_name): + func_name = 'EVP_' + cipher_name.replace('-', '_') + cipher = getattr(libcrypto, func_name, None) + if cipher: + cipher.restype = c_void_p + return cipher() + return None + +def rand_bytes(length): + if not loaded: + load_openssl() + buf = create_string_buffer(length) + r = libcrypto.RAND_bytes(buf, length) + if r <= 0: + raise Exception('RAND_bytes return error') + return buf.raw + +class OpenSSLCrypto(object): + def __init__(self, cipher_name, key, iv, op): + self._ctx = None + if not loaded: + load_openssl() + cipher = libcrypto.EVP_get_cipherbyname(common.to_bytes(cipher_name)) + if not cipher: + cipher = load_cipher(cipher_name) + if not cipher: + raise Exception('cipher %s not found in libcrypto' % cipher_name) + key_ptr = c_char_p(key) + iv_ptr = c_char_p(iv) + self._ctx = libcrypto.EVP_CIPHER_CTX_new() + if not self._ctx: + raise Exception('can not create cipher context') + r = libcrypto.EVP_CipherInit_ex(self._ctx, cipher, None, + key_ptr, iv_ptr, c_int(op)) + if not r: + self.clean() + raise Exception('can not initialize cipher context') + + def update(self, data): + global buf_size, buf + cipher_out_len = c_long(0) + l = len(data) + if buf_size < l: + buf_size = l * 2 + buf = create_string_buffer(buf_size) + libcrypto.EVP_CipherUpdate(self._ctx, byref(buf), + byref(cipher_out_len), c_char_p(data), l) + # buf is copied to a str object when we access buf.raw + return buf.raw[:cipher_out_len.value] + + def __del__(self): + self.clean() + + def clean(self): + if self._ctx: + if hasattr(libcrypto, "EVP_CIPHER_CTX_cleanup"): + libcrypto.EVP_CIPHER_CTX_cleanup(self._ctx) + else: + libcrypto.EVP_CIPHER_CTX_reset(self._ctx) + libcrypto.EVP_CIPHER_CTX_free(self._ctx) + + +ciphers = { + 'aes-128-cbc': (16, 16, OpenSSLCrypto), + 'aes-192-cbc': (24, 16, OpenSSLCrypto), + 'aes-256-cbc': (32, 16, OpenSSLCrypto), + 'aes-128-cfb': (16, 16, OpenSSLCrypto), + 'aes-192-cfb': (24, 16, OpenSSLCrypto), + 'aes-256-cfb': (32, 16, OpenSSLCrypto), + 'aes-128-ofb': (16, 16, OpenSSLCrypto), + 'aes-192-ofb': (24, 16, OpenSSLCrypto), + 'aes-256-ofb': (32, 16, OpenSSLCrypto), + 'aes-128-ctr': (16, 16, OpenSSLCrypto), + 'aes-192-ctr': (24, 16, OpenSSLCrypto), + 'aes-256-ctr': (32, 16, OpenSSLCrypto), + 'aes-128-cfb8': (16, 16, OpenSSLCrypto), + 'aes-192-cfb8': (24, 16, OpenSSLCrypto), + 'aes-256-cfb8': (32, 16, OpenSSLCrypto), + 'aes-128-cfb1': (16, 16, OpenSSLCrypto), + 'aes-192-cfb1': (24, 16, OpenSSLCrypto), + 'aes-256-cfb1': (32, 16, OpenSSLCrypto), + 'bf-cfb': (16, 8, OpenSSLCrypto), + 'camellia-128-cfb': (16, 16, OpenSSLCrypto), + 'camellia-192-cfb': (24, 16, OpenSSLCrypto), + 'camellia-256-cfb': (32, 16, OpenSSLCrypto), + 'cast5-cfb': (16, 8, OpenSSLCrypto), + 'des-cfb': (8, 8, OpenSSLCrypto), + 'idea-cfb': (16, 8, OpenSSLCrypto), + 'rc2-cfb': (16, 8, OpenSSLCrypto), + 'rc4': (16, 0, OpenSSLCrypto), + 'seed-cfb': (16, 16, OpenSSLCrypto), +} + + +def run_method(method): + + cipher = OpenSSLCrypto(method, b'k' * 32, b'i' * 16, 1) + decipher = OpenSSLCrypto(method, b'k' * 32, b'i' * 16, 0) + + util.run_cipher(cipher, decipher) + + +def test_aes_128_cfb(): + run_method('aes-128-cfb') + + +def test_aes_256_cfb(): + run_method('aes-256-cfb') + + +def test_aes_128_cfb8(): + run_method('aes-128-cfb8') + + +def test_aes_256_ofb(): + run_method('aes-256-ofb') + + +def test_aes_256_ctr(): + run_method('aes-256-ctr') + + +def test_bf_cfb(): + run_method('bf-cfb') + + +def test_rc4(): + run_method('rc4') + + +if __name__ == '__main__': + test_aes_128_cfb() diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/crypto/rc4_md5.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/crypto/rc4_md5.py new file mode 100644 index 00000000000000..b0105ec29c93d6 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/crypto/rc4_md5.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +# +# Copyright 2015 clowwindy +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from __future__ import absolute_import, division, print_function, \ + with_statement + +import hashlib + +from shadowsocks.crypto import openssl + +__all__ = ['ciphers'] + + +def create_cipher(alg, key, iv, op, key_as_bytes=0, d=None, salt=None, + i=1, padding=1): + md5 = hashlib.md5() + md5.update(key) + md5.update(iv) + rc4_key = md5.digest() + return openssl.OpenSSLCrypto(b'rc4', rc4_key, b'', op) + + +ciphers = { + 'rc4-md5': (16, 16, create_cipher), + 'rc4-md5-6': (16, 6, create_cipher), +} + + +def test(): + from shadowsocks.crypto import util + + cipher = create_cipher('rc4-md5', b'k' * 32, b'i' * 16, 1) + decipher = create_cipher('rc4-md5', b'k' * 32, b'i' * 16, 0) + + util.run_cipher(cipher, decipher) + + +if __name__ == '__main__': + test() diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/crypto/sodium.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/crypto/sodium.py new file mode 100644 index 00000000000000..51d476bedcac72 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/crypto/sodium.py @@ -0,0 +1,140 @@ +#!/usr/bin/env python +# +# Copyright 2015 clowwindy +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from __future__ import absolute_import, division, print_function, \ + with_statement + +from ctypes import c_char_p, c_int, c_ulong, c_ulonglong, byref, \ + create_string_buffer, c_void_p + +from shadowsocks.crypto import util + +__all__ = ['ciphers'] + +libsodium = None +loaded = False + +buf_size = 2048 + +# for salsa20 and chacha20 and chacha20-ietf +BLOCK_SIZE = 64 + + +def load_libsodium(): + global loaded, libsodium, buf + + libsodium = util.find_library('sodium', 'crypto_stream_salsa20_xor_ic', + 'libsodium') + if libsodium is None: + raise Exception('libsodium not found') + + libsodium.crypto_stream_salsa20_xor_ic.restype = c_int + libsodium.crypto_stream_salsa20_xor_ic.argtypes = (c_void_p, c_char_p, + c_ulonglong, + c_char_p, c_ulonglong, + c_char_p) + libsodium.crypto_stream_chacha20_xor_ic.restype = c_int + libsodium.crypto_stream_chacha20_xor_ic.argtypes = (c_void_p, c_char_p, + c_ulonglong, + c_char_p, c_ulonglong, + c_char_p) + + try: + libsodium.crypto_stream_chacha20_ietf_xor_ic.restype = c_int + libsodium.crypto_stream_chacha20_ietf_xor_ic.argtypes = (c_void_p, c_char_p, + c_ulonglong, + c_char_p, c_ulong, + c_char_p) + except: + pass + + buf = create_string_buffer(buf_size) + loaded = True + + +class SodiumCrypto(object): + def __init__(self, cipher_name, key, iv, op): + if not loaded: + load_libsodium() + self.key = key + self.iv = iv + self.key_ptr = c_char_p(key) + self.iv_ptr = c_char_p(iv) + if cipher_name == 'salsa20': + self.cipher = libsodium.crypto_stream_salsa20_xor_ic + elif cipher_name == 'chacha20': + self.cipher = libsodium.crypto_stream_chacha20_xor_ic + elif cipher_name == 'chacha20-ietf': + self.cipher = libsodium.crypto_stream_chacha20_ietf_xor_ic + else: + raise Exception('Unknown cipher') + # byte counter, not block counter + self.counter = 0 + + def update(self, data): + global buf_size, buf + l = len(data) + + # we can only prepend some padding to make the encryption align to + # blocks + padding = self.counter % BLOCK_SIZE + if buf_size < padding + l: + buf_size = (padding + l) * 2 + buf = create_string_buffer(buf_size) + + if padding: + data = (b'\0' * padding) + data + self.cipher(byref(buf), c_char_p(data), padding + l, + self.iv_ptr, int(self.counter / BLOCK_SIZE), self.key_ptr) + self.counter += l + # buf is copied to a str object when we access buf.raw + # strip off the padding + return buf.raw[padding:padding + l] + + +ciphers = { + 'salsa20': (32, 8, SodiumCrypto), + 'chacha20': (32, 8, SodiumCrypto), + 'chacha20-ietf': (32, 12, SodiumCrypto), +} + + +def test_salsa20(): + cipher = SodiumCrypto('salsa20', b'k' * 32, b'i' * 16, 1) + decipher = SodiumCrypto('salsa20', b'k' * 32, b'i' * 16, 0) + + util.run_cipher(cipher, decipher) + + +def test_chacha20(): + + cipher = SodiumCrypto('chacha20', b'k' * 32, b'i' * 16, 1) + decipher = SodiumCrypto('chacha20', b'k' * 32, b'i' * 16, 0) + + util.run_cipher(cipher, decipher) + + +def test_chacha20_ietf(): + + cipher = SodiumCrypto('chacha20-ietf', b'k' * 32, b'i' * 16, 1) + decipher = SodiumCrypto('chacha20-ietf', b'k' * 32, b'i' * 16, 0) + + util.run_cipher(cipher, decipher) + +if __name__ == '__main__': + test_chacha20_ietf() + test_chacha20() + test_salsa20() diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/crypto/table.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/crypto/table.py new file mode 100644 index 00000000000000..60c2f24519b131 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/crypto/table.py @@ -0,0 +1,181 @@ +# !/usr/bin/env python +# +# Copyright 2015 clowwindy +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from __future__ import absolute_import, division, print_function, \ + with_statement + +import string +import struct +import hashlib + + +__all__ = ['ciphers'] + +cached_tables = {} + +if hasattr(string, 'maketrans'): + maketrans = string.maketrans + translate = string.translate +else: + maketrans = bytes.maketrans + translate = bytes.translate + + +def get_table(key): + m = hashlib.md5() + m.update(key) + s = m.digest() + a, b = struct.unpack(' 0: + # parent waits for its child + time.sleep(5) + sys.exit(0) + + # child signals its parent to exit + ppid = os.getppid() + pid = os.getpid() + if write_pid_file(pid_file, pid) != 0: + os.kill(ppid, signal.SIGINT) + sys.exit(1) + + os.setsid() + signal.signal(signal.SIG_IGN, signal.SIGHUP) + + print('started') + os.kill(ppid, signal.SIGTERM) + + sys.stdin.close() + try: + freopen(log_file, 'a', sys.stdout) + freopen(log_file, 'a', sys.stderr) + except IOError as e: + shell.print_exception(e) + sys.exit(1) + + +def daemon_stop(pid_file): + import errno + try: + with open(pid_file) as f: + buf = f.read() + pid = common.to_str(buf) + if not buf: + logging.error('not running') + except IOError as e: + shell.print_exception(e) + if e.errno == errno.ENOENT: + # always exit 0 if we are sure daemon is not running + logging.error('not running') + return + sys.exit(1) + pid = int(pid) + if pid > 0: + try: + os.kill(pid, signal.SIGTERM) + except OSError as e: + if e.errno == errno.ESRCH: + logging.error('not running') + # always exit 0 if we are sure daemon is not running + return + shell.print_exception(e) + sys.exit(1) + else: + logging.error('pid is not positive: %d', pid) + + # sleep for maximum 10s + for i in range(0, 200): + try: + # query for the pid + os.kill(pid, 0) + except OSError as e: + if e.errno == errno.ESRCH: + break + time.sleep(0.05) + else: + logging.error('timed out when stopping pid %d', pid) + sys.exit(1) + print('stopped') + os.unlink(pid_file) + + +def set_user(username): + if username is None: + return + + import pwd + import grp + + try: + pwrec = pwd.getpwnam(username) + except KeyError: + logging.error('user not found: %s' % username) + raise + user = pwrec[0] + uid = pwrec[2] + gid = pwrec[3] + + cur_uid = os.getuid() + if uid == cur_uid: + return + if cur_uid != 0: + logging.error('can not set user as nonroot user') + # will raise later + + # inspired by supervisor + if hasattr(os, 'setgroups'): + groups = [grprec[2] for grprec in grp.getgrall() if user in grprec[3]] + groups.insert(0, gid) + os.setgroups(groups) + os.setgid(gid) + os.setuid(uid) diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/encrypt.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/encrypt.py new file mode 100644 index 00000000000000..44f9052506433e --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/encrypt.py @@ -0,0 +1,236 @@ +#!/usr/bin/env python +# +# Copyright 2012-2015 clowwindy +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from __future__ import absolute_import, division, print_function, \ + with_statement + +import os +import sys +import hashlib +import logging + +from shadowsocks import common +from shadowsocks.crypto import rc4_md5, openssl, sodium, table + + +method_supported = {} +method_supported.update(rc4_md5.ciphers) +method_supported.update(openssl.ciphers) +method_supported.update(sodium.ciphers) +method_supported.update(table.ciphers) + + +def random_string(length): + try: + return os.urandom(length) + except NotImplementedError as e: + return openssl.rand_bytes(length) + +cached_keys = {} + + +def try_cipher(key, method=None): + Encryptor(key, method) + + +def EVP_BytesToKey(password, key_len, iv_len): + # equivalent to OpenSSL's EVP_BytesToKey() with count 1 + # so that we make the same key and iv as nodejs version + if hasattr(password, 'encode'): + password = password.encode('utf-8') + cached_key = '%s-%d-%d' % (password, key_len, iv_len) + r = cached_keys.get(cached_key, None) + if r: + return r + m = [] + i = 0 + while len(b''.join(m)) < (key_len + iv_len): + md5 = hashlib.md5() + data = password + if i > 0: + data = m[i - 1] + password + md5.update(data) + m.append(md5.digest()) + i += 1 + ms = b''.join(m) + key = ms[:key_len] + iv = ms[key_len:key_len + iv_len] + cached_keys[cached_key] = (key, iv) + return key, iv + + +class Encryptor(object): + def __init__(self, key, method, iv = None): + self.key = key + self.method = method + self.iv = None + self.iv_sent = False + self.cipher_iv = b'' + self.iv_buf = b'' + self.cipher_key = b'' + self.decipher = None + method = method.lower() + self._method_info = self.get_method_info(method) + if self._method_info: + if iv is None or len(iv) != self._method_info[1]: + self.cipher = self.get_cipher(key, method, 1, + random_string(self._method_info[1])) + else: + self.cipher = self.get_cipher(key, method, 1, iv) + else: + logging.error('method %s not supported' % method) + sys.exit(1) + + def get_method_info(self, method): + method = method.lower() + m = method_supported.get(method) + return m + + def iv_len(self): + return len(self.cipher_iv) + + def get_cipher(self, password, method, op, iv): + password = common.to_bytes(password) + m = self._method_info + if m[0] > 0: + key, iv_ = EVP_BytesToKey(password, m[0], m[1]) + else: + # key_length == 0 indicates we should use the key directly + key, iv = password, b'' + + iv = iv[:m[1]] + if op == 1: + # this iv is for cipher not decipher + self.cipher_iv = iv[:m[1]] + self.cipher_key = key + return m[2](method, key, iv, op) + + def encrypt(self, buf): + if len(buf) == 0: + return buf + if self.iv_sent: + return self.cipher.update(buf) + else: + self.iv_sent = True + return self.cipher_iv + self.cipher.update(buf) + + def decrypt(self, buf): + if len(buf) == 0: + return buf + if self.decipher is not None: #optimize + return self.decipher.update(buf) + + decipher_iv_len = self._method_info[1] + if len(self.iv_buf) <= decipher_iv_len: + self.iv_buf += buf + if len(self.iv_buf) > decipher_iv_len: + decipher_iv = self.iv_buf[:decipher_iv_len] + self.decipher = self.get_cipher(self.key, self.method, 0, + iv=decipher_iv) + buf = self.iv_buf[decipher_iv_len:] + del self.iv_buf + return self.decipher.update(buf) + else: + return b'' + +def encrypt_all(password, method, op, data): + result = [] + method = method.lower() + (key_len, iv_len, m) = method_supported[method] + if key_len > 0: + key, _ = EVP_BytesToKey(password, key_len, iv_len) + else: + key = password + if op: + iv = random_string(iv_len) + result.append(iv) + else: + iv = data[:iv_len] + data = data[iv_len:] + cipher = m(method, key, iv, op) + result.append(cipher.update(data)) + return b''.join(result) + +def encrypt_key(password, method): + method = method.lower() + (key_len, iv_len, m) = method_supported[method] + if key_len > 0: + key, _ = EVP_BytesToKey(password, key_len, iv_len) + else: + key = password + return key + +def encrypt_iv_len(method): + method = method.lower() + (key_len, iv_len, m) = method_supported[method] + return iv_len + +def encrypt_new_iv(method): + method = method.lower() + (key_len, iv_len, m) = method_supported[method] + return random_string(iv_len) + +def encrypt_all_iv(key, method, op, data, ref_iv): + result = [] + method = method.lower() + (key_len, iv_len, m) = method_supported[method] + if op: + iv = ref_iv[0] + result.append(iv) + else: + iv = data[:iv_len] + data = data[iv_len:] + ref_iv[0] = iv + cipher = m(method, key, iv, op) + result.append(cipher.update(data)) + return b''.join(result) + + +CIPHERS_TO_TEST = [ + 'aes-128-cfb', + 'aes-256-cfb', + 'rc4-md5', + 'salsa20', + 'chacha20', + 'table', +] + + +def test_encryptor(): + from os import urandom + plain = urandom(10240) + for method in CIPHERS_TO_TEST: + logging.warn(method) + encryptor = Encryptor(b'key', method) + decryptor = Encryptor(b'key', method) + cipher = encryptor.encrypt(plain) + plain2 = decryptor.decrypt(cipher) + assert plain == plain2 + + +def test_encrypt_all(): + from os import urandom + plain = urandom(10240) + for method in CIPHERS_TO_TEST: + logging.warn(method) + cipher = encrypt_all(b'key', method, 1, plain) + plain2 = encrypt_all(b'key', method, 0, cipher) + assert plain == plain2 + + +if __name__ == '__main__': + test_encrypt_all() + test_encryptor() diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/encrypt_test.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/encrypt_test.py new file mode 100644 index 00000000000000..d5e50778997773 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/encrypt_test.py @@ -0,0 +1,51 @@ +from __future__ import absolute_import, division, print_function, \ + with_statement + +import sys +import os + +sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../')) + + +from shadowsocks.crypto import rc4_md5 +from shadowsocks.crypto import openssl +from shadowsocks.crypto import sodium +from shadowsocks.crypto import table + +def run(func): + try: + func() + except: + pass + +def run_n(func, name): + try: + func(name) + except: + pass + +def main(): + print("\n""rc4_md5") + rc4_md5.test() + print("\n""aes-256-cfb") + openssl.test_aes_256_cfb() + print("\n""aes-128-cfb") + openssl.test_aes_128_cfb() + print("\n""bf-cfb") + run(openssl.test_bf_cfb) + print("\n""camellia-128-cfb") + run_n(openssl.run_method, "camellia-128-cfb") + print("\n""cast5-cfb") + run_n(openssl.run_method, "cast5-cfb") + print("\n""idea-cfb") + run_n(openssl.run_method, "idea-cfb") + print("\n""seed-cfb") + run_n(openssl.run_method, "seed-cfb") + print("\n""salsa20") + run(sodium.test_salsa20) + print("\n""chacha20") + run(sodium.test_chacha20) + +if __name__ == '__main__': + main() + diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/eventloop.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/eventloop.py new file mode 100644 index 00000000000000..341620efd13f54 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/eventloop.py @@ -0,0 +1,258 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright 2013-2015 clowwindy +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +# from ssloop +# https://github.com/clowwindy/ssloop + +from __future__ import absolute_import, division, print_function, \ + with_statement + +import os +import time +import socket +import select +import errno +import logging +from collections import defaultdict + +from shadowsocks import shell + + +__all__ = ['EventLoop', 'POLL_NULL', 'POLL_IN', 'POLL_OUT', 'POLL_ERR', + 'POLL_HUP', 'POLL_NVAL', 'EVENT_NAMES'] + +POLL_NULL = 0x00 +POLL_IN = 0x01 +POLL_OUT = 0x04 +POLL_ERR = 0x08 +POLL_HUP = 0x10 +POLL_NVAL = 0x20 + + +EVENT_NAMES = { + POLL_NULL: 'POLL_NULL', + POLL_IN: 'POLL_IN', + POLL_OUT: 'POLL_OUT', + POLL_ERR: 'POLL_ERR', + POLL_HUP: 'POLL_HUP', + POLL_NVAL: 'POLL_NVAL', +} + +# we check timeouts every TIMEOUT_PRECISION seconds +TIMEOUT_PRECISION = 2 + + +class KqueueLoop(object): + + MAX_EVENTS = 1024 + + def __init__(self): + self._kqueue = select.kqueue() + self._fds = {} + + def _control(self, fd, mode, flags): + events = [] + if mode & POLL_IN: + events.append(select.kevent(fd, select.KQ_FILTER_READ, flags)) + if mode & POLL_OUT: + events.append(select.kevent(fd, select.KQ_FILTER_WRITE, flags)) + for e in events: + self._kqueue.control([e], 0) + + def poll(self, timeout): + if timeout < 0: + timeout = None # kqueue behaviour + events = self._kqueue.control(None, KqueueLoop.MAX_EVENTS, timeout) + results = defaultdict(lambda: POLL_NULL) + for e in events: + fd = e.ident + if e.filter == select.KQ_FILTER_READ: + results[fd] |= POLL_IN + elif e.filter == select.KQ_FILTER_WRITE: + results[fd] |= POLL_OUT + return results.items() + + def register(self, fd, mode): + self._fds[fd] = mode + self._control(fd, mode, select.KQ_EV_ADD) + + def unregister(self, fd): + self._control(fd, self._fds[fd], select.KQ_EV_DELETE) + del self._fds[fd] + + def modify(self, fd, mode): + self.unregister(fd) + self.register(fd, mode) + + def close(self): + self._kqueue.close() + + +class SelectLoop(object): + + def __init__(self): + self._r_list = set() + self._w_list = set() + self._x_list = set() + + def poll(self, timeout): + r, w, x = select.select(self._r_list, self._w_list, self._x_list, + timeout) + results = defaultdict(lambda: POLL_NULL) + for p in [(r, POLL_IN), (w, POLL_OUT), (x, POLL_ERR)]: + for fd in p[0]: + results[fd] |= p[1] + return results.items() + + def register(self, fd, mode): + if mode & POLL_IN: + self._r_list.add(fd) + if mode & POLL_OUT: + self._w_list.add(fd) + if mode & POLL_ERR: + self._x_list.add(fd) + + def unregister(self, fd): + if fd in self._r_list: + self._r_list.remove(fd) + if fd in self._w_list: + self._w_list.remove(fd) + if fd in self._x_list: + self._x_list.remove(fd) + + def modify(self, fd, mode): + self.unregister(fd) + self.register(fd, mode) + + def close(self): + pass + + +class EventLoop(object): + def __init__(self): + if hasattr(select, 'epoll'): + self._impl = select.epoll() + model = 'epoll' + elif hasattr(select, 'kqueue'): + self._impl = KqueueLoop() + model = 'kqueue' + elif hasattr(select, 'select'): + self._impl = SelectLoop() + model = 'select' + else: + raise Exception('can not find any available functions in select ' + 'package') + self._fdmap = {} # (f, handler) + self._last_time = time.time() + self._periodic_callbacks = [] + self._stopping = False + logging.debug('using event model: %s', model) + + def poll(self, timeout=None): + events = self._impl.poll(timeout) + return [(self._fdmap[fd][0], fd, event) for fd, event in events] + + def add(self, f, mode, handler): + fd = f.fileno() + self._fdmap[fd] = (f, handler) + self._impl.register(fd, mode) + + def remove(self, f): + fd = f.fileno() + del self._fdmap[fd] + self._impl.unregister(fd) + + def removefd(self, fd): + del self._fdmap[fd] + self._impl.unregister(fd) + + def add_periodic(self, callback): + self._periodic_callbacks.append(callback) + + def remove_periodic(self, callback): + self._periodic_callbacks.remove(callback) + + def modify(self, f, mode): + fd = f.fileno() + self._impl.modify(fd, mode) + + def stop(self): + self._stopping = True + + def run(self): + events = [] + while not self._stopping: + asap = False + try: + events = self.poll(TIMEOUT_PRECISION) + except (OSError, IOError) as e: + if errno_from_exception(e) in (errno.EPIPE, errno.EINTR): + # EPIPE: Happens when the client closes the connection + # EINTR: Happens when received a signal + # handles them as soon as possible + asap = True + logging.debug('poll:%s', e) + else: + logging.error('poll:%s', e) + import traceback + traceback.print_exc() + continue + + handle = False + for sock, fd, event in events: + handler = self._fdmap.get(fd, None) + if handler is not None: + handler = handler[1] + try: + handle = handler.handle_event(sock, fd, event) or handle + except (OSError, IOError) as e: + shell.print_exception(e) + now = time.time() + if asap or now - self._last_time >= TIMEOUT_PRECISION: + for callback in self._periodic_callbacks: + callback() + self._last_time = now + if events and not handle: + time.sleep(0.001) + + def __del__(self): + self._impl.close() + + +# from tornado +def errno_from_exception(e): + """Provides the errno from an Exception object. + + There are cases that the errno attribute was not set so we pull + the errno out of the args but if someone instatiates an Exception + without any args you will get a tuple error. So this function + abstracts all that behavior to give you a safe way to get the + errno. + """ + + if hasattr(e, 'errno'): + return e.errno + elif e.args: + return e.args[0] + else: + return None + + +# from tornado +def get_sock_error(sock): + error_number = sock.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR) + return socket.error(error_number, os.strerror(error_number)) diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/local.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/local.py new file mode 100644 index 00000000000000..9f54d93066ab31 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/local.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright 2012-2015 clowwindy +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from __future__ import absolute_import, division, print_function, \ + with_statement + +import sys +import os +import logging +import signal + +if __name__ == '__main__': + import inspect + file_path = os.path.dirname(os.path.realpath(inspect.getfile(inspect.currentframe()))) + sys.path.insert(0, os.path.join(file_path, '../')) + +from shadowsocks import shell, daemon, eventloop, tcprelay, udprelay, asyncdns + + +def main(): + shell.check_python() + + # fix py2exe + if hasattr(sys, "frozen") and sys.frozen in \ + ("windows_exe", "console_exe"): + p = os.path.dirname(os.path.abspath(sys.executable)) + os.chdir(p) + + config = shell.get_config(True) + + if not config.get('dns_ipv6', False): + asyncdns.IPV6_CONNECTION_SUPPORT = False + + daemon.daemon_exec(config) + logging.info("local start with protocol[%s] password [%s] method [%s] obfs [%s] obfs_param [%s]" % + (config['protocol'], config['password'], config['method'], config['obfs'], config['obfs_param'])) + + try: + logging.info("starting local at %s:%d" % + (config['local_address'], config['local_port'])) + + dns_resolver = asyncdns.DNSResolver() + tcp_server = tcprelay.TCPRelay(config, dns_resolver, True) + udp_server = udprelay.UDPRelay(config, dns_resolver, True) + loop = eventloop.EventLoop() + dns_resolver.add_to_loop(loop) + tcp_server.add_to_loop(loop) + udp_server.add_to_loop(loop) + + def handler(signum, _): + logging.warn('received SIGQUIT, doing graceful shutting down..') + tcp_server.close(next_tick=True) + udp_server.close(next_tick=True) + signal.signal(getattr(signal, 'SIGQUIT', signal.SIGTERM), handler) + + def int_handler(signum, _): + sys.exit(1) + signal.signal(signal.SIGINT, int_handler) + + daemon.set_user(config.get('user', None)) + loop.run() + except Exception as e: + shell.print_exception(e) + sys.exit(1) + +if __name__ == '__main__': + main() diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/logrun.sh b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/logrun.sh new file mode 100644 index 00000000000000..fc081e1d2b2ca5 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/logrun.sh @@ -0,0 +1,8 @@ +#!/bin/bash +cd `dirname $0` +python_ver=$(ls /usr/bin|grep -e "^python[23]\.[1-9]\+$"|tail -1) +eval $(ps -ef | grep "[0-9] ${python_ver} server\\.py a" | awk '{print "kill "$2}') +ulimit -n 512000 +nohup ${python_ver} server.py a>> ssserver.log 2>&1 & + + diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/lru_cache.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/lru_cache.py new file mode 100644 index 00000000000000..ab0d210861f9d5 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/lru_cache.py @@ -0,0 +1,179 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright 2015 clowwindy +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from __future__ import absolute_import, division, print_function, \ + with_statement + +import collections +import logging +import time + +if __name__ == '__main__': + import os, sys, inspect + file_path = os.path.dirname(os.path.realpath(inspect.getfile(inspect.currentframe()))) + sys.path.insert(0, os.path.join(file_path, '../')) + +try: + from collections import OrderedDict +except: + from shadowsocks.ordereddict import OrderedDict + +# this LRUCache is optimized for concurrency, not QPS +# n: concurrency, keys stored in the cache +# m: visits not timed out, proportional to QPS * timeout +# get & set is O(1), not O(n). thus we can support very large n +# sweep is O((n - m)) or O(1024) at most, +# no metter how large the cache or timeout value is + +SWEEP_MAX_ITEMS = 1024 + +class LRUCache(collections.MutableMapping): + """This class is not thread safe""" + + def __init__(self, timeout=60, close_callback=None, *args, **kwargs): + self.timeout = timeout + self.close_callback = close_callback + self._store = {} + self._keys_to_last_time = OrderedDict() + self.update(dict(*args, **kwargs)) # use the free update to set keys + + def __getitem__(self, key): + # O(1) + t = time.time() + last_t = self._keys_to_last_time[key] + del self._keys_to_last_time[key] + self._keys_to_last_time[key] = t + return self._store[key] + + def __setitem__(self, key, value): + # O(1) + t = time.time() + if key in self._keys_to_last_time: + del self._keys_to_last_time[key] + self._keys_to_last_time[key] = t + self._store[key] = value + + def __delitem__(self, key): + # O(1) + last_t = self._keys_to_last_time[key] + del self._store[key] + del self._keys_to_last_time[key] + + def __contains__(self, key): + return key in self._store + + def __iter__(self): + return iter(self._store) + + def __len__(self): + return len(self._store) + + def first(self): + if len(self._keys_to_last_time) > 0: + for key in self._keys_to_last_time: + return key + + def sweep(self, sweep_item_cnt = SWEEP_MAX_ITEMS): + # O(n - m) + now = time.time() + c = 0 + while c < sweep_item_cnt: + if len(self._keys_to_last_time) == 0: + break + for key in self._keys_to_last_time: + break + last_t = self._keys_to_last_time[key] + if now - last_t <= self.timeout: + break + value = self._store[key] + del self._store[key] + del self._keys_to_last_time[key] + if self.close_callback is not None: + self.close_callback(value) + c += 1 + if c: + logging.debug('%d keys swept' % c) + return c < SWEEP_MAX_ITEMS + + def clear(self, keep): + now = time.time() + c = 0 + while len(self._keys_to_last_time) > keep: + if len(self._keys_to_last_time) == 0: + break + for key in self._keys_to_last_time: + break + last_t = self._keys_to_last_time[key] + value = self._store[key] + if self.close_callback is not None: + self.close_callback(value) + del self._store[key] + del self._keys_to_last_time[key] + c += 1 + if c: + logging.debug('%d keys swept' % c) + return c < SWEEP_MAX_ITEMS + +def test(): + c = LRUCache(timeout=0.3) + + c['a'] = 1 + assert c['a'] == 1 + c['a'] = 1 + + time.sleep(0.5) + c.sweep() + assert 'a' not in c + + c['a'] = 2 + c['b'] = 3 + time.sleep(0.2) + c.sweep() + assert c['a'] == 2 + assert c['b'] == 3 + + time.sleep(0.2) + c.sweep() + c['b'] + time.sleep(0.2) + c.sweep() + assert 'a' not in c + assert c['b'] == 3 + + time.sleep(0.5) + c.sweep() + assert 'a' not in c + assert 'b' not in c + + global close_cb_called + close_cb_called = False + + def close_cb(t): + global close_cb_called + assert not close_cb_called + close_cb_called = True + + c = LRUCache(timeout=0.1, close_callback=close_cb) + c['s'] = 1 + c['s'] + time.sleep(0.1) + c['s'] + time.sleep(0.3) + c.sweep() + +if __name__ == '__main__': + test() diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/manager.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/manager.py new file mode 100644 index 00000000000000..80d0a320bb23cb --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/manager.py @@ -0,0 +1,291 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright 2015 clowwindy +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from __future__ import absolute_import, division, print_function, \ + with_statement + +import errno +import traceback +import socket +import logging +import json +import collections + +from shadowsocks import common, eventloop, tcprelay, udprelay, asyncdns, shell + + +BUF_SIZE = 1506 +STAT_SEND_LIMIT = 50 + + +class Manager(object): + + def __init__(self, config): + self._config = config + self._relays = {} # (tcprelay, udprelay) + self._loop = eventloop.EventLoop() + self._dns_resolver = asyncdns.DNSResolver() + self._dns_resolver.add_to_loop(self._loop) + + self._statistics = collections.defaultdict(int) + self._control_client_addr = None + try: + manager_address = common.to_str(config['manager_address']) + if ':' in manager_address: + addr = manager_address.rsplit(':', 1) + addr = addr[0], int(addr[1]) + addrs = socket.getaddrinfo(addr[0], addr[1]) + if addrs: + family = addrs[0][0] + else: + logging.error('invalid address: %s', manager_address) + exit(1) + else: + addr = manager_address + family = socket.AF_UNIX + self._control_socket = socket.socket(family, + socket.SOCK_DGRAM) + self._control_socket.bind(addr) + self._control_socket.setblocking(False) + except (OSError, IOError) as e: + logging.error(e) + logging.error('can not bind to manager address') + exit(1) + self._loop.add(self._control_socket, + eventloop.POLL_IN, self) + self._loop.add_periodic(self.handle_periodic) + + port_password = config['port_password'] + del config['port_password'] + for port, password in port_password.items(): + a_config = config.copy() + a_config['server_port'] = int(port) + a_config['password'] = password + self.add_port(a_config) + + def add_port(self, config): + port = int(config['server_port']) + servers = self._relays.get(port, None) + if servers: + logging.error("server already exists at %s:%d" % (config['server'], + port)) + return + logging.info("adding server at %s:%d" % (config['server'], port)) + t = tcprelay.TCPRelay(config, self._dns_resolver, False, + stat_callback=self.stat_callback) + u = udprelay.UDPRelay(config, self._dns_resolver, False, + stat_callback=self.stat_callback) + t.add_to_loop(self._loop) + u.add_to_loop(self._loop) + self._relays[port] = (t, u) + + def remove_port(self, config): + port = int(config['server_port']) + servers = self._relays.get(port, None) + if servers: + logging.info("removing server at %s:%d" % (config['server'], port)) + t, u = servers + t.close(next_tick=False) + u.close(next_tick=False) + del self._relays[port] + else: + logging.error("server not exist at %s:%d" % (config['server'], + port)) + + def handle_event(self, sock, fd, event): + if sock == self._control_socket and event == eventloop.POLL_IN: + data, self._control_client_addr = sock.recvfrom(BUF_SIZE) + parsed = self._parse_command(data) + if parsed: + command, config = parsed + a_config = self._config.copy() + if config: + # let the command override the configuration file + a_config.update(config) + if 'server_port' not in a_config: + logging.error('can not find server_port in config') + else: + if command == 'add': + self.add_port(a_config) + self._send_control_data(b'ok') + elif command == 'remove': + self.remove_port(a_config) + self._send_control_data(b'ok') + elif command == 'ping': + self._send_control_data(b'pong') + else: + logging.error('unknown command %s', command) + + def _parse_command(self, data): + # commands: + # add: {"server_port": 8000, "password": "foobar"} + # remove: {"server_port": 8000"} + data = common.to_str(data) + parts = data.split(':', 1) + if len(parts) < 2: + return data, None + command, config_json = parts + try: + config = shell.parse_json_in_str(config_json) + return command, config + except Exception as e: + logging.error(e) + return None + + def stat_callback(self, port, data_len): + self._statistics[port] += data_len + + def handle_periodic(self): + r = {} + i = 0 + + def send_data(data_dict): + if data_dict: + # use compact JSON format (without space) + data = common.to_bytes(json.dumps(data_dict, + separators=(',', ':'))) + self._send_control_data(b'stat: ' + data) + + for k, v in self._statistics.items(): + r[k] = v + i += 1 + # split the data into segments that fit in UDP packets + if i >= STAT_SEND_LIMIT: + send_data(r) + r.clear() + i = 0 + if len(r) > 0 : + send_data(r) + self._statistics.clear() + + def _send_control_data(self, data): + if self._control_client_addr: + try: + self._control_socket.sendto(data, self._control_client_addr) + except (socket.error, OSError, IOError) as e: + error_no = eventloop.errno_from_exception(e) + if error_no in (errno.EAGAIN, errno.EINPROGRESS, + errno.EWOULDBLOCK): + return + else: + shell.print_exception(e) + if self._config['verbose']: + traceback.print_exc() + + def run(self): + self._loop.run() + + +def run(config): + Manager(config).run() + + +def test(): + import time + import threading + import struct + from shadowsocks import encrypt + + logging.basicConfig(level=5, + format='%(asctime)s %(levelname)-8s %(message)s', + datefmt='%Y-%m-%d %H:%M:%S') + enc = [] + eventloop.TIMEOUT_PRECISION = 1 + + def run_server(): + config = shell.get_config(True) + config = config.copy() + a_config = { + 'server': '127.0.0.1', + 'local_port': 1081, + 'port_password': { + '8381': 'foobar1', + '8382': 'foobar2' + }, + 'method': 'aes-256-cfb', + 'manager_address': '127.0.0.1:6001', + 'timeout': 60, + 'fast_open': False, + 'verbose': 2 + } + config.update(a_config) + manager = Manager(config) + enc.append(manager) + manager.run() + + t = threading.Thread(target=run_server) + t.start() + time.sleep(1) + manager = enc[0] + cli = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + cli.connect(('127.0.0.1', 6001)) + + # test add and remove + time.sleep(1) + cli.send(b'add: {"server_port":7001, "password":"asdfadsfasdf"}') + time.sleep(1) + assert 7001 in manager._relays + data, addr = cli.recvfrom(1506) + assert b'ok' in data + + cli.send(b'remove: {"server_port":8381}') + time.sleep(1) + assert 8381 not in manager._relays + data, addr = cli.recvfrom(1506) + assert b'ok' in data + logging.info('add and remove test passed') + + # test statistics for TCP + header = common.pack_addr(b'google.com') + struct.pack('>H', 80) + data = encrypt.encrypt_all(b'asdfadsfasdf', 'aes-256-cfb', 1, + header + b'GET /\r\n\r\n') + tcp_cli = socket.socket() + tcp_cli.connect(('127.0.0.1', 7001)) + tcp_cli.send(data) + tcp_cli.recv(4096) + tcp_cli.close() + + data, addr = cli.recvfrom(1506) + data = common.to_str(data) + assert data.startswith('stat: ') + data = data.split('stat:')[1] + stats = shell.parse_json_in_str(data) + assert '7001' in stats + logging.info('TCP statistics test passed') + + # test statistics for UDP + header = common.pack_addr(b'127.0.0.1') + struct.pack('>H', 80) + data = encrypt.encrypt_all(b'foobar2', 'aes-256-cfb', 1, + header + b'test') + udp_cli = socket.socket(type=socket.SOCK_DGRAM) + udp_cli.sendto(data, ('127.0.0.1', 8382)) + tcp_cli.close() + + data, addr = cli.recvfrom(1506) + data = common.to_str(data) + assert data.startswith('stat: ') + data = data.split('stat:')[1] + stats = json.loads(data) + assert '8382' in stats + logging.info('UDP statistics test passed') + + manager._loop.stop() + t.join() + + +if __name__ == '__main__': + test() diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/obfs.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/obfs.py new file mode 100644 index 00000000000000..3dfdb141f11c26 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/obfs.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python +# +# Copyright 2015-2015 breakwa11 +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from __future__ import absolute_import, division, print_function, \ + with_statement + +import os +import sys +import hashlib +import logging + +from shadowsocks import common +from shadowsocks.obfsplugin import plain, http_simple, obfs_tls, verify, auth, auth_chain + + +method_supported = {} +method_supported.update(plain.obfs_map) +method_supported.update(http_simple.obfs_map) +method_supported.update(obfs_tls.obfs_map) +method_supported.update(verify.obfs_map) +method_supported.update(auth.obfs_map) +method_supported.update(auth_chain.obfs_map) + +def mu_protocol(): + return ["auth_aes128_md5", "auth_aes128_sha1", "auth_chain_a"] + +class server_info(object): + def __init__(self, data): + self.data = data + +class obfs(object): + def __init__(self, method): + method = common.to_str(method) + self.method = method + self._method_info = self.get_method_info(method) + if self._method_info: + self.obfs = self.get_obfs(method) + else: + raise Exception('obfs plugin [%s] not supported' % method) + + def init_data(self): + return self.obfs.init_data() + + def set_server_info(self, server_info): + return self.obfs.set_server_info(server_info) + + def get_server_info(self): + return self.obfs.get_server_info() + + def get_method_info(self, method): + method = method.lower() + m = method_supported.get(method) + return m + + def get_obfs(self, method): + m = self._method_info + return m[0](method) + + def get_overhead(self, direction): + return self.obfs.get_overhead(direction) + + def client_pre_encrypt(self, buf): + return self.obfs.client_pre_encrypt(buf) + + def client_encode(self, buf): + return self.obfs.client_encode(buf) + + def client_decode(self, buf): + return self.obfs.client_decode(buf) + + def client_post_decrypt(self, buf): + return self.obfs.client_post_decrypt(buf) + + def server_pre_encrypt(self, buf): + return self.obfs.server_pre_encrypt(buf) + + def server_encode(self, buf): + return self.obfs.server_encode(buf) + + def server_decode(self, buf): + return self.obfs.server_decode(buf) + + def server_post_decrypt(self, buf): + return self.obfs.server_post_decrypt(buf) + + def client_udp_pre_encrypt(self, buf): + return self.obfs.client_udp_pre_encrypt(buf) + + def client_udp_post_decrypt(self, buf): + return self.obfs.client_udp_post_decrypt(buf) + + def server_udp_pre_encrypt(self, buf, uid): + return self.obfs.server_udp_pre_encrypt(buf, uid) + + def server_udp_post_decrypt(self, buf): + return self.obfs.server_udp_post_decrypt(buf) + + def dispose(self): + self.obfs.dispose() + del self.obfs + diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/obfsplugin/__init__.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/obfsplugin/__init__.py new file mode 100644 index 00000000000000..401c7b726e6d62 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/obfsplugin/__init__.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python +# +# Copyright 2015 clowwindy +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from __future__ import absolute_import, division, print_function, \ + with_statement diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/obfsplugin/auth.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/obfsplugin/auth.py new file mode 100644 index 00000000000000..a745e098fcb0b6 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/obfsplugin/auth.py @@ -0,0 +1,787 @@ +#!/usr/bin/env python +# +# Copyright 2015-2015 breakwa11 +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from __future__ import absolute_import, division, print_function, \ + with_statement + +import os +import sys +import hashlib +import logging +import binascii +import base64 +import time +import datetime +import random +import math +import struct +import zlib +import hmac +import hashlib + +import shadowsocks +from shadowsocks import common, lru_cache, encrypt +from shadowsocks.obfsplugin import plain +from shadowsocks.common import to_bytes, to_str, ord, chr + +def create_auth_sha1_v4(method): + return auth_sha1_v4(method) + +def create_auth_aes128_md5(method): + return auth_aes128_sha1(method, hashlib.md5) + +def create_auth_aes128_sha1(method): + return auth_aes128_sha1(method, hashlib.sha1) + +obfs_map = { + 'auth_sha1_v4': (create_auth_sha1_v4,), + 'auth_sha1_v4_compatible': (create_auth_sha1_v4,), + 'auth_aes128_md5': (create_auth_aes128_md5,), + 'auth_aes128_sha1': (create_auth_aes128_sha1,), +} + +def match_begin(str1, str2): + if len(str1) >= len(str2): + if str1[:len(str2)] == str2: + return True + return False + +class auth_base(plain.plain): + def __init__(self, method): + super(auth_base, self).__init__(method) + self.method = method + self.no_compatible_method = '' + self.overhead = 7 + + def init_data(self): + return '' + + def get_overhead(self, direction): # direction: true for c->s false for s->c + return self.overhead + + def set_server_info(self, server_info): + self.server_info = server_info + + def client_encode(self, buf): + return buf + + def client_decode(self, buf): + return (buf, False) + + def server_encode(self, buf): + return buf + + def server_decode(self, buf): + return (buf, True, False) + + def not_match_return(self, buf): + self.raw_trans = True + self.overhead = 0 + if self.method == self.no_compatible_method: + return (b'E'*2048, False) + return (buf, False) + +class client_queue(object): + def __init__(self, begin_id): + self.front = begin_id - 64 + self.back = begin_id + 1 + self.alloc = {} + self.enable = True + self.last_update = time.time() + + def update(self): + self.last_update = time.time() + + def is_active(self): + return time.time() - self.last_update < 60 * 3 + + def re_enable(self, connection_id): + self.enable = True + self.front = connection_id - 64 + self.back = connection_id + 1 + self.alloc = {} + + def insert(self, connection_id): + if not self.enable: + logging.warn('obfs auth: not enable') + return False + if not self.is_active(): + self.re_enable(connection_id) + self.update() + if connection_id < self.front: + logging.warn('obfs auth: deprecated id, someone replay attack') + return False + if connection_id > self.front + 0x4000: + logging.warn('obfs auth: wrong id') + return False + if connection_id in self.alloc: + logging.warn('obfs auth: duplicate id, someone replay attack') + return False + if self.back <= connection_id: + self.back = connection_id + 1 + self.alloc[connection_id] = 1 + while (self.front in self.alloc) or self.front + 0x1000 < self.back: + if self.front in self.alloc: + del self.alloc[self.front] + self.front += 1 + return True + +class obfs_auth_v2_data(object): + def __init__(self): + self.client_id = lru_cache.LRUCache() + self.local_client_id = b'' + self.connection_id = 0 + self.set_max_client(64) # max active client count + + def update(self, client_id, connection_id): + if client_id in self.client_id: + self.client_id[client_id].update() + + def set_max_client(self, max_client): + self.max_client = max_client + self.max_buffer = max(self.max_client * 2, 1024) + + def insert(self, client_id, connection_id): + if self.client_id.get(client_id, None) is None or not self.client_id[client_id].enable: + if self.client_id.first() is None or len(self.client_id) < self.max_client: + if client_id not in self.client_id: + #TODO: check + self.client_id[client_id] = client_queue(connection_id) + else: + self.client_id[client_id].re_enable(connection_id) + return self.client_id[client_id].insert(connection_id) + + if not self.client_id[self.client_id.first()].is_active(): + del self.client_id[self.client_id.first()] + if client_id not in self.client_id: + #TODO: check + self.client_id[client_id] = client_queue(connection_id) + else: + self.client_id[client_id].re_enable(connection_id) + return self.client_id[client_id].insert(connection_id) + + logging.warn('auth_sha1_v2: no inactive client') + return False + else: + return self.client_id[client_id].insert(connection_id) + +class auth_sha1_v4(auth_base): + def __init__(self, method): + super(auth_sha1_v4, self).__init__(method) + self.recv_buf = b'' + self.unit_len = 8100 + self.decrypt_packet_num = 0 + self.raw_trans = False + self.has_sent_header = False + self.has_recv_header = False + self.client_id = 0 + self.connection_id = 0 + self.max_time_dif = 60 * 60 * 24 # time dif (second) setting + self.salt = b"auth_sha1_v4" + self.no_compatible_method = 'auth_sha1_v4' + + def init_data(self): + return obfs_auth_v2_data() + + def set_server_info(self, server_info): + self.server_info = server_info + try: + max_client = int(server_info.protocol_param) + except: + max_client = 64 + self.server_info.data.set_max_client(max_client) + + def rnd_data(self, buf_size): + if buf_size > 1200: + return b'\x01' + + if buf_size > 400: + rnd_data = os.urandom(common.ord(os.urandom(1)[0]) % 256) + else: + rnd_data = os.urandom(struct.unpack('>H', os.urandom(2))[0] % 512) + + if len(rnd_data) < 128: + return common.chr(len(rnd_data) + 1) + rnd_data + else: + return common.chr(255) + struct.pack('>H', len(rnd_data) + 3) + rnd_data + + def pack_data(self, buf): + data = self.rnd_data(len(buf)) + buf + data_len = len(data) + 8 + crc = binascii.crc32(struct.pack('>H', data_len)) & 0xFFFF + data = struct.pack('H', data_len) + data + adler32 = zlib.adler32(data) & 0xFFFFFFFF + data += struct.pack('H', data_len) + self.salt + self.server_info.key) & 0xFFFFFFFF + data = struct.pack('H', data_len) + data + data += hmac.new(self.server_info.iv + self.server_info.key, data, hashlib.sha1).digest()[:10] + return data + + def auth_data(self): + utc_time = int(time.time()) & 0xFFFFFFFF + if self.server_info.data.connection_id > 0xFF000000: + self.server_info.data.local_client_id = b'' + if not self.server_info.data.local_client_id: + self.server_info.data.local_client_id = os.urandom(4) + logging.debug("local_client_id %s" % (binascii.hexlify(self.server_info.data.local_client_id),)) + self.server_info.data.connection_id = struct.unpack(' self.unit_len: + ret += self.pack_data(buf[:self.unit_len]) + buf = buf[self.unit_len:] + ret += self.pack_data(buf) + return ret + + def client_post_decrypt(self, buf): + if self.raw_trans: + return buf + self.recv_buf += buf + out_buf = b'' + while len(self.recv_buf) > 4: + crc = struct.pack('H', self.recv_buf[:2])[0] + if length >= 8192 or length < 7: + self.raw_trans = True + self.recv_buf = b'' + raise Exception('client_post_decrypt data error') + if length > len(self.recv_buf): + break + + if struct.pack('H', self.recv_buf[5:7])[0] + 4 + out_buf += self.recv_buf[pos:length - 4] + self.recv_buf = self.recv_buf[length:] + + if out_buf: + self.decrypt_packet_num += 1 + return out_buf + + def server_pre_encrypt(self, buf): + if self.raw_trans: + return buf + ret = b'' + while len(buf) > self.unit_len: + ret += self.pack_data(buf[:self.unit_len]) + buf = buf[self.unit_len:] + ret += self.pack_data(buf) + return ret + + def server_post_decrypt(self, buf): + if self.raw_trans: + return (buf, False) + self.recv_buf += buf + out_buf = b'' + sendback = False + + if not self.has_recv_header: + if len(self.recv_buf) <= 6: + return (b'', False) + crc = struct.pack('H', self.recv_buf[:2])[0] + if length > len(self.recv_buf): + return (b'', False) + sha1data = hmac.new(self.server_info.recv_iv + self.server_info.key, self.recv_buf[:length - 10], hashlib.sha1).digest()[:10] + if sha1data != self.recv_buf[length - 10:length]: + logging.error('auth_sha1_v4 data uncorrect auth HMAC-SHA1') + return self.not_match_return(self.recv_buf) + pos = common.ord(self.recv_buf[6]) + if pos < 255: + pos += 6 + else: + pos = struct.unpack('>H', self.recv_buf[7:9])[0] + 6 + out_buf = self.recv_buf[pos:length - 10] + if len(out_buf) < 12: + logging.info('auth_sha1_v4: too short, data %s' % (binascii.hexlify(self.recv_buf),)) + return self.not_match_return(self.recv_buf) + utc_time = struct.unpack(' self.max_time_dif: + logging.info('auth_sha1_v4: wrong timestamp, time_dif %d, data %s' % (time_dif, binascii.hexlify(out_buf),)) + return self.not_match_return(self.recv_buf) + elif self.server_info.data.insert(client_id, connection_id): + self.has_recv_header = True + out_buf = out_buf[12:] + self.client_id = client_id + self.connection_id = connection_id + else: + logging.info('auth_sha1_v4: auth fail, data %s' % (binascii.hexlify(out_buf),)) + return self.not_match_return(self.recv_buf) + self.recv_buf = self.recv_buf[length:] + self.has_recv_header = True + sendback = True + + while len(self.recv_buf) > 4: + crc = struct.pack('H', self.recv_buf[:2])[0] + if length >= 8192 or length < 7: + self.raw_trans = True + self.recv_buf = b'' + if self.decrypt_packet_num == 0: + logging.info('auth_sha1_v4: over size') + return (b'E'*2048, False) + else: + raise Exception('server_post_decrype data error') + if length > len(self.recv_buf): + break + + if struct.pack('H', self.recv_buf[5:7])[0] + 4 + out_buf += self.recv_buf[pos:length - 4] + self.recv_buf = self.recv_buf[length:] + if pos == length - 4: + sendback = True + + if out_buf: + self.server_info.data.update(self.client_id, self.connection_id) + self.decrypt_packet_num += 1 + return (out_buf, sendback) + +class obfs_auth_mu_data(object): + def __init__(self): + self.user_id = {} + self.local_client_id = b'' + self.connection_id = 0 + self.set_max_client(64) # max active client count + + def update(self, user_id, client_id, connection_id): + if user_id not in self.user_id: + self.user_id[user_id] = lru_cache.LRUCache() + local_client_id = self.user_id[user_id] + + if client_id in local_client_id: + local_client_id[client_id].update() + + def set_max_client(self, max_client): + self.max_client = max_client + self.max_buffer = max(self.max_client * 2, 1024) + + def insert(self, user_id, client_id, connection_id): + if user_id not in self.user_id: + self.user_id[user_id] = lru_cache.LRUCache() + local_client_id = self.user_id[user_id] + + if local_client_id.get(client_id, None) is None or not local_client_id[client_id].enable: + if local_client_id.first() is None or len(local_client_id) < self.max_client: + if client_id not in local_client_id: + #TODO: check + local_client_id[client_id] = client_queue(connection_id) + else: + local_client_id[client_id].re_enable(connection_id) + return local_client_id[client_id].insert(connection_id) + + if not local_client_id[local_client_id.first()].is_active(): + del local_client_id[local_client_id.first()] + if client_id not in local_client_id: + #TODO: check + local_client_id[client_id] = client_queue(connection_id) + else: + local_client_id[client_id].re_enable(connection_id) + return local_client_id[client_id].insert(connection_id) + + logging.warn('auth_aes128: no inactive client') + return False + else: + return local_client_id[client_id].insert(connection_id) + +class auth_aes128_sha1(auth_base): + def __init__(self, method, hashfunc): + super(auth_aes128_sha1, self).__init__(method) + self.hashfunc = hashfunc + self.recv_buf = b'' + self.unit_len = 8100 + self.raw_trans = False + self.has_sent_header = False + self.has_recv_header = False + self.client_id = 0 + self.connection_id = 0 + self.max_time_dif = 60 * 60 * 24 # time dif (second) setting + self.salt = hashfunc == hashlib.md5 and b"auth_aes128_md5" or b"auth_aes128_sha1" + self.no_compatible_method = hashfunc == hashlib.md5 and "auth_aes128_md5" or 'auth_aes128_sha1' + self.extra_wait_size = struct.unpack('>H', os.urandom(2))[0] % 1024 + self.pack_id = 1 + self.recv_id = 1 + self.user_id = None + self.user_key = None + self.last_rnd_len = 0 + self.overhead = 9 + + def init_data(self): + return obfs_auth_mu_data() + + def get_overhead(self, direction): # direction: true for c->s false for s->c + return self.overhead + + def set_server_info(self, server_info): + self.server_info = server_info + try: + max_client = int(server_info.protocol_param.split('#')[0]) + except: + max_client = 64 + self.server_info.data.set_max_client(max_client) + + def trapezoid_random_float(self, d): + if d == 0: + return random.random() + s = random.random() + a = 1 - d + return (math.sqrt(a * a + 4 * d * s) - a) / (2 * d) + + def trapezoid_random_int(self, max_val, d): + v = self.trapezoid_random_float(d) + return int(v * max_val) + + def rnd_data_len(self, buf_size, full_buf_size): + if full_buf_size >= self.server_info.buffer_size: + return 0 + tcp_mss = self.server_info.tcp_mss + rev_len = tcp_mss - buf_size - 9 + if rev_len == 0: + return 0 + if rev_len < 0: + if rev_len > -tcp_mss: + return self.trapezoid_random_int(rev_len + tcp_mss, -0.3) + return common.ord(os.urandom(1)[0]) % 32 + if buf_size > 900: + return struct.unpack('>H', os.urandom(2))[0] % rev_len + return self.trapezoid_random_int(rev_len, -0.3) + + def rnd_data(self, buf_size, full_buf_size): + data_len = self.rnd_data_len(buf_size, full_buf_size) + + if data_len < 128: + return common.chr(data_len + 1) + os.urandom(data_len) + + return common.chr(255) + struct.pack(' 400: + rnd_len = struct.unpack(' 0xFF000000: + self.server_info.data.local_client_id = b'' + if not self.server_info.data.local_client_id: + self.server_info.data.local_client_id = os.urandom(4) + logging.debug("local_client_id %s" % (binascii.hexlify(self.server_info.data.local_client_id),)) + self.server_info.data.connection_id = struct.unpack(' self.unit_len: + ret += self.pack_data(buf[:self.unit_len], ogn_data_len) + buf = buf[self.unit_len:] + ret += self.pack_data(buf, ogn_data_len) + self.last_rnd_len = ogn_data_len + return ret + + def client_post_decrypt(self, buf): + if self.raw_trans: + return buf + self.recv_buf += buf + out_buf = b'' + while len(self.recv_buf) > 4: + mac_key = self.user_key + struct.pack('= 8192 or length < 7: + self.raw_trans = True + self.recv_buf = b'' + raise Exception('client_post_decrypt data error') + if length > len(self.recv_buf): + break + + if hmac.new(mac_key, self.recv_buf[:length - 4], self.hashfunc).digest()[:4] != self.recv_buf[length - 4:length]: + self.raw_trans = True + self.recv_buf = b'' + raise Exception('client_post_decrypt data uncorrect checksum') + + self.recv_id = (self.recv_id + 1) & 0xFFFFFFFF + pos = common.ord(self.recv_buf[4]) + if pos < 255: + pos += 4 + else: + pos = struct.unpack(' self.unit_len: + ret += self.pack_data(buf[:self.unit_len], ogn_data_len) + buf = buf[self.unit_len:] + ret += self.pack_data(buf, ogn_data_len) + self.last_rnd_len = ogn_data_len + return ret + + def server_post_decrypt(self, buf): + if self.raw_trans: + return (buf, False) + self.recv_buf += buf + out_buf = b'' + sendback = False + + if not self.has_recv_header: + if len(self.recv_buf) >= 7 or len(self.recv_buf) in [2, 3]: + recv_len = min(len(self.recv_buf), 7) + mac_key = self.server_info.recv_iv + self.server_info.key + sha1data = hmac.new(mac_key, self.recv_buf[:1], self.hashfunc).digest()[:recv_len - 1] + if sha1data != self.recv_buf[1:recv_len]: + return self.not_match_return(self.recv_buf) + + if len(self.recv_buf) < 31: + return (b'', False) + sha1data = hmac.new(mac_key, self.recv_buf[7:27], self.hashfunc).digest()[:4] + if sha1data != self.recv_buf[27:31]: + logging.error('%s data uncorrect auth HMAC-SHA1 from %s:%d, data %s' % (self.no_compatible_method, self.server_info.client, self.server_info.client_port, binascii.hexlify(self.recv_buf))) + if len(self.recv_buf) < 31 + self.extra_wait_size: + return (b'', False) + return self.not_match_return(self.recv_buf) + + uid = self.recv_buf[7:11] + if uid in self.server_info.users: + self.user_id = uid + self.user_key = self.hashfunc(self.server_info.users[uid]).digest() + self.server_info.update_user_func(uid) + else: + if not self.server_info.users: + self.user_key = self.server_info.key + else: + self.user_key = self.server_info.recv_iv + encryptor = encrypt.Encryptor(to_bytes(base64.b64encode(self.user_key)) + self.salt, 'aes-128-cbc') + head = encryptor.decrypt(b'\x00' * 16 + self.recv_buf[11:27] + b'\x00') # need an extra byte or recv empty + length = struct.unpack(' self.max_time_dif: + logging.info('%s: wrong timestamp, time_dif %d, data %s' % (self.no_compatible_method, time_dif, binascii.hexlify(head))) + return self.not_match_return(self.recv_buf) + elif self.server_info.data.insert(self.user_id, client_id, connection_id): + self.has_recv_header = True + out_buf = self.recv_buf[31 + rnd_len:length - 4] + self.client_id = client_id + self.connection_id = connection_id + else: + logging.info('%s: auth fail, data %s' % (self.no_compatible_method, binascii.hexlify(out_buf))) + return self.not_match_return(self.recv_buf) + self.recv_buf = self.recv_buf[length:] + self.has_recv_header = True + sendback = True + + while len(self.recv_buf) > 4: + mac_key = self.user_key + struct.pack('= 8192 or length < 7: + self.raw_trans = True + self.recv_buf = b'' + if self.recv_id == 0: + logging.info(self.no_compatible_method + ': over size') + return (b'E'*2048, False) + else: + raise Exception('server_post_decrype data error') + if length > len(self.recv_buf): + break + + if hmac.new(mac_key, self.recv_buf[:length - 4], self.hashfunc).digest()[:4] != self.recv_buf[length - 4:length]: + logging.info('%s: checksum error, data %s' % (self.no_compatible_method, binascii.hexlify(self.recv_buf[:length]))) + self.raw_trans = True + self.recv_buf = b'' + if self.recv_id == 0: + return (b'E'*2048, False) + else: + raise Exception('server_post_decrype data uncorrect checksum') + + self.recv_id = (self.recv_id + 1) & 0xFFFFFFFF + pos = common.ord(self.recv_buf[4]) + if pos < 255: + pos += 4 + else: + pos = struct.unpack('> 17) ^ (y >> 26)) & xorshift128plus.max_int + self.v1 = x + return (x + y) & xorshift128plus.max_int + + def init_from_bin(self, bin): + bin += b'\0' * 16 + self.v0 = struct.unpack('= len(str2): + if str1[:len(str2)] == str2: + return True + return False + + +class auth_base(plain.plain): + def __init__(self, method): + super(auth_base, self).__init__(method) + self.method = method + self.no_compatible_method = '' + self.overhead = 4 + + def init_data(self): + return '' + + def get_overhead(self, direction): # direction: true for c->s false for s->c + return self.overhead + + def set_server_info(self, server_info): + self.server_info = server_info + + def client_encode(self, buf): + return buf + + def client_decode(self, buf): + return (buf, False) + + def server_encode(self, buf): + return buf + + def server_decode(self, buf): + return (buf, True, False) + + def not_match_return(self, buf): + self.raw_trans = True + self.overhead = 0 + if self.method == self.no_compatible_method: + return (b'E' * 2048, False) + return (buf, False) + + +class client_queue(object): + def __init__(self, begin_id): + self.front = begin_id - 64 + self.back = begin_id + 1 + self.alloc = {} + self.enable = True + self.last_update = time.time() + self.ref = 0 + + def update(self): + self.last_update = time.time() + + def addref(self): + self.ref += 1 + + def delref(self): + if self.ref > 0: + self.ref -= 1 + + def is_active(self): + return (self.ref > 0) and (time.time() - self.last_update < 60 * 10) + + def re_enable(self, connection_id): + self.enable = True + self.front = connection_id - 64 + self.back = connection_id + 1 + self.alloc = {} + + def insert(self, connection_id): + if not self.enable: + logging.warn('obfs auth: not enable') + return False + if not self.is_active(): + self.re_enable(connection_id) + self.update() + if connection_id < self.front: + logging.warn('obfs auth: deprecated id, someone replay attack') + return False + if connection_id > self.front + 0x4000: + logging.warn('obfs auth: wrong id') + return False + if connection_id in self.alloc: + logging.warn('obfs auth: duplicate id, someone replay attack') + return False + if self.back <= connection_id: + self.back = connection_id + 1 + self.alloc[connection_id] = 1 + while (self.front in self.alloc) or self.front + 0x1000 < self.back: + if self.front in self.alloc: + del self.alloc[self.front] + self.front += 1 + self.addref() + return True + + +class obfs_auth_chain_data(object): + def __init__(self, name): + self.name = name + self.user_id = {} + self.local_client_id = b'' + self.connection_id = 0 + self.set_max_client(64) # max active client count + + def update(self, user_id, client_id, connection_id): + if user_id not in self.user_id: + self.user_id[user_id] = lru_cache.LRUCache() + local_client_id = self.user_id[user_id] + + if client_id in local_client_id: + local_client_id[client_id].update() + + def set_max_client(self, max_client): + self.max_client = max_client + self.max_buffer = max(self.max_client * 2, 1024) + + def insert(self, user_id, client_id, connection_id): + if user_id not in self.user_id: + self.user_id[user_id] = lru_cache.LRUCache() + local_client_id = self.user_id[user_id] + + if local_client_id.get(client_id, None) is None or not local_client_id[client_id].enable: + if local_client_id.first() is None or len(local_client_id) < self.max_client: + if client_id not in local_client_id: + # TODO: check + local_client_id[client_id] = client_queue(connection_id) + else: + local_client_id[client_id].re_enable(connection_id) + return local_client_id[client_id].insert(connection_id) + + if not local_client_id[local_client_id.first()].is_active(): + del local_client_id[local_client_id.first()] + if client_id not in local_client_id: + # TODO: check + local_client_id[client_id] = client_queue(connection_id) + else: + local_client_id[client_id].re_enable(connection_id) + return local_client_id[client_id].insert(connection_id) + + logging.warn(self.name + ': no inactive client') + return False + else: + return local_client_id[client_id].insert(connection_id) + + def remove(self, user_id, client_id): + if user_id in self.user_id: + local_client_id = self.user_id[user_id] + if client_id in local_client_id: + local_client_id[client_id].delref() + + +class auth_chain_a(auth_base): + def __init__(self, method): + super(auth_chain_a, self).__init__(method) + self.hashfunc = hashlib.md5 + self.recv_buf = b'' + self.unit_len = 2800 + self.raw_trans = False + self.has_sent_header = False + self.has_recv_header = False + self.client_id = 0 + self.connection_id = 0 + self.max_time_dif = 60 * 60 * 24 # time dif (second) setting + self.salt = b"auth_chain_a" + self.no_compatible_method = 'auth_chain_a' + self.pack_id = 1 + self.recv_id = 1 + self.user_id = None + self.user_id_num = 0 + self.user_key = None + self.overhead = 4 + self.client_over_head = 4 + self.last_client_hash = b'' + self.last_server_hash = b'' + self.random_client = xorshift128plus() + self.random_server = xorshift128plus() + self.encryptor = None + + def init_data(self): + return obfs_auth_chain_data(self.method) + + def get_overhead(self, direction): # direction: true for c->s false for s->c + return self.overhead + + def set_server_info(self, server_info): + self.server_info = server_info + try: + max_client = int(server_info.protocol_param.split('#')[0]) + except: + max_client = 64 + self.server_info.data.set_max_client(max_client) + + def trapezoid_random_float(self, d): + if d == 0: + return random.random() + s = random.random() + a = 1 - d + return (math.sqrt(a * a + 4 * d * s) - a) / (2 * d) + + def trapezoid_random_int(self, max_val, d): + v = self.trapezoid_random_float(d) + return int(v * max_val) + + def rnd_data_len(self, buf_size, last_hash, random): + if buf_size > 1440: + return 0 + random.init_from_bin_len(last_hash, buf_size) + if buf_size > 1300: + return random.next() % 31 + if buf_size > 900: + return random.next() % 127 + if buf_size > 400: + return random.next() % 521 + return random.next() % 1021 + + def udp_rnd_data_len(self, last_hash, random): + random.init_from_bin(last_hash) + return random.next() % 127 + + def rnd_start_pos(self, rand_len, random): + if rand_len > 0: + return random.next() % 8589934609 % rand_len + return 0 + + def rnd_data(self, buf_size, buf, last_hash, random): + rand_len = self.rnd_data_len(buf_size, last_hash, random) + + rnd_data_buf = os.urandom(rand_len) + + if buf_size == 0: + return rnd_data_buf + else: + if rand_len > 0: + start_pos = self.rnd_start_pos(rand_len, random) + return rnd_data_buf[:start_pos] + buf + rnd_data_buf[start_pos:] + else: + return buf + + def pack_client_data(self, buf): + buf = self.encryptor.encrypt(buf) + data = self.rnd_data(len(buf), buf, self.last_client_hash, self.random_client) + data_len = len(data) + 8 + mac_key = self.user_key + struct.pack(' 0xFF000000: + self.server_info.data.local_client_id = b'' + if not self.server_info.data.local_client_id: + self.server_info.data.local_client_id = os.urandom(4) + logging.debug("local_client_id %s" % (binascii.hexlify(self.server_info.data.local_client_id),)) + self.server_info.data.connection_id = struct.unpack(' self.unit_len: + ret += self.pack_client_data(buf[:self.unit_len]) + buf = buf[self.unit_len:] + ret += self.pack_client_data(buf) + return ret + + def client_post_decrypt(self, buf): + if self.raw_trans: + return buf + self.recv_buf += buf + out_buf = b'' + while len(self.recv_buf) > 4: + mac_key = self.user_key + struct.pack('= 4096: + self.raw_trans = True + self.recv_buf = b'' + raise Exception('client_post_decrypt data error') + + if length + 4 > len(self.recv_buf): + break + + server_hash = hmac.new(mac_key, self.recv_buf[:length + 2], self.hashfunc).digest() + if server_hash[:2] != self.recv_buf[length + 2: length + 4]: + logging.info('%s: checksum error, data %s' + % (self.no_compatible_method, binascii.hexlify(self.recv_buf[:length]))) + self.raw_trans = True + self.recv_buf = b'' + raise Exception('client_post_decrypt data uncorrect checksum') + + pos = 2 + if data_len > 0 and rand_len > 0: + pos = 2 + self.rnd_start_pos(rand_len, self.random_server) + out_buf += self.encryptor.decrypt(self.recv_buf[pos: data_len + pos]) + self.last_server_hash = server_hash + if self.recv_id == 1: + self.server_info.tcp_mss = struct.unpack(' self.unit_len: + ret += self.pack_server_data(buf[:self.unit_len]) + buf = buf[self.unit_len:] + ret += self.pack_server_data(buf) + return ret + + def server_post_decrypt(self, buf): + if self.raw_trans: + return (buf, False) + self.recv_buf += buf + out_buf = b'' + sendback = False + + if not self.has_recv_header: + if len(self.recv_buf) >= 12 or len(self.recv_buf) in [7, 8]: + recv_len = min(len(self.recv_buf), 12) + mac_key = self.server_info.recv_iv + self.server_info.key + md5data = hmac.new(mac_key, self.recv_buf[:4], self.hashfunc).digest() + if md5data[:recv_len - 4] != self.recv_buf[4:recv_len]: + return self.not_match_return(self.recv_buf) + + if len(self.recv_buf) < 12 + 24: + return (b'', False) + + self.last_client_hash = md5data + uid = struct.unpack(' self.max_time_dif: + logging.info('%s: wrong timestamp, time_dif %d, data %s' % ( + self.no_compatible_method, time_dif, binascii.hexlify(head) + )) + return self.not_match_return(self.recv_buf) + elif self.server_info.data.insert(self.user_id, client_id, connection_id): + self.has_recv_header = True + self.client_id = client_id + self.connection_id = connection_id + else: + logging.info('%s: auth fail, data %s' % (self.no_compatible_method, binascii.hexlify(out_buf))) + return self.not_match_return(self.recv_buf) + + self.encryptor = encrypt.Encryptor( + to_bytes(base64.b64encode(self.user_key)) + to_bytes(base64.b64encode(self.last_client_hash)), 'rc4') + self.recv_buf = self.recv_buf[36:] + self.has_recv_header = True + sendback = True + + while len(self.recv_buf) > 4: + mac_key = self.user_key + struct.pack('= 4096: + self.raw_trans = True + self.recv_buf = b'' + if self.recv_id == 0: + logging.info(self.no_compatible_method + ': over size') + return (b'E' * 2048, False) + else: + raise Exception('server_post_decrype data error') + + if length + 4 > len(self.recv_buf): + break + + client_hash = hmac.new(mac_key, self.recv_buf[:length + 2], self.hashfunc).digest() + if client_hash[:2] != self.recv_buf[length + 2: length + 4]: + logging.info('%s: checksum error, data %s' % ( + self.no_compatible_method, binascii.hexlify(self.recv_buf[:length]) + )) + self.raw_trans = True + self.recv_buf = b'' + if self.recv_id == 0: + return (b'E' * 2048, False) + else: + raise Exception('server_post_decrype data uncorrect checksum') + + self.recv_id = (self.recv_id + 1) & 0xFFFFFFFF + pos = 2 + if data_len > 0 and rand_len > 0: + pos = 2 + self.rnd_start_pos(rand_len, self.random_client) + out_buf += self.encryptor.decrypt(self.recv_buf[pos: data_len + pos]) + self.last_client_hash = client_hash + self.recv_buf = self.recv_buf[length + 4:] + if data_len == 0: + sendback = True + + if out_buf: + self.server_info.data.update(self.user_id, self.client_id, self.connection_id) + return (out_buf, sendback) + + def client_udp_pre_encrypt(self, buf): + if self.user_key is None: + if b':' in to_bytes(self.server_info.protocol_param): + try: + items = to_bytes(self.server_info.protocol_param).split(':') + self.user_key = self.hashfunc(items[1]).digest() + self.user_id = struct.pack('= 1440: + return 0 + random.init_from_bin_len(last_hash, buf_size) + pos = bisect.bisect_left(self.data_size_list, buf_size + self.server_info.overhead) + final_pos = pos + random.next() % (len(self.data_size_list)) + # 假设random均匀分布,则越长的原始数据长度越容易if false + if final_pos < len(self.data_size_list): + return self.data_size_list[final_pos] - buf_size - self.server_info.overhead + + # 上面if false后选择2号补全数组,此处有更精细的长度分段 + pos = bisect.bisect_left(self.data_size_list2, buf_size + self.server_info.overhead) + final_pos = pos + random.next() % (len(self.data_size_list2)) + if final_pos < len(self.data_size_list2): + return self.data_size_list2[final_pos] - buf_size - self.server_info.overhead + # final_pos 总是分布在pos~(data_size_list2.len-1)之间 + if final_pos < pos + len(self.data_size_list2) - 1: + return 0 + # 有1/len(self.data_size_list2)的概率不满足上一个if ? + # 理论上不会运行到此处,因此可以插入运行断言 ? + # assert False + + if buf_size > 1300: + return random.next() % 31 + if buf_size > 900: + return random.next() % 127 + if buf_size > 400: + return random.next() % 521 + return random.next() % 1021 + + +class auth_chain_c(auth_chain_b): + def __init__(self, method): + super(auth_chain_c, self).__init__(method) + self.salt = b"auth_chain_c" + self.no_compatible_method = 'auth_chain_c' + self.data_size_list0 = [] + + def init_data_size(self, key): + if self.data_size_list0: + self.data_size_list0 = [] + random = xorshift128plus() + random.init_from_bin(key) + # 补全数组长为12~24-1 + list_len = random.next() % (8 + 16) + (4 + 8) + for i in range(0, list_len): + self.data_size_list0.append((int)(random.next() % 2340 % 2040 % 1440)) + self.data_size_list0.sort() + + def set_server_info(self, server_info): + self.server_info = server_info + try: + max_client = int(server_info.protocol_param.split('#')[0]) + except: + max_client = 64 + self.server_info.data.set_max_client(max_client) + self.init_data_size(self.server_info.key) + + def rnd_data_len(self, buf_size, last_hash, random): + other_data_size = buf_size + self.server_info.overhead + # 一定要在random使用前初始化,以保证服务器与客户端同步,保证包大小验证结果正确 + random.init_from_bin_len(last_hash, buf_size) + # final_pos 总是分布在pos~(data_size_list0.len-1)之间 + # 除非data_size_list0中的任何值均过小使其全部都无法容纳buf + if other_data_size >= self.data_size_list0[-1]: + if other_data_size >= 1440: + return 0 + if other_data_size > 1300: + return random.next() % 31 + if other_data_size > 900: + return random.next() % 127 + if other_data_size > 400: + return random.next() % 521 + return random.next() % 1021 + + pos = bisect.bisect_left(self.data_size_list0, other_data_size) + # random select a size in the leftover data_size_list0 + final_pos = pos + random.next() % (len(self.data_size_list0) - pos) + return self.data_size_list0[final_pos] - other_data_size + + +class auth_chain_d(auth_chain_b): + def __init__(self, method): + super(auth_chain_d, self).__init__(method) + self.salt = b"auth_chain_d" + self.no_compatible_method = 'auth_chain_d' + self.data_size_list0 = [] + + def check_and_patch_data_size(self, random): + # append new item + # when the biggest item(first time) or the last append item(other time) are not big enough. + # but set a limit size (64) to avoid stack overflow. + if self.data_size_list0[-1] < 1300 and len(self.data_size_list0) < 64: + self.data_size_list0.append((int)(random.next() % 2340 % 2040 % 1440)) + self.check_and_patch_data_size(random) + + def init_data_size(self, key): + if self.data_size_list0: + self.data_size_list0 = [] + random = xorshift128plus() + random.init_from_bin(key) + # 补全数组长为12~24-1 + list_len = random.next() % (8 + 16) + (4 + 8) + for i in range(0, list_len): + self.data_size_list0.append((int)(random.next() % 2340 % 2040 % 1440)) + self.data_size_list0.sort() + old_len = len(self.data_size_list0) + self.check_and_patch_data_size(random) + # if check_and_patch_data_size are work, re-sort again. + if old_len != len(self.data_size_list0): + self.data_size_list0.sort() + + def set_server_info(self, server_info): + self.server_info = server_info + try: + max_client = int(server_info.protocol_param.split('#')[0]) + except: + max_client = 64 + self.server_info.data.set_max_client(max_client) + self.init_data_size(self.server_info.key) + + def rnd_data_len(self, buf_size, last_hash, random): + other_data_size = buf_size + self.server_info.overhead + # if other_data_size > the bigest item in data_size_list0, not padding any data + if other_data_size >= self.data_size_list0[-1]: + return 0 + + random.init_from_bin_len(last_hash, buf_size) + pos = bisect.bisect_left(self.data_size_list0, other_data_size) + # random select a size in the leftover data_size_list0 + final_pos = pos + random.next() % (len(self.data_size_list0) - pos) + return self.data_size_list0[final_pos] - other_data_size diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/obfsplugin/http_simple.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/obfsplugin/http_simple.py new file mode 100644 index 00000000000000..ff3c5fdfbc7297 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/obfsplugin/http_simple.py @@ -0,0 +1,315 @@ +#!/usr/bin/env python +# +# Copyright 2015-2015 breakwa11 +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from __future__ import absolute_import, division, print_function, \ + with_statement + +import os +import sys +import hashlib +import logging +import binascii +import struct +import base64 +import datetime +import random + +from shadowsocks import common +from shadowsocks.obfsplugin import plain +from shadowsocks.common import to_bytes, to_str, ord, chr + +def create_http_simple_obfs(method): + return http_simple(method) + +def create_http_post_obfs(method): + return http_post(method) + +def create_random_head_obfs(method): + return random_head(method) + +obfs_map = { + 'http_simple': (create_http_simple_obfs,), + 'http_simple_compatible': (create_http_simple_obfs,), + 'http_post': (create_http_post_obfs,), + 'http_post_compatible': (create_http_post_obfs,), + 'random_head': (create_random_head_obfs,), + 'random_head_compatible': (create_random_head_obfs,), +} + +def match_begin(str1, str2): + if len(str1) >= len(str2): + if str1[:len(str2)] == str2: + return True + return False + +class http_simple(plain.plain): + def __init__(self, method): + self.method = method + self.has_sent_header = False + self.has_recv_header = False + self.host = None + self.port = 0 + self.recv_buffer = b'' + # TODO user config user_agent + self.user_agent = [b"Mozilla/5.0 (Windows NT 6.3; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0", + b"Mozilla/5.0 (Windows NT 6.3; WOW64; rv:40.0) Gecko/20100101 Firefox/44.0", + b"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36", + b"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Ubuntu/11.10 Chromium/27.0.1453.93 Chrome/27.0.1453.93 Safari/537.36", + b"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0", + b"Mozilla/5.0 (compatible; WOW64; MSIE 10.0; Windows NT 6.2)", + b"Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27", + b"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; Trident/7.0; .NET4.0E; .NET4.0C)", + b"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko", + b"Mozilla/5.0 (Linux; Android 4.4; Nexus 5 Build/BuildID) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36", + b"Mozilla/5.0 (iPad; CPU OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3", + b"Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3"] + + def encode_head(self, buf): + hexstr = binascii.hexlify(buf) + chs = [] + for i in range(0, len(hexstr), 2): + chs.append(b"%" + hexstr[i:i+2]) + return b''.join(chs) + + def client_encode(self, buf): + if self.has_sent_header: + return buf + head_size = len(self.server_info.iv) + self.server_info.head_len + if len(buf) - head_size > 64: + headlen = head_size + random.randint(0, 64) + else: + headlen = len(buf) + headdata = buf[:headlen] + buf = buf[headlen:] + port = b'' + if self.server_info.port != 80: + port = b':' + to_bytes(str(self.server_info.port)) + body = None + hosts = (self.server_info.obfs_param or self.server_info.host) + pos = hosts.find("#") + if pos >= 0: + body = hosts[pos + 1:].replace("\n", "\r\n") + body = body.replace("\\n", "\r\n") + hosts = hosts[:pos] + hosts = hosts.split(',') + host = random.choice(hosts) + http_head = b"GET /" + self.encode_head(headdata) + b" HTTP/1.1\r\n" + http_head += b"Host: " + to_bytes(host) + port + b"\r\n" + if body: + http_head += body + "\r\n\r\n" + else: + http_head += b"User-Agent: " + random.choice(self.user_agent) + b"\r\n" + http_head += b"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.8\r\nAccept-Encoding: gzip, deflate\r\nDNT: 1\r\nConnection: keep-alive\r\n\r\n" + self.has_sent_header = True + return http_head + buf + + def client_decode(self, buf): + if self.has_recv_header: + return (buf, False) + pos = buf.find(b'\r\n\r\n') + if pos >= 0: + self.has_recv_header = True + return (buf[pos + 4:], False) + else: + return (b'', False) + + def server_encode(self, buf): + if self.has_sent_header: + return buf + + header = b'HTTP/1.1 200 OK\r\nConnection: keep-alive\r\nContent-Encoding: gzip\r\nContent-Type: text/html\r\nDate: ' + header += to_bytes(datetime.datetime.now().strftime('%a, %d %b %Y %H:%M:%S GMT')) + header += b'\r\nServer: nginx\r\nVary: Accept-Encoding\r\n\r\n' + self.has_sent_header = True + return header + buf + + def get_data_from_http_header(self, buf): + ret_buf = b'' + lines = buf.split(b'\r\n') + if lines and len(lines) > 1: + hex_items = lines[0].split(b'%') + if hex_items and len(hex_items) > 1: + for index in range(1, len(hex_items)): + if len(hex_items[index]) < 2: + ret_buf += binascii.unhexlify('0' + hex_items[index]) + break + elif len(hex_items[index]) > 2: + ret_buf += binascii.unhexlify(hex_items[index][:2]) + break + else: + ret_buf += binascii.unhexlify(hex_items[index]) + return ret_buf + return b'' + + def get_host_from_http_header(self, buf): + ret_buf = b'' + lines = buf.split(b'\r\n') + if lines and len(lines) > 1: + for line in lines: + if match_begin(line, b"Host: "): + return common.to_str(line[6:]) + + def not_match_return(self, buf): + self.has_sent_header = True + self.has_recv_header = True + if self.method == 'http_simple': + return (b'E'*2048, False, False) + return (buf, True, False) + + def error_return(self, buf): + self.has_sent_header = True + self.has_recv_header = True + return (b'E'*2048, False, False) + + def server_decode(self, buf): + if self.has_recv_header: + return (buf, True, False) + + self.recv_buffer += buf + buf = self.recv_buffer + if len(buf) > 10: + if match_begin(buf, b'GET ') or match_begin(buf, b'POST '): + if len(buf) > 65536: + self.recv_buffer = None + logging.warn('http_simple: over size') + return self.not_match_return(buf) + else: #not http header, run on original protocol + self.recv_buffer = None + logging.debug('http_simple: not match begin') + return self.not_match_return(buf) + else: + return (b'', True, False) + + if b'\r\n\r\n' in buf: + datas = buf.split(b'\r\n\r\n', 1) + ret_buf = self.get_data_from_http_header(buf) + host = self.get_host_from_http_header(buf) + if host and self.server_info.obfs_param: + pos = host.find(":") + if pos >= 0: + host = host[:pos] + hosts = self.server_info.obfs_param.split(',') + if host not in hosts: + return self.not_match_return(buf) + if len(ret_buf) < 4: + return self.error_return(buf) + if len(datas) > 1: + ret_buf += datas[1] + if len(ret_buf) >= 13: + self.has_recv_header = True + return (ret_buf, True, False) + return self.not_match_return(buf) + else: + return (b'', True, False) + +class http_post(http_simple): + def __init__(self, method): + super(http_post, self).__init__(method) + + def boundary(self): + return to_bytes(''.join([random.choice("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") for i in range(32)])) + + def client_encode(self, buf): + if self.has_sent_header: + return buf + head_size = len(self.server_info.iv) + self.server_info.head_len + if len(buf) - head_size > 64: + headlen = head_size + random.randint(0, 64) + else: + headlen = len(buf) + headdata = buf[:headlen] + buf = buf[headlen:] + port = b'' + if self.server_info.port != 80: + port = b':' + to_bytes(str(self.server_info.port)) + body = None + hosts = (self.server_info.obfs_param or self.server_info.host) + pos = hosts.find("#") + if pos >= 0: + body = hosts[pos + 1:].replace("\\n", "\r\n") + hosts = hosts[:pos] + hosts = hosts.split(',') + host = random.choice(hosts) + http_head = b"POST /" + self.encode_head(headdata) + b" HTTP/1.1\r\n" + http_head += b"Host: " + to_bytes(host) + port + b"\r\n" + if body: + http_head += body + "\r\n\r\n" + else: + http_head += b"User-Agent: " + random.choice(self.user_agent) + b"\r\n" + http_head += b"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.8\r\nAccept-Encoding: gzip, deflate\r\n" + http_head += b"Content-Type: multipart/form-data; boundary=" + self.boundary() + b"\r\nDNT: 1\r\n" + http_head += b"Connection: keep-alive\r\n\r\n" + self.has_sent_header = True + return http_head + buf + + def not_match_return(self, buf): + self.has_sent_header = True + self.has_recv_header = True + if self.method == 'http_post': + return (b'E'*2048, False, False) + return (buf, True, False) + +class random_head(plain.plain): + def __init__(self, method): + self.method = method + self.has_sent_header = False + self.has_recv_header = False + self.raw_trans_sent = False + self.raw_trans_recv = False + self.send_buffer = b'' + + def client_encode(self, buf): + if self.raw_trans_sent: + return buf + self.send_buffer += buf + if not self.has_sent_header: + self.has_sent_header = True + data = os.urandom(common.ord(os.urandom(1)[0]) % 96 + 4) + crc = (0xffffffff - binascii.crc32(data)) & 0xffffffff + return data + struct.pack('= len(str2): + if str1[:len(str2)] == str2: + return True + return False + +class obfs_auth_data(object): + def __init__(self): + self.client_data = lru_cache.LRUCache(60 * 5) + self.client_id = os.urandom(32) + self.startup_time = int(time.time() - 60 * 30) & 0xFFFFFFFF + self.ticket_buf = {} + +class tls_ticket_auth(plain.plain): + def __init__(self, method): + self.method = method + self.handshake_status = 0 + self.send_buffer = b'' + self.recv_buffer = b'' + self.client_id = b'' + self.max_time_dif = 60 * 60 * 24 # time dif (second) setting + self.tls_version = b'\x03\x03' + self.overhead = 5 + + def init_data(self): + return obfs_auth_data() + + def get_overhead(self, direction): # direction: true for c->s false for s->c + return self.overhead + + def sni(self, url): + url = common.to_bytes(url) + data = b"\x00" + struct.pack('>H', len(url)) + url + data = b"\x00\x00" + struct.pack('>H', len(data) + 2) + struct.pack('>H', len(data)) + data + return data + + def pack_auth_data(self, client_id): + utc_time = int(time.time()) & 0xFFFFFFFF + data = struct.pack('>I', utc_time) + os.urandom(18) + data += hmac.new(self.server_info.key + client_id, data, hashlib.sha1).digest()[:10] + return data + + def client_encode(self, buf): + if self.handshake_status == -1: + return buf + if self.handshake_status == 8: + ret = b'' + while len(buf) > 2048: + size = min(struct.unpack('>H', os.urandom(2))[0] % 4096 + 100, len(buf)) + ret += b"\x17" + self.tls_version + struct.pack('>H', size) + buf[:size] + buf = buf[size:] + if len(buf) > 0: + ret += b"\x17" + self.tls_version + struct.pack('>H', len(buf)) + buf + return ret + if len(buf) > 0: + self.send_buffer += b"\x17" + self.tls_version + struct.pack('>H', len(buf)) + buf + if self.handshake_status == 0: + self.handshake_status = 1 + data = self.tls_version + self.pack_auth_data(self.server_info.data.client_id) + b"\x20" + self.server_info.data.client_id + binascii.unhexlify(b"001cc02bc02fcca9cca8cc14cc13c00ac014c009c013009c0035002f000a" + b"0100") + ext = binascii.unhexlify(b"ff01000100") + host = self.server_info.obfs_param or self.server_info.host + if host and host[-1] in string.digits: + host = '' + hosts = host.split(',') + host = random.choice(hosts) + ext += self.sni(host) + ext += b"\x00\x17\x00\x00" + if host not in self.server_info.data.ticket_buf: + self.server_info.data.ticket_buf[host] = os.urandom((struct.unpack('>H', os.urandom(2))[0] % 17 + 8) * 16) + ext += b"\x00\x23" + struct.pack('>H', len(self.server_info.data.ticket_buf[host])) + self.server_info.data.ticket_buf[host] + ext += binascii.unhexlify(b"000d001600140601060305010503040104030301030302010203") + ext += binascii.unhexlify(b"000500050100000000") + ext += binascii.unhexlify(b"00120000") + ext += binascii.unhexlify(b"75500000") + ext += binascii.unhexlify(b"000b00020100") + ext += binascii.unhexlify(b"000a0006000400170018") + data += struct.pack('>H', len(ext)) + ext + data = b"\x01\x00" + struct.pack('>H', len(data)) + data + data = b"\x16\x03\x01" + struct.pack('>H', len(data)) + data + return data + elif self.handshake_status == 1 and len(buf) == 0: + data = b"\x14" + self.tls_version + b"\x00\x01\x01" #ChangeCipherSpec + data += b"\x16" + self.tls_version + b"\x00\x20" + os.urandom(22) #Finished + data += hmac.new(self.server_info.key + self.server_info.data.client_id, data, hashlib.sha1).digest()[:10] + ret = data + self.send_buffer + self.send_buffer = b'' + self.handshake_status = 8 + return ret + return b'' + + def client_decode(self, buf): + if self.handshake_status == -1: + return (buf, False) + + if self.handshake_status == 8: + ret = b'' + self.recv_buffer += buf + while len(self.recv_buffer) > 5: + if ord(self.recv_buffer[0]) != 0x17: + logging.info("data = %s" % (binascii.hexlify(self.recv_buffer))) + raise Exception('server_decode appdata error') + size = struct.unpack('>H', self.recv_buffer[3:5])[0] + if len(self.recv_buffer) < size + 5: + break + buf = self.recv_buffer[5:size+5] + ret += buf + self.recv_buffer = self.recv_buffer[size+5:] + return (ret, False) + + if len(buf) < 11 + 32 + 1 + 32: + raise Exception('client_decode data error') + verify = buf[11:33] + if hmac.new(self.server_info.key + self.server_info.data.client_id, verify, hashlib.sha1).digest()[:10] != buf[33:43]: + raise Exception('client_decode data error') + if hmac.new(self.server_info.key + self.server_info.data.client_id, buf[:-10], hashlib.sha1).digest()[:10] != buf[-10:]: + raise Exception('client_decode data error') + return (b'', True) + + def server_encode(self, buf): + if self.handshake_status == -1: + return buf + if (self.handshake_status & 8) == 8: + ret = b'' + while len(buf) > 2048: + size = min(struct.unpack('>H', os.urandom(2))[0] % 4096 + 100, len(buf)) + ret += b"\x17" + self.tls_version + struct.pack('>H', size) + buf[:size] + buf = buf[size:] + if len(buf) > 0: + ret += b"\x17" + self.tls_version + struct.pack('>H', len(buf)) + buf + return ret + self.handshake_status |= 8 + data = self.tls_version + self.pack_auth_data(self.client_id) + b"\x20" + self.client_id + binascii.unhexlify(b"c02f000005ff01000100") + data = b"\x02\x00" + struct.pack('>H', len(data)) + data #server hello + data = b"\x16" + self.tls_version + struct.pack('>H', len(data)) + data + if random.randint(0, 8) < 1: + ticket = os.urandom((struct.unpack('>H', os.urandom(2))[0] % 164) * 2 + 64) + ticket = struct.pack('>H', len(ticket) + 4) + b"\x04\x00" + struct.pack('>H', len(ticket)) + ticket + data += b"\x16" + self.tls_version + ticket #New session ticket + data += b"\x14" + self.tls_version + b"\x00\x01\x01" #ChangeCipherSpec + finish_len = random.choice([32, 40]) + data += b"\x16" + self.tls_version + struct.pack('>H', finish_len) + os.urandom(finish_len - 10) #Finished + data += hmac.new(self.server_info.key + self.client_id, data, hashlib.sha1).digest()[:10] + if buf: + data += self.server_encode(buf) + return data + + def decode_error_return(self, buf): + self.handshake_status = -1 + if self.overhead > 0: + self.server_info.overhead -= self.overhead + self.overhead = 0 + if self.method in ['tls1.2_ticket_auth', 'tls1.2_ticket_fastauth']: + return (b'E'*2048, False, False) + return (buf, True, False) + + def server_decode(self, buf): + if self.handshake_status == -1: + return (buf, True, False) + + if (self.handshake_status & 4) == 4: + ret = b'' + self.recv_buffer += buf + while len(self.recv_buffer) > 5: + if ord(self.recv_buffer[0]) != 0x17 or ord(self.recv_buffer[1]) != 0x3 or ord(self.recv_buffer[2]) != 0x3: + logging.info("data = %s" % (binascii.hexlify(self.recv_buffer))) + raise Exception('server_decode appdata error') + size = struct.unpack('>H', self.recv_buffer[3:5])[0] + if len(self.recv_buffer) < size + 5: + break + ret += self.recv_buffer[5:size+5] + self.recv_buffer = self.recv_buffer[size+5:] + return (ret, True, False) + + if (self.handshake_status & 1) == 1: + self.recv_buffer += buf + buf = self.recv_buffer + verify = buf + if len(buf) < 11: + raise Exception('server_decode data error') + if not match_begin(buf, b"\x14" + self.tls_version + b"\x00\x01\x01"): #ChangeCipherSpec + raise Exception('server_decode data error') + buf = buf[6:] + if not match_begin(buf, b"\x16" + self.tls_version + b"\x00"): #Finished + raise Exception('server_decode data error') + verify_len = struct.unpack('>H', buf[3:5])[0] + 1 # 11 - 10 + if len(verify) < verify_len + 10: + return (b'', False, False) + if hmac.new(self.server_info.key + self.client_id, verify[:verify_len], hashlib.sha1).digest()[:10] != verify[verify_len:verify_len+10]: + raise Exception('server_decode data error') + self.recv_buffer = verify[verify_len + 10:] + status = self.handshake_status + self.handshake_status |= 4 + ret = self.server_decode(b'') + return ret; + + #raise Exception("handshake data = %s" % (binascii.hexlify(buf))) + self.recv_buffer += buf + buf = self.recv_buffer + ogn_buf = buf + if len(buf) < 3: + return (b'', False, False) + if not match_begin(buf, b'\x16\x03\x01'): + return self.decode_error_return(ogn_buf) + buf = buf[3:] + header_len = struct.unpack('>H', buf[:2])[0] + if header_len > len(buf) - 2: + return (b'', False, False) + + self.recv_buffer = self.recv_buffer[header_len + 5:] + self.handshake_status = 1 + buf = buf[2:header_len + 2] + if not match_begin(buf, b'\x01\x00'): #client hello + logging.info("tls_auth not client hello message") + return self.decode_error_return(ogn_buf) + buf = buf[2:] + if struct.unpack('>H', buf[:2])[0] != len(buf) - 2: + logging.info("tls_auth wrong message size") + return self.decode_error_return(ogn_buf) + buf = buf[2:] + if not match_begin(buf, self.tls_version): + logging.info("tls_auth wrong tls version") + return self.decode_error_return(ogn_buf) + buf = buf[2:] + verifyid = buf[:32] + buf = buf[32:] + sessionid_len = ord(buf[0]) + if sessionid_len < 32: + logging.info("tls_auth wrong sessionid_len") + return self.decode_error_return(ogn_buf) + sessionid = buf[1:sessionid_len + 1] + buf = buf[sessionid_len+1:] + self.client_id = sessionid + sha1 = hmac.new(self.server_info.key + sessionid, verifyid[:22], hashlib.sha1).digest()[:10] + utc_time = struct.unpack('>I', verifyid[:4])[0] + time_dif = common.int32((int(time.time()) & 0xffffffff) - utc_time) + if self.server_info.obfs_param: + try: + self.max_time_dif = int(self.server_info.obfs_param) + except: + pass + if self.max_time_dif > 0 and (time_dif < -self.max_time_dif or time_dif > self.max_time_dif \ + or common.int32(utc_time - self.server_info.data.startup_time) < -self.max_time_dif / 2): + logging.info("tls_auth wrong time") + return self.decode_error_return(ogn_buf) + if sha1 != verifyid[22:]: + logging.info("tls_auth wrong sha1") + return self.decode_error_return(ogn_buf) + if self.server_info.data.client_data.get(verifyid[:22]): + logging.info("replay attack detect, id = %s" % (binascii.hexlify(verifyid))) + return self.decode_error_return(ogn_buf) + self.server_info.data.client_data.sweep() + self.server_info.data.client_data[verifyid[:22]] = sessionid + if len(self.recv_buffer) >= 11: + ret = self.server_decode(b'') + return (ret[0], True, True) + # (buffer_to_recv, is_need_decrypt, is_need_to_encode_and_send_back) + return (b'', False, True) + diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/obfsplugin/plain.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/obfsplugin/plain.py new file mode 100644 index 00000000000000..8c6355c38fca26 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/obfsplugin/plain.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python +# +# Copyright 2015-2015 breakwa11 +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from __future__ import absolute_import, division, print_function, \ + with_statement + +import os +import sys +import hashlib +import logging + +from shadowsocks.common import ord + +def create_obfs(method): + return plain(method) + +obfs_map = { + 'plain': (create_obfs,), + 'origin': (create_obfs,), +} + +class plain(object): + def __init__(self, method): + self.method = method + self.server_info = None + + def init_data(self): + return b'' + + def get_overhead(self, direction): # direction: true for c->s false for s->c + return 0 + + def get_server_info(self): + return self.server_info + + def set_server_info(self, server_info): + self.server_info = server_info + + def client_pre_encrypt(self, buf): + return buf + + def client_encode(self, buf): + return buf + + def client_decode(self, buf): + # (buffer_to_recv, is_need_to_encode_and_send_back) + return (buf, False) + + def client_post_decrypt(self, buf): + return buf + + def server_pre_encrypt(self, buf): + return buf + + def server_encode(self, buf): + return buf + + def server_decode(self, buf): + # (buffer_to_recv, is_need_decrypt, is_need_to_encode_and_send_back) + return (buf, True, False) + + def server_post_decrypt(self, buf): + return (buf, False) + + def client_udp_pre_encrypt(self, buf): + return buf + + def client_udp_post_decrypt(self, buf): + return buf + + def server_udp_pre_encrypt(self, buf, uid): + return buf + + def server_udp_post_decrypt(self, buf): + return (buf, None) + + def dispose(self): + pass + + def get_head_size(self, buf, def_value): + if len(buf) < 2: + return def_value + head_type = ord(buf[0]) & 0x7 + if head_type == 1: + return 7 + if head_type == 4: + return 19 + if head_type == 3: + return 4 + ord(buf[1]) + return def_value + diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/obfsplugin/verify.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/obfsplugin/verify.py new file mode 100644 index 00000000000000..0dc0ca6d109208 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/obfsplugin/verify.py @@ -0,0 +1,154 @@ +#!/usr/bin/env python +# +# Copyright 2015-2015 breakwa11 +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from __future__ import absolute_import, division, print_function, \ + with_statement + +import os +import sys +import hashlib +import logging +import binascii +import base64 +import time +import datetime +import random +import struct +import zlib +import hmac +import hashlib + +import shadowsocks +from shadowsocks import common +from shadowsocks.obfsplugin import plain +from shadowsocks.common import to_bytes, to_str, ord, chr + +def create_verify_deflate(method): + return verify_deflate(method) + +obfs_map = { + 'verify_deflate': (create_verify_deflate,), +} + +def match_begin(str1, str2): + if len(str1) >= len(str2): + if str1[:len(str2)] == str2: + return True + return False + +class obfs_verify_data(object): + def __init__(self): + pass + +class verify_base(plain.plain): + def __init__(self, method): + super(verify_base, self).__init__(method) + self.method = method + + def init_data(self): + return obfs_verify_data() + + def set_server_info(self, server_info): + self.server_info = server_info + + def client_encode(self, buf): + return buf + + def client_decode(self, buf): + return (buf, False) + + def server_encode(self, buf): + return buf + + def server_decode(self, buf): + return (buf, True, False) + +class verify_deflate(verify_base): + def __init__(self, method): + super(verify_deflate, self).__init__(method) + self.recv_buf = b'' + self.unit_len = 32700 + self.decrypt_packet_num = 0 + self.raw_trans = False + + def pack_data(self, buf): + if len(buf) == 0: + return b'' + data = zlib.compress(buf) + data = struct.pack('>H', len(data)) + data[2:] + return data + + def client_pre_encrypt(self, buf): + ret = b'' + while len(buf) > self.unit_len: + ret += self.pack_data(buf[:self.unit_len]) + buf = buf[self.unit_len:] + ret += self.pack_data(buf) + return ret + + def client_post_decrypt(self, buf): + if self.raw_trans: + return buf + self.recv_buf += buf + out_buf = b'' + while len(self.recv_buf) > 2: + length = struct.unpack('>H', self.recv_buf[:2])[0] + if length >= 32768 or length < 6: + self.raw_trans = True + self.recv_buf = b'' + raise Exception('client_post_decrypt data error') + if length > len(self.recv_buf): + break + + out_buf += zlib.decompress(b'x\x9c' + self.recv_buf[2:length]) + self.recv_buf = self.recv_buf[length:] + + if out_buf: + self.decrypt_packet_num += 1 + return out_buf + + def server_pre_encrypt(self, buf): + ret = b'' + while len(buf) > self.unit_len: + ret += self.pack_data(buf[:self.unit_len]) + buf = buf[self.unit_len:] + ret += self.pack_data(buf) + return ret + + def server_post_decrypt(self, buf): + if self.raw_trans: + return (buf, False) + self.recv_buf += buf + out_buf = b'' + while len(self.recv_buf) > 2: + length = struct.unpack('>H', self.recv_buf[:2])[0] + if length >= 32768 or length < 6: + self.raw_trans = True + self.recv_buf = b'' + if self.decrypt_packet_num == 0: + return (b'E'*2048, False) + else: + raise Exception('server_post_decrype data error') + if length > len(self.recv_buf): + break + + out_buf += zlib.decompress(b'\x78\x9c' + self.recv_buf[2:length]) + self.recv_buf = self.recv_buf[length:] + + if out_buf: + self.decrypt_packet_num += 1 + return (out_buf, False) + diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/ordereddict.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/ordereddict.py new file mode 100644 index 00000000000000..e1918f5e02ada1 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/ordereddict.py @@ -0,0 +1,214 @@ +import collections + +################################################################################ +### OrderedDict +################################################################################ + +class OrderedDict(dict): + 'Dictionary that remembers insertion order' + # An inherited dict maps keys to values. + # The inherited dict provides __getitem__, __len__, __contains__, and get. + # The remaining methods are order-aware. + # Big-O running times for all methods are the same as regular dictionaries. + + # The internal self.__map dict maps keys to links in a doubly linked list. + # The circular doubly linked list starts and ends with a sentinel element. + # The sentinel element never gets deleted (this simplifies the algorithm). + # Each link is stored as a list of length three: [PREV, NEXT, KEY]. + + def __init__(*args, **kwds): + '''Initialize an ordered dictionary. The signature is the same as + regular dictionaries, but keyword arguments are not recommended because + their insertion order is arbitrary. + + ''' + if not args: + raise TypeError("descriptor '__init__' of 'OrderedDict' object " + "needs an argument") + self = args[0] + args = args[1:] + if len(args) > 1: + raise TypeError('expected at most 1 arguments, got %d' % len(args)) + try: + self.__root + except AttributeError: + self.__root = root = [] # sentinel node + root[:] = [root, root, None] + self.__map = {} + self.__update(*args, **kwds) + + def __setitem__(self, key, value, dict_setitem=dict.__setitem__): + 'od.__setitem__(i, y) <==> od[i]=y' + # Setting a new item creates a new link at the end of the linked list, + # and the inherited dictionary is updated with the new key/value pair. + if key not in self: + root = self.__root + last = root[0] + last[1] = root[0] = self.__map[key] = [last, root, key] + return dict_setitem(self, key, value) + + def __delitem__(self, key, dict_delitem=dict.__delitem__): + 'od.__delitem__(y) <==> del od[y]' + # Deleting an existing item uses self.__map to find the link which gets + # removed by updating the links in the predecessor and successor nodes. + dict_delitem(self, key) + link_prev, link_next, _ = self.__map.pop(key) + link_prev[1] = link_next # update link_prev[NEXT] + link_next[0] = link_prev # update link_next[PREV] + + def __iter__(self): + 'od.__iter__() <==> iter(od)' + # Traverse the linked list in order. + root = self.__root + curr = root[1] # start at the first node + while curr is not root: + yield curr[2] # yield the curr[KEY] + curr = curr[1] # move to next node + + def __reversed__(self): + 'od.__reversed__() <==> reversed(od)' + # Traverse the linked list in reverse order. + root = self.__root + curr = root[0] # start at the last node + while curr is not root: + yield curr[2] # yield the curr[KEY] + curr = curr[0] # move to previous node + + def clear(self): + 'od.clear() -> None. Remove all items from od.' + root = self.__root + root[:] = [root, root, None] + self.__map.clear() + dict.clear(self) + + # -- the following methods do not depend on the internal structure -- + + def keys(self): + 'od.keys() -> list of keys in od' + return list(self) + + def values(self): + 'od.values() -> list of values in od' + return [self[key] for key in self] + + def items(self): + 'od.items() -> list of (key, value) pairs in od' + return [(key, self[key]) for key in self] + + def iterkeys(self): + 'od.iterkeys() -> an iterator over the keys in od' + return iter(self) + + def itervalues(self): + 'od.itervalues -> an iterator over the values in od' + for k in self: + yield self[k] + + def iteritems(self): + 'od.iteritems -> an iterator over the (key, value) pairs in od' + for k in self: + yield (k, self[k]) + + update = collections.MutableMapping.update + + __update = update # let subclasses override update without breaking __init__ + + __marker = object() + + def pop(self, key, default=__marker): + '''od.pop(k[,d]) -> v, remove specified key and return the corresponding + value. If key is not found, d is returned if given, otherwise KeyError + is raised. + + ''' + if key in self: + result = self[key] + del self[key] + return result + if default is self.__marker: + raise KeyError(key) + return default + + def setdefault(self, key, default=None): + 'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od' + if key in self: + return self[key] + self[key] = default + return default + + def popitem(self, last=True): + '''od.popitem() -> (k, v), return and remove a (key, value) pair. + Pairs are returned in LIFO order if last is true or FIFO order if false. + + ''' + if not self: + raise KeyError('dictionary is empty') + key = next(reversed(self) if last else iter(self)) + value = self.pop(key) + return key, value + + def __repr__(self, _repr_running={}): + 'od.__repr__() <==> repr(od)' + call_key = id(self), _get_ident() + if call_key in _repr_running: + return '...' + _repr_running[call_key] = 1 + try: + if not self: + return '%s()' % (self.__class__.__name__,) + return '%s(%r)' % (self.__class__.__name__, self.items()) + finally: + del _repr_running[call_key] + + def __reduce__(self): + 'Return state information for pickling' + items = [[k, self[k]] for k in self] + inst_dict = vars(self).copy() + for k in vars(OrderedDict()): + inst_dict.pop(k, None) + if inst_dict: + return (self.__class__, (items,), inst_dict) + return self.__class__, (items,) + + def copy(self): + 'od.copy() -> a shallow copy of od' + return self.__class__(self) + + @classmethod + def fromkeys(cls, iterable, value=None): + '''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S. + If not specified, the value defaults to None. + + ''' + self = cls() + for key in iterable: + self[key] = value + return self + + def __eq__(self, other): + '''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive + while comparison to a regular mapping is order-insensitive. + + ''' + if isinstance(other, OrderedDict): + return dict.__eq__(self, other) and all(_imap(_eq, self, other)) + return dict.__eq__(self, other) + + def __ne__(self, other): + 'od.__ne__(y) <==> od!=y' + return not self == other + + # -- the following methods support python 3.x style dictionary views -- + + def viewkeys(self): + "od.viewkeys() -> a set-like object providing a view on od's keys" + return KeysView(self) + + def viewvalues(self): + "od.viewvalues() -> an object providing a view on od's values" + return ValuesView(self) + + def viewitems(self): + "od.viewitems() -> a set-like object providing a view on od's items" + return ItemsView(self) + diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/run.sh b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/run.sh new file mode 100644 index 00000000000000..43720308dcf9ce --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/run.sh @@ -0,0 +1,7 @@ +#!/bin/bash +cd `dirname $0` +python_ver=$(ls /usr/bin|grep -e "^python[23]\.[1-9]\+$"|tail -1) +eval $(ps -ef | grep "[0-9] ${python_ver} server\\.py a" | awk '{print "kill "$2}') +ulimit -n 512000 +nohup ${python_ver} server.py a>> /dev/null 2>&1 & + diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/server.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/server.py new file mode 100644 index 00000000000000..081538933baf5d --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/server.py @@ -0,0 +1,221 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright 2015 clowwindy +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from __future__ import absolute_import, division, print_function, \ + with_statement + +import sys +import os +import logging +import signal + +if __name__ == '__main__': + import inspect + + file_path = os.path.dirname(os.path.realpath(inspect.getfile(inspect.currentframe()))) + sys.path.insert(0, os.path.join(file_path, '../')) + +from shadowsocks import shell, daemon, eventloop, tcprelay, udprelay, \ + asyncdns, manager, common + + +def main(): + shell.check_python() + + config = shell.get_config(False) + + shell.log_shadowsocks_version() + + daemon.daemon_exec(config) + + try: + import resource + logging.info( + 'current process RLIMIT_NOFILE resource: soft %d hard %d' % resource.getrlimit(resource.RLIMIT_NOFILE)) + except ImportError: + pass + + if config['port_password']: + pass + else: + config['port_password'] = {} + server_port = config['server_port'] + if type(server_port) == list: + for a_server_port in server_port: + config['port_password'][a_server_port] = config['password'] + else: + config['port_password'][str(server_port)] = config['password'] + + if not config.get('dns_ipv6', False): + asyncdns.IPV6_CONNECTION_SUPPORT = False + + if config.get('manager_address', 0): + logging.info('entering manager mode') + manager.run(config) + return + + tcp_servers = [] + udp_servers = [] + dns_resolver = asyncdns.DNSResolver(config['black_hostname_list']) + if int(config['workers']) > 1: + stat_counter_dict = None + else: + stat_counter_dict = {} + port_password = config['port_password'] + config_password = config.get('password', 'm') + del config['port_password'] + for port, password_obfs in port_password.items(): + method = config["method"] + protocol = config.get("protocol", 'origin') + protocol_param = config.get("protocol_param", '') + obfs = config.get("obfs", 'plain') + obfs_param = config.get("obfs_param", '') + bind = config.get("out_bind", '') + bindv6 = config.get("out_bindv6", '') + if type(password_obfs) == list: + password = password_obfs[0] + obfs = common.to_str(password_obfs[1]) + if len(password_obfs) > 2: + protocol = common.to_str(password_obfs[2]) + elif type(password_obfs) == dict: + password = password_obfs.get('password', config_password) + method = common.to_str(password_obfs.get('method', method)) + protocol = common.to_str(password_obfs.get('protocol', protocol)) + protocol_param = common.to_str(password_obfs.get('protocol_param', protocol_param)) + obfs = common.to_str(password_obfs.get('obfs', obfs)) + obfs_param = common.to_str(password_obfs.get('obfs_param', obfs_param)) + bind = password_obfs.get('out_bind', bind) + bindv6 = password_obfs.get('out_bindv6', bindv6) + else: + password = password_obfs + a_config = config.copy() + ipv6_ok = False + logging.info("server start with protocol[%s] password [%s] method [%s] obfs [%s] obfs_param [%s]" % + (protocol, password, method, obfs, obfs_param)) + if 'server_ipv6' in a_config: + try: + if len(a_config['server_ipv6']) > 2 and a_config['server_ipv6'][0] == "[" and a_config['server_ipv6'][ + -1] == "]": + a_config['server_ipv6'] = a_config['server_ipv6'][1:-1] + a_config['server_port'] = int(port) + a_config['password'] = password + a_config['method'] = method + a_config['protocol'] = protocol + a_config['protocol_param'] = protocol_param + a_config['obfs'] = obfs + a_config['obfs_param'] = obfs_param + a_config['out_bind'] = bind + a_config['out_bindv6'] = bindv6 + a_config['server'] = a_config['server_ipv6'] + logging.info("starting server at [%s]:%d" % + (a_config['server'], int(port))) + tcp_servers.append(tcprelay.TCPRelay(a_config, dns_resolver, False, stat_counter=stat_counter_dict)) + udp_servers.append(udprelay.UDPRelay(a_config, dns_resolver, False, stat_counter=stat_counter_dict)) + if a_config['server_ipv6'] == b"::": + ipv6_ok = True + except Exception as e: + shell.print_exception(e) + + try: + a_config = config.copy() + a_config['server_port'] = int(port) + a_config['password'] = password + a_config['method'] = method + a_config['protocol'] = protocol + a_config['protocol_param'] = protocol_param + a_config['obfs'] = obfs + a_config['obfs_param'] = obfs_param + a_config['out_bind'] = bind + a_config['out_bindv6'] = bindv6 + logging.info("starting server at %s:%d" % + (a_config['server'], int(port))) + tcp_servers.append(tcprelay.TCPRelay(a_config, dns_resolver, False, stat_counter=stat_counter_dict)) + udp_servers.append(udprelay.UDPRelay(a_config, dns_resolver, False, stat_counter=stat_counter_dict)) + except Exception as e: + if not ipv6_ok: + shell.print_exception(e) + + def run_server(): + def child_handler(signum, _): + logging.warn('received SIGQUIT, doing graceful shutting down..') + list(map(lambda s: s.close(next_tick=True), + tcp_servers + udp_servers)) + + signal.signal(getattr(signal, 'SIGQUIT', signal.SIGTERM), + child_handler) + + def int_handler(signum, _): + sys.exit(1) + + signal.signal(signal.SIGINT, int_handler) + + try: + loop = eventloop.EventLoop() + dns_resolver.add_to_loop(loop) + list(map(lambda s: s.add_to_loop(loop), tcp_servers + udp_servers)) + + daemon.set_user(config.get('user', None)) + loop.run() + except Exception as e: + shell.print_exception(e) + sys.exit(1) + + if int(config['workers']) > 1: + if os.name == 'posix': + children = [] + is_child = False + for i in range(0, int(config['workers'])): + r = os.fork() + if r == 0: + logging.info('worker started') + is_child = True + run_server() + break + else: + children.append(r) + if not is_child: + def handler(signum, _): + for pid in children: + try: + os.kill(pid, signum) + os.waitpid(pid, 0) + except OSError: # child may already exited + pass + sys.exit() + + signal.signal(signal.SIGTERM, handler) + signal.signal(signal.SIGQUIT, handler) + signal.signal(signal.SIGINT, handler) + + # master + for a_tcp_server in tcp_servers: + a_tcp_server.close() + for a_udp_server in udp_servers: + a_udp_server.close() + dns_resolver.close() + + for child in children: + os.waitpid(child, 0) + else: + logging.warn('worker is only available on Unix/Linux') + run_server() + else: + run_server() + + +if __name__ == '__main__': + main() diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/shell.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/shell.py new file mode 100644 index 00000000000000..a1547d0821eea8 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/shell.py @@ -0,0 +1,451 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright 2015 clowwindy +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from __future__ import absolute_import, division, print_function, \ + with_statement + +import os +import json +import sys +import getopt +import logging +from shadowsocks.common import to_bytes, to_str, IPNetwork, PortRange +from shadowsocks import encrypt + +VERBOSE_LEVEL = 5 + +verbose = 0 + + +def check_python(): + info = sys.version_info + if info[0] == 2 and not info[1] >= 6: + print('Python 2.6+ required') + sys.exit(1) + elif info[0] == 3 and not info[1] >= 3: + print('Python 3.3+ required') + sys.exit(1) + elif info[0] not in [2, 3]: + print('Python version not supported') + sys.exit(1) + + +def print_exception(e): + global verbose + logging.error(e) + if verbose > 0: + import traceback + traceback.print_exc() + + +def __version(): + version_str = '' + try: + import pkg_resources + version_str = pkg_resources.get_distribution('shadowsocks').version + except Exception: + try: + from shadowsocks import version + version_str = version.version() + except Exception: + pass + return version_str + + +def print_shadowsocks(): + print('ShadowsocksR %s' % __version()) + + +def log_shadowsocks_version(): + logging.info('ShadowsocksR %s' % __version()) + + +def find_config(): + user_config_path = 'user-config.json' + config_path = 'config.json' + + def sub_find(file_name): + if os.path.exists(file_name): + return file_name + file_name = os.path.join(os.path.abspath('..'), file_name) + return file_name if os.path.exists(file_name) else None + + return sub_find(user_config_path) or sub_find(config_path) + + +def check_config(config, is_local): + if config.get('daemon', None) == 'stop': + # no need to specify configuration for daemon stop + return + + if is_local and not config.get('password', None): + logging.error('password not specified') + print_help(is_local) + sys.exit(2) + + if not is_local and not config.get('password', None) \ + and not config.get('port_password', None): + logging.error('password or port_password not specified') + print_help(is_local) + sys.exit(2) + + if 'local_port' in config: + config['local_port'] = int(config['local_port']) + + if 'server_port' in config and type(config['server_port']) != list: + config['server_port'] = int(config['server_port']) + + if config.get('local_address', '') in [b'0.0.0.0']: + logging.warning('warning: local set to listen on 0.0.0.0, it\'s not safe') + if config.get('server', '') in ['127.0.0.1', 'localhost']: + logging.warning('warning: server set to listen on %s:%s, are you sure?' % + (to_str(config['server']), config['server_port'])) + if config.get('timeout', 300) < 100: + logging.warning('warning: your timeout %d seems too short' % + int(config.get('timeout'))) + if config.get('timeout', 300) > 600: + logging.warning('warning: your timeout %d seems too long' % + int(config.get('timeout'))) + if config.get('password') in [b'mypassword']: + logging.error('DON\'T USE DEFAULT PASSWORD! Please change it in your ' + 'config.json!') + sys.exit(1) + if config.get('user', None) is not None: + if os.name != 'posix': + logging.error('user can be used only on Unix') + sys.exit(1) + + encrypt.try_cipher(config['password'], config['method']) + + +def get_config(is_local): + global verbose + config = {} + config_path = None + logging.basicConfig(level=logging.INFO, + format='%(levelname)-s: %(message)s') + if is_local: + shortopts = 'hd:s:b:p:k:l:m:O:o:G:g:c:t:vq' + longopts = ['help', 'fast-open', 'pid-file=', 'log-file=', 'user=', + 'version'] + else: + shortopts = 'hd:s:p:k:m:O:o:G:g:c:t:vq' + longopts = ['help', 'fast-open', 'pid-file=', 'log-file=', 'workers=', + 'forbidden-ip=', 'user=', 'manager-address=', 'version'] + try: + optlist, args = getopt.getopt(sys.argv[1:], shortopts, longopts) + for key, value in optlist: + if key == '-c': + config_path = value + elif key in ('-h', '--help'): + print_help(is_local) + sys.exit(0) + elif key == '--version': + print_shadowsocks() + sys.exit(0) + else: + continue + + if config_path is None: + config_path = find_config() + + if config_path: + logging.debug('loading config from %s' % config_path) + with open(config_path, 'rb') as f: + try: + config = parse_json_in_str(remove_comment(f.read().decode('utf8'))) + except ValueError as e: + logging.error('found an error in config.json: %s', str(e)) + sys.exit(1) + + v_count = 0 + for key, value in optlist: + if key == '-p': + config['server_port'] = int(value) + elif key == '-k': + config['password'] = to_bytes(value) + elif key == '-l': + config['local_port'] = int(value) + elif key == '-s': + config['server'] = to_str(value) + elif key == '-m': + config['method'] = to_str(value) + elif key == '-O': + config['protocol'] = to_str(value) + elif key == '-o': + config['obfs'] = to_str(value) + elif key == '-G': + config['protocol_param'] = to_str(value) + elif key == '-g': + config['obfs_param'] = to_str(value) + elif key == '-b': + config['local_address'] = to_str(value) + elif key == '-v': + v_count += 1 + # '-vv' turns on more verbose mode + config['verbose'] = v_count + elif key == '-t': + config['timeout'] = int(value) + elif key == '--fast-open': + config['fast_open'] = True + elif key == '--workers': + config['workers'] = int(value) + elif key == '--manager-address': + config['manager_address'] = value + elif key == '--user': + config['user'] = to_str(value) + elif key == '--forbidden-ip': + config['forbidden_ip'] = to_str(value) + + elif key == '-d': + config['daemon'] = to_str(value) + elif key == '--pid-file': + config['pid-file'] = to_str(value) + elif key == '--log-file': + config['log-file'] = to_str(value) + elif key == '-q': + v_count -= 1 + config['verbose'] = v_count + else: + continue + except getopt.GetoptError as e: + print(e, file=sys.stderr) + print_help(is_local) + sys.exit(2) + + if not config: + logging.error('config not specified') + print_help(is_local) + sys.exit(2) + + config['password'] = to_bytes(config.get('password', b'')) + config['method'] = to_str(config.get('method', 'aes-256-cfb')) + config['protocol'] = to_str(config.get('protocol', 'origin')) + config['protocol_param'] = to_str(config.get('protocol_param', '')) + config['obfs'] = to_str(config.get('obfs', 'plain')) + config['obfs_param'] = to_str(config.get('obfs_param', '')) + config['port_password'] = config.get('port_password', None) + config['additional_ports'] = config.get('additional_ports', {}) + config['additional_ports_only'] = config.get('additional_ports_only', False) + config['timeout'] = int(config.get('timeout', 300)) + config['udp_timeout'] = int(config.get('udp_timeout', 120)) + config['udp_cache'] = int(config.get('udp_cache', 64)) + config['fast_open'] = config.get('fast_open', False) + config['workers'] = config.get('workers', 1) + config['pid-file'] = config.get('pid-file', '/var/run/shadowsocksr.pid') + config['log-file'] = config.get('log-file', '/var/log/shadowsocksr.log') + config['verbose'] = config.get('verbose', False) + config['connect_verbose_info'] = config.get('connect_verbose_info', 0) + config['local_address'] = to_str(config.get('local_address', '127.0.0.1')) + config['local_port'] = config.get('local_port', 1080) + if is_local: + if config.get('server', None) is None: + logging.error('server addr not specified') + print_local_help() + sys.exit(2) + else: + config['server'] = to_str(config['server']) + else: + config['server'] = to_str(config.get('server', '0.0.0.0')) + config['black_hostname_list'] = to_str(config.get('black_hostname_list', '')).split(',') + if len(config['black_hostname_list']) == 1 and config['black_hostname_list'][0] == '': + config['black_hostname_list'] = [] + try: + config['forbidden_ip'] = \ + IPNetwork(config.get('forbidden_ip', '127.0.0.0/8,::1/128')) + except Exception as e: + logging.error(e) + sys.exit(2) + try: + config['forbidden_port'] = PortRange(config.get('forbidden_port', '')) + except Exception as e: + logging.error(e) + sys.exit(2) + try: + config['ignore_bind'] = \ + IPNetwork(config.get('ignore_bind', '127.0.0.0/8,::1/128,10.0.0.0/8,192.168.0.0/16')) + except Exception as e: + logging.error(e) + sys.exit(2) + config['server_port'] = config.get('server_port', 8388) + + logging.getLogger('').handlers = [] + logging.addLevelName(VERBOSE_LEVEL, 'VERBOSE') + if config['verbose'] >= 2: + level = VERBOSE_LEVEL + elif config['verbose'] == 1: + level = logging.DEBUG + elif config['verbose'] == -1: + level = logging.WARN + elif config['verbose'] <= -2: + level = logging.ERROR + else: + level = logging.INFO + verbose = config['verbose'] + logging.basicConfig(level=level, + format='%(asctime)s %(levelname)-8s %(filename)s:%(lineno)s %(message)s', + datefmt='%Y-%m-%d %H:%M:%S') + + check_config(config, is_local) + + return config + + +def print_help(is_local): + if is_local: + print_local_help() + else: + print_server_help() + + +def print_local_help(): + print('''usage: sslocal [OPTION]... +A fast tunnel proxy that helps you bypass firewalls. + +You can supply configurations via either config file or command line arguments. + +Proxy options: + -c CONFIG path to config file + -s SERVER_ADDR server address + -p SERVER_PORT server port, default: 8388 + -b LOCAL_ADDR local binding address, default: 127.0.0.1 + -l LOCAL_PORT local port, default: 1080 + -k PASSWORD password + -m METHOD encryption method, default: aes-256-cfb + -o OBFS obfsplugin, default: http_simple + -t TIMEOUT timeout in seconds, default: 300 + --fast-open use TCP_FASTOPEN, requires Linux 3.7+ + +General options: + -h, --help show this help message and exit + -d start/stop/restart daemon mode + --pid-file PID_FILE pid file for daemon mode + --log-file LOG_FILE log file for daemon mode + --user USER username to run as + -v, -vv verbose mode + -q, -qq quiet mode, only show warnings/errors + --version show version information + +Online help: +''') + + +def print_server_help(): + print('''usage: ssserver [OPTION]... +A fast tunnel proxy that helps you bypass firewalls. + +You can supply configurations via either config file or command line arguments. + +Proxy options: + -c CONFIG path to config file + -s SERVER_ADDR server address, default: 0.0.0.0 + -p SERVER_PORT server port, default: 8388 + -k PASSWORD password + -m METHOD encryption method, default: aes-256-cfb + -o OBFS obfsplugin, default: http_simple + -t TIMEOUT timeout in seconds, default: 300 + --fast-open use TCP_FASTOPEN, requires Linux 3.7+ + --workers WORKERS number of workers, available on Unix/Linux + --forbidden-ip IPLIST comma seperated IP list forbidden to connect + --manager-address ADDR optional server manager UDP address, see wiki + +General options: + -h, --help show this help message and exit + -d start/stop/restart daemon mode + --pid-file PID_FILE pid file for daemon mode + --log-file LOG_FILE log file for daemon mode + --user USER username to run as + -v, -vv verbose mode + -q, -qq quiet mode, only show warnings/errors + --version show version information + +Online help: +''') + + +def _decode_list(data): + rv = [] + for item in data: + if hasattr(item, 'encode'): + item = item.encode('utf-8') + elif isinstance(item, list): + item = _decode_list(item) + elif isinstance(item, dict): + item = _decode_dict(item) + rv.append(item) + return rv + + +def _decode_dict(data): + rv = {} + for key, value in data.items(): + if hasattr(value, 'encode'): + value = value.encode('utf-8') + elif isinstance(value, list): + value = _decode_list(value) + elif isinstance(value, dict): + value = _decode_dict(value) + rv[key] = value + return rv + + +class JSFormat: + def __init__(self): + self.state = 0 + + def push(self, ch): + ch = ord(ch) + if self.state == 0: + if ch == ord('"'): + self.state = 1 + return to_str(chr(ch)) + elif ch == ord('/'): + self.state = 3 + else: + return to_str(chr(ch)) + elif self.state == 1: + if ch == ord('"'): + self.state = 0 + return to_str(chr(ch)) + elif ch == ord('\\'): + self.state = 2 + return to_str(chr(ch)) + elif self.state == 2: + self.state = 1 + if ch == ord('"'): + return to_str(chr(ch)) + return "\\" + to_str(chr(ch)) + elif self.state == 3: + if ch == ord('/'): + self.state = 4 + else: + return "/" + to_str(chr(ch)) + elif self.state == 4: + if ch == ord('\n'): + self.state = 0 + return "\n" + return "" + + +def remove_comment(json): + fmt = JSFormat() + return "".join([fmt.push(c) for c in json]) + + +def parse_json_in_str(data): + # parse json and convert everything from unicode to str + return json.loads(data, object_hook=_decode_dict) diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/stop.sh b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/stop.sh new file mode 100644 index 00000000000000..d7d29589eccc41 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/stop.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +python_ver=$(ls /usr/bin|grep -e "^python[23]\.[1-9]\+$"|tail -1) +eval $(ps -ef | grep "[0-9] ${python_ver} server\\.py a" | awk '{print "kill "$2}') + diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/tail.sh b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/tail.sh new file mode 100644 index 00000000000000..aa3713939694ef --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/tail.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +tail -f ssserver.log diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/tcprelay.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/tcprelay.py new file mode 100644 index 00000000000000..595e2be73f4179 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/tcprelay.py @@ -0,0 +1,1476 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright 2015 clowwindy +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from __future__ import absolute_import, division, print_function, \ + with_statement + +import time +import socket +import errno +import struct +import logging +import binascii +import traceback +import random +import platform +import threading + +from shadowsocks import encrypt, obfs, eventloop, shell, common, lru_cache, version +from shadowsocks.common import pre_parse_header, parse_header + +# we clear at most TIMEOUTS_CLEAN_SIZE timeouts each time +TIMEOUTS_CLEAN_SIZE = 512 + +MSG_FASTOPEN = 0x20000000 + +# SOCKS command definition +CMD_CONNECT = 1 +CMD_BIND = 2 +CMD_UDP_ASSOCIATE = 3 + +# for each opening port, we have a TCP Relay + +# for each connection, we have a TCP Relay Handler to handle the connection + +# for each handler, we have 2 sockets: +# local: connected to the client +# remote: connected to remote server + +# for each handler, it could be at one of several stages: + +# as sslocal: +# stage 0 SOCKS hello received from local, send hello to local +# stage 1 addr received from local, query DNS for remote +# stage 2 UDP assoc +# stage 3 DNS resolved, connect to remote +# stage 4 still connecting, more data from local received +# stage 5 remote connected, piping local and remote + +# as ssserver: +# stage 0 just jump to stage 1 +# stage 1 addr received from local, query DNS for remote +# stage 3 DNS resolved, connect to remote +# stage 4 still connecting, more data from local received +# stage 5 remote connected, piping local and remote + +STAGE_INIT = 0 +STAGE_ADDR = 1 +STAGE_UDP_ASSOC = 2 +STAGE_DNS = 3 +STAGE_CONNECTING = 4 +STAGE_STREAM = 5 +STAGE_DESTROYED = -1 + +# for each handler, we have 2 stream directions: +# upstream: from client to server direction +# read local and write to remote +# downstream: from server to client direction +# read remote and write to local + +STREAM_UP = 0 +STREAM_DOWN = 1 + +# for each stream, it's waiting for reading, or writing, or both +WAIT_STATUS_INIT = 0 +WAIT_STATUS_READING = 1 +WAIT_STATUS_WRITING = 2 +WAIT_STATUS_READWRITING = WAIT_STATUS_READING | WAIT_STATUS_WRITING + +NETWORK_MTU = 1500 +TCP_MSS = NETWORK_MTU - 40 +BUF_SIZE = 32 * 1024 +UDP_MAX_BUF_SIZE = 65536 + +class SpeedTester(object): + def __init__(self, max_speed = 0): + self.max_speed = max_speed * 1024 + self.last_time = time.time() + self.sum_len = 0 + + def update_limit(self, max_speed): + self.max_speed = max_speed * 1024 + + def add(self, data_len): + if self.max_speed > 0: + cut_t = time.time() + self.sum_len -= (cut_t - self.last_time) * self.max_speed + if self.sum_len < 0: + self.sum_len = 0 + self.last_time = cut_t + self.sum_len += data_len + + def isExceed(self): + if self.max_speed > 0: + cut_t = time.time() + self.sum_len -= (cut_t - self.last_time) * self.max_speed + if self.sum_len < 0: + self.sum_len = 0 + self.last_time = cut_t + return self.sum_len >= self.max_speed + return False + +class TCPRelayHandler(object): + def __init__(self, server, fd_to_handlers, loop, local_sock, config, + dns_resolver, is_local): + self._server = server + self._fd_to_handlers = fd_to_handlers + self._loop = loop + self._local_sock = local_sock + self._remote_sock = None + self._remote_sock_v6 = None + self._local_sock_fd = None + self._remote_sock_fd = None + self._remotev6_sock_fd = None + self._remote_udp = False + self._config = config + self._dns_resolver = dns_resolver + self._add_ref = 0 + if not self._create_encryptor(config): + return + + self._client_address = local_sock.getpeername()[:2] + self._accept_address = local_sock.getsockname()[:2] + self._user = None + self._user_id = server._listen_port + self._update_tcp_mss(local_sock) + + # TCP Relay works as either sslocal or ssserver + # if is_local, this is sslocal + self._is_local = is_local + self._encrypt_correct = True + self._obfs = obfs.obfs(config['obfs']) + self._protocol = obfs.obfs(config['protocol']) + self._overhead = self._obfs.get_overhead(self._is_local) + self._protocol.get_overhead(self._is_local) + self._recv_buffer_size = BUF_SIZE - self._overhead + + server_info = obfs.server_info(server.obfs_data) + server_info.host = config['server'] + server_info.port = server._listen_port + #server_info.users = server.server_users + #server_info.update_user_func = self._update_user + server_info.client = self._client_address[0] + server_info.client_port = self._client_address[1] + server_info.protocol_param = '' + server_info.obfs_param = config['obfs_param'] + server_info.iv = self._encryptor.cipher_iv + server_info.recv_iv = b'' + server_info.key_str = common.to_bytes(config['password']) + server_info.key = self._encryptor.cipher_key + server_info.head_len = 30 + server_info.tcp_mss = self._tcp_mss + server_info.buffer_size = self._recv_buffer_size + server_info.overhead = self._overhead + self._obfs.set_server_info(server_info) + + server_info = obfs.server_info(server.protocol_data) + server_info.host = config['server'] + server_info.port = server._listen_port + server_info.users = server.server_users + server_info.update_user_func = self._update_user + server_info.client = self._client_address[0] + server_info.client_port = self._client_address[1] + server_info.protocol_param = config['protocol_param'] + server_info.obfs_param = '' + server_info.iv = self._encryptor.cipher_iv + server_info.recv_iv = b'' + server_info.key_str = common.to_bytes(config['password']) + server_info.key = self._encryptor.cipher_key + server_info.head_len = 30 + server_info.tcp_mss = self._tcp_mss + server_info.buffer_size = self._recv_buffer_size + server_info.overhead = self._overhead + self._protocol.set_server_info(server_info) + + self._redir_list = config.get('redirect', ["*#0.0.0.0:0"]) + self._is_redirect = False + self._bind = config.get('out_bind', '') + self._bindv6 = config.get('out_bindv6', '') + self._ignore_bind_list = config.get('ignore_bind', []) + + self._fastopen_connected = False + self._data_to_write_to_local = [] + self._data_to_write_to_remote = [] + self._udp_data_send_buffer = b'' + self._upstream_status = WAIT_STATUS_READING + self._downstream_status = WAIT_STATUS_INIT + self._remote_address = None + + self._forbidden_iplist = config.get('forbidden_ip', None) + self._forbidden_portset = config.get('forbidden_port', None) + if is_local: + self._chosen_server = self._get_a_server() + + self.last_activity = 0 + self._update_activity() + self._server.add_connection(1) + self._server.stat_add(self._client_address[0], 1) + self._add_ref = 1 + self.speed_tester_u = SpeedTester(config.get("speed_limit_per_con", 0)) + self.speed_tester_d = SpeedTester(config.get("speed_limit_per_con", 0)) + self._recv_u_max_size = BUF_SIZE + self._recv_d_max_size = BUF_SIZE + self._recv_pack_id = 0 + self._udp_send_pack_id = 0 + self._udpv6_send_pack_id = 0 + + local_sock.setblocking(False) + local_sock.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1) + self._local_sock_fd = local_sock.fileno() + fd_to_handlers[self._local_sock_fd] = self + loop.add(local_sock, eventloop.POLL_IN | eventloop.POLL_ERR, self._server) + self._stage = STAGE_INIT + + def __hash__(self): + # default __hash__ is id / 16 + # we want to eliminate collisions + return id(self) + + @property + def remote_address(self): + return self._remote_address + + def _get_a_server(self): + server = self._config['server'] + server_port = self._config['server_port'] + if type(server_port) == list: + server_port = random.choice(server_port) + if type(server) == list: + server = random.choice(server) + logging.debug('chosen server: %s:%d', server, server_port) + return server, server_port + + def _update_tcp_mss(self, local_sock): + self._tcp_mss = TCP_MSS + try: + tcp_mss = local_sock.getsockopt(socket.SOL_TCP, socket.TCP_MAXSEG) + if tcp_mss > 500 and tcp_mss <= 1500: + self._tcp_mss = tcp_mss + logging.debug("TCP MSS = %d" % (self._tcp_mss,)) + except: + pass + + def _create_encryptor(self, config): + try: + self._encryptor = encrypt.Encryptor(config['password'], + config['method']) + return True + except Exception: + self._stage = STAGE_DESTROYED + logging.error('create encryptor fail at port %d', self._server._listen_port) + + def _update_user(self, user): + self._user = user + self._user_id = struct.unpack(' 6: + length = struct.unpack('>H', self._udp_data_send_buffer[:2])[0] + + if length > len(self._udp_data_send_buffer): + break + + data = self._udp_data_send_buffer[:length] + self._udp_data_send_buffer = self._udp_data_send_buffer[length:] + + frag = common.ord(data[2]) + if frag != 0: + logging.warn('drop a message since frag is %d' % (frag,)) + continue + else: + data = data[3:] + header_result = parse_header(data) + if header_result is None: + continue + connecttype, addrtype, dest_addr, dest_port, header_length = header_result + if (addrtype & 7) == 3: + af = common.is_ip(dest_addr) + if af == False: + handler = common.UDPAsyncDNSHandler(data[header_length:]) + handler.resolve(self._dns_resolver, (dest_addr, dest_port), self._handle_server_dns_resolved) + else: + return self._handle_server_dns_resolved("", (dest_addr, dest_port), dest_addr, data[header_length:]) + else: + return self._handle_server_dns_resolved("", (dest_addr, dest_port), dest_addr, data[header_length:]) + + except Exception as e: + #trace = traceback.format_exc() + #logging.error(trace) + error_no = eventloop.errno_from_exception(e) + if error_no in (errno.EAGAIN, errno.EINPROGRESS, + errno.EWOULDBLOCK): + uncomplete = True + else: + shell.print_exception(e) + logging.error("exception from %s:%d" % (self._client_address[0], self._client_address[1])) + self.destroy() + return False + return True + else: + try: + if self._encrypt_correct: + if sock == self._remote_sock: + self._server.add_transfer_u(self._user, len(data)) + self._update_activity(len(data)) + if data: + l = len(data) + s = sock.send(data) + if s < l: + data = data[s:] + uncomplete = True + else: + return + except (OSError, IOError) as e: + error_no = eventloop.errno_from_exception(e) + if error_no in (errno.EAGAIN, errno.EINPROGRESS, + errno.EWOULDBLOCK): + uncomplete = True + else: + #traceback.print_exc() + shell.print_exception(e) + logging.error("exception from %s:%d" % (self._client_address[0], self._client_address[1])) + self.destroy() + return False + except Exception as e: + shell.print_exception(e) + logging.error("exception from %s:%d" % (self._client_address[0], self._client_address[1])) + self.destroy() + return False + if uncomplete: + if sock == self._local_sock: + self._data_to_write_to_local.append(data) + self._update_stream(STREAM_DOWN, WAIT_STATUS_WRITING) + elif sock == self._remote_sock: + self._data_to_write_to_remote.append(data) + self._update_stream(STREAM_UP, WAIT_STATUS_WRITING) + else: + logging.error('write_all_to_sock:unknown socket from %s:%d' % (self._client_address[0], self._client_address[1])) + else: + if sock == self._local_sock: + self._update_stream(STREAM_DOWN, WAIT_STATUS_READING) + elif sock == self._remote_sock: + self._update_stream(STREAM_UP, WAIT_STATUS_READING) + else: + logging.error('write_all_to_sock:unknown socket from %s:%d' % (self._client_address[0], self._client_address[1])) + return True + + def _handle_server_dns_resolved(self, error, remote_addr, server_addr, data): + if error: + return + try: + addrs = socket.getaddrinfo(server_addr, remote_addr[1], 0, socket.SOCK_DGRAM, socket.SOL_UDP) + if not addrs: # drop + return + af, socktype, proto, canonname, sa = addrs[0] + if af == socket.AF_INET6: + self._remote_sock_v6.sendto(data, (server_addr, remote_addr[1])) + if self._udpv6_send_pack_id == 0: + addr, port = self._remote_sock_v6.getsockname()[:2] + common.connect_log('UDPv6 sendto %s(%s):%d from %s:%d by user %d' % + (common.to_str(remote_addr[0]), common.to_str(server_addr), remote_addr[1], addr, port, self._user_id)) + self._udpv6_send_pack_id += 1 + else: + self._remote_sock.sendto(data, (server_addr, remote_addr[1])) + if self._udp_send_pack_id == 0: + addr, port = self._remote_sock.getsockname()[:2] + common.connect_log('UDP sendto %s(%s):%d from %s:%d by user %d' % + (common.to_str(remote_addr[0]), common.to_str(server_addr), remote_addr[1], addr, port, self._user_id)) + self._udp_send_pack_id += 1 + return True + except Exception as e: + shell.print_exception(e) + logging.error("exception from %s:%d" % (self._client_address[0], self._client_address[1])) + + def _get_redirect_host(self, client_address, ogn_data): + host_list = self._redir_list or ["*#0.0.0.0:0"] + + if type(host_list) != list: + host_list = [host_list] + + items_sum = common.to_str(host_list[0]).rsplit('#', 1) + if len(items_sum) < 2: + hash_code = binascii.crc32(ogn_data) + addrs = socket.getaddrinfo(client_address[0], client_address[1], 0, socket.SOCK_STREAM, socket.SOL_TCP) + af, socktype, proto, canonname, sa = addrs[0] + address_bytes = common.inet_pton(af, sa[0]) + if af == socket.AF_INET6: + addr = struct.unpack('>Q', address_bytes[8:])[0] + elif af == socket.AF_INET: + addr = struct.unpack('>I', address_bytes)[0] + else: + addr = 0 + + host_port = [] + match_port = False + for host in host_list: + items = common.to_str(host).rsplit(':', 1) + if len(items) > 1: + try: + port = int(items[1]) + if port == self._server._listen_port: + match_port = True + host_port.append((items[0], port)) + except: + pass + else: + host_port.append((host, 80)) + + if match_port: + last_host_port = host_port + host_port = [] + for host in last_host_port: + if host[1] == self._server._listen_port: + host_port.append(host) + + return host_port[((hash_code & 0xffffffff) + addr) % len(host_port)] + + else: + host_port = [] + for host in host_list: + items_sum = common.to_str(host).rsplit('#', 1) + items_match = common.to_str(items_sum[0]).rsplit(':', 1) + items = common.to_str(items_sum[1]).rsplit(':', 1) + if len(items_match) > 1: + if items_match[1] != "*": + try: + if self._server._listen_port != int(items_match[1]) and int(items_match[1]) != 0: + continue + except: + pass + + if items_match[0] != "*" and common.match_regex( + items_match[0], ogn_data) == False: + continue + if len(items) > 1: + try: + port = int(items[1]) + return (items[0], port) + except: + pass + else: + return (items[0], 80) + + return ("0.0.0.0", 0) + + def _handel_protocol_error(self, client_address, ogn_data): + logging.warn("Protocol ERROR, TCP ogn data %s from %s:%d via port %d by UID %d" % (binascii.hexlify(ogn_data), client_address[0], client_address[1], self._server._listen_port, self._user_id)) + self._encrypt_correct = False + #create redirect or disconnect by hash code + host, port = self._get_redirect_host(client_address, ogn_data) + if port == 0: + raise Exception('can not parse header') + data = b"\x03" + common.to_bytes(common.chr(len(host))) + common.to_bytes(host) + struct.pack('>H', port) + self._is_redirect = True + logging.warn("TCP data redir %s:%d %s" % (host, port, binascii.hexlify(data))) + return data + ogn_data + + def _handle_stage_connecting(self, data): + if self._is_local: + if self._encryptor is not None: + data = self._protocol.client_pre_encrypt(data) + data = self._encryptor.encrypt(data) + data = self._obfs.client_encode(data) + if data: + self._data_to_write_to_remote.append(data) + if self._is_local and not self._fastopen_connected and \ + self._config['fast_open']: + # for sslocal and fastopen, we basically wait for data and use + # sendto to connect + try: + # only connect once + self._fastopen_connected = True + remote_sock = \ + self._create_remote_socket(self._chosen_server[0], + self._chosen_server[1]) + self._loop.add(remote_sock, eventloop.POLL_ERR, self._server) + data = b''.join(self._data_to_write_to_remote) + l = len(data) + s = remote_sock.sendto(data, MSG_FASTOPEN, self._chosen_server) + if s < l: + data = data[s:] + self._data_to_write_to_remote = [data] + else: + self._data_to_write_to_remote = [] + self._update_stream(STREAM_UP, WAIT_STATUS_READWRITING) + except (OSError, IOError) as e: + if eventloop.errno_from_exception(e) == errno.EINPROGRESS: + # in this case data is not sent at all + self._update_stream(STREAM_UP, WAIT_STATUS_READWRITING) + elif eventloop.errno_from_exception(e) == errno.ENOTCONN: + logging.error('fast open not supported on this OS') + self._config['fast_open'] = False + self.destroy() + else: + shell.print_exception(e) + if self._config['verbose']: + traceback.print_exc() + logging.error("exception from %s:%d" % (self._client_address[0], self._client_address[1])) + self.destroy() + + def _get_head_size(self, buf, def_value): + if len(buf) < 2: + return def_value + head_type = common.ord(buf[0]) & 0xF + if head_type == 1: + return 7 + if head_type == 4: + return 19 + if head_type == 3: + return 4 + common.ord(buf[1]) + return def_value + + def _handle_stage_addr(self, ogn_data, data): + try: + if self._is_local: + cmd = common.ord(data[1]) + if cmd == CMD_UDP_ASSOCIATE: + logging.debug('UDP associate') + if self._local_sock.family == socket.AF_INET6: + header = b'\x05\x00\x00\x04' + else: + header = b'\x05\x00\x00\x01' + addr, port = self._local_sock.getsockname()[:2] + addr_to_send = socket.inet_pton(self._local_sock.family, + addr) + port_to_send = struct.pack('>H', port) + self._write_to_sock(header + addr_to_send + port_to_send, + self._local_sock) + self._stage = STAGE_UDP_ASSOC + # just wait for the client to disconnect + return + elif cmd == CMD_CONNECT: + # just trim VER CMD RSV + data = data[3:] + else: + logging.error('invalid command %d', cmd) + self.destroy() + return + + before_parse_data = data + if self._is_local: + header_result = parse_header(data) + else: + data = pre_parse_header(data) + if data is None: + data = self._handel_protocol_error(self._client_address, ogn_data) + header_result = parse_header(data) + if header_result is not None: + try: + common.to_str(header_result[2]) + except Exception as e: + header_result = None + if header_result is None: + data = self._handel_protocol_error(self._client_address, ogn_data) + header_result = parse_header(data) + self._overhead = self._obfs.get_overhead(self._is_local) + self._protocol.get_overhead(self._is_local) + self._recv_buffer_size = BUF_SIZE - self._overhead + server_info = self._obfs.get_server_info() + server_info.buffer_size = self._recv_buffer_size + server_info = self._protocol.get_server_info() + server_info.buffer_size = self._recv_buffer_size + connecttype, addrtype, remote_addr, remote_port, header_length = header_result + if connecttype != 0: + pass + #common.connect_log('UDP over TCP by user %d' % + # (self._user_id, )) + else: + common.connect_log('TCP request %s:%d by user %d' % + (common.to_str(remote_addr), remote_port, self._user_id)) + self._remote_address = (common.to_str(remote_addr), remote_port) + self._remote_udp = (connecttype != 0) + # pause reading + self._update_stream(STREAM_UP, WAIT_STATUS_WRITING) + self._stage = STAGE_DNS + if self._is_local: + # forward address to remote + self._write_to_sock((b'\x05\x00\x00\x01' + b'\x00\x00\x00\x00\x10\x10'), + self._local_sock) + head_len = self._get_head_size(data, 30) + self._obfs.obfs.server_info.head_len = head_len + self._protocol.obfs.server_info.head_len = head_len + if self._encryptor is not None: + data = self._protocol.client_pre_encrypt(data) + data_to_send = self._encryptor.encrypt(data) + data_to_send = self._obfs.client_encode(data_to_send) + if data_to_send: + self._data_to_write_to_remote.append(data_to_send) + # notice here may go into _handle_dns_resolved directly + self._dns_resolver.resolve(self._chosen_server[0], + self._handle_dns_resolved) + else: + if len(data) > header_length: + self._data_to_write_to_remote.append(data[header_length:]) + # notice here may go into _handle_dns_resolved directly + self._dns_resolver.resolve(remote_addr, + self._handle_dns_resolved) + except Exception as e: + self._log_error(e) + if self._config['verbose']: + traceback.print_exc() + self.destroy() + + def _socket_bind_addr(self, sock, af): + bind_addr = '' + if self._bind and af == socket.AF_INET: + bind_addr = self._bind + elif self._bindv6 and af == socket.AF_INET6: + bind_addr = self._bindv6 + else: + bind_addr = self._accept_address[0] + + bind_addr = bind_addr.replace("::ffff:", "") + if bind_addr in self._ignore_bind_list: + bind_addr = None + if bind_addr: + local_addrs = socket.getaddrinfo(bind_addr, 0, 0, socket.SOCK_STREAM, socket.SOL_TCP) + if local_addrs[0][0] == af: + logging.debug("bind %s" % (bind_addr,)) + try: + sock.bind((bind_addr, 0)) + except Exception as e: + logging.warn("bind %s fail" % (bind_addr,)) + + def _create_remote_socket(self, ip, port): + if self._remote_udp: + addrs_v6 = socket.getaddrinfo("::", 0, 0, socket.SOCK_DGRAM, socket.SOL_UDP) + addrs = socket.getaddrinfo("0.0.0.0", 0, 0, socket.SOCK_DGRAM, socket.SOL_UDP) + else: + addrs = socket.getaddrinfo(ip, port, 0, socket.SOCK_STREAM, socket.SOL_TCP) + if len(addrs) == 0: + raise Exception("getaddrinfo failed for %s:%d" % (ip, port)) + af, socktype, proto, canonname, sa = addrs[0] + if not self._remote_udp and not self._is_redirect: + if self._forbidden_iplist: + if common.to_str(sa[0]) in self._forbidden_iplist: + if self._remote_address: + raise Exception('IP %s is in forbidden list, when connect to %s:%d via port %d by UID %d' % + (common.to_str(sa[0]), self._remote_address[0], self._remote_address[1], self._server._listen_port, self._user_id)) + raise Exception('IP %s is in forbidden list, reject' % + common.to_str(sa[0])) + if self._forbidden_portset: + if sa[1] in self._forbidden_portset: + if self._remote_address: + raise Exception('Port %d is in forbidden list, when connect to %s:%d via port %d by UID %d' % + (sa[1], self._remote_address[0], self._remote_address[1], self._server._listen_port, self._user_id)) + raise Exception('Port %d is in forbidden list, reject' % sa[1]) + remote_sock = socket.socket(af, socktype, proto) + self._remote_sock = remote_sock + self._remote_sock_fd = remote_sock.fileno() + self._fd_to_handlers[self._remote_sock_fd] = self + + if self._remote_udp: + af, socktype, proto, canonname, sa = addrs_v6[0] + remote_sock_v6 = socket.socket(af, socktype, proto) + self._remote_sock_v6 = remote_sock_v6 + self._remotev6_sock_fd = remote_sock_v6.fileno() + self._fd_to_handlers[self._remotev6_sock_fd] = self + + remote_sock.setblocking(False) + if self._remote_udp: + remote_sock_v6.setblocking(False) + + if not self._is_local: + self._socket_bind_addr(remote_sock, af) + self._socket_bind_addr(remote_sock_v6, af) + else: + remote_sock.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1) + if not self._is_local: + self._socket_bind_addr(remote_sock, af) + return remote_sock + + def _handle_dns_resolved(self, result, error): + if error: + self._log_error(error) + self.destroy() + return + if result: + ip = result[1] + if ip: + try: + self._stage = STAGE_CONNECTING + remote_addr = ip + if self._is_local: + remote_port = self._chosen_server[1] + else: + remote_port = self._remote_address[1] + + if self._is_local and self._config['fast_open']: + # for fastopen: + # wait for more data to arrive and send them in one SYN + self._stage = STAGE_CONNECTING + # we don't have to wait for remote since it's not + # created + self._update_stream(STREAM_UP, WAIT_STATUS_READING) + # TODO when there is already data in this packet + else: + # else do connect + remote_sock = self._create_remote_socket(remote_addr, + remote_port) + if self._remote_udp: + self._loop.add(remote_sock, + eventloop.POLL_IN, + self._server) + if self._remote_sock_v6: + self._loop.add(self._remote_sock_v6, + eventloop.POLL_IN, + self._server) + else: + try: + remote_sock.connect((remote_addr, remote_port)) + except (OSError, IOError) as e: + if eventloop.errno_from_exception(e) in (errno.EINPROGRESS, + errno.EWOULDBLOCK): + pass # always goto here + else: + raise e + addr, port = self._remote_sock.getsockname()[:2] + common.connect_log('TCP connecting %s(%s):%d from %s:%d by user %d' % + (common.to_str(self._remote_address[0]), common.to_str(remote_addr), remote_port, addr, port, self._user_id)) + + self._loop.add(remote_sock, + eventloop.POLL_ERR | eventloop.POLL_OUT, + self._server) + self._stage = STAGE_CONNECTING + self._update_stream(STREAM_UP, WAIT_STATUS_READWRITING) + self._update_stream(STREAM_DOWN, WAIT_STATUS_READING) + if self._remote_udp: + while self._data_to_write_to_remote: + data = self._data_to_write_to_remote[0] + del self._data_to_write_to_remote[0] + self._write_to_sock(data, self._remote_sock) + return + except Exception as e: + shell.print_exception(e) + if self._config['verbose']: + traceback.print_exc() + logging.error("exception from %s:%d" % (self._client_address[0], self._client_address[1])) + self.destroy() + + def _get_read_size(self, sock, recv_buffer_size, up): + if self._overhead == 0: + return recv_buffer_size + buffer_size = len(sock.recv(recv_buffer_size, socket.MSG_PEEK)) + frame_size = self._tcp_mss - self._overhead + if up: + buffer_size = min(buffer_size, self._recv_u_max_size) + self._recv_u_max_size = min(self._recv_u_max_size + frame_size, BUF_SIZE) + else: + buffer_size = min(buffer_size, self._recv_d_max_size) + self._recv_d_max_size = min(self._recv_d_max_size + frame_size, BUF_SIZE) + if buffer_size == recv_buffer_size: + return buffer_size + if buffer_size > frame_size: + buffer_size = int(buffer_size / frame_size) * frame_size + return buffer_size + + def _on_local_read(self): + # handle all local read events and dispatch them to methods for + # each stage + if not self._local_sock: + return + is_local = self._is_local + if is_local: + recv_buffer_size = self._get_read_size(self._local_sock, self._recv_buffer_size, True) + else: + recv_buffer_size = BUF_SIZE + data = None + try: + data = self._local_sock.recv(recv_buffer_size) + except (OSError, IOError) as e: + if eventloop.errno_from_exception(e) in \ + (errno.ETIMEDOUT, errno.EAGAIN, errno.EWOULDBLOCK): + return + if not data: + self.destroy() + return + + self.speed_tester_u.add(len(data)) + self._server.speed_tester_u(self._user_id).add(len(data)) + ogn_data = data + if not is_local: + if self._encryptor is not None: + if self._encrypt_correct: + try: + obfs_decode = self._obfs.server_decode(data) + if self._stage == STAGE_INIT: + self._overhead = self._obfs.get_overhead(self._is_local) + self._protocol.get_overhead(self._is_local) + server_info = self._protocol.get_server_info() + server_info.overhead = self._overhead + except Exception as e: + shell.print_exception(e) + logging.error("exception from %s:%d" % (self._client_address[0], self._client_address[1])) + self.destroy() + return + if obfs_decode[2]: + data = self._obfs.server_encode(b'') + try: + self._write_to_sock(data, self._local_sock) + except Exception as e: + shell.print_exception(e) + if self._config['verbose']: + traceback.print_exc() + logging.error("exception from %s:%d" % (self._client_address[0], self._client_address[1])) + self.destroy() + return + if obfs_decode[1]: + if not self._protocol.obfs.server_info.recv_iv: + iv_len = len(self._protocol.obfs.server_info.iv) + self._protocol.obfs.server_info.recv_iv = obfs_decode[0][:iv_len] + data = self._encryptor.decrypt(obfs_decode[0]) + else: + data = obfs_decode[0] + try: + data, sendback = self._protocol.server_post_decrypt(data) + if sendback: + backdata = self._protocol.server_pre_encrypt(b'') + backdata = self._encryptor.encrypt(backdata) + backdata = self._obfs.server_encode(backdata) + try: + self._write_to_sock(backdata, self._local_sock) + except Exception as e: + shell.print_exception(e) + if self._config['verbose']: + traceback.print_exc() + logging.error("exception from %s:%d" % (self._client_address[0], self._client_address[1])) + self.destroy() + return + except Exception as e: + shell.print_exception(e) + logging.error("exception from %s:%d" % (self._client_address[0], self._client_address[1])) + self.destroy() + return + else: + return + if not data: + return + if self._stage == STAGE_STREAM: + if self._is_local: + if self._encryptor is not None: + data = self._protocol.client_pre_encrypt(data) + data = self._encryptor.encrypt(data) + data = self._obfs.client_encode(data) + self._write_to_sock(data, self._remote_sock) + elif is_local and self._stage == STAGE_INIT: + # TODO check auth method + self._write_to_sock(b'\x05\00', self._local_sock) + self._stage = STAGE_ADDR + elif self._stage == STAGE_CONNECTING: + self._handle_stage_connecting(data) + elif (is_local and self._stage == STAGE_ADDR) or \ + (not is_local and self._stage == STAGE_INIT): + self._handle_stage_addr(ogn_data, data) + + def _on_remote_read(self, is_remote_sock): + # handle all remote read events + data = None + try: + if self._remote_udp: + if is_remote_sock: + data, addr = self._remote_sock.recvfrom(UDP_MAX_BUF_SIZE) + else: + data, addr = self._remote_sock_v6.recvfrom(UDP_MAX_BUF_SIZE) + port = struct.pack('>H', addr[1]) + try: + ip = socket.inet_aton(addr[0]) + data = b'\x00\x01' + ip + port + data + except Exception as e: + ip = socket.inet_pton(socket.AF_INET6, addr[0]) + data = b'\x00\x04' + ip + port + data + size = len(data) + 2 + data = struct.pack('>H', size) + data + #logging.info('UDP over TCP recvfrom %s:%d %d bytes to %s:%d' % (addr[0], addr[1], len(data), self._client_address[0], self._client_address[1])) + else: + if self._is_local: + recv_buffer_size = BUF_SIZE + else: + recv_buffer_size = self._get_read_size(self._remote_sock, self._recv_buffer_size, False) + data = self._remote_sock.recv(recv_buffer_size) + self._recv_pack_id += 1 + except (OSError, IOError) as e: + if eventloop.errno_from_exception(e) in \ + (errno.ETIMEDOUT, errno.EAGAIN, errno.EWOULDBLOCK, 10035): #errno.WSAEWOULDBLOCK + return + if not data: + self.destroy() + return + + self.speed_tester_d.add(len(data)) + self._server.speed_tester_d(self._user_id).add(len(data)) + if self._encryptor is not None: + if self._is_local: + try: + obfs_decode = self._obfs.client_decode(data) + except Exception as e: + shell.print_exception(e) + logging.error("exception from %s:%d" % (self._client_address[0], self._client_address[1])) + self.destroy() + return + if obfs_decode[1]: + send_back = self._obfs.client_encode(b'') + self._write_to_sock(send_back, self._remote_sock) + if not self._protocol.obfs.server_info.recv_iv: + iv_len = len(self._protocol.obfs.server_info.iv) + self._protocol.obfs.server_info.recv_iv = obfs_decode[0][:iv_len] + data = self._encryptor.decrypt(obfs_decode[0]) + try: + data = self._protocol.client_post_decrypt(data) + if self._recv_pack_id == 1: + self._tcp_mss = self._protocol.get_server_info().tcp_mss + except Exception as e: + shell.print_exception(e) + logging.error("exception from %s:%d" % (self._client_address[0], self._client_address[1])) + self.destroy() + return + else: + if self._encrypt_correct: + data = self._protocol.server_pre_encrypt(data) + data = self._encryptor.encrypt(data) + data = self._obfs.server_encode(data) + self._server.add_transfer_d(self._user, len(data)) + self._update_activity(len(data)) + else: + return + try: + self._write_to_sock(data, self._local_sock) + except Exception as e: + shell.print_exception(e) + if self._config['verbose']: + traceback.print_exc() + logging.error("exception from %s:%d" % (self._client_address[0], self._client_address[1])) + self.destroy() + + def _on_local_write(self): + # handle local writable event + if self._data_to_write_to_local: + data = b''.join(self._data_to_write_to_local) + self._data_to_write_to_local = [] + self._write_to_sock(data, self._local_sock) + else: + self._update_stream(STREAM_DOWN, WAIT_STATUS_READING) + + def _on_remote_write(self): + # handle remote writable event + self._stage = STAGE_STREAM + if self._data_to_write_to_remote: + data = b''.join(self._data_to_write_to_remote) + self._data_to_write_to_remote = [] + self._write_to_sock(data, self._remote_sock) + else: + self._update_stream(STREAM_UP, WAIT_STATUS_READING) + + def _on_local_error(self): + if self._local_sock: + err = eventloop.get_sock_error(self._local_sock) + if err.errno not in [errno.ECONNRESET, errno.EPIPE]: + logging.error(err) + logging.error("local error, exception from %s:%d" % (self._client_address[0], self._client_address[1])) + self.destroy() + + def _on_remote_error(self): + if self._remote_sock: + err = eventloop.get_sock_error(self._remote_sock) + if err.errno not in [errno.ECONNRESET]: + logging.error(err) + if self._remote_address: + logging.error("remote error, when connect to %s:%d" % (self._remote_address[0], self._remote_address[1])) + else: + logging.error("remote error, exception from %s:%d" % (self._client_address[0], self._client_address[1])) + self.destroy() + + def handle_event(self, sock, fd, event): + # handle all events in this handler and dispatch them to methods + handle = False + if self._stage == STAGE_DESTROYED: + logging.debug('ignore handle_event: destroyed') + return True + if self._user is not None and self._user not in self._server.server_users: + self.destroy() + return True + if fd == self._remote_sock_fd or fd == self._remotev6_sock_fd: + if event & eventloop.POLL_ERR: + handle = True + self._on_remote_error() + elif event & (eventloop.POLL_IN | eventloop.POLL_HUP): + if not self.speed_tester_d.isExceed() and not self._server.speed_tester_d(self._user_id).isExceed(): + handle = True + self._on_remote_read(sock == self._remote_sock) + else: + self._recv_d_max_size = self._tcp_mss - self._overhead + elif event & eventloop.POLL_OUT: + handle = True + self._on_remote_write() + elif fd == self._local_sock_fd: + if event & eventloop.POLL_ERR: + handle = True + self._on_local_error() + elif event & (eventloop.POLL_IN | eventloop.POLL_HUP): + if not self.speed_tester_u.isExceed() and not self._server.speed_tester_u(self._user_id).isExceed(): + handle = True + self._on_local_read() + else: + self._recv_u_max_size = self._tcp_mss - self._overhead + elif event & eventloop.POLL_OUT: + handle = True + self._on_local_write() + else: + logging.warn('unknown socket from %s:%d' % (self._client_address[0], self._client_address[1])) + try: + self._loop.removefd(fd) + except Exception as e: + shell.print_exception(e) + try: + del self._fd_to_handlers[fd] + except Exception as e: + shell.print_exception(e) + sock.close() + + return handle + + def _log_error(self, e): + logging.error('%s when handling connection from %s:%d' % + (e, self._client_address[0], self._client_address[1])) + + def stage(self): + return self._stage + + def destroy(self): + # destroy the handler and release any resources + # promises: + # 1. destroy won't make another destroy() call inside + # 2. destroy releases resources so it prevents future call to destroy + # 3. destroy won't raise any exceptions + # if any of the promises are broken, it indicates a bug has been + # introduced! mostly likely memory leaks, etc + if self._stage == STAGE_DESTROYED: + # this couldn't happen + logging.debug('already destroyed') + return + self._stage = STAGE_DESTROYED + if self._remote_address: + logging.debug('destroy: %s:%d' % + self._remote_address) + else: + logging.debug('destroy') + if self._remote_sock: + logging.debug('destroying remote') + try: + self._loop.removefd(self._remote_sock_fd) + except Exception as e: + shell.print_exception(e) + try: + if self._remote_sock_fd is not None: + del self._fd_to_handlers[self._remote_sock_fd] + except Exception as e: + shell.print_exception(e) + self._remote_sock.close() + self._remote_sock = None + if self._remote_sock_v6: + logging.debug('destroying remote_v6') + try: + self._loop.removefd(self._remotev6_sock_fd) + except Exception as e: + shell.print_exception(e) + try: + if self._remotev6_sock_fd is not None: + del self._fd_to_handlers[self._remotev6_sock_fd] + except Exception as e: + shell.print_exception(e) + self._remote_sock_v6.close() + self._remote_sock_v6 = None + if self._local_sock: + logging.debug('destroying local') + try: + self._loop.removefd(self._local_sock_fd) + except Exception as e: + shell.print_exception(e) + try: + if self._local_sock_fd is not None: + del self._fd_to_handlers[self._local_sock_fd] + except Exception as e: + shell.print_exception(e) + self._local_sock.close() + self._local_sock = None + if self._obfs: + self._obfs.dispose() + self._obfs = None + if self._protocol: + self._protocol.dispose() + self._protocol = None + self._encryptor = None + self._dns_resolver.remove_callback(self._handle_dns_resolved) + self._server.remove_handler(self) + if self._add_ref > 0: + self._server.add_connection(-1) + self._server.stat_add(self._client_address[0], -1) + +class TCPRelay(object): + def __init__(self, config, dns_resolver, is_local, stat_callback=None, stat_counter=None): + self._config = config + self._is_local = is_local + self._dns_resolver = dns_resolver + self._closed = False + self._eventloop = None + self._fd_to_handlers = {} + self.server_transfer_ul = 0 + self.server_transfer_dl = 0 + self.server_users = {} + self.server_users_cfg = {} + self.server_user_transfer_ul = {} + self.server_user_transfer_dl = {} + self.mu = False + self._speed_tester_u = {} + self._speed_tester_d = {} + self.server_connections = 0 + self.protocol_data = obfs.obfs(config['protocol']).init_data() + self.obfs_data = obfs.obfs(config['obfs']).init_data() + + if config.get('connect_verbose_info', 0) > 0: + common.connect_log = logging.info + + self._timeout = config['timeout'] + self._timeout_cache = lru_cache.LRUCache(timeout=self._timeout, + close_callback=self._close_tcp_client) + + if is_local: + listen_addr = config['local_address'] + listen_port = config['local_port'] + else: + listen_addr = config['server'] + listen_port = config['server_port'] + self._listen_port = listen_port + + if common.to_str(config['protocol']) in obfs.mu_protocol(): + self._update_users(None, None) + + addrs = socket.getaddrinfo(listen_addr, listen_port, 0, + socket.SOCK_STREAM, socket.SOL_TCP) + if len(addrs) == 0: + raise Exception("can't get addrinfo for %s:%d" % + (listen_addr, listen_port)) + af, socktype, proto, canonname, sa = addrs[0] + server_socket = socket.socket(af, socktype, proto) + server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + server_socket.bind(sa) + server_socket.setblocking(False) + if config['fast_open']: + try: + server_socket.setsockopt(socket.SOL_TCP, 23, 5) + except socket.error: + logging.error('warning: fast open is not available') + self._config['fast_open'] = False + server_socket.listen(config.get('max_connect', 1024)) + self._server_socket = server_socket + self._server_socket_fd = server_socket.fileno() + self._stat_counter = stat_counter + self._stat_callback = stat_callback + + def add_to_loop(self, loop): + if self._eventloop: + raise Exception('already add to loop') + if self._closed: + raise Exception('already closed') + self._eventloop = loop + self._eventloop.add(self._server_socket, + eventloop.POLL_IN | eventloop.POLL_ERR, self) + self._eventloop.add_periodic(self.handle_periodic) + + def remove_handler(self, client): + if hash(client) in self._timeout_cache: + del self._timeout_cache[hash(client)] + + def add_connection(self, val): + self.server_connections += val + logging.debug('server port %5d connections = %d' % (self._listen_port, self.server_connections,)) + + def get_ud(self): + return (self.server_transfer_ul, self.server_transfer_dl) + + def get_users_ud(self): + return (self.server_user_transfer_ul.copy(), self.server_user_transfer_dl.copy()) + + def _update_users(self, protocol_param, acl): + if protocol_param is None: + protocol_param = self._config['protocol_param'] + param = common.to_bytes(protocol_param).split(b'#') + if len(param) == 2: + self.mu = True + user_list = param[1].split(b',') + if user_list: + for user in user_list: + items = user.split(b':') + if len(items) == 2: + user_int_id = int(items[0]) + uid = struct.pack('= stat_dict.get(-1, 0) + connections_step: + logging.info('port %d connections up to %d' % (port, newval)) + stat_dict[-1] = stat_dict.get(-1, 0) + connections_step + elif newval <= stat_dict.get(-1, 0) - connections_step: + logging.info('port %d connections down to %d' % (port, newval)) + stat_dict[-1] = stat_dict.get(-1, 0) - connections_step + + def stat_add(self, local_addr, val): + if self._stat_counter is not None: + if self._listen_port not in self._stat_counter: + self._stat_counter[self._listen_port] = {} + newval = self._stat_counter[self._listen_port].get(local_addr, 0) + val + logging.debug('port %d addr %s connections %d' % (self._listen_port, local_addr, newval)) + self._stat_counter[self._listen_port][local_addr] = newval + self.update_stat(self._listen_port, self._stat_counter[self._listen_port], val) + if newval <= 0: + if local_addr in self._stat_counter[self._listen_port]: + del self._stat_counter[self._listen_port][local_addr] + + newval = self._stat_counter.get(0, 0) + val + self._stat_counter[0] = newval + logging.debug('Total connections %d' % newval) + + connections_step = 50 + if newval >= self._stat_counter.get(-1, 0) + connections_step: + logging.info('Total connections up to %d' % newval) + self._stat_counter[-1] = self._stat_counter.get(-1, 0) + connections_step + elif newval <= self._stat_counter.get(-1, 0) - connections_step: + logging.info('Total connections down to %d' % newval) + self._stat_counter[-1] = self._stat_counter.get(-1, 0) - connections_step + + def update_activity(self, client, data_len): + if data_len and self._stat_callback: + self._stat_callback(self._listen_port, data_len) + + self._timeout_cache[hash(client)] = client + + def _sweep_timeout(self): + self._timeout_cache.sweep() + + def _close_tcp_client(self, client): + if client.remote_address: + logging.debug('timed out: %s:%d' % + client.remote_address) + else: + logging.debug('timed out') + client.destroy() + + def handle_event(self, sock, fd, event): + # handle events and dispatch to handlers + handle = False + if sock: + logging.log(shell.VERBOSE_LEVEL, 'fd %d %s', fd, + eventloop.EVENT_NAMES.get(event, event)) + if sock == self._server_socket: + if event & eventloop.POLL_ERR: + # TODO + raise Exception('server_socket error') + handler = None + handle = True + try: + logging.debug('accept') + conn = self._server_socket.accept() + handler = TCPRelayHandler(self, self._fd_to_handlers, + self._eventloop, conn[0], self._config, + self._dns_resolver, self._is_local) + if handler.stage() == STAGE_DESTROYED: + conn[0].close() + except (OSError, IOError) as e: + error_no = eventloop.errno_from_exception(e) + if error_no in (errno.EAGAIN, errno.EINPROGRESS, + errno.EWOULDBLOCK): + return + else: + shell.print_exception(e) + if self._config['verbose']: + traceback.print_exc() + if handler: + handler.destroy() + else: + if sock: + handler = self._fd_to_handlers.get(fd, None) + if handler: + handle = handler.handle_event(sock, fd, event) + else: + logging.warn('unknown fd') + handle = True + try: + self._eventloop.removefd(fd) + except Exception as e: + shell.print_exception(e) + sock.close() + else: + logging.warn('poll removed fd') + handle = True + if fd in self._fd_to_handlers: + try: + del self._fd_to_handlers[fd] + except Exception as e: + shell.print_exception(e) + return handle + + def handle_periodic(self): + if self._closed: + if self._server_socket: + self._eventloop.removefd(self._server_socket_fd) + self._server_socket.close() + self._server_socket = None + logging.info('closed TCP port %d', self._listen_port) + for handler in list(self._fd_to_handlers.values()): + handler.destroy() + self._sweep_timeout() + + def close(self, next_tick=False): + logging.debug('TCP close') + self._closed = True + if not next_tick: + if self._eventloop: + self._eventloop.remove_periodic(self.handle_periodic) + self._eventloop.removefd(self._server_socket_fd) + self._server_socket.close() + for handler in list(self._fd_to_handlers.values()): + handler.destroy() diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/udprelay.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/udprelay.py new file mode 100644 index 00000000000000..b9606cd818ec91 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/udprelay.py @@ -0,0 +1,656 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright 2015 clowwindy +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +# SOCKS5 UDP Request +# +----+------+------+----------+----------+----------+ +# |RSV | FRAG | ATYP | DST.ADDR | DST.PORT | DATA | +# +----+------+------+----------+----------+----------+ +# | 2 | 1 | 1 | Variable | 2 | Variable | +# +----+------+------+----------+----------+----------+ + +# SOCKS5 UDP Response +# +----+------+------+----------+----------+----------+ +# |RSV | FRAG | ATYP | DST.ADDR | DST.PORT | DATA | +# +----+------+------+----------+----------+----------+ +# | 2 | 1 | 1 | Variable | 2 | Variable | +# +----+------+------+----------+----------+----------+ + +# shadowsocks UDP Request (before encrypted) +# +------+----------+----------+----------+ +# | ATYP | DST.ADDR | DST.PORT | DATA | +# +------+----------+----------+----------+ +# | 1 | Variable | 2 | Variable | +# +------+----------+----------+----------+ + +# shadowsocks UDP Response (before encrypted) +# +------+----------+----------+----------+ +# | ATYP | DST.ADDR | DST.PORT | DATA | +# +------+----------+----------+----------+ +# | 1 | Variable | 2 | Variable | +# +------+----------+----------+----------+ + +# shadowsocks UDP Request and Response (after encrypted) +# +-------+--------------+ +# | IV | PAYLOAD | +# +-------+--------------+ +# | Fixed | Variable | +# +-------+--------------+ + +# HOW TO NAME THINGS +# ------------------ +# `dest` means destination server, which is from DST fields in the SOCKS5 +# request +# `local` means local server of shadowsocks +# `remote` means remote server of shadowsocks +# `client` means UDP clients that connects to other servers +# `server` means the UDP server that handles user requests + +from __future__ import absolute_import, division, print_function, \ + with_statement + +import time +import socket +import logging +import struct +import errno +import random +import binascii +import traceback +import threading + +from shadowsocks import encrypt, obfs, eventloop, lru_cache, common, shell +from shadowsocks.common import pre_parse_header, parse_header, pack_addr + +# for each handler, we have 2 stream directions: +# upstream: from client to server direction +# read local and write to remote +# downstream: from server to client direction +# read remote and write to local + +STREAM_UP = 0 +STREAM_DOWN = 1 + +# for each stream, it's waiting for reading, or writing, or both +WAIT_STATUS_INIT = 0 +WAIT_STATUS_READING = 1 +WAIT_STATUS_WRITING = 2 +WAIT_STATUS_READWRITING = WAIT_STATUS_READING | WAIT_STATUS_WRITING + +BUF_SIZE = 65536 +DOUBLE_SEND_BEG_IDS = 16 +POST_MTU_MIN = 500 +POST_MTU_MAX = 1400 +SENDING_WINDOW_SIZE = 8192 + +STAGE_INIT = 0 +STAGE_RSP_ID = 1 +STAGE_DNS = 2 +STAGE_CONNECTING = 3 +STAGE_STREAM = 4 +STAGE_DESTROYED = -1 + +CMD_CONNECT = 0 +CMD_RSP_CONNECT = 1 +CMD_CONNECT_REMOTE = 2 +CMD_RSP_CONNECT_REMOTE = 3 +CMD_POST = 4 +CMD_SYN_STATUS = 5 +CMD_POST_64 = 6 +CMD_SYN_STATUS_64 = 7 +CMD_DISCONNECT = 8 + +CMD_VER_STR = b"\x08" + +RSP_STATE_EMPTY = b"" +RSP_STATE_REJECT = b"\x00" +RSP_STATE_CONNECTED = b"\x01" +RSP_STATE_CONNECTEDREMOTE = b"\x02" +RSP_STATE_ERROR = b"\x03" +RSP_STATE_DISCONNECT = b"\x04" +RSP_STATE_REDIRECT = b"\x05" + +def client_key(source_addr, server_af): + # notice this is server af, not dest af + return '%s:%s:%d' % (source_addr[0], source_addr[1], server_af) + +class UDPRelay(object): + def __init__(self, config, dns_resolver, is_local, stat_callback=None, stat_counter=None): + self._config = config + if config.get('connect_verbose_info', 0) > 0: + common.connect_log = logging.info + if is_local: + self._listen_addr = config['local_address'] + self._listen_port = config['local_port'] + self._remote_addr = config['server'] + self._remote_port = config['server_port'] + else: + self._listen_addr = config['server'] + self._listen_port = config['server_port'] + self._remote_addr = None + self._remote_port = None + self._dns_resolver = dns_resolver + self._password = common.to_bytes(config['password']) + self._method = config['method'] + self._timeout = config['timeout'] + self._is_local = is_local + self._udp_cache_size = config['udp_cache'] + self._cache = lru_cache.LRUCache(timeout=config['udp_timeout'], + close_callback=self._close_client_pair) + self._cache_dns_client = lru_cache.LRUCache(timeout=10, + close_callback=self._close_client_pair) + self._client_fd_to_server_addr = {} + #self._dns_cache = lru_cache.LRUCache(timeout=1800) + self._eventloop = None + self._closed = False + self.server_transfer_ul = 0 + self.server_transfer_dl = 0 + self.server_users = {} + self.server_user_transfer_ul = {} + self.server_user_transfer_dl = {} + + if common.to_bytes(config['protocol']) in obfs.mu_protocol(): + self._update_users(None, None) + + self.protocol_data = obfs.obfs(config['protocol']).init_data() + self._protocol = obfs.obfs(config['protocol']) + server_info = obfs.server_info(self.protocol_data) + server_info.host = self._listen_addr + server_info.port = self._listen_port + server_info.users = self.server_users + server_info.protocol_param = config['protocol_param'] + server_info.obfs_param = '' + server_info.iv = b'' + server_info.recv_iv = b'' + server_info.key_str = common.to_bytes(config['password']) + server_info.key = encrypt.encrypt_key(self._password, self._method) + server_info.head_len = 30 + server_info.tcp_mss = 1452 + server_info.buffer_size = BUF_SIZE + server_info.overhead = 0 + self._protocol.set_server_info(server_info) + + self._sockets = set() + self._fd_to_handlers = {} + self._reqid_to_hd = {} + self._data_to_write_to_server_socket = [] + + self._timeout_cache = lru_cache.LRUCache(timeout=self._timeout, + close_callback=self._close_tcp_client) + + self._bind = config.get('out_bind', '') + self._bindv6 = config.get('out_bindv6', '') + self._ignore_bind_list = config.get('ignore_bind', []) + + if 'forbidden_ip' in config: + self._forbidden_iplist = config['forbidden_ip'] + else: + self._forbidden_iplist = None + if 'forbidden_port' in config: + self._forbidden_portset = config['forbidden_port'] + else: + self._forbidden_portset = None + + addrs = socket.getaddrinfo(self._listen_addr, self._listen_port, 0, + socket.SOCK_DGRAM, socket.SOL_UDP) + if len(addrs) == 0: + raise Exception("can't get addrinfo for %s:%d" % + (self._listen_addr, self._listen_port)) + af, socktype, proto, canonname, sa = addrs[0] + server_socket = socket.socket(af, socktype, proto) + server_socket.bind((self._listen_addr, self._listen_port)) + server_socket.setblocking(False) + self._server_socket = server_socket + self._stat_callback = stat_callback + + def _get_a_server(self): + server = self._config['server'] + server_port = self._config['server_port'] + if type(server_port) == list: + server_port = random.choice(server_port) + if type(server) == list: + server = random.choice(server) + logging.debug('chosen server: %s:%d', server, server_port) + return server, server_port + + def get_ud(self): + return (self.server_transfer_ul, self.server_transfer_dl) + + def get_users_ud(self): + ret = (self.server_user_transfer_ul.copy(), self.server_user_transfer_dl.copy()) + return ret + + def _update_users(self, protocol_param, acl): + if protocol_param is None: + protocol_param = self._config['protocol_param'] + param = common.to_bytes(protocol_param).split(b'#') + if len(param) == 2: + user_list = param[1].split(b',') + if user_list: + for user in user_list: + items = user.split(b':') + if len(items) == 2: + user_int_id = int(items[0]) + uid = struct.pack(' header_length + 13 and data[header_length + 4 : header_length + 12] == b"\x00\x01\x00\x00\x00\x00\x00\x00": + is_dns = True + else: + pass + if sa[1] == 53 and is_dns: #DNS + logging.debug("DNS query %s from %s:%d" % (common.to_str(sa[0]), r_addr[0], r_addr[1])) + self._cache_dns_client[key] = (client, uid) + else: + self._cache[key] = (client, uid) + self._client_fd_to_server_addr[client.fileno()] = (r_addr, af) + + self._sockets.add(client.fileno()) + self._eventloop.add(client, eventloop.POLL_IN, self) + + logging.debug('UDP port %5d sockets %d' % (self._listen_port, len(self._sockets))) + + if uid is not None: + user_id = struct.unpack(' 255: + # drop + return + data = pack_addr(r_addr[0]) + struct.pack('>H', r_addr[1]) + data + ref_iv = [encrypt.encrypt_new_iv(self._method)] + self._protocol.obfs.server_info.iv = ref_iv[0] + data = self._protocol.server_udp_pre_encrypt(data, client_uid) + response = encrypt.encrypt_all_iv(self._protocol.obfs.server_info.key, self._method, 1, + data, ref_iv) + if not response: + return + else: + ref_iv = [0] + data = encrypt.encrypt_all_iv(self._protocol.obfs.server_info.key, self._method, 0, + data, ref_iv) + if not data: + return + self._protocol.obfs.server_info.recv_iv = ref_iv[0] + data = self._protocol.client_udp_post_decrypt(data) + header_result = parse_header(data) + if header_result is None: + return + #connecttype, dest_addr, dest_port, header_length = header_result + #logging.debug('UDP handle_client %s:%d to %s:%d' % (common.to_str(r_addr[0]), r_addr[1], dest_addr, dest_port)) + + response = b'\x00\x00\x00' + data + + if client_addr: + if client_uid: + self.add_transfer_d(client_uid, len(response)) + else: + self.server_transfer_dl += len(response) + self.write_to_server_socket(response, client_addr[0]) + if client_dns_pair: + logging.debug("remove dns client %s:%d" % (client_addr[0][0], client_addr[0][1])) + del self._cache_dns_client[key] + self._close_client(client_dns_pair[0]) + else: + # this packet is from somewhere else we know + # simply drop that packet + pass + + def write_to_server_socket(self, data, addr): + uncomplete = False + retry = 0 + try: + self._server_socket.sendto(data, addr) + data = None + while self._data_to_write_to_server_socket: + data_buf = self._data_to_write_to_server_socket[0] + retry = data_buf[1] + 1 + del self._data_to_write_to_server_socket[0] + data, addr = data_buf[0] + self._server_socket.sendto(data, addr) + except (OSError, IOError) as e: + error_no = eventloop.errno_from_exception(e) + uncomplete = True + if error_no in (errno.EWOULDBLOCK,): + pass + else: + shell.print_exception(e) + return False + #if uncomplete and data is not None and retry < 3: + # self._data_to_write_to_server_socket.append([(data, addr), retry]) + #''' + + def add_to_loop(self, loop): + if self._eventloop: + raise Exception('already add to loop') + if self._closed: + raise Exception('already closed') + self._eventloop = loop + + server_socket = self._server_socket + self._eventloop.add(server_socket, + eventloop.POLL_IN | eventloop.POLL_ERR, self) + loop.add_periodic(self.handle_periodic) + + def remove_handler(self, client): + if hash(client) in self._timeout_cache: + del self._timeout_cache[hash(client)] + + def update_activity(self, client): + self._timeout_cache[hash(client)] = client + + def _sweep_timeout(self): + self._timeout_cache.sweep() + + def _close_tcp_client(self, client): + if client.remote_address: + logging.debug('timed out: %s:%d' % + client.remote_address) + else: + logging.debug('timed out') + client.destroy() + client.destroy_local() + + def handle_event(self, sock, fd, event): + if sock == self._server_socket: + if event & eventloop.POLL_ERR: + logging.error('UDP server_socket err') + try: + self._handle_server() + except Exception as e: + shell.print_exception(e) + if self._config['verbose']: + traceback.print_exc() + elif sock and (fd in self._sockets): + if event & eventloop.POLL_ERR: + logging.error('UDP client_socket err') + try: + self._handle_client(sock) + except Exception as e: + shell.print_exception(e) + if self._config['verbose']: + traceback.print_exc() + else: + if sock: + handler = self._fd_to_handlers.get(fd, None) + if handler: + handler.handle_event(sock, event) + else: + logging.warn('poll removed fd') + + def handle_periodic(self): + if self._closed: + self._cache.clear(0) + self._cache_dns_client.clear(0) + if self._eventloop: + self._eventloop.remove_periodic(self.handle_periodic) + self._eventloop.remove(self._server_socket) + if self._server_socket: + self._server_socket.close() + self._server_socket = None + logging.info('closed UDP port %d', self._listen_port) + else: + before_sweep_size = len(self._sockets) + self._cache.sweep() + self._cache_dns_client.sweep() + if before_sweep_size != len(self._sockets): + logging.debug('UDP port %5d sockets %d' % (self._listen_port, len(self._sockets))) + self._sweep_timeout() + + def close(self, next_tick=False): + logging.debug('UDP close') + self._closed = True + if not next_tick: + if self._eventloop: + self._eventloop.remove_periodic(self.handle_periodic) + self._eventloop.remove(self._server_socket) + self._server_socket.close() + self._cache.clear(0) + self._cache_dns_client.clear(0) diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/version.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/version.py new file mode 100644 index 00000000000000..f3e1ef796d94db --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/shadowsocks/version.py @@ -0,0 +1,20 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright 2017 breakwa11 +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +def version(): + return '3.4.0 2017-07-27' + diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/stop.sh b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/stop.sh new file mode 100644 index 00000000000000..56567daa0c2870 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/stop.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +python_ver=$(ls /usr/bin|grep -e "^python[23]\.[1-9]\+$"|tail -1) +eval $(ps -ef | grep "[0-9] ${python_ver} server\\.py m" | awk '{print "kill "$2}') + diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/switchrule.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/switchrule.py new file mode 100644 index 00000000000000..6687e12cfb246d --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/switchrule.py @@ -0,0 +1,8 @@ +def getKeys(key_list): + return key_list + #return key_list + ['plan'] # append the column name 'plan' + +def isTurnOn(row): + return True + #return row['plan'] == 'B' # then judge here + diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tail.sh b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tail.sh new file mode 100644 index 00000000000000..f36f605eeda2ab --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tail.sh @@ -0,0 +1,3 @@ +#!/bin/bash +cd `dirname $0` +tail -f ssserver.log diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/aes-cfb1.json b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/aes-cfb1.json new file mode 100644 index 00000000000000..40d0b2107e5747 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/aes-cfb1.json @@ -0,0 +1,10 @@ +{ + "server":"127.0.0.1", + "server_port":8388, + "local_port":1081, + "password":"aes_password", + "timeout":60, + "method":"aes-256-cfb1", + "local_address":"127.0.0.1", + "fast_open":false +} diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/aes-cfb8.json b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/aes-cfb8.json new file mode 100644 index 00000000000000..fb7014b1ee45d9 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/aes-cfb8.json @@ -0,0 +1,10 @@ +{ + "server":"127.0.0.1", + "server_port":8388, + "local_port":1081, + "password":"aes_password", + "timeout":60, + "method":"aes-256-cfb8", + "local_address":"127.0.0.1", + "fast_open":false +} diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/aes-ctr.json b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/aes-ctr.json new file mode 100644 index 00000000000000..1fed8a8c77fdf6 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/aes-ctr.json @@ -0,0 +1,10 @@ +{ + "server":"127.0.0.1", + "server_port":8388, + "local_port":1081, + "password":"aes_password", + "timeout":60, + "method":"aes-256-ctr", + "local_address":"127.0.0.1", + "fast_open":false +} diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/aes.json b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/aes.json new file mode 100644 index 00000000000000..a3d95b9b5f88ea --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/aes.json @@ -0,0 +1,10 @@ +{ + "server":"127.0.0.1", + "server_port":8388, + "local_port":1081, + "password":"aes_password", + "timeout":60, + "method":"aes-256-cfb", + "local_address":"127.0.0.1", + "fast_open":false +} diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/assert.sh b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/assert.sh new file mode 100644 index 00000000000000..b0c679cbcdf54e --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/assert.sh @@ -0,0 +1,148 @@ +#!/bin/bash +# assert.sh 1.0 - bash unit testing framework +# Copyright (C) 2009, 2010, 2011, 2012 Robert Lehmann +# +# http://github.com/lehmannro/assert.sh +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . + +export DISCOVERONLY=${DISCOVERONLY:-} +export DEBUG=${DEBUG:-} +export STOP=${STOP:-} +export INVARIANT=${INVARIANT:-} +export CONTINUE=${CONTINUE:-} + +args="$(getopt -n "$0" -l \ + verbose,help,stop,discover,invariant,continue vhxdic $*)" \ +|| exit -1 +for arg in $args; do + case "$arg" in + -h) + echo "$0 [-vxidc]" \ + "[--verbose] [--stop] [--invariant] [--discover] [--continue]" + echo "`sed 's/./ /g' <<< "$0"` [-h] [--help]" + exit 0;; + --help) + cat < [stdin] + (( tests_ran++ )) || : + [[ -n "$DISCOVERONLY" ]] && return || true + # printf required for formatting + printf -v expected "x${2:-}" # x required to overwrite older results + result="$(eval 2>/dev/null $1 <<< ${3:-})" || true + # Note: $expected is already decorated + if [[ "x$result" == "$expected" ]]; then + [[ -n "$DEBUG" ]] && echo -n . || true + return + fi + result="$(sed -e :a -e '$!N;s/\n/\\n/;ta' <<< "$result")" + [[ -z "$result" ]] && result="nothing" || result="\"$result\"" + [[ -z "$2" ]] && expected="nothing" || expected="\"$2\"" + _assert_fail "expected $expected${_indent}got $result" "$1" "$3" +} + +assert_raises() { + # assert_raises [stdin] + (( tests_ran++ )) || : + [[ -n "$DISCOVERONLY" ]] && return || true + status=0 + (eval $1 <<< ${3:-}) > /dev/null 2>&1 || status=$? + expected=${2:-0} + if [[ "$status" -eq "$expected" ]]; then + [[ -n "$DEBUG" ]] && echo -n . || true + return + fi + _assert_fail "program terminated with code $status instead of $expected" "$1" "$3" +} + +_assert_fail() { + # _assert_fail + [[ -n "$DEBUG" ]] && echo -n X + report="test #$tests_ran \"$2${3:+ <<< $3}\" failed:${_indent}$1" + if [[ -n "$STOP" ]]; then + [[ -n "$DEBUG" ]] && echo + echo "$report" + exit 1 + fi + tests_errors[$tests_failed]="$report" + (( tests_failed++ )) || : +} + +_assert_reset +: ${tests_suite_status:=0} # remember if any of the tests failed so far +_assert_cleanup() { + local status=$? + # modify exit code if it's not already non-zero + [[ $status -eq 0 && -z $CONTINUE ]] && exit $tests_suite_status +} +trap _assert_cleanup EXIT diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/chacha20.json b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/chacha20.json new file mode 100644 index 00000000000000..541a9beb511099 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/chacha20.json @@ -0,0 +1,10 @@ +{ + "server":"127.0.0.1", + "server_port":8388, + "local_port":1081, + "password":"salsa20_password", + "timeout":60, + "method":"chacha20", + "local_address":"127.0.0.1", + "fast_open":false +} diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/client-multi-server-ip.json b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/client-multi-server-ip.json new file mode 100644 index 00000000000000..1823c2a7581c1a --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/client-multi-server-ip.json @@ -0,0 +1,10 @@ +{ + "server":["127.0.0.1", "127.0.0.1"], + "server_port":8388, + "local_port":1081, + "password":"aes_password", + "timeout":60, + "method":"aes-256-cfb", + "local_address":"127.0.0.1", + "fast_open":false +} diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/coverage_server.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/coverage_server.py new file mode 100644 index 00000000000000..23cc8cd71d38ae --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/coverage_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# +# Copyright 2015 clowwindy +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +if __name__ == '__main__': + import tornado.ioloop + import tornado.web + import urllib + + class MainHandler(tornado.web.RequestHandler): + def get(self, project): + try: + with open('/tmp/%s-coverage' % project, 'rb') as f: + coverage = f.read().strip() + n = int(coverage.strip('%')) + if n >= 80: + color = 'brightgreen' + else: + color = 'yellow' + self.redirect(('https://img.shields.io/badge/' + 'coverage-%s-%s.svg' + '?style=flat') % + (urllib.quote(coverage), color)) + except IOError: + raise tornado.web.HTTPError(404) + + application = tornado.web.Application([ + (r"/([a-zA-Z0-9\-_]+)", MainHandler), + ]) + + if __name__ == "__main__": + application.listen(8888, address='127.0.0.1') + tornado.ioloop.IOLoop.instance().start() diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/fastopen.json b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/fastopen.json new file mode 100644 index 00000000000000..f3980b65e5a1e0 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/fastopen.json @@ -0,0 +1,10 @@ +{ + "server":"127.0.0.1", + "server_port":8388, + "local_port":1081, + "password":"fastopen_password", + "timeout":60, + "method":"aes-256-cfb", + "local_address":"127.0.0.1", + "fast_open":true +} diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/ipv6-client-side.json b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/ipv6-client-side.json new file mode 100644 index 00000000000000..6c3cfaf8d53080 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/ipv6-client-side.json @@ -0,0 +1,10 @@ +{ + "server":"::1", + "server_port":8388, + "local_port":1081, + "password":"aes_password", + "timeout":60, + "method":"aes-256-cfb", + "local_address":"127.0.0.1", + "fast_open":false +} diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/ipv6.json b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/ipv6.json new file mode 100644 index 00000000000000..d855f9c47b918e --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/ipv6.json @@ -0,0 +1,10 @@ +{ + "server":"::", + "server_port":8388, + "local_port":1081, + "password":"aes_password", + "timeout":60, + "method":"aes-256-cfb", + "local_address":"127.0.0.1", + "fast_open":false +} diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/jenkins.sh b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/jenkins.sh new file mode 100644 index 00000000000000..ea5c1630b892ab --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/jenkins.sh @@ -0,0 +1,82 @@ +#!/bin/bash + +result=0 + +function run_test { + printf '\e[0;36m' + echo "running test: $command $@" + printf '\e[0m' + + $command "$@" + status=$? + if [ $status -ne 0 ]; then + printf '\e[0;31m' + echo "test failed: $command $@" + printf '\e[0m' + echo + result=1 + else + printf '\e[0;32m' + echo OK + printf '\e[0m' + echo + fi + return 0 +} + +python --version +coverage erase +mkdir tmp +run_test pep8 --ignore=E402 . +run_test pyflakes . +run_test coverage run tests/nose_plugin.py -v +run_test python setup.py sdist +run_test tests/test_daemon.sh +run_test python tests/test.py --with-coverage -c tests/aes.json +run_test python tests/test.py --with-coverage -c tests/aes-ctr.json +run_test python tests/test.py --with-coverage -c tests/aes-cfb1.json +run_test python tests/test.py --with-coverage -c tests/aes-cfb8.json +run_test python tests/test.py --with-coverage -c tests/rc4-md5.json +run_test python tests/test.py --with-coverage -c tests/salsa20.json +run_test python tests/test.py --with-coverage -c tests/chacha20.json +run_test python tests/test.py --with-coverage -c tests/table.json +run_test python tests/test.py --with-coverage -c tests/server-multi-ports.json +run_test python tests/test.py --with-coverage -s tests/aes.json -c tests/client-multi-server-ip.json +run_test python tests/test.py --with-coverage -s tests/server-multi-passwd.json -c tests/server-multi-passwd-client-side.json +run_test python tests/test.py --with-coverage -c tests/workers.json +run_test python tests/test.py --with-coverage -s tests/ipv6.json -c tests/ipv6-client-side.json +run_test python tests/test.py --with-coverage -b "-m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -q" -a "-m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -l 1081 -vv" +run_test python tests/test.py --with-coverage -b "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 --workers 1" -a "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 -l 1081 -t 30 -qq -b 127.0.0.1" +run_test python tests/test.py --with-coverage --should-fail --url="http://127.0.0.1/" -b "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 --forbidden-ip=127.0.0.1,::1,8.8.8.8" -a "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 -l 1081 -t 30 -b 127.0.0.1" + +# test if DNS works +run_test python tests/test.py --with-coverage -c tests/aes.json --url="https://clients1.google.com/generate_204" + +# test localhost is in the forbidden list by default +run_test python tests/test.py --with-coverage --should-fail --tcp-only --url="http://127.0.0.1/" -b "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388" -a "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 -l 1081 -t 30 -b 127.0.0.1" + +# test localhost is available when forbidden list is empty +run_test python tests/test.py --with-coverage --tcp-only --url="http://127.0.0.1/" -b "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 --forbidden-ip=" -a "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 -l 1081 -t 30 -b 127.0.0.1" + +if [ -f /proc/sys/net/ipv4/tcp_fastopen ] ; then + if [ 3 -eq `cat /proc/sys/net/ipv4/tcp_fastopen` ] ; then + # we have to run it twice: + # the first time there's no syn cookie + # the second time there is syn cookie + run_test python tests/test.py --with-coverage -c tests/fastopen.json + run_test python tests/test.py --with-coverage -c tests/fastopen.json + fi +fi + +run_test tests/test_large_file.sh +run_test tests/test_udp_src.sh +run_test tests/test_command.sh + +coverage combine && coverage report --include=shadowsocks/* +rm -rf htmlcov +rm -rf tmp +coverage html --include=shadowsocks/* + +coverage report --include=shadowsocks/* | tail -n1 | rev | cut -d' ' -f 1 | rev > /tmp/shadowsocks-coverage + +exit $result diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/libsodium/install.sh b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/libsodium/install.sh new file mode 100644 index 00000000000000..b0e35fa1319910 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/libsodium/install.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +if [ ! -d libsodium-1.0.1 ]; then + wget https://github.com/jedisct1/libsodium/releases/download/1.0.1/libsodium-1.0.1.tar.gz || exit 1 + tar xf libsodium-1.0.1.tar.gz || exit 1 +fi +pushd libsodium-1.0.1 +./configure && make -j2 && make install || exit 1 +sudo ldconfig +popd diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/nose_plugin.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/nose_plugin.py new file mode 100644 index 00000000000000..86b1a865374202 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/nose_plugin.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python +# +# Copyright 2015 clowwindy +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import nose +from nose.plugins.base import Plugin + + +class ExtensionPlugin(Plugin): + + name = "ExtensionPlugin" + + def options(self, parser, env): + Plugin.options(self, parser, env) + + def configure(self, options, config): + Plugin.configure(self, options, config) + self.enabled = True + + def wantFile(self, file): + return file.endswith('.py') + + def wantDirectory(self, directory): + return True + + def wantModule(self, file): + return True + + +if __name__ == '__main__': + nose.main(addplugins=[ExtensionPlugin()]) diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/rc4-md5.json b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/rc4-md5.json new file mode 100644 index 00000000000000..26ba0dfa7668ed --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/rc4-md5.json @@ -0,0 +1,10 @@ +{ + "server":"127.0.0.1", + "server_port":8388, + "local_port":1081, + "password":"aes_password", + "timeout":60, + "method":"rc4-md5", + "local_address":"127.0.0.1", + "fast_open":false +} diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/salsa20-ctr.json b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/salsa20-ctr.json new file mode 100644 index 00000000000000..5ca6c45f5281ed --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/salsa20-ctr.json @@ -0,0 +1,10 @@ +{ + "server":"127.0.0.1", + "server_port":8388, + "local_port":1081, + "password":"salsa20_password", + "timeout":60, + "method":"salsa20-ctr", + "local_address":"127.0.0.1", + "fast_open":false +} diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/salsa20.json b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/salsa20.json new file mode 100644 index 00000000000000..7e303800d859ee --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/salsa20.json @@ -0,0 +1,10 @@ +{ + "server":"127.0.0.1", + "server_port":8388, + "local_port":1081, + "password":"salsa20_password", + "timeout":60, + "method":"salsa20", + "local_address":"127.0.0.1", + "fast_open":false +} diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/server-multi-passwd-client-side.json b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/server-multi-passwd-client-side.json new file mode 100644 index 00000000000000..c822c98b9df3ff --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/server-multi-passwd-client-side.json @@ -0,0 +1,8 @@ +{ + "server": "127.0.0.1", + "server_port": "8385", + "local_port": 1081, + "password": "foobar5", + "timeout": 60, + "method": "aes-256-cfb" +} diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/server-multi-passwd-table.json b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/server-multi-passwd-table.json new file mode 100644 index 00000000000000..a2c0a808968ea4 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/server-multi-passwd-table.json @@ -0,0 +1,19 @@ +{ + "server": "127.0.0.1", + "server_port": 8384, + "local_port": 1081, + "password": "foobar4", + "port_password": { + "8381": "foobar1", + "8382": "foobar2", + "8383": "foobar3", + "8384": "foobar4", + "8385": "foobar5", + "8386": "foobar6", + "8387": "foobar7", + "8388": "foobar8", + "8389": "foobar9" + }, + "timeout": 60, + "method": "table" +} diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/server-multi-passwd.json b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/server-multi-passwd.json new file mode 100644 index 00000000000000..b1407f0a1704e9 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/server-multi-passwd.json @@ -0,0 +1,17 @@ +{ + "server": "127.0.0.1", + "local_port": 1081, + "port_password": { + "8381": "foobar1", + "8382": "foobar2", + "8383": "foobar3", + "8384": "foobar4", + "8385": "foobar5", + "8386": "foobar6", + "8387": "foobar7", + "8388": "foobar8", + "8389": "foobar9" + }, + "timeout": 60, + "method": "aes-256-cfb" +} diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/server-multi-ports.json b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/server-multi-ports.json new file mode 100644 index 00000000000000..5bdbcab6415cd9 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/server-multi-ports.json @@ -0,0 +1,8 @@ +{ + "server": "127.0.0.1", + "server_port": [8384, 8345, 8346, 8347], + "local_port": 1081, + "password": "foobar4", + "timeout": 60, + "method": "aes-256-cfb" +} diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/setup_tc.sh b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/setup_tc.sh new file mode 100644 index 00000000000000..1a5fa208bf72de --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/setup_tc.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +DEV=lo +PORT=8388 +DELAY=100ms + +type tc 2> /dev/null && ( + tc qdisc add dev $DEV root handle 1: htb + tc class add dev $DEV parent 1: classid 1:1 htb rate 2mbps + tc class add dev $DEV parent 1:1 classid 1:6 htb rate 2mbps ceil 1mbps prio 0 + tc filter add dev $DEV parent 1:0 prio 0 protocol ip handle 6 fw flowid 1:6 + + tc filter add dev $DEV parent 1:0 protocol ip u32 match ip dport $PORT 0xffff flowid 1:6 + tc filter add dev $DEV parent 1:0 protocol ip u32 match ip sport $PORT 0xffff flowid 1:6 + + tc qdisc show dev lo +) + diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/socksify/install.sh b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/socksify/install.sh new file mode 100644 index 00000000000000..8eff72df08c253 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/socksify/install.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +if [ ! -d dante-1.4.0 ]; then + wget http://www.inet.no/dante/files/dante-1.4.0.tar.gz || exit 1 + tar xf dante-1.4.0.tar.gz || exit 1 +fi +pushd dante-1.4.0 +./configure && make -j4 && make install || exit 1 +popd +cp tests/socksify/socks.conf /etc/ || exit 1 diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/socksify/socks.conf b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/socksify/socks.conf new file mode 100644 index 00000000000000..13db772fd183cb --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/socksify/socks.conf @@ -0,0 +1,5 @@ +route { + from: 0.0.0.0/0 to: 0.0.0.0/0 via: 127.0.0.1 port = 1081 + proxyprotocol: socks_v5 + method: none +} \ No newline at end of file diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/table.json b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/table.json new file mode 100644 index 00000000000000..cca6ac27e4db30 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/table.json @@ -0,0 +1,10 @@ +{ + "server":"127.0.0.1", + "server_port":8388, + "local_port":1081, + "password":"table_password", + "timeout":60, + "method":"table", + "local_address":"127.0.0.1", + "fast_open":false +} diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/test.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/test.py new file mode 100644 index 00000000000000..408340134e6c70 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/test.py @@ -0,0 +1,158 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# Copyright 2015 clowwindy +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from __future__ import absolute_import, division, print_function, \ + with_statement + +import sys +import os +import signal +import select +import time +import argparse +from subprocess import Popen, PIPE + +python = ['python'] + +default_url = 'http://localhost/' + +parser = argparse.ArgumentParser(description='test Shadowsocks') +parser.add_argument('-c', '--client-conf', type=str, default=None) +parser.add_argument('-s', '--server-conf', type=str, default=None) +parser.add_argument('-a', '--client-args', type=str, default=None) +parser.add_argument('-b', '--server-args', type=str, default=None) +parser.add_argument('--with-coverage', action='store_true', default=None) +parser.add_argument('--should-fail', action='store_true', default=None) +parser.add_argument('--tcp-only', action='store_true', default=None) +parser.add_argument('--url', type=str, default=default_url) +parser.add_argument('--dns', type=str, default='8.8.8.8') + +config = parser.parse_args() + +if config.with_coverage: + python = ['coverage', 'run', '-p'] + +client_args = python + ['shadowsocks/local.py', '-v'] +server_args = python + ['shadowsocks/server.py', '-v'] + +if config.client_conf: + client_args.extend(['-c', config.client_conf]) + if config.server_conf: + server_args.extend(['-c', config.server_conf]) + else: + server_args.extend(['-c', config.client_conf]) +if config.client_args: + client_args.extend(config.client_args.split()) + if config.server_args: + server_args.extend(config.server_args.split()) + else: + server_args.extend(config.client_args.split()) +if config.url == default_url: + server_args.extend(['--forbidden-ip', '']) + +p1 = Popen(server_args, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) +p2 = Popen(client_args, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) +p3 = None +p4 = None +p3_fin = False +p4_fin = False + +# 1 shadowsocks started +# 2 curl started +# 3 curl finished +# 4 dig started +# 5 dig finished +stage = 1 + +try: + local_ready = False + server_ready = False + fdset = [p1.stdout, p2.stdout, p1.stderr, p2.stderr] + while True: + r, w, e = select.select(fdset, [], fdset) + if e: + break + + for fd in r: + line = fd.readline() + if not line: + if stage == 2 and fd == p3.stdout: + stage = 3 + if stage == 4 and fd == p4.stdout: + stage = 5 + if bytes != str: + line = str(line, 'utf8') + sys.stderr.write(line) + if line.find('starting local') >= 0: + local_ready = True + if line.find('starting server') >= 0: + server_ready = True + + if stage == 1: + time.sleep(2) + + p3 = Popen(['curl', config.url, '-v', '-L', + '--socks5-hostname', '127.0.0.1:1081', + '-m', '15', '--connect-timeout', '10'], + stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) + if p3 is not None: + fdset.append(p3.stdout) + fdset.append(p3.stderr) + stage = 2 + else: + sys.exit(1) + + if stage == 3 and p3 is not None: + fdset.remove(p3.stdout) + fdset.remove(p3.stderr) + r = p3.wait() + if config.should_fail: + if r == 0: + sys.exit(1) + else: + if r != 0: + sys.exit(1) + if config.tcp_only: + break + p4 = Popen(['socksify', 'dig', '@%s' % config.dns, + 'www.google.com'], + stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) + if p4 is not None: + fdset.append(p4.stdout) + fdset.append(p4.stderr) + stage = 4 + else: + sys.exit(1) + + if stage == 5: + r = p4.wait() + if config.should_fail: + if r == 0: + sys.exit(1) + print('test passed (expecting failure)') + else: + if r != 0: + sys.exit(1) + print('test passed') + break +finally: + for p in [p1, p2]: + try: + os.kill(p.pid, signal.SIGINT) + os.waitpid(p.pid, 0) + except OSError: + pass diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/test_command.sh b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/test_command.sh new file mode 100644 index 00000000000000..a1a777b0d9134d --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/test_command.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +. tests/assert.sh + +PYTHON="coverage run -p" +LOCAL="$PYTHON shadowsocks/local.py" +SERVER="$PYTHON shadowsocks/server.py" + +assert "$LOCAL --version 2>&1 | grep Shadowsocks | awk -F\" \" '{print \$1}'" "Shadowsocks" +assert "$SERVER --version 2>&1 | grep Shadowsocks | awk -F\" \" '{print \$1}'" "Shadowsocks" + + +assert "$LOCAL 2>&1 -m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -d start | grep WARNING | awk -F\"WARNING\" '{print \$2}'" " warning: server set to listen on 127.0.0.1:8388, are you sure?" +$LOCAL 2>/dev/null 1>/dev/null -m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -d stop + +assert "$LOCAL 2>&1 -m rc4-md5 -k testrc4 -s 0.0.0.0 -p 8388 -t10 -d start | grep WARNING | awk -F\"WARNING\" '{print \$2}'" " warning: your timeout 10 seems too short" +$LOCAL 2>/dev/null 1>/dev/null -m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -d stop + +assert "$LOCAL 2>&1 -m rc4-md5 -k testrc4 -s 0.0.0.0 -p 8388 -t1000 -d start | grep WARNING | awk -F\"WARNING\" '{print \$2}'" " warning: your timeout 1000 seems too long" +$LOCAL 2>/dev/null 1>/dev/null -m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -d stop + +assert "$LOCAL 2>&1 -m rc4 -k testrc4 -s 0.0.0.0 -p 8388 -d start | grep WARNING | awk -F\"WARNING\" '{print \$2}'" " warning: RC4 is not safe; please use a safer cipher, like AES-256-CFB" +$LOCAL 2>/dev/null 1>/dev/null -m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -d stop + +assert "$LOCAL 2>&1 -m rc4-md5 -k mypassword -s 0.0.0.0 -p 8388 -d start | grep ERROR | awk -F\"ERROR\" '{print \$2}'" " DON'T USE DEFAULT PASSWORD! Please change it in your config.json!" +$LOCAL 2>/dev/null 1>/dev/null -m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -d stop + + +assert "$SERVER 2>&1 --forbidden-ip 127.0.0.1/4a -m rc4-md5 -k 12345 -p 8388 -s 0.0.0.0 -d start | grep ERROR | awk -F\"ERROR\" '{print \$2}'" ": Not a valid CIDR notation: 127.0.0.1/4a" +$LOCAL 2>/dev/null 1>/dev/null -m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -d stop + +assert_end command diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/test_daemon.sh b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/test_daemon.sh new file mode 100644 index 00000000000000..7a192bdb111db0 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/test_daemon.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +function run_test { + expected=$1 + shift + echo "running test: $command $@" + $command $@ + status=$? + if [ $status -ne $expected ]; then + echo "exit $status != $expected" + exit 1 + fi + echo "exit status $status == $expected" + echo OK + return +} + +for module in local server +do + +command="coverage run -p shadowsocks/$module.py" + +mkdir -p tmp + +run_test 0 -c tests/aes.json -d stop --pid-file tmp/shadowsocks.pid --log-file tmp/shadowsocks.log + +run_test 0 -c tests/aes.json -d start --pid-file tmp/shadowsocks.pid --log-file tmp/shadowsocks.log +run_test 0 -c tests/aes.json -d stop --pid-file tmp/shadowsocks.pid --log-file tmp/shadowsocks.log + +run_test 0 -c tests/aes.json -d start --pid-file tmp/shadowsocks.pid --log-file tmp/shadowsocks.log +run_test 1 -c tests/aes.json -d start --pid-file tmp/shadowsocks.pid --log-file tmp/shadowsocks.log +run_test 0 -c tests/aes.json -d stop --pid-file tmp/shadowsocks.pid --log-file tmp/shadowsocks.log + +run_test 0 -c tests/aes.json -d start --pid-file tmp/shadowsocks.pid --log-file tmp/shadowsocks.log +run_test 0 -c tests/aes.json -d restart --pid-file tmp/shadowsocks.pid --log-file tmp/shadowsocks.log +run_test 0 -c tests/aes.json -d stop --pid-file tmp/shadowsocks.pid --log-file tmp/shadowsocks.log + +run_test 0 -c tests/aes.json -d restart --pid-file tmp/shadowsocks.pid --log-file tmp/shadowsocks.log +run_test 0 -c tests/aes.json -d stop --pid-file tmp/shadowsocks.pid --log-file tmp/shadowsocks.log + +run_test 1 -c tests/aes.json -d start --pid-file tmp/not_exist/shadowsocks.pid --log-file tmp/shadowsocks.log + +done diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/test_large_file.sh b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/test_large_file.sh new file mode 100644 index 00000000000000..7a61caff142b83 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/test_large_file.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +PYTHON="coverage run -p" +URL=http://127.0.0.1/file + +mkdir -p tmp + +$PYTHON shadowsocks/local.py -c tests/aes.json & +LOCAL=$! + +$PYTHON shadowsocks/server.py -c tests/aes.json --forbidden-ip "" & +SERVER=$! + +sleep 3 + +time curl -o tmp/expected $URL +time curl -o tmp/result --socks5-hostname 127.0.0.1:1081 $URL + +kill -s SIGINT $LOCAL +kill -s SIGINT $SERVER + +sleep 2 + +diff tmp/expected tmp/result || exit 1 diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/test_udp_src.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/test_udp_src.py new file mode 100644 index 00000000000000..e8fa5057ebea0f --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/test_udp_src.py @@ -0,0 +1,83 @@ +#!/usr/bin/python + +import socket +import socks + + +SERVER_IP = '127.0.0.1' +SERVER_PORT = 1081 + + +if __name__ == '__main__': + # Test 1: same source port IPv4 + sock_out = socks.socksocket(socket.AF_INET, socket.SOCK_DGRAM, + socket.SOL_UDP) + sock_out.set_proxy(socks.SOCKS5, SERVER_IP, SERVER_PORT) + sock_out.bind(('127.0.0.1', 9000)) + + sock_in1 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, + socket.SOL_UDP) + sock_in2 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, + socket.SOL_UDP) + + sock_in1.bind(('127.0.0.1', 9001)) + sock_in2.bind(('127.0.0.1', 9002)) + + sock_out.sendto(b'data', ('127.0.0.1', 9001)) + result1 = sock_in1.recvfrom(8) + + sock_out.sendto(b'data', ('127.0.0.1', 9002)) + result2 = sock_in2.recvfrom(8) + + sock_out.close() + sock_in1.close() + sock_in2.close() + + # make sure they're from the same source port + assert result1 == result2 + + # Test 2: same source port IPv6 + # try again from the same port but IPv6 + sock_out = socks.socksocket(socket.AF_INET, socket.SOCK_DGRAM, + socket.SOL_UDP) + sock_out.set_proxy(socks.SOCKS5, SERVER_IP, SERVER_PORT) + sock_out.bind(('127.0.0.1', 9000)) + + sock_in1 = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM, + socket.SOL_UDP) + sock_in2 = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM, + socket.SOL_UDP) + + sock_in1.bind(('::1', 9001)) + sock_in2.bind(('::1', 9002)) + + sock_out.sendto(b'data', ('::1', 9001)) + result1 = sock_in1.recvfrom(8) + + sock_out.sendto(b'data', ('::1', 9002)) + result2 = sock_in2.recvfrom(8) + + sock_out.close() + sock_in1.close() + sock_in2.close() + + # make sure they're from the same source port + assert result1 == result2 + + # Test 3: different source ports IPv6 + sock_out = socks.socksocket(socket.AF_INET, socket.SOCK_DGRAM, + socket.SOL_UDP) + sock_out.set_proxy(socks.SOCKS5, SERVER_IP, SERVER_PORT) + sock_out.bind(('127.0.0.1', 9003)) + + sock_in1 = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM, + socket.SOL_UDP) + sock_in1.bind(('::1', 9001)) + sock_out.sendto(b'data', ('::1', 9001)) + result3 = sock_in1.recvfrom(8) + + # make sure they're from different source ports + assert result1 != result3 + + sock_out.close() + sock_in1.close() diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/test_udp_src.sh b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/test_udp_src.sh new file mode 100644 index 00000000000000..6a778abc10a9fe --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/test_udp_src.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +PYTHON="coverage run -p" + +mkdir -p tmp + +$PYTHON shadowsocks/local.py -c tests/aes.json -v & +LOCAL=$! + +$PYTHON shadowsocks/server.py -c tests/aes.json --forbidden-ip "" -v & +SERVER=$! + +sleep 3 + +python tests/test_udp_src.py +r=$? + +kill -s SIGINT $LOCAL +kill -s SIGINT $SERVER + +sleep 2 + +exit $r diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/workers.json b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/workers.json new file mode 100644 index 00000000000000..2015ff6c6a592d --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/tests/workers.json @@ -0,0 +1,10 @@ +{ + "server":"127.0.0.1", + "server_port":8388, + "local_port":1081, + "password":"workers_password", + "timeout":60, + "method":"aes-256-cfb", + "local_address":"127.0.0.1", + "workers": 4 +} diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/utils/README.md b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/utils/README.md new file mode 100644 index 00000000000000..f624309c728ae2 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/utils/README.md @@ -0,0 +1,9 @@ +Useful Tools +=========== + +autoban.py +---------- + +Automatically ban IPs that try to brute force crack the server. + +See https://github.com/shadowsocks/shadowsocks/wiki/Ban-Brute-Force-Crackers diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/utils/autoban.py b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/utils/autoban.py new file mode 100644 index 00000000000000..1bbb65c9b729ea --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/utils/autoban.py @@ -0,0 +1,53 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# Copyright (c) 2015 clowwindy +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +from __future__ import absolute_import, division, print_function, \ + with_statement + +import os +import sys +import argparse + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='See README') + parser.add_argument('-c', '--count', default=3, type=int, + help='with how many failure times it should be ' + 'considered as an attack') + config = parser.parse_args() + ips = {} + banned = set() + for line in sys.stdin: + if 'can not parse header when' in line: + ip = line.split()[-1].split(':')[0] + if ip not in ips: + ips[ip] = 1 + print(ip) + sys.stdout.flush() + else: + ips[ip] += 1 + if ip not in banned and ips[ip] >= config.count: + banned.add(ip) + cmd = 'iptables -A INPUT -s %s -j DROP' % ip + print(cmd, file=sys.stderr) + sys.stderr.flush() + os.system(cmd) diff --git a/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/utils/fail2ban/shadowsocks.conf b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/utils/fail2ban/shadowsocks.conf new file mode 100644 index 00000000000000..9b1c7ec7aaab06 --- /dev/null +++ b/package/lean/luci-app-ssrserver-python/root/usr/share/ssr/utils/fail2ban/shadowsocks.conf @@ -0,0 +1,5 @@ +[Definition] + +_daemon = shadowsocks + +failregex = ^\s+ERROR\s+can not parse header when handling connection from :\d+$ diff --git a/package/lean/luci-app-syncdial/Makefile b/package/lean/luci-app-syncdial/Makefile new file mode 100644 index 00000000000000..70da3386170d77 --- /dev/null +++ b/package/lean/luci-app-syncdial/Makefile @@ -0,0 +1,17 @@ +# +# Copyright (C) 2008-2014 The LuCI Team +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=Virtual WAN config generator +LUCI_DEPENDS:=+kmod-macvlan +luci-app-mwan3 +PKG_VERSION:=2.0 +PKG_RELEASE:=25 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature +#Makefile for syncdial diff --git a/package/lean/luci-app-syncdial/luasrc/controller/syncdial.lua b/package/lean/luci-app-syncdial/luasrc/controller/syncdial.lua new file mode 100644 index 00000000000000..9e6c7076888c97 --- /dev/null +++ b/package/lean/luci-app-syncdial/luasrc/controller/syncdial.lua @@ -0,0 +1,14 @@ +module("luci.controller.syncdial",package.seeall) +function index() +if not nixio.fs.access("/etc/config/syncdial")then +return +end +local e +e=entry({"admin","network","syncdial"},cbi("syncdial"),_("多线多拨"),103) +e.dependent=true +e=entry({"admin","network","macvlan_redial"},call("redial"),nil) +e.leaf=true +end +function redial() +os.execute("killall -9 pppd") +end diff --git a/package/lean/luci-app-syncdial/luasrc/model/cbi/syncdial.lua b/package/lean/luci-app-syncdial/luasrc/model/cbi/syncdial.lua new file mode 100644 index 00000000000000..30c7f172c97b88 --- /dev/null +++ b/package/lean/luci-app-syncdial/luasrc/model/cbi/syncdial.lua @@ -0,0 +1,62 @@ +local e=require"nixio.fs" +require("luci.tools.webadmin") +local e="mwan3 status | grep -c \"is online and tracking is active\"" +local e=io.popen(e,"r") +local t=e:read("*a") +e:close() +m=Map("syncdial",translate("多线多拨"), +translate("使用macvlan驱动创建多个虚拟WAN口,支持并发多拨
当前在线接口数量:")..t) +s=m:section(TypedSection,"syncdial",translate(" ")) +s.anonymous=true +o=s:option(Flag,"enabled","启用") +o.rmempty=false +o=s:option(Flag,"syncon","启用并发多拨") +o.rmempty=false +o=s:option(ListValue,"dial_type",translate("多拨类型")) +o:value("1",translate("单线多拨")) +o:value("2",translate("双线多拨")) +o.rmempty=false +o=s:option(Value,"wanselect",translate("选择外网接口"),translate("指定要多拨的外网接口,如wan")) +luci.tools.webadmin.cbi_add_networks(o) +o.optional=false +o.rmempty=false +o=s:option(Value,"wannum","虚拟WAN接口数量") +o.datatype="range(0,249)" +o.optional=false +o.default=1 +o=s:option(Flag,"bindwan","绑定物理接口") +o.rmempty=false +o=s:option(Value,"wanselect2",translate("选择第二个外网接口"),translate("指定要多拨的第二个外网接口,如wan2")) +luci.tools.webadmin.cbi_add_networks(o) +o.optional=false +o:depends("dial_type","2") +o=s:option(Value,"wannum2",translate("第二条线虚拟WAN接口数量"),translate("设置第二条线的拨号数")) +o.datatype="range(0,249)" +o.optional=false +o.default=1 +o:depends("dial_type","2") +o=s:option(Flag,"bindwan2","绑定物理接口","第二条线生成的虚拟接口绑定当前物理接口") +o.rmempty=false +o:depends("dial_type","2") +o=s:option(Flag,"dialchk","启用掉线检测") +o.rmempty=false +o=s:option(Value,"dialnum","最低在线接口数量","如果在线接口数量小于这个值则重拨。") +o.datatype="range(0,248)" +o.optional=false +o.default=2 +o=s:option(Value,"dialnum2","第二条线最低在线接口数量","如果第二条线在线接口数量小于这个值则重拨。") +o.datatype="range(0,248)" +o.optional=false +o.default=2 +o:depends("dial_type","2") +o=s:option(Value,"dialwait","重拨等待时间","重拨时,接口全部下线后下一次拨号前的等待时间。单位:秒 最小值:5秒") +o.datatype="and(uinteger,min(5))" +o.optional=false +o=s:option(Flag,"old_frame","使用旧的macvlan创建方式") +o.rmempty=false +o=s:option(Flag,"nomwan","不自动配置MWAN3负载均衡","需要自定义负载均衡设置或者要使用策略路由的用户选择") +o.rmempty=false +o=s:option(DummyValue,"_redial","重新并发拨号") +o.template="syncdial/redial_button" +o.width="10%" +return m diff --git a/package/lean/luci-app-syncdial/luasrc/view/syncdial/redial_button.htm b/package/lean/luci-app-syncdial/luasrc/view/syncdial/redial_button.htm new file mode 100644 index 00000000000000..d1ba683d17428c --- /dev/null +++ b/package/lean/luci-app-syncdial/luasrc/view/syncdial/redial_button.htm @@ -0,0 +1,17 @@ +<%+cbi/valueheader%> + + + + +<%+cbi/valuefooter%> diff --git a/package/lean/luci-app-syncdial/root/bin/genwancfg b/package/lean/luci-app-syncdial/root/bin/genwancfg new file mode 100644 index 00000000000000..6a058b3bcab8e0 --- /dev/null +++ b/package/lean/luci-app-syncdial/root/bin/genwancfg @@ -0,0 +1,278 @@ +#!/bin/sh +#macvlan及PPPoE拨号接口配置批量自动生成脚本 +#Copyright (C) 2016 +. /lib/functions.sh + +#检测IP列表 +chk_ip_list="www.baidu.com 114.114.114.114 119.29.29.29" +origfirewall=$(uci get firewall.@zone[1].network) +backupdev=$(uci get syncdial.config.devbackup) +norun=$(echo $origfirewall|grep vwan) +nomwan=$(uci get syncdial.config.nomwan) +wanselect=$(uci get syncdial.config.wanselect) +wannum=$(uci get syncdial.config.wannum) +oldframe=$(uci get syncdial.config.old_frame) +bindwan=$(uci -q get syncdial.config.bindwan) + +dial_type=$(uci get syncdial.config.dial_type) +[ "$dial_type" -eq 2 ] && { + wanselect2=$(uci get syncdial.config.wanselect2) + [ $? -ne 0 ] && { + logger -t Syncppp "You must select another pppoe interface ! 启用双线多拨必须同时选择第二个外网接口!" + return 0 + } + + wannum2=$(uci get syncdial.config.wannum2) + [ $? -ne 0 ] && { + logger -t Syncppp "When dualdial is enabled, the number of the second virtual WAN cannot be blank! 启用双线多拨时第二个虚拟WAN接口数不能为空!" + return 0 + } + bindwan2=$(uci -q get syncdial.config.bindwan2) +} + +#添加MWAN负载均衡相关配置 +#$1:接口名称 +mwan_cfg_add() { + #gen mwan3_interface + uci set mwan3.${1}=interface + uci set mwan3.${1}.enabled=1 + uci set mwan3.${1}.count=2 + uci set mwan3.${1}.timeout=2 + uci set mwan3.${1}.interval=5 + uci set mwan3.${1}.down=4 + uci set mwan3.${1}.up=1 + for i in $chk_ip_list + do + uci add_list mwan3.${1}.track_ip="$i" + done + uci set mwan3.${1}.reliability=1 + uci set mwan3.${1}.initial_state=online + uci set mwan3.${1}.family=ipv4 + uci set mwan3.${1}.track_method=ping + uci set mwan3.${1}.size=56 + uci set mwan3.${1}.failure_interval=5 + uci set mwan3.${1}.recovery_interval=5 + uci set mwan3.${1}.flush_conntrack=never + #gen mwan3_member + uci set mwan3.${1}_m1_w1=member + uci set mwan3.${1}_m1_w1.interface=${1} + uci set mwan3.${1}_m1_w1.metric=1 + uci set mwan3.${1}_m1_w1.weight=1 + #gen mwan3_policy + uci add_list mwan3.balanced.use_member=${1}_m1_w1 +} + +#删除MWAN负载均衡相关配置 +#$1:接口名称 +mwan_cfg_del() { + uci del mwan3.${1} + uci del mwan3.${1}_m1_w1 + uci del_list mwan3.balanced.use_member=${1}_m1_w1 +} + +#添加macvlan设备 +#$1:设虚拟备名称 $2:原始设备名称 +macvlan_dev_add() { + uci set network.macvlandev_${1}=device + uci set network.macvlandev_${1}.name=${1} + uci set network.macvlandev_${1}.ifname=${2} + uci set network.macvlandev_${1}.type=macvlan +} + +#添加PPPoE接口 +#$1:接口名称 $2:设备名称 $3:账户 $4:密码 $5:网关跃点 +pppoe_if_add() { + #gen vwan macaddr + NEW_MACADDR=$(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//') + #gen wan if + uci set network.${1}=interface + uci set network.${1}.ifname=${2} + uci set network.${1}.proto=pppoe + uci set network.${1}.username=${3} + uci set network.${1}.password=${4} + uci set network.${1}.metric=${5} + uci set network.${1}.macaddr=$NEW_MACADDR + #gen firewall + uci add_list firewall.@zone[1].network=${1} +} + + +orig_firewall_add() { + need_del_rule=`uci -q get firewall.@zone[1].network | awk -F"'" '{print $2}'` + uci del_list firewall.@zone[1].network="$need_del_rule" + for k in $( seq 1 250 ) + do + origdev=$(echo $origfirewall | cut -d " " -f$k) + if [ -z "$origdev" ]; then + break + fi + [ -z "$(uci get firewall.@zone[1].network | grep -w $origdev)" ] && uci add_list firewall.@zone[1].network=$origdev + done +} + +apply_cfg() { + uci commit + #/etc/init.d/network restart & + logger -t Syncppp "Apply syncdial configuaration." + ifup wan & + killall pppconnectcheck +} + +general_config_load() { + config_load 'syncdial' + config_get_bool enabled 'config' 'enabled' + config_get_bool old_frame 'config' 'old_frame' + congig_get_bool dial_type 'config' 'dial_type' + + if [ "$enabled" -eq 0 ]; then + if [ "$old_frame" -eq 1 ]; then + mwan_cfg_add $wanselect + if [ "$dial_type" -eq 2 ]; then + mwan_cfg_add $wanselect2 + fi + fi + echo "Disabled.Exit now." + apply_cfg + exit 1 + fi + + config_load 'network' + config_get pppoe_user $wanselect 'username' + config_get pppoe_password $wanselect 'password' + pppoe_ifname=$(uci get network.$wanselect.ifname) + [ "$dial_type" -eq 2 ] && { + config_get pppoe_user2 $wanselect2 'username' + config_get pppoe_password2 $wanselect2 'password' + pppoe_ifname2=$(uci get network.$wanselect2.ifname) + } + +} + +check_remove_device() { + local devcfg=${1} + [ ${devcfg::11} == 'macvlandev_' ] && uci del network.${devcfg} +} + +check_remove_interface() { + local ifcfg=${1} + [ ${ifcfg::4} == 'vwan' ] && { + uci del network.${ifcfg} + uci del_list firewall.@zone[1].network=${ifcfg} + [ "$nomwan" -ne 1 ] && mwan_cfg_del ${ifcfg} + } + uci set firewall.@zone[1].network="$backupdev" +} + +general_config_remove() { + config_load network + config_foreach check_remove_device 'device' + config_foreach check_remove_interface 'interface' + all_macvlans=`ip link show |grep macvlan | awk -F":" '{print $2}' | awk -F"@" '{print $1}'` + [ -n "$all_macvlans" ] && { + for macvlan in $all_macvlans + do + ip link delete $macvlan + done + } + [ "$(uci get network.$wanselect.proto)" == "none" ] && { + uci set network.$wanselect.proto=pppoe + } + + if [ "$oldframe" -eq 0 ]; then + [ "$wanselect" != "$(echo $(uci get syncdial.config.devbackup)| cut -d " " -f1)" ] && \ + [ "$wanselect" != "$(echo $(uci get syncdial.config.devbackup)| cut -d " " -f2)" ] && \ + [ "$nomwan" -ne 1 ] && mwan_cfg_del $wanselect + else + [ "$nomwan" -ne 1 ] && mwan_cfg_del $wanselect + fi + + [ "$dial_type" -eq 2 ] && { + [ $(uci get network.$wanselect2.proto) == "none" ] && { + uci set network.$wanselect2.proto=pppoe + } + + if [ "$oldframe" -eq 0 ]; then + [ "$wanselect2" != "$(echo $(uci get syncdial.config.devbackup)| cut -d " " -f1)" ] && \ + [ "$wanselect2" != "$(echo $(uci get syncdial.config.devbackup)| cut -d " " -f2)" ] && \ + [ "$nomwan" -ne 1 ] && mwan_cfg_del $wanselect2 + else + [ "$nomwan" -ne 1 ] && mwan_cfg_del $wanselect2 + fi + } +} + + +[ -z "$norun" ] && uci set syncdial.config.devbackup="$origfirewall" && uci commit syncdial +general_config_remove +general_config_load + +uci set network.$wanselect.metric=40 +if [ "$wannum" -gt 0 ]; then + [ "$old_frame" -eq 1 ] && { + uci set network.$wanselect.proto=none + ifname=$(uci get network.$wanselect.ifname) + for i in $(seq 1 $wannum) + do + ip link add link $ifname name macvlan$i type macvlan + ifconfig macvlan$i hw ether $(echo $(cat /sys/class/net/$ifname/address|awk -F ":" '{print $1":"$2":"$3":"$4":"$5":" }')$(echo "" | awk -F ":" '{printf("%X\n", 16+i);}' i=$i)) + ifconfig macvlan$i up + done + } + [ "$wanselect" != "$(echo $(uci get syncdial.config.devbackup)| cut -d " " -f1)" ] && \ + [ "$wanselect" != "$(echo $(uci get syncdial.config.devbackup)| cut -d " " -f2)" ] && \ + [ "$old_frame" -eq 0 -a "$nomwan" -ne 1 ] && mwan_cfg_add $wanselect + + + for i in $(seq 1 $wannum) + do + [ "$old_frame" -eq 0 ] && macvlan_dev_add macvlan$i $pppoe_ifname + if [ "$bindwan" != "" -a "$bindwan" == "1" ]; then + pppoe_if_add vwan$i $pppoe_ifname $pppoe_user $pppoe_password $((40+$i)) + else + pppoe_if_add vwan$i macvlan$i $pppoe_user $pppoe_password $((40+$i)) + fi + [ "$nomwan" -ne 1 ] && mwan_cfg_add vwan$i + done +else + [ "$nomwan" -ne 1 ] && mwan_cfg_add $wanselect +fi + +###dualdial configuration +[ "$(uci -q get syncdial.config.dial_type)" = "2" ] && { + + uci set network.$wanselect2.metric=60 + if [ "$wannum2" -gt 0 ]; then + [ "$old_frame" -eq 1 ] && { + uci set network.$wanselect2.proto=none + ifname2=$(uci get network.$wanselect2.ifname) + for i in $(seq 1 $wannum2) + do + ip link add link $ifname2 name macvlan$(($wannum+$i)) type macvlan + ifconfig macvlan$(($wannum+$i)) hw ether $(echo $(cat /sys/class/net/$ifname2/address|awk -F ":" '{print $1":"$2":"$3":"$4":"$5":" }')$(echo "" | awk -F ":" '{printf("%X\n", 16+i);}' i=$i)) + ifconfig macvlan$(($wannum+$i)) up + done + } + [ "$wanselect2" != "$(echo $(uci get syncdial.config.devbackup)| cut -d " " -f1)" ] && \ + [ "$wanselect2" != "$(echo $(uci get syncdial.config.devbackup)| cut -d " " -f2)" ] && \ + [ "$old_frame" -eq 0 -a "$nomwan" -ne 1 ] && mwan_cfg_add $wanselect2 + + + for i in $(seq 1 $wannum2) + do + [ "$old_frame" -eq 0 ] && macvlan_dev_add macvlan$(($wannum+$i)) $pppoe_ifname2 + if [ "$bindwan2" != "" -a "$bindwan2" == "1" ]; then + pppoe_if_add vwan$(($wannum+$i)) $pppoe_ifname2 $pppoe_user2 $pppoe_password2 $((60+$i)) + else + pppoe_if_add vwan$(($wannum+$i)) macvlan$(($wannum+$i)) $pppoe_user2 $pppoe_password2 $((60+$i)) + fi + [ "$nomwan" -ne 1 ] && mwan_cfg_add vwan$(($wannum+$i)) + done + else + [ "$nomwan" -ne 1 ] && mwan_cfg_add $wanselect2 + fi +} + +orig_firewall_add +apply_cfg + +return 0 diff --git a/package/lean/luci-app-syncdial/root/etc/config/syncdial b/package/lean/luci-app-syncdial/root/etc/config/syncdial new file mode 100644 index 00000000000000..5a39e586f819c2 --- /dev/null +++ b/package/lean/luci-app-syncdial/root/etc/config/syncdial @@ -0,0 +1,19 @@ + +config syncdial 'config' + option syncon '1' + option dialwait '25' + option dialchk '1' + option nomwan '0' + option wanselect 'wan' + option dial_type '2' + option wannum '3' + option wanselect2 'wan2' + option wannum2 '2' + option dialnum '3' + option dialnum2 '2' + option old_frame '1' + option devbackup 'wan wan6 wan2' + option bindwan '0' + option bindwan2 '0' + option enabled '0' + diff --git a/package/lean/luci-app-syncdial/root/etc/hotplug.d/iface/01-dialcheck b/package/lean/luci-app-syncdial/root/etc/hotplug.d/iface/01-dialcheck new file mode 100644 index 00000000000000..716db654c52818 --- /dev/null +++ b/package/lean/luci-app-syncdial/root/etc/hotplug.d/iface/01-dialcheck @@ -0,0 +1,36 @@ +#!/bin/sh +[ "$ACTION" = "ifdown" ] && pppconnectcheck & + +wanselect=$(uci get syncdial.config.wanselect) +[ "$(uci get syncdial.config.dial_type)" = "2" ] && { + wanselect2=$(uci get syncdial.config.wanselect2) +} + +[ "$(uci get syncdial.config.enabled)" = "1" ] && \ + [ "$(uci get syncdial.config.old_frame)" = "1" ] && \ + [ "$DEVICE" = "$(uci get network.$wanselect.ifname)" ] && \ + [ "$ACTION" = "ifup" ] && { + ifname=$(uci get network.$wanselect.ifname) + wannum=$(uci get syncdial.config.wannum) + for i in $(seq 1 $wannum) + do + [ -d /sys/class/net/macvlan$i ] || { + ip link add link $ifname name macvlan$i type macvlan + ifconfig macvlan$i hw ether $(echo $(cat /sys/class/net/$ifname/address|awk -F ":" '{print $1":"$2":"$3":"$4":"$5":" }')$(echo "" | awk -F ":" '{printf("%X\n", 16+i);}' i=$i)) + ifconfig macvlan$i up + } + done + + [ "$(uci get syncdial.config.dial_type)" = "2" ] && { + ifname2=$(uci get network.$wanselect2.ifname) + wannum2=$(uci get syncdial.config.wannum2) + for i in $(seq 1 $wannum2) + do + [ -d /sys/class/net/macvlan$(($wannum+$i)) ] || { + ip link add link $ifname2 name macvlan$(($wannum+$i)) type macvlan + ifconfig macvlan$(($wannum+$i)) hw ether $(echo $(cat /sys/class/net/$ifname2/address|awk -F ":" '{print $1":"$2":"$3":"$4":"$5":" }')$(echo "" | awk -F ":" '{printf("%X\n", 16+i);}' i=$i)) + ifconfig macvlan$(($wannum+$i)) up + } + done + } +} diff --git a/package/lean/luci-app-syncdial/root/etc/hotplug.d/iface/01-mvifcreate b/package/lean/luci-app-syncdial/root/etc/hotplug.d/iface/01-mvifcreate new file mode 100644 index 00000000000000..426341fed9fabf --- /dev/null +++ b/package/lean/luci-app-syncdial/root/etc/hotplug.d/iface/01-mvifcreate @@ -0,0 +1,16 @@ +#!/bin/sh +[ "$(uci get syncdial.config.enabled)" = "1" ] && \ + [ "$(uci get syncdial.config.old_frame)" = "1" ] && \ + [ "$DEVICE" = "$(uci get network.wan.ifname)" ] && \ + [ "$ACTION" = "ifup" ] && { + ifname=$(uci get network.wan.ifname) + wannum=$(uci get syncdial.config.wannum) + for i in $(seq 1 $wannum) + do + [ -d /sys/class/net/macvlan$i ] || { + ip link add link $ifname name macvlan$i type macvlan + ifconfig macvlan$i hw ether $(echo $(cat /sys/class/net/$ifname/address|awk -F ":" '{print $1":"$2":"$3":"$4":"$5":" }')$(echo "" | awk -F ":" '{printf("%X\n", 16+i);}' i=$i)) + ifconfig macvlan$i up + } + done +} diff --git a/package/lean/luci-app-syncdial/root/etc/uci-defaults/luci-syncdial b/package/lean/luci-app-syncdial/root/etc/uci-defaults/luci-syncdial new file mode 100644 index 00000000000000..5394164ccad7e5 --- /dev/null +++ b/package/lean/luci-app-syncdial/root/etc/uci-defaults/luci-syncdial @@ -0,0 +1,12 @@ +#!/bin/sh +touch /etc/config/syncdial + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@syncdial[-1] + add ucitrack syncdial + set ucitrack.@syncdial[-1].exec='/bin/genwancfg' + commit ucitrack +EOF + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/package/lean/luci-app-ttyd/Makefile b/package/lean/luci-app-ttyd/Makefile new file mode 100644 index 00000000000000..cd54f30d297e18 --- /dev/null +++ b/package/lean/luci-app-ttyd/Makefile @@ -0,0 +1,17 @@ +# Copyright (C) 2016 Openwrt.org +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI support for ttyd +LUCI_DEPENDS:=+ttyd +LUCI_PKGARCH:=all +PKG_VERSION:=1.0 +PKG_RELEASE:=2 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + diff --git a/package/lean/luci-app-ttyd/luasrc/controller/terminal.lua b/package/lean/luci-app-ttyd/luasrc/controller/terminal.lua new file mode 100644 index 00000000000000..f4618f2da76298 --- /dev/null +++ b/package/lean/luci-app-ttyd/luasrc/controller/terminal.lua @@ -0,0 +1,9 @@ +module("luci.controller.terminal", package.seeall) + +function index() + if not (luci.sys.call("pidof ttyd > /dev/null") == 0) then + return + end + + entry({"admin", "system", "terminal"}, template("terminal"), _("TTYD Terminal"), 10).leaf = true +end diff --git a/package/lean/luci-app-ttyd/luasrc/view/terminal.htm b/package/lean/luci-app-ttyd/luasrc/view/terminal.htm new file mode 100644 index 00000000000000..784f86f4ffdcf0 --- /dev/null +++ b/package/lean/luci-app-ttyd/luasrc/view/terminal.htm @@ -0,0 +1,9 @@ +<%+header%> +
+

<%=translate("TTYD Terminal")%>

+ +
+ +<%+footer%> \ No newline at end of file diff --git a/package/lean/luci-app-ttyd/po/zh-cn/terminal.po b/package/lean/luci-app-ttyd/po/zh-cn/terminal.po new file mode 100644 index 00000000000000..ed7b7523b34191 --- /dev/null +++ b/package/lean/luci-app-ttyd/po/zh-cn/terminal.po @@ -0,0 +1,5 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +msgid "TTYD Terminal" +msgstr "TTYD 终端" diff --git a/package/lean/luci-app-ttyd/root/etc/init.d/ttyd b/package/lean/luci-app-ttyd/root/etc/init.d/ttyd new file mode 100644 index 00000000000000..87216650bfe48a --- /dev/null +++ b/package/lean/luci-app-ttyd/root/etc/init.d/ttyd @@ -0,0 +1,26 @@ +#!/bin/sh /etc/rc.common + +START=99 +SERVICE_WRITE_PID=1 +SERVICE_DAEMONIZE=1 + +start() { + logger -t TTYD 'Starting ttyd service' + service_start /usr/bin/ttyd -i br-lan /bin/login + return 0 +} + +stop() { + if [ -n "`pidof ttyd`" ]; then + logger -t TTYD 'Shutting down ttyd service' + service_stop /usr/bin/ttyd + fi + return 0 +} + +restart() { + logger -t TTYD 'Restarting ttyd service' + stop + sleep 2 + start +} diff --git a/package/lean/luci-app-unblockmusic/Config.in b/package/lean/luci-app-unblockmusic/Config.in new file mode 100644 index 00000000000000..9dae2dc0f0bee3 --- /dev/null +++ b/package/lean/luci-app-unblockmusic/Config.in @@ -0,0 +1,9 @@ + +config UnblockNeteaseMusic_Go + bool "UnblockNeteaseMusic Golang Version" + default y if x86||x86_64||arm||aarch64 + +config UnblockNeteaseMusic_NodeJS + bool "UnblockNeteaseMusic NodeJS Version" + depends on HAS_FPU || KERNEL_MIPS_FPU_EMULATOR + default y if x86||x86_64||arm||aarch64 diff --git a/package/lean/luci-app-unblockmusic/Makefile b/package/lean/luci-app-unblockmusic/Makefile new file mode 100644 index 00000000000000..9c4b4d913c31bc --- /dev/null +++ b/package/lean/luci-app-unblockmusic/Makefile @@ -0,0 +1,34 @@ +# Copyright (C) 2020 Openwrt.org +# +# This is free software, licensed under the Apache License, Version 2.0 . +# +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=luci-app-unblockmusic +PKG_VERSION:=2.3.1 +PKG_RELEASE:=39 + +PKG_CONFIG_DEPENDS := \ + CONFIG_UnblockNeteaseMusic_Go \ + CONFIG_UnblockNeteaseMusic_NodeJS + +include $(INCLUDE_DIR)/package.mk + +define Package/$(PKG_NAME)/config + source "$(SOURCE)/Config.in" +endef + +PKG_LICENSE:=Apache-2.0 + +LUCI_TITLE:=LuCI support for Unblock NeteaseCloudMusic +LUCI_DEPENDS:=+dnsmasq-full +ipset +wget +UnblockNeteaseMusic_NodeJS:UnblockNeteaseMusic +UnblockNeteaseMusic_Go:UnblockNeteaseMusicGo +LUCI_PKGARCH:=all + +PKG_MAINTAINER:=lean + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + diff --git a/package/lean/luci-app-unblockmusic/luasrc/controller/unblockmusic.lua b/package/lean/luci-app-unblockmusic/luasrc/controller/unblockmusic.lua new file mode 100644 index 00000000000000..3a4c773032f6d4 --- /dev/null +++ b/package/lean/luci-app-unblockmusic/luasrc/controller/unblockmusic.lua @@ -0,0 +1,22 @@ + +module("luci.controller.unblockmusic", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/unblockmusic") then + return + end + + entry({"admin", "services", "unblockmusic"},firstchild(), _("Unblock Netease Music"), 50).dependent = false + + entry({"admin", "services", "unblockmusic", "general"},cbi("unblockmusic"), _("Base Setting"), 1) + entry({"admin", "services", "unblockmusic", "log"},form("unblockmusiclog"), _("Log"), 2) + + entry({"admin", "services", "unblockmusic", "status"},call("act_status")).leaf=true +end + +function act_status() + local e={} + e.running=luci.sys.call("busybox ps -w | grep UnblockNeteaseMusic | grep -v grep | grep -v logcheck.sh >/dev/null")==0 + luci.http.prepare_content("application/json") + luci.http.write_json(e) +end diff --git a/package/lean/luci-app-unblockmusic/luasrc/model/cbi/unblockmusic.lua b/package/lean/luci-app-unblockmusic/luasrc/model/cbi/unblockmusic.lua new file mode 100644 index 00000000000000..ca3a9fe7f58e3d --- /dev/null +++ b/package/lean/luci-app-unblockmusic/luasrc/model/cbi/unblockmusic.lua @@ -0,0 +1,97 @@ +local fs = require "nixio.fs" + +mp = Map("unblockmusic", translate("解锁网易云灰色歌曲")) +mp.description = translate("采用 [QQ/虾米/百度/酷狗/酷我/咕咪/JOOX]等音源,替换网易云变灰歌曲链接") + +mp:section(SimpleSection).template = "unblockmusic/unblockmusic_status" + +s = mp:section(TypedSection, "unblockmusic") +s.anonymous=true +s.addremove=false + +enabled = s:option(Flag, "enabled", translate("启用")) +enabled.default = 0 +enabled.rmempty = false +enabled.description = translate("启用后,路由器自动分流解锁,大部分设备无需设置代理") + +apptype = s:option(ListValue, "apptype", translate("解锁程序选择")) +if nixio.fs.access("/usr/bin/UnblockNeteaseMusic") then +apptype:value("go", translate("Golang 版本")) +end +if nixio.fs.access("/usr/share/UnblockNeteaseMusic/app.js") then +apptype:value("nodejs", translate("NodeJS 版本")) +end +apptype:value("cloud", translate("云解锁( [CTCGFW] 云服务器)")) + +speedtype = s:option(Value, "musicapptype", translate("音源选择")) +speedtype:value("default", translate("默认")) +speedtype:value("netease", translate("网易云音乐")) +speedtype:value("qq", translate("QQ音乐")) +speedtype:value("xiami", translate("虾米音乐")) +speedtype:value("baidu", translate("百度音乐")) +speedtype:value("kugou", translate("酷狗音乐")) +speedtype:value("kuwo", translate("酷我音乐(高音质/FLACの解锁可能性)")) +speedtype:value("migu", translate("咕咪音乐")) +speedtype:value("joox", translate("JOOX音乐")) +speedtype.default = "kuwo" +speedtype:depends("apptype", "nodejs") +speedtype:depends("apptype", "go") + +cloudserver = s:option(Value, "cloudserver", translate("服务器位置")) +cloudserver:value("cdn-shanghai.service.project-openwrt.eu.org:30000:30001", translate("[CTCGFW] 腾讯云上海(高音质)")) +cloudserver:value("hyird.xyz:30000:30001", translate("[hyird] 阿里云北京(高音质)")) +cloudserver:value("39.96.56.58:30000:30000", translate("[Sunsky] 阿里云北京(高音质)")) +cloudserver:value("cdn-henan.service.project-openwrt.eu.org:33221:33222",translate("[CTCGFW] 移动河南(无损音质)")) +cloudserver.description = translate("自定义服务器格式为 IP[域名]:HTTP端口:HTTPS端口
如果服务器为LAN内网IP,需要将这个服务器IP放入例外客户端 (不代理HTTP和HTTPS)") +cloudserver.default = "cdn-shanghai.service.project-openwrt.eu.org:30000:30001" +cloudserver.rmempty = true +cloudserver:depends("apptype", "cloud") + +download_certificate=s:option(DummyValue,"opennewwindow",translate("HTTPS 证书")) +download_certificate.description = translate("
Mac/iOS客户端需要安装 CA根证书并信任
iOS系统需要在“设置 -> 通用 -> 关于本机 -> 证书信任设置”中,信任 UnblockNeteaseMusic Root CA
Linux 设备请在启用时加入 --ignore-certificate-errors 参数") + +o = s:option(Flag, "autoupdate") +o.title = translate("自动检查更新主程序") +o.default = 0 +o.rmempty = false +o.description = translate("每天自动检测并更新到最新版本") +o:depends("apptype", "nodejs") + +local ver = fs.readfile("/usr/share/UnblockNeteaseMusic/core_ver") or "0.00" + +o = s:option(Button, "restart",translate("手动更新")) +o.inputtitle = translate("更新核心版本") +o.description = string.format(translate("NodeJS 解锁主程序版本") .. ": %s ", ver) +o.inputstyle = "reload" +o.write = function() + luci.sys.exec("/usr/share/UnblockNeteaseMusic/update_core.sh luci_update 2>&1") + luci.http.redirect(luci.dispatcher.build_url("admin", "services", "unblockmusic")) +end +o:depends("apptype", "nodejs") + +t=mp:section(TypedSection,"acl_rule",translate("例外客户端规则"), +translate("可以为局域网客户端分别设置不同的例外模式,默认无需设置")) +t.template="cbi/tblsection" +t.sortable=true +t.anonymous=true +t.addremove=true + +e=t:option(Value,"ipaddr",translate("IP Address")) +e.width="40%" +e.datatype="ip4addr" +e.placeholder="0.0.0.0/0" +luci.ip.neighbors({ family = 4 }, function(entry) + if entry.reachable then + e:value(entry.dest:string()) + end +end) + +e=t:option(ListValue,"filter_mode",translate("例外协议")) +e.width="40%" +e.default="disable" +e.rmempty=false +e:value("disable",translate("不代理HTTP和HTTPS")) +e:value("http",translate("不代理HTTP")) +e:value("https",translate("不代理HTTPS")) + +return mp diff --git a/package/lean/luci-app-unblockmusic/luasrc/model/cbi/unblockmusiclog.lua b/package/lean/luci-app-unblockmusic/luasrc/model/cbi/unblockmusiclog.lua new file mode 100644 index 00000000000000..c02d1cc4bc37d0 --- /dev/null +++ b/package/lean/luci-app-unblockmusic/luasrc/model/cbi/unblockmusiclog.lua @@ -0,0 +1,15 @@ +local fs = require "nixio.fs" +local conffile = "/tmp/music.log" + +f = SimpleForm("logview") + +t = f:field(TextValue, "conf") +t.rmempty = true +t.rows = 20 +function t.cfgvalue() + luci.sys.exec("grep -B 1 'http' /tmp/unblockmusic.log | grep -v -e'running' -e'TLS' -e'Transport' -e'POST' -e'github' -e'consumed' -e'starting' -e'error' > /tmp/music.log") + return fs.readfile(conffile) or "" +end +t.readonly="readonly" + +return f \ No newline at end of file diff --git a/package/lean/luci-app-unblockmusic/luasrc/view/unblockmusic/unblockmusic_status.htm b/package/lean/luci-app-unblockmusic/luasrc/view/unblockmusic/unblockmusic_status.htm new file mode 100644 index 00000000000000..74dd92812952d1 --- /dev/null +++ b/package/lean/luci-app-unblockmusic/luasrc/view/unblockmusic/unblockmusic_status.htm @@ -0,0 +1,22 @@ + + +
+

+ <%:Collecting data...%> +

+
\ No newline at end of file diff --git a/package/lean/luci-app-unblockmusic/po/zh-cn/unblockmusic.po b/package/lean/luci-app-unblockmusic/po/zh-cn/unblockmusic.po new file mode 100644 index 00000000000000..07fcb644c05e24 --- /dev/null +++ b/package/lean/luci-app-unblockmusic/po/zh-cn/unblockmusic.po @@ -0,0 +1,13 @@ + +msgid "Unblock Netease Music" +msgstr "解锁网易云灰色歌曲" + +msgid "Base Setting" +msgstr "基本设置" + +msgid "Log" +msgstr "日志" + +msgid "Port" +msgstr "端口" + diff --git a/package/lean/luci-app-unblockmusic/root/etc/config/unblockmusic b/package/lean/luci-app-unblockmusic/root/etc/config/unblockmusic new file mode 100644 index 00000000000000..c9f790b4530aba --- /dev/null +++ b/package/lean/luci-app-unblockmusic/root/etc/config/unblockmusic @@ -0,0 +1,8 @@ + +config unblockmusic + option musicapptype 'kuwo' + option autoupdate '0' + option endpoint 'http://music.163.com' + option enabled '0' + option apptype 'go' + diff --git a/package/lean/luci-app-unblockmusic/root/etc/hotplug.d/iface/099-unblockmusic b/package/lean/luci-app-unblockmusic/root/etc/hotplug.d/iface/099-unblockmusic new file mode 100644 index 00000000000000..3a3c0d92c40593 --- /dev/null +++ b/package/lean/luci-app-unblockmusic/root/etc/hotplug.d/iface/099-unblockmusic @@ -0,0 +1,6 @@ +#!/bin/sh + +[ "$ACTION" = ifup ] || exit 0 + +sleep 10 +/usr/share/UnblockNeteaseMusic/getmusicip.sh diff --git a/package/lean/luci-app-unblockmusic/root/etc/init.d/unblockmusic b/package/lean/luci-app-unblockmusic/root/etc/init.d/unblockmusic new file mode 100644 index 00000000000000..585291277baf47 --- /dev/null +++ b/package/lean/luci-app-unblockmusic/root/etc/init.d/unblockmusic @@ -0,0 +1,199 @@ +#!/bin/sh /etc/rc.common + +START=97 +STOP=10 + +NAME=unblockmusic + +uci_get_by_type() { + local ret=$(uci get $NAME.@$1[0].$2 2>/dev/null) + echo ${ret:=$3} +} + +uci_get_by_name() { + local index=0 + if [ -n $4 ]; then + + index=$4 + fi + local ret=$(uci get $NAME.@$1[$index].$2 2>/dev/null) + echo ${ret:=$3} +} + +check_host() { + local host=$1 + if echo $host | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" >/dev/null; then + hostip=$host + elif [ "$host" != "${host#*:[0-9a-fA-F]}" ]; then + hostip=$host + else + hostip=$(ping $host -W 1 -s 1 -c 1 | grep PING | cut -d'(' -f 2 | cut -d')' -f1) + if echo $hostip | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" >/dev/null; then + hostip=$hostip + else + hostip="127.0.0.1" + fi + fi + echo -e $hostip +} + +ip_rule() +{ + local icount=$(uci show unblockmusic | grep 'filter_mode' | wc -l) + let icount=icount-1 + for i in $(seq 0 $icount) + do + local ip=$(uci_get_by_name acl_rule ipaddr '' $i) + local mode=$(uci_get_by_name acl_rule filter_mode '' $i) + + case "$mode" in + http) + ipset -! add music_http $ip + ;; + https) + ipset -! add music_https $ip + ;; + disable) + ipset -! add music_http $ip + ipset -! add music_https $ip + ;; + esac + done +} + +ENABLE=$(uci_get_by_type unblockmusic enabled 0) +TYPE=$(uci_get_by_type unblockmusic musicapptype default) +AUTOUPDATE=$(uci_get_by_type unblockmusic autoupdate 0) +APPTYPE=$(uci_get_by_type unblockmusic apptype go) + +CLOUD=$(uci_get_by_type unblockmusic cloudserver "127.0.0.1:5200:5201") +cloudadd=$(echo "$CLOUD" | awk -F ':' '{print $1}') +cloudhttp=$(echo "$CLOUD" | awk -F ':' '{print $2}') +cloudhttps=$(echo "$CLOUD" | awk -F ':' '{print $3}') + +cloudip=$(check_host $cloudadd) + +CRON_FILE=/etc/crontabs/root + +ipt_n="iptables -t nat" + +add_rule() +{ + ipset -! -N music hash:ip + ipset -! -N music_http hash:ip + ipset -! -N music_https hash:ip + $ipt_n -N CLOUD_MUSIC + $ipt_n -A CLOUD_MUSIC -d 0.0.0.0/8 -j RETURN + $ipt_n -A CLOUD_MUSIC -d 10.0.0.0/8 -j RETURN + $ipt_n -A CLOUD_MUSIC -d 127.0.0.0/8 -j RETURN + $ipt_n -A CLOUD_MUSIC -d 169.254.0.0/16 -j RETURN + $ipt_n -A CLOUD_MUSIC -d 172.16.0.0/12 -j RETURN + $ipt_n -A CLOUD_MUSIC -d 192.168.0.0/16 -j RETURN + $ipt_n -A CLOUD_MUSIC -d 224.0.0.0/4 -j RETURN + $ipt_n -A CLOUD_MUSIC -d 240.0.0.0/4 -j RETURN + if [ "$APPTYPE" != "cloud" ]; then + $ipt_n -A CLOUD_MUSIC -p tcp -m set ! --match-set music_http src --dport 80 -j REDIRECT --to-ports 5200 + $ipt_n -A CLOUD_MUSIC -p tcp -m set ! --match-set music_https src --dport 443 -j REDIRECT --to-ports 5201 + else + $ipt_n -A CLOUD_MUSIC -p tcp -m set ! --match-set music_http src --dport 80 -j DNAT --to $cloudip:$cloudhttp + $ipt_n -A CLOUD_MUSIC -p tcp -m set ! --match-set music_https src --dport 443 -j DNAT --to $cloudip:$cloudhttps + fi + $ipt_n -I PREROUTING -p tcp -m set --match-set music dst -j CLOUD_MUSIC + iptables -I OUTPUT -d 223.252.199.10 -j DROP + + ip_rule +} + +del_rule(){ + $ipt_n -D PREROUTING -p tcp -m set --match-set music dst -j CLOUD_MUSIC 2>/dev/null + $ipt_n -F CLOUD_MUSIC 2>/dev/null + $ipt_n -X CLOUD_MUSIC 2>/dev/null + iptables -D OUTPUT -d 223.252.199.10 -j DROP 2>/dev/null + + ipset -X music_http 2>/dev/null + ipset -X music_https 2>/dev/null + + rm -f /tmp/dnsmasq.d/dnsmasq-163.conf + /etc/init.d/dnsmasq reload >/dev/null 2>&1 +} + +set_firewall(){ + rm -f /tmp/dnsmasq.d/dnsmasq-163.conf + mkdir -p /tmp/dnsmasq.d + cat <<-EOF > "/tmp/dnsmasq.d/dnsmasq-163.conf" +ipset=/.music.163.com/music +ipset=/interface.music.163.com/music +ipset=/interface3.music.163.com/music +ipset=/apm.music.163.com/music +ipset=/apm3.music.163.com/music +ipset=/clientlog.music.163.com/music +ipset=/clientlog3.music.163.com/music + EOF + /etc/init.d/dnsmasq reload >/dev/null 2>&1 + + add_rule + + mkdir -p /var/etc + echo -e "/etc/init.d/unblockmusic restart" > "/var/etc/unblockmusic.include" +} + +add_cron() +{ + if [ $AUTOUPDATE -eq 1 ]; then + sed -i '/update_core.sh/d' $CRON_FILE + echo '0 2 * * * /usr/share/UnblockNeteaseMusic/update_core.sh 2>&1' >> $CRON_FILE + crontab $CRON_FILE + fi +} + +del_cron() +{ + sed -i '/update_core.sh/d' $CRON_FILE + /etc/init.d/cron restart +} + +start() +{ + stop + + [ $ENABLE -eq "0" ] && exit 0 + + rm -f /tmp/unblockmusic.log + echo "$(date -R) # Start UnblockNeteaseMusic" >/tmp/unblockmusic.log + + if [ "$TYPE" = "default" ]; then + musictype=" " + else + musictype="-o $TYPE" + fi + + if [ "$APPTYPE" == "nodejs" ]; then + export ENABLE_FLAC=true + node /usr/share/UnblockNeteaseMusic/app.js -e http://music.163.com -p 5200:5201 $musictype >>/tmp/unblockmusic.log 2>&1 & + add_cron + echo "$(date -R) # UnblockNeteaseMusic Nodejs Version (http:5200, https:5201)" >>/tmp/unblockmusic.log + elif [ "$APPTYPE" == "go" ]; then + UnblockNeteaseMusic -p 5200 -sp 5201 -c /usr/share/UnblockNeteaseMusicGo/server.crt -k /usr/share/UnblockNeteaseMusicGo/server.key -m 0 -e >>/tmp/unblockmusic.log 2>&1 & + echo "$(date -R) # UnblockNeteaseMusic Golang Version (http:5200, https:5201)" >>/tmp/unblockmusic.log + else + kill -9 $(busybox ps -w | grep 'sleep 60m' | grep -v grep | awk '{print $1}') >/dev/null 2>&1 + /usr/bin/UnblockNeteaseMusicCloud >/dev/null 2>&1 & + echo "$(date -R) # UnblockNeteaseMusic Cloud Version - Server: $cloudip (http:$cloudhttp, https:$cloudhttp)" >>/tmp/unblockmusic.log + fi + + set_firewall + + if [ "$APPTYPE" != "cloud" ]; then + /usr/share/UnblockNeteaseMusic/logcheck.sh >/dev/null 2>&1 & + fi +} + +stop() +{ + kill -9 $(busybox ps -w | grep UnblockNeteaseMusic | grep -v grep | awk '{print $1}') >/dev/null 2>&1 + kill -9 $(busybox ps -w | grep logcheck.sh | grep -v grep | awk '{print $1}') >/dev/null 2>&1 + rm -f /tmp/unblockmusic.log + + del_rule + del_cron +} diff --git a/package/lean/luci-app-unblockmusic/root/etc/uci-defaults/unblockmusic b/package/lean/luci-app-unblockmusic/root/etc/uci-defaults/unblockmusic new file mode 100644 index 00000000000000..38a16d6958afae --- /dev/null +++ b/package/lean/luci-app-unblockmusic/root/etc/uci-defaults/unblockmusic @@ -0,0 +1,17 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@unblockmusic[-1] + add ucitrack unblockmusic + set ucitrack.@unblockmusic[-1].init=unblockmusic + commit ucitrack + delete firewall.unblockmusic + set firewall.unblockmusic=include + set firewall.unblockmusic.type=script + set firewall.unblockmusic.path=/var/etc/unblockmusic.include + set firewall.unblockmusic.reload=1 + commit firewall +EOF + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/package/lean/luci-app-unblockmusic/root/lib/upgrade/keep.d/unblockmusic b/package/lean/luci-app-unblockmusic/root/lib/upgrade/keep.d/unblockmusic new file mode 100644 index 00000000000000..97e69bd4ea3b49 --- /dev/null +++ b/package/lean/luci-app-unblockmusic/root/lib/upgrade/keep.d/unblockmusic @@ -0,0 +1,6 @@ +/usr/share/UnblockNeteaseMusic/ca.crt +/usr/share/UnblockNeteaseMusic/server.crt +/usr/share/UnblockNeteaseMusic/server.key +/usr/share/UnblockNeteaseMusicGo/ca.crt +/usr/share/UnblockNeteaseMusicGo/server.crt +/usr/share/UnblockNeteaseMusicGo/server.key \ No newline at end of file diff --git a/package/lean/luci-app-unblockmusic/root/usr/bin/UnblockNeteaseMusicCloud b/package/lean/luci-app-unblockmusic/root/usr/bin/UnblockNeteaseMusicCloud new file mode 100644 index 00000000000000..02027f62de08c0 --- /dev/null +++ b/package/lean/luci-app-unblockmusic/root/usr/bin/UnblockNeteaseMusicCloud @@ -0,0 +1,8 @@ +#!/bin/sh + +while true +do + ipset -! -N music hash:ip + wget-ssl -q -t 99 -T 10 http://httpdns.n.netease.com/httpdns/v2/d?domain=music.163.com,interface.music.163.com,interface3.music.163.com,apm.music.163.com,apm3.music.163.com,clientlog.music.163.com,clientlog3.music.163.com -O- | grep -Eo '[0-9]+?\.[0-9]+?\.[0-9]+?\.[0-9]+?' | sort | uniq | awk '{print "ipset -! add music "$1}' | sh + sleep 60m +done diff --git a/package/lean/luci-app-unblockmusic/root/usr/share/UnblockNeteaseMusic/getmusicip.sh b/package/lean/luci-app-unblockmusic/root/usr/share/UnblockNeteaseMusic/getmusicip.sh new file mode 100644 index 00000000000000..cdb213a82de74b --- /dev/null +++ b/package/lean/luci-app-unblockmusic/root/usr/share/UnblockNeteaseMusic/getmusicip.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +ipset -! -N music hash:ip +wget-ssl -q -t 99 -T 10 http://httpdns.n.netease.com/httpdns/v2/d?domain=music.163.com,interface.music.163.com,interface3.music.163.com,apm.music.163.com,apm3.music.163.com,clientlog.music.163.com,clientlog3.music.163.com -O- | grep -Eo '[0-9]+?\.[0-9]+?\.[0-9]+?\.[0-9]+?' | sort | uniq | awk '{print "ipset -! add music "$1}' | sh \ No newline at end of file diff --git a/package/lean/luci-app-unblockmusic/root/usr/share/UnblockNeteaseMusic/logcheck.sh b/package/lean/luci-app-unblockmusic/root/usr/share/UnblockNeteaseMusic/logcheck.sh new file mode 100644 index 00000000000000..8d53d96c341268 --- /dev/null +++ b/package/lean/luci-app-unblockmusic/root/usr/share/UnblockNeteaseMusic/logcheck.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +log_max_size=100 +log_file="/tmp/unblockmusic.log" +log_size=0 + +/usr/share/UnblockNeteaseMusic/getmusicip.sh +sleep 29s + +while true +do + icount=`busybox ps -w | grep UnblockNeteaseMusic | grep -v grep | grep -v logcheck.sh` + if [ -z "$icount" ]; then + /usr/share/UnblockNeteaseMusic/getmusicip.sh + /etc/init.d/unblockmusic restart + fi + log_size=$(expr $(ls -l $log_file | awk '{print $5}') / 1024) + [ $log_size -ge $log_max_size ] && echo "$(date -R) # Start UnblockNeteaseMusic" >/tmp/unblockmusic.log + sleep 29s +done diff --git a/package/lean/luci-app-unblockmusic/root/usr/share/UnblockNeteaseMusic/update_core.sh b/package/lean/luci-app-unblockmusic/root/usr/share/UnblockNeteaseMusic/update_core.sh new file mode 100644 index 00000000000000..65953b93537e24 --- /dev/null +++ b/package/lean/luci-app-unblockmusic/root/usr/share/UnblockNeteaseMusic/update_core.sh @@ -0,0 +1,69 @@ +#!/bin/sh + +function check_if_already_running(){ + running_tasks="$(ps |grep "unblockneteasemusic" |grep "update_core" |grep -v "grep" |awk '{print $1}' |wc -l)" + [ "${running_tasks}" -gt "2" ] && echo -e "\nA task is already running." >>/tmp/unblockmusic_update.log && exit 2 +} + +function clean_log(){ + echo "" > /tmp/unblockmusic_update.log +} + +function check_latest_version(){ + latest_ver="$(wget-ssl --no-check-certificate -O- https://github.com/nondanee/UnblockNeteaseMusic/commits/master |tr -d '\n' |grep -Eo 'commit\/[0-9a-z]+' |sed -n 1p |sed 's#commit/##g')" + [ -z "${latest_ver}" ] && echo -e "\nFailed to check latest version, please try again later." >>/tmp/unblockmusic_update.log && exit 1 + if [ ! -e "/usr/share/UnblockNeteaseMusic/local_ver" ]; then + clean_log + echo -e "Local version: NOT FOUND, cloud version: ${latest_ver}." >>/tmp/unblockmusic_update.log + update_core + else + if [ "$(cat /usr/share/UnblockNeteaseMusic/local_ver)" != "${latest_ver}" ]; then + clean_log + echo -e "Local version: $(cat /usr/share/UnblockNeteaseMusic/local_ver 2>/dev/null), cloud version: ${latest_ver}." >>/tmp/unblockmusic_update.log + update_core + else + echo -e "\nLocal version: $(cat /usr/share/UnblockNeteaseMusic/local_ver 2>/dev/null), cloud version: ${latest_ver}." >>/tmp/unblockmusic_update.log + echo -e "You're already using the latest version." >>/tmp/unblockmusic_update.log + [ "${luci_update}" == "n" ] && /etc/init.d/unblockmusic restart + exit 3 + fi + fi +} + +function update_core(){ + echo -e "Updating core..." >>/tmp/unblockmusic_update.log + + mkdir -p "/tmp/unblockneteasemusic/core" >/dev/null 2>&1 + rm -rf /tmp/unblockneteasemusic/core/* >/dev/null 2>&1 + + wget-ssl --no-check-certificate -t 1 -T 10 -O /tmp/unblockneteasemusic/core/core.tar.gz "https://github.com/nondanee/UnblockNeteaseMusic/archive/master.tar.gz" >/dev/null 2>&1 + tar -zxf "/tmp/unblockneteasemusic/core/core.tar.gz" -C "/tmp/unblockneteasemusic/core/" >/dev/null 2>&1 + if [ -e "/usr/share/UnblockNeteaseMusic/ca.crt" ] && [ -e "/usr/share/UnblockNeteaseMusic/server.crt" ] && [ -e "/usr/share/UnblockNeteaseMusic/server.key" ] ; then + rm -f /tmp/unblockneteasemusic/core/UnblockNeteaseMusic-master/ca.crt /tmp/unblockneteasemusic/core/UnblockNeteaseMusic-master/server.crt /tmp/unblockneteasemusic/core/UnblockNeteaseMusic-master/server.key + fi + cp -a /tmp/unblockneteasemusic/core/UnblockNeteaseMusic-master/* "/usr/share/UnblockNeteaseMusic/" + rm -rf "/tmp/unblockneteasemusic" >/dev/null 2>&1 + + if [ ! -e "/usr/share/UnblockNeteaseMusic/app.js" ]; then + echo -e "Failed to download core." >>/tmp/unblockmusic_update.log + exit 1 + else + echo -e "${latest_ver}" > /usr/share/UnblockNeteaseMusic/local_ver + cat /usr/share/UnblockNeteaseMusic/package-lock.json | grep version |awk -F ':' '{print $2}' | cut -c3-8 > /usr/share/UnblockNeteaseMusic/core_ver + fi + + echo -e "Succeeded in updating core." >/tmp/unblockmusic_update.log + echo -e "Local version: $(cat /usr/share/UnblockNeteaseMusic/local_ver 2>/dev/null), cloud version: ${latest_ver}.\n" >>/tmp/unblockmusic_update.log + + /etc/init.d/unblockmusic restart +} + +function main(){ + check_if_already_running + check_latest_version +} + + luci_update="n" + [ "$1" == "luci_update" ] && luci_update="y" + main + diff --git a/package/lean/luci-app-usb-printer/Makefile b/package/lean/luci-app-usb-printer/Makefile new file mode 100644 index 00000000000000..b2133768104ea6 --- /dev/null +++ b/package/lean/luci-app-usb-printer/Makefile @@ -0,0 +1,18 @@ +# +# Copyright (C) 2008-2014 The LuCI Team +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=USB Printer Share via TCP/IP +LUCI_DEPENDS:=+p910nd +kmod-usb-printer +PKG_VERSION:=1.0 +PKG_RELEASE:=2 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature +#applications/luci-app-usb-printer/ +#applications/luci-app-usb-printer/ diff --git a/package/lean/luci-app-usb-printer/ipkg/postinst b/package/lean/luci-app-usb-printer/ipkg/postinst new file mode 100644 index 00000000000000..97a343c7b1e27c --- /dev/null +++ b/package/lean/luci-app-usb-printer/ipkg/postinst @@ -0,0 +1,6 @@ +#!/bin/sh +[ -n "${IPKG_INSTROOT}" ] || { + ( . /etc/uci-defaults/luci-usb-printer ) && rm -f /etc/uci-defaults/luci-usb-printer + exit 0 +} + diff --git a/package/lean/luci-app-usb-printer/luasrc/controller/usb_printer.lua b/package/lean/luci-app-usb-printer/luasrc/controller/usb_printer.lua new file mode 100644 index 00000000000000..ebcee4f79a50da --- /dev/null +++ b/package/lean/luci-app-usb-printer/luasrc/controller/usb_printer.lua @@ -0,0 +1,29 @@ +--[[ +LuCI - Lua Configuration Interface + +Copyright 2008 Steven Barth + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ +]]-- + +require("luci.sys") + +module("luci.controller.usb_printer", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/usb_printer") then + return + end + + entry({"admin", "nas"}, firstchild(), "NAS", 44).dependent = false + + local page + + page = entry({"admin", "nas", "usb_printer"}, cbi("usb_printer"), _("USB Printer Server"), 50) +end diff --git a/package/lean/luci-app-usb-printer/luasrc/model/cbi/usb_printer.lua b/package/lean/luci-app-usb-printer/luasrc/model/cbi/usb_printer.lua new file mode 100644 index 00000000000000..3cc7526ef93221 --- /dev/null +++ b/package/lean/luci-app-usb-printer/luasrc/model/cbi/usb_printer.lua @@ -0,0 +1,130 @@ +--[[ +LuCI - Lua Configuration Interface + +Copyright 2008 Steven Barth +Copyright 2005-2013 hackpascal + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ +]]-- + +require "luci.util" +local uci = luci.model.uci.cursor_state() +local net = require "luci.model.network" + +m = Map("usb_printer", translate("USB Printer Server"), + translate("Shares multiple USB printers via TCP/IP.
When modified bingings, re-plug usb connectors to take effect.
This module requires kmod-usb-printer.")) + +function hex_align(hex, num) + local len = num - string.len(hex) + + return string.rep("0", len) .. hex +end + +function detect_usb_printers() + local data = {} + + local lps = luci.util.execi("/usr/bin/detectlp") + + for value in lps do + local row = {} + + --[[ + detectlp 的输出格式: + 设备名,VID/PID/?,描述,型号 + ]]-- + + local pos = string.find(value, ",") + + local devname = string.sub(value, 1, pos - 1) + + local value = string.sub(value, pos + 1, string.len(value)) + + pos = string.find(value, ",") + local product = string.sub(value, 1, pos - 1) + + value = string.sub(value, pos + 1, string.len(value)) + + pos = string.find(value, ",") + local model = string.sub(value, 1, pos - 1) + + local name = string.sub(value, pos + 1, string.len(value)) + + pos = string.find(product, "/"); + + local vid = string.sub(product, 1, pos - 1) + + local pid = string.sub(product, pos + 1, string.len(product)) + + pos = string.find(pid, "/") + pid = string.sub(pid, 1, pos - 1) + + row["description"] = name + row["model"] = model + row["id"] = hex_align(vid, 4) .. ":" .. hex_align(pid, 4) + row["name"] = devname + row["product"] = product + + table.insert(data, row) + end + + return data +end + +local printers = detect_usb_printers() + +v = m:section(Table, printers, translate("Detected printers")) + +v:option(DummyValue, "description", translate("Description")) +v:option(DummyValue, "model", translate("Printer Model")) +v:option(DummyValue, "id", translate("VID/PID")) +v:option(DummyValue, "name", translate("Device Name")) + +net = net.init(m.uci) + +s = m:section(TypedSection, "printer", translate("Bindings")) +s.addremove = true +s.anonymous = true + +s:option(Flag, "enabled", translate("enable")) + +d = s:option(Value, "device", translate("Device")) +d.rmempty = true + +for key, item in ipairs(printers) do + d:value(item["product"], item["description"] .. " [" .. item["id"] .. "]") +end + +b = s:option(Value, "bind", translate("Interface"), translate("Specifies the interface to listen on.")) +b.template = "cbi/network_netlist" +b.nocreate = true +b.unspecified = true + +function b.cfgvalue(...) + local v = Value.cfgvalue(...) + if v then + return (net:get_status_by_address(v)) + end +end + +function b.write(self, section, value) + local n = net:get_network(value) + if n and n:ipaddr() then + Value.write(self, section, n:ipaddr()) + end +end + +p = s:option(ListValue, "port", translate("Port"), translate("TCP listener port.")) +p.rmempty = true +for i = 0, 9 do + p:value(i, 9100 + i) +end + +s:option(Flag, "bidirectional", translate("Bidirectional mode")) + +return m diff --git a/package/lean/luci-app-usb-printer/po/zh-cn/usb-printer.po b/package/lean/luci-app-usb-printer/po/zh-cn/usb-printer.po new file mode 100644 index 00000000000000..05ce0d1eea2242 --- /dev/null +++ b/package/lean/luci-app-usb-printer/po/zh-cn/usb-printer.po @@ -0,0 +1,65 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-05-18 01:34+0800\n" +"PO-Revision-Date: 2014-05-18 01:34+0800\n" +"Last-Translator: hackpascal \n" +"Language-Team: \n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Pootle 2.0.6\n" + +msgid "Bidirectional mode" +msgstr "双向模式" + +msgid "Bindings" +msgstr "绑定" + +msgid "Device" +msgstr "设备" + +msgid "Device Name" +msgstr "设备名" + +msgid "Detected printers" +msgstr "检测到的打印机" + +msgid "" +"Shares multiple USB printers via TCP/IP.
" +"When modified bingings, re-plug usb connectors to take effect.
" +"This module requires kmod-usb-printer." +msgstr "" +"通过 TCP/IP 共享 USB 打印机。
修改设置后,请重新连接打印机以使设置生效。
" +"此模块需要 kmod-usb-printer 支持。" + +msgid "Port" +msgstr "端口" + +msgid "Printer Model" +msgstr "打印机型号" + +msgid "Settings" +msgstr "设置" + +msgid "TCP listener port." +msgstr "TCP 监听端口。" + +msgid "enable" +msgstr "启用" + +msgid "USB Printer Server" +msgstr "USB 打印服务器" + +msgid "Specifies the interface to listen on." +msgstr "指定要监听的接口。" + +msgid "NAS" +msgstr "网络存储" + +msgid "Architecture" +msgstr "架构" + diff --git a/package/lean/luci-app-usb-printer/root/etc/config/usb_printer b/package/lean/luci-app-usb-printer/root/etc/config/usb_printer new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/package/lean/luci-app-usb-printer/root/etc/hotplug.d/usb/10-usb_printer b/package/lean/luci-app-usb-printer/root/etc/hotplug.d/usb/10-usb_printer new file mode 100644 index 00000000000000..c250fe78feb936 --- /dev/null +++ b/package/lean/luci-app-usb-printer/root/etc/hotplug.d/usb/10-usb_printer @@ -0,0 +1,7 @@ +#!/bin/sh +# Copyright (C) 2005-2014 NowRush Studio +# Author: hackpascal + +if [ x"$INTERFACE" = x"7/1/1" ] || [ x"$INTERFACE" = x"7/1/2" ]; then + /usr/bin/usb_printer_hotplug "$PRODUCT" "$ACTION" +fi diff --git a/package/lean/luci-app-usb-printer/root/etc/init.d/usb_printer b/package/lean/luci-app-usb-printer/root/etc/init.d/usb_printer new file mode 100644 index 00000000000000..4da5e344567e6e --- /dev/null +++ b/package/lean/luci-app-usb-printer/root/etc/init.d/usb_printer @@ -0,0 +1,22 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2005-2013 NowRush Studio +# Author: hackpascal + +START=70 + +stop() { + killall p910nd 2>/dev/null +} + +start() { + for lps in `/usr/bin/detectlp`; do + product=`echo $lps | cut -d , -f 2` + + /usr/bin/usb_printer_hotplug "$product" add + done +} + +restart() { + stop + start +} diff --git a/package/lean/luci-app-usb-printer/root/etc/uci-defaults/luci-usb-printer b/package/lean/luci-app-usb-printer/root/etc/uci-defaults/luci-usb-printer new file mode 100644 index 00000000000000..38c214f9c18f98 --- /dev/null +++ b/package/lean/luci-app-usb-printer/root/etc/uci-defaults/luci-usb-printer @@ -0,0 +1,12 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@usb_printer[-1] + add ucitrack usb_printer + set ucitrack.@usb_printer[-1].init=usb_printer + commit ucitrack +EOF + +[ -f /etc/init.d/p910nd ] && /etc/init.d/p910nd disable + +exit 0 diff --git a/package/lean/luci-app-usb-printer/root/usr/bin/detectlp b/package/lean/luci-app-usb-printer/root/usr/bin/detectlp new file mode 100644 index 00000000000000..b69385bb90b0ab --- /dev/null +++ b/package/lean/luci-app-usb-printer/root/usr/bin/detectlp @@ -0,0 +1,20 @@ +#!/bin/sh + +lp_path=/sys/class/usbmisc + +if ! [ -d "$lp_path" ]; then + exit +fi + +cd $lp_path + +for lps in `ls`; do + desc_file=$lp_path/$lps/device/ieee1284_id + uevent_file=$lp_path/$lps/device/uevent + + name=`cat $desc_file | sed 's/.*DES:\(.*\);.*/\1/' | cut -d ';' -f 1` + model=`cat $desc_file | sed 's/.*MDL:\(.*\);.*/\1/' | cut -d ';' -f 1` + product=`cat $uevent_file | grep PRODUCT= | sed 's/PRODUCT=\(.*\)/\1/'` + + echo $lps,$product,$model,$name; +done diff --git a/package/lean/luci-app-usb-printer/root/usr/bin/usb_printer_hotplug b/package/lean/luci-app-usb-printer/root/usr/bin/usb_printer_hotplug new file mode 100644 index 00000000000000..e0a60b003364e7 --- /dev/null +++ b/package/lean/luci-app-usb-printer/root/usr/bin/usb_printer_hotplug @@ -0,0 +1,72 @@ +#!/bin/sh +# Copyright (C) 2005-2014 NowRush Studio +# Author: hackpascal + +. $IPKG_INSTROOT/lib/functions.sh + +PRODUCT=$1 +ACTION=$2 + +DEVICES= + +check_printer() { + local cfg=$1 + local enabled + local device_id + local bind_ip + local port + local bidirect + local device_file + local args="" + local pid_file + + config_get_bool enabled "$cfg" enabled 0 + [ "$enabled" -eq 0 ] && return 0 + + config_get device_id "$cfg" device "" + config_get bind_ip "$cfg" bind "0.0.0.0" + config_get port "$cfg" port "" + config_get_bool bidirect "$cfg" bidirectional "0" + + if [ -z "$device_id" ] || [ -z "$port" ]; then + return + fi + + if [ x"$PRODUCT" != x"$device_id" ]; then + return + fi + + device_file=`echo $DEVICES | grep $device_id | cut -d , -f 1` + + if [ "$ACTION" = "add" ] && [ -z "$device_file" ]; then + return + fi + + pid_file=/var/run/p910${port}d.pid + [ -f $pid_file ] && kill `cat $pid_file` 2>/dev/null + + if [ "$ACTION" = "add" ]; then + if [ "$bidirect" != 0 ]; then + args='-b' + fi + + logger "usb_printer: start p910nd on $bind_ip:$port for /dev/usb/$device_file" + /usr/sbin/p910nd $args -f /dev/usb/$device_file -i $bind_ip $port + fi +} + +if [ -z "$PRODUCT" ] || [ -z "$ACTION" ]; then + echo "Arguements required" + exit 1 +fi + +if [ "$ACTION" != "add" ] && [ "$ACTION" != "remove" ]; then + echo "Invalid action arguement" + exit 1 +fi + +DEVICES=`/usr/bin/detectlp` + +config_load usb_printer + +config_foreach check_printer printer diff --git a/package/lean/luci-app-v2ray-server/LICENSE b/package/lean/luci-app-v2ray-server/LICENSE new file mode 100644 index 00000000000000..e72bfddabc15be --- /dev/null +++ b/package/lean/luci-app-v2ray-server/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + 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. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. \ No newline at end of file diff --git a/package/lean/luci-app-v2ray-server/Makefile b/package/lean/luci-app-v2ray-server/Makefile new file mode 100644 index 00000000000000..dbdae4d037cb58 --- /dev/null +++ b/package/lean/luci-app-v2ray-server/Makefile @@ -0,0 +1,18 @@ +# Copyright (C) 2018-2019 Lienol +# +# This is free software, licensed under the GNU General Public License v3. +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI support for V2ray Server +LUCI_DEPENDS:=+v2ray +LUCI_PKGARCH:=all +PKG_VERSION:=1.1 +PKG_RELEASE:=5 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + + diff --git a/package/lean/luci-app-v2ray-server/luasrc/controller/v2ray_server.lua b/package/lean/luci-app-v2ray-server/luasrc/controller/v2ray_server.lua new file mode 100644 index 00000000000000..d2a29ac1c0a09f --- /dev/null +++ b/package/lean/luci-app-v2ray-server/luasrc/controller/v2ray_server.lua @@ -0,0 +1,65 @@ +module("luci.controller.v2ray_server", package.seeall) +local http = require "luci.http" +local v2ray = require "luci.model.cbi.v2ray_server.api.v2ray" + +function index() + if not nixio.fs.access("/etc/config/v2ray_server") then return end + entry({"admin", "vpn"}, firstchild(), "VPN", 45).dependent = false + entry({"admin", "vpn", "v2ray_server"}, cbi("v2ray_server/index"), + _("V2ray Server"), 3).dependent = true + entry({"admin", "vpn", "v2ray_server", "config"}, cbi("v2ray_server/config")).leaf = + true + + entry({"admin", "vpn", "v2ray_server", "users_status"}, + call("v2ray_users_status")).leaf = true + entry({"admin", "vpn", "v2ray_server", "check"}, call("v2ray_check")).leaf = + true + entry({"admin", "vpn", "v2ray_server", "update"}, call("v2ray_update")).leaf = + true + entry({"admin", "vpn", "v2ray_server", "get_log"}, call("get_log")).leaf = + true + entry({"admin", "vpn", "v2ray_server", "clear_log"}, call("clear_log")).leaf = + true +end + +local function http_write_json(content) + http.prepare_content("application/json") + http.write_json(content or {code = 1}) +end + +function v2ray_users_status() + local e = {} + e.index = luci.http.formvalue("index") + e.status = luci.sys.call( + "ps -w| grep -v grep | grep '/var/etc/v2ray_server/" .. + luci.http.formvalue("id") .. "' >/dev/null") == 0 + http_write_json(e) +end + +function v2ray_check() + local json = v2ray.to_check("") + http_write_json(json) +end + +function v2ray_update() + local json = nil + local task = http.formvalue("task") + if task == "extract" then + json = + v2ray.to_extract(http.formvalue("file"), http.formvalue("subfix")) + elseif task == "move" then + json = v2ray.to_move(http.formvalue("file")) + else + json = v2ray.to_download(http.formvalue("url")) + end + + http_write_json(json) +end + +function get_log() + luci.http.write(luci.sys.exec( + "[ -f '/var/log/v2ray_server/app.log' ] && cat /var/log/v2ray_server/app.log")) +end + +function clear_log() luci.sys.call("echo '' > /var/log/v2ray_server/app.log") end + diff --git a/package/lean/luci-app-v2ray-server/luasrc/model/cbi/v2ray_server/api/genv2rayconfig.lua b/package/lean/luci-app-v2ray-server/luasrc/model/cbi/v2ray_server/api/genv2rayconfig.lua new file mode 100644 index 00000000000000..6b632ee76a764d --- /dev/null +++ b/package/lean/luci-app-v2ray-server/luasrc/model/cbi/v2ray_server/api/genv2rayconfig.lua @@ -0,0 +1,124 @@ +local ucursor = require"luci.model.uci".cursor() +local json = require "luci.jsonc" +local server_section = arg[1] +local server = ucursor:get_all("v2ray_server", server_section) + +local settings = nil +local routing = nil + +if server.protocol == "vmess" then + if server.VMess_id then + local clients = {} + for i = 1, #server.VMess_id do + clients[i] = { + id = server.VMess_id[i], + level = tonumber(server.VMess_level), + alterId = tonumber(server.VMess_alterId) + } + end + settings = {clients = clients} + end +elseif server.protocol == "socks" then + settings = { + auth = (server.socks_username == nil and server.socks_password == nil) and + "noauth" or "password", + accounts = { + { + user = (server.socks_username == nil) and "" or + server.socks_username, + pass = (server.socks_password == nil) and "" or + server.socks_password + } + } + } +elseif server.protocol == "http" then + settings = { + allowTransparent = false, + accounts = { + { + user = (server.http_username == nil) and "" or + server.http_username, + pass = (server.http_password == nil) and "" or + server.http_password + } + } + } +elseif server.protocol == "shadowsocks" then + settings = { + method = server.ss_method, + password = server.ss_password, + level = tonumber(server.ss_level), + network = server.ss_network, + ota = (server.ss_ota == '1') and true or false + } +end + +if server.accept_lan == nil or server.accept_lan == "0" then + routing = { + domainStrategy = "IPOnDemand", + rules = { + { + type = "field", + ip = {"10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"}, + outboundTag = "blocked" + } + } + } +end + +local v2ray = { + log = { + -- error = "/var/log/v2ray.log", + loglevel = "warning" + }, + -- 传入连接 + inbound = { + listen = (server.bind_local == "1") and "127.0.0.1" or nil, + port = tonumber(server.port), + protocol = server.protocol, + -- 底层传输配置 + settings = settings, + streamSettings = (server.protocol == "vmess") and { + network = server.transport, + security = (server.tls_enable == '1') and "tls" or "none", + tlsSettings = (server.tls_enable == '1') and { + -- serverName = (server.tls_serverName), + allowInsecure = false, + disableSystemRoot = false, + certificates = { + { + certificateFile = server.tls_certificateFile, + keyFile = server.tls_keyFile + } + } + } or nil, + kcpSettings = (server.transport == "mkcp") and { + mtu = tonumber(server.mkcp_mtu), + tti = tonumber(server.mkcp_tti), + uplinkCapacity = tonumber(server.mkcp_uplinkCapacity), + downlinkCapacity = tonumber(server.mkcp_downlinkCapacity), + congestion = (server.mkcp_congestion == "1") and true or false, + readBufferSize = tonumber(server.mkcp_readBufferSize), + writeBufferSize = tonumber(server.mkcp_writeBufferSize), + header = {type = server.mkcp_guise} + } or nil, + wsSettings = (server.transport == "ws") and { + headers = (server.ws_host) and {Host = server.ws_host} or nil, + path = server.ws_path + } or nil, + httpSettings = (server.transport == "h2") and + {path = server.h2_path, host = server.h2_host} or nil, + quicSettings = (server.transport == "quic") and { + security = server.quic_security, + key = server.quic_key, + header = {type = server.quic_guise} + } or nil + } or nil + }, + -- 传出连接 + outbound = {protocol = "freedom"}, + -- 额外传出连接 + outboundDetour = {{protocol = "blackhole", tag = "blocked"}}, + routing = routing +} +print(json.stringify(v2ray, 1)) diff --git a/package/lean/luci-app-v2ray-server/luasrc/model/cbi/v2ray_server/api/v2ray.lua b/package/lean/luci-app-v2ray-server/luasrc/model/cbi/v2ray_server/api/v2ray.lua new file mode 100644 index 00000000000000..69b93b3204b4d7 --- /dev/null +++ b/package/lean/luci-app-v2ray-server/luasrc/model/cbi/v2ray_server/api/v2ray.lua @@ -0,0 +1,328 @@ +module("luci.model.cbi.v2ray_server.api.v2ray", package.seeall) +local fs = require "nixio.fs" +local sys = require "luci.sys" +local uci = require"luci.model.uci".cursor() +local util = require "luci.util" +local i18n = require "luci.i18n" +local ipkg = require "luci.model.ipkg" + +local appname = "v2ray_server" +local v2ray_api = + "https://api.github.com/repos/v2ray/v2ray-core/releases/latest" +local wget = "/usr/bin/wget" +local wget_args = { + "--no-check-certificate", "--quiet", "--timeout=100", "--tries=3" +} +local command_timeout = 300 + +local LEDE_BOARD = nil +local DISTRIB_TARGET = nil +local is_armv7 = false + +local function _unpack(t, i) + i = i or 1 + if t[i] ~= nil then return t[i], _unpack(t, i + 1) end +end + +local function exec(cmd, args, writer, timeout) + local os = require "os" + local nixio = require "nixio" + + local fdi, fdo = nixio.pipe() + local pid = nixio.fork() + + if pid > 0 then + fdo:close() + + if writer or timeout then + local starttime = os.time() + while true do + if timeout and os.difftime(os.time(), starttime) >= timeout then + nixio.kill(pid, nixio.const.SIGTERM) + return 1 + end + + if writer then + local buffer = fdi:read(2048) + if buffer and #buffer > 0 then + writer(buffer) + end + end + + local wpid, stat, code = nixio.waitpid(pid, "nohang") + + if wpid and stat == "exited" then return code end + + if not writer and timeout then nixio.nanosleep(1) end + end + else + local wpid, stat, code = nixio.waitpid(pid) + return wpid and stat == "exited" and code + end + elseif pid == 0 then + nixio.dup(fdo, nixio.stdout) + fdi:close() + fdo:close() + nixio.exece(cmd, args, nil) + nixio.stdout:close() + os.exit(1) + end +end + +local function compare_versions(ver1, comp, ver2) + local table = table + + local av1 = util.split(ver1, "[%.%-]", nil, true) + local av2 = util.split(ver2, "[%.%-]", nil, true) + + local max = table.getn(av1) + local n2 = table.getn(av2) + if (max < n2) then max = n2 end + + for i = 1, max, 1 do + local s1 = av1[i] or "" + local s2 = av2[i] or "" + + if comp == "~=" and (s1 ~= s2) then return true end + if (comp == "<" or comp == "<=") and (s1 < s2) then return true end + if (comp == ">" or comp == ">=") and (s1 > s2) then return true end + if (s1 ~= s2) then return false end + end + + return not (comp == "<" or comp == ">") +end + +local function auto_get_arch() + local arch = nixio.uname().machine or "" + if fs.access("/usr/lib/os-release") then + LEDE_BOARD = sys.exec( + "echo -n `grep 'LEDE_BOARD' /usr/lib/os-release | awk -F '[\\042\\047]' '{print $2}'`") + end + if fs.access("/etc/openwrt_release") then + DISTRIB_TARGET = sys.exec( + "echo -n `grep 'DISTRIB_TARGET' /etc/openwrt_release | awk -F '[\\042\\047]' '{print $2}'`") + end + + if arch == "mips" then + if LEDE_BOARD and LEDE_BOARD ~= "" then + if string.match(LEDE_BOARD, "ramips") == "ramips" then + arch = "ramips" + else + arch = sys.exec("echo '" .. LEDE_BOARD .. + "' | grep -oE 'ramips|ar71xx'") + end + elseif DISTRIB_TARGET and DISTRIB_TARGET ~= "" then + if string.match(DISTRIB_TARGET, "ramips") == "ramips" then + arch = "ramips" + else + arch = sys.exec("echo '" .. DISTRIB_TARGET .. + "' | grep -oE 'ramips|ar71xx'") + end + end + end + + return util.trim(arch) +end + +local function get_file_info(arch) + local file_tree = "" + local sub_version = "" + + if arch == "x86_64" then + file_tree = "64" + elseif arch == "aarch64" then + file_tree = "arm64" + elseif arch == "ramips" then + file_tree = "mipsle" + elseif arch == "ar71xx" then + file_tree = "mips" + elseif arch:match("^i[%d]86$") then + file_tree = "32" + elseif arch:match("^armv[5-8]") then + file_tree = "arm" + sub_version = arch:match("[5-8]") + if LEDE_BOARD and string.match(LEDE_BOARD, "bcm53xx") == "bcm53xx" then + sub_version = "5" + elseif DISTRIB_TARGET and string.match(DISTRIB_TARGET, "bcm53xx") == + "bcm53xx" then + sub_version = "5" + end + sub_version = "5" + if sub_version == "7" then is_armv7 = true end + end + + return file_tree, sub_version +end + +local function get_api_json(url) + local jsonc = require "luci.jsonc" + + local output = {} + -- exec(wget, { "-O-", url, _unpack(wget_args) }, + -- function(chunk) output[#output + 1] = chunk end) + -- local json_content = util.trim(table.concat(output)) + + local json_content = luci.sys.exec(wget .. + " --no-check-certificate --timeout=10 -t 1 -O- " .. + url) + + if json_content == "" then return {} end + + return jsonc.parse(json_content) or {} +end + +function get_v2ray_file_path() return "/usr/bin/v2ray" end + +function get_v2ray_version() + if get_v2ray_file_path() and get_v2ray_file_path() ~= "" then + if fs.access(get_v2ray_file_path() .. "/v2ray") then + return luci.sys.exec("echo -n `" .. get_v2ray_file_path() .. + "/v2ray -version | awk '{print $2}' | sed -n 1P" .. + "`") + end + end + return "" +end + +function to_check(arch) + if not arch or arch == "" then arch = auto_get_arch() end + + local file_tree, sub_version = get_file_info(arch) + + if file_tree == "" then + return { + code = 1, + error = i18n.translate( + "Can't determine ARCH, or ARCH not supported.") + } + end + + local json = get_api_json(v2ray_api) + + if json.tag_name == nil then + return { + code = 1, + error = i18n.translate("Get remote version info failed.") + } + end + + local remote_version = json.tag_name:match("[^v]+") + local needs_update = compare_versions(get_v2ray_version(), "<", + remote_version) + local html_url, download_url + + if needs_update then + html_url = json.html_url + for _, v in ipairs(json.assets) do + if v.name and v.name:match("linux%-" .. file_tree) then + download_url = v.browser_download_url + break + end + end + end + + if needs_update and not download_url then + return { + code = 1, + now_version = get_v2ray_version(), + version = remote_version, + html_url = html_url, + error = i18n.translate( + "New version found, but failed to get new version download url.") + } + end + + return { + code = 0, + update = needs_update, + now_version = get_v2ray_version(), + version = remote_version, + url = {html = html_url, download = download_url} + } +end + +function to_download(url) + if not url or url == "" then + return {code = 1, error = i18n.translate("Download url is required.")} + end + + sys.call("/bin/rm -f /tmp/v2ray_download.*") + + local tmp_file = util.trim(util.exec("mktemp -u -t v2ray_download.XXXXXX")) + + local result = exec(wget, {"-O", tmp_file, url, _unpack(wget_args)}, nil, + command_timeout) == 0 + + if not result then + exec("/bin/rm", {"-f", tmp_file}) + return { + code = 1, + error = i18n.translatef("File download failed or timed out: %s", url) + } + end + + return {code = 0, file = tmp_file} +end + +function to_extract(file, subfix) + local isinstall_unzip = ipkg.installed("unzip") + if isinstall_unzip == nil then + ipkg.update() + ipkg.install("unzip") + end + + if not file or file == "" or not fs.access(file) then + return {code = 1, error = i18n.translate("File path required.")} + end + + sys.call("/bin/rm -rf /tmp/v2ray_extract.*") + local tmp_dir = util.trim(util.exec("mktemp -d -t v2ray_extract.XXXXXX")) + + local output = {} + exec("/usr/bin/unzip", {"-o", file, "-d", tmp_dir}, + function(chunk) output[#output + 1] = chunk end) + + local files = util.split(table.concat(output)) + + exec("/bin/rm", {"-f", file}) + + return {code = 0, file = tmp_dir} +end + +function to_move(file) + if not file or file == "" then + sys.call("/bin/rm -rf /tmp/v2ray_extract.*") + return {code = 1, error = i18n.translate("Client file is required.")} + end + + local client_file = get_v2ray_file_path() + + sys.call("mkdir -p " .. client_file) + + if not arch or arch == "" then arch = auto_get_arch() end + local file_tree, sub_version = get_file_info(arch) + local result = nil + if is_armv7 and is_armv7 == true then + result = exec("/bin/mv", { + "-f", file .. "/v2ray_armv7", file .. "/v2ctl_armv7", client_file + }, nil, command_timeout) == 0 + else + result = exec("/bin/mv", + {"-f", file .. "/v2ray", file .. "/v2ctl", client_file}, + nil, command_timeout) == 0 + end + if not result or not fs.access(client_file) then + sys.call("/bin/rm -rf /tmp/v2ray_extract.*") + return { + code = 1, + error = i18n.translatef("Can't move new file to path: %s", + client_file) + } + end + + exec("/bin/chmod", {"-R", "755", client_file}) + + sys.call("/bin/rm -rf /tmp/v2ray_extract.*") + + return {code = 0} +end diff --git a/package/lean/luci-app-v2ray-server/luasrc/model/cbi/v2ray_server/config.lua b/package/lean/luci-app-v2ray-server/luasrc/model/cbi/v2ray_server/config.lua new file mode 100644 index 00000000000000..2ce656edeb2263 --- /dev/null +++ b/package/lean/luci-app-v2ray-server/luasrc/model/cbi/v2ray_server/config.lua @@ -0,0 +1,238 @@ +local app_name = "v2ray_server" +local d = require "luci.dispatcher" + +local header_type = {"none", "srtp", "utp", "wechat-video", "dtls", "wireguard"} + +map = Map(app_name, "V2ray " .. translate("Server Config")) +map.redirect = d.build_url("admin", "vpn", "v2ray_server") + +t = map:section(NamedSection, arg[1], "user", "") +t.addremove = false +t.dynamic = false + +enable = t:option(Flag, "enable", translate("Enable")) +enable.default = "1" +enable.rmempty = false + +remarks = t:option(Value, "remarks", translate("Remarks")) +remarks.default = translate("Remarks") +remarks.rmempty = false + +bind_local = t:option(Flag, "bind_local", translate("Bind Local"), translate( + "When selected, it can only be accessed locally,It is recommended to turn on when using reverse proxies.")) +bind_local.default = "0" +bind_local.rmempty = false + +port = t:option(Value, "port", translate("Port")) +port.datatype = "port" +port.rmempty = false + +protocol = t:option(ListValue, "protocol", translate("Protocol")) +protocol:value("vmess", translate("Vmess")) +protocol:value("socks", translate("Socks")) +protocol:value("http",translate("Http")) +protocol:value("shadowsocks", translate("Shadowsocks")) + +socks_username = t:option(Value, "socks_username", translate("User name")) +socks_username.rmempty = true +socks_username:depends("protocol", "socks") + +socks_password = t:option(Value, "socks_password", translate("Password")) +socks_password.rmempty = true +socks_password.password = true +socks_password:depends("protocol", "socks") + +http_username = t:option(Value, "http_username", translate("User name")) +http_username.rmempty = true +http_username:depends("protocol", "http") + +http_password = t:option(Value, "http_password", translate("Password")) +http_password.rmempty = true +http_password.password = true +http_password:depends("protocol", "http") + +ss_method = t:option(ListValue, "ss_method", translate("Encrypt Method")) +ss_method:value("aes-128-cfb") +ss_method:value("aes-256-cfb") +ss_method:value("aes-128-gcm") +ss_method:value("aes-256-gcm") +ss_method:value("chacha20") +ss_method:value("chacha20-ietf") +ss_method:value("chacha20-poly1305") +ss_method:value("chacha20-ietf-poly1305") +ss_method:depends("protocol", "shadowsocks") + +ss_password = t:option(Value, "ss_password", translate("Password")) +ss_password:depends("protocol", "shadowsocks") + +ss_level = t:option(Value, "ss_level", translate("User Level")) +ss_level.default = 1 +ss_level:depends("protocol", "shadowsocks") + +ss_network = t:option(ListValue, "ss_network", translate("Transport")) +ss_network.default = "tcp,udp" +ss_network:value("tcp", "TCP") +ss_network:value("udp", "UDP") +ss_network:value("tcp,udp", "TCP,UDP") +ss_network:depends("protocol", "shadowsocks") + +ss_ota = t:option(Flag, "ss_ota", translate("OTA"), translate( + "When OTA is enabled, V2Ray will reject connections that are not OTA enabled. This option is invalid when using AEAD encryption.")) +ss_ota.default = "0" +ss_ota:depends("protocol", "shadowsocks") + +VMess_id = t:option(DynamicList, "VMess_id", translate("ID")) +for i = 1, 3 do + local uuid = luci.sys.exec("cat /proc/sys/kernel/random/uuid") + VMess_id:value(uuid) +end +VMess_id:depends("protocol", "vmess") + +VMess_alterId = t:option(Value, "VMess_alterId", translate("Alter ID")) +VMess_alterId.default = 16 +VMess_alterId:depends("protocol", "vmess") + +VMess_level = t:option(Value, "VMess_level", translate("User Level")) +VMess_level.default = 1 +VMess_level:depends("protocol", "vmess") + +transport = t:option(ListValue, "transport", translate("Transport")) +transport:value("tcp", "TCP") +transport:value("mkcp", "mKCP") +transport:value("ws", "WebSocket") +transport:value("h2", "HTTP/2") +transport:value("quic", "QUIC") +transport:depends("protocol", "vmess") + +-- [[ TCP部分 ]]-- +-- TCP伪装 +tcp_guise = t:option(ListValue, "tcp_guise", translate("Camouflage Type")) +tcp_guise:depends("transport", "tcp") +tcp_guise:value("none", "none") +tcp_guise:value("http", "http") + +-- HTTP域名 +tcp_guise_http_host = t:option(DynamicList, "tcp_guise_http_host", + translate("HTTP Host")) +tcp_guise_http_host:depends("tcp_guise", "http") + +-- HTTP路径 +tcp_guise_http_path = t:option(DynamicList, "tcp_guise_http_path", + translate("HTTP Path")) +tcp_guise_http_path:depends("tcp_guise", "http") + +-- [[ mKCP部分 ]]-- +mkcp_guise = t:option(ListValue, "mkcp_guise", translate("Camouflage Type"), + translate( + '
none: default, no masquerade, data sent is packets with no characteristics.
srtp: disguised as an SRTP packet, it will be recognized as video call data (such as FaceTime).
utp: packets disguised as uTP will be recognized as bittorrent downloaded data.
wechat-video: packets disguised as WeChat video calls.
dtls: disguised as DTLS 1.2 packet.
wireguard: disguised as a WireGuard packet. (not really WireGuard protocol)')) +for a, t in ipairs(header_type) do mkcp_guise:value(t) end +mkcp_guise:depends("transport", "mkcp") + +mkcp_mtu = t:option(Value, "mkcp_mtu", translate("KCP MTU")) +mkcp_mtu:depends("transport", "mkcp") + +mkcp_tti = t:option(Value, "mkcp_tti", translate("KCP TTI")) +mkcp_tti:depends("transport", "mkcp") + +mkcp_uplinkCapacity = t:option(Value, "mkcp_uplinkCapacity", + translate("KCP uplinkCapacity")) +mkcp_uplinkCapacity:depends("transport", "mkcp") + +mkcp_downlinkCapacity = t:option(Value, "mkcp_downlinkCapacity", + translate("KCP downlinkCapacity")) +mkcp_downlinkCapacity:depends("transport", "mkcp") + +mkcp_congestion = t:option(Flag, "mkcp_congestion", translate("KCP Congestion")) +mkcp_congestion:depends("transport", "mkcp") + +mkcp_readBufferSize = t:option(Value, "mkcp_readBufferSize", + translate("KCP readBufferSize")) +mkcp_readBufferSize:depends("transport", "mkcp") + +mkcp_writeBufferSize = t:option(Value, "mkcp_writeBufferSize", + translate("KCP writeBufferSize")) +mkcp_writeBufferSize:depends("transport", "mkcp") + +-- [[ WebSocket部分 ]]-- +ws_path = t:option(Value, "ws_path", translate("WebSocket Path")) +ws_path:depends("transport", "ws") + +ws_host = t:option(Value, "ws_host", translate("WebSocket Host")) +ws_host:depends("transport", "ws") + +-- [[ HTTP/2部分 ]]-- +h2_path = t:option(Value, "h2_path", translate("HTTP/2 Path")) +h2_path:depends("transport", "h2") + +h2_host = t:option(DynamicList, "h2_host", translate("HTTP/2 Host"), + translate("Camouflage Domain,you can not fill in")) +h2_host:depends("transport", "h2") + +-- [[ QUIC部分 ]]-- +quic_security = + t:option(ListValue, "quic_security", translate("Encrypt Method")) +quic_security:value("none") +quic_security:value("aes-128-gcm") +quic_security:value("chacha20-poly1305") +quic_security:depends("transport", "quic") + +quic_key = t:option(Value, "quic_key", + translate("Encrypt Method") .. translate("Key")) +quic_key:depends("transport", "quic") + +quic_guise = t:option(ListValue, "quic_guise", translate("Camouflage Type")) +for a, t in ipairs(header_type) do quic_guise:value(t) end +quic_guise:depends("transport", "quic") + +-- [[ TLS部分 ]] -- +tls_enable = t:option(Flag, "tls_enable", translate("Use HTTPS")) +tls_enable:depends("transport", "ws") +tls_enable:depends("transport", "h2") +tls_enable.default = "1" +tls_enable.rmempty = false + +-- tls_serverName = t:option(Value, "tls_serverName", translate("Domain")) +-- tls_serverName:depends("transport", "ws") +-- tls_serverName:depends("transport", "h2") + +tls_certificateFile = t:option(Value, "tls_certificateFile", + translate("Public key absolute path"), + translate("as:") .. "/etc/ssl/fullchain.pem") +tls_certificateFile:depends("tls_enable", 1) + +tls_keyFile = t:option(Value, "tls_keyFile", + translate("Private key absolute path"), + translate("as:") .. "/etc/ssl/private.key") +tls_keyFile:depends("tls_enable", 1) + +accept_lan = t:option(Flag, "accept_lan", translate("Accept LAN Access"), + translate( + "When selected, it can accessed lan , this will not be safe!")) +accept_lan.default = "0" +accept_lan.rmempty = false + +function rmempty_restore() + VMess_id.rmempty = true + VMess_alterId.rmempty = true + socks_username.rmempty = true + socks_password.rmempty = true + ss_password.rmempty = true + ss_ota.rmempty = true +end + +protocol.validate = function(self, value) + rmempty_restore() + if value == "vmess" then + VMess_id.rmempty = false + VMess_alterId.rmempty = false + elseif value == "socks" then + socks_username.rmempty = true + socks_password.rmempty = true + elseif value == "shadowsocks" then + ss_password.rmempty = false + ss_ota.rmempty = false + end + return value +end + +return map diff --git a/package/lean/luci-app-v2ray-server/luasrc/model/cbi/v2ray_server/index.lua b/package/lean/luci-app-v2ray-server/luasrc/model/cbi/v2ray_server/index.lua new file mode 100644 index 00000000000000..395a0f31edff5c --- /dev/null +++ b/package/lean/luci-app-v2ray-server/luasrc/model/cbi/v2ray_server/index.lua @@ -0,0 +1,107 @@ +local i = require "luci.dispatcher" +local e = require "nixio.fs" +local e = require "luci.sys" +local e = luci.model.uci.cursor() +local o = "v2ray_server" + +m = Map(o, translate("V2ray Server")) + +t = m:section(TypedSection, "global", translate("Global Settings")) +t.anonymous = true +t.addremove = false +e = t:option(Flag, "enable", translate("Enable")) +e.rmempty = false +t:append(Template("v2ray_server/v2ray")) + +t = m:section(TypedSection, "user", translate("Users Manager")) +t.anonymous = true +t.addremove = true +t.template = "cbi/tblsection" +t.extedit = i.build_url("admin", "vpn", o, "config", "%s") +function t.create(t, e) + local e = TypedSection.create(t, e) + luci.http.redirect(i.build_url("admin", "vpn", o, "config", e)) +end +function t.remove(t, a) + t.map.proceed = true + t.map:del(a) + luci.http.redirect(i.build_url("admin", "vpn", o)) +end +e = t:option(Flag, "enable", translate("Enable")) +e.width = "5%" +e.rmempty = false +e = t:option(DummyValue, "status", translate("Status")) +e.template = "v2ray_server/users_status" +e.value = translate("Collecting data...") +e = t:option(DummyValue, "remarks", translate("Remarks")) +e.width = "15%" +e = t:option(DummyValue, "port", translate("Port")) +e.width = "10%" +e = t:option(DummyValue, "protocol", translate("Protocol")) +e.width = "15%" +e.cfgvalue = function(self, section) + local str = "未知" + local protocol = m:get(section, "protocol") or "" + if protocol ~= "" then str = (protocol:gsub("^%l", string.upper)) end + return str +end +e = t:option(DummyValue, "transport", translate("Transport")) +e.width = "10%" +e.cfgvalue = function(self, section) + local t = "未知" + local b = "" + local protocol = m:get(section, "protocol") or "" + if protocol == "vmess" then + b = "transport" + elseif protocol == "shadowsocks" then + b = "ss_network" + end + local a = m:get(section, b) or "" + if a == "tcp" then + t = "TCP" + elseif a == "udp" then + t = "UDP" + elseif a == "tcp,udp" then + t = "TCP,UDP" + elseif a == "mkcp" then + t = "mKCP" + elseif a == "ws" then + t = "WebSocket" + elseif a == "h2" then + t = "HTTP/2" + elseif a == "quic" then + t = "QUIC" + else + t = "TCP,UDP" + end + return t +end +e = t:option(DummyValue, "password", translate("Password")) +e.width = "30%" +e.cfgvalue = function(self, section) + local e = "" + local protocol = m:get(section, "protocol") or "" + if protocol == "vmess" then + e = "VMess_id" + elseif protocol == "shadowsocks" then + e = "ss_password" + elseif protocol == "socks" then + e = "socks_password" + elseif protocol == "http" then + e = "http_password" + end + local e = m:get(section, e) or "" + local t = "" + if type(e) == "table" then + for a = 1, #e do t = t .. e[a] end + else + t = e + end + return t +end + +m:append(Template("v2ray_server/log")) + +m:append(Template("v2ray_server/users_list_status")) +return m + diff --git a/package/lean/luci-app-v2ray-server/luasrc/view/v2ray_server/log.htm b/package/lean/luci-app-v2ray-server/luasrc/view/v2ray_server/log.htm new file mode 100644 index 00000000000000..fbdd2289b242aa --- /dev/null +++ b/package/lean/luci-app-v2ray-server/luasrc/view/v2ray_server/log.htm @@ -0,0 +1,31 @@ + +
+ + <%:Logs%> + + + +
\ No newline at end of file diff --git a/package/lean/luci-app-v2ray-server/luasrc/view/v2ray_server/users_list_status.htm b/package/lean/luci-app-v2ray-server/luasrc/view/v2ray_server/users_list_status.htm new file mode 100644 index 00000000000000..09508aa72e19c6 --- /dev/null +++ b/package/lean/luci-app-v2ray-server/luasrc/view/v2ray_server/users_list_status.htm @@ -0,0 +1,23 @@ +<% +local dsp = require "luci.dispatcher" +-%> + + \ No newline at end of file diff --git a/package/lean/luci-app-v2ray-server/luasrc/view/v2ray_server/users_status.htm b/package/lean/luci-app-v2ray-server/luasrc/view/v2ray_server/users_status.htm new file mode 100644 index 00000000000000..40c2e3c58c48ff --- /dev/null +++ b/package/lean/luci-app-v2ray-server/luasrc/view/v2ray_server/users_status.htm @@ -0,0 +1,3 @@ +<%+cbi/valueheader%> +-- +<%+cbi/valuefooter%> \ No newline at end of file diff --git a/package/lean/luci-app-v2ray-server/luasrc/view/v2ray_server/v2ray.htm b/package/lean/luci-app-v2ray-server/luasrc/view/v2ray_server/v2ray.htm new file mode 100644 index 00000000000000..acfa3023a0330a --- /dev/null +++ b/package/lean/luci-app-v2ray-server/luasrc/view/v2ray_server/v2ray.htm @@ -0,0 +1,182 @@ +<% +local v2ray_version=luci.sys.exec("[ -f '/usr/bin/v2ray/v2ray' ] && /usr/bin/v2ray/v2ray -version | awk '{print $2}' | sed -n 1P") +local dsp = require "luci.dispatcher" +-%> + + + +
+ +
+
+ 【 <%=v2ray_version%>】 + + +
+
+
\ No newline at end of file diff --git a/package/lean/luci-app-v2ray-server/po/zh-cn/v2ray_server.po b/package/lean/luci-app-v2ray-server/po/zh-cn/v2ray_server.po new file mode 100644 index 00000000000000..04f53127862b21 --- /dev/null +++ b/package/lean/luci-app-v2ray-server/po/zh-cn/v2ray_server.po @@ -0,0 +1,101 @@ +msgid "V2ray Server" +msgstr "V2ray 服务器" + +msgid "Global Settings" +msgstr "全局设置" + +msgid "Server Config" +msgstr "服务器配置" + +msgid "Users Manager" +msgstr "用户管理" + +msgid "Remarks" +msgstr "备注" + +msgid "Bind Local" +msgstr "本机监听" + +msgid "When selected, it can only be accessed locally,It is recommended to turn on when using reverse proxies." +msgstr "当勾选时,只能由本机访问此端口,当开启反向代理时建议勾选此项。" + +msgid "Port" +msgstr "端口" + +msgid "User name" +msgstr "用户名" + +msgid "Password" +msgstr "密码" + +msgid "Protocol" +msgstr "协议" + +msgid "Null" +msgstr "无" + +msgid "Alter ID" +msgstr "额外ID(AlterID)" + +msgid "User Level" +msgstr "用户等级(Level)" + +msgid "When OTA is enabled, V2Ray will reject connections that are not OTA enabled. This option is invalid when using AEAD encryption." +msgstr "开启 OTA 后,V2Ray 会拒绝未启用 OTA 的连接。当使用 AEAD 加密时,该选项无效。" + +msgid "Transport" +msgstr "传输方式" + +msgid "Camouflage Type" +msgstr "伪装类型" + +msgid "Camouflage Domain,you can not fill in" +msgstr "伪装域名,也可以不填写" + +msgid "can not has conflict" +msgstr "请不要冲突" + +msgid "Use HTTPS" +msgstr "使用HTTPS" + +msgid "TLS Settings" +msgstr "TLS配置" + +msgid "as:" +msgstr "如:" + +msgid "Public key absolute path" +msgstr "公钥文件绝对路径" + +msgid "Private key absolute path" +msgstr "私钥文件绝对路径" + +msgid "
none: default, no masquerade, data sent is packets with no characteristics.
srtp: disguised as an SRTP packet, it will be recognized as video call data (such as FaceTime).
utp: packets disguised as uTP will be recognized as bittorrent downloaded data.
wechat-video: packets disguised as WeChat video calls.
dtls: disguised as DTLS 1.2 packet.
wireguard: disguised as a WireGuard packet. (not really WireGuard protocol)" +msgstr "
none:默认值,不进行伪装,发送的数据是没有特征的数据包。
srtp:伪装成 SRTP 数据包,会被识别为视频通话数据(如 FaceTime)。
utp:伪装成 uTP 数据包,会被识别为 BT 下载数据。
wechat-video:伪装成微信视频通话的数据包。
dtls:伪装成 DTLS 1.2 数据包。
wireguard:伪装成 WireGuard 数据包。(并不是真正的 WireGuard 协议)" + +msgid "Accept LAN Access" +msgstr "接受局域网访问" + +msgid "When selected, it can accessed lan , this will not be safe!" +msgstr "当勾选时,可以直接访问局域网,这将不安全!(非特殊情况不建议开启)" + +msgid "Logs" +msgstr "日志" + +msgid "Clear logs" +msgstr "清空日志" + +msgid "Enabled" +msgstr "启用" + +msgid "Status" +msgstr "状态" + +msgid "Current Condition" +msgstr "当前状态" + +msgid "NOT RUNNING" +msgstr "未运行" + +msgid "RUNNING" +msgstr "运行中" \ No newline at end of file diff --git a/package/lean/luci-app-v2ray-server/root/etc/config/v2ray_server b/package/lean/luci-app-v2ray-server/root/etc/config/v2ray_server new file mode 100644 index 00000000000000..6a8bb1b8edba21 --- /dev/null +++ b/package/lean/luci-app-v2ray-server/root/etc/config/v2ray_server @@ -0,0 +1,29 @@ + +config global + option enable '0' + +config user + option enable '1' + option remarks 'tcp' + option bind_local '0' + option protocol 'vmess' + list VMess_id 'fd00927a-b0c2-4629-aef7-d9ff15a9d722' + option VMess_alterId '16' + option VMess_level '1' + option transport 'tcp' + option tcp_guise 'none' + option port '12366' + +config user + option enable '1' + option remarks 'ws' + option bind_local '0' + option protocol 'vmess' + option VMess_alterId '16' + option VMess_level '1' + list VMess_id 'fd00927a-b0c2-4629-aef7-d9ff15a9d722' + option transport 'ws' + option ws_path '/websocket' + option tls_enable '0' + option port '30010' + \ No newline at end of file diff --git a/package/lean/luci-app-v2ray-server/root/etc/init.d/v2ray_server b/package/lean/luci-app-v2ray-server/root/etc/init.d/v2ray_server new file mode 100644 index 00000000000000..86a8e043af6539 --- /dev/null +++ b/package/lean/luci-app-v2ray-server/root/etc/init.d/v2ray_server @@ -0,0 +1,59 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2018-2020 Lienol + +START=99 + +CONFIG=v2ray_server +CONFIG_PATH=/var/etc/$CONFIG +LOG_PATH=/var/log/$CONFIG +LOG_APP_FILE=$LOG_PATH/app.log + +echolog() { + echo -e "$(date "+%Y-%m-%d %H:%M:%S"): $1" >> $LOG_APP_FILE +} + +gen_v2ray_config_file() { + config_get enable $1 enable + [ "$enable" = "0" ] && return 0 + config_get remarks $1 remarks + config_get port $1 port + config_get transport $1 transport + lua /usr/lib/lua/luci/model/cbi/v2ray_server/api/genv2rayconfig.lua $1 > $CONFIG_PATH/$1.json + echolog "$remarks $port 生成并运行 V2ray 配置文件 - $CONFIG_PATH/$1.json" + [ -f /var/v2server ] || cp -a /usr/bin/v2ray/v2ray /var/v2server + /var/v2server -config $CONFIG_PATH/$1.json >/dev/null 2>&1 & +} + +start_v2ray_server() { + mkdir -p $CONFIG_PATH $LOG_PATH + touch $LOG_APP_FILE + config_foreach gen_v2ray_config_file "user" + fw3 reload > /dev/null 2>&1 +} + +stop_v2ray_server() { + fw3 reload > /dev/null 2>&1 + ps -w | grep "$CONFIG_PATH/" | grep -v "grep" | awk '{print $1}' | xargs kill -9 >/dev/null 2>&1 & + rm -rf $CONFIG_PATH + rm -rf $LOG_PATH +} + +start() { + config_load $CONFIG + enable=$(uci get $CONFIG.@global[0].enable) + if [ "$enable" = "0" ];then + stop_v2ray_server + else + start_v2ray_server + fi +} + +stop() { + stop_v2ray_server +} + +restart() { + stop + sleep 1 + start +} \ No newline at end of file diff --git a/package/lean/luci-app-v2ray-server/root/etc/uci-defaults/luci-app-v2ray-server b/package/lean/luci-app-v2ray-server/root/etc/uci-defaults/luci-app-v2ray-server new file mode 100644 index 00000000000000..31fbc65ef45dd9 --- /dev/null +++ b/package/lean/luci-app-v2ray-server/root/etc/uci-defaults/luci-app-v2ray-server @@ -0,0 +1,21 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete firewall.v2ray_server + set firewall.v2ray_server=include + set firewall.v2ray_server.type=script + set firewall.v2ray_server.path=/usr/share/v2ray_server/firewall.include + set firewall.v2ray_server.reload=1 +EOF + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@v2ray_server[-1] + add ucitrack v2ray_server + set ucitrack.@v2ray_server[-1].init=v2ray_server + commit ucitrack +EOF + +chmod a+x /usr/share/v2ray_server/* >/dev/null 2>&1 + +rm -rf /tmp/luci-* +exit 0 diff --git a/package/lean/luci-app-v2ray-server/root/usr/share/v2ray_server/firewall.include b/package/lean/luci-app-v2ray-server/root/usr/share/v2ray_server/firewall.include new file mode 100644 index 00000000000000..694442a5255a99 --- /dev/null +++ b/package/lean/luci-app-v2ray-server/root/usr/share/v2ray_server/firewall.include @@ -0,0 +1,29 @@ +#!/bin/sh + +. $IPKG_INSTROOT/lib/functions.sh +. $IPKG_INSTROOT/lib/functions/service.sh + +gen_user_iptables() { + config_get enable $1 enable + [ "$enable" = "0" ] && return 0 + config_get remarks $1 remarks + config_get bind_local $1 bind_local + config_get port $1 port + dport=$port + [ "$bind_local" != "1" ] && { + iptables -A V2RAY-SERVER -p tcp --dport $dport -m comment --comment "$remarks" -j ACCEPT + iptables -A V2RAY-SERVER -p udp --dport $dport -m comment --comment "$remarks" -j ACCEPT + } +} + +iptables -F V2RAY-SERVER 2>/dev/null +iptables -D INPUT -j V2RAY-SERVER 2>/dev/null +iptables -X V2RAY-SERVER 2>/dev/null + +enable=$(uci get v2ray_server.@global[0].enable) +if [ $enable -eq 1 ]; then + iptables -N V2RAY-SERVER + iptables -I INPUT -j V2RAY-SERVER + config_load v2ray_server + config_foreach gen_user_iptables "user" +fi \ No newline at end of file diff --git a/package/lean/luci-app-verysync/Makefile b/package/lean/luci-app-verysync/Makefile new file mode 100644 index 00000000000000..7c37c8d84592cd --- /dev/null +++ b/package/lean/luci-app-verysync/Makefile @@ -0,0 +1,16 @@ +# Copyright (C) 2016 Openwrt.org +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI support for Verysync +LUCI_DEPENDS:=+verysync +LUCI_PKGARCH:=all +PKG_VERSION:=1.0 +PKG_RELEASE:=4 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/package/lean/luci-app-verysync/luasrc/controller/verysync.lua b/package/lean/luci-app-verysync/luasrc/controller/verysync.lua new file mode 100644 index 00000000000000..04518d5bbf0284 --- /dev/null +++ b/package/lean/luci-app-verysync/luasrc/controller/verysync.lua @@ -0,0 +1,17 @@ +module("luci.controller.verysync", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/verysync") then + return + end + + entry({"admin", "nas", "verysync"}, cbi("verysync"), _("Verysync"), 10).dependent = true + entry({"admin","nas","verysync","status"},call("act_status")).leaf=true +end + +function act_status() + local e={} + e.running=luci.sys.call("pgrep verysync >/dev/null")==0 + luci.http.prepare_content("application/json") + luci.http.write_json(e) +end diff --git a/package/lean/luci-app-verysync/luasrc/model/cbi/verysync.lua b/package/lean/luci-app-verysync/luasrc/model/cbi/verysync.lua new file mode 100644 index 00000000000000..097d6f1885704d --- /dev/null +++ b/package/lean/luci-app-verysync/luasrc/model/cbi/verysync.lua @@ -0,0 +1,27 @@ +-- Copyright 2008 Yanira +-- Copyright 2020 KFERMercer +-- Licensed to the public under the Apache License 2.0. + +m = Map("verysync") +m.title = translate("Verysync") +m.description = translate("Simple and easy-to-use multi-platform file synchronization software, astonishing transmission speed is different from the greatest advantage of other products. Micro-force synchronization of intelligent P2P technology to accelerate synchronization, will split the file into several KB-only data synchronization, and the file will be AES encryption processing.") + +m:section(SimpleSection).template = "verysync/verysync_status" + +s = m:section(TypedSection, "verysync") +s.addremove = false +s.anonymous = true + +o = s:option(Flag, "enabled", translate("Enable")) +o.rmempty = false + +o = s:option(Value, "port", translate("Port")) +o.datatype = "port" +o.placeholder = "8886" +o.default = "8886" +o.rmempty = false + +o = s:option(Value, "profile", translate("Store configuration files in the Path")) +o.default = '/etc/verysync/' + +return m diff --git a/package/lean/luci-app-verysync/luasrc/view/verysync/verysync_status.htm b/package/lean/luci-app-verysync/luasrc/view/verysync/verysync_status.htm new file mode 100644 index 00000000000000..a0386ec3128aaa --- /dev/null +++ b/package/lean/luci-app-verysync/luasrc/view/verysync/verysync_status.htm @@ -0,0 +1,33 @@ + + +
+

+ <%:Collecting data...%> +

+
diff --git a/package/lean/luci-app-verysync/po/zh-cn/verysync.po b/package/lean/luci-app-verysync/po/zh-cn/verysync.po new file mode 100644 index 00000000000000..647e401ff45923 --- /dev/null +++ b/package/lean/luci-app-verysync/po/zh-cn/verysync.po @@ -0,0 +1,11 @@ +msgid "Verysync" +msgstr "微力同步" + +msgid "Simple and easy-to-use multi-platform file synchronization software, astonishing transmission speed is different from the greatest advantage of other products. Micro-force synchronization of intelligent P2P technology to accelerate synchronization, will split the file into several KB-only data synchronization, and the file will be AES encryption processing." +msgstr "简单易用的多平台文件同步软件, 惊人的传输速度是不同于其他产品的最大优势. 微力同步的智能 P2P 加速同步技术会将文件分割成若干份仅 KB 的数据进行传输, 同时会使用 AES 加密处理." + +msgid "Open Verysync page" +msgstr "打开微力同步页面" + +msgid "Store configuration files in the Path" +msgstr "配置文件存放路径" diff --git a/package/lean/luci-app-verysync/root/etc/config/verysync b/package/lean/luci-app-verysync/root/etc/config/verysync new file mode 100644 index 00000000000000..7d6720ee2b23a7 --- /dev/null +++ b/package/lean/luci-app-verysync/root/etc/config/verysync @@ -0,0 +1,2 @@ + +config verysync 'config' diff --git a/package/lean/luci-app-verysync/root/etc/init.d/verysync b/package/lean/luci-app-verysync/root/etc/init.d/verysync new file mode 100644 index 00000000000000..146ddc35068cfc --- /dev/null +++ b/package/lean/luci-app-verysync/root/etc/init.d/verysync @@ -0,0 +1,18 @@ +#!/bin/sh /etc/rc.common + +START=50 +STOP=10 + +start() { + local enabled="$(uci get verysync.config.enabled)" + local port="$(uci get verysync.config.port)" + local profile="$(uci get verysync.config.profile)" + stop + [ "${enabled}" == "1" ] || exit 0 + export HOME="/root/" + verysync -gui-address="0.0.0.0:${port}" -logfile="/var/log/verysync.log" -home="${profile}" -no-browser >/dev/null 2>&1 & +} + +stop() { + kill -9 `pgrep verysync` >/dev/null 2>&1 +} diff --git a/package/lean/luci-app-verysync/root/etc/uci-defaults/luci-verysync b/package/lean/luci-app-verysync/root/etc/uci-defaults/luci-verysync new file mode 100644 index 00000000000000..52e9dbffcd415c --- /dev/null +++ b/package/lean/luci-app-verysync/root/etc/uci-defaults/luci-verysync @@ -0,0 +1,11 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@verysync[-1] + add ucitrack verysync + set ucitrack.@verysync[-1].init=verysync + commit ucitrack +EOF + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/package/lean/luci-app-vlmcsd/Makefile b/package/lean/luci-app-vlmcsd/Makefile new file mode 100644 index 00000000000000..2bb1feb9c06ec5 --- /dev/null +++ b/package/lean/luci-app-vlmcsd/Makefile @@ -0,0 +1,18 @@ +# +# Copyright (C) 2008-2014 The LuCI Team +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI page for KMS +LUCI_DEPENDS:=+vlmcsd +PKG_VERSION:=1.0 +PKG_RELEASE:=5 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + + diff --git a/package/lean/luci-app-vlmcsd/luasrc/controller/vlmcsd.lua b/package/lean/luci-app-vlmcsd/luasrc/controller/vlmcsd.lua new file mode 100644 index 00000000000000..f540847cbcaf41 --- /dev/null +++ b/package/lean/luci-app-vlmcsd/luasrc/controller/vlmcsd.lua @@ -0,0 +1,19 @@ +module("luci.controller.vlmcsd", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/vlmcsd") then + return + end + local page + page = entry({"admin", "services", "vlmcsd"}, cbi("vlmcsd"), _("KMS Server"), 100) + page.i18n = "vlmcsd" + page.dependent = true + entry({"admin","services","vlmcsd","status"},call("act_status")).leaf=true +end + +function act_status() + local e={} + e.running=luci.sys.call("pgrep vlmcsd >/dev/null")==0 + luci.http.prepare_content("application/json") + luci.http.write_json(e) +end diff --git a/package/lean/luci-app-vlmcsd/luasrc/model/cbi/vlmcsd.lua b/package/lean/luci-app-vlmcsd/luasrc/model/cbi/vlmcsd.lua new file mode 100644 index 00000000000000..1cb06b7cea63b9 --- /dev/null +++ b/package/lean/luci-app-vlmcsd/luasrc/model/cbi/vlmcsd.lua @@ -0,0 +1,35 @@ + + +m = Map("vlmcsd") +m.title = translate("vlmcsd config") +m.description = translate("A KMS Server Emulator to active your Windows or Office") + +m:section(SimpleSection).template = "vlmcsd/vlmcsd_status" + +s = m:section(TypedSection, "vlmcsd") +s.addremove = false +s.anonymous = true + +s:tab("basic", translate("Basic Setting")) +enable = s:taboption("basic",Flag, "enabled", translate("Enable")) +enable.rmempty = false + +autoactivate = s:taboption("basic", Flag, "autoactivate", translate("Auto activate")) +autoactivate.rmempty = false + +s:tab("config", translate("Config File")) +config = s:taboption("config", Value, "config", translate("configfile"), translate("This file is /etc/vlmcsd.ini."), "") +config.template = "cbi/tvalue" +config.rows = 13 +config.wrap = "off" + +function config.cfgvalue(self, section) + return nixio.fs.readfile("/etc/vlmcsd.ini") +end + +function config.write(self, section, value) + value = value:gsub("\r\n?", "\n") + nixio.fs.writefile("/etc/vlmcsd.ini", value) +end + +return m diff --git a/package/lean/luci-app-vlmcsd/luasrc/view/vlmcsd/vlmcsd_status.htm b/package/lean/luci-app-vlmcsd/luasrc/view/vlmcsd/vlmcsd_status.htm new file mode 100644 index 00000000000000..d711300e26d0e5 --- /dev/null +++ b/package/lean/luci-app-vlmcsd/luasrc/view/vlmcsd/vlmcsd_status.htm @@ -0,0 +1,22 @@ + + +
+

+ <%:Collecting data...%> +

+
\ No newline at end of file diff --git a/package/lean/luci-app-vlmcsd/po/zh-cn/vlmcsd.zh-cn.po b/package/lean/luci-app-vlmcsd/po/zh-cn/vlmcsd.zh-cn.po new file mode 100644 index 00000000000000..63ec520c50ce22 --- /dev/null +++ b/package/lean/luci-app-vlmcsd/po/zh-cn/vlmcsd.zh-cn.po @@ -0,0 +1,40 @@ +msgid "" +msgstr "" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgid "vlmcsd config" +msgstr "KMS 服务器设置" + +msgid "KMS Server" +msgstr "KMS 服务器" + +msgid "Basic Setting" +msgstr "基本设置" + +msgid "Config File" +msgstr "配置文件" + +msgid "A KMS Server Emulator to active your Windows or Office" +msgstr "KMS服务器可用于激活Windows或Office" + +msgid "Vlmcsd is running." +msgstr "KMS 服务器运行中" + +msgid "Vlmcsd is not running." +msgstr "KMS 服务器未运行" + +msgid "Enable" +msgstr "启用" + +msgid "Auto activate" +msgstr "自动激活局域网客户端" + +msgid "configfile" +msgstr "配置文件" + +msgid "This file is /etc/vlmcsd.ini." +msgstr "这个文件在 /etc/vlmcsd.ini 下,可以增加新的产品主密钥。" diff --git a/package/lean/luci-app-vlmcsd/root/etc/config/vlmcsd b/package/lean/luci-app-vlmcsd/root/etc/config/vlmcsd new file mode 100644 index 00000000000000..8940d0c0d3cde6 --- /dev/null +++ b/package/lean/luci-app-vlmcsd/root/etc/config/vlmcsd @@ -0,0 +1,5 @@ + +config vlmcsd 'config' + option autoactivate '1' + option enabled '1' + diff --git a/package/lean/luci-app-vlmcsd/root/etc/init.d/kms b/package/lean/luci-app-vlmcsd/root/etc/init.d/kms new file mode 100644 index 00000000000000..7878239e14f289 --- /dev/null +++ b/package/lean/luci-app-vlmcsd/root/etc/init.d/kms @@ -0,0 +1,56 @@ +#!/bin/sh /etc/rc.common +# Copyright (c) 2011-2015 OpenWrt.org + +START=90 + +get_config() { + config_get_bool enabled $1 enabled 0 + config_get autoactivate $1 autoactivate 1 +} + +add_vlmcs_entry() { + local new_hostname="$1" + + uci -q batch <<-EOF >/dev/null + add dhcp srvhost + set dhcp.@srvhost[-1].srv=_vlmcs._tcp + set dhcp.@srvhost[-1].target=$new_hostname + set dhcp.@srvhost[-1].port=1688 + set dhcp.@srvhost[-1].class=0 + set dhcp.@srvhost[-1].weight=100 + commit dhcp + EOF + + /etc/init.d/dnsmasq restart + exit 0 +} + +start() { + config_load vlmcsd + config_foreach get_config vlmcsd + [ $enabled -eq 0 ] && exit 0 + /usr/bin/vlmcsd -i /etc/vlmcsd.ini -L 0.0.0.0:1688 + echo "KMS Server has started." + + if [ $autoactivate -eq 1 ]; then + local HOSTNAME=`uci get system.@system[0].hostname` + + local index=$(uci -q show dhcp |grep "].srv='_vlmcs._tcp'") \ + || add_vlmcs_entry $HOSTNAME + index=${index#*[} + index=${index%]*} + + local host_name=$(uci -q get dhcp.@srvhost[$index].target) + + if [ "$HOSTNAME" != "$host_name" ]; then + uci delete dhcp.@srvhost[$index] + add_vlmcs_entry $HOSTNAME + fi + fi +} + +stop() { + killall -q -9 vlmcsd + echo "KMS Server has stopped." +} + diff --git a/package/lean/luci-app-vlmcsd/root/etc/uci-defaults/luci-app-vlmcsd b/package/lean/luci-app-vlmcsd/root/etc/uci-defaults/luci-app-vlmcsd new file mode 100644 index 00000000000000..d28b2ec9f84bfc --- /dev/null +++ b/package/lean/luci-app-vlmcsd/root/etc/uci-defaults/luci-app-vlmcsd @@ -0,0 +1,21 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@vlmcsd[-1] + add ucitrack vlmcsd + set ucitrack.@vlmcsd[-1].init=kms + commit ucitrack +EOF + +uci delete firewall.kms +uci add firewall rule +uci rename firewall.@rule[-1]="kms" +uci set firewall.@rule[-1].name="kms" +uci set firewall.@rule[-1].target="ACCEPT" +uci set firewall.@rule[-1].src="wan" +uci set firewall.@rule[-1].proto="tcp" +uci set firewall.@rule[-1].dest_port="1688" +uci commit firewall + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/package/lean/luci-app-vsftpd/Makefile b/package/lean/luci-app-vsftpd/Makefile new file mode 100644 index 00000000000000..49b71c9e9fd08b --- /dev/null +++ b/package/lean/luci-app-vsftpd/Makefile @@ -0,0 +1,17 @@ +# Copyright (C) 2016 Openwrt.org +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI support for VSFTPD +LUCI_DEPENDS:=+vsftpd-alt +LUCI_PKGARCH:=all +PKG_VERSION:=1.0 +PKG_RELEASE:=3 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + diff --git a/package/lean/luci-app-vsftpd/luasrc/controller/vsftpd.lua b/package/lean/luci-app-vsftpd/luasrc/controller/vsftpd.lua new file mode 100644 index 00000000000000..de44711dc5133c --- /dev/null +++ b/package/lean/luci-app-vsftpd/luasrc/controller/vsftpd.lua @@ -0,0 +1,47 @@ +--[[ +LuCI - Lua Configuration Interface + +Copyright 2016 Weijie Gao + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ +]]-- + +require("luci.sys") + +module("luci.controller.vsftpd", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/vsftpd") then + return + end + + entry({"admin", "nas"}, firstchild(), "NAS", 44).dependent = false + entry({"admin", "nas", "vsftpd"}, + alias("admin", "nas", "vsftpd", "general"), + _("FTP Server")) + + entry({"admin", "nas", "vsftpd", "general"}, + cbi("vsftpd/general"), + _("General Settings"), 10).leaf = true + + entry({"admin", "nas", "vsftpd", "users"}, + cbi("vsftpd/users"), + _("Virtual Users"), 20).leaf = true + + entry({"admin", "nas", "vsftpd", "anonymous"}, + cbi("vsftpd/anonymous"), + _("Anonymous User"), 30).leaf = true + + entry({"admin", "nas", "vsftpd", "log"}, + cbi("vsftpd/log"), + _("Log Settings"), 40).leaf = true + + entry({"admin", "nas", "vsftpd", "item"}, + cbi("vsftpd/item"), nil).leaf = true +end diff --git a/package/lean/luci-app-vsftpd/luasrc/model/cbi/vsftpd/anonymous.lua b/package/lean/luci-app-vsftpd/luasrc/model/cbi/vsftpd/anonymous.lua new file mode 100644 index 00000000000000..3ebbb4ba9c4704 --- /dev/null +++ b/package/lean/luci-app-vsftpd/luasrc/model/cbi/vsftpd/anonymous.lua @@ -0,0 +1,44 @@ +--[[ +LuCI - Lua Configuration Interface + +Copyright 2016 Weijie Gao + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ +]]-- + +m = Map("vsftpd", translate("FTP Server - Anonymous Settings")) + +sa = m:section(NamedSection, "anonymous", "anonymous", translate("Anonymous Settings")) + +o = sa:option(Flag, "enabled", translate("Enabled")) +o.default = false + +o = sa:option(Value, "username", translate("Username"), translate("An actual local user to handle anonymous user")) +o.default = "ftp" + +o = sa:option(Value, "root", translate("Root directory")) +o.default = "/home/ftp" + +o = sa:option(Value, "umask", translate("File mode umask")) +o.default = "022" + +o = sa:option(Value, "maxrate", translate("Max transmit rate"), translate("0 means no limitation")) +o.default = "0" + +o = sa:option(Flag, "writemkdir", translate("Enable write/mkdir")) +o.default = false + +o = sa:option(Flag, "upload", translate("Enable upload")) +o.default = false + +o = sa:option(Flag, "others", translate("Enable other rights"), translate("Include rename, deletion ...")) +o.default = false + + +return m diff --git a/package/lean/luci-app-vsftpd/luasrc/model/cbi/vsftpd/general.lua b/package/lean/luci-app-vsftpd/luasrc/model/cbi/vsftpd/general.lua new file mode 100644 index 00000000000000..2de653c798c5c3 --- /dev/null +++ b/package/lean/luci-app-vsftpd/luasrc/model/cbi/vsftpd/general.lua @@ -0,0 +1,122 @@ +--[[ +LuCI - Lua Configuration Interface + +Copyright 2016 Weijie Gao + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ +]]-- + +m = Map("vsftpd", translate("FTP Server - General Settings")) + +sl = m:section(NamedSection, "listen", "listen", translate("Listening Settings")) + +o = sl:option(Flag, "enable4", translate("Enable IPv4")) +o.rmempty = false +o.default = true + +o = sl:option(Value, "ipv4", translate("IPv4 Address")) +o.datatype = "ip4addr" +o.default = "0.0.0.0" + +o = sl:option(Flag, "enable6", translate("Enable IPv6")) +o.rmempty = false + +o = sl:option(Value, "ipv6", translate("IPv6 Address")) +o.datatype = "ip6addr" +o.default = "::" + +o = sl:option(Value, "port", translate("Listen Port")) +o.datatype = "uinteger" +o.default = "21" + +o = sl:option(Value, "dataport", translate("Data Port")) +o.datatype = "uinteger" +o.default = "20" + +o = sl:option(Value, "pasv_min_port", translate("Pasv Min Port")) +o.datatype = "uinteger" +o.default = "50000" + +o = sl:option(Value, "pasv_max_port", translate("Pasv Max Port")) +o.datatype = "uinteger" +o.default = "51000" + + +sg = m:section(NamedSection, "global", "global", translate("Global Settings")) + +o = sg:option(Flag, "write", translate("Enable write"), translate("When disabled, all write request will give permission denied.")); +o.default = true + +o = sg:option(Flag, "download", translate("Enable download"), translate("When disabled, all download request will give permission denied.")); +o.default = true + +o = sg:option(Flag, "dirlist", translate("Enable directory list"), translate("When disabled, list commands will give permission denied.")) +o.default = true + +o = sg:option(Flag, "lsrecurse", translate("Allow directory recursely list")) + +o = sg:option(Flag, "dotfile", translate("Show dot files"), translate(". and .. are excluded.")); +o.default = true + +o = sg:option(Value, "umask", translate("File mode umask"), translate("Uploaded file mode will be 666 - <umask>; directory mode will be 777 - <umask>.")) +o.default = "022" + +o = sg:option(Value, "banner", translate("FTP Banner")) + +o = sg:option(Flag, "dirmessage", translate("Enable directory message"), translate("A message will be displayed when entering a directory.")) + +o = sg:option(Value, "dirmsgfile", translate("Directory message filename")) +o.default = ".message" + + +sl = m:section(NamedSection, "local", "local", translate("Local Users")) + +o = sl:option(Flag, "enabled", translate("Enable local user")) +o.rmempty = false + +o = sl:option(Value, "root", translate("Root directory"), translate("Leave empty will use user's home directory")) +o.default = "" + + +sc = m:section(NamedSection, "connection", "connection", translate("Connection Settings")) + +o = sc:option(Flag, "portmode", translate("Enable PORT mode")) +o = sc:option(Flag, "pasvmode", translate("Enable PASV mode")) + +o = sc:option(ListValue, "ascii", translate("ASCII mode")) +o:value("disabled", translate("Disabled")) +o:value("download", translate("Download only")) +o:value("upload", translate("Upload only")) +o:value("both", translate("Both download and upload")) +o.default = "both" + +o = sc:option(Value, "idletimeout", translate("Idle session timeout"), translate("in seconds")) +o.datatype = "uinteger" +o.default = "1800" +o = sc:option(Value, "conntimeout", translate("Connection timeout"), translate("in seconds")) +o.datatype = "uinteger" +o.default = "120" +o = sc:option(Value, "dataconntimeout", translate("Data connection timeout"), translate("in seconds")) +o.datatype = "uinteger" +o.default = "120" +o = sc:option(Value, "maxclient", translate("Max clients"), translate("0 means no limitation")) +o.datatype = "uinteger" +o.default = "0" +o = sc:option(Value, "maxperip", translate("Max clients per IP"), translate("0 means no limitation")) +o.datatype = "uinteger" +o.default = "0" +o = sc:option(Value, "maxrate", translate("Max transmit rate"), translate("in KB/s, 0 means no limitation")) +o.datatype = "uinteger" +o.default = "0" +o = sc:option(Value, "maxretry", translate("Max login fail count"), translate("Can not be zero, default is 3")) +o.datatype = "uinteger" +o.default = "3" + + +return m diff --git a/package/lean/luci-app-vsftpd/luasrc/model/cbi/vsftpd/item.lua b/package/lean/luci-app-vsftpd/luasrc/model/cbi/vsftpd/item.lua new file mode 100644 index 00000000000000..2a0003c8bddba4 --- /dev/null +++ b/package/lean/luci-app-vsftpd/luasrc/model/cbi/vsftpd/item.lua @@ -0,0 +1,70 @@ +--[[ +LuCI - Lua Configuration Interface + +Copyright 2016 Weijie Gao + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ +]]-- + +local sid = arg[1] +local utl = require "luci.util" + +m = Map("vsftpd", translate("FTP Server - Virtual User <new>")) + +m.redirect = luci.dispatcher.build_url("admin/nas/vsftpd/users") + +if m.uci:get("vsftpd", sid) ~= "user" then + luci.http.redirect(m.redirect) + return +end + +m.uci:foreach("vsftpd", "user", + function(s) + if s['.name'] == sid and s.username then + m.title = translatef("FTP Server - Virtual User %q", s.username) + return false + end + end) + +s = m:section(NamedSection, sid, "settings", translate("User Settings")) +s.addremove = false + +o = s:option(Value, "username", translate("Username")) +o.rmempty = false + +function o.validate(self, value) + if value == "" then + return nil, translate("Username cannot be empty") + end + return value +end + +o = s:option(Value, "password", translate("Password")) +o.password = true + +o = s:option(Value, "home", translate("Home directory")) +o.default = "/home/ftp" + +o = s:option(Value, "umask", translate("File mode umask")) +o.default = "022" + +o = s:option(Value, "maxrate", translate("Max transmit rate"), translate("0 means no limitation")) +o.default = "0" + +o = s:option(Flag, "writemkdir", translate("Enable write/mkdir")) +o.default = false + +o = s:option(Flag, "upload", translate("Enable upload")) +o.default = false + +o = s:option(Flag, "others", translate("Enable other rights"), translate("Include rename, deletion ...")) +o.default = false + + +return m diff --git a/package/lean/luci-app-vsftpd/luasrc/model/cbi/vsftpd/log.lua b/package/lean/luci-app-vsftpd/luasrc/model/cbi/vsftpd/log.lua new file mode 100644 index 00000000000000..969ce817c44485 --- /dev/null +++ b/package/lean/luci-app-vsftpd/luasrc/model/cbi/vsftpd/log.lua @@ -0,0 +1,29 @@ +--[[ +LuCI - Lua Configuration Interface + +Copyright 2016 Weijie Gao + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ +]]-- + +m = Map("vsftpd", translate("FTP Server - Log Settings")) + +sl = m:section(NamedSection, "log", "log", translate("Log Settings")) + +o = sl:option(Flag, "syslog", translate("Enable syslog")) +o.default = false + +o = sl:option(Flag, "xreflog", translate("Enable file log")) +o.default = true + +o = sl:option(Value, "file", translate("Log file")) +o.default = "/var/log/vsftpd.log" + + +return m diff --git a/package/lean/luci-app-vsftpd/luasrc/model/cbi/vsftpd/users.lua b/package/lean/luci-app-vsftpd/luasrc/model/cbi/vsftpd/users.lua new file mode 100644 index 00000000000000..2ffaf759d55773 --- /dev/null +++ b/package/lean/luci-app-vsftpd/luasrc/model/cbi/vsftpd/users.lua @@ -0,0 +1,54 @@ +--[[ +LuCI - Lua Configuration Interface + +Copyright 2016 Weijie Gao + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ +]]-- + +m = Map("vsftpd", translate("FTP Server - Virtual User Settings")) + +sv = m:section(NamedSection, "vuser", "vuser", translate("Settings")) + +o = sv:option(Flag, "enabled", translate("Enabled")) +o.default = false + +o = sv:option(Value, "username", translate("Username"), translate("An actual local user to handle virtual users")) +o.default = "ftp" + +s = m:section(TypedSection, "user", translate("User lists")) +s.template = "cbi/tblsection" +s.extedit = luci.dispatcher.build_url("admin/nas/vsftpd/item/%s") +s.addremove = true +s.anonymous = true + +function s.create(...) + local id = TypedSection.create(...) + luci.http.redirect(s.extedit % id) +end + +function s.remove(self, section) + return TypedSection.remove(self, section) +end + +o = s:option(DummyValue, "username", translate("Username")) +function o.cfgvalue(...) + local v = Value.cfgvalue(...) or ("<%s>" % translate("Unknown")) + return v +end +o.rmempty = false + +o = s:option(DummyValue, "home", translate("Home directory")) +function o.cfgvalue(...) + local v = Value.cfgvalue(...) or ("/home/ftp") + return v +end +o.rmempty = false + +return m diff --git a/package/lean/luci-app-vsftpd/po/zh-cn/vsftpd.po b/package/lean/luci-app-vsftpd/po/zh-cn/vsftpd.po new file mode 100644 index 00000000000000..d77cb43adcf150 --- /dev/null +++ b/package/lean/luci-app-vsftpd/po/zh-cn/vsftpd.po @@ -0,0 +1,236 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-02-17 18:00+0800\n"\ +"Last-Translator: Weijie Gao \n" +"Language-Team: \n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Pootle 2.0.6\n" + +msgid "NAS" +msgstr "网络存储" + +msgid ". and .. are excluded." +msgstr ". 和 .. 将被忽略。" + +msgid "0 means no limitation" +msgstr "0 表明不限制" + +msgid "A message will be displayed when entering a directory." +msgstr "在进入一个新目录时将显示的消息" + +msgid "ASCII mode" +msgstr "ASCII 模式" + +msgid "Allow directory recursely list" +msgstr "允许递归列目录" + +msgid "An actual local user to handle anonymous user" +msgstr "承载匿名用户的本地用户" + +msgid "An actual local user to handle virtual users" +msgstr "承载虚拟用户的本地用户" + +msgid "Anonymous Settings" +msgstr "匿名用户设置" + +msgid "Anonymous User" +msgstr "匿名用户" + +msgid "Both download and upload" +msgstr "下载和上传" + +msgid "Can not be zero, default is 3" +msgstr "不能为 0,默认为 3" + +msgid "Connection Settings" +msgstr "连接设置" + +msgid "Connection timeout" +msgstr "连接超时" + +msgid "Data Port" +msgstr "数据端口" + +msgid "Data connection timeout" +msgstr "数据连接超时" + +msgid "Directory message filename" +msgstr "目录消息文件名" + +msgid "Download only" +msgstr "仅下载" + +msgid "Enable IPv4" +msgstr "启用 IPv4" + +msgid "Enable IPv6" +msgstr "启用 IPv6" + +msgid "Enable PASV mode" +msgstr "启用 PASV 模式" + +msgid "Enable PORT mode" +msgstr "启用 PORT 模式" + +msgid "Enable directory list" +msgstr "允许列目录" + +msgid "Enable directory message" +msgstr "启用目录消息" + +msgid "Enable download" +msgstr "允许下载" + +msgid "Enable file log" +msgstr "启用文件日志" + +msgid "Enable local user" +msgstr "启用本地用户" + +msgid "Enable other rights" +msgstr "允许其它权限" + +msgid "Enable syslog" +msgstr "启用系统日志" + +msgid "Enable upload" +msgstr "允许上传" + +msgid "Enable write" +msgstr "允许写" + +msgid "Enable write/mkdir" +msgstr "允许写/创建目录" + +msgid "FTP Banner" +msgstr "FTP 欢迎提示" + +msgid "FTP Server" +msgstr "FTP 服务器" + +msgid "FTP Server - Anonymous Settings" +msgstr "FTP 服务器 - 匿名用户设置" + +msgid "FTP Server - General Settings" +msgstr "FTP 服务器 - 常规设置" + +msgid "FTP Server - Log Settings" +msgstr "FTP 服务器 - 日志设置" + +msgid "FTP Server - Virtual User %q" +msgstr "FTP 服务器 - 虚拟用户 %q" + +msgid "FTP Server - Virtual User <new>" +msgstr "FTP 服务器 - 虚拟用户 <新用户>" + +msgid "FTP Server - Virtual User Settings" +msgstr "FTP 服务器 - 虚拟用户设置" + +msgid "File mode umask" +msgstr "文件权限掩码" + +msgid "General Settings" +msgstr "常规设置" + +msgid "Global Settings" +msgstr "全局设置" + +msgid "Home directory" +msgstr "主目录" + +msgid "IPv4 Address" +msgstr "IPv4 地址" + +msgid "IPv6 Address" +msgstr "IPv6 地址" + +msgid "Idle session timeout" +msgstr "空闲回话超时" + +msgid "Include rename, deletion ..." +msgstr "包括重命名、删除 ..." + +msgid "Leave empty will use user's home directory" +msgstr "留空将使用用户主目录" + +msgid "Listen Port" +msgstr "监听端口" + +msgid "Listening Settings" +msgstr "监听设置" + +msgid "Local Users" +msgstr "本地用户" + +msgid "Log Settings" +msgstr "日志设置" + +msgid "Log file" +msgstr "日志文件" + +msgid "Max clients" +msgstr "最大连接数" + +msgid "Max clients per IP" +msgstr "同一 IP 的最大连接数" + +msgid "Max login fail count" +msgstr "最大登录尝试数" + +msgid "Max transmit rate" +msgstr "最大传输速率" + +msgid "Root directory" +msgstr "根目录" + +msgid "Settings" +msgstr "设置" + +msgid "Show dot files" +msgstr "显示以点开头的文件 (隐藏文件)" + +msgid "Upload only" +msgstr "仅上传" + +msgid "Uploaded file mode will be 666 - <umask>; directory mode will be 777 - <umask>." +msgstr "上传的文件权限将被设置为 666 - <掩码>;目录权限将被设置为 777 - <掩码>。" + +msgid "User Settings" +msgstr "用户设置" + +msgid "User lists" +msgstr "用户列表" + +msgid "Username cannot be empty" +msgstr "用户名不能为空" + +msgid "When disabled, all download request will give permission denied." +msgstr "如果禁止,所有的下载请求都将被拒绝。" + +msgid "When disabled, all write request will give permission denied." +msgstr "如果禁止,所有的写类型请求都将被拒绝。" + +msgid "When disabled, list commands will give permission denied." +msgstr "如果禁止,列目录命令将被拒绝。" + +msgid "Virtual Users" +msgstr "虚拟用户" + +msgid "in seconds" +msgstr "单位为秒" + +msgid "in KB/s, 0 means no limitation" +msgstr "单位为 KB/s,0 表明不限制" + +msgid "Pasv Min Port" +msgstr "Pasv 模式最小端口" + +msgid "Pasv Max Port" +msgstr "Pasv 模式最大端口" + diff --git a/package/lean/luci-app-vsftpd/root/etc/uci-defaults/luci-vsftpd b/package/lean/luci-app-vsftpd/root/etc/uci-defaults/luci-vsftpd new file mode 100644 index 00000000000000..aa2f71a36b5b49 --- /dev/null +++ b/package/lean/luci-app-vsftpd/root/etc/uci-defaults/luci-vsftpd @@ -0,0 +1,11 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@vsftpd[-1] + add ucitrack vsftpd + set ucitrack.@vsftpd[-1].init=vsftpd + commit ucitrack +EOF + +rm -f /tmp/luci-vsftpd +exit 0 diff --git a/package/lean/luci-app-webadmin/Makefile b/package/lean/luci-app-webadmin/Makefile new file mode 100644 index 00000000000000..711673fab507ba --- /dev/null +++ b/package/lean/luci-app-webadmin/Makefile @@ -0,0 +1,18 @@ +# +# Copyright (C) 2008-2014 The LuCI Team +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI page for Web Admin +LUCI_DEPENDS:=+uhttpd +PKG_VERSION:=1.0 +PKG_RELEASE:=3 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + + diff --git a/package/lean/luci-app-webadmin/luasrc/controller/webadmin.lua b/package/lean/luci-app-webadmin/luasrc/controller/webadmin.lua new file mode 100644 index 00000000000000..5e3d17d4d3f1fe --- /dev/null +++ b/package/lean/luci-app-webadmin/luasrc/controller/webadmin.lua @@ -0,0 +1,17 @@ +-- Copyright 2018 lean +-- Licensed to the public under the Apache License 2.0. + +module("luci.controller.webadmin", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/uhttpd") then + return + end + + local page + + page = entry({"admin", "system", "webadmin"}, cbi("webadmin"), _("Web Admin"), 1) + page.leaf = true + +end + diff --git a/package/lean/luci-app-webadmin/luasrc/model/cbi/webadmin.lua b/package/lean/luci-app-webadmin/luasrc/model/cbi/webadmin.lua new file mode 100644 index 00000000000000..e1872d20d71970 --- /dev/null +++ b/package/lean/luci-app-webadmin/luasrc/model/cbi/webadmin.lua @@ -0,0 +1,50 @@ +-- Copyright 2015 Daniel Dickinson +-- Licensed to the public under the Apache License 2.0. + +local fs = require("nixio.fs") + +local m = Map("uhttpd", translate("Web Admin Settings"), + translate("Web Admin Settings Page")) + +local ucs = m:section(TypedSection, "uhttpd") +ucs.addremove = false +ucs.anonymous = true + +lhttp = ucs:option(DynamicList, "listen_http", translate("HTTP listeners (address:port)"), translate("Bind to specific interface:port (by specifying interface address")) +lhttp.datatype = "list(ipaddrport(1))" + +function lhttp.validate(self, value, section) + local have_https_listener = false + local have_http_listener = false + if lhttp and lhttp:formvalue(section) and (#(lhttp:formvalue(section)) > 0) then + for k, v in pairs(lhttp:formvalue(section)) do + if v and (v ~= "") then + have_http_listener = true + break + end + end + end + if lhttps and lhttps:formvalue(section) and (#(lhttps:formvalue(section)) > 0) then + for k, v in pairs(lhttps:formvalue(section)) do + if v and (v ~= "") then + have_https_listener = true + break + end + end + end + if not (have_http_listener or have_https_listener) then + return nil, "must listen on at list one address:port" + end + return DynamicList.validate(self, value, section) +end + +o = ucs:option(Flag, "redirect_https", translate("Redirect all HTTP to HTTPS")) +o.default = o.enabled +o.rmempty = false +o.description = translate("Redirect all HTTP to HTTPS when SSl cert was installed") + +o = ucs:option(Flag, "rfc1918_filter", translate("Ignore private IPs on public interface"), translate("Prevent access from private (RFC1918) IPs on an interface if it has an public IP address")) +o.default = o.enabled +o.rmempty = false + +return m diff --git a/package/lean/luci-app-webadmin/po/zh-cn/webadmin.po b/package/lean/luci-app-webadmin/po/zh-cn/webadmin.po new file mode 100644 index 00000000000000..8370b7174badd9 --- /dev/null +++ b/package/lean/luci-app-webadmin/po/zh-cn/webadmin.po @@ -0,0 +1,41 @@ +msgid "" +msgstr "" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgid "Web Admin" +msgstr "Web 管理" + +msgid "Web Admin Settings" +msgstr "Web 管理页面设置" + +msgid "Web Admin Settings Page" +msgstr "设置更改Web管理页面端口,绑定地址,是否允许从互联网访问等" + +msgid "HTTP listeners (address:port)"" +msgstr "HTTP 监听 (IP地址:端口)"" + +msgid "Bind to specific interface:port (by specifying interface address" +msgstr "绑定到指定的IP地址:端口" + +msgid "Redirect all HTTP to HTTPS" +msgstr "重定向HTTP到HTTPS" + +msgid "Redirect all HTTP to HTTPS when SSl cert was installed" +msgstr "当安装了SSL证书后,重定向HTTP到HTTPS管理页面" + +msgid "Auto activate" +msgstr "自动激活局域网客户端" + +msgid "configfile" +msgstr "配置文件" + +msgid "Ignore private IPs on public interface" +msgstr "只允许内网访问" + +msgid "Prevent access from private (RFC1918) IPs on an interface if it has an public IP address" +msgstr "拒绝从互联网访问Web管理页面" + diff --git a/package/lean/luci-app-wrtbwmon/Makefile b/package/lean/luci-app-wrtbwmon/Makefile new file mode 100644 index 00000000000000..412b35fe5220bf --- /dev/null +++ b/package/lean/luci-app-wrtbwmon/Makefile @@ -0,0 +1,17 @@ +# Copyright (C) 2016 Openwrt.org +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI support for Wrtbwmon +LUCI_DEPENDS:=+luci-app-nlbwmon +LUCI_PKGARCH:=all +PKG_VERSION:=1.0 +PKG_RELEASE:=7 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + diff --git a/package/lean/luci-app-wrtbwmon/htdocs/luci-static/wrtbwmon.js b/package/lean/luci-app-wrtbwmon/htdocs/luci-static/wrtbwmon.js new file mode 100644 index 00000000000000..36812e723b6540 --- /dev/null +++ b/package/lean/luci-app-wrtbwmon/htdocs/luci-static/wrtbwmon.js @@ -0,0 +1,562 @@ +var wrt = { + // variables for auto-update, interval is in seconds + scheduleTimeout: undefined, + updateTimeout: undefined, + isScheduled: true, + interval: 5, + // option on whether to show per host sub-totals + perHostTotals: false, + // variables for sorting + sortData: { + column: 7, + elId: 'thTotal', + dir: 'desc', + cache: {} + } +}; + +(function () { + var oldDate, oldValues = []; + + // find base path + var re = /(.*?admin\/nlbw\/[^/]+)/; + var basePath = window.location.pathname.match(re)[1]; + + //---------------------- + // HELPER FUNCTIONS + //---------------------- + + /** + * Human readable text for size + * @param size + * @returns {string} + */ + function getSize(size) { + var prefix = [' ', 'k', 'M', 'G', 'T', 'P', 'E', 'Z']; + var precision, base = 1000, pos = 0; + while (size > base) { + size /= base; + pos++; + } + if (pos > 2) precision = 1000; else precision = 1; + return (Math.round(size * precision) / precision) + ' ' + prefix[pos] + 'B'; + } + + /** + * Human readable text for date + * @param date + * @returns {string} + */ + function dateToString(date) { + return date.toString().substring(0, 24); + } + + /** + * Gets the string representation of the date received from BE + * @param value + * @returns {*} + */ + function getDateString(value) { + var tmp = value.split('_'), + str = tmp[0].split('-').reverse().join('-') + 'T' + tmp[1]; + return dateToString(new Date(str)); + } + + /** + * Create a `tr` element with content + * @param content + * @returns {string} + */ + function createTR(content) { + var res = '' + data[2], {title: data[1]}), + createTD(getSize(dlSpeed) + '/s', {right: true}), + createTD(getSize(upSpeed) + '/s', {right: true}), + createTD(getSize(data[3]), {right: true}), + createTD(getSize(data[4]), {right: true}), + createTD(getSize(data[5]), {right: true}), + createTD(getDateString(data[6])), + createTD(getDateString(data[7])) + ]; + + // display row data + var result = ''; + for (var k = 0; k < displayData.length; k++) { + result += displayData[k]; + } + result = createTR(result); + return [result, rowData]; + } + + /** + * Creates the HTML output based on the `data` and `totals` inputs + * @param data + * @param totals + * @returns {string} HTML output + */ + function getDisplayData(data, totals) { + var result = + createTH('客户端', {id: 'thClient'}) + + createTH('下载带宽', {id: 'thDownload'}) + + createTH('上传带宽', {id: 'thUpload'}) + + createTH('总下载流量', {id: 'thTotalDown'}) + + createTH('总上传流量', {id: 'thTotalUp'}) + + createTH('流量合计', {id: 'thTotal'}) + + createTH('首次上线时间', {id: 'thFirstSeen'}) + + createTH('最后上线时间', {id: 'thLastSeen'}); + result = createTR(result); + for (var k = 0; k < data.length; k++) { + result += data[k][0]; + } + var totalsRow = createTH('总计'); + for (var m = 0; m < totals.length; m++) { + var t = totals[m]; + totalsRow += createTD(getSize(t) + (m < 2 ? '/s' : ''), {right: true}); + } + result += createTR(totalsRow); + return result; + } + + /** + * Calculates per host sub-totals and adds them in the data input + * @param data The data input + */ + function aggregateHostTotals(data) { + if (!wrt.perHostTotals) return; + + var curHost = 0, insertAt = 1; + while (curHost < data.length && insertAt < data.length) { + // grab the current hostname/mac, and walk the data looking for rows with the same host/mac + var hostName = data[curHost][1][0].toLowerCase(); + for (var k = curHost + 1; k < data.length; k++) { + if (data[k][1][0].toLowerCase() === hostName) { + // this is another row for the same host, group it with any other rows for this host + data.splice(insertAt, 0, data.splice(k, 1)[0]); + insertAt++; + } + } + + // if we found more than one row for the host, add a subtotal row + if (insertAt > curHost + 1) { + var hostTotals = [data[curHost][1][0], '', '', 0, 0, 0, 0, 0]; + for (var i = curHost; i < insertAt && i < data.length; i++) { + for (var j = 3; j < hostTotals.length; j++) { + hostTotals[j] += data[i][1][j]; + } + } + var hostTotalRow = createTH(data[curHost][1][0] + '
(host total)', {title: data[curHost][1][1]}); + for (var m = 3; m < hostTotals.length; m++) { + var t = hostTotals[m]; + hostTotalRow += createTD(getSize(t) + (m < 5 ? '/s' : ''), {right: true}); + } + hostTotalRow = createTR(hostTotalRow); + data.splice(insertAt, 0, [hostTotalRow, hostTotals]); + } + curHost = insertAt; + insertAt = curHost + 1; + } + } + + /** + * Sorting function used to sort the `data`. Uses the global sort settings + * @param x first item to compare + * @param y second item to compare + * @returns {number} 1 for desc, -1 for asc, 0 for equal + */ + function sortingFunction(x, y) { + // get data from global variable + var sortColumn = wrt.sortData.column, sortDirection = wrt.sortData.dir; + var a = x[1][sortColumn]; + var b = y[1][sortColumn]; + if (a === b) { + return 0; + } else if (sortDirection === 'desc') { + return a < b ? 1 : -1; + } else { + return a > b ? 1 : -1; + } + } + + /** + * Sets the relevant global sort variables and re-renders the table to apply the new sorting + * @param elId + * @param column + */ + function setSortColumn(elId, column) { + if (column === wrt.sortData.column) { + // same column clicked, switch direction + wrt.sortData.dir = wrt.sortData.dir === 'desc' ? 'asc' : 'desc'; + } else { + // change sort column + wrt.sortData.column = column; + // reset sort direction + wrt.sortData.dir = 'desc'; + } + wrt.sortData.elId = elId; + + // render table data from cache + renderTableData(wrt.sortData.cache.data, wrt.sortData.cache.totals); + } + + /** + * Registers the table events handlers for sorting when clicking the column headers + */ + function registerTableEventHandlers() { + // note these ordinals are into the data array, not the table output + document.getElementById('thClient').addEventListener('click', function () { + setSortColumn(this.id, 0); // hostname + }); + document.getElementById('thDownload').addEventListener('click', function () { + setSortColumn(this.id, 3); // dl speed + }); + document.getElementById('thUpload').addEventListener('click', function () { + setSortColumn(this.id, 4); // ul speed + }); + document.getElementById('thTotalDown').addEventListener('click', function () { + setSortColumn(this.id, 5); // total down + }); + document.getElementById('thTotalUp').addEventListener('click', function () { + setSortColumn(this.id, 6); // total up + }); + document.getElementById('thTotal').addEventListener('click', function () { + setSortColumn(this.id, 7); // total + }); + } + + /** + * Fetches and handles the updated `values` from the BE + * @param once If set to true, it re-schedules itself for execution based on selected interval + */ + function receiveData(once) { + var ajax = new XMLHttpRequest(); + ajax.onreadystatechange = function () { + // noinspection EqualityComparisonWithCoercionJS + if (this.readyState == 4 && this.status == 200) { + var re = /(var values = new Array[^;]*;)/, + match = ajax.responseText.match(re); + if (!match) { + handleError(); + } else { + // evaluate values + eval(match[1]); + //noinspection JSUnresolvedVariable + var v = values; + if (!v) { + handleError(); + } else { + handleValues(v); + // set old values + oldValues = v; + // set old date + oldDate = new Date(); + document.getElementById('updated').innerHTML = '数据更新时间 ' + dateToString(oldDate); + } + } + var int = wrt.interval; + if (!once && int > 0) reschedule(int); + } + }; + ajax.open('GET', basePath + '/usage_data', true); + ajax.send(); + } + + /** + * Registers DOM event listeners for user interaction + */ + function addEventListeners() { + document.getElementById('intervalSelect').addEventListener('change', function () { + var int = wrt.interval = this.value; + if (int > 0) { + // it is not scheduled, schedule it + if (!wrt.isScheduled) { + reschedule(int); + } + } else { + // stop the scheduling + stopSchedule(); + } + }); + + document.getElementById('resetDatabase').addEventListener('click', function () { + if (confirm('This will delete the database file. Are you sure?')) { + var ajax = new XMLHttpRequest(); + ajax.onreadystatechange = function () { + // noinspection EqualityComparisonWithCoercionJS + if (this.readyState == 4 && this.status == 204) { + location.reload(); + } + }; + ajax.open('GET', basePath + '/usage_reset', true); + ajax.send(); + } + }); + + document.getElementById('perHostTotals').addEventListener('change', function () { + wrt.perHostTotals = !wrt.perHostTotals; + }); + } + + //---------------------- + // AUTO-UPDATE + //---------------------- + + /** + * Stop auto-update schedule + */ + function stopSchedule() { + window.clearTimeout(wrt.scheduleTimeout); + window.clearTimeout(wrt.updateTimeout); + setUpdateMessage(''); + wrt.isScheduled = false; + } + + /** + * Start auto-update schedule + * @param seconds + */ + function reschedule(seconds) { + wrt.isScheduled = true; + seconds = seconds || 60; + updateSeconds(seconds); + wrt.scheduleTimeout = window.setTimeout(receiveData, seconds * 1000); + } + + /** + * Sets the text of the `#updating` element + * @param msg + */ + function setUpdateMessage(msg) { + document.getElementById('updating').innerHTML = msg; + } + + /** + * Updates the 'Updating in X seconds' message + * @param start + */ + function updateSeconds(start) { + setUpdateMessage('倒数 ' + start + ' 秒后刷新.'); + if (start > 0) { + wrt.updateTimeout = window.setTimeout(function () { + updateSeconds(start - 1); + }, 1000); + } + } + + //---------------------- + // END AUTO-UPDATE + //---------------------- + + /** + * Check for dependency, and if all is well, run callback + * @param cb Callback function + */ + function checkForDependency(cb) { + var ajax = new XMLHttpRequest(); + ajax.onreadystatechange = function () { + // noinspection EqualityComparisonWithCoercionJS + if (this.readyState == 4 && this.status == 200) { + // noinspection EqualityComparisonWithCoercionJS + if (ajax.responseText == "1") { + cb(); + } else { + alert("wrtbwmon is not installed!"); + } + } + }; + ajax.open('GET', basePath + '/check_dependency', true); + ajax.send(); + } + + checkForDependency(function () { + // register events + addEventListeners(); + // Main entry point + receiveData(); + }); + +})(); diff --git a/package/lean/luci-app-wrtbwmon/luasrc/controller/wrtbwmon.lua b/package/lean/luci-app-wrtbwmon/luasrc/controller/wrtbwmon.lua new file mode 100644 index 00000000000000..25909c846d984c --- /dev/null +++ b/package/lean/luci-app-wrtbwmon/luasrc/controller/wrtbwmon.lua @@ -0,0 +1,43 @@ +module("luci.controller.wrtbwmon", package.seeall) + +function index() + entry({"admin", "nlbw", "usage"}, alias("admin", "nlbw", "usage", "details"), _("Usage"), 60) + entry({"admin", "nlbw", "usage", "details"}, template("wrtbwmon"), _("Details"), 10).leaf=true + entry({"admin", "nlbw", "usage", "config"}, cbi("wrtbwmon/config"), _("Configuration"), 20).leaf=true + entry({"admin", "nlbw", "usage", "custom"}, form("wrtbwmon/custom"), _("User file"), 30).leaf=true + entry({"admin", "nlbw", "usage", "check_dependency"}, call("check_dependency")).dependent=true + entry({"admin", "nlbw", "usage", "usage_data"}, call("usage_data")).dependent=true + entry({"admin", "nlbw", "usage", "usage_reset"}, call("usage_reset")).dependent=true +end + +function usage_database_path() + local cursor = luci.model.uci.cursor() + if cursor:get("wrtbwmon", "general", "persist") == "1" then + return "/etc/config/usage.db" + else + return "/tmp/usage.db" + end +end + +function check_dependency() + local ret = "0" + if require("luci.model.ipkg").installed('iptables') then + ret = "1" + end + luci.http.prepare_content("text/plain") + luci.http.write(ret) +end + +function usage_data() + local db = usage_database_path() + local publish_cmd = "wrtbwmon publish " .. db .. " /tmp/usage.htm /etc/config/wrtbwmon.user" + local cmd = "wrtbwmon update " .. db .. " && " .. publish_cmd .. " && cat /tmp/usage.htm" + luci.http.prepare_content("text/html") + luci.http.write(luci.sys.exec(cmd)) +end + +function usage_reset() + local db = usage_database_path() + local ret = luci.sys.call("wrtbwmon update " .. db .. " && rm " .. db) + luci.http.status(204) +end diff --git a/package/lean/luci-app-wrtbwmon/luasrc/model/cbi/wrtbwmon/config.lua b/package/lean/luci-app-wrtbwmon/luasrc/model/cbi/wrtbwmon/config.lua new file mode 100644 index 00000000000000..469d4f8f2ca7e2 --- /dev/null +++ b/package/lean/luci-app-wrtbwmon/luasrc/model/cbi/wrtbwmon/config.lua @@ -0,0 +1,18 @@ +local m = Map("wrtbwmon", translate("Details")) + +local s = m:section(NamedSection, "general", "wrtbwmon", translate("General settings")) + +local o = s:option(Flag, "persist", translate("Persist database"), + translate("Check this to persist the database file")) +o.rmempty = false + +function o.write(self, section, value) + if value == '1' then + luci.sys.call("mv /tmp/usage.db /etc/config/usage.db") + elseif value == '0' then + luci.sys.call("mv /etc/config/usage.db /tmp/usage.db") + end + return Flag.write(self, section ,value) +end + +return m diff --git a/package/lean/luci-app-wrtbwmon/luasrc/model/cbi/wrtbwmon/custom.lua b/package/lean/luci-app-wrtbwmon/luasrc/model/cbi/wrtbwmon/custom.lua new file mode 100644 index 00000000000000..671879b4cc2917 --- /dev/null +++ b/package/lean/luci-app-wrtbwmon/luasrc/model/cbi/wrtbwmon/custom.lua @@ -0,0 +1,23 @@ +local USER_FILE_PATH = "/etc/config/wrtbwmon.user" + +local fs = require "nixio.fs" + +local f = SimpleForm("wrtbwmon", + translate("Usage - Custom User File"), + translate("This file is used to match users with MAC addresses and it must have the following format: 00:aa:bb:cc:ee:ff,username")) + +local o = f:field(Value, "_custom") + +o.template = "cbi/tvalue" +o.rows = 20 + +function o.cfgvalue(self, section) + return fs.readfile(USER_FILE_PATH) +end + +function o.write(self, section, value) + value = value:gsub("\r\n?", "\n") + fs.writefile(USER_FILE_PATH, value) +end + +return f diff --git a/package/lean/luci-app-wrtbwmon/luasrc/view/wrtbwmon.htm b/package/lean/luci-app-wrtbwmon/luasrc/view/wrtbwmon.htm new file mode 100644 index 00000000000000..68713b12382f2b --- /dev/null +++ b/package/lean/luci-app-wrtbwmon/luasrc/view/wrtbwmon.htm @@ -0,0 +1,46 @@ +<%+header%> +

<%=translate("Usage")%>

+

+ +

+

+ + + +
+ + +
+

+ + +
<%=translate("Loading...")%>
+ + +<%+footer%> diff --git a/package/lean/luci-app-wrtbwmon/po/zh-cn/wrtbwmon.po b/package/lean/luci-app-wrtbwmon/po/zh-cn/wrtbwmon.po new file mode 100644 index 00000000000000..3eb050e3f48dc4 --- /dev/null +++ b/package/lean/luci-app-wrtbwmon/po/zh-cn/wrtbwmon.po @@ -0,0 +1,56 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +msgid "Usage" +msgstr "实时流量监测" + +msgid "Details" +msgstr "详细信息" + +msgid "Configuration" +msgstr "配置" + +msgid "User file" +msgstr "自定义主机信息" + +msgid "Usage - Configuration" +msgstr "详细设置" + +msgid "General settings" +msgstr "通用设置" + +msgid "Persist database" +msgstr "写入数据库到硬盘" + +msgid "Check this to persist the database file" +msgstr "把统计数据写入 /etc/config 中避免重启或者升级后丢失" + +msgid "Usage - Custom User File" +msgstr "自定义MAC地址对应的主机名" + +msgid "This file is used to match users with MAC addresses and it must have the following format: 00:aa:bb:cc:ee:ff,username" +msgstr "每一行的格式为 00:aa:bb:cc:ee:ff,username" + +msgid "Reset Database" +msgstr "重置数据库" + +msgid "Auto Refresh Interval" +msgstr "自动刷新间隔" + +msgid "Disabled" +msgstr "禁用" + +msgid "Second" +msgstr "秒" + +msgid "Seconds" +msgstr "秒" + +msgid "Minutes" +msgstr "分钟" + +msgid "Per-host Totals" +msgstr "合并每一客户端数据" + +msgid "Loading..." +msgstr "加载中..." diff --git a/package/lean/luci-app-wrtbwmon/root/etc/config/wrtbwmon b/package/lean/luci-app-wrtbwmon/root/etc/config/wrtbwmon new file mode 100644 index 00000000000000..419270dbab4532 --- /dev/null +++ b/package/lean/luci-app-wrtbwmon/root/etc/config/wrtbwmon @@ -0,0 +1,4 @@ + +config wrtbwmon 'general' + option persist '0' + diff --git a/package/lean/luci-app-wrtbwmon/root/etc/init.d/wrtbwmon b/package/lean/luci-app-wrtbwmon/root/etc/init.d/wrtbwmon new file mode 100644 index 00000000000000..d57c09ae1decba --- /dev/null +++ b/package/lean/luci-app-wrtbwmon/root/etc/init.d/wrtbwmon @@ -0,0 +1,22 @@ +#!/bin/sh /etc/rc.common +# +# start/stop wrtbwmon bandwidth monitor + +### BEGIN INIT INFO +# Provides: wrtbwmon +# Required-Start: $network $local_fs $remote_fs +# Required-Stop: $local_fs $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: iptables-based bandwidth monitor +### END INIT INFO + +START=91 + +start(){ + /usr/sbin/wrtbwmon setup /tmp/usage.db +} + +stop(){ + /usr/sbin/wrtbwmon remove +} diff --git a/package/lean/luci-app-wrtbwmon/root/etc/uci-defaults/luci-wrtbwmon b/package/lean/luci-app-wrtbwmon/root/etc/uci-defaults/luci-wrtbwmon new file mode 100644 index 00000000000000..bcb5b337f35c00 --- /dev/null +++ b/package/lean/luci-app-wrtbwmon/root/etc/uci-defaults/luci-wrtbwmon @@ -0,0 +1,14 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete firewall.wrtbwmon + set firewall.wrtbwmon=include + set firewall.wrtbwmon.type=script + set firewall.wrtbwmon.path='/etc/wrtbwmon.include' + set firewall.wrtbwmon.reload=1 + commit firewall +EOF + +/etc/init.d/wrtbwmon enable +/etc/init.d/wrtbwmon start +exit 0 diff --git a/package/lean/luci-app-wrtbwmon/root/etc/wrtbwmon.include b/package/lean/luci-app-wrtbwmon/root/etc/wrtbwmon.include new file mode 100644 index 00000000000000..39bcf43a10bdc0 --- /dev/null +++ b/package/lean/luci-app-wrtbwmon/root/etc/wrtbwmon.include @@ -0,0 +1 @@ +/etc/init.d/wrtbwmon restart >/dev/null 2>&1 diff --git a/package/lean/luci-app-wrtbwmon/root/usr/sbin/readDB.awk b/package/lean/luci-app-wrtbwmon/root/usr/sbin/readDB.awk new file mode 100644 index 00000000000000..fe67e4ae8b651d --- /dev/null +++ b/package/lean/luci-app-wrtbwmon/root/usr/sbin/readDB.awk @@ -0,0 +1,157 @@ +#!/usr/bin/awk + +function inInterfaces(host){ + return(interfaces ~ "(^| )"host"($| )") +} + +function newRule(arp_ip, + ipt_cmd){ + # checking for existing rules shouldn't be necessary if newRule is + # always called after db is read, arp table is read, and existing + # iptables rules are read. + ipt_cmd="iptables -t mangle -j RETURN -s " arp_ip + system(ipt_cmd " -C RRDIPT_FORWARD 2>/dev/null || " ipt_cmd " -A RRDIPT_FORWARD") + ipt_cmd="iptables -t mangle -j RETURN -d " arp_ip + system(ipt_cmd " -C RRDIPT_FORWARD 2>/dev/null || " ipt_cmd " -A RRDIPT_FORWARD") +} + +function total(i){ + return(bw[i "/in"] + bw[i "/out"]) +} + +function date( cmd, d){ + cmd="date +%d-%m-%Y_%H:%M:%S" + cmd | getline d + close(cmd) + #!@todo could start a process with "while true; do date ...; done" + return(d) +} + +BEGIN { + od="" + fid=1 + debug=0 + rrd=0 +} + +/^#/ { # get DB filename + FS="," + dbFile=FILENAME + next +} + +# data from database; first file +FNR==NR { #!@todo this doesn't help if the DB file is empty. + if($2 == "NA") + #!@todo could get interface IP here + n=$1 + else + n=$2 + + hosts[n] = "" # add this host/interface to hosts + mac[n] = $1 + ip[n] = $2 + inter[n] = $3 + bw[n "/in"] = $4 + bw[n "/out"] = $5 + firstDate[n] = $7 + lastDate[n] = $8 + next +} + +# not triggered on the first file +FNR==1 { + FS=" " + fid++ #!@todo use fid for all files; may be problematic for empty files + next +} + +# arp: ip hw flags hw_addr mask device +fid==2 { + #!@todo regex match IPs and MACs for sanity + arp_ip = $1 + arp_flags = $3 + arp_mac = $4 + arp_dev = $6 + if(arp_flags != "0x0" && !(arp_ip in ip)){ + if(debug) + print "new host:", arp_ip, arp_flags > "/dev/stderr" + hosts[arp_ip] = "" + mac[arp_ip] = arp_mac + ip[arp_ip] = arp_ip + inter[arp_ip] = arp_dev + bw[arp_ip "/in"] = bw[arp_ip "/out"] = 0 + firstDate[arp_ip] = lastDate[arp_ip] = date() + } + next +} + +#!@todo could use mangle chain totals or tailing "unnact" rules to +# account for data for new hosts from their first presence on the +# network to rule creation. The "unnact" rules would have to be +# maintained at the end of the list, and new rules would be inserted +# at the top. + +# skip line +# read the chain name and deal with the data accordingly +fid==3 && $1 == "Chain"{ + rrd=$2 ~ /RRDIPT_.*/ + next +} + +fid==3 && rrd && (NF < 9 || $1=="pkts"){ next } + +fid==3 && rrd { # iptables input + if($6 != "*"){ + m=$6 + n=m "/out" + } else if($7 != "*"){ + m=$7 + n=m "/in" + } else if($8 != "0.0.0.0/0"){ + m=$8 + n=m "/out" + } else { # $9 != "0.0.0.0/0" + m=$9 + n=m "/in" + } + + # remove host from array; any hosts left in array at END get new + # iptables rules + + #!@todo this deletes a host if any rule exists; if only one + # directional rule is removed, this will not remedy the situation + delete hosts[m] + + if($2 > 0){ # counted some bytes + if(mode == "diff" || mode == "noUpdate") + print n, $2 + if(mode!="noUpdate"){ + if(inInterfaces(m)){ # if label is an interface + if(!(m in mac)){ # if label was not in db (also not in + # arp table, but interfaces won't be + # there anyway) + firstDate[m] = date() + mac[m] = inter[m] = m + ip[m] = "NA" + bw[m "/in"]=bw[m "/out"]= 0 + } + } + bw[n]+=$2 + lastDate[m] = date() + } + } +} + +END { + if(mode=="noUpdate") exit + close(dbFile) + system("rm -f " dbFile) + print "#mac,ip,iface,in,out,total,first_date,last_date" > dbFile + OFS="," + for(i in mac) + print mac[i], ip[i], inter[i], bw[i "/in"], bw[i "/out"], total(i), firstDate[i], lastDate[i] > dbFile + close(dbFile) + # for hosts without rules + for(host in hosts) if(!inInterfaces(host)) newRule(host) +} diff --git a/package/lean/luci-app-wrtbwmon/root/usr/sbin/wrtbwmon b/package/lean/luci-app-wrtbwmon/root/usr/sbin/wrtbwmon new file mode 100644 index 00000000000000..b2c0b9a07ac7bc --- /dev/null +++ b/package/lean/luci-app-wrtbwmon/root/usr/sbin/wrtbwmon @@ -0,0 +1,301 @@ +#!/bin/sh +# +# wrtbwmon: traffic logging tool for routers +# +# Peter Bailey (peter.eldridge.bailey+wrtbwmon AT gmail.com) +# +# Based on work by: +# Emmanuel Brucy (e.brucy AT qut.edu.au) +# Fredrik Erlandsson (erlis AT linux.nu) +# twist - http://wiki.openwrt.org/RrdTrafficWatch + +trap "rm -f /tmp/*_$$.tmp; kill $$" INT +binDir=/usr/sbin +dataDir=/usr/share/wrtbwmon +lockDir=/tmp/wrtbwmon.lock +pidFile=$lockDir/pid +networkFuncs=/lib/functions/network.sh +uci=`which uci 2>/dev/null` +nslookup=`which nslookup 2>/dev/null` +nvram=`which nvram 2>/dev/null` + +chains='INPUT OUTPUT FORWARD' +DEBUG= +interfaces='eth0 tun0' # in addition to detected WAN +DB=$2 +mode= + +# DNS server for reverse lookups provided in "DNS". +# don't perform reverse DNS lookups by default +DO_RDNS=${DNS-} + +header="#mac,ip,iface,in,out,total,first_date,last_date" + +createDbIfMissing() +{ + [ ! -f "$DB" ] && echo $header > "$DB" +} + +checkDbArg() +{ + [ -z "$DB" ] && echo "ERROR: Missing argument 2 (database file)" && exit 1 +} + +checkDB() +{ + [ ! -f "$DB" ] && echo "ERROR: $DB does not exist" && exit 1 + [ ! -w "$DB" ] && echo "ERROR: $DB is not writable" && exit 1 +} + +checkWAN() +{ + [ -z "$wan" ] && echo "Warning: failed to detect WAN interface." +} + +lookup() +{ + MAC=$1 + IP=$2 + userDB=$3 + for USERSFILE in $userDB /tmp/dhcp.leases /tmp/dnsmasq.conf /etc/dnsmasq.conf /etc/hosts; do + [ -e "$USERSFILE" ] || continue + case $USERSFILE in + /tmp/dhcp.leases ) + USER=$(grep -i "$MAC" $USERSFILE | cut -f4 -s -d' ') + ;; + /etc/hosts ) + USER=$(grep "^$IP " $USERSFILE | cut -f2 -s -d' ') + ;; + * ) + USER=$(grep -i "$MAC" "$USERSFILE" | cut -f2 -s -d,) + ;; + esac + [ "$USER" = "*" ] && USER= + [ -n "$USER" ] && break + done + if [ -n "$DO_RDNS" -a -z "$USER" -a "$IP" != "NA" -a -n "$nslookup" ]; then + USER=`$nslookup $IP $DNS | awk '!/server can/{if($4){print $4; exit}}' | sed -re 's/[.]$//'` + fi + [ -z "$USER" ] && USER=${MAC} + echo $USER +} + +detectIF() +{ + if [ -f "$networkFuncs" ]; then + IF=`. $networkFuncs; network_get_device netdev $1; echo $netdev` + [ -n "$IF" ] && echo $IF && return + fi + + if [ -n "$uci" -a -x "$uci" ]; then + IF=`$uci get network.${1}.ifname 2>/dev/null` + [ $? -eq 0 -a -n "$IF" ] && echo $IF && return + fi + + if [ -n "$nvram" -a -x "$nvram" ]; then + IF=`$nvram get ${1}_ifname 2>/dev/null` + [ $? -eq 0 -a -n "$IF" ] && echo $IF && return + fi +} + +detectLAN() +{ + [ -e /sys/class/net/br-lan ] && echo br-lan && return + lan=$(detectIF lan) + [ -n "$lan" ] && echo $lan && return +} + +detectWAN() +{ + [ -n "$WAN_IF" ] && echo $WAN_IF && return + wan=$(detectIF wan) + [ -n "$wan" ] && echo $wan && return + wan=$(ip route show 2>/dev/null | grep default | sed -re '/^default/ s/default.*dev +([^ ]+).*/\1/') + [ -n "$wan" ] && echo $wan && return + [ -f "$networkFuncs" ] && wan=$(. $networkFuncs; network_find_wan wan; echo $wan) + [ -n "$wan" ] && echo $wan && return +} + +lock() +{ + attempts=0 + while [ $attempts -lt 10 ]; do + mkdir $lockDir 2>/dev/null && break + attempts=$((attempts+1)) + pid=`cat $pidFile 2>/dev/null` + if [ -n "$pid" ]; then + if [ -d "/proc/$pid" ]; then + [ -n "$DEBUG" ] && echo "WARNING: Lockfile detected but process $(cat $pidFile) does not exist !" + rm -rf $lockDir + else + sleep 1 + fi + fi + done + mkdir $lockDir 2>/dev/null + echo $$ > $pidFile + [ -n "$DEBUG" ] && echo $$ "got lock after $attempts attempts" + trap '' INT +} + +unlock() +{ + rm -rf $lockDir + [ -n "$DEBUG" ] && echo $$ "released lock" + trap "rm -f /tmp/*_$$.tmp; kill $$" INT +} + +# chain +newChain() +{ + chain=$1 + # Create the RRDIPT_$chain chain (it doesn't matter if it already exists). + iptables -t mangle -N RRDIPT_$chain 2> /dev/null + + # Add the RRDIPT_$chain CHAIN to the $chain chain if not present + iptables -t mangle -C $chain -j RRDIPT_$chain 2>/dev/null + if [ $? -ne 0 ]; then + [ -n "$DEBUG" ] && echo "DEBUG: iptables chain misplaced, recreating it..." + iptables -t mangle -I $chain -j RRDIPT_$chain + fi +} + +# chain tun +newRuleIF() +{ + chain=$1 + IF=$2 + + #!@todo test + if [ "$chain" = "OUTPUT" ]; then + cmd="iptables -t mangle -o $IF -j RETURN" + eval $cmd " -C RRDIPT_$chain 2>/dev/null" || eval $cmd " -A RRDIPT_$chain" + elif [ "$chain" = "INPUT" ]; then + cmd="iptables -t mangle -i $IF -j RETURN" + eval $cmd " -C RRDIPT_$chain 2>/dev/null" || eval $cmd " -A RRDIPT_$chain" + fi +} + +update() +{ + #!@todo could let readDB.awk handle this; that would place header + #!info in fewer places + createDbIfMissing + + checkDB + checkWAN + + > /tmp/iptables_$$.tmp + lock + # only zero our own chains + for chain in $chains; do + iptables -nvxL RRDIPT_$chain -t mangle -Z >> /tmp/iptables_$$.tmp + done + # the iptables and readDB commands have to be separate. Otherwise, + # they will fight over iptables locks + awk -v mode="$mode" -v interfaces=\""$interfaces"\" -f $binDir/readDB.awk \ + $DB \ + /proc/net/arp \ + /tmp/iptables_$$.tmp + unlock +} + +############################################################ + +case $1 in + "dump" ) + checkDbArg + lock + tr ',' '\t' < "$DB" + unlock + ;; + + "update" ) + checkDbArg + wan=$(detectWAN) + interfaces="$interfaces $wan" + update + rm -f /tmp/*_$$.tmp + exit + ;; + + "publish" ) + checkDbArg + [ -z "$3" ] && echo "ERROR: Missing argument 3 (output html file)" && exit 1 + + # sort DB + lock + + # busybox sort truncates numbers to 32 bits + grep -v '^#' $DB | awk -F, '{OFS=","; a=sprintf("%f",$4/1e6); $4=""; print a,$0}' | tr -s ',' | sort -rn | awk -F, '{OFS=",";$1=sprintf("%f",$1*1e6);print}' > /tmp/sorted_$$.tmp + + # create HTML page + rm -f $3.tmp + cp $dataDir/usage.htm1 $3.tmp + + #!@todo fix publishing + while IFS=, read PEAKUSAGE_IN MAC IP IFACE PEAKUSAGE_OUT TOTAL FIRSTSEEN LASTSEEN + do + echo " +new Array(\"$(lookup $MAC $IP $4)\",\"$MAC\",\"$IP\", +$PEAKUSAGE_IN,$PEAKUSAGE_OUT,$TOTAL,\"$FIRSTSEEN\",\"$LASTSEEN\")," >> $3.tmp + done < /tmp/sorted_$$.tmp + echo "0);" >> $3.tmp + + sed "s/(date)/`date`/" < $dataDir/usage.htm2 >> $3.tmp + mv $3.tmp $3 + + unlock + + #Free some memory + rm -f /tmp/*_$$.tmp + ;; + + "setup" ) + checkDbArg + [ -w "$DB" ] && echo "Warning: using existing $DB" + createDbIfMissing + + for chain in $chains; do + newChain $chain + done + + #lan=$(detectLAN) + wan=$(detectWAN) + checkWAN + interfaces="$interfaces $wan" + + # track local data + for chain in INPUT OUTPUT; do + for interface in $interfaces; do + [ -n "$interface" ] && [ -e "/sys/class/net/$interface" ] && newRuleIF $chain $interface + done + done + + # this will add rules for hosts in arp table + update + + rm -f /tmp/*_$$.tmp + ;; + + "remove" ) + iptables-save | grep -v RRDIPT | iptables-restore + rm -rf "$lockDir" + ;; + + *) + echo \ +"Usage: $0 {setup|update|publish|remove} [options...] +Options: + $0 setup database_file + $0 update database_file + $0 publish database_file path_of_html_report [user_file] +Examples: + $0 setup /tmp/usage.db + $0 update /tmp/usage.db + $0 publish /tmp/usage.db /www/user/usage.htm /jffs/users.txt + $0 remove +Note: [user_file] is an optional file to match users with MAC addresses. + Its format is \"00:MA:CA:DD:RE:SS,username\", with one entry per line." + ;; +esac diff --git a/package/lean/luci-app-wrtbwmon/root/usr/share/wrtbwmon/usage.htm1 b/package/lean/luci-app-wrtbwmon/root/usr/share/wrtbwmon/usage.htm1 new file mode 100644 index 00000000000000..1f0c342a7ccf66 --- /dev/null +++ b/package/lean/luci-app-wrtbwmon/root/usr/share/wrtbwmon/usage.htm1 @@ -0,0 +1,23 @@ +Traffic + +

Total Usage:

+ + + + + + + + + +
UserDownloadUploadTotalFirst seenLast seen
+
This page was generated on (date) + diff --git a/package/lean/luci-app-xlnetacc/Makefile b/package/lean/luci-app-xlnetacc/Makefile new file mode 100644 index 00000000000000..e54b589f56a2d8 --- /dev/null +++ b/package/lean/luci-app-xlnetacc/Makefile @@ -0,0 +1,64 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=luci-app-xlnetacc +PKG_VERSION:=1.0.3 +PKG_RELEASE:=9 + +PKG_LICENSE:=GPLv2 +PKG_MAINTAINER:=Sense + +include $(INCLUDE_DIR)/package.mk + +define Package/$(PKG_NAME) + SECTION:=luci + CATEGORY:=LuCI + SUBMENU:=3. Applications + TITLE:=LuCI Support for XLNetAcc + PKGARCH:=all + DEPENDS:=+jshn +wget +openssl-util +endef + +define Package/$(PKG_NAME)/description + LuCI Support for XLNetAcc. +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/$(PKG_NAME)/postinst +#!/bin/sh +if [ -z "$${IPKG_INSTROOT}" ]; then + ( . /etc/uci-defaults/luci-xlnetacc ) && rm -f /etc/uci-defaults/luci-xlnetacc +fi +exit 0 +endef + +define Package/$(PKG_NAME)/conffiles + /etc/config/xlnetacc +endef + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller + $(INSTALL_DATA) ./luasrc/controller/*.lua $(1)/usr/lib/lua/luci/controller/ + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi + $(INSTALL_DATA) ./luasrc/model/cbi/*.lua $(1)/usr/lib/lua/luci/model/cbi/ + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/xlnetacc + $(INSTALL_DATA) ./luasrc/view/xlnetacc/*.htm $(1)/usr/lib/lua/luci/view/xlnetacc/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./root/etc/config/xlnetacc $(1)/etc/config/xlnetacc + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./root/etc/init.d/xlnetacc $(1)/etc/init.d/xlnetacc + $(INSTALL_DIR) $(1)/etc/hotplug.d/iface + $(INSTALL_BIN) ./root/etc/hotplug.d/iface/95-xlnetacc $(1)/etc/hotplug.d/iface/95-xlnetacc + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) ./root/etc/uci-defaults/luci-xlnetacc $(1)/etc/uci-defaults/luci-xlnetacc + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) ./root/usr/bin/xlnetacc.sh $(1)/usr/bin/xlnetacc.sh + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n + po2lmo ./po/zh-cn/xlnetacc.po $(1)/usr/lib/lua/luci/i18n/xlnetacc.zh-cn.lmo +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/package/lean/luci-app-xlnetacc/luasrc/controller/xlnetacc.lua b/package/lean/luci-app-xlnetacc/luasrc/controller/xlnetacc.lua new file mode 100644 index 00000000000000..ab9d9294739598 --- /dev/null +++ b/package/lean/luci-app-xlnetacc/luasrc/controller/xlnetacc.lua @@ -0,0 +1,47 @@ +module("luci.controller.xlnetacc", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/xlnetacc") then + return + end + + entry({"admin", "services", "xlnetacc"}, + firstchild(), _("XLNetAcc")).dependent = false + + entry({"admin", "services", "xlnetacc", "general"}, + cbi("xlnetacc"), _("Settings"), 1) + + entry({"admin", "services", "xlnetacc", "log"}, + template("xlnetacc/logview"), _("Log"), 2) + + entry({"admin", "services", "xlnetacc", "status"}, call("action_status")) + entry({"admin", "services", "xlnetacc", "logdata"}, call("action_log")) +end + +local function is_running() + return luci.sys.call("(ps | grep xlnetacc.sh | grep -v 'grep') >/dev/null" ) == 0 +end + +function action_status() + luci.http.prepare_content("application/json") + luci.http.write_json({ + run_state = is_running(), + down_state = nixio.fs.readfile("/var/state/xlnetacc_down_state") or "", + up_state = nixio.fs.readfile("/var/state/xlnetacc_up_state") or "" + }) +end + +function action_log() + local uci = require "luci.model.uci".cursor() + local util = require "luci.util" + local log_data = { } + + log_data.syslog = util.trim(util.exec("logread | grep xlnetacc")) + if uci:get("xlnetacc", "general", "logging") ~= "0" then + log_data.client = nixio.fs.readfile("/var/log/xlnetacc.log") or "" + end + uci:unload("xlnetacc") + + luci.http.prepare_content("application/json") + luci.http.write_json(log_data) +end diff --git a/package/lean/luci-app-xlnetacc/luasrc/model/cbi/xlnetacc.lua b/package/lean/luci-app-xlnetacc/luasrc/model/cbi/xlnetacc.lua new file mode 100644 index 00000000000000..9bef249ce9b1d6 --- /dev/null +++ b/package/lean/luci-app-xlnetacc/luasrc/model/cbi/xlnetacc.lua @@ -0,0 +1,36 @@ +local m, s, o +local uci = luci.model.uci.cursor() + +m = Map("xlnetacc", "%s - %s" %{translate("XLNetAcc"), translate("Settings")}, translate("XLNetAcc is a Thunder joint broadband operators launched a commitment to help users solve the low broadband, slow Internet access, poor Internet experience of professional-grade broadband upgrade software.")) +m:append(Template("xlnetacc/status")) + +s = m:section(NamedSection, "general", "general", translate("General Settings")) +s.anonymous = true +s.addremove = false + +o = s:option(Flag, "enabled", translate("Enabled")) +o.rmempty = false + +o = s:option(Flag, "down_acc", translate("Enable DownLink Upgrade")) + +o = s:option(Flag, "up_acc", translate("Enable UpLink Upgrade")) + +o = s:option(Flag, "logging", translate("Enable Logging")) +o.default = "1" + +o = s:option(Flag, "verbose", translate("Enable verbose logging")) +o:depends("logging", "1") + +o = s:option(ListValue, "network", translate("Upgrade interface")) +uci:foreach("network", "interface", function(section) + if section[".name"] ~= "loopback" then + o:value(section[".name"]) + end +end) + +o = s:option(Value, "account", translate("XLNetAcc account")) + +o = s:option(Value, "password", translate("XLNetAcc password")) +o.password = true + +return m diff --git a/package/lean/luci-app-xlnetacc/luasrc/view/xlnetacc/logview.htm b/package/lean/luci-app-xlnetacc/luasrc/view/xlnetacc/logview.htm new file mode 100644 index 00000000000000..a07a27112f59d9 --- /dev/null +++ b/package/lean/luci-app-xlnetacc/luasrc/view/xlnetacc/logview.htm @@ -0,0 +1,49 @@ +<% css = [[ + #log_text { + padding: 10px; + text-align: left; + height: 500px; + overflow: auto; + } + #log_text pre { + word-break: break-all; + margin: 0; + } + .description { + color: #ffffff; + background-color: #0099ff; + } +]] +%> + +<%+header%> + +
+

<%:XLNetAcc%> - <%:Log Data%>

+
+
+
<%:Loading...%><%:Collecting data...%>
+
<%:Refresh every 5 seconds.%>
+
+
+
+ + + + +<%+footer%> diff --git a/package/lean/luci-app-xlnetacc/luasrc/view/xlnetacc/status.htm b/package/lean/luci-app-xlnetacc/luasrc/view/xlnetacc/status.htm new file mode 100644 index 00000000000000..3da9c4422a456b --- /dev/null +++ b/package/lean/luci-app-xlnetacc/luasrc/view/xlnetacc/status.htm @@ -0,0 +1,21 @@ +
+ <%:Running Status%> + + + + +
<%:XLNetAcc Running Status%><%:Collecting data...%>
<%:DownLink Upgrade Status%><%:Collecting data...%>
<%:UpLink Upgrade Status%><%:Collecting data...%>
+
+ + diff --git a/package/lean/luci-app-xlnetacc/po/zh-cn/xlnetacc.po b/package/lean/luci-app-xlnetacc/po/zh-cn/xlnetacc.po new file mode 100644 index 00000000000000..80c6b9d23bda09 --- /dev/null +++ b/package/lean/luci-app-xlnetacc/po/zh-cn/xlnetacc.po @@ -0,0 +1,92 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8\n" + +msgid "XLNetAcc" +msgstr "迅雷快鸟" + +msgid "XLNetAcc is a Thunder joint broadband operators launched a commitment to help users solve the low broadband, slow Internet access, poor Internet experience of professional-grade broadband upgrade software." +msgstr "迅雷快鸟是迅雷联合宽带运营商推出的一款致力于帮助用户解决宽带低、网速慢、上网体验差的专业级宽带加速软件。" + +msgid "Settings" +msgstr "设置" + +msgid "Log" +msgstr "日志" + +msgid "Running Status" +msgstr "运行状态" + +msgid "XLNetAcc Running Status" +msgstr "快鸟运行状态" + +msgid "DownLink Upgrade Status" +msgstr "下行提速状态" + +msgid "UpLink Upgrade Status" +msgstr "上行提速状态" + +msgid "RUNNING" +msgstr "运行中" + +msgid "NOT RUNNING" +msgstr "未运行" + +msgid "No upgrade information" +msgstr "暂无提速信息" + +msgid "General Settings" +msgstr "基本设置" + +msgid "Enabled" +msgstr "启用" + +msgid "Enable DownLink Upgrade" +msgstr "开启下行提速" + +msgid "Enable UpLink Upgrade" +msgstr "开启上行提速" + +msgid "Enable Logging" +msgstr "启用日志记录" + +msgid "Enable verbose logging" +msgstr "启用详细日志" + +msgid "Upgrade interface" +msgstr "指定提速接口" + +msgid "XLNetAcc account" +msgstr "迅雷快鸟帐号" + +msgid "XLNetAcc password" +msgstr "迅雷快鸟密码" + +msgid "Does not store the plaintext password, automatically emptied after start." +msgstr "不存储明文密码,启动后自动清空。" + +msgid "Encrypted password" +msgstr "加密后的密码" + +msgid "Auto-generate in accordance with the plaintext password, do not modify it!" +msgstr "根据明文密码自动生成,请勿修改!" + +msgid "Log Data" +msgstr "日志数据" + +msgid "Loading..." +msgstr "正在加载..." + +msgid "Refresh every 5 seconds." +msgstr "每 5 秒刷新。" + +msgid "syslog:" +msgstr "系统日志:" + +msgid "log file:" +msgstr "日志文件:" + +msgid "No log data." +msgstr "无日志数据。" + +msgid "Error get log data." +msgstr "获取日志数据失败。" diff --git a/package/lean/luci-app-xlnetacc/root/etc/config/xlnetacc b/package/lean/luci-app-xlnetacc/root/etc/config/xlnetacc new file mode 100644 index 00000000000000..4345070c4c71c7 --- /dev/null +++ b/package/lean/luci-app-xlnetacc/root/etc/config/xlnetacc @@ -0,0 +1,5 @@ + +config general 'general' + option enabled '0' + option network 'wan' + diff --git a/package/lean/luci-app-xlnetacc/root/etc/hotplug.d/iface/95-xlnetacc b/package/lean/luci-app-xlnetacc/root/etc/hotplug.d/iface/95-xlnetacc new file mode 100644 index 00000000000000..be0271ad8f25c1 --- /dev/null +++ b/package/lean/luci-app-xlnetacc/root/etc/hotplug.d/iface/95-xlnetacc @@ -0,0 +1,13 @@ +#!/bin/sh + +/etc/init.d/xlnetacc enabled || exit 0 +[ "$INTERFACE" != "$(uci get xlnetacc.general.network)" ] && exit 0 + +case "$ACTION" in + ifup) + /etc/init.d/xlnetacc start + ;; + ifdown) + /etc/init.d/xlnetacc stop + ;; +esac diff --git a/package/lean/luci-app-xlnetacc/root/etc/init.d/xlnetacc b/package/lean/luci-app-xlnetacc/root/etc/init.d/xlnetacc new file mode 100644 index 00000000000000..d1562811368c7b --- /dev/null +++ b/package/lean/luci-app-xlnetacc/root/etc/init.d/xlnetacc @@ -0,0 +1,49 @@ +#!/bin/sh /etc/rc.common + +START=95 +STOP=10 +SERVICE_DAEMONIZE=1 + +NAME=xlnetacc + +start() { + local retry=1 + while pidof "${NAME}.sh" >/dev/null 2>&1; do + [ $retry -ge 10 ] && return 1 || let retry++ + sleep 1 + done + + config_load "$NAME" + config_get_bool enabled "general" "enabled" 0 + config_get_bool down_acc "general" "down_acc" 0 + config_get_bool up_acc "general" "up_acc" 0 + config_get network "general" "network" + config_get username "general" "account" + config_get password "general" "password" + ( [ $enabled -eq 0 ] || [ $down_acc -eq 0 -a $up_acc -eq 0 ] || [ -z "$username" -o -z "$password" -o -z "$network" ] ) && return 2 + + logger -p "daemon.notice" -t "$NAME" "XLNetAcc is starting ..." + service_start /usr/bin/${NAME}.sh --start +} + +stop() { + ps | grep xlnetacc.sh | grep -v 'grep' >/dev/null 2>&1 || return 1 + + local pid spid + for pid in $(ps | grep xlnetacc.sh | grep -v 'grep' | awk '{print $1}'); do + echo "Stop XLNetAcc process PID: $pid" + kill -9 $pid >/dev/null 2>&1 + for spid in $(pgrep -P $pid "sleep"); do + echo "Stop XLNetAcc process SPID: $spid" + kill -9 $spid >/dev/null 2>&1 + done + done + logger -p "daemon.notice" -t "$NAME" "XLNetAcc has stoped." + return 0 +} + +restart() { + rm -rf /tmp/state/xlnetacc* + stop && sleep 1 + start +} diff --git a/package/lean/luci-app-xlnetacc/root/etc/uci-defaults/luci-xlnetacc b/package/lean/luci-app-xlnetacc/root/etc/uci-defaults/luci-xlnetacc new file mode 100644 index 00000000000000..632c026789c9e9 --- /dev/null +++ b/package/lean/luci-app-xlnetacc/root/etc/uci-defaults/luci-xlnetacc @@ -0,0 +1,22 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@xlnetacc[-1] + add ucitrack xlnetacc + set ucitrack.@xlnetacc[-1].init=xlnetacc + commit ucitrack +EOF + +general=$(uci -q get xlnetacc.@general[-1]) +if [ -z "$general" ]; then + uci -q add xlnetacc general +fi +if [ "$general"x != "general"x ]; then + uci -q batch <<-EOF >/dev/null + rename xlnetacc.@general[-1]="general" + commit xlnetacc + EOF +fi + +rm -rf /tmp/luci-indexcache /tmp/luci-modulecache +exit 0 diff --git a/package/lean/luci-app-xlnetacc/root/usr/bin/xlnetacc.sh b/package/lean/luci-app-xlnetacc/root/usr/bin/xlnetacc.sh new file mode 100644 index 00000000000000..57fac717aaa981 --- /dev/null +++ b/package/lean/luci-app-xlnetacc/root/usr/bin/xlnetacc.sh @@ -0,0 +1,670 @@ +#!/bin/sh + +# 声明常量 +readonly packageName='com.xunlei.vip.swjsq' +readonly protocolVersion=200 +readonly businessType=68 +readonly sdkVersion='2.1.1.177662' +readonly clientVersion='2.4.1.3' +readonly agent_xl="android-async-http/xl-acc-sdk/version-$sdkVersion" +readonly agent_down='okhttp/3.4.1' +readonly agent_up='android-async-http/xl-acc-sdk/version-1.0.0.1' +readonly client_type_down='android-swjsq' +readonly client_type_up='android-uplink' + +# 声明全局变量 +_bind_ip= +_http_cmd= +_peerid= +_devicesign= +_userid= +_loginkey= +_sessionid= +_portal_down= +_portal_up= +_dial_account= +access_url= +http_args= +user_agent= +link_cn= +lasterr= +sequence_xl=1000000 +sequence_down=$(( $(date +%s) / 6 )) +sequence_up=$sequence_down + +# 包含用于解析 JSON 格式返回值的函数 +. /usr/share/libubox/jshn.sh + +# 读取 UCI 设置相关函数 +uci_get_by_name() { + local ret=$(uci get $NAME.$1.$2 2> /dev/null) + echo -n ${ret:=$3} +} +uci_get_by_type() { + local ret=$(uci get $NAME.@$1[-1].$2 2> /dev/null) + echo -n ${ret:=$3} +} +uci_get_by_bool() { + case $(uci_get_by_name "$1" "$2" "$3") in + 1|on|true|yes|enabled) echo -n 1;; + *) echo -n 0;; + esac +} + +# 日志和状态栏输出。1 日志文件, 2 系统日志, 4 详细模式, 8 下行状态栏, 16 上行状态栏, 32 失败状态 +_log() { + local msg=$1 + local flag=$2 + [ -z "$msg" ] && return + [ -z "$flag" ] && flag=1 + local timestamp=$(date +'%Y/%m/%d %H:%M:%S') + + [ $logging -eq 0 -a $(( $flag & 1 )) -ne 0 ] && flag=$(( $flag ^ 1 )) + if [ $verbose -eq 0 -a $(( $flag & 4 )) -ne 0 ]; then + [ $(( $flag & 1 )) -ne 0 ] && flag=$(( $flag ^ 1 )) + [ $(( $flag & 2 )) -ne 0 ] && flag=$(( $flag ^ 2 )) + fi + if [ $down_acc -eq 0 -a $(( $flag & 8 )) -ne 0 ]; then + flag=$(( $flag ^ 8 )) + [ $up_acc -ne 0 ] && flag=$(( $flag | 16 )) + fi + if [ $up_acc -eq 0 -a $(( $flag & 16 )) -ne 0 ]; then + flag=$(( $flag ^ 16 )) + [ $down_acc -ne 0 ] && flag=$(( $flag | 8 )) + fi + + [ $(( $flag & 1 )) -ne 0 ] && echo "$timestamp $msg" >> $LOGFILE 2> /dev/null + [ $(( $flag & 2 )) -ne 0 ] && logger -p "daemon.info" -t "$NAME" "$msg" + + [ $(( $flag & 32 )) -eq 0 ] && local color="green" || local color="red" + [ $(( $flag & 8 )) -ne 0 ] && echo -n "$timestamp $msg" > $down_state_file 2> /dev/null + [ $(( $flag & 16 )) -ne 0 ] && echo -n "$timestamp $msg" > $up_state_file 2> /dev/null +} + +# 清理日志 +clean_log() { + [ $logging -eq 1 -a -f "$LOGFILE" ] || return + [ $(wc -l "$LOGFILE" | awk '{print $1}') -le 800 ] && return + _log "清理日志文件" + local logdata=$(tail -n 500 "$LOGFILE") + echo "$logdata" > $LOGFILE 2> /dev/null + unset logdata +} + +# 获取接口IP地址 +get_bind_ip() { + json_cleanup; json_load "$(ubus call network.interface.$network status 2> /dev/null)" >/dev/null 2>&1 + json_select "ipv4-address" >/dev/null 2>&1; json_select 1 >/dev/null 2>&1 + json_get_var _bind_ip "address" + if [ -z "$_bind_ip" -o "$_bind_ip"x == "0.0.0.0"x ]; then + _log "获取网络 $network IP地址失败" + return 1 + else + _log "绑定IP地址: $_bind_ip" + return 0 + fi +} + +# 定义基本 HTTP 命令和参数 +gen_http_cmd() { + _http_cmd="wget-ssl -nv -t 1 -T 5 -O - --no-check-certificate" + _http_cmd="$_http_cmd --bind-address=$_bind_ip" +} + +# 生成设备标识 +gen_device_sign() { + local ifname macaddr + while : ; do + ifname=$(uci get "network.$network.ifname" 2> /dev/null) + [ "${ifname:0:1}" == "@" ] && network="${ifname:1}" || break + done + [ -z "$ifname" ] && { _log "获取网络 $network 信息出错"; return; } + json_cleanup; json_load "$(ubus call network.device status {\"name\":\"$ifname\"} 2> /dev/null)" >/dev/null 2>&1 + json_get_var macaddr "macaddr" + [ -z "$macaddr" ] && { _log "获取网络 $network MAC地址出错"; return; } + macaddr=$(echo -n "$macaddr" | awk '{print toupper($0)}') + + # 计算peerID + local fake_peerid=$(awk -F- '{print toupper($5)}' '/proc/sys/kernel/random/uuid') + readonly _peerid="${fake_peerid}004V" + _log "_peerid is $_peerid" $(( 1 | 4 )) + + # 计算devicesign + # sign = div.10?.device_id + md5(sha1(packageName + businessType + md5(a protocolVersion specific GUID))) + local fake_device_id=$(echo -n "${macaddr//:/}" | openssl dgst -md5 | awk '{print $2}') + local fake_device_sign=$(echo -n "${fake_device_id}${packageName}${businessType}c7f21687eed3cdb400ca11fc2263c998" \ + | openssl dgst -sha1 | awk '{print $2}') + readonly _devicesign="div101.${fake_device_id}"$(echo -n "$fake_device_sign" | openssl dgst -md5 | awk '{print $2}') + _log "_devicesign is $_devicesign" $(( 1 | 4 )) +} + +# 快鸟帐号通用参数 +swjsq_json() { + let sequence_xl++ + # 生成POST数据 + json_init + json_add_string protocolVersion "$protocolVersion" + json_add_string sequenceNo "$sequence_xl" + json_add_string platformVersion '2' + json_add_string isCompressed '0' + json_add_string businessType "$businessType" + json_add_string clientVersion "$clientVersion" + json_add_string peerID "$_peerid" + json_add_string appName "ANDROID-$packageName" + json_add_string sdkVersion "${sdkVersion##*.}" + json_add_string devicesign "$_devicesign" + json_add_string deviceModel 'MI' + json_add_string deviceName 'Xiaomi Mi' + json_add_string OSVersion "7.1.1" +} + +# 帐号登录 +swjsq_login() { + swjsq_json + if [ -z "$_userid" -o -z "$_loginkey" ]; then + access_url='https://mobile-login.xunlei.com/login' + json_add_string userName "$username" + json_add_string passWord "$password" + json_add_string verifyKey + json_add_string verifyCode + else + access_url='https://mobile-login.xunlei.com/loginkey' + json_add_string userName "$_userid" + json_add_string loginKey "$_loginkey" + fi + json_close_object + + local ret=$($_http_cmd --user-agent="$agent_xl" "$access_url" --post-data="$(json_dump)") + case $? in + 0) + _log "login is $ret" $(( 1 | 4 )) + json_cleanup; json_load "$ret" >/dev/null 2>&1 + json_get_var lasterr "errorCode" + ;; + 2) lasterr=-2;; + 4) lasterr=-3;; + *) lasterr=-1;; + esac + + case ${lasterr:=-1} in + 0) + json_get_var _userid "userID" + json_get_var _loginkey "loginKey" + json_get_var _sessionid "sessionID" + _log "_sessionid is $_sessionid" $(( 1 | 4 )) + local outmsg="帐号登录成功"; _log "$outmsg" $(( 1 | 8 )) + ;; + 15) # 身份信息已失效 + _userid=; _loginkey=;; + -1) + local outmsg="帐号登录失败。迅雷服务器未响应,请稍候"; _log "$outmsg";; + -2) + local outmsg="Wget 参数解析错误,请更新 GNU Wget"; _log "$outmsg" $(( 1 | 8 | 32 ));; + -3) + local outmsg="Wget 网络通信失败,请稍候"; _log "$outmsg";; + *) + local errorDesc; json_get_var errorDesc "errorDesc" + local outmsg="帐号登录失败。错误代码: ${lasterr}"; \ + [ -n "$errorDesc" ] && outmsg="${outmsg},原因: $errorDesc"; _log "$outmsg" $(( 1 | 8 | 32 ));; + esac + + [ $lasterr -eq 0 ] && return 0 || return 1 +} + +# 帐号注销 +swjsq_logout() { + swjsq_json + json_add_string userID "$_userid" + json_add_string sessionID "$_sessionid" + json_close_object + + local ret=$($_http_cmd --user-agent="$agent_xl" 'https://mobile-login.xunlei.com/logout' --post-data="$(json_dump)") + _log "logout is $ret" $(( 1 | 4 )) + json_cleanup; json_load "$ret" >/dev/null 2>&1 + json_get_var lasterr "errorCode" + + case ${lasterr:=-1} in + 0) + _sessionid= + local outmsg="帐号注销成功"; _log "$outmsg" $(( 1 | 8 ));; + -1) + local outmsg="帐号注销失败。迅雷服务器未响应,请稍候"; _log "$outmsg";; + *) + local errorDesc; json_get_var errorDesc "errorDesc" + local outmsg="帐号注销失败。错误代码: ${lasterr}"; \ + [ -n "$errorDesc" ] && outmsg="${outmsg},原因: $errorDesc"; _log "$outmsg" $(( 1 | 8 | 32 ));; + esac + + [ $lasterr -eq 0 ] && return 0 || return 1 +} + +# 获取用户信息 +swjsq_getuserinfo() { + [ $1 -eq 1 ] && local _vasid=14 || local _vasid=33 + swjsq_json + json_add_string userID "$_userid" + json_add_string sessionID "$_sessionid" + json_add_string vasid "$_vasid" + json_close_object + + local ret=$($_http_cmd --user-agent="$agent_xl" 'https://mobile-login.xunlei.com/getuserinfo' --post-data="$(json_dump)") + _log "getuserinfo $1 is $ret" $(( 1 | 4 )) + json_cleanup; json_load "$ret" >/dev/null 2>&1 + json_get_var lasterr "errorCode" + + [ $1 -eq 1 ] && local outmsg="下行提速会员" || local outmsg="上行提速会员" + case ${lasterr:=-1} in + 0) + local index vasid isVip isYear expireDate can_upgrade + json_select "vipList" >/dev/null 2>&1 + while : ; do + json_select ${index:=1} >/dev/null 2>&1 + [ $? -ne 0 ] && break + json_get_var vasid "vasid" + json_get_var isVip "isVip" + json_get_var isYear "isYear" + json_get_var expireDate "expireDate" + json_select ".." >/dev/null 2>&1 + let index++ + ([ $1 -eq 1 -a ${vasid:-0} -eq 2 ] || [ ${vasid:-0} -eq $_vasid ]) && \ + [ ${isVip:-0} -eq 1 -o ${isYear:-0} -eq 1 ] && { can_upgrade=1; break; } + done + if [ ${can_upgrade:-0} -eq 1 ]; then + outmsg="获取${outmsg}信息成功。会员到期时间:${expireDate:0:4}-${expireDate:4:2}-${expireDate:6:2}"; \ + _log "$outmsg" $(( 1 | $1 * 8 )) + else + if [ ${#expireDate} -ge 8 ]; then + outmsg="${outmsg}已到期。会员到期时间:${expireDate:0:4}-${expireDate:4:2}-${expireDate:6:2}" + else + outmsg="${outmsg}无效" + fi + _log "$outmsg" $(( 1 | $1 * 8 | 32 )) + [ $1 -eq 1 ] && down_acc=0 || up_acc=0 + fi + ;; + -1) + outmsg="获取${outmsg}信息失败。迅雷服务器未响应,请稍候"; _log "$outmsg";; + *) + local errorDesc; json_get_var errorDesc "errorDesc" + outmsg="获取${outmsg}信息失败。错误代码: ${lasterr}"; \ + [ -n "$errorDesc" ] && outmsg="${outmsg},原因: $errorDesc"; _log "$outmsg" $(( 1 | $1 * 8 | 32 ));; + esac + + [ $lasterr -eq 0 ] && return 0 || return 1 +} + +# 获取提速入口 +swjsq_portal() { + xlnetacc_var $1 + + [ $1 -eq 1 ] && access_url='http://api.portal.swjsq.vip.xunlei.com:81/v2/queryportal' || \ + access_url='http://api.upportal.swjsq.vip.xunlei.com/v2/queryportal' + local ret=$($_http_cmd --user-agent="$user_agent" "$access_url") + _log "portal $1 is $ret" $(( 1 | 4 )) + json_cleanup; json_load "$ret" >/dev/null 2>&1 + json_get_var lasterr "errno" + + case ${lasterr:=-1} in + 0) + local interface_ip interface_port province sp + json_get_var interface_ip "interface_ip" + json_get_var interface_port "interface_port" + json_get_var province "province_name" + json_get_var sp "sp_name" + if [ $1 -eq 1 ]; then + _portal_down="http://$interface_ip:$interface_port/v2" + _log "_portal_down is $_portal_down" $(( 1 | 4 )) + else + _portal_up="http://$interface_ip:$interface_port/v2" + _log "_portal_up is $_portal_up" $(( 1 | 4 )) + fi + local outmsg="获取${link_cn}提速入口成功"; \ + [ -n "$province" -a -n "$sp" ] && outmsg="${outmsg}。运营商:${province}${sp}"; _log "$outmsg" $(( 1 | $1 * 8 )) + ;; + -1) + local outmsg="获取${link_cn}提速入口失败。迅雷服务器未响应,请稍候"; _log "$outmsg";; + *) + local message; json_get_var message "message" + local outmsg="获取${link_cn}提速入口失败。错误代码: ${lasterr}"; \ + [ -n "$message" ] && outmsg="${outmsg},原因: $message"; _log "$outmsg" $(( 1 | $1 * 8 | 32 ));; + esac + + [ $lasterr -eq 0 ] && return 0 || return 1 +} + +# 获取网络带宽信息 +isp_bandwidth() { + xlnetacc_var $1 + + local ret=$($_http_cmd --user-agent="$user_agent" "$access_url/bandwidth?${http_args%&dial_account=*}") + _log "bandwidth $1 is $ret" $(( 1 | 4 )) + json_cleanup; json_load "$ret" >/dev/null 2>&1 + json_get_var lasterr "errno" + + case ${lasterr:=-1} in + 0) + # 获取带宽数据 + local can_upgrade bind_dial_account dial_account stream cur_bandwidth max_bandwidth + [ $1 -eq 1 ] && stream="downstream" || stream="upstream" + json_get_var can_upgrade "can_upgrade" + json_get_var bind_dial_account "bind_dial_account" + json_get_var dial_account "dial_account" + json_select; json_select "bandwidth" >/dev/null 2>&1 + json_get_var cur_bandwidth "$stream" + json_select; json_select "max_bandwidth" >/dev/null 2>&1 + json_get_var max_bandwidth "$stream" + json_select + cur_bandwidth=$(expr ${cur_bandwidth:-0} / 1024) + max_bandwidth=$(expr ${max_bandwidth:-0} / 1024) + + if [ -n "$bind_dial_account" -a "$bind_dial_account" != "$dial_account" ]; then + local outmsg="绑定宽带账号 $bind_dial_account 与当前宽带账号 $dial_account 不一致,请联系迅雷客服解绑(每月仅一次)"; \ + _log "$outmsg" $(( 1 | 8 | 32 )) + down_acc=0; up_acc=0 + elif [ $can_upgrade -eq 0 ]; then + local message; json_get_var message "richmessage"; [ -z "$message" ] && json_get_var message "message" + local outmsg="${link_cn}无法提速"; \ + [ -n "$message" ] && outmsg="${outmsg},原因: $message"; _log "$outmsg" $(( 1 | $1 * 8 | 32 )) + [ $1 -eq 1 ] && down_acc=0 || up_acc=0 + elif [ $cur_bandwidth -ge $max_bandwidth ]; then + local outmsg="${link_cn}无需提速。当前带宽 ${cur_bandwidth}M,超过最大可提升带宽 ${max_bandwidth}M"; \ + _log "$outmsg" $(( 1 | $1 * 8 )) + [ $1 -eq 1 ] && down_acc=0 || up_acc=0 + else + if [ -z "$_dial_account" -a -n "$dial_account" ]; then + _dial_account=$dial_account + _log "_dial_account is $_dial_account" $(( 1 | 4 )) + fi + local outmsg="${link_cn}可以提速。当前带宽 ${cur_bandwidth}M,可提升至 ${max_bandwidth}M"; _log "$outmsg" $(( 1 | $1 * 8 )) + fi + ;; + 724) # 724 账号存在异常 + lasterr=-2 + local outmsg="获取${link_cn}网络带宽信息失败。原因: 您的账号存在异常,请联系迅雷客服反馈"; _log "$outmsg" $(( 1 | $1 * 8 | 32 ));; + 3103) # 3103 线路暂不支持 + lasterr=0 + local province sp + json_get_var province "province_name"; json_get_var sp "sp_name" + local outmsg="${link_cn}无法提速。原因: ${province}${sp}线路暂不支持"; _log "$outmsg" $(( 1 | $1 * 8 | 32 )) + [ $1 -eq 1 ] && down_acc=0 || up_acc=0 + ;; + -1) + local outmsg="获取${link_cn}网络带宽信息失败。运营商服务器未响应,请稍候"; _log "$outmsg";; + *) + local message; json_get_var message "richmessage"; [ -z "$message" ] && json_get_var message "message" + local outmsg="获取${link_cn}网络带宽信息失败。错误代码: ${lasterr}"; \ + [ -n "$message" ] && outmsg="${outmsg},原因: $message"; _log "$outmsg" $(( 1 | $1 * 8 | 32 ));; + esac + + [ $lasterr -eq 0 ] && return 0 || return 1 +} + +# 发送带宽提速信号 +isp_upgrade() { + xlnetacc_var $1 + + local ret=$($_http_cmd --user-agent="$user_agent" "$access_url/upgrade?$http_args") + _log "upgrade $1 is $ret" $(( 1 | 4 )) + json_cleanup; json_load "$ret" >/dev/null 2>&1 + json_get_var lasterr "errno" + + case ${lasterr:=-1} in + 0) + local bandwidth + json_select "bandwidth" >/dev/null 2>&1 + json_get_var bandwidth "downstream" + [ ${bandwidth:=0} -ge 1024 ] && bandwidth=$(( $bandwidth / 1024 )) + local outmsg="${link_cn}提速成功,带宽已提升到 ${bandwidth}M"; _log "$outmsg" $(( 1 | $1 * 8 )) + [ $1 -eq 1 ] && down_acc=2 || up_acc=2 + ;; + 812) # 812 已处于提速状态 + lasterr=0 + local outmsg="${link_cn}提速成功,当前宽带已处于提速状态"; _log "$outmsg" $(( 1 | $1 * 8 )) + [ $1 -eq 1 ] && down_acc=2 || up_acc=2 + ;; + 724) # 724 账号存在异常 + lasterr=-2 + local outmsg="${link_cn}提速失败。原因: 您的账号存在异常,请联系迅雷客服反馈"; _log "$outmsg" $(( 1 | $1 * 8 | 32 ));; + -1) + local outmsg="${link_cn}提速失败。运营商服务器未响应,请稍候"; _log "$outmsg";; + *) + local message; json_get_var message "richmessage"; [ -z "$message" ] && json_get_var message "message" + local outmsg="${link_cn}提速失败。错误代码: ${lasterr}"; \ + [ -n "$message" ] && outmsg="${outmsg},原因: $message"; _log "$outmsg" $(( 1 | $1 * 8 | 32 ));; + esac + + [ $lasterr -eq 0 ] && return 0 || return 1 +} + +# 发送提速心跳信号 +isp_keepalive() { + xlnetacc_var $1 + + local ret=$($_http_cmd --user-agent="$user_agent" "$access_url/keepalive?$http_args") + _log "keepalive $1 is $ret" $(( 1 | 4 )) + json_cleanup; json_load "$ret" >/dev/null 2>&1 + json_get_var lasterr "errno" + + case ${lasterr:=-1} in + 0) + local outmsg="${link_cn}心跳信号返回正常"; _log "$outmsg";; + 513) # 513 提速通道不存在 + lasterr=-2 + local outmsg="${link_cn}提速超时,提速通道不存在"; _log "$outmsg" $(( 1 | $1 * 8 | 32 ));; + -1) + local outmsg="${link_cn}心跳信号发送失败。运营商服务器未响应,请稍候"; _log "$outmsg";; + *) + local message; json_get_var message "richmessage"; [ -z "$message" ] && json_get_var message "message" + local outmsg="${link_cn}提速失效。错误代码: ${lasterr}"; \ + [ -n "$message" ] && outmsg="${outmsg},原因: $message"; _log "$outmsg" $(( 1 | $1 * 8 | 32 ));; + esac + + [ $lasterr -eq 0 ] && return 0 || return 1 +} + +# 发送带宽恢复信号 +isp_recover() { + xlnetacc_var $1 + + local ret=$($_http_cmd --user-agent="$user_agent" "$access_url/recover?$http_args") + _log "recover $1 is $ret" $(( 1 | 4 )) + json_cleanup; json_load "$ret" >/dev/null 2>&1 + json_get_var lasterr "errno" + + case ${lasterr:=-1} in + 0) + local outmsg="${link_cn}带宽已恢复"; _log "$outmsg" $(( 1 | $1 * 8 )) + [ $1 -eq 1 ] && down_acc=1 || up_acc=1;; + -1) + local outmsg="${link_cn}带宽恢复失败。运营商服务器未响应,请稍候"; _log "$outmsg";; + *) + local message; json_get_var message "richmessage"; [ -z "$message" ] && json_get_var message "message" + local outmsg="${link_cn}带宽恢复失败。错误代码: ${lasterr}"; \ + [ -n "$message" ] && outmsg="${outmsg},原因: $message"; _log "$outmsg" $(( 1 | $1 * 8 | 32 ));; + esac + + [ $lasterr -eq 0 ] && return 0 || return 1 +} + +# 查询提速信息,未使用 +isp_query() { + xlnetacc_var $1 + + local ret=$($_http_cmd --user-agent="$user_agent" "$access_url/query_try_info?$http_args") + _log "query_try_info $1 is $ret" $(( 1 | 4 )) + json_cleanup; json_load "$ret" >/dev/null 2>&1 + json_get_var lasterr "errno" + + [ $lasterr -eq 0 ] && return 0 || return 1 +} + +# 设置参数变量 +xlnetacc_var() { + if [ $1 -eq 1 ]; then + let sequence_down++ + access_url=$_portal_down + http_args="sequence=${sequence_down}&client_type=${client_type_down}-${clientVersion}&client_version=${client_type_down//-/}-${clientVersion}&chanel=umeng-10900011&time_and=$(date +%s)000" + user_agent=$agent_down + link_cn="下行" + else + let sequence_up++ + access_url=$_portal_up + http_args="sequence=${sequence_up}&client_type=${client_type_up}-${clientVersion}&client_version=${client_type_up//-/}-${clientVersion}" + user_agent=$agent_up + link_cn="上行" + fi + http_args="${http_args}&peerid=${_peerid}&userid=${_userid}&sessionid=${_sessionid}&user_type=1&os=android-7.1.1" + [ -n "$_dial_account" ] && http_args="${http_args}&dial_account=${_dial_account}" +} + +# 重试循环 +xlnetacc_retry() { + if [ $# -ge 3 -a $3 -ne 0 ]; then + [ $2 -eq 1 -a $down_acc -ne $3 ] && return 0 + [ $2 -eq 2 -a $up_acc -ne $3 ] && return 0 + fi + + local retry=1 + while : ; do + lasterr= + eval $1 $2 && break # 成功 + [ $# -ge 4 -a $retry -ge $4 ] && break || let retry++ # 重试超时 + case $lasterr in + -1) sleep 5s;; # 服务器未响应 + -2) break;; # 严重错误 + *) sleep 3s;; # 其它错误 + esac + done + + [ ${lasterr:-0} -eq 0 ] && return 0 || return 1 +} + +# 注销已登录帐号 +xlnetacc_logout() { + [ -z "$_sessionid" ] && return 2 + [ $# -ge 1 ] && local retry=$1 || local retry=1 + + xlnetacc_retry 'isp_recover' 1 2 $retry + xlnetacc_retry 'isp_recover' 2 2 $retry + xlnetacc_retry 'swjsq_logout' 0 0 $retry + [ $down_acc -ne 0 ] && down_acc=1; [ $up_acc -ne 0 ] && up_acc=1 + _sessionid=; _dial_account= + + [ $lasterr -eq 0 ] && return 0 || return 1 +} + +# 中止信号处理 +sigterm() { + _log "trap sigterm, exit" $(( 1 | 4 )) + xlnetacc_logout + rm -f "$down_state_file" "$up_state_file" + exit 0 +} + +# 初始化 +xlnetacc_init() { + [ "$1" != "--start" ] && return 1 + + # 防止重复启动 + local pid + for pid in $(pidof "${0##*/}"); do + [ $pid -ne $$ ] && return 1 + done + + # 读取设置 + readonly NAME=xlnetacc + readonly LOGFILE=/var/log/${NAME}.log + readonly down_state_file=/var/state/${NAME}_down_state + readonly up_state_file=/var/state/${NAME}_up_state + down_acc=$(uci_get_by_bool "general" "down_acc" 0) + up_acc=$(uci_get_by_bool "general" "up_acc" 0) + readonly logging=$(uci_get_by_bool "general" "logging" 1) + readonly verbose=$(uci_get_by_bool "general" "verbose" 0) + network=$(uci_get_by_name "general" "network" "wan") + readonly username=$(uci_get_by_name "general" "account") + readonly password=$(uci_get_by_name "general" "password") + local enabled=$(uci_get_by_bool "general" "enabled" 0) + ([ $enabled -eq 0 ] || [ $down_acc -eq 0 -a $up_acc -eq 0 ] || [ -z "$username" -o -z "$password" -o -z "$network" ]) && return 2 + + [ $logging -eq 1 ] && [ ! -d /var/log ] && mkdir -p /var/log + [ -f "$LOGFILE" ] && _log "------------------------------" + _log "迅雷快鸟正在启动..." + + # 检查外部调用工具 + command -v wget-ssl >/dev/null || { _log "GNU Wget 未安装"; return 3; } + local opensslchk=$(echo -n 'openssl' | openssl dgst -sha1 | awk '{print $2}') + [ "$opensslchk" != 'c898fa1e7226427010e329971e82c669f8d8abb4' ] && { _log "openssl-util 未安装或计算错误"; return 3; } + + # 捕获中止信号 + trap 'sigterm' INT # Ctrl-C + trap 'sigterm' QUIT # Ctrl-\ + trap 'sigterm' TERM # kill + + # 生成设备标识 + gen_device_sign + [ ${#_peerid} -ne 16 -o ${#_devicesign} -ne 71 ] && return 4 + + clean_log + [ -d /var/state ] || mkdir -p /var/state + return 0 +} + +# 程序主体 +xlnetacc_main() { + while : ; do + # 获取外网IP地址 + xlnetacc_retry 'get_bind_ip' + gen_http_cmd + + # 注销快鸟帐号 + xlnetacc_logout 3 && sleep 3s + + # 登录快鸟帐号 + while : ; do + lasterr= + swjsq_login + case $lasterr in + 0) break;; # 登录成功 + -1) sleep 5s;; # 服务器未响应 + -2) return 7;; # Wget 参数解析错误 + -3) sleep 3s;; # Wget 网络通信失败 + 6) sleep 130m;; # 需要输入验证码 + 8) sleep 3m;; # 服务器系统维护 + 15) sleep 1s;; # 身份信息已失效 + *) return 5;; # 登录失败 + esac + done + + # 获取用户信息 + xlnetacc_retry 'swjsq_getuserinfo' 1 1 + xlnetacc_retry 'swjsq_getuserinfo' 2 1 + [ $down_acc -eq 0 -a $up_acc -eq 0 ] && break + # 获取提速入口 + xlnetacc_retry 'swjsq_portal' 1 1 + xlnetacc_retry 'swjsq_portal' 2 1 + # 获取带宽信息 + xlnetacc_retry 'isp_bandwidth' 1 1 10 || { sleep 3m; continue; } + xlnetacc_retry 'isp_bandwidth' 2 1 10 || { sleep 3m; continue; } + [ $down_acc -eq 0 -a $up_acc -eq 0 ] && break + # 带宽提速 + xlnetacc_retry 'isp_upgrade' 1 1 10 || { sleep 3m; continue; } + xlnetacc_retry 'isp_upgrade' 2 1 10 || { sleep 3m; continue; } + + # 心跳保持 +# local retry=1 + while : ; do + clean_log # 清理日志 + sleep 10m +# [ $retry -ge 144 ] && break || let retry++ # 心跳最多保持24小时,144=24*60/10 + xlnetacc_retry 'isp_keepalive' 1 2 5 || break + xlnetacc_retry 'isp_keepalive' 2 2 5 || break + done + done + xlnetacc_logout + _log "无法提速,迅雷快鸟已停止。" + return 6 +} + +# 程序入口 +xlnetacc_init "$@" && xlnetacc_main +exit $? diff --git a/package/lean/luci-app-zerotier/Makefile b/package/lean/luci-app-zerotier/Makefile new file mode 100644 index 00000000000000..d557df631fc9a0 --- /dev/null +++ b/package/lean/luci-app-zerotier/Makefile @@ -0,0 +1,19 @@ +# +# Copyright (C) 2008-2014 The LuCI Team +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI for Zerotier +LUCI_DEPENDS:=+zerotier +LUCI_PKGARCH:=all +PKG_VERSION:=1.0 +PKG_RELEASE:=17 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature + + diff --git a/package/lean/luci-app-zerotier/luasrc/controller/zerotier.lua b/package/lean/luci-app-zerotier/luasrc/controller/zerotier.lua new file mode 100644 index 00000000000000..e02a4f793ef9de --- /dev/null +++ b/package/lean/luci-app-zerotier/luasrc/controller/zerotier.lua @@ -0,0 +1,23 @@ +module("luci.controller.zerotier",package.seeall) + +function index() + if not nixio.fs.access("/etc/config/zerotier")then +return +end + +entry({"admin","vpn"}, firstchild(), "VPN", 45).dependent = false + +entry({"admin", "vpn", "zerotier"},firstchild(), _("ZeroTier")).dependent = false + +entry({"admin", "vpn", "zerotier", "general"},cbi("zerotier/settings"), _("Base Setting"), 1) +entry({"admin", "vpn", "zerotier", "log"},form("zerotier/info"), _("Interface Info"), 2) + +entry({"admin","vpn","zerotier","status"},call("act_status")) +end + +function act_status() +local e={} + e.running=luci.sys.call("pgrep /usr/bin/zerotier-one >/dev/null")==0 + luci.http.prepare_content("application/json") + luci.http.write_json(e) +end diff --git a/package/lean/luci-app-zerotier/luasrc/model/cbi/zerotier/info.lua b/package/lean/luci-app-zerotier/luasrc/model/cbi/zerotier/info.lua new file mode 100644 index 00000000000000..9bc3824cfcdf87 --- /dev/null +++ b/package/lean/luci-app-zerotier/luasrc/model/cbi/zerotier/info.lua @@ -0,0 +1,15 @@ +local fs = require "nixio.fs" +local conffile = "/tmp/zero.info" + +f = SimpleForm("logview") + +t = f:field(TextValue, "conf") +t.rmempty = true +t.rows = 15 +function t.cfgvalue() + luci.sys.exec("ifconfig $(ifconfig | grep zt | awk '{print $1}') > /tmp/zero.info") + return fs.readfile(conffile) or "" +end +t.readonly="readonly" + +return f \ No newline at end of file diff --git a/package/lean/luci-app-zerotier/luasrc/model/cbi/zerotier/settings.lua b/package/lean/luci-app-zerotier/luasrc/model/cbi/zerotier/settings.lua new file mode 100644 index 00000000000000..14f4bdce056eee --- /dev/null +++ b/package/lean/luci-app-zerotier/luasrc/model/cbi/zerotier/settings.lua @@ -0,0 +1,26 @@ + +a=Map("zerotier",translate("ZeroTier"),translate("Zerotier is an open source, cross-platform and easy to use virtual LAN")) +a:section(SimpleSection).template = "zerotier/zerotier_status" + +t=a:section(NamedSection,"sample_config","zerotier") +t.anonymous=true +t.addremove=false + +e=t:option(Flag,"enabled",translate("Enable")) +e.default=0 +e.rmempty=false + +e=t:option(DynamicList,"join",translate('ZeroTier Network ID')) +e.password=true +e.rmempty=false + +e=t:option(Flag,"nat",translate("Auto NAT Clients")) +e.default=0 +e.rmempty=false +e.description = translate("Allow zerotier clients access your LAN network") + +e=t:option(DummyValue,"opennewwindow" , + translate("")) +e.description = translate("Create or manage your zerotier network, and auth clients who could access") + +return a diff --git a/package/lean/luci-app-zerotier/luasrc/view/zerotier/zerotier_status.htm b/package/lean/luci-app-zerotier/luasrc/view/zerotier/zerotier_status.htm new file mode 100644 index 00000000000000..9d216c5d93be17 --- /dev/null +++ b/package/lean/luci-app-zerotier/luasrc/view/zerotier/zerotier_status.htm @@ -0,0 +1,22 @@ + + +
+

+ <%:Collecting data...%> +

+
diff --git a/package/lean/luci-app-zerotier/po/zh-cn/zerotier.po b/package/lean/luci-app-zerotier/po/zh-cn/zerotier.po new file mode 100644 index 00000000000000..3787a890d500d3 --- /dev/null +++ b/package/lean/luci-app-zerotier/po/zh-cn/zerotier.po @@ -0,0 +1,22 @@ +msgid "" +msgstr "" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Gtranslator 2.91.7\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgid "Zerotier is an open source, cross-platform and easy to use virtual LAN" +msgstr "Zerotier是一个开源,跨平台,而且适合内网穿透互联的傻瓜配置虚拟 VPN LAN" + +msgid "Auto NAT Clients" +msgstr "自动允许客户端NAT" + +msgid "Allow zerotier clients access your LAN network" +msgstr "允许Zerotier的拨入客户端访问路由器LAN资源(需要在 Zerotier管理页面设定到LAN网段的路由表)" + +msgid "Create or manage your zerotier network, and auth clients who could access" +msgstr "点击跳转到Zerotier官网管理平台,新建或者管理网络,并允许客户端接入访问你私人网路(新接入的节点默认不允许访问)" + +msgid "Interface Info" +msgstr "接口信息" diff --git a/package/lean/luci-app-zerotier/root/etc/init.d/zerotier b/package/lean/luci-app-zerotier/root/etc/init.d/zerotier new file mode 100644 index 00000000000000..446711acbaaa3d --- /dev/null +++ b/package/lean/luci-app-zerotier/root/etc/init.d/zerotier @@ -0,0 +1,101 @@ +#!/bin/sh /etc/rc.common + +START=90 + +USE_PROCD=1 + +PROG=/usr/bin/zerotier-one +CONFIG_PATH=/var/lib/zerotier-one + +section_enabled() { + config_get_bool enabled "$1" 'enabled' 0 + [ $enabled -gt 0 ] +} + +start_instance() { + local cfg="$1" + local port secret config_path + local ARGS="" + + if ! section_enabled "$cfg"; then + echo "disabled in config" + return 1 + fi + + [ -d /etc/config/zero ] || mkdir -p /etc/config/zero + config_path=/etc/config/zero + + config_get_bool port $cfg 'port' + config_get secret $cfg 'secret' + + # Remove existing link or folder + rm -rf $CONFIG_PATH + + # Create link from CONFIG_PATH to config_path + if [ -n "$config_path" -a "$config_path" != $CONFIG_PATH ]; then + if [ ! -d "$config_path" ]; then + echo "ZeroTier config_path does not exist: $config_path" + return + fi + + ln -s $config_path $CONFIG_PATH + fi + + mkdir -p $CONFIG_PATH/networks.d + + if [ -n "$port" ]; then + ARGS="$ARGS -p$port" + fi + + if [ "$secret" = "generate" ]; then + echo "Generate secret - please wait..." + local sf="/tmp/zt.$cfg.secret" + + zerotier-idtool generate "$sf" > /dev/null + [ $? -ne 0 ] && return 1 + + secret="$(cat $sf)" + rm "$sf" + + uci set zerotier.$cfg.secret="$secret" + uci commit zerotier + fi + + if [ -n "$secret" ]; then + echo "$secret" > $CONFIG_PATH/identity.secret + # make sure there is not previous identity.public + rm -f $CONFIG_PATH/identity.public + fi + + add_join() { + # an (empty) config file will cause ZT to join a network + touch $CONFIG_PATH/networks.d/$1.conf + } + + config_list_foreach $cfg 'join' add_join + + procd_open_instance + procd_set_param command $PROG $ARGS $CONFIG_PATH + procd_set_param stderr 1 + procd_close_instance +} + +start_service() { + config_load 'zerotier' + config_foreach start_instance 'zerotier' + touch /tmp/zero.log && /etc/zerotier.start > /tmp/zero.log 2>&1 & +} + +stop_instance() { + rm -f /tmp/zero.log + local cfg="$1" + + # Remove existing link or folder + rm -rf $CONFIG_PATH +} + +stop_service() { + config_load 'zerotier' + config_foreach stop_instance 'zerotier' +} + diff --git a/package/lean/luci-app-zerotier/root/etc/uci-defaults/40_luci-zerotier b/package/lean/luci-app-zerotier/root/etc/uci-defaults/40_luci-zerotier new file mode 100644 index 00000000000000..95f0ccfc963f44 --- /dev/null +++ b/package/lean/luci-app-zerotier/root/etc/uci-defaults/40_luci-zerotier @@ -0,0 +1,17 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@zerotier[-1] + add ucitrack zerotier + set ucitrack.@zerotier[-1].init=zerotier + commit ucitrack + delete firewall.zerotier + set firewall.zerotier=include + set firewall.zerotier.type=script + set firewall.zerotier.path=/etc/zerotier.start + set firewall.zerotier.reload=1 + commit firewall +EOF + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/package/lean/luci-app-zerotier/root/etc/zerotier.start b/package/lean/luci-app-zerotier/root/etc/zerotier.start new file mode 100644 index 00000000000000..eb7bb8c27b61e9 --- /dev/null +++ b/package/lean/luci-app-zerotier/root/etc/zerotier.start @@ -0,0 +1,29 @@ +#!/bin/sh + +zero_enable=$(uci get zerotier.sample_config.enabled) + +if [ $zero_enable -eq 1 ]; then + +if [ -f /tmp/zero.log ];then +while [ "$(ifconfig | grep zt | awk '{print $1}')" = "" ] +do + sleep 1 +done +fi + +nat_enable=$(uci get zerotier.sample_config.nat) +zt0=$(ifconfig | grep zt | awk '{print $1}') + +echo $zt0 > /tmp/zt.nif +iptables -D FORWARD -i $zt0 -j ACCEPT 2>/dev/null +iptables -D FORWARD -o $zt0 -j ACCEPT 2>/dev/null +iptables -t nat -D POSTROUTING -o $zt0 -j MASQUERADE 2>/dev/null +if [ $nat_enable -eq 1 ]; then + iptables -I FORWARD -i $zt0 -j ACCEPT + iptables -I FORWARD -o $zt0 -j ACCEPT + iptables -t nat -I POSTROUTING -o $zt0 -j MASQUERADE + ip_segment=$(ip route | grep "dev $zt0 proto" | awk '{print $1}') + iptables -t nat -I POSTROUTING -s $ip_segment -j MASQUERADE +fi + +fi diff --git a/package/lean/luci-app-zerotier/root/etc/zerotier.stop b/package/lean/luci-app-zerotier/root/etc/zerotier.stop new file mode 100644 index 00000000000000..68f3b718a681d0 --- /dev/null +++ b/package/lean/luci-app-zerotier/root/etc/zerotier.stop @@ -0,0 +1,12 @@ +#!/bin/sh + +zt0=$(ifconfig | grep zt | awk '{print $1}') +if [ "$zt0" = "" ]; then + zt0=$(cat /tmp/cat /tmp/zt.nif) +fi +echo "zt interface $zt0 is stopped!" +iptables -D FORWARD -i $zt0 -j ACCEPT 2>/dev/null +iptables -D FORWARD -o $zt0 -j ACCEPT 2>/dev/null +iptables -t nat -D POSTROUTING -o $zt0 -j MASQUERADE 2>/dev/null +ip_segment=$(ip route | grep "dev $zt0 proto" | awk '{print $1}') +iptables -t nat -D POSTROUTING -s $ip_segment -j MASQUERADE 2>/dev/null diff --git a/package/lean/luci-app-zerotier/root/etc/zerotier/zerotier.log b/package/lean/luci-app-zerotier/root/etc/zerotier/zerotier.log new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/package/lean/luci-lib-docker/Makefile b/package/lean/luci-lib-docker/Makefile new file mode 100644 index 00000000000000..a9a88b92f39441 --- /dev/null +++ b/package/lean/luci-lib-docker/Makefile @@ -0,0 +1,49 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=luci-lib-docker +PKG_VERSION:=v0.3.0 +PKG_RELEASE:=beta +PKG_MAINTAINER:=lisaac +PKG_LICENSE:=AGPL-3.0 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/lisaac/luci-lib-docker.git +PKG_SOURCE_VERSION:=$(PKG_VERSION) + +PKG_SOURCE_SUBDIR:=$(PKG_NAME) +PKG_SOURCE:=$(PKG_SOURCE_SUBDIR)-$(PKG_VERSION).tar.gz +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) + +include $(INCLUDE_DIR)/package.mk + +define Package/$(PKG_NAME) + SECTION:=luci + CATEGORY:=LuCI + SUBMENU:=6. Libraries + TITLE:=Docker Engine API for LuCI + PKGARCH:=all + DEPENDS:=+luci-lib-json +endef + +define Package/$(PKG_NAME)/description + Docker Engine API for LuCI +endef + +define Build/Prepare + tar -xzvf $(DL_DIR)/$(PKG_SOURCE) -C $(BUILD_DIR) +endef + +define Build/Compile +endef + +define Package/$(PKG_NAME)/postinst +#!/bin/sh +rm -fr /tmp/luci-indexcache /tmp/luci-modulecache +endef + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/usr/lib/lua/luci + cp -pR $(PKG_BUILD_DIR)/luasrc/* $(1)/usr/lib/lua/luci/ +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/package/lean/luci-lib-docker/luasrc/docker.lua b/package/lean/luci-lib-docker/luasrc/docker.lua new file mode 100644 index 00000000000000..8a5f056fc7b139 --- /dev/null +++ b/package/lean/luci-lib-docker/luasrc/docker.lua @@ -0,0 +1,432 @@ +require "nixio.util" +require "luci.util" +local jsonc = require "luci.jsonc" +local nixio = require "nixio" +local ltn12 = require "luci.ltn12" +local fs = require "nixio.fs" + +local urlencode = luci.util.urlencode or luci.http and luci.http.protocol and luci.http.protocol.urlencode +local json_stringify = jsonc.stringify +local json_parse = jsonc.parse + +local chunksource = function(sock, buffer) + buffer = buffer or "" + return function() + local output + local _, endp, count = buffer:find("^([0-9a-fA-F]+);?.-\r\n") + if not count then -- lua ^ only match start of stirng,not start of line + _, endp, count = buffer:find("\r\n([0-9a-fA-F]+);?.-\r\n") + end + while not count do + local newblock, code = sock:recv(1024) + if not newblock then + return nil, code + end + buffer = buffer .. newblock + _, endp, count = buffer:find("^([0-9a-fA-F]+);?.-\r\n") + if not count then + _, endp, count = buffer:find("\r\n([0-9a-fA-F]+);?.-\r\n") + end + end + count = tonumber(count, 16) + if not count then + return nil, -1, "invalid encoding" + elseif count == 0 then -- finial + return nil + elseif count + 2 <= #buffer - endp then + output = buffer:sub(endp + 1, endp + count) + buffer = buffer:sub(endp + count + 3) -- don't forget handle buffer + return output + else + output = buffer:sub(endp + 1, endp + count) + buffer = "" + if count > #output then + local remain, code = sock:recvall(count - #output) --need read remaining + if not remain then + return nil, code + end + output = output .. remain + count, code = sock:recvall(2) --read \r\n + else + count, code = sock:recvall(count + 2 - #buffer + endp) + end + if not count then + return nil, code + end + return output + end + end +end + +local chunksink = function (sock) + return function(chunk, err) + if not chunk then + return sock:writeall("0\r\n\r\n") + else + return sock:writeall(("%X\r\n%s\r\n"):format(#chunk, tostring(chunk))) + end + end +end + +local docker_stream_filter = function(buffer) + buffer = buffer or "" + if #buffer < 8 then + return "" + end + local stream_type = ((string.byte(buffer, 1) == 1) and "stdout") or ((string.byte(buffer, 1) == 2) and "stderr") or ((string.byte(buffer, 1) == 0) and "stdin") or "stream_err" + local valid_length = + tonumber(string.byte(buffer, 5)) * 256 * 256 * 256 + tonumber(string.byte(buffer, 6)) * 256 * 256 + tonumber(string.byte(buffer, 7)) * 256 + tonumber(string.byte(buffer, 8)) + if valid_length > #buffer + 8 then + return "" + end + return stream_type .. ": " .. string.sub(buffer, 9, valid_length + 8) + -- return string.sub(buffer, 9, valid_length + 8) +end + +local send_http_socket = function(socket_path, req_header, req_body, callback) + local docker_socket = nixio.socket("unix", "stream") + if docker_socket:connect(socket_path) ~= true then + return { + headers = {code=497, message="bad socket path", protocol="HTTP/1.1"}, + body = {message="can\'t connect to unix socket"} + } + end + if docker_socket:send(req_header) == 0 then + return { + headers={code=498,message="bad socket path", protocol="HTTP/1.1"}, + body={message="can\'t send data to unix socket"} + } + end + + if req_body and type(req_body) == "function" and req_header and req_header:match("chunked") then + -- chunked send + req_body(chunksink(docker_socket)) + elseif req_body and type(req_body) == "function" then + -- normal send by req_body function + req_body(docker_socket) + elseif req_body and type(req_body) == "table" then + -- json + docker_socket:send(json_stringify(req_body)) + elseif req_body then + docker_socket:send(req_body) + end + + local linesrc = docker_socket:linesource() + -- read socket using source http://w3.impa.br/~diego/software/luasocket/ltn12.html + --http://lua-users.org/wiki/FiltersSourcesAndSinks + -- handle response header + local line = linesrc() + if not line then + docker_socket:close() + return { + headers = {code=499, message="bad socket path", protocol="HTTP/1.1"}, + body = {message="no data receive from socket"} + } + end + local response = {code = 0, headers = {}, body = {}} + + local p, code, msg = line:match("^([%w./]+) ([0-9]+) (.*)") + response.protocol = p + response.code = tonumber(code) + response.message = msg + line = linesrc() + while line and line ~= "" do + local key, val = line:match("^([%w-]+)%s?:%s?(.*)") + if key and key ~= "Status" then + if type(response.headers[key]) == "string" then + response.headers[key] = {response.headers[key], val} + elseif type(response.headers[key]) == "table" then + response.headers[key][#response.headers[key] + 1] = val + else + response.headers[key] = val + end + end + line = linesrc() + end + -- handle response body + local body_buffer = linesrc(true) + response.body = {} + if type(callback) ~= "function" then + if response.headers["Transfer-Encoding"] == "chunked" then + local source = chunksource(docker_socket, body_buffer) + code = ltn12.pump.all(source, (ltn12.sink.table(response.body))) and response.code or 555 + response.code = code + else + local body_source = ltn12.source.cat(ltn12.source.string(body_buffer), docker_socket:blocksource()) + code = ltn12.pump.all(body_source, (ltn12.sink.table(response.body))) and response.code or 555 + response.code = code + end + else + if response.headers["Transfer-Encoding"] == "chunked" then + local source = chunksource(docker_socket, body_buffer) + callback(response, source) + else + local body_source = ltn12.source.cat(ltn12.source.string(body_buffer), docker_socket:blocksource()) + callback(response, body_source) + end + end + docker_socket:close() + return response +end + +local gen_header = function(options, http_method, api_group, api_action, name_or_id, request) + local header, query, path + options = options or {} + options.protocol = options.protocol or "HTTP/1.1" + name_or_id = name_or_id ~= "" and name_or_id or nil + + if request and type(request.query) == "table" then + local k, v + for k, v in pairs(request.query) do + if type(v) == "table" then + query = (query and query .. "&" or "?") .. k .. "=" .. urlencode(json_stringify(v)) + elseif type(v) == "boolean" then + query = (query and query .. "&" or "?") .. k .. "=" .. (v and "true" or "false") + elseif type(v) == "number" or type(v) == "string" then + query = (query and query .. "&" or "?") .. k .. "=" .. v + end + end + end + + path = (api_group and ("/" .. api_group) or "") .. (name_or_id and ("/" .. name_or_id) or "") .. (api_action and ("/" .. api_action) or "") .. (query or "") + header = (http_method or "GET") .. " " .. path .. " " .. options.protocol .. "\r\n" + header = header .. "Host: " .. options.host .. "\r\n" + header = header .. "User-Agent: " .. options.user_agent .. "\r\n" + header = header .. "Connection: close\r\n" + + if request and type(request.header) == "table" then + local k, v + for k, v in pairs(request.header) do + header = header .. k .. ": " .. v .. "\r\n" + end + end + + -- when requst_body is function, we need to custom header using custom header + if request and request.body and type(request.body) == "function" then + if not header:match("Content-Length:") then + header = header .. "Transfer-Encoding: chunked\r\n" + end + elseif http_method == "POST" and request and request.body and type(request.body) == "table" then + local conetnt_json = json_stringify(request.body) + header = header .. "Content-Type: application/json\r\n" + header = header .. "Content-Length: " .. #conetnt_json .. "\r\n" + elseif request and request.body and type(request.body) == "string" then + header = header .. "Content-Length: " .. #request.body .. "\r\n" + end + header = header .. "\r\n" + if options.debug then io.popen("echo '".. header .. "' >> " .. options.debug_path) end + return header +end + +local call_docker = function(options, http_method, api_group, api_action, name_or_id, request, callback) + local req_options = setmetatable({}, {__index = options}) + + local req_header = gen_header(req_options, http_method, api_group, api_action, name_or_id, request) + local req_body = request and request.body or nil + + return send_http_socket(req_options.socket_path, req_header, req_body, callback) +end + +local gen_api = function(_table, http_method, api_group, api_action) + local _api_action + if api_action == "get_archive" or api_action == "put_archive" then + _api_action = "archive" + elseif api_action == "df" then + _api_action = "system/df" + elseif api_action ~= "list" and api_action ~= "inspect" and api_action ~= "remove" then + _api_action = api_action + elseif (api_group == "containers" or api_group == "images" or api_group == "exec") and (api_action == "list" or api_action == "inspect") then + _api_action = "json" + end + + local fp = function(self, request, callback) + local name_or_id = request and (request.name or request.id or request.name_or_id) or nil + if api_action == "list" then + if (name_or_id ~= "" and name_or_id ~= nil) then + if api_group == "images" then + name_or_id = nil + else + request.query = request and request.query or {} + request.query.filters = request.query.filters or {} + request.query.filters.name = request.query.filters.name or {} + request.query.filters.name[#request.query.filters.name + 1] = name_or_id + name_or_id = nil + end + end + elseif api_action == "create" then + if (name_or_id ~= "" and name_or_id ~= nil) then + request.query = request and request.query or {} + request.query.name = request.query.name or name_or_id + name_or_id = nil + end + elseif api_action == "logs" then + local body_buffer = "" + local response = call_docker(self.options, http_method, api_group, _api_action, name_or_id, request, callback) + if response.code >= 200 and response.code < 300 then + for i, v in ipairs(response.body) do + body_buffer = body_buffer .. docker_stream_filter(response.body[i]) + end + response.body = body_buffer + end + return response + end + local response = call_docker(self.options, http_method, api_group, _api_action, name_or_id, request, callback) + if response.headers and response.headers["Content-Type"] == "application/json" then + if #response.body == 1 then + response.body = json_parse(response.body[1]) + else + local tmp = {} + for _, v in ipairs(response.body) do + tmp[#tmp+1] = json_parse(v) + end + response.body = tmp + end + end + return response + end + + if api_group then + _table[api_group][api_action] = fp + else + _table[api_action] = fp + end +end + +local _docker = {containers = {}, exec = {}, images = {}, networks = {}, volumes = {}} + +gen_api(_docker, "GET", "containers", "list") +gen_api(_docker, "POST", "containers", "create") +gen_api(_docker, "GET", "containers", "inspect") +gen_api(_docker, "GET", "containers", "top") +gen_api(_docker, "GET", "containers", "logs") +gen_api(_docker, "GET", "containers", "changes") +gen_api(_docker, "GET", "containers", "stats") +gen_api(_docker, "POST", "containers", "resize") +gen_api(_docker, "POST", "containers", "start") +gen_api(_docker, "POST", "containers", "stop") +gen_api(_docker, "POST", "containers", "restart") +gen_api(_docker, "POST", "containers", "kill") +gen_api(_docker, "POST", "containers", "update") +gen_api(_docker, "POST", "containers", "rename") +gen_api(_docker, "POST", "containers", "pause") +gen_api(_docker, "POST", "containers", "unpause") +gen_api(_docker, "POST", "containers", "update") +gen_api(_docker, "DELETE", "containers", "remove") +gen_api(_docker, "POST", "containers", "prune") +gen_api(_docker, "POST", "containers", "exec") +gen_api(_docker, "POST", "exec", "start") +gen_api(_docker, "POST", "exec", "resize") +gen_api(_docker, "GET", "exec", "inspect") +gen_api(_docker, "GET", "containers", "get_archive") +gen_api(_docker, "PUT", "containers", "put_archive") +-- TODO: export,attch + +gen_api(_docker, "GET", "images", "list") +gen_api(_docker, "POST", "images", "create") +gen_api(_docker, "GET", "images", "inspect") +gen_api(_docker, "GET", "images", "history") +gen_api(_docker, "POST", "images", "tag") +gen_api(_docker, "DELETE", "images", "remove") +gen_api(_docker, "GET", "images", "search") +gen_api(_docker, "POST", "images", "prune") +-- TODO: build clear push commit export import + +gen_api(_docker, "GET", "networks", "list") +gen_api(_docker, "GET", "networks", "inspect") +gen_api(_docker, "DELETE", "networks", "remove") +gen_api(_docker, "POST", "networks", "create") +gen_api(_docker, "POST", "networks", "connect") +gen_api(_docker, "POST", "networks", "disconnect") +gen_api(_docker, "POST", "networks", "prune") + +gen_api(_docker, "GET", "volumes", "list") +gen_api(_docker, "GET", "volumes", "inspect") +gen_api(_docker, "DELETE", "volumes", "remove") +gen_api(_docker, "POST", "volumes", "create") + +gen_api(_docker, "GET", nil, "events") +gen_api(_docker, "GET", nil, "version") +gen_api(_docker, "GET", nil, "info") +gen_api(_docker, "GET", nil, "_ping") +gen_api(_docker, "GET", nil, "df") + +function _docker.new(options) + local docker = {} + local _options = options or {} + docker.options = { + socket_path = _options.socket_path or "/var/run/docker.sock", + host = _options.host or "localhost", + version = _options.version or "v1.40", + user_agent = _options.user_agent or "LuCI", + protocol = _options.protocol or "HTTP/1.1", + -- status_enabled = _options.status_enabled or true, + -- status_path = _options.status_path or "/tmp/.docker_action_status", + debug = _options.debug or false, + debug_path = _options.debug_path or "/tmp/.docker_debug" + } + setmetatable( + docker, + { + __index = function(t, key) + if _docker[key] ~= nil then + return _docker[key] + else + return _docker.containers[key] + end + end + } + ) + setmetatable( + docker.containers, + { + __index = function(t, key) + if key == "options" then + return docker.options + end + end + } + ) + setmetatable( + docker.networks, + { + __index = function(t, key) + if key == "options" then + return docker.options + end + end + } + ) + setmetatable( + docker.images, + { + __index = function(t, key) + if key == "options" then + return docker.options + end + end + } + ) + setmetatable( + docker.volumes, + { + __index = function(t, key) + if key == "options" then + return docker.options + end + end + } + ) + setmetatable( + docker.exec, + { + __index = function(t, key) + if key == "options" then + return docker.options + end + end + } + ) + return docker +end + +return _docker diff --git a/package/lean/luci-lib-fs/Makefile b/package/lean/luci-lib-fs/Makefile new file mode 100644 index 00000000000000..9d78a297136c61 --- /dev/null +++ b/package/lean/luci-lib-fs/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2009 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:=luci-lib-fs +PKG_VERSION:=1.0 +PKG_RELEASE:=1 + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/luci-lib-fs + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=luci-lib-fs + PKGARCH:=all + URL:=https://github.com/lbthomsen/openwrt-luci + DEPENDS:=+luci +luci-lib-nixio +endef + +define Package/luci-lib-fs/description + luci-lib-fs +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Build/Install +endef + + +define Package/luci-lib-fs/install + $(INSTALL_DIR) $(1)/usr/lib/lua/luci + $(CP) ./files/*.lua $(1)/usr/lib/lua/luci + +endef + +$(eval $(call BuildPackage,luci-lib-fs)) diff --git a/package/lean/luci-lib-fs/files/fs.lua b/package/lean/luci-lib-fs/files/fs.lua new file mode 100644 index 00000000000000..a81ff675d41c1b --- /dev/null +++ b/package/lean/luci-lib-fs/files/fs.lua @@ -0,0 +1,244 @@ +--[[ +LuCI - Filesystem tools + +Description: +A module offering often needed filesystem manipulation functions + +FileId: +$Id$ + +License: +Copyright 2008 Steven Barth + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +]]-- + +local io = require "io" +local os = require "os" +local ltn12 = require "luci.ltn12" +local fs = require "nixio.fs" +local nutil = require "nixio.util" + +local type = type + +--- LuCI filesystem library. +module "luci.fs" + +--- Test for file access permission on given path. +-- @class function +-- @name access +-- @param str String value containing the path +-- @return Number containing the return code, 0 on sucess or nil on error +-- @return String containing the error description (if any) +-- @return Number containing the os specific errno (if any) +access = fs.access + +--- Evaluate given shell glob pattern and return a table containing all matching +-- file and directory entries. +-- @class function +-- @name glob +-- @param filename String containing the path of the file to read +-- @return Table containing file and directory entries or nil if no matches +-- @return String containing the error description (if no matches) +-- @return Number containing the os specific errno (if no matches) +function glob(...) + local iter, code, msg = fs.glob(...) + if iter then + return nutil.consume(iter) + else + return nil, code, msg + end +end + +--- Checks wheather the given path exists and points to a regular file. +-- @param filename String containing the path of the file to test +-- @return Boolean indicating wheather given path points to regular file +function isfile(filename) + return fs.stat(filename, "type") == "reg" +end + +--- Checks wheather the given path exists and points to a directory. +-- @param dirname String containing the path of the directory to test +-- @return Boolean indicating wheather given path points to directory +function isdirectory(dirname) + return fs.stat(dirname, "type") == "dir" +end + +--- Read the whole content of the given file into memory. +-- @param filename String containing the path of the file to read +-- @return String containing the file contents or nil on error +-- @return String containing the error message on error +readfile = fs.readfile + +--- Write the contents of given string to given file. +-- @param filename String containing the path of the file to read +-- @param data String containing the data to write +-- @return Boolean containing true on success or nil on error +-- @return String containing the error message on error +writefile = fs.writefile + +--- Copies a file. +-- @param source Source file +-- @param dest Destination +-- @return Boolean containing true on success or nil on error +copy = fs.datacopy + +--- Renames a file. +-- @param source Source file +-- @param dest Destination +-- @return Boolean containing true on success or nil on error +rename = fs.move + +--- Get the last modification time of given file path in Unix epoch format. +-- @param path String containing the path of the file or directory to read +-- @return Number containing the epoch time or nil on error +-- @return String containing the error description (if any) +-- @return Number containing the os specific errno (if any) +function mtime(path) + return fs.stat(path, "mtime") +end + +--- Set the last modification time of given file path in Unix epoch format. +-- @param path String containing the path of the file or directory to read +-- @param mtime Last modification timestamp +-- @param atime Last accessed timestamp +-- @return 0 in case of success nil on error +-- @return String containing the error description (if any) +-- @return Number containing the os specific errno (if any) +function utime(path, mtime, atime) + return fs.utimes(path, atime, mtime) +end + +--- Return the last element - usually the filename - from the given path with +-- the directory component stripped. +-- @class function +-- @name basename +-- @param path String containing the path to strip +-- @return String containing the base name of given path +-- @see dirname +basename = fs.basename + +--- Return the directory component of the given path with the last element +-- stripped of. +-- @class function +-- @name dirname +-- @param path String containing the path to strip +-- @return String containing the directory component of given path +-- @see basename +dirname = fs.dirname + +--- Return a table containing all entries of the specified directory. +-- @class function +-- @name dir +-- @param path String containing the path of the directory to scan +-- @return Table containing file and directory entries or nil on error +-- @return String containing the error description on error +-- @return Number containing the os specific errno on error +function dir(...) + local iter, code, msg = fs.dir(...) + if iter then + local t = nutil.consume(iter) + t[#t+1] = "." + t[#t+1] = ".." + return t + else + return nil, code, msg + end +end + +--- Create a new directory, recursively on demand. +-- @param path String with the name or path of the directory to create +-- @param recursive Create multiple directory levels (optional, default is true) +-- @return Number with the return code, 0 on sucess or nil on error +-- @return String containing the error description on error +-- @return Number containing the os specific errno on error +function mkdir(path, recursive) + return recursive and fs.mkdirr(path) or fs.mkdir(path) +end + +--- Remove the given empty directory. +-- @class function +-- @name rmdir +-- @param path String containing the path of the directory to remove +-- @return Number with the return code, 0 on sucess or nil on error +-- @return String containing the error description on error +-- @return Number containing the os specific errno on error +rmdir = fs.rmdir + +local stat_tr = { + reg = "regular", + dir = "directory", + lnk = "link", + chr = "character device", + blk = "block device", + fifo = "fifo", + sock = "socket" +} +--- Get information about given file or directory. +-- @class function +-- @name stat +-- @param path String containing the path of the directory to query +-- @return Table containing file or directory properties or nil on error +-- @return String containing the error description on error +-- @return Number containing the os specific errno on error +function stat(path, key) + local data, code, msg = fs.stat(path) + if data then + data.mode = data.modestr + data.type = stat_tr[data.type] or "?" + end + return key and data and data[key] or data, code, msg +end + +--- Set permissions on given file or directory. +-- @class function +-- @name chmod +-- @param path String containing the path of the directory +-- @param perm String containing the permissions to set ([ugoa][+-][rwx]) +-- @return Number with the return code, 0 on sucess or nil on error +-- @return String containing the error description on error +-- @return Number containing the os specific errno on error +chmod = fs.chmod + +--- Create a hard- or symlink from given file (or directory) to specified target +-- file (or directory) path. +-- @class function +-- @name link +-- @param path1 String containing the source path to link +-- @param path2 String containing the destination path for the link +-- @param symlink Boolean indicating wheather to create a symlink (optional) +-- @return Number with the return code, 0 on sucess or nil on error +-- @return String containing the error description on error +-- @return Number containing the os specific errno on error +function link(src, dest, sym) + return sym and fs.symlink(src, dest) or fs.link(src, dest) +end + +--- Remove the given file. +-- @class function +-- @name unlink +-- @param path String containing the path of the file to remove +-- @return Number with the return code, 0 on sucess or nil on error +-- @return String containing the error description on error +-- @return Number containing the os specific errno on error +unlink = fs.unlink + +--- Retrieve target of given symlink. +-- @class function +-- @name readlink +-- @param path String containing the path of the symlink to read +-- @return String containing the link target or nil on error +-- @return String containing the error description on error +-- @return Number containing the os specific errno on error +readlink = fs.readlink diff --git a/package/lean/luci-proto-bonding/Makefile b/package/lean/luci-proto-bonding/Makefile new file mode 100644 index 00000000000000..ab73de0f02e45c --- /dev/null +++ b/package/lean/luci-proto-bonding/Makefile @@ -0,0 +1,18 @@ +# +# Copyright (C) 2017 TDT AG +# +# This is free software, licensed under the Apache License Version 2.0. +# See https://www.apache.org/licenses/LICENSE-2.0 for more information. +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=Support for Link Aggregation (Channel Bonding) +LUCI_DEPENDS:=+proto-bonding +LUCI_PKGARCH:=all + +PKG_MAINTAINER:=Helge Mader + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/package/lean/luci-proto-bonding/luasrc/model/cbi/admin_network/proto_bonding.lua b/package/lean/luci-proto-bonding/luasrc/model/cbi/admin_network/proto_bonding.lua new file mode 100644 index 00000000000000..898a6587c7667d --- /dev/null +++ b/package/lean/luci-proto-bonding/luasrc/model/cbi/admin_network/proto_bonding.lua @@ -0,0 +1,386 @@ +--[[ + +Copyright (C) 2018 TDT AG + +This is free software, licensed under the Apache License Version 2.0. +See https://www.apache.org/licenses/LICENSE-2.0 for more information. + +]]-- + +local map, section, net = ... + +local ipaddr, netmask, gateway, broadcast + +local SYS = require "luci.sys" + +local dhcp, slaves, bonding_policy, primary, primary_reselect, min_links, ad_actor_sys_prio, ad_actor_system +local ad_select, lacp_rate, packets_per_slave, lp_interval, tlb_dynamic_lb, fail_over_mac +local num_grat_arp__num_unsol_na, xmit_hash_policy, resend_igmp, all_slaves_active, link_monitoring +local arp_interval, arp_ip_target, arp_all_targets, arp_validate, miimon, downdelay, updelay, use_carrier + +local function get_selectable_slaves(field) + m.uci:foreach("network", "interface", + function (section) + if section[".name"] ~= "loopback" then + local network_section_ifname = m.uci:get("network", section['.name'], "ifname") + local in_use = false + + m.uci:foreach("network", "interface", + function (section) + if m.uci:get("network", section['.name'], "proto") == "bonding" then + + local bonding_section_slaves = m.uci:get("network", section['.name'], "slaves") + + if bonding_section_slaves ~= nil then + + for this_slave in bonding_section_slaves:gmatch("[%S-]+") do + + if network_section_ifname == this_slave:gsub("-", "") and section['.name'] ~= arg[1] then + in_use = true + end + end + end + end + end + ) + + if in_use == false and network_section_ifname ~= nil then + if network_section_ifname:find("eth") ~= nil then + field:value(network_section_ifname, network_section_ifname) + end + end + end + end + ) +end + + +local function get_selectable_slaves_from_proc(field) + local interfaces = SYS.exec("cat /proc/net/dev | grep 'eth' | awk '\{print \$1\}' | tr ':\n' ' '") + + if interfaces ~= nil then + for this_interface in interfaces:gmatch("[%S-]+") do + local in_use = false + + m.uci:foreach("network", "interface", + function (section) + if m.uci:get("network", section['.name'], "proto") == "bonding" then + local bonding_section_slaves = m.uci:get("network", section['.name'], "slaves") + + if bonding_section_slaves ~= nil then + + for this_slave in bonding_section_slaves:gmatch("[%S-]+") do + + if this_interface == this_slave and section['.name'] ~= arg[1] then + in_use = true + end + end + end + end + end + ) + + if in_use == false then + field:value(this_interface, this_interface) + end + end + end +end + + +ipaddr = section:taboption("general", Value, "ipaddr", + translate("IPv4 address")) +ipaddr.datatype = "ip4addr" +ipaddr.optional = false +ipaddr.rmempty = false + + +netmask = section:taboption("general", Value, "netmask", + translate("IPv4 netmask")) +netmask.datatype = "ip4addr" +netmask.optional = false +netmask.rmempty = false +netmask:value("255.255.255.0") +netmask:value("255.255.0.0") +netmask:value("255.0.0.0") + + +-- dhcp = section:taboption("general", Flag, "dhcp", +-- translate("Use DHCP (Client Mode)"), +-- translate("Specifies whether the bonding interface should use DHCP client mode")) +-- dhcp.default = dhcp.disabled +-- dhcp.rmempty = false + +slaves = section:taboption("advanced", MultiValue, "slaves", + translate ("Slave Interfaces"), + translate("Specifies which slave interfaces should be attached to this bonding interface")) +slaves.oneline = true +slaves.widget = "checkbox" + +get_selectable_slaves_from_proc(slaves) + +bonding_policy = section:taboption("advanced", ListValue, "bonding_policy", + translate("Bonding Policy"), + translate("Specifies the mode to be used for this bonding interface")) +bonding_policy.default = "balance-rr" +bonding_policy:value("balance-rr", translate("Round-Robin policy (balance-rr, 0)")) +bonding_policy:value("active-backup", translate("Active-Backup policy (active-backup, 1)")) +bonding_policy:value("balance-xor", translate("XOR policy (balance-xor, 2)")) +bonding_policy:value("broadcast", translate("Broadcast policy (broadcast, 3)")) +bonding_policy:value("802.3ad", translate("IEEE 802.3ad Dynamic link aggregation (802.3ad, 4)")) +bonding_policy:value("balance-tlb", translate("Adaptive transmit load balancing (balance-tlb, 5)")) +bonding_policy:value("balance-alb", translate("Adaptive load balancing (balance-alb, 6)")) + +primary = section:taboption("advanced", ListValue, "primary", + translate("Primary Slave"), + translate("Specifies which slave is the primary device. It will always be the active slave while it is available")) +primary.widget = "radio" +primary.orientation = "horizontal" +primary:depends("bonding_policy", "active-backup") +primary:depends("bonding_policy", "balance-tlb") +primary:depends("bonding_policy", "balance-alb") + +get_selectable_slaves_from_proc(primary) + +primary_reselect = section:taboption("advanced", ListValue, "primary_reselect", + translate("Reselection policy for primary slave"), + translate("Specifies the reselection policy for the primary slave when failure of the active slave or recovery of the primary slave occurs")) +primary_reselect.default = "always" +primary_reselect:value("always", translate("Primary becomes active slave whenever it comes back up (always, 0)")) +primary_reselect:value("better", translate("Primary becomes active slave when it comes back up if speed and duplex better than current slave (better, 1)")) +primary_reselect:value("failure", translate("Only if current active slave fails and the primary slave is up (failure, 2)")) +primary_reselect:depends("bonding_policy", "active-backup") +primary_reselect:depends("bonding_policy", "balance-tlb") +primary_reselect:depends("bonding_policy", "balance-alb") + +min_links = section:taboption("advanced", Value, "min_links", + translate("Minimum Number of Links"), + translate("Specifies the minimum number of links that must be active before asserting carrier")) +min_links.datatype = "uinteger" +min_links.default = 0 +min_links:depends("bonding_policy", "802.3ad") + +ad_actor_sys_prio = section:taboption("advanced", Value, "ad_actor_sys_prio", + translate("System Priority"), + translate("Specifies the system priority")) +ad_actor_sys_prio.datatype = "range(1,65535)" +ad_actor_sys_prio.default = 65535 +ad_actor_sys_prio:depends("bonding_policy", "802.3ad") + +ad_actor_system = section:taboption("advanced", Value, "ad_actor_system", + translate("MAC Address For The Actor"), + translate("Specifies the mac-address for the actor in protocol packet exchanges (LACPDUs). If empty, masters' mac address defaults to system default")) +ad_actor_system.datatype = "macaddr" +ad_actor_system.default = "" +ad_actor_system:depends("bonding_policy", "802.3ad") + +ad_select = section:taboption("advanced", ListValue, "ad_select", + translate("Aggregation Selection Logic"), + translate("Specifies the aggregation selection logic to use")) +ad_select.default = "stable" +ad_select:value("stable", translate("Aggregator: All slaves down or has no slaves (stable, 0)")) +ad_select:value("bandwidth", translate("Aggregator: Slave added/removed or state changes (bandwidth, 1)")) +ad_select:value("count", translate("Aggregator: Chosen by the largest number of ports + slave added/removed or state changes (count, 2)")) +ad_select:depends("bonding_policy", "802.3ad") + +lacp_rate = section:taboption("advanced", ListValue, "lacp_rate", + translate("LACPDU Packets"), + translate("Specifies the rate in which the link partner will be asked to transmit LACPDU packets")) +lacp_rate.default = "slow" +lacp_rate:value("slow", translate("Every 30 seconds (slow, 0)")) +lacp_rate:value("fast", translate("Every second (fast, 1)")) +lacp_rate:depends("bonding_policy", "802.3ad") + +packets_per_slave = section:taboption("advanced", Value, "packets_per_slave", + translate("Packets To Transmit Before Moving To Next Slave"), + translate("Specifies the number of packets to transmit through a slave before moving to the next one")) +packets_per_slave.datatype = "range(0,65535)" +packets_per_slave.default = 1 +packets_per_slave:depends("bonding_policy", "balance-rr") + +lp_interval = section:taboption("advanced", Value, "lp_interval", + translate("Interval For Sending Learning Packets"), + translate("Specifies the number of seconds between instances where the bonding driver sends learning packets to each slaves peer switch")) +lp_interval.datatype = "range(1,2147483647)" +lp_interval.default = 1 +lp_interval:depends("bonding_policy", "balance-tlb") +lp_interval:depends("bonding_policy", "balance-alb") + +tlb_dynamic_lb = section:taboption("advanced", ListValue, "tlb_dynamic_lb", + translate("Enable Dynamic Shuffling Of Flows"), + translate("Specifies whether to shuffle active flows across slaves based on the load")) +tlb_dynamic_lb.default = "1" +tlb_dynamic_lb:value("1", translate("Yes")) +tlb_dynamic_lb:value("0", translate("No")) +tlb_dynamic_lb:depends("bonding_policy", "balance-tlb") + +fail_over_mac = section:taboption("advanced", ListValue, "fail_over_mac", + translate("Set same MAC Address to all slaves"), + translate("Specifies whether active-backup mode should set all slaves to the same MAC address at enslavement")) +fail_over_mac.default = "none" +fail_over_mac:value("none", translate("Yes (none, 0)")) +fail_over_mac:value("active", translate("Set to currently active slave (active, 1)")) +fail_over_mac:value("follow", translate("Set to first slave added to the bond (follow, 2)")) +fail_over_mac:depends("bonding_policy", "active-backup") + +num_grat_arp__num_unsol_na = section:taboption("advanced", Value, "num_grat_arp__num_unsol_na", + translate("Number of peer notifications after failover event"), + translate("Specifies the number of peer notifications (gratuitous ARPs and unsolicited IPv6 Neighbor Advertisements) to be issued after a failover event")) +num_grat_arp__num_unsol_na.datatype = "range(0,255)" +num_grat_arp__num_unsol_na.default = 1 +num_grat_arp__num_unsol_na:depends("bonding_policy", "active-backup") + +xmit_hash_policy = section:taboption("advanced", ListValue, "xmit_hash_policy", + translate("Transmit Hash Policy"), + translate("Selects the transmit hash policy to use for slave selection")) +xmit_hash_policy.default = "layer2" +xmit_hash_policy:value("layer2", translate("Use XOR of hardware MAC addresses (layer2)")) +xmit_hash_policy:value("layer2+3", translate("Use XOR of hardware MAC addresses and IP addresses (layer2+3)")) +xmit_hash_policy:value("layer3+4", translate("Use upper layer protocol information (layer3+4)")) +xmit_hash_policy:value("encap2+3", translate("Use XOR of hardware MAC addresses and IP addresses, rely on skb_flow_dissect (encap2+3)")) +xmit_hash_policy:value("encap3+4", translate("Use upper layer protocol information, rely on skb_flow_dissect (encap3+4)")) +xmit_hash_policy:depends("bonding_policy", "balance-rr") +xmit_hash_policy:depends("bonding_policy", "active-backup") +xmit_hash_policy:depends("bonding_policy", "balance-tlb") +xmit_hash_policy:depends("bonding_policy", "balance-alb") +xmit_hash_policy:depends("bonding_policy", "balance-xor") + +resend_igmp = section:taboption("advanced", Value, "resend_igmp", + translate("Number of IGMP membership reports"), + translate("Specifies the number of IGMP membership reports to be issued after a failover event in 200ms intervals")) +resend_igmp.datatype = "range(0,255)" +resend_igmp.default = 1 +resend_igmp:depends("bonding_policy", "balance-tlb") +resend_igmp:depends("bonding_policy", "balance-alb") + +all_slaves_active = section:taboption("advanced", ListValue, "all_slaves_active", + translate("Drop Duplicate Frames"), + translate("Specifies that duplicate frames (received on inactive ports) should be dropped or delivered")) +all_slaves_active.default = "0" +all_slaves_active:value("0", translate("Yes")) +all_slaves_active:value("1", translate("No")) + +link_monitoring = section:taboption("advanced", ListValue, "link_monitoring", + translate("Link Monitoring"), + translate("Method of link monitoring")) +link_monitoring.default = "off" +link_monitoring:value("off", translate("Off")) +link_monitoring:value("arp", translate("ARP")) +link_monitoring:value("mii", translate("MII")) + +arp_interval = section:taboption("advanced", Value, "arp_interval", + translate("ARP Interval"), + translate("Specifies the ARP link monitoring frequency in milliseconds")) +arp_interval.datatype = "uinteger" +arp_interval.default = 0 +arp_interval:depends("link_monitoring", "arp") + +arp_ip_target = section:taboption("advanced", DynamicList, "arp_ip_target", + translate("ARP IP Targets"), + translate("Specifies the IP addresses to use for ARP monitoring")) +arp_ip_target.datatype = "ipaddr" +arp_ip_target.cast = "string" +arp_ip_target:depends("link_monitoring", "arp") + +arp_all_targets = section:taboption("advanced", ListValue, "arp_all_targets", + translate("ARP mode to consider a slave as being up"), + translate("Specifies the quantity of ARP IP targets that must be reachable")) +arp_all_targets.default = "any" +arp_all_targets:value("any", translate("Consider the slave up when any ARP IP target is reachable (any, 0)")) +arp_all_targets:value("all", translate("Consider the slave up when all ARP IP targets are reachable (all, 1)")) +arp_all_targets:depends({link_monitoring="arp", bonding_policy="active-backup"}) + +arp_validate = section:taboption("advanced", ListValue, "arp_validate", + translate("ARP Validation"), + translate("Specifies whether ARP probes and replies should be validated or non-ARP traffic should be filtered for link monitoring")) +arp_validate.default = "filter" +arp_validate:value("none", translate("No validation or filtering ")) +arp_validate:value("active", translate("Validation only for active slave")) +arp_validate:value("backup", translate("Validation only for backup slaves")) +arp_validate:value("all", translate("Validation for all slaves")) +arp_validate:value("filter", translate("Filtering for all slaves, no validation")) +arp_validate:value("filter_active", translate("Filtering for all slaves, validation only for active slave")) +arp_validate:value("filter_backup", translate("Filtering for all slaves, validation only for backup slaves")) +arp_validate:depends("link_monitoring", "arp") + +miimon = section:taboption("advanced", Value, "miimon", + translate("MII Interval"), + translate("Specifies the MII link monitoring frequency in milliseconds")) +miimon.datatype = "uinteger" +miimon.default = 0 +miimon:depends("link_monitoring", "mii") + +downdelay = section:taboption("advanced", Value, "downdelay", + translate("Down Delay"), + translate("Specifies the time in milliseconds to wait before disabling a slave after a link failure detection")) +downdelay.datatype = "uinteger" +downdelay.default = 0 +downdelay:depends("link_monitoring", "mii") + +updelay = section:taboption("advanced", Value, "updelay", + translate("Up Delay"), + translate("Specifies the time in milliseconds to wait before enabling a slave after a link recovery detection")) +updelay.datatype = "uinteger" +updelay.default = 0 +updelay:depends("link_monitoring", "mii") + +use_carrier = section:taboption("advanced", ListValue, "use_carrier", + translate("Method to determine link status"), + translate("Specifies whether or not miimon should use MII or ETHTOOL ioctls vs. netif_carrier_ok()")) +use_carrier.default = "1" +use_carrier:value("0", translate("MII / ETHTOOL ioctls")) +use_carrier:value("1", translate("netif_carrier_ok()")) +use_carrier:depends("link_monitoring", "mii") + + +-- we use the bondig_policy validate function to check for other required values +-- (e.g. slave interfaces, primary interface, ARP targets, ...) as validate functions +-- are not called for _empty_ fields. bonding_policy will never be empty. +function bonding_policy.validate(self, value, section) + + local selected_link_monitoring = link_monitoring:formvalue(section) + local selected_arp_ip_targets = arp_ip_target:formvalue(section) + + local selected_policy = bonding_policy:formvalue(section) + + local selected_slaves = slaves:formvalue(section) + local selected_primary = primary:formvalue(section) + + if selected_link_monitoring == "arp" then + if selected_policy == "802.3ad" or selected_policy == "balance-tlb" or selected_policy == "balance-alb" then + return nil, translate("ARP monitoring is not supported for the selected policy") + end + + if #selected_arp_ip_targets == 0 then + return nil, translate("You must select at least one ARP IP target if ARP monitoring is selected") + end + + end + + if selected_slaves == nil then + return nil, translate("You must select at least one slave interface") + end + + if selected_policy == "active-backup" or selected_policy == "balance-tlb" or selected_policy == "balance-alb" then + if selected_primary == nil then + return nil, translate("You must select a primary interface for the selected policy") + else + if (type(selected_slaves) == "table") then + for key,slave_value in pairs(selected_slaves) do + if slave_value == selected_primary then + return value + end + end + else + if selected_slaves == selected_primary then + return value + end + end + end + + return nil, translate("You must select a primary interface which is included in selected slave interfaces") + end + + return value +end + diff --git a/package/lean/luci-proto-bonding/luasrc/model/network/proto_bonding.lua b/package/lean/luci-proto-bonding/luasrc/model/network/proto_bonding.lua new file mode 100644 index 00000000000000..2c0e3ddbc3aa07 --- /dev/null +++ b/package/lean/luci-proto-bonding/luasrc/model/network/proto_bonding.lua @@ -0,0 +1,31 @@ +--[[ + +Copyright (C) 2018 TDT AG + +This is free software, licensed under the Apache License Version 2.0. +See https://www.apache.org/licenses/LICENSE-2.0 for more information. + +]]-- + +local proto = luci.model.network:register_protocol("bonding") + +function proto.get_i18n(self) + return luci.i18n.translate("Link Aggregation (Channel Bonding)") +end + +function proto.is_installed(self) + return nixio.fs.access("/lib/netifd/proto/bonding.sh") +end + +function proto.is_virtual(self) + return true +end + +function proto.is_floating(self) + return true +end + +function proto.opkg_package(self) + return "bonding" +end + diff --git a/package/lean/luci-proto-bonding/po/de/bonding.po b/package/lean/luci-proto-bonding/po/de/bonding.po new file mode 100644 index 00000000000000..fc2c1e3c301eae --- /dev/null +++ b/package/lean/luci-proto-bonding/po/de/bonding.po @@ -0,0 +1,398 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8\n" + +msgid "ARP" +msgstr "" + +msgid "ARP IP Targets" +msgstr "ARP IP Ziele" + +msgid "ARP Interval" +msgstr "ARP Intervall" + +msgid "ARP Validation" +msgstr "ARP Überprüfung" + +msgid "ARP mode to consider a slave as being up" +msgstr "ARP Methode um ein Slave als UP zu betrachten" + +msgid "ARP monitoring is not supported for the selected policy" +msgstr "ARP Monitoring wird für die gewählte Bonding Methode nicht unterstützt" + +msgid "Active-Backup policy (active-backup, 1)" +msgstr "Aktiv-Backup (active-backup, 1)" + +msgid "Adaptive load balancing (balance-alb, 6)" +msgstr "Adaptives Load Balancing (balance-alb, 6)" + +msgid "Adaptive transmit load balancing (balance-tlb, 5)" +msgstr "Adaptives Sende Load Balancing (balance-tlb, 5)" + +msgid "Aggregation Selection Logic" +msgstr "Gruppierungslogik" + +msgid "Aggregator: All slaves down or has no slaves (stable, 0)" +msgstr "Aggregator: Alle Slaves Down oder keine Slaves vorhanden (stable, 0)" + +msgid "" +"Aggregator: Chosen by the largest number of ports + slave added/removed or " +"state changes (count, 2)" +msgstr "" +"Aggregator: Ausgewählt durch die höchsten Portnummern + Slave hinzugefügt/" +"entfernt oder Statuswechsel (count, 2)" + +msgid "Aggregator: Slave added/removed or state changes (bandwidth, 1)" +msgstr "" +"Aggregator: Slave hinzugefügt/entfernt oder Statuswechsel (bandwidth, 1)" + +msgid "Bonding Policy" +msgstr "Bonding Methode" + +msgid "Broadcast policy (broadcast, 3)" +msgstr "Broadcast (broadcast, 3)" + +msgid "Consider the slave up when all ARP IP targets are reachable (all, 1)" +msgstr "" +"Slave wird als aktiv angesehen, wenn alle ARP IP Ziele erreichbar sind (all, " +"1)" + +msgid "Consider the slave up when any ARP IP target is reachable (any, 0)" +msgstr "" +"Slave wird als aktiv angesehen, wenn irgendein ARP IP Ziel erreichbar ist " +"(any, 0)" + +msgid "Down Delay" +msgstr "Down Verzögerung" + +msgid "Drop Duplicate Frames" +msgstr "Doppelte Frames verwerfen" + +msgid "Enable Dynamic Shuffling Of Flows" +msgstr "Dynamisches Verteilen von Flows aktivieren" + +msgid "Every 30 seconds (slow, 0)" +msgstr "Alle 30 Sekunden (slow, 0)" + +msgid "Every second (fast, 1)" +msgstr "Jede Sekunde (fast, 1)" + +msgid "Filtering for all slaves, no validation" +msgstr "Alle Slaves filtern, keine Überprüfung" + +msgid "Filtering for all slaves, validation only for active slave" +msgstr "Alle Slaves filtern, Überprüfung nur für aktive Slaves" + +msgid "Filtering for all slaves, validation only for backup slaves" +msgstr "Alle Slaves filtern, Überprüfung nur für Backup Slaves" + +msgid "IEEE 802.3ad Dynamic link aggregation (802.3ad, 4)" +msgstr "" + +msgid "IPv4 address" +msgstr "IPv4 Adresse" + +msgid "IPv4 netmask" +msgstr "IPv4 Netzmaske" + +msgid "Interval For Sending Learning Packets" +msgstr "Interval zum Senden von 'Learning Packets'" + +msgid "LACPDU Packets" +msgstr "LACPDU Pakete" + +msgid "Link Aggregation (Channel Bonding)" +msgstr "Link Aggregation (Kanalbündelung)" + +msgid "Link Monitoring" +msgstr "Link Überwachung" + +msgid "MAC Address For The Actor" +msgstr "MAC Adresse für den Aktor" + +msgid "MII" +msgstr "" + +msgid "MII / ETHTOOL ioctls" +msgstr "" + +msgid "MII Interval" +msgstr "MII Intervall" + +msgid "Method of link monitoring" +msgstr "Art der Link Überwachung" + +msgid "Method to determine link status" +msgstr "Methode um Link Status festzustellen" + +msgid "Minimum Number of Links" +msgstr "Minimale Anzahl von Links" + +msgid "No" +msgstr "Nein" + +msgid "No validation or filtering" +msgstr "Keine Überprüfung oder Filterung" + +msgid "Number of IGMP membership reports" +msgstr "Anzahl von IGMP Zugehörigkeitsmeldungen" + +msgid "Number of peer notifications after failover event" +msgstr "Anzahl von Peer Benachrichtigungen nach einem Failover Ereignis" + +msgid "Off" +msgstr "Aus" + +msgid "" +"Only if current active slave fails and the primary slave is up (failure, 2)" +msgstr "" +"Nur wenn das derzeit aktive Slave fehlschlägt und das primäre Slave Up ist " +"(failure, 2)" + +msgid "Packets To Transmit Before Moving To Next Slave" +msgstr "Zu übertragende Pakete vor Wechsel zum nächsten Slave" + +msgid "Primary Slave" +msgstr "Primäres Slave" + +msgid "" +"Primary becomes active slave when it comes back up if speed and duplex " +"better than current slave (better, 1)" +msgstr "" +"Primäres Slave wird zum aktiven Slave wenn es wieder Up ist und " +"Geschwindikkeit/Duplex besser als derzeitiges Slave (better, 1)" + +msgid "Primary becomes active slave whenever it comes back up (always, 0)" +msgstr "" +"Primäres Slave wird zum aktiven Slave wenn es wieder Up ist (always, 0)" + +msgid "Reselection policy for primary slave" +msgstr "Methode zur Neuauswahl des primären Slaves" + +msgid "Round-Robin policy (balance-rr, 0)" +msgstr "Round-Robin (balance-rr, 0)" + +msgid "Selects the transmit hash policy to use for slave selection" +msgstr "Selektiert die Hash Übertragunsmethode zur Slave Auswahl" + +msgid "Set same MAC Address to all slaves" +msgstr "Gleiche MAC Adresse für alle Slaves verwenden" + +msgid "Set to currently active slave (active, 1)" +msgstr "Entsprechend dem derzeit aktiven Slave (active, 1)" + +msgid "Set to first slave added to the bond (follow, 2)" +msgstr "Entsprechend dem ersten hinzugefügten Slave (follow, 2)" + +msgid "Slave Interfaces" +msgstr "" + +msgid "" +"Specifies that duplicate frames (received on inactive ports) should be " +"dropped or delivered" +msgstr "" +"Spezifiziert ob doppelte Frames (empfangen auf inaktiven Ports) verworfen " +"oder zugestellt werden" + +msgid "Specifies the ARP link monitoring frequency in milliseconds" +msgstr "Häufigkeit des ARP Link Monitorings in Millisekunden" + +msgid "Specifies the IP addresses to use for ARP monitoring" +msgstr "Für ARP Monitoring zu verwendende IP Adressen" + +msgid "Specifies the MII link monitoring frequency in milliseconds" +msgstr "Häufigkeit des MII Link Monitorings in Millisekunden" + +msgid "Specifies the aggregation selection logic to use" +msgstr "Spezifiziert die zu verwendende Gruppierungslogik" + +msgid "" +"Specifies the mac-address for the actor in protocol packet exchanges " +"(LACPDUs). If empty, masters' mac address defaults to system default" +msgstr "" +"Selektiert die MAC Adresse für den Aktor für LACPDUs. Wenn nicht angegeben " +"entspricht die Master Mac Adresse der System Voreinstellung" + +msgid "" +"Specifies the minimum number of links that must be active before asserting " +"carrier" +msgstr "" +"Spezifiziert die minimale Anzahl aktiver Links bevor Carrier signalisiert " +"wird" + +msgid "Specifies the mode to be used for this bonding interface" +msgstr "" +"Spezifizert die zu benutzende Bonding Methode für dieses Bonding Interface" + +msgid "" +"Specifies the number of IGMP membership reports to be issued after a " +"failover event in 200ms intervals" +msgstr "" +"Spezifiziert die Anzahl von IGMP Zugehörigkeitsmeldungen nach einem Failover " +"Ereignis in 200ms Intervallen" + +msgid "" +"Specifies the number of packets to transmit through a slave before moving to " +"the next one" +msgstr "" +"Spezifiziert die Anzahl der auf einem Slave zu übertragenden Pakete vor " +"Wechsel zum nächsten Slave" + +msgid "" +"Specifies the number of peer notifications (gratuitous ARPs and unsolicited " +"IPv6 Neighbor Advertisements) to be issued after a failover event" +msgstr "" +"Spezifiziert die Anzahl der Peer Benachrichtigungen (gratuitous ARPs and " +"unsolicited IPv6 Neighbor Advertisements) nach einem Failover Ereignis" + +msgid "" +"Specifies the number of seconds between instances where the bonding driver " +"sends learning packets to each slaves peer switch" +msgstr "" + +msgid "Specifies the quantity of ARP IP targets that must be reachable" +msgstr "Spezifizert die Anzahl der ARP IP Ziele die erreichbar sein müssen" + +msgid "" +"Specifies the rate in which the link partner will be asked to transmit " +"LACPDU packets" +msgstr "" +"Spezifiziert die Häufigkeit in welcher der Link Partner aufgefordert wird " +"LACPDU Pakete zu senden" + +msgid "" +"Specifies the reselection policy for the primary slave when failure of the " +"active slave or recovery of the primary slave occurs" +msgstr "" +"Spezifiziert die Neuauswahl für das primäre Slave wenn ein Ausfall des " +"aktiven Slaves oder ein Recovery des primären Slaves passiert" + +msgid "Specifies the system priority" +msgstr "Spezifiziert die System Priorität" + +msgid "" +"Specifies the time in milliseconds to wait before disabling a slave after a " +"link failure detection" +msgstr "" +"Spezifizert die Zeit in Millisekunden bevor ein Slave nach Erkennung eines " +"Link Fehlers deaktiviert wird" + +msgid "" +"Specifies the time in milliseconds to wait before enabling a slave after a " +"link recovery detection" +msgstr "" +"Spezifizert die Zeit in Millisekunden nach der ein Slave nach Erkennung " +"eines Link Recoveries aktiviert wird" + +msgid "" +"Specifies whether ARP probes and replies should be validated or non-ARP " +"traffic should be filtered for link monitoring" +msgstr "" +"Spezifiziert ob ARP Anfragen und Antworten überprüft oder nicht ARP " +"Datenverkehr für das Link Monitoring gefiltert werden sollen" + +msgid "" +"Specifies whether active-backup mode should set all slaves to the same MAC " +"address at enslavement" +msgstr "" +"Spezifiziert ob 'active-backup' Modus allen Slaves die gleiche MAC Adresse " +"beim Zusammenschluss zuweisen soll" + +msgid "" +"Specifies whether or not miimon should use MII or ETHTOOL ioctls vs. " +"netif_carrier_ok()" +msgstr "" +"Spezifiziert ob 'miimon' MII oder ETHTOOL ioctls verwenden soll oder " +"netif_carrier_ok()" + +msgid "Specifies whether the bonding interface should use DHCP client mode" +msgstr "" +"Spezifiziert ob das Bonding Interface im DHCP Client Modus arbeiten soll" + +msgid "" +"Specifies whether to shuffle active flows across slaves based on the load" +msgstr "" +"Spezifiziert ob aktiver Datenverkehr über Slaves lastabhängig verteilt " +"werden soll" + +msgid "" +"Specifies which slave interfaces should be attached to this bonding interface" +msgstr "" +"Spezifiziert welche Slave Interfaces diesem Bonding Interface zugeordnet " +"werden sollen" + +msgid "" +"Specifies which slave is the primary device. It will always be the active " +"slave while it is available" +msgstr "" +"Spezifiziert welches Slave Interface als primäres Slave verwendet werden " +"soll. Es wird immer als aktives Slave verwendet sofern es verfügbar ist." + +msgid "System Priority" +msgstr "System Priorität" + +msgid "Transmit Hash Policy" +msgstr "Hash Übertragungsmethode" + +msgid "Up Delay" +msgstr "Up Verzögerung" + +msgid "Use DHCP (Client Mode)" +msgstr "DHCP Client Mode verwenden" + +msgid "Use XOR of hardware MAC addresses (layer2)" +msgstr "XOR der Hardware MAC Adressen verwenden (layer2)" + +msgid "Use XOR of hardware MAC addresses and IP addresses (layer2+3)" +msgstr "XOR der Hardware MAC und IP Adressen verwenden (layer2+3)" + +msgid "" +"Use XOR of hardware MAC addresses and IP addresses, rely on skb_flow_dissect " +"(encap2+3)" +msgstr "" +"XOR der Hardware MAC und IP Adressen basierend auf skb_flow_dissect " +"verwenden (encap2+3)" + +msgid "Use upper layer protocol information (layer3+4)" +msgstr "Übergeordnete Protokollschicht Informationen verwenden (layer3+4)" + +msgid "" +"Use upper layer protocol information, rely on skb_flow_dissect (encap3+4)" +msgstr "" +"Übergeordnete Protokollschicht Informationen basierend auf skb_flow_dissect " +"verwenden (encap3+4)" + +msgid "Validation for all slaves" +msgstr "Validierung für alle Slaves" + +msgid "Validation only for active slave" +msgstr "Validierung nur für aktives Slave" + +msgid "Validation only for backup slaves" +msgstr "Validierung nur für Backup Slaves" + +msgid "XOR policy (balance-xor, 2)" +msgstr "" + +msgid "Yes" +msgstr "Ja" + +msgid "Yes (none, 0)" +msgstr "Ja (none, 0)" + +msgid "You must select a primary interface for the selected policy" +msgstr "Für die gewählte Bonding Methode ist ein Primäres Slave erforderlich" + +msgid "" +"You must select a primary interface which is included in selected slave " +"interfaces" +msgstr "Das primäre Interface muss in den selektierten Slaves enthalten sein" + +msgid "" +"You must select at least one ARP IP target if ARP monitoring is selected" +msgstr "Es muss mindestens ein ARP IP Ziel für ARP Monitoring definiert werden" + +msgid "You must select at least one slave interface" +msgstr "Bitte mindestens ein Slave Interface auswählen" + +msgid "netif_carrier_ok()" +msgstr "" diff --git a/package/lean/luci-proto-bonding/po/en/bonding.po b/package/lean/luci-proto-bonding/po/en/bonding.po new file mode 100644 index 00000000000000..8f734db3de72e8 --- /dev/null +++ b/package/lean/luci-proto-bonding/po/en/bonding.po @@ -0,0 +1,345 @@ +msgid "ARP" +msgstr "" + +msgid "ARP IP Targets" +msgstr "" + +msgid "ARP Interval" +msgstr "" + +msgid "ARP Validation" +msgstr "" + +msgid "ARP mode to consider a slave as being up" +msgstr "" + +msgid "ARP monitoring is not supported for the selected policy" +msgstr "" + +msgid "Active-Backup policy (active-backup, 1)" +msgstr "" + +msgid "Adaptive load balancing (balance-alb, 6)" +msgstr "" + +msgid "Adaptive transmit load balancing (balance-tlb, 5)" +msgstr "" + +msgid "Aggregation Selection Logic" +msgstr "" + +msgid "Aggregator: All slaves down or has no slaves (stable, 0)" +msgstr "" + +msgid "" +"Aggregator: Chosen by the largest number of ports + slave added/removed or " +"state changes (count, 2)" +msgstr "" + +msgid "Aggregator: Slave added/removed or state changes (bandwidth, 1)" +msgstr "" + +msgid "Bonding Policy" +msgstr "" + +msgid "Broadcast policy (broadcast, 3)" +msgstr "" + +msgid "Consider the slave up when all ARP IP targets are reachable (all, 1)" +msgstr "" + +msgid "Consider the slave up when any ARP IP target is reachable (any, 0)" +msgstr "" + +msgid "Down Delay" +msgstr "" + +msgid "Drop Duplicate Frames" +msgstr "" + +msgid "Enable Dynamic Shuffling Of Flows" +msgstr "" + +msgid "Every 30 seconds (slow, 0)" +msgstr "" + +msgid "Every second (fast, 1)" +msgstr "" + +msgid "Filtering for all slaves, no validation" +msgstr "" + +msgid "Filtering for all slaves, validation only for active slave" +msgstr "" + +msgid "Filtering for all slaves, validation only for backup slaves" +msgstr "" + +msgid "IEEE 802.3ad Dynamic link aggregation (802.3ad, 4)" +msgstr "" + +msgid "IPv4 address" +msgstr "" + +msgid "IPv4 netmask" +msgstr "" + +msgid "Interval For Sending Learning Packets" +msgstr "" + +msgid "LACPDU Packets" +msgstr "" + +msgid "Link Aggregation (Channel Bonding)" +msgstr "" + +msgid "Link Monitoring" +msgstr "" + +msgid "MAC Address For The Actor" +msgstr "" + +msgid "MII" +msgstr "" + +msgid "MII / ETHTOOL ioctls" +msgstr "" + +msgid "MII Interval" +msgstr "" + +msgid "Method of link monitoring" +msgstr "" + +msgid "Method to determine link status" +msgstr "" + +msgid "Minimum Number of Links" +msgstr "" + +msgid "No" +msgstr "" + +msgid "No validation or filtering" +msgstr "" + +msgid "Number of IGMP membership reports" +msgstr "" + +msgid "Number of peer notifications after failover event" +msgstr "" + +msgid "Off" +msgstr "" + +msgid "" +"Only if current active slave fails and the primary slave is up (failure, 2)" +msgstr "" + +msgid "Packets To Transmit Before Moving To Next Slave" +msgstr "" + +msgid "Primary Slave" +msgstr "" + +msgid "" +"Primary becomes active slave when it comes back up if speed and duplex " +"better than current slave (better, 1)" +msgstr "" + +msgid "Primary becomes active slave whenever it comes back up (always, 0)" +msgstr "" + +msgid "Reselection policy for primary slave" +msgstr "" + +msgid "Round-Robin policy (balance-rr, 0)" +msgstr "" + +msgid "Selects the transmit hash policy to use for slave selection" +msgstr "" + +msgid "Set same MAC Address to all slaves" +msgstr "" + +msgid "Set to currently active slave (active, 1)" +msgstr "" + +msgid "Set to first slave added to the bond (follow, 2)" +msgstr "" + +msgid "Slave Interfaces" +msgstr "" + +msgid "" +"Specifies that duplicate frames (received on inactive ports) should be " +"dropped or delivered" +msgstr "" + +msgid "Specifies the ARP link monitoring frequency in milliseconds" +msgstr "" + +msgid "Specifies the IP addresses to use for ARP monitoring" +msgstr "" + +msgid "Specifies the MII link monitoring frequency in milliseconds" +msgstr "" + +msgid "Specifies the aggregation selection logic to use" +msgstr "" + +msgid "" +"Specifies the mac-address for the actor in protocol packet exchanges " +"(LACPDUs). If empty, masters' mac address defaults to system default" +msgstr "" + +msgid "" +"Specifies the minimum number of links that must be active before asserting " +"carrier" +msgstr "" + +msgid "Specifies the mode to be used for this bonding interface" +msgstr "" + +msgid "" +"Specifies the number of IGMP membership reports to be issued after a " +"failover event in 200ms intervals" +msgstr "" + +msgid "" +"Specifies the number of packets to transmit through a slave before moving to " +"the next one" +msgstr "" + +msgid "" +"Specifies the number of peer notifications (gratuitous ARPs and unsolicited " +"IPv6 Neighbor Advertisements) to be issued after a failover event" +msgstr "" + +msgid "" +"Specifies the number of seconds between instances where the bonding driver " +"sends learning packets to each slaves peer switch" +msgstr "" + +msgid "Specifies the quantity of ARP IP targets that must be reachable" +msgstr "" + +msgid "" +"Specifies the rate in which the link partner will be asked to transmit " +"LACPDU packets" +msgstr "" + +msgid "" +"Specifies the reselection policy for the primary slave when failure of the " +"active slave or recovery of the primary slave occurs" +msgstr "" + +msgid "Specifies the system priority" +msgstr "" + +msgid "" +"Specifies the time in milliseconds to wait before disabling a slave after a " +"link failure detection" +msgstr "" + +msgid "" +"Specifies the time in milliseconds to wait before enabling a slave after a " +"link recovery detection" +msgstr "" + +msgid "" +"Specifies whether ARP probes and replies should be validated or non-ARP " +"traffic should be filtered for link monitoring" +msgstr "" + +msgid "" +"Specifies whether active-backup mode should set all slaves to the same MAC " +"address at enslavement" +msgstr "" + +msgid "" +"Specifies whether or not miimon should use MII or ETHTOOL ioctls vs. " +"netif_carrier_ok()" +msgstr "" + +msgid "Specifies whether the bonding interface should use DHCP client mode" +msgstr "" + +msgid "" +"Specifies whether to shuffle active flows across slaves based on the load" +msgstr "" + +msgid "" +"Specifies which slave interfaces should be attached to this bonding interface" +msgstr "" + +msgid "" +"Specifies which slave is the primary device. It will always be the active " +"slave while it is available" +msgstr "" + +msgid "System Priority" +msgstr "" + +msgid "Transmit Hash Policy" +msgstr "" + +msgid "Up Delay" +msgstr "" + +msgid "Use DHCP (Client Mode)" +msgstr "" + +msgid "Use XOR of hardware MAC addresses (layer2)" +msgstr "" + +msgid "Use XOR of hardware MAC addresses and IP addresses (layer2+3)" +msgstr "" + +msgid "" +"Use XOR of hardware MAC addresses and IP addresses, rely on skb_flow_dissect " +"(encap2+3)" +msgstr "" + +msgid "Use upper layer protocol information (layer3+4)" +msgstr "" + +msgid "" +"Use upper layer protocol information, rely on skb_flow_dissect (encap3+4)" +msgstr "" + +msgid "Validation for all slaves" +msgstr "" + +msgid "Validation only for active slave" +msgstr "" + +msgid "Validation only for backup slaves" +msgstr "" + +msgid "XOR policy (balance-xor, 2)" +msgstr "" + +msgid "Yes" +msgstr "" + +msgid "Yes (none, 0)" +msgstr "" + +msgid "You must select a primary interface for the selected policy" +msgstr "" + +msgid "" +"You must select a primary interface which is included in selected slave " +"interfaces" +msgstr "" + +msgid "" +"You must select at least one ARP IP target if ARP monitoring is selected" +msgstr "" + +msgid "You must select at least one slave interface" +msgstr "" + +msgid "netif_carrier_ok()" +msgstr "" diff --git a/package/lean/luci-proto-bonding/po/templates/bonding.pot b/package/lean/luci-proto-bonding/po/templates/bonding.pot new file mode 100644 index 00000000000000..96878ec981cafb --- /dev/null +++ b/package/lean/luci-proto-bonding/po/templates/bonding.pot @@ -0,0 +1,348 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +msgid "ARP" +msgstr "" + +msgid "ARP IP Targets" +msgstr "" + +msgid "ARP Interval" +msgstr "" + +msgid "ARP Validation" +msgstr "" + +msgid "ARP mode to consider a slave as being up" +msgstr "" + +msgid "ARP monitoring is not supported for the selected policy" +msgstr "" + +msgid "Active-Backup policy (active-backup, 1)" +msgstr "" + +msgid "Adaptive load balancing (balance-alb, 6)" +msgstr "" + +msgid "Adaptive transmit load balancing (balance-tlb, 5)" +msgstr "" + +msgid "Aggregation Selection Logic" +msgstr "" + +msgid "Aggregator: All slaves down or has no slaves (stable, 0)" +msgstr "" + +msgid "" +"Aggregator: Chosen by the largest number of ports + slave added/removed or " +"state changes (count, 2)" +msgstr "" + +msgid "Aggregator: Slave added/removed or state changes (bandwidth, 1)" +msgstr "" + +msgid "Bonding Policy" +msgstr "" + +msgid "Broadcast policy (broadcast, 3)" +msgstr "" + +msgid "Consider the slave up when all ARP IP targets are reachable (all, 1)" +msgstr "" + +msgid "Consider the slave up when any ARP IP target is reachable (any, 0)" +msgstr "" + +msgid "Down Delay" +msgstr "" + +msgid "Drop Duplicate Frames" +msgstr "" + +msgid "Enable Dynamic Shuffling Of Flows" +msgstr "" + +msgid "Every 30 seconds (slow, 0)" +msgstr "" + +msgid "Every second (fast, 1)" +msgstr "" + +msgid "Filtering for all slaves, no validation" +msgstr "" + +msgid "Filtering for all slaves, validation only for active slave" +msgstr "" + +msgid "Filtering for all slaves, validation only for backup slaves" +msgstr "" + +msgid "IEEE 802.3ad Dynamic link aggregation (802.3ad, 4)" +msgstr "" + +msgid "IPv4 address" +msgstr "" + +msgid "IPv4 netmask" +msgstr "" + +msgid "Interval For Sending Learning Packets" +msgstr "" + +msgid "LACPDU Packets" +msgstr "" + +msgid "Link Aggregation (Channel Bonding)" +msgstr "" + +msgid "Link Monitoring" +msgstr "" + +msgid "MAC Address For The Actor" +msgstr "" + +msgid "MII" +msgstr "" + +msgid "MII / ETHTOOL ioctls" +msgstr "" + +msgid "MII Interval" +msgstr "" + +msgid "Method of link monitoring" +msgstr "" + +msgid "Method to determine link status" +msgstr "" + +msgid "Minimum Number of Links" +msgstr "" + +msgid "No" +msgstr "" + +msgid "No validation or filtering" +msgstr "" + +msgid "Number of IGMP membership reports" +msgstr "" + +msgid "Number of peer notifications after failover event" +msgstr "" + +msgid "Off" +msgstr "" + +msgid "" +"Only if current active slave fails and the primary slave is up (failure, 2)" +msgstr "" + +msgid "Packets To Transmit Before Moving To Next Slave" +msgstr "" + +msgid "Primary Slave" +msgstr "" + +msgid "" +"Primary becomes active slave when it comes back up if speed and duplex " +"better than current slave (better, 1)" +msgstr "" + +msgid "Primary becomes active slave whenever it comes back up (always, 0)" +msgstr "" + +msgid "Reselection policy for primary slave" +msgstr "" + +msgid "Round-Robin policy (balance-rr, 0)" +msgstr "" + +msgid "Selects the transmit hash policy to use for slave selection" +msgstr "" + +msgid "Set same MAC Address to all slaves" +msgstr "" + +msgid "Set to currently active slave (active, 1)" +msgstr "" + +msgid "Set to first slave added to the bond (follow, 2)" +msgstr "" + +msgid "Slave Interfaces" +msgstr "" + +msgid "" +"Specifies that duplicate frames (received on inactive ports) should be " +"dropped or delivered" +msgstr "" + +msgid "Specifies the ARP link monitoring frequency in milliseconds" +msgstr "" + +msgid "Specifies the IP addresses to use for ARP monitoring" +msgstr "" + +msgid "Specifies the MII link monitoring frequency in milliseconds" +msgstr "" + +msgid "Specifies the aggregation selection logic to use" +msgstr "" + +msgid "" +"Specifies the mac-address for the actor in protocol packet exchanges " +"(LACPDUs). If empty, masters' mac address defaults to system default" +msgstr "" + +msgid "" +"Specifies the minimum number of links that must be active before asserting " +"carrier" +msgstr "" + +msgid "Specifies the mode to be used for this bonding interface" +msgstr "" + +msgid "" +"Specifies the number of IGMP membership reports to be issued after a " +"failover event in 200ms intervals" +msgstr "" + +msgid "" +"Specifies the number of packets to transmit through a slave before moving to " +"the next one" +msgstr "" + +msgid "" +"Specifies the number of peer notifications (gratuitous ARPs and unsolicited " +"IPv6 Neighbor Advertisements) to be issued after a failover event" +msgstr "" + +msgid "" +"Specifies the number of seconds between instances where the bonding driver " +"sends learning packets to each slaves peer switch" +msgstr "" + +msgid "Specifies the quantity of ARP IP targets that must be reachable" +msgstr "" + +msgid "" +"Specifies the rate in which the link partner will be asked to transmit " +"LACPDU packets" +msgstr "" + +msgid "" +"Specifies the reselection policy for the primary slave when failure of the " +"active slave or recovery of the primary slave occurs" +msgstr "" + +msgid "Specifies the system priority" +msgstr "" + +msgid "" +"Specifies the time in milliseconds to wait before disabling a slave after a " +"link failure detection" +msgstr "" + +msgid "" +"Specifies the time in milliseconds to wait before enabling a slave after a " +"link recovery detection" +msgstr "" + +msgid "" +"Specifies whether ARP probes and replies should be validated or non-ARP " +"traffic should be filtered for link monitoring" +msgstr "" + +msgid "" +"Specifies whether active-backup mode should set all slaves to the same MAC " +"address at enslavement" +msgstr "" + +msgid "" +"Specifies whether or not miimon should use MII or ETHTOOL ioctls vs. " +"netif_carrier_ok()" +msgstr "" + +msgid "Specifies whether the bonding interface should use DHCP client mode" +msgstr "" + +msgid "" +"Specifies whether to shuffle active flows across slaves based on the load" +msgstr "" + +msgid "" +"Specifies which slave interfaces should be attached to this bonding interface" +msgstr "" + +msgid "" +"Specifies which slave is the primary device. It will always be the active " +"slave while it is available" +msgstr "" + +msgid "System Priority" +msgstr "" + +msgid "Transmit Hash Policy" +msgstr "" + +msgid "Up Delay" +msgstr "" + +msgid "Use DHCP (Client Mode)" +msgstr "" + +msgid "Use XOR of hardware MAC addresses (layer2)" +msgstr "" + +msgid "Use XOR of hardware MAC addresses and IP addresses (layer2+3)" +msgstr "" + +msgid "" +"Use XOR of hardware MAC addresses and IP addresses, rely on skb_flow_dissect " +"(encap2+3)" +msgstr "" + +msgid "Use upper layer protocol information (layer3+4)" +msgstr "" + +msgid "" +"Use upper layer protocol information, rely on skb_flow_dissect (encap3+4)" +msgstr "" + +msgid "Validation for all slaves" +msgstr "" + +msgid "Validation only for active slave" +msgstr "" + +msgid "Validation only for backup slaves" +msgstr "" + +msgid "XOR policy (balance-xor, 2)" +msgstr "" + +msgid "Yes" +msgstr "" + +msgid "Yes (none, 0)" +msgstr "" + +msgid "You must select a primary interface for the selected policy" +msgstr "" + +msgid "" +"You must select a primary interface which is included in selected slave " +"interfaces" +msgstr "" + +msgid "" +"You must select at least one ARP IP target if ARP monitoring is selected" +msgstr "" + +msgid "You must select at least one slave interface" +msgstr "" + +msgid "netif_carrier_ok()" +msgstr "" diff --git a/package/lean/luci-theme-argon/Makefile b/package/lean/luci-theme-argon/Makefile new file mode 100644 index 00000000000000..9a7cafaf6e07db --- /dev/null +++ b/package/lean/luci-theme-argon/Makefile @@ -0,0 +1,17 @@ +# +# Copyright (C) 2008-2014 The LuCI Team +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=Argon Theme +LUCI_DEPENDS:= +LUCI_PKGARCH:=all +PKG_VERSION:=1.0 +PKG_RELEASE:=2 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/package/lean/luci-theme-argon/htdocs/luci-static/argon/css/style.css b/package/lean/luci-theme-argon/htdocs/luci-static/argon/css/style.css new file mode 100644 index 00000000000000..d209dfaa954b04 --- /dev/null +++ b/package/lean/luci-theme-argon/htdocs/luci-static/argon/css/style.css @@ -0,0 +1,1853 @@ +/** + * argon is a clean HTML5 theme for LuCI. It is based on luci-theme-bootstrap and MUI + * + * luci-theme-argon + * Copyright 2015 Lutty Yang + * + * Have a bug? Please create an issue here on GitHub! + * https://github.com/LuttyYang/luci-theme-material/issues + * + * luci-theme-bootstrap: + * Copyright 2008 Steven Barth + * Copyright 2008 Jo-Philipp Wich + * Copyright 2012 David Menting + * + * MUI: + * https://github.com/muicss/mui + * + * Licensed to the public under the Apache License 2.0 + */ + +/* + * Font generate by Icomoon + */ + .pure-g{letter-spacing:-.31em;text-rendering:optimizespeed;font-family:FreeSans,Arimo,"Droid Sans",Helvetica,Arial,sans-serif;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-flow:row wrap;-ms-flex-flow:row wrap;flex-flow:row wrap;-webkit-align-content:flex-start;-ms-flex-line-pack:start;align-content:flex-start}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){table .pure-g{display:block}}.opera-only :-o-prefocus,.pure-g{word-spacing:-.43em}.pure-u,.pure-u-1,.pure-u-1-1,.pure-u-1-12,.pure-u-1-2,.pure-u-1-24,.pure-u-1-3,.pure-u-1-4,.pure-u-1-5,.pure-u-1-6,.pure-u-1-8,.pure-u-10-24,.pure-u-11-12,.pure-u-11-24,.pure-u-12-24,.pure-u-13-24,.pure-u-14-24,.pure-u-15-24,.pure-u-16-24,.pure-u-17-24,.pure-u-18-24,.pure-u-19-24,.pure-u-2-24,.pure-u-2-3,.pure-u-2-5,.pure-u-20-24,.pure-u-21-24,.pure-u-22-24,.pure-u-23-24,.pure-u-24-24,.pure-u-3-24,.pure-u-3-4,.pure-u-3-5,.pure-u-3-8,.pure-u-4-24,.pure-u-4-5,.pure-u-5-12,.pure-u-5-24,.pure-u-5-5,.pure-u-5-6,.pure-u-5-8,.pure-u-6-24,.pure-u-7-12,.pure-u-7-24,.pure-u-7-8,.pure-u-8-24,.pure-u-9-24{display:inline-block;zoom:1;letter-spacing:normal;word-spacing:normal;vertical-align:top;text-rendering:auto}.pure-g [class*=pure-u]{font-family:sans-serif}.pure-u-1-24{width:4.1667%}.pure-u-1-12,.pure-u-2-24{width:8.3333%}.pure-u-1-8,.pure-u-3-24{width:12.5%}.pure-u-1-6,.pure-u-4-24{width:16.6667%}.pure-u-1-5{width:20%}.pure-u-5-24{width:20.8333%}.pure-u-1-4,.pure-u-6-24{width:25%}.pure-u-7-24{width:29.1667%}.pure-u-1-3,.pure-u-8-24{width:33.3333%}.pure-u-3-8,.pure-u-9-24{width:37.5%}.pure-u-2-5{width:40%}.pure-u-10-24,.pure-u-5-12{width:41.6667%}.pure-u-11-24{width:45.8333%}.pure-u-1-2,.pure-u-12-24{width:50%}.pure-u-13-24{width:54.1667%}.pure-u-14-24,.pure-u-7-12{width:58.3333%}.pure-u-3-5{width:60%}.pure-u-15-24,.pure-u-5-8{width:62.5%}.pure-u-16-24,.pure-u-2-3{width:66.6667%}.pure-u-17-24{width:70.8333%}.pure-u-18-24,.pure-u-3-4{width:75%}.pure-u-19-24{width:79.1667%}.pure-u-4-5{width:80%}.pure-u-20-24,.pure-u-5-6{width:83.3333%}.pure-u-21-24,.pure-u-7-8{width:87.5%}.pure-u-11-12,.pure-u-22-24{width:91.6667%}.pure-u-23-24{width:95.8333%}.pure-u-1,.pure-u-1-1,.pure-u-24-24,.pure-u-5-5{width:100%} + +@font-face { + font-family: 'icomoon'; + src: url('../fonts/font.eot'); + src: url('../fonts/font.eot') format('embedded-opentype'), + url('../fonts/font.ttf') format('truetype'), + url('../fonts/font.woff') format('woff'), + url('../fonts/font.svg') format('svg'); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: 'ssr'; + src: url('../fonts/ssr.eot?5zoxsi'); + src: url('../fonts/ssr.eot?5zoxsi#iefix') format('embedded-opentype'), + url('../fonts/ssr.ttf?5zoxsi') format('truetype'), + url('../fonts/ssr.woff?5zoxsi') format('woff'), + url('../fonts/ssr.svg?5zoxsi#ssr') format('svg'); + font-weight: normal; + font-style: normal; +} + +[class^="icon-"], [class*=" icon-"] { + /* use !important to prevent issues with browser extensions that change fonts */ + font-family: 'ssr' !important; + speak: none; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + line-height: 1; + + /* Better Font Rendering =========== */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon-dashboard:before { + content: "\e906"; +} +.icon-logout:before { + content: "\e907"; +} +.icon-Network:before { + content: "\e908"; +} +.icon-services:before { + content: "\e909"; +} +.icon-system:before { + content: "\e90a"; +} +.icon-vpn:before { + content: "\e90b"; +} +.icon-storage:before { + content: "\e90c"; +} +.icon-statistics:before { + content: "\e90d"; +} +.icon-delete:before { + content: "\e900"; +} +.icon-edit:before { + content: "\e901"; +} +.icon-ok:before { + content: "\e902"; +} +.icon-loading:before { + content: "\e903"; +} +.icon-switch:before { + content: "\e904"; +} +.icon-error:before { + content: "\e905"; +} + + +.cbi-button-up, +.cbi-button-down, +.cbi-value-helpicon, +.showSide, +.main > .loading > span { + font-family: 'icomoon' !important; + speak: none; + font-style: normal !important; + font-weight: normal !important; + font-variant: normal !important; + text-transform: none !important; + line-height: 1; + + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +.h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 { + font-family: inherit; + font-weight: 400; + line-height: 1.1; + color: inherit; +} + +html { + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; +} + +body { + font-size: 0.8rem; + background-color: #f8f9fe; +} + +html, body { + margin: 0px; + padding: 0px; + height: 100%; + font-family: Microsoft Yahei, WenQuanYi Micro Hei, sans-serif, "Helvetica Neue", Helvetica, Hiragino Sans GB; +} + +select { + padding: 0.36rem 0.8rem; + color: #555; + background-color: #fff; + background-image: none; + border: 1px solid #ccc; +} + +select, +input { + + font-size: .875rem; + transition: all .15s ease-in-out; + line-height: 1.5; + height: calc(2.75rem + 2px); + padding: .625rem .75rem; + transition: all .15s cubic-bezier(.68,-.55,.265,1.55); + color: #8898aa; + border: 1px solid #dee2e6; + border-radius: .25rem; + background-color: #fff; + background-clip: padding-box; + box-shadow: 0 3px 2px rgba(233,236,239,.05); + margin:0.25rem; +} + +select:not([multiple="multiple"]):focus, +input:focus { + border-color: #0099CC; +} + +select[multiple="multiple"] { + height: auto; +} + +code { + color: #0099CC; +} + +abbr { + color: #005470; + text-decoration: underline; + cursor: help; +} + +hr { + margin: 1rem 0; + border-color: #EEE; + opacity: 0.1; +} + +header, .main { + width: 100%; + position: absolute; +} + +header { + height: 4rem; + box-shadow: 0 4px 20px 0 rgba(0,0,0,.14), 0 7px 12px -5px rgba(156,39,176,.46); + transition: box-shadow .2s; + float: left; + position: fixed; + z-index: 101; +} + +footer { + text-align: right; + padding: 1rem; + color: #aaa; + font-size: 0.8rem; + text-shadow: 0px 0px 2px #BBB; +} + +footer > a { + color: #aaa; + text-decoration: none; +} + +.main { + top: 4rem; + bottom: 0rem; + position: relative; + height: 100%; + height: calc(100% - 4rem); +} + +.main > .loading { + position: fixed; + width: 100%; + height: 100%; + z-index: 2000; + display: flex; + align-items: center; + justify-content: center; + background-color: #f8f9fe; + top: 0; +} + +.main > .loading > span { + display: block; + text-align: center; + margin-top: 2rem; + color: #5e72e4; + font-size: 2rem; +} + +.main > .loading > span > .loading-img:before { + content: "\e603"; +} + +.main > .loading > span > .loading-img { + animation: anim-rotate 2s infinite linear; + margin-right: 0.4rem; + display: inline-block; +} + +@keyframes anim-rotate { + 0% { + -webkit-transform: rotate(0); + -ms-transform: rotate(0); + transform: rotate(0); + } + 100% { + -webkit-transform: rotate(360deg); + -ms-transform: rotate(360deg); + transform: rotate(360deg) + } +} + +[id^="cbi-apply-"] { + position: fixed; + z-index: 200; + width: 20rem; + margin-left:-10rem; + margin-top:-5rem; + height: 10rem; + left: 50%; + top: 50%; + font-size: 1.2rem; + border-color: #5e72e4; + text-align: center; +} +[id^="cbi-apply-"] > .panel-title { + border-bottom:none; +} +[id^="cbi-apply-"] > [id^="cbi-apply-"]{ + position: initial; + width:auto; + height:auto; + font-size: 1rem; + margin-top:.8rem; + display:block; +} +.main-left { + float: left; + top: 4rem; + width: 15%; + width: calc(0% + 15rem); + height: 100%; + height: calc(100% - 4rem); + background-color: #172b4d!important; + box-shadow: 0 0 2rem 0 rgba(136,152,170,.15); + overflow-x: auto; + position: fixed; +} + +.main-right { + width: 85%; + width: calc(100% - 15rem); + float: right; + height: 100%; + background-color: #f8f9fe; +} + +.main-right > #maincontent { + background-color: #f8f9fe; +} + +.pull-right { + float: right; +} + +.pull-left { + float: left; +} + +header { + background: linear-gradient(87deg,#5e72e4 0,#825ee4 100%)!important; + color: white; +} + +header > .container { + margin-top: 0.5rem; + padding: 0.5rem 1rem 0 1rem; +} + +header > .container > .brand { + font-size: 1.4rem; + color: white; + text-decoration: none; + cursor: default; + vertical-align: text-bottom; +} + +.danger { + background-color: #f5365c !important; + color: black; +} + +.warning { + background-color: #fb6340 !important; + color: black; +} + +.success { + background-color: #2dce89 !important; + color: black; +} + +.errorbox, +.alert-message { + margin: 2rem 0 0 0; + padding: 2rem; + border: 0; + font-weight: normal; + font-style: normal; + line-height: 1; + font-family: inherit; + min-width: inherit; + overflow: auto; + border-radius: 0; + background-color: #FFF; + box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .16), 0 0 2px 0 rgba(0, 0, 0, .12); +} + +.errorbox { + color: #fff; + background-color: #f0ad4e; + border-color: #eea236; +} + +.error { + color: red; +} + +#maincontent > .container > div:nth-child(1).alert-message.warning > a { + font: inherit; + overflow: visible; + text-transform: none; + display: inline-block; + margin-bottom: 0; + font-weight: 400; + text-align: center; + white-space: nowrap; + vertical-align: middle; + touch-action: manipulation; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-image: none; + min-width: 6rem; + padding: 0.5rem 1rem; + font-size: 0.9rem; + line-height: 1.42857143; + color: #fff; + background-color: #5bc0de; + border-color: #46b8da; + margin-top: 2rem; + text-decoration: inherit; +} + +.main > .main-left > .nav { + margin-top: 0.5rem; +} + +.main > .main-left > .nav > li a { + color: #8699ad; + display: block; +} + +.main > .main-left > .nav > li:nth-last-child(1) { + margin-top: 2rem; + font-size: 1.2rem; +} + +.main > .main-left > .nav > li { + padding: 0.5rem 1rem; + cursor: pointer; +} + +.main > .main-left > .nav > .slide { + padding: 0; +} + +.main > .main-left > .nav > .slide > ul { + display: none; +} + +.main > .main-left > .nav > .slide > .menu { + display: block; + margin: 0.1rem .5rem 0.1rem 0; + padding: .675rem 0 .675rem 2.5rem; + border-radius: 0 .375rem .375rem 0; + text-decoration: none; + cursor: default; + font-size: 1rem; + transition: all 0.2s; + border-left: transparent 3px solid; +} + +.main > .main-left > .nav > li:hover, +.main > .main-left > .nav > .slide > .menu:hover { + color: white; + + background: #5e72e4; +} + +.main > .main-left > .nav > .slide:hover { + background: none; + +} +.main > .main-left > .nav > .slide > .menu:hover { + + border-left: #ffffff 3px solid; +} + +.main > .main-left > .nav > .slide > .menu:before{ + font-family: 'ssr' !important; + speak: none; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + line-height: 1; + + /* Better Font Rendering =========== */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + position: absolute; + left:1rem; + padding-top:3px; +} +.main > .main-left > .nav > .slide > .menu[data-title= 状态 ]:before{ + content: "\e906"; +} +.main > .main-left > .nav > .slide > .menu[data-title= 系统 ]:before{ + content: "\e90a"; +} +.main > .main-left > .nav > .slide > .menu[data-title= 服务 ]:before{ + content: "\e909"; +} +.main > .main-left > .nav > .slide > .menu[data-title= 网络存储 ]:before{ + content: "\e90c"; +} +.main > .main-left > .nav > .slide > .menu[data-title= VPN ]:before{ + content: "\e90b"; +} +.main > .main-left > .nav > .slide > .menu[data-title= 网络 ]:before{ + content: "\e908"; +} +.main > .main-left > .nav > .slide > .menu[data-title= 带宽监控 ]:before{ + content: "\e90d"; +} +.main > .main-left > .nav > .slide > .menu[data-title= 退出 ]:before{ + content: "\e907"; +} +header > .container > .brand:before{ + font-family: 'ssr' !important; + speak: none; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + line-height: 1; + + /* Better Font Rendering =========== */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + content: "\e90e"; + margin-right:0.5rem; +} + +.main > .main-left > .nav > .slide > .menu.active{ + border-left: #ffffff 3px solid; + color:white; +} + +.main > .main-left > .nav > .slide > .slide-menu > li { + +} + +.main > .main-left > .nav > .slide > .slide-menu > .active { + +} + +.main > .main-left > .nav > .slide > .slide-menu > li > a { + margin: 0.1rem .5rem 0.1rem 0; + padding: 0.5rem 1.5rem 0.5rem 2.5rem; + text-decoration: none; + border-radius: 0 .375rem .375rem 0; + white-space: nowrap; + color: #8699ad; + border-left: transparent 3px solid; + transition: all 0.2s; +} + +.main > .main-left > .nav > .slide > .slide-menu > .active > a { + color: white; + border-left: #ffffff 3px solid; + background-color: #5e72e4; +} + +.main > .main-left > .nav > .slide > .slide-menu > li > a:hover { + color: white; + border-left: #ffffff 3px solid; + background: #5e72e4; +} + +.main > .main-left > .nav > .slide > .slide-menu > .active > a:hover { + color: white; + border-left: #ffffff 3px solid; + background-color: #5e72e4; + cursor: hand; +} + +li { + list-style-type: none; +} + +#maincontent > .container { + margin: 0 2rem 1rem 2rem; +} + +h1 { + font-size: 2rem; + padding-bottom: 10px; + border-bottom: 1px solid #eee; +} + +h2 { + margin: 2rem 0 0 0; + font-size: 1.5rem; + padding-bottom: 10px; + border-bottom: 1px solid #eee; +} + +h3 { + font-size: 1.4rem; + + width: 100%; + display: block; + margin-bottom: 0; + padding: 1.25rem 1.5rem; + padding-bottom: 10px; + border-bottom: 1px solid rgba(0,0,0,.05); + background-color: #fff; + line-height: 1.5; + margin-bottom: 0rem; + letter-spacing: 0.1rem; + color: #32325d; + font-weight: bold; +} + +h4 { + +} + +fieldset { + margin: 2rem 0 0 0; + padding: 0; + font-weight: normal; + font-style: normal; + line-height: 1; + font-family: inherit; + + min-width: inherit; + overflow-x: auto; + overflow-y: hidden; + + border: 1px solid rgba(0,0,0,.05); + border-radius: .375rem; + background-color: #fff; + box-shadow: 0 0 2rem 0 rgba(136,152,170,.15); + + -webkit-overflow-scrolling: touch; +} + +.cbi-map-descr + fieldset { + margin-top: 1rem; +} + +fieldset > legend { + display: none !important; +} + +fieldset > fieldset { + margin: 0; + padding: 0; + border: none; + box-shadow: none; +} + +.panel-title { + width: 100%; + display: block; + margin-bottom: 0; + padding: 1.25rem 1.5rem; + border-bottom: 1px solid rgba(0,0,0,.05); + background-color: #fff; + line-height: 1.5; + margin-bottom: 0rem; + letter-spacing:0.1rem; + color: #32325d; + font-weight:bold; +} + +table { + border-spacing: 0; + border-collapse: collapse; + width: 100%; + border: 1px solid #eee; +} + +table > tbody > tr > td, table > tfoot > tr > td, table > thead > tr > td { + font-size: .8125rem; + white-space: nowrap; + color: #525f7f; + padding: 1rem; + padding-right: 1.5rem; + padding-left: 1.5rem; + border-top: 1px solid #ddd; + white-space: nowrap; +} + +table > tbody > tr > th, table > tfoot > tr > th, table > thead > tr > th { + +padding-right: 1.5rem; + padding-left: 1.5rem; + color: #8898aa; + background-color: #f6f9fc; + font-size: .65rem; + padding-top: .75rem; + padding-bottom: .75rem; + letter-spacing: 1px; + text-transform: uppercase; + border-bottom: 1px solid #e9ecef; +} +.cbi-section-table-cell { + text-align: center; +} + +.cbi-section-table-row { + text-align: center; +} + +fieldset > table > tbody > tr:nth-of-type(2n) { + background-color: #f9f9f9; +} + +/* fix progress bar */ +#swaptotal > div, +#swapfree > div, +#memfree > div, +#membuff > div, +#conns > div, +#memtotal > div { + width: 100% !important; + height: 1.6rem !important; + line-height:1.6rem; + border-radius: .25rem; +} + +#swaptotal > div > div, +#swapfree > div > div, +#memfree > div > div, +#membuff > div > div, +#conns > div > div, +#memtotal > div > div { + height: 100% !important; + background-color: #5e72e4 !important; +} + +/* fix multiple table */ + +table table { + border: none; +} + +.cbi-value-field table { + border: none; +} + +td > table > tbody > tr > td { + border: none; +} + +.cbi-value-field > table > tbody > tr > td { + border: none; +} + +/* button style */ + +.cbi-button { + -webkit-appearance: none; + text-transform: uppercase; + color: rgba(0, 0, 0, 0.87); + background-color: #F0F0F0; + transition: all 0.2s ease-in-out; + display: inline-block; + padding: 0 0.8rem; + border: none; + border-radius: 0.2rem; + cursor: pointer; + -ms-touch-action: manipulation; + touch-action: manipulation; + background-image: none; + text-align: center; + vertical-align: middle; + white-space: nowrap; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + font-size: 0.8rem; + width: auto !important; +} + +.cbi-button:hover, +.cbi-button:focus, +.cbi-button:active { + color: rgba(0, 0, 0, 0.87); + outline: 0; + text-decoration: none; + color: rgba(0, 0, 0, 0.87); +} + +.cbi-button:hover, +.cbi-button:focus { + box-shadow: 0 0px 2px rgba(0, 0, 0, 0.12), 0 2px 2px rgba(0, 0, 0, 0.2); +} + +.cbi-button:active { + box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23); +} + +.cbi-button:disabled { + cursor: not-allowed; + pointer-events: none; + opacity: 0.60; + box-shadow: none; +} + +form.inline + form.inline, +.cbi-button + .cbi-button { + margin-left: 0.6rem; +} + +.cbi-button-reset, +.cbi-input-remove { + color: #fff !important; + background-color: #f0ad4e !important; + border-color: #eea236 !important; +} + +.cbi-input-find, +.cbi-input-save, +.cbi-button-add, +.cbi-button-save, +.cbi-button-find, +.cbi-input-reload, +.cbi-button-reload { + color: #fff !important; + background-color: #337ab7 !important; + border-color: #2e6da4 !important; +} + +.cbi-input-apply, +.cbi-button-apply, +.cbi-button-edit { + color: #fff !important; + background-color: #5e72e4 !important; + border-color: #5e72e4 !important; +} + +.cbi-input-reset, +.cbi-section-remove > .cbi-button, +.cbi-button-remove { + color: #fff !important; + background-color: #fb6340 !important; + border-color: #fb6340 !important; +} + +.a-to-btn { + text-decoration: none; +} + +/* table */ + +.tabs { + margin: 0 -2rem; + padding-left: 0.5rem; + background-color: #FFFFFF; +} + +.cbi-tabmenu > li, +.tabs > li { + font-size:1rem; + border-top-left-radius:0.25rem; + border-top-right-radius:0.25rem; + display: inline-block; + padding: 1rem 0rem; +} + +.cbi-tabmenu > li > a, +.tabs > li > a { + text-decoration: none; + color:#404040; + padding: 0.5rem 0.8rem; +} +.cbi-tabmenu > li > a{ + color: white; +} + +.tabs > li[class~="active"], +.tabs > li:hover { + cursor: pointer; + border-bottom: 0.2rem solid #5e72e4; + color: #5e72e4; + margin-bottom: -0.18751rem; +} + +.tabs > li[class~="active"] > a { + color: #5e72e4; +} + +.tabs > li:hover { + border-bottom: 0.18751rem solid #C9C9C9; +} + +.cbi-tabmenu { + color: white; + +} + +.cbi-tabmenu > li:hover { + background-color: #F1F1F1; +} +.cbi-tabmenu > li:hover > a{ + color: #525f7f; +} + +.cbi-tabmenu > li[class~="cbi-tab"] { + + background-color: white; +} +.cbi-tabmenu > li[class~="cbi-tab"] > a{ + color: #525f7f; +} + +.cbi-tabmenu { + background-color: #adb5bd; + margin +} + +.cbi-section-remove:nth-of-type(2n), +.cbi-section-node:nth-of-type(2n){ + background-color: #f9f9f9; +} + +.cbi-section-node-tabbed { + padding: 0; + margin-top: 0; + +} + + +.cbi-tabcontainer > .cbi-value:nth-of-type(2n) { + background-color: #f9f9f9; +} + +.cbi-value-field, +.cbi-value-description { + display: table-cell; + line-height: 1.25; +} + +.cbi-value-helpicon > img { + display: none; +} + +.cbi-value-helpicon:before { + content: "\f059"; +} + +.cbi-value-description { + font-size: small; + opacity: 0.5; + padding: 0.5rem 0 0 0; +} + +.cbi-value-title { + word-wrap: break-word; + font-size: 0.875rem; + line-height: 1.6; + color: #525f7f; + padding: .7rem; + padding-left:0; + width: 23rem; + float: left; + text-align: right; + display: table-cell; +} + +.cbi-value { + padding: 0.3rem 1rem; + display: inline-block; + width: 100%; +} + +.cbi-section-table-descr > .cbi-section-table-cell, +.cbi-section-table-titles > .cbi-section-table-cell { + border: none; +} + +.cbi-rowstyle-2 { + background-color: #fff; +} + +.cbi-rowstyle-2 .cbi-button-up, +.cbi-rowstyle-2 .cbi-button-down { + background-color: #FFF !important; +} + +.cbi-section-table .cbi-section-table-titles .cbi-section-table-cell { + width: auto !important; +} + +/* desc */ +.cbi-section-descr, +.cbi-map-descr { + padding: 0.5rem; + color: #999; + font-size: small; +} + +/* luci */ + +.hidden { + display: none +} + +.left { + text-align: left !important; +} + +.right { + text-align: right !important; +} + +.inline { + display: inline; +} + +.cbi-page-actions { + border-top: 1px solid #eee; + padding-top: 1rem; + text-align: right; +} + +/* input */ +.cbi-value input[type="password"], +.cbi-value input[type="text"] { + min-width: 15rem; +} + +/* select */ +.cbi-value-field .cbi-input-select { + min-width: 15rem; +} + +.ifacebadge { + display: inline-flex; + border-bottom: 1px solid #CCCCCC; + padding: 0.5rem 1rem; + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); +} + +td > .ifacebadge { + background-color: #F0F0F0; + font-size: 0.9rem; +} + +.ifacebadge > img { + float: right; + margin: 0 0.3rem; +} + +/*textarea*/ + +.cbi-input-textarea { + width: 100%; + min-height: 14rem; + padding: 0.8rem; + font-size: 0.8rem; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + color: black; +} + +#syslog { + width: 100%; + min-height: 15rem; + padding: 1rem; + font-size: small; + color: #5F5F5F; + + margin-bottom: 20px; + border-radius: 0; + background-color: #FFF; + box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .16), 0 0 2px 0 rgba(0, 0, 0, .12); + border: none; +} + +/* change */ + +.uci-change-list { + font-family: monospace; +} + +.uci-change-list ins, +.uci-change-legend-label ins { + text-decoration: none; + border: 1px solid #00FF00; + background-color: #CCFFCC; + display: block; + padding: 2px; +} + +.uci-change-list del, +.uci-change-legend-label del { + text-decoration: none; + border: 1px solid #FF0000; + background-color: #FFCCCC; + display: block; + font-style: normal; + padding: 2px; +} + +.uci-change-list var, +.uci-change-legend-label var { + text-decoration: none; + border: 1px solid #CCCCCC; + background-color: #EEEEEE; + display: block; + font-style: normal; + padding: 2px; +} + +.uci-change-list var ins, +.uci-change-list var del { + border: none; + white-space: pre; + font-style: normal; + padding: 0px; +} + +.uci-change-legend { + padding: 5px; +} + +.uci-change-legend-label { + width: 150px; + float: left; +} + +.uci-change-legend-label > ins, +.uci-change-legend-label > del, +.uci-change-legend-label > var { + float: left; + margin-right: 4px; + width: 10px; + height: 10px; + display: block; +} + +.uci-change-legend-label var ins, +.uci-change-legend-label var del { + line-height: 6px; + border: none; +} + +.uci-change-list var, +.uci-change-list del, +.uci-change-list ins { + padding: 0.5rem; +} + +/* other fix */ +#iwsvg, +#iwsvg2, +#bwsvg { + border: 1px solid #D4D4D4 !important; + border-top: none !important; +} + +.ifacebox { + border: 1px solid #999; + background-color: #f9f9f9; +} + +.cbi-image-button { + margin-left: 0.5rem; +} + +.zonebadge { + padding: 0.2rem 0.5rem; + display: inline-block; + cursor: pointer; +} + +.zonebadge > .ifacebadge { + padding: 0.2rem 1rem; + margin: 0.3rem; + border: 1px solid #6C6C6C; +} + +.zonebadge > input[type="text"] { + padding: 0.16rem 1rem; + min-width: 10rem; + margin-top: 0.3rem; +} + +.cbi-value-field .cbi-input-checkbox, +.cbi-value-field .cbi-input-radio { + margin-top: 0.5rem; + height: 1rem; +} + +.cbi-value-field > input + .cbi-value-description { + padding: 0; +} + +.cbi-value-field > ul > li { + display: flex; +} + +.cbi-value-field > ul > li > label { + margin-top: 0.5rem; +} + +.cbi-value-field > ul > li .ifacebadge { + background-color: #eee; + margin-left: 0.4rem; + margin-top: -0.5rem; +} + +.cbi-section-table-row > .cbi-value-field .cbi-input-select { + min-width: 7rem; +} + +.cbi-section-create > .cbi-button-add { + margin: 0.5rem; +} + +.cbi-section-remove { + padding: 0.5rem; +} + +div.cbi-value var, td.cbi-value-field var { + font-style: italic; + color: #0069D6; +} + +small { + font-size: 90%; + white-space: normal; + line-height: 1.42857143; +} + +.cbi-button-up, +.cbi-button-down { + display: inline-block; + min-width: 0; + padding: 0.2rem 0.3rem; + font-size: 1.2rem; +} + +.cbi-optionals { + padding: 1rem 1rem 0 1rem; + border-top: 1px solid #CCC; +} + +#diag-rc-output > pre { + background-color: #f5f5f5; + display: block; + padding: 8.5px; + margin: 0 0 18px; + line-height: 1.5rem; + -moz-border-radius: 3px; + white-space: pre-wrap; + word-wrap: break-word; + font-size: 1.4rem; + color: #404040; +} + +input[name="ping"], +input[name="traceroute"], +input[name="nslookup"] { + width: 80%; +} + +header > .container > .pull-right > * { + position: relative; + top: 0.45rem; + cursor: pointer; +} + +#xhr_poll_status > .label.success { + background-color: #14CE14; +} + +.label { + padding: 0.3rem 0.8rem; + font-size: 0.8rem; + font-weight: bold; + color: #ffffff !important; + text-transform: uppercase; + white-space: nowrap; + background-color: #bfbfbf; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + text-shadow: none; + text-decoration: none; +} + +.notice { + background-color: #11cdef; +} + +.showSide { + display: none; +} + +.darkMask { + width: 100%; + height: 100%; + position: fixed; + background-color: rgba(0, 0, 0, 0.56); + content: ""; + z-index: 99; + display: none; +} + +/* fix Main Login*/ + +.node-main-login > .main > .main-left { + display: none; +} + +.node-main-login > .main > .main-right { + width: 100%; + background-color: #172b4d!important; +} + +.node-main-login > .main > .main-right > #maincontent { + margin-top:5rem; + background-color: #172b4d!important; +} + +.node-main-login > .main fieldset { + padding: 0.5rem; + margin-bottom: 1rem; + display: inline; + background: none; + border: none; + box-shadow: none; + overflow: hidden; +} + +.node-main-login > .main .cbi-value-title { + width: 7rem; + font-size: 1rem; + line-height: 1.5; + color:#525f7f; + padding: .625rem; +} + +.node-main-login > .main #maincontent { + + text-align: center; +} + +.node-main-login > .main .container { + display: inline-block; + padding: 2rem 2rem; + margin-top: 2rem !important; + background-color: #f7fafc!important; + border-radius: .375rem; + box-shadow: 0 0 2rem 0 rgba(136,152,170,.15); + text-align: left; +} + +.node-main-login > .main .container h2{ + color:#5e72e4; + text-align:center; + letter-spacing:4px; +} +.node-main-login > .main .container .cbi-map-descr{ + text-align:center; +} +.node-main-login > .main .container .cbi-value-field input{ + font-size: 1rem; + line-height: 1.5; + display: block; + width: 100%; + height: calc(2.75rem + 2px); + padding: .625rem .75rem; + transition: all .15s cubic-bezier(.68,-.55,.265,1.55); + color: #8898aa; + border: 1px solid #dee2e6; + border-radius: .25rem; + background-color: #fff; + background-clip: padding-box; + box-shadow: 0 3px 2px rgba(233,236,239,.05); +} +.node-main-login > .main .container .cbi-value-field input:focus { + color: #8898aa; + border-color: #5e72e4; + outline: 0; + background-color: #fff; + box-shadow: 0 3px 9px rgba(50,50,9,0),3px 4px 8px rgba(94,114,228,.1) +} +.node-main-login > .main .container input.cbi-button{ + font-size: 1rem; + height:auto; + position: relative; + transition: all .15s ease; + letter-spacing: .2em; + text-transform: none; + padding: .625rem 1.25rem; + will-change: transform; +} + +.node-main-login > .main form > div:nth-last-child(1) { + text-align:center; +} + +.node-main-login > .main .cbi-value { + display: block; +} + +.node-main-login > .main .cbi-value > * { + display: inline-block !important; +} + +.node-main-login > .main .cbi-input-user, +.node-main-login > .main .cbi-input-password { + min-width: 15rem; +} + +.node-main-login footer { + bottom: 0; + position: absolute; + width: 100%; +} + +/* fix status overview */ + +.node-status-overview > .main fieldset:nth-child(4) td:nth-child(2) { + white-space: normal; +} + +/* fix status processes */ + +.node-status-processes > .main table tr td:nth-child(3) { + white-space: normal; +} + +.node-status-iptables > .main div > .cbi-map > form { + margin: 1rem 2rem 0 0; +} + +/* fix system reboot */ + +.node-system-reboot > .main > .main-right p, +.node-system-reboot > .main > .main-right h3 { + padding-left: 2rem; +} + +/* fix Services Network Shares*/ +.node-services-samba > .main .cbi-tabcontainer:nth-child(3) .cbi-value-title { + margin-bottom: 1rem; + width: auto; +} + +.node-services-samba > .main .cbi-tabcontainer:nth-child(3) .cbi-value-field { + display: list-item; +} + +.node-services-samba > .main .cbi-tabcontainer:nth-child(3) .cbi-value-description { + padding-top: 1rem; +} + +/* fix System Software*/ +.node-system-packages > .main table tr td:nth-child(1) { + width: auto !important; +} + +.node-system-packages > .main table tr td:nth-last-child(1) { + white-space: normal; + font-size: small; + color: #404040; +} + +.node-system-packages > .main .cbi-tabmenu > li > a, .tabs > li > a { + padding: 0.5rem 0.8rem; +} + +.node-system-packages > .main .cbi-value > pre { + background-color: #eee; + padding: 0.5rem; + overflow: auto; +} + +.cbi-tabmenu + .cbi-section { + margin-top: 0; +} + +/* fix network firewall*/ +.node-network-firewall > .main .cbi-section-table-row > .cbi-value-field .cbi-input-select { + min-width: 4rem; +} + +.node-status-iptables fieldset, +.node-system-packages fieldset, +.node-system-flashops fieldset { + margin-top: 0; +} + +.node-status-iptables .cbi-tabmenu, +.node-system-packages .cbi-tabmenu, +.node-system-flashops .cbi-tabmenu { + border: none; + box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .16), 0 0 2px 0 rgba(0, 0, 0, .12); +} + +.node-system-flashops form.inline + form.inline { + margin-left: 0; +} + +#cbi-firewall-redirect table *, +#cbi-network-switch_vlan table *, +#cbi-firewall-zone table * { + font-size: small; +} + +#cbi-firewall-redirect table input[type="text"], +#cbi-network-switch_vlan table input[type="text"], +#cbi-firewall-zone table input[type="text"] { + width: 5rem; +} + +#cbi-firewall-redirect table select, +#cbi-network-switch_vlan table select, +#cbi-firewall-zone table select { + min-width: 3.5rem; +} + +/* language fix */ +body.lang_pl.node-main-login .cbi-value-title { + width: 12rem; +} + +@media screen and (max-width: 1600px) { + .main-left { + width: calc(0% + 13rem); + } + + .main-right { + width: calc(100% - 13rem); + } + + .cbi-button { + padding: 0.3rem 1.5rem; + font-size: 0.8rem; + } + + header > .container > .pull-right > * { + top: 0.35rem; + } + + .label { + padding: 0.2rem 0.6rem; + } + + .cbi-value-title { + width: 15rem; + padding-right: 0.6rem; + } + + fieldset { + padding: 0; + } + + .cbi-input-textarea { + font-size: small; + } + + .node-status-iptables > .main fieldset li > a { + padding: 0.3rem 0.6rem; + } +} + +@media screen and (max-width: 1280px) { + header { + height: 3.5rem; + } + + header > .container { + margin-top: 0.25rem; + } + + .main { + top: 3.5rem; + height: calc(100% - 3.5rem); + } + + .main-left { + width: calc(0% + 13rem); + top: 3.5rem; + height: calc(100% - 3.5rem); + } + + .main-right { + width: calc(100% - 13rem); + } + + .cbi-tabmenu > li > a, .tabs > li > a { + padding: 0.2rem 0.5rem; + } + + .panel-title { + font-size: 1.1rem; + padding-bottom: 1rem; + } + + table { + font-size: 0.7rem !important; + width: 100% !important; + } + + .main > .main-left > .nav > li, + .main > .main-left > .nav > li a, + .main > .main-left > .nav > .slide > .menu { + font-size: 0.9rem; + } + + .main > .main-left > .nav > .slide > .slide-menu > li > a { + font-size: 0.7rem; + } +} + +@media screen and (max-width: 992px) { + .main-left { + width: 0; + position: fixed; + z-index: 100; + } + + .main-right { + width: 100%; + } + + .showSide { + padding: 0.1rem; + margin-right: 0.5rem; + display: inline-block; + } + + .showSide:before { + content: "\e20e"; + font-size: 1.7rem; + } + + .node-main-login .showSide { + display: none !important; + } + + .cbi-value-title { + width: 9rem; + padding-right: 1rem; + } + + .node-network-diagnostics > .main .cbi-map fieldset > div * { + width: 100% !important; + } + + .node-network-diagnostics > .main .cbi-map fieldset > div input[type="text"] { + margin: 3rem 0 0 0 !important; + } + + .node-network-diagnostics > .main .cbi-map fieldset > div:nth-child(4) input[type="text"] { + margin: 0 !important; + } + + .node-network-diagnostics > .main .cbi-map fieldset > div select, + .node-network-diagnostics > .main .cbi-map fieldset > div input[type="button"] { + margin: 1rem 0 0 0; + } + + .node-network-diagnostics > .main .cbi-map fieldset > div { + width: 100% !important; + } + + #diag-rc-output > pre { + font-size: 1rem; + } + + .node-main-login > .main .cbi-value-title { + text-align: left; + } +} + +@media screen and (max-width: 480px) { + body { + font-size: 1rem; + } + + fieldset { + padding: 0; + margin: 1rem 0 0 0; + } + + .tabs { + margin: 0 -1rem; + } + + #maincontent > .container { + margin: 0 1rem 1.5rem 1rem; + } + + .main > .main-left > .nav > .slide > .menu { + font-size: 1.3rem; + } + + .main > .main-left > .nav > .slide > .slide-menu > li > a { + font-size: 1.1rem; + } + + .cbi-value-title { + width: 100%; + min-width: 0rem !important; + display: block; + margin-top: 1rem; + margin-bottom: 0.5rem; + padding-bottom:0; + padding-top:0; + text-align: left; + } + + .cbi-value-field, .cbi-value-description { + width: 100%; + } + .cbi-value-field .cbi-input-select { + width: 100%; + } + + .cbi-value > .cbi-value-field { + display: inline-block; + } + + .cbi-tabmenu > li, .tabs > li { + padding: 0.6rem 0rem; + } + + .cbi-tabmenu > li > a, .tabs > li > a { + padding: 0.2rem 0.3rem; + font-size: 0.9rem; + } + + .cbi-page-actions > div > input { + display: none; + } + + .node-main-login > .main .container { + padding: 0.5rem 1rem 2rem 1rem; + } + + .node-main-login > .main .cbi-value { + padding: 0; + } + + .node-main-login > .main form > div:nth-last-child(1) { + margin-top: 2rem; + } + + .node-main-login > .main .cbi-value-title { + width: 100% !important; + font-size: 1.2rem; + } + + .node-main-login > .main fieldset { + margin: 0; + padding: 0.5rem; + } + + h2 { + font-size: 1.5rem; + } + + .tabs > li > a { + font-size: 0.9rem; + } + + select, + input { + font-size: 0.9rem; + } + + .mobile-hide { + display: none; + } + + .panel-title { + font-size: 1.4rem; + padding-bottom: 1rem; + } + + .node-system-packages > .main .cbi-value.cbi-value-last > div { + width: 100% !important; + } + + .node-system-packages > .main .cbi-value .cbi-value-field input { + width: 100%; + } + + .node-status-iptables > .main div > .cbi-map > form { + position: static !important; + margin: 0 0 2rem 0; + padding: 2rem; + border: 0; + font-weight: normal; + font-style: normal; + line-height: 1; + font-family: inherit; + min-width: inherit; + overflow-x: auto; + overflow-y: hidden; + border-radius: 0; + background-color: #FFF; + box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .16), 0 0 2px 0 rgba(0, 0, 0, .12); + -webkit-overflow-scrolling: touch; + } + + .node-status-iptables > .main div > .cbi-map > form input[type="submit"] { + width: 100% !important; + margin: 0; + } + + .node-status-iptables > .main div > .cbi-map > form input[type="submit"] + input[type="submit"] { + margin-top: 1rem; + } +} + +@media screen and (min-width: 992px) { + .cbi-value input[type="password"], + .cbi-value input[type="text"] { + min-width: 20rem; + } + + .cbi-value-field .cbi-input-select { + min-width: 20rem; + } +} + +@media screen and (min-width: 1280px) { + .cbi-value input[type="password"], + .cbi-value input[type="text"] { + min-width: 22rem; + } + + .cbi-value-field .cbi-input-select { + min-width: 22rem; + } +} + +@media screen and (min-width: 1600px) { + .cbi-value input[type="password"], + .cbi-value input[type="text"] { + min-width: 25rem; + } + + .cbi-value-field .cbi-input-select { + min-width: 25rem; + } +} diff --git a/package/lean/luci-theme-argon/htdocs/luci-static/argon/favicon.ico b/package/lean/luci-theme-argon/htdocs/luci-static/argon/favicon.ico new file mode 100644 index 00000000000000..b407d18455773a Binary files /dev/null and b/package/lean/luci-theme-argon/htdocs/luci-static/argon/favicon.ico differ diff --git a/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/font.eot b/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/font.eot new file mode 100644 index 00000000000000..9e6ffc9b826cb3 Binary files /dev/null and b/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/font.eot differ diff --git a/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/font.svg b/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/font.svg new file mode 100644 index 00000000000000..d38d057da3a03d --- /dev/null +++ b/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/font.svg @@ -0,0 +1,16 @@ + + + +Generated by IcoMoon + + + + + + + + + + + + \ No newline at end of file diff --git a/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/font.ttf b/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/font.ttf new file mode 100644 index 00000000000000..84669323e9ddfd Binary files /dev/null and b/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/font.ttf differ diff --git a/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/font.woff b/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/font.woff new file mode 100644 index 00000000000000..00cf84ea037c97 Binary files /dev/null and b/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/font.woff differ diff --git a/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/ssr.eot b/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/ssr.eot new file mode 100644 index 00000000000000..ad617b652beabc Binary files /dev/null and b/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/ssr.eot differ diff --git a/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/ssr.svg b/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/ssr.svg new file mode 100644 index 00000000000000..a9045e4ca6d04b --- /dev/null +++ b/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/ssr.svg @@ -0,0 +1,25 @@ + + + +Generated by IcoMoon + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/ssr.ttf b/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/ssr.ttf new file mode 100644 index 00000000000000..f47f04d0aa4fb9 Binary files /dev/null and b/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/ssr.ttf differ diff --git a/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/ssr.woff b/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/ssr.woff new file mode 100644 index 00000000000000..36a8b4ab075efb Binary files /dev/null and b/package/lean/luci-theme-argon/htdocs/luci-static/argon/fonts/ssr.woff differ diff --git a/package/lean/luci-theme-argon/htdocs/luci-static/argon/js/jquery.min.js b/package/lean/luci-theme-argon/htdocs/luci-static/argon/js/jquery.min.js new file mode 100644 index 00000000000000..f3644431eea2f0 --- /dev/null +++ b/package/lean/luci-theme-argon/htdocs/luci-static/argon/js/jquery.min.js @@ -0,0 +1,6 @@ +/*! jQuery v1.11.3 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */ +!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.3",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b="length"in a&&a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1; + +return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthh;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML="
a",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function aa(){return!0}function ba(){return!1}function ca(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h]","i"),ha=/^\s+/,ia=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ja=/<([\w:]+)/,ka=/\s*$/g,ra={option:[1,""],legend:[1,"
","
"],area:[1,"",""],param:[1,"",""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:k.htmlSerialize?[0,"",""]:[1,"X
","
"]},sa=da(y),ta=sa.appendChild(y.createElement("div"));ra.optgroup=ra.option,ra.tbody=ra.tfoot=ra.colgroup=ra.caption=ra.thead,ra.th=ra.td;function ua(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ua(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function va(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wa(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xa(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function ya(a){var b=pa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function za(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Aa(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Ba(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xa(b).text=a.text,ya(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!ga.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ta.innerHTML=a.outerHTML,ta.removeChild(f=ta.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ua(f),h=ua(a),g=0;null!=(e=h[g]);++g)d[g]&&Ba(e,d[g]);if(b)if(c)for(h=h||ua(a),d=d||ua(f),g=0;null!=(e=h[g]);g++)Aa(e,d[g]);else Aa(a,f);return d=ua(f,"script"),d.length>0&&za(d,!i&&ua(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=da(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(la.test(f)){h=h||o.appendChild(b.createElement("div")),i=(ja.exec(f)||["",""])[1].toLowerCase(),l=ra[i]||ra._default,h.innerHTML=l[1]+f.replace(ia,"<$1>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&ha.test(f)&&p.push(b.createTextNode(ha.exec(f)[0])),!k.tbody){f="table"!==i||ka.test(f)?""!==l[1]||ka.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ua(p,"input"),va),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ua(o.appendChild(f),"script"),g&&za(h),c)){e=0;while(f=h[e++])oa.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ua(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&za(ua(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ua(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fa,""):void 0;if(!("string"!=typeof a||ma.test(a)||!k.htmlSerialize&&ga.test(a)||!k.leadingWhitespace&&ha.test(a)||ra[(ja.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ia,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ua(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ua(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&na.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ua(i,"script"),xa),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ua(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,ya),j=0;f>j;j++)d=g[j],oa.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qa,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Ca,Da={};function Ea(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fa(a){var b=y,c=Da[a];return c||(c=Ea(a,b),"none"!==c&&c||(Ca=(Ca||m("