I have a TD-W8980 with me. I use it only for torrent downloads and it sends data wirelessly to my main router, which is a BT HomeHub 5A, and its attached 500Gb drive. I can spare my W8980 for testing for a few days. I want to test because this one crashes a lot if my torrents are downloading at more than 400 KiBytes/s and/or there are multiple active at the same time. I have a 8mb/1mb ADSL connection for now and Wireless transfer is around 3-4 MiBytes/s. Doing anything that can help make xrx200 devices maintain better performance is better than nothing.
So I would like to know how can I test your files? I always build my own firmware through Image Builder. But I dont think that I can use these files in Image Builder. Do I need to clone the whole OpenWrt source for this? Can I just use the SDK instead?
git clone https://github.com/openwrt/openwrt.git
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
make V=s menuconfig
make V=s
Now there should be full kernel tree located there: build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.93
Now the irq.c file is located build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.93/arch/mips/lantiq/irq.c , the smp-mt.c file is located build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.93/arch/mips/kernel/smp-mt.c ... it depends on the current build (the current will have probably a newer kernel, but you get the idea ...). The DTS file is located build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.93/arch/mips/boot/dts/vr9.dtsi it should be fine to just overwrite them with the versions from pastebin. You can always do a diff.
Now when you redo:
make V=s
you should get the updated images targets/lantiq/xrx200 and build_dir/target-mips_24kc_musl/linux-lantiq_xrx200 . The is probably easier way to do that, but I didn't have yet a time to learn openwrt patching system and I don't want to flash every single rebuild into the SPI flash.
No it doesn't have to be combined, balancing can put RX interrupt on one core and TX interrupt on the second core (concurrent interrupts doesn't have to wait on each other). The DMA burst change will just use a more optimal value for DMA (IMO, the tplink kernel source does it ...), which means DMA doesn't need to ask for every single byte, it just ask for a block of data.
I tried to compile the source but it fails around compiling gdb in toolchain. I'm not sure if I can continue any further from it unless the error gets resolved. I'll post the error log here once I have my laptop with me in a few hours maybe. In the meantime if someone else is able to compile source successfully then maybe please share the firmware for Tp-Link TD-W8980 here and I can then test it how it works.
Running v18.06.1 I get 3 mb/s from this router and 5 mb/s to this router on LAN. Tested through iperf and netcat.
Update: Correct me if I'm wrong but I think that two of the above functions are already available in Kernel config but are not available by default. Run make kernel_menuconfig and go to Kernel Type for the options.
#!/bin/bash
CWD=$(pwd)
BUILD_D=/mnt/mapper/sda3/build # the build directory change if need
RESULT_ROOT="$CWD"
RESULT_D="$RESULT_ROOT"
DL_D="$CWD/Xrx200-IRQ-balancing-between-VPEs-files"
PATCHES_D="$BUILD_D/create_kpatches_irqbalancing"
test -d "$DL_D" || mkdir -p "$DL_D"
cd "$DL_D"
wget -O irq.c https://pastebin.com/raw/1Bv9abyB
wget -O smp-mt.c https://pastebin.com/raw/Mvx3Cu3b
wget -O vr9_dtsi.txt https://pastebin.com/raw/dYqHpaCz
rm -rf "$PATCHES_D" # delete the build directory first if needed
test -d "$PATCHES_D" || mkdir -p "$PATCHES_D"
cd "$PATCHES_D"
git clone https://git.openwrt.org/openwrt/openwrt.git openwrt
cd ./openwrt
git checkout master
make menuconfig # choice lantiq / xrx200
make target/linux/{clean,prepare} V=s
KVER=$(find ./build_dir/target-mips_24kc_musl/linux-lantiq_xrx200 -maxdepth 1 -mindepth 1 | grep "linux-" | rev | cut -d- -f1 | rev)
rm -r ../a
mkdir -p ../a/arch/mips/lantiq
cp -vf ./build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-$KVER/arch/mips/lantiq/irq.c ../a/arch/mips/lantiq
mkdir -p ../a/arch/mips/kernel
cp -vf ./build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-$KVER/arch/mips/kernel/smp-mt.c ../a/arch/mips/kernel
mkdir -p ../a/arch/mips/boot/dts
cp -vf ./build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-$KVER/arch/mips/boot/dts/vr9.dtsi ../a/arch/mips/boot/dts
rm -r ../b
mkdir -p ../b/arch/mips/lantiq
cp -vf "$DL_D/irq.c" ../b/arch/mips/lantiq/irq.c
mkdir -p ../b/arch/mips/kernel
cp -vf "$DL_D/smp-mt.c" ../b/arch/mips/kernel/smp-mt.c
mkdir -p ../b/arch/mips/boot/dts
cp -vf "$DL_D/vr9_dtsi.txt" ../b/arch/mips/boot/dts/vr9.dtsi
cd ..
diff -aurN a b > "$CWD/4060-Xrx200-IRQ-balancing-between-VPEs.patch" || diff -aurN a b > ./4060-Xrx200-IRQ-balancing-between-VPEs.patch
exit 0
( I need it because your way is to complex for my buildscripts )
At the moment my Raspberry is building Openwrt for my Easybox 904xDSL i hope it works and i can test it in the next days.
thanks for help @pc2005
SMP is supported by default (running userspace apps on both VPEs), but there was no support for running interrupt handlers on the second VPE (all interrupt handlers had to run on first VPE = bottleneck).
I see, there was a change in newer kernel which changes interrupts handling "MIPS: lantiq: Fix IPI interrupt handling", but IMO there is still no peripheral IRQ support. Gonna need to fix my patch.
thanks, I think i'm gonna use your script for other patches too
Patches 0901-add-icu-smp-support.patch0902-enable-external-irqs-for-second-vpe.patch0903-add-icu1-node-for-smp.patch , compatible with git openwrt snapshot a3ccac6b1d693527befa73532a6cf5abda7134c0 and kernel linux-4.14.96. Should be possible to add them into target/linux/lantiq/patches-4.14, but I didn't test it if the patch folder applies after files folder it should work. Or you can apply them directly on kernel in build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96 .
I can't test the patches on my system because support for cifs is broken in snapshots for now. I couldn't make it work on my router. So I had to go back to stable release. If you have tested it on your end it should be okay to submit the pull request for now.
Sorry, Happy too early my created patch end up in:
make[2] package/install
make[2] target/install
make[3] -C target/linux install
mips-openwrt-linux-musl-ld: arch/mips/kernel/smp-mt.o: in function `ltq_disable_irq':
/opt/build/owrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96/arch/mips/kernel/smp-mt.c:121: multiple definition of `ltq_disable_irq'; arch/mips/lantiq/irq.o:/opt/build/owrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96/arch/mips/lantiq/irq.c:121: first defined here
mips-openwrt-linux-musl-ld: arch/mips/kernel/smp-mt.o: in function `ltq_mask_and_ack_irq':
/opt/build/owrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96/arch/mips/kernel/smp-mt.c:137: multiple definition of `ltq_mask_and_ack_irq'; arch/mips/lantiq/irq.o:/opt/build/owrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96/arch/mips/lantiq/irq.c:137: first defined here
mips-openwrt-linux-musl-ld: arch/mips/kernel/smp-mt.o: in function `ltq_enable_irq':
/opt/build/owrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96/arch/mips/kernel/smp-mt.c:172: multiple definition of `ltq_enable_irq'; arch/mips/lantiq/irq.o:/opt/build/owrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96/arch/mips/lantiq/irq.c:172: first defined here
mips-openwrt-linux-musl-ld: arch/mips/kernel/smp-mt.o: in function `get_c0_perfcount_int':
/opt/build/owrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96/arch/mips/kernel/smp-mt.c:626: multiple definition of `get_c0_perfcount_int'; arch/mips/lantiq/irq.o:/opt/build/owrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96/arch/mips/lantiq/irq.c:626: first defined here
mips-openwrt-linux-musl-ld: arch/mips/kernel/smp-mt.o: in function `ltq_eiu_get_irq':
/opt/build/owrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96/arch/mips/kernel/smp-mt.c:113: multiple definition of `ltq_eiu_get_irq'; arch/mips/lantiq/irq.o:/opt/build/owrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96/arch/mips/lantiq/irq.c:113: first defined here
mips-openwrt-linux-musl-ld: arch/mips/kernel/smp-mt.o: in function `arch_init_ipiirq':
/opt/build/owrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96/arch/mips/kernel/smp-mt.c:407: multiple definition of `arch_init_ipiirq'; arch/mips/lantiq/irq.o:/opt/build/owrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96/arch/mips/lantiq/irq.c:407: first defined here
mips-openwrt-linux-musl-ld: arch/mips/kernel/smp-mt.o: in function `icu_of_init':
/opt/build/owrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96/arch/mips/kernel/smp-mt.c:487: multiple definition of `icu_of_init'; arch/mips/lantiq/irq.o:/opt/build/owrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96/arch/mips/lantiq/irq.c:487: first defined here
mips-openwrt-linux-musl-ld: arch/mips/kernel/smp-mt.o: in function `plat_irq_dispatch':
/opt/build/owrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96/arch/mips/kernel/smp-mt.c:447: multiple definition of `plat_irq_dispatch'; arch/mips/lantiq/irq.o:/opt/build/owrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96/arch/mips/lantiq/irq.c:447: first defined here
mips-openwrt-linux-musl-ld: arch/mips/kernel/smp-mt.o: in function `get_c0_compare_int':
/opt/build/owrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96/arch/mips/kernel/smp-mt.c:633: multiple definition of `get_c0_compare_int'; arch/mips/lantiq/irq.o:/opt/build/owrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96/arch/mips/lantiq/irq.c:633: first defined here
mips-openwrt-linux-musl-ld: arch/mips/kernel/smp-mt.o: in function `arch_init_irq':
/opt/build/owrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96/arch/mips/kernel/smp-mt.c:642: multiple definition of `arch_init_irq'; arch/mips/lantiq/irq.o:/opt/build/owrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96/arch/mips/lantiq/irq.c:642: first defined here
make[5]: *** [vmlinux] Error 1
make[4]: *** [/opt/build/owrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96/.image] Error 2
make[3]: *** [install] Error 2
time: target/linux/install#70.82#22.53#94.29
make[2]: *** [target/linux/install] Error 2
make[1]: *** [/opt/build/owrt/staging_dir/target-mips_24kc_musl/stamp/.target_install] Error 2
make -r world: build failed. Please re-run make with -j1 V=s or V=sc for a higher verbosity level to see what's going on
/opt/build/owrt/include/toplevel.mk:216: die Regel für Ziel „world“ scheiterte
make: *** [world] Fehler 1
But i am 100% shure that the files are replaced by new like copy.
Can someone confirm the error ?
Applying /opt/build/openwrt-sb1-master/target/linux/lantiq/patches-4.14/0901-add-icu-smp-support.patch using plaintext:
(Stripping trailing CRs from patch; use --binary to disable.)
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- ./a/arch/mips/lantiq/irq.c 2019-01-30 02:20:35.739994259 +0100
|+++ ./b/arch/mips/lantiq/irq.c 2019-01-30 04:30:31.152538191 +0100
--------------------------
No file to patch. Skipping patch.
patch unexpectedly ends in middle of line
10 out of 10 hunks ignored
Patch failed! Please fix /opt/build/openwrt-sb1-master/target/linux/lantiq/patches-4.14/0901-add-icu-smp-support.patch!
Makefile:23: recipe for target '/opt/build/openwrt-sb1-master/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96/.prepared_f12eb2f9aed002097e49068404c55dea' failed
make[3]: *** [/opt/build/openwrt-sb1-master/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.96/.prepared_f12eb2f9aed002097e49068404c55dea] Error 1
make[3]: Leaving directory '/opt/build/openwrt-sb1-master/target/linux/lantiq'
Makefile:13: recipe for target 'prepare' failed
make[2]: *** [prepare] Error 2
make[2]: Leaving directory '/opt/build/openwrt-sb1-master/target/linux'
time: target/linux/prepare#41.75#16.02#160.44
target/Makefile:23: recipe for target 'target/linux/prepare' failed
make[1]: *** [target/linux/prepare] Error 2
make[1]: Leaving directory '/opt/build/openwrt-sb1-master'
/opt/build/openwrt-sb1-master/include/toplevel.mk:216: die Regel für Ziel „target/linux/prepare“ scheiterte
make: *** [target/linux/prepare] Fehler 2
irq.c
smp-mt.c
I guest it must be named a/arch/mips/lantiq/irq.c instead ./a/arch/mips/lantiq/irq.c
I fear there is a "./" to much.
But in the moment it does not make sense to make a build because the package postgres will not build and in consequence of that a lot of other needed packages are missed
Thank you for your efforts. I have a BT HomeHub 5a (xrx200 rev 1.2) and was keen to try your patches. I downloaded trunk this morning (kernel 4.14.96) and placed your patches (all 5 of them) in target/linux/lantiq/patches-4.14:
mac@mac-desktop:~/source/target/linux/lantiq/patches-4.14$ ls -al 09*
-rw-r--r-- 1 mac mac 8657 Jan 31 12:33 0901-add-icu-smp-support.patch
-rw-r--r-- 1 mac mac 432 Jan 31 12:33 0902-enable-external-irqs-for-second-vpe.patch
-rw-r--r-- 1 mac mac 921 Jan 31 12:34 0903-add-icu1-node-for-smp.patch
-rw-r--r-- 1 mac mac 26619 Jan 31 12:30 0904-backport-vanilla-eth-driver.patch
-rw-r--r-- 1 mac mac 545 Jan 31 12:31 0905-increase-dma-burst-size.patch
Sadly they failed to build:
Applying /home/mac/source/target/linux/lantiq/patches-4.14/0701-NET-lantiq-etop-of-mido.patch using plaintext:
patching file drivers/net/ethernet/lantiq_etop.c
Applying /home/mac/source/target/linux/lantiq/patches-4.14/0901-add-icu-smp-support.patch using plaintext:
patching file arch/mips/lantiq/irq.c
Hunk #1 FAILED at 49.
Hunk #2 succeeded at 62 with fuzz 2.
Hunk #3 FAILED at 120.
Hunk #4 FAILED at 131.
Hunk #5 FAILED at 143.
Hunk #6 FAILED at 197.
Hunk #7 succeeded at 242 with fuzz 2.
Hunk #8 FAILED at 280.
Hunk #9 FAILED at 300.
Hunk #10 FAILED at 344.
8 out of 10 hunks FAILED -- saving rejects to file arch/mips/lantiq/irq.c.rej
Patch failed! Please fix /home/mac/source/target/linux/lantiq/patches-4.14/0901-add-icu-smp-support.patch!
I downloaded current git https://github.com/openwrt/openwrt.git with last commit efa6b8b6b6463a406bbbff30839ef9c05d0daaac and it works OK. But by looking at your patch sizes, they are much bigger, did you click on "raw" or "download" button on linked webpage?
Did you changed the lantiq switch driver as well? Or only the IRQ Patches?
I tried to use all patches from the mailing list, but I can't get activated the wifi for example.
EDIT: Nevermind. I mixed up IRQ and How can we make the lantiq xrx200 devices faster. The latter one causes some problems ( My testing branch is located here ).
As if I'm deserting what I'm doing
But i guess no, but i must do a look into the vr9.dtsi
Unfortunately i have not build the wifi driver yet, because buildproblems.