--- /dev/null
+# Use "make defconfig" to expand this to a full .config
+CONFIG_TARGET_ipq806x=y
+CONFIG_TARGET_ipq806x_DEVICE_R7800=y
+CONFIG_TARGET_BOARD="ipq806x"
+
+# Per-package build logs in <buildroot>/logs
+CONFIG_DEVEL=y
+CONFIG_BUILD_LOG=y
+
+# Debugging options (build gdbserver, include package debug)
+CONFIG_PACKAGE_gdbserver=m
+CONFIG_DEBUG=y
+
+# Longer waiting for failsafe button push
+CONFIG_IMAGEOPT=y
+CONFIG_PREINITOPT=y
+CONFIG_TARGET_PREINIT_TIMEOUT=5
+
+# Busybox tweaks
+CONFIG_BUSYBOX_CUSTOM=y
+#CONFIG_BUSYBOX_CONFIG_DIFF=y
+CONFIG_BUSYBOX_CONFIG_FEATURE_EDITING_SAVEHISTORY=y
+CONFIG_BUSYBOX_CONFIG_FEATURE_EDITING_SAVE_ON_EXIT=y
+CONFIG_BUSYBOX_CONFIG_FEATURE_LESS_FLAGS=y
+CONFIG_BUSYBOX_CONFIG_FEATURE_LESS_REGEXP=y
+CONFIG_BUSYBOX_CONFIG_FEATURE_LESS_WINCH=y
+
+# Add-on programs
+CONFIG_PACKAGE_htop=y
+CONFIG_PACKAGE_nano=y
+CONFIG_PACKAGE_ccrypt=y
+CONFIG_PACKAGE_curl=y
+CONFIG_LIBCURL_OPENSSL=y
+CONFIG_PACKAGE_vsftpd-tls=y
+CONFIG_PACKAGE_wget=y
+CONFIG_PACKAGE_patch=y
+CONFIG_PACKAGE_diffutils=y
+CONFIG_PACKAGE_tree=y
+CONFIG_PACKAGE_irqbalance=y
+CONFIG_DROPBEAR_ECC=y
+
+# USB device mount & file systems support
+CONFIG_PACKAGE_block-mount=y
+CONFIG_PACKAGE_kmod-usb-storage=y
+CONFIG_PACKAGE_kmod-fs-cifs=y
+CONFIG_PACKAGE_kmod-fs-exfat=y
+CONFIG_PACKAGE_libblkid=y
+CONFIG_PACKAGE_kmod-fs-ext4=y
+CONFIG_PACKAGE_kmod-fs-hfsplus=y
+CONFIG_PACKAGE_kmod-fs-msdos=y
+CONFIG_PACKAGE_kmod-fs-vfat=y
+CONFIG_PACKAGE_ntfs-3g=y
+CONFIG_PACKAGE_kmod-nls-cp1250=y
+CONFIG_PACKAGE_kmod-nls-cp437=y
+CONFIG_PACKAGE_kmod-nls-cp850=y
+CONFIG_PACKAGE_kmod-nls-iso8859-1=y
+CONFIG_PACKAGE_kmod-nls-iso8859-15=y
+CONFIG_PACKAGE_kmod-nls-utf8=y
+
+# IPv6 support
+CONFIG_PACKAGE_6in4=y
+CONFIG_PACKAGE_6to4=y
+CONFIG_PACKAGE_6rd=y
+
+# IPv6 NAT support (ip6tables NAT extensions, ipt-nat6 and nf-nat6 kmods)
+CONFIG_PACKAGE_ip6tables-mod-nat=y
+
+# WLAN/WPS support
+CONFIG_PACKAGE_hostapd-utils=y
+CONFIG_WPA_SUPPLICANT_INTERNAL=y
+CONFIG_WPA_MSG_MIN_PRIORITY=4
+CONFIG_PACKAGE_wpad=y
+# CONFIG_PACKAGE_wpad-mini is not set
+CONFIG_ATH_USER_REGD=y
+CONFIG_PACKAGE_ATH_DFS=y
+
+# SSL certificates
+CONFIG_PACKAGE_ca-certificates=y
+
+# Luci (SSL from OpenSSL)
+CONFIG_PACKAGE_luci-ssl-openssl=y
+CONFIG_PACKAGE_luci-mod-admin-full=y
+CONFIG_PACKAGE_luci-app-commands=y
+CONFIG_PACKAGE_luci-app-ddns=y
+CONFIG_PACKAGE_luci-app-upnp=y
+CONFIG_PACKAGE_luci-app-wol=y
+
+# Luci statistics
+CONFIG_PACKAGE_luci-app-statistics=y
+CONFIG_PACKAGE_collectd-mod-conntrack=y
+CONFIG_PACKAGE_collectd-mod-cpufreq=y
+CONFIG_PACKAGE_collectd-mod-entropy=y
+CONFIG_PACKAGE_collectd-mod-ping=y
+CONFIG_PACKAGE_collectd-mod-thermal=y
+CONFIG_PACKAGE_collectd-mod-uptime=y
+
+# QoS selection - currently SQM
+CONFIG_PACKAGE_luci-app-sqm=y
+CONFIG_PACKAGE_sqm-scripts-extra=y
+
+# Build luci-theme-material, default is still bootstrap
+CONFIG_PACKAGE_luci-theme-material=y
+
+# 3G USB dongle
+CONFIG_PACKAGE_luci-proto-3g=y
+CONFIG_PACKAGE_kmod-usb-serial=y
+CONFIG_PACKAGE_kmod-usb-serial-wwan=y
+CONFIG_PACKAGE_usb-modeswitch=y
+
+# kernel support for tunnels, VPNs
+CONFIG_PACKAGE_kmod-tun=y
+
+# PPTP support
+CONFIG_PACKAGE_luci-proto-ppp=y
+CONFIG_PACKAGE_ppp-mod-pptp=y
+
+# iptables add-ons ipsec rtsp
+CONFIG_PACKAGE_kmod-ipt-nathelper-rtsp=y
+CONFIG_PACKAGE_iptables-mod-ipsec=y
+
+# Support for IETF BCP38
+CONFIG_PACKAGE_luci-app-bcp38=y
+
+# Adblock package with Luci support, initially disabled
+CONFIG_PACKAGE_luci-app-adblock=y
+
/logs
/feeds
/feeds.conf
-/files
/overlay
/package/feeds
/package/openwrt-packages
--- /dev/null
+LEDE 17.01-snapshot r3422-b78bcdf619 / 2017-06-02 09:38
+---
+main 2017-06-02 b78bcdf x86: disable X2APIC support for legacy su
+luci 2017-06-02 7f6fc16 luci-mod-admin-full: automatically set dn
+packages 2017-05-29 8844d7e net/mosquitto: bump to 1.4.12 for CVE-201
+routing 2017-04-20 dbbad84 batmand: Provide PKG_MIRROR_HASH for LEDE
--- /dev/null
+#!/bin/sh
+cp -f $1 /tmp/HNsettings.cpt
+if [ "$?" -eq 0 ] ; then
+ ccdecrypt -vf /tmp/HNsettings.cpt
+ if [ "$?" -eq 0 ] ; then
+ tar -xzv -f /tmp/HNsettings -C /etc
+ chmod 744 /etc/dropbear/authorized_keys
+ fi
+fi
+
--- /dev/null
+#!/bin/sh
+cd /etc/config
+for F in *
+do
+ echo
+ echo "===== $F ====="
+ uci -c /rom/etc/config export $F >/tmp/$F.default 2>/dev/null
+ case $? in 0) ;; *) echo '>> no default in /rom <<' ;; esac
+ uci export $F >/tmp/$F.current
+ diff /tmp/$F.default /tmp/$F.current
+ rm -f /tmp/$F.default /tmp/$F.current
+done
+
--- /dev/null
+config 'global'
+ option anon_swap '0'
+ option anon_mount '1'
+ option auto_swap '1'
+ option auto_mount '1'
+ option delay_root '0'
+ option check_fs '0'
+
+## use 'block detect' to find out uuid, if you want device specific mount.
+## anon_mount enables the automatic mounting of /dev/sdXy to /mnt/sdXy
+
--- /dev/null
+#!/bin/sh
+[ $ACTION = "step" ] && logger -t ntpd Time set, stratum=$stratum interval=$poll_interval offset=$offset
+[ $ACTION = "stratum" ] && logger -t ntpd Stratum change, stratum=$stratum interval=$poll_interval offset=$offset
+
--- /dev/null
+#!/bin/sh
+uci set system.@system[0].hostname=router2
+uci set network.lan.ipaddr=192.168.1.2
+uci set network.lan.ip6ifaceid='::2'
+uci set network.lan.gateway=192.168.1.1
+uci set network.lan.dns=192.168.1.1
+uci set network.henet.auto=0
+uci set network.lan6=interface
+uci set network.lan6.ifname=@lan
+uci set network.lan6.proto=dhcpv6
+uci set network.lan6.reqprefix=no
+uci set wireless.@wifi-device[0].channel=48
+uci set wireless.@wifi-device[1].channel=9
+uci set dhcp.lan.ignore=1
+uci set dhcp.lan.force=0
+uci delete dhcp.lan.dhcpv6
+uci delete dhcp.lan.ra
+uci delete dhcp.lan.ndp
+uci set upnpd.config.enable_natpmp=0
+uci set upnpd.config.enable_upnp=0
+uci commit dhcp
+uci commit network
+uci commit wireless
+uci commit system
+uci commit upnpd
+/etc/init.d/dnsmasq disable
+/etc/init.d/miniupnpd disable
+
--- /dev/null
+#!/bin/sh
+cd /etc
+tar -czv -f /tmp/HNsettings \
+ config/network config/wireless config/firewall config/dhcp config/sqm \
+ config/luci_statistics config/bcp38 vsftpd* \
+ dropbear/authorized_keys adblock/adblock.whitelist
+if [ "$?" -eq 0 ] ; then
+ ccencrypt -vf /tmp/HNsettings
+ if [ "$?" -eq 0 ] ; then
+ cp -f /tmp/HNsettings.cpt /etc/HNsettings.$1.cpt
+ fi
+fi
+
--- /dev/null
+#!/bin/sh
+#
+# copyPackages2tmp - Copy packages to router's /tmp directory
+
+#create new /etc/opkg/customfeeds.conf with base, luci, packages, routing
+cat <<EOF >/tmp/customfeeds.conf
+src/gz TmpBase file:/tmp/arm_cortex-a15_neon-vfpv4/base
+src/gz TmpLuci file:/tmp/arm_cortex-a15_neon-vfpv4/luci
+src/gz TmpPackages file:/tmp/arm_cortex-a15_neon-vfpv4/packages
+src/gz TmpRouting file:/tmp/arm_cortex-a15_neon-vfpv4/routing
+src/gz TmpTarget file:/tmp/target
+EOF
+
+#copy packages
+echo "Copy packages..."
+scp -r bin/packages/arm_cortex-a15_neon-vfpv4 root@192.168.1.1:/tmp/
+scp -r bin/targets/ipq806x/generic/packages root@192.168.1.1:/tmp/target
+
+#copy and overwrite /etc/opkg/customfeeds.conf
+echo "Copy modified /etc/opkg/customfeeds.conf..."
+scp /tmp/customfeeds.conf root@192.168.1.1:/etc/opkg/customfeeds.conf
+echo "done."
+
--- /dev/null
+#!/bin/sh
+#
+# createbuildinfo - Create info on current config and source code changes
+
+getGitInfo() {
+#params: directory patchfile infofile
+ echo "\n######################################################\n" >> $3
+ (cd $1
+ git diff HEAD > $2
+ git remote -v show | grep fetch >> $3
+ git branch --list >> $3
+ git show --format="%cd %h %s" --abbrev=7 --date=short | head -n 1 | cut -b1-60 >> $3
+ git status --porcelain >> $3
+ )
+}
+
+BinDir=$PWD/bin/targets/ipq806x/generic
+Device=R7800
+Prefix=lede-ipq806x
+Branch=lede1701
+#Branch=`basename $PWD`
+
+VersTime=$Branch-`scripts/getver.sh`-`date +%Y%m%d-%H%M`
+TFile=$BinDir/$Device-$VersTime
+
+echo process $Branch...
+
+# cleanup old binaries & patches
+rm -f $BinDir/$Device-*
+
+# remove unnecessary files
+rm -f $BinDir/*root.img $BinDir/*vmlinux.elf
+
+# create status info and patches
+echo "$VersTime" > $TFile-status.txt
+getGitInfo . $TFile-main.patch $TFile-status.txt
+getGitInfo feeds/luci $TFile-luci.patch $TFile-status.txt
+getGitInfo feeds/packages $TFile-packages.patch $TFile-status.txt
+getGitInfo feeds/routing $TFile-routing.patch $TFile-status.txt
+sed -i -e 's/$/\r/' $TFile-status.txt
+
+# collect config info
+cp .config $TFile.config
+cp .config.init $TFile.config.init
+scripts/diffconfig.sh > $TFile.diffconfig 2>/dev/null
+
+# copy buildroot creation script and patch timestamp info
+cp hnscripts/newBuildroot.sh $TFile-newBuildroot.sh
+sed -i "s/^FILESTAMP=.*/FILESTAMP=$Device-$VersTime/" $TFile-newBuildroot.sh
+
+# cleanup checksum files
+grep -sh $Device.*-squashfs $BinDir/md5sums $BinDir/sha256sums \
+ | sed -e 's/$/\r/' -e 's/'$Prefix'-//' -e 's/squash/sq/' \
+ > $TFile-checksums.txt
+rm -f $BinDir/md5sums $BinDir/sha256sums
+
+# rename manifest and firmware files
+cd $BinDir
+mv *.manifest $Device-$VersTime.manifest
+mv $Prefix-$Device-squashfs-sysupgrade.tar $Device-$VersTime-sqfs-sysupgrade.tar
+mv $Prefix-$Device-squashfs-factory.img $Device-$VersTime-sqfs-factory.img
+
--- /dev/null
+#!/bin/bash
+#
+# kernelcompile - Clean & compile kernel using a single thread. No update.
+
+echo "...make kernel..."
+make target/linux/clean
+mkdir -p logs
+make target/linux/compile V=s 2>&1 | tee logs/build.log | grep -i -E "^make.*(error|[12345]...Entering dir)"
+
--- /dev/null
+#!/bin/sh
+#
+# mount & copy - Mount the Virtualbox shared folder and copy files to PC
+
+Mounttype=vboxsf
+Mountname=PCSHARE
+Mountpoint=/media/windows-share
+BinDir=bin/targets/ipq806x/generic
+
+echo Check for existing mount of the shared folder $Mountpoint
+df | grep $Mountpoint
+if [ "$?" -ne 0 ]; then
+ echo Mounting $Mountpoint as $Mountname...
+ sudo mount -t $Mounttype $Mountname $Mountpoint
+ [ "$?" -ne 0 ] && echo "Sudo/mount failed." && exit 1
+fi
+
+echo "\nCopy from $PWD ..."
+cp $BinDir/*tar $Mountpoint
+sleep 2
+cp $BinDir/*img $Mountpoint
+sleep 2
+cp $BinDir/*patch $Mountpoint
+sleep 1
+cp $BinDir/*sh $Mountpoint
+sleep 1
+cp $BinDir/*manifest $Mountpoint
+sleep 1
+cp $BinDir/*txt $Mountpoint
+sleep 1
+cp $BinDir/*config* $Mountpoint
+echo done.
+
--- /dev/null
+#!/bin/sh
+#
+# newBuildroot.sh
+#
+# Creates the build environment with the current directory as the root
+# To avoid problems with long paths, something like /Openwrt is preferable
+#
+# Script creates subdir for trunk or the release branch, and dl for downloads
+# Creates main source repository and luci, packages & routing feeds
+
+### Target definitions
+TARGET=lede1701
+GITREPO="-b lede-17.01 --single-branch https://git.lede-project.org/source.git"
+
+## Current version
+FILESTAMP=R7800-lede1701-r3389-379155dc0f-20170518-1219
+
+### Prerequisites for buildroot
+sudo apt-get install build-essential subversion libncurses5-dev zlib1g-dev
+sudo apt-get install gawk gcc-multilib flex git-core gettext libssl-dev
+
+### Prerequisites for being able to send patches to openwrt-devel
+sudo apt-get install git-email
+
+### Newly patched Ubuntu may not yet have the correct kernel headers.
+# sudo apt-get install linux-headers-$(uname -r)
+
+### set the preferred umask (LEDE allows 0000-0022)
+umask 0022
+
+### download directory (outside main directory to protect from make distclean)
+mkdir -p dl
+
+### main directory
+mkdir -p $TARGET
+
+### checkout/clone and change to directory
+git clone $GITREPO $TARGET
+cd $TARGET
+
+### create symlink to dl (after git clone)
+ln -s ../dl dl
+
+### patch main source first to set feeds correctly
+### update the feeds, apply patches to feeds
+### re-create index to find new packages, finally install
+patch -p1 -i ../$FILESTAMP-main.patch
+scripts/feeds update -a
+(cd feeds/luci; patch -p1 -i ../../../$FILESTAMP-luci.patch)
+(cd feeds/packages; patch -p1 -i ../../../$FILESTAMP-packages.patch)
+(cd feeds/routing; patch -p1 -i ../../../$FILESTAMP-routing.patch)
+scripts/feeds update -i
+scripts/feeds install -a
+
+### chmod known script files executable
+chmod -f 755 files/etc/*.sh
+chmod -f 755 files/etc/rc.button/*
+
+### chmod buildscripts executable
+chmod -f 755 hnscripts/*.sh
+
+### add created/modified files in main repo to version control
+git add -f files
+git add -A
+
+### add created/modified files in feeds to version control
+(cd feeds/luci; git add -A)
+(cd feeds/packages; git add -A)
+(cd feeds/routing; git add -A)
+
+### initialise .config
+cp .config.init .config
+
--- /dev/null
+#!/bin/bash
+#
+# parallelcompile - Compile using multiple threads
+
+echo "...create version info file..."
+hnscripts/timestampVersion.sh
+echo "...make world..."
+mkdir -p logs
+make -j 3 V=s 2>&1 | tee logs/build.log | grep -i -E "^make.*(error|[12345]...Entering dir)"
+[ ${PIPESTATUS[0]} -ne 0 ] && exit 1
+echo -n "...create build info: "
+hnscripts/createbuildinfo.sh
+echo done.
+
--- /dev/null
+#!/bin/bash
+#
+# singlecompile - Compile using a single thread. For debug
+
+echo "...create version info file..."
+hnscripts/timestampVersion.sh
+echo "...make world..."
+mkdir -p logs
+make V=s 2>&1 | tee logs/build.log | grep -i -E "^make.*(error|[12345]...Entering dir)"
+[ ${PIPESTATUS[0]} -ne 0 ] && exit 1
+echo -n "...create build info: "
+hnscripts/createbuildinfo.sh
+echo done.
+
--- /dev/null
+#!/bin/bash
+#
+# timestampVersion - Collect source version info and insert it into firmware
+
+STATUSFILE=files/etc/Compile_info.txt
+#Nickname=`grep RELEASE: include/{version,toplevel}.mk | cut -d "=" -f 2`
+Nickname=17.01-snapshot
+
+echo LEDE $Nickname `scripts/getver.sh` / `date "+%F %H:%M"` > $STATUSFILE
+echo "---" >> $STATUSFILE
+echo "main "`(git show --format="%cd %h %s" --abbrev=7 --date=short | head -n 1 | cut -b1-60)` >> $STATUSFILE
+echo "luci "`(cd feeds/luci && git show --format="%cd %h %s" --abbrev=7 --date=short | head -n 1 | cut -b1-60)` >> $STATUSFILE
+echo "packages "`(cd feeds/packages && git show --format="%cd %h %s" --abbrev=7 --date=short | head -n 1 | cut -b1-60)` >> $STATUSFILE
+echo "routing "`(cd feeds/routing && git show --format="%cd %h %s" --abbrev=7 --date=short | head -n 1 | cut -b1-60)` >> $STATUSFILE
+git add $STATUSFILE
+
+# Override git/svn timestamp after r48583-48594, set initial clock to now
+date +%s > version.date
+
--- /dev/null
+#!/bin/bash
+#
+# update & make - Update source code and continue to make the build
+
+umask 0022
+echo "...update main source..."
+git pull
+echo "...update feeds..."
+./scripts/feeds update -a
+[ "$?" -ne 0 ] && echo "Updating the feeds failed." && exit 1
+echo "...install feeds..."
+./scripts/feeds install -a
+echo "...make defconfig..."
+make defconfig
+#echo "...make menuconfig..."
+#make menuconfig
+echo "...download new source packages..."
+make download
+echo "...make the firmware..."
+hnscripts/parallelcompile.sh
+
echo "$$$${conffile##$(1)}" >> $(1)/CONTROL/conffiles; \
fi \
done
+
+ $(if $(CONFIG_INCLUDE_CONFIG), \
+ echo -e "# Build configuration for board $(BOARD)/$(SUBTARGET)/$(PROFILE)\n" >$(1)/etc/build.config; \
+ cat $(BIN_DIR)/config.seed >>$(1)/etc/build.config)
endef
ifneq ($(DUMP),1)
delete system.@system[0]
add system system
set system.@system[-1].hostname='LEDE'
- set system.@system[-1].timezone='UTC'
+ set system.@system[-1].timezone='EET-2EEST,M3.5.0/3,M10.5.0/4'
+ set system.@system[-1].zonename='Europe/Helsinki'
set system.@system[-1].ttylogin='0'
set system.@system[-1].log_size='64'
set system.@system[-1].urandom_seed='0'
set_state failsafe
;;
released)
- if [ "$SEEN" -lt 1 ]
- then
- echo "REBOOT" > /dev/console
- sync
- reboot
- elif [ "$SEEN" -gt 5 -a -n "$OVERLAY" ]
- then
echo "FACTORY RESET" > /dev/console
jffs2reset -y && reboot &
- fi
;;
esac
proto_6in4_update() {
sh -c '
- timeout=5
+ timeout=8
(while [ $((timeout--)) -gt 0 ]; do
sleep 1
option domain 'lan'
option expandhosts 1
option nonegcache 0
+ option cachesize 1000
option authoritative 1
option readethers 1
option leasefile '/tmp/dhcp.leases'
set_default wps_device_name "Lede AP"
set_default wps_manufacturer "www.lede-project.org"
set_default wps_independent 1
+ # Set WPS label pin to original Netgear value stored in art partition
+ # Value for wps_pin can be overridden by /etc/config/wireless
+# local PINdefault="$(dd if=/dev/mtdblock3 bs=1 skip=18 count=8 2>/dev/null)"
+# set_default wps_pin "$PINdefault"
wps_state=2
[ -n "$wps_configured" ] && wps_state=1
#!/bin/sh
if [ "$ACTION" = "pressed" -a "$BUTTON" = "wps" ]; then
+ logger "WPS button pressed, looking for active radios"
+# echo "255" > /sys/class/leds/r7800:amber:power/brightness
cd /var/run/hostapd
for socket in *; do
[ -S "$socket" ] || continue
+ logger "WPS activated for: $socket"
hostapd_cli -i "$socket" wps_pbc
done
+# sleep 120
+# echo "0" > /sys/class/leds/r7800:amber:power/brightness
fi
return 0
--- /dev/null
+--- a/shell/ash.c
++++ b/shell/ash.c
+@@ -13235,7 +13235,7 @@ int ash_main(int argc UNUSED_PARAM, char
+ if (iflag) {
+ const char *hp = lookupvar("HISTFILE");
+ if (!hp) {
+- hp = lookupvar("HOME");
++ hp = "/tmp";
+ if (hp) {
+ hp = concat_path_file(hp, ".ash_history");
+ setvar0("HISTFILE", hp);
--- /dev/null
+From: Eric Dumazet <edumazet@google.com>
+Date: Mon, 23 May 2016 14:24:56 -0700
+Subject: [PATCH] net_sched: avoid too many hrtimer_start() calls
+
+I found a serious performance bug in packet schedulers using hrtimers.
+
+sch_htb and sch_fq are definitely impacted by this problem.
+
+We constantly rearm high resolution timers if some packets are throttled
+in one (or more) class, and other packets are flying through qdisc on
+another (non throttled) class.
+
+hrtimer_start() does not have the mod_timer() trick of doing nothing if
+expires value does not change :
+
+ if (timer_pending(timer) &&
+ timer->expires == expires)
+ return 1;
+
+This issue is particularly visible when multiple cpus can queue/dequeue
+packets on the same qdisc, as hrtimer code has to lock a remote base.
+
+I used following fix :
+
+1) Change htb to use qdisc_watchdog_schedule_ns() instead of open-coding
+it.
+
+2) Cache watchdog prior expiration. hrtimer might provide this, but I
+prefer to not rely on some hrtimer internal.
+
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+
+--- a/include/net/pkt_sched.h
++++ b/include/net/pkt_sched.h
+@@ -61,6 +61,7 @@ psched_tdiff_bounded(psched_time_t tv1,
+ }
+
+ struct qdisc_watchdog {
++ u64 last_expires;
+ struct hrtimer timer;
+ struct Qdisc *qdisc;
+ };
+--- a/net/sched/sch_api.c
++++ b/net/sched/sch_api.c
+@@ -607,6 +607,10 @@ void qdisc_watchdog_schedule_ns(struct q
+ if (throttle)
+ qdisc_throttled(wd->qdisc);
+
++ if (wd->last_expires == expires)
++ return;
++
++ wd->last_expires = expires;
+ hrtimer_start(&wd->timer,
+ ns_to_ktime(expires),
+ HRTIMER_MODE_ABS_PINNED);
+--- a/net/sched/sch_htb.c
++++ b/net/sched/sch_htb.c
+@@ -928,17 +928,10 @@ ok:
+ }
+ }
+ qdisc_qstats_overlimit(sch);
+- if (likely(next_event > q->now)) {
+- if (!test_bit(__QDISC_STATE_DEACTIVATED,
+- &qdisc_root_sleeping(q->watchdog.qdisc)->state)) {
+- ktime_t time = ns_to_ktime(next_event);
+- qdisc_throttled(q->watchdog.qdisc);
+- hrtimer_start(&q->watchdog.timer, time,
+- HRTIMER_MODE_ABS_PINNED);
+- }
+- } else {
++ if (likely(next_event > q->now))
++ qdisc_watchdog_schedule_ns(&q->watchdog, next_event, true);
++ else
+ schedule_work(&q->work);
+- }
+ fin:
+ return skb;
+ }
--- /dev/null
+From: Florian Westphal <fw@strlen.de>
+Date: Thu, 9 Jun 2016 00:27:43 +0200
+Subject: [PATCH] sched: place state, next_sched and gso_skb in same cacheline
+ again
+
+Earlier commits removed two members from struct Qdisc which places
+next_sched/gso_skb into a different cacheline than ->state.
+
+This restores the struct layout to what it was before the removal.
+Move the two members, then add an annotation so they all reside in the
+same cacheline.
+
+This adds a 16 byte hole after cpu_qstats.
+
+The hole could be closed but as it doesn't decrease total struct size just
+do it this way.
+
+Reported-by: Eric Dumazet <edumazet@google.com>
+Signed-off-by: Florian Westphal <fw@strlen.de>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+
+--- a/include/net/sch_generic.h
++++ b/include/net/sch_generic.h
+@@ -85,11 +85,11 @@ struct Qdisc {
+ struct gnet_stats_basic_cpu __percpu *cpu_bstats;
+ struct gnet_stats_queue __percpu *cpu_qstats;
+
+- struct Qdisc *next_sched;
+- struct sk_buff *gso_skb;
+ /*
+ * For performance sake on SMP, we put highly modified fields at the end
+ */
++ struct Qdisc *next_sched ____cacheline_aligned_in_smp;
++ struct sk_buff *gso_skb;
+ unsigned long state;
+ struct sk_buff_head q;
+ struct gnet_stats_basic_packed bstats;
--- /dev/null
+From: Eric Dumazet <edumazet@google.com>
+Date: Tue, 21 Jun 2016 23:16:52 -0700
+Subject: [PATCH] net_sched: generalize bulk dequeue
+
+When qdisc bulk dequeue was added in linux-3.18 (commit
+5772e9a3463b "qdisc: bulk dequeue support for qdiscs
+with TCQ_F_ONETXQUEUE"), it was constrained to some
+specific qdiscs.
+
+With some extra care, we can extend this to all qdiscs,
+so that typical traffic shaping solutions can benefit from
+small batches (8 packets in this patch).
+
+For example, HTB is often used on some multi queue device.
+And bonding/team are multi queue devices...
+
+Idea is to bulk-dequeue packets mapping to the same transmit queue.
+
+This brings between 35 and 80 % performance increase in HTB setup
+under pressure on a bonding setup :
+
+1) NUMA node contention : 610,000 pps -> 1,110,000 pps
+2) No node contention : 1,380,000 pps -> 1,930,000 pps
+
+Now we should work to add batches on the enqueue() side ;)
+
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Cc: John Fastabend <john.r.fastabend@intel.com>
+Cc: Jesper Dangaard Brouer <brouer@redhat.com>
+Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
+Cc: Florian Westphal <fw@strlen.de>
+Cc: Daniel Borkmann <daniel@iogearbox.net>
+Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+
+--- a/include/net/sch_generic.h
++++ b/include/net/sch_generic.h
+@@ -88,13 +88,14 @@ struct Qdisc {
+ /*
+ * For performance sake on SMP, we put highly modified fields at the end
+ */
+- struct Qdisc *next_sched ____cacheline_aligned_in_smp;
+- struct sk_buff *gso_skb;
+- unsigned long state;
++ struct sk_buff *gso_skb ____cacheline_aligned_in_smp;
+ struct sk_buff_head q;
+ struct gnet_stats_basic_packed bstats;
+ unsigned int __state;
+ struct gnet_stats_queue qstats;
++ unsigned long state;
++ struct Qdisc *next_sched;
++ struct sk_buff *skb_bad_txq;
+ struct rcu_head rcu_head;
+ int padded;
+ atomic_t refcnt;
+--- a/net/sched/sch_generic.c
++++ b/net/sched/sch_generic.c
+@@ -76,6 +76,34 @@ static void try_bulk_dequeue_skb(struct
+ skb->next = NULL;
+ }
+
++/* This variant of try_bulk_dequeue_skb() makes sure
++ * all skbs in the chain are for the same txq
++ */
++static void try_bulk_dequeue_skb_slow(struct Qdisc *q,
++ struct sk_buff *skb,
++ int *packets)
++{
++ int mapping = skb_get_queue_mapping(skb);
++ struct sk_buff *nskb;
++ int cnt = 0;
++
++ do {
++ nskb = q->dequeue(q);
++ if (!nskb)
++ break;
++ if (unlikely(skb_get_queue_mapping(nskb) != mapping)) {
++ q->skb_bad_txq = nskb;
++ qdisc_qstats_backlog_inc(q, nskb);
++ q->q.qlen++;
++ break;
++ }
++ skb->next = nskb;
++ skb = nskb;
++ } while (++cnt < 8);
++ (*packets) += cnt;
++ skb->next = NULL;
++}
++
+ /* Note that dequeue_skb can possibly return a SKB list (via skb->next).
+ * A requeued skb (via q->gso_skb) can also be a SKB list.
+ */
+@@ -86,8 +114,9 @@ static struct sk_buff *dequeue_skb(struc
+ const struct netdev_queue *txq = q->dev_queue;
+
+ *packets = 1;
+- *validate = true;
+ if (unlikely(skb)) {
++ /* skb in gso_skb were already validated */
++ *validate = false;
+ /* check the reason of requeuing without tx lock first */
+ txq = skb_get_tx_queue(txq->dev, skb);
+ if (!netif_xmit_frozen_or_stopped(txq)) {
+@@ -95,15 +124,30 @@ static struct sk_buff *dequeue_skb(struc
+ q->q.qlen--;
+ } else
+ skb = NULL;
+- /* skb in gso_skb were already validated */
+- *validate = false;
+- } else {
+- if (!(q->flags & TCQ_F_ONETXQUEUE) ||
+- !netif_xmit_frozen_or_stopped(txq)) {
+- skb = q->dequeue(q);
+- if (skb && qdisc_may_bulk(q))
+- try_bulk_dequeue_skb(q, skb, txq, packets);
++ return skb;
++ }
++ *validate = true;
++ skb = q->skb_bad_txq;
++ if (unlikely(skb)) {
++ /* check the reason of requeuing without tx lock first */
++ txq = skb_get_tx_queue(txq->dev, skb);
++ if (!netif_xmit_frozen_or_stopped(txq)) {
++ q->skb_bad_txq = NULL;
++ qdisc_qstats_backlog_dec(q, skb);
++ q->q.qlen--;
++ goto bulk;
+ }
++ return NULL;
++ }
++ if (!(q->flags & TCQ_F_ONETXQUEUE) ||
++ !netif_xmit_frozen_or_stopped(txq))
++ skb = q->dequeue(q);
++ if (skb) {
++bulk:
++ if (qdisc_may_bulk(q))
++ try_bulk_dequeue_skb(q, skb, txq, packets);
++ else
++ try_bulk_dequeue_skb_slow(q, skb, packets);
+ }
+ return skb;
+ }
+@@ -649,11 +693,14 @@ void qdisc_reset(struct Qdisc *qdisc)
+ if (ops->reset)
+ ops->reset(qdisc);
+
++ kfree_skb(qdisc->skb_bad_txq);
++ qdisc->skb_bad_txq = NULL;
++
+ if (qdisc->gso_skb) {
+ kfree_skb_list(qdisc->gso_skb);
+ qdisc->gso_skb = NULL;
+- qdisc->q.qlen = 0;
+ }
++ qdisc->q.qlen = 0;
+ }
+ EXPORT_SYMBOL(qdisc_reset);
+
+@@ -692,6 +739,7 @@ void qdisc_destroy(struct Qdisc *qdisc)
+ dev_put(qdisc_dev(qdisc));
+
+ kfree_skb_list(qdisc->gso_skb);
++ kfree_skb(qdisc->skb_bad_txq);
+ /*
+ * gen_estimator est_timer() might access qdisc->q.lock,
+ * wait a RCU grace period before freeing qdisc.
{
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
-@@ -344,6 +344,7 @@ extern struct Qdisc_ops noop_qdisc_ops;
+@@ -345,6 +345,7 @@ extern struct Qdisc_ops noop_qdisc_ops;
extern struct Qdisc_ops pfifo_fast_ops;
extern struct Qdisc_ops mq_qdisc_ops;
extern struct Qdisc_ops noqueue_qdisc_ops;
EXPORT_SYMBOL(default_qdisc_ops);
/* Main transmission queue. */
-@@ -731,7 +731,7 @@ static void attach_one_default_qdisc(str
+@@ -779,7 +779,7 @@ static void attach_one_default_qdisc(str
void *_unused)
{
struct Qdisc *qdisc;
if (qdisc == NULL) {
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
-@@ -1948,7 +1948,7 @@ static int __init pktsched_init(void)
+@@ -1952,7 +1952,7 @@ static int __init pktsched_init(void)
return err;
}
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
-@@ -438,139 +438,6 @@ struct Qdisc_ops noqueue_qdisc_ops __rea
+@@ -482,139 +482,6 @@ struct Qdisc_ops noqueue_qdisc_ops __rea
.owner = THIS_MODULE,
};
;;
d7800 |\
r7500 |\
-r7500v2 |\
+r7500v2)
+ ucidef_set_led_usbport "usb1" "USB 1" "${board}:white:usb1" "usb1-port1" "usb2-port1"
+ ucidef_set_led_usbport "usb2" "USB 2" "${board}:white:usb2" "usb3-port1" "usb4-port1"
+ ucidef_set_led_netdev "wan" "WAN" "${board}:white:wan" "eth0"
+ ucidef_set_led_ide "esata" "eSATA" "${board}:white:esata"
+ ;;
r7800)
ucidef_set_led_usbport "usb1" "USB 1" "${board}:white:usb1" "usb1-port1" "usb2-port1"
ucidef_set_led_usbport "usb2" "USB 2" "${board}:white:usb2" "usb3-port1" "usb4-port1"
ucidef_set_led_netdev "wan" "WAN" "${board}:white:wan" "eth0"
ucidef_set_led_ide "esata" "eSATA" "${board}:white:esata"
+ ucidef_set_led_wlan "wlan2g" "WLAN 2G" "${board}:white:wifi" "phy1tpt"
+ ucidef_set_led_wlan "wlan5g" "WLAN 5G" "${board}:white:wps" "phy0tpt"
;;
nbg6817)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "$board:amber:wifi2g" "phy1tpt"