diff --git a/build.sh b/build.sh index ea642ed6..ced3bf33 100755 --- a/build.sh +++ b/build.sh @@ -22,7 +22,6 @@ _get_repo() ( OMR_DIST=${OMR_DIST:-openmptcprouter} OMR_HOST=${OMR_HOST:-$(curl -sS ifconfig.co)} OMR_PORT=${OMR_PORT:-8000} -OMR_REPO=${OMR_REPO:-http://$OMR_HOST:$OMR_PORT/release/$OMR_KERNEL} OMR_KEEPBIN=${OMR_KEEPBIN:-no} OMR_IMG=${OMR_IMG:-yes} #OMR_UEFI=${OMR_UEFI:-yes} @@ -32,11 +31,14 @@ OMR_TARGET=${OMR_TARGET:-x86_64} OMR_TARGET_CONFIG="config-$OMR_TARGET" OMR_KERNEL=${OMR_KERNEL:-5.4} #OMR_RELEASE=${OMR_RELEASE:-$(git describe --tags `git rev-list --tags --max-count=1` | sed 's/^\([0-9.]*\).*/\1/')} -OMR_RELEASE=${OMR_RELEASE:-$(git describe --tags `git rev-list --tags --max-count=1`)} +OMR_RELEASE=${OMR_RELEASE:-$(git tag --sort=committerdate | tail -1)} +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_SRC="${OMR_FEED_SRC:-develop}" +CUSTOM_FEED_URL="${CUSTOM_FEED_URL}" + OMR_OPENWRT=${OMR_OPENWRT:-default} if [ ! -f "$OMR_TARGET_CONFIG" ]; then @@ -56,6 +58,10 @@ elif [ "$OMR_TARGET" = "wrt32x" ]; then OMR_REAL_TARGET="arm_cortex-a9_vfpv3" elif [ "$OMR_TARGET" = "bpi-r2" ]; then OMR_REAL_TARGET="arm_cortex-a7_neon-vfpv4" +elif [ "$OMR_TARGET" = "bpi-r64" ]; then + OMR_REAL_TARGET="aarch64_cortex-a53" +elif [ "$OMR_TARGET" = "espressobin" ]; then + OMR_REAL_TARGET="aarch64_cortex-a53" elif [ "$OMR_TARGET" = "x86" ]; then OMR_REAL_TARGET="i386_pentium4" else @@ -64,9 +70,9 @@ fi #_get_repo source https://github.com/ysurac/openmptcprouter-source "master" if [ "$OMR_OPENWRT" = "default" ]; then - _get_repo "$OMR_TARGET/source" https://github.com/openwrt/openwrt "635f111148c3f7ccb0ecc92863a3b1a142f6ebeb" - _get_repo feeds/packages https://github.com/openwrt/packages "c7dca50f110d5458ceff21a2274eddae2aae119b" - _get_repo feeds/luci https://github.com/openwrt/luci "558525783cf33a986efa33d23f5283b33a6c936e" + _get_repo "$OMR_TARGET/source" https://github.com/openwrt/openwrt "da986035973a8c803e6f193ae502ff65e6d551c3" + _get_repo feeds/packages https://github.com/openwrt/packages "91bf524845d4733c77c11f359b1c915e788ece14" + _get_repo feeds/luci https://github.com/openwrt/luci "b2fa7903ebfdbe9f485a94710b77320fe7897dba" elif [ "$OMR_OPENWRT" = "master" ]; then _get_repo "$OMR_TARGET/source" https://github.com/openwrt/openwrt "master" _get_repo feeds/packages https://github.com/openwrt/packages "master" @@ -82,6 +88,11 @@ if [ -z "$OMR_FEED" ]; then _get_repo "$OMR_FEED" "$OMR_FEED_URL" "$OMR_FEED_SRC" fi +if [ -n "$CUSTOM_FEED_URL" ]; then + CUSTOM_FEED=feeds/${OMR_DIST} + _get_repo "$CUSTOM_FEED" "$CUSTOM_FEED_URL" "master" +fi + if [ -n "$1" ] && [ -f "$OMR_FEED/$1/Makefile" ]; then OMR_DIST=$1 shift 1 @@ -110,6 +121,10 @@ src-link luci $(readlink -f feeds/luci) src-link openmptcprouter $(readlink -f "$OMR_FEED") EOF +if [ -n "$CUSTOM_FEED" ]; then + echo "src-link ${OMR_DIST} $(readlink -f ${CUSTOM_FEED})" >> "$OMR_TARGET/source/feeds.conf" +fi + if [ "$OMR_DIST" = "openmptcprouter" ]; then cat > "$OMR_TARGET/source/package/system/opkg/files/customfeeds.conf" <<-EOF src/gz openwrt_luci http://packages.openmptcprouter.com/${OMR_RELEASE}/${OMR_REAL_TARGET}/luci @@ -142,7 +157,6 @@ if [ -f "$OMR_TARGET_CONFIG" ]; then CONFIG_VERSION_DIST="$OMR_DIST" CONFIG_VERSION_REPO="$OMR_REPO" CONFIG_VERSION_NUMBER="$(git -C "$OMR_FEED" describe --tag --always)" - CONFIG_PACKAGE_${OMR_DIST}-full=y EOF else cat config -> "$OMR_TARGET/source/.config" <<-EOF @@ -151,7 +165,6 @@ else CONFIG_VERSION_DIST="$OMR_DIST" CONFIG_VERSION_REPO="$OMR_REPO" CONFIG_VERSION_NUMBER="$(git -C "$OMR_FEED" describe --tag --always)" - CONFIG_PACKAGE_${OMR_DIST}-full=y EOF fi if [ "$OMR_ALL_PACKAGES" = "yes" ]; then @@ -165,10 +178,10 @@ if [ "$OMR_IMG" = "yes" ] && [ "$OMR_TARGET" = "x86_64" ]; then fi if [ "$OMR_PACKAGES" = "full" ]; then - echo 'CONFIG_PACKAGE_${OMR_DIST}-full=y' >> "$OMR_TARGET/source/.config" + echo "CONFIG_PACKAGE_${OMR_DIST}-full=y" >> "$OMR_TARGET/source/.config" fi if [ "$OMR_PACKAGES" = "mini" ]; then - echo 'CONFIG_PACKAGE_${OMR_DIST}-mini=y' >> "$OMR_TARGET/source/.config" + echo "CONFIG_PACKAGE_${OMR_DIST}-mini=y" >> "$OMR_TARGET/source/.config" fi cd "$OMR_TARGET/source" @@ -270,10 +283,7 @@ if [ "$OMR_KERNEL" = "5.4" ]; then echo "Done" fi -# Remove patch that can make BPI-R2 slow -rm -rf target/linux/mediatek/patches-4.14/0027-*.patch - -rm -rf feeds/packages/libs/libwebp +#rm -rf feeds/packages/libs/libwebp echo "Update feeds index" rm -rf feeds/luci/modules/luci-mod-network @@ -295,7 +305,12 @@ if [ "$OMR_ALL_PACKAGES" = "yes" ]; then scripts/feeds install -a -d m -p packages scripts/feeds install -a -d m -p luci fi -scripts/feeds install -a -d y -f -p openmptcprouter +if [ -n "$CUSTOM_FEED" ]; then + scripts/feeds install -a -d m -p openmptcprouter + scripts/feeds install -a -d y -f -p ${OMR_DIST} +else + scripts/feeds install -a -d y -f -p openmptcprouter +fi cp .config.keep .config echo "Done" diff --git a/config b/config index 971e38db..ae512ee1 100644 --- a/config +++ b/config @@ -17,9 +17,9 @@ CONFIG_BUSYBOX_CONFIG_FEATURE_SEAMLESS_BZ2=y CONFIG_BUSYBOX_CONFIG_FEATURE_SHOW_THREADS=y CONFIG_BUSYBOX_CONFIG_FEATURE_STAT_FILESYSTEM=y CONFIG_BUSYBOX_CONFIG_FEATURE_STAT_FORMAT=y -CONFIG_BUSYBOX_CONFIG_FEATURE_TOP_DECIMALS=y -CONFIG_BUSYBOX_CONFIG_FEATURE_TOP_SMP_CPU=y -CONFIG_BUSYBOX_CONFIG_FEATURE_TOP_SMP_PROCESS=y +# CONFIG_BUSYBOX_CONFIG_FEATURE_TOP_DECIMALS is not set +# CONFIG_BUSYBOX_CONFIG_FEATURE_TOP_SMP_CPU is not set +# CONFIG_BUSYBOX_CONFIG_FEATURE_TOP_SMP_PROCESS is not set CONFIG_BUSYBOX_CONFIG_FEATURE_USE_TERMIOS=y CONFIG_BUSYBOX_CONFIG_FEATURE_VI_UNDO=y CONFIG_BUSYBOX_CONFIG_FEATURE_VI_UNDO_QUEUE=y @@ -218,7 +218,8 @@ CONFIG_LUCI_LANG_vi=y CONFIG_LUCI_LANG_de=y CONFIG_LUCI_LANG_no=y CONFIG_LUCI_LANG_ms=y -CONFIG_LUCI_LANG_zh-cn=y +CONFIG_LUCI_LANG_zh_Hans=y +CONFIG_LUCI_LANG_zh_Hant=y CONFIG_LUCI_LANG_ko=y CONFIG_LUCI_LANG_he=y CONFIG_LUCI_LANG_zh-tw=y @@ -228,10 +229,17 @@ CONFIG_LUCI_LANG_ru=y CONFIG_LUCI_LANG_el=y CONFIG_LUCI_LANG_ca=y CONFIG_LUCI_LANG_es=y -CONFIG_LUCI_LANG_pt-br=y +CONFIG_LUCI_LANG_pt_BR=y CONFIG_LUCI_LANG_cs=y CONFIG_LUCI_LANG_fr=y CONFIG_LUCI_LANG_it=y +CONFIG_LUCI_LANG_ar=y +CONFIG_LUCI_LANG_bg=y +CONFIG_LUCI_LANG_bn_BD=y +CONFIG_LUCI_LANG_fi=y +CONFIG_LUCI_LANG_hi=y +CONFIG_LUCI_LANG_mr=y +CONFIG_LUCI_LANG_nb_NO=y CONFIG_TARGET_ROOTFS_PARTSIZE=512 CONFIG_TARGET_KERNEL_PARTSIZE=64 CONFIG_OPENSSL_WITH_CHACHA_POLY1305=y diff --git a/config-bpi-r2 b/config-bpi-r2 index 08dac613..4022b63d 100644 --- a/config-bpi-r2 +++ b/config-bpi-r2 @@ -2,7 +2,7 @@ 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 is not set +CONFIG_TARGET_ROOTFS_SQUASHFS=y CONFIG_PACKAGE_kmod-cryptodev=y CONFIG_OPENSSL_HARDWARE_SUPPORT=y CONFIG_OPENSSL_ENGINE_CRYPTO=y diff --git a/config-espressobin b/config-espressobin new file mode 100644 index 00000000..b11d9a82 --- /dev/null +++ b/config-espressobin @@ -0,0 +1,7 @@ +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 diff --git a/root/package/boot/uboot-mediatek/Makefile b/root/package/boot/uboot-mediatek/Makefile deleted file mode 100644 index 150abe59..00000000 --- a/root/package/boot/uboot-mediatek/Makefile +++ /dev/null @@ -1,58 +0,0 @@ -# -# Copyright (C) 2013-2019 OpenWrt.org -# Copyright (C) 2019 Alexey Loukianov -# -# 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_VERSION:=2020.04 - -PKG_HASH:=fe732aaf037d9cc3c0909bad8362af366ae964bbdac6913a34081ff4ad565372 - -PKG_MAINTAINER:=Cristian Ciobanu - -include $(INCLUDE_DIR)/u-boot.mk -include $(INCLUDE_DIR)/package.mk - -define U-Boot/Default - BUILD_TARGET:=mediatek - UBOOT_IMAGE:=u-boot.bin - UENV:=default - HIDDEN:=1 -endef - -define U-Boot/mt7623n_bpir2 - BUILD_SUBTARGET:=mt7623 - NAME:=Bannana PI R2 (mt7623) - BUILD_DEVICES:=bpi_bananapi-r2 -endef - -UBOOT_TARGETS := \ - mt7623n_bpir2 - -UBOOT_CONFIGURE_VARS += USE_PRIVATE_LIBGCC=yes - -UBOOT_MAKE_FLAGS = \ - HOSTCC="$(HOSTCC)" \ - HOSTCFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS) -std=gnu11" \ - HOSTLDFLAGS="$(HOST_LDFLAGS)" - -define Build/Prepare - $(call Build/Prepare/Default) - $(CP) uEnv-$(UENV).txt ${PKG_BUILD_DIR}/uEnv.txt -endef - -define Build/InstallDev - $(INSTALL_DIR) $(STAGING_DIR_IMAGE) - $(CP) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)-uboot-mediatek.bin - $(CP) $(PKG_BUILD_DIR)/uEnv.txt $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)-uEnv.txt -endef - -define Package/u-boot/install/default -endef - -$(eval $(call BuildPackage/U-Boot)) diff --git a/root/package/boot/uboot-mediatek/patches/0001-defconfig-r2-Add-additional-U-boot-options-for-mt7623n.patch b/root/package/boot/uboot-mediatek/patches/0001-defconfig-r2-Add-additional-U-boot-options-for-mt7623n.patch deleted file mode 100644 index a6959594..00000000 --- a/root/package/boot/uboot-mediatek/patches/0001-defconfig-r2-Add-additional-U-boot-options-for-mt7623n.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 075db54b57761868cd63434b466fffe7ba7a564f Mon Sep 17 00:00:00 2001 -From: Cristian Ciobanu -Date: Thu, 9 Apr 2020 17:59:27 +0300 -Subject: [PATCH] defconfig: r2: Add additional U-boot options for mt7623n - ---- - configs/mt7623n_bpir2_defconfig | 30 ++++++++++++++++++++++++++++-- - 1 file changed, 28 insertions(+), 2 deletions(-) - -diff --git a/configs/mt7623n_bpir2_defconfig b/configs/mt7623n_bpir2_defconfig -index 07ddade76a..36a903cbe7 100644 ---- a/configs/mt7623n_bpir2_defconfig -+++ b/configs/mt7623n_bpir2_defconfig -@@ -3,7 +3,7 @@ CONFIG_SYS_THUMB_BUILD=y - CONFIG_ARCH_MEDIATEK=y - CONFIG_SYS_TEXT_BASE=0x81e00000 - CONFIG_SYS_MALLOC_F_LEN=0x4000 --CONFIG_ENV_SIZE=0x1000 -+CONFIG_ENV_SIZE=0x2000 - CONFIG_ENV_OFFSET=0x100000 - CONFIG_TARGET_MT7623=y - CONFIG_NR_DRAM_BANKS=1 -@@ -14,7 +14,7 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y - CONFIG_DEFAULT_FDT_FILE="mt7623n-bananapi-bpi-r2" - # CONFIG_DISPLAY_BOARDINFO is not set - CONFIG_HUSH_PARSER=y --CONFIG_SYS_PROMPT="U-Boot> " -+CONFIG_SYS_PROMPT="BPI-R2> " - CONFIG_CMD_BOOTMENU=y - # CONFIG_CMD_ELF is not set - # CONFIG_CMD_XIMG is not set -@@ -57,3 +57,29 @@ CONFIG_MTK_TIMER=y - CONFIG_WDT_MTK=y - CONFIG_LZMA=y - # CONFIG_EFI_LOADER is not set -+ -+CONFIG_LOCALVERSION_AUTO=n -+CONFIG_USE_DEFAULT_ENV_FILE=y -+CONFIG_DEFAULT_ENV_FILE="uEnv.txt" -+CONFIG_CMD_BOOTZ=y -+CONFIG_OF_LIBFDT_OVERLAY=y -+ -+#commands used in uenv.txt -+CONFIG_CMD_ASKENV=y -+CONFIG_CMD_STRINGS=y -+CONFIG_CMD_SETEXPR=y -+CONFIG_CMD_CACHE=y -+CONFIG_CMD_ERASEENV=y -+CONFIG_PCI=y -+CONFIG_DM_PCI=y -+CONFIG_PCIE_MEDIATEK=y -+CONFIG_PHY=y -+CONFIG_PHY_MTK_TPHY=y -+CONFIG_CMD_PCI=y -+CONFIG_AHCI=y -+CONFIG_AHCI_PCI=y -+CONFIG_SCSI=y -+CONFIG_DM_SCSI=y -+CONFIG_SCSI_AHCI=y -+CONFIG_HAVE_BLOCK_DEVICE=y -+CONFIG_POWER_MT6323=y --- -2.25.1 - diff --git a/root/package/boot/uboot-mediatek/patches/0002-u-boot-modify-environment-offset-for-mt7623.patch b/root/package/boot/uboot-mediatek/patches/0002-u-boot-modify-environment-offset-for-mt7623.patch deleted file mode 100644 index 2f0e68a1..00000000 --- a/root/package/boot/uboot-mediatek/patches/0002-u-boot-modify-environment-offset-for-mt7623.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 15e032f5b06ba97a7777bc32aef15e10d0086041 Mon Sep 17 00:00:00 2001 -From: Cristian Ciobanu -Date: Wed, 8 Apr 2020 22:27:01 +0300 -Subject: [PATCH] u-boot: Modify environment offset for mt7623 - ---- - include/configs/mt7623.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/include/configs/mt7623.h b/include/configs/mt7623.h -index faab0913fc..5d0da71ce9 100644 ---- a/include/configs/mt7623.h -+++ b/include/configs/mt7623.h -@@ -56,5 +56,6 @@ - #define CONFIG_SERVERIP 192.168.1.2 - - #define CONFIG_SYS_MMC_ENV_DEV 0 -+#define CONFIG_ENV_OFFSET 0xF3800 - - #endif --- -2.25.1 - diff --git a/root/package/boot/uboot-mediatek/patches/0003-bootmenu-added-key-input-1-9-a-f.patch b/root/package/boot/uboot-mediatek/patches/0003-bootmenu-added-key-input-1-9-a-f.patch deleted file mode 100644 index faa70ac6..00000000 --- a/root/package/boot/uboot-mediatek/patches/0003-bootmenu-added-key-input-1-9-a-f.patch +++ /dev/null @@ -1,219 +0,0 @@ -From 798f0fc54926093a074a9cbb011de833a0614c3a Mon Sep 17 00:00:00 2001 -From: Frank Wunderlich -Date: Fri, 28 Dec 2018 17:56:19 +0100 -Subject: [PATCH 1/2] bootmenu: added key-input (1-9,a-f) - ---- - cmd/bootmenu.c | 145 ++++++++++++++++++++++++++++++++----------------- - 1 file changed, 94 insertions(+), 51 deletions(-) - -diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c -index 3dc2c854ac..fd6ba6c8af 100644 ---- a/cmd/bootmenu.c -+++ b/cmd/bootmenu.c -@@ -40,7 +40,22 @@ struct bootmenu_data { - - enum bootmenu_key { - KEY_NONE = 0, -- KEY_UP, -+ KEY_1, -+ KEY_2, -+ KEY_3, -+ KEY_4, -+ KEY_5, -+ KEY_6, -+ KEY_7, -+ KEY_8, -+ KEY_9, -+ KEY_a, -+ KEY_b, -+ KEY_c, -+ KEY_d, -+ KEY_e, -+ KEY_f, -+ KEY_UP = 20, - KEY_DOWN, - KEY_SELECT, - }; -@@ -78,6 +93,23 @@ static void bootmenu_print_entry(void *data) - puts(ANSI_COLOR_RESET); - } - -+bool get_bootmenu_key(enum bootmenu_key *key, int c) -+{ -+ /* ANSI '1~9' - was pressed */ -+ if (c <= '9' && c >= '1' ) -+ { -+ *key = c-48; -+ return true; -+ }else -+ /* ANSI 'a~f' - was pressed */ -+ if (c <= 'f' && c >= 'a' ) -+ { -+ *key = c-87; -+ return true; -+ } -+ return false; -+} -+ - static void bootmenu_autoboot_loop(struct bootmenu_data *menu, - enum bootmenu_key *key, int *esc) - { -@@ -98,23 +130,23 @@ static void bootmenu_autoboot_loop(struct bootmenu_data *menu, - - menu->delay = -1; - c = getc(); -- -- switch (c) { -- case '\e': -- *esc = 1; -- *key = KEY_NONE; -- break; -- case '\r': -- *key = KEY_SELECT; -- break; -- default: -- *key = KEY_NONE; -- break; -+ if (!get_bootmenu_key(key,c)) -+ { -+ switch (c) { -+ case '\e': -+ *esc = 1; -+ *key = KEY_NONE; -+ break; -+ case '\r': -+ *key = KEY_SELECT; -+ break; -+ default: -+ *key = KEY_NONE; -+ break; -+ } - } -- - break; - } -- - if (menu->delay < 0) - break; - -@@ -141,47 +173,49 @@ static void bootmenu_loop(struct bootmenu_data *menu, - - c = getc(); - -- switch (*esc) { -- case 0: -- /* First char of ANSI escape sequence '\e' */ -- if (c == '\e') { -- *esc = 1; -- *key = KEY_NONE; -- } -- break; -- case 1: -- /* Second char of ANSI '[' */ -- if (c == '[') { -- *esc = 2; -- *key = KEY_NONE; -- } else { -- *esc = 0; -- } -- break; -- case 2: -- case 3: -- /* Third char of ANSI (number '1') - optional */ -- if (*esc == 2 && c == '1') { -- *esc = 3; -+ if (!get_bootmenu_key(key,c)) -+ { -+ switch (*esc) { -+ case 0: -+ /* First char of ANSI escape sequence '\e' */ -+ if (c == '\e') { -+ *esc = 1; -+ *key = KEY_NONE; -+ } -+ break; -+ case 1: -+ /* Second char of ANSI '[' */ -+ if (c == '[') { -+ *esc = 2; - *key = KEY_NONE; -+ } else { -+ *esc = 0; -+ } - break; -- } -+ case 2: -+ case 3: -+ /* Third char of ANSI (number '1') - optional */ -+ if (*esc == 2 && c == '1') { -+ *esc = 3; -+ *key = KEY_NONE; -+ break; -+ } - -- *esc = 0; -+ *esc = 0; - -- /* ANSI 'A' - key up was pressed */ -- if (c == 'A') -- *key = KEY_UP; -- /* ANSI 'B' - key down was pressed */ -- else if (c == 'B') -- *key = KEY_DOWN; -- /* other key was pressed */ -- else -- *key = KEY_NONE; -+ /* ANSI 'A' - key up was pressed */ -+ if (c == 'A') -+ *key = KEY_UP; -+ /* ANSI 'B' - key down was pressed */ -+ else if (c == 'B') -+ *key = KEY_DOWN; -+ /* other key was pressed */ -+ else -+ *key = KEY_NONE; - -- break; -+ break; -+ } - } -- - /* enter key was pressed */ - if (c == '\r') - *key = KEY_SELECT; -@@ -204,6 +238,14 @@ static char *bootmenu_choice_entry(void *data) - bootmenu_loop(menu, &key, &esc); - } - -+ if (key < KEY_UP && key > KEY_NONE) -+ { -+ menu->active = key-1; -+ return NULL; -+ } -+ else -+ { -+ - switch (key) { - case KEY_UP: - if (menu->active > 0) -@@ -223,6 +265,7 @@ static char *bootmenu_choice_entry(void *data) - default: - break; - } -+ } - } - - /* never happens */ -@@ -467,7 +510,7 @@ void menu_display_statusline(struct menu *m) - printf(ANSI_CURSOR_POSITION, menu->count + 5, 1); - puts(ANSI_CLEAR_LINE); - printf(ANSI_CURSOR_POSITION, menu->count + 6, 1); -- puts(" Press UP/DOWN to move, ENTER to select"); -+ puts(" Press UP/DOWN to move or Press 1~9,a~f to choose, ENTER to select"); - puts(ANSI_CLEAR_LINE_TO_END); - printf(ANSI_CURSOR_POSITION, menu->count + 7, 1); - puts(ANSI_CLEAR_LINE); --- -2.25.1 - diff --git a/root/package/boot/uboot-mediatek/patches/0004-Add-EXT4-support-in-U-boot.patch b/root/package/boot/uboot-mediatek/patches/0004-Add-EXT4-support-in-U-boot.patch deleted file mode 100644 index 3f1a024b..00000000 --- a/root/package/boot/uboot-mediatek/patches/0004-Add-EXT4-support-in-U-boot.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 39b0c824b56be1000844cedb5faba506b6b09b9b Mon Sep 17 00:00:00 2001 -From: Cristian Ciobanu -Date: Fri, 10 Apr 2020 00:41:42 +0300 -Subject: [PATCH] Add EXT4 support in U-boot - ---- - configs/mt7623n_bpir2_defconfig | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/configs/mt7623n_bpir2_defconfig b/configs/mt7623n_bpir2_defconfig -index 36a903cbe7..09b9b6f797 100644 ---- a/configs/mt7623n_bpir2_defconfig -+++ b/configs/mt7623n_bpir2_defconfig -@@ -83,3 +83,8 @@ CONFIG_DM_SCSI=y - CONFIG_SCSI_AHCI=y - CONFIG_HAVE_BLOCK_DEVICE=y - CONFIG_POWER_MT6323=y -+ -+CONFIG_CMD_EXT4=y -+CONFIG_CMD_EXT4_WRITE=y -+CONFIG_FS_EXT4=y -+CONFIG_EXT4_WRITE=y --- -2.25.1 - diff --git a/root/package/boot/uboot-mediatek/uEnv-default.txt b/root/package/boot/uboot-mediatek/uEnv-default.txt deleted file mode 100644 index 10373c46..00000000 --- a/root/package/boot/uboot-mediatek/uEnv-default.txt +++ /dev/null @@ -1,91 +0,0 @@ -scriptaddr=0x83000000 -device=mmc -bootenv=uEnv.txt -kernel=uImage -loadaddr=0x80200000 -#default bootargs will be overidden by buildargs -bootargs=console=ttyS2,115200 root=/dev/mmcblk1p2 rw rootwait ip=dhcp - -console=earlyprintk console=ttyS2,115200 console=tty1 fbcon=map:0 -roottmpl=${rootdev} rootfstype=ext4 rootwait -prepsetroot=setenv setroot setenv root ${roottmpl} -bootopts=vmalloc=496M debug=7 initcall_debug=0 -graphic=video=1920x1080 drm.debug=0x7 - -buildargs=setenv bootargs "console=${console} root=${root} ${bootopts} ${graphic}" - -checkenv=test -e ${device} ${partition} ${bootenv} -importenv=env import -t ${scriptaddr} ${filesize} -loadbootenv=if fatload ${device} ${partition} ${scriptaddr} ${bootenv};then run importenv;else echo "fatload (${bootenv}) failed";fi -resetenv=env default -a;printenv; - -# Here we assume that SD card id mmcblk1 and eMMC is mmcblk0 in linux. Swap them if your DTS define them in reverse order. -usesd=setenv partition 1:1; setenv rootdev /dev/mmcblk1p2; setenv bootdev SD; setenv swaproot 'run useemmc'; -useemmc=setenv partition 0:1; setenv rootdev /dev/mmcblk0p2; setenv bootdev eMMC; setenv swaproot 'run usesd'; - -checkbootedfrom=if itest.l *81dffff0 == 434d4d65 ; then setenv bootedfrom eMMC; else setenv bootedfrom SD; fi; - -checkroot=fatinfo ${device} ${partition} -checksd=fatinfo ${device} 1:1 -checkmmc=fatinfo ${device} 0:1 - -reportbootedfrom=echo "Preloader/U-Boot loaded from ${bootedfrom}."; run validroot || echo "Both SD and eMMC pt#1 are not FAT, falling back to U-Boot shell." -reportvalidroot=run validroot || echo "Both SD and eMMC pt#1 are not FAT, falling back to U-Boot shell." -reportrootswapwarn=if test "${bootedfrom}" != "${bootdev}" ; then echo "Warning: Partition 1 on ${bootedfrom} is not FAT, failing back to ${bootdev}"; fi; true; -reportbootdev=echo "Booting from ${bootdev}." -reportboot=run reportbootedfrom reportvalidroot reportrootswapwarn reportbootdev - -detectroot=run useemmc; run checkbootedfrom; if test "${bootedfrom}" == "SD"; then run usesd; fi; run validateroot; -validateroot=setenv validroot false; run checkroot || run swaproot; run checkroot && setenv validroot true || run swaproot; - -newboot=run prepsetroot; run setroot;run buildargs;printenv bootargs;fatload ${device} ${partition} ${loadaddr} ${kernel}; bootm - -reloadenv=run detectroot; if run validroot; then if run checkenv; then run loadbootenv; run detectroot; else echo uEnv.txt file not found on ${bootdev}; fi; fi; -reloadmenu=run reloadenv; run reportboot; if run validroot; then if run checkenv; then run loadbootenv; else echo uEnv.txt file not found on ${bootdev}; fi; bootmenu; fi; - -lskernel=ls ${device} ${partition}; -lsdtb=ls ${device} ${partition} dtb -askkernel=askenv kernelinput "enter uImage-name:"; -askdtb=askenv dtbinput "enter dtb-name:"; - -#bootmenu -boot0=run lskernel;run askkernel;if printenv kernelinput ;then setenv kernel ${kernelinput};run lsdtb;run askdtb;if printenv dtbinput ;then setenv fdt ${dtbinput};fi; run newboot2; fi; -boot1=run newboot; - -bootmenu_default=2 -bootmenu_0=1. Enter kernel-name to boot from SD/EMMC.=run boot0 -bootmenu_1=2. Boot kernel from TFTP.=run bootnet -bootmenu_2=3. Boot from SD/EMMC.=run boot1 -bootmenu_3=4. Boot from eMMC.=run useemmc; run boot1 -bootmenu_4=5. Boot from SD.=run usesd; run boot1 - -#Netboot -ipaddr=192.168.0.11 -netmask=255.255.255.0 -serverip=192.168.0.10 - -bootfile=uImage -netbootargs=console=ttyS2,115200 root=/dev/mmcblk1p2 rw rootwait -#ip=dhcp sets ip on eth0 instead of wan - -lstftp=tftp ${loadaddr} ${serverip}:files.lst;setexpr listend ${loadaddr} + ${filesize};mw.b ${listend} 00 2;strings ${loadaddr}; -#md.b ${loadaddr} 60; - -bootnet=run lstftp;run askkernel;if printenv kernelinput ;then setenv bootfile "${kernelinput}"; fi;printenv; setenv bootargs ${netbootargs};tftp ${loadaddr} ${bootfile};bootm - -#separate fdt+dto -dtaddr=0x83f00000 -fdt_high=0xffffffff - -loadfdt=fatload ${device} ${partition} ${dtaddr} dtb/${fdt} -loadkernel=echo "loading kernel ${kernel}...";fatload ${device} ${partition} ${loadaddr} ${kernel} - -loaddto=echo "loaddto:${dto}";fdt addr ${dtaddr};fdt resize 8192; setexpr fdtovaddr ${dtaddr} + F000;fatload ${device} ${partition} ${fdtovaddr} dtb/${dto} && fdt apply ${fdtovaddr} -loaddtolist=for dto in ${dtolist} ; do run loaddto ; done - -bootall=if printenv fdt; then run loadfdt; if printenv dtolist;then run loaddtolist;fi; bootm ${loadaddr} - ${dtaddr} ;else bootm; fi -newboot2=run prepsetroot; run setroot;run buildargs; printenv bootargs; run loadkernel; run bootall; - -#automatic reload from sd/emmc -bootdelay=0 -bootcmd=setenv bootdelay 3; run reloadmenu; diff --git a/root/package/boot/uboot-mtk-bpi-r2/Makefile b/root/package/boot/uboot-mtk-bpi-r2/Makefile deleted file mode 100644 index 622f6ca5..00000000 --- a/root/package/boot/uboot-mtk-bpi-r2/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -# -# Copyright (C) 2016 Gary Wang -# -# 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:=uboot-mtk-bpi-r2 -PKG_VERSION:=v1.0 -PKG_RELEASE:=1 -HOSTCPPFLAGS:="-I." -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/BPI-SINOVOIP/BPI-R2-LEDE-Uboot.git -PKG_SOURCE_VERSION:=b05a4e323e1fd8727fcfe32c35d562f12b88a23b - -PKG_LICENSE:=GPL-2.0 GPL-2.0+ -PKG_LICENSE_FILES:=Licenses/README - -PKG_MAINTAINER:=Gary Wang - -include $(INCLUDE_DIR)/u-boot.mk -include $(INCLUDE_DIR)/package.mk - -define U-Boot/bpi_r2 - BUILD_TARGET:=mediatek - NAME:=Mediatek Banana Pi R2 board - BUILD_DEVICES:=7623n-bananapi-bpi-r2 -endef - -UBOOT_TARGETS := \ - bpi_r2 - - -UBOOT_CONFIGURE_VARS += USE_PRIVATE_LIBGCC=yes - -define Build/InstallDev - $(INSTALL_DIR) $(STAGING_DIR_IMAGE) - $(CP) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/mtk-bpi-r2-uboot.bin - $(CP) $(PKG_BUILD_DIR)/bpi_r2_preloader/EMMC_PRELOADER_1600MHz.img $(STAGING_DIR_IMAGE)/mtk-bpi-r2-preloader-emmc.bin - $(CP) $(PKG_BUILD_DIR)/bpi_r2_preloader/SD_PRELOADER_1600MHz.img $(STAGING_DIR_IMAGE)/mtk-bpi-r2-preloader-sd.bin -endef - -define Package/u-boot/install/default -endef - -$(eval $(call BuildPackage/U-Boot)) diff --git a/root/package/boot/uboot-mtk-bpi-r2/patches/002-use-static-inline.patch b/root/package/boot/uboot-mtk-bpi-r2/patches/002-use-static-inline.patch deleted file mode 100644 index 2fc7bfbb..00000000 --- a/root/package/boot/uboot-mtk-bpi-r2/patches/002-use-static-inline.patch +++ /dev/null @@ -1,56 +0,0 @@ -Index: uboot-mtk-bpi-r2-v1.0/arch/arm/include/asm/io.h -=================================================================== ---- uboot-mtk-bpi-r2-v1.0.orig/arch/arm/include/asm/io.h -+++ uboot-mtk-bpi-r2-v1.0/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/root/package/boot/uboot-mtk-bpi-r2/patches/003-use-weak-in-board.patch b/root/package/boot/uboot-mtk-bpi-r2/patches/003-use-weak-in-board.patch deleted file mode 100644 index 2968a54f..00000000 --- a/root/package/boot/uboot-mtk-bpi-r2/patches/003-use-weak-in-board.patch +++ /dev/null @@ -1,38 +0,0 @@ -Index: uboot-mtk-bpi-r2-v1.0/arch/arm/lib/board.c -=================================================================== ---- uboot-mtk-bpi-r2-v1.0.orig/arch/arm/lib/board.c -+++ uboot-mtk-bpi-r2-v1.0/arch/arm/lib/board.c -@@ -69,24 +69,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) {} - - /* - ************************************************************************ diff --git a/root/package/boot/uboot-mtk-bpi-r2/patches/004-use-weak-in-main.patch b/root/package/boot/uboot-mtk-bpi-r2/patches/004-use-weak-in-main.patch deleted file mode 100644 index be731ae4..00000000 --- a/root/package/boot/uboot-mtk-bpi-r2/patches/004-use-weak-in-main.patch +++ /dev/null @@ -1,14 +0,0 @@ -Index: uboot-mtk-bpi-r2-v1.0/common/main.c -=================================================================== ---- uboot-mtk-bpi-r2-v1.0.orig/common/main.c -+++ uboot-mtk-bpi-r2-v1.0/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/root/package/boot/uboot-mtk-bpi-r2/patches/200-fix-dtc-header-guard.patch b/root/package/boot/uboot-mtk-bpi-r2/patches/200-fix-dtc-header-guard.patch deleted file mode 100644 index 88d914b1..00000000 --- a/root/package/boot/uboot-mtk-bpi-r2/patches/200-fix-dtc-header-guard.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- 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/root/package/boot/uboot-mtk-bpi-r2/patches/420-gcc-7-compiler.patch b/root/package/boot/uboot-mtk-bpi-r2/patches/420-gcc-7-compiler.patch deleted file mode 100644 index 09516296..00000000 --- a/root/package/boot/uboot-mtk-bpi-r2/patches/420-gcc-7-compiler.patch +++ /dev/null @@ -1,287 +0,0 @@ ---- /dev/null -+++ b/include/linux/compiler-gcc7.h -@@ -0,0 +1,284 @@ -+#ifndef __LINUX_COMPILER_H -+#error "Please don't include directly, include instead." -+#endif -+ -+/* -+ * Common definitions for all gcc versions go here. -+ */ -+#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 -+ * shouldn't recognize the original var, and make assumptions about it. -+ * -+ * This is needed because the C standard makes it undefined to do -+ * pointer arithmetic on "objects" outside their boundaries and the -+ * gcc optimizers assume this is the case. In particular they -+ * assume such arithmetic does not wrap. -+ * -+ * A miscompilation has been observed because of this on PPC. -+ * To work around it we hide the relationship of the pointer and the object -+ * using this macro. -+ * -+ * Versions of the ppc64 compiler before 4.1 had a bug where use of -+ * RELOC_HIDE could trash r30. The bug can be worked around by changing -+ * 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)); \ -+}) -+ -+/* 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(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])) -+#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) || \ -+ !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 -+#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 __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. -+ * -+ * 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)) noinline __noclone notrace -+ -+#define __noreturn __attribute__((noreturn)) -+ -+/* -+ * From the GCC manual: -+ * -+ * Many functions have no effects except the return value and their -+ * return value depends only on the parameters and/or global -+ * variables. Such a function can be subject to common subexpression -+ * elimination and loop optimization just as an arithmetic operator -+ * would be. -+ * [...] -+ */ -+#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)) -+#define __malloc __attribute__((__malloc__)) -+#endif -+ -+#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 -+ -+#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__, __optimize__("no-tracer"))) -+ -+#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 -+#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 diff --git a/root/package/boot/uboot-mtk-bpi-r2/patches/421-gcc-8-compiler.patch b/root/package/boot/uboot-mtk-bpi-r2/patches/421-gcc-8-compiler.patch deleted file mode 100644 index ab3a0171..00000000 --- a/root/package/boot/uboot-mtk-bpi-r2/patches/421-gcc-8-compiler.patch +++ /dev/null @@ -1,287 +0,0 @@ ---- /dev/null -+++ b/include/linux/compiler-gcc8.h -@@ -0,0 +1,284 @@ -+#ifndef __LINUX_COMPILER_H -+#error "Please don't include directly, include instead." -+#endif -+ -+/* -+ * Common definitions for all gcc versions go here. -+ */ -+#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 -+ * shouldn't recognize the original var, and make assumptions about it. -+ * -+ * This is needed because the C standard makes it undefined to do -+ * pointer arithmetic on "objects" outside their boundaries and the -+ * gcc optimizers assume this is the case. In particular they -+ * assume such arithmetic does not wrap. -+ * -+ * A miscompilation has been observed because of this on PPC. -+ * To work around it we hide the relationship of the pointer and the object -+ * using this macro. -+ * -+ * Versions of the ppc64 compiler before 4.1 had a bug where use of -+ * RELOC_HIDE could trash r30. The bug can be worked around by changing -+ * 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)); \ -+}) -+ -+/* 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(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])) -+#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) || \ -+ !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 -+#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 __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. -+ * -+ * 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)) noinline __noclone notrace -+ -+#define __noreturn __attribute__((noreturn)) -+ -+/* -+ * From the GCC manual: -+ * -+ * Many functions have no effects except the return value and their -+ * return value depends only on the parameters and/or global -+ * variables. Such a function can be subject to common subexpression -+ * elimination and loop optimization just as an arithmetic operator -+ * would be. -+ * [...] -+ */ -+#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)) -+#define __malloc __attribute__((__malloc__)) -+#endif -+ -+#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 -+ -+#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__, __optimize__("no-tracer"))) -+ -+#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 -+#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 diff --git a/root/package/firmware/ipq-wifi/Makefile b/root/package/firmware/ipq-wifi/Makefile new file mode 100644 index 00000000..4b0e29ec --- /dev/null +++ b/root/package/firmware/ipq-wifi/Makefile @@ -0,0 +1,119 @@ +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/version.mk + +PKG_NAME:=ipq-wifi +PKG_RELEASE:=1 +PKG_FLAGS:=nonshared + +include $(INCLUDE_DIR)/package.mk + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Compile +endef + +# Use ath10k-bdencoder from https://github.com/qca/qca-swiss-army-knife.git +# to generate the board-* files here. +# +# This is intended to be used on an interim basis until device-specific +# board data for new devices is available through the upstream compilation +# +# Please send a mail with your device-specific board files upstream. +# You can find instructions and examples on the linux-wireless wiki: +# + +ALLWIFIBOARDS:= \ + 8dev_habanero-dvk \ + aruba_ap-303 \ + avm_fritzrepeater-1200 \ + buffalo_wtr-m2133hp \ + cellc_rtl30vw \ + dlink_dap2610 \ + engenius_eap2200 \ + engenius_emd1 \ + engenius_emr3500 \ + ezviz_cs-w3-wd1200g-eup \ + glinet_gl-s1300 \ + linksys_ea8300 \ + p2w_r619c \ + mobipromo_cm520-79f \ + qxwlan_e2600ac + +ALLWIFIPACKAGES:=$(foreach BOARD,$(ALLWIFIBOARDS),ipq-wifi-$(BOARD)) + +define Package/ipq-wifi-default + SUBMENU:=ath10k Board-Specific Overrides + SECTION:=firmware + CATEGORY:=Firmware + DEPENDS:=@TARGET_ipq40xx + TITLE:=Custom Board +endef + +define ipq-wifi-install-one-to + $(INSTALL_DIR) $(2)/lib/firmware/ath10k/$(3)/ + $(INSTALL_DATA) $(1) $(2)/lib/firmware/ath10k/$(3)/board-2.bin +endef + +define ipq-wifi-install-one + $(if $(filter $(suffix $(1)),.QCA4019 .qca4019),\ + $(call ipq-wifi-install-one-to,$(1),$(2),QCA4019/hw1.0),\ + $(if $(filter $(suffix $(1)),.QCA9888 .qca9888),\ + $(call ipq-wifi-install-one-to,$(1),$(2),QCA9888/hw2.0),\ + $(if $(filter $(suffix $(1)),.QCA9984 .qca9984),\ + $(call ipq-wifi-install-one-to,$(1),$(2),QCA9984/hw1.0),\ + $(error Unrecognized board-file suffix '$(suffix $(1))' for '$(1)')\ + ))) + +endef +# Blank line required at end of above define due to foreach context + +define generate-ipq-wifi-package + define Package/ipq-wifi-$(1) + $(call Package/ipq-wifi-default) + TITLE:=board-2.bin Overrides for $(2) + CONFLICTS:=$(PREV_BOARD) + endef + + define Package/ipq-wifi-$(1)/description +The $(2) requires board-specific, reference ("cal") data +that is not yet present in the upstream wireless firmware distribution. + +This package supplies board-2.bin file(s) that, in the interim, +overwrite those supplied by the ath10k-firmware-* packages. + +This is package is only necessary for the $(2). + +Do not install it for any other device! + endef + + define Package/ipq-wifi-$(1)/install-overlay + $$$$(foreach IPQ_WIFI_BOARD_FILE,$$$$(wildcard board-$(1).*),\ + $$$$(call ipq-wifi-install-one,$$$$(IPQ_WIFI_BOARD_FILE),$$(1))) + endef + + PREV_BOARD+=ipq-wifi-$(1) +endef + +# Add board name to ALLWIFIBOARDS +# Place files in this directory as board-. +# Add $(eval $(call generate-ipq-wifi-package,,)) + +$(eval $(call generate-ipq-wifi-package,8dev_habanero-dvk,8devices Habanero DVK)) +$(eval $(call generate-ipq-wifi-package,aruba_ap-303,Aruba AP-303)) +$(eval $(call generate-ipq-wifi-package,avm_fritzrepeater-1200,AVM FRITZRepeater 1200)) +$(eval $(call generate-ipq-wifi-package,buffalo_wtr-m2133hp,Buffalo WTR-M2133HP)) +$(eval $(call generate-ipq-wifi-package,cellc_rtl30vw, Cell C RTL30VW)) +$(eval $(call generate-ipq-wifi-package,dlink_dap2610,D-Link DAP-2610)) +$(eval $(call generate-ipq-wifi-package,engenius_eap2200,EnGenius EAP2200)) +$(eval $(call generate-ipq-wifi-package,engenius_emd1,EnGenius EMD1)) +$(eval $(call generate-ipq-wifi-package,engenius_emr3500,EnGenius EMR3500)) +$(eval $(call generate-ipq-wifi-package,ezviz_cs-w3-wd1200g-eup,EZVIZ CS-W3-WD1200G EUP)) +$(eval $(call generate-ipq-wifi-package,glinet_gl-s1300,GL.iNet GL-S1300)) +$(eval $(call generate-ipq-wifi-package,linksys_ea8300,Linksys EA8300)) +$(eval $(call generate-ipq-wifi-package,mobipromo_cm520-79f,MobiPromo CM520-79F)) +$(eval $(call generate-ipq-wifi-package,qxwlan_e2600ac,Qxwlan E2600AC)) +$(eval $(call generate-ipq-wifi-package,p2w_r619ac,PW R619AC)) + +$(foreach PACKAGE,$(ALLWIFIPACKAGES),$(eval $(call BuildPackage,$(PACKAGE)))) diff --git a/root/package/firmware/ipq-wifi/board-p2w_r619ac.qca4019 b/root/package/firmware/ipq-wifi/board-p2w_r619ac.qca4019 new file mode 100644 index 00000000..a1b1166f Binary files /dev/null and b/root/package/firmware/ipq-wifi/board-p2w_r619ac.qca4019 differ diff --git a/root/package/kernel/mt7623-preloader/Makefile b/root/package/kernel/mt7623-preloader/Makefile deleted file mode 100644 index d3f752bb..00000000 --- a/root/package/kernel/mt7623-preloader/Makefile +++ /dev/null @@ -1,65 +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 -#include $(INCLUDE_DIR)/image.mk - -PKG_NAME:=mt7623n-preloader -PKG_VERSION:=2019-10-24 -PKG_RELEASE:=1b7b6039b9d92c48193f38ac29dd2f71e303e280 - -PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_RELEASE) - -PKG_FLAGS:=nonshared - -include $(INCLUDE_DIR)/package.mk - -BPI_PRELOADER_URL:=@GITHUB/BPI-SINOVOIP/BPI-files/$(PKG_RELEASE)/SD/100MB/ -BPI_PRELOADER_PREFIX:=bpi-preloader-$(PKG_RELEASE) - -define Download/BPI-R2-preloader-DDR1600-20191024-2k.img.gz - FILE:=$(BPI_PRELOADER_PREFIX)-BPI-R2-preloader-DDR1600-20191024-2k.img.gz - URL:=$(BPI_PRELOADER_URL) - URL_FILE:=BPI-R2-preloader-DDR1600-20191024-2k.img.gz - HASH:=c731cc166c912c84846e2ed5faf727504e4dec1463754baa6328e9908c84a373 -endef -$(eval $(call Download,BPI-R2-preloader-DDR1600-20191024-2k.img.gz)) - - -define Package/mt7623n-preloader - SECTION:=boot - CATEGORY:=Boot Loaders - DEPENDS:=@TARGET_mediatek_mt7623 - TITLE:=mt7623n-preloader - DEFAULT:=y if TARGET_mediatek -endef - -define Package/mt7623n-preloader/description - Preloader image for mt7623n based boards like Bannana Pi R2. -endef - -define Build/Prepare - rm -rf $(PKG_BUILD_DIR) - mkdir -p $(PKG_BUILD_DIR) - cp $(DL_DIR)/$(BPI_PRELOADER_PREFIX)-BPI-R2-preloader-DDR1600-20191024-2k.img.gz $(PKG_BUILD_DIR)/bpi-r2-preloader.bin.gz -endef - -define Build/Compile - true -endef - -define Package/brcm2708-gpu-fw/install - true -endef - -define Build/InstallDev - mkdir -p $(STAGING_DIR_IMAGE) - gunzip -c $(PKG_BUILD_DIR)/bpi-r2-preloader.bin.gz > $(STAGING_DIR_IMAGE)/bpi-r2-preloader.bin -endef - -$(eval $(call BuildPackage,mt7623n-preloader)) \ No newline at end of file diff --git a/root/target/linux/generic/hack-5.4/690-mptcp_trunk.patch b/root/target/linux/generic/hack-5.4/690-mptcp_trunk.patch index af8944c8..61b5df80 100644 --- a/root/target/linux/generic/hack-5.4/690-mptcp_trunk.patch +++ b/root/target/linux/generic/hack-5.4/690-mptcp_trunk.patch @@ -1,6 +1,6 @@ diff -aurN linux-5.4/Documentation/admin-guide/kernel-parameters.txt mptcp-mptcp_trunk/Documentation/admin-guide/kernel-parameters.txt --- linux-5.4/Documentation/admin-guide/kernel-parameters.txt 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/Documentation/admin-guide/kernel-parameters.txt 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/Documentation/admin-guide/kernel-parameters.txt 2020-07-14 19:34:59.000000000 +0200 @@ -2724,6 +2724,10 @@ allocations which rules out almost all kernel allocations. Use with caution! @@ -14,7 +14,7 @@ diff -aurN linux-5.4/Documentation/admin-guide/kernel-parameters.txt mptcp-mptcp diff -aurN linux-5.4/Documentation/networking/ip-sysctl.txt mptcp-mptcp_trunk/Documentation/networking/ip-sysctl.txt --- linux-5.4/Documentation/networking/ip-sysctl.txt 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/Documentation/networking/ip-sysctl.txt 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/Documentation/networking/ip-sysctl.txt 2020-07-14 19:34:59.000000000 +0200 @@ -818,6 +818,18 @@ Default: 0 (disabled) @@ -36,7 +36,7 @@ diff -aurN linux-5.4/Documentation/networking/ip-sysctl.txt mptcp-mptcp_trunk/Do udp_l3mdev_accept - BOOLEAN diff -aurN linux-5.4/drivers/infiniband/hw/cxgb4/cm.c mptcp-mptcp_trunk/drivers/infiniband/hw/cxgb4/cm.c --- linux-5.4/drivers/infiniband/hw/cxgb4/cm.c 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/drivers/infiniband/hw/cxgb4/cm.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/drivers/infiniband/hw/cxgb4/cm.c 2020-07-14 19:34:59.000000000 +0200 @@ -3946,7 +3946,7 @@ */ memset(&tmp_opt, 0, sizeof(tmp_opt)); @@ -48,7 +48,7 @@ diff -aurN linux-5.4/drivers/infiniband/hw/cxgb4/cm.c mptcp-mptcp_trunk/drivers/ memset(req, 0, sizeof(*req)); diff -aurN linux-5.4/include/linux/skbuff.h mptcp-mptcp_trunk/include/linux/skbuff.h --- linux-5.4/include/linux/skbuff.h 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/include/linux/skbuff.h 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/include/linux/skbuff.h 2020-07-14 19:34:59.000000000 +0200 @@ -717,7 +717,7 @@ * want to keep them across layers you have to do a skb_clone() * first. This is owned by whoever has the skb queued ATM. @@ -60,7 +60,7 @@ diff -aurN linux-5.4/include/linux/skbuff.h mptcp-mptcp_trunk/include/linux/skbu struct { diff -aurN linux-5.4/include/linux/tcp.h mptcp-mptcp_trunk/include/linux/tcp.h --- linux-5.4/include/linux/tcp.h 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/include/linux/tcp.h 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/include/linux/tcp.h 2020-07-14 19:34:59.000000000 +0200 @@ -54,7 +54,7 @@ /* TCP Fast Open */ #define TCP_FASTOPEN_COOKIE_MIN 4 /* Min Fast Open Cookie size in bytes */ @@ -219,7 +219,7 @@ diff -aurN linux-5.4/include/linux/tcp.h mptcp-mptcp_trunk/include/linux/tcp.h static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk) diff -aurN linux-5.4/include/net/inet_common.h mptcp-mptcp_trunk/include/net/inet_common.h --- linux-5.4/include/net/inet_common.h 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/include/net/inet_common.h 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/include/net/inet_common.h 2020-07-14 19:34:59.000000000 +0200 @@ -2,6 +2,7 @@ #ifndef _INET_COMMON_H #define _INET_COMMON_H @@ -239,7 +239,7 @@ diff -aurN linux-5.4/include/net/inet_common.h mptcp-mptcp_trunk/include/net/ine int addr_len, int flags); diff -aurN linux-5.4/include/net/inet_connection_sock.h mptcp-mptcp_trunk/include/net/inet_connection_sock.h --- linux-5.4/include/net/inet_connection_sock.h 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/include/net/inet_connection_sock.h 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/include/net/inet_connection_sock.h 2020-07-14 19:34:59.000000000 +0200 @@ -25,6 +25,7 @@ struct inet_bind_bucket; @@ -250,7 +250,7 @@ diff -aurN linux-5.4/include/net/inet_connection_sock.h mptcp-mptcp_trunk/includ * Pointers to address related TCP functions diff -aurN linux-5.4/include/net/inet_sock.h mptcp-mptcp_trunk/include/net/inet_sock.h --- linux-5.4/include/net/inet_sock.h 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/include/net/inet_sock.h 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/include/net/inet_sock.h 2020-07-14 19:34:59.000000000 +0200 @@ -79,7 +79,7 @@ #define ireq_state req.__req_common.skc_state #define ireq_family req.__req_common.skc_family @@ -271,8 +271,8 @@ diff -aurN linux-5.4/include/net/inet_sock.h mptcp-mptcp_trunk/include/net/inet_ union { diff -aurN linux-5.4/include/net/mptcp.h mptcp-mptcp_trunk/include/net/mptcp.h --- linux-5.4/include/net/mptcp.h 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/include/net/mptcp.h 2020-06-09 17:33:41.000000000 +0200 -@@ -0,0 +1,1545 @@ ++++ mptcp-mptcp_trunk/include/net/mptcp.h 2020-07-14 19:34:59.000000000 +0200 +@@ -0,0 +1,1571 @@ +/* + * MPTCP implementation + * @@ -964,7 +964,10 @@ diff -aurN linux-5.4/include/net/mptcp.h mptcp-mptcp_trunk/include/net/mptcp.h + return 4 + m->A * (4 + m->a * 4) + m->M * (10 + m->m * 4 + csum * 2); +} + -+#define MPTCP_SYSCTL 1 ++#define MPTCP_ENABLE 0x01 ++#define MPTCP_SOCKOPT 0x02 ++#define MPTCP_CLIENT_DISABLE 0x04 ++#define MPTCP_SERVER_DISABLE 0x08 + +extern int sysctl_mptcp_enabled; +extern int sysctl_mptcp_version; @@ -1000,6 +1003,7 @@ diff -aurN linux-5.4/include/net/mptcp.h mptcp-mptcp_trunk/include/net/mptcp.h + mptcp_for_each_bit_set(~b, i) + +#define MPTCP_INC_STATS(net, field) SNMP_INC_STATS((net)->mptcp.mptcp_statistics, field) ++#define MPTCP_DEC_STATS(net, field) SNMP_DEC_STATS((net)->mptcp.mptcp_statistics, field) +#define MPTCP_INC_STATS_BH(net, field) __SNMP_INC_STATS((net)->mptcp.mptcp_statistics, field) + +enum @@ -1045,6 +1049,8 @@ diff -aurN linux-5.4/include/net/mptcp.h mptcp-mptcp_trunk/include/net/mptcp.h + MPTCP_MIB_ADDADDRTX, /* Sent an ADD_ADDR */ + MPTCP_MIB_REMADDRRX, /* Received a REMOVE_ADDR */ + MPTCP_MIB_REMADDRTX, /* Sent a REMOVE_ADDR */ ++ MPTCP_MIB_JOINALTERNATEPORT, /* Established a subflow on a different destination port-number */ ++ MPTCP_MIB_CURRESTAB, /* Current established MPTCP connections */ + __MPTCP_MIB_MAX +}; + @@ -1224,7 +1230,25 @@ diff -aurN linux-5.4/include/net/mptcp.h mptcp-mptcp_trunk/include/net/mptcp.h +/* Initializes function-pointers and MPTCP-flags */ +static inline void mptcp_init_tcp_sock(struct sock *sk) +{ -+ if (!mptcp_init_failed && sysctl_mptcp_enabled == MPTCP_SYSCTL) ++ if (!mptcp_init_failed && sysctl_mptcp_enabled == MPTCP_ENABLE) ++ mptcp_enable_sock(sk); ++} ++ ++static inline void mptcp_init_listen(struct sock *sk) ++{ ++ if (!mptcp_init_failed && ++ sk->sk_type == SOCK_STREAM && sk->sk_protocol == IPPROTO_TCP && ++ sysctl_mptcp_enabled & MPTCP_ENABLE && ++ !(sysctl_mptcp_enabled & MPTCP_SERVER_DISABLE)) ++ mptcp_enable_sock(sk); ++} ++ ++static inline void mptcp_init_connect(struct sock *sk) ++{ ++ if (!mptcp_init_failed && ++ sk->sk_type == SOCK_STREAM && sk->sk_protocol == IPPROTO_TCP && ++ sysctl_mptcp_enabled & MPTCP_ENABLE && ++ !(sysctl_mptcp_enabled & MPTCP_CLIENT_DISABLE)) + mptcp_enable_sock(sk); +} + @@ -1800,6 +1824,8 @@ diff -aurN linux-5.4/include/net/mptcp.h mptcp-mptcp_trunk/include/net/mptcp.h +static inline void mptcp_remove_shortcuts(const struct mptcp_cb *mpcb, + const struct sk_buff *skb) {} +static inline void mptcp_init_tcp_sock(struct sock *sk) {} ++static inline void mptcp_init_listen(struct sock *sk) {} ++static inline void mptcp_init_connect(struct sock *sk) {} +static inline void mptcp_disable_static_key(void) {} +static inline void mptcp_cookies_reqsk_init(struct request_sock *req, + struct mptcp_options_received *mopt, @@ -1820,7 +1846,7 @@ diff -aurN linux-5.4/include/net/mptcp.h mptcp-mptcp_trunk/include/net/mptcp.h +#endif /* _MPTCP_H */ diff -aurN linux-5.4/include/net/mptcp_v4.h mptcp-mptcp_trunk/include/net/mptcp_v4.h --- linux-5.4/include/net/mptcp_v4.h 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/include/net/mptcp_v4.h 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/include/net/mptcp_v4.h 2020-07-14 19:34:59.000000000 +0200 @@ -0,0 +1,76 @@ +/* + * MPTCP implementation @@ -1900,7 +1926,7 @@ diff -aurN linux-5.4/include/net/mptcp_v4.h mptcp-mptcp_trunk/include/net/mptcp_ +#endif /* MPTCP_V4_H_ */ diff -aurN linux-5.4/include/net/mptcp_v6.h mptcp-mptcp_trunk/include/net/mptcp_v6.h --- linux-5.4/include/net/mptcp_v6.h 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/include/net/mptcp_v6.h 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/include/net/mptcp_v6.h 2020-07-14 19:34:59.000000000 +0200 @@ -0,0 +1,77 @@ +/* + * MPTCP implementation @@ -1981,7 +2007,7 @@ diff -aurN linux-5.4/include/net/mptcp_v6.h mptcp-mptcp_trunk/include/net/mptcp_ +#endif /* _MPTCP_V6_H */ diff -aurN linux-5.4/include/net/net_namespace.h mptcp-mptcp_trunk/include/net/net_namespace.h --- linux-5.4/include/net/net_namespace.h 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/include/net/net_namespace.h 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/include/net/net_namespace.h 2020-07-14 19:34:59.000000000 +0200 @@ -19,6 +19,7 @@ #include #include @@ -2002,7 +2028,7 @@ diff -aurN linux-5.4/include/net/net_namespace.h mptcp-mptcp_trunk/include/net/n #endif diff -aurN linux-5.4/include/net/netns/mptcp.h mptcp-mptcp_trunk/include/net/netns/mptcp.h --- linux-5.4/include/net/netns/mptcp.h 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/include/net/netns/mptcp.h 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/include/net/netns/mptcp.h 2020-07-14 19:34:59.000000000 +0200 @@ -0,0 +1,52 @@ +/* + * MPTCP implementation - MPTCP namespace @@ -2058,7 +2084,7 @@ diff -aurN linux-5.4/include/net/netns/mptcp.h mptcp-mptcp_trunk/include/net/net +#endif /* __NETNS_MPTCP_H__ */ diff -aurN linux-5.4/include/net/snmp.h mptcp-mptcp_trunk/include/net/snmp.h --- linux-5.4/include/net/snmp.h 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/include/net/snmp.h 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/include/net/snmp.h 2020-07-14 19:34:59.000000000 +0200 @@ -86,7 +86,6 @@ atomic_long_t mibs[ICMP6MSG_MIB_MAX]; }; @@ -2069,7 +2095,7 @@ diff -aurN linux-5.4/include/net/snmp.h mptcp-mptcp_trunk/include/net/snmp.h struct tcp_mib { diff -aurN linux-5.4/include/net/sock.h mptcp-mptcp_trunk/include/net/sock.h --- linux-5.4/include/net/sock.h 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/include/net/sock.h 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/include/net/sock.h 2020-07-14 19:34:59.000000000 +0200 @@ -814,6 +814,7 @@ SOCK_TXTIME, SOCK_XDP, /* XDP is attached */ @@ -2088,7 +2114,7 @@ diff -aurN linux-5.4/include/net/sock.h mptcp-mptcp_trunk/include/net/sock.h #ifdef CONFIG_PROC_FS diff -aurN linux-5.4/include/net/tcp.h mptcp-mptcp_trunk/include/net/tcp.h --- linux-5.4/include/net/tcp.h 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/include/net/tcp.h 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/include/net/tcp.h 2020-07-14 19:34:59.000000000 +0200 @@ -182,6 +182,7 @@ #define TCPOPT_SACK 5 /* SACK Block */ #define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */ @@ -2129,7 +2155,7 @@ diff -aurN linux-5.4/include/net/tcp.h mptcp-mptcp_trunk/include/net/tcp.h /* sysctl variables for tcp */ extern int sysctl_tcp_max_orphans; -@@ -310,6 +336,96 @@ +@@ -310,6 +336,97 @@ #define TCP_DEC_STATS(net, field) SNMP_DEC_STATS((net)->mib.tcp_statistics, field) #define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val) @@ -2203,6 +2229,7 @@ diff -aurN linux-5.4/include/net/tcp.h mptcp-mptcp_trunk/include/net/tcp.h +unsigned int tcp_xmit_size_goal(struct sock *sk, u32 mss_now, + int large_allowed); +u32 tcp_tso_acked(struct sock *sk, struct sk_buff *skb); ++void tcp_ack_tstamp(struct sock *sk, struct sk_buff *skb, u32 prior_snd_una); + +void skb_clone_fraglist(struct sk_buff *skb); + @@ -2226,7 +2253,7 @@ diff -aurN linux-5.4/include/net/tcp.h mptcp-mptcp_trunk/include/net/tcp.h void tcp_tasklet_init(void); int tcp_v4_err(struct sk_buff *skb, u32); -@@ -411,7 +527,9 @@ +@@ -411,7 +528,9 @@ #endif void tcp_parse_options(const struct net *net, const struct sk_buff *skb, struct tcp_options_received *opt_rx, @@ -2237,7 +2264,7 @@ diff -aurN linux-5.4/include/net/tcp.h mptcp-mptcp_trunk/include/net/tcp.h const u8 *tcp_parse_md5sig_option(const struct tcphdr *th); /* -@@ -430,6 +548,7 @@ +@@ -430,6 +549,7 @@ void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb); void tcp_v4_mtu_reduced(struct sock *sk); @@ -2245,7 +2272,7 @@ diff -aurN linux-5.4/include/net/tcp.h mptcp-mptcp_trunk/include/net/tcp.h void tcp_req_err(struct sock *sk, u32 seq, bool abort); int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb); struct sock *tcp_create_openreq_child(const struct sock *sk, -@@ -453,6 +572,7 @@ +@@ -453,6 +573,7 @@ struct request_sock *req, struct tcp_fastopen_cookie *foc, enum tcp_synack_type synack_type); @@ -2253,7 +2280,7 @@ diff -aurN linux-5.4/include/net/tcp.h mptcp-mptcp_trunk/include/net/tcp.h int tcp_disconnect(struct sock *sk, int flags); void tcp_finish_connect(struct sock *sk, struct sk_buff *skb); -@@ -462,6 +582,7 @@ +@@ -462,6 +583,7 @@ /* From syncookies.c */ struct sock *tcp_get_cookie_sock(struct sock *sk, struct sk_buff *skb, struct request_sock *req, @@ -2261,7 +2288,7 @@ diff -aurN linux-5.4/include/net/tcp.h mptcp-mptcp_trunk/include/net/tcp.h struct dst_entry *dst, u32 tsoff); int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th, u32 cookie); -@@ -536,7 +657,8 @@ +@@ -536,7 +658,8 @@ u32 __cookie_v4_init_sequence(const struct iphdr *iph, const struct tcphdr *th, u16 *mssp); @@ -2271,7 +2298,7 @@ diff -aurN linux-5.4/include/net/tcp.h mptcp-mptcp_trunk/include/net/tcp.h u64 cookie_init_timestamp(struct request_sock *req); bool cookie_timestamp_decode(const struct net *net, struct tcp_options_received *opt); -@@ -550,7 +672,8 @@ +@@ -550,7 +673,8 @@ u32 __cookie_v6_init_sequence(const struct ipv6hdr *iph, const struct tcphdr *th, u16 *mssp); @@ -2281,7 +2308,7 @@ diff -aurN linux-5.4/include/net/tcp.h mptcp-mptcp_trunk/include/net/tcp.h #endif /* tcp_output.c */ -@@ -586,10 +709,16 @@ +@@ -586,10 +710,16 @@ void tcp_skb_collapse_tstamp(struct sk_buff *skb, const struct sk_buff *next_skb); @@ -2298,7 +2325,7 @@ diff -aurN linux-5.4/include/net/tcp.h mptcp-mptcp_trunk/include/net/tcp.h void tcp_skb_mark_lost_uncond_verify(struct tcp_sock *tp, struct sk_buff *skb); void tcp_fin(struct sock *sk); -@@ -633,7 +762,7 @@ +@@ -633,7 +763,7 @@ } /* tcp.c */ @@ -2307,7 +2334,7 @@ diff -aurN linux-5.4/include/net/tcp.h mptcp-mptcp_trunk/include/net/tcp.h /* Read 'sendfile()'-style from a TCP socket */ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, -@@ -817,6 +946,12 @@ +@@ -817,6 +947,12 @@ u16 tcp_gso_size; }; }; @@ -2320,7 +2347,7 @@ diff -aurN linux-5.4/include/net/tcp.h mptcp-mptcp_trunk/include/net/tcp.h __u8 tcp_flags; /* TCP header flags. (tcp[13]) */ __u8 sacked; /* State flags for SACK. */ -@@ -835,6 +970,14 @@ +@@ -835,6 +971,14 @@ has_rxtstamp:1, /* SKB has a RX timestamp */ unused:5; __u32 ack_seq; /* Sequence number ACK'd */ @@ -2335,7 +2362,7 @@ diff -aurN linux-5.4/include/net/tcp.h mptcp-mptcp_trunk/include/net/tcp.h union { struct { /* There is space for up to 24 bytes */ -@@ -1076,6 +1219,8 @@ +@@ -1076,6 +1220,8 @@ int tcp_set_allowed_congestion_control(char *allowed); int tcp_set_congestion_control(struct sock *sk, const char *name, bool load, bool reinit, bool cap_net_admin); @@ -2344,7 +2371,7 @@ diff -aurN linux-5.4/include/net/tcp.h mptcp-mptcp_trunk/include/net/tcp.h u32 tcp_slow_start(struct tcp_sock *tp, u32 acked); void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w, u32 acked); -@@ -1377,6 +1522,19 @@ +@@ -1377,6 +1523,19 @@ space - (space>>tcp_adv_win_scale); } @@ -2364,7 +2391,7 @@ diff -aurN linux-5.4/include/net/tcp.h mptcp-mptcp_trunk/include/net/tcp.h /* Note: caller must be prepared to deal with negative returns */ static inline int tcp_space(const struct sock *sk) { -@@ -1949,6 +2107,30 @@ +@@ -1949,6 +2108,30 @@ #endif }; @@ -2395,7 +2422,7 @@ diff -aurN linux-5.4/include/net/tcp.h mptcp-mptcp_trunk/include/net/tcp.h struct tcp_request_sock_ops { u16 mss_clamp; #ifdef CONFIG_TCP_MD5SIG -@@ -1959,12 +2141,13 @@ +@@ -1959,12 +2142,13 @@ const struct sock *sk, const struct sk_buff *skb); #endif @@ -2414,7 +2441,7 @@ diff -aurN linux-5.4/include/net/tcp.h mptcp-mptcp_trunk/include/net/tcp.h #endif struct dst_entry *(*route_req)(const struct sock *sk, struct flowi *fl, const struct request_sock *req); -@@ -1978,15 +2161,17 @@ +@@ -1978,15 +2162,17 @@ #ifdef CONFIG_SYN_COOKIES static inline __u32 cookie_init_sequence(const struct tcp_request_sock_ops *ops, @@ -2435,7 +2462,7 @@ diff -aurN linux-5.4/include/net/tcp.h mptcp-mptcp_trunk/include/net/tcp.h { diff -aurN linux-5.4/include/net/tcp_states.h mptcp-mptcp_trunk/include/net/tcp_states.h --- linux-5.4/include/net/tcp_states.h 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/include/net/tcp_states.h 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/include/net/tcp_states.h 2020-07-14 19:34:59.000000000 +0200 @@ -22,6 +22,7 @@ TCP_LISTEN, TCP_CLOSING, /* Now a valid state */ @@ -2454,7 +2481,7 @@ diff -aurN linux-5.4/include/net/tcp_states.h mptcp-mptcp_trunk/include/net/tcp_ #endif /* _LINUX_TCP_STATES_H */ diff -aurN linux-5.4/include/net/transp_v6.h mptcp-mptcp_trunk/include/net/transp_v6.h --- linux-5.4/include/net/transp_v6.h 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/include/net/transp_v6.h 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/include/net/transp_v6.h 2020-07-14 19:34:59.000000000 +0200 @@ -58,6 +58,8 @@ /* address family specific functions */ @@ -2466,7 +2493,7 @@ diff -aurN linux-5.4/include/net/transp_v6.h mptcp-mptcp_trunk/include/net/trans diff -aurN linux-5.4/include/trace/events/tcp.h mptcp-mptcp_trunk/include/trace/events/tcp.h --- linux-5.4/include/trace/events/tcp.h 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/include/trace/events/tcp.h 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/include/trace/events/tcp.h 2020-07-14 19:34:59.000000000 +0200 @@ -10,6 +10,7 @@ #include #include @@ -2517,7 +2544,7 @@ diff -aurN linux-5.4/include/trace/events/tcp.h mptcp-mptcp_trunk/include/trace/ #endif /* _TRACE_TCP_H */ diff -aurN linux-5.4/include/uapi/linux/bpf.h mptcp-mptcp_trunk/include/uapi/linux/bpf.h --- linux-5.4/include/uapi/linux/bpf.h 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/include/uapi/linux/bpf.h 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/include/uapi/linux/bpf.h 2020-07-14 19:34:59.000000000 +0200 @@ -3438,6 +3438,7 @@ BPF_TCP_LISTEN, BPF_TCP_CLOSING, /* Now a valid state */ @@ -2528,7 +2555,7 @@ diff -aurN linux-5.4/include/uapi/linux/bpf.h mptcp-mptcp_trunk/include/uapi/lin }; diff -aurN linux-5.4/include/uapi/linux/if.h mptcp-mptcp_trunk/include/uapi/linux/if.h --- linux-5.4/include/uapi/linux/if.h 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/include/uapi/linux/if.h 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/include/uapi/linux/if.h 2020-07-14 19:34:59.000000000 +0200 @@ -132,6 +132,9 @@ #define IFF_ECHO IFF_ECHO #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */ @@ -2539,9 +2566,21 @@ diff -aurN linux-5.4/include/uapi/linux/if.h mptcp-mptcp_trunk/include/uapi/linu #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT) +diff -aurN linux-5.4/include/uapi/linux/in.h mptcp-mptcp_trunk/include/uapi/linux/in.h +--- linux-5.4/include/uapi/linux/in.h 2019-11-25 01:32:01.000000000 +0100 ++++ mptcp-mptcp_trunk/include/uapi/linux/in.h 2020-07-14 19:34:59.000000000 +0200 +@@ -76,6 +76,8 @@ + #define IPPROTO_MPLS IPPROTO_MPLS + IPPROTO_RAW = 255, /* Raw IP packets */ + #define IPPROTO_RAW IPPROTO_RAW ++ IPPROTO_MPTCP = 262, /* Multipath TCP connection */ ++#define IPPROTO_MPTCP IPPROTO_MPTCP + IPPROTO_MAX + }; + #endif diff -aurN linux-5.4/include/uapi/linux/mptcp.h mptcp-mptcp_trunk/include/uapi/linux/mptcp.h --- linux-5.4/include/uapi/linux/mptcp.h 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/include/uapi/linux/mptcp.h 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/include/uapi/linux/mptcp.h 2020-07-14 19:34:59.000000000 +0200 @@ -0,0 +1,149 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* @@ -2694,7 +2733,7 @@ diff -aurN linux-5.4/include/uapi/linux/mptcp.h mptcp-mptcp_trunk/include/uapi/l +#endif /* _LINUX_MPTCP_H */ diff -aurN linux-5.4/include/uapi/linux/tcp.h mptcp-mptcp_trunk/include/uapi/linux/tcp.h --- linux-5.4/include/uapi/linux/tcp.h 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/include/uapi/linux/tcp.h 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/include/uapi/linux/tcp.h 2020-07-14 19:34:59.000000000 +0200 @@ -18,9 +18,15 @@ #ifndef _UAPI_LINUX_TCP_H #define _UAPI_LINUX_TCP_H @@ -2782,7 +2821,7 @@ diff -aurN linux-5.4/include/uapi/linux/tcp.h mptcp-mptcp_trunk/include/uapi/lin diff -aurN linux-5.4/net/core/dev.c mptcp-mptcp_trunk/net/core/dev.c --- linux-5.4/net/core/dev.c 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/core/dev.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/core/dev.c 2020-07-14 19:34:59.000000000 +0200 @@ -7855,7 +7855,7 @@ dev->flags = (flags & (IFF_DEBUG | IFF_NOTRAILERS | IFF_NOARP | @@ -2794,7 +2833,7 @@ diff -aurN linux-5.4/net/core/dev.c mptcp-mptcp_trunk/net/core/dev.c diff -aurN linux-5.4/net/core/net-traces.c mptcp-mptcp_trunk/net/core/net-traces.c --- linux-5.4/net/core/net-traces.c 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/core/net-traces.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/core/net-traces.c 2020-07-14 19:34:59.000000000 +0200 @@ -60,3 +60,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(napi_poll); @@ -2803,7 +2842,7 @@ diff -aurN linux-5.4/net/core/net-traces.c mptcp-mptcp_trunk/net/core/net-traces +EXPORT_TRACEPOINT_SYMBOL_GPL(mptcp_retransmit); diff -aurN linux-5.4/net/core/skbuff.c mptcp-mptcp_trunk/net/core/skbuff.c --- linux-5.4/net/core/skbuff.c 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/core/skbuff.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/core/skbuff.c 2020-07-14 19:34:59.000000000 +0200 @@ -573,7 +573,7 @@ skb_drop_list(&skb_shinfo(skb)->frag_list); } @@ -2815,7 +2854,7 @@ diff -aurN linux-5.4/net/core/skbuff.c mptcp-mptcp_trunk/net/core/skbuff.c diff -aurN linux-5.4/net/core/sock.c mptcp-mptcp_trunk/net/core/sock.c --- linux-5.4/net/core/sock.c 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/core/sock.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/core/sock.c 2020-07-14 19:34:59.000000000 +0200 @@ -135,6 +135,11 @@ #include @@ -2867,17 +2906,15 @@ diff -aurN linux-5.4/net/core/sock.c mptcp-mptcp_trunk/net/core/sock.c } else sk = kmalloc(prot->obj_size, priority); -@@ -1832,6 +1858,7 @@ +@@ -1832,4 +1858,5 @@ atomic_set(&newsk->sk_zckey, 0); sock_reset_flag(newsk, SOCK_DONE); + sock_reset_flag(newsk, SOCK_MPTCP); - /* sk->sk_memcg will be populated at accept() time */ - diff -aurN linux-5.4/net/ipv4/af_inet.c mptcp-mptcp_trunk/net/ipv4/af_inet.c --- linux-5.4/net/ipv4/af_inet.c 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/ipv4/af_inet.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/ipv4/af_inet.c 2020-07-14 19:34:59.000000000 +0200 @@ -100,6 +100,7 @@ #include #include @@ -2896,7 +2933,16 @@ diff -aurN linux-5.4/net/ipv4/af_inet.c mptcp-mptcp_trunk/net/ipv4/af_inet.c WARN_ON(atomic_read(&sk->sk_rmem_alloc)); WARN_ON(refcount_read(&sk->sk_wmem_alloc)); WARN_ON(sk->sk_wmem_queued); -@@ -244,8 +248,7 @@ +@@ -227,6 +231,8 @@ + tcp_fastopen_init_key_once(sock_net(sk)); + } + ++ mptcp_init_listen(sk); ++ + err = inet_csk_listen_start(sk, backlog); + if (err) + goto out; +@@ -244,8 +250,7 @@ * Create an inet socket. */ @@ -2906,7 +2952,7 @@ diff -aurN linux-5.4/net/ipv4/af_inet.c mptcp-mptcp_trunk/net/ipv4/af_inet.c { struct sock *sk; struct inet_protosw *answer; -@@ -739,6 +742,24 @@ +@@ -739,6 +744,24 @@ lock_sock(sk2); sock_rps_record_flow(sk2); @@ -2931,7 +2977,7 @@ diff -aurN linux-5.4/net/ipv4/af_inet.c mptcp-mptcp_trunk/net/ipv4/af_inet.c WARN_ON(!((1 << sk2->sk_state) & (TCPF_ESTABLISHED | TCPF_SYN_RECV | TCPF_CLOSE_WAIT | TCPF_CLOSE))); -@@ -1974,6 +1995,9 @@ +@@ -1974,6 +1997,9 @@ ip_init(); @@ -2943,7 +2989,7 @@ diff -aurN linux-5.4/net/ipv4/af_inet.c mptcp-mptcp_trunk/net/ipv4/af_inet.c diff -aurN linux-5.4/net/ipv4/inet_connection_sock.c mptcp-mptcp_trunk/net/ipv4/inet_connection_sock.c --- linux-5.4/net/ipv4/inet_connection_sock.c 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/ipv4/inet_connection_sock.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/ipv4/inet_connection_sock.c 2020-07-14 19:34:59.000000000 +0200 @@ -19,6 +19,7 @@ #include #include @@ -3003,7 +3049,7 @@ diff -aurN linux-5.4/net/ipv4/inet_connection_sock.c mptcp-mptcp_trunk/net/ipv4/ cond_resched(); diff -aurN linux-5.4/net/ipv4/ip_sockglue.c mptcp-mptcp_trunk/net/ipv4/ip_sockglue.c --- linux-5.4/net/ipv4/ip_sockglue.c 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/ipv4/ip_sockglue.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/ipv4/ip_sockglue.c 2020-07-14 19:34:59.000000000 +0200 @@ -44,6 +44,8 @@ #endif #include @@ -3045,7 +3091,7 @@ diff -aurN linux-5.4/net/ipv4/ip_sockglue.c mptcp-mptcp_trunk/net/ipv4/ip_sockgl case IP_TTL: diff -aurN linux-5.4/net/ipv4/Kconfig mptcp-mptcp_trunk/net/ipv4/Kconfig --- linux-5.4/net/ipv4/Kconfig 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/ipv4/Kconfig 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/ipv4/Kconfig 2020-07-14 19:34:59.000000000 +0200 @@ -654,6 +654,51 @@ bufferbloat, policers, or AQM schemes that do not provide a delay signal. It requires the fq ("Fair Queue") pacing packet scheduler. @@ -3133,7 +3179,7 @@ diff -aurN linux-5.4/net/ipv4/Kconfig mptcp-mptcp_trunk/net/ipv4/Kconfig default "cdg" if DEFAULT_CDG diff -aurN linux-5.4/net/ipv4/syncookies.c mptcp-mptcp_trunk/net/ipv4/syncookies.c --- linux-5.4/net/ipv4/syncookies.c 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/ipv4/syncookies.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/ipv4/syncookies.c 2020-07-14 19:34:59.000000000 +0200 @@ -12,6 +12,8 @@ #include #include @@ -3261,7 +3307,7 @@ diff -aurN linux-5.4/net/ipv4/syncookies.c mptcp-mptcp_trunk/net/ipv4/syncookies */ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c --- linux-5.4/net/ipv4/tcp.c 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/ipv4/tcp.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/ipv4/tcp.c 2020-07-14 19:34:59.000000000 +0200 @@ -270,6 +270,7 @@ #include @@ -3488,7 +3534,33 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c release_sock(sk); -@@ -2287,7 +2367,7 @@ +@@ -2238,8 +2318,11 @@ + + switch (state) { + case TCP_ESTABLISHED: +- if (oldstate != TCP_ESTABLISHED) ++ if (oldstate != TCP_ESTABLISHED) { + TCP_INC_STATS(sock_net(sk), TCP_MIB_CURRESTAB); ++ if (is_meta_sk(sk)) ++ MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_CURRESTAB); ++ } + break; + + case TCP_CLOSE: +@@ -2252,8 +2335,11 @@ + inet_put_port(sk); + /* fall through */ + default: +- if (oldstate == TCP_ESTABLISHED) ++ if (oldstate == TCP_ESTABLISHED) { + TCP_DEC_STATS(sock_net(sk), TCP_MIB_CURRESTAB); ++ if (is_meta_sk(sk)) ++ MPTCP_DEC_STATS(sock_net(sk), MPTCP_MIB_CURRESTAB); ++ } + } + + /* Change state AFTER socket is unhashed to avoid closed +@@ -2287,7 +2373,7 @@ [TCP_NEW_SYN_RECV] = TCP_CLOSE, /* should not happen ! */ }; @@ -3497,7 +3569,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c { int next = (int)new_state[sk->sk_state]; int ns = next & TCP_STATE_MASK; -@@ -2317,7 +2397,7 @@ +@@ -2317,7 +2403,7 @@ TCPF_SYN_RECV | TCPF_CLOSE_WAIT)) { /* Clear out any half completed packets. FIN if needed. */ if (tcp_close_state(sk)) @@ -3506,7 +3578,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c } } EXPORT_SYMBOL(tcp_shutdown); -@@ -2342,6 +2422,17 @@ +@@ -2342,6 +2428,17 @@ int data_was_unread = 0; int state; @@ -3524,7 +3596,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c lock_sock(sk); sk->sk_shutdown = SHUTDOWN_MASK; -@@ -2386,7 +2477,7 @@ +@@ -2386,7 +2483,7 @@ /* Unread data was tossed, zap the connection. */ NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPABORTONCLOSE); tcp_set_state(sk, TCP_CLOSE); @@ -3533,7 +3605,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c } else if (sock_flag(sk, SOCK_LINGER) && !sk->sk_lingertime) { /* Check zero linger _after_ checking for unread data. */ sk->sk_prot->disconnect(sk, 0); -@@ -2460,7 +2551,7 @@ +@@ -2460,7 +2557,7 @@ struct tcp_sock *tp = tcp_sk(sk); if (tp->linger2 < 0) { tcp_set_state(sk, TCP_CLOSE); @@ -3542,7 +3614,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c __NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPABORTONLINGER); } else { -@@ -2470,7 +2561,8 @@ +@@ -2470,7 +2567,8 @@ inet_csk_reset_keepalive_timer(sk, tmo - TCP_TIMEWAIT_LEN); } else { @@ -3552,7 +3624,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c goto out; } } -@@ -2479,7 +2571,7 @@ +@@ -2479,7 +2577,7 @@ sk_mem_reclaim(sk); if (tcp_check_oom(sk, 0)) { tcp_set_state(sk, TCP_CLOSE); @@ -3561,7 +3633,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c __NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPABORTONMEMORY); } else if (!check_net(sock_net(sk))) { -@@ -2511,15 +2603,6 @@ +@@ -2511,15 +2609,6 @@ } EXPORT_SYMBOL(tcp_close); @@ -3577,7 +3649,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c static void tcp_rtx_queue_purge(struct sock *sk) { struct rb_node *p = rb_first(&sk->tcp_rtx_queue); -@@ -2540,6 +2623,10 @@ +@@ -2540,6 +2629,10 @@ { struct sk_buff *skb; @@ -3588,7 +3660,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c tcp_chrono_stop(sk, TCP_CHRONO_BUSY); while ((skb = __skb_dequeue(&sk->sk_write_queue)) != NULL) { tcp_skb_tsorted_anchor_cleanup(skb); -@@ -2558,6 +2645,29 @@ +@@ -2558,6 +2651,29 @@ inet_csk(sk)->icsk_backoff = 0; } @@ -3618,7 +3690,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c int tcp_disconnect(struct sock *sk, int flags) { struct inet_sock *inet = inet_sk(sk); -@@ -2580,7 +2690,7 @@ +@@ -2580,7 +2696,7 @@ /* The last check adjusts for discrepancy of Linux wrt. RFC * states */ @@ -3627,7 +3699,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c sk->sk_err = ECONNRESET; } else if (old_state == TCP_SYN_SENT) sk->sk_err = ECONNRESET; -@@ -2602,11 +2712,15 @@ +@@ -2602,11 +2718,15 @@ if (!(sk->sk_userlocks & SOCK_BINDADDR_LOCK)) inet_reset_saddr(sk); @@ -3646,7 +3718,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c seq = tp->write_seq + tp->max_window + 2; if (!seq) -@@ -2616,17 +2730,11 @@ +@@ -2616,20 +2736,14 @@ icsk->icsk_backoff = 0; tp->snd_cwnd = 2; icsk->icsk_probes_out = 0; @@ -3660,6 +3732,9 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c + + tcp_reset_vars(sk); + + if (icsk->icsk_ca_ops->release) + icsk->icsk_ca_ops->release(sk); + memset(icsk->icsk_ca_priv, 0, sizeof(icsk->icsk_ca_priv)); tcp_set_ca_state(sk, TCP_CA_Open); - tp->is_sack_reneg = 0; - tcp_clear_retrans(tp); @@ -3667,7 +3742,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c inet_csk_delack_init(sk); /* Initialize rcv_mss to TCP_MIN_MSS to avoid division by 0 * issue in __tcp_select_window() -@@ -2636,14 +2746,10 @@ +@@ -2636,14 +2752,10 @@ sk->sk_rx_dst = NULL; tcp_saved_syn_free(tp); tp->compressed_ack = 0; @@ -3677,12 +3752,12 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c - tp->bytes_acked = 0; - tp->bytes_received = 0; - tp->bytes_retrans = 0; - tp->data_segs_in = 0; - tp->data_segs_out = 0; + tp->data_segs_in = 0; + tp->data_segs_out = 0; tp->duplicate_sack[0].start_seq = 0; tp->duplicate_sack[0].end_seq = 0; tp->dsack_dups = 0; -@@ -2648,8 +2754,6 @@ +@@ -2648,8 +2760,6 @@ tp->sacked_out = 0; tp->tlp_high_seq = 0; tp->last_oow_ack_time = 0; @@ -3691,7 +3766,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c tp->rack.mstamp = 0; tp->rack.advanced = 0; tp->rack.reo_wnd_steps = 1; -@@ -2683,7 +2787,7 @@ +@@ -2683,7 +2793,7 @@ static inline bool tcp_can_repair_sock(const struct sock *sk) { return ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN) && @@ -3700,7 +3775,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c } static int tcp_repair_set_window(struct tcp_sock *tp, char __user *optbuf, int len) -@@ -2852,6 +2956,61 @@ +@@ -2852,6 +2962,61 @@ return tcp_fastopen_reset_cipher(net, sk, key, backup_key); } @@ -3762,7 +3837,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c default: /* fallthru */ break; -@@ -3032,6 +3191,12 @@ +@@ -3032,6 +3197,12 @@ break; case TCP_DEFER_ACCEPT: @@ -3775,7 +3850,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c /* Translate value in seconds to number of retransmits */ icsk->icsk_accept_queue.rskq_defer_accept = secs_to_retrans(val, TCP_TIMEOUT_INIT / HZ, -@@ -3059,7 +3224,7 @@ +@@ -3059,7 +3230,7 @@ (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT) && inet_csk_ack_scheduled(sk)) { icsk->icsk_ack.pending |= ICSK_ACK_PUSHED; @@ -3784,16 +3859,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c if (!(val & 1)) inet_csk_enter_pingpong_mode(sk); } -@@ -3069,7 +3234,7 @@ - #ifdef CONFIG_TCP_MD5SIG - case TCP_MD5SIG: - case TCP_MD5SIG_EXT: -- if ((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN)) -+ if ((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN) && !sock_flag(sk, SOCK_MPTCP)) - err = tp->af_specific->md5_parse(sk, optname, optval, optlen); - else - err = -EINVAL; -@@ -3128,6 +3293,32 @@ +@@ -3128,6 +3299,32 @@ tp->notsent_lowat = val; sk->sk_write_space(sk); break; @@ -3826,7 +3892,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c case TCP_INQ: if (val > 1 || val < 0) err = -EINVAL; -@@ -3192,7 +3383,7 @@ +@@ -3192,7 +3389,7 @@ } /* Return information about state of tcp endpoint in API format. */ @@ -3835,7 +3901,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c { const struct tcp_sock *tp = tcp_sk(sk); /* iff sk_type == SOCK_STREAM */ const struct inet_connection_sock *icsk = inet_csk(sk); -@@ -3229,7 +3420,8 @@ +@@ -3229,7 +3426,8 @@ return; } @@ -3845,7 +3911,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c info->tcpi_ca_state = icsk->icsk_ca_state; info->tcpi_retransmits = icsk->icsk_retransmits; -@@ -3305,7 +3497,9 @@ +@@ -3305,7 +3503,9 @@ info->tcpi_reord_seen = tp->reord_seen; info->tcpi_rcv_ooopack = tp->rcv_ooopack; info->tcpi_snd_wnd = tp->snd_wnd; @@ -3856,7 +3922,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c } EXPORT_SYMBOL_GPL(tcp_get_info); -@@ -3452,7 +3646,7 @@ +@@ -3452,7 +3652,7 @@ if (get_user(len, optlen)) return -EFAULT; @@ -3865,7 +3931,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c len = min_t(unsigned int, len, sizeof(info)); if (put_user(len, optlen)) -@@ -3649,6 +3843,87 @@ +@@ -3649,6 +3849,87 @@ } return 0; } @@ -3953,7 +4019,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c #ifdef CONFIG_MMU case TCP_ZEROCOPY_RECEIVE: { struct tcp_zerocopy_receive zc; -@@ -3851,7 +4126,9 @@ +@@ -3851,7 +4132,9 @@ if (sk->sk_state == TCP_SYN_SENT || sk->sk_state == TCP_SYN_RECV) TCP_INC_STATS(sock_net(sk), TCP_MIB_ATTEMPTFAILS); @@ -3963,7 +4029,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c tcp_clear_xmit_timers(sk); if (req) reqsk_fastopen_remove(sk, req, false); -@@ -3867,6 +4144,8 @@ +@@ -3867,6 +4150,8 @@ int tcp_abort(struct sock *sk, int err) { @@ -3972,7 +4038,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c if (!sk_fullsock(sk)) { if (sk->sk_state == TCP_NEW_SYN_RECV) { struct request_sock *req = inet_reqsk(sk); -@@ -3880,7 +4159,7 @@ +@@ -3880,7 +4165,7 @@ } /* Don't race with userspace socket closes such as tcp_close. */ @@ -3981,7 +4047,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c if (sk->sk_state == TCP_LISTEN) { tcp_set_state(sk, TCP_CLOSE); -@@ -3889,7 +4168,7 @@ +@@ -3889,7 +4174,7 @@ /* Don't race with BH socket closes such as inet_csk_listen_stop. */ local_bh_disable(); @@ -3990,7 +4056,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c if (!sock_flag(sk, SOCK_DEAD)) { sk->sk_err = err; -@@ -3897,14 +4176,14 @@ +@@ -3897,14 +4182,14 @@ smp_wmb(); sk->sk_error_report(sk); if (tcp_need_reset(sk->sk_state)) @@ -4010,7 +4076,7 @@ diff -aurN linux-5.4/net/ipv4/tcp.c mptcp-mptcp_trunk/net/ipv4/tcp.c EXPORT_SYMBOL_GPL(tcp_abort); diff -aurN linux-5.4/net/ipv4/tcp_cong.c mptcp-mptcp_trunk/net/ipv4/tcp_cong.c --- linux-5.4/net/ipv4/tcp_cong.c 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/ipv4/tcp_cong.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/ipv4/tcp_cong.c 2020-07-14 19:34:59.000000000 +0200 @@ -328,13 +328,19 @@ return ret; } @@ -4035,7 +4101,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_cong.c mptcp-mptcp_trunk/net/ipv4/tcp_cong.c const struct tcp_congestion_ops *ca; diff -aurN linux-5.4/net/ipv4/tcp_diag.c mptcp-mptcp_trunk/net/ipv4/tcp_diag.c --- linux-5.4/net/ipv4/tcp_diag.c 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/ipv4/tcp_diag.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/ipv4/tcp_diag.c 2020-07-14 19:34:59.000000000 +0200 @@ -31,7 +31,7 @@ r->idiag_wqueue = READ_ONCE(tp->write_seq) - tp->snd_una; } @@ -4047,7 +4113,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_diag.c mptcp-mptcp_trunk/net/ipv4/tcp_diag.c #ifdef CONFIG_TCP_MD5SIG diff -aurN linux-5.4/net/ipv4/tcp_fastopen.c mptcp-mptcp_trunk/net/ipv4/tcp_fastopen.c --- linux-5.4/net/ipv4/tcp_fastopen.c 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/ipv4/tcp_fastopen.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/ipv4/tcp_fastopen.c 2020-07-14 19:34:59.000000000 +0200 @@ -9,6 +9,7 @@ #include #include @@ -4108,7 +4174,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_fastopen.c mptcp-mptcp_trunk/net/ipv4/tcp_fast */ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c --- linux-5.4/net/ipv4/tcp_input.c 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/ipv4/tcp_input.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/ipv4/tcp_input.c 2020-07-14 19:34:59.000000000 +0200 @@ -76,35 +76,15 @@ #include #include @@ -4268,7 +4334,17 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c { struct tcp_sock *tp = tcp_sk(sk); u32 packets_acked; -@@ -3147,6 +3154,8 @@ +@@ -3041,8 +3048,7 @@ + return packets_acked; + } + +-static void tcp_ack_tstamp(struct sock *sk, struct sk_buff *skb, +- u32 prior_snd_una) ++void tcp_ack_tstamp(struct sock *sk, struct sk_buff *skb, u32 prior_snd_una) + { + const struct skb_shared_info *shinfo; + +@@ -3147,6 +3153,8 @@ */ if (likely(!(scb->tcp_flags & TCPHDR_SYN))) { flag |= FLAG_DATA_ACKED; @@ -4277,7 +4353,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c } else { flag |= FLAG_SYN_ACKED; tp->retrans_stamp = 0; -@@ -3266,7 +3275,7 @@ +@@ -3266,7 +3274,7 @@ return flag; } @@ -4286,7 +4362,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c { struct inet_connection_sock *icsk = inet_csk(sk); struct sk_buff *head = tcp_send_head(sk); -@@ -3338,9 +3347,8 @@ +@@ -3338,9 +3346,8 @@ /* Check that window update is acceptable. * The function assumes that snd_una<=ack<=snd_next. */ @@ -4298,7 +4374,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c { return after(ack, tp->snd_una) || after(ack_seq, tp->snd_wl1) || -@@ -3577,7 +3585,7 @@ +@@ -3577,7 +3584,7 @@ } /* This routine deals with incoming acks, but not outgoing ones. */ @@ -4307,7 +4383,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c { struct inet_connection_sock *icsk = inet_csk(sk); struct tcp_sock *tp = tcp_sk(sk); -@@ -3691,6 +3699,16 @@ +@@ -3691,6 +3698,16 @@ tcp_rack_update_reo_wnd(sk, &rs); @@ -4324,7 +4400,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c if (tp->tlp_high_seq) tcp_process_tlp_ack(sk, ack, flag); /* If needed, reset TLP/RTO timer; RACK may later override this. */ -@@ -3833,8 +3851,10 @@ +@@ -3833,8 +3850,10 @@ */ void tcp_parse_options(const struct net *net, const struct sk_buff *skb, @@ -4337,7 +4413,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c { const unsigned char *ptr; const struct tcphdr *th = tcp_hdr(skb); -@@ -3920,6 +3940,10 @@ +@@ -3920,6 +3939,10 @@ */ break; #endif @@ -4348,7 +4424,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c case TCPOPT_FASTOPEN: tcp_parse_fastopen_option( opsize - TCPOLEN_FASTOPEN_BASE, -@@ -3987,7 +4011,9 @@ +@@ -3987,7 +4010,9 @@ return true; } @@ -4359,7 +4435,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr) tp->rx_opt.rcv_tsecr -= tp->tsoffset; -@@ -4146,6 +4172,11 @@ +@@ -4146,6 +4171,11 @@ { struct tcp_sock *tp = tcp_sk(sk); @@ -4371,7 +4447,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c inet_csk_schedule_ack(sk); sk->sk_shutdown |= RCV_SHUTDOWN; -@@ -4156,6 +4187,10 @@ +@@ -4156,6 +4186,10 @@ case TCP_ESTABLISHED: /* Move to CLOSE_WAIT */ tcp_set_state(sk, TCP_CLOSE_WAIT); @@ -4382,7 +4458,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c inet_csk_enter_pingpong_mode(sk); break; -@@ -4178,9 +4213,16 @@ +@@ -4178,9 +4212,16 @@ tcp_set_state(sk, TCP_CLOSING); break; case TCP_FIN_WAIT2: @@ -4400,7 +4476,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c break; default: /* Only TCP_LISTEN and TCP_CLOSE are left, in these -@@ -4202,6 +4244,10 @@ +@@ -4202,6 +4243,10 @@ if (!sock_flag(sk, SOCK_DEAD)) { sk->sk_state_change(sk); @@ -4411,7 +4487,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c /* Do not send POLL_HUP for half duplex close. */ if (sk->sk_shutdown == SHUTDOWN_MASK || sk->sk_state == TCP_CLOSE) -@@ -4416,6 +4462,9 @@ +@@ -4416,6 +4461,9 @@ *fragstolen = false; @@ -4421,7 +4497,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c /* Its possible this segment overlaps with prior segment in queue */ if (TCP_SKB_CB(from)->seq != TCP_SKB_CB(to)->end_seq) return false; -@@ -4470,7 +4519,7 @@ +@@ -4470,7 +4518,7 @@ /* This one checks to see if we can put data from the * out_of_order queue into the receive_queue. */ @@ -4430,7 +4506,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c { struct tcp_sock *tp = tcp_sk(sk); __u32 dsack_high = tp->rcv_nxt; -@@ -4493,7 +4542,14 @@ +@@ -4493,7 +4541,14 @@ p = rb_next(p); rb_erase(&skb->rbnode, &tp->out_of_order_queue); @@ -4446,7 +4522,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c tcp_drop(sk, skb); continue; } -@@ -4523,6 +4579,9 @@ +@@ -4523,6 +4578,9 @@ static int tcp_try_rmem_schedule(struct sock *sk, struct sk_buff *skb, unsigned int size) { @@ -4456,7 +4532,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf || !sk_rmem_schedule(sk, skb, size)) { -@@ -4537,7 +4596,7 @@ +@@ -4537,7 +4595,7 @@ return 0; } @@ -4465,7 +4541,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c { struct tcp_sock *tp = tcp_sk(sk); struct rb_node **p, *parent; -@@ -4604,7 +4663,8 @@ +@@ -4604,7 +4662,8 @@ continue; } if (before(seq, TCP_SKB_CB(skb1)->end_seq)) { @@ -4475,7 +4551,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c /* All the bits are present. Drop. */ NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFOMERGE); -@@ -4651,6 +4711,11 @@ +@@ -4651,6 +4710,11 @@ end_seq); break; } @@ -4487,7 +4563,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c rb_erase(&skb1->rbnode, &tp->out_of_order_queue); tcp_dsack_extend(sk, TCP_SKB_CB(skb1)->seq, TCP_SKB_CB(skb1)->end_seq); -@@ -4662,7 +4727,7 @@ +@@ -4662,7 +4726,7 @@ tp->ooo_last_skb = skb; add_sack: @@ -4496,7 +4572,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c tcp_sack_new_ofo_skb(sk, seq, end_seq); end: if (skb) { -@@ -4672,8 +4737,8 @@ +@@ -4672,8 +4736,8 @@ } } @@ -4507,18 +4583,17 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c { int eaten; struct sk_buff *tail = skb_peek_tail(&sk->sk_receive_queue); -@@ -4746,8 +4811,8 @@ +@@ -4746,8 +4810,7 @@ const struct tcp_sock *tp = tcp_sk(sk); int avail = tp->rcv_nxt - tp->copied_seq; - if (avail < sk->sk_rcvlowat && !tcp_rmem_pressure(sk) && - !sock_flag(sk, SOCK_DONE)) -+ if (avail < sk->sk_rcvlowat && !tcp_rmem_pressure(sk) && !mptcp(tp) && -+ !sock_flag(sk, SOCK_DONE)) ++ if (avail < sk->sk_rcvlowat && !tcp_rmem_pressure(sk) && !sock_flag(sk, SOCK_DONE) && !mptcp(tp)) return; sk->sk_data_ready(sk); -@@ -4758,10 +4823,14 @@ +@@ -4758,10 +4822,14 @@ bool fragstolen; int eaten; @@ -4534,7 +4609,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c skb_dst_drop(skb); __skb_pull(skb, tcp_hdr(skb)->doff * 4); -@@ -4789,7 +4858,7 @@ +@@ -4789,7 +4857,7 @@ } eaten = tcp_queue_rcv(sk, skb, &fragstolen); @@ -4543,7 +4618,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c tcp_event_data_recv(sk, skb); if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN) tcp_fin(sk); -@@ -4811,7 +4880,11 @@ +@@ -4811,7 +4879,11 @@ if (eaten > 0) kfree_skb_partial(skb, fragstolen); @@ -4556,7 +4631,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c tcp_data_ready(sk); return; } -@@ -5154,7 +5227,7 @@ +@@ -5154,7 +5226,7 @@ return -1; } @@ -4565,7 +4640,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c { const struct tcp_sock *tp = tcp_sk(sk); -@@ -5189,7 +5262,7 @@ +@@ -5189,7 +5261,7 @@ { struct tcp_sock *tp = tcp_sk(sk); @@ -4574,7 +4649,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c tcp_sndbuf_expand(sk); tp->snd_cwnd_stamp = tcp_jiffies32; } -@@ -5203,10 +5276,11 @@ +@@ -5203,10 +5275,11 @@ sock_reset_flag(sk, SOCK_QUEUE_SHRUNK); /* pairs with tcp_poll() */ smp_mb(); @@ -4589,7 +4664,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c tcp_chrono_stop(sk, TCP_CHRONO_SNDBUF_LIMITED); } } -@@ -5225,6 +5299,8 @@ +@@ -5225,6 +5298,8 @@ { struct tcp_sock *tp = tcp_sk(sk); unsigned long rtt, delay; @@ -4598,7 +4673,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c /* More than one full frame received... */ if (((tp->rcv_nxt - tp->rcv_wup) > inet_csk(sk)->icsk_ack.rcv_mss && -@@ -5233,8 +5309,8 @@ +@@ -5233,8 +5308,8 @@ * If application uses SO_RCVLOWAT, we want send ack now if * we have not received enough bytes to satisfy the condition. */ @@ -4609,7 +4684,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c /* We ACK each frame or... */ tcp_in_quickack_mode(sk) || /* Protocol state mandates a one-time immediate ACK */ -@@ -5369,6 +5445,10 @@ +@@ -5369,6 +5444,10 @@ { struct tcp_sock *tp = tcp_sk(sk); @@ -4620,7 +4695,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c /* Check if we get a new urgent pointer - normally not. */ if (th->urg) tcp_check_urg(sk, th); -@@ -5511,9 +5591,15 @@ +@@ -5511,9 +5590,15 @@ goto discard; } @@ -4636,7 +4711,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c tcp_drop(sk, skb); return false; } -@@ -5570,6 +5656,10 @@ +@@ -5570,6 +5655,10 @@ tp->rx_opt.saw_tstamp = 0; @@ -4647,7 +4722,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c /* pred_flags is 0xS?10 << 16 + snd_wnd * if header_prediction is to be made * 'S' will always be tp->tcp_header_len >> 2 -@@ -5742,7 +5832,7 @@ +@@ -5742,7 +5831,7 @@ tcp_call_bpf(sk, bpf_op, 0, NULL); tcp_init_congestion_control(sk); @@ -4656,7 +4731,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c } void tcp_finish_connect(struct sock *sk, struct sk_buff *skb) -@@ -5779,17 +5869,24 @@ +@@ -5779,17 +5868,24 @@ struct tcp_fastopen_cookie *cookie) { struct tcp_sock *tp = tcp_sk(sk); @@ -4683,7 +4758,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c mss = opt.mss_clamp; } -@@ -5813,7 +5910,11 @@ +@@ -5813,7 +5909,11 @@ tcp_fastopen_cache_set(sk, mss, cookie, syn_drop, try_exp); @@ -4696,7 +4771,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c skb_rbtree_walk_from(data) { if (__tcp_retransmit_skb(sk, data, 1)) break; -@@ -5868,9 +5969,13 @@ +@@ -5868,9 +5968,13 @@ struct tcp_sock *tp = tcp_sk(sk); struct tcp_fastopen_cookie foc = { .len = -1 }; int saved_clamp = tp->rx_opt.mss_clamp; @@ -4711,7 +4786,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr) tp->rx_opt.rcv_tsecr -= tp->tsoffset; -@@ -5931,6 +6036,35 @@ +@@ -5931,6 +6035,35 @@ tcp_try_undo_spurious_syn(sk); tcp_ack(sk, skb, FLAG_SLOWPATH); @@ -4747,7 +4822,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c /* Ok.. it's good. Set up sequence numbers and * move to established. */ -@@ -5957,6 +6091,11 @@ +@@ -5957,6 +6090,11 @@ tp->tcp_header_len = sizeof(struct tcphdr); } @@ -4759,7 +4834,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c tcp_sync_mss(sk, icsk->icsk_pmtu_cookie); tcp_initialize_rcv_mss(sk); -@@ -5980,9 +6119,12 @@ +@@ -5980,9 +6118,12 @@ } if (fastopen_fail) return -1; @@ -4774,7 +4849,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c /* Save one ACK. Data will be ready after * several ticks, if write_pending is set. * -@@ -6021,6 +6163,7 @@ +@@ -6021,6 +6162,7 @@ tcp_paws_reject(&tp->rx_opt, 0)) goto discard_and_undo; @@ -4782,7 +4857,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c if (th->syn) { /* We see SYN without ACK. It is attempt of * simultaneous connect with crossed SYNs. -@@ -6037,6 +6180,11 @@ +@@ -6037,6 +6179,11 @@ tp->tcp_header_len = sizeof(struct tcphdr); } @@ -4794,7 +4869,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c WRITE_ONCE(tp->rcv_nxt, TCP_SKB_CB(skb)->seq + 1); WRITE_ONCE(tp->copied_seq, tp->rcv_nxt); tp->rcv_wup = TCP_SKB_CB(skb)->seq + 1; -@@ -6123,6 +6271,7 @@ +@@ -6123,6 +6270,7 @@ */ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) @@ -4802,7 +4877,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c { struct tcp_sock *tp = tcp_sk(sk); struct inet_connection_sock *icsk = inet_csk(sk); -@@ -6165,6 +6314,16 @@ +@@ -6165,6 +6313,16 @@ tp->rx_opt.saw_tstamp = 0; tcp_mstamp_refresh(tp); queued = tcp_rcv_synsent_state_process(sk, skb, th); @@ -4819,7 +4894,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c if (queued >= 0) return queued; -@@ -6237,6 +6396,8 @@ +@@ -6237,6 +6395,8 @@ if (tp->rx_opt.tstamp_ok) tp->advmss -= TCPOLEN_TSTAMP_ALIGNED; @@ -4828,7 +4903,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c if (!inet_csk(sk)->icsk_ca_ops->cong_control) tcp_update_pacing_rate(sk); -@@ -6246,6 +6407,30 @@ +@@ -6246,6 +6406,30 @@ tcp_initialize_rcv_mss(sk); tcp_fast_path_on(tp); @@ -4859,7 +4934,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c break; case TCP_FIN_WAIT1: { -@@ -6286,7 +6471,8 @@ +@@ -6286,7 +6470,8 @@ tmo = tcp_fin_time(sk); if (tmo > TCP_TIMEWAIT_LEN) { inet_csk_reset_keepalive_timer(sk, tmo - TCP_TIMEWAIT_LEN); @@ -4869,7 +4944,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c /* Bad case. We could lose such FIN otherwise. * It is not a big problem, but it looks confusing * and not so rare event. We still can lose it now, -@@ -6295,7 +6481,7 @@ +@@ -6295,7 +6480,7 @@ */ inet_csk_reset_keepalive_timer(sk, tmo); } else { @@ -4878,7 +4953,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c goto discard; } break; -@@ -6303,7 +6489,7 @@ +@@ -6303,7 +6488,7 @@ case TCP_CLOSING: if (tp->snd_una == tp->write_seq) { @@ -4887,7 +4962,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c goto discard; } break; -@@ -6315,6 +6501,9 @@ +@@ -6315,6 +6500,9 @@ goto discard; } break; @@ -4897,7 +4972,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c } /* step 6: check the URG bit */ -@@ -6336,7 +6525,8 @@ +@@ -6336,7 +6524,8 @@ */ if (sk->sk_shutdown & RCV_SHUTDOWN) { if (TCP_SKB_CB(skb)->end_seq != TCP_SKB_CB(skb)->seq && @@ -4907,7 +4982,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPABORTONDATA); tcp_reset(sk); return 1; -@@ -6438,6 +6628,8 @@ +@@ -6438,6 +6627,8 @@ ireq->wscale_ok = rx_opt->wscale_ok; ireq->acked = 0; ireq->ecn_ok = 0; @@ -4916,7 +4991,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c ireq->ir_rmt_port = tcp_hdr(skb)->source; ireq->ir_num = ntohs(tcp_hdr(skb)->dest); ireq->ir_mark = inet_request_mark(sk, skb); -@@ -6563,12 +6755,17 @@ +@@ -6563,12 +6754,17 @@ /* TW buckets are converted to open requests without * limitations, they conserve resources and peer is * evidently real one. @@ -4935,7 +5010,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c } if (sk_acceptq_is_full(sk)) { -@@ -6586,8 +6783,8 @@ +@@ -6586,8 +6782,8 @@ tcp_clear_options(&tmp_opt); tmp_opt.mss_clamp = af_ops->mss_clamp; tmp_opt.user_mss = tp->rx_opt.user_mss; @@ -4946,7 +5021,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c if (want_cookie && !tmp_opt.saw_tstamp) tcp_clear_options(&tmp_opt); -@@ -6602,7 +6799,8 @@ +@@ -6602,7 +6798,8 @@ /* Note: tcp_v6_init_req() might override ir_iif for link locals */ inet_rsk(req)->ir_iif = inet_request_bound_dev_if(sk, skb); @@ -4956,7 +5031,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c if (security_inet_conn_request(sk, skb, req)) goto drop_and_free; -@@ -6638,7 +6836,7 @@ +@@ -6638,7 +6835,7 @@ tcp_ecn_create_request(req, skb, sk, dst); if (want_cookie) { @@ -4965,7 +5040,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c req->cookie_ts = tmp_opt.tstamp_ok; if (!tmp_opt.tstamp_ok) inet_rsk(req)->ecn_ok = 0; -@@ -6653,17 +6851,25 @@ +@@ -6653,17 +6850,25 @@ fastopen_sk = tcp_try_fastopen(sk, skb, req, &foc, dst); } if (fastopen_sk) { @@ -4994,7 +5069,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_input.c mptcp-mptcp_trunk/net/ipv4/tcp_input.c tcp_rsk(req)->tfo_listener = false; diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c --- linux-5.4/net/ipv4/tcp_ipv4.c 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c 2020-07-14 19:34:59.000000000 +0200 @@ -62,6 +62,8 @@ #include #include @@ -5004,7 +5079,16 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c #include #include #include -@@ -430,7 +432,7 @@ +@@ -209,6 +211,8 @@ + struct ip_options_rcu *inet_opt; + struct inet_timewait_death_row *tcp_death_row = &sock_net(sk)->ipv4.tcp_death_row; + ++ mptcp_init_connect(sk); ++ + if (addr_len < sizeof(struct sockaddr_in)) + return -EINVAL; + +@@ -430,7 +434,7 @@ struct inet_sock *inet; const int type = icmp_hdr(icmp_skb)->type; const int code = icmp_hdr(icmp_skb)->code; @@ -5013,7 +5097,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c struct sk_buff *skb; struct request_sock *fastopen; u32 seq, snd_una; -@@ -460,13 +462,19 @@ +@@ -460,13 +464,19 @@ return 0; } @@ -5035,7 +5119,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c if (!(type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED)) __NET_INC_STATS(net, LINUX_MIB_LOCKDROPPEDICMPS); } -@@ -479,7 +487,6 @@ +@@ -479,7 +489,6 @@ } icsk = inet_csk(sk); @@ -5043,7 +5127,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c /* XXX (TFO) - tp->snd_una should be ISN (tcp_create_openreq_child() */ fastopen = rcu_dereference(tp->fastopen_rsk); snd_una = fastopen ? tcp_rsk(fastopen)->snt_isn : tp->snd_una; -@@ -513,11 +520,13 @@ +@@ -513,11 +522,13 @@ goto out; tp->mtu_info = info; @@ -5058,7 +5142,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c } goto out; } -@@ -531,7 +540,7 @@ +@@ -531,7 +542,7 @@ !icsk->icsk_backoff || fastopen) break; @@ -5067,7 +5151,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c break; skb = tcp_rtx_queue_head(sk); -@@ -555,7 +564,7 @@ +@@ -555,7 +566,7 @@ } else { /* RTO revert clocked out retransmission. * Will retransmit now */ @@ -5076,7 +5160,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c } break; -@@ -575,7 +584,7 @@ +@@ -575,7 +586,7 @@ if (fastopen && !fastopen->sk) break; @@ -5085,7 +5169,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c sk->sk_err = err; sk->sk_error_report(sk); -@@ -604,7 +613,7 @@ +@@ -604,7 +615,7 @@ */ inet = inet_sk(sk); @@ -5094,7 +5178,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c sk->sk_err = err; sk->sk_error_report(sk); } else { /* Only an error on timeout */ -@@ -612,7 +621,7 @@ +@@ -612,7 +623,7 @@ } out: @@ -5103,7 +5187,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c sock_put(sk); return 0; } -@@ -648,7 +657,7 @@ +@@ -648,7 +659,7 @@ * Exception: precedence violation. We do not implement it in any case. */ @@ -5112,7 +5196,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c { const struct tcphdr *th = tcp_hdr(skb); struct { -@@ -800,10 +809,10 @@ +@@ -800,10 +811,10 @@ */ static void tcp_v4_send_ack(const struct sock *sk, @@ -5125,7 +5209,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c { const struct tcphdr *th = tcp_hdr(skb); struct { -@@ -812,6 +821,10 @@ +@@ -812,6 +823,10 @@ #ifdef CONFIG_TCP_MD5SIG + (TCPOLEN_MD5SIG_ALIGNED >> 2) #endif @@ -5136,7 +5220,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c ]; } rep; struct net *net = sock_net(sk); -@@ -858,6 +871,21 @@ +@@ -858,6 +873,21 @@ ip_hdr(skb)->daddr, &rep.th); } #endif @@ -5158,7 +5242,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c arg.flags = reply_flags; arg.csum = csum_tcpudp_nofold(ip_hdr(skb)->daddr, ip_hdr(skb)->saddr, /* XXX */ -@@ -889,28 +917,36 @@ +@@ -889,28 +919,36 @@ { struct inet_timewait_sock *tw = inet_twsk(sk); struct tcp_timewait_sock *tcptw = tcp_twsk(sk); @@ -5200,7 +5284,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c tcp_sk(sk)->snd_nxt; /* RFC 7323 2.3 -@@ -919,7 +955,7 @@ +@@ -919,7 +957,7 @@ * Rcv.Wind.Shift bits: */ tcp_v4_send_ack(sk, skb, seq, @@ -5209,7 +5293,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c req->rsk_rcv_wnd >> inet_rsk(req)->rcv_wscale, tcp_time_stamp_raw() + tcp_rsk(req)->ts_off, req->ts_recent, -@@ -927,7 +963,7 @@ +@@ -927,7 +965,7 @@ tcp_md5_do_lookup(sk, (union tcp_md5_addr *)&ip_hdr(skb)->saddr, AF_INET), inet_rsk(req)->no_srccheck ? IP_REPLY_ARG_NOSRCCHECK : 0, @@ -5218,7 +5302,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c } /* -@@ -935,11 +971,11 @@ +@@ -935,11 +973,11 @@ * This still operates on a request_sock only, not on a big * socket. */ @@ -5235,7 +5319,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c { const struct inet_request_sock *ireq = inet_rsk(req); struct flowi4 fl4; -@@ -969,7 +1005,7 @@ +@@ -969,7 +1007,7 @@ /* * IPv4 request_sock destructor. */ @@ -5244,7 +5328,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c { kfree(rcu_dereference_protected(inet_rsk(req)->ireq_opt, 1)); } -@@ -1345,9 +1381,10 @@ +@@ -1345,9 +1383,10 @@ return false; } @@ -5258,7 +5342,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c { struct inet_request_sock *ireq = inet_rsk(req); struct net *net = sock_net(sk_listener); -@@ -1355,6 +1392,8 @@ +@@ -1355,6 +1394,8 @@ sk_rcv_saddr_set(req_to_sk(req), ip_hdr(skb)->daddr); sk_daddr_set(req_to_sk(req), ip_hdr(skb)->saddr); RCU_INIT_POINTER(ireq->ireq_opt, tcp_v4_save_options(net, skb)); @@ -5267,7 +5351,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c } static struct dst_entry *tcp_v4_route_req(const struct sock *sk, -@@ -1374,7 +1413,7 @@ +@@ -1374,7 +1415,7 @@ .syn_ack_timeout = tcp_syn_ack_timeout, }; @@ -5276,7 +5360,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c .mss_clamp = TCP_MSS_DEFAULT, #ifdef CONFIG_TCP_MD5SIG .req_md5_lookup = tcp_v4_md5_lookup, -@@ -1511,7 +1550,7 @@ +@@ -1511,7 +1552,7 @@ } EXPORT_SYMBOL(tcp_v4_syn_recv_sock); @@ -5285,7 +5369,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c { #ifdef CONFIG_SYN_COOKIES const struct tcphdr *th = tcp_hdr(skb); -@@ -1549,6 +1588,9 @@ +@@ -1549,6 +1590,9 @@ { struct sock *rsk; @@ -5295,7 +5379,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ struct dst_entry *dst = sk->sk_rx_dst; -@@ -1793,6 +1835,10 @@ +@@ -1793,6 +1837,10 @@ TCP_SKB_CB(skb)->end_seq = (TCP_SKB_CB(skb)->seq + th->syn + th->fin + skb->len - th->doff * 4); TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq); @@ -5306,7 +5390,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c TCP_SKB_CB(skb)->tcp_flags = tcp_flag_byte(th); TCP_SKB_CB(skb)->tcp_tw_isn = 0; TCP_SKB_CB(skb)->ip_dsfield = ipv4_get_dsfield(iph); -@@ -1812,8 +1858,8 @@ +@@ -1812,8 +1860,8 @@ int sdif = inet_sdif(skb); const struct iphdr *iph; const struct tcphdr *th; @@ -5316,7 +5400,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c int ret; if (skb->pkt_type != PACKET_HOST) -@@ -1867,7 +1913,11 @@ +@@ -1867,7 +1915,11 @@ reqsk_put(req); goto csum_error; } @@ -5329,7 +5413,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c inet_csk_reqsk_queue_drop_and_put(sk, req); goto lookup; } -@@ -1876,6 +1926,7 @@ +@@ -1876,6 +1928,7 @@ */ sock_hold(sk); refcounted = true; @@ -5337,7 +5421,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c nsk = NULL; if (!tcp_filter(sk, skb)) { th = (const struct tcphdr *)skb->data; -@@ -1936,19 +1987,28 @@ +@@ -1936,19 +1989,28 @@ sk_incoming_cpu_update(sk); @@ -5370,7 +5454,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c if (skb_to_free) __kfree_skb(skb_to_free); -@@ -1964,6 +2024,19 @@ +@@ -1964,6 +2026,19 @@ tcp_v4_fill_cb(skb, iph, th); @@ -5390,7 +5474,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c if (tcp_checksum_complete(skb)) { csum_error: __TCP_INC_STATS(net, TCP_MIB_CSUMERRORS); -@@ -2012,6 +2085,18 @@ +@@ -2012,6 +2087,18 @@ refcounted = false; goto process; } @@ -5409,7 +5493,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c } /* to ACK */ /* fall through */ -@@ -2081,7 +2166,12 @@ +@@ -2081,7 +2168,12 @@ tcp_init_sock(sk); @@ -5423,7 +5507,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c #ifdef CONFIG_TCP_MD5SIG tcp_sk(sk)->af_specific = &tcp_sock_ipv4_specific; -@@ -2100,6 +2190,11 @@ +@@ -2100,6 +2192,11 @@ tcp_cleanup_congestion_control(sk); @@ -5435,7 +5519,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c tcp_cleanup_ulp(sk); /* Cleanup up the write buffer. */ -@@ -2603,6 +2698,11 @@ +@@ -2603,6 +2700,11 @@ .sysctl_rmem_offset = offsetof(struct net, ipv4.sysctl_tcp_rmem), .max_header = MAX_TCP_HEADER, .obj_size = sizeof(struct tcp_sock), @@ -5447,7 +5531,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c .slab_flags = SLAB_TYPESAFE_BY_RCU, .twsk_prot = &tcp_timewait_sock_ops, .rsk_prot = &tcp_request_sock_ops, -@@ -2613,6 +2713,9 @@ +@@ -2613,6 +2715,9 @@ .compat_getsockopt = compat_tcp_getsockopt, #endif .diag_destroy = tcp_abort, @@ -5459,7 +5543,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_ipv4.c mptcp-mptcp_trunk/net/ipv4/tcp_ipv4.c diff -aurN linux-5.4/net/ipv4/tcp_minisocks.c mptcp-mptcp_trunk/net/ipv4/tcp_minisocks.c --- linux-5.4/net/ipv4/tcp_minisocks.c 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/ipv4/tcp_minisocks.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/ipv4/tcp_minisocks.c 2020-07-14 19:34:59.000000000 +0200 @@ -19,11 +19,13 @@ * Jorge Cwik, */ @@ -5594,7 +5678,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_minisocks.c mptcp-mptcp_trunk/net/ipv4/tcp_min __TCP_INC_STATS(sock_net(sk), TCP_MIB_PASSIVEOPENS); -@@ -570,6 +612,7 @@ +@@ -570,15 +612,20 @@ bool fastopen, bool *req_stolen) { struct tcp_options_received tmp_opt; @@ -5602,8 +5686,9 @@ diff -aurN linux-5.4/net/ipv4/tcp_minisocks.c mptcp-mptcp_trunk/net/ipv4/tcp_min struct sock *child; const struct tcphdr *th = tcp_hdr(skb); __be32 flg = tcp_flag_word(th) & (TCP_FLAG_RST|TCP_FLAG_SYN|TCP_FLAG_ACK); -@@ -577,8 +620,11 @@ + bool paws_reject = false; bool own_req; ++ bool meta_locked = false; tmp_opt.saw_tstamp = 0; + @@ -5615,7 +5700,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_minisocks.c mptcp-mptcp_trunk/net/ipv4/tcp_min if (tmp_opt.saw_tstamp) { tmp_opt.ts_recent = req->ts_recent; -@@ -619,7 +665,14 @@ +@@ -619,7 +666,14 @@ * * Reset timer after retransmitting SYNACK, similar to * the idea of fast retransmit in recovery. @@ -5630,12 +5715,14 @@ diff -aurN linux-5.4/net/ipv4/tcp_minisocks.c mptcp-mptcp_trunk/net/ipv4/tcp_min if (!tcp_oow_rate_limited(sock_net(sk), skb, LINUX_MIB_TCPACKSKIPPEDSYNRECV, &tcp_rsk(req)->last_oow_ack_time) && -@@ -767,17 +820,37 @@ +@@ -767,17 +821,40 @@ * ESTABLISHED STATE. If it will be dropped after * socket is created, wait for troubles. */ -+ if (is_meta_sk(sk)) ++ if (is_meta_sk(sk)) { + bh_lock_sock_nested(sk); ++ meta_locked = true; ++ } child = inet_csk(sk)->icsk_af_ops->syn_recv_sock(sk, skb, req, NULL, req, &own_req); if (!child) @@ -5653,22 +5740,23 @@ diff -aurN linux-5.4/net/ipv4/tcp_minisocks.c mptcp-mptcp_trunk/net/ipv4/tcp_min + return mptcp_check_req_child(sk, child, req, skb, &mopt); + } + -+ if (is_meta_sk(sk)) ++ if (meta_locked) + bh_unlock_sock(sk); + sock_rps_save_rxhash(child, skb); tcp_synack_rtt_meas(child, req); *req_stolen = !own_req; ++ return inet_csk_complete_hashdance(sk, child, req, own_req); listen_overflow: -+ if (is_meta_sk(sk)) ++ if (meta_locked) + bh_unlock_sock(sk); + if (!sock_net(sk)->ipv4.sysctl_tcp_abort_on_overflow) { inet_rsk(req)->acked = 1; return NULL; -@@ -820,12 +893,13 @@ +@@ -820,12 +897,13 @@ { int ret = 0; int state = child->sk_state; @@ -5683,7 +5771,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_minisocks.c mptcp-mptcp_trunk/net/ipv4/tcp_min ret = tcp_rcv_state_process(child, skb); /* Wakeup parent, send SIGIO */ if (state == TCP_SYN_RECV && child->sk_state != state) -@@ -835,10 +909,14 @@ +@@ -835,10 +913,14 @@ * in main socket hash table and lock on listening * socket does not protect us more. */ @@ -5701,7 +5789,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_minisocks.c mptcp-mptcp_trunk/net/ipv4/tcp_min } diff -aurN linux-5.4/net/ipv4/tcp_output.c mptcp-mptcp_trunk/net/ipv4/tcp_output.c --- linux-5.4/net/ipv4/tcp_output.c 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/ipv4/tcp_output.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/ipv4/tcp_output.c 2020-07-14 19:34:59.000000000 +0200 @@ -37,6 +37,12 @@ #define pr_fmt(fmt) "TCP: " fmt @@ -6293,7 +6381,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_output.c mptcp-mptcp_trunk/net/ipv4/tcp_output /* Cancel probe timer, if it is not required. */ diff -aurN linux-5.4/net/ipv4/tcp_timer.c mptcp-mptcp_trunk/net/ipv4/tcp_timer.c --- linux-5.4/net/ipv4/tcp_timer.c 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/ipv4/tcp_timer.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/ipv4/tcp_timer.c 2020-07-14 19:34:59.000000000 +0200 @@ -21,6 +21,7 @@ #include @@ -6507,7 +6595,7 @@ diff -aurN linux-5.4/net/ipv4/tcp_timer.c mptcp-mptcp_trunk/net/ipv4/tcp_timer.c diff -aurN linux-5.4/net/ipv6/addrconf.c mptcp-mptcp_trunk/net/ipv6/addrconf.c --- linux-5.4/net/ipv6/addrconf.c 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/ipv6/addrconf.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/ipv6/addrconf.c 2020-07-14 19:34:59.000000000 +0200 @@ -967,6 +967,7 @@ kfree_rcu(ifp, rcu); @@ -6518,7 +6606,7 @@ diff -aurN linux-5.4/net/ipv6/addrconf.c mptcp-mptcp_trunk/net/ipv6/addrconf.c ipv6_link_dev_addr(struct inet6_dev *idev, struct inet6_ifaddr *ifp) diff -aurN linux-5.4/net/ipv6/af_inet6.c mptcp-mptcp_trunk/net/ipv6/af_inet6.c --- linux-5.4/net/ipv6/af_inet6.c 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/ipv6/af_inet6.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/ipv6/af_inet6.c 2020-07-14 19:34:59.000000000 +0200 @@ -104,8 +104,7 @@ return (struct ipv6_pinfo *)(((u8 *)sk) + offset); } @@ -6531,7 +6619,7 @@ diff -aurN linux-5.4/net/ipv6/af_inet6.c mptcp-mptcp_trunk/net/ipv6/af_inet6.c struct ipv6_pinfo *np; diff -aurN linux-5.4/net/ipv6/ipv6_sockglue.c mptcp-mptcp_trunk/net/ipv6/ipv6_sockglue.c --- linux-5.4/net/ipv6/ipv6_sockglue.c 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/ipv6/ipv6_sockglue.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/ipv6/ipv6_sockglue.c 2020-07-14 19:34:59.000000000 +0200 @@ -44,6 +44,8 @@ #include #include @@ -6557,7 +6645,7 @@ diff -aurN linux-5.4/net/ipv6/ipv6_sockglue.c mptcp-mptcp_trunk/net/ipv6/ipv6_so tcp_sync_mss(sk, icsk->icsk_pmtu_cookie); diff -aurN linux-5.4/net/ipv6/syncookies.c mptcp-mptcp_trunk/net/ipv6/syncookies.c --- linux-5.4/net/ipv6/syncookies.c 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/ipv6/syncookies.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/ipv6/syncookies.c 2020-07-14 19:34:59.000000000 +0200 @@ -15,6 +15,8 @@ #include #include @@ -6647,7 +6735,7 @@ diff -aurN linux-5.4/net/ipv6/syncookies.c mptcp-mptcp_trunk/net/ipv6/syncookies out_free: diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c --- linux-5.4/net/ipv6/tcp_ipv6.c 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c 2020-07-14 19:34:59.000000000 +0200 @@ -58,6 +58,8 @@ #include #include @@ -6691,7 +6779,16 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c int addr_len) { struct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr; -@@ -236,7 +229,12 @@ +@@ -157,6 +150,8 @@ + int err; + struct inet_timewait_death_row *tcp_death_row = &sock_net(sk)->ipv4.tcp_death_row; + ++ mptcp_init_connect(sk); ++ + if (addr_len < SIN6_LEN_RFC2133) + return -EINVAL; + +@@ -236,7 +231,12 @@ sin.sin_port = usin->sin6_port; sin.sin_addr.s_addr = usin->sin6_addr.s6_addr32[3]; @@ -6705,7 +6802,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c sk->sk_backlog_rcv = tcp_v4_do_rcv; #ifdef CONFIG_TCP_MD5SIG tp->af_specific = &tcp_sock_ipv6_mapped_specific; -@@ -246,7 +244,12 @@ +@@ -246,7 +246,12 @@ if (err) { icsk->icsk_ext_hdr_len = exthdrlen; @@ -6719,7 +6816,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c sk->sk_backlog_rcv = tcp_v6_do_rcv; #ifdef CONFIG_TCP_MD5SIG tp->af_specific = &tcp_sock_ipv6_specific; -@@ -340,7 +343,7 @@ +@@ -340,7 +345,7 @@ return err; } @@ -6728,7 +6825,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c { struct dst_entry *dst; -@@ -367,7 +370,7 @@ +@@ -367,7 +372,7 @@ struct ipv6_pinfo *np; struct tcp_sock *tp; __u32 seq, snd_una; @@ -6737,7 +6834,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c bool fatal; int err; -@@ -393,8 +396,14 @@ +@@ -393,8 +398,14 @@ return 0; } @@ -6754,7 +6851,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c __NET_INC_STATS(net, LINUX_MIB_LOCKDROPPEDICMPS); if (sk->sk_state == TCP_CLOSE) -@@ -405,7 +414,6 @@ +@@ -405,7 +416,6 @@ goto out; } @@ -6762,7 +6859,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c /* XXX (TFO) - tp->snd_una should be ISN (tcp_create_openreq_child() */ fastopen = rcu_dereference(tp->fastopen_rsk); snd_una = fastopen ? tcp_rsk(fastopen)->snt_isn : tp->snd_una; -@@ -439,11 +447,15 @@ +@@ -439,11 +449,15 @@ goto out; tp->mtu_info = ntohl(info); @@ -6782,7 +6879,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c goto out; } -@@ -458,7 +470,7 @@ +@@ -458,7 +472,7 @@ if (fastopen && !fastopen->sk) break; @@ -6791,7 +6888,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c sk->sk_err = err; sk->sk_error_report(sk); /* Wake people up to see the error (see connect in sock.c) */ -@@ -468,14 +480,14 @@ +@@ -468,14 +482,14 @@ goto out; } @@ -6808,7 +6905,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c sock_put(sk); return 0; } -@@ -523,8 +535,7 @@ +@@ -523,8 +537,7 @@ return err; } @@ -6818,7 +6915,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c { kfree(inet_rsk(req)->ipv6_opt); kfree_skb(inet_rsk(req)->pktopts); -@@ -742,9 +753,10 @@ +@@ -742,9 +755,10 @@ return false; } @@ -6832,7 +6929,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c { bool l3_slave = ipv6_l3mdev_skb(TCP_SKB_CB(skb)->header.h6.flags); struct inet_request_sock *ireq = inet_rsk(req); -@@ -766,6 +778,8 @@ +@@ -766,6 +780,8 @@ refcount_inc(&skb->users); ireq->pktopts = skb; } @@ -6841,7 +6938,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c } static struct dst_entry *tcp_v6_route_req(const struct sock *sk, -@@ -785,7 +799,7 @@ +@@ -785,7 +801,7 @@ .syn_ack_timeout = tcp_syn_ack_timeout, }; @@ -6850,7 +6947,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c .mss_clamp = IPV6_MIN_MTU - sizeof(struct tcphdr) - sizeof(struct ipv6hdr), #ifdef CONFIG_TCP_MD5SIG -@@ -803,9 +817,9 @@ +@@ -803,9 +819,9 @@ }; static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32 seq, @@ -6862,7 +6959,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c { const struct tcphdr *th = tcp_hdr(skb); struct tcphdr *t1; -@@ -824,7 +838,10 @@ +@@ -824,7 +840,10 @@ if (key) tot_len += TCPOLEN_MD5SIG_ALIGNED; #endif @@ -6874,7 +6971,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c buff = alloc_skb(MAX_HEADER + sizeof(struct ipv6hdr) + tot_len, GFP_ATOMIC); if (!buff) -@@ -862,6 +879,17 @@ +@@ -862,6 +881,17 @@ tcp_v6_md5_hash_hdr((__u8 *)topt, key, &ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr, t1); @@ -6892,7 +6989,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c } #endif -@@ -920,7 +948,7 @@ +@@ -920,7 +950,7 @@ kfree_skb(buff); } @@ -6901,7 +6998,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c { const struct tcphdr *th = tcp_hdr(skb); struct ipv6hdr *ipv6h = ipv6_hdr(skb); -@@ -1005,8 +1033,8 @@ +@@ -1005,8 +1035,8 @@ label = ip6_flowlabel(ipv6h); } @@ -6912,7 +7009,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c #ifdef CONFIG_TCP_MD5SIG out: -@@ -1015,30 +1043,37 @@ +@@ -1015,30 +1045,37 @@ } static void tcp_v6_send_ack(const struct sock *sk, struct sk_buff *skb, u32 seq, @@ -6957,7 +7054,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c { /* sk->sk_state == TCP_LISTEN -> for regular TCP_SYN_RECV * sk->sk_state == TCP_SYN_RECV -> for Fast Open. -@@ -1048,18 +1083,18 @@ +@@ -1048,18 +1085,18 @@ * exception of segments, MUST be right-shifted by * Rcv.Wind.Shift bits: */ @@ -6980,7 +7077,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c { #ifdef CONFIG_SYN_COOKIES const struct tcphdr *th = tcp_hdr(skb); -@@ -1085,7 +1120,7 @@ +@@ -1085,7 +1122,7 @@ return mss; } @@ -6989,7 +7086,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c { if (skb->protocol == htons(ETH_P_IP)) return tcp_v4_conn_request(sk, skb); -@@ -1111,11 +1146,11 @@ +@@ -1111,11 +1148,11 @@ sizeof(struct inet6_skb_parm)); } @@ -7006,7 +7103,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c { struct inet_request_sock *ireq; struct ipv6_pinfo *newnp; -@@ -1150,7 +1185,15 @@ +@@ -1150,7 +1187,15 @@ newnp->saddr = newsk->sk_v6_rcv_saddr; @@ -7023,7 +7120,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c newsk->sk_backlog_rcv = tcp_v4_do_rcv; #ifdef CONFIG_TCP_MD5SIG newtp->af_specific = &tcp_sock_ipv6_mapped_specific; -@@ -1197,6 +1240,14 @@ +@@ -1197,6 +1242,14 @@ if (!newsk) goto out_nonewsk; @@ -7038,7 +7135,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c /* * No need to charge this sock to the relevant IPv6 refcnt debug socks * count here, tcp_create_openreq_child now does this for us, see the -@@ -1324,7 +1375,7 @@ +@@ -1324,7 +1377,7 @@ * This is because we cannot sleep with the original spinlock * held. */ @@ -7047,7 +7144,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c { struct ipv6_pinfo *np = tcp_inet6_sk(sk); struct sk_buff *opt_skb = NULL; -@@ -1341,6 +1392,9 @@ +@@ -1341,6 +1394,9 @@ if (skb->protocol == htons(ETH_P_IP)) return tcp_v4_do_rcv(sk, skb); @@ -7057,7 +7154,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c /* * socket locking is here for SMP purposes as backlog rcv * is currently called with bh processing disabled. -@@ -1468,6 +1522,10 @@ +@@ -1468,6 +1524,10 @@ TCP_SKB_CB(skb)->end_seq = (TCP_SKB_CB(skb)->seq + th->syn + th->fin + skb->len - th->doff*4); TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq); @@ -7068,7 +7165,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c TCP_SKB_CB(skb)->tcp_flags = tcp_flag_byte(th); TCP_SKB_CB(skb)->tcp_tw_isn = 0; TCP_SKB_CB(skb)->ip_dsfield = ipv6_get_dsfield(hdr); -@@ -1482,8 +1540,8 @@ +@@ -1482,8 +1542,8 @@ int sdif = inet6_sdif(skb); const struct tcphdr *th; const struct ipv6hdr *hdr; @@ -7078,7 +7175,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c int ret; struct net *net = dev_net(skb->dev); -@@ -1537,12 +1595,17 @@ +@@ -1537,12 +1597,17 @@ reqsk_put(req); goto csum_error; } @@ -7097,7 +7194,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c nsk = NULL; if (!tcp_filter(sk, skb)) { th = (const struct tcphdr *)skb->data; -@@ -1601,19 +1664,28 @@ +@@ -1601,19 +1666,28 @@ sk_incoming_cpu_update(sk); @@ -7130,7 +7227,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c if (skb_to_free) __kfree_skb(skb_to_free); put_and_return: -@@ -1627,6 +1699,19 @@ +@@ -1627,6 +1701,19 @@ tcp_v6_fill_cb(skb, hdr, th); @@ -7150,7 +7247,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c if (tcp_checksum_complete(skb)) { csum_error: __TCP_INC_STATS(net, TCP_MIB_CSUMERRORS); -@@ -1679,6 +1764,18 @@ +@@ -1679,6 +1766,18 @@ refcounted = false; goto process; } @@ -7169,7 +7266,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c } /* to ACK */ /* fall through */ -@@ -1733,13 +1830,13 @@ +@@ -1733,13 +1832,13 @@ } } @@ -7185,7 +7282,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c .queue_xmit = inet6_csk_xmit, .send_check = tcp_v6_send_check, .rebuild_header = inet6_sk_rebuild_header, -@@ -1770,7 +1867,7 @@ +@@ -1770,7 +1869,7 @@ /* * TCP over IPv4 via INET6 API */ @@ -7194,7 +7291,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c .queue_xmit = ip_queue_xmit, .send_check = tcp_v4_send_check, .rebuild_header = inet_sk_rebuild_header, -@@ -1806,7 +1903,12 @@ +@@ -1806,7 +1905,12 @@ tcp_init_sock(sk); @@ -7208,7 +7305,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c #ifdef CONFIG_TCP_MD5SIG tcp_sk(sk)->af_specific = &tcp_sock_ipv6_specific; -@@ -1815,7 +1917,7 @@ +@@ -1815,7 +1919,7 @@ return 0; } @@ -7217,7 +7314,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c { tcp_v4_destroy_sock(sk); inet6_destroy_sock(sk); -@@ -2038,6 +2140,11 @@ +@@ -2038,6 +2142,11 @@ .sysctl_rmem_offset = offsetof(struct net, ipv4.sysctl_tcp_rmem), .max_header = MAX_TCP_HEADER, .obj_size = sizeof(struct tcp6_sock), @@ -7229,7 +7326,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c .slab_flags = SLAB_TYPESAFE_BY_RCU, .twsk_prot = &tcp6_timewait_sock_ops, .rsk_prot = &tcp6_request_sock_ops, -@@ -2048,6 +2155,9 @@ +@@ -2048,6 +2157,9 @@ .compat_getsockopt = compat_tcp_getsockopt, #endif .diag_destroy = tcp_abort, @@ -7241,7 +7338,7 @@ diff -aurN linux-5.4/net/ipv6/tcp_ipv6.c mptcp-mptcp_trunk/net/ipv6/tcp_ipv6.c /* thinking of making this const? Don't. diff -aurN linux-5.4/net/Kconfig mptcp-mptcp_trunk/net/Kconfig --- linux-5.4/net/Kconfig 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/Kconfig 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/Kconfig 2020-07-14 19:34:59.000000000 +0200 @@ -91,6 +91,7 @@ source "net/ipv4/Kconfig" source "net/ipv6/Kconfig" @@ -7252,7 +7349,7 @@ diff -aurN linux-5.4/net/Kconfig mptcp-mptcp_trunk/net/Kconfig diff -aurN linux-5.4/net/Makefile mptcp-mptcp_trunk/net/Makefile --- linux-5.4/net/Makefile 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/net/Makefile 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/Makefile 2020-07-14 19:34:59.000000000 +0200 @@ -20,6 +20,7 @@ obj-$(CONFIG_XFRM) += xfrm/ obj-$(CONFIG_UNIX_SCM) += unix/ @@ -7263,14 +7360,16 @@ diff -aurN linux-5.4/net/Makefile mptcp-mptcp_trunk/net/Makefile obj-$(CONFIG_NET_KEY) += key/ diff -aurN linux-5.4/net/mptcp/Kconfig mptcp-mptcp_trunk/net/mptcp/Kconfig --- linux-5.4/net/mptcp/Kconfig 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/net/mptcp/Kconfig 2020-06-09 17:33:41.000000000 +0200 -@@ -0,0 +1,152 @@ ++++ mptcp-mptcp_trunk/net/mptcp/Kconfig 2020-07-14 19:34:59.000000000 +0200 +@@ -0,0 +1,154 @@ +# +# MPTCP configuration +# +config MPTCP + bool "MPTCP protocol" + depends on (IPV6=y || IPV6=n) ++ select CRYPTO_LIB_SHA256 ++ select CRYPTO + ---help--- + This replaces the normal TCP stack with a Multipath TCP stack, + able to use several paths at once. @@ -7419,7 +7518,7 @@ diff -aurN linux-5.4/net/mptcp/Kconfig mptcp-mptcp_trunk/net/mptcp/Kconfig + diff -aurN linux-5.4/net/mptcp/Makefile mptcp-mptcp_trunk/net/mptcp/Makefile --- linux-5.4/net/mptcp/Makefile 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/net/mptcp/Makefile 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/mptcp/Makefile 2020-07-14 19:34:59.000000000 +0200 @@ -0,0 +1,25 @@ +# +## Makefile for MultiPath TCP support code. @@ -7448,7 +7547,7 @@ diff -aurN linux-5.4/net/mptcp/Makefile mptcp-mptcp_trunk/net/mptcp/Makefile +mptcp-$(subst m,y,$(CONFIG_IPV6)) += mptcp_ipv6.o diff -aurN linux-5.4/net/mptcp/mctcp_desync.c mptcp-mptcp_trunk/net/mptcp/mctcp_desync.c --- linux-5.4/net/mptcp/mctcp_desync.c 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/net/mptcp/mctcp_desync.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/mptcp/mctcp_desync.c 2020-07-14 19:34:59.000000000 +0200 @@ -0,0 +1,193 @@ +/* + * Desynchronized Multi-Channel TCP Congestion Control Algorithm @@ -7645,7 +7744,7 @@ diff -aurN linux-5.4/net/mptcp/mctcp_desync.c mptcp-mptcp_trunk/net/mptcp/mctcp_ +MODULE_VERSION("1.0"); diff -aurN linux-5.4/net/mptcp/mptcp_balia.c mptcp-mptcp_trunk/net/mptcp/mptcp_balia.c --- linux-5.4/net/mptcp/mptcp_balia.c 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/net/mptcp/mptcp_balia.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/mptcp/mptcp_balia.c 2020-07-14 19:34:59.000000000 +0200 @@ -0,0 +1,261 @@ +/* + * MPTCP implementation - Balia Congestion Control @@ -7910,7 +8009,7 @@ diff -aurN linux-5.4/net/mptcp/mptcp_balia.c mptcp-mptcp_trunk/net/mptcp/mptcp_b +MODULE_VERSION("0.1"); diff -aurN linux-5.4/net/mptcp/mptcp_binder.c mptcp-mptcp_trunk/net/mptcp/mptcp_binder.c --- linux-5.4/net/mptcp/mptcp_binder.c 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/net/mptcp/mptcp_binder.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/mptcp/mptcp_binder.c 2020-07-14 19:34:59.000000000 +0200 @@ -0,0 +1,494 @@ +#include + @@ -8408,7 +8507,7 @@ diff -aurN linux-5.4/net/mptcp/mptcp_binder.c mptcp-mptcp_trunk/net/mptcp/mptcp_ +MODULE_VERSION("0.1"); diff -aurN linux-5.4/net/mptcp/mptcp_blest.c mptcp-mptcp_trunk/net/mptcp/mptcp_blest.c --- linux-5.4/net/mptcp/mptcp_blest.c 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/net/mptcp/mptcp_blest.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/mptcp/mptcp_blest.c 2020-07-14 19:34:59.000000000 +0200 @@ -0,0 +1,285 @@ +// SPDX-License-Identifier: GPL-2.0 +/* MPTCP Scheduler to reduce HoL-blocking and spurious retransmissions. @@ -8697,7 +8796,7 @@ diff -aurN linux-5.4/net/mptcp/mptcp_blest.c mptcp-mptcp_trunk/net/mptcp/mptcp_b +MODULE_VERSION("0.95"); diff -aurN linux-5.4/net/mptcp/mptcp_coupled.c mptcp-mptcp_trunk/net/mptcp/mptcp_coupled.c --- linux-5.4/net/mptcp/mptcp_coupled.c 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/net/mptcp/mptcp_coupled.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/mptcp/mptcp_coupled.c 2020-07-14 19:34:59.000000000 +0200 @@ -0,0 +1,262 @@ +/* + * MPTCP implementation - Linked Increase congestion control Algorithm (LIA) @@ -8963,8 +9062,8 @@ diff -aurN linux-5.4/net/mptcp/mptcp_coupled.c mptcp-mptcp_trunk/net/mptcp/mptcp +MODULE_VERSION("0.1"); diff -aurN linux-5.4/net/mptcp/mptcp_ctrl.c mptcp-mptcp_trunk/net/mptcp/mptcp_ctrl.c --- linux-5.4/net/mptcp/mptcp_ctrl.c 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/net/mptcp/mptcp_ctrl.c 2020-06-09 17:33:41.000000000 +0200 -@@ -0,0 +1,3299 @@ ++++ mptcp-mptcp_trunk/net/mptcp/mptcp_ctrl.c 2020-07-14 19:34:59.000000000 +0200 +@@ -0,0 +1,3309 @@ +/* + * MPTCP implementation - MPTCP-control + * @@ -10269,6 +10368,10 @@ diff -aurN linux-5.4/net/mptcp/mptcp_ctrl.c mptcp-mptcp_trunk/net/mptcp/mptcp_ct + if (!master_sk) + goto err_alloc_master; + ++ /* Same as in inet_csk_clone_lock - need to init to 0 */ ++ memset(&inet_csk(master_sk)->icsk_accept_queue, 0, ++ sizeof(inet_csk(master_sk)->icsk_accept_queue)); ++ + master_tp = tcp_sk(master_sk); + master_tp->inside_tk_table = 0; + @@ -11433,6 +11536,10 @@ diff -aurN linux-5.4/net/mptcp/mptcp_ctrl.c mptcp-mptcp_trunk/net/mptcp/mptcp_ct + reqsk_put(req); + + MPTCP_INC_STATS(sock_net(meta_sk), MPTCP_MIB_JOINACKRX); ++ ++ if (inet_sk(child)->inet_sport != inet_sk(meta_sk)->inet_sport) ++ MPTCP_INC_STATS(sock_net(meta_sk), MPTCP_MIB_JOINALTERNATEPORT); ++ + return child; + +teardown: @@ -12000,6 +12107,8 @@ diff -aurN linux-5.4/net/mptcp/mptcp_ctrl.c mptcp-mptcp_trunk/net/mptcp/mptcp_ct + SNMP_MIB_ITEM("AddAddrTx", MPTCP_MIB_ADDADDRTX), + SNMP_MIB_ITEM("RemAddrRx", MPTCP_MIB_REMADDRRX), + SNMP_MIB_ITEM("RemAddrTx", MPTCP_MIB_REMADDRTX), ++ SNMP_MIB_ITEM("MPJoinAlternatePort", MPTCP_MIB_JOINALTERNATEPORT), ++ SNMP_MIB_ITEM("MPCurrEstab", MPTCP_MIB_CURRESTAB), + SNMP_MIB_SENTINEL +}; + @@ -12266,7 +12375,7 @@ diff -aurN linux-5.4/net/mptcp/mptcp_ctrl.c mptcp-mptcp_trunk/net/mptcp/mptcp_ct +} diff -aurN linux-5.4/net/mptcp/mptcp_ecf.c mptcp-mptcp_trunk/net/mptcp/mptcp_ecf.c --- linux-5.4/net/mptcp/mptcp_ecf.c 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/net/mptcp/mptcp_ecf.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/mptcp/mptcp_ecf.c 2020-07-14 19:34:59.000000000 +0200 @@ -0,0 +1,195 @@ +// SPDX-License-Identifier: GPL-2.0 +/* MPTCP ECF Scheduler @@ -12465,7 +12574,7 @@ diff -aurN linux-5.4/net/mptcp/mptcp_ecf.c mptcp-mptcp_trunk/net/mptcp/mptcp_ecf +MODULE_VERSION("0.95"); diff -aurN linux-5.4/net/mptcp/mptcp_fullmesh.c mptcp-mptcp_trunk/net/mptcp/mptcp_fullmesh.c --- linux-5.4/net/mptcp/mptcp_fullmesh.c 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/net/mptcp/mptcp_fullmesh.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/mptcp/mptcp_fullmesh.c 2020-07-14 19:34:59.000000000 +0200 @@ -0,0 +1,1938 @@ +#include +#include @@ -14239,7 +14348,7 @@ diff -aurN linux-5.4/net/mptcp/mptcp_fullmesh.c mptcp-mptcp_trunk/net/mptcp/mptc + mptcp_for_each_bit_set(mptcp_local->loc4_bits, i) { + struct mptcp_loc4 *loc4 = &mptcp_local->locaddr4[i]; + -+ seq_printf(seq, "%u, %u, %u, %pI4 %u\n", i, loc4->loc4_id, ++ seq_printf(seq, "%u, %u, %u, %pI4, %u\n", i, loc4->loc4_id, + loc4->low_prio, &loc4->addr, loc4->if_idx); + } + @@ -14248,7 +14357,7 @@ diff -aurN linux-5.4/net/mptcp/mptcp_fullmesh.c mptcp-mptcp_trunk/net/mptcp/mptc + mptcp_for_each_bit_set(mptcp_local->loc6_bits, i) { + struct mptcp_loc6 *loc6 = &mptcp_local->locaddr6[i]; + -+ seq_printf(seq, "%u, %u, %u, %pI6 %u\n", i, loc6->loc6_id, ++ seq_printf(seq, "%u, %u, %u, %pI6, %u\n", i, loc6->loc6_id, + loc6->low_prio, &loc6->addr, loc6->if_idx); + } + rcu_read_unlock_bh(); @@ -14407,8 +14516,8 @@ diff -aurN linux-5.4/net/mptcp/mptcp_fullmesh.c mptcp-mptcp_trunk/net/mptcp/mptc +MODULE_VERSION("0.88"); diff -aurN linux-5.4/net/mptcp/mptcp_input.c mptcp-mptcp_trunk/net/mptcp/mptcp_input.c --- linux-5.4/net/mptcp/mptcp_input.c 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/net/mptcp/mptcp_input.c 2020-06-09 17:33:41.000000000 +0200 -@@ -0,0 +1,2529 @@ ++++ mptcp-mptcp_trunk/net/mptcp/mptcp_input.c 2020-07-14 19:34:59.000000000 +0200 +@@ -0,0 +1,2531 @@ +/* + * MPTCP implementation - Sending side + * @@ -14506,21 +14615,23 @@ diff -aurN linux-5.4/net/mptcp/mptcp_input.c mptcp-mptcp_trunk/net/mptcp/mptcp_i + struct sk_buff *skb, *tmp, *next; + struct tcp_sock *meta_tp = tcp_sk(meta_sk); + struct mptcp_cb *mpcb = meta_tp->mpcb; ++ bool fully_acked = true; + bool acked = false; + u32 acked_pcount; + + for (skb = skb_rb_first(&meta_sk->tcp_rtx_queue); skb; skb = next) { -+ bool fully_acked = true; ++ struct tcp_skb_cb *scb = TCP_SKB_CB(skb); + -+ if (before(meta_tp->snd_una, TCP_SKB_CB(skb)->end_seq)) { ++ tcp_ack_tstamp(meta_sk, skb, prior_snd_una); ++ ++ if (after(scb->end_seq, meta_tp->snd_una)) { + if (tcp_skb_pcount(skb) == 1 || -+ !after(meta_tp->snd_una, TCP_SKB_CB(skb)->seq)) ++ !after(meta_tp->snd_una, scb->seq)) + break; + + acked_pcount = tcp_tso_acked(meta_sk, skb); + if (!acked_pcount) + break; -+ + fully_acked = false; + } else { + acked_pcount = tcp_skb_pcount(skb); @@ -16940,8 +17051,8 @@ diff -aurN linux-5.4/net/mptcp/mptcp_input.c mptcp-mptcp_trunk/net/mptcp/mptcp_i +} diff -aurN linux-5.4/net/mptcp/mptcp_ipv4.c mptcp-mptcp_trunk/net/mptcp/mptcp_ipv4.c --- linux-5.4/net/mptcp/mptcp_ipv4.c 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/net/mptcp/mptcp_ipv4.c 2020-06-09 17:33:41.000000000 +0200 -@@ -0,0 +1,430 @@ ++++ mptcp-mptcp_trunk/net/mptcp/mptcp_ipv4.c 2020-07-14 19:34:59.000000000 +0200 +@@ -0,0 +1,431 @@ +/* + * MPTCP implementation - IPv4-specific functions + * @@ -17150,6 +17261,7 @@ diff -aurN linux-5.4/net/mptcp/mptcp_ipv4.c mptcp-mptcp_trunk/net/mptcp/mptcp_ip + goto reset_and_discard; + } + ++ bh_unlock_sock(meta_sk); + local_bh_enable(); + return 0; + } @@ -17374,8 +17486,8 @@ diff -aurN linux-5.4/net/mptcp/mptcp_ipv4.c mptcp-mptcp_trunk/net/mptcp/mptcp_ip +} diff -aurN linux-5.4/net/mptcp/mptcp_ipv6.c mptcp-mptcp_trunk/net/mptcp/mptcp_ipv6.c --- linux-5.4/net/mptcp/mptcp_ipv6.c 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/net/mptcp/mptcp_ipv6.c 2020-06-09 17:33:41.000000000 +0200 -@@ -0,0 +1,478 @@ ++++ mptcp-mptcp_trunk/net/mptcp/mptcp_ipv6.c 2020-07-14 19:34:59.000000000 +0200 +@@ -0,0 +1,479 @@ +/* + * MPTCP implementation - IPv6-specific functions + * @@ -17612,6 +17724,7 @@ diff -aurN linux-5.4/net/mptcp/mptcp_ipv6.c mptcp-mptcp_trunk/net/mptcp/mptcp_ip + goto reset_and_discard; + } + ++ bh_unlock_sock(meta_sk); + local_bh_enable(); + return 0; + } @@ -17856,7 +17969,7 @@ diff -aurN linux-5.4/net/mptcp/mptcp_ipv6.c mptcp-mptcp_trunk/net/mptcp/mptcp_ip +} diff -aurN linux-5.4/net/mptcp/mptcp_ndiffports.c mptcp-mptcp_trunk/net/mptcp/mptcp_ndiffports.c --- linux-5.4/net/mptcp/mptcp_ndiffports.c 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/net/mptcp/mptcp_ndiffports.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/mptcp/mptcp_ndiffports.c 2020-07-14 19:34:59.000000000 +0200 @@ -0,0 +1,174 @@ +#include + @@ -18034,7 +18147,7 @@ diff -aurN linux-5.4/net/mptcp/mptcp_ndiffports.c mptcp-mptcp_trunk/net/mptcp/mp +MODULE_VERSION("0.88"); diff -aurN linux-5.4/net/mptcp/mptcp_netlink.c mptcp-mptcp_trunk/net/mptcp/mptcp_netlink.c --- linux-5.4/net/mptcp/mptcp_netlink.c 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/net/mptcp/mptcp_netlink.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/mptcp/mptcp_netlink.c 2020-07-14 19:34:59.000000000 +0200 @@ -0,0 +1,1271 @@ +// SPDX-License-Identifier: GPL-2.0 +/* MPTCP implementation - Netlink Path Manager @@ -19309,7 +19422,7 @@ diff -aurN linux-5.4/net/mptcp/mptcp_netlink.c mptcp-mptcp_trunk/net/mptcp/mptcp +MODULE_ALIAS_GENL_FAMILY(MPTCP_GENL_NAME); diff -aurN linux-5.4/net/mptcp/mptcp_olia.c mptcp-mptcp_trunk/net/mptcp/mptcp_olia.c --- linux-5.4/net/mptcp/mptcp_olia.c 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/net/mptcp/mptcp_olia.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/mptcp/mptcp_olia.c 2020-07-14 19:34:59.000000000 +0200 @@ -0,0 +1,318 @@ +/* + * MPTCP implementation - OPPORTUNISTIC LINKED INCREASES CONGESTION CONTROL: @@ -19631,8 +19744,8 @@ diff -aurN linux-5.4/net/mptcp/mptcp_olia.c mptcp-mptcp_trunk/net/mptcp/mptcp_ol +MODULE_VERSION("0.1"); diff -aurN linux-5.4/net/mptcp/mptcp_output.c mptcp-mptcp_trunk/net/mptcp/mptcp_output.c --- linux-5.4/net/mptcp/mptcp_output.c 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/net/mptcp/mptcp_output.c 2020-06-09 17:33:41.000000000 +0200 -@@ -0,0 +1,1994 @@ ++++ mptcp-mptcp_trunk/net/mptcp/mptcp_output.c 2020-07-14 19:34:59.000000000 +0200 +@@ -0,0 +1,1997 @@ +/* + * MPTCP implementation - Sending side + * @@ -20238,6 +20351,9 @@ diff -aurN linux-5.4/net/mptcp/mptcp_output.c mptcp-mptcp_trunk/net/mptcp/mptcp_ + tp->write_seq += subskb->len + ((tcb->tcp_flags & TCPHDR_FIN) ? 1 : 0); + tcb->end_seq = tp->write_seq; + ++ /* txstamp_ack is handled at the meta-level */ ++ tcb->txstamp_ack = 0; ++ + /* If it's a non-payload DATA_FIN (also no subflow-fin), the + * segment is not part of the subflow but on a meta-only-level. + */ @@ -21629,7 +21745,7 @@ diff -aurN linux-5.4/net/mptcp/mptcp_output.c mptcp-mptcp_trunk/net/mptcp/mptcp_ + diff -aurN linux-5.4/net/mptcp/mptcp_pm.c mptcp-mptcp_trunk/net/mptcp/mptcp_pm.c --- linux-5.4/net/mptcp/mptcp_pm.c 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/net/mptcp/mptcp_pm.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/mptcp/mptcp_pm.c 2020-07-14 19:34:59.000000000 +0200 @@ -0,0 +1,226 @@ +/* + * MPTCP implementation - MPTCP-subflow-management @@ -21859,7 +21975,7 @@ diff -aurN linux-5.4/net/mptcp/mptcp_pm.c mptcp-mptcp_trunk/net/mptcp/mptcp_pm.c +late_initcall(mptcp_path_manager_default); diff -aurN linux-5.4/net/mptcp/mptcp_redundant.c mptcp-mptcp_trunk/net/mptcp/mptcp_redundant.c --- linux-5.4/net/mptcp/mptcp_redundant.c 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/net/mptcp/mptcp_redundant.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/mptcp/mptcp_redundant.c 2020-07-14 19:34:59.000000000 +0200 @@ -0,0 +1,392 @@ +/* + * MPTCP Scheduler to reduce latency and jitter. @@ -22255,7 +22371,7 @@ diff -aurN linux-5.4/net/mptcp/mptcp_redundant.c mptcp-mptcp_trunk/net/mptcp/mpt +MODULE_VERSION("0.90"); diff -aurN linux-5.4/net/mptcp/mptcp_rr.c mptcp-mptcp_trunk/net/mptcp/mptcp_rr.c --- linux-5.4/net/mptcp/mptcp_rr.c 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/net/mptcp/mptcp_rr.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/mptcp/mptcp_rr.c 2020-07-14 19:34:59.000000000 +0200 @@ -0,0 +1,309 @@ +/* MPTCP Scheduler module selector. Highly inspired by tcp_cong.c */ + @@ -22568,7 +22684,7 @@ diff -aurN linux-5.4/net/mptcp/mptcp_rr.c mptcp-mptcp_trunk/net/mptcp/mptcp_rr.c +MODULE_VERSION("0.89"); diff -aurN linux-5.4/net/mptcp/mptcp_sched.c mptcp-mptcp_trunk/net/mptcp/mptcp_sched.c --- linux-5.4/net/mptcp/mptcp_sched.c 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/net/mptcp/mptcp_sched.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/mptcp/mptcp_sched.c 2020-07-14 19:34:59.000000000 +0200 @@ -0,0 +1,647 @@ +/* MPTCP Scheduler module selector. Highly inspired by tcp_cong.c */ + @@ -23219,7 +23335,7 @@ diff -aurN linux-5.4/net/mptcp/mptcp_sched.c mptcp-mptcp_trunk/net/mptcp/mptcp_s +late_initcall(mptcp_scheduler_default); diff -aurN linux-5.4/net/mptcp/mptcp_wvegas.c mptcp-mptcp_trunk/net/mptcp/mptcp_wvegas.c --- linux-5.4/net/mptcp/mptcp_wvegas.c 1970-01-01 01:00:00.000000000 +0100 -+++ mptcp-mptcp_trunk/net/mptcp/mptcp_wvegas.c 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/net/mptcp/mptcp_wvegas.c 2020-07-14 19:34:59.000000000 +0200 @@ -0,0 +1,271 @@ +/* + * MPTCP implementation - WEIGHTED VEGAS @@ -23492,9 +23608,49 @@ diff -aurN linux-5.4/net/mptcp/mptcp_wvegas.c mptcp-mptcp_trunk/net/mptcp/mptcp_ +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("MPTCP wVegas"); +MODULE_VERSION("0.1"); +diff -aurN linux-5.4/net/socket.c mptcp-mptcp_trunk/net/socket.c +--- linux-5.4/net/socket.c 2019-11-25 01:32:01.000000000 +0100 ++++ mptcp-mptcp_trunk/net/socket.c 2020-07-14 19:34:59.000000000 +0200 +@@ -91,6 +91,7 @@ + #include + + #include ++#include + #include + #include + +@@ -1350,6 +1351,7 @@ + int err; + struct socket *sock; + const struct net_proto_family *pf; ++ int old_protocol = protocol; + + /* + * Check protocol is in range +@@ -1370,6 +1372,9 @@ + family = PF_PACKET; + } + ++ if (old_protocol == IPPROTO_MPTCP) ++ protocol = IPPROTO_TCP; ++ + err = security_socket_create(family, type, protocol, kern); + if (err) + return err; +@@ -1419,6 +1424,10 @@ + if (err < 0) + goto out_module_put; + ++ if (sysctl_mptcp_enabled && old_protocol == IPPROTO_MPTCP && ++ type == SOCK_STREAM && (family == AF_INET || family == AF_INET6)) ++ mptcp_enable_sock(sock->sk); ++ + /* + * Now to bump the refcnt of the [loadable] module that owns this + * socket at sock_release time we decrement its refcnt. diff -aurN linux-5.4/tools/include/uapi/linux/bpf.h mptcp-mptcp_trunk/tools/include/uapi/linux/bpf.h --- linux-5.4/tools/include/uapi/linux/bpf.h 2019-11-25 01:32:01.000000000 +0100 -+++ mptcp-mptcp_trunk/tools/include/uapi/linux/bpf.h 2020-06-09 17:33:41.000000000 +0200 ++++ mptcp-mptcp_trunk/tools/include/uapi/linux/bpf.h 2020-07-14 19:34:59.000000000 +0200 @@ -3438,6 +3438,7 @@ BPF_TCP_LISTEN, BPF_TCP_CLOSING, /* Now a valid state */ diff --git a/root/target/linux/generic/hack-5.4/999-stop-promiscuous-info.patch b/root/target/linux/generic/hack-5.4/999-stop-promiscuous-info.patch index 2dc06ee6..850613b5 100644 --- a/root/target/linux/generic/hack-5.4/999-stop-promiscuous-info.patch +++ b/root/target/linux/generic/hack-5.4/999-stop-promiscuous-info.patch @@ -12,3 +12,36 @@ if (audit_enabled) { current_uid_gid(&uid, &gid); audit_log(current->audit_context, GFP_ATOMIC, +--- a/drivers/net/usb/r8152.c 2020-08-13 13:11:25.866435255 +0200 ++++ b/drivers/net/usb/r8152.c 2020-08-13 13:11:51.973994306 +0200 +@@ -2353,7 +2353,7 @@ + + if (netdev->flags & IFF_PROMISC) { + /* Unconditionally log net taps. */ +- netif_notice(tp, link, netdev, "Promiscuous mode enabled\n"); ++ //netif_notice(tp, link, netdev, "Promiscuous mode enabled\n"); + ocp_data |= RCR_AM | RCR_AAP; + mc_filter[1] = 0xffffffff; + mc_filter[0] = 0xffffffff; +--- a/drivers/net/usb/pegasus.c 2020-08-13 13:14:15.519570376 +0200 ++++ b/drivers/net/usb/pegasus.c 2020-08-13 13:14:26.795380006 +0200 +@@ -1031,7 +1031,7 @@ + + if (net->flags & IFF_PROMISC) { + pegasus->eth_regs[EthCtrl2] |= RX_PROMISCUOUS; +- netif_info(pegasus, link, net, "Promiscuous mode enabled\n"); ++ //netif_info(pegasus, link, net, "Promiscuous mode enabled\n"); + } else if (!netdev_mc_empty(net) || (net->flags & IFF_ALLMULTI)) { + pegasus->eth_regs[EthCtrl0] |= RX_MULTICAST; + pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS; +--- a/drivers/net/ethernet/realtek/r8169_main.c 2020-08-13 13:15:44.478068638 +0200 ++++ b/drivers/net/ethernet/realtek/r8169_main.c 2020-08-13 13:15:59.181820450 +0200 +@@ -4313,7 +4313,7 @@ + + if (dev->flags & IFF_PROMISC) { + /* Unconditionally log net taps. */ +- netif_notice(tp, link, dev, "Promiscuous mode enabled\n"); ++ //netif_notice(tp, link, dev, "Promiscuous mode enabled\n"); + rx_mode |= AcceptAllPhys; + } else if (netdev_mc_count(dev) > MC_FILTER_LIMIT || + dev->flags & IFF_ALLMULTI || diff --git a/root/target/linux/ipq40xx/base-files/etc/board.d/02_network b/root/target/linux/ipq40xx/base-files/etc/board.d/02_network new file mode 100755 index 00000000..0ac8b59a --- /dev/null +++ b/root/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -0,0 +1,173 @@ +#!/bin/sh +# +# Copyright (c) 2015 The Linux Foundation. All rights reserved. +# Copyright (c) 2011-2015 OpenWrt.org +# + +. /lib/functions/uci-defaults.sh +. /lib/functions/system.sh + +ipq40xx_setup_interfaces() +{ + local board="$1" + + case "$board" in + 8dev,habanero-dvk|\ + 8dev,jalapeno|\ + alfa-network,ap120c-ac|\ + engenius,emr3500|\ + engenius,ens620ext) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ;; + aruba,ap-303|\ + aruba,ap-365|\ + avm,fritzrepeater-1200|\ + dlink,dap-2610 |\ + engenius,eap1300|\ + engenius,emd1|\ + meraki,mr33|\ + netgear,ex6100v2|\ + netgear,ex6150v2|\ + zyxel,wre6606) + ucidef_set_interface_lan "eth0" + ;; + aruba,ap-303h) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ucidef_add_switch "switch0" \ + "0u@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "0u@eth1" "5:wan" + ;; + asus,map-ac2200|\ + cilab,meshpoint-one|\ + openmesh,a42|\ + openmesh,a62) + ucidef_set_interfaces_lan_wan "eth1" "eth0" + ;; + asus,rt-ac58u|\ + p2w,r619ac-128m|\ + p2w,r619ac|\ + zyxel,nbg6617) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ucidef_add_switch "switch0" \ + "0u@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" + ;; + avm,fritzbox-4040|\ + linksys,ea6350v3|\ + linksys,ea8300) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ucidef_add_switch "switch0" \ + "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" + ;; + avm,fritzbox-7530) + ucidef_add_switch "switch0" \ + "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" + ;; + avm,fritzrepeater-3000|\ + compex,wpj419|\ + compex,wpj428|\ + engenius,eap2200) + ucidef_set_interface_lan "eth0 eth1" + ;; + buffalo,wtr-m2133hp) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ucidef_add_switch "switch0" \ + "0u@eth0" "2:lan:3" "3:lan:2" "4:lan:1" + ;; + cellc,rtl30vw) + ucidef_set_interface_lan "eth0" + ucidef_add_switch "switch0" \ + "0u@eth0" "3:lan" "4:lan" + ;; + ezviz,cs-w3-wd1200g-eup) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ucidef_add_switch "switch0" \ + "0u@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "0u@eth1" "5:wan" + ;; + glinet,gl-b1300 |\ + glinet,gl-s1300) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ucidef_add_switch "switch0" \ + "0u@eth0" "3:lan" "4:lan" + ;; + mobipromo,cm520-79f) + ucidef_add_switch "switch0" \ + "0u@eth0" "3:lan:2" "4:lan:1" + ucidef_set_interface_wan "eth1" + ;; + qxwlan,e2600ac-c1 |\ + qxwlan,e2600ac-c2) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ucidef_add_switch "switch0" \ + "0u@eth0" "3:lan" "4:lan" "0u@eth1" "5:wan" + ;; + unielec,u4019-32m) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ucidef_add_switch "switch0" \ + "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan" + ;; + *) + echo "Unsupported hardware. Network interfaces not initialized" + ;; + esac +} + +ipq40xx_setup_macs() +{ + local board="$1" + local lan_mac="" + local wan_mac="" + local label_mac="" + + case "$board" in + 8dev,habanero-dvk) + label_mac=$(mtd_get_mac_binary "ART" 0x1006) + ;; + asus,rt-ac58u|\ + p2w,r619ac-128m|\ + p2w,r619ac) + CI_UBIPART=UBI_DEV + wan_mac=$(mtd_get_mac_binary_ubi Factory 0x1006) + lan_mac=$(mtd_get_mac_binary_ubi Factory 0x5006) + label_mac=$wan_mac + ;; + cilab,meshpoint-one) + label_mac=$(mtd_get_mac_binary "ART" 0x1006) + ;; + dlink,dap-2610) + lan_mac=$(mtd_get_mac_ascii bdcfg lanmac) + label_mac=$lan_mac + ;; + engenius,eap2200|\ + engenius,emd1) + lan_mac=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr) + label_mac=$lan_mac + ;; + engenius,emr3500) + wan_mac=$(mtd_get_mac_ascii 0:APPSBLENV wanaddr) + lan_mac=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr) + label_mac=$wan_mac + ;; + engenius,ens620ext) + wan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) + lan_mac=$(macaddr_add "$wan_mac" 1) + ;; + ezviz,cs-w3-wd1200g-eup) + label_mac=$(mtd_get_mac_binary "ART" 0x6) + ;; + linksys,ea6350v3) + wan_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) + lan_mac=$(macaddr_add "$wan_mac" 1) + ;; + esac + + [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac + [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac + [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac +} + +board_config_update +board=$(board_name) +ipq40xx_setup_interfaces $board +ipq40xx_setup_macs $board +board_config_flush + +exit 0 diff --git a/root/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/root/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata new file mode 100644 index 00000000..4b69c79f --- /dev/null +++ b/root/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -0,0 +1,242 @@ +#!/bin/sh + +[ -e /lib/firmware/$FIRMWARE ] && exit 0 + +. /lib/functions/caldata.sh + +board=$(board_name) + +case "$FIRMWARE" in +"ath10k/cal-pci-0000:01:00.0.bin") + case "$board" in + meraki,mr33) + caldata_extract_ubi "ART" 0x9000 0x844 + caldata_valid "4408" || caldata_extract "ART" 0x9000 0x844 + ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +1) + ;; + esac + ;; +"ath10k/pre-cal-pci-0000:01:00.0.bin") + case "$board" in + asus,map-ac2200) + caldata_extract_ubi "Factory" 0x9000 0x2f20 + ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ + /lib/firmware/ath10k/QCA9888/hw2.0/board.bin + ;; + avm,fritzrepeater-3000) + /usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \ + /usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \ + /usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \ + /usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \ + /usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \ + /usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") + ;; + buffalo,wtr-m2133hp) + caldata_extract "ART" 0x9000 0x2f20 + ath10k_patch_mac $(mtd_get_mac_binary ORGDATA 0x32) + ;; + engenius,eap2200 |\ + openmesh,a62) + caldata_extract "0:ART" 0x9000 0x2f20 + ;; + linksys,ea8300) + caldata_extract "ART" 0x9000 0x2f20 + # OEM assigns 4 sequential MACs + ath10k_patch_mac $(macaddr_setbit_la $(macaddr_add "$(cat /sys/class/net/eth0/address)" 4)) + ;; + esac + ;; +"ath10k/pre-cal-ahb-a000000.wifi.bin") + case "$board" in + 8dev,habanero-dvk |\ + 8dev,jalapeno |\ + alfa-network,ap120c-ac |\ + cilab,meshpoint-one |\ + ezviz,cs-w3-wd1200g-eup |\ + glinet,gl-b1300 |\ + glinet,gl-s1300 |\ + linksys,ea6350v3 |\ + mobipromo,cm520-79f |\ + p2w,r619ac-128m |\ + p2w,r619ac |\ + qcom,ap-dk01.1-c1) + caldata_extract "ART" 0x1000 0x2f20 + ;; + aruba,ap-303 |\ + aruba,ap-303h |\ + aruba,ap-365) + caldata_extract "ART" 0x1000 0x2f20 + ath10k_patch_mac $(mtd_get_mac_binary mfginfo 0x1D) + ;; + asus,map-ac2200) + caldata_extract_ubi "Factory" 0x1000 0x2f20 + ;; + asus,rt-ac58u) + CI_UBIPART=UBI_DEV + caldata_extract_ubi "Factory" 0x1000 0x2f20 + ;; + avm,fritzbox-4040) + /usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config") + ;; + avm,fritzbox-7530 |\ + avm,fritzrepeater-1200 |\ + avm,fritzrepeater-3000) + /usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \ + /usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \ + /usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \ + /usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \ + /usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \ + /usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") + ;; + buffalo,wtr-m2133hp) + caldata_extract "ART" 0x1000 0x2f20 + ath10k_patch_mac $(mtd_get_mac_binary ORGDATA 0x26) + ;; + cellc,rtl30vw |\ + compex,wpj419 |\ + compex,wpj428 |\ + engenius,eap1300 |\ + engenius,eap2200 |\ + openmesh,a42 |\ + openmesh,a62 |\ + qxwlan,e2600ac-c1 |\ + qxwlan,e2600ac-c2 |\ + unielec,u4019-32m) + caldata_extract "0:ART" 0x1000 0x2f20 + ;; + dlink,dap-2610) + caldata_extract "ART" 0x1000 0x2f20 + ath10k_patch_mac $(mtd_get_mac_ascii bdcfg wlanmac) + ;; + engenius,emd1) + caldata_extract "0:ART" 0x1000 0x2f20 + ath10k_patch_mac $(mtd_get_mac_ascii 0:APPSBLENV wlanaddr) + ;; + engenius,emr3500) + caldata_extract "0:ART" 0x1000 0x2f20 + ath10k_patch_mac $(mtd_get_mac_ascii 0:APPSBLENV ethaddr) + ;; + engenius,ens620ext) + caldata_extract "ART" 0x1000 0x2f20 + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +2) + ;; + linksys,ea8300) + caldata_extract "ART" 0x1000 0x2f20 + ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 2) + ;; + meraki,mr33) + caldata_extract_ubi "ART" 0x1000 0x2f20 + caldata_valid "202f" || caldata_extract "ART" 0x1000 0x2f20 + ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +2) + ;; + netgear,ex6100v2 |\ + netgear,ex6150v2) + caldata_extract "ART" 0x1000 0x2f20 + ath10k_patch_mac $(mtd_get_mac_binary dnidata 0x0) + ;; + zyxel,nbg6617 |\ + zyxel,wre6606) + caldata_extract "ART" 0x1000 0x2f20 + ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2) + ;; + esac + ;; +"ath10k/pre-cal-ahb-a800000.wifi.bin") + case "$board" in + 8dev,habanero-dvk |\ + 8dev,jalapeno |\ + alfa-network,ap120c-ac |\ + cilab,meshpoint-one |\ + ezviz,cs-w3-wd1200g-eup |\ + glinet,gl-b1300 |\ + glinet,gl-s1300 |\ + linksys,ea6350v3 |\ + mobipromo,cm520-79f |\ + p2w,r619ac-128m |\ + p2w,r619ac |\ + qcom,ap-dk01.1-c1) + caldata_extract "ART" 0x5000 0x2f20 + ;; + aruba,ap-303 |\ + aruba,ap-303h |\ + aruba,ap-365) + caldata_extract "ART" 0x5000 0x2f20 + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary mfginfo 0x1D) +1) + ;; + asus,map-ac2200) + caldata_extract_ubi "Factory" 0x5000 0x2f20 + ;; + asus,rt-ac58u) + CI_UBIPART=UBI_DEV + caldata_extract_ubi "Factory" 0x5000 0x2f20 + ;; + avm,fritzbox-4040) + /usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config") + ;; + avm,fritzbox-7530 |\ + avm,fritzrepeater-1200 |\ + avm,fritzrepeater-3000) + /usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \ + /usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \ + /usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader0") || \ + /usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \ + /usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \ + /usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") + ;; + buffalo,wtr-m2133hp) + caldata_extract "ART" 0x5000 0x2f20 + ath10k_patch_mac $(mtd_get_mac_binary ORGDATA 0x2c) + ;; + cellc,rtl30vw |\ + compex,wpj419 |\ + compex,wpj428 |\ + engenius,eap1300 |\ + engenius,eap2200 |\ + openmesh,a42 |\ + openmesh,a62 |\ + qxwlan,e2600ac-c1 |\ + qxwlan,e2600ac-c2 |\ + unielec,u4019-32m) + caldata_extract "0:ART" 0x5000 0x2f20 + ;; + dlink,dap-2610) + caldata_extract "ART" 0x5000 0x2f20 + ath10k_patch_mac $(mtd_get_mac_ascii bdcfg wlanmac_a) + ;; + engenius,emd1) + caldata_extract "0:ART" 0x5000 0x2f20 + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii 0:APPSBLENV wlanaddr) +1) + ;; + engenius,emr3500) + caldata_extract "0:ART" 0x5000 0x2f20 + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii 0:APPSBLENV ethaddr) +1) + ;; + engenius,ens620ext) + caldata_extract "ART" 0x5000 0x2f20 + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +3) + ;; + linksys,ea8300) + caldata_extract "ART" 0x5000 0x2f20 + ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 3) + ;; + meraki,mr33) + caldata_extract_ubi "ART" 0x5000 0x2f20 + caldata_valid "202f" || caldata_extract "ART" 0x5000 0x2f20 + ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +3) + ;; + netgear,ex6100v2 |\ + netgear,ex6150v2) + caldata_extract "ART" 0x5000 0x2f20 + ath10k_patch_mac $(mtd_get_mac_binary dnidata 0xc) + ;; + zyxel,nbg6617 |\ + zyxel,wre6606) + caldata_extract "ART" 0x5000 0x2f20 + ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1) + ;; + esac + ;; +*) + exit 1 + ;; +esac diff --git a/root/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/root/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh new file mode 100644 index 00000000..f874aa4b --- /dev/null +++ b/root/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh @@ -0,0 +1,123 @@ +PART_NAME=firmware +REQUIRE_IMAGE_METADATA=1 + +RAMFS_COPY_BIN='fw_printenv fw_setenv' +RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock' + +platform_check_image() { + case "$(board_name)" in + asus,rt-ac58u) + CI_UBIPART="UBI_DEV" + local ubidev=$(nand_find_ubi $CI_UBIPART) + local asus_root=$(nand_find_volume $ubidev jffs2) + + [ -n "$asus_root" ] || return 0 + + cat << EOF +jffs2 partition is still present. +There's probably no space left +to install the filesystem. + +You need to delete the jffs2 partition first: +# ubirmvol /dev/ubi0 --name=jffs2 + +Once this is done. Retry. +EOF + return 1 + ;; + esac + return 0; +} + +askey_do_upgrade() { + local tar_file="$1" + + local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$') + board_dir=${board_dir%/} + + tar Oxf $tar_file ${board_dir}/root | mtd write - rootfs + + nand_do_upgrade "$1" +} + +zyxel_do_upgrade() { + local tar_file="$1" + + local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$') + board_dir=${board_dir%/} + + tar Oxf $tar_file ${board_dir}/kernel | mtd write - kernel + + if [ -n "$UPGRADE_BACKUP" ]; then + tar Oxf $tar_file ${board_dir}/root | mtd -j "$UPGRADE_BACKUP" write - rootfs + else + tar Oxf $tar_file ${board_dir}/root | mtd write - rootfs + fi +} + +platform_do_upgrade() { + case "$(board_name)" in + 8dev,jalapeno |\ + aruba,ap-303 |\ + aruba,ap-303h |\ + aruba,ap-365 |\ + avm,fritzbox-7530 |\ + avm,fritzrepeater-1200 |\ + avm,fritzrepeater-3000 |\ + buffalo,wtr-m2133hp |\ + cilab,meshpoint-one |\ + engenius,eap2200 |\ + mobipromo,cm520-79f |\ + qxwlan,e2600ac-c2) + nand_do_upgrade "$1" + ;; + alfa-network,ap120c-ac) + part="$(awk -F 'ubi.mtd=' '{printf $2}' /proc/cmdline | sed -e 's/ .*$//')" + if [ "$part" = "rootfs1" ]; then + fw_setenv active 2 || exit 1 + CI_UBIPART="rootfs2" + else + fw_setenv active 1 || exit 1 + CI_UBIPART="rootfs1" + fi + nand_do_upgrade "$1" + ;; + asus,map-ac2200) + CI_KERNPART="linux" + nand_do_upgrade "$1" + ;; + asus,rt-ac58u) + CI_UBIPART="UBI_DEV" + CI_KERNPART="linux" + nand_do_upgrade "$1" + ;; + cellc,rtl30vw) + CI_UBIPART="ubifs" + askey_do_upgrade "$1" + ;; + compex,wpj419|\ + p2w,r619ac-128m|\ + p2w,r619ac) + nand_do_upgrade "$1" + ;; + linksys,ea6350v3 |\ + linksys,ea8300) + platform_do_upgrade_linksys "$1" + ;; + meraki,mr33) + CI_KERNPART="part.safe" + nand_do_upgrade "$1" + ;; + openmesh,a42 |\ + openmesh,a62) + PART_NAME="inactive" + platform_do_upgrade_openmesh "$1" + ;; + zyxel,nbg6617) + zyxel_do_upgrade "$1" + ;; + *) + default_do_upgrade "$1" + ;; + esac +} diff --git a/root/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac-128m.dts b/root/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac-128m.dts new file mode 100644 index 00000000..b51378a7 --- /dev/null +++ b/root/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac-128m.dts @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qcom-ipq4019-r619ac.dtsi" + +/ { + model = "P&W R619AC 128M"; + compatible = "p2w,r619ac-128m"; + + chosen { + bootargs-append = " root=/dev/ubiblock0_1 rootfstype=squashfs"; + }; +}; + +&rootfs_part1 { + reg = <0x0 0x8000000>; +}; + +/delete-node/ &rootfs_part2; diff --git a/root/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac.dts b/root/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac.dts new file mode 100644 index 00000000..31010dd1 --- /dev/null +++ b/root/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac.dts @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qcom-ipq4019-r619ac.dtsi" + +/ { + model = "P&W R619AC"; + compatible = "p2w,r619ac"; + + chosen { + bootargs-append = " root=/dev/ubiblock0_1 rootfstype=squashfs"; + }; +}; diff --git a/root/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi b/root/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi new file mode 100644 index 00000000..81018dd0 --- /dev/null +++ b/root/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi @@ -0,0 +1,322 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qcom-ipq4019.dtsi" +#include +#include +#include + +/ { + aliases { + led-boot = &led_sys; + led-failsafe = &led_sys; + led-running = &led_sys; + led-upgrade = &led_sys; + label-mac-device = &gmac0; + }; + + soc { + rng@22000 { + status = "okay"; + }; + + mdio@90000 { + status = "okay"; + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + }; + + ess-psgmii@98000 { + status = "okay"; + }; + + tcsr@1949000 { + compatible = "qcom,tcsr"; + reg = <0x1949000 0x100>; + qcom,wifi_glb_cfg = ; + }; + + tcsr@194b000 { + compatible = "qcom,tcsr"; + reg = <0x194b000 0x100>; + qcom,usb-hsphy-mode-select = ; + }; + + ess_tcsr@1953000 { + compatible = "qcom,tcsr"; + reg = <0x1953000 0x1000>; + qcom,ess-interface-select = ; + }; + + tcsr@1957000 { + compatible = "qcom,tcsr"; + reg = <0x1957000 0x100>; + qcom,wifi_noc_memtype_m0_m2 = ; + }; + + usb2@60f8800 { + status = "okay"; + }; + + usb3@8af8800 { + status = "okay"; + }; + + crypto@8e3a000 { + status = "okay"; + }; + + watchdog@b017000 { + status = "okay"; + }; + + ess-switch@c000000 { + status = "okay"; + }; + + edma@c080000 { + status = "okay"; + }; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-0 = <&led_pins>; + pinctrl-names = "default"; + + led_sys: sys { + label = "r619ac:blue:sys"; + gpios = <&tlmm 39 GPIO_ACTIVE_HIGH>; + }; + + wlan2g { + label = "r619ac:blue:wlan2g"; + gpios = <&tlmm 32 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy0tpt"; + }; + + wlan5g { + label = "r619ac:blue:wlan5g"; + gpios = <&tlmm 50 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy1tpt"; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&tlmm 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&blsp_dma { + status = "okay"; +}; + +&blsp1_spi1 { + status = "okay"; + + flash@0 { + reg = <0>; + compatible = "jedec,spi-nor"; + spi-max-frequency = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "SBL1"; + reg = <0x0 0x40000>; + read-only; + }; + + partition@40000 { + label = "MIBIB"; + reg = <0x40000 0x20000>; + read-only; + }; + + partition@60000 { + label = "QSEE"; + reg = <0x60000 0x60000>; + read-only; + }; + + partition@c0000 { + label = "CDT"; + reg = <0xc0000 0x10000>; + read-only; + }; + + partition@d0000 { + label = "DDRPARAMS"; + reg = <0xd0000 0x10000>; + read-only; + }; + + partition@e0000 { + label = "APPSBLENV"; + reg = <0xe0000 0x10000>; + read-only; + }; + + partition@f0000 { + label = "APPSBL"; + reg = <0xf0000 0x80000>; + read-only; + }; + + partition@1 { + label = "Bootloader"; + reg = <0x0 0x170000>; + read-only; + }; + + partition@170000 { + label = "ART"; + reg = <0x170000 0x10000>; + read-only; + }; + + partition@180000 { + label = "unused"; + reg = <0x180000 0xe80000>; + }; + }; + }; +}; + +&blsp1_uart1 { + pinctrl-0 = <&serial_0_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&nand { + status = "okay"; + + nand@0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + rootfs_part1: partition@0 { + label = "rootfs"; + reg = <0x0 0x4000000>; + }; + + rootfs_part2: partition@4000000 { + label = "unused1"; + reg = <0x4000000 0x4000000>; + }; + }; + }; +}; + +&qpic_bam { + status = "okay"; +}; + +&sdhci { + pinctrl-0 = <&sd_0_pins>; + pinctrl-names = "default"; + vqmmc-supply = <&vqmmc>; + status = "okay"; +}; + +&tlmm { + mdio_pins: mdio_pinmux { + mux_1 { + pins = "gpio6"; + function = "mdio"; + bias-pull-up; + }; + + mux_2 { + pins = "gpio7"; + function = "mdc"; + bias-pull-up; + }; + }; + + sd_0_pins: sd_0_pinmux { + mux_1 { + pins = "gpio23", "gpio24", "gpio25", "gpio26", "gpio28"; + function = "sdio"; + drive-strength = <10>; + }; + + mux_2 { + pins = "gpio27"; + function = "sdio"; + drive-strength = <16>; + }; + }; + + serial_0_pins: serial0-pinmux { + mux { + pins = "gpio16", "gpio17"; + function = "blsp_uart0"; + bias-disable; + }; + }; + + led_pins: led_pinmux { + mux { + pins = "gpio32", "gpio39", "gpio50"; + function = "gpio"; + bias-pull-up; + output-low; + }; + + mux_1 { + pins = "gpio52"; + function = "gpio"; + bias-pull-up; + output-high; + }; + + mux_2 { + pins = "gpio61"; + function = "gpio"; + bias-pull-down; + output-high; + }; + }; +}; + +&usb3_ss_phy { + status = "okay"; +}; + +&usb3_hs_phy { + status = "okay"; +}; + +&usb2_hs_phy { + status = "okay"; +}; + +&vqmmc { + status = "okay"; +}; + +&wifi0 { + status = "okay"; + qcom,ath10k-calibration-variant = "R619AC"; +}; + +&wifi1 { + status = "okay"; + qcom,ath10k-calibration-variant = "R619AC"; +}; diff --git a/root/target/linux/ipq40xx/image/Makefile b/root/target/linux/ipq40xx/image/Makefile new file mode 100644 index 00000000..44b6da6d --- /dev/null +++ b/root/target/linux/ipq40xx/image/Makefile @@ -0,0 +1,734 @@ +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/image.mk + +DEVICE_VARS += NETGEAR_BOARD_ID NETGEAR_HW_ID +DEVICE_VARS += RAS_BOARD RAS_ROOTFS_SIZE RAS_VERSION +DEVICE_VARS += WRGG_DEVNAME WRGG_SIGNATURE + +define Device/Default + PROFILES := Default + KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts) + KERNEL_INITRAMFS_PREFIX := $$(IMG_PREFIX)-$(1)-initramfs + KERNEL_PREFIX := $$(IMAGE_PREFIX) + KERNEL_LOADADDR := 0x80208000 + DEVICE_DTS = $$(SOC)-$(lastword $(subst _, ,$(1))) + SUPPORTED_DEVICES := $(subst _,$(comma),$(1)) + IMAGES := sysupgrade.bin + IMAGE/sysupgrade.bin = sysupgrade-tar | append-metadata + IMAGE/sysupgrade.bin/squashfs := +endef + +define Device/FitImage + KERNEL_SUFFIX := -fit-uImage.itb + KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb + KERNEL_NAME := Image +endef + +define Device/FitImageLzma + KERNEL_SUFFIX := -fit-uImage.itb + KERNEL = kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb + KERNEL_NAME := Image +endef + +define Device/FitzImage + KERNEL_SUFFIX := -fit-zImage.itb + KERNEL = kernel-bin | fit none $$(DTS_DIR)/$$(DEVICE_DTS).dtb + KERNEL_NAME := zImage +endef + +define Device/UbiFit + KERNEL_IN_UBI := 1 + IMAGES := nand-factory.ubi nand-sysupgrade.bin + IMAGE/nand-factory.ubi := append-ubi + IMAGE/nand-sysupgrade.bin := sysupgrade-tar | append-metadata +endef + +define Device/DniImage + $(call Device/FitzImage) + NETGEAR_BOARD_ID := + NETGEAR_HW_ID := + IMAGES += factory.img + IMAGE/factory.img := append-kernel | pad-offset 64k 64 | append-uImage-fakehdr filesystem | append-rootfs | pad-rootfs | netgear-dni + IMAGE/sysupgrade.bin := append-kernel | pad-offset 64k 64 | append-uImage-fakehdr filesystem | \ + append-rootfs | pad-rootfs | append-metadata | check-size +endef + +define Build/append-rootfshdr + mkimage -A $(LINUX_KARCH) \ + -O linux -T filesystem \ + -C lzma -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \ + -n root.squashfs -d $(IMAGE_ROOTFS) $@.new + dd if=$@.new bs=64 count=1 >> $(IMAGE_KERNEL) +endef + +define Build/mkmylofw_32m + $(eval device_id=$(word 1,$(1))) + $(eval revision=$(word 2,$(1))) + + let \ + size="$$(stat -c%s $@)" \ + pad="$(subst k,* 1024,$(BLOCKSIZE))" \ + pad="(pad - (size % pad)) % pad" \ + newsize='size + pad'; \ + $(STAGING_DIR_HOST)/bin/mkmylofw \ + -B WPE72 -i 0x11f6:$(device_id):0x11f6:$(device_id) -r $(revision) \ + -s 0x2000000 -p0x180000:$$newsize:al:0x80208000:"OpenWrt":$@ \ + $@.new + @mv $@.new $@ +endef + +define Build/qsdk-ipq-factory-nand-askey + $(TOPDIR)/scripts/mkits-qsdk-ipq-image.sh $@.its\ + askey_kernel $(IMAGE_KERNEL) \ + askey_fs $(IMAGE_ROOTFS) \ + ubifs $@ + PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new + @mv $@.new $@ +endef + +define Build/SenaoFW + -$(STAGING_DIR_HOST)/bin/mksenaofw \ + -n $(BOARD_NAME) -r $(VENDOR_ID) -p $(1) \ + -c $(DATECODE) -w $(2) -x $(CW_VER) -t 0 \ + -e $@ \ + -o $@.new + @cp $@.new $@ +endef + +define Build/wrgg-image + mkwrggimg -i $@ \ + -o $@.new \ + -d "$(WRGG_DEVNAME)" \ + -s "$(WRGG_SIGNATURE)" \ + -v "" -m "" -B "" + mv $@.new $@ +endef + +define Device/8dev_habanero-dvk + $(call Device/FitImageLzma) + DEVICE_VENDOR := 8devices + DEVICE_MODEL := Habanero DVK + IMAGE_SIZE := 30976k + SOC := qcom-ipq4019 + DEVICE_PACKAGES := ipq-wifi-8dev_habanero-dvk + IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | append-rootfs | pad-rootfs | append-metadata | check-size +endef +TARGET_DEVICES += 8dev_habanero-dvk + +define Device/8dev_jalapeno-common + $(call Device/FitImage) + $(call Device/UbiFit) + BLOCKSIZE := 128k + PAGESIZE := 2048 + SOC := qcom-ipq4018 +endef + +define Device/8dev_jalapeno + $(call Device/8dev_jalapeno-common) + DEVICE_VENDOR := 8devices + DEVICE_MODEL := Jalapeno +endef +TARGET_DEVICES += 8dev_jalapeno + +define Device/alfa-network_ap120c-ac + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := ALFA Network + DEVICE_MODEL := AP120C-AC + SOC := qcom-ipq4018 + DEVICE_PACKAGES := kmod-usb-acm \ + kmod-tpm-i2c-atmel uboot-envtools + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 65536k + IMAGES := nand-factory.bin nand-sysupgrade.bin + IMAGE/nand-factory.bin := append-ubi | qsdk-ipq-factory-nand +endef +TARGET_DEVICES += alfa-network_ap120c-ac + +define Device/aruba_glenmorangie + $(call Device/FitImageLzma) + DEVICE_VENDOR := Aruba + SOC := qcom-ipq4029 + DEVICE_PACKAGES := ipq-wifi-aruba_ap-303 +endef + +define Device/aruba_ap-303 + $(call Device/aruba_glenmorangie) + DEVICE_MODEL := AP-303 +endef +TARGET_DEVICES += aruba_ap-303 + +define Device/aruba_ap-303h + $(call Device/aruba_glenmorangie) + DEVICE_MODEL := AP-303H +endef +TARGET_DEVICES += aruba_ap-303h + +define Device/aruba_ap-365 + $(call Device/aruba_glenmorangie) + DEVICE_MODEL := AP-365 + DEVICE_PACKAGES += kmod-hwmon-ad7418 +endef +TARGET_DEVICES += aruba_ap-365 + +define Device/asus_map-ac2200 + $(call Device/FitImageLzma) + DEVICE_VENDOR := ASUS + DEVICE_MODEL := Lyra (MAP-AC2200) + SOC := qcom-ipq4019 + DEVICE_PACKAGES := ath10k-firmware-qca9888-ct kmod-ath3k +endef +TARGET_DEVICES += asus_map-ac2200 + +define Device/asus_rt-ac58u + $(call Device/FitImageLzma) + DEVICE_VENDOR := ASUS + DEVICE_MODEL := RT-AC58U + SOC := qcom-ipq4018 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DTB_SIZE := 65536 + IMAGE_SIZE := 20439364 + FILESYSTEMS := squashfs +# Someone - in their infinite wisdom - decided to put the firmware +# version in front of the image name \03\00\00\04 => Version 3.0.0.4 +# Since u-boot works with strings we either need another fixup step +# to add a version... or we are very careful not to add '\0' into that +# string and call it a day.... Yeah, we do the latter! + UIMAGE_NAME:=$(shell echo -e '\03\01\01\01RT-AC58U') + DEVICE_PACKAGES := -kmod-ath10k-ct kmod-ath10k-ct-smallbuffers \ + kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += asus_rt-ac58u + +define Device/avm_fritzbox-4040 + $(call Device/FitImageLzma) + DEVICE_VENDOR := AVM + DEVICE_MODEL := FRITZ!Box 4040 + SOC := qcom-ipq4018 + BOARD_NAME := fritz4040 + IMAGE_SIZE := 29056k + UBOOT_PATH := $(STAGING_DIR_IMAGE)/uboot-fritz4040.bin + UBOOT_PARTITION_SIZE := 524288 + IMAGES += eva.bin + IMAGE/eva.bin := append-uboot | pad-to $$$$(UBOOT_PARTITION_SIZE) | append-kernel | append-rootfs | pad-rootfs + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata | check-size + DEVICE_PACKAGES := fritz-tffs fritz-caldata +endef +TARGET_DEVICES += avm_fritzbox-4040 + +define Device/avm_fritzbox-7530 + $(call Device/FitImageLzma) + DEVICE_VENDOR := AVM + DEVICE_MODEL := FRITZ!Box 7530 + SOC := qcom-ipq4019 + DEVICE_PACKAGES := fritz-caldata fritz-tffs-nand +endef +TARGET_DEVICES += avm_fritzbox-7530 + +define Device/avm_fritzrepeater-1200 + $(call Device/FitImageLzma) + DEVICE_VENDOR := AVM + DEVICE_MODEL := FRITZ!Repeater 1200 + SOC := qcom-ipq4019 + DEVICE_PACKAGES := fritz-caldata fritz-tffs-nand ipq-wifi-avm_fritzrepeater-1200 +endef +TARGET_DEVICES += avm_fritzrepeater-1200 + +define Device/avm_fritzrepeater-3000 + $(call Device/FitImageLzma) + DEVICE_VENDOR := AVM + DEVICE_MODEL := FRITZ!Repeater 3000 + SOC := qcom-ipq4019 + DEVICE_PACKAGES := ath10k-firmware-qca9984-ct fritz-caldata fritz-tffs-nand +endef +TARGET_DEVICES += avm_fritzrepeater-3000 + +define Device/buffalo_wtr-m2133hp + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := Buffalo + DEVICE_MODEL := WTR-M2133HP + SOC := qcom-ipq4019 + DEVICE_PACKAGES := uboot-envtools ath10k-firmware-qca9984-ct ipq-wifi-buffalo_wtr-m2133hp + BLOCKSIZE := 128k + PAGESIZE := 2048 +endef +TARGET_DEVICES += buffalo_wtr-m2133hp + +define Device/cellc_rtl30vw + KERNEL_SUFFIX := -fit-uImage.itb + KERNEL_INITRAMFS = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb + KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb | uImage lzma | pad-to 2048 + KERNEL_NAME := Image + KERNEL_IN_UBI := + IMAGES := nand-factory.bin nand-sysupgrade.bin + IMAGE/nand-factory.bin := append-rootfshdr | append-ubi | qsdk-ipq-factory-nand-askey + IMAGE/nand-sysupgrade.bin := append-rootfshdr | sysupgrade-tar | append-metadata + DEVICE_VENDOR := Cell C + DEVICE_MODEL := RTL30VW + SOC := qcom-ipq4019 + DEVICE_DTS_CONFIG := config@5 + KERNEL_INSTALL := 1 + KERNEL_SIZE := 4096k + IMAGE_SIZE := 57344k + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_PACKAGES := kmod-usb-net-qmi-wwan kmod-usb-serial-option uqmi ipq-wifi-cellc_rtl30vw +endef +TARGET_DEVICES += cellc_rtl30vw + +define Device/cilab_meshpoint-one + $(call Device/8dev_jalapeno-common) + DEVICE_VENDOR := Crisis Innovation Lab + DEVICE_MODEL := MeshPoint.One + DEVICE_PACKAGES := kmod-i2c-gpio kmod-iio-bmp280-i2c kmod-hwmon-ina2xx kmod-rtc-pcf2127 +endef +TARGET_DEVICES += cilab_meshpoint-one + +define Device/compex_wpj419 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := Compex + DEVICE_MODEL := WPJ419 + SOC := qcom-ipq4019 + DEVICE_DTS_CONFIG := config@12 + KERNEL_INSTALL := 1 + BLOCKSIZE := 128k + PAGESIZE := 2048 + FILESYSTEMS := squashfs +endef +TARGET_DEVICES += compex_wpj419 + +define Device/compex_wpj428 + $(call Device/FitImage) + DEVICE_VENDOR := Compex + DEVICE_MODEL := WPJ428 + SOC := qcom-ipq4028 + DEVICE_DTS_CONFIG := config@4 + BLOCKSIZE := 64k + IMAGE_SIZE := 31232k + KERNEL_SIZE := 4096k + IMAGES += cpximg-6a04.bin + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata + IMAGE/cpximg-6a04.bin := append-kernel | append-rootfs | pad-rootfs | mkmylofw_32m 0x8A2 3 + DEVICE_PACKAGES := kmod-gpio-beeper +endef +TARGET_DEVICES += compex_wpj428 + +define Device/dlink_dap-2610 + $(call Device/FitImageLzma) + DEVICE_VENDOR := D-Link + DEVICE_MODEL := DAP-2610 + SOC := qcom-ipq4018 + DEVICE_DTS_CONFIG := config@ap.dk01.1-c1 + BLOCKSIZE := 64k + WRGG_DEVNAME := /dev/mtdblock/8 + WRGG_SIGNATURE := wapac30_dkbs_dap2610 + IMAGE_SIZE := 14080k + IMAGES += factory.bin + # Bootloader expects a special 160 byte header which is added by + # wrgg-image. + # Factory image size must be larger than 6MB, and size in wrgg header must + # match actual factory image size to be flashable from D-Link http server. + # Bootloader verifies checksum of wrgg image before booting, thus jffs2 + # cannot be part of the wrgg image. This is solved in the factory image by + # having the rootfs at the end of the image (without pad-rootfs). And in + # the sysupgrade image only the kernel is included in the wrgg checksum, + # but this is not flashable from the D-link http server. + # append-rootfs must start on an erase block boundary. + IMAGE/factory.bin := append-kernel | pad-offset 6144k 160 | append-rootfs | wrgg-image | check-size + IMAGE/sysupgrade.bin := append-kernel | wrgg-image | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size | append-metadata + DEVICE_PACKAGES := ipq-wifi-dlink_dap2610 +endef +TARGET_DEVICES += dlink_dap-2610 + +define Device/engenius_eap1300 + $(call Device/FitImage) + DEVICE_VENDOR := EnGenius + DEVICE_MODEL := EAP1300 + DEVICE_DTS_CONFIG := config@4 + BOARD_NAME := eap1300 + SOC := qcom-ipq4018 + KERNEL_SIZE := 5120k + IMAGE_SIZE := 25344k + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata +endef +TARGET_DEVICES += engenius_eap1300 + +define Device/engenius_eap2200 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := EnGenius + DEVICE_MODEL := EAP2200 + SOC := qcom-ipq4019 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_PACKAGES := ath10k-firmware-qca9888-ct ipq-wifi-engenius_eap2200 -kmod-ath10k-ct kmod-ath10k-ct-smallbuffers +endef +TARGET_DEVICES += engenius_eap2200 + +define Device/engenius_emd1 + $(call Device/FitImage) + DEVICE_VENDOR := EnGenius + DEVICE_MODEL := EMD1 + DEVICE_DTS_CONFIG := config@4 + SOC := qcom-ipq4018 + IMAGE_SIZE := 30720k + IMAGES += factory.bin + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata + IMAGE/factory.bin := qsdk-ipq-factory-nor | check-size +endef +TARGET_DEVICES += engenius_emd1 + +define Device/engenius_emr3500 + $(call Device/FitImage) + DEVICE_VENDOR := EnGenius + DEVICE_MODEL := EMR3500 + DEVICE_DTS_CONFIG := config@4 + SOC := qcom-ipq4018 + KERNEL_SIZE := 4096k + IMAGE_SIZE := 30720k + IMAGES += factory.bin + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata + IMAGE/factory.bin := qsdk-ipq-factory-nor | check-size +endef +TARGET_DEVICES += engenius_emr3500 + +define Device/engenius_ens620ext + $(call Device/FitImage) + DEVICE_VENDOR := EnGenius + DEVICE_MODEL := ENS620EXT + SOC := qcom-ipq4018 + DEVICE_DTS_CONFIG := config@4 + BLOCKSIZE := 64k + PAGESIZE := 256 + BOARD_NAME := ENS620EXT + VENDOR_ID := 0x0101 + PRODUCT_ID := 0x79 + PRODUCT_ID_NEW := 0xA4 + DATECODE := 190507 + FW_VER := 3.1.2 + FW_VER_NEW := 3.5.6 + CW_VER := 1.8.99 + IMAGE_SIZE := 21312k + KERNEL_SIZE := 5120k + FILESYSTEMS := squashfs + IMAGES += factory_30.bin factory_35.bin + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | check-size | append-metadata + IMAGE/factory_30.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size | SenaoFW $$$$(PRODUCT_ID) $$$$(FW_VER) + IMAGE/factory_35.bin := qsdk-ipq-factory-nor | check-size | SenaoFW $$$$(PRODUCT_ID_NEW) $$$$(FW_VER_NEW) +endef +TARGET_DEVICES += engenius_ens620ext + +define Device/ezviz_cs-w3-wd1200g-eup + $(call Device/FitImage) + DEVICE_VENDOR := EZVIZ + DEVICE_MODEL := CS-W3-WD1200G + DEVICE_VARIANT := EUP + DEVICE_DTS_CONFIG := config@4 + IMAGE_SIZE := 14848k + SOC := qcom-ipq4018 + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \ + append-metadata + DEVICE_PACKAGES := -kmod-ath10k-ct kmod-ath10k-ct-smallbuffers \ + ipq-wifi-ezviz_cs-w3-wd1200g-eup +endef +TARGET_DEVICES += ezviz_cs-w3-wd1200g-eup + +define Device/glinet_gl-b1300 + $(call Device/FitImage) + DEVICE_VENDOR := GL.iNet + DEVICE_MODEL := GL-B1300 + BOARD_NAME := gl-b1300 + SOC := qcom-ipq4029 + KERNEL_SIZE := 4096k + IMAGE_SIZE := 26624k + IMAGE/sysupgrade.bin := append-kernel |append-rootfs | pad-rootfs | append-metadata +endef +TARGET_DEVICES += glinet_gl-b1300 + +define Device/glinet_gl-s1300 + $(call Device/FitImage) + DEVICE_VENDOR := GL.iNet + DEVICE_MODEL := GL-S1300 + SOC := qcom-ipq4029 + KERNEL_SIZE := 4096k + IMAGE_SIZE := 26624k + IMAGES := sysupgrade.bin + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata + DEVICE_PACKAGES := ipq-wifi-glinet_gl-s1300 kmod-fs-ext4 kmod-mmc kmod-spi-dev +endef +TARGET_DEVICES += glinet_gl-s1300 + +define Device/linksys_ea6350v3 + # The Linksys EA6350v3 has a uboot bootloader that does not + # support either booting lzma kernel images nor booting UBI + # partitions. This uboot, however, supports raw kernel images and + # gzipped images. + # + # As for the time of writing this, the device will boot the kernel + # from a fixed address with a fixed length of 3MiB. Also, the + # device has a hard-coded kernel command line that requieres the + # rootfs and alt_rootfs to be in mtd11 and mtd13 respectively. + # Oh... and the kernel partition overlaps with the rootfs + # partition (the same for alt_kernel and alt_rootfs). + # + # If you are planing re-partitioning the device, you may want to + # keep those details in mind: + # 1. The kernel adresses you should honor are 0x00000000 and + # 0x02800000 respectively. + # 2. The kernel size (plus the dtb) cannot exceed 3.00MiB in size. + # 3. You can use 'zImage', but not a raw 'Image' packed with lzma. + # 4. The kernel command line from uboot is harcoded to boot with + # rootfs either in mtd11 or mtd13. + $(call Device/FitzImage) + DEVICE_VENDOR := Linksys + DEVICE_MODEL := EA6350 + DEVICE_VARIANT := v3 + SOC := qcom-ipq4018 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_SIZE := 3072k + IMAGE_SIZE := 37888k + UBINIZE_OPTS := -E 5 + IMAGES += factory.bin + IMAGE/factory.bin := append-kernel | append-uImage-fakehdr filesystem | pad-to $$$$(KERNEL_SIZE) | append-ubi | linksys-image type=EA6350v3 + DEVICE_PACKAGES := uboot-envtools +endef +TARGET_DEVICES += linksys_ea6350v3 + +define Device/linksys_ea8300 + $(call Device/FitzImage) + DEVICE_VENDOR := Linksys + DEVICE_MODEL := EA8300 + SOC := qcom-ipq4019 + KERNEL_SIZE := 3072k + IMAGE_SIZE := 87040k + BLOCKSIZE := 128k + PAGESIZE := 2048 + UBINIZE_OPTS := -E 5 # EOD marks to "hide" factory sig at EOF + IMAGES += factory.bin + IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | linksys-image type=EA8300 + DEVICE_PACKAGES := uboot-envtools ath10k-firmware-qca9888-ct ipq-wifi-linksys_ea8300 kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += linksys_ea8300 + +define Device/meraki_mr33 + $(call Device/FitImage) + DEVICE_VENDOR := Cisco Meraki + DEVICE_MODEL := MR33 + SOC := qcom-ipq4029 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_PACKAGES := -swconfig ath10k-firmware-qca9887-ct +endef +TARGET_DEVICES += meraki_mr33 + +define Device/mobipromo_cm520-79f + $(call Device/FitzImage) + $(call Device/UbiFit) + DEVICE_VENDOR := MobiPromo + DEVICE_MODEL := CM520-79F + SOC := qcom-ipq4019 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_PACKAGES := ipq-wifi-mobipromo_cm520-79f kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += mobipromo_cm520-79f + +define Device/netgear_ex61x0v2 + $(call Device/DniImage) + DEVICE_DTS_CONFIG := config@4 + NETGEAR_BOARD_ID := EX6150v2series + NETGEAR_HW_ID := 29765285+16+0+128+2x2 + IMAGE_SIZE := 14400k + SOC := qcom-ipq4018 +endef + +define Device/netgear_ex6100v2 + $(call Device/netgear_ex61x0v2) + DEVICE_VENDOR := Netgear + DEVICE_MODEL := EX6100 + DEVICE_VARIANT := v2 +endef +TARGET_DEVICES += netgear_ex6100v2 + +define Device/netgear_ex6150v2 + $(call Device/netgear_ex61x0v2) + DEVICE_VENDOR := Netgear + DEVICE_MODEL := EX6150 + DEVICE_VARIANT := v2 +endef +TARGET_DEVICES += netgear_ex6150v2 + +define Device/openmesh_a42 + $(call Device/FitImageLzma) + DEVICE_VENDOR := OpenMesh + DEVICE_MODEL := A42 + SOC := qcom-ipq4018 + DEVICE_DTS_CONFIG := config@om.a42 + BLOCKSIZE := 64k + KERNEL = kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb | pad-to $$(BLOCKSIZE) + IMAGE_SIZE := 15616k + IMAGES += factory.bin + IMAGE/factory.bin := append-rootfs | pad-rootfs | openmesh-image ce_type=A42 + IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-rootfs | sysupgrade-tar rootfs=$$$$@ | append-metadata + DEVICE_PACKAGES := uboot-envtools +endef +TARGET_DEVICES += openmesh_a42 + +define Device/openmesh_a62 + $(call Device/FitImageLzma) + DEVICE_VENDOR := OpenMesh + DEVICE_MODEL := A62 + SOC := qcom-ipq4019 + DEVICE_DTS_CONFIG := config@om.a62 + BLOCKSIZE := 64k + KERNEL = kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb | pad-to $$(BLOCKSIZE) + IMAGE_SIZE := 15552k + IMAGES += factory.bin + IMAGE/factory.bin := append-rootfs | pad-rootfs | openmesh-image ce_type=A62 + IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-rootfs | sysupgrade-tar rootfs=$$$$@ | append-metadata + DEVICE_PACKAGES := ath10k-firmware-qca9888-ct uboot-envtools +endef + +TARGET_DEVICES += openmesh_a62 + +define Device/qcom_ap-dk01.1-c1 + DEVICE_VENDOR := Qualcomm Atheros + DEVICE_MODEL := AP-DK01.1 + DEVICE_VARIANT := C1 + BOARD_NAME := ap-dk01.1-c1 + SOC := qcom-ipq4019 + DEVICE_DTS := qcom-ipq4019-ap.dk01.1-c1 + KERNEL_INSTALL := 1 + KERNEL_SIZE := 4096k + IMAGE_SIZE := 26624k + $(call Device/FitImage) + IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | append-metadata +endef +TARGET_DEVICES += qcom_ap-dk01.1-c1 + +define Device/qcom_ap-dk04.1-c1 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := Qualcomm Atheros + DEVICE_MODEL := AP-DK04.1 + DEVICE_VARIANT := C1 + SOC := qcom-ipq4019 + DEVICE_DTS := qcom-ipq4019-ap.dk04.1-c1 + KERNEL_INSTALL := 1 + KERNEL_SIZE := 4048k + BLOCKSIZE := 128k + PAGESIZE := 2048 + BOARD_NAME := ap-dk04.1-c1 +endef +TARGET_DEVICES += qcom_ap-dk04.1-c1 + +define Device/p2w_r619ac + $(call Device/FitzImage) + $(call Device/UbiFit) + DEVICE_VENDOR := P&W + DEVICE_MODEL := R619AC + SOC := qcom-ipq4019 + DEVICE_DTS_CONFIG := config@10 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGES += nand-factory.bin + IMAGE/nand-factory.bin := append-ubi | qsdk-ipq-factory-nand + DEVICE_PACKAGES := ipq-wifi-p2w_r619ac +endef +TARGET_DEVICES += p2w_r619ac + +define Device/p2w_r619ac-128m + $(call Device/FitzImage) + $(call Device/UbiFit) + DEVICE_VENDOR := P&W + DEVICE_MODEL := R619AC + DEVICE_VARIANT := 128M + SOC := qcom-ipq4019 + DEVICE_DTS_CONFIG := config@10 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_PACKAGES := ipq-wifi-p2w_r619ac +endef +TARGET_DEVICES += p2w_r619ac-128m + +define Device/qxwlan_e2600ac-c1 + $(call Device/FitImage) + DEVICE_VENDOR := Qxwlan + DEVICE_MODEL := E2600AC + DEVICE_VARIANT := C1 + BOARD_NAME := e2600ac-c1 + SOC := qcom-ipq4019 + KERNEL_SIZE := 4096k + IMAGE_SIZE := 31232k + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata + DEVICE_PACKAGES := ipq-wifi-qxwlan_e2600ac +endef +TARGET_DEVICES += qxwlan_e2600ac-c1 + +define Device/qxwlan_e2600ac-c2 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := Qxwlan + DEVICE_MODEL := E2600AC + DEVICE_VARIANT := C2 + SOC := qcom-ipq4019 + KERNEL_INSTALL := 1 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_PACKAGES := ipq-wifi-qxwlan_e2600ac +endef +TARGET_DEVICES += qxwlan_e2600ac-c2 + +define Device/unielec_u4019-32m + $(call Device/FitImage) + DEVICE_VENDOR := Unielec + DEVICE_MODEL := U4019 + DEVICE_VARIANT := 32M + BOARD_NAME := u4019-32m + SOC := qcom-ipq4019 + KERNEL_SIZE := 4096k + IMAGE_SIZE := 31232k + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata +endef +TARGET_DEVICES += unielec_u4019-32m + +define Device/zyxel_nbg6617 + $(call Device/FitImageLzma) + DEVICE_VENDOR := ZyXEL + DEVICE_MODEL := NBG6617 + SOC := qcom-ipq4018 + KERNEL_SIZE := 4096k + ROOTFS_SIZE := 24960k + RAS_BOARD := NBG6617 + RAS_ROOTFS_SIZE := 19840k + RAS_VERSION := "$(VERSION_DIST) $(REVISION)" + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata + IMAGES += factory.bin +# The ZyXEL firmware allows flashing thru the web-gui only when the rootfs is +# at least as large as the one of the initial firmware image (not the current +# one on the device). This only applies to the Web-UI, the bootlaoder ignores +# this minimum-size. However, the larger image can be flashed both ways. + IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to 64k | check-size $$$$(ROOTFS_SIZE) | zyxel-ras-image separate-kernel + IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-rootfs | check-size $$$$(ROOTFS_SIZE) | sysupgrade-tar rootfs=$$$$@ | append-metadata + DEVICE_PACKAGES := uboot-envtools kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += zyxel_nbg6617 + +define Device/zyxel_wre6606 + $(call Device/FitImage) + DEVICE_VENDOR := ZyXEL + DEVICE_MODEL := WRE6606 + DEVICE_DTS_CONFIG := config@4 + SOC := qcom-ipq4018 + IMAGE_SIZE := 13184k + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata | check-size + DEVICE_PACKAGES := -kmod-ath10k-ct kmod-ath10k-ct-smallbuffers +endef +TARGET_DEVICES += zyxel_wre6606 + +$(eval $(call BuildImage)) diff --git a/root/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch b/root/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch new file mode 100644 index 00000000..ade7a675 --- /dev/null +++ b/root/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch @@ -0,0 +1,65 @@ +From a10fab12a927e60b7141a602e740d70cb4d09e4a Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Thu, 9 Mar 2017 11:03:18 +0100 +Subject: [PATCH] arm: boot: add dts files + +Signed-off-by: John Crispin +--- + arch/arm/boot/dts/Makefile | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -837,11 +837,52 @@ dtb-$(CONFIG_ARCH_QCOM) += \ + qcom-apq8074-dragonboard.dtb \ + qcom-apq8084-ifc6540.dtb \ + qcom-apq8084-mtp.dtb \ ++ qcom-ipq4018-a42.dtb \ ++ qcom-ipq4018-ap120c-ac.dtb \ ++ qcom-ipq4018-dap-2610.dtb \ ++ qcom-ipq4018-cs-w3-wd1200g-eup.dtb \ ++ qcom-ipq4018-ea6350v3.dtb \ ++ qcom-ipq4018-eap1300.dtb \ ++ qcom-ipq4018-emd1.dtb \ ++ qcom-ipq4018-emr3500.dtb \ ++ qcom-ipq4018-ens620ext.dtb \ ++ qcom-ipq4018-ex6100v2.dtb \ ++ qcom-ipq4018-ex6150v2.dtb \ ++ qcom-ipq4018-fritzbox-4040.dtb \ ++ qcom-ipq4018-jalapeno.dtb \ ++ qcom-ipq4018-meshpoint-one.dtb \ ++ qcom-ipq4018-nbg6617.dtb \ ++ qcom-ipq4018-rt-ac58u.dtb \ ++ qcom-ipq4018-wre6606.dtb \ + qcom-ipq4019-ap.dk01.1-c1.dtb \ + qcom-ipq4019-ap.dk04.1-c1.dtb \ + qcom-ipq4019-ap.dk04.1-c3.dtb \ + qcom-ipq4019-ap.dk07.1-c1.dtb \ + qcom-ipq4019-ap.dk07.1-c2.dtb \ ++ qcom-ipq4019-a62.dtb \ ++ qcom-ipq4019-cm520-79f.dtb \ ++ qcom-ipq4019-ea8300.dtb \ ++ qcom-ipq4019-eap2200.dtb \ ++ qcom-ipq4019-fritzbox-7530.dtb \ ++ qcom-ipq4019-fritzrepeater-1200.dtb \ ++ qcom-ipq4019-fritzrepeater-3000.dtb \ ++ qcom-ipq4019-r619ac.dtb \ ++ qcom-ipq4019-r619ac-128m.dtb \ ++ qcom-ipq4019-map-ac2200.dtb \ ++ qcom-ipq4019-e2600ac-c1.dtb \ ++ qcom-ipq4019-e2600ac-c2.dtb \ ++ qcom-ipq4019-habanero-dvk.dtb \ ++ qcom-ipq4019-rtl30vw.dtb \ ++ qcom-ipq4019-u4019-32m.dtb \ ++ qcom-ipq4019-wpj419.dtb \ ++ qcom-ipq4019-wtr-m2133hp.dtb \ ++ qcom-ipq4028-wpj428.dtb \ ++ qcom-ipq4029-ap-303.dtb \ ++ qcom-ipq4029-ap-303h.dtb \ ++ qcom-ipq4029-ap-365.dtb \ ++ qcom-ipq4029-gl-b1300.dtb \ ++ qcom-ipq4029-gl-s1300.dtb \ ++ qcom-ipq4029-mr33.dtb \ + qcom-ipq8064-ap148.dtb \ + qcom-msm8660-surf.dtb \ + qcom-msm8960-cdp.dtb \ diff --git a/root/target/linux/mediatek/image/Config.in b/root/target/linux/mediatek/image/Config.in deleted file mode 100644 index 0daa957a..00000000 --- a/root/target/linux/mediatek/image/Config.in +++ /dev/null @@ -1,4 +0,0 @@ -config MEDIATEK_SD_BOOT_PARTSIZE - int "Boot (SD Card) filesystem partition size (in MB)" - depends on TARGET_mediatek - default 128 \ No newline at end of file diff --git a/root/target/linux/mediatek/image/Makefile b/root/target/linux/mediatek/image/Makefile deleted file mode 100644 index ecfa4eaf..00000000 --- a/root/target/linux/mediatek/image/Makefile +++ /dev/null @@ -1,90 +0,0 @@ -# -# Copyright (C) 2012-2015 OpenWrt.org -# Copyright (C) 2016-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)/image.mk - -FAT32_BLOCK_SIZE=1024 -FAT32_BLOCKS=$(shell echo $$(($(CONFIG_MEDIATEK_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE)))) - -# for arm -KERNEL_LOADADDR := 0x80008000 - -define Build/mediatek-sdcard - rm -f $@.boot - mkfs.fat $@.boot -C $(FAT32_BLOCKS) - - mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-uEnv.txt ::uEnv.txt - mcopy -i $@.boot $(IMAGE_KERNEL) ::uImage - ./gen_mt7623_sdcard_img.sh $@ \ - $(STAGING_DIR_IMAGE)/bpi-r2-preloader.bin \ - $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-uboot-mediatek.bin \ - $@.boot \ - $(IMAGE_ROOTFS) \ - $(CONFIG_MEDIATEK_SD_BOOT_PARTSIZE) \ - $(CONFIG_TARGET_ROOTFS_PARTSIZE) - rm -f $@.boot - -endef - -# for arm64 -ifeq ($(SUBTARGET),mt7622) -KERNEL_LOADADDR = 0x41080000 -endif - -ifeq ($(SUBTARGET),mt7629) -KERNEL_LOADADDR = 0x40008000 -endif - -define Build/sysupgrade-emmc - rm -f $@.recovery - mkfs.fat -C $@.recovery 3070 - - ./gen_mt7623_emmc_img.sh $@ \ - $(IMAGE_KERNEL) \ - $@.recovery \ - $(IMAGE_ROOTFS) -endef - -# default all platform image(fit) build -define Device/Default - PROFILES = Default $$(DEVICE_NAME) - KERNEL_NAME := zImage - FILESYSTEMS := squashfs - DEVICE_DTS_DIR := $(DTS_DIR) - IMAGES := sysupgrade.bin - IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata - SUPPORTED_DEVICES := $(subst _,$(comma),$(1)) -ifeq ($(SUBTARGET),mt7623) - DEVICE_VARS := MEDIATEK_UBOOT - KERNEL_NAME := zImage - KERNEL := kernel-bin | append-dtb | uImage none - KERNEL_INITRAMFS := kernel-bin | append-dtb | uImage none - FILESYSTEMS += ext4 - IMAGES := sysupgrade.tar sdcard.img.gz - IMAGE/sysupgrade.tar := sysupgrade-tar | append-metadata - IMAGE/sdcard.img.gz := mediatek-sdcard | gzip | append-metadata -else - KERNEL_NAME := Image - KERNEL = kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb - KERNEL_INITRAMFS = kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb -endif -endef - -ifeq ($(SUBTARGET),mt7622) -include mt7622.mk -endif - -ifeq ($(SUBTARGET),mt7623) -include mt7623.mk -endif - -ifeq ($(SUBTARGET),mt7629) -include mt7629.mk -endif - -$(eval $(call BuildImage)) diff --git a/root/target/linux/mediatek/image/gen_mt7623_sdcard_img.sh b/root/target/linux/mediatek/image/gen_mt7623_sdcard_img.sh deleted file mode 100755 index f9a8dbde..00000000 --- a/root/target/linux/mediatek/image/gen_mt7623_sdcard_img.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright (C) 2013 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -set -e -[ $# -eq 7 ] || { - echo "SYNTAX: $0 " - exit 1 -} - -OUTPUT="$1" -PRELOADER="$2" -UBOOT="$3" -BOOTFS="$4" -ROOTFS="$5" -BOOTFSSIZE="$6" -ROOTFSSIZE="$7" - -head=4 -sect=63 - -set `ptgen -o $OUTPUT -h $head -s $sect -l 1024 -t c -p ${BOOTFSSIZE}M -t 83 -p ${ROOTFSSIZE}M -a 0` - -BOOT_OFFSET="$(($1 / 512))" -BOOT_SIZE="$(($2 / 512))" -ROOTFS_OFFSET="$(($3 / 512))" -ROOTFS_SIZE="$(($4 / 512))" - -PRELOADER_OFFSET=2 # 2KB -UBOOT_OFFSET=320 # 320KB - -SDMMC_BOOT="SDMMC_BOOT\x00\x00\x01\x00\x00\x00\x00\x02\x00\x00" -BRLYT="\ -BRLYT\x00\x00\x00\x01\x00\x00\x00\x00\x08\x00\x00\ -\x00\x08\x00\x00\x42\x42\x42\x42\x08\x00\x01\x00\x00\x08\x00\x00\ -\x00\x08\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - -echo -en "${SDMMC_BOOT}" | dd bs=1 of="${OUTPUT}" seek=0 conv=notrunc -echo -en "${BRLYT}" | dd bs=1 of="${OUTPUT}" seek=512 conv=notrunc - -dd bs=1024 if="${PRELOADER}" of="${OUTPUT}" seek="${PRELOADER_OFFSET}" conv=notrunc -dd bs=1024 if="${UBOOT}" of="${OUTPUT}" seek="${UBOOT_OFFSET}" conv=notrunc -dd bs=512 if="${BOOTFS}" of="${OUTPUT}" seek="${BOOT_OFFSET}" conv=notrunc -dd bs=512 if="${ROOTFS}" of="${OUTPUT}" seek="${ROOTFS_OFFSET}" conv=notrunc diff --git a/root/target/linux/mediatek/image/mt7623.mk b/root/target/linux/mediatek/image/mt7623.mk deleted file mode 100644 index 678bfed0..00000000 --- a/root/target/linux/mediatek/image/mt7623.mk +++ /dev/null @@ -1,21 +0,0 @@ -define Device/unielec_u7623-02-emmc-512m - DEVICE_VENDOR := UniElec - DEVICE_MODEL := U7623-02 - DEVICE_VARIANT := eMMC/512MB RAM - DEVICE_DTS := mt7623a-unielec-u7623-02-emmc-512m - DEVICE_PACKAGES := mkf2fs e2fsprogs kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 kmod-mmc - IMAGES := sysupgrade-emmc.bin.gz - IMAGE/sysupgrade-emmc.bin.gz := sysupgrade-emmc | gzip | append-metadata -endef -TARGET_DEVICES += unielec_u7623-02-emmc-512m - -define Device/bpi_bananapi-r2 - DEVICE_VENDOR := Bpi - DEVICE_MODEL := Banana Pi R2 - DEVICE_DTS := mt7623n-bananapi-bpi-r2 - DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb3 \ - kmod-ata-core kmod-ata-ahci-mtk \ - mt7623n-preloader - SUPPORTED_DEVICES := bananapi,bpi-r2 -endef -TARGET_DEVICES += bpi_bananapi-r2