mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-03-09 15:40:20 +00:00
Merge branch 'develop'
This commit is contained in:
commit
20c4996564
15 changed files with 309 additions and 126 deletions
2
build.sh
2
build.sh
|
@ -42,7 +42,7 @@ OMR_KERNEL=${OMR_KERNEL:-5.4}
|
||||||
OMR_RELEASE=${OMR_RELEASE:-$(git describe --tags `git rev-list --tags --max-count=1` | tail -1 | cut -d '-' -f1)}
|
OMR_RELEASE=${OMR_RELEASE:-$(git describe --tags `git rev-list --tags --max-count=1` | tail -1 | cut -d '-' -f1)}
|
||||||
OMR_REPO=${OMR_REPO:-http://$OMR_HOST:$OMR_PORT/release/$OMR_RELEASE/$OMR_TARGET}
|
OMR_REPO=${OMR_REPO:-http://$OMR_HOST:$OMR_PORT/release/$OMR_RELEASE/$OMR_TARGET}
|
||||||
|
|
||||||
OMR_FEED_URL="${OMR_FEED_URL:-https://github.com/ysurac/openmptcprouter-feeds}"
|
OMR_FEED_URL="${OMR_FEED_URL:-https://github.com/suyuan168/openmptcprouter-feeds}"
|
||||||
OMR_FEED_SRC="${OMR_FEED_SRC:-develop}"
|
OMR_FEED_SRC="${OMR_FEED_SRC:-develop}"
|
||||||
|
|
||||||
CUSTOM_FEED_URL="${CUSTOM_FEED_URL}"
|
CUSTOM_FEED_URL="${CUSTOM_FEED_URL}"
|
||||||
|
|
4
config
4
config
|
@ -216,6 +216,8 @@ CONFIG_OPENSSL_WITH_CHACHA_POLY1305=y
|
||||||
# CONFIG_LUCI_CSSTIDY is not set
|
# CONFIG_LUCI_CSSTIDY is not set
|
||||||
# CONFIG_LIBCURL_WOLFSSL is not set
|
# CONFIG_LIBCURL_WOLFSSL is not set
|
||||||
# CONFIG_PACKAGE_libustream-wolfssl is not set
|
# CONFIG_PACKAGE_libustream-wolfssl is not set
|
||||||
|
CONFIG_KERNEL_DEVMEM=y
|
||||||
|
CONFIG_KERNEL_DEVKMEM=y
|
||||||
# CONFIG_PACKAGE_luci-theme-argon=y
|
# CONFIG_PACKAGE_luci-theme-argon=y
|
||||||
CONFIG_PACKAGE_luci-theme-bootstrap=y
|
CONFIG_PACKAGE_luci-theme-bootstrap=y
|
||||||
CONFIG_PACKAGE_luci-theme-openwrt-2020=y
|
CONFIG_PACKAGE_luci-theme-openwrt-2020=y
|
||||||
|
@ -227,6 +229,4 @@ CONFIG_PACKAGE_rtty-nossl=y
|
||||||
CONFIG_PACKAGE_minicom=y
|
CONFIG_PACKAGE_minicom=y
|
||||||
CONFIG_PACKAGE_irqbalance=y
|
CONFIG_PACKAGE_irqbalance=y
|
||||||
CONFIG_PACKAGE_mtr=y
|
CONFIG_PACKAGE_mtr=y
|
||||||
CONFIG_KERNEL_DEVMEM=y
|
|
||||||
CONFIG_KERNEL_DEVKMEM=y
|
|
||||||
CONFIG_AUTOREMOVE=y
|
CONFIG_AUTOREMOVE=y
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
CONFIG_TARGET_mediatek=y
|
|
||||||
CONFIG_TARGET_mediatek_mt7623=y
|
|
||||||
CONFIG_TARGET_mediatek_mt7623_DEVICE_bpi_bananapi-r2=y
|
|
||||||
CONFIG_TARGET_ROOTFS_EXT4FS=y
|
|
||||||
CONFIG_TARGET_ROOTFS_SQUASHFS=y
|
|
||||||
CONFIG_PACKAGE_kmod-cryptodev=y
|
|
||||||
CONFIG_OPENSSL_HARDWARE_SUPPORT=y
|
|
||||||
CONFIG_OPENSSL_ENGINE_CRYPTO=y
|
|
||||||
CONFIG_OPENSSL_ENGINE_DIGEST=y
|
|
||||||
CONFIG_PACKAGE_uboot-envtools=y
|
|
||||||
CONFIG_PACKAGE_attr=y
|
|
||||||
CONFIG_PACKAGE_f2fs-tools=y
|
|
||||||
CONFIG_PACKAGE_f2fsck=y
|
|
||||||
CONFIG_PACKAGE_mkf2fs=y
|
|
||||||
# CONFIG_PACKAGE_kmod-fs-nfs-v3 is not set
|
|
||||||
# CONFIG_PACKAGE_kmod-fs-nfs-v4 is not set
|
|
||||||
# CONFIG_PACKAGE_kmod-rtl8812au-ct is not set
|
|
||||||
# CONFIG_PACKAGE_kmod-mt6625l-bt is not set
|
|
||||||
# CONFIG_PACKAGE_kmod-mt6625l-wlan-gen-2 is not set
|
|
||||||
CONFIG_KERNEL_ARM_MODULE_PLTS=y
|
|
|
@ -4,3 +4,4 @@ CONFIG_TARGET_ipq40xx_generic_DEVICE_mobipromo_cm520-79f=y
|
||||||
CONFIG_PACKAGE_kmod-6lowpan=y
|
CONFIG_PACKAGE_kmod-6lowpan=y
|
||||||
# CONFIG_KERNEL_CC_OPTIMIZE_FOR_PERFORMANCE is not set
|
# CONFIG_KERNEL_CC_OPTIMIZE_FOR_PERFORMANCE is not set
|
||||||
CONFIG_KERNEL_CC_OPTIMIZE_FOR_SIZE=y
|
CONFIG_KERNEL_CC_OPTIMIZE_FOR_SIZE=y
|
||||||
|
CONFIG_KERNEL_ARM_MODULE_PLTS=y
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
CONFIG_TARGET_mvebu=y
|
|
||||||
CONFIG_TARGET_mvebu_cortexa53=y
|
|
||||||
CONFIG_TARGET_mvebu_cortexa53_DEVICE_globalscale_espressobin-v7=y
|
|
||||||
CONFIG_PACKAGE_kmod-6lowpan=y
|
|
||||||
CONFIG_PACKAGE_luci-app-advanced-reboot=y
|
|
||||||
# CONFIG_KERNEL_CC_OPTIMIZE_FOR_PERFORMANCE is not set
|
|
||||||
CONFIG_KERNEL_CC_OPTIMIZE_FOR_SIZE=y
|
|
||||||
CONFIG_KERNEL_ARM_MODULE_PLTS=y
|
|
70
config-nanopi_neo
Normal file
70
config-nanopi_neo
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
CONFIG_MODULES=y
|
||||||
|
CONFIG_HAVE_DOT_CONFIG=y
|
||||||
|
CONFIG_TARGET_sunxi=y
|
||||||
|
CONFIG_TARGET_sunxi_cortexa7=y
|
||||||
|
CONFIG_TARGET_sunxi_cortexa7_DEVICE_friendlyarm_nanopi-neo=y
|
||||||
|
CONFIG_PACKAGE_kmod-6lowpan=y
|
||||||
|
CONFIG_HAS_SUBTARGETS=y
|
||||||
|
CONFIG_HAS_DEVICES=y
|
||||||
|
CONFIG_TARGET_BOARD="sunxi"
|
||||||
|
CONFIG_TARGET_SUBTARGET="cortexa7"
|
||||||
|
CONFIG_TARGET_PROFILE="DEVICE_friendlyarm_nanopi-neo"
|
||||||
|
CONFIG_TARGET_ARCH_PACKAGES="arm_cortex-a7_neon-vfpv4"
|
||||||
|
CONFIG_DEFAULT_TARGET_OPTIMIZATION="-Os -pipe"
|
||||||
|
CONFIG_CPU_TYPE="cortex-a7+neon-vfpv4"
|
||||||
|
CONFIG_LINUX_5_4=y
|
||||||
|
CONFIG_DEFAULT_base-files=y
|
||||||
|
CONFIG_DEFAULT_busybox=y
|
||||||
|
CONFIG_DEFAULT_ca-bundle=y
|
||||||
|
CONFIG_DEFAULT_dnsmasq=y
|
||||||
|
CONFIG_DEFAULT_dropbear=y
|
||||||
|
CONFIG_DEFAULT_e2fsprogs=y
|
||||||
|
CONFIG_DEFAULT_firewall=y
|
||||||
|
CONFIG_DEFAULT_fstools=y
|
||||||
|
CONFIG_DEFAULT_ip6tables=y
|
||||||
|
CONFIG_DEFAULT_iptables=y
|
||||||
|
CONFIG_DEFAULT_kmod-ipt-offload=y
|
||||||
|
CONFIG_DEFAULT_libc=y
|
||||||
|
CONFIG_DEFAULT_libgcc=y
|
||||||
|
CONFIG_DEFAULT_libustream-wolfssl=y
|
||||||
|
CONFIG_DEFAULT_logd=y
|
||||||
|
CONFIG_DEFAULT_mkf2fs=y
|
||||||
|
CONFIG_DEFAULT_mtd=y
|
||||||
|
CONFIG_DEFAULT_netifd=y
|
||||||
|
CONFIG_DEFAULT_odhcp6c=y
|
||||||
|
CONFIG_DEFAULT_odhcpd-ipv6only=y
|
||||||
|
CONFIG_DEFAULT_opkg=y
|
||||||
|
CONFIG_DEFAULT_partx-utils=y
|
||||||
|
CONFIG_DEFAULT_ppp=y
|
||||||
|
CONFIG_DEFAULT_ppp-mod-pppoe=y
|
||||||
|
CONFIG_DEFAULT_uboot-envtools=y
|
||||||
|
CONFIG_DEFAULT_uci=y
|
||||||
|
CONFIG_DEFAULT_uclient-fetch=y
|
||||||
|
CONFIG_DEFAULT_urandom-seed=y
|
||||||
|
CONFIG_DEFAULT_urngd=y
|
||||||
|
CONFIG_HAS_FPU=y
|
||||||
|
CONFIG_AUDIO_SUPPORT=y
|
||||||
|
CONFIG_GPIO_SUPPORT=y
|
||||||
|
CONFIG_USB_SUPPORT=y
|
||||||
|
CONFIG_RTC_SUPPORT=y
|
||||||
|
CONFIG_USES_DEVICETREE=y
|
||||||
|
CONFIG_USES_SQUASHFS=y
|
||||||
|
CONFIG_USES_EXT4=y
|
||||||
|
CONFIG_arm=y
|
||||||
|
CONFIG_arm_v7=y
|
||||||
|
CONFIG_ARCH="arm"
|
||||||
|
CONFIG_KERNEL_ARM_MODULE_PLTS=y
|
||||||
|
# CONFIG_PACKAGE_libustream-wolfssl is not set
|
||||||
|
CONFIG_KERNEL_DEVMEM=y
|
||||||
|
CONFIG_KERNEL_DEVKMEM=y
|
||||||
|
# CONFIG_PACKAGE_luci-theme-argon=y
|
||||||
|
CONFIG_PACKAGE_luci-theme-bootstrap=y
|
||||||
|
CONFIG_PACKAGE_luci-theme-openwrt-2020=y
|
||||||
|
# CONFIG_PACKAGE_luci-theme-argon is not set
|
||||||
|
CONFIG_PACKAGE_luci-app-status=m
|
||||||
|
CONFIG_PACKAGE_luci-mod-status=y
|
||||||
|
CONFIG_PACKAGE_frpc=y
|
||||||
|
CONFIG_PACKAGE_rtty-nossl=y
|
||||||
|
CONFIG_PACKAGE_minicom=y
|
||||||
|
CONFIG_PACKAGE_irqbalance=y
|
||||||
|
CONFIG_PACKAGE_mtr=y
|
|
@ -1,6 +0,0 @@
|
||||||
CONFIG_TARGET_bcm27xx=y
|
|
||||||
CONFIG_TARGET_bcm27xx_bcm2710=y
|
|
||||||
CONFIG_TARGET_bcm27xx_bcm2710_DEVICE_rpi-3=y
|
|
||||||
CONFIG_PACKAGE_kmod-ath10k-ct=n
|
|
||||||
CONFIG_PACKAGE_kmod-ath9k=y
|
|
||||||
CONFIG_KERNEL_ARM_MODULE_PLTS=y
|
|
|
@ -1,8 +0,0 @@
|
||||||
CONFIG_TARGET_mvebu=y
|
|
||||||
CONFIG_TARGET_mvebu_cortexa9=y
|
|
||||||
CONFIG_TARGET_mvebu_cortexa9_DEVICE_linksys_wrt3200acm=y
|
|
||||||
CONFIG_PACKAGE_kmod-6lowpan=y
|
|
||||||
CONFIG_PACKAGE_luci-app-advanced-reboot=y
|
|
||||||
# CONFIG_KERNEL_CC_OPTIMIZE_FOR_PERFORMANCE is not set
|
|
||||||
CONFIG_KERNEL_CC_OPTIMIZE_FOR_SIZE=y
|
|
||||||
CONFIG_KERNEL_ARM_MODULE_PLTS=y
|
|
|
@ -1,8 +0,0 @@
|
||||||
CONFIG_TARGET_mvebu=y
|
|
||||||
CONFIG_TARGET_mvebu_cortexa9=y
|
|
||||||
CONFIG_TARGET_mvebu_cortexa9_DEVICE_linksys_wrt32x=y
|
|
||||||
CONFIG_PACKAGE_kmod-6lowpan=y
|
|
||||||
CONFIG_PACKAGE_luci-app-advanced-reboot=y
|
|
||||||
# CONFIG_KERNEL_CC_OPTIMIZE_FOR_PERFORMANCE is not set
|
|
||||||
CONFIG_KERNEL_CC_OPTIMIZE_FOR_SIZE=y
|
|
||||||
CONFIG_KERNEL_ARM_MODULE_PLTS=y
|
|
|
@ -1,7 +0,0 @@
|
||||||
CONFIG_TARGET_x86=y
|
|
||||||
CONFIG_TARGET_x86_generic=y
|
|
||||||
CONFIG_TARGET_x86_generic_Generic=y
|
|
||||||
CONFIG_TARGET_EXT4_JOURNAL=y
|
|
||||||
# CONFIG_TARGET_ROOTFS_TARGZ is not set
|
|
||||||
CONFIG_PACKAGE_open-vm-tools=m
|
|
||||||
CONFIG_PACKAGE_kmod-ath9k=y
|
|
|
@ -15,21 +15,17 @@ generate_static_network() {
|
||||||
set network.loopback.proto='static'
|
set network.loopback.proto='static'
|
||||||
set network.loopback.ipaddr='127.0.0.1'
|
set network.loopback.ipaddr='127.0.0.1'
|
||||||
set network.loopback.netmask='255.0.0.0'
|
set network.loopback.netmask='255.0.0.0'
|
||||||
|
delete network.globals
|
||||||
|
set network.globals='globals'
|
||||||
|
set network.globals.ula_prefix='auto'
|
||||||
EOF
|
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
|
if json_is_a dsl object; then
|
||||||
json_select dsl
|
json_select dsl
|
||||||
if json_is_a atmbridge object; then
|
if json_is_a atmbridge object; then
|
||||||
json_select atmbridge
|
json_select atmbridge
|
||||||
local vpi vci encaps payload nameprefix
|
local vpi vci encaps payload
|
||||||
json_get_vars vpi vci encaps payload nameprefix
|
json_get_vars vpi vci encaps payload
|
||||||
uci -q batch <<-EOF
|
uci -q batch <<-EOF
|
||||||
delete network.atm
|
delete network.atm
|
||||||
set network.atm='atm-bridge'
|
set network.atm='atm-bridge'
|
||||||
|
@ -37,7 +33,6 @@ generate_static_network() {
|
||||||
set network.atm.vci='$vci'
|
set network.atm.vci='$vci'
|
||||||
set network.atm.encaps='$encaps'
|
set network.atm.encaps='$encaps'
|
||||||
set network.atm.payload='$payload'
|
set network.atm.payload='$payload'
|
||||||
set network.atm.nameprefix='$nameprefix'
|
|
||||||
EOF
|
EOF
|
||||||
json_select ..
|
json_select ..
|
||||||
fi
|
fi
|
||||||
|
@ -72,11 +67,26 @@ generate_network() {
|
||||||
|
|
||||||
[ -n "$ifname" ] || return
|
[ -n "$ifname" ] || return
|
||||||
|
|
||||||
# force bridge for multi-interface devices (and lan)
|
case "$1" in
|
||||||
case "$1:$ifname" in
|
# hack (see /etc/board.d/02_network)
|
||||||
*\ * | lan:*) type="bridge" ;;
|
none) return ;;
|
||||||
|
lan*) proto=${proto:-static} ;;
|
||||||
|
wan*) proto=${proto:-dhcp} ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if [ -n "$macaddr" ]; then
|
||||||
|
type=macvlan # useless, only for legacy
|
||||||
|
uci -q batch <<-EOF
|
||||||
|
delete network.${1}_dev
|
||||||
|
set network.${1}_dev='device'
|
||||||
|
set network.${1}_dev.name='$1'
|
||||||
|
set network.${1}_dev.type='$type'
|
||||||
|
set network.${1}_dev.ifname='$ifname'
|
||||||
|
set network.${1}_dev.macaddr='$macaddr'
|
||||||
|
EOF
|
||||||
|
ifname=$1
|
||||||
|
fi
|
||||||
|
|
||||||
uci -q batch <<-EOF
|
uci -q batch <<-EOF
|
||||||
delete network.$1
|
delete network.$1
|
||||||
set network.$1='interface'
|
set network.$1='interface'
|
||||||
|
@ -85,22 +95,11 @@ generate_network() {
|
||||||
set network.$1.proto='none'
|
set network.$1.proto='none'
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
if [ -n "$macaddr" ]; then
|
|
||||||
for name in $ifname; do
|
|
||||||
uci -q batch <<-EOF
|
|
||||||
delete network.$1_${name/./_}_dev
|
|
||||||
set network.$1_${name/./_}_dev='device'
|
|
||||||
set network.$1_${name/./_}_dev.name='$name'
|
|
||||||
set network.$1_${name/./_}_dev.macaddr='$macaddr'
|
|
||||||
EOF
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$protocol" in
|
case "$protocol" in
|
||||||
static)
|
static)
|
||||||
local ipad
|
local ipad
|
||||||
case "$1" in
|
case "$1" in
|
||||||
lan) ipad=${ipaddr:-"192.168.1.1"} ;;
|
lan) ipad=${ipaddr:-"192.168.100.1"} ;;
|
||||||
*) ipad=${ipaddr:-"192.168.$((addr_offset++)).1"} ;;
|
*) ipad=${ipaddr:-"192.168.$((addr_offset++)).1"} ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -110,23 +109,17 @@ generate_network() {
|
||||||
set network.$1.proto='static'
|
set network.$1.proto='static'
|
||||||
set network.$1.ipaddr='$ipad'
|
set network.$1.ipaddr='$ipad'
|
||||||
set network.$1.netmask='$netm'
|
set network.$1.netmask='$netm'
|
||||||
|
set network.$1.ip6assign='60'
|
||||||
EOF
|
EOF
|
||||||
[ -e /proc/sys/net/ipv6 ] && uci set network.$1.ip6assign='60'
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
dhcp)
|
dhcp)
|
||||||
# fixup IPv6 slave interface if parent is a bridge
|
# fixup IPv6 slave interface if parent is a bridge
|
||||||
[ "$type" = "bridge" ] && ifname="br-$1"
|
[ "$type" = "bridge" ] && ifname="br-$1"
|
||||||
|
|
||||||
uci set network.$1.proto='dhcp'
|
uci -q batch <<-EOF
|
||||||
[ -e /proc/sys/net/ipv6 ] && {
|
set network.$1.proto='dhcp'
|
||||||
uci -q batch <<-EOF
|
EOF
|
||||||
delete network.${1}6
|
|
||||||
set network.${1}6='interface'
|
|
||||||
set network.${1}6.ifname='$ifname'
|
|
||||||
set network.${1}6.proto='dhcpv6'
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
pppoe)
|
pppoe)
|
||||||
|
@ -134,16 +127,12 @@ generate_network() {
|
||||||
set network.$1.proto='pppoe'
|
set network.$1.proto='pppoe'
|
||||||
set network.$1.username='username'
|
set network.$1.username='username'
|
||||||
set network.$1.password='password'
|
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
|
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
|
esac
|
||||||
}
|
}
|
||||||
|
@ -217,8 +206,7 @@ generate_switch() {
|
||||||
|
|
||||||
json_select switch
|
json_select switch
|
||||||
json_select "$key"
|
json_select "$key"
|
||||||
json_get_vars enable reset blinkrate cpu_port \
|
json_get_vars enable reset blinkrate cpu_port
|
||||||
ar8xxx_mib_type ar8xxx_mib_poll_interval
|
|
||||||
|
|
||||||
uci -q batch <<-EOF
|
uci -q batch <<-EOF
|
||||||
add network switch
|
add network switch
|
||||||
|
@ -226,8 +214,6 @@ generate_switch() {
|
||||||
set network.@switch[-1].reset='$reset'
|
set network.@switch[-1].reset='$reset'
|
||||||
set network.@switch[-1].enable_vlan='$enable'
|
set network.@switch[-1].enable_vlan='$enable'
|
||||||
set network.@switch[-1].blinkrate='$blinkrate'
|
set network.@switch[-1].blinkrate='$blinkrate'
|
||||||
set network.@switch[-1].ar8xxx_mib_type='$ar8xxx_mib_type'
|
|
||||||
set network.@switch[-1].ar8xxx_mib_poll_interval='$ar8xxx_mib_poll_interval'
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
generate_switch_vlans_ports "$1"
|
generate_switch_vlans_ports "$1"
|
||||||
|
@ -241,7 +227,7 @@ generate_static_system() {
|
||||||
uci -q batch <<-EOF
|
uci -q batch <<-EOF
|
||||||
delete system.@system[0]
|
delete system.@system[0]
|
||||||
add system system
|
add system system
|
||||||
set system.@system[-1].hostname='antrouter
|
set system.@system[-1].hostname='antrouter'
|
||||||
set system.@system[-1].timezone='UTC'
|
set system.@system[-1].timezone='UTC'
|
||||||
set system.@system[-1].ttylogin='0'
|
set system.@system[-1].ttylogin='0'
|
||||||
set system.@system[-1].log_size='64'
|
set system.@system[-1].log_size='64'
|
||||||
|
@ -373,12 +359,11 @@ generate_led() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
switch)
|
switch)
|
||||||
local port_mask speed_mask mode
|
local port_mask speed_mask
|
||||||
json_get_vars port_mask speed_mask mode
|
json_get_vars port_mask speed_mask
|
||||||
uci -q batch <<-EOF
|
uci -q batch <<-EOF
|
||||||
set system.$cfg.port_mask='$port_mask'
|
set system.$cfg.port_mask='$port_mask'
|
||||||
set system.$cfg.speed_mask='$speed_mask'
|
set system.$cfg.speed_mask='$speed_mask'
|
||||||
set system.$cfg.mode='$mode'
|
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -426,8 +411,6 @@ generate_gpioswitch() {
|
||||||
json_init
|
json_init
|
||||||
json_load "$(cat ${CFG})"
|
json_load "$(cat ${CFG})"
|
||||||
|
|
||||||
umask 077
|
|
||||||
|
|
||||||
if [ ! -s /etc/config/network ]; then
|
if [ ! -s /etc/config/network ]; then
|
||||||
touch /etc/config/network
|
touch /etc/config/network
|
||||||
generate_static_network
|
generate_static_network
|
||||||
|
|
|
@ -34,5 +34,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
(%C)
|
55860.com QQ 175338181 weixin:xinyangla
|
||||||
|
(%C)
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
|
|
@ -10,7 +10,6 @@ board_config_update
|
||||||
json_is_a network object && exit 0
|
json_is_a network object && exit 0
|
||||||
|
|
||||||
ucidef_set_interface_lan 'eth0'
|
ucidef_set_interface_lan 'eth0'
|
||||||
[ -d /sys/class/net/eth1 ] && ucidef_set_interface_wan 'eth1'
|
|
||||||
|
|
||||||
board_config_flush
|
board_config_flush
|
||||||
|
|
||||||
|
|
206
root/target/linux/ipq40xx/base-files/etc/init.d/adjust_network
Normal file → Executable file
206
root/target/linux/ipq40xx/base-files/etc/init.d/adjust_network
Normal file → Executable file
|
@ -1,19 +1,205 @@
|
||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
# Copyright (C) 2006-2011 OpenWrt.org
|
# Copyright (C) 2006-2011 OpenWrt.org
|
||||||
|
|
||||||
START=11
|
START=99
|
||||||
STOP=98
|
STOP=98
|
||||||
|
|
||||||
adjust_smp_affinity() {
|
rps_flow_cnt=4096
|
||||||
test -f /lib/adjust_network.sh && {
|
core_count=$(grep -c processor /proc/cpuinfo)
|
||||||
. /lib/adjust_network.sh
|
rps_sock_flow_ent=`expr $core_count \* $rps_flow_cnt`
|
||||||
|
queue_cores="0 1 2"
|
||||||
|
queue_irq_cores="1 2"
|
||||||
|
wifi_core="3"
|
||||||
|
usb_core="0"
|
||||||
|
|
||||||
adjust_eth_queue
|
############### util functions ###############
|
||||||
adjust_edma_smp_affinity
|
|
||||||
adjust_radio_smp_affinity
|
to_hex_list() {
|
||||||
}
|
local cores=$1
|
||||||
|
local converted=""
|
||||||
|
for core in $(echo $cores | awk '{print}')
|
||||||
|
do
|
||||||
|
local hex="$(gen_hex_mask "$core")"
|
||||||
|
converted="$converted $hex"
|
||||||
|
done
|
||||||
|
echo `echo $converted | sed 's/^ *//'`
|
||||||
}
|
}
|
||||||
|
|
||||||
boot() {
|
gen_hex_mask() {
|
||||||
adjust_smp_affinity
|
local cores=$1
|
||||||
|
local mask=0
|
||||||
|
for core in $(echo $cores | awk '{print}')
|
||||||
|
do
|
||||||
|
local bit="$((1 << $core))"
|
||||||
|
let "mask = mask + bit"
|
||||||
|
done
|
||||||
|
local hex="$(printf %x "$mask")"
|
||||||
|
echo "$hex"
|
||||||
|
}
|
||||||
|
|
||||||
|
val_at_index() {
|
||||||
|
local values=$1
|
||||||
|
local idx=$2
|
||||||
|
echo `echo $values | awk -v i=$idx '{print $i}'`
|
||||||
|
}
|
||||||
|
|
||||||
|
size_of_list() {
|
||||||
|
local list=$1
|
||||||
|
local spaces=`echo $list | grep -o ' ' | wc -l`
|
||||||
|
echo `expr $spaces + 1`
|
||||||
|
}
|
||||||
|
|
||||||
|
set_core_mask() {
|
||||||
|
local file=$1
|
||||||
|
local cores=$2
|
||||||
|
local mask="$(gen_hex_mask "$cores")"
|
||||||
|
echo $mask > $file
|
||||||
|
}
|
||||||
|
|
||||||
|
set_core_mask_round() {
|
||||||
|
local files=$1
|
||||||
|
local cores=$2
|
||||||
|
local step_size=$3
|
||||||
|
[ ! -n "$3" ] && step_size=1
|
||||||
|
|
||||||
|
local core_count="$(size_of_list "$cores")"
|
||||||
|
local counter=0
|
||||||
|
local idx=1
|
||||||
|
local roof=`expr $core_count \* $step_size`
|
||||||
|
for file in $(echo $files | awk '{print}')
|
||||||
|
do
|
||||||
|
let "idx = counter / step_size + 1"
|
||||||
|
local core="$(val_at_index "$cores" $idx)"
|
||||||
|
set_core_mask $file $core
|
||||||
|
let "counter = counter + 1"
|
||||||
|
[ $counter -ge $roof ] && counter=0
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
############### assign network queues ###############
|
||||||
|
|
||||||
|
set_interface_round() {
|
||||||
|
local interface=$1
|
||||||
|
local cores=$2
|
||||||
|
local step_size=$3
|
||||||
|
[ ! -n "$3" ] && step_size=1
|
||||||
|
|
||||||
|
echo "using round mask for interface: $interface, step size: $step_size"
|
||||||
|
set_core_mask_round "$(ls /sys/class/net/$interface/queues/tx-*/xps_cpus)" "$cores" $step_size
|
||||||
|
set_core_mask_round "$(ls /sys/class/net/$interface/queues/rx-*/rps_cpus)" "$cores" $step_size
|
||||||
|
|
||||||
|
for file in /sys/class/net/$interface/queues/rx-[0-9]*/rps_flow_cnt
|
||||||
|
do
|
||||||
|
echo $rps_flow_cnt > $file
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
set_interface() {
|
||||||
|
local interface=$1
|
||||||
|
local cores=$2
|
||||||
|
|
||||||
|
echo "using cores: $cores for interface: $interface"
|
||||||
|
|
||||||
|
for file in /sys/class/net/$interface/queues/rx-[0-9]*/rps_cpus
|
||||||
|
do
|
||||||
|
set_core_mask $file "$cores"
|
||||||
|
echo $rps_flow_cnt > `dirname $file`/rps_flow_cnt
|
||||||
|
done
|
||||||
|
|
||||||
|
for file in /sys/class/net/$interface/queues/tx-[0-9]*/xps_cpus
|
||||||
|
do
|
||||||
|
set_core_mask $file "$cores"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
set_interface_queues() {
|
||||||
|
echo "using cpu: $queue_cores for network queues"
|
||||||
|
for dev in /sys/class/net/eth*
|
||||||
|
do
|
||||||
|
[ -d "$dev" ] || continue
|
||||||
|
|
||||||
|
local interface=`basename $dev`
|
||||||
|
|
||||||
|
set_interface $interface "$queue_cores"
|
||||||
|
done
|
||||||
|
|
||||||
|
for dev in /sys/class/net/wlan*
|
||||||
|
do
|
||||||
|
[ -d "$dev" ] || continue
|
||||||
|
|
||||||
|
local interface=`basename $dev`
|
||||||
|
|
||||||
|
set_interface $interface "$queue_cores"
|
||||||
|
done
|
||||||
|
|
||||||
|
for dev in /sys/class/net/eth*
|
||||||
|
do
|
||||||
|
local eth=`basename $dev`
|
||||||
|
echo "enabling offload on $eth"
|
||||||
|
ethtool -K $eth rx-checksum on >/dev/null 2>&1
|
||||||
|
ethtool -K $eth tx-checksum-ip-generic on >/dev/null 2>&1 || (
|
||||||
|
ethtool -K $eth tx-checksum-ipv4 on >/dev/null 2>&1
|
||||||
|
ethtool -K $eth tx-checksum-ipv6 on >/dev/null 2>&1)
|
||||||
|
ethtool -K $eth tx-scatter-gather on >/dev/null 2>&1
|
||||||
|
ethtool -K $eth gso on >/dev/null 2>&1
|
||||||
|
ethtool -K $eth gro on >/dev/null 2>&1
|
||||||
|
ethtool -K $eth lro on >/dev/null 2>&1
|
||||||
|
ethtool -K $eth tso on >/dev/null 2>&1
|
||||||
|
ethtool -K $eth ufo on >/dev/null 2>&1
|
||||||
|
done
|
||||||
|
|
||||||
|
echo $rps_sock_flow_ent > /proc/sys/net/core/rps_sock_flow_entries
|
||||||
|
sysctl -w net.core.rps_sock_flow_entries=$rps_sock_flow_ent
|
||||||
|
}
|
||||||
|
|
||||||
|
############### assign interrupts ###############
|
||||||
|
set_irq_cores() {
|
||||||
|
local mask="$(gen_hex_mask "$2")"
|
||||||
|
echo "set mask $mask for irq: $1"
|
||||||
|
echo $mask > "/proc/irq/$1/smp_affinity"
|
||||||
|
}
|
||||||
|
|
||||||
|
set_irq_pattern() {
|
||||||
|
local name_pattern="$1"
|
||||||
|
local cores="$2"
|
||||||
|
|
||||||
|
for irq in `grep "$name_pattern" /proc/interrupts | cut -d: -f1 | sed 's, *,,'`
|
||||||
|
do
|
||||||
|
set_irq_cores $irq "$cores"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
set_irq_interleave() {
|
||||||
|
local name_pattern=$1
|
||||||
|
local cores=$2
|
||||||
|
local step_size=$3
|
||||||
|
|
||||||
|
local files=""
|
||||||
|
for irq in `grep "$name_pattern" /proc/interrupts | cut -d: -f1 | sed 's, *,,'`
|
||||||
|
do
|
||||||
|
files="$files\
|
||||||
|
/proc/irq/$irq/smp_affinity"
|
||||||
|
done
|
||||||
|
|
||||||
|
set_core_mask_round "$files" "$cores" "$step_size"
|
||||||
|
}
|
||||||
|
|
||||||
|
set_irqs() {
|
||||||
|
#dma
|
||||||
|
set_irq_pattern bam_dma "$usb_core"
|
||||||
|
|
||||||
|
#ethernet
|
||||||
|
set_irq_interleave eth_tx "$queue_irq_cores" 4
|
||||||
|
set_irq_interleave eth_rx "$queue_irq_cores" 1
|
||||||
|
|
||||||
|
#pcie
|
||||||
|
set_irq_pattern pcie "$wifi_core"
|
||||||
|
|
||||||
|
#usb
|
||||||
|
set_irq_pattern usb "$usb_core"
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
set_interface_queues
|
||||||
|
set_irqs
|
||||||
}
|
}
|
0
root/target/linux/ipq40xx/base-files/lib/adjust_network.sh
Normal file → Executable file
0
root/target/linux/ipq40xx/base-files/lib/adjust_network.sh
Normal file → Executable file
Loading…
Add table
Add a link
Reference in a new issue