diff --git a/feeds.conf.default b/feeds.conf.default index 75e8329792e..513fbd2f8fc 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -2,7 +2,7 @@ src-git packages https://github.com/immortalwrt/packages.git src-git luci https://github.com/immortalwrt/luci.git src-git routing https://git.openwrt.org/feed/routing.git src-git telephony https://git.openwrt.org/feed/telephony.git -src-git nss_packages https://github.com/breeze303/nss-packages.git;NSS-12.5-K6.x +src-git nss https://github.com/qosmio/nss-packages;NSS-12.5-K6.x src-git sqm_scripts_nss https://github.com/qosmio/sqm-scripts-nss.git #src-git video https://github.com/openwrt/video.git #src-git targets https://github.com/openwrt/targets.git diff --git a/include/cmake.mk b/include/cmake.mk index 00ade7fd7de..87309dd0458 100644 --- a/include/cmake.mk +++ b/include/cmake.mk @@ -174,6 +174,7 @@ define Host/Configure/Default -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=TRUE \ -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=FALSE \ -DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=TRUE \ + -DBUILD_SHARED_LIBS=OFF \ $(CMAKE_HOST_OPTIONS) \ $(HOST_CMAKE_SOURCE_DIR) \ ) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index d096bfabd06..6f72804b870 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .53 -LINUX_KERNEL_HASH-6.6.53 = 285d181d1b252b0bf905f040d094215cf183ac98c31a17f9cce9f3537ef4d779 +LINUX_VERSION-6.6 = .56 +LINUX_KERNEL_HASH-6.6.56 = f74812f78e88992c416434cb107639e13a551dbaff36bb90d6346ab16ab71a95 diff --git a/include/kernel-build.mk b/include/kernel-build.mk index 48e00fa4c61..404c318d413 100644 --- a/include/kernel-build.mk +++ b/include/kernel-build.mk @@ -154,7 +154,7 @@ define BuildKernel download: $(if $(LINUX_SITE),$(DL_DIR)/$(LINUX_SOURCE)) prepare: $(STAMP_PREPARED) compile: $(LINUX_DIR)/.modules - $(MAKE) -C image compile TARGET_BUILD= + +$(MAKE) -C image compile TARGET_BUILD= dtb: $(STAMP_CONFIGURED) $(_SINGLE)$(KERNEL_MAKE) scripts_dtc diff --git a/include/prereq-build.mk b/include/prereq-build.mk index 49340ce3e44..8b138cfc44e 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -182,6 +182,7 @@ $(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \ perl --version | grep "perl.*v5")) $(eval $(call SetupHostCommand,python,Please install Python >= 3.7, \ + python3.12 -V 2>&1 | grep 'Python 3', \ python3.11 -V 2>&1 | grep 'Python 3', \ python3.10 -V 2>&1 | grep 'Python 3', \ python3.9 -V 2>&1 | grep 'Python 3', \ @@ -190,6 +191,7 @@ $(eval $(call SetupHostCommand,python,Please install Python >= 3.7, \ python3 -V 2>&1 | grep -E 'Python 3\.([7-9]|[0-9][0-9])\.?')) $(eval $(call SetupHostCommand,python3,Please install Python >= 3.7, \ + python3.12 -V 2>&1 | grep 'Python 3', \ python3.11 -V 2>&1 | grep 'Python 3', \ python3.10 -V 2>&1 | grep 'Python 3', \ python3.9 -V 2>&1 | grep 'Python 3', \ @@ -199,7 +201,8 @@ $(eval $(call SetupHostCommand,python3,Please install Python >= 3.7, \ $(eval $(call TestHostCommand,python3-distutils, \ Please install the Python3 distutils module, \ - $(STAGING_DIR_HOST)/bin/python3 -c 'from distutils import util')) + printf 'from sys import version_info\nif version_info < (3, 12):\n\tfrom distutils import util' | \ + $(STAGING_DIR_HOST)/bin/python3 -)) $(eval $(call TestHostCommand,python3-stdlib, \ Please install the Python3 stdlib module, \ diff --git a/include/toplevel.mk b/include/toplevel.mk index 54cd8e3a908..e5f5e0fecd8 100644 --- a/include/toplevel.mk +++ b/include/toplevel.mk @@ -276,7 +276,7 @@ help: cat README.md distclean: - rm -rf bin build_dir .ccache .config* dl feeds key-build* logs package/feeds staging_dir tmp + rm -rf bin build_dir .ccache .config* dl feeds key-build* logs package/feeds target/linux/feeds staging_dir tmp @$(_SINGLE)$(SUBMAKE) -C scripts/config clean ifeq ($(findstring v,$(DEBUG)),) diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 0529c135f3d..a0780680eac 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -77,7 +77,7 @@ endef define ImageConfigOptions mkdir -p $(1)/lib/preinit echo 'pi_suppress_stderr="$(CONFIG_TARGET_PREINIT_SUPPRESS_STDERR)"' >$(1)/lib/preinit/00_preinit.conf - echo 'fs_failsafe_wait_timeout=$(if $(CONFIG_TARGET_PREINIT_TIMEOUT),$(CONFIG_TARGET_PREINIT_TIMEOUT),2)' >>$(1)/lib/preinit/00_preinit.conf + echo 'fs_failsafe_wait_timeout=$(if $(CONFIG_TARGET_PREINIT_TIMEOUT),$(CONFIG_TARGET_PREINIT_TIMEOUT),4)' >>$(1)/lib/preinit/00_preinit.conf echo 'pi_init_path="$(TARGET_INIT_PATH)"' >>$(1)/lib/preinit/00_preinit.conf echo 'pi_init_env=$(if $(CONFIG_TARGET_INIT_ENV),$(CONFIG_TARGET_INIT_ENV),"")' >>$(1)/lib/preinit/00_preinit.conf echo 'pi_init_cmd=$(if $(CONFIG_TARGET_INIT_CMD),$(CONFIG_TARGET_INIT_CMD),"/sbin/init")' >>$(1)/lib/preinit/00_preinit.conf diff --git a/package/base-files/files/etc/init.d/led b/package/base-files/files/etc/init.d/led index 5130ac7d41b..7f05254c2ba 100755 --- a/package/base-files/files/etc/init.d/led +++ b/package/base-files/files/etc/init.d/led @@ -184,7 +184,12 @@ start() { echo "$color" | sed 's/:/\ /g' > \ "/sys/class/leds/$led/multi_intensity" done < /var/run/led.state - rm /var/run/led.state + if [ "$1" ]; then + grep -v "^$1 " /var/run/led.state > /var/run/led.state.new + mv /var/run/led.state.new /var/run/led.state + else + rm /var/run/led.state + fi } config_load system diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh index 9fa3cd2ddd4..ca302557c8e 100644 --- a/package/base-files/files/lib/upgrade/nand.sh +++ b/package/base-files/files/lib/upgrade/nand.sh @@ -300,7 +300,7 @@ nand_upgrade_fit() { # Write images in the TAR file to MTD partitions and/or UBI volumes as required nand_upgrade_tar() { local tar_file="$1" - local cmd="$2" + local cmd="${2:-cat}" local jffs2_markers="${CI_JFFS2_CLEAN_MARKERS:-0}" # WARNING: This fails if tar contains more than one 'sysupgrade-*' directory. diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index c0dd75da17b..39acfb4d3d8 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -44,7 +44,7 @@ config TARGET_PREINIT_DISABLE_FAILSAFE config TARGET_PREINIT_TIMEOUT int prompt "Failsafe/Debug wait timeout" if PREINITOPT - default 2 + default 4 help How long to wait for failsafe mode to be entered or for a debug option to be pressed before continuing with a diff --git a/package/boot/uboot-ath79/Makefile b/package/boot/uboot-ath79/Makefile index d19f5615769..9e64f680b7f 100644 --- a/package/boot/uboot-ath79/Makefile +++ b/package/boot/uboot-ath79/Makefile @@ -1,8 +1,8 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk -PKG_VERSION:=2024.07 -PKG_HASH:=f591da9ab90ef3d6b3d173766d0ddff90c4ed7330680897486117df390d83c8f +PKG_VERSION:=2024.10 +PKG_HASH:=b28daf4ac17e43156363078bf510297584137f6df50fced9b12df34f61a92fb0 UBOOT_USE_INTREE_DTC:=1 diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index d6e9be913c4..e5a0a393fe5 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -1,8 +1,8 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk -PKG_VERSION:=2024.07 -PKG_HASH:=f591da9ab90ef3d6b3d173766d0ddff90c4ed7330680897486117df390d83c8f +PKG_VERSION:=2024.10 +PKG_HASH:=b28daf4ac17e43156363078bf510297584137f6df50fced9b12df34f61a92fb0 PKG_BUILD_DEPENDS:=!(TARGET_ramips||TARGET_mediatek_mt7623):arm-trusted-firmware-tools/host UBOOT_USE_INTREE_DTC:=1 @@ -830,7 +830,8 @@ UBOOT_TARGETS := \ UBOOT_CUSTOMIZE_CONFIG := \ --disable TOOLS_KWBIMAGE \ - --disable TOOLS_LIBCRYPTO + --disable TOOLS_LIBCRYPTO \ + --disable TOOLS_MKEFICAPSULE ifdef CONFIG_TARGET_mediatek UBOOT_MAKE_FLAGS += $(UBOOT_IMAGE:.fip=.bin) diff --git a/package/boot/uboot-mediatek/patches/100-02-drivers-mtd-add-support-for-MediaTek-SPI-NAND-flash-.patch b/package/boot/uboot-mediatek/patches/100-02-drivers-mtd-add-support-for-MediaTek-SPI-NAND-flash-.patch index 0e63b1e2d37..e57c88c2959 100644 --- a/package/boot/uboot-mediatek/patches/100-02-drivers-mtd-add-support-for-MediaTek-SPI-NAND-flash-.patch +++ b/package/boot/uboot-mediatek/patches/100-02-drivers-mtd-add-support-for-MediaTek-SPI-NAND-flash-.patch @@ -38,7 +38,7 @@ Signed-off-by: Weijie Gao --- a/drivers/mtd/Kconfig +++ b/drivers/mtd/Kconfig -@@ -238,6 +238,8 @@ config SYS_MAX_FLASH_BANKS_DETECT +@@ -246,6 +246,8 @@ config SYS_MAX_FLASH_BANKS_DETECT to reduce the effective number of flash bank, between 0 and CONFIG_SYS_MAX_FLASH_BANKS @@ -49,7 +49,7 @@ Signed-off-by: Weijie Gao config SYS_NAND_MAX_OOBFREE --- a/drivers/mtd/Makefile +++ b/drivers/mtd/Makefile -@@ -39,3 +39,5 @@ obj-$(CONFIG_$(SPL_TPL_)SPI_FLASH_SUPPOR +@@ -40,3 +40,5 @@ obj-$(CONFIG_$(SPL_TPL_)SPI_FLASH_SUPPOR obj-$(CONFIG_SPL_UBI) += ubispl/ endif @@ -1313,7 +1313,7 @@ Signed-off-by: Weijie Gao + * Author: Weijie Gao + */ + -+#include ++#include +#include +#include +#include @@ -1896,7 +1896,7 @@ Signed-off-by: Weijie Gao +#ifndef _MTK_SNAND_OS_H_ +#define _MTK_SNAND_OS_H_ + -+#include ++#include +#include +#include +#include diff --git a/package/boot/uboot-mediatek/patches/100-03-mtd-mtk-snand-add-support-for-SPL.patch b/package/boot/uboot-mediatek/patches/100-03-mtd-mtk-snand-add-support-for-SPL.patch index 3d7c4a9bf60..27b56f7bd3a 100644 --- a/package/boot/uboot-mediatek/patches/100-03-mtd-mtk-snand-add-support-for-SPL.patch +++ b/package/boot/uboot-mediatek/patches/100-03-mtd-mtk-snand-add-support-for-SPL.patch @@ -47,7 +47,7 @@ Signed-off-by: Weijie Gao + * Author: Weijie Gao + */ + -+#include ++#include +#include +#include +#include diff --git a/package/boot/uboot-mediatek/patches/100-04-env-add-support-for-generic-MTD-device.patch b/package/boot/uboot-mediatek/patches/100-04-env-add-support-for-generic-MTD-device.patch index 2f070005d6d..8f0a50bd984 100644 --- a/package/boot/uboot-mediatek/patches/100-04-env-add-support-for-generic-MTD-device.patch +++ b/package/boot/uboot-mediatek/patches/100-04-env-add-support-for-generic-MTD-device.patch @@ -370,7 +370,7 @@ Signed-off-by: Weijie Gao +}; --- a/include/env_internal.h +++ b/include/env_internal.h -@@ -108,6 +108,7 @@ enum env_location { +@@ -107,6 +107,7 @@ enum env_location { ENVL_FAT, ENVL_FLASH, ENVL_MMC, diff --git a/package/boot/uboot-mediatek/patches/100-05-mtd-add-a-new-mtd-device-type-for-NMBM.patch b/package/boot/uboot-mediatek/patches/100-05-mtd-add-a-new-mtd-device-type-for-NMBM.patch index d90ca647041..aa19a115872 100644 --- a/package/boot/uboot-mediatek/patches/100-05-mtd-add-a-new-mtd-device-type-for-NMBM.patch +++ b/package/boot/uboot-mediatek/patches/100-05-mtd-add-a-new-mtd-device-type-for-NMBM.patch @@ -15,7 +15,7 @@ Signed-off-by: Weijie Gao --- a/cmd/mtdparts.c +++ b/cmd/mtdparts.c -@@ -1057,6 +1057,9 @@ int mtd_id_parse(const char *id, const c +@@ -1054,6 +1054,9 @@ int mtd_id_parse(const char *id, const c } else if (strncmp(p, "spi-nand", 8) == 0) { *dev_type = MTD_DEV_TYPE_SPINAND; p += 8; @@ -27,7 +27,7 @@ Signed-off-by: Weijie Gao return 1; --- a/include/jffs2/load_kernel.h +++ b/include/jffs2/load_kernel.h -@@ -16,11 +16,13 @@ +@@ -17,11 +17,13 @@ #define MTD_DEV_TYPE_NAND 0x0002 #define MTD_DEV_TYPE_ONENAND 0x0004 #define MTD_DEV_TYPE_SPINAND 0x0008 diff --git a/package/boot/uboot-mediatek/patches/100-06-mtd-add-core-facility-code-of-NMBM.patch b/package/boot/uboot-mediatek/patches/100-06-mtd-add-core-facility-code-of-NMBM.patch index 997d07867b3..30d21b0e49c 100644 --- a/package/boot/uboot-mediatek/patches/100-06-mtd-add-core-facility-code-of-NMBM.patch +++ b/package/boot/uboot-mediatek/patches/100-06-mtd-add-core-facility-code-of-NMBM.patch @@ -31,7 +31,7 @@ Signed-off-by: Weijie Gao --- a/drivers/mtd/Kconfig +++ b/drivers/mtd/Kconfig -@@ -274,6 +274,8 @@ source "drivers/mtd/ubi/Kconfig" +@@ -282,6 +282,8 @@ source "drivers/mtd/ubi/Kconfig" source "drivers/mtd/nvmxip/Kconfig" @@ -42,7 +42,7 @@ Signed-off-by: Weijie Gao endmenu --- a/drivers/mtd/Makefile +++ b/drivers/mtd/Makefile -@@ -41,3 +41,4 @@ obj-$(CONFIG_SPL_UBI) += ubispl/ +@@ -42,3 +42,4 @@ obj-$(CONFIG_SPL_UBI) += ubispl/ endif obj-$(CONFIG_MTK_SPI_NAND) += mtk-snand/ diff --git a/package/boot/uboot-mediatek/patches/100-08-common-board_r-add-support-to-initialize-NMBM-after-.patch b/package/boot/uboot-mediatek/patches/100-08-common-board_r-add-support-to-initialize-NMBM-after-.patch index 6a7912e64ad..176b215b52b 100644 --- a/package/boot/uboot-mediatek/patches/100-08-common-board_r-add-support-to-initialize-NMBM-after-.patch +++ b/package/boot/uboot-mediatek/patches/100-08-common-board_r-add-support-to-initialize-NMBM-after-.patch @@ -13,7 +13,7 @@ Signed-off-by: Weijie Gao --- a/common/board_r.c +++ b/common/board_r.c -@@ -373,6 +373,20 @@ static int initr_nand(void) +@@ -372,6 +372,20 @@ static int initr_nand(void) } #endif @@ -34,7 +34,7 @@ Signed-off-by: Weijie Gao #if defined(CONFIG_CMD_ONENAND) /* go init the NAND */ static int initr_onenand(void) -@@ -664,6 +678,9 @@ static init_fnc_t init_sequence_r[] = { +@@ -663,6 +677,9 @@ static init_fnc_t init_sequence_r[] = { #ifdef CONFIG_CMD_ONENAND initr_onenand, #endif diff --git a/package/boot/uboot-mediatek/patches/100-09-cmd-add-nmbm-command.patch b/package/boot/uboot-mediatek/patches/100-09-cmd-add-nmbm-command.patch index cd415810068..f988219b6d0 100644 --- a/package/boot/uboot-mediatek/patches/100-09-cmd-add-nmbm-command.patch +++ b/package/boot/uboot-mediatek/patches/100-09-cmd-add-nmbm-command.patch @@ -15,7 +15,7 @@ Signed-off-by: Weijie Gao --- a/cmd/Kconfig +++ b/cmd/Kconfig -@@ -1450,6 +1450,12 @@ config CMD_NAND_TORTURE +@@ -1465,6 +1465,12 @@ config CMD_NAND_TORTURE endif # CMD_NAND diff --git a/package/boot/uboot-mediatek/patches/100-10-cmd-mtd-add-markbad-subcommand-for-NMBM-testing.patch b/package/boot/uboot-mediatek/patches/100-10-cmd-mtd-add-markbad-subcommand-for-NMBM-testing.patch index 34f7fba9601..b2a9235cdbc 100644 --- a/package/boot/uboot-mediatek/patches/100-10-cmd-mtd-add-markbad-subcommand-for-NMBM-testing.patch +++ b/package/boot/uboot-mediatek/patches/100-10-cmd-mtd-add-markbad-subcommand-for-NMBM-testing.patch @@ -20,7 +20,7 @@ Signed-off-by: SkyLake.Huang --- a/cmd/mtd.c +++ b/cmd/mtd.c -@@ -722,6 +722,42 @@ out_put_mtd: +@@ -721,6 +721,42 @@ out_put_mtd: return CMD_RET_SUCCESS; } @@ -63,7 +63,7 @@ Signed-off-by: SkyLake.Huang #ifdef CONFIG_AUTO_COMPLETE static int mtd_name_complete(int argc, char *const argv[], char last_char, int maxv, char *cmdv[]) -@@ -769,6 +805,7 @@ U_BOOT_LONGHELP(mtd, +@@ -768,6 +804,7 @@ U_BOOT_LONGHELP(mtd, "\n" "Specific functions:\n" "mtd bad \n" @@ -71,7 +71,7 @@ Signed-off-by: SkyLake.Huang #if CONFIG_IS_ENABLED(CMD_MTD_OTP) "mtd otpread [u|f] \n" "mtd otpwrite \n" -@@ -809,4 +846,6 @@ U_BOOT_CMD_WITH_SUBCMDS(mtd, "MTD utils" +@@ -808,4 +845,6 @@ U_BOOT_CMD_WITH_SUBCMDS(mtd, "MTD utils" U_BOOT_SUBCMD_MKENT_COMPLETE(erase, 4, 0, do_mtd_erase, mtd_name_complete), U_BOOT_SUBCMD_MKENT_COMPLETE(bad, 2, 1, do_mtd_bad, diff --git a/package/boot/uboot-mediatek/patches/100-11-env-add-support-for-NMBM-upper-MTD-layer.patch b/package/boot/uboot-mediatek/patches/100-11-env-add-support-for-NMBM-upper-MTD-layer.patch index 0930ace26aa..a5f9586b918 100644 --- a/package/boot/uboot-mediatek/patches/100-11-env-add-support-for-NMBM-upper-MTD-layer.patch +++ b/package/boot/uboot-mediatek/patches/100-11-env-add-support-for-NMBM-upper-MTD-layer.patch @@ -240,7 +240,7 @@ Signed-off-by: Weijie Gao +}; --- a/include/env_internal.h +++ b/include/env_internal.h -@@ -110,6 +110,7 @@ enum env_location { +@@ -109,6 +109,7 @@ enum env_location { ENVL_MMC, ENVL_MTD, ENVL_NAND, diff --git a/package/boot/uboot-mediatek/patches/100-13-cmd-add-a-new-command-for-NAND-flash-debugging.patch b/package/boot/uboot-mediatek/patches/100-13-cmd-add-a-new-command-for-NAND-flash-debugging.patch index 97cb1088a00..c16f63fdb3a 100644 --- a/package/boot/uboot-mediatek/patches/100-13-cmd-add-a-new-command-for-NAND-flash-debugging.patch +++ b/package/boot/uboot-mediatek/patches/100-13-cmd-add-a-new-command-for-NAND-flash-debugging.patch @@ -26,7 +26,7 @@ Signed-off-by: Weijie Gao --- a/cmd/Kconfig +++ b/cmd/Kconfig -@@ -1450,6 +1450,14 @@ config CMD_NAND_TORTURE +@@ -1465,6 +1465,14 @@ config CMD_NAND_TORTURE endif # CMD_NAND diff --git a/package/boot/uboot-mediatek/patches/100-14-mtd-spi-nor-add-support-to-read-flash-unique-ID.patch b/package/boot/uboot-mediatek/patches/100-14-mtd-spi-nor-add-support-to-read-flash-unique-ID.patch index 8db02ddf6a8..82839033a38 100644 --- a/package/boot/uboot-mediatek/patches/100-14-mtd-spi-nor-add-support-to-read-flash-unique-ID.patch +++ b/package/boot/uboot-mediatek/patches/100-14-mtd-spi-nor-add-support-to-read-flash-unique-ID.patch @@ -13,7 +13,7 @@ Signed-off-by: Weijie Gao --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c -@@ -2908,6 +2908,100 @@ static int spi_nor_init_params(struct sp +@@ -2958,6 +2958,100 @@ static int spi_nor_init_params(struct sp return 0; } @@ -114,7 +114,7 @@ Signed-off-by: Weijie Gao static int spi_nor_hwcaps2cmd(u32 hwcaps, const int table[][2], size_t size) { size_t i; -@@ -4027,6 +4121,7 @@ int spi_nor_scan(struct spi_nor *nor) +@@ -4077,6 +4171,7 @@ int spi_nor_scan(struct spi_nor *nor) nor->write = spi_nor_write_data; nor->read_reg = spi_nor_read_reg; nor->write_reg = spi_nor_write_reg; diff --git a/package/boot/uboot-mediatek/patches/100-16-cmd-bootmenu-add-ability-to-select-item-by-shortkey.patch b/package/boot/uboot-mediatek/patches/100-16-cmd-bootmenu-add-ability-to-select-item-by-shortkey.patch index 701acddd780..4aa4318493e 100644 --- a/package/boot/uboot-mediatek/patches/100-16-cmd-bootmenu-add-ability-to-select-item-by-shortkey.patch +++ b/package/boot/uboot-mediatek/patches/100-16-cmd-bootmenu-add-ability-to-select-item-by-shortkey.patch @@ -14,7 +14,7 @@ Signed-off-by: Weijie Gao --- a/cmd/bootmenu.c +++ b/cmd/bootmenu.c -@@ -89,6 +89,7 @@ static char *bootmenu_choice_entry(void +@@ -88,6 +88,7 @@ static char *bootmenu_choice_entry(void struct bootmenu_data *menu = data; struct bootmenu_entry *iter; enum bootmenu_key key = BKEY_NONE; @@ -22,7 +22,7 @@ Signed-off-by: Weijie Gao int i; cli_ch_init(cch); -@@ -96,10 +97,10 @@ static char *bootmenu_choice_entry(void +@@ -95,10 +96,10 @@ static char *bootmenu_choice_entry(void while (1) { if (menu->delay >= 0) { /* Autoboot was not stopped */ @@ -35,7 +35,7 @@ Signed-off-by: Weijie Gao } switch (key) { -@@ -113,6 +114,12 @@ static char *bootmenu_choice_entry(void +@@ -112,6 +113,12 @@ static char *bootmenu_choice_entry(void ++menu->active; /* no menu key selected, regenerate menu */ return NULL; @@ -48,7 +48,7 @@ Signed-off-by: Weijie Gao case BKEY_SELECT: iter = menu->first; for (i = 0; i < menu->active; ++i) -@@ -170,6 +177,9 @@ static int prepare_bootmenu_entry(struct +@@ -169,6 +176,9 @@ static int prepare_bootmenu_entry(struct unsigned short int i = *index; struct bootmenu_entry *entry = NULL; struct bootmenu_entry *iter = *current; @@ -58,7 +58,7 @@ Signed-off-by: Weijie Gao while ((option = bootmenu_getoption(i))) { -@@ -184,11 +194,24 @@ static int prepare_bootmenu_entry(struct +@@ -183,11 +193,24 @@ static int prepare_bootmenu_entry(struct if (!entry) return -ENOMEM; @@ -84,7 +84,7 @@ Signed-off-by: Weijie Gao entry->command = strdup(sep + 1); if (!entry->command) { -@@ -334,6 +357,7 @@ static struct bootmenu_data *bootmenu_cr +@@ -333,6 +356,7 @@ static struct bootmenu_data *bootmenu_cr menu->delay = delay; menu->active = 0; menu->first = NULL; @@ -92,7 +92,7 @@ Signed-off-by: Weijie Gao default_str = env_get("bootmenu_default"); if (default_str) -@@ -369,9 +393,9 @@ static struct bootmenu_data *bootmenu_cr +@@ -368,9 +392,9 @@ static struct bootmenu_data *bootmenu_cr /* Add Quit entry if exiting bootmenu is disabled */ if (!IS_ENABLED(CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE)) @@ -106,7 +106,7 @@ Signed-off-by: Weijie Gao free(entry); --- a/common/menu.c +++ b/common/menu.c -@@ -49,6 +49,33 @@ struct menu { +@@ -48,6 +48,33 @@ struct menu { int item_cnt; }; @@ -140,7 +140,7 @@ Signed-off-by: Weijie Gao /* * An iterator function for menu items. callback will be called for each item * in m, with m, a pointer to the item, and extra being passed to callback. If -@@ -428,7 +455,7 @@ int menu_destroy(struct menu *m) +@@ -426,7 +453,7 @@ int menu_destroy(struct menu *m) } enum bootmenu_key bootmenu_autoboot_loop(struct bootmenu_data *menu, @@ -149,7 +149,7 @@ Signed-off-by: Weijie Gao { enum bootmenu_key key = BKEY_NONE; int i, c; -@@ -463,6 +490,19 @@ enum bootmenu_key bootmenu_autoboot_loop +@@ -461,6 +488,19 @@ enum bootmenu_key bootmenu_autoboot_loop break; default: key = BKEY_NONE; @@ -169,7 +169,7 @@ Signed-off-by: Weijie Gao break; } break; -@@ -483,7 +523,8 @@ enum bootmenu_key bootmenu_autoboot_loop +@@ -481,7 +521,8 @@ enum bootmenu_key bootmenu_autoboot_loop return key; } @@ -179,7 +179,7 @@ Signed-off-by: Weijie Gao { enum bootmenu_key key; -@@ -515,6 +556,20 @@ enum bootmenu_key bootmenu_conv_key(int +@@ -513,6 +554,20 @@ enum bootmenu_key bootmenu_conv_key(int case ' ': key = BKEY_SPACE; break; @@ -200,7 +200,7 @@ Signed-off-by: Weijie Gao default: key = BKEY_NONE; break; -@@ -524,11 +579,16 @@ enum bootmenu_key bootmenu_conv_key(int +@@ -522,11 +577,16 @@ enum bootmenu_key bootmenu_conv_key(int } enum bootmenu_key bootmenu_loop(struct bootmenu_data *menu, @@ -218,7 +218,7 @@ Signed-off-by: Weijie Gao c = cli_ch_process(cch, 0); if (!c) { while (!c && !tstc()) { -@@ -542,7 +602,7 @@ enum bootmenu_key bootmenu_loop(struct b +@@ -540,7 +600,7 @@ enum bootmenu_key bootmenu_loop(struct b } } @@ -301,7 +301,7 @@ Signed-off-by: Weijie Gao switch (key) { case BKEY_UP: -@@ -1839,7 +1839,7 @@ char *eficonfig_choice_change_boot_order +@@ -1881,7 +1881,7 @@ char *eficonfig_choice_change_boot_order cli_ch_init(cch); while (1) { @@ -312,7 +312,7 @@ Signed-off-by: Weijie Gao case BKEY_PLUS: --- a/boot/bootflow_menu.c +++ b/boot/bootflow_menu.c -@@ -234,7 +234,7 @@ int bootflow_menu_run(struct bootstd_pri +@@ -240,7 +240,7 @@ int bootflow_menu_run(struct bootstd_pri key = 0; if (ichar) { diff --git a/package/boot/uboot-mediatek/patches/100-17-common-spl-spl_nand-enable-CONFIG_SYS_NAND_U_BOOT_OF.patch b/package/boot/uboot-mediatek/patches/100-17-common-spl-spl_nand-enable-CONFIG_SYS_NAND_U_BOOT_OF.patch index c65a118b893..85011058630 100644 --- a/package/boot/uboot-mediatek/patches/100-17-common-spl-spl_nand-enable-CONFIG_SYS_NAND_U_BOOT_OF.patch +++ b/package/boot/uboot-mediatek/patches/100-17-common-spl-spl_nand-enable-CONFIG_SYS_NAND_U_BOOT_OF.patch @@ -14,7 +14,7 @@ Signed-off-by: Weijie Gao --- a/common/spl/spl_nand.c +++ b/common/spl/spl_nand.c -@@ -19,7 +19,11 @@ +@@ -18,7 +18,11 @@ uint32_t __weak spl_nand_get_uboot_raw_page(void) { diff --git a/package/boot/uboot-mediatek/patches/100-18-board-mt7629-add-support-for-booting-from-SPI-NAND.patch b/package/boot/uboot-mediatek/patches/100-18-board-mt7629-add-support-for-booting-from-SPI-NAND.patch index bc5f68cd1e8..8c2bcd54370 100644 --- a/package/boot/uboot-mediatek/patches/100-18-board-mt7629-add-support-for-booting-from-SPI-NAND.patch +++ b/package/boot/uboot-mediatek/patches/100-18-board-mt7629-add-support-for-booting-from-SPI-NAND.patch @@ -89,7 +89,7 @@ Signed-off-by: Weijie Gao reg = <0x11014000 0x1000>; --- a/arch/arm/mach-mediatek/Kconfig +++ b/arch/arm/mach-mediatek/Kconfig -@@ -147,9 +147,11 @@ config SYS_CONFIG_NAME +@@ -148,9 +148,11 @@ config SYS_CONFIG_NAME config MTK_BROM_HEADER_INFO string diff --git a/package/boot/uboot-mediatek/patches/100-20-board-mt7981-add-reference-board-using-new-spi-nand-.patch b/package/boot/uboot-mediatek/patches/100-20-board-mt7981-add-reference-board-using-new-spi-nand-.patch index caedea73159..bfeaf07f042 100644 --- a/package/boot/uboot-mediatek/patches/100-20-board-mt7981-add-reference-board-using-new-spi-nand-.patch +++ b/package/boot/uboot-mediatek/patches/100-20-board-mt7981-add-reference-board-using-new-spi-nand-.patch @@ -18,7 +18,7 @@ Signed-off-by: Weijie Gao --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile -@@ -1225,6 +1225,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ +@@ -1190,6 +1190,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ mt7623n-bananapi-bpi-r2.dtb \ mt7629-rfb.dtb \ mt7981-rfb.dtb \ diff --git a/package/boot/uboot-mediatek/patches/100-21-mtd-spi-nor-add-more-flash-ids.patch b/package/boot/uboot-mediatek/patches/100-21-mtd-spi-nor-add-more-flash-ids.patch index adcaadf654f..578b6e62b84 100644 --- a/package/boot/uboot-mediatek/patches/100-21-mtd-spi-nor-add-more-flash-ids.patch +++ b/package/boot/uboot-mediatek/patches/100-21-mtd-spi-nor-add-more-flash-ids.patch @@ -13,7 +13,7 @@ Signed-off-by: Weijie Gao --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c -@@ -698,6 +698,7 @@ static int set_4byte(struct spi_nor *nor +@@ -697,6 +697,7 @@ static int set_4byte(struct spi_nor *nor case SNOR_MFR_ISSI: case SNOR_MFR_MACRONIX: case SNOR_MFR_WINBOND: @@ -23,7 +23,7 @@ Signed-off-by: Weijie Gao --- a/drivers/mtd/spi/spi-nor-ids.c +++ b/drivers/mtd/spi/spi-nor-ids.c -@@ -84,7 +84,8 @@ const struct flash_info spi_nor_ids[] = +@@ -83,7 +83,8 @@ const struct flash_info spi_nor_ids[] = { INFO("en25q32b", 0x1c3016, 0, 64 * 1024, 64, 0) }, { INFO("en25q64", 0x1c3017, 0, 64 * 1024, 128, SECT_4K) }, { INFO("en25q128b", 0x1c3018, 0, 64 * 1024, 256, 0) }, @@ -33,7 +33,7 @@ Signed-off-by: Weijie Gao { INFO("en25s64", 0x1c3817, 0, 64 * 1024, 128, SECT_4K) }, #endif #ifdef CONFIG_SPI_FLASH_GIGADEVICE /* GIGADEVICE */ -@@ -150,6 +151,11 @@ const struct flash_info spi_nor_ids[] = +@@ -149,6 +150,11 @@ const struct flash_info spi_nor_ids[] = {INFO("gd55x02g", 0xc8481C, 0, 64 * 1024, 4096, SECT_4K | SPI_NOR_OCTAL_READ | SPI_NOR_4B_OPCODES)}, { @@ -45,7 +45,7 @@ Signed-off-by: Weijie Gao INFO("gd25lq128", 0xc86018, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) -@@ -489,6 +495,16 @@ const struct flash_info spi_nor_ids[] = +@@ -490,6 +496,16 @@ const struct flash_info spi_nor_ids[] = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) }, { @@ -62,7 +62,7 @@ Signed-off-by: Weijie Gao INFO("w25q128jw", 0xef8018, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) -@@ -548,6 +564,11 @@ const struct flash_info spi_nor_ids[] = +@@ -549,6 +565,11 @@ const struct flash_info spi_nor_ids[] = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) }, { INFO("w25q256", 0xef4019, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, diff --git a/package/boot/uboot-mediatek/patches/100-22-mtd-spi-nand-backport-from-upstream-kernel.patch b/package/boot/uboot-mediatek/patches/100-22-mtd-spi-nand-backport-from-upstream-kernel.patch index ddfb7577ef7..aa03c9b3b9c 100644 --- a/package/boot/uboot-mediatek/patches/100-22-mtd-spi-nand-backport-from-upstream-kernel.patch +++ b/package/boot/uboot-mediatek/patches/100-22-mtd-spi-nand-backport-from-upstream-kernel.patch @@ -31,7 +31,7 @@ Signed-off-by: Weijie Gao obj-$(CONFIG_MTD_SPI_NAND) += spinand.o --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c -@@ -822,6 +822,7 @@ static const struct nand_ops spinand_ops +@@ -826,6 +826,7 @@ static const struct nand_ops spinand_ops }; static const struct spinand_manufacturer *spinand_manufacturers[] = { diff --git a/package/boot/uboot-mediatek/patches/100-23-mmc-mtk-sd-add-support-to-display-verbose-error-log.patch b/package/boot/uboot-mediatek/patches/100-23-mmc-mtk-sd-add-support-to-display-verbose-error-log.patch index d33ab0b284c..7ab2b6d0ce4 100644 --- a/package/boot/uboot-mediatek/patches/100-23-mmc-mtk-sd-add-support-to-display-verbose-error-log.patch +++ b/package/boot/uboot-mediatek/patches/100-23-mmc-mtk-sd-add-support-to-display-verbose-error-log.patch @@ -15,7 +15,7 @@ Signed-off-by: Weijie Gao --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig -@@ -855,6 +855,14 @@ config MMC_MTK +@@ -864,6 +864,14 @@ config MMC_MTK This is needed if support for any SD/SDIO/MMC devices is required. If unsure, say N. @@ -42,7 +42,7 @@ Signed-off-by: Weijie Gao +endif --- a/drivers/mmc/mtk-sd.c +++ b/drivers/mmc/mtk-sd.c -@@ -779,18 +779,24 @@ static int msdc_ops_send_cmd(struct udev +@@ -783,18 +783,24 @@ static int msdc_ops_send_cmd(struct udev if (cmd_ret && !(cmd_ret == -EIO && (cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK || diff --git a/package/boot/uboot-mediatek/patches/100-24-cmd-ubi-make-volume-find-create-remove-APIs-public.patch b/package/boot/uboot-mediatek/patches/100-24-cmd-ubi-make-volume-find-create-remove-APIs-public.patch index 3362e0e57db..cba34fce3f0 100644 --- a/package/boot/uboot-mediatek/patches/100-24-cmd-ubi-make-volume-find-create-remove-APIs-public.patch +++ b/package/boot/uboot-mediatek/patches/100-24-cmd-ubi-make-volume-find-create-remove-APIs-public.patch @@ -14,7 +14,7 @@ Signed-off-by: Weijie Gao --- a/cmd/ubi.c +++ b/cmd/ubi.c -@@ -213,8 +213,8 @@ bad: +@@ -212,8 +212,8 @@ bad: return err; } @@ -25,16 +25,16 @@ Signed-off-by: Weijie Gao { struct ubi_mkvol_req req; int err; -@@ -247,7 +247,7 @@ static int ubi_create_vol(char *volume, +@@ -246,7 +246,7 @@ static int ubi_create_vol(char *volume, return ubi_create_volume(ubi, &req); } -static struct ubi_volume *ubi_find_volume(char *volume) +struct ubi_volume *ubi_find_volume(char *volume) { - struct ubi_volume *vol = NULL; + struct ubi_volume *vol; int i; -@@ -262,7 +262,7 @@ static struct ubi_volume *ubi_find_volum +@@ -261,7 +261,7 @@ static struct ubi_volume *ubi_find_volum return NULL; } @@ -47,8 +47,8 @@ Signed-off-by: Weijie Gao +++ b/include/ubi_uboot.h @@ -50,6 +50,10 @@ extern void ubi_exit(void); extern int ubi_part(char *part_name, const char *vid_header_offset); - extern int ubi_volume_write(char *volume, void *buf, size_t size); - extern int ubi_volume_read(char *volume, char *buf, size_t size); + extern int ubi_volume_write(char *volume, void *buf, loff_t offset, size_t size); + extern int ubi_volume_read(char *volume, char *buf, loff_t offset, size_t size); +extern int ubi_create_vol(char *volume, int64_t size, int dynamic, int vol_id, + bool skipcheck); +extern struct ubi_volume *ubi_find_volume(char *volume); diff --git a/package/boot/uboot-mediatek/patches/100-25-cmd-ubi-allow-creating-volume-with-all-free-spaces.patch b/package/boot/uboot-mediatek/patches/100-25-cmd-ubi-allow-creating-volume-with-all-free-spaces.patch index d023b004f76..e61f5d11193 100644 --- a/package/boot/uboot-mediatek/patches/100-25-cmd-ubi-allow-creating-volume-with-all-free-spaces.patch +++ b/package/boot/uboot-mediatek/patches/100-25-cmd-ubi-allow-creating-volume-with-all-free-spaces.patch @@ -12,7 +12,7 @@ Signed-off-by: Weijie Gao --- a/cmd/ubi.c +++ b/cmd/ubi.c -@@ -226,7 +226,11 @@ int ubi_create_vol(char *volume, int64_t +@@ -225,7 +225,11 @@ int ubi_create_vol(char *volume, int64_t req.vol_id = vol_id; req.alignment = 1; diff --git a/package/boot/uboot-mediatek/patches/100-26-env-ubi-add-support-to-create-environment-volume-if-.patch b/package/boot/uboot-mediatek/patches/100-26-env-ubi-add-support-to-create-environment-volume-if-.patch index fb8d15ddf9b..afc586ff1c0 100644 --- a/package/boot/uboot-mediatek/patches/100-26-env-ubi-add-support-to-create-environment-volume-if-.patch +++ b/package/boot/uboot-mediatek/patches/100-26-env-ubi-add-support-to-create-environment-volume-if-.patch @@ -29,7 +29,7 @@ Signed-off-by: Weijie Gao depends on ENV_IS_IN_UBI --- a/env/ubi.c +++ b/env/ubi.c -@@ -106,6 +106,18 @@ static int env_ubi_save(void) +@@ -105,6 +105,18 @@ static int env_ubi_save(void) #endif /* CONFIG_SYS_REDUNDAND_ENVIRONMENT */ #endif /* CONFIG_CMD_SAVEENV */ @@ -48,7 +48,7 @@ Signed-off-by: Weijie Gao #ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT static int env_ubi_load(void) { -@@ -135,6 +147,11 @@ static int env_ubi_load(void) +@@ -134,6 +146,10 @@ static int env_ubi_load(void) return -EIO; } @@ -56,17 +56,16 @@ Signed-off-by: Weijie Gao + env_ubi_volume_create(CONFIG_ENV_UBI_VOLUME); + env_ubi_volume_create(CONFIG_ENV_UBI_VOLUME_REDUND); + } -+ - read1_fail = ubi_volume_read(CONFIG_ENV_UBI_VOLUME, (void *)tmp_env1, + read1_fail = ubi_volume_read(CONFIG_ENV_UBI_VOLUME, (void *)tmp_env1, 0, CONFIG_ENV_SIZE); if (read1_fail) -@@ -172,6 +189,9 @@ static int env_ubi_load(void) +@@ -171,6 +187,9 @@ static int env_ubi_load(void) return -EIO; } + if (IS_ENABLED(CONFIG_ENV_UBI_VOLUME_CREATE)) + env_ubi_volume_create(CONFIG_ENV_UBI_VOLUME); + - if (ubi_volume_read(CONFIG_ENV_UBI_VOLUME, buf, CONFIG_ENV_SIZE)) { + if (ubi_volume_read(CONFIG_ENV_UBI_VOLUME, buf, 0, CONFIG_ENV_SIZE)) { printf("\n** Unable to read env from %s:%s **\n", CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME); diff --git a/package/boot/uboot-mediatek/patches/100-29-board-mediatek-wire-up-NMBM-support.patch b/package/boot/uboot-mediatek/patches/100-29-board-mediatek-wire-up-NMBM-support.patch index f22449ae76f..aea82d898e0 100644 --- a/package/boot/uboot-mediatek/patches/100-29-board-mediatek-wire-up-NMBM-support.patch +++ b/package/boot/uboot-mediatek/patches/100-29-board-mediatek-wire-up-NMBM-support.patch @@ -12,7 +12,7 @@ Subject: [PATCH] board: mediatek: wire-up NMBM support --- a/board/mediatek/mt7622/mt7622_rfb.c +++ b/board/mediatek/mt7622/mt7622_rfb.c -@@ -10,6 +10,11 @@ +@@ -9,6 +9,11 @@ #include #include @@ -24,7 +24,7 @@ Subject: [PATCH] board: mediatek: wire-up NMBM support DECLARE_GLOBAL_DATA_PTR; int board_init(void) -@@ -23,3 +28,36 @@ int board_late_init(void) +@@ -22,3 +27,36 @@ int board_late_init(void) env_relocate(); return 0; } @@ -64,7 +64,7 @@ Subject: [PATCH] board: mediatek: wire-up NMBM support --- a/board/mediatek/mt7629/mt7629_rfb.c +++ b/board/mediatek/mt7629/mt7629_rfb.c @@ -6,6 +6,11 @@ - #include + #include #include +#include @@ -114,11 +114,10 @@ Subject: [PATCH] board: mediatek: wire-up NMBM support +} --- a/board/mediatek/mt7981/mt7981_rfb.c +++ b/board/mediatek/mt7981/mt7981_rfb.c -@@ -4,7 +4,58 @@ +@@ -4,7 +4,57 @@ * Author: Sam Shih */ -+#include +#include +#include +#include @@ -175,11 +174,10 @@ Subject: [PATCH] board: mediatek: wire-up NMBM support +} --- a/board/mediatek/mt7986/mt7986_rfb.c +++ b/board/mediatek/mt7986/mt7986_rfb.c -@@ -4,7 +4,60 @@ +@@ -4,7 +4,59 @@ * Author: Sam Shih */ -+#include +#include +#include +#include diff --git a/package/boot/uboot-mediatek/patches/160-net-phy-add-support-for-Airoha-ethernet-PHY-driver.patch b/package/boot/uboot-mediatek/patches/160-net-phy-add-support-for-Airoha-ethernet-PHY-driver.patch index f8e86599527..2a71a4eb924 100644 --- a/package/boot/uboot-mediatek/patches/160-net-phy-add-support-for-Airoha-ethernet-PHY-driver.patch +++ b/package/boot/uboot-mediatek/patches/160-net-phy-add-support-for-Airoha-ethernet-PHY-driver.patch @@ -58,7 +58,7 @@ Signed-off-by: Weijie Gao --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -77,6 +77,37 @@ config PHY_ADIN +@@ -83,6 +83,37 @@ config PHY_ADIN help Add support for configuring RGMII on Analog Devices ADIN PHYs. @@ -122,7 +122,7 @@ Signed-off-by: Weijie Gao + +/* INCLUDE FILE DECLARATIONS + */ -+#include ++#include +#include +#include +#include @@ -1028,7 +1028,7 @@ Signed-off-by: Weijie Gao + +/* INCLUDE FILE DECLARATIONS +*/ -+#include ++#include +#include +#include +#include @@ -1421,7 +1421,7 @@ Signed-off-by: Weijie Gao + } + +#ifdef CONFIG_PHY_AIROHA_FW_IN_UBI -+ ret = ubi_volume_read("en8811h-fw", firmware_buf, EN8811H_MD32_DM_SIZE + EN8811H_MD32_DSP_SIZE); ++ ret = ubi_volume_read("en8811h-fw", firmware_buf, 0, EN8811H_MD32_DM_SIZE + EN8811H_MD32_DSP_SIZE); + if (ret) { + printf("[Airoha] read firmware from UBI failed.\n"); + free(firmware_buf); @@ -1909,7 +1909,7 @@ Signed-off-by: Weijie Gao + --- a/drivers/net/eth-phy-uclass.c +++ b/drivers/net/eth-phy-uclass.c -@@ -155,7 +155,7 @@ static int eth_phy_of_to_plat(struct ude +@@ -154,7 +154,7 @@ static int eth_phy_of_to_plat(struct ude return 0; } diff --git a/package/boot/uboot-mediatek/patches/200-cmd-add-imsz-and-imszb.patch b/package/boot/uboot-mediatek/patches/200-cmd-add-imsz-and-imszb.patch index d10391e8c68..81c24543e2d 100644 --- a/package/boot/uboot-mediatek/patches/200-cmd-add-imsz-and-imszb.patch +++ b/package/boot/uboot-mediatek/patches/200-cmd-add-imsz-and-imszb.patch @@ -1,6 +1,6 @@ --- a/cmd/bootm.c +++ b/cmd/bootm.c -@@ -262,6 +262,67 @@ U_BOOT_CMD( +@@ -260,6 +260,67 @@ U_BOOT_CMD( /* iminfo - print header info for a requested image */ /*******************************************************************/ #if defined(CONFIG_CMD_IMI) @@ -70,7 +70,7 @@ { --- a/boot/image-fit.c +++ b/boot/image-fit.c -@@ -2051,6 +2051,47 @@ static const char *fit_get_image_type_pr +@@ -2046,6 +2046,47 @@ static const char *fit_get_image_type_pr return "unknown"; } @@ -120,7 +120,7 @@ int arch, int ph_type, int bootstage_id, --- a/include/image.h +++ b/include/image.h -@@ -1123,6 +1123,7 @@ int fit_parse_subimage(const char *spec, +@@ -1124,6 +1124,7 @@ int fit_parse_subimage(const char *spec, ulong *addr, const char **image_name); int fit_get_subimage_count(const void *fit, int images_noffset); diff --git a/package/boot/uboot-mediatek/patches/211-cmd-bootmenu-custom-title.patch b/package/boot/uboot-mediatek/patches/211-cmd-bootmenu-custom-title.patch index a99b77be083..76ff745e93f 100644 --- a/package/boot/uboot-mediatek/patches/211-cmd-bootmenu-custom-title.patch +++ b/package/boot/uboot-mediatek/patches/211-cmd-bootmenu-custom-title.patch @@ -1,6 +1,6 @@ --- a/cmd/bootmenu.c +++ b/cmd/bootmenu.c -@@ -452,7 +452,11 @@ static void menu_display_statusline(stru +@@ -451,7 +451,11 @@ static void menu_display_statusline(stru printf(ANSI_CURSOR_POSITION, 1, 1); puts(ANSI_CLEAR_LINE); printf(ANSI_CURSOR_POSITION, 2, 3); @@ -13,7 +13,7 @@ puts(ANSI_CLEAR_LINE_TO_END); printf(ANSI_CURSOR_POSITION, 3, 1); puts(ANSI_CLEAR_LINE); -@@ -537,6 +541,7 @@ static enum bootmenu_ret bootmenu_show(i +@@ -536,6 +540,7 @@ static enum bootmenu_ret bootmenu_show(i return BOOTMENU_RET_FAIL; } diff --git a/package/boot/uboot-mediatek/patches/220-cmd-env-readmem.patch b/package/boot/uboot-mediatek/patches/220-cmd-env-readmem.patch index 6f5f5539abf..58f7d316a69 100644 --- a/package/boot/uboot-mediatek/patches/220-cmd-env-readmem.patch +++ b/package/boot/uboot-mediatek/patches/220-cmd-env-readmem.patch @@ -1,6 +1,6 @@ --- a/cmd/Kconfig +++ b/cmd/Kconfig -@@ -676,6 +676,12 @@ config CMD_ENV_EXISTS +@@ -683,6 +683,12 @@ config CMD_ENV_EXISTS Check if a variable is defined in the environment for use in shell scripting. diff --git a/package/boot/uboot-mediatek/patches/250-fix-mmc-erase-timeout.patch b/package/boot/uboot-mediatek/patches/250-fix-mmc-erase-timeout.patch index fd5fdd814b8..e03b212a746 100644 --- a/package/boot/uboot-mediatek/patches/250-fix-mmc-erase-timeout.patch +++ b/package/boot/uboot-mediatek/patches/250-fix-mmc-erase-timeout.patch @@ -1,6 +1,6 @@ --- a/drivers/mmc/mmc_write.c +++ b/drivers/mmc/mmc_write.c -@@ -80,7 +80,7 @@ ulong mmc_berase(struct blk_desc *block_ +@@ -79,7 +79,7 @@ ulong mmc_berase(struct blk_desc *block_ u32 start_rem, blkcnt_rem, erase_args = 0; struct mmc *mmc = find_mmc_device(dev_num); lbaint_t blk = 0, blk_r = 0; diff --git a/package/boot/uboot-mediatek/patches/280-image-fdt-save-name-of-FIT-configuration-in-chosen-node.patch b/package/boot/uboot-mediatek/patches/280-image-fdt-save-name-of-FIT-configuration-in-chosen-node.patch index 6755f614a96..419ee4adb8a 100644 --- a/package/boot/uboot-mediatek/patches/280-image-fdt-save-name-of-FIT-configuration-in-chosen-node.patch +++ b/package/boot/uboot-mediatek/patches/280-image-fdt-save-name-of-FIT-configuration-in-chosen-node.patch @@ -16,7 +16,7 @@ Reviewed-by: Tom Rini --- a/boot/image-fdt.c +++ b/boot/image-fdt.c -@@ -618,6 +618,12 @@ int image_setup_libfdt(struct bootm_head +@@ -617,6 +617,12 @@ int image_setup_libfdt(struct bootm_head images->fit_uname_cfg, strlen(images->fit_uname_cfg) + 1, 1); diff --git a/package/boot/uboot-mediatek/patches/300-mt7623-fix-mmc-get-env-dev.patch b/package/boot/uboot-mediatek/patches/300-mt7623-fix-mmc-get-env-dev.patch index 86c48badda9..5fc3d0a344e 100644 --- a/package/boot/uboot-mediatek/patches/300-mt7623-fix-mmc-get-env-dev.patch +++ b/package/boot/uboot-mediatek/patches/300-mt7623-fix-mmc-get-env-dev.patch @@ -2,7 +2,7 @@ +++ b/board/mediatek/mt7623/mt7623_rfb.c @@ -5,6 +5,7 @@ - #include + #include #include +#include #include diff --git a/package/boot/uboot-mediatek/patches/301-mt7622-generic-reset-button-ignore-env.patch b/package/boot/uboot-mediatek/patches/301-mt7622-generic-reset-button-ignore-env.patch index 47c92a85bd6..57a119bd398 100644 --- a/package/boot/uboot-mediatek/patches/301-mt7622-generic-reset-button-ignore-env.patch +++ b/package/boot/uboot-mediatek/patches/301-mt7622-generic-reset-button-ignore-env.patch @@ -1,8 +1,8 @@ --- a/board/mediatek/mt7622/mt7622_rfb.c +++ b/board/mediatek/mt7622/mt7622_rfb.c -@@ -6,9 +6,16 @@ +@@ -5,9 +5,16 @@ + */ - #include #include +#include +#include @@ -17,7 +17,7 @@ #include #include -@@ -24,7 +31,22 @@ int board_init(void) +@@ -23,7 +30,22 @@ int board_init(void) int board_late_init(void) { @@ -43,7 +43,7 @@ } --- a/arch/arm/mach-mediatek/Kconfig +++ b/arch/arm/mach-mediatek/Kconfig -@@ -154,4 +154,11 @@ config MTK_BROM_HEADER_INFO +@@ -155,4 +155,11 @@ config MTK_BROM_HEADER_INFO source "board/mediatek/mt7629/Kconfig" diff --git a/package/boot/uboot-mediatek/patches/302-mt7623-generic-reset-button-ignore-env.patch b/package/boot/uboot-mediatek/patches/302-mt7623-generic-reset-button-ignore-env.patch index b8d89058a2e..a6e4229dd53 100644 --- a/package/boot/uboot-mediatek/patches/302-mt7623-generic-reset-button-ignore-env.patch +++ b/package/boot/uboot-mediatek/patches/302-mt7623-generic-reset-button-ignore-env.patch @@ -3,7 +3,7 @@ @@ -4,9 +4,18 @@ */ - #include + #include +#include +#include +#include diff --git a/package/boot/uboot-mediatek/patches/303-mt7986-generic-reset-button-ignore-env.patch b/package/boot/uboot-mediatek/patches/303-mt7986-generic-reset-button-ignore-env.patch index 45290149f3f..01b4b52952f 100644 --- a/package/boot/uboot-mediatek/patches/303-mt7986-generic-reset-button-ignore-env.patch +++ b/package/boot/uboot-mediatek/patches/303-mt7986-generic-reset-button-ignore-env.patch @@ -1,8 +1,8 @@ --- a/board/mediatek/mt7986/mt7986_rfb.c +++ b/board/mediatek/mt7986/mt7986_rfb.c -@@ -6,9 +6,16 @@ +@@ -5,9 +5,16 @@ + */ - #include #include +#include +#include @@ -17,7 +17,7 @@ #include #include -@@ -24,7 +31,22 @@ int board_init(void) +@@ -23,7 +30,22 @@ int board_init(void) int board_late_init(void) { diff --git a/package/boot/uboot-mediatek/patches/304-mt7981-generic-reset-button-ignore-env.patch b/package/boot/uboot-mediatek/patches/304-mt7981-generic-reset-button-ignore-env.patch index fc443349829..b3ac2aa27f1 100644 --- a/package/boot/uboot-mediatek/patches/304-mt7981-generic-reset-button-ignore-env.patch +++ b/package/boot/uboot-mediatek/patches/304-mt7981-generic-reset-button-ignore-env.patch @@ -1,8 +1,8 @@ --- a/board/mediatek/mt7981/mt7981_rfb.c +++ b/board/mediatek/mt7981/mt7981_rfb.c -@@ -6,9 +6,16 @@ +@@ -5,9 +5,16 @@ + */ - #include #include +#include +#include @@ -17,7 +17,7 @@ #include #include -@@ -24,7 +31,22 @@ int board_init(void) +@@ -23,7 +30,22 @@ int board_init(void) int board_late_init(void) { diff --git a/package/boot/uboot-mediatek/patches/305-mt7988-generic-reset-button-ignore-env.patch b/package/boot/uboot-mediatek/patches/305-mt7988-generic-reset-button-ignore-env.patch index 2bbc5c1005f..3f239c984a7 100644 --- a/package/boot/uboot-mediatek/patches/305-mt7988-generic-reset-button-ignore-env.patch +++ b/package/boot/uboot-mediatek/patches/305-mt7988-generic-reset-button-ignore-env.patch @@ -1,10 +1,9 @@ --- a/board/mediatek/mt7988/mt7988_rfb.c +++ b/board/mediatek/mt7988/mt7988_rfb.c -@@ -4,7 +4,43 @@ +@@ -4,7 +4,42 @@ * Author: Sam Shih */ -+#include +#include +#include +#include diff --git a/package/boot/uboot-mediatek/patches/310-mt7988-select-rootdisk.patch b/package/boot/uboot-mediatek/patches/310-mt7988-select-rootdisk.patch index 28d7e0a3f6e..308108e621d 100644 --- a/package/boot/uboot-mediatek/patches/310-mt7988-select-rootdisk.patch +++ b/package/boot/uboot-mediatek/patches/310-mt7988-select-rootdisk.patch @@ -1,6 +1,6 @@ --- a/board/mediatek/mt7988/mt7988_rfb.c +++ b/board/mediatek/mt7988/mt7988_rfb.c -@@ -11,7 +11,9 @@ +@@ -10,7 +10,9 @@ #include #include #include @@ -10,7 +10,7 @@ #ifndef CONFIG_RESET_BUTTON_LABEL #define CONFIG_RESET_BUTTON_LABEL "reset" -@@ -44,3 +46,54 @@ int board_late_init(void) +@@ -43,3 +45,54 @@ int board_late_init(void) env_relocate(); return 0; } diff --git a/package/boot/uboot-mediatek/patches/311-mt7986-select-rootdisk.patch b/package/boot/uboot-mediatek/patches/311-mt7986-select-rootdisk.patch index 33121627655..3588dc2a881 100644 --- a/package/boot/uboot-mediatek/patches/311-mt7986-select-rootdisk.patch +++ b/package/boot/uboot-mediatek/patches/311-mt7986-select-rootdisk.patch @@ -1,6 +1,6 @@ --- a/board/mediatek/mt7986/mt7986_rfb.c +++ b/board/mediatek/mt7986/mt7986_rfb.c -@@ -11,7 +11,9 @@ +@@ -10,7 +10,9 @@ #include #include #include @@ -10,7 +10,7 @@ #ifndef CONFIG_RESET_BUTTON_LABEL #define CONFIG_RESET_BUTTON_LABEL "reset" -@@ -83,3 +85,54 @@ int board_nmbm_init(void) +@@ -82,3 +84,54 @@ int board_nmbm_init(void) return 0; } diff --git a/package/boot/uboot-mediatek/patches/312-mt7622-select-rootdisk.patch b/package/boot/uboot-mediatek/patches/312-mt7622-select-rootdisk.patch index 70cbf6b4630..44caf8465cb 100644 --- a/package/boot/uboot-mediatek/patches/312-mt7622-select-rootdisk.patch +++ b/package/boot/uboot-mediatek/patches/312-mt7622-select-rootdisk.patch @@ -1,6 +1,6 @@ --- a/board/mediatek/mt7622/mt7622_rfb.c +++ b/board/mediatek/mt7622/mt7622_rfb.c -@@ -11,7 +11,9 @@ +@@ -10,7 +10,9 @@ #include #include #include @@ -10,7 +10,7 @@ #ifndef CONFIG_RESET_BUTTON_LABEL #define CONFIG_RESET_BUTTON_LABEL "reset" -@@ -22,10 +24,43 @@ +@@ -21,10 +23,43 @@ #include #include @@ -54,7 +54,7 @@ return 0; } -@@ -83,3 +118,84 @@ int board_nmbm_init(void) +@@ -82,3 +117,84 @@ int board_nmbm_init(void) return 0; } diff --git a/package/boot/uboot-mediatek/patches/314-mt7981-select-rootdisk.patch b/package/boot/uboot-mediatek/patches/314-mt7981-select-rootdisk.patch index 05b620a2769..8c13a704689 100644 --- a/package/boot/uboot-mediatek/patches/314-mt7981-select-rootdisk.patch +++ b/package/boot/uboot-mediatek/patches/314-mt7981-select-rootdisk.patch @@ -1,6 +1,6 @@ --- a/board/mediatek/mt7981/mt7981_rfb.c +++ b/board/mediatek/mt7981/mt7981_rfb.c -@@ -11,7 +11,9 @@ +@@ -10,7 +10,9 @@ #include #include #include @@ -10,7 +10,7 @@ #ifndef CONFIG_RESET_BUTTON_LABEL #define CONFIG_RESET_BUTTON_LABEL "reset" -@@ -81,3 +83,54 @@ int board_nmbm_init(void) +@@ -80,3 +82,54 @@ int board_nmbm_init(void) return 0; } @@ -81,9 +81,9 @@ +CONFIG_OF_SYSTEM_SETUP=y --- a/configs/mt7981_rfb_defconfig +++ b/configs/mt7981_rfb_defconfig -@@ -134,3 +134,4 @@ CONFIG_DM_SPI=y - CONFIG_MTK_SPIM=y +@@ -135,3 +135,4 @@ CONFIG_MTK_SPIM=y CONFIG_HEXDUMP=y + # CONFIG_EFI_LOADER is not set CONFIG_LMB_MAX_REGIONS=64 +CONFIG_OF_SYSTEM_SETUP=y --- a/configs/mt7981_sd_rfb_defconfig diff --git a/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch b/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch index a4cb75b2775..8768879d947 100644 --- a/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch +++ b/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch @@ -332,7 +332,7 @@ +}; --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile -@@ -1222,6 +1222,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ +@@ -1187,6 +1187,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ mt7622-rfb.dtb \ mt7623a-unielec-u7623-02-emmc.dtb \ mt7622-bananapi-bpi-r64.dtb \ diff --git a/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch b/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch index 3a743384afb..e41562e90b8 100644 --- a/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch +++ b/package/boot/uboot-mediatek/patches/412-add-ubnt-unifi-6-lr.patch @@ -739,7 +739,7 @@ +}; --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile -@@ -1223,6 +1223,8 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ +@@ -1188,6 +1188,8 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ mt7623a-unielec-u7623-02-emmc.dtb \ mt7622-bananapi-bpi-r64.dtb \ mt7622-linksys-e8450-ubi.dtb \ @@ -917,7 +917,7 @@ DECLARE_GLOBAL_DATA_PTR; -@@ -397,6 +398,20 @@ static int initr_onenand(void) +@@ -396,6 +397,20 @@ static int initr_onenand(void) } #endif @@ -938,7 +938,7 @@ #ifdef CONFIG_MMC static int initr_mmc(void) { -@@ -681,6 +696,9 @@ static init_fnc_t init_sequence_r[] = { +@@ -680,6 +695,9 @@ static init_fnc_t init_sequence_r[] = { #ifdef CONFIG_NMBM_MTD initr_nmbm, #endif diff --git a/package/boot/uboot-mediatek/patches/442-add-bpi-r3-mini.patch b/package/boot/uboot-mediatek/patches/442-add-bpi-r3-mini.patch index 95c9bec7318..ad556b7d82d 100644 --- a/package/boot/uboot-mediatek/patches/442-add-bpi-r3-mini.patch +++ b/package/boot/uboot-mediatek/patches/442-add-bpi-r3-mini.patch @@ -149,7 +149,7 @@ +CONFIG_LMB_MAX_REGIONS=64 --- /dev/null +++ b/configs/mt7986a_bpi-r3-mini-snand_defconfig -@@ -0,0 +1,139 @@ +@@ -0,0 +1,140 @@ +CONFIG_ARM=y +CONFIG_SYS_HAS_NONCACHED_MEMORY=y +CONFIG_POSITION_INDEPENDENT=y @@ -256,6 +256,7 @@ +CONFIG_MTD_UBI_FASTMAP=y +CONFIG_PHY_AIROHA=y +CONFIG_PHY_AIROHA_EN8811H=y ++CONFIG_PHY_AIROHA_FW_IN_UBI=y +CONFIG_PHY_ETHERNET_ID=y +CONFIG_PHY_FIXED=y +CONFIG_DM_MDIO=y diff --git a/package/boot/uboot-mediatek/patches/452-add-xiaomi-redmi-ax6s.patch b/package/boot/uboot-mediatek/patches/452-add-xiaomi-redmi-ax6s.patch index 06c866d840b..003b20a0b7c 100644 --- a/package/boot/uboot-mediatek/patches/452-add-xiaomi-redmi-ax6s.patch +++ b/package/boot/uboot-mediatek/patches/452-add-xiaomi-redmi-ax6s.patch @@ -15,7 +15,7 @@ Subject: [PATCH] add xiaomi redmi ax6s --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile -@@ -1225,6 +1225,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ +@@ -1190,6 +1190,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ mt7622-linksys-e8450-ubi.dtb \ mt7622-ubnt-unifi-6-lr.dtb \ mt7622-ubnt-unifi-6-lr-v3.dtb \ diff --git a/package/boot/uboot-mediatek/patches/454-add-glinet-x3000.patch b/package/boot/uboot-mediatek/patches/454-add-glinet-x3000.patch index 0cad80ed5ac..069a240d499 100644 --- a/package/boot/uboot-mediatek/patches/454-add-glinet-x3000.patch +++ b/package/boot/uboot-mediatek/patches/454-add-glinet-x3000.patch @@ -1,6 +1,3 @@ -diff --git a/arch/arm/dts/mt7981-glinet-gl-x3000.dts b/arch/arm/dts/mt7981-glinet-gl-x3000.dts -new file mode 100644 -index 0000000..911a702 --- /dev/null +++ b/arch/arm/dts/mt7981-glinet-gl-x3000.dts @@ -0,0 +1,144 @@ @@ -148,9 +145,6 @@ index 0000000..911a702 +&uart0 { + status = "okay"; +}; -diff --git a/configs/mt7981_glinet_gl-x3000_defconfig b/configs/mt7981_glinet_gl-x3000_defconfig -new file mode 100644 -index 0000000..96ad96f --- /dev/null +++ b/configs/mt7981_glinet_gl-x3000_defconfig @@ -0,0 +1,100 @@ @@ -254,9 +248,6 @@ index 0000000..96ad96f +# CONFIG_EFI_LOADER is not set +CONFIG_LMB_MAX_REGIONS=64 +# CONFIG_TOOLS_LIBCRYPTO is not set -diff --git a/glinet_gl-x3000_env b/glinet_gl-x3000_env -new file mode 100644 -index 0000000..e624e41 --- /dev/null +++ b/glinet_gl-x3000_env @@ -0,0 +1,26 @@ diff --git a/package/boot/uboot-mediatek/patches/455-arm-provide-noncached_set_region-prototype-to-fix-build.patch b/package/boot/uboot-mediatek/patches/455-arm-provide-noncached_set_region-prototype-to-fix-build.patch new file mode 100644 index 00000000000..ba04f608b45 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/455-arm-provide-noncached_set_region-prototype-to-fix-build.patch @@ -0,0 +1,43 @@ +From aab8e6cf7afbbcef60593c6b1795fa5d8e78e597 Mon Sep 17 00:00:00 2001 +From: Jonas Jelonek +Date: Tue, 15 Oct 2024 20:02:25 +0200 +Subject: [PATCH] arm: provide noncached_set_region prototype to fix build + +Due to the removal of weak functions in 7d6cee2cd0 ("cmd: cache: Remove +weak function"), uboot fails to compile after updating to v2024.10 for +mediatek target in OpenWrt with GCC-14 with error: +cmd/cache.c: In function 'do_dcache': +cmd/cache.c:57:25: error: implicit declaration of function + 'noncached_set_region' [-Wimplicit-function-declaration] + +Thus, provide a prototype in arm's include/asm/system.h to fix a build +error in cmd/cache.c, since related prototypes are also located there. +Also add an include of asm/system.h in cmd/cache.c have the function +available there. + +Signed-off-by: Jonas Jelonek +--- + arch/arm/include/asm/system.h | 1 + + cmd/cache.c | 1 + + 2 files changed, 2 insertions(+) + +--- a/arch/arm/include/asm/system.h ++++ b/arch/arm/include/asm/system.h +@@ -658,6 +658,7 @@ void mmu_set_region_dcache_behaviour(phy + * Return: 0 if OK + */ + int noncached_init(void); ++void noncached_set_region(void); + + phys_addr_t noncached_alloc(size_t size, size_t align); + #endif /* CONFIG_SYS_NONCACHED_MEMORY */ +--- a/cmd/cache.c ++++ b/cmd/cache.c +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + + static int parse_argv(const char *); + diff --git a/package/boot/uboot-rockchip/Makefile b/package/boot/uboot-rockchip/Makefile index a4d81a94e13..dd22ac390e1 100644 --- a/package/boot/uboot-rockchip/Makefile +++ b/package/boot/uboot-rockchip/Makefile @@ -5,9 +5,9 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk -PKG_VERSION:=2024.07 +PKG_VERSION:=2024.10 PKG_RELEASE:=1 -PKG_HASH:=f591da9ab90ef3d6b3d173766d0ddff90c4ed7330680897486117df390d83c8f +PKG_HASH:=b28daf4ac17e43156363078bf510297584137f6df50fced9b12df34f61a92fb0 PKG_MAINTAINER:=Sarah Maedel diff --git a/package/boot/uboot-rockchip/patches/000-v2024.10-rc1-backport-upstream-dts-sync.patch b/package/boot/uboot-rockchip/patches/000-v2024.10-rc1-backport-upstream-dts-sync.patch deleted file mode 100644 index afe651afc80..00000000000 --- a/package/boot/uboot-rockchip/patches/000-v2024.10-rc1-backport-upstream-dts-sync.patch +++ /dev/null @@ -1,3687 +0,0 @@ -From 6bb92fcf7d2fea2314d616e5e2391a8bf2b0fdfa Mon Sep 17 00:00:00 2001 -From: Tom Rini -Date: Mon, 20 May 2024 09:54:58 -0600 -Subject: [PATCH] Squashed 'dts/upstream/' changes from - b35b9bd1d4ee..7e08733c96c8 ---- - .../src/arm64/rockchip/rk3588s-nanopi-r6c.dts | 14 + - .../src/arm64/rockchip/rk3588s-nanopi-r6s.dts | 764 ++++++++++++++++++ - 2 files changed, 778 insertions(+) - create mode 100644 dts/upstream/src/arm64/rockchip/rk3588s-nanopi-r6c.dts - create mode 100644 dts/upstream/src/arm64/rockchip/rk3588s-nanopi-r6s.dts - ---- /dev/null -+++ b/dts/upstream/src/arm64/rockchip/rk3588-armsom-sige7.dts -@@ -0,0 +1,691 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+ -+/dts-v1/; -+ -+#include -+#include -+#include "rk3588.dtsi" -+ -+/ { -+ model = "ArmSoM Sige7"; -+ compatible = "armsom,sige7", "rockchip,rk3588"; -+ -+ aliases { -+ mmc0 = &sdhci; -+ mmc1 = &sdmmc; -+ }; -+ -+ chosen { -+ stdout-path = "serial2:1500000n8"; -+ }; -+ -+ analog-sound { -+ compatible = "audio-graph-card"; -+ dais = <&i2s0_8ch_p0>; -+ label = "rk3588-es8316"; -+ hp-det-gpio = <&gpio1 RK_PD5 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&hp_detect>; -+ routing = "MIC2", "Mic Jack", -+ "Headphones", "HPOL", -+ "Headphones", "HPOR"; -+ widgets = "Microphone", "Mic Jack", -+ "Headphone", "Headphones"; -+ }; -+ -+ leds { -+ compatible = "gpio-leds"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&led_rgb_g>; -+ -+ led_green: led-0 { -+ color = ; -+ function = LED_FUNCTION_STATUS; -+ gpios = <&gpio0 RK_PB7 GPIO_ACTIVE_HIGH>; -+ linux,default-trigger = "heartbeat"; -+ }; -+ -+ led_red: led-1 { -+ color = ; -+ function = LED_FUNCTION_STATUS; -+ gpios = <&gpio4 RK_PC5 GPIO_ACTIVE_HIGH>; -+ linux,default-trigger = "none"; -+ }; -+ }; -+ -+ fan: pwm-fan { -+ compatible = "pwm-fan"; -+ cooling-levels = <0 95 145 195 255>; -+ fan-supply = <&vcc5v0_sys>; -+ pwms = <&pwm1 0 50000 0>; -+ #cooling-cells = <2>; -+ }; -+ -+ vcc3v3_pcie2x1l2: vcc3v3-pcie2x1l2-regulator { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc3v3_pcie2x1l2"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ startup-delay-us = <5000>; -+ vin-supply = <&vcc_3v3_s3>; -+ }; -+ -+ vcc3v3_pcie30: vcc3v3-pcie30-regulator { -+ compatible = "regulator-fixed"; -+ enable-active-high; -+ gpios = <&gpio1 RK_PA4 GPIO_ACTIVE_HIGH>; -+ regulator-name = "vcc3v3_pcie30"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ startup-delay-us = <5000>; -+ vin-supply = <&vcc5v0_sys>; -+ }; -+ -+ vcc5v0_host: vcc5v0-host-regulator { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc5v0_host"; -+ regulator-boot-on; -+ regulator-always-on; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ enable-active-high; -+ gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&vcc5v0_host_en>; -+ vin-supply = <&vcc5v0_sys>; -+ }; -+ -+ vcc5v0_sys: vcc5v0-sys-regulator { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc5v0_sys"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ }; -+ -+ vcc_1v1_nldo_s3: vcc-1v1-nldo-s3-regulator { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc_1v1_nldo_s3"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1100000>; -+ regulator-max-microvolt = <1100000>; -+ vin-supply = <&vcc5v0_sys>; -+ }; -+}; -+ -+&combphy0_ps { -+ status = "okay"; -+}; -+ -+&combphy1_ps { -+ status = "okay"; -+}; -+ -+&combphy2_psu { -+ status = "okay"; -+}; -+ -+&cpu_b0 { -+ cpu-supply = <&vdd_cpu_big0_s0>; -+}; -+ -+&cpu_b1 { -+ cpu-supply = <&vdd_cpu_big0_s0>; -+}; -+ -+&cpu_b2 { -+ cpu-supply = <&vdd_cpu_big1_s0>; -+}; -+ -+&cpu_b3 { -+ cpu-supply = <&vdd_cpu_big1_s0>; -+}; -+ -+&cpu_l0 { -+ cpu-supply = <&vdd_cpu_lit_s0>; -+}; -+ -+&cpu_l1 { -+ cpu-supply = <&vdd_cpu_lit_s0>; -+}; -+ -+&cpu_l2 { -+ cpu-supply = <&vdd_cpu_lit_s0>; -+}; -+ -+&cpu_l3 { -+ cpu-supply = <&vdd_cpu_lit_s0>; -+}; -+ -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0m2_xfer>; -+ status = "okay"; -+ -+ vdd_cpu_big0_s0: regulator@42 { -+ compatible = "rockchip,rk8602"; -+ reg = <0x42>; -+ fcs,suspend-voltage-selector = <1>; -+ regulator-name = "vdd_cpu_big0_s0"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <550000>; -+ regulator-max-microvolt = <1050000>; -+ regulator-ramp-delay = <2300>; -+ vin-supply = <&vcc5v0_sys>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vdd_cpu_big1_s0: regulator@43 { -+ compatible = "rockchip,rk8603", "rockchip,rk8602"; -+ reg = <0x43>; -+ fcs,suspend-voltage-selector = <1>; -+ regulator-name = "vdd_cpu_big1_s0"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <550000>; -+ regulator-max-microvolt = <1050000>; -+ regulator-ramp-delay = <2300>; -+ vin-supply = <&vcc5v0_sys>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+}; -+ -+&i2c6 { -+ status = "okay"; -+ -+ hym8563: rtc@51 { -+ compatible = "haoyu,hym8563"; -+ reg = <0x51>; -+ interrupt-parent = <&gpio0>; -+ interrupts = ; -+ #clock-cells = <0>; -+ clock-output-names = "hym8563"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&hym8563_int>; -+ wakeup-source; -+ }; -+}; -+ -+&i2c7 { -+ status = "okay"; -+ -+ es8316: audio-codec@11 { -+ compatible = "everest,es8316"; -+ reg = <0x11>; -+ assigned-clocks = <&cru I2S0_8CH_MCLKOUT>; -+ assigned-clock-rates = <12288000>; -+ clocks = <&cru I2S0_8CH_MCLKOUT>; -+ clock-names = "mclk"; -+ #sound-dai-cells = <0>; -+ -+ port { -+ es8316_p0_0: endpoint { -+ remote-endpoint = <&i2s0_8ch_p0_0>; -+ }; -+ }; -+ }; -+}; -+ -+&i2s0_8ch { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s0_lrck -+ &i2s0_mclk -+ &i2s0_sclk -+ &i2s0_sdi0 -+ &i2s0_sdo0>; -+ status = "okay"; -+ -+ i2s0_8ch_p0: port { -+ i2s0_8ch_p0_0: endpoint { -+ dai-format = "i2s"; -+ mclk-fs = <256>; -+ remote-endpoint = <&es8316_p0_0>; -+ }; -+ }; -+}; -+ -+/* phy1 - right ethernet port */ -+&pcie2x1l0 { -+ reset-gpios = <&gpio4 RK_PA5 GPIO_ACTIVE_HIGH>; -+ status = "okay"; -+}; -+ -+/* phy2 - WiFi */ -+&pcie2x1l1 { -+ reset-gpios = <&gpio3 RK_PD4 GPIO_ACTIVE_HIGH>; -+ status = "okay"; -+}; -+ -+/* phy0 - left ethernet port */ -+&pcie2x1l2 { -+ reset-gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_HIGH>; -+ status = "okay"; -+}; -+ -+&pcie30phy { -+ status = "okay"; -+}; -+ -+&pcie3x4 { -+ reset-gpios = <&gpio4 RK_PB6 GPIO_ACTIVE_HIGH>; -+ vpcie3v3-supply = <&vcc3v3_pcie30>; -+ status = "okay"; -+}; -+ -+&pinctrl { -+ hym8563 { -+ hym8563_int: hym8563-int { -+ rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ leds { -+ led_rgb_g: led-rgb-g { -+ rockchip,pins = <0 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ led_rgb_r: led-rgb-r { -+ rockchip,pins = <0 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ sound { -+ hp_detect: hp-detect { -+ rockchip,pins = <1 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ usb { -+ vcc5v0_host_en: vcc5v0-host-en { -+ rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+}; -+ -+&pwm1 { -+ status = "okay"; -+}; -+ -+&saradc { -+ vref-supply = <&avcc_1v8_s0>; -+ status = "okay"; -+}; -+ -+&sdhci { -+ bus-width = <8>; -+ no-sdio; -+ no-sd; -+ non-removable; -+ mmc-hs200-1_8v; -+ status = "okay"; -+}; -+ -+&sdmmc { -+ bus-width = <4>; -+ cap-mmc-highspeed; -+ cap-sd-highspeed; -+ disable-wp; -+ max-frequency = <200000000>; -+ no-sdio; -+ no-mmc; -+ sd-uhs-sdr104; -+ vmmc-supply = <&vcc_3v3_s3>; -+ vqmmc-supply = <&vccio_sd_s0>; -+ status = "okay"; -+}; -+ -+&spi2 { -+ assigned-clocks = <&cru CLK_SPI2>; -+ assigned-clock-rates = <200000000>; -+ num-cs = <1>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi2m2_cs0 &spi2m2_pins>; -+ status = "okay"; -+ -+ pmic@0 { -+ compatible = "rockchip,rk806"; -+ spi-max-frequency = <1000000>; -+ reg = <0x0>; -+ -+ interrupt-parent = <&gpio0>; -+ interrupts = <7 IRQ_TYPE_LEVEL_LOW>; -+ -+ gpio-controller; -+ #gpio-cells = <2>; -+ -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_null>, -+ <&rk806_dvs2_null>, <&rk806_dvs3_null>; -+ -+ system-power-controller; -+ -+ vcc1-supply = <&vcc5v0_sys>; -+ vcc2-supply = <&vcc5v0_sys>; -+ vcc3-supply = <&vcc5v0_sys>; -+ vcc4-supply = <&vcc5v0_sys>; -+ vcc5-supply = <&vcc5v0_sys>; -+ vcc6-supply = <&vcc5v0_sys>; -+ vcc7-supply = <&vcc5v0_sys>; -+ vcc8-supply = <&vcc5v0_sys>; -+ vcc9-supply = <&vcc5v0_sys>; -+ vcc10-supply = <&vcc5v0_sys>; -+ vcc11-supply = <&vcc_2v0_pldo_s3>; -+ vcc12-supply = <&vcc5v0_sys>; -+ vcc13-supply = <&vcc_1v1_nldo_s3>; -+ vcc14-supply = <&vcc_1v1_nldo_s3>; -+ vcca-supply = <&vcc5v0_sys>; -+ -+ rk806_dvs1_null: dvs1-null-pins { -+ pins = "gpio_pwrctrl1"; -+ function = "pin_fun0"; -+ }; -+ -+ rk806_dvs2_null: dvs2-null-pins { -+ pins = "gpio_pwrctrl2"; -+ function = "pin_fun0"; -+ }; -+ -+ rk806_dvs3_null: dvs3-null-pins { -+ pins = "gpio_pwrctrl3"; -+ function = "pin_fun0"; -+ }; -+ -+ regulators { -+ vdd_gpu_s0: vdd_gpu_mem_s0: dcdc-reg1 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <550000>; -+ regulator-max-microvolt = <950000>; -+ regulator-ramp-delay = <12500>; -+ regulator-name = "vdd_gpu_s0"; -+ regulator-enable-ramp-delay = <400>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vdd_cpu_lit_s0: vdd_cpu_lit_mem_s0: dcdc-reg2 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <550000>; -+ regulator-max-microvolt = <950000>; -+ regulator-ramp-delay = <12500>; -+ regulator-name = "vdd_cpu_lit_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vdd_log_s0: dcdc-reg3 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <675000>; -+ regulator-max-microvolt = <750000>; -+ regulator-ramp-delay = <12500>; -+ regulator-name = "vdd_log_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ regulator-suspend-microvolt = <750000>; -+ }; -+ }; -+ -+ vdd_vdenc_s0: vdd_vdenc_mem_s0: dcdc-reg4 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <550000>; -+ regulator-max-microvolt = <950000>; -+ regulator-ramp-delay = <12500>; -+ regulator-name = "vdd_vdenc_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vdd_ddr_s0: dcdc-reg5 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <675000>; -+ regulator-max-microvolt = <900000>; -+ regulator-ramp-delay = <12500>; -+ regulator-name = "vdd_ddr_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ regulator-suspend-microvolt = <850000>; -+ }; -+ }; -+ -+ vdd2_ddr_s3: dcdc-reg6 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-name = "vdd2_ddr_s3"; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ }; -+ }; -+ -+ vcc_2v0_pldo_s3: dcdc-reg7 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <2000000>; -+ regulator-max-microvolt = <2000000>; -+ regulator-ramp-delay = <12500>; -+ regulator-name = "vdd_2v0_pldo_s3"; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <2000000>; -+ }; -+ }; -+ -+ vcc_3v3_s3: dcdc-reg8 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-name = "vcc_3v3_s3"; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <3300000>; -+ }; -+ }; -+ -+ vddq_ddr_s0: dcdc-reg9 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-name = "vddq_ddr_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc_1v8_s3: dcdc-reg10 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ regulator-name = "vcc_1v8_s3"; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <1800000>; -+ }; -+ }; -+ -+ avcc_1v8_s0: pldo-reg1 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ regulator-name = "avcc_1v8_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc_1v8_s0: pldo-reg2 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ regulator-name = "vcc_1v8_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ regulator-suspend-microvolt = <1800000>; -+ }; -+ }; -+ -+ avdd_1v2_s0: pldo-reg3 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1200000>; -+ regulator-max-microvolt = <1200000>; -+ regulator-name = "avdd_1v2_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc_3v3_s0: pldo-reg4 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-ramp-delay = <12500>; -+ regulator-name = "vcc_3v3_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vccio_sd_s0: pldo-reg5 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-ramp-delay = <12500>; -+ regulator-name = "vccio_sd_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ pldo6_s3: pldo-reg6 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ regulator-name = "pldo6_s3"; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <1800000>; -+ }; -+ }; -+ -+ vdd_0v75_s3: nldo-reg1 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <750000>; -+ regulator-max-microvolt = <750000>; -+ regulator-name = "vdd_0v75_s3"; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <750000>; -+ }; -+ }; -+ -+ vdd_ddr_pll_s0: nldo-reg2 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <850000>; -+ regulator-max-microvolt = <850000>; -+ regulator-name = "vdd_ddr_pll_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ regulator-suspend-microvolt = <850000>; -+ }; -+ }; -+ -+ avdd_0v75_s0: nldo-reg3 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <750000>; -+ regulator-max-microvolt = <750000>; -+ regulator-name = "avdd_0v75_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vdd_0v85_s0: nldo-reg4 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <850000>; -+ regulator-max-microvolt = <850000>; -+ regulator-name = "vdd_0v85_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vdd_0v75_s0: nldo-reg5 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <750000>; -+ regulator-max-microvolt = <750000>; -+ regulator-name = "vdd_0v75_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ }; -+ }; -+}; -+ -+&u2phy3 { -+ status = "okay"; -+}; -+ -+&u2phy3_host { -+ phy-supply = <&vcc5v0_host>; -+ status = "okay"; -+}; -+ -+&uart2 { -+ pinctrl-0 = <&uart2m0_xfer>; -+ status = "okay"; -+}; -+ -+&usb_host1_ehci { -+ status = "okay"; -+}; -+ -+&usb_host1_ohci { -+ status = "okay"; -+}; ---- /dev/null -+++ b/dts/upstream/src/arm64/rockchip/rk3588s-nanopi-r6c.dts -@@ -0,0 +1,14 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+ -+/dts-v1/; -+ -+#include "rk3588s-nanopi-r6s.dts" -+ -+/ { -+ model = "FriendlyElec NanoPi R6C"; -+ compatible = "friendlyarm,nanopi-r6c", "rockchip,rk3588s"; -+}; -+ -+&lan2_led { -+ label = "user_led"; -+}; ---- /dev/null -+++ b/dts/upstream/src/arm64/rockchip/rk3588s-nanopi-r6s.dts -@@ -0,0 +1,764 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+ -+/dts-v1/; -+ -+#include -+#include -+#include -+#include "rk3588s.dtsi" -+ -+/ { -+ model = "FriendlyElec NanoPi R6S"; -+ compatible = "friendlyarm,nanopi-r6s", "rockchip,rk3588s"; -+ -+ aliases { -+ ethernet0 = &gmac1; -+ mmc0 = &sdmmc; -+ mmc1 = &sdhci; -+ }; -+ -+ chosen { -+ stdout-path = "serial2:1500000n8"; -+ }; -+ -+ adc-keys { -+ compatible = "adc-keys"; -+ io-channels = <&saradc 0>; -+ io-channel-names = "buttons"; -+ keyup-threshold-microvolt = <1800000>; -+ poll-interval = <100>; -+ -+ button-maskrom { -+ label = "Maskrom"; -+ linux,code = ; -+ press-threshold-microvolt = <1800>; -+ }; -+ }; -+ -+ gpio-keys { -+ compatible = "gpio-keys"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&key1_pin>; -+ -+ button-user { -+ label = "User"; -+ linux,code = ; -+ gpios = <&gpio1 RK_PC0 GPIO_ACTIVE_LOW>; -+ debounce-interval = <50>; -+ }; -+ }; -+ -+ leds { -+ compatible = "gpio-leds"; -+ -+ sys_led: led-0 { -+ label = "sys_led"; -+ gpios = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>; -+ linux,default-trigger = "heartbeat"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sys_led_pin>; -+ }; -+ -+ wan_led: led-1 { -+ label = "wan_led"; -+ gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&wan_led_pin>; -+ }; -+ -+ lan1_led: led-2 { -+ label = "lan1_led"; -+ gpios = <&gpio1 RK_PC3 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&lan1_led_pin>; -+ }; -+ -+ lan2_led: led-3 { -+ label = "lan2_led"; -+ gpios = <&gpio1 RK_PC4 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&lan2_led_pin>; -+ }; -+ }; -+ -+ vcc5v0_sys: vcc5v0-sys-regulator { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc5v0_sys"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ }; -+ -+ vcc_1v1_nldo_s3: vcc-1v1-nldo-s3-regulator { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc_1v1_nldo_s3"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1100000>; -+ regulator-max-microvolt = <1100000>; -+ vin-supply = <&vcc5v0_sys>; -+ }; -+ -+ vcc_3v3_s0: vcc-3v3-s0-regulator { -+ compatible = "regulator-fixed"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-name = "vcc_3v3_s0"; -+ vin-supply = <&vcc_3v3_s3>; -+ }; -+ -+ vcc_3v3_sd_s0: vcc-3v3-sd-s0-regulator { -+ compatible = "regulator-fixed"; -+ enable-active-high; -+ gpios = <&gpio4 RK_PB4 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sd_s0_pwr>; -+ regulator-name = "vcc_3v3_sd_s0"; -+ regulator-boot-on; -+ regulator-max-microvolt = <3000000>; -+ regulator-min-microvolt = <3000000>; -+ vin-supply = <&vcc_3v3_s3>; -+ }; -+ -+ vcc_3v3_pcie20: vcc3v3-pcie20-regulator { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc_3v3_pcie20"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ vin-supply = <&vcc_3v3_s3>; -+ }; -+ -+ vcc5v0_usb: vcc5v0-usb-regulator { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc5v0_usb"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ vin-supply = <&vcc5v0_sys>; -+ }; -+ -+ vcc5v0_usb_otg0: vcc5v0-usb-otg0-regulator { -+ compatible = "regulator-fixed"; -+ enable-active-high; -+ gpios = <&gpio1 RK_PD2 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&typec5v_pwren>; -+ regulator-name = "vcc5v0_usb_otg0"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ vin-supply = <&vcc5v0_usb>; -+ }; -+ -+ vcc5v0_host_20: vcc5v0-host-20-regulator { -+ compatible = "regulator-fixed"; -+ enable-active-high; -+ gpios = <&gpio4 RK_PB5 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&vcc5v0_host20_en>; -+ regulator-name = "vcc5v0_host_20"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ vin-supply = <&vcc5v0_usb>; -+ }; -+}; -+ -+&combphy0_ps { -+ status = "okay"; -+}; -+ -+&combphy2_psu { -+ status = "okay"; -+}; -+ -+&cpu_b0 { -+ cpu-supply = <&vdd_cpu_big0_s0>; -+}; -+ -+&cpu_b1 { -+ cpu-supply = <&vdd_cpu_big0_s0>; -+}; -+ -+&cpu_b2 { -+ cpu-supply = <&vdd_cpu_big1_s0>; -+}; -+ -+&cpu_b3 { -+ cpu-supply = <&vdd_cpu_big1_s0>; -+}; -+ -+&cpu_l0 { -+ cpu-supply = <&vdd_cpu_lit_s0>; -+}; -+ -+&cpu_l1 { -+ cpu-supply = <&vdd_cpu_lit_s0>; -+}; -+ -+&cpu_l2 { -+ cpu-supply = <&vdd_cpu_lit_s0>; -+}; -+ -+&cpu_l3 { -+ cpu-supply = <&vdd_cpu_lit_s0>; -+}; -+ -+&gmac1 { -+ clock_in_out = "output"; -+ phy-handle = <&rgmii_phy1>; -+ phy-mode = "rgmii-rxid"; -+ pinctrl-0 = <&gmac1_miim -+ &gmac1_tx_bus2 -+ &gmac1_rx_bus2 -+ &gmac1_rgmii_clk -+ &gmac1_rgmii_bus>; -+ pinctrl-names = "default"; -+ tx_delay = <0x42>; -+ status = "okay"; -+}; -+ -+&i2c0 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c0m2_xfer>; -+ status = "okay"; -+ -+ vdd_cpu_big0_s0: regulator@42 { -+ compatible = "rockchip,rk8602"; -+ reg = <0x42>; -+ fcs,suspend-voltage-selector = <1>; -+ regulator-name = "vdd_cpu_big0_s0"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <550000>; -+ regulator-max-microvolt = <1050000>; -+ regulator-ramp-delay = <2300>; -+ vin-supply = <&vcc5v0_sys>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vdd_cpu_big1_s0: regulator@43 { -+ compatible = "rockchip,rk8603", "rockchip,rk8602"; -+ reg = <0x43>; -+ fcs,suspend-voltage-selector = <1>; -+ regulator-name = "vdd_cpu_big1_s0"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <550000>; -+ regulator-max-microvolt = <1050000>; -+ regulator-ramp-delay = <2300>; -+ vin-supply = <&vcc5v0_sys>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+}; -+ -+&i2c2 { -+ status = "okay"; -+ -+ vdd_npu_s0: regulator@42 { -+ compatible = "rockchip,rk8602"; -+ reg = <0x42>; -+ fcs,suspend-voltage-selector = <1>; -+ regulator-name = "vdd_npu_s0"; -+ regulator-min-microvolt = <550000>; -+ regulator-max-microvolt = <950000>; -+ regulator-ramp-delay = <2300>; -+ regulator-boot-on; -+ regulator-always-on; -+ vin-supply = <&vcc5v0_sys>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+}; -+ -+&i2c6 { -+ clock-frequency = <200000>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c6m0_xfer>; -+ status = "okay"; -+ -+ hym8563: rtc@51 { -+ compatible = "haoyu,hym8563"; -+ reg = <0x51>; -+ #clock-cells = <0>; -+ clock-output-names = "hym8563"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&rtc_int>; -+ interrupt-parent = <&gpio0>; -+ interrupts = ; -+ wakeup-source; -+ }; -+}; -+ -+&mdio1 { -+ rgmii_phy1: ethernet-phy@1 { -+ compatible = "ethernet-phy-id001c.c916"; -+ reg = <0x1>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&rtl8211f_rst>; -+ reset-assert-us = <20000>; -+ reset-deassert-us = <100000>; -+ reset-gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; -+ }; -+}; -+ -+&pcie2x1l1 { -+ reset-gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_HIGH>; -+ vpcie3v3-supply = <&vcc_3v3_pcie20>; -+ status = "okay"; -+}; -+ -+&pcie2x1l2 { -+ reset-gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_HIGH>; -+ vpcie3v3-supply = <&vcc_3v3_pcie20>; -+ status = "okay"; -+}; -+ -+&pinctrl { -+ gpio-key { -+ key1_pin: key1-pin { -+ rockchip,pins = <1 RK_PC0 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+ -+ gpio-leds { -+ sys_led_pin: sys-led-pin { -+ rockchip,pins = -+ <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ -+ wan_led_pin: wan-led-pin { -+ rockchip,pins = -+ <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ -+ lan1_led_pin: lan1-led-pin { -+ rockchip,pins = -+ <1 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ -+ lan2_led_pin: lan2-led-pin { -+ rockchip,pins = -+ <1 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ hym8563 { -+ rtc_int: rtc-int { -+ rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+ -+ sdmmc { -+ sd_s0_pwr: sd-s0-pwr { -+ rockchip,pins = <4 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+ -+ usb { -+ typec5v_pwren: typec5v-pwren { -+ rockchip,pins = <1 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ -+ vcc5v0_host20_en: vcc5v0-host20-en { -+ rockchip,pins = <4 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ rtl8211f { -+ rtl8211f_rst: rtl8211f-rst { -+ rockchip,pins = <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+}; -+ -+&saradc { -+ vref-supply = <&avcc_1v8_s0>; -+ status = "okay"; -+}; -+ -+&sdhci { -+ bus-width = <8>; -+ no-sdio; -+ no-sd; -+ non-removable; -+ mmc-hs200-1_8v; -+ status = "okay"; -+}; -+ -+&sdmmc { -+ bus-width = <4>; -+ cap-sd-highspeed; -+ disable-wp; -+ max-frequency = <150000000>; -+ no-mmc; -+ no-sdio; -+ sd-uhs-sdr104; -+ vmmc-supply = <&vcc_3v3_sd_s0>; -+ vqmmc-supply = <&vccio_sd_s0>; -+ status = "okay"; -+}; -+ -+&spi2 { -+ status = "okay"; -+ assigned-clocks = <&cru CLK_SPI2>; -+ assigned-clock-rates = <200000000>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&spi2m2_cs0 &spi2m2_pins>; -+ num-cs = <1>; -+ -+ pmic@0 { -+ compatible = "rockchip,rk806"; -+ spi-max-frequency = <1000000>; -+ reg = <0x0>; -+ -+ interrupt-parent = <&gpio0>; -+ interrupts = <7 IRQ_TYPE_LEVEL_LOW>; -+ -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_null>, -+ <&rk806_dvs2_null>, <&rk806_dvs3_null>; -+ -+ system-power-controller; -+ -+ vcc1-supply = <&vcc5v0_sys>; -+ vcc2-supply = <&vcc5v0_sys>; -+ vcc3-supply = <&vcc5v0_sys>; -+ vcc4-supply = <&vcc5v0_sys>; -+ vcc5-supply = <&vcc5v0_sys>; -+ vcc6-supply = <&vcc5v0_sys>; -+ vcc7-supply = <&vcc5v0_sys>; -+ vcc8-supply = <&vcc5v0_sys>; -+ vcc9-supply = <&vcc5v0_sys>; -+ vcc10-supply = <&vcc5v0_sys>; -+ vcc11-supply = <&vcc_2v0_pldo_s3>; -+ vcc12-supply = <&vcc5v0_sys>; -+ vcc13-supply = <&vcc_1v1_nldo_s3>; -+ vcc14-supply = <&vcc_1v1_nldo_s3>; -+ vcca-supply = <&vcc5v0_sys>; -+ -+ gpio-controller; -+ #gpio-cells = <2>; -+ -+ rk806_dvs1_null: dvs1-null-pins { -+ pins = "gpio_pwrctrl1"; -+ function = "pin_fun0"; -+ }; -+ -+ rk806_dvs2_null: dvs2-null-pins { -+ pins = "gpio_pwrctrl2"; -+ function = "pin_fun0"; -+ }; -+ -+ rk806_dvs3_null: dvs3-null-pins { -+ pins = "gpio_pwrctrl3"; -+ function = "pin_fun0"; -+ }; -+ -+ regulators { -+ vdd_gpu_s0: vdd_gpu_mem_s0: dcdc-reg1 { -+ regulator-boot-on; -+ regulator-min-microvolt = <550000>; -+ regulator-max-microvolt = <950000>; -+ regulator-ramp-delay = <12500>; -+ regulator-name = "vdd_gpu_s0"; -+ regulator-enable-ramp-delay = <400>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vdd_cpu_lit_s0: vdd_cpu_lit_mem_s0: dcdc-reg2 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <550000>; -+ regulator-max-microvolt = <950000>; -+ regulator-ramp-delay = <12500>; -+ regulator-name = "vdd_cpu_lit_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vdd_log_s0: dcdc-reg3 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <675000>; -+ regulator-max-microvolt = <750000>; -+ regulator-ramp-delay = <12500>; -+ regulator-name = "vdd_log_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ regulator-suspend-microvolt = <750000>; -+ }; -+ }; -+ -+ vdd_vdenc_s0: vdd_vdenc_mem_s0: dcdc-reg4 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <550000>; -+ regulator-max-microvolt = <950000>; -+ regulator-ramp-delay = <12500>; -+ regulator-name = "vdd_vdenc_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vdd_ddr_s0: dcdc-reg5 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <675000>; -+ regulator-max-microvolt = <900000>; -+ regulator-ramp-delay = <12500>; -+ regulator-name = "vdd_ddr_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ regulator-suspend-microvolt = <850000>; -+ }; -+ }; -+ -+ vdd2_ddr_s3: dcdc-reg6 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-name = "vdd2_ddr_s3"; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ }; -+ }; -+ -+ vcc_2v0_pldo_s3: dcdc-reg7 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <2000000>; -+ regulator-max-microvolt = <2000000>; -+ regulator-ramp-delay = <12500>; -+ regulator-name = "vdd_2v0_pldo_s3"; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <2000000>; -+ }; -+ }; -+ -+ vcc_3v3_s3: dcdc-reg8 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-name = "vcc_3v3_s3"; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <3300000>; -+ }; -+ }; -+ -+ vddq_ddr_s0: dcdc-reg9 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-name = "vddq_ddr_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc_1v8_s3: dcdc-reg10 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ regulator-name = "vcc_1v8_s3"; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <1800000>; -+ }; -+ }; -+ -+ avcc_1v8_s0: pldo-reg1 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ regulator-name = "avcc_1v8_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ regulator-suspend-microvolt = <1800000>; -+ }; -+ }; -+ -+ vcc_1v8_s0: pldo-reg2 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ regulator-name = "vcc_1v8_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ regulator-suspend-microvolt = <1800000>; -+ }; -+ }; -+ -+ avdd_1v2_s0: pldo-reg3 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1200000>; -+ regulator-max-microvolt = <1200000>; -+ regulator-name = "avdd_1v2_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ avcc_3v3_s0: pldo-reg4 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-ramp-delay = <12500>; -+ regulator-name = "avcc_3v3_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vccio_sd_s0: pldo-reg5 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <3300000>; -+ regulator-ramp-delay = <12500>; -+ regulator-name = "vccio_sd_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ pldo6_s3: pldo-reg6 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ regulator-name = "pldo6_s3"; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <1800000>; -+ }; -+ }; -+ -+ vdd_0v75_s3: nldo-reg1 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <750000>; -+ regulator-max-microvolt = <750000>; -+ regulator-name = "vdd_0v75_s3"; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <750000>; -+ }; -+ }; -+ -+ avdd_ddr_pll_s0: nldo-reg2 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <850000>; -+ regulator-max-microvolt = <850000>; -+ regulator-name = "avdd_ddr_pll_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ regulator-suspend-microvolt = <850000>; -+ }; -+ }; -+ -+ avdd_0v75_s0: nldo-reg3 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <750000>; -+ regulator-max-microvolt = <750000>; -+ regulator-name = "avdd_0v75_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ avdd_0v85_s0: nldo-reg4 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <850000>; -+ regulator-max-microvolt = <850000>; -+ regulator-name = "avdd_0v85_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vdd_0v75_s0: nldo-reg5 { -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <750000>; -+ regulator-max-microvolt = <750000>; -+ regulator-name = "vdd_0v75_s0"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ }; -+ }; -+}; -+ -+&tsadc { -+ status = "okay"; -+}; -+ -+&u2phy2 { -+ status = "okay"; -+}; -+ -+&u2phy2_host { -+ phy-supply = <&vcc5v0_host_20>; -+ status = "okay"; -+}; -+ -+&uart2 { -+ pinctrl-0 = <&uart2m0_xfer>; -+ status = "okay"; -+}; -+ -+&usb_host0_ehci { -+ status = "okay"; -+}; -+ -+&usb_host0_ohci { -+ status = "okay"; -+}; ---- /dev/null -+++ b/dts/upstream/src/arm64/rockchip/rk3566-rock-3c.dts -@@ -0,0 +1,726 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+ -+/dts-v1/; -+#include -+#include -+#include -+#include -+#include "rk3566.dtsi" -+ -+/ { -+ model = "Radxa ROCK 3C"; -+ compatible = "radxa,rock-3c", "rockchip,rk3566"; -+ -+ aliases { -+ ethernet0 = &gmac1; -+ mmc0 = &sdhci; -+ mmc1 = &sdmmc0; -+ mmc2 = &sdmmc1; -+ }; -+ -+ chosen: chosen { -+ stdout-path = "serial2:1500000n8"; -+ }; -+ -+ gmac1_clkin: external-gmac1-clock { -+ compatible = "fixed-clock"; -+ clock-frequency = <125000000>; -+ clock-output-names = "gmac1_clkin"; -+ #clock-cells = <0>; -+ }; -+ -+ hdmi-con { -+ compatible = "hdmi-connector"; -+ type = "a"; -+ -+ port { -+ hdmi_con_in: endpoint { -+ remote-endpoint = <&hdmi_out_con>; -+ }; -+ }; -+ }; -+ -+ leds { -+ compatible = "gpio-leds"; -+ -+ led-0 { -+ gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>; -+ function = LED_FUNCTION_HEARTBEAT; -+ color = ; -+ linux,default-trigger = "heartbeat"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&user_led2>; -+ }; -+ }; -+ -+ sdio_pwrseq: sdio-pwrseq { -+ compatible = "mmc-pwrseq-simple"; -+ clocks = <&rk809 1>; -+ clock-names = "ext_clock"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&wifi_reg_on_h>; -+ post-power-on-delay-ms = <100>; -+ power-off-delay-us = <5000000>; -+ reset-gpios = <&gpio0 RK_PC0 GPIO_ACTIVE_LOW>; -+ }; -+ -+ vcc5v_dcin: vcc5v-dcin-regulator { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc5v_dcin"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ }; -+ -+ vcc3v3_pcie: vcc3v3-pcie-regulator { -+ compatible = "regulator-fixed"; -+ enable-active-high; -+ gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pcie_pwr_en>; -+ regulator-name = "vcc3v3_pcie"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ vin-supply = <&vcc3v3_sys>; -+ }; -+ -+ vcc3v3_sys: vcc3v3-sys-regulator { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc3v3_sys"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ vin-supply = <&vcc5v0_sys>; -+ }; -+ -+ vcc5v0_sys: vcc5v0-sys-regulator { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc5v0_sys"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ vin-supply = <&vcc5v_dcin>; -+ }; -+ -+ vcc5v0_usb30_host: vcc5v0-usb30-host-regulator { -+ compatible = "regulator-fixed"; -+ enable-active-high; -+ gpio = <&gpio0 RK_PC5 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&vcc5v0_usb30_host_en>; -+ regulator-name = "vcc5v0_usb30_host"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ vin-supply = <&vcc5v0_sys>; -+ }; -+ -+ vcc5v0_usb_otg: vcc5v0-usb-otg-regulator { -+ compatible = "regulator-fixed"; -+ enable-active-high; -+ gpio = <&gpio0 RK_PC6 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&vcc5v0_usb_otg_en>; -+ regulator-name = "vcc5v0_usb_otg"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ vin-supply = <&vcc5v0_sys>; -+ }; -+ -+ vcc_cam: vcc-cam-regulator { -+ compatible = "regulator-fixed"; -+ enable-active-high; -+ gpio = <&gpio0 RK_PC4 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&vcc_cam_en>; -+ regulator-name = "vcc_cam"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ vin-supply = <&vcc3v3_sys>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc_mipi: vcc-mipi-regulator { -+ compatible = "regulator-fixed"; -+ enable-active-high; -+ gpio = <&gpio0 RK_PC7 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&vcc_mipi_en>; -+ regulator-name = "vcc_mipi"; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ vin-supply = <&vcc3v3_sys>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+}; -+ -+&combphy1 { -+ status = "okay"; -+}; -+ -+&combphy2 { -+ status = "okay"; -+}; -+ -+&cpu0 { -+ cpu-supply = <&vdd_cpu>; -+}; -+ -+&cpu1 { -+ cpu-supply = <&vdd_cpu>; -+}; -+ -+&cpu2 { -+ cpu-supply = <&vdd_cpu>; -+}; -+ -+&cpu3 { -+ cpu-supply = <&vdd_cpu>; -+}; -+ -+&gmac1 { -+ assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>; -+ assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&gmac1_clkin>; -+ clock_in_out = "input"; -+ phy-handle = <&rgmii_phy1>; -+ phy-mode = "rgmii-id"; -+ phy-supply = <&vcc_3v3>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&gmac1m1_miim -+ &gmac1m1_tx_bus2 -+ &gmac1m1_rx_bus2 -+ &gmac1m1_rgmii_clk -+ &gmac1m1_rgmii_bus -+ &gmac1m1_clkinout>; -+ status = "okay"; -+}; -+ -+&gpu { -+ mali-supply = <&vdd_gpu>; -+ status = "okay"; -+}; -+ -+&hdmi { -+ avdd-0v9-supply = <&vdda0v9_image>; -+ avdd-1v8-supply = <&vcca1v8_image>; -+ status = "okay"; -+}; -+ -+&hdmi_in { -+ hdmi_in_vp0: endpoint { -+ remote-endpoint = <&vp0_out_hdmi>; -+ }; -+}; -+ -+&hdmi_out { -+ hdmi_out_con: endpoint { -+ remote-endpoint = <&hdmi_con_in>; -+ }; -+}; -+ -+&hdmi_sound { -+ status = "okay"; -+}; -+ -+&i2c0 { -+ status = "okay"; -+ -+ vdd_cpu: regulator@1c { -+ compatible = "tcs,tcs4525"; -+ reg = <0x1c>; -+ fcs,suspend-voltage-selector = <1>; -+ regulator-name = "vdd_cpu"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <800000>; -+ regulator-max-microvolt = <1150000>; -+ regulator-ramp-delay = <2300>; -+ vin-supply = <&vcc5v0_sys>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ rk809: pmic@20 { -+ compatible = "rockchip,rk809"; -+ reg = <0x20>; -+ interrupt-parent = <&gpio0>; -+ interrupts = ; -+ clock-output-names = "rk808-clkout1", "rk808-clkout2"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pmic_int_l>, <&i2s1m0_mclk>; -+ system-power-controller; -+ vcc1-supply = <&vcc3v3_sys>; -+ vcc2-supply = <&vcc3v3_sys>; -+ vcc3-supply = <&vcc3v3_sys>; -+ vcc4-supply = <&vcc3v3_sys>; -+ vcc5-supply = <&vcc3v3_sys>; -+ vcc6-supply = <&vcc3v3_sys>; -+ vcc7-supply = <&vcc3v3_sys>; -+ vcc8-supply = <&vcc3v3_sys>; -+ vcc9-supply = <&vcc3v3_sys>; -+ wakeup-source; -+ #clock-cells = <1>; -+ -+ regulators { -+ vdd_logic: DCDC_REG1 { -+ regulator-name = "vdd_logic"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-initial-mode = <0x2>; -+ regulator-min-microvolt = <500000>; -+ regulator-max-microvolt = <1350000>; -+ regulator-ramp-delay = <6001>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ regulator-suspend-microvolt = <900000>; -+ }; -+ }; -+ -+ vdd_gpu: DCDC_REG2 { -+ regulator-name = "vdd_gpu"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-initial-mode = <0x2>; -+ regulator-min-microvolt = <500000>; -+ regulator-max-microvolt = <1350000>; -+ regulator-ramp-delay = <6001>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ regulator-suspend-microvolt = <900000>; -+ }; -+ }; -+ -+ vcc_ddr: DCDC_REG3 { -+ regulator-name = "vcc_ddr"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-initial-mode = <0x2>; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ }; -+ }; -+ -+ vdd_npu: DCDC_REG4 { -+ regulator-name = "vdd_npu"; -+ regulator-initial-mode = <0x2>; -+ regulator-min-microvolt = <500000>; -+ regulator-max-microvolt = <1350000>; -+ regulator-ramp-delay = <6001>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc_1v8: DCDC_REG5 { -+ regulator-name = "vcc_1v8"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vdda0v9_image: LDO_REG1 { -+ regulator-name = "vdda0v9_image"; -+ regulator-min-microvolt = <900000>; -+ regulator-max-microvolt = <900000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vdda_0v9: LDO_REG2 { -+ regulator-name = "vdda_0v9"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <900000>; -+ regulator-max-microvolt = <900000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vdda0v9_pmu: LDO_REG3 { -+ regulator-name = "vdda0v9_pmu"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <900000>; -+ regulator-max-microvolt = <900000>; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <900000>; -+ }; -+ }; -+ -+ vccio_acodec: LDO_REG4 { -+ regulator-name = "vccio_acodec"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vccio_sd: LDO_REG5 { -+ regulator-name = "vccio_sd"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <3300000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc3v3_pmu: LDO_REG6 { -+ regulator-name = "vcc3v3_pmu"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <3300000>; -+ }; -+ }; -+ -+ vcca_1v8: LDO_REG7 { -+ regulator-name = "vcca_1v8"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcca1v8_pmu: LDO_REG8 { -+ regulator-name = "vcca1v8_pmu"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <1800000>; -+ }; -+ }; -+ -+ vcca1v8_image: LDO_REG9 { -+ regulator-name = "vcca1v8_image"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc_3v3: SWITCH_REG1 { -+ regulator-name = "vcc_3v3"; -+ regulator-always-on; -+ regulator-boot-on; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc3v3_sd: SWITCH_REG2 { -+ regulator-name = "vcc3v3_sd"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ }; -+ }; -+ -+ eeprom: eeprom@50 { -+ compatible = "belling,bl24c16a", "atmel,24c16"; -+ reg = <0x50>; -+ pagesize = <16>; -+ }; -+}; -+ -+&i2s0_8ch { -+ status = "okay"; -+}; -+ -+&i2s1_8ch { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s1m0_sclktx &i2s1m0_lrcktx &i2s1m0_sdi0 &i2s1m0_sdo0>; -+ rockchip,trcm-sync-tx-only; -+ status = "okay"; -+}; -+ -+&mdio1 { -+ rgmii_phy1: ethernet-phy@1 { -+ compatible = "ethernet-phy-ieee802.3-c22"; -+ reg = <0x1>; -+ reset-assert-us = <20000>; -+ reset-deassert-us = <100000>; -+ reset-gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; -+ }; -+}; -+ -+&pcie2x1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pcie_reset_h>; -+ reset-gpios = <&gpio1 RK_PB2 GPIO_ACTIVE_HIGH>; -+ vpcie3v3-supply = <&vcc3v3_pcie>; -+ status = "okay"; -+}; -+ -+&pinctrl { -+ bluetooth { -+ bt_reg_on_h: bt-reg-on-h { -+ rockchip,pins = <0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ -+ bt_wake_host_h: bt-wake-host-h { -+ rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ -+ bt_host_wake_h: bt-host-wake-h { -+ rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ cam { -+ vcc_cam_en: vcc_cam_en { -+ rockchip,pins = <0 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ display { -+ vcc_mipi_en: vcc_mipi_en { -+ rockchip,pins = <0 RK_PC7 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ leds { -+ user_led2: user-led2 { -+ rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ pcie { -+ pcie_pwr_en: pcie-pwr-en { -+ rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ -+ pcie_reset_h: pcie-reset-h { -+ rockchip,pins = <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ pmic { -+ pmic_int_l: pmic-int-l { -+ rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+ -+ usb { -+ vcc5v0_usb30_host_en: vcc5v0-usb30-host-en { -+ rockchip,pins = <0 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ -+ vcc5v0_usb_otg_en: vcc5v0-usb-otg-en { -+ rockchip,pins = <0 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ wifi { -+ wifi_host_wake_h: wifi-host-wake-h { -+ rockchip,pins = <0 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ -+ wifi_reg_on_h: wifi-reg-on-h { -+ rockchip,pins = <0 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+}; -+ -+&pmu_io_domains { -+ pmuio1-supply = <&vcc3v3_pmu>; -+ pmuio2-supply = <&vcca1v8_pmu>; -+ vccio1-supply = <&vccio_acodec>; -+ vccio2-supply = <&vcc_1v8>; -+ vccio3-supply = <&vccio_sd>; -+ vccio4-supply = <&vcca1v8_pmu>; -+ vccio5-supply = <&vcc_3v3>; -+ vccio6-supply = <&vcc_3v3>; -+ vccio7-supply = <&vcc_3v3>; -+ status = "okay"; -+}; -+ -+&saradc { -+ vref-supply = <&vcca_1v8>; -+ status = "okay"; -+}; -+ -+&sdhci { -+ bus-width = <8>; -+ max-frequency = <200000000>; -+ mmc-hs200-1_8v; -+ non-removable; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>; -+ vmmc-supply = <&vcc_3v3>; -+ vqmmc-supply = <&vcc_1v8>; -+ status = "okay"; -+}; -+ -+&sdmmc0 { -+ bus-width = <4>; -+ cap-sd-highspeed; -+ disable-wp; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>; -+ sd-uhs-sdr50; -+ vmmc-supply = <&vcc3v3_sys>; -+ vqmmc-supply = <&vccio_sd>; -+ status = "okay"; -+}; -+ -+&sdmmc1 { -+ bus-width = <4>; -+ cap-sd-highspeed; -+ cap-sdio-irq; -+ keep-power-in-suspend; -+ mmc-pwrseq = <&sdio_pwrseq>; -+ non-removable; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_clk &sdmmc1_cmd>; -+ sd-uhs-sdr104; -+ vmmc-supply = <&vcc3v3_sys>; -+ vqmmc-supply = <&vcca1v8_pmu>; -+ status = "okay"; -+}; -+ -+&sfc { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ flash@0 { -+ compatible = "jedec,spi-nor"; -+ reg = <0x0>; -+ spi-max-frequency = <104000000>; -+ spi-rx-bus-width = <4>; -+ spi-tx-bus-width = <1>; -+ }; -+}; -+ -+&tsadc { -+ rockchip,hw-tshut-mode = <1>; -+ rockchip,hw-tshut-polarity = <0>; -+ status = "okay"; -+}; -+ -+&uart1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart1m0_ctsn &uart1m0_rtsn &uart1m0_xfer>; -+ status = "okay"; -+}; -+ -+&uart2 { -+ status = "okay"; -+}; -+ -+&usb_host0_ehci { -+ status = "okay"; -+}; -+ -+&usb_host0_ohci { -+ status = "okay"; -+}; -+ -+&usb_host0_xhci { -+ dr_mode = "host"; -+ status = "okay"; -+}; -+ -+&usb_host1_ehci { -+ status = "okay"; -+}; -+ -+&usb_host1_ohci { -+ status = "okay"; -+}; -+ -+&usb_host1_xhci { -+ status = "okay"; -+}; -+ -+&usb2phy0 { -+ status = "okay"; -+}; -+ -+&usb2phy0_host { -+ phy-supply = <&vcc5v0_usb30_host>; -+ status = "okay"; -+}; -+ -+&usb2phy0_otg { -+ phy-supply = <&vcc5v0_usb_otg>; -+ status = "okay"; -+}; -+ -+&usb2phy1 { -+ status = "okay"; -+}; -+ -+&usb2phy1_host { -+ phy-supply = <&vcc5v0_usb30_host>; -+ status = "okay"; -+}; -+ -+&usb2phy1_otg { -+ phy-supply = <&vcc5v0_usb30_host>; -+ status = "okay"; -+}; -+ -+&vop { -+ assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>; -+ assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>; -+ status = "okay"; -+}; -+ -+&vop_mmu { -+ status = "okay"; -+}; -+ -+&vp0 { -+ vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { -+ reg = ; -+ remote-endpoint = <&hdmi_in_vp0>; -+ }; -+}; ---- /dev/null -+++ b/dts/upstream/src/arm64/rockchip/rk3566-radxa-zero-3.dtsi -@@ -0,0 +1,531 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+ -+#include -+#include -+#include -+#include "rk3566.dtsi" -+ -+/ { -+ chosen { -+ stdout-path = "serial2:1500000n8"; -+ }; -+ -+ hdmi-con { -+ compatible = "hdmi-connector"; -+ type = "d"; -+ -+ port { -+ hdmi_con_in: endpoint { -+ remote-endpoint = <&hdmi_out_con>; -+ }; -+ }; -+ }; -+ -+ leds { -+ compatible = "gpio-leds"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&user_led2>; -+ -+ led-green { -+ color = ; -+ default-state = "on"; -+ function = LED_FUNCTION_HEARTBEAT; -+ gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>; -+ linux,default-trigger = "heartbeat"; -+ }; -+ }; -+ -+ vcc_1v8: regulator-1v8-vcc { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc_1v8"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ vin-supply = <&vcc_1v8_p>; -+ }; -+ -+ vcca_1v8: regulator-1v8-vcca { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcca_1v8"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ vin-supply = <&vcc_1v8_p>; -+ }; -+ -+ vcca1v8_image: regulator-1v8-vcca-image { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcca1v8_image"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ vin-supply = <&vcc_1v8_p>; -+ }; -+ -+ vcc_3v3: regulator-3v3-vcc { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc_3v3"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ vin-supply = <&vcc3v3_sys>; -+ }; -+ -+ vcc_sys: regulator-5v0-vcc-sys { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc_sys"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ }; -+}; -+ -+&combphy1 { -+ status = "okay"; -+}; -+ -+&cpu0 { -+ cpu-supply = <&vdd_cpu>; -+}; -+ -+&cpu1 { -+ cpu-supply = <&vdd_cpu>; -+}; -+ -+&cpu2 { -+ cpu-supply = <&vdd_cpu>; -+}; -+ -+&cpu3 { -+ cpu-supply = <&vdd_cpu>; -+}; -+ -+&gpio0 { -+ gpio-line-names = -+ /* GPIO0_A0 - A7 */ -+ "", "", "", "", "", "", "", "", -+ /* GPIO0_B0 - B7 */ -+ "", "", "", "", "", "", "", "", -+ /* GPIO0_C0 - C7 */ -+ "", "", "", "", "", "", "", "", -+ /* GPIO0_D0 - D7 */ -+ "pin-10 [GPIO0_D0]", "pin-08 [GPIO0_D1]", "", -+ "", "", "", "", ""; -+}; -+ -+&gpio1 { -+ gpio-line-names = -+ /* GPIO1_A0 - A7 */ -+ "pin-03 [GPIO1_A0]", "pin-05 [GPIO1_A1]", "", -+ "", "pin-37 [GPIO1_A4]", "", -+ "", "", -+ /* GPIO1_B0 - B7 */ -+ "", "", "", "", "", "", "", "", -+ /* GPIO1_C0 - C7 */ -+ "", "", "", "", "", "", "", "", -+ /* GPIO1_D0 - D7 */ -+ "", "", "", "", "", "", "", ""; -+}; -+ -+&gpio2 { -+ gpio-line-names = -+ /* GPIO2_A0 - A7 */ -+ "", "", "", "", "", "", "", "", -+ /* GPIO2_B0 - B7 */ -+ "", "", "", "", "", "", "", "", -+ /* GPIO2_C0 - C7 */ -+ "", "", "", "", "", "", "", "", -+ /* GPIO2_D0 - D7 */ -+ "", "", "", "", "", "", "", ""; -+}; -+ -+&gpio3 { -+ gpio-line-names = -+ /* GPIO3_A0 - A7 */ -+ "", "pin-11 [GPIO3_A1]", "pin-13 [GPIO3_A2]", -+ "pin-12 [GPIO3_A3]", "pin-35 [GPIO3_A4]", "pin-40 [GPIO3_A5]", -+ "pin-38 [GPIO3_A6]", "pin-36 [GPIO3_A7]", -+ /* GPIO3_B0 - B7 */ -+ "pin-15 [GPIO3_B0]", "pin-16 [GPIO3_B1]", "pin-18 [GPIO3_B2]", -+ "pin-29 [GPIO3_B3]", "pin-31 [GPIO3_B4]", "", -+ "", "", -+ /* GPIO3_C0 - C7 */ -+ "", "pin-22 [GPIO3_C1]", "pin-32 [GPIO3_C2]", -+ "pin-33 [GPIO3_C3]", "pin-07 [GPIO3_C4]", "", -+ "", "", -+ /* GPIO3_D0 - D7 */ -+ "", "", "", "", "", "", "", ""; -+}; -+ -+&gpio4 { -+ gpio-line-names = -+ /* GPIO4_A0 - A7 */ -+ "", "", "", "", "", "", "", "", -+ /* GPIO4_B0 - B7 */ -+ "", "", "pin-27 [GPIO4_B2]", -+ "pin-28 [GPIO4_B3]", "", "", "", "", -+ /* GPIO4_C0 - C7 */ -+ "", "", "pin-23 [GPIO4_C2]", -+ "pin-19 [GPIO4_C3]", "", "pin-21 [GPIO4_C5]", -+ "pin-24 [GPIO4_C6]", "", -+ /* GPIO4_D0 - D7 */ -+ "", "", "", "", "", "", "", ""; -+}; -+ -+&gpu { -+ mali-supply = <&vdd_gpu_npu>; -+ status = "okay"; -+}; -+ -+&hdmi { -+ avdd-0v9-supply = <&vdda_0v9>; -+ avdd-1v8-supply = <&vcca1v8_image>; -+ status = "okay"; -+}; -+ -+&hdmi_in { -+ hdmi_in_vp0: endpoint { -+ remote-endpoint = <&vp0_out_hdmi>; -+ }; -+}; -+ -+&hdmi_out { -+ hdmi_out_con: endpoint { -+ remote-endpoint = <&hdmi_con_in>; -+ }; -+}; -+ -+&hdmi_sound { -+ status = "okay"; -+}; -+ -+&i2c0 { -+ status = "okay"; -+ -+ rk817: pmic@20 { -+ compatible = "rockchip,rk817"; -+ reg = <0x20>; -+ #clock-cells = <1>; -+ clock-output-names = "rk817-clkout1", "rk817-clkout2"; -+ interrupt-parent = <&gpio0>; -+ interrupts = ; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pmic_int_l>; -+ system-power-controller; -+ wakeup-source; -+ -+ vcc1-supply = <&vcc_sys>; -+ vcc2-supply = <&vcc_sys>; -+ vcc3-supply = <&vcc_sys>; -+ vcc4-supply = <&vcc_sys>; -+ vcc5-supply = <&vcc_sys>; -+ vcc6-supply = <&vcc_sys>; -+ vcc7-supply = <&vcc_sys>; -+ vcc8-supply = <&vcc_sys>; -+ vcc9-supply = <&vcc5v_midu>; -+ -+ regulators { -+ vdd_logic: DCDC_REG1 { -+ regulator-name = "vdd_logic"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-initial-mode = <0x2>; -+ regulator-min-microvolt = <500000>; -+ regulator-max-microvolt = <1350000>; -+ regulator-ramp-delay = <6001>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ regulator-suspend-microvolt = <900000>; -+ }; -+ }; -+ -+ vdd_gpu_npu: DCDC_REG2 { -+ regulator-name = "vdd_gpu_npu"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-initial-mode = <0x2>; -+ regulator-min-microvolt = <500000>; -+ regulator-max-microvolt = <1350000>; -+ regulator-ramp-delay = <6001>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc_ddr: DCDC_REG3 { -+ regulator-name = "vcc_ddr"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-initial-mode = <0x2>; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ }; -+ }; -+ -+ vcc3v3_sys: DCDC_REG4 { -+ regulator-name = "vcc3v3_sys"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-initial-mode = <0x2>; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <3300000>; -+ }; -+ }; -+ -+ vcca1v8_pmu: LDO_REG1 { -+ regulator-name = "vcca1v8_pmu"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <1800000>; -+ }; -+ }; -+ -+ vdda_0v9: LDO_REG2 { -+ regulator-name = "vdda_0v9"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <900000>; -+ regulator-max-microvolt = <900000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vdda0v9_pmu: LDO_REG3 { -+ regulator-name = "vdda0v9_pmu"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <900000>; -+ regulator-max-microvolt = <900000>; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <900000>; -+ }; -+ }; -+ -+ vccio_acodec: LDO_REG4 { -+ regulator-name = "vccio_acodec"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vccio_sd: LDO_REG5 { -+ regulator-name = "vccio_sd"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <3300000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc3v3_pmu: LDO_REG6 { -+ regulator-name = "vcc3v3_pmu"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <3300000>; -+ }; -+ }; -+ -+ vcc_1v8_p: LDO_REG7 { -+ regulator-name = "vcc_1v8_p"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc1v8_dvp: LDO_REG8 { -+ regulator-name = "vcc1v8_dvp"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc2v8_dvp: LDO_REG9 { -+ regulator-name = "vcc2v8_dvp"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <2800000>; -+ regulator-max-microvolt = <2800000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc5v_midu: BOOST { -+ regulator-name = "vcc5v_midu"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vbus: OTG_SWITCH { -+ regulator-name = "vbus"; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ }; -+ }; -+ -+ vdd_cpu: regulator@40 { -+ compatible = "rockchip,rk8600"; -+ reg = <0x40>; -+ fcs,suspend-voltage-selector = <1>; -+ regulator-name = "vdd_cpu"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <712500>; -+ regulator-max-microvolt = <1390000>; -+ regulator-ramp-delay = <2300>; -+ vin-supply = <&vcc_sys>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+}; -+ -+&i2s0_8ch { -+ status = "okay"; -+}; -+ -+&pinctrl { -+ leds { -+ user_led2: user-led2 { -+ rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ pmic { -+ pmic_int_l: pmic-int-l { -+ rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+}; -+ -+&pmu_io_domains { -+ pmuio1-supply = <&vcc3v3_pmu>; -+ pmuio2-supply = <&vcca1v8_pmu>; -+ vccio1-supply = <&vccio_acodec>; -+ vccio2-supply = <&vcc_1v8>; -+ vccio3-supply = <&vccio_sd>; -+ vccio4-supply = <&vcc_1v8>; -+ vccio5-supply = <&vcc_3v3>; -+ vccio6-supply = <&vcc_3v3>; -+ vccio7-supply = <&vcc_3v3>; -+ status = "okay"; -+}; -+ -+&saradc { -+ vref-supply = <&vcca_1v8>; -+ status = "okay"; -+}; -+ -+&sdmmc0 { -+ bus-width = <4>; -+ cap-sd-highspeed; -+ disable-wp; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>; -+ vmmc-supply = <&vcc3v3_sys>; -+ vqmmc-supply = <&vccio_sd>; -+ status = "okay"; -+}; -+ -+&tsadc { -+ rockchip,hw-tshut-mode = <1>; -+ rockchip,hw-tshut-polarity = <0>; -+ status = "okay"; -+}; -+ -+&uart2 { -+ status = "okay"; -+}; -+ -+&usb_host0_xhci { -+ dr_mode = "peripheral"; -+ status = "okay"; -+}; -+ -+&usb_host1_xhci { -+ status = "okay"; -+}; -+ -+&usb2phy0 { -+ status = "okay"; -+}; -+ -+&usb2phy0_host { -+ status = "okay"; -+}; -+ -+&usb2phy0_otg { -+ status = "okay"; -+}; -+ -+&vop { -+ assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>; -+ assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>; -+ status = "okay"; -+}; -+ -+&vop_mmu { -+ status = "okay"; -+}; -+ -+&vp0 { -+ vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { -+ reg = ; -+ remote-endpoint = <&hdmi_in_vp0>; -+ }; -+}; ---- /dev/null -+++ b/dts/upstream/src/arm64/rockchip/rk3566-radxa-zero-3e.dts -@@ -0,0 +1,52 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+ -+/dts-v1/; -+ -+#include "rk3566-radxa-zero-3.dtsi" -+ -+/ { -+ model = "Radxa ZERO 3E"; -+ compatible = "radxa,zero-3e", "rockchip,rk3566"; -+ -+ aliases { -+ ethernet0 = &gmac1; -+ mmc0 = &sdmmc0; -+ }; -+}; -+ -+&gmac1 { -+ assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>; -+ assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru CLK_MAC1_2TOP>; -+ clock_in_out = "input"; -+ phy-handle = <&rgmii_phy1>; -+ phy-mode = "rgmii-id"; -+ phy-supply = <&vcc_3v3>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&gmac1m1_miim -+ &gmac1m1_tx_bus2 -+ &gmac1m1_rx_bus2 -+ &gmac1m1_rgmii_clk -+ &gmac1m1_rgmii_bus -+ &gmac1m1_clkinout>; -+ status = "okay"; -+}; -+ -+&mdio1 { -+ rgmii_phy1: ethernet-phy@1 { -+ compatible = "ethernet-phy-ieee802.3-c22"; -+ reg = <1>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&gmac1_rstn>; -+ reset-assert-us = <20000>; -+ reset-deassert-us = <50000>; -+ reset-gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; -+ }; -+}; -+ -+&pinctrl { -+ gmac1 { -+ gmac1_rstn: gmac1-rstn { -+ rockchip,pins = <3 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+}; ---- /dev/null -+++ b/dts/upstream/src/arm64/rockchip/rk3566-radxa-zero-3w.dts -@@ -0,0 +1,92 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+ -+/dts-v1/; -+ -+#include "rk3566-radxa-zero-3.dtsi" -+ -+/ { -+ model = "Radxa ZERO 3W"; -+ compatible = "radxa,zero-3w", "rockchip,rk3566"; -+ -+ aliases { -+ mmc0 = &sdhci; -+ mmc1 = &sdmmc0; -+ mmc2 = &sdmmc1; -+ }; -+ -+ sdio_pwrseq: sdio-pwrseq { -+ compatible = "mmc-pwrseq-simple"; -+ clocks = <&rk817 1>; -+ clock-names = "ext_clock"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&wifi_reg_on_h>; -+ post-power-on-delay-ms = <100>; -+ power-off-delay-us = <5000000>; -+ reset-gpios = <&gpio0 RK_PC0 GPIO_ACTIVE_LOW>; -+ }; -+}; -+ -+&pinctrl { -+ bluetooth { -+ bt_reg_on_h: bt-reg-on-h { -+ rockchip,pins = <0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ -+ bt_wake_host_h: bt-wake-host-h { -+ rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ -+ host_wake_bt_h: host-wake-bt-h { -+ rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ wifi { -+ wifi_reg_on_h: wifi-reg-on-h { -+ rockchip,pins = <0 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ -+ wifi_wake_host_h: wifi-wake-host-h { -+ rockchip,pins = <0 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+}; -+ -+&sdhci { -+ bus-width = <8>; -+ cap-mmc-highspeed; -+ max-frequency = <200000000>; -+ mmc-hs200-1_8v; -+ no-sd; -+ no-sdio; -+ non-removable; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>; -+ vmmc-supply = <&vcc_3v3>; -+ vqmmc-supply = <&vcc_1v8>; -+ status = "okay"; -+}; -+ -+&sdmmc1 { -+ bus-width = <4>; -+ cap-sd-highspeed; -+ cap-sdio-irq; -+ keep-power-in-suspend; -+ mmc-pwrseq = <&sdio_pwrseq>; -+ no-mmc; -+ no-sd; -+ non-removable; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_clk &sdmmc1_cmd>; -+ sd-uhs-sdr104; -+ vmmc-supply = <&vcc_3v3>; -+ vqmmc-supply = <&vcc_1v8>; -+ status = "okay"; -+}; -+ -+&uart1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart1m0_xfer &uart1m0_ctsn &uart1m0_rtsn>; -+ uart-has-rtscts; -+ status = "okay"; -+}; ---- /dev/null -+++ b/dts/upstream/src/arm64/rockchip/rk3568-rock-3b.dts -@@ -0,0 +1,781 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+ -+/dts-v1/; -+ -+#include -+#include -+#include -+#include -+#include "rk3568.dtsi" -+ -+/ { -+ model = "Radxa ROCK 3B"; -+ compatible = "radxa,rock-3b", "rockchip,rk3568"; -+ -+ aliases { -+ ethernet0 = &gmac0; -+ ethernet1 = &gmac1; -+ mmc0 = &sdhci; -+ mmc1 = &sdmmc0; -+ mmc2 = &sdmmc2; -+ }; -+ -+ chosen { -+ stdout-path = "serial2:1500000n8"; -+ }; -+ -+ hdmi-con { -+ compatible = "hdmi-connector"; -+ type = "a"; -+ -+ port { -+ hdmi_con_in: endpoint { -+ remote-endpoint = <&hdmi_out_con>; -+ }; -+ }; -+ }; -+ -+ ir-receiver { -+ compatible = "gpio-ir-receiver"; -+ gpios = <&gpio0 RK_PC2 GPIO_ACTIVE_LOW>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pwm3_ir>; -+ }; -+ -+ leds { -+ compatible = "gpio-leds"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&led>; -+ -+ led-0 { -+ color = ; -+ default-state = "on"; -+ function = LED_FUNCTION_HEARTBEAT; -+ gpios = <&gpio0 RK_PB7 GPIO_ACTIVE_HIGH>; -+ linux,default-trigger = "heartbeat"; -+ }; -+ }; -+ -+ /* pi6c pcie clock generator */ -+ vcc3v3_pi6c_03: regulator-3v3-vcc-pi6c-03 { -+ compatible = "regulator-fixed"; -+ enable-active-high; -+ gpios = <&gpio0 RK_PD4 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pcie_pwren_h>; -+ regulator-name = "vcc3v3_pi6c_03"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ startup-delay-us = <10000>; -+ vin-supply = <&vcc5v0_sys>; -+ }; -+ -+ vcc3v3_sys: regulator-3v3-vcc-sys { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc3v3_sys"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ vin-supply = <&vcc5v0_sys>; -+ }; -+ -+ vcc3v3_sys2: regulator-3v3-vcc-sys2 { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc3v3_sys2"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ vin-supply = <&vcc5v0_sys>; -+ }; -+ -+ vcc5v0_sys: regulator-5v0-vcc-sys { -+ compatible = "regulator-fixed"; -+ regulator-name = "vcc5v0_sys"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ }; -+ -+ vcc5v0_usb_host: regulator-5v0-vcc-usb-host { -+ compatible = "regulator-fixed"; -+ enable-active-high; -+ gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&usb_host_pwren_h>; -+ regulator-name = "vcc5v0_usb_host"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ vin-supply = <&vcc5v0_sys>; -+ }; -+ -+ vcc5v0_usb_otg: regulator-5v0-vcc-usb-otg { -+ compatible = "regulator-fixed"; -+ enable-active-high; -+ gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&usb_otg_pwren_h>; -+ regulator-name = "vcc5v0_usb_otg"; -+ regulator-min-microvolt = <5000000>; -+ regulator-max-microvolt = <5000000>; -+ vin-supply = <&vcc5v0_sys>; -+ }; -+ -+ sdio_pwrseq: sdio-pwrseq { -+ compatible = "mmc-pwrseq-simple"; -+ clocks = <&rk809 1>; -+ clock-names = "ext_clock"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&wifi_reg_on_h>; -+ post-power-on-delay-ms = <100>; -+ power-off-delay-us = <5000000>; -+ reset-gpios = <&gpio3 RK_PD4 GPIO_ACTIVE_LOW>; -+ }; -+ -+ sound { -+ compatible = "simple-audio-card"; -+ simple-audio-card,format = "i2s"; -+ simple-audio-card,name = "Analog RK809"; -+ simple-audio-card,mclk-fs = <256>; -+ -+ simple-audio-card,cpu { -+ sound-dai = <&i2s1_8ch>; -+ }; -+ -+ simple-audio-card,codec { -+ sound-dai = <&rk809>; -+ }; -+ }; -+}; -+ -+&combphy0 { -+ status = "okay"; -+}; -+ -+&combphy1 { -+ status = "okay"; -+}; -+ -+&combphy2 { -+ status = "okay"; -+}; -+ -+&cpu0 { -+ cpu-supply = <&vdd_cpu>; -+}; -+ -+&cpu1 { -+ cpu-supply = <&vdd_cpu>; -+}; -+ -+&cpu2 { -+ cpu-supply = <&vdd_cpu>; -+}; -+ -+&cpu3 { -+ cpu-supply = <&vdd_cpu>; -+}; -+ -+&gmac0 { -+ assigned-clocks = <&cru SCLK_GMAC0_RX_TX>, <&cru SCLK_GMAC0>; -+ assigned-clock-parents = <&cru SCLK_GMAC0_RGMII_SPEED>, <&cru CLK_MAC0_2TOP>; -+ clock_in_out = "input"; -+ phy-handle = <&rgmii_phy0>; -+ phy-mode = "rgmii-id"; -+ phy-supply = <&vcc_3v3>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&gmac0_miim -+ &gmac0_tx_bus2 -+ &gmac0_rx_bus2 -+ &gmac0_rgmii_clk -+ &gmac0_rgmii_bus -+ &gmac0_clkinout>; -+ status = "okay"; -+}; -+ -+&gmac1 { -+ assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>; -+ assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru CLK_MAC1_2TOP>; -+ clock_in_out = "input"; -+ phy-handle = <&rgmii_phy1>; -+ phy-mode = "rgmii-id"; -+ phy-supply = <&vcc_3v3>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&gmac1m1_miim -+ &gmac1m1_tx_bus2 -+ &gmac1m1_rx_bus2 -+ &gmac1m1_rgmii_clk -+ &gmac1m1_rgmii_bus -+ &gmac1m1_clkinout>; -+ status = "okay"; -+}; -+ -+&gpu { -+ mali-supply = <&vdd_gpu>; -+ status = "okay"; -+}; -+ -+&hdmi { -+ avdd-0v9-supply = <&vdda0v9_image>; -+ avdd-1v8-supply = <&vcca1v8_image>; -+ status = "okay"; -+}; -+ -+&hdmi_in { -+ hdmi_in_vp0: endpoint { -+ remote-endpoint = <&vp0_out_hdmi>; -+ }; -+}; -+ -+&hdmi_out { -+ hdmi_out_con: endpoint { -+ remote-endpoint = <&hdmi_con_in>; -+ }; -+}; -+ -+&hdmi_sound { -+ status = "okay"; -+}; -+ -+&i2c0 { -+ status = "okay"; -+ -+ vdd_cpu: regulator@1c { -+ compatible = "tcs,tcs4525"; -+ reg = <0x1c>; -+ fcs,suspend-voltage-selector = <1>; -+ regulator-name = "vdd_cpu"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <800000>; -+ regulator-max-microvolt = <1150000>; -+ regulator-ramp-delay = <2300>; -+ vin-supply = <&vcc5v0_sys>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ rk809: pmic@20 { -+ compatible = "rockchip,rk809"; -+ reg = <0x20>; -+ assigned-clocks = <&cru I2S1_MCLKOUT_TX>; -+ assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>; -+ #clock-cells = <1>; -+ clocks = <&cru I2S1_MCLKOUT_TX>; -+ clock-names = "mclk"; -+ clock-output-names = "rk809-clkout1", "rk809-clkout2"; -+ interrupt-parent = <&gpio0>; -+ interrupts = ; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pmic_int_l>, <&i2s1m0_mclk>; -+ #sound-dai-cells = <0>; -+ system-power-controller; -+ wakeup-source; -+ -+ vcc1-supply = <&vcc3v3_sys>; -+ vcc2-supply = <&vcc3v3_sys>; -+ vcc3-supply = <&vcc3v3_sys>; -+ vcc4-supply = <&vcc3v3_sys>; -+ vcc5-supply = <&vcc3v3_sys>; -+ vcc6-supply = <&vcc3v3_sys>; -+ vcc7-supply = <&vcc3v3_sys>; -+ vcc8-supply = <&vcc3v3_sys>; -+ vcc9-supply = <&vcc3v3_sys>; -+ -+ regulators { -+ vdd_logic: DCDC_REG1 { -+ regulator-name = "vdd_logic"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-initial-mode = <0x2>; -+ regulator-min-microvolt = <500000>; -+ regulator-max-microvolt = <1350000>; -+ regulator-ramp-delay = <6001>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vdd_gpu: DCDC_REG2 { -+ regulator-name = "vdd_gpu"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-initial-mode = <0x2>; -+ regulator-min-microvolt = <500000>; -+ regulator-max-microvolt = <1350000>; -+ regulator-ramp-delay = <6001>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc_ddr: DCDC_REG3 { -+ regulator-name = "vcc_ddr"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-initial-mode = <0x2>; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ }; -+ }; -+ -+ vdd_npu: DCDC_REG4 { -+ regulator-name = "vdd_npu"; -+ regulator-initial-mode = <0x2>; -+ regulator-min-microvolt = <500000>; -+ regulator-max-microvolt = <1350000>; -+ regulator-ramp-delay = <6001>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc_1v8: DCDC_REG5 { -+ regulator-name = "vcc_1v8"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vdda0v9_image: LDO_REG1 { -+ regulator-name = "vdda0v9_image"; -+ regulator-min-microvolt = <900000>; -+ regulator-max-microvolt = <900000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vdda_0v9: LDO_REG2 { -+ regulator-name = "vdda_0v9"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <900000>; -+ regulator-max-microvolt = <900000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vdda0v9_pmu: LDO_REG3 { -+ regulator-name = "vdda0v9_pmu"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <900000>; -+ regulator-max-microvolt = <900000>; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <900000>; -+ }; -+ }; -+ -+ vccio_acodec: LDO_REG4 { -+ regulator-name = "vccio_acodec"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vccio_sd: LDO_REG5 { -+ regulator-name = "vccio_sd"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <3300000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc3v3_pmu: LDO_REG6 { -+ regulator-name = "vcc3v3_pmu"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <3300000>; -+ regulator-max-microvolt = <3300000>; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <3300000>; -+ }; -+ }; -+ -+ vcca_1v8: LDO_REG7 { -+ regulator-name = "vcca_1v8"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcca1v8_pmu: LDO_REG8 { -+ regulator-name = "vcca1v8_pmu"; -+ regulator-always-on; -+ regulator-boot-on; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ -+ regulator-state-mem { -+ regulator-on-in-suspend; -+ regulator-suspend-microvolt = <1800000>; -+ }; -+ }; -+ -+ vcca1v8_image: LDO_REG9 { -+ regulator-name = "vcca1v8_image"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc_3v3: SWITCH_REG1 { -+ regulator-name = "vcc_3v3"; -+ regulator-always-on; -+ regulator-boot-on; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ -+ vcc3v3_sd: SWITCH_REG2 { -+ regulator-name = "vcc3v3_sd"; -+ regulator-always-on; -+ regulator-boot-on; -+ -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; -+ }; -+ }; -+ }; -+}; -+ -+&i2c5 { -+ status = "okay"; -+ -+ hym8563: rtc@51 { -+ compatible = "haoyu,hym8563"; -+ reg = <0x51>; -+ interrupt-parent = <&gpio0>; -+ interrupts = ; -+ #clock-cells = <0>; -+ clock-output-names = "rtcic_32kout"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&rtcic_int_l>; -+ wakeup-source; -+ }; -+}; -+ -+&i2s0_8ch { -+ status = "okay"; -+}; -+ -+&i2s1_8ch { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2s1m0_sclktx -+ &i2s1m0_lrcktx -+ &i2s1m0_sdi0 -+ &i2s1m0_sdo0>; -+ rockchip,trcm-sync-tx-only; -+ status = "okay"; -+}; -+ -+&mdio0 { -+ rgmii_phy0: ethernet-phy@1 { -+ compatible = "ethernet-phy-ieee802.3-c22"; -+ reg = <1>; -+ reset-assert-us = <20000>; -+ reset-deassert-us = <50000>; -+ reset-gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; -+ }; -+}; -+ -+&mdio1 { -+ rgmii_phy1: ethernet-phy@1 { -+ compatible = "ethernet-phy-ieee802.3-c22"; -+ reg = <1>; -+ reset-assert-us = <20000>; -+ reset-deassert-us = <50000>; -+ reset-gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>; -+ }; -+}; -+ -+&pcie2x1 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pcie20m1_pins>; -+ reset-gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_HIGH>; -+ vpcie3v3-supply = <&vcc3v3_sys2>; -+ status = "okay"; -+}; -+ -+&pcie30phy { -+ status = "okay"; -+}; -+ -+&pcie3x2 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pcie30x2m1_pins>; -+ reset-gpios = <&gpio2 RK_PD6 GPIO_ACTIVE_HIGH>; -+ status = "okay"; -+}; -+ -+&pinctrl { -+ bluetooth { -+ bt_reg_on_h: bt-reg-on-h { -+ rockchip,pins = <4 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ -+ bt_wake_host_h: bt-wake-host-h { -+ rockchip,pins = <4 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ -+ host_wake_bt_h: host-wake-bt-h { -+ rockchip,pins = <4 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ ir-receiver { -+ pwm3_ir: pwm3-ir { -+ rockchip,pins = <0 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ leds { -+ led: led { -+ rockchip,pins = <0 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ pcie { -+ pcie_pwren_h: pcie-pwren-h { -+ rockchip,pins = <0 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ pcie20 { -+ pcie20m1_pins: pcie20m1-pins { -+ rockchip,pins = -+ <2 RK_PD0 4 &pcfg_pull_none>, -+ <3 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>, -+ <2 RK_PD1 4 &pcfg_pull_none>; -+ }; -+ }; -+ -+ pcie30x2 { -+ pcie30x2m1_pins: pcie30x2m1-pins { -+ rockchip,pins = -+ <2 RK_PD4 4 &pcfg_pull_none>, -+ <2 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>, -+ <2 RK_PD5 4 &pcfg_pull_none>; -+ }; -+ }; -+ -+ pmic { -+ pmic_int_l: pmic-int-l { -+ rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+ -+ rtc { -+ rtcic_int_l: rtcic-int-l { -+ rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up>; -+ }; -+ }; -+ -+ usb { -+ usb_host_pwren_h: usb-host-pwren-h { -+ rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ -+ usb_otg_pwren_h: usb-otg-pwren-h { -+ rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+ -+ wifi { -+ wifi_reg_on_h: wifi-reg-on-h { -+ rockchip,pins = <3 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ -+ wifi_wake_host_h: wifi-wake-host-h { -+ rockchip,pins = <3 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>; -+ }; -+ }; -+}; -+ -+&pmu_io_domains { -+ pmuio1-supply = <&vcc3v3_pmu>; -+ pmuio2-supply = <&vcc3v3_pmu>; -+ vccio1-supply = <&vccio_acodec>; -+ vccio2-supply = <&vcc_1v8>; -+ vccio3-supply = <&vccio_sd>; -+ vccio4-supply = <&vcc_1v8>; -+ vccio5-supply = <&vcc_3v3>; -+ vccio6-supply = <&vcc_1v8>; -+ vccio7-supply = <&vcc_3v3>; -+ status = "okay"; -+}; -+ -+&saradc { -+ vref-supply = <&vcca_1v8>; -+ status = "okay"; -+}; -+ -+&sdhci { -+ bus-width = <8>; -+ cap-mmc-highspeed; -+ max-frequency = <200000000>; -+ mmc-hs200-1_8v; -+ non-removable; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>; -+ vmmc-supply = <&vcc_3v3>; -+ vqmmc-supply = <&vcc_1v8>; -+ status = "okay"; -+}; -+ -+&sdmmc0 { -+ bus-width = <4>; -+ cap-sd-highspeed; -+ disable-wp; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>; -+ vmmc-supply = <&vcc3v3_sd>; -+ vqmmc-supply = <&vccio_sd>; -+ status = "okay"; -+}; -+ -+&sdmmc2 { -+ bus-width = <4>; -+ cap-sd-highspeed; -+ cap-sdio-irq; -+ keep-power-in-suspend; -+ mmc-pwrseq = <&sdio_pwrseq>; -+ non-removable; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&sdmmc2m0_bus4 &sdmmc2m0_clk &sdmmc2m0_cmd>; -+ sd-uhs-sdr104; -+ vmmc-supply = <&vcc3v3_sys2>; -+ vqmmc-supply = <&vcc_1v8>; -+ status = "disabled"; -+}; -+ -+&sfc { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ flash@0 { -+ compatible = "jedec,spi-nor"; -+ reg = <0>; -+ spi-max-frequency = <104000000>; -+ spi-rx-bus-width = <4>; -+ spi-tx-bus-width = <1>; -+ }; -+}; -+ -+&tsadc { -+ rockchip,hw-tshut-mode = <1>; -+ rockchip,hw-tshut-polarity = <0>; -+ status = "okay"; -+}; -+ -+&uart2 { -+ status = "okay"; -+}; -+ -+&uart8 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&uart8m0_xfer &uart8m0_ctsn &uart8m0_rtsn>; -+ uart-has-rtscts; -+ status = "disabled"; -+}; -+ -+&usb_host0_ehci { -+ status = "okay"; -+}; -+ -+&usb_host0_ohci { -+ status = "okay"; -+}; -+ -+&usb_host0_xhci { -+ extcon = <&usb2phy0>; -+ status = "okay"; -+}; -+ -+&usb_host1_xhci { -+ status = "okay"; -+}; -+ -+&usb2phy0 { -+ status = "okay"; -+}; -+ -+&usb2phy0_host { -+ phy-supply = <&vcc5v0_usb_host>; -+ status = "okay"; -+}; -+ -+&usb2phy0_otg { -+ phy-supply = <&vcc5v0_usb_otg>; -+ status = "okay"; -+}; -+ -+&usb2phy1 { -+ status = "okay"; -+}; -+ -+&usb2phy1_otg { -+ phy-supply = <&vcc5v0_usb_host>; -+ status = "okay"; -+}; -+ -+&vop { -+ assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>; -+ assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>; -+ status = "okay"; -+}; -+ -+&vop_mmu { -+ status = "okay"; -+}; -+ -+&vp0 { -+ vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { -+ reg = ; -+ remote-endpoint = <&hdmi_in_vp0>; -+ }; -+}; diff --git a/package/boot/uboot-rockchip/patches/001-v2024.10-rc3-rockchip-add-support-for-Radxa-ROCK-Pi-E-v3.0.patch b/package/boot/uboot-rockchip/patches/001-v2024.10-rc3-rockchip-add-support-for-Radxa-ROCK-Pi-E-v3.0.patch deleted file mode 100644 index 515e07c3f87..00000000000 --- a/package/boot/uboot-rockchip/patches/001-v2024.10-rc3-rockchip-add-support-for-Radxa-ROCK-Pi-E-v3.0.patch +++ /dev/null @@ -1,248 +0,0 @@ -From 8ca5e0e4d6ed084d2321584e8cdc8105c60b9aa1 Mon Sep 17 00:00:00 2001 -From: FUKAUMI Naoki -Date: Tue, 25 Jun 2024 05:45:29 +0900 -Subject: [PATCH] rockchip: add support for Radxa ROCK Pi E v3.0 - -ROCK Pi E v3.0 uses DDR4 SDRAM instead of DDR3 SDRAM used in v1.2x. - -prepare new rk3328-rock-pi-e-v3.dts in u-boot which just includes -upstream rk3328-rock-pi-e.dts. - -defconfig still uses - CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-rock-pi-e.dtb" - -because v3.0 and prior are compatible. - -Suggested-by: Jonas Karlman -Signed-off-by: FUKAUMI Naoki -Reviewed-by: Kever Yang ---- - ...dtsi => rk3328-rock-pi-e-base-u-boot.dtsi} | 1 - - arch/arm/dts/rk3328-rock-pi-e-u-boot.dtsi | 47 +-------- - arch/arm/dts/rk3328-rock-pi-e-v3-u-boot.dtsi | 4 + - arch/arm/dts/rk3328-rock-pi-e-v3.dts | 4 + - board/rockchip/evb_rk3328/MAINTAINERS | 4 +- - configs/rock-pi-e-v3-rk3328_defconfig | 97 +++++++++++++++++++ - 6 files changed, 111 insertions(+), 46 deletions(-) - copy arch/arm/dts/{rk3328-rock-pi-e-u-boot.dtsi => rk3328-rock-pi-e-base-u-boot.dtsi} (94%) - rewrite arch/arm/dts/rk3328-rock-pi-e-u-boot.dtsi (88%) - create mode 100644 arch/arm/dts/rk3328-rock-pi-e-v3-u-boot.dtsi - create mode 100644 arch/arm/dts/rk3328-rock-pi-e-v3.dts - create mode 100644 configs/rock-pi-e-v3-rk3328_defconfig - ---- a/arch/arm/dts/rk3328-rock-pi-e-u-boot.dtsi -+++ b/arch/arm/dts/rk3328-rock-pi-e-u-boot.dtsi -@@ -1,43 +1,4 @@ - // SPDX-License-Identifier: GPL-2.0+ --/* -- * (C) Copyright 2020 Radxa -- */ - --#include "rk3328-u-boot.dtsi" -+#include "rk3328-rock-pi-e-base-u-boot.dtsi" - #include "rk3328-sdram-ddr3-666.dtsi" -- --/ { -- smbios { -- compatible = "u-boot,sysinfo-smbios"; -- -- smbios { -- system { -- manufacturer = "radxa"; -- product = "rock-pi-e_rk3328"; -- }; -- -- baseboard { -- manufacturer = "radxa"; -- product = "rock-pi-e_rk3328"; -- }; -- -- chassis { -- manufacturer = "radxa"; -- product = "rock-pi-e_rk3328"; -- }; -- }; -- }; --}; -- --&u2phy_host { -- phy-supply = <&vcc_host_5v>; --}; -- --&vcc_host_5v { -- /delete-property/ regulator-always-on; -- /delete-property/ regulator-boot-on; --}; -- --&vcc_sd { -- bootph-pre-ram; --}; ---- /dev/null -+++ b/arch/arm/dts/rk3328-rock-pi-e-base-u-boot.dtsi -@@ -0,0 +1,42 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * (C) Copyright 2020 Radxa -+ */ -+ -+#include "rk3328-u-boot.dtsi" -+ -+/ { -+ smbios { -+ compatible = "u-boot,sysinfo-smbios"; -+ -+ smbios { -+ system { -+ manufacturer = "radxa"; -+ product = "rock-pi-e_rk3328"; -+ }; -+ -+ baseboard { -+ manufacturer = "radxa"; -+ product = "rock-pi-e_rk3328"; -+ }; -+ -+ chassis { -+ manufacturer = "radxa"; -+ product = "rock-pi-e_rk3328"; -+ }; -+ }; -+ }; -+}; -+ -+&u2phy_host { -+ phy-supply = <&vcc_host_5v>; -+}; -+ -+&vcc_host_5v { -+ /delete-property/ regulator-always-on; -+ /delete-property/ regulator-boot-on; -+}; -+ -+&vcc_sd { -+ bootph-pre-ram; -+}; ---- /dev/null -+++ b/arch/arm/dts/rk3328-rock-pi-e-v3-u-boot.dtsi -@@ -0,0 +1,4 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+ -+#include "rk3328-rock-pi-e-base-u-boot.dtsi" -+#include "rk3328-sdram-ddr4-666.dtsi" ---- /dev/null -+++ b/arch/arm/dts/rk3328-rock-pi-e-v3.dts -@@ -0,0 +1,4 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+ -+/dts-v1/; -+#include "rk3328-rock-pi-e.dts" ---- a/board/rockchip/evb_rk3328/MAINTAINERS -+++ b/board/rockchip/evb_rk3328/MAINTAINERS -@@ -64,5 +64,5 @@ M: Banglang Huang - S: Maintained - F: configs/rock-pi-e-rk3328_defconfig --F: arch/arm/dts/rk3328-rock-pi-e.dts --F: arch/arm/dts/rk3328-rock-pi-e-u-boot.dtsi -+F: configs/rock-pi-e-v3-rk3328_defconfig -+F: arch/arm/dts/rk3328-rock-pi-e* ---- /dev/null -+++ b/configs/rock-pi-e-v3-rk3328_defconfig -@@ -0,0 +1,97 @@ -+CONFIG_ARM=y -+CONFIG_SKIP_LOWLEVEL_INIT=y -+CONFIG_COUNTER_FREQUENCY=24000000 -+CONFIG_ARCH_ROCKCHIP=y -+CONFIG_SPL_GPIO=y -+CONFIG_NR_DRAM_BANKS=1 -+CONFIG_SF_DEFAULT_SPEED=20000000 -+CONFIG_ENV_OFFSET=0x3F8000 -+CONFIG_DEFAULT_DEVICE_TREE="rk3328-rock-pi-e-v3" -+CONFIG_DM_RESET=y -+CONFIG_ROCKCHIP_RK3328=y -+CONFIG_DEBUG_UART_BASE=0xFF130000 -+CONFIG_DEBUG_UART_CLOCK=24000000 -+CONFIG_SYS_LOAD_ADDR=0x800800 -+CONFIG_DEBUG_UART=y -+CONFIG_FIT=y -+CONFIG_FIT_VERBOSE=y -+CONFIG_SPL_FIT_SIGNATURE=y -+CONFIG_SPL_LOAD_FIT=y -+CONFIG_LEGACY_IMAGE_FORMAT=y -+CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-rock-pi-e.dtb" -+# CONFIG_DISPLAY_CPUINFO is not set -+CONFIG_DISPLAY_BOARDINFO_LATE=y -+CONFIG_SPL_MAX_SIZE=0x40000 -+CONFIG_SPL_PAD_TO=0x7f8000 -+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set -+CONFIG_SPL_POWER=y -+CONFIG_SPL_ATF=y -+CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y -+CONFIG_CMD_BOOTZ=y -+CONFIG_CMD_GPIO=y -+CONFIG_CMD_GPT=y -+CONFIG_CMD_MMC=y -+CONFIG_CMD_USB=y -+CONFIG_CMD_TIME=y -+CONFIG_CMD_REGULATOR=y -+CONFIG_SPL_OF_CONTROL=y -+CONFIG_TPL_OF_CONTROL=y -+# CONFIG_OF_UPSTREAM is not set -+CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" -+CONFIG_TPL_OF_PLATDATA=y -+CONFIG_ENV_IS_IN_MMC=y -+CONFIG_SYS_RELOC_GD_ENV_ADDR=y -+CONFIG_SYS_MMC_ENV_DEV=1 -+CONFIG_TPL_DM=y -+CONFIG_SPL_DM_SEQ_ALIAS=y -+CONFIG_REGMAP=y -+CONFIG_SPL_REGMAP=y -+CONFIG_TPL_REGMAP=y -+CONFIG_SYSCON=y -+CONFIG_SPL_SYSCON=y -+CONFIG_TPL_SYSCON=y -+CONFIG_CLK=y -+CONFIG_SPL_CLK=y -+CONFIG_ROCKCHIP_GPIO=y -+CONFIG_SYS_I2C_ROCKCHIP=y -+CONFIG_MMC_DW=y -+CONFIG_MMC_DW_ROCKCHIP=y -+CONFIG_PHY_REALTEK=y -+CONFIG_DM_MDIO=y -+CONFIG_DM_ETH_PHY=y -+CONFIG_PHY_GIGE=y -+CONFIG_ETH_DESIGNWARE=y -+CONFIG_GMAC_ROCKCHIP=y -+CONFIG_PHY_ROCKCHIP_INNO_USB2=y -+CONFIG_PINCTRL=y -+CONFIG_SPL_PINCTRL=y -+CONFIG_DM_PMIC=y -+CONFIG_PMIC_RK8XX=y -+CONFIG_SPL_DM_REGULATOR=y -+CONFIG_DM_REGULATOR_FIXED=y -+CONFIG_SPL_DM_REGULATOR_FIXED=y -+CONFIG_REGULATOR_RK8XX=y -+CONFIG_PWM_ROCKCHIP=y -+CONFIG_RAM=y -+CONFIG_SPL_RAM=y -+CONFIG_TPL_RAM=y -+CONFIG_DM_RNG=y -+CONFIG_RNG_ROCKCHIP=y -+CONFIG_BAUDRATE=1500000 -+CONFIG_DEBUG_UART_SHIFT=2 -+CONFIG_SYS_NS16550_MEM32=y -+CONFIG_SYSINFO=y -+CONFIG_SYSINFO_SMBIOS=y -+CONFIG_SYSRESET=y -+# CONFIG_TPL_SYSRESET is not set -+CONFIG_USB=y -+CONFIG_USB_XHCI_HCD=y -+CONFIG_USB_EHCI_HCD=y -+CONFIG_USB_EHCI_GENERIC=y -+CONFIG_USB_OHCI_HCD=y -+CONFIG_USB_OHCI_GENERIC=y -+CONFIG_USB_DWC3=y -+CONFIG_USB_DWC3_GENERIC=y -+CONFIG_SPL_TINY_MEMSET=y -+CONFIG_TPL_TINY_MEMSET=y -+CONFIG_ERRNO_STR=y diff --git a/package/boot/uboot-rockchip/patches/002-v2024.10-rc3-board-rockchip-add-Radxa-ROCK-3-Model-C.patch b/package/boot/uboot-rockchip/patches/002-v2024.10-rc3-board-rockchip-add-Radxa-ROCK-3-Model-C.patch deleted file mode 100644 index 22ced545fee..00000000000 --- a/package/boot/uboot-rockchip/patches/002-v2024.10-rc3-board-rockchip-add-Radxa-ROCK-3-Model-C.patch +++ /dev/null @@ -1,178 +0,0 @@ -From e6e82ce24d4e9d20c232db2a95b2d10faf8f2bcf Mon Sep 17 00:00:00 2001 -From: Maxim Moskalets -Date: Thu, 8 Aug 2024 22:37:10 +0300 -Subject: [PATCH] board: rockchip: add Radxa ROCK 3 Model C - -Based on rock-3a-rk3568_defconfig. -Tested on v1.31 revision. - -Board Specifications: -- Rockchip RK3566 -- 1/2/4GB LPDDR4 2112MT/s -- eMMC socket -- uSD card slot -- M.2 2230 Connector -- GbE LAN with POE -- 3.5mm jack with mic -- HDMI 2.0, MIPI DSI/CSI -- USB 3.0 Host, USB 2.0 Host/OTG -- 40-pin GPIO expansion ports - -Signed-off-by: Maxim Moskalets -Suggested-by: Jonas Karlman -Reviewed-by: Jonas Karlman -Tested-by: FUKAUMI Naoki -Reviewed-by: Kever Yang ---- - arch/arm/dts/rk3566-rock-3c-u-boot.dtsi | 18 +++++ - board/rockchip/evb_rk3568/MAINTAINERS | 7 ++ - configs/rock-3c-rk3566_defconfig | 97 +++++++++++++++++++++++++ - doc/board/rockchip/rockchip.rst | 1 + - 4 files changed, 123 insertions(+) - create mode 100644 arch/arm/dts/rk3566-rock-3c-u-boot.dtsi - create mode 100644 configs/rock-3c-rk3566_defconfig - ---- /dev/null -+++ b/arch/arm/dts/rk3566-rock-3c-u-boot.dtsi -@@ -0,0 +1,18 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+ -+#include "rk356x-u-boot.dtsi" -+ -+&sfc { -+ flash@0 { -+ bootph-pre-ram; -+ bootph-some-ram; -+ }; -+}; -+ -+/ { -+ leds { -+ led-0 { -+ default-state = "on"; -+ }; -+ }; -+}; ---- a/board/rockchip/evb_rk3568/MAINTAINERS -+++ b/board/rockchip/evb_rk3568/MAINTAINERS -@@ -69,3 +69,10 @@ S: Maintained - F: configs/rock-3a-rk3568_defconfig - F: arch/arm/dts/rk3568-rock-3a.dts - F: arch/arm/dts/rk3568-rock-3a-u-boot.dtsi -+ -+ROCK-3C -+M: Jonas Karlman -+M: Maxim Moskalets -+S: Maintained -+F: arch/arm/dts/rk3566-rock-3c-u-boot.dtsi -+F: configs/rock-3c-rk3566_defconfig ---- /dev/null -+++ b/configs/rock-3c-rk3566_defconfig -@@ -0,0 +1,97 @@ -+CONFIG_ARM=y -+CONFIG_SKIP_LOWLEVEL_INIT=y -+CONFIG_COUNTER_FREQUENCY=24000000 -+CONFIG_ARCH_ROCKCHIP=y -+CONFIG_SF_DEFAULT_SPEED=24000000 -+CONFIG_SF_DEFAULT_MODE=0x2000 -+CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3566-rock-3c" -+CONFIG_ROCKCHIP_RK3568=y -+CONFIG_ROCKCHIP_SPI_IMAGE=y -+CONFIG_SPL_SERIAL=y -+CONFIG_DEBUG_UART_BASE=0xFE660000 -+CONFIG_DEBUG_UART_CLOCK=24000000 -+CONFIG_SPL_SPI_FLASH_SUPPORT=y -+CONFIG_SPL_SPI=y -+CONFIG_SYS_LOAD_ADDR=0xc00800 -+CONFIG_PCI=y -+CONFIG_DEBUG_UART=y -+CONFIG_AHCI=y -+CONFIG_FIT=y -+CONFIG_FIT_VERBOSE=y -+CONFIG_SPL_FIT_SIGNATURE=y -+CONFIG_SPL_LOAD_FIT=y -+CONFIG_LEGACY_IMAGE_FORMAT=y -+CONFIG_DEFAULT_FDT_FILE="rockchip/rk3566-rock-3c.dtb" -+# CONFIG_DISPLAY_CPUINFO is not set -+CONFIG_DISPLAY_BOARDINFO_LATE=y -+CONFIG_SPL_MAX_SIZE=0x40000 -+CONFIG_SPL_PAD_TO=0x7f8000 -+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set -+CONFIG_SPL_SPI_LOAD=y -+CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000 -+CONFIG_SPL_ATF=y -+CONFIG_CMD_GPIO=y -+CONFIG_CMD_GPT=y -+CONFIG_CMD_I2C=y -+CONFIG_CMD_MMC=y -+CONFIG_CMD_PCI=y -+CONFIG_CMD_POWEROFF=y -+CONFIG_CMD_USB=y -+# CONFIG_CMD_SETEXPR is not set -+CONFIG_CMD_PMIC=y -+CONFIG_CMD_REGULATOR=y -+# CONFIG_SPL_DOS_PARTITION is not set -+CONFIG_SPL_OF_CONTROL=y -+CONFIG_OF_LIVE=y -+CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" -+CONFIG_SYS_RELOC_GD_ENV_ADDR=y -+CONFIG_SPL_DM_SEQ_ALIAS=y -+CONFIG_SPL_REGMAP=y -+CONFIG_SPL_SYSCON=y -+CONFIG_SCSI_AHCI=y -+CONFIG_AHCI_PCI=y -+CONFIG_SPL_CLK=y -+CONFIG_ROCKCHIP_GPIO=y -+CONFIG_SYS_I2C_ROCKCHIP=y -+CONFIG_LED=y -+CONFIG_LED_GPIO=y -+CONFIG_MISC=y -+CONFIG_SUPPORT_EMMC_RPMB=y -+CONFIG_MMC_DW=y -+CONFIG_MMC_DW_ROCKCHIP=y -+CONFIG_MMC_SDHCI=y -+CONFIG_MMC_SDHCI_SDMA=y -+CONFIG_MMC_SDHCI_ROCKCHIP=y -+CONFIG_SF_DEFAULT_BUS=4 -+CONFIG_SPI_FLASH_SFDP_SUPPORT=y -+CONFIG_SPI_FLASH_GIGADEVICE=y -+CONFIG_SPI_FLASH_MACRONIX=y -+CONFIG_SPI_FLASH_WINBOND=y -+CONFIG_SPI_FLASH_XTX=y -+CONFIG_PHY_REALTEK=y -+CONFIG_DWC_ETH_QOS=y -+CONFIG_DWC_ETH_QOS_ROCKCHIP=y -+CONFIG_NVME_PCI=y -+CONFIG_PCIE_DW_ROCKCHIP=y -+CONFIG_PHY_ROCKCHIP_INNO_USB2=y -+CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY=y -+CONFIG_SPL_PINCTRL=y -+CONFIG_DM_PMIC=y -+CONFIG_PMIC_RK8XX=y -+CONFIG_REGULATOR_RK8XX=y -+CONFIG_SPL_RAM=y -+CONFIG_SCSI=y -+CONFIG_BAUDRATE=1500000 -+CONFIG_DEBUG_UART_SHIFT=2 -+CONFIG_SYS_NS16550_MEM32=y -+CONFIG_ROCKCHIP_SFC=y -+CONFIG_SYSRESET=y -+CONFIG_USB=y -+CONFIG_USB_XHCI_HCD=y -+CONFIG_USB_EHCI_HCD=y -+CONFIG_USB_EHCI_GENERIC=y -+CONFIG_USB_OHCI_HCD=y -+CONFIG_USB_OHCI_GENERIC=y -+CONFIG_USB_DWC3=y -+CONFIG_USB_DWC3_GENERIC=y -+CONFIG_ERRNO_STR=y ---- a/doc/board/rockchip/rockchip.rst -+++ b/doc/board/rockchip/rockchip.rst -@@ -106,6 +106,7 @@ List of mainline supported Rockchip boar - - Pine64 SOQuartz on Model A (soquartz-model-a-rk3566) - - Powkiddy X55 (powkiddy-x55-rk3566) - - Radxa CM3 IO Board (radxa-cm3-io-rk3566) -+ - Radxa ROCK 3C (rock-3c-rk3566) - - * rk3568 - - Rockchip Evb-RK3568 (evb-rk3568) diff --git a/package/boot/uboot-rockchip/patches/003-v2024.10-rc3-dm-adc-Add-SPL_ADC-Kconfig-symbol-for-use-of-ADC-in-.patch b/package/boot/uboot-rockchip/patches/003-v2024.10-rc3-dm-adc-Add-SPL_ADC-Kconfig-symbol-for-use-of-ADC-in-.patch deleted file mode 100644 index c62c3789806..00000000000 --- a/package/boot/uboot-rockchip/patches/003-v2024.10-rc3-dm-adc-Add-SPL_ADC-Kconfig-symbol-for-use-of-ADC-in-.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 232af1e58a977f3857074d3aba3709c860bd8058 Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Fri, 2 Aug 2024 22:12:22 +0000 -Subject: [PATCH] dm: adc: Add SPL_ADC Kconfig symbol for use of ADC in SPL - -What model of Radxa ZERO 3W/3E board can be identified using ADC at -runtime, add a Kconfig symbol to allow use of ADC in SPL. - -This will be used to identify board model in SPL to allow loading -correct FIT configuration and FDT for U-Boot proper at SPL phase. - -Signed-off-by: Jonas Karlman -Reviewed-by: Kever Yang ---- - drivers/Makefile | 2 +- - drivers/adc/Kconfig | 5 +++++ - drivers/adc/Makefile | 2 +- - 3 files changed, 7 insertions(+), 2 deletions(-) - ---- a/drivers/Makefile -+++ b/drivers/Makefile -@@ -1,5 +1,6 @@ - # SPDX-License-Identifier: GPL-2.0+ - -+obj-$(CONFIG_$(SPL_TPL_)ADC) += adc/ - obj-$(CONFIG_$(SPL_TPL_)BIOSEMU) += bios_emulator/ - obj-$(CONFIG_$(SPL_TPL_)BLK) += block/ - obj-$(CONFIG_$(SPL_TPL_)BOOTCOUNT_LIMIT) += bootcount/ -@@ -81,7 +82,6 @@ endif - - ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) - --obj-y += adc/ - obj-y += ata/ - obj-$(CONFIG_DM_DEMO) += demo/ - obj-y += block/ ---- a/drivers/adc/Kconfig -+++ b/drivers/adc/Kconfig -@@ -1,5 +1,6 @@ - config ADC - bool "Enable ADC drivers using Driver Model" -+ depends on DM - help - This enables ADC API for drivers, which allows driving ADC features - by single and multi-channel methods for: -@@ -11,6 +12,10 @@ config ADC - - support supply's phandle with auto-enable - - supply polarity setting in fdt - -+config SPL_ADC -+ bool "Enable ADC drivers using Driver Model in SPL" -+ depends on SPL_DM -+ - config ADC_EXYNOS - bool "Enable Exynos 54xx ADC driver" - depends on ADC ---- a/drivers/adc/Makefile -+++ b/drivers/adc/Makefile -@@ -4,7 +4,7 @@ - # Przemyslaw Marczak - # - --obj-$(CONFIG_ADC) += adc-uclass.o -+obj-$(CONFIG_$(SPL_TPL_)ADC) += adc-uclass.o - obj-$(CONFIG_ADC_EXYNOS) += exynos-adc.o - obj-$(CONFIG_ADC_SANDBOX) += sandbox.o - obj-$(CONFIG_SARADC_ROCKCHIP) += rockchip-saradc.o diff --git a/package/boot/uboot-rockchip/patches/004-v2024.10-rc3-board-rockchip-Add-Radxa-ZERO-3W-3E.patch b/package/boot/uboot-rockchip/patches/004-v2024.10-rc3-board-rockchip-Add-Radxa-ZERO-3W-3E.patch deleted file mode 100644 index cbd69958748..00000000000 --- a/package/boot/uboot-rockchip/patches/004-v2024.10-rc3-board-rockchip-Add-Radxa-ZERO-3W-3E.patch +++ /dev/null @@ -1,295 +0,0 @@ -From 5d199ad9a6bb43dbf43efe45ec37002c4ae305a0 Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Fri, 2 Aug 2024 22:12:23 +0000 -Subject: [PATCH] board: rockchip: Add Radxa ZERO 3W/3E - -The Radxa ZERO 3W/3E is an ultra-small, high-performance single board -computer based on the Rockchip RK3566, with a compact form factor and -rich interfaces. - -Implement rk_board_late_init() to set correct fdtfile env var and -board_fit_config_name_match() to load correct FIT config based on what -board is detected at runtime so a single board target can be used for -both board models. - -Features tested on a ZERO 3W 8GB v1.11: -- SD-card boot -- eMMC boot -- USB gadget -- USB host - -Features tested on a ZERO 3E 4GB v1.2: -- SD-card boot -- Ethernet -- USB gadget -- USB host - -Signed-off-by: Jonas Karlman -Tested-by: FUKAUMI Naoki -Reviewed-by: Kever Yang ---- - arch/arm/dts/rk3566-radxa-zero-3e-u-boot.dtsi | 15 ++++ - arch/arm/dts/rk3566-radxa-zero-3w-u-boot.dtsi | 15 ++++ - arch/arm/mach-rockchip/rk3568/Kconfig | 6 ++ - board/radxa/zero3-rk3566/Kconfig | 12 +++ - board/radxa/zero3-rk3566/MAINTAINERS | 6 ++ - board/radxa/zero3-rk3566/Makefile | 3 + - board/radxa/zero3-rk3566/zero3-rk3566.c | 59 +++++++++++++ - configs/radxa-zero-3-rk3566_defconfig | 85 +++++++++++++++++++ - doc/board/rockchip/rockchip.rst | 1 + - 9 files changed, 202 insertions(+) - create mode 100644 arch/arm/dts/rk3566-radxa-zero-3e-u-boot.dtsi - create mode 100644 arch/arm/dts/rk3566-radxa-zero-3w-u-boot.dtsi - create mode 100644 board/radxa/zero3-rk3566/Kconfig - create mode 100644 board/radxa/zero3-rk3566/MAINTAINERS - create mode 100644 board/radxa/zero3-rk3566/Makefile - create mode 100644 board/radxa/zero3-rk3566/zero3-rk3566.c - create mode 100644 configs/radxa-zero-3-rk3566_defconfig - ---- /dev/null -+++ b/arch/arm/dts/rk3566-radxa-zero-3e-u-boot.dtsi -@@ -0,0 +1,15 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+ -+#include "rk356x-u-boot.dtsi" -+ -+&saradc { -+ bootph-pre-ram; -+}; -+ -+&usb_host0_xhci { -+ dr_mode = "otg"; -+}; -+ -+&vcca_1v8 { -+ bootph-pre-ram; -+}; ---- /dev/null -+++ b/arch/arm/dts/rk3566-radxa-zero-3w-u-boot.dtsi -@@ -0,0 +1,15 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+ -+#include "rk356x-u-boot.dtsi" -+ -+&saradc { -+ bootph-pre-ram; -+}; -+ -+&usb_host0_xhci { -+ dr_mode = "otg"; -+}; -+ -+&vcca_1v8 { -+ bootph-pre-ram; -+}; ---- a/arch/arm/mach-rockchip/rk3568/Kconfig -+++ b/arch/arm/mach-rockchip/rk3568/Kconfig -@@ -32,6 +32,11 @@ config TARGET_QUARTZ64_RK3566 - help - Pine64 Quartz64 single board computer with a RK3566 SoC. - -+config TARGET_RADXA_ZERO_3_RK3566 -+ bool "Radxa ZERO 3W/3E" -+ help -+ Radxa ZERO 3W/3E single board computers with a RK3566 SoC. -+ - endchoice - - config ROCKCHIP_BOOT_MODE_REG -@@ -54,5 +59,6 @@ source "board/anbernic/rgxx3_rk3566/Kcon - source "board/hardkernel/odroid_m1/Kconfig" - source "board/pine64/quartz64_rk3566/Kconfig" - source "board/powkiddy/x55/Kconfig" -+source "board/radxa/zero3-rk3566/Kconfig" - - endif ---- /dev/null -+++ b/board/radxa/zero3-rk3566/Kconfig -@@ -0,0 +1,12 @@ -+if TARGET_RADXA_ZERO_3_RK3566 -+ -+config SYS_BOARD -+ default "zero3-rk3566" -+ -+config SYS_VENDOR -+ default "radxa" -+ -+config SYS_CONFIG_NAME -+ default "evb_rk3568" -+ -+endif ---- /dev/null -+++ b/board/radxa/zero3-rk3566/MAINTAINERS -@@ -0,0 +1,6 @@ -+RADXA-ZERO-3-RK3566 -+M: Jonas Karlman -+S: Maintained -+F: board/radxa/zero3-rk3566 -+F: configs/radxa-zero-3-rk3566_defconfig -+F: arch/arm/dts/rk3566-radxa-zero-3* ---- /dev/null -+++ b/board/radxa/zero3-rk3566/Makefile -@@ -0,0 +1,3 @@ -+# SPDX-License-Identifier: GPL-2.0+ -+ -+obj-y += zero3-rk3566.o ---- /dev/null -+++ b/board/radxa/zero3-rk3566/zero3-rk3566.c -@@ -0,0 +1,59 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+ -+#include -+#include -+#include -+#include -+ -+#define HW_ID_CHANNEL 1 -+ -+struct board_model { -+ unsigned int low; -+ unsigned int high; -+ const char *fdtfile; -+}; -+ -+static const struct board_model board_models[] = { -+ { 230, 270, "rockchip/rk3566-radxa-zero-3w.dtb" }, -+ { 400, 450, "rockchip/rk3566-radxa-zero-3e.dtb" }, -+}; -+ -+static const struct board_model *get_board_model(void) -+{ -+ unsigned int val; -+ int i, ret; -+ -+ ret = adc_channel_single_shot("saradc@fe720000", HW_ID_CHANNEL, &val); -+ if (ret) -+ return NULL; -+ -+ for (i = 0; i < ARRAY_SIZE(board_models); i++) { -+ unsigned int min = board_models[i].low; -+ unsigned int max = board_models[i].high; -+ -+ if (min <= val && val <= max) -+ return &board_models[i]; -+ } -+ -+ return NULL; -+} -+ -+int rk_board_late_init(void) -+{ -+ const struct board_model *model = get_board_model(); -+ -+ if (model) -+ env_set("fdtfile", model->fdtfile); -+ -+ return 0; -+} -+ -+int board_fit_config_name_match(const char *name) -+{ -+ const struct board_model *model = get_board_model(); -+ -+ if (model && !strcmp(name, model->fdtfile)) -+ return 0; -+ -+ return -EINVAL; -+} ---- /dev/null -+++ b/configs/radxa-zero-3-rk3566_defconfig -@@ -0,0 +1,85 @@ -+CONFIG_ARM=y -+CONFIG_SKIP_LOWLEVEL_INIT=y -+CONFIG_COUNTER_FREQUENCY=24000000 -+CONFIG_ARCH_ROCKCHIP=y -+CONFIG_SPL_GPIO=y -+CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3566-radxa-zero-3w" -+CONFIG_ROCKCHIP_RK3568=y -+CONFIG_SPL_SERIAL=y -+CONFIG_TARGET_RADXA_ZERO_3_RK3566=y -+CONFIG_DEBUG_UART_BASE=0xFE660000 -+CONFIG_DEBUG_UART_CLOCK=24000000 -+CONFIG_SYS_LOAD_ADDR=0xc00800 -+CONFIG_DEBUG_UART=y -+CONFIG_FIT=y -+CONFIG_FIT_VERBOSE=y -+CONFIG_SPL_FIT_SIGNATURE=y -+CONFIG_SPL_LOAD_FIT=y -+CONFIG_LEGACY_IMAGE_FORMAT=y -+CONFIG_DEFAULT_FDT_FILE="rockchip/rk3566-radxa-zero-3w.dtb" -+# CONFIG_DISPLAY_CPUINFO is not set -+CONFIG_DISPLAY_BOARDINFO_LATE=y -+CONFIG_SPL_MAX_SIZE=0x40000 -+CONFIG_SPL_PAD_TO=0x7f8000 -+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set -+CONFIG_SPL_POWER=y -+CONFIG_SPL_ATF=y -+CONFIG_CMD_GPIO=y -+CONFIG_CMD_GPT=y -+CONFIG_CMD_I2C=y -+CONFIG_CMD_MMC=y -+CONFIG_CMD_USB=y -+CONFIG_CMD_ROCKUSB=y -+CONFIG_CMD_USB_MASS_STORAGE=y -+# CONFIG_CMD_SETEXPR is not set -+CONFIG_CMD_PMIC=y -+CONFIG_CMD_REGULATOR=y -+# CONFIG_SPL_DOS_PARTITION is not set -+CONFIG_SPL_OF_CONTROL=y -+CONFIG_OF_LIVE=y -+CONFIG_OF_LIST="rockchip/rk3566-radxa-zero-3w rockchip/rk3566-radxa-zero-3e" -+CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" -+CONFIG_SYS_RELOC_GD_ENV_ADDR=y -+CONFIG_SPL_DM_SEQ_ALIAS=y -+CONFIG_SPL_REGMAP=y -+CONFIG_SPL_SYSCON=y -+CONFIG_SPL_ADC=y -+CONFIG_SPL_CLK=y -+# CONFIG_USB_FUNCTION_FASTBOOT is not set -+CONFIG_ROCKCHIP_GPIO=y -+CONFIG_SYS_I2C_ROCKCHIP=y -+CONFIG_LED=y -+CONFIG_LED_GPIO=y -+CONFIG_MISC=y -+CONFIG_SUPPORT_EMMC_RPMB=y -+CONFIG_MMC_DW=y -+CONFIG_MMC_DW_ROCKCHIP=y -+CONFIG_MMC_SDHCI=y -+CONFIG_MMC_SDHCI_SDMA=y -+CONFIG_MMC_SDHCI_ROCKCHIP=y -+CONFIG_PHY_REALTEK=y -+CONFIG_DWC_ETH_QOS=y -+CONFIG_DWC_ETH_QOS_ROCKCHIP=y -+CONFIG_PHY_ROCKCHIP_INNO_USB2=y -+CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY=y -+CONFIG_SPL_PINCTRL=y -+CONFIG_DM_PMIC=y -+CONFIG_DM_PMIC_FAN53555=y -+CONFIG_PMIC_RK8XX=y -+CONFIG_SPL_DM_REGULATOR=y -+CONFIG_SPL_DM_REGULATOR_FIXED=y -+CONFIG_REGULATOR_RK8XX=y -+CONFIG_SPL_RAM=y -+CONFIG_BAUDRATE=1500000 -+CONFIG_DEBUG_UART_SHIFT=2 -+CONFIG_SYS_NS16550_MEM32=y -+CONFIG_SYSRESET=y -+CONFIG_SYSRESET_PSCI=y -+CONFIG_USB=y -+CONFIG_USB_XHCI_HCD=y -+CONFIG_USB_DWC3=y -+CONFIG_USB_DWC3_GENERIC=y -+CONFIG_USB_GADGET=y -+CONFIG_USB_GADGET_DOWNLOAD=y -+CONFIG_USB_FUNCTION_ROCKUSB=y -+CONFIG_ERRNO_STR=y ---- a/doc/board/rockchip/rockchip.rst -+++ b/doc/board/rockchip/rockchip.rst -@@ -107,6 +107,7 @@ List of mainline supported Rockchip boar - - Powkiddy X55 (powkiddy-x55-rk3566) - - Radxa CM3 IO Board (radxa-cm3-io-rk3566) - - Radxa ROCK 3C (rock-3c-rk3566) -+ - Radxa ZERO 3W/3E (radxa-zero-3-rk3566) - - * rk3568 - - Rockchip Evb-RK3568 (evb-rk3568) diff --git a/package/boot/uboot-rockchip/patches/005-v2024.10-rc3-board-rockchip-Add-Radxa-ROCK-3B.patch b/package/boot/uboot-rockchip/patches/005-v2024.10-rc3-board-rockchip-Add-Radxa-ROCK-3B.patch deleted file mode 100644 index 0fe8bfd52d4..00000000000 --- a/package/boot/uboot-rockchip/patches/005-v2024.10-rc3-board-rockchip-Add-Radxa-ROCK-3B.patch +++ /dev/null @@ -1,179 +0,0 @@ -From e20d57ae7e0c28f2d770a7d18c1501d332e8766a Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Wed, 31 Jul 2024 07:28:54 +0000 -Subject: [PATCH] board: rockchip: Add Radxa ROCK 3B - -The Radxa ROCK 3B is a single-board computer based on the Pico-ITX form -factor (100mm x 75mm). Two versions of the ROCK 3B exists, a community -version based on the RK3568 SoC and an industrial version based on the -RK3568J SoC. - -Features tested on ROCK 3B 8GB v1.51 (both variants): -- SD-card boot -- eMMC boot -- SPI Flash boot -- Ethernet -- PCIe/NVMe -- USB gadget -- USB host - -Signed-off-by: Jonas Karlman -Tested-by: FUKAUMI Naoki -Reviewed-by: Kever Yang ---- - arch/arm/dts/rk3568-rock-3b-u-boot.dtsi | 15 ++++ - board/rockchip/evb_rk3568/MAINTAINERS | 6 ++ - configs/rock-3b-rk3568_defconfig | 100 ++++++++++++++++++++++++ - doc/board/rockchip/rockchip.rst | 3 +- - 4 files changed, 123 insertions(+), 1 deletion(-) - create mode 100644 arch/arm/dts/rk3568-rock-3b-u-boot.dtsi - create mode 100644 configs/rock-3b-rk3568_defconfig - ---- /dev/null -+++ b/arch/arm/dts/rk3568-rock-3b-u-boot.dtsi -@@ -0,0 +1,15 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+ -+#include "rk356x-u-boot.dtsi" -+ -+&sdhci { -+ mmc-hs400-1_8v; -+ mmc-hs400-enhanced-strobe; -+}; -+ -+&sfc { -+ flash@0 { -+ bootph-pre-ram; -+ bootph-some-ram; -+ }; -+}; ---- a/board/rockchip/evb_rk3568/MAINTAINERS -+++ b/board/rockchip/evb_rk3568/MAINTAINERS -@@ -70,6 +70,12 @@ F: configs/rock-3a-rk3568_defconfig - F: arch/arm/dts/rk3568-rock-3a.dts - F: arch/arm/dts/rk3568-rock-3a-u-boot.dtsi - -+ROCK-3B -+M: Jonas Karlman -+S: Maintained -+F: configs/rock-3b-rk3568_defconfig -+F: arch/arm/dts/rk3568-rock-3b* -+ - ROCK-3C - M: Jonas Karlman - M: Maxim Moskalets ---- /dev/null -+++ b/configs/rock-3b-rk3568_defconfig -@@ -0,0 +1,100 @@ -+CONFIG_ARM=y -+CONFIG_SKIP_LOWLEVEL_INIT=y -+CONFIG_COUNTER_FREQUENCY=24000000 -+CONFIG_ARCH_ROCKCHIP=y -+CONFIG_SF_DEFAULT_SPEED=24000000 -+CONFIG_SF_DEFAULT_MODE=0x2000 -+CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3568-rock-3b" -+CONFIG_ROCKCHIP_RK3568=y -+CONFIG_ROCKCHIP_SPI_IMAGE=y -+CONFIG_SPL_SERIAL=y -+CONFIG_DEBUG_UART_BASE=0xFE660000 -+CONFIG_DEBUG_UART_CLOCK=24000000 -+CONFIG_SPL_SPI_FLASH_SUPPORT=y -+CONFIG_SPL_SPI=y -+CONFIG_SYS_LOAD_ADDR=0xc00800 -+CONFIG_PCI=y -+CONFIG_DEBUG_UART=y -+CONFIG_AHCI=y -+CONFIG_FIT=y -+CONFIG_FIT_VERBOSE=y -+CONFIG_SPL_FIT_SIGNATURE=y -+CONFIG_SPL_LOAD_FIT=y -+CONFIG_LEGACY_IMAGE_FORMAT=y -+CONFIG_DEFAULT_FDT_FILE="rockchip/rk3568-rock-3b.dtb" -+# CONFIG_DISPLAY_CPUINFO is not set -+CONFIG_DISPLAY_BOARDINFO_LATE=y -+CONFIG_SPL_MAX_SIZE=0x40000 -+CONFIG_SPL_PAD_TO=0x7f8000 -+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set -+CONFIG_SPL_SPI_LOAD=y -+CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000 -+CONFIG_SPL_ATF=y -+CONFIG_CMD_GPIO=y -+CONFIG_CMD_GPT=y -+CONFIG_CMD_I2C=y -+CONFIG_CMD_MMC=y -+CONFIG_CMD_PCI=y -+CONFIG_CMD_POWEROFF=y -+CONFIG_CMD_USB=y -+CONFIG_CMD_ROCKUSB=y -+CONFIG_CMD_USB_MASS_STORAGE=y -+# CONFIG_CMD_SETEXPR is not set -+CONFIG_CMD_PMIC=y -+CONFIG_CMD_REGULATOR=y -+# CONFIG_SPL_DOS_PARTITION is not set -+CONFIG_SPL_OF_CONTROL=y -+CONFIG_OF_LIVE=y -+CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" -+CONFIG_SYS_RELOC_GD_ENV_ADDR=y -+CONFIG_SPL_DM_SEQ_ALIAS=y -+CONFIG_SPL_REGMAP=y -+CONFIG_SPL_SYSCON=y -+CONFIG_SCSI_AHCI=y -+CONFIG_AHCI_PCI=y -+CONFIG_SPL_CLK=y -+# CONFIG_USB_FUNCTION_FASTBOOT is not set -+CONFIG_ROCKCHIP_GPIO=y -+CONFIG_SYS_I2C_ROCKCHIP=y -+CONFIG_LED=y -+CONFIG_LED_GPIO=y -+CONFIG_MISC=y -+CONFIG_SUPPORT_EMMC_RPMB=y -+CONFIG_MMC_DW=y -+CONFIG_MMC_DW_ROCKCHIP=y -+CONFIG_MMC_SDHCI=y -+CONFIG_MMC_SDHCI_SDMA=y -+CONFIG_MMC_SDHCI_ROCKCHIP=y -+CONFIG_SF_DEFAULT_BUS=4 -+CONFIG_SPI_FLASH_SFDP_SUPPORT=y -+CONFIG_SPI_FLASH_MACRONIX=y -+CONFIG_SPI_FLASH_XTX=y -+CONFIG_PHY_REALTEK=y -+CONFIG_DWC_ETH_QOS=y -+CONFIG_DWC_ETH_QOS_ROCKCHIP=y -+CONFIG_NVME_PCI=y -+CONFIG_PCIE_DW_ROCKCHIP=y -+CONFIG_PHY_ROCKCHIP_INNO_USB2=y -+CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY=y -+CONFIG_SPL_PINCTRL=y -+CONFIG_DM_PMIC=y -+CONFIG_DM_PMIC_FAN53555=y -+CONFIG_PMIC_RK8XX=y -+CONFIG_REGULATOR_RK8XX=y -+CONFIG_SPL_RAM=y -+CONFIG_SCSI=y -+CONFIG_BAUDRATE=1500000 -+CONFIG_DEBUG_UART_SHIFT=2 -+CONFIG_SYS_NS16550_MEM32=y -+CONFIG_ROCKCHIP_SFC=y -+CONFIG_SYSRESET=y -+CONFIG_USB=y -+CONFIG_USB_XHCI_HCD=y -+CONFIG_USB_EHCI_HCD=y -+CONFIG_USB_EHCI_GENERIC=y -+CONFIG_USB_DWC3=y -+CONFIG_USB_DWC3_GENERIC=y -+CONFIG_USB_GADGET=y -+CONFIG_USB_GADGET_DOWNLOAD=y -+CONFIG_USB_FUNCTION_ROCKUSB=y -+CONFIG_ERRNO_STR=y ---- a/doc/board/rockchip/rockchip.rst -+++ b/doc/board/rockchip/rockchip.rst -@@ -118,7 +118,8 @@ List of mainline supported Rockchip boar - - Generic RK3566/RK3568 (generic-rk3568) - - Hardkernel ODROID-M1 (odroid-m1-rk3568) - - Radxa E25 Carrier Board (radxa-e25-rk3568) -- - Radxa ROCK 3 Model A (rock-3a-rk3568) -+ - Radxa ROCK 3A (rock-3a-rk3568) -+ - Radxa ROCK 3B (rock-3b-rk3568) - - * rk3588 - - Rockchip EVB (evb-rk3588) diff --git a/package/boot/uboot-rockchip/patches/010-v2024.10-rc3-arm64-dts-rockchip-correct-the-model-name-for-Radxa-.patch b/package/boot/uboot-rockchip/patches/010-v2024.10-rc3-arm64-dts-rockchip-correct-the-model-name-for-Radxa-.patch deleted file mode 100644 index 6bf47e2a5b6..00000000000 --- a/package/boot/uboot-rockchip/patches/010-v2024.10-rc3-arm64-dts-rockchip-correct-the-model-name-for-Radxa-.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 626a479873b6a680b3227c4852bde4a1f2c17fdf Mon Sep 17 00:00:00 2001 -From: Chukun Pan -Date: Fri, 19 Apr 2024 18:30:19 +0800 -Subject: [PATCH 1/3] arm64: dts: rockchip: correct the model name for Radxa - ROCK 3A - -According to https://radxa.com/products/rock3/3a, -the name of this board should be "Radxa ROCK 3A". - -Suggested-by: FUKAUMI Naoki -Signed-off-by: Chukun Pan -Reviewed-by: Dragan Simic -Link: https://lore.kernel.org/r/20240419103019.992586-3-amadeus@jmu.edu.cn -Signed-off-by: Heiko Stuebner ---- - arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/dts/upstream/src/arm64/rockchip/rk3568-rock-3a.dts -+++ b/dts/upstream/src/arm64/rockchip/rk3568-rock-3a.dts -@@ -8,7 +8,7 @@ - #include "rk3568.dtsi" - - / { -- model = "Radxa ROCK3 Model A"; -+ model = "Radxa ROCK 3A"; - compatible = "radxa,rock3a", "rockchip,rk3568"; - - aliases { diff --git a/package/boot/uboot-rockchip/patches/011-v2024.10-rc3-arm64-dts-rockchip-Correct-the-model-names-for-Radxa.patch b/package/boot/uboot-rockchip/patches/011-v2024.10-rc3-arm64-dts-rockchip-Correct-the-model-names-for-Radxa.patch deleted file mode 100644 index 82918e38991..00000000000 --- a/package/boot/uboot-rockchip/patches/011-v2024.10-rc3-arm64-dts-rockchip-Correct-the-model-names-for-Radxa.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 45e831033f7a00a14f64afa1e34c476a9ff0f9f0 Mon Sep 17 00:00:00 2001 -From: Dragan Simic -Date: Thu, 18 Apr 2024 18:26:20 +0200 -Subject: [PATCH] arm64: dts: rockchip: Correct the model names for Radxa ROCK - 5 boards - -Correct the descriptions of a few Radxa boards, according to the up-to-date -documentation from Radxa and the detailed explanation from Naoki. [1] To sum -it up, the short naming, as specified by Radxa, is preferred. - -[1] https://lore.kernel.org/linux-rockchip/B26C732A4DCEA9B3+282b8775-601b-4d4a-a513-4924b7940076@radxa.com/ - -Suggested-by: FUKAUMI Naoki -Signed-off-by: Dragan Simic -Link: https://lore.kernel.org/r/6931289a252dc2d6c7bfd2388835c5e98ba0d8c9.1713457260.git.dsimic@manjaro.org -Signed-off-by: Heiko Stuebner ---- - arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts | 2 +- - arch/arm64/boot/dts/rockchip/rk3588s-rock-5a.dts | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - ---- a/dts/upstream/src/arm64/rockchip/rk3588-rock-5b.dts -+++ b/dts/upstream/src/arm64/rockchip/rk3588-rock-5b.dts -@@ -7,7 +7,7 @@ - #include "rk3588.dtsi" - - / { -- model = "Radxa ROCK 5 Model B"; -+ model = "Radxa ROCK 5B"; - compatible = "radxa,rock-5b", "rockchip,rk3588"; - - aliases { ---- a/dts/upstream/src/arm64/rockchip/rk3588s-rock-5a.dts -+++ b/dts/upstream/src/arm64/rockchip/rk3588s-rock-5a.dts -@@ -8,7 +8,7 @@ - #include "rk3588s.dtsi" - - / { -- model = "Radxa ROCK 5 Model A"; -+ model = "Radxa ROCK 5A"; - compatible = "radxa,rock-5a", "rockchip,rk3588s"; - - aliases { diff --git a/package/boot/uboot-rockchip/patches/106-v2024.10-rc1-board-rockchip-Add-FriendlyElec-NanoPi-R6S.patch b/package/boot/uboot-rockchip/patches/106-v2024.10-rc1-board-rockchip-Add-FriendlyElec-NanoPi-R6S.patch deleted file mode 100644 index 68958d87c94..00000000000 --- a/package/boot/uboot-rockchip/patches/106-v2024.10-rc1-board-rockchip-Add-FriendlyElec-NanoPi-R6S.patch +++ /dev/null @@ -1,193 +0,0 @@ -From 7db9ff164813afb343024d37731ab797ed7f507e Mon Sep 17 00:00:00 2001 -From: Sebastian Kropatsch -Date: Thu, 11 Jul 2024 12:15:18 +0200 -Subject: [PATCH] board: rockchip: Add FriendlyElec NanoPi R6S - -The NanoPi R6S is a SBC by FriendlyElec based on the Rockchip RK3588s. -It comes with 4GB or 8GB of RAM, a microSD card slot, 32GB eMMC storage, -one RTL8211F 1GbE and two RTL8125 2.5GbE Ethernet ports, one USB 2.0 -Type-A and one USB 3.0 Type-A port, a HDMI port, a 12-pin GPIO FPC -connector, a fan connector, IR receiver as well as some buttons and LEDs. - -Add initial support for this board using the upstream devicetree sources. - -Kernel commit: -f1b11f43b3e9 ("arm64: dts: rockchip: Add support for NanoPi R6S") - -Reviewed-by: Kever Yang -Signed-off-by: Sebastian Kropatsch ---- - arch/arm/dts/rk3588s-nanopi-r6s-u-boot.dtsi | 3 + - arch/arm/mach-rockchip/rk3588/Kconfig | 13 +++ - board/friendlyelec/nanopi-r6s-rk3588s/Kconfig | 12 +++ - .../nanopi-r6s-rk3588s/MAINTAINERS | 7 ++ - configs/nanopi-r6s-rk3588s_defconfig | 82 +++++++++++++++++++ - doc/board/rockchip/rockchip.rst | 1 + - include/configs/nanopi-r6s-rk3588s.h | 12 +++ - 7 files changed, 130 insertions(+) - create mode 100644 arch/arm/dts/rk3588s-nanopi-r6s-u-boot.dtsi - create mode 100644 board/friendlyelec/nanopi-r6s-rk3588s/Kconfig - create mode 100644 board/friendlyelec/nanopi-r6s-rk3588s/MAINTAINERS - create mode 100644 configs/nanopi-r6s-rk3588s_defconfig - create mode 100644 include/configs/nanopi-r6s-rk3588s.h - ---- /dev/null -+++ b/arch/arm/dts/rk3588s-nanopi-r6s-u-boot.dtsi -@@ -0,0 +1,3 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+ -+#include "rk3588s-u-boot.dtsi" ---- a/arch/arm/mach-rockchip/rk3588/Kconfig -+++ b/arch/arm/mach-rockchip/rk3588/Kconfig -@@ -78,6 +78,18 @@ config TARGET_NANOPCT6_RK3588 - Power: 5.5*2.1mm DC Jack, 12VDC input - Dimensions: 110x80x1.6mm (without case) / 86x114.5x30mm (with case) - -+config TARGET_NANOPI_R6S_RK3588S -+ bool "FriendlyElec NanoPi R6S" -+ select BOARD_LATE_INIT -+ help -+ The NanoPi R6S is a SBC by FriendlyElec based on the Rockchip -+ RK3588s. -+ It comes with 4GB or 8GB of RAM, a microSD card slot, 32GB eMMC -+ storage, one RTL8211F 1GbE and two RTL8125 2.5GbE Ethernet ports, -+ one USB 2.0 Type-A and one USB 3.0 Type-A port, a HDMI port, a -+ 12-pin GPIO FPC connector, a fan connector, IR receiver as well -+ as some buttons and LEDs. -+ - config TARGET_NOVA_RK3588 - bool "Indiedroid Nova RK3588" - select BOARD_LATE_INIT -@@ -232,6 +244,7 @@ config TEXT_BASE - - source "board/edgeble/neural-compute-module-6/Kconfig" - source "board/friendlyelec/nanopc-t6-rk3588/Kconfig" -+source "board/friendlyelec/nanopi-r6s-rk3588s/Kconfig" - source "board/indiedroid/nova/Kconfig" - source "board/pine64/quartzpro64-rk3588/Kconfig" - source "board/turing/turing-rk1-rk3588/Kconfig" ---- /dev/null -+++ b/board/friendlyelec/nanopi-r6s-rk3588s/Kconfig -@@ -0,0 +1,12 @@ -+if TARGET_NANOPI_R6S_RK3588S -+ -+config SYS_BOARD -+ default "nanopi-r6s-rk3588s" -+ -+config SYS_VENDOR -+ default "friendlyelec" -+ -+config SYS_CONFIG_NAME -+ default "nanopi-r6s-rk3588s" -+ -+endif ---- /dev/null -+++ b/board/friendlyelec/nanopi-r6s-rk3588s/MAINTAINERS -@@ -0,0 +1,7 @@ -+NANOPI-R6S -+M: Sebastian Kropatsch -+S: Maintained -+F: arch/arm/dts/rk3588s-nanopi-r6s-u-boot.dtsi -+F: board/friendlyelec/nanopi-r6s-rk3588s -+F: configs/nanopi-r6s-rk3588s_defconfig -+F: include/configs/nanopi-r6s-rk3588s.h ---- /dev/null -+++ b/configs/nanopi-r6s-rk3588s_defconfig -@@ -0,0 +1,82 @@ -+CONFIG_ARM=y -+CONFIG_SKIP_LOWLEVEL_INIT=y -+CONFIG_SYS_HAS_NONCACHED_MEMORY=y -+CONFIG_COUNTER_FREQUENCY=24000000 -+CONFIG_ARCH_ROCKCHIP=y -+CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3588s-nanopi-r6s" -+CONFIG_ROCKCHIP_RK3588=y -+CONFIG_SPL_SERIAL=y -+CONFIG_TARGET_NANOPI_R6S_RK3588S=y -+CONFIG_DEBUG_UART_BASE=0xFEB50000 -+CONFIG_DEBUG_UART_CLOCK=24000000 -+CONFIG_SYS_LOAD_ADDR=0xc00800 -+CONFIG_PCI=y -+CONFIG_DEBUG_UART=y -+CONFIG_FIT=y -+CONFIG_FIT_VERBOSE=y -+CONFIG_SPL_FIT_SIGNATURE=y -+CONFIG_SPL_LOAD_FIT=y -+CONFIG_LEGACY_IMAGE_FORMAT=y -+CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588s-nanopi-r6s.dtb" -+# CONFIG_DISPLAY_CPUINFO is not set -+CONFIG_DISPLAY_BOARDINFO_LATE=y -+CONFIG_SPL_MAX_SIZE=0x40000 -+CONFIG_SPL_PAD_TO=0x7f8000 -+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set -+CONFIG_SPL_ATF=y -+CONFIG_CMD_GPIO=y -+CONFIG_CMD_PWM=y -+CONFIG_CMD_GPT=y -+CONFIG_CMD_I2C=y -+CONFIG_CMD_MMC=y -+CONFIG_CMD_PCI=y -+CONFIG_CMD_USB=y -+CONFIG_CMD_ROCKUSB=y -+# CONFIG_CMD_SETEXPR is not set -+CONFIG_CMD_REGULATOR=y -+# CONFIG_SPL_DOS_PARTITION is not set -+CONFIG_SPL_OF_CONTROL=y -+CONFIG_OF_LIVE=y -+CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" -+CONFIG_SPL_DM_SEQ_ALIAS=y -+CONFIG_SPL_REGMAP=y -+CONFIG_SPL_SYSCON=y -+CONFIG_SPL_CLK=y -+# CONFIG_USB_FUNCTION_FASTBOOT is not set -+CONFIG_ROCKCHIP_GPIO=y -+CONFIG_SYS_I2C_ROCKCHIP=y -+CONFIG_MISC=y -+CONFIG_SUPPORT_EMMC_RPMB=y -+CONFIG_MMC_DW=y -+CONFIG_MMC_DW_ROCKCHIP=y -+CONFIG_MMC_SDHCI=y -+CONFIG_MMC_SDHCI_SDMA=y -+CONFIG_MMC_SDHCI_ROCKCHIP=y -+# CONFIG_SPI_FLASH is not set -+CONFIG_PHY_REALTEK=y -+CONFIG_DWC_ETH_QOS=y -+CONFIG_DWC_ETH_QOS_ROCKCHIP=y -+CONFIG_RTL8169=y -+CONFIG_PCIE_DW_ROCKCHIP=y -+CONFIG_PHY_ROCKCHIP_INNO_USB2=y -+CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY=y -+CONFIG_PHY_ROCKCHIP_USBDP=y -+CONFIG_SPL_PINCTRL=y -+CONFIG_PWM_ROCKCHIP=y -+CONFIG_SPL_RAM=y -+CONFIG_BAUDRATE=1500000 -+CONFIG_DEBUG_UART_SHIFT=2 -+CONFIG_SYS_NS16550_MEM32=y -+CONFIG_SYSRESET=y -+CONFIG_USB=y -+CONFIG_USB_XHCI_HCD=y -+CONFIG_USB_EHCI_HCD=y -+CONFIG_USB_EHCI_GENERIC=y -+CONFIG_USB_OHCI_HCD=y -+CONFIG_USB_OHCI_GENERIC=y -+CONFIG_USB_DWC3=y -+CONFIG_USB_DWC3_GENERIC=y -+CONFIG_USB_GADGET=y -+CONFIG_USB_GADGET_DOWNLOAD=y -+CONFIG_USB_FUNCTION_ROCKUSB=y -+CONFIG_ERRNO_STR=y ---- /dev/null -+++ b/include/configs/nanopi-r6s-rk3588s.h -@@ -0,0 +1,12 @@ -+/* SPDX-License-Identifier: GPL-2.0+ */ -+ -+#ifndef __NANOPI_R6S_RK3588S_H -+#define __NANOPI_R6S_RK3588S_H -+ -+#define ROCKCHIP_DEVICE_SETTINGS \ -+ "stdout=serial,vidconsole\0" \ -+ "stderr=serial,vidconsole\0" -+ -+#include -+ -+#endif /* __NANOPI_R6S_RK3588S_H */ diff --git a/package/boot/uboot-rockchip/patches/107-v2024.10-rc1-board-rockchip-Add-FriendlyElec-NanoPi-R6C.patch b/package/boot/uboot-rockchip/patches/107-v2024.10-rc1-board-rockchip-Add-FriendlyElec-NanoPi-R6C.patch deleted file mode 100644 index ba00a5c9dee..00000000000 --- a/package/boot/uboot-rockchip/patches/107-v2024.10-rc1-board-rockchip-Add-FriendlyElec-NanoPi-R6C.patch +++ /dev/null @@ -1,213 +0,0 @@ -From f59d40aa5598063396164b3248f0f8ed6591e3db Mon Sep 17 00:00:00 2001 -From: Sebastian Kropatsch -Date: Thu, 11 Jul 2024 12:15:17 +0200 -Subject: [PATCH] board: rockchip: Add FriendlyElec NanoPi R6C - -The NanoPi R6C is a SBC by FriendlyElec based on the Rockchip RK3588s. -It comes with 4GB or 8GB of RAM, a microSD card slot, optional 32GB eMMC -storage, one M.2 M-Key connector, one RTL8211F 1GbE and one RTL8125 -2.5GbE Ethernet port, one USB 2.0 Type-A and one USB 3.0 Type-A port, a -HDMI port, a 30-pin GPIO header as well as multiple buttons and LEDs. - -Add initial support for this board using the upstream devicetree sources. - -Tested in U-Boot proper: -- Booting from eMMC works -- 1GbE Ethernet works using the eth_eqos driver (tested by ping) -- 2.5GbE Ethernet works using the eth_rtl8169 driver (tested by ping), - but the status LEDs on this specific port currently aren't working -- NVMe SSD in M.2 socket does get recognized (tested with `nvme scan` - followed by `nvme details`) - -Kernel commit: -d5f1d7437451 ("arm64: dts: rockchip: Add support for NanoPi R6C") - -Reviewed-by: Quentin Schulz -Reviewed-by: Kever Yang -Signed-off-by: Sebastian Kropatsch ---- - arch/arm/dts/rk3588s-nanopi-r6c-u-boot.dtsi | 3 + - arch/arm/mach-rockchip/rk3588/Kconfig | 13 +++ - board/friendlyelec/nanopi-r6c-rk3588s/Kconfig | 12 +++ - .../nanopi-r6c-rk3588s/MAINTAINERS | 7 ++ - configs/nanopi-r6c-rk3588s_defconfig | 83 +++++++++++++++++++ - doc/board/rockchip/rockchip.rst | 1 + - include/configs/nanopi-r6c-rk3588s.h | 12 +++ - 7 files changed, 131 insertions(+) - create mode 100644 arch/arm/dts/rk3588s-nanopi-r6c-u-boot.dtsi - create mode 100644 board/friendlyelec/nanopi-r6c-rk3588s/Kconfig - create mode 100644 board/friendlyelec/nanopi-r6c-rk3588s/MAINTAINERS - create mode 100644 configs/nanopi-r6c-rk3588s_defconfig - create mode 100644 include/configs/nanopi-r6c-rk3588s.h - ---- /dev/null -+++ b/arch/arm/dts/rk3588s-nanopi-r6c-u-boot.dtsi -@@ -0,0 +1,3 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+ -+#include "rk3588s-u-boot.dtsi" ---- a/arch/arm/mach-rockchip/rk3588/Kconfig -+++ b/arch/arm/mach-rockchip/rk3588/Kconfig -@@ -90,6 +90,18 @@ config TARGET_NANOPI_R6S_RK3588S - 12-pin GPIO FPC connector, a fan connector, IR receiver as well - as some buttons and LEDs. - -+config TARGET_NANOPI_R6C_RK3588S -+ bool "FriendlyElec NanoPi R6C" -+ select BOARD_LATE_INIT -+ help -+ The NanoPi R6C is a SBC by FriendlyElec based on the Rockchip -+ RK3588s. -+ It comes with 4GB or 8GB of RAM, a microSD card slot, optional 32GB -+ eMMC storage, one M.2 M-Key connector, one RTL8211F 1GbE and one -+ RTL8125 2.5GbE Ethernet port, one USB 2.0 Type-A and one USB 3.0 -+ Type-A port, a HDMI port, a 30-pin GPIO header as well as some -+ buttons and LEDs. -+ - config TARGET_NOVA_RK3588 - bool "Indiedroid Nova RK3588" - select BOARD_LATE_INIT -@@ -245,6 +257,7 @@ config TEXT_BASE - source "board/edgeble/neural-compute-module-6/Kconfig" - source "board/friendlyelec/nanopc-t6-rk3588/Kconfig" - source "board/friendlyelec/nanopi-r6s-rk3588s/Kconfig" -+source "board/friendlyelec/nanopi-r6c-rk3588s/Kconfig" - source "board/indiedroid/nova/Kconfig" - source "board/pine64/quartzpro64-rk3588/Kconfig" - source "board/turing/turing-rk1-rk3588/Kconfig" ---- /dev/null -+++ b/board/friendlyelec/nanopi-r6c-rk3588s/Kconfig -@@ -0,0 +1,12 @@ -+if TARGET_NANOPI_R6C_RK3588S -+ -+config SYS_BOARD -+ default "nanopi-r6c-rk3588s" -+ -+config SYS_VENDOR -+ default "friendlyelec" -+ -+config SYS_CONFIG_NAME -+ default "nanopi-r6c-rk3588s" -+ -+endif ---- /dev/null -+++ b/board/friendlyelec/nanopi-r6c-rk3588s/MAINTAINERS -@@ -0,0 +1,7 @@ -+NANOPI-R6C -+M: Sebastian Kropatsch -+S: Maintained -+F: arch/arm/dts/rk3588s-nanopi-r6c-u-boot.dtsi -+F: board/friendlyelec/nanopi-r6c-rk3588s -+F: configs/nanopi-r6c-rk3588s_defconfig -+F: include/configs/nanopi-r6c-rk3588s.h ---- /dev/null -+++ b/configs/nanopi-r6c-rk3588s_defconfig -@@ -0,0 +1,83 @@ -+CONFIG_ARM=y -+CONFIG_SKIP_LOWLEVEL_INIT=y -+CONFIG_SYS_HAS_NONCACHED_MEMORY=y -+CONFIG_COUNTER_FREQUENCY=24000000 -+CONFIG_ARCH_ROCKCHIP=y -+CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3588s-nanopi-r6c" -+CONFIG_ROCKCHIP_RK3588=y -+CONFIG_SPL_SERIAL=y -+CONFIG_TARGET_NANOPI_R6C_RK3588S=y -+CONFIG_DEBUG_UART_BASE=0xFEB50000 -+CONFIG_DEBUG_UART_CLOCK=24000000 -+CONFIG_SYS_LOAD_ADDR=0xc00800 -+CONFIG_PCI=y -+CONFIG_DEBUG_UART=y -+CONFIG_FIT=y -+CONFIG_FIT_VERBOSE=y -+CONFIG_SPL_FIT_SIGNATURE=y -+CONFIG_SPL_LOAD_FIT=y -+CONFIG_LEGACY_IMAGE_FORMAT=y -+CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588s-nanopi-r6c.dtb" -+# CONFIG_DISPLAY_CPUINFO is not set -+CONFIG_DISPLAY_BOARDINFO_LATE=y -+CONFIG_SPL_MAX_SIZE=0x40000 -+CONFIG_SPL_PAD_TO=0x7f8000 -+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set -+CONFIG_SPL_ATF=y -+CONFIG_CMD_GPIO=y -+CONFIG_CMD_PWM=y -+CONFIG_CMD_GPT=y -+CONFIG_CMD_I2C=y -+CONFIG_CMD_MMC=y -+CONFIG_CMD_PCI=y -+CONFIG_CMD_USB=y -+CONFIG_CMD_ROCKUSB=y -+# CONFIG_CMD_SETEXPR is not set -+CONFIG_CMD_REGULATOR=y -+# CONFIG_SPL_DOS_PARTITION is not set -+CONFIG_SPL_OF_CONTROL=y -+CONFIG_OF_LIVE=y -+CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" -+CONFIG_SPL_DM_SEQ_ALIAS=y -+CONFIG_SPL_REGMAP=y -+CONFIG_SPL_SYSCON=y -+CONFIG_SPL_CLK=y -+# CONFIG_USB_FUNCTION_FASTBOOT is not set -+CONFIG_ROCKCHIP_GPIO=y -+CONFIG_SYS_I2C_ROCKCHIP=y -+CONFIG_MISC=y -+CONFIG_SUPPORT_EMMC_RPMB=y -+CONFIG_MMC_DW=y -+CONFIG_MMC_DW_ROCKCHIP=y -+CONFIG_MMC_SDHCI=y -+CONFIG_MMC_SDHCI_SDMA=y -+CONFIG_MMC_SDHCI_ROCKCHIP=y -+# CONFIG_SPI_FLASH is not set -+CONFIG_PHY_REALTEK=y -+CONFIG_DWC_ETH_QOS=y -+CONFIG_DWC_ETH_QOS_ROCKCHIP=y -+CONFIG_RTL8169=y -+CONFIG_NVME_PCI=y -+CONFIG_PCIE_DW_ROCKCHIP=y -+CONFIG_PHY_ROCKCHIP_INNO_USB2=y -+CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY=y -+CONFIG_PHY_ROCKCHIP_USBDP=y -+CONFIG_SPL_PINCTRL=y -+CONFIG_PWM_ROCKCHIP=y -+CONFIG_SPL_RAM=y -+CONFIG_BAUDRATE=1500000 -+CONFIG_DEBUG_UART_SHIFT=2 -+CONFIG_SYS_NS16550_MEM32=y -+CONFIG_SYSRESET=y -+CONFIG_USB=y -+CONFIG_USB_XHCI_HCD=y -+CONFIG_USB_EHCI_HCD=y -+CONFIG_USB_EHCI_GENERIC=y -+CONFIG_USB_OHCI_HCD=y -+CONFIG_USB_OHCI_GENERIC=y -+CONFIG_USB_DWC3=y -+CONFIG_USB_DWC3_GENERIC=y -+CONFIG_USB_GADGET=y -+CONFIG_USB_GADGET_DOWNLOAD=y -+CONFIG_USB_FUNCTION_ROCKUSB=y -+CONFIG_ERRNO_STR=y ---- a/doc/board/rockchip/rockchip.rst -+++ b/doc/board/rockchip/rockchip.rst -@@ -126,6 +126,7 @@ List of mainline supported Rockchip boar - - Edgeble Neural Compute Module 6A SoM - Neu6a (neu6a-io-rk3588) - - Edgeble Neural Compute Module 6B SoM - Neu6b (neu6b-io-rk3588) - - FriendlyElec NanoPC-T6 (nanopc-t6-rk3588) -+ - FriendlyElec NanoPi R6C (nanopi-r6c-rk3588s) - - Generic RK3588S/RK3588 (generic-rk3588) - - Indiedroid Nova (nova-rk3588s) - - Pine64 QuartzPro64 (quartzpro64-rk3588) ---- /dev/null -+++ b/include/configs/nanopi-r6c-rk3588s.h -@@ -0,0 +1,12 @@ -+/* SPDX-License-Identifier: GPL-2.0+ */ -+ -+#ifndef __NANOPI_R6C_RK3588S_H -+#define __NANOPI_R6C_RK3588S_H -+ -+#define ROCKCHIP_DEVICE_SETTINGS \ -+ "stdout=serial,vidconsole\0" \ -+ "stderr=serial,vidconsole\0" -+ -+#include -+ -+#endif /* __NANOPI_R6C_RK3588S_H */ diff --git a/package/boot/uboot-rockchip/patches/108-v2024.10-rc1-board-rockchip-add-ArmSoM-Sige7-Rk3588-board.patch b/package/boot/uboot-rockchip/patches/108-v2024.10-rc1-board-rockchip-add-ArmSoM-Sige7-Rk3588-board.patch deleted file mode 100644 index 7fa4d679e48..00000000000 --- a/package/boot/uboot-rockchip/patches/108-v2024.10-rc1-board-rockchip-add-ArmSoM-Sige7-Rk3588-board.patch +++ /dev/null @@ -1,257 +0,0 @@ -From 40b573e4f6ed629eab54633f8836a2be5e5aa75a Mon Sep 17 00:00:00 2001 -From: Jianfeng Liu -Date: Wed, 29 May 2024 01:04:06 +0800 -Subject: [PATCH] board: rockchip: add ArmSoM Sige7 Rk3588 board - -ArmSoM Sige7 is a Rockchip RK3588 based SBC (Single Board Computer) by -ArmSoM. - -There are two variants depending on the DRAM size : 8G and 16G. - -Specification: - - Rockchip Rk3588 SoC - 4x ARM Cortex-A76, 4x ARM Cortex-A55 - 8/16GB memory LPDDR4x - Mali G610MC4 GPU - 2x MIPI CSI 2 multiple lanes connector - 64GB/128GB on board eMMC - uSD slot - 1x USB 2.0 Type-A, 1x USB 3.0 Type-A, 1x USB 3.0 Type-C - 1x HDMI 2.1 output - 2x 2.5 Gbps Ethernet port - 40-pin IO header including UART, SPI and I2C - USB PD over USB Type-C - Size: 92mm x 62mm - -Kernel commit: -81c828a67c78 (arm64: dts: rockchip: Add ArmSom Sige7 board) - -Signed-off-by: Jianfeng Liu -Reviewed-by: Kever Yang ---- - MAINTAINERS | 1 + - arch/arm/dts/rk3588-armsom-sige7-u-boot.dtsi | 6 ++ - arch/arm/mach-rockchip/rk3588/Kconfig | 26 ++++++ - board/armsom/sige7-rk3588/Kconfig | 12 +++ - board/armsom/sige7-rk3588/MAINTAINERS | 7 ++ - configs/sige7-rk3588_defconfig | 93 ++++++++++++++++++++ - doc/board/rockchip/rockchip.rst | 1 + - include/configs/sige7-rk3588.h | 15 ++++ - 8 files changed, 161 insertions(+) - create mode 100644 arch/arm/dts/rk3588-armsom-sige7-u-boot.dtsi - create mode 100644 board/armsom/sige7-rk3588/Kconfig - create mode 100644 board/armsom/sige7-rk3588/MAINTAINERS - create mode 100644 configs/sige7-rk3588_defconfig - create mode 100644 include/configs/sige7-rk3588.h - ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -533,6 +533,7 @@ F: arch/arm/include/asm/arch-rockchip/ - F: arch/arm/mach-rockchip/ - F: board/amarula/vyasa-rk3288/ - F: board/anbernic/rgxx3_rk3566/ -+F: board/armsom/sige7-rk3588/ - F: board/chipspark/popmetal_rk3288 - F: board/engicam/px30_core/ - F: board/firefly/ ---- /dev/null -+++ b/arch/arm/dts/rk3588-armsom-sige7-u-boot.dtsi -@@ -0,0 +1,6 @@ -+// SPDX-License-Identifier: (GPL-2.0+ OR MIT) -+/* -+ * Copyright (c) 2024 ArmSoM Technology Co., Ltd. -+ */ -+ -+#include "rk3588-u-boot.dtsi" ---- a/arch/arm/mach-rockchip/rk3588/Kconfig -+++ b/arch/arm/mach-rockchip/rk3588/Kconfig -@@ -185,6 +185,31 @@ config TARGET_ROCK5B_RK3588 - USB PD over USB Type-C - Size: 100mm x 72mm (Pico-ITX form factor) - -+config TARGET_SIGE7_RK3588 -+ bool "ArmSoM Sige7 RK3588 board" -+ select BOARD_LATE_INIT -+ help -+ ArmSoM Sige7 is a Rockchip RK3588 based SBC (Single Board Computer) -+ by ArmSoM. -+ -+ There are two variants depending on the DRAM size : 8G and 16G. -+ -+ Specification: -+ -+ Rockchip Rk3588 SoC -+ 4x ARM Cortex-A76, 4x ARM Cortex-A55 -+ 8/16GB memory LPDDR4x -+ Mali G610MC4 GPU -+ 2x MIPI CSI 2 multiple lanes connector -+ 64GB/128GB on board eMMC -+ uSD slot -+ 1x USB 2.0 Type-A, 1x USB 3.0 Type-A, 1x USB 3.0 Type-C -+ 1x HDMI 2.1 output -+ 2x 2.5 Gbps Ethernet port -+ 40-pin IO header including UART, SPI and I2C -+ USB PD over USB Type-C -+ Size: 92mm x 62mm -+ - config TARGET_QUARTZPRO64_RK3588 - bool "Pine64 QuartzPro64 RK3588 board" - select BOARD_LATE_INIT -@@ -254,6 +279,7 @@ config ROCKCHIP_COMMON_STACK_ADDR - config TEXT_BASE - default 0x00a00000 - -+source "board/armsom/sige7-rk3588/Kconfig" - source "board/edgeble/neural-compute-module-6/Kconfig" - source "board/friendlyelec/nanopc-t6-rk3588/Kconfig" - source "board/friendlyelec/nanopi-r6s-rk3588s/Kconfig" ---- /dev/null -+++ b/board/armsom/sige7-rk3588/Kconfig -@@ -0,0 +1,12 @@ -+if TARGET_SIGE7_RK3588 -+ -+config SYS_BOARD -+ default "sige7-rk3588" -+ -+config SYS_VENDOR -+ default "armsom" -+ -+config SYS_CONFIG_NAME -+ default "sige7-rk3588" -+ -+endif ---- /dev/null -+++ b/board/armsom/sige7-rk3588/MAINTAINERS -@@ -0,0 +1,7 @@ -+SIGE7-RK3588 -+M: Jianfeng Liu -+S: Maintained -+F: board/armsom/sige7-rk3588 -+F: include/configs/sige7-rk3588.h -+F: configs/sige7-rk3588_defconfig -+F: arch/arm/dts/rk3588-armsom-sige7* ---- /dev/null -+++ b/configs/sige7-rk3588_defconfig -@@ -0,0 +1,93 @@ -+CONFIG_ARM=y -+CONFIG_SKIP_LOWLEVEL_INIT=y -+CONFIG_SYS_HAS_NONCACHED_MEMORY=y -+CONFIG_COUNTER_FREQUENCY=24000000 -+CONFIG_ARCH_ROCKCHIP=y -+CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3588-armsom-sige7" -+CONFIG_ROCKCHIP_RK3588=y -+CONFIG_SPL_SERIAL=y -+CONFIG_TARGET_SIGE7_RK3588=y -+CONFIG_DEBUG_UART_BASE=0xFEB50000 -+CONFIG_DEBUG_UART_CLOCK=24000000 -+CONFIG_SPL_SPI=y -+CONFIG_SYS_LOAD_ADDR=0xc00800 -+CONFIG_PCI=y -+CONFIG_DEBUG_UART=y -+CONFIG_AHCI=y -+CONFIG_FIT=y -+CONFIG_FIT_VERBOSE=y -+CONFIG_SPL_FIT_SIGNATURE=y -+CONFIG_SPL_LOAD_FIT=y -+CONFIG_LEGACY_IMAGE_FORMAT=y -+CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-armsom-sige7.dtb" -+# CONFIG_DISPLAY_CPUINFO is not set -+CONFIG_DISPLAY_BOARDINFO_LATE=y -+CONFIG_SPL_MAX_SIZE=0x40000 -+CONFIG_SPL_PAD_TO=0x7f8000 -+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set -+CONFIG_SPL_ATF=y -+CONFIG_CMD_GPIO=y -+CONFIG_CMD_GPT=y -+CONFIG_CMD_I2C=y -+CONFIG_CMD_MMC=y -+CONFIG_CMD_PCI=y -+CONFIG_CMD_USB=y -+CONFIG_CMD_ROCKUSB=y -+# CONFIG_CMD_SETEXPR is not set -+CONFIG_CMD_REGULATOR=y -+# CONFIG_SPL_DOS_PARTITION is not set -+CONFIG_SPL_OF_CONTROL=y -+CONFIG_OF_LIVE=y -+CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" -+CONFIG_SPL_DM_SEQ_ALIAS=y -+CONFIG_SPL_REGMAP=y -+CONFIG_SPL_SYSCON=y -+CONFIG_AHCI_PCI=y -+CONFIG_DWC_AHCI=y -+CONFIG_SPL_CLK=y -+# CONFIG_USB_FUNCTION_FASTBOOT is not set -+CONFIG_ROCKCHIP_GPIO=y -+CONFIG_SYS_I2C_ROCKCHIP=y -+CONFIG_MISC=y -+CONFIG_SUPPORT_EMMC_RPMB=y -+CONFIG_MMC_DW=y -+CONFIG_MMC_DW_ROCKCHIP=y -+CONFIG_MMC_SDHCI=y -+CONFIG_MMC_SDHCI_SDMA=y -+CONFIG_MMC_SDHCI_ROCKCHIP=y -+CONFIG_PHYLIB=y -+CONFIG_RTL8169=y -+CONFIG_NVME_PCI=y -+CONFIG_PCIE_DW_ROCKCHIP=y -+CONFIG_PHY_ROCKCHIP_INNO_USB2=y -+CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY=y -+CONFIG_PHY_ROCKCHIP_USBDP=y -+CONFIG_SPL_PINCTRL=y -+CONFIG_PWM_ROCKCHIP=y -+CONFIG_SPL_RAM=y -+CONFIG_SCSI=y -+CONFIG_BAUDRATE=1500000 -+CONFIG_DEBUG_UART_SHIFT=2 -+CONFIG_SYS_NS16550_MEM32=y -+CONFIG_SYSRESET=y -+CONFIG_USB=y -+CONFIG_USB_XHCI_HCD=y -+CONFIG_USB_EHCI_HCD=y -+CONFIG_USB_EHCI_GENERIC=y -+CONFIG_USB_OHCI_HCD=y -+CONFIG_USB_OHCI_GENERIC=y -+CONFIG_USB_DWC3=y -+CONFIG_USB_DWC3_GENERIC=y -+CONFIG_SPL_USB_DWC3_GENERIC=y -+CONFIG_USB_HOST_ETHER=y -+CONFIG_USB_ETHER_ASIX=y -+CONFIG_USB_ETHER_ASIX88179=y -+CONFIG_USB_ETHER_LAN75XX=y -+CONFIG_USB_ETHER_LAN78XX=y -+CONFIG_USB_ETHER_MCS7830=y -+CONFIG_USB_ETHER_RTL8152=y -+CONFIG_USB_ETHER_SMSC95XX=y -+CONFIG_USB_GADGET=y -+CONFIG_USB_GADGET_DOWNLOAD=y -+CONFIG_USB_FUNCTION_ROCKUSB=y -+CONFIG_ERRNO_STR=y ---- a/doc/board/rockchip/rockchip.rst -+++ b/doc/board/rockchip/rockchip.rst -@@ -122,6 +122,7 @@ List of mainline supported Rockchip boar - - Radxa ROCK 3B (rock-3b-rk3568) - - * rk3588 -+ - ArmSoM Sige7 (sige7-rk3588) - - Rockchip EVB (evb-rk3588) - - Edgeble Neural Compute Module 6A SoM - Neu6a (neu6a-io-rk3588) - - Edgeble Neural Compute Module 6B SoM - Neu6b (neu6b-io-rk3588) ---- /dev/null -+++ b/include/configs/sige7-rk3588.h -@@ -0,0 +1,15 @@ -+/* SPDX-License-Identifier: GPL-2.0+ */ -+/* -+ * Copyright (c) 2024 ArmSoM Technology Co., Ltd. -+ */ -+ -+#ifndef __SIGE7_RK3588_H -+#define __SIGE7_RK3588_H -+ -+#define ROCKCHIP_DEVICE_SETTINGS \ -+ "stdout=serial,vidconsole\0" \ -+ "stderr=serial,vidconsole\0" -+ -+#include -+ -+#endif /* __SIGE7_RK3588_H */ diff --git a/package/devel/gdb/Makefile b/package/devel/gdb/Makefile index cf897b79f27..366746be87f 100644 --- a/package/devel/gdb/Makefile +++ b/package/devel/gdb/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gdb -PKG_VERSION:=14.1 +PKG_VERSION:=15.2 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/gdb -PKG_HASH:=d66df51276143451fcbff464cc8723d68f1e9df45a6a2d5635a54e71643edb80 +PKG_HASH:=83350ccd35b5b5a0cba6b334c41294ea968158c573940904f00b92f76345314d PKG_BUILD_PARALLEL:=1 PKG_INSTALL:=1 diff --git a/package/devel/gdb/patches/001-gdb-pr14523-mips-signal-number.patch b/package/devel/gdb/patches/001-gdb-pr14523-mips-signal-number.patch deleted file mode 100644 index b8e7b10fc98..00000000000 --- a/package/devel/gdb/patches/001-gdb-pr14523-mips-signal-number.patch +++ /dev/null @@ -1,16 +0,0 @@ -See http://sourceware.org/bugzilla/show_bug.cgi?id=14523 - ---- a/gdbsupport/signals.cc -+++ b/gdbsupport/signals.cc -@@ -348,6 +348,11 @@ gdb_signal_from_host (int hostsig) - else if (64 <= hostsig && hostsig <= 127) - return (enum gdb_signal) - (hostsig - 64 + (int) GDB_SIGNAL_REALTIME_64); -+ else if (hostsig == 128) -+ /* Some platforms, such as Linux MIPS, have NSIG == 128, in which case -+ signal 128 is the highest realtime signal. There is no constant for -+ that though. */ -+ return GDB_SIGNAL_UNKNOWN; - else - error (_("GDB bug: target.c (gdb_signal_from_host): " - "unrecognized real-time signal")); diff --git a/package/devel/gdb/patches/110-shared_libgcc.patch b/package/devel/gdb/patches/110-shared_libgcc.patch index 1a02ad11603..d9dcafe0e00 100644 --- a/package/devel/gdb/patches/110-shared_libgcc.patch +++ b/package/devel/gdb/patches/110-shared_libgcc.patch @@ -1,6 +1,6 @@ --- a/configure.ac +++ b/configure.ac -@@ -1400,13 +1400,13 @@ if test -z "$LD"; then +@@ -1401,13 +1401,13 @@ if test -z "$LD"; then fi fi @@ -17,7 +17,7 @@ AC_LANG_PUSH(C++) AC_LINK_IFELSE([AC_LANG_SOURCE([ #if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) -@@ -1836,7 +1836,7 @@ AC_ARG_WITH(stage1-ldflags, +@@ -1837,7 +1837,7 @@ AC_ARG_WITH(stage1-ldflags, # trust that they are doing what they want. if test "$with_static_standard_libraries" = yes -a "$stage1_libs" = "" \ -a "$have_static_libs" = yes; then @@ -26,18 +26,18 @@ fi]) AC_SUBST(stage1_ldflags) -@@ -1865,7 +1865,7 @@ AC_ARG_WITH(boot-ldflags, +@@ -1866,7 +1866,7 @@ AC_ARG_WITH(boot-ldflags, # statically. But if the user explicitly specified the libraries to # use, trust that they are doing what they want. if test "$poststage1_libs" = ""; then - poststage1_ldflags="-static-libstdc++ -static-libgcc" + poststage1_ldflags="-static-libstdc++" fi]) - AC_SUBST(poststage1_ldflags) - + case $target in + *-darwin2* | *-darwin1[[56789]]*) --- a/configure +++ b/configure -@@ -5413,14 +5413,14 @@ if test -z "$LD"; then +@@ -5414,14 +5414,14 @@ if test -z "$LD"; then fi fi @@ -56,7 +56,7 @@ ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -@@ -8464,7 +8464,7 @@ else +@@ -8465,7 +8465,7 @@ else # trust that they are doing what they want. if test "$with_static_standard_libraries" = yes -a "$stage1_libs" = "" \ -a "$have_static_libs" = yes; then @@ -65,7 +65,7 @@ fi fi -@@ -8500,7 +8500,7 @@ else +@@ -8501,7 +8501,7 @@ else # statically. But if the user explicitly specified the libraries to # use, trust that they are doing what they want. if test "$poststage1_libs" = ""; then diff --git a/package/devel/gdb/patches/120-sigprocmask-invalid-call.patch b/package/devel/gdb/patches/120-sigprocmask-invalid-call.patch index 1ac8f5f2ce3..0796c34c76b 100644 --- a/package/devel/gdb/patches/120-sigprocmask-invalid-call.patch +++ b/package/devel/gdb/patches/120-sigprocmask-invalid-call.patch @@ -27,7 +27,7 @@ gdb/ChangeLog: --- a/gdbsupport/signals-state-save-restore.cc +++ b/gdbsupport/signals-state-save-restore.cc -@@ -38,7 +38,7 @@ save_original_signals_state (bool quiet) +@@ -37,7 +37,7 @@ save_original_signals_state (bool quiet) int i; int res; diff --git a/package/devel/gdb/patches/130-gdb-ctrl-c.patch b/package/devel/gdb/patches/130-gdb-ctrl-c.patch deleted file mode 100644 index 5272b7e9698..00000000000 --- a/package/devel/gdb/patches/130-gdb-ctrl-c.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 63df98fa78c8a6e12b40ebdc5c155838d2bf8b5f Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Thu, 29 Nov 2018 18:00:23 -0800 -Subject: [PATCH 11/11] gdbserver ctrl-c handling - -This problem was created by the upstream commit 78708b7c8c -After applying the commit, it will send SIGINT to the process -group(-signal_pid). -But if we use gdbserver send SIGINT, and the attached process is not a -process -group leader, then the "kill (-signal_pid, SIGINT)" returns error and -fails to -interrupt the attached process. - -Upstream-Status: Submitted -[https://sourceware.org/bugzilla/show_bug.cgi?id=18945] - -Author: Josh Gao -Signed-off-by: Zhixiong Chi -Signed-off-by: Khem Raj ---- - gdbserver/linux-low.cc | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/gdbserver/linux-low.cc -+++ b/gdbserver/linux-low.cc -@@ -5481,7 +5481,7 @@ linux_process_target::request_interrupt - { - /* Send a SIGINT to the process group. This acts just like the user - typed a ^C on the controlling terminal. */ -- int res = ::kill (-signal_pid, SIGINT); -+ int res = ::kill (signal_pid, SIGINT); - if (res == -1) - warning (_("Sending SIGINT to process group of pid %ld failed: %s"), - signal_pid, safe_strerror (errno)); diff --git a/package/devel/gdb/patches/140-sgidefs.patch b/package/devel/gdb/patches/140-sgidefs.patch index 05b30f52425..1753e9bb850 100644 --- a/package/devel/gdb/patches/140-sgidefs.patch +++ b/package/devel/gdb/patches/140-sgidefs.patch @@ -19,7 +19,7 @@ Signed-off-by: Andre McCurdy --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c -@@ -31,7 +31,7 @@ +@@ -30,7 +30,7 @@ #include "gdb_proc_service.h" #include "gregset.h" diff --git a/package/devel/gdb/patches/150-mips64.patch b/package/devel/gdb/patches/150-mips64.patch index 65418fd290f..41c267bcf60 100644 --- a/package/devel/gdb/patches/150-mips64.patch +++ b/package/devel/gdb/patches/150-mips64.patch @@ -18,7 +18,7 @@ Upstream-Status: Pending --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c -@@ -42,6 +42,11 @@ +@@ -41,6 +41,11 @@ #define PTRACE_GET_THREAD_AREA 25 #endif diff --git a/package/devel/strace/Makefile b/package/devel/strace/Makefile index c4c395566b8..f418bea5a72 100644 --- a/package/devel/strace/Makefile +++ b/package/devel/strace/Makefile @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=strace -PKG_VERSION:=6.7 +PKG_VERSION:=6.11 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://strace.io/files/$(PKG_VERSION) -PKG_HASH:=2090201e1a3ff32846f4fe421c1163b15f440bb38e31355d09f82d3949922af7 +PKG_HASH:=83262583a3529f02c3501aa8b8ac772b4cbc03dc934e98bab6e4883626e283a5 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=LGPL-2.1-or-later diff --git a/package/devel/valgrind/Makefile b/package/devel/valgrind/Makefile index 9f8a2e9e79a..313df759219 100644 --- a/package/devel/valgrind/Makefile +++ b/package/devel/valgrind/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=valgrind -PKG_VERSION:=3.22.0 +PKG_VERSION:=3.23.0 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://sourceware.org/pub/valgrind/ -PKG_HASH:=c811db5add2c5f729944caf47c4e7a65dcaabb9461e472b578765dd7bf6d2d4c +PKG_HASH:=c5c34a3380457b9b75606df890102e7df2c702b9420c2ebef9540f8b5d56264d PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0+ @@ -97,17 +97,14 @@ else BITS := 32bit endif +ifeq ($(CONFIG_arm_v7),y) + CONFIGURE_ARGS += --host=armv7-openwrt-linux$(if $(TARGET_SUFFIX),-$(TARGET_SUFFIX)) +endif + CONFIGURE_ARGS += \ --enable-lto \ --enable-tls \ - --without-x \ --without-mpicc \ - --without-uiout \ - --disable-valgrindmi \ - --disable-tui \ - --disable-valgrindtk \ - --without-included-gettext \ - --with-pagesize=4 \ define Package/valgrind/install $(INSTALL_DIR) $(1)/usr/bin diff --git a/package/devel/valgrind/patches/010-486180-Valgrind-MIPS-VexGuestArchState-has-no-member.patch b/package/devel/valgrind/patches/010-486180-Valgrind-MIPS-VexGuestArchState-has-no-member.patch new file mode 100644 index 00000000000..912ac388312 --- /dev/null +++ b/package/devel/valgrind/patches/010-486180-Valgrind-MIPS-VexGuestArchState-has-no-member.patch @@ -0,0 +1,61 @@ +From 7214886886bce9029f325214156c02dcfff760d5 Mon Sep 17 00:00:00 2001 +From: Paul Floyd +Date: Sat, 27 Apr 2024 13:07:07 +0200 +Subject: 486180 - [Valgrind][MIPS] 'VexGuestArchState' has no member named + 'guest_IP_AT_SYSCALL' + +--- + NEWS | 34 ++++++++++++++++++++++++++++++++++ + VEX/priv/guest_mips_helpers.c | 4 ++++ + VEX/pub/libvex_guest_mips32.h | 6 +++--- + VEX/pub/libvex_guest_mips64.h | 2 ++ + configure.ac | 6 +++--- + 5 files changed, 46 insertions(+), 6 deletions(-) + +--- a/VEX/priv/guest_mips_helpers.c ++++ b/VEX/priv/guest_mips_helpers.c +@@ -187,6 +187,8 @@ void LibVEX_GuestMIPS32_initialise( /*OU + vex_state->guest_w1.w64[1] = 0; + vex_state->guest_w2.w64[0] = 0; + vex_state->guest_w2.w64[1] = 0; ++ ++ vex_state->guest_IP_AT_SYSCALL = 0; + } + + void LibVEX_GuestMIPS64_initialise ( /*OUT*/ VexGuestMIPS64State * vex_state ) +@@ -294,6 +296,8 @@ void LibVEX_GuestMIPS64_initialise ( /*O + vex_state->guest_LLaddr = 0xFFFFFFFFFFFFFFFFULL; + vex_state->guest_LLdata = 0; + ++ vex_state->guest_IP_AT_SYSCALL = 0; ++ + vex_state->guest_MSACSR = 0; + } + +--- a/VEX/pub/libvex_guest_mips32.h ++++ b/VEX/pub/libvex_guest_mips32.h +@@ -188,10 +188,10 @@ typedef + + /* 1016 */ UInt guest_MSACSR; + +- /* 1020 */ UInt _padding3; ++ /* 1020 */ UInt guest_IP_AT_SYSCALL; + +- /* 1020 */ ULong guest_LLdata64; +- /* 1028 */ ULong _padding4; ++ /* 1024 */ ULong guest_LLdata64; ++ /* 1032 */ ULong _padding3; + } VexGuestMIPS32State; + /*---------------------------------------------------------------*/ + /*--- Utility functions for MIPS32 guest stuff. ---*/ +--- a/VEX/pub/libvex_guest_mips64.h ++++ b/VEX/pub/libvex_guest_mips64.h +@@ -184,6 +184,8 @@ typedef + /* 1144 */ UInt guest_MSACSR; + + /* 1148 */ UInt _padding2; ++ /* 1152 */ ULong guest_IP_AT_SYSCALL; ++ /* 1160 */ ULong _padding3; + + } VexGuestMIPS64State; + diff --git a/package/devel/valgrind/patches/010-mips-Fix-new-syscall-numbers.patch b/package/devel/valgrind/patches/010-mips-Fix-new-syscall-numbers.patch deleted file mode 100644 index 5967b0cadac..00000000000 --- a/package/devel/valgrind/patches/010-mips-Fix-new-syscall-numbers.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 82e935c564699456a766044faa39367b47cce793 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sun, 31 Oct 2021 23:11:11 +0100 -Subject: [PATCH] mips: Fix new syscall numbers - -The MIPS32 and MIPS64 O32 ABI are adding 4000 to all syscall numbers. -The MIPS64 N64 ABI adds 5000 to each syscall and the MIPS64 N32 ABI adds -6000 to each syscall number. We can not use the shared file for MIPS and -have to define this for each sycall separately. - -Without this change valgrind is not able to detect new syscalls like -clock_gettime64 correctly. - -Signed-off-by: Hauke Mehrtens ---- - include/pub_tool_vkiscnums_asm.h | 3 -- - include/vki/vki-scnums-mips32-linux.h | 40 +++++++++++++++++++++++++++ - include/vki/vki-scnums-mips64-linux.h | 40 +++++++++++++++++++++++++++ - 3 files changed, 80 insertions(+), 3 deletions(-) - ---- a/include/pub_tool_vkiscnums_asm.h -+++ b/include/pub_tool_vkiscnums_asm.h -@@ -63,15 +63,12 @@ - # include "vki/vki-scnums-arm64-linux.h" - - #elif defined(VGP_mips32_linux) --# include "vki/vki-scnums-shared-linux.h" --# include "vki/vki-scnums-32bit-linux.h" - # include "vki/vki-scnums-mips32-linux.h" - - #elif defined(VGP_nanomips_linux) - # include "vki/vki-scnums-nanomips-linux.h" - - #elif defined(VGP_mips64_linux) --# include "vki/vki-scnums-shared-linux.h" - # include "vki/vki-scnums-mips64-linux.h" - - #elif defined(VGP_x86_freebsd) || defined(VGP_amd64_freebsd) ---- a/include/vki/vki-scnums-mips32-linux.h -+++ b/include/vki/vki-scnums-mips32-linux.h -@@ -401,6 +401,46 @@ - #define __NR_pkey_free (__NR_Linux + 365) - #define __NR_statx (__NR_Linux + 366) - -+#define __NR_clock_gettime64 (__NR_Linux + 403) -+#define __NR_clock_settime64 (__NR_Linux + 404) -+#define __NR_clock_adjtime64 (__NR_Linux + 405) -+#define __NR_clock_getres_time64 (__NR_Linux + 406) -+#define __NR_clock_nanosleep_time64 (__NR_Linux + 407) -+#define __NR_timer_gettime64 (__NR_Linux + 408) -+#define __NR_timer_settime64 (__NR_Linux + 409) -+#define __NR_timerfd_gettime64 (__NR_Linux + 410) -+#define __NR_timerfd_settime64 (__NR_Linux + 411) -+#define __NR_utimensat_time64 (__NR_Linux + 412) -+#define __NR_pselect6_time64 (__NR_Linux + 413) -+#define __NR_ppoll_time64 (__NR_Linux + 414) -+#define __NR_io_pgetevents_time64 (__NR_Linux + 416) -+#define __NR_recvmmsg_time64 (__NR_Linux + 417) -+#define __NR_mq_timedsend_time64 (__NR_Linux + 418) -+#define __NR_mq_timedreceive_time64 (__NR_Linux + 419) -+#define __NR_semtimedop_time64 (__NR_Linux + 420) -+#define __NR_rt_sigtimedwait_time64 (__NR_Linux + 421) -+#define __NR_futex_time64 (__NR_Linux + 422) -+#define __NR_sched_rr_get_interval_time64 (__NR_Linux + 423) -+#define __NR_pidfd_send_signal (__NR_Linux + 424) -+#define __NR_io_uring_setup (__NR_Linux + 425) -+#define __NR_io_uring_enter (__NR_Linux + 426) -+#define __NR_io_uring_register (__NR_Linux + 427) -+#define __NR_open_tree (__NR_Linux + 428) -+#define __NR_move_mount (__NR_Linux + 429) -+#define __NR_fsopen (__NR_Linux + 430) -+#define __NR_fsconfig (__NR_Linux + 431) -+#define __NR_fsmount (__NR_Linux + 432) -+#define __NR_fspick (__NR_Linux + 433) -+ -+#define __NR_pidfd_open (__NR_Linux + 434) -+#define __NR_clone3 (__NR_Linux + 435) -+#define __NR_close_range (__NR_Linux + 436) -+#define __NR_openat2 (__NR_Linux + 437) -+ -+#define __NR_faccessat2 (__NR_Linux + 439) -+ -+#define __NR_epoll_pwait2 (__NR_Linux + 441) -+ - /* - * Offset of the last Linux o32 flavoured syscall - */ ---- a/include/vki/vki-scnums-mips64-linux.h -+++ b/include/vki/vki-scnums-mips64-linux.h -@@ -363,6 +363,26 @@ - #define __NR_pkey_free (__NR_Linux + 325) - #define __NR_statx (__NR_Linux + 326) - -+#define __NR_pidfd_send_signal (__NR_Linux + 424) -+#define __NR_io_uring_setup (__NR_Linux + 425) -+#define __NR_io_uring_enter (__NR_Linux + 426) -+#define __NR_io_uring_register (__NR_Linux + 427) -+#define __NR_open_tree (__NR_Linux + 428) -+#define __NR_move_mount (__NR_Linux + 429) -+#define __NR_fsopen (__NR_Linux + 430) -+#define __NR_fsconfig (__NR_Linux + 431) -+#define __NR_fsmount (__NR_Linux + 432) -+#define __NR_fspick (__NR_Linux + 433) -+ -+#define __NR_pidfd_open (__NR_Linux + 434) -+#define __NR_clone3 (__NR_Linux + 435) -+#define __NR_close_range (__NR_Linux + 436) -+#define __NR_openat2 (__NR_Linux + 437) -+ -+#define __NR_faccessat2 (__NR_Linux + 439) -+ -+#define __NR_epoll_pwait2 (__NR_Linux + 441) -+ - #elif defined(VGABI_N32) - - /* -@@ -702,6 +722,26 @@ - #define __NR_pkey_free (__NR_Linux + 329) - #define __NR_statx (__NR_Linux + 330) - -+#define __NR_pidfd_send_signal (__NR_Linux + 424) -+#define __NR_io_uring_setup (__NR_Linux + 425) -+#define __NR_io_uring_enter (__NR_Linux + 426) -+#define __NR_io_uring_register (__NR_Linux + 427) -+#define __NR_open_tree (__NR_Linux + 428) -+#define __NR_move_mount (__NR_Linux + 429) -+#define __NR_fsopen (__NR_Linux + 430) -+#define __NR_fsconfig (__NR_Linux + 431) -+#define __NR_fsmount (__NR_Linux + 432) -+#define __NR_fspick (__NR_Linux + 433) -+ -+#define __NR_pidfd_open (__NR_Linux + 434) -+#define __NR_clone3 (__NR_Linux + 435) -+#define __NR_close_range (__NR_Linux + 436) -+#define __NR_openat2 (__NR_Linux + 437) -+ -+#define __NR_faccessat2 (__NR_Linux + 439) -+ -+#define __NR_epoll_pwait2 (__NR_Linux + 441) -+ - #else - #error unknown mips64 abi - #endif diff --git a/package/devel/valgrind/patches/020-mips-skip-using-shared-syscall-numbers-for-mips32.patch b/package/devel/valgrind/patches/020-mips-skip-using-shared-syscall-numbers-for-mips32.patch new file mode 100644 index 00000000000..a519341887c --- /dev/null +++ b/package/devel/valgrind/patches/020-mips-skip-using-shared-syscall-numbers-for-mips32.patch @@ -0,0 +1,159 @@ +From 54d6ad3348fb50f5b972fe9c05d0d8757bfe73ba Mon Sep 17 00:00:00 2001 +From: Aleksandar Rikalo +Date: Fri, 10 May 2024 17:59:28 +0200 +Subject: mips: skip using shared syscall numbers for mips32 + +mips does not use shared syscall numbers, so we can not use +vki-scnums-shared-linux.h. + +This partially fixes KDE #444781. + +Signed-off-by: Hauke Mehrtens +Signed-off-by: Aleksandar Rikalo +--- + coregrind/m_syswrap/syswrap-mips32-linux.c | 1 + + include/pub_tool_vkiscnums_asm.h | 2 - + include/vki/vki-scnums-mips32-linux.h | 105 ++++++++++++++++----- + 3 files changed, 83 insertions(+), 25 deletions(-) + +--- a/coregrind/m_syswrap/syswrap-mips32-linux.c ++++ b/coregrind/m_syswrap/syswrap-mips32-linux.c +@@ -1110,6 +1110,7 @@ static SyscallTableEntry syscall_main_ta + LINX_ (__NR_pwritev2, sys_pwritev2), // 362 + //.. + LINXY(__NR_statx, sys_statx), // 366 ++ GENX_(__NR_rseq, sys_ni_syscall), // 367 + + LINXY(__NR_clock_gettime64, sys_clock_gettime64), // 403 + LINX_(__NR_clock_settime64, sys_clock_settime64), // 404 +--- a/include/pub_tool_vkiscnums_asm.h ++++ b/include/pub_tool_vkiscnums_asm.h +@@ -63,8 +63,6 @@ + # include "vki/vki-scnums-arm64-linux.h" + + #elif defined(VGP_mips32_linux) +-# include "vki/vki-scnums-shared-linux.h" +-# include "vki/vki-scnums-32bit-linux.h" + # include "vki/vki-scnums-mips32-linux.h" + + #elif defined(VGP_nanomips_linux) +--- a/include/vki/vki-scnums-mips32-linux.h ++++ b/include/vki/vki-scnums-mips32-linux.h +@@ -380,35 +380,94 @@ + #define __NR_setns (__NR_Linux + 343) + #define __NR_process_vm_readv (__NR_Linux + 345) + #define __NR_process_vm_writev (__NR_Linux + 346) +-#define __NR_kcmp (__NR_Linux + 347) +-#define __NR_finit_module (__NR_Linux + 348) +-#define __NR_sched_setattr (__NR_Linux + 349) +-#define __NR_sched_getattr (__NR_Linux + 350) +-#define __NR_renameat2 (__NR_Linux + 351) +-#define __NR_seccomp (__NR_Linux + 352) +-#define __NR_getrandom (__NR_Linux + 353) +-#define __NR_memfd_create (__NR_Linux + 354) +-#define __NR_bpf (__NR_Linux + 355) +-#define __NR_execveat (__NR_Linux + 356) +-#define __NR_userfaultfd (__NR_Linux + 357) +-#define __NR_membarrier (__NR_Linux + 358) +-#define __NR_mlock2 (__NR_Linux + 359) +-#define __NR_copy_file_range (__NR_Linux + 360) +-#define __NR_preadv2 (__NR_Linux + 361) +-#define __NR_pwritev2 (__NR_Linux + 362) +-#define __NR_pkey_mprotect (__NR_Linux + 363) +-#define __NR_pkey_alloc (__NR_Linux + 364) +-#define __NR_pkey_free (__NR_Linux + 365) +-#define __NR_statx (__NR_Linux + 366) +- ++#define __NR_kcmp (__NR_Linux + 347) ++#define __NR_finit_module (__NR_Linux + 348) ++#define __NR_sched_setattr (__NR_Linux + 349) ++#define __NR_sched_getattr (__NR_Linux + 350) ++#define __NR_renameat2 (__NR_Linux + 351) ++#define __NR_seccomp (__NR_Linux + 352) ++#define __NR_getrandom (__NR_Linux + 353) ++#define __NR_memfd_create (__NR_Linux + 354) ++#define __NR_bpf (__NR_Linux + 355) ++#define __NR_execveat (__NR_Linux + 356) ++#define __NR_userfaultfd (__NR_Linux + 357) ++#define __NR_membarrier (__NR_Linux + 358) ++#define __NR_mlock2 (__NR_Linux + 359) ++#define __NR_copy_file_range (__NR_Linux + 360) ++#define __NR_preadv2 (__NR_Linux + 361) ++#define __NR_pwritev2 (__NR_Linux + 362) ++#define __NR_pkey_mprotect (__NR_Linux + 363) ++#define __NR_pkey_alloc (__NR_Linux + 364) ++#define __NR_pkey_free (__NR_Linux + 365) ++#define __NR_statx (__NR_Linux + 366) ++#define __NR_rseq (__NR_Linux + 367) ++#define __NR_io_pgetevents (__NR_Linux + 368) ++#define __NR_semget (__NR_Linux + 393) ++#define __NR_semctl (__NR_Linux + 394) ++#define __NR_shmget (__NR_Linux + 395) ++#define __NR_shmctl (__NR_Linux + 396) ++#define __NR_shmat (__NR_Linux + 397) ++#define __NR_shmdt (__NR_Linux + 398) ++#define __NR_msgget (__NR_Linux + 399) ++#define __NR_msgsnd (__NR_Linux + 400) ++#define __NR_msgrcv (__NR_Linux + 401) ++#define __NR_msgctl (__NR_Linux + 402) ++#define __NR_clock_gettime64 (__NR_Linux + 403) ++#define __NR_clock_settime64 (__NR_Linux + 404) ++#define __NR_clock_adjtime64 (__NR_Linux + 405) ++#define __NR_clock_getres_time64 (__NR_Linux + 406) ++#define __NR_clock_nanosleep_time64 (__NR_Linux + 407) ++#define __NR_timer_gettime64 (__NR_Linux + 408) ++#define __NR_timer_settime64 (__NR_Linux + 409) ++#define __NR_timerfd_gettime64 (__NR_Linux + 410) ++#define __NR_timerfd_settime64 (__NR_Linux + 411) ++#define __NR_utimensat_time64 (__NR_Linux + 412) ++#define __NR_pselect6_time64 (__NR_Linux + 413) ++#define __NR_ppoll_time64 (__NR_Linux + 414) ++#define __NR_io_pgetevents_time64 (__NR_Linux + 416) ++#define __NR_recvmmsg_time64 (__NR_Linux + 417) ++#define __NR_mq_timedsend_time64 (__NR_Linux + 418) ++#define __NR_mq_timedreceive_time64 (__NR_Linux + 419) ++#define __NR_semtimedop_time64 (__NR_Linux + 420) ++#define __NR_rt_sigtimedwait_time64 (__NR_Linux + 421) ++#define __NR_futex_time64 (__NR_Linux + 422) ++#define __NR_sched_rr_get_interval_time64 (__NR_Linux + 423) ++#define __NR_pidfd_send_signal (__NR_Linux + 424) ++#define __NR_io_uring_setup (__NR_Linux + 425) ++#define __NR_io_uring_enter (__NR_Linux + 426) ++#define __NR_io_uring_register (__NR_Linux + 427) ++#define __NR_open_tree (__NR_Linux + 428) ++#define __NR_move_mount (__NR_Linux + 429) ++#define __NR_fsopen (__NR_Linux + 430) ++#define __NR_fsconfig (__NR_Linux + 431) ++#define __NR_fsmount (__NR_Linux + 432) ++#define __NR_fspick (__NR_Linux + 433) ++#define __NR_pidfd_open (__NR_Linux + 434) ++#define __NR_clone3 (__NR_Linux + 435) ++#define __NR_close_range (__NR_Linux + 436) ++#define __NR_openat2 (__NR_Linux + 437) ++#define __NR_pidfd_getfd (__NR_Linux + 438) ++#define __NR_faccessat2 (__NR_Linux + 439) ++#define __NR_process_madvise (__NR_Linux + 440) ++#define __NR_epoll_pwait2 (__NR_Linux + 441) ++#define __NR_mount_setattr (__NR_Linux + 442) ++#define __NR_quotactl_fd (__NR_Linux + 443) ++#define __NR_landlock_create_ruleset (__NR_Linux + 444) ++#define __NR_landlock_add_rule (__NR_Linux + 445) ++#define __NR_landlock_restrict_self (__NR_Linux + 446) ++#define __NR_process_mrelease (__NR_Linux + 448) ++#define __NR_futex_waitv (__NR_Linux + 449) ++#define __NR_set_mempolicy_home_node (__NR_Linux + 450) ++#define __NR_cachestat (__NR_Linux + 451) ++#define __NR_fchmodat2 (__NR_Linux + 452) + /* + * Offset of the last Linux o32 flavoured syscall + */ +-#define __NR_Linux_syscalls 366 ++#define __NR_Linux_syscalls 366 + + + #define __NR_O32_Linux 4000 +-#define __NR_O32_Linux_syscalls 366 ++#define __NR_O32_Linux_syscalls 366 + + + #endif /* __VKI_SCNUMS_MIPS32_LINUX_H */ diff --git a/package/devel/valgrind/patches/021-mips-skip-using-shared-syscall-numbers-for-mips64.patch b/package/devel/valgrind/patches/021-mips-skip-using-shared-syscall-numbers-for-mips64.patch new file mode 100644 index 00000000000..759c5fdcd0b --- /dev/null +++ b/package/devel/valgrind/patches/021-mips-skip-using-shared-syscall-numbers-for-mips64.patch @@ -0,0 +1,152 @@ +From efaa17e53a750d5f0f4c138b507b1b104729ed67 Mon Sep 17 00:00:00 2001 +From: Petar Jovanovic +Date: Mon, 24 Jun 2024 10:33:46 +0000 +Subject: mips: skip using shared syscall numbers for mips64 + +mips does not use shared syscall numbers, so we can not use +vki-scnums-shared-linux.h. + +This fixes KDE #444781. + +Signed-off-by: Hauke Mehrtens +Signed-off-by: Aleksandar Rikalo +--- + coregrind/m_syswrap/syswrap-mips64-linux.c | 1 + + include/pub_tool_vkiscnums_asm.h | 1 - + include/vki/vki-scnums-mips64-linux.h | 98 ++++++++++++++++++++++ + 3 files changed, 99 insertions(+), 1 deletion(-) + +--- a/coregrind/m_syswrap/syswrap-mips64-linux.c ++++ b/coregrind/m_syswrap/syswrap-mips64-linux.c +@@ -813,6 +813,7 @@ static SyscallTableEntry syscall_main_ta + LINX_ (__NR_pwritev2, sys_pwritev2), + LINX_ (__NR_syncfs, sys_syncfs), + LINXY (__NR_statx, sys_statx), ++ GENX_ (__NR_rseq, sys_ni_syscall), + LINX_ (__NR_setns, sys_setns), + LINXY (__NR_io_uring_setup, sys_io_uring_setup), + LINXY (__NR_io_uring_enter, sys_io_uring_enter), +--- a/include/pub_tool_vkiscnums_asm.h ++++ b/include/pub_tool_vkiscnums_asm.h +@@ -70,7 +70,6 @@ + # include "vki/vki-scnums-shared-linux.h" + + #elif defined(VGP_mips64_linux) +-# include "vki/vki-scnums-shared-linux.h" + # include "vki/vki-scnums-mips64-linux.h" + + #elif defined(VGP_x86_freebsd) || defined(VGP_amd64_freebsd) || defined(VGP_arm64_freebsd) +--- a/include/vki/vki-scnums-mips64-linux.h ++++ b/include/vki/vki-scnums-mips64-linux.h +@@ -362,6 +362,45 @@ + #define __NR_pkey_alloc (__NR_Linux + 324) + #define __NR_pkey_free (__NR_Linux + 325) + #define __NR_statx (__NR_Linux + 326) ++#define __NR_rseq (__NR_Linux + 327) ++#define __NR_io_pgetevents (__NR_Linux + 328) ++#define __NR_pidfd_send_signal (__NR_Linux + 424) ++#define __NR_io_uring_setup (__NR_Linux + 425) ++#define __NR_io_uring_enter (__NR_Linux + 426) ++#define __NR_io_uring_register (__NR_Linux + 427) ++#define __NR_open_tree (__NR_Linux + 428) ++#define __NR_move_mount (__NR_Linux + 429) ++#define __NR_fsopen (__NR_Linux + 430) ++#define __NR_fsconfig (__NR_Linux + 431) ++#define __NR_fsmount (__NR_Linux + 432) ++#define __NR_fspick (__NR_Linux + 433) ++#define __NR_pidfd_open (__NR_Linux + 434) ++#define __NR_clone3 (__NR_Linux + 435) ++#define __NR_close_range (__NR_Linux + 436) ++#define __NR_openat2 (__NR_Linux + 437) ++#define __NR_pidfd_getfd (__NR_Linux + 438) ++#define __NR_faccessat2 (__NR_Linux + 439) ++#define __NR_process_madvise (__NR_Linux + 440) ++#define __NR_epoll_pwait2 (__NR_Linux + 441) ++#define __NR_mount_setattr (__NR_Linux + 442) ++#define __NR_quotactl_fd (__NR_Linux + 443) ++#define __NR_landlock_create_ruleset (__NR_Linux + 444) ++#define __NR_landlock_add_rule (__NR_Linux + 445) ++#define __NR_landlock_restrict_self (__NR_Linux + 446) ++#define __NR_process_mrelease (__NR_Linux + 448) ++#define __NR_futex_waitv (__NR_Linux + 449) ++#define __NR_set_mempolicy_home_node (__NR_Linux + 450) ++#define __NR_cachestat (__NR_Linux + 451) ++#define __NR_fchmodat2 (__NR_Linux + 452) ++#define __NR_map_shadow_stack (__NR_Linux + 453) ++#define __NR_futex_wake (__NR_Linux + 454) ++#define __NR_futex_wait (__NR_Linux + 455) ++#define __NR_futex_requeue (__NR_Linux + 456) ++#define __NR_statmount (__NR_Linux + 457) ++#define __NR_listmount (__NR_Linux + 458) ++#define __NR_lsm_get_self_attr (__NR_Linux + 459) ++#define __NR_lsm_set_self_attr (__NR_Linux + 460) ++#define __NR_lsm_list_modules (__NR_Linux + 461) + + #elif defined(VGABI_N32) + +@@ -701,6 +740,65 @@ + #define __NR_pkey_alloc (__NR_Linux + 328) + #define __NR_pkey_free (__NR_Linux + 329) + #define __NR_statx (__NR_Linux + 330) ++#define __NR_rseq (__NR_Linux + 331) ++#define __NR_io_pgetevents (__NR_Linux + 332) ++#define __NR_clock_gettime64 (__NR_Linux + 403) ++#define __NR_clock_settime64 (__NR_Linux + 404) ++#define __NR_clock_adjtime64 (__NR_Linux + 405) ++#define __NR_clock_getres_time64 (__NR_Linux + 406) ++#define __NR_clock_nanosleep_time64 (__NR_Linux + 407) ++#define __NR_timer_gettime64 (__NR_Linux + 408) ++#define __NR_timer_settime64 (__NR_Linux + 409) ++#define __NR_timerfd_gettime64 (__NR_Linux + 410) ++#define __NR_timerfd_settime64 (__NR_Linux + 411) ++#define __NR_utimensat_time64 (__NR_Linux + 412) ++#define __NR_pselect6_time64 (__NR_Linux + 413) ++#define __NR_ppoll_time64 (__NR_Linux + 414) ++#define __NR_io_pgetevents_time64 (__NR_Linux + 416) ++#define __NR_recvmmsg_time64 (__NR_Linux + 417) ++#define __NR_mq_timedsend_time64 (__NR_Linux + 418) ++#define __NR_mq_timedreceive_time64 (__NR_Linux + 419) ++#define __NR_semtimedop_time64 (__NR_Linux + 420) ++#define __NR_rt_sigtimedwait_time64 (__NR_Linux + 421) ++#define __NR_futex_time64 (__NR_Linux + 422) ++#define __NR_sched_rr_get_interval_time64 (__NR_Linux + 423) ++#define __NR_pidfd_send_signal (__NR_Linux + 424) ++#define __NR_io_uring_setup (__NR_Linux + 425) ++#define __NR_io_uring_enter (__NR_Linux + 426) ++#define __NR_io_uring_register (__NR_Linux + 427) ++#define __NR_open_tree (__NR_Linux + 428) ++#define __NR_move_mount (__NR_Linux + 429) ++#define __NR_fsopen (__NR_Linux + 430) ++#define __NR_fsconfig (__NR_Linux + 431) ++#define __NR_fsmount (__NR_Linux + 432) ++#define __NR_fspick (__NR_Linux + 433) ++#define __NR_pidfd_open (__NR_Linux + 434) ++#define __NR_clone3 (__NR_Linux + 435) ++#define __NR_close_range (__NR_Linux + 436) ++#define __NR_openat2 (__NR_Linux + 437) ++#define __NR_pidfd_getfd (__NR_Linux + 438) ++#define __NR_faccessat2 (__NR_Linux + 439) ++#define __NR_process_madvise (__NR_Linux + 440) ++#define __NR_epoll_pwait2 (__NR_Linux + 441) ++#define __NR_mount_setattr (__NR_Linux + 442) ++#define __NR_quotactl_fd (__NR_Linux + 443) ++#define __NR_landlock_create_ruleset (__NR_Linux + 444) ++#define __NR_landlock_add_rule (__NR_Linux + 445) ++#define __NR_landlock_restrict_self (__NR_Linux + 446) ++#define __NR_process_mrelease (__NR_Linux + 448) ++#define __NR_futex_waitv (__NR_Linux + 449) ++#define __NR_set_mempolicy_home_node (__NR_Linux + 450) ++#define __NR_cachestat (__NR_Linux + 451) ++#define __NR_fchmodat2 (__NR_Linux + 452) ++#define __NR_map_shadow_stack (__NR_Linux + 453) ++#define __NR_futex_wake (__NR_Linux + 454) ++#define __NR_futex_wait (__NR_Linux + 455) ++#define __NR_futex_requeue (__NR_Linux + 456) ++#define __NR_statmount (__NR_Linux + 457) ++#define __NR_listmount (__NR_Linux + 458) ++#define __NR_lsm_get_self_attr (__NR_Linux + 459) ++#define __NR_lsm_set_self_attr (__NR_Linux + 460) ++#define __NR_lsm_list_modules (__NR_Linux + 461) + + #else + #error unknown mips64 abi diff --git a/package/devel/valgrind/patches/100-fix_configure_check.patch b/package/devel/valgrind/patches/100-fix_configure_check.patch index 5fa51977e7b..d771943db8d 100644 --- a/package/devel/valgrind/patches/100-fix_configure_check.patch +++ b/package/devel/valgrind/patches/100-fix_configure_check.patch @@ -1,6 +1,6 @@ --- a/configure.ac +++ b/configure.ac -@@ -364,7 +364,7 @@ case "${host_os}" in +@@ -381,7 +381,7 @@ case "${host_os}" in # Ok, this is linux. Check the kernel version AC_MSG_CHECKING([for the kernel version]) diff --git a/package/devel/valgrind/patches/130-fix_arm_arch_detection.patch b/package/devel/valgrind/patches/130-fix_arm_arch_detection.patch deleted file mode 100644 index 9a7b591e707..00000000000 --- a/package/devel/valgrind/patches/130-fix_arm_arch_detection.patch +++ /dev/null @@ -1,17 +0,0 @@ -Description: Fix FTBFS on armhf by correctly detecting the architecture -Origin: vendor -Bug-Debian: http://bugs.debian.org/730844 -Author: Alessandro Ghedini -Last-Update: 2013-11-30 - ---- a/configure.ac -+++ b/configure.ac -@@ -271,7 +271,7 @@ case "${host_cpu}" in - ARCH_MAX="s390x" - ;; - -- armv7*) -+ arm*) - AC_MSG_RESULT([ok (${host_cpu})]) - ARCH_MAX="arm" - ;; diff --git a/package/devel/valgrind/patches/130-mips_fix_soft_float.patch b/package/devel/valgrind/patches/130-mips_fix_soft_float.patch index 7c7122ecac9..f861646e80f 100644 --- a/package/devel/valgrind/patches/130-mips_fix_soft_float.patch +++ b/package/devel/valgrind/patches/130-mips_fix_soft_float.patch @@ -14,7 +14,7 @@ This fixes the following error message when compiling with a GCC 10 MIPS BE 32: --- a/VEX/priv/guest_mips_helpers.c +++ b/VEX/priv/guest_mips_helpers.c -@@ -616,6 +616,7 @@ extern UInt mips_dirtyhelper_calculate_F +@@ -620,6 +620,7 @@ extern UInt mips_dirtyhelper_calculate_F flt_op inst ) { UInt ret = 0; @@ -22,7 +22,7 @@ This fixes the following error message when compiling with a GCC 10 MIPS BE 32: #if defined(__mips__) VexGuestMIPS32State* guest_state = (VexGuestMIPS32State*)gs; UInt loFsVal, hiFsVal, loFtVal, hiFtVal; -@@ -698,6 +699,7 @@ extern UInt mips_dirtyhelper_calculate_F +@@ -702,6 +703,7 @@ extern UInt mips_dirtyhelper_calculate_F break; } #endif @@ -30,7 +30,7 @@ This fixes the following error message when compiling with a GCC 10 MIPS BE 32: return ret; } -@@ -707,6 +709,7 @@ extern UInt mips_dirtyhelper_calculate_F +@@ -711,6 +713,7 @@ extern UInt mips_dirtyhelper_calculate_F flt_op inst ) { UInt ret = 0; @@ -38,7 +38,7 @@ This fixes the following error message when compiling with a GCC 10 MIPS BE 32: #if defined(__mips__) && ((__mips == 64) || \ (defined(__mips_isa_rev) && (__mips_isa_rev >= 2))) #if defined(VGA_mips32) -@@ -859,6 +862,7 @@ extern UInt mips_dirtyhelper_calculate_F +@@ -863,6 +866,7 @@ extern UInt mips_dirtyhelper_calculate_F break; } #endif @@ -48,7 +48,7 @@ This fixes the following error message when compiling with a GCC 10 MIPS BE 32: --- a/coregrind/m_machine.c +++ b/coregrind/m_machine.c -@@ -2109,6 +2109,7 @@ Bool VG_(machine_get_hwcaps)( void ) +@@ -2119,6 +2119,7 @@ Bool VG_(machine_get_hwcaps)( void ) we are using alternative way to determine FP mode */ ULong result = 0; @@ -56,7 +56,7 @@ This fixes the following error message when compiling with a GCC 10 MIPS BE 32: if (!VG_MINIMAL_SETJMP(env_unsup_insn)) { __asm__ volatile ( ".set push\n\t" -@@ -2126,6 +2127,9 @@ Bool VG_(machine_get_hwcaps)( void ) +@@ -2136,6 +2137,9 @@ Bool VG_(machine_get_hwcaps)( void ) fpmode = (result != 0x3FF0000000000000ull); } diff --git a/package/firmware/ath11k-firmware/Makefile b/package/firmware/ath11k-firmware/Makefile index 77af27a1bb7..fba04d3c09c 100644 --- a/package/firmware/ath11k-firmware/Makefile +++ b/package/firmware/ath11k-firmware/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ath11k-firmware -PKG_SOURCE_DATE:=2024-07-22 -PKG_SOURCE_VERSION:=935aaf53a02193b50a241f167d509718a9dd395e -PKG_MIRROR_HASH:=adf518b384b2eb1bc424a982732f69f9db955c485d5739650ccf24cfe6edf67a +PKG_SOURCE_DATE:=2024-10-18 +PKG_SOURCE_VERSION:=0eb8fd98d5c07cd470a940e5cc36506cf82b42b3 +PKG_MIRROR_HASH:=0ad616a5ea1feff744ca12c81e306c3880e091391800b7cd392e74c8a8eeafaf PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/qosmio/upstream-wifi-fw.git +PKG_SOURCE_URL:=https://github.com/VIKINGYFY/ath11k-firmware-ddwrt.git PKG_LICENSE_FILES:=LICENSE.qca_firmware @@ -32,11 +32,6 @@ define Package/ath11k-firmware-default DEPENDS:= endef -define Package/ath11k-firmware-ipq5018 -$(Package/ath11k-firmware-default) - TITLE:=IPQ5018 ath11k firmware -endef - define Package/ath11k-firmware-ipq6018 $(Package/ath11k-firmware-default) TITLE:=IPQ6018 ath11k firmware @@ -47,11 +42,6 @@ $(Package/ath11k-firmware-default) TITLE:=IPQ8074 ath11k firmware endef -define Package/ath11k-firmware-qcn6122 -$(Package/ath11k-firmware-default) - TITLE:=QCN6122 ath11k firmware -endef - define Package/ath11k-firmware-qcn9074 $(Package/ath11k-firmware-default) TITLE:=QCN9074 ath11k firmware @@ -61,57 +51,29 @@ define Build/Compile endef -QCN9074_BOARD_REV:=8e140c65f36137714b6d8934e09dcd73cb05c2f6 -QCN9074_BOARD_FILE:=board-2.bin.$(QCN9074_BOARD_REV) - -define Download/qcn9074-board - URL:=https://git.codelinaro.org/clo/ath-firmware/ath11k-firmware/-/raw/main/QCN9074/hw1.0/ - URL_FILE:=board-2.bin - FILE:=$(QCN9074_BOARD_FILE) - HASH:=dbf0ca14aa1229eccd48f26f1026901b9718b143bd30b51b8ea67c84ba6207f1 -endef -$(eval $(call Download,qcn9074-board)) - -define Package/ath11k-firmware-ipq5018/install - $(INSTALL_DIR) $(1)/lib/firmware/IPQ5018 - $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/ath11k-firmware/IPQ5018_QCN6122_QCN6122/hw1.0/2.7.0.1/WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1/*.* \ - $(1)/lib/firmware/IPQ5018/ -endef - define Package/ath11k-firmware-ipq6018/install $(INSTALL_DIR) $(1)/lib/firmware/IPQ6018 $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/ath11k-firmware/IPQ6018/hw1.0/testing/2.12/WLAN.HK.2.12-01368-QCAHKSWPL_SILICONZ-1/* \ + $(PKG_BUILD_DIR)/IPQ6018/hw1.0/2.12-01460/* \ $(1)/lib/firmware/IPQ6018/ endef define Package/ath11k-firmware-ipq8074/install $(INSTALL_DIR) $(1)/lib/firmware/IPQ8074 $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/ath11k-firmware/IPQ8074/hw2.0/testing/2.12/WLAN.HK.2.12-01368-QCAHKSWPL_SILICONZ-1/* \ + $(PKG_BUILD_DIR)/IPQ8074/hw2.0/2.12-01460/* \ $(1)/lib/firmware/IPQ8074/ endef -define Package/ath11k-firmware-qcn6122/install - $(INSTALL_DIR) $(1)/lib/firmware/ath11k/QCN6122/hw1.0 - $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/ath11k-firmware/IPQ5018_QCN6122_QCN6122/hw1.0/2.7.0.1/WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1/qcn6122/* \ - $(1)/lib/firmware/ath11k/QCN6122/hw1.0 -endef - define Package/ath11k-firmware-qcn9074/install $(INSTALL_DIR) $(1)/lib/firmware/ath11k/QCN9074/hw1.0 $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/ath11k-firmware/QCN9074/hw1.0/2.9.0.1/WLAN.HK.2.9.0.1-01977-QCAHKSWPL_SILICONZ-1/* \ + $(PKG_BUILD_DIR)/QCN9074/hw1.0/2.12-01460/* \ $(1)/lib/firmware/ath11k/QCN9074/hw1.0/ $(INSTALL_BIN) \ - $(DL_DIR)/$(QCN9074_BOARD_FILE) $(1)/lib/firmware/ath11k/QCN9074/hw1.0/board-2.bin + $(PKG_BUILD_DIR)/QCN9074/hw1.0/board-2.bin $(1)/lib/firmware/ath11k/QCN9074/hw1.0/board-2.bin endef -$(eval $(call BuildPackage,ath11k-firmware-ipq5018)) $(eval $(call BuildPackage,ath11k-firmware-ipq6018)) $(eval $(call BuildPackage,ath11k-firmware-ipq8074)) -$(eval $(call BuildPackage,ath11k-firmware-qcn6122)) -$(eval $(call BuildPackage,ath11k-firmware-qcn9074)) - +$(eval $(call BuildPackage,ath11k-firmware-qcn9074)) \ No newline at end of file diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 171e79e1ab7..8d0c9db0ce3 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -6,9 +6,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware/qca-wireless.git -PKG_SOURCE_DATE:=2024-09-14 -PKG_SOURCE_VERSION:=2ca41d755d93dce53748ee6906318cc7d3829a8c -PKG_MIRROR_HASH:=e7447649e044a2759f6768eaec6de330238e6166bc01703979844be94fe2f817 +PKG_SOURCE_DATE:=2024-10-08 +PKG_SOURCE_VERSION:=dcbab62272bf5cab2ed857bc655d240970e14f2a +PKG_MIRROR_HASH:=e53a3872abf5e35db6baaceb56e6ffa289f8dd9b6226cf8a4d5b87b541179175 PKG_FLAGS:=nonshared include $(INCLUDE_DIR)/package.mk @@ -61,6 +61,7 @@ ALLWIFIBOARDS:= \ redmi_ax5 \ redmi_ax5-jdcloud \ redmi_ax6 \ + skspruce_wia3300-20 \ spectrum_sax1v1k \ tplink_eap660hd-v1 \ wallys_dr40x9 \ @@ -204,6 +205,7 @@ $(eval $(call generate-ipq-wifi-package,redmi_ax3000,Redmi AX3000)) $(eval $(call generate-ipq-wifi-package,redmi_ax5,Redmi AX5)) $(eval $(call generate-ipq-wifi-package,redmi_ax5-jdcloud,Redmi AX5 JDCloud)) $(eval $(call generate-ipq-wifi-package,redmi_ax6,Redmi AX6)) +$(eval $(call generate-ipq-wifi-package,skspruce_wia3300-20,SKSpruce WIA3300-20)) $(eval $(call generate-ipq-wifi-package,spectrum_sax1v1k,Spectrum SAX1V1K)) $(eval $(call generate-ipq-wifi-package,tplink_eap660hd-v1,TP-Link EAP660 HD v1)) $(eval $(call generate-ipq-wifi-package,wallys_dr40x9,Wallys DR40X9)) diff --git a/package/firmware/ipq-wifi/src/board-jdc_ax1800-pro.ipq6018 b/package/firmware/ipq-wifi/src/board-jdc_ax1800-pro.ipq6018 new file mode 100644 index 00000000000..3a05fe8f183 Binary files /dev/null and b/package/firmware/ipq-wifi/src/board-jdc_ax1800-pro.ipq6018 differ diff --git a/package/firmware/linux-firmware/intel.mk b/package/firmware/linux-firmware/intel.mk index b686a4caf8a..225b2aa8629 100644 --- a/package/firmware/linux-firmware/intel.mk +++ b/package/firmware/linux-firmware/intel.mk @@ -173,7 +173,7 @@ $(eval $(call BuildPackage,iwlwifi-firmware-iwl9260)) Package/iwlwifi-firmware-ax101 = $(call Package/firmware-default,Intel AX101 firmware) define Package/iwlwifi-firmware-ax101/install $(INSTALL_DIR) $(1)/lib/firmware - $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-so-a0-hr-b0-83.ucode $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-so-a0-hr-b0-89.ucode $(1)/lib/firmware endef $(eval $(call BuildPackage,iwlwifi-firmware-ax101)) @@ -194,7 +194,7 @@ $(eval $(call BuildPackage,iwlwifi-firmware-ax201)) Package/iwlwifi-firmware-ax210 = $(call Package/firmware-default,Intel AX210 firmware) define Package/iwlwifi-firmware-ax210/install $(INSTALL_DIR) $(1)/lib/firmware - $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-ty-a0-gf-a0-83.ucode $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-ty-a0-gf-a0-89.ucode $(1)/lib/firmware $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-ty-a0-gf-a0.pnvm $(1)/lib/firmware endef $(eval $(call BuildPackage,iwlwifi-firmware-ax210)) @@ -202,7 +202,7 @@ $(eval $(call BuildPackage,iwlwifi-firmware-ax210)) Package/iwlwifi-firmware-be200 = $(call Package/firmware-default,Intel BE200 firmware) define Package/iwlwifi-firmware-be200/install $(INSTALL_DIR) $(1)/lib/firmware - $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-gl-c0-fm-c0-83.ucode $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-gl-c0-fm-c0-92.ucode $(1)/lib/firmware $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-gl-c0-fm-c0.pnvm $(1)/lib/firmware endef $(eval $(call BuildPackage,iwlwifi-firmware-be200)) diff --git a/package/firmware/linux-firmware/realtek.mk b/package/firmware/linux-firmware/realtek.mk index 5ba679d4049..0889796a128 100644 --- a/package/firmware/linux-firmware/realtek.mk +++ b/package/firmware/linux-firmware/realtek.mk @@ -180,7 +180,6 @@ $(eval $(call BuildPackage,rtl8852ae-firmware)) Package/rtl8852be-firmware = $(call Package/firmware-default,RealTek RTL8852BE firmware) define Package/rtl8852be-firmware/install $(INSTALL_DIR) $(1)/lib/firmware/rtw89 - $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtw89/rtw8852b_fw.bin $(1)/lib/firmware/rtw89 $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtw89/rtw8852b_fw-1.bin $(1)/lib/firmware/rtw89 endef $(eval $(call BuildPackage,rtl8852be-firmware)) @@ -191,3 +190,10 @@ define Package/rtl8852ce-firmware/install $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtw89/rtw8852c_fw.bin $(1)/lib/firmware/rtw89 endef $(eval $(call BuildPackage,rtl8852ce-firmware)) + +Package/rtl8922ae-firmware = $(call Package/firmware-default,RealTek RTL8922AE firmware) +define Package/rtl8922ae-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/rtw89 + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtw89/rtw8922a_fw.bin $(1)/lib/firmware/rtw89 +endef +$(eval $(call BuildPackage,rtl8922ae-firmware)) diff --git a/package/firmware/wireless-regdb/Makefile b/package/firmware/wireless-regdb/Makefile index 4cce267f611..7d4cf63c479 100644 --- a/package/firmware/wireless-regdb/Makefile +++ b/package/firmware/wireless-regdb/Makefile @@ -1,14 +1,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wireless-regdb -PKG_VERSION:=2024.07.04 +PKG_VERSION:=2024.10.07 PKG_RELEASE:=1 PKG_LICENSE:=ISC PKG_LICENSE_FILES:=LICENSE PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/network/wireless-regdb/ -PKG_HASH:=9832a14e1be24abff7be30dee3c9a1afb5fdfcf475a0d91aafef039f8d85f5eb +PKG_HASH:=f76f2bd79a653e9f9dd50548d99d03a4a4eb157da056dfd5892f403ec28fb3d5 PKG_MAINTAINER:=Felix Fietkau diff --git a/package/kernel/ath10k-ct/Makefile b/package/kernel/ath10k-ct/Makefile index bd18930801d..f9795d8c8d2 100644 --- a/package/kernel/ath10k-ct/Makefile +++ b/package/kernel/ath10k-ct/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ath10k-ct -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_LICENSE:=GPLv2 PKG_LICENSE_FILES:= @@ -12,10 +12,10 @@ PKG_SOURCE_DATE:=2024-07-30 PKG_SOURCE_VERSION:=ac71b14dc93aef0af6f0f24808b0afb673eaa5f5 PKG_MIRROR_HASH:=f7774fc7002bbea450f543927acd528fb1bb6742f0e9ef28a402df3796893d93 -# Build the 6.9 ath10k-ct driver version. +# Build the 6.10 ath10k-ct driver version. # Probably this should match as closely as # possible to whatever mac80211 backports version is being used. -CT_KVER="-6.9" +CT_KVER="-6.10" PKG_MAINTAINER:=Ben Greear PKG_BUILD_PARALLEL:=1 @@ -29,7 +29,7 @@ include $(INCLUDE_DIR)/package.mk define KernelPackage/ath10k-ct SUBMENU:=Wireless Drivers TITLE:=ath10k-ct driver optimized for CT ath10k firmware - DEPENDS:=+kmod-mac80211 +kmod-ath +@DRIVER_11AC_SUPPORT @PCI_SUPPORT +kmod-hwmon-core + DEPENDS:=+kmod-mac80211 +kmod-ath +@DRIVER_11AC_SUPPORT @PCI_SUPPORT +kmod-hwmon-core +@PACKAGE_MAC80211_DEBUGFS FILES:=\ $(PKG_BUILD_DIR)/ath10k$(CT_KVER)/ath10k_pci.ko \ $(PKG_BUILD_DIR)/ath10k$(CT_KVER)/ath10k_core.ko diff --git a/package/kernel/ath10k-ct/patches/001-patch-version.patch b/package/kernel/ath10k-ct/patches/001-patch-version.patch index e5ae723cf13..4c90a3f3163 100644 --- a/package/kernel/ath10k-ct/patches/001-patch-version.patch +++ b/package/kernel/ath10k-ct/patches/001-patch-version.patch @@ -1,11 +1,11 @@ ---- a/ath10k-6.9/pci.c -+++ b/ath10k-6.9/pci.c +--- a/ath10k-6.10/pci.c ++++ b/ath10k-6.10/pci.c @@ -3871,7 +3871,7 @@ static int __ath10k_pci_probe(struct pci int (*pci_hard_reset)(struct ath10k *ar); u32 (*targ_cpu_to_ce_addr)(struct ath10k *ar, u32 addr); - printk(KERN_INFO "ath10k 6.7 driver, optimized for CT firmware, probing pci device: 0x%x.\n", -+ printk(KERN_INFO "ath10k 6.9 driver, optimized for CT firmware, probing pci device: 0x%x.\n", ++ printk(KERN_INFO "ath10k 6.10 driver, optimized for CT firmware, probing pci device: 0x%x.\n", pci_dev->device); switch (pci_dev->device) { diff --git a/package/kernel/ath10k-ct/patches/002-ath10k-6.10-remove-unsupported-feature.patch b/package/kernel/ath10k-ct/patches/002-ath10k-6.10-remove-unsupported-feature.patch new file mode 100644 index 00000000000..ca64c8a110e --- /dev/null +++ b/package/kernel/ath10k-ct/patches/002-ath10k-6.10-remove-unsupported-feature.patch @@ -0,0 +1,10 @@ +--- a/ath10k-6.10/mac.c ++++ b/ath10k-6.10/mac.c +@@ -11626,7 +11626,6 @@ int ath10k_mac_register(struct ath10k *a + ar->hw->wiphy->n_cipher_suites = ar->hw_params.n_cipher_suites; + + wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); +- wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_ETHTOOL_VDEV_STATS); + + ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; + diff --git a/package/kernel/ath10k-ct/patches/010-api_update.patch b/package/kernel/ath10k-ct/patches/010-api_update.patch new file mode 100644 index 00000000000..dff725b4e43 --- /dev/null +++ b/package/kernel/ath10k-ct/patches/010-api_update.patch @@ -0,0 +1,42 @@ +--- a/ath10k-6.10/mac.c ++++ b/ath10k-6.10/mac.c +@@ -1675,7 +1675,7 @@ static void ath10k_recalc_radar_detectio + * by indicating that radar was detected. + */ + ath10k_warn(ar, "failed to start CAC: %d\n", ret); +- ieee80211_radar_detected(ar->hw); ++ ieee80211_radar_detected(ar->hw, NULL); + } + } + +@@ -6238,7 +6238,7 @@ err: + return ret; + } + +-static void ath10k_stop(struct ieee80211_hw *hw) ++static void ath10k_stop(struct ieee80211_hw *hw, bool suspend) + { + struct ath10k *ar = hw->priv; + u32 opt; +--- a/ath10k-6.10/debug.c ++++ b/ath10k-6.10/debug.c +@@ -3319,7 +3319,7 @@ static ssize_t ath10k_write_simulate_rad + if (!arvif->is_started) + return -EINVAL; + +- ieee80211_radar_detected(ar->hw); ++ ieee80211_radar_detected(ar->hw, NULL); + + return count; + } +--- a/ath10k-6.10/wmi.c ++++ b/ath10k-6.10/wmi.c +@@ -4402,7 +4402,7 @@ static void ath10k_radar_detected(struct + if (ar->dfs_block_radar_events) + ath10k_info(ar, "DFS Radar detected, but ignored as requested\n"); + else +- ieee80211_radar_detected(ar->hw); ++ ieee80211_radar_detected(ar->hw, NULL); + } + + static void ath10k_radar_confirmation_work(struct work_struct *work) diff --git a/package/kernel/ath10k-ct/patches/130-ath10k-read-qcom-coexist-support-as-a-u32.patch b/package/kernel/ath10k-ct/patches/130-ath10k-read-qcom-coexist-support-as-a-u32.patch index b15bfdde6a5..61090a49d0e 100644 --- a/package/kernel/ath10k-ct/patches/130-ath10k-read-qcom-coexist-support-as-a-u32.patch +++ b/package/kernel/ath10k-ct/patches/130-ath10k-read-qcom-coexist-support-as-a-u32.patch @@ -39,9 +39,9 @@ that the feature is properly initialized: Signed-off-by: Vincent Tremblay ---- a/ath10k-6.9/core.c -+++ b/ath10k-6.9/core.c -@@ -2889,14 +2889,14 @@ done: +--- a/ath10k-6.10/core.c ++++ b/ath10k-6.10/core.c +@@ -2871,14 +2871,14 @@ done: static void ath10k_core_fetch_btcoex_dt(struct ath10k *ar) { struct device_node *node; diff --git a/package/kernel/ath10k-ct/patches/201-wifi-ath10k-add-LED-and-GPIO-controlling-support-for.patch b/package/kernel/ath10k-ct/patches/201-wifi-ath10k-add-LED-and-GPIO-controlling-support-for.patch index ba9372f9f05..c1137d081e1 100644 --- a/package/kernel/ath10k-ct/patches/201-wifi-ath10k-add-LED-and-GPIO-controlling-support-for.patch +++ b/package/kernel/ath10k-ct/patches/201-wifi-ath10k-add-LED-and-GPIO-controlling-support-for.patch @@ -20,24 +20,24 @@ Tested-by: Stefan Lippers-Hollmann Signed-off-by: Kalle Valo Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com --- - ath10k-6.9/Kconfig | 6 ++ - ath10k-6.9/Makefile | 1 + - ath10k-6.9/core.c | 32 ++++++++ - ath10k-6.9/core.h | 8 ++ - ath10k-6.9/hw.h | 1 + - ath10k-6.9/leds.c | 90 +++++++++++++++++++++++ - ath10k-6.9/leds.h | 34 +++++++++ - ath10k-6.9/mac.c | 1 + - ath10k-6.9/wmi-ops.h | 32 ++++++++ - ath10k-6.9/wmi-tlv.c | 2 + - ath10k-6.9/wmi.c | 54 ++++++++++++++ - ath10k-6.9/wmi.h | 35 +++++++++ + ath10k-6.10/Kconfig | 6 ++ + ath10k-6.10/Makefile | 1 + + ath10k-6.10/core.c | 32 ++++++++ + ath10k-6.10/core.h | 8 ++ + ath10k-6.10/hw.h | 1 + + ath10k-6.10/leds.c | 90 +++++++++++++++++++++++ + ath10k-6.10/leds.h | 34 +++++++++ + ath10k-6.10/mac.c | 1 + + ath10k-6.10/wmi-ops.h | 32 ++++++++ + ath10k-6.10/wmi-tlv.c | 2 + + ath10k-6.10/wmi.c | 54 ++++++++++++++ + ath10k-6.10/wmi.h | 35 +++++++++ 12 files changed, 296 insertions(+) - create mode 100644 ath10k-6.9/leds.c - create mode 100644 ath10k-6.9/leds.h + create mode 100644 ath10k-6.10/leds.c + create mode 100644 ath10k-6.10/leds.h ---- a/ath10k-6.9/Kconfig -+++ b/ath10k-6.9/Kconfig +--- a/ath10k-6.10/Kconfig ++++ b/ath10k-6.10/Kconfig @@ -68,6 +68,12 @@ config ATH10K_DEBUGFS If unsure, say Y to make it easier to debug problems. @@ -51,8 +51,8 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com config ATH10K_SPECTRAL bool "Atheros ath10k spectral scan support" depends on ATH10K_DEBUGFS ---- a/ath10k-6.9/Makefile -+++ b/ath10k-6.9/Makefile +--- a/ath10k-6.10/Makefile ++++ b/ath10k-6.10/Makefile @@ -20,6 +20,7 @@ ath10k_core-$(CONFIG_ATH10K_SPECTRAL) += ath10k_core-$(CONFIG_NL80211_TESTMODE) += testmode.o ath10k_core-$(CONFIG_ATH10K_TRACING) += trace.o @@ -61,8 +61,8 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com ath10k_core-$(CONFIG_MAC80211_DEBUGFS) += debugfs_sta.o ath10k_core-$(CONFIG_PM) += wow.o ath10k_core-$(CONFIG_ATH10K_CE) += ce.o ---- a/ath10k-6.9/core.c -+++ b/ath10k-6.9/core.c +--- a/ath10k-6.10/core.c ++++ b/ath10k-6.10/core.c @@ -29,6 +29,7 @@ #include "testmode.h" #include "wmi-ops.h" @@ -79,7 +79,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, .otp_exe_param = 0, .channel_counters_freq_hz = 88000, -@@ -122,6 +124,7 @@ static const struct ath10k_hw_params ath +@@ -121,6 +123,7 @@ static const struct ath10k_hw_params ath .name = "qca988x hw2.0 ubiquiti", .patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, @@ -87,7 +87,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, .otp_exe_param = 0, .channel_counters_freq_hz = 88000, -@@ -164,6 +167,7 @@ static const struct ath10k_hw_params ath +@@ -162,6 +165,7 @@ static const struct ath10k_hw_params ath .name = "qca9887 hw1.0", .patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, @@ -95,7 +95,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, .otp_exe_param = 0, .channel_counters_freq_hz = 88000, -@@ -206,6 +210,7 @@ static const struct ath10k_hw_params ath +@@ -203,6 +207,7 @@ static const struct ath10k_hw_params ath .name = "qca6174 hw3.2 sdio", .patch_load_addr = QCA6174_HW_3_0_PATCH_LOAD_ADDR, .uart_pin = 19, @@ -103,7 +103,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .otp_exe_param = 0, .channel_counters_freq_hz = 88000, .max_probe_resp_desc_thres = 0, -@@ -243,6 +248,7 @@ static const struct ath10k_hw_params ath +@@ -239,6 +244,7 @@ static const struct ath10k_hw_params ath .name = "qca6164 hw2.1", .patch_load_addr = QCA6174_HW_2_1_PATCH_LOAD_ADDR, .uart_pin = 6, @@ -111,7 +111,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .otp_exe_param = 0, .channel_counters_freq_hz = 88000, .max_probe_resp_desc_thres = 0, -@@ -284,6 +290,7 @@ static const struct ath10k_hw_params ath +@@ -279,6 +285,7 @@ static const struct ath10k_hw_params ath .name = "qca6174 hw2.1", .patch_load_addr = QCA6174_HW_2_1_PATCH_LOAD_ADDR, .uart_pin = 6, @@ -119,7 +119,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .otp_exe_param = 0, .channel_counters_freq_hz = 88000, .max_probe_resp_desc_thres = 0, -@@ -325,6 +332,7 @@ static const struct ath10k_hw_params ath +@@ -319,6 +326,7 @@ static const struct ath10k_hw_params ath .name = "qca6174 hw3.0", .patch_load_addr = QCA6174_HW_3_0_PATCH_LOAD_ADDR, .uart_pin = 6, @@ -127,7 +127,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .otp_exe_param = 0, .channel_counters_freq_hz = 88000, .max_probe_resp_desc_thres = 0, -@@ -366,6 +374,7 @@ static const struct ath10k_hw_params ath +@@ -359,6 +367,7 @@ static const struct ath10k_hw_params ath .name = "qca6174 hw3.2", .patch_load_addr = QCA6174_HW_3_0_PATCH_LOAD_ADDR, .uart_pin = 6, @@ -135,7 +135,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .otp_exe_param = 0, .channel_counters_freq_hz = 88000, .max_probe_resp_desc_thres = 0, -@@ -411,6 +420,7 @@ static const struct ath10k_hw_params ath +@@ -403,6 +412,7 @@ static const struct ath10k_hw_params ath .name = "qca99x0 hw2.0", .patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, @@ -143,7 +143,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .otp_exe_param = 0x00000700, .continuous_frag_desc = true, .cck_rate_map_rev2 = true, -@@ -458,6 +468,7 @@ static const struct ath10k_hw_params ath +@@ -449,6 +459,7 @@ static const struct ath10k_hw_params ath .name = "qca9984/qca9994 hw1.0", .patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, @@ -151,7 +151,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, .otp_exe_param = 0x00000700, .continuous_frag_desc = true, -@@ -512,6 +523,7 @@ static const struct ath10k_hw_params ath +@@ -501,6 +512,7 @@ static const struct ath10k_hw_params ath .name = "qca9888 hw2.0", .patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, @@ -159,7 +159,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, .otp_exe_param = 0x00000700, .continuous_frag_desc = true, -@@ -563,6 +575,7 @@ static const struct ath10k_hw_params ath +@@ -551,6 +563,7 @@ static const struct ath10k_hw_params ath .name = "qca9377 hw1.0", .patch_load_addr = QCA9377_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 6, @@ -167,7 +167,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .otp_exe_param = 0, .channel_counters_freq_hz = 88000, .max_probe_resp_desc_thres = 0, -@@ -604,6 +617,7 @@ static const struct ath10k_hw_params ath +@@ -591,6 +604,7 @@ static const struct ath10k_hw_params ath .name = "qca9377 hw1.1", .patch_load_addr = QCA9377_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 6, @@ -175,7 +175,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .otp_exe_param = 0, .channel_counters_freq_hz = 88000, .max_probe_resp_desc_thres = 0, -@@ -647,6 +661,7 @@ static const struct ath10k_hw_params ath +@@ -633,6 +647,7 @@ static const struct ath10k_hw_params ath .name = "qca9377 hw1.1 sdio", .patch_load_addr = QCA9377_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 19, @@ -183,7 +183,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .otp_exe_param = 0, .channel_counters_freq_hz = 88000, .max_probe_resp_desc_thres = 0, -@@ -681,6 +696,7 @@ static const struct ath10k_hw_params ath +@@ -666,6 +681,7 @@ static const struct ath10k_hw_params ath .name = "qca4019 hw1.0", .patch_load_addr = QCA4019_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, @@ -191,7 +191,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, .otp_exe_param = 0x0010000, .continuous_frag_desc = true, -@@ -727,6 +743,7 @@ static const struct ath10k_hw_params ath +@@ -711,6 +727,7 @@ static const struct ath10k_hw_params ath .dev_id = 0, .bus = ATH10K_BUS_SNOC, .name = "wcn3990 hw1.0", @@ -199,7 +199,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .continuous_frag_desc = true, .tx_chain_mask = 0x7, .rx_chain_mask = 0x7, -@@ -4091,6 +4108,10 @@ int ath10k_core_start(struct ath10k *ar, +@@ -4073,6 +4090,10 @@ int ath10k_core_start(struct ath10k *ar, ath10k_wmi_check_apply_board_power_ctl_table(ar); } @@ -210,7 +210,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com return 0; err_hif_stop: -@@ -4352,9 +4373,18 @@ static void ath10k_core_register_work(st +@@ -4334,9 +4355,18 @@ static void ath10k_core_register_work(st goto err_spectral_destroy; } @@ -229,7 +229,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com err_spectral_destroy: ath10k_spectral_destroy(ar); err_debug_destroy: -@@ -4414,6 +4444,8 @@ void ath10k_core_unregister(struct ath10 +@@ -4396,6 +4426,8 @@ void ath10k_core_unregister(struct ath10 if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags)) return; @@ -238,8 +238,8 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com ath10k_thermal_unregister(ar); /* Stop spectral before unregistering from mac80211 to remove the * relayfs debugfs file cleanly. Otherwise the parent debugfs tree ---- a/ath10k-6.9/core.h -+++ b/ath10k-6.9/core.h +--- a/ath10k-6.10/core.h ++++ b/ath10k-6.10/core.h @@ -15,6 +15,7 @@ #include #include @@ -248,7 +248,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com #include "htt.h" #include "htc.h" -@@ -1590,6 +1591,13 @@ struct ath10k { +@@ -1592,6 +1593,13 @@ struct ath10k { } testmode; struct { @@ -262,9 +262,9 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com /* protected by data_lock */ u32 rx_crc_err_drop; u32 fw_crash_counter; ---- a/ath10k-6.9/hw.h -+++ b/ath10k-6.9/hw.h -@@ -525,6 +525,7 @@ struct ath10k_hw_params { +--- a/ath10k-6.10/hw.h ++++ b/ath10k-6.10/hw.h +@@ -516,6 +516,7 @@ struct ath10k_hw_params { const char *name; u32 patch_load_addr; int uart_pin; @@ -273,7 +273,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com /* Type of hw cycle counter wraparound logic, for more info --- /dev/null -+++ b/ath10k-6.9/leds.c ++++ b/ath10k-6.10/leds.c @@ -0,0 +1,90 @@ +// SPDX-License-Identifier: ISC +/* @@ -366,7 +366,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com +} + --- /dev/null -+++ b/ath10k-6.9/leds.h ++++ b/ath10k-6.10/leds.h @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: ISC */ +/* @@ -402,8 +402,8 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com + +#endif +#endif /* _LEDS_H_ */ ---- a/ath10k-6.9/mac.c -+++ b/ath10k-6.9/mac.c +--- a/ath10k-6.10/mac.c ++++ b/ath10k-6.10/mac.c @@ -26,6 +26,7 @@ #include "wmi-tlv.h" #include "wmi-ops.h" @@ -412,8 +412,8 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com /*********/ /* Rates */ ---- a/ath10k-6.9/wmi-ops.h -+++ b/ath10k-6.9/wmi-ops.h +--- a/ath10k-6.10/wmi-ops.h ++++ b/ath10k-6.10/wmi-ops.h @@ -228,7 +228,10 @@ struct wmi_ops { const struct wmi_bb_timing_cfg_arg *arg); struct sk_buff *(*gen_per_peer_per_tid_cfg)(struct ath10k *ar, @@ -461,8 +461,8 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com static inline int ath10k_wmi_dbglog_cfg(struct ath10k *ar, u64 module_enable, u32 log_level) { ---- a/ath10k-6.9/wmi-tlv.c -+++ b/ath10k-6.9/wmi-tlv.c +--- a/ath10k-6.10/wmi-tlv.c ++++ b/ath10k-6.10/wmi-tlv.c @@ -4606,6 +4606,8 @@ static const struct wmi_ops wmi_tlv_ops .gen_echo = ath10k_wmi_tlv_op_gen_echo, .gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf, @@ -472,8 +472,8 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com }; static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = { ---- a/ath10k-6.9/wmi.c -+++ b/ath10k-6.9/wmi.c +--- a/ath10k-6.10/wmi.c ++++ b/ath10k-6.10/wmi.c @@ -8467,6 +8467,49 @@ ath10k_wmi_op_gen_peer_set_param(struct return skb; } @@ -570,8 +570,8 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com }; int ath10k_wmi_attach(struct ath10k *ar) ---- a/ath10k-6.9/wmi.h -+++ b/ath10k-6.9/wmi.h +--- a/ath10k-6.10/wmi.h ++++ b/ath10k-6.10/wmi.h @@ -3137,6 +3137,41 @@ enum wmi_10_4_feature_mask { }; diff --git a/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch b/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch index 9bd07a24a6d..cd1d300b388 100644 --- a/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch +++ b/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch @@ -14,9 +14,9 @@ Signed-off-by: Mathias Kresin ath10k-6.7/mac.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) ---- a/ath10k-6.9/core.h -+++ b/ath10k-6.9/core.h -@@ -1705,6 +1705,10 @@ struct ath10k { +--- a/ath10k-6.10/core.h ++++ b/ath10k-6.10/core.h +@@ -1707,6 +1707,10 @@ struct ath10k { u8 csi_data[4096]; u16 csi_data_len; @@ -27,8 +27,8 @@ Signed-off-by: Mathias Kresin /* must be last */ u8 drv_priv[] __aligned(sizeof(void *)); }; ---- a/ath10k-6.9/leds.c -+++ b/ath10k-6.9/leds.c +--- a/ath10k-6.10/leds.c ++++ b/ath10k-6.10/leds.c @@ -70,7 +70,7 @@ int ath10k_leds_register(struct ath10k * ar->leds.cdev.name = ar->leds.label; @@ -38,8 +38,8 @@ Signed-off-by: Mathias Kresin ret = led_classdev_register(wiphy_dev(ar->hw->wiphy), &ar->leds.cdev); if (ret) ---- a/ath10k-6.9/mac.c -+++ b/ath10k-6.9/mac.c +--- a/ath10k-6.10/mac.c ++++ b/ath10k-6.10/mac.c @@ -11631,7 +11631,7 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; diff --git a/package/kernel/ath10k-ct/patches/300-fix-fortify-checking-error.patch b/package/kernel/ath10k-ct/patches/300-fix-fortify-checking-error.patch index 122716c24db..89921d6a342 100644 --- a/package/kernel/ath10k-ct/patches/300-fix-fortify-checking-error.patch +++ b/package/kernel/ath10k-ct/patches/300-fix-fortify-checking-error.patch @@ -1,5 +1,5 @@ ---- a/ath10k-6.9/wmi.h -+++ b/ath10k-6.9/wmi.h +--- a/ath10k-6.10/wmi.h ++++ b/ath10k-6.10/wmi.h @@ -6310,7 +6310,7 @@ struct qca9880_set_ctl_table_cmd { __le32 ctl_len; /* in bytes. This may be ignored in firmware, * make sure ctl_info data is sizeof(qca9880_power_ctl) */ diff --git a/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch b/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch index c1de78de98c..bd25222e1d8 100644 --- a/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch +++ b/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch @@ -1,5 +1,5 @@ ---- a/ath10k-6.9/htt.h -+++ b/ath10k-6.9/htt.h +--- a/ath10k-6.10/htt.h ++++ b/ath10k-6.10/htt.h @@ -238,7 +238,11 @@ enum htt_rx_ring_flags { }; diff --git a/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch b/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch index 3dcbda37154..708a7caea25 100644 --- a/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch +++ b/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch @@ -1,5 +1,5 @@ ---- a/ath10k-6.9/pci.c -+++ b/ath10k-6.9/pci.c +--- a/ath10k-6.10/pci.c ++++ b/ath10k-6.10/pci.c @@ -132,7 +132,11 @@ static const struct ce_attr pci_host_ce_ .flags = CE_ATTR_FLAGS, .src_nentries = 0, diff --git a/package/kernel/ath10k-ct/patches/988-ath10k-always-use-mac80211-loss-detection.patch b/package/kernel/ath10k-ct/patches/988-ath10k-always-use-mac80211-loss-detection.patch index 974072fb9a7..35026cc0f94 100644 --- a/package/kernel/ath10k-ct/patches/988-ath10k-always-use-mac80211-loss-detection.patch +++ b/package/kernel/ath10k-ct/patches/988-ath10k-always-use-mac80211-loss-detection.patch @@ -13,11 +13,11 @@ own loss detection mechanism. Signed-off-by: David Bauer --- - ath10k-6.9/mac.c | 1 - + ath10k-6.10/mac.c | 1 - 1 file changed, 1 deletion(-) ---- a/ath10k-6.9/mac.c -+++ b/ath10k-6.9/mac.c +--- a/ath10k-6.10/mac.c ++++ b/ath10k-6.10/mac.c @@ -11316,7 +11316,6 @@ int ath10k_mac_register(struct ath10k *a ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA); ieee80211_hw_set(ar->hw, QUEUE_CONTROL); diff --git a/package/kernel/gpio-button-hotplug/Makefile b/package/kernel/gpio-button-hotplug/Makefile index 5b4085887d4..caa3dce01e2 100644 --- a/package/kernel/gpio-button-hotplug/Makefile +++ b/package/kernel/gpio-button-hotplug/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=gpio-button-hotplug -PKG_RELEASE:=4 +PKG_RELEASE:=5 PKG_LICENSE:=GPL-2.0 include $(INCLUDE_DIR)/package.mk diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c index de100777f24..1dd0ff2a1a1 100644 --- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c +++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c @@ -373,7 +373,7 @@ gpio_keys_get_devtree_pdata(struct device *dev) if (!node) return NULL; - nbuttons = of_get_child_count(node); + nbuttons = of_get_available_child_count(node); if (nbuttons == 0) return ERR_PTR(-EINVAL); @@ -388,7 +388,7 @@ gpio_keys_get_devtree_pdata(struct device *dev) pdata->rep = !!of_get_property(node, "autorepeat", NULL); of_property_read_u32(node, "poll-interval", &pdata->poll_interval); - for_each_child_of_node(node, pp) { + for_each_available_child_of_node(node, pp) { button = (struct gpio_keys_button *)(&pdata->buttons[i++]); if (of_property_read_u32(pp, "linux,code", &button->code)) { diff --git a/package/kernel/leds-ws2812b/src/leds-ws2812b.c b/package/kernel/leds-ws2812b/src/leds-ws2812b.c index 0dba128c1f0..3f266649136 100644 --- a/package/kernel/leds-ws2812b/src/leds-ws2812b.c +++ b/package/kernel/leds-ws2812b/src/leds-ws2812b.c @@ -117,14 +117,17 @@ static int ws2812b_probe(struct spi_device *spi) priv->data_len = num_leds * WS2812B_BYTES_PER_COLOR * WS2812B_NUM_COLORS + WS2812B_RESET_LEN; - priv->data_buf = kzalloc(priv->data_len, GFP_KERNEL); + priv->data_buf = devm_kzalloc(dev, priv->data_len, GFP_KERNEL); if (!priv->data_buf) return -ENOMEM; for (i = 0; i < num_leds * WS2812B_NUM_COLORS; i++) ws2812b_set_byte(priv, i, 0); - mutex_init(&priv->mutex); + ret = devm_mutex_init(dev, &priv->mutex); + if (ret) + return ret; + priv->num_leds = num_leds; priv->spi = spi; @@ -144,13 +147,12 @@ static int ws2812b_probe(struct spi_device *spi) if (ret) { dev_err(dev, "failed to obtain numerical LED index for %s", fwnode_get_name(led_node)); - goto ERR_UNREG_LEDS; + return ret; } if (cascade >= num_leds) { dev_err(dev, "LED index of %s is larger than the number of LEDs.", fwnode_get_name(led_node)); - ret = -EINVAL; - goto ERR_UNREG_LEDS; + return -EINVAL; } cnt = fwnode_property_count_u32(led_node, "color-index"); @@ -171,12 +173,12 @@ static int ws2812b_probe(struct spi_device *spi) priv->leds[cur_led].cascade = cascade; - ret = led_classdev_multicolor_register_ext( + ret = devm_led_classdev_multicolor_register_ext( dev, &priv->leds[cur_led].mc_cdev, &init_data); if (ret) { dev_err(dev, "registration of %s failed.", fwnode_get_name(led_node)); - goto ERR_UNREG_LEDS; + return ret; } cur_led++; } @@ -184,31 +186,6 @@ static int ws2812b_probe(struct spi_device *spi) spi_set_drvdata(spi, priv); return 0; -ERR_UNREG_LEDS: - for (; cur_led >= 0; cur_led--) - led_classdev_multicolor_unregister(&priv->leds[cur_led].mc_cdev); - mutex_destroy(&priv->mutex); - kfree(priv->data_buf); - return ret; -} - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,18,0) -static void ws2812b_remove(struct spi_device *spi) -#else -static int ws2812b_remove(struct spi_device *spi) -#endif -{ - struct ws2812b_priv *priv = spi_get_drvdata(spi); - int cur_led; - - for (cur_led = priv->num_leds - 1; cur_led >= 0; cur_led--) - led_classdev_multicolor_unregister(&priv->leds[cur_led].mc_cdev); - kfree(priv->data_buf); - mutex_destroy(&priv->mutex); - -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) - return 0; -#endif } static const struct spi_device_id ws2812b_spi_ids[] = { @@ -225,7 +202,6 @@ MODULE_DEVICE_TABLE(of, ws2812b_dt_ids); static struct spi_driver ws2812b_driver = { .probe = ws2812b_probe, - .remove = ws2812b_remove, .id_table = ws2812b_spi_ids, .driver = { .name = KBUILD_MODNAME, diff --git a/package/kernel/linux/files/sysctl-nf-conntrack.conf b/package/kernel/linux/files/sysctl-nf-conntrack.conf index c6a0ef362b6..b8821b162ac 100644 --- a/package/kernel/linux/files/sysctl-nf-conntrack.conf +++ b/package/kernel/linux/files/sysctl-nf-conntrack.conf @@ -6,3 +6,6 @@ net.netfilter.nf_conntrack_checksum=0 net.netfilter.nf_conntrack_tcp_timeout_established=7440 net.netfilter.nf_conntrack_udp_timeout=60 net.netfilter.nf_conntrack_udp_timeout_stream=180 +net.netfilter.nf_conntrack_helper=1 +net.netfilter.nf_conntrack_buckets=16384 +net.netfilter.nf_conntrack_expect_max=16384 \ No newline at end of file diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index d77dabfa79b..64a373a80db 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -560,6 +560,7 @@ define KernelPackage/dsa-mv88e6xxx TITLE:=Marvell MV88E6XXX DSA Switch DEPENDS:=+kmod-dsa +kmod-ptp +kmod-phy-marvell +kmod-dsa-tag-dsa KCONFIG:=CONFIG_NET_DSA_MV88E6XXX \ + CONFIG_NET_DSA_MV88E6XXX_LEDS=y \ CONFIG_NET_DSA_MV88E6XXX_PTP=y FILES:=$(LINUX_DIR)/drivers/net/dsa/mv88e6xxx/mv88e6xxx.ko AUTOLOAD:=$(call AutoLoad,41,mv88e6xxx,1) @@ -801,6 +802,23 @@ endef $(eval $(call KernelPackage,r6040)) +define KernelPackage/rmnet + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=RmNet MAP support + KCONFIG:=CONFIG_RMNET + FILES:=$(LINUX_DIR)/drivers/net/ethernet/qualcomm/rmnet/rmnet.ko + AUTOLOAD:=$(call AutoLoad,30,rmnet) +endef + +define KernelPackage/rmnet/description + Kernel support for RMNET module which is used for handling data in the + multiplexing and aggregation protocol (MAP) format in the embedded data + path. RMNET devices can be attached to any IP mode physical device. +endef + +$(eval $(call KernelPackage,rmnet)) + + define KernelPackage/niu SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Sun Neptune 10Gbit Ethernet support diff --git a/package/kernel/linux/modules/netfilter.mk b/package/kernel/linux/modules/netfilter.mk index c7d89227d4b..3687eaca75c 100644 --- a/package/kernel/linux/modules/netfilter.mk +++ b/package/kernel/linux/modules/netfilter.mk @@ -1052,7 +1052,7 @@ $(eval $(call KernelPackage,nfnetlink-queue)) define KernelPackage/nf-conntrack-netlink TITLE:=Connection tracking netlink interface FILES:=$(LINUX_DIR)/net/netfilter/nf_conntrack_netlink.ko - KCONFIG:=CONFIG_NF_CT_NETLINK CONFIG_NF_CONNTRACK_EVENTS=y CONFIG_NETFILTER_NETLINK_GLUE_CT=y + KCONFIG:=CONFIG_NF_CT_NETLINK CONFIG_NF_CONNTRACK_EVENTS=y CONFIG_NETFILTER_NETLINK_GLUE_CT=y CONFIG_NF_CONNTRACK_DSCPREMARK_EXT=y AUTOLOAD:=$(call AutoProbe,nf_conntrack_netlink) $(call AddDepends/nfnetlink,+kmod-nf-conntrack) endef diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 22ca7e6f5c7..3a32cd43a7d 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -10,13 +10,13 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=6.9.9 +PKG_VERSION:=6.11.2 PKG_RELEASE:=1 PKG_LICENSE:=GPL-2.0-only PKG_LICENSE_FILES:=COPYING PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources/ -PKG_HASH:=3417da091a57c7b1c145d44c1fae9f1e0bac6d0c8ad61b37e57b0a802eeb2837 +PKG_HASH:=700ea5abef8dde9e3c6df2acd32ff443da735d773d56db9a80269e2237549b34 PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(if $(BUILD_VARIANT),$(PKG_NAME)-$(BUILD_VARIANT)/)backports-$(PKG_VERSION) @@ -47,6 +47,9 @@ include $(INCLUDE_DIR)/package.mk WMENU:=Wireless Drivers NSS_PATCH:= subsys ath10k ath11k +IPQ_BRANCH:=$(shell git -C $(TOPDIR) rev-parse --abbrev-ref HEAD) +IPQ_DATE:=$(shell git -C $(TOPDIR) log -1 --format=%cd --date=format:%Y-%m-%d) +IPQ_COMMIT:=$(shell git -C $(TOPDIR) log -1 --format=%h) define KernelPackage/mac80211/Default SUBMENU:=$(WMENU) @@ -438,9 +441,13 @@ endef ifdef CONFIG_ATH11K_NSS_SUPPORT define KernelPackage/ath11k/install - $(INSTALL_DIR) $(1)/etc/init.d $(1)/etc/config + $(INSTALL_DIR) $(1)/etc/init.d $(1)/etc/config $(1)/usr/bin $(INSTALL_BIN) ./files/qca-nss-pbuf.init $(1)/etc/init.d/qca-nss-pbuf - $(INSTALL_BIN) ./files/pbuf.uci $(1)/etc/config/pbuf + $(INSTALL_DATA) ./files/pbuf.uci $(1)/etc/config/pbuf + $(INSTALL_BIN) ./files/nss_diag.sh $(1)/usr/bin/nss_diag + echo "IPQ_BRANCH=$(IPQ_BRANCH)" > $(1)/etc/ipq_release + echo "IPQ_DATE=$(IPQ_DATE)" >> $(1)/etc/ipq_release + echo "IPQ_COMMIT=$(IPQ_COMMIT)" >> $(1)/etc/ipq_release endef endif diff --git a/package/kernel/mac80211/files/nss_diag.sh b/package/kernel/mac80211/files/nss_diag.sh new file mode 100644 index 00000000000..1868adda2ed --- /dev/null +++ b/package/kernel/mac80211/files/nss_diag.sh @@ -0,0 +1,88 @@ +#!/bin/sh +# shellcheck disable=3037,3060,2034,1091,2166 + +blue="" +red="" +green="" +yellow="" +white="" +reset="" +bold="" + +# check if stdout is a terminal, then set colors. +if [ -t 1 ]; then + red="\033[31m" + green="\033[32m" + yellow="\033[33m" + blue="\033[34m" + magenta="\033[35m" + cyan="\033[36m" + white="\033[37m" + reset="\033[m" + bold="\033[1m" +fi + +# Retrieve OpenWRT version +[ -r /etc/openwrt_version ] && openwrt_rev=$(cat /etc/openwrt_version) + +# Retrieve device model +model=$(jsonfilter -e ''@.model.name'' < /etc/board.json | sed -e "s/,/_/g") + +# NSS firmware version +nss_fw="/lib/firmware/qca*.bin" +# shellcheck disable=2086 +[ "$(ls $nss_fw 2> /dev/null)" ] && nss_version=$(grep -h -m 1 -a -o 'Version:.[^[:cntrl:]]*' $nss_fw | head -1 | cut -d ' ' -f 2) + +# ATH11K firmware version +ath11k_fw=$(grep -hm1 -a -o 'WLAN.[^[:cntrl:]]*SILICONZ-1' /lib/firmware/*/q6* | head -1) + +# MAC80211 (backports) version +mac80211_version=$(awk '/version/{print $NF;exit}' /lib/modules/*/compat.ko) + +# OpenWRT IPQ release details +[ -r /etc/ipq_release ] && . /etc/ipq_release +ipq_branch=${IPQ_BRANCH:-"N/A"} +ipq_commit=${IPQ_COMMIT:-"N/A"} +ipq_date=${IPQ_DATE:-"N/A"} + +# Defaults for empty variables +openwrt_rev=${openwrt_rev:-"N/A"} +model=${model:-"N/A"} +nss_version=${nss_version:-"N/A"} +ath11k_fw=${ath11k_fw:-"N/A"} +mac80211_version=${mac80211_version:-"N/A"} + +# Display the information +echo -e "${bold}${red} MODEL${reset}: ${blue}${bold}${model}${reset}" +echo -e "${bold}${red} OPENWRT${reset}: ${white}${openwrt_rev}${reset}" +echo -e "${bold}${red}IPQ BRANCH${reset}: ${cyan}${ipq_branch}${reset}" +echo -e "${bold}${red}IPQ COMMIT${reset}: ${cyan}${ipq_commit}${reset}" +echo -e "${bold}${red} IPQ DATE${reset}: ${cyan}${ipq_date}${reset}" +echo -e "${bold}${red} NSS FW${reset}: ${magenta}${nss_version}${reset}" +echo -e "${bold}${red} MAC80211${reset}: ${yellow}${mac80211_version}${reset}" +echo -e "${bold}${red} ATH11K FW${reset}: ${green}${ath11k_fw}${reset}" + +# Display GRO Fragmentation status using BusyBox +echo -ne "${bold}${red} GRO FRAG${reset}: ${white}" +n=0 +for iface in /sys/class/net/*; do + iface=${iface##*/} + [ "$iface" = "lo" -o "$iface" = "miireg" ] && continue + gro_status=$(ethtool -k "$iface" 2> /dev/null | awk '/rx-gro-list/{print $2}') + gro_status=${gro_status:-"N/A"} + color=$green + [ "$gro_status" = "on" ] && color=$red + [ $n -gt 0 ] && spacing=" " + printf "%s%-11s : %b%s%b\n" "$spacing" "$iface" "$color" "$gro_status" "$reset" + n=$((n + 1)) +done + +echo -e "${reset}" +echo -ne "${bold}${red} NSS PKGS${reset}: ${white}" +opkg list-installed | awk -v count=0 ' + /kmod-qca-nss|^nss/ { + if(count>0) tab=" " + print tab $0 + count++ +}' +echo -ne "${reset}" diff --git a/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch index 0f6a570cb09..5f5ac20ddba 100644 --- a/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch +++ b/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch @@ -82,7 +82,7 @@ help --- a/local-symbols +++ b/local-symbols -@@ -94,6 +94,7 @@ ADM8211= +@@ -96,6 +96,7 @@ ADM8211= ATH_COMMON= WLAN_VENDOR_ATH= ATH_DEBUG= diff --git a/package/kernel/mac80211/patches/ath10k/080-ath10k_thermal_config.patch b/package/kernel/mac80211/patches/ath10k/080-ath10k_thermal_config.patch index c41bfa8888c..10d95d36bf8 100644 --- a/package/kernel/mac80211/patches/ath10k/080-ath10k_thermal_config.patch +++ b/package/kernel/mac80211/patches/ath10k/080-ath10k_thermal_config.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath10k/Kconfig +++ b/drivers/net/wireless/ath/ath10k/Kconfig -@@ -88,6 +88,12 @@ config ATH10K_TRACING +@@ -94,6 +94,12 @@ config ATH10K_TRACING help Select this to ath10k use tracing infrastructure. @@ -21,9 +21,9 @@ ath10k_core-$(CPTCFG_ATH10K_TRACING) += trace.o -ath10k_core-$(CONFIG_THERMAL) += thermal.o +ath10k_core-$(CPTCFG_ATH10K_THERMAL) += thermal.o + ath10k_core-$(CPTCFG_ATH10K_LEDS) += leds.o ath10k_core-$(CPTCFG_MAC80211_DEBUGFS) += debugfs_sta.o ath10k_core-$(CONFIG_PM) += wow.o - ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o --- a/drivers/net/wireless/ath/ath10k/thermal.h +++ b/drivers/net/wireless/ath/ath10k/thermal.h @@ -25,7 +25,7 @@ struct ath10k_thermal { @@ -37,9 +37,9 @@ void ath10k_thermal_event_temperature(struct ath10k *ar, int temperature); --- a/local-symbols +++ b/local-symbols -@@ -153,6 +153,7 @@ ATH10K_SNOC= - ATH10K_DEBUG= +@@ -156,6 +156,7 @@ ATH10K_DEBUG= ATH10K_DEBUGFS= + ATH10K_LEDS= ATH10K_SPECTRAL= +ATH10K_THERMAL= ATH10K_TRACING= diff --git a/package/kernel/mac80211/patches/ath10k/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/ath10k/921-ath10k_init_devices_synchronously.patch index 479c74e4734..a7e11679a31 100644 --- a/package/kernel/mac80211/patches/ath10k/921-ath10k_init_devices_synchronously.patch +++ b/package/kernel/mac80211/patches/ath10k/921-ath10k_init_devices_synchronously.patch @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -3527,6 +3527,16 @@ int ath10k_core_register(struct ath10k * +@@ -3539,6 +3539,16 @@ int ath10k_core_register(struct ath10k * queue_work(ar->workqueue, &ar->register_work); diff --git a/package/kernel/mac80211/patches/ath10k/930-ath10k_add_tpt_led_trigger.patch b/package/kernel/mac80211/patches/ath10k/930-ath10k_add_tpt_led_trigger.patch index c9ad4018c81..b13bc334982 100644 --- a/package/kernel/mac80211/patches/ath10k/930-ath10k_add_tpt_led_trigger.patch +++ b/package/kernel/mac80211/patches/ath10k/930-ath10k_add_tpt_led_trigger.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -9918,6 +9918,21 @@ static int ath10k_mac_init_rd(struct ath +@@ -9919,6 +9919,21 @@ static int ath10k_mac_init_rd(struct ath return 0; } @@ -22,7 +22,7 @@ int ath10k_mac_register(struct ath10k *ar) { static const u32 cipher_suites[] = { -@@ -10280,6 +10295,12 @@ int ath10k_mac_register(struct ath10k *a +@@ -10281,6 +10296,12 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; diff --git a/package/kernel/mac80211/patches/ath10k/974-wifi-ath10k-add-LED-and-GPIO-controlling-support-for.patch b/package/kernel/mac80211/patches/ath10k/974-wifi-ath10k-add-LED-and-GPIO-controlling-support-for.patch deleted file mode 100644 index a9eb38e5764..00000000000 --- a/package/kernel/mac80211/patches/ath10k/974-wifi-ath10k-add-LED-and-GPIO-controlling-support-for.patch +++ /dev/null @@ -1,626 +0,0 @@ -From 8e1debd82466a3fe711784ab37e6b54e56011267 Mon Sep 17 00:00:00 2001 -From: Sebastian Gottschall -Date: Mon, 13 May 2024 17:22:25 +0300 -Subject: [PATCH] wifi: ath10k: add LED and GPIO controlling support for - various chipsets - -Adds LED and GPIO Control support for 988x, 9887, 9888, 99x0, 9984 -based chipsets with on chipset connected led's using WMI Firmware API. -The LED device will get available named as "ath10k-phyX" at sysfs and -can be controlled with various triggers. -Adds also debugfs interface for gpio control. - -Signed-off-by: Sebastian Gottschall -Reviewed-by: Steve deRosier -[kvalo: major reorg and cleanup] -Signed-off-by: Kalle Valo -[ansuel: rebase and small cleanup] -Signed-off-by: Christian Marangi -Tested-by: Stefan Lippers-Hollmann -Signed-off-by: Kalle Valo -Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com ---- - drivers/net/wireless/ath/ath10k/Kconfig | 6 ++ - drivers/net/wireless/ath/ath10k/Makefile | 1 + - drivers/net/wireless/ath/ath10k/core.c | 32 ++++++++ - drivers/net/wireless/ath/ath10k/core.h | 8 ++ - drivers/net/wireless/ath/ath10k/hw.h | 1 + - drivers/net/wireless/ath/ath10k/leds.c | 90 +++++++++++++++++++++++ - drivers/net/wireless/ath/ath10k/leds.h | 34 +++++++++ - drivers/net/wireless/ath/ath10k/mac.c | 1 + - drivers/net/wireless/ath/ath10k/wmi-ops.h | 32 ++++++++ - drivers/net/wireless/ath/ath10k/wmi-tlv.c | 2 + - drivers/net/wireless/ath/ath10k/wmi.c | 54 ++++++++++++++ - drivers/net/wireless/ath/ath10k/wmi.h | 35 +++++++++ - 12 files changed, 296 insertions(+) - create mode 100644 drivers/net/wireless/ath/ath10k/leds.c - create mode 100644 drivers/net/wireless/ath/ath10k/leds.h - ---- a/drivers/net/wireless/ath/ath10k/Kconfig -+++ b/drivers/net/wireless/ath/ath10k/Kconfig -@@ -73,6 +73,12 @@ config ATH10K_DEBUGFS - - If unsure, say Y to make it easier to debug problems. - -+config ATH10K_LEDS -+ bool -+ depends on ATH10K -+ depends on LEDS_CLASS=y || LEDS_CLASS=MAC80211 -+ default y -+ - config ATH10K_SPECTRAL - bool "Atheros ath10k spectral scan support" - depends on ATH10K_DEBUGFS ---- a/drivers/net/wireless/ath/ath10k/Makefile -+++ b/drivers/net/wireless/ath/ath10k/Makefile -@@ -19,6 +19,7 @@ ath10k_core-$(CPTCFG_ATH10K_SPECTRAL) += - ath10k_core-$(CPTCFG_NL80211_TESTMODE) += testmode.o - ath10k_core-$(CPTCFG_ATH10K_TRACING) += trace.o - ath10k_core-$(CPTCFG_ATH10K_THERMAL) += thermal.o -+ath10k_core-$(CPTCFG_ATH10K_LEDS) += leds.o - ath10k_core-$(CPTCFG_MAC80211_DEBUGFS) += debugfs_sta.o - ath10k_core-$(CONFIG_PM) += wow.o - ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o ---- a/local-symbols -+++ b/local-symbols -@@ -154,6 +154,7 @@ ATH10K_DEBUG= - ATH10K_DEBUGFS= - ATH10K_SPECTRAL= - ATH10K_THERMAL= -+ATH10K_LEDS= - ATH10K_TRACING= - ATH10K_DFS_CERTIFIED= - WCN36XX= ---- a/drivers/net/wireless/ath/ath10k/core.c -+++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -27,6 +27,7 @@ - #include "testmode.h" - #include "wmi-ops.h" - #include "coredump.h" -+#include "leds.h" - - unsigned int ath10k_debug_mask; - EXPORT_SYMBOL(ath10k_debug_mask); -@@ -68,6 +69,7 @@ static const struct ath10k_hw_params ath - .name = "qca988x hw2.0", - .patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR, - .uart_pin = 7, -+ .led_pin = 1, - .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, - .otp_exe_param = 0, - .channel_counters_freq_hz = 88000, -@@ -109,6 +111,7 @@ static const struct ath10k_hw_params ath - .name = "qca988x hw2.0 ubiquiti", - .patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR, - .uart_pin = 7, -+ .led_pin = 0, - .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, - .otp_exe_param = 0, - .channel_counters_freq_hz = 88000, -@@ -151,6 +154,7 @@ static const struct ath10k_hw_params ath - .name = "qca9887 hw1.0", - .patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR, - .uart_pin = 7, -+ .led_pin = 1, - .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, - .otp_exe_param = 0, - .channel_counters_freq_hz = 88000, -@@ -193,6 +197,7 @@ static const struct ath10k_hw_params ath - .name = "qca6174 hw3.2 sdio", - .patch_load_addr = QCA6174_HW_3_0_PATCH_LOAD_ADDR, - .uart_pin = 19, -+ .led_pin = 0, - .otp_exe_param = 0, - .channel_counters_freq_hz = 88000, - .max_probe_resp_desc_thres = 0, -@@ -230,6 +235,7 @@ static const struct ath10k_hw_params ath - .name = "qca6164 hw2.1", - .patch_load_addr = QCA6174_HW_2_1_PATCH_LOAD_ADDR, - .uart_pin = 6, -+ .led_pin = 0, - .otp_exe_param = 0, - .channel_counters_freq_hz = 88000, - .max_probe_resp_desc_thres = 0, -@@ -271,6 +277,7 @@ static const struct ath10k_hw_params ath - .name = "qca6174 hw2.1", - .patch_load_addr = QCA6174_HW_2_1_PATCH_LOAD_ADDR, - .uart_pin = 6, -+ .led_pin = 0, - .otp_exe_param = 0, - .channel_counters_freq_hz = 88000, - .max_probe_resp_desc_thres = 0, -@@ -312,6 +319,7 @@ static const struct ath10k_hw_params ath - .name = "qca6174 hw3.0", - .patch_load_addr = QCA6174_HW_3_0_PATCH_LOAD_ADDR, - .uart_pin = 6, -+ .led_pin = 0, - .otp_exe_param = 0, - .channel_counters_freq_hz = 88000, - .max_probe_resp_desc_thres = 0, -@@ -353,6 +361,7 @@ static const struct ath10k_hw_params ath - .name = "qca6174 hw3.2", - .patch_load_addr = QCA6174_HW_3_0_PATCH_LOAD_ADDR, - .uart_pin = 6, -+ .led_pin = 0, - .otp_exe_param = 0, - .channel_counters_freq_hz = 88000, - .max_probe_resp_desc_thres = 0, -@@ -398,6 +407,7 @@ static const struct ath10k_hw_params ath - .name = "qca99x0 hw2.0", - .patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR, - .uart_pin = 7, -+ .led_pin = 17, - .otp_exe_param = 0x00000700, - .continuous_frag_desc = true, - .cck_rate_map_rev2 = true, -@@ -445,6 +455,7 @@ static const struct ath10k_hw_params ath - .name = "qca9984/qca9994 hw1.0", - .patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR, - .uart_pin = 7, -+ .led_pin = 17, - .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, - .otp_exe_param = 0x00000700, - .continuous_frag_desc = true, -@@ -499,6 +510,7 @@ static const struct ath10k_hw_params ath - .name = "qca9888 hw2.0", - .patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR, - .uart_pin = 7, -+ .led_pin = 17, - .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, - .otp_exe_param = 0x00000700, - .continuous_frag_desc = true, -@@ -550,6 +562,7 @@ static const struct ath10k_hw_params ath - .name = "qca9377 hw1.0", - .patch_load_addr = QCA9377_HW_1_0_PATCH_LOAD_ADDR, - .uart_pin = 6, -+ .led_pin = 0, - .otp_exe_param = 0, - .channel_counters_freq_hz = 88000, - .max_probe_resp_desc_thres = 0, -@@ -591,6 +604,7 @@ static const struct ath10k_hw_params ath - .name = "qca9377 hw1.1", - .patch_load_addr = QCA9377_HW_1_0_PATCH_LOAD_ADDR, - .uart_pin = 6, -+ .led_pin = 0, - .otp_exe_param = 0, - .channel_counters_freq_hz = 88000, - .max_probe_resp_desc_thres = 0, -@@ -634,6 +648,7 @@ static const struct ath10k_hw_params ath - .name = "qca9377 hw1.1 sdio", - .patch_load_addr = QCA9377_HW_1_0_PATCH_LOAD_ADDR, - .uart_pin = 19, -+ .led_pin = 0, - .otp_exe_param = 0, - .channel_counters_freq_hz = 88000, - .max_probe_resp_desc_thres = 0, -@@ -668,6 +683,7 @@ static const struct ath10k_hw_params ath - .name = "qca4019 hw1.0", - .patch_load_addr = QCA4019_HW_1_0_PATCH_LOAD_ADDR, - .uart_pin = 7, -+ .led_pin = 0, - .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, - .otp_exe_param = 0x0010000, - .continuous_frag_desc = true, -@@ -714,6 +730,7 @@ static const struct ath10k_hw_params ath - .dev_id = 0, - .bus = ATH10K_BUS_SNOC, - .name = "wcn3990 hw1.0", -+ .led_pin = 0, - .continuous_frag_desc = true, - .tx_chain_mask = 0x7, - .rx_chain_mask = 0x7, -@@ -3242,6 +3259,10 @@ int ath10k_core_start(struct ath10k *ar, - goto err_hif_stop; - } - -+ status = ath10k_leds_start(ar); -+ if (status) -+ goto err_hif_stop; -+ - return 0; - - err_hif_stop: -@@ -3500,9 +3521,18 @@ static void ath10k_core_register_work(st - goto err_spectral_destroy; - } - -+ status = ath10k_leds_register(ar); -+ if (status) { -+ ath10k_err(ar, "could not register leds: %d\n", -+ status); -+ goto err_thermal_unregister; -+ } -+ - set_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags); - return; - -+err_thermal_unregister: -+ ath10k_thermal_unregister(ar); - err_spectral_destroy: - ath10k_spectral_destroy(ar); - err_debug_destroy: -@@ -3548,6 +3578,8 @@ void ath10k_core_unregister(struct ath10 - if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags)) - return; - -+ ath10k_leds_unregister(ar); -+ - ath10k_thermal_unregister(ar); - /* Stop spectral before unregistering from mac80211 to remove the - * relayfs debugfs file cleanly. Otherwise the parent debugfs tree ---- a/drivers/net/wireless/ath/ath10k/core.h -+++ b/drivers/net/wireless/ath/ath10k/core.h -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - - #include "htt.h" - #include "htc.h" -@@ -1257,6 +1258,13 @@ struct ath10k { - } testmode; - - struct { -+ struct gpio_led wifi_led; -+ struct led_classdev cdev; -+ char label[48]; -+ u32 gpio_state_pin; -+ } leds; -+ -+ struct { - /* protected by data_lock */ - u32 rx_crc_err_drop; - u32 fw_crash_counter; ---- a/drivers/net/wireless/ath/ath10k/hw.h -+++ b/drivers/net/wireless/ath/ath10k/hw.h -@@ -521,6 +521,7 @@ struct ath10k_hw_params { - const char *name; - u32 patch_load_addr; - int uart_pin; -+ int led_pin; - u32 otp_exe_param; - - /* Type of hw cycle counter wraparound logic, for more info ---- /dev/null -+++ b/drivers/net/wireless/ath/ath10k/leds.c -@@ -0,0 +1,90 @@ -+// SPDX-License-Identifier: ISC -+/* -+ * Copyright (c) 2005-2011 Atheros Communications Inc. -+ * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. -+ * Copyright (c) 2018 Sebastian Gottschall -+ * Copyright (c) 2018 The Linux Foundation. All rights reserved. -+ */ -+ -+#include -+ -+#include "core.h" -+#include "wmi.h" -+#include "wmi-ops.h" -+ -+#include "leds.h" -+ -+static int ath10k_leds_set_brightness_blocking(struct led_classdev *led_cdev, -+ enum led_brightness brightness) -+{ -+ struct ath10k *ar = container_of(led_cdev, struct ath10k, -+ leds.cdev); -+ struct gpio_led *led = &ar->leds.wifi_led; -+ -+ mutex_lock(&ar->conf_mutex); -+ -+ if (ar->state != ATH10K_STATE_ON) -+ goto out; -+ -+ ar->leds.gpio_state_pin = (brightness != LED_OFF) ^ led->active_low; -+ ath10k_wmi_gpio_output(ar, led->gpio, ar->leds.gpio_state_pin); -+ -+out: -+ mutex_unlock(&ar->conf_mutex); -+ -+ return 0; -+} -+ -+int ath10k_leds_start(struct ath10k *ar) -+{ -+ if (ar->hw_params.led_pin == 0) -+ /* leds not supported */ -+ return 0; -+ -+ /* under some circumstances, the gpio pin gets reconfigured -+ * to default state by the firmware, so we need to -+ * reconfigure it this behaviour has only ben seen on -+ * QCA9984 and QCA99XX devices so far -+ */ -+ ath10k_wmi_gpio_config(ar, ar->hw_params.led_pin, 0, -+ WMI_GPIO_PULL_NONE, WMI_GPIO_INTTYPE_DISABLE); -+ ath10k_wmi_gpio_output(ar, ar->hw_params.led_pin, 1); -+ -+ return 0; -+} -+ -+int ath10k_leds_register(struct ath10k *ar) -+{ -+ int ret; -+ -+ if (ar->hw_params.led_pin == 0) -+ /* leds not supported */ -+ return 0; -+ -+ snprintf(ar->leds.label, sizeof(ar->leds.label), "ath10k-%s", -+ wiphy_name(ar->hw->wiphy)); -+ ar->leds.wifi_led.active_low = 1; -+ ar->leds.wifi_led.gpio = ar->hw_params.led_pin; -+ ar->leds.wifi_led.name = ar->leds.label; -+ ar->leds.wifi_led.default_state = LEDS_GPIO_DEFSTATE_KEEP; -+ -+ ar->leds.cdev.name = ar->leds.label; -+ ar->leds.cdev.brightness_set_blocking = ath10k_leds_set_brightness_blocking; -+ ar->leds.cdev.default_trigger = ar->leds.wifi_led.default_trigger; -+ -+ ret = led_classdev_register(wiphy_dev(ar->hw->wiphy), &ar->leds.cdev); -+ if (ret) -+ return ret; -+ -+ return 0; -+} -+ -+void ath10k_leds_unregister(struct ath10k *ar) -+{ -+ if (ar->hw_params.led_pin == 0) -+ /* leds not supported */ -+ return; -+ -+ led_classdev_unregister(&ar->leds.cdev); -+} -+ ---- /dev/null -+++ b/drivers/net/wireless/ath/ath10k/leds.h -@@ -0,0 +1,34 @@ -+/* SPDX-License-Identifier: ISC */ -+/* -+ * Copyright (c) 2005-2011 Atheros Communications Inc. -+ * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. -+ * Copyright (c) 2018 Sebastian Gottschall -+ * Copyright (c) 2018 The Linux Foundation. All rights reserved. -+ */ -+ -+#ifndef _LEDS_H_ -+#define _LEDS_H_ -+ -+#include "core.h" -+ -+#ifdef CPTCFG_ATH10K_LEDS -+void ath10k_leds_unregister(struct ath10k *ar); -+int ath10k_leds_start(struct ath10k *ar); -+int ath10k_leds_register(struct ath10k *ar); -+#else -+static inline void ath10k_leds_unregister(struct ath10k *ar) -+{ -+} -+ -+static inline int ath10k_leds_start(struct ath10k *ar) -+{ -+ return 0; -+} -+ -+static inline int ath10k_leds_register(struct ath10k *ar) -+{ -+ return 0; -+} -+ -+#endif -+#endif /* _LEDS_H_ */ ---- a/drivers/net/wireless/ath/ath10k/mac.c -+++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -25,6 +25,7 @@ - #include "wmi-tlv.h" - #include "wmi-ops.h" - #include "wow.h" -+#include "leds.h" - - /*********/ - /* Rates */ ---- a/drivers/net/wireless/ath/ath10k/wmi-ops.h -+++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h -@@ -226,7 +226,10 @@ struct wmi_ops { - const struct wmi_bb_timing_cfg_arg *arg); - struct sk_buff *(*gen_per_peer_per_tid_cfg)(struct ath10k *ar, - const struct wmi_per_peer_per_tid_cfg_arg *arg); -+ struct sk_buff *(*gen_gpio_config)(struct ath10k *ar, u32 gpio_num, -+ u32 input, u32 pull_type, u32 intr_mode); - -+ struct sk_buff *(*gen_gpio_output)(struct ath10k *ar, u32 gpio_num, u32 set); - }; - - int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id); -@@ -1122,6 +1125,35 @@ ath10k_wmi_force_fw_hang(struct ath10k * - return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->force_fw_hang_cmdid); - } - -+static inline int ath10k_wmi_gpio_config(struct ath10k *ar, u32 gpio_num, -+ u32 input, u32 pull_type, u32 intr_mode) -+{ -+ struct sk_buff *skb; -+ -+ if (!ar->wmi.ops->gen_gpio_config) -+ return -EOPNOTSUPP; -+ -+ skb = ar->wmi.ops->gen_gpio_config(ar, gpio_num, input, pull_type, intr_mode); -+ if (IS_ERR(skb)) -+ return PTR_ERR(skb); -+ -+ return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->gpio_config_cmdid); -+} -+ -+static inline int ath10k_wmi_gpio_output(struct ath10k *ar, u32 gpio_num, u32 set) -+{ -+ struct sk_buff *skb; -+ -+ if (!ar->wmi.ops->gen_gpio_config) -+ return -EOPNOTSUPP; -+ -+ skb = ar->wmi.ops->gen_gpio_output(ar, gpio_num, set); -+ if (IS_ERR(skb)) -+ return PTR_ERR(skb); -+ -+ return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->gpio_output_cmdid); -+} -+ - static inline int - ath10k_wmi_dbglog_cfg(struct ath10k *ar, u64 module_enable, u32 log_level) - { ---- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c -+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c -@@ -4606,6 +4606,8 @@ static const struct wmi_ops wmi_tlv_ops - .gen_echo = ath10k_wmi_tlv_op_gen_echo, - .gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf, - .gen_vdev_spectral_enable = ath10k_wmi_tlv_op_gen_vdev_spectral_enable, -+ /* .gen_gpio_config not implemented */ -+ /* .gen_gpio_output not implemented */ - }; - - static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = { ---- a/drivers/net/wireless/ath/ath10k/wmi.c -+++ b/drivers/net/wireless/ath/ath10k/wmi.c -@@ -7493,6 +7493,49 @@ ath10k_wmi_op_gen_peer_set_param(struct - return skb; - } - -+static struct sk_buff *ath10k_wmi_op_gen_gpio_config(struct ath10k *ar, -+ u32 gpio_num, u32 input, -+ u32 pull_type, u32 intr_mode) -+{ -+ struct wmi_gpio_config_cmd *cmd; -+ struct sk_buff *skb; -+ -+ skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); -+ if (!skb) -+ return ERR_PTR(-ENOMEM); -+ -+ cmd = (struct wmi_gpio_config_cmd *)skb->data; -+ cmd->pull_type = __cpu_to_le32(pull_type); -+ cmd->gpio_num = __cpu_to_le32(gpio_num); -+ cmd->input = __cpu_to_le32(input); -+ cmd->intr_mode = __cpu_to_le32(intr_mode); -+ -+ ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi gpio_config gpio_num 0x%08x input 0x%08x pull_type 0x%08x intr_mode 0x%08x\n", -+ gpio_num, input, pull_type, intr_mode); -+ -+ return skb; -+} -+ -+static struct sk_buff *ath10k_wmi_op_gen_gpio_output(struct ath10k *ar, -+ u32 gpio_num, u32 set) -+{ -+ struct wmi_gpio_output_cmd *cmd; -+ struct sk_buff *skb; -+ -+ skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); -+ if (!skb) -+ return ERR_PTR(-ENOMEM); -+ -+ cmd = (struct wmi_gpio_output_cmd *)skb->data; -+ cmd->gpio_num = __cpu_to_le32(gpio_num); -+ cmd->set = __cpu_to_le32(set); -+ -+ ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi gpio_output gpio_num 0x%08x set 0x%08x\n", -+ gpio_num, set); -+ -+ return skb; -+} -+ - static struct sk_buff * - ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id, - enum wmi_sta_ps_mode psmode) -@@ -9157,6 +9200,9 @@ static const struct wmi_ops wmi_ops = { - .fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill, - .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, - .gen_echo = ath10k_wmi_op_gen_echo, -+ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config, -+ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output, -+ - /* .gen_bcn_tmpl not implemented */ - /* .gen_prb_tmpl not implemented */ - /* .gen_p2p_go_bcn_ie not implemented */ -@@ -9227,6 +9273,8 @@ static const struct wmi_ops wmi_10_1_ops - .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, - .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, - .gen_echo = ath10k_wmi_op_gen_echo, -+ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config, -+ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output, - /* .gen_bcn_tmpl not implemented */ - /* .gen_prb_tmpl not implemented */ - /* .gen_p2p_go_bcn_ie not implemented */ -@@ -9299,6 +9347,8 @@ static const struct wmi_ops wmi_10_2_ops - .gen_delba_send = ath10k_wmi_op_gen_delba_send, - .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill, - .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype, -+ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config, -+ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output, - /* .gen_pdev_enable_adaptive_cca not implemented */ - }; - -@@ -9370,6 +9420,8 @@ static const struct wmi_ops wmi_10_2_4_o - ath10k_wmi_op_gen_pdev_enable_adaptive_cca, - .get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype, - .gen_bb_timing = ath10k_wmi_10_2_4_op_gen_bb_timing, -+ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config, -+ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output, - /* .gen_bcn_tmpl not implemented */ - /* .gen_prb_tmpl not implemented */ - /* .gen_p2p_go_bcn_ie not implemented */ -@@ -9451,6 +9503,8 @@ static const struct wmi_ops wmi_10_4_ops - .gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info, - .gen_echo = ath10k_wmi_op_gen_echo, - .gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config, -+ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config, -+ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output, - }; - - int ath10k_wmi_attach(struct ath10k *ar) ---- a/drivers/net/wireless/ath/ath10k/wmi.h -+++ b/drivers/net/wireless/ath/ath10k/wmi.h -@@ -3034,6 +3034,41 @@ enum wmi_10_4_feature_mask { - - }; - -+/* WMI_GPIO_CPTCFG_CMDID */ -+enum { -+ WMI_GPIO_PULL_NONE, -+ WMI_GPIO_PULL_UP, -+ WMI_GPIO_PULL_DOWN, -+}; -+ -+enum { -+ WMI_GPIO_INTTYPE_DISABLE, -+ WMI_GPIO_INTTYPE_RISING_EDGE, -+ WMI_GPIO_INTTYPE_FALLING_EDGE, -+ WMI_GPIO_INTTYPE_BOTH_EDGE, -+ WMI_GPIO_INTTYPE_LEVEL_LOW, -+ WMI_GPIO_INTTYPE_LEVEL_HIGH -+}; -+ -+/* WMI_GPIO_CPTCFG_CMDID */ -+struct wmi_gpio_config_cmd { -+ __le32 gpio_num; /* GPIO number to be setup */ -+ __le32 input; /* 0 - Output/ 1 - Input */ -+ __le32 pull_type; /* Pull type defined above */ -+ __le32 intr_mode; /* Interrupt mode defined above (Input) */ -+} __packed; -+ -+/* WMI_GPIO_OUTPUT_CMDID */ -+struct wmi_gpio_output_cmd { -+ __le32 gpio_num; /* GPIO number to be setup */ -+ __le32 set; /* Set the GPIO pin*/ -+} __packed; -+ -+/* WMI_GPIO_INPUT_EVENTID */ -+struct wmi_gpio_input_event { -+ __le32 gpio_num; /* GPIO number which changed state */ -+} __packed; -+ - struct wmi_ext_resource_config_10_4_cmd { - /* contains enum wmi_host_platform_type */ - __le32 host_platform_config; diff --git a/package/kernel/mac80211/patches/ath10k/975-ath10k-use-tpt-trigger-by-default.patch b/package/kernel/mac80211/patches/ath10k/975-ath10k-use-tpt-trigger-by-default.patch index 5bd9186d192..fc41f5f1511 100644 --- a/package/kernel/mac80211/patches/ath10k/975-ath10k-use-tpt-trigger-by-default.patch +++ b/package/kernel/mac80211/patches/ath10k/975-ath10k-use-tpt-trigger-by-default.patch @@ -16,7 +16,7 @@ Signed-off-by: Mathias Kresin --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h -@@ -1313,6 +1313,10 @@ struct ath10k { +@@ -1315,6 +1315,10 @@ struct ath10k { s32 tx_power_2g_limit; s32 tx_power_5g_limit; diff --git a/package/kernel/mac80211/patches/ath10k/984-ath10k-Try-to-get-mac-address-from-dts.patch b/package/kernel/mac80211/patches/ath10k/984-ath10k-Try-to-get-mac-address-from-dts.patch index 5d70df15adc..beec6a95eaf 100644 --- a/package/kernel/mac80211/patches/ath10k/984-ath10k-Try-to-get-mac-address-from-dts.patch +++ b/package/kernel/mac80211/patches/ath10k/984-ath10k-Try-to-get-mac-address-from-dts.patch @@ -26,7 +26,7 @@ Signed-off-by: Ansuel Smith #include #include #include -@@ -3429,6 +3430,8 @@ static int ath10k_core_probe_fw(struct a +@@ -3411,6 +3412,8 @@ static int ath10k_core_probe_fw(struct a device_get_mac_address(ar->dev, ar->mac_addr); diff --git a/package/kernel/mac80211/patches/ath11k/100-wifi-ath11k-use-unique-QRTR-instance-ID.patch b/package/kernel/mac80211/patches/ath11k/100-wifi-ath11k-use-unique-QRTR-instance-ID.patch index f1583b6e96a..272876288b7 100644 --- a/package/kernel/mac80211/patches/ath11k/100-wifi-ath11k-use-unique-QRTR-instance-ID.patch +++ b/package/kernel/mac80211/patches/ath11k/100-wifi-ath11k-use-unique-QRTR-instance-ID.patch @@ -93,9 +93,9 @@ Signed-off-by: Robert Marko default: return "UNKNOWN"; } -@@ -282,27 +312,14 @@ static void ath11k_mhi_op_status_cb(stru - if (!(test_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags))) +@@ -290,6 +320,9 @@ static void ath11k_mhi_op_status_cb(stru queue_work(ab->workqueue_aux, &ab->reset_work); + break; + case MHI_CB_EE_SBL_MODE: + ath11k_mhi_qrtr_instance_set(mhi_cntrl); @@ -103,6 +103,8 @@ Signed-off-by: Robert Marko default: break; } +@@ -297,22 +330,6 @@ static void ath11k_mhi_op_status_cb(stru + ab_pci->mhi_pre_cb = cb; } -static int ath11k_mhi_op_read_reg(struct mhi_controller *mhi_cntrl, diff --git a/package/kernel/mac80211/patches/ath11k/101-wifi-ath11k-add-support-DT-ieee80211-freq-limit.patch b/package/kernel/mac80211/patches/ath11k/101-wifi-ath11k-add-support-DT-ieee80211-freq-limit.patch deleted file mode 100644 index 6088b26e6ba..00000000000 --- a/package/kernel/mac80211/patches/ath11k/101-wifi-ath11k-add-support-DT-ieee80211-freq-limit.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 1338da257f299d35b4d954b9fda2cc7e0a54a69d Mon Sep 17 00:00:00 2001 -From: Christian Lamparter -Date: Sun, 11 Jun 2023 14:37:32 +0200 -Subject: [PATCH] wifi: ath11k: add support DT ieee80211-freq-limit - -The common DT property can be used to limit the available -channels/frequencies. But ath11k has to manually call -wiphy_read_of_freq_limits(). - -Signed-off-by: Christian Lamparter ---- - drivers/net/wireless/ath/ath11k/mac.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -10034,6 +10034,7 @@ static int __ath11k_mac_register(struct - if (ret) - goto err; - -+ wiphy_read_of_freq_limits(ar->hw->wiphy); - ath11k_mac_setup_ht_vht_cap(ar, cap, &ht_cap); - ath11k_mac_setup_he_cap(ar, cap); - diff --git a/package/kernel/mac80211/patches/ath11k/900-ath11k-control-thermal-support-via-symbol.patch b/package/kernel/mac80211/patches/ath11k/900-ath11k-control-thermal-support-via-symbol.patch index 6b351cc81d7..6a0e4ff77ea 100644 --- a/package/kernel/mac80211/patches/ath11k/900-ath11k-control-thermal-support-via-symbol.patch +++ b/package/kernel/mac80211/patches/ath11k/900-ath11k-control-thermal-support-via-symbol.patch @@ -21,7 +21,7 @@ Signed-off-by: Robert Marko --- a/drivers/net/wireless/ath/ath11k/Kconfig +++ b/drivers/net/wireless/ath/ath11k/Kconfig -@@ -61,3 +61,10 @@ config ATH11K_SPECTRAL +@@ -62,3 +62,10 @@ config ATH11K_SPECTRAL Enable ath11k spectral scan support Say Y to enable access to the FFT/spectral data via debugfs. @@ -34,7 +34,7 @@ Signed-off-by: Robert Marko + Enable ath11k thermal sensors and throttling support. --- a/drivers/net/wireless/ath/ath11k/Makefile +++ b/drivers/net/wireless/ath/ath11k/Makefile -@@ -23,7 +23,7 @@ ath11k-y += core.o \ +@@ -24,7 +24,7 @@ ath11k-y += core.o \ ath11k-$(CPTCFG_ATH11K_DEBUGFS) += debugfs.o debugfs_htt_stats.o debugfs_sta.o ath11k-$(CPTCFG_NL80211_TESTMODE) += testmode.o ath11k-$(CPTCFG_ATH11K_TRACING) += trace.o @@ -56,11 +56,11 @@ Signed-off-by: Robert Marko int ath11k_thermal_set_throttling(struct ath11k *ar, u32 throttle_state); --- a/local-symbols +++ b/local-symbols -@@ -166,6 +166,7 @@ ATH11K_DEBUG= +@@ -168,6 +168,7 @@ ATH11K_DEBUG= ATH11K_DEBUGFS= ATH11K_TRACING= ATH11K_SPECTRAL= +ATH11K_THERMAL= ATH12K= ATH12K_DEBUG= - ATH12K_TRACING= + ATH12K_DEBUGFS= diff --git a/package/kernel/mac80211/patches/ath11k/903-ath11k-support-setting-FW-memory-mode-via-DT.patch b/package/kernel/mac80211/patches/ath11k/903-ath11k-support-setting-FW-memory-mode-via-DT.patch index dcf1f5f2765..1250147e2bd 100644 --- a/package/kernel/mac80211/patches/ath11k/903-ath11k-support-setting-FW-memory-mode-via-DT.patch +++ b/package/kernel/mac80211/patches/ath11k/903-ath11k-support-setting-FW-memory-mode-via-DT.patch @@ -31,7 +31,7 @@ Signed-off-by: Robert Marko { .hw_rev = ATH11K_HW_IPQ8074, .name = "ipq8074 hw2.0", -@@ -2138,7 +2138,8 @@ static void ath11k_core_reset(struct wor +@@ -2147,7 +2147,8 @@ static void ath11k_core_reset(struct wor static int ath11k_init_hw_params(struct ath11k_base *ab) { const struct ath11k_hw_params *hw_params = NULL; @@ -41,7 +41,7 @@ Signed-off-by: Robert Marko for (i = 0; i < ARRAY_SIZE(ath11k_hw_params); i++) { hw_params = &ath11k_hw_params[i]; -@@ -2154,7 +2155,31 @@ static int ath11k_init_hw_params(struct +@@ -2163,7 +2164,31 @@ static int ath11k_init_hw_params(struct ab->hw_params = *hw_params; diff --git a/package/kernel/mac80211/patches/ath11k/905-ath11k-remove-intersection-support-for-regulatory-ru.patch b/package/kernel/mac80211/patches/ath11k/905-ath11k-remove-intersection-support-for-regulatory-ru.patch index 19f4e7dbe26..f30e03475f5 100644 --- a/package/kernel/mac80211/patches/ath11k/905-ath11k-remove-intersection-support-for-regulatory-ru.patch +++ b/package/kernel/mac80211/patches/ath11k/905-ath11k-remove-intersection-support-for-regulatory-ru.patch @@ -23,7 +23,7 @@ Signed-off-by: Aditya Kumar Singh --- a/drivers/net/wireless/ath/ath11k/reg.c +++ b/drivers/net/wireless/ath/ath11k/reg.c -@@ -363,134 +363,6 @@ static u32 ath11k_map_fw_phy_flags(u32 p +@@ -361,134 +361,6 @@ static u32 ath11k_map_fw_phy_flags(u32 p return flags; } @@ -158,7 +158,7 @@ Signed-off-by: Aditya Kumar Singh static const char * ath11k_reg_get_regdom_str(enum nl80211_dfs_regions dfs_region) { -@@ -641,11 +513,11 @@ ath11k_reg_ap_pwr_convert(enum ieee80211 +@@ -639,11 +511,11 @@ ath11k_reg_ap_pwr_convert(enum ieee80211 struct ieee80211_regdomain * ath11k_reg_build_regd(struct ath11k_base *ab, @@ -172,7 +172,7 @@ Signed-off-by: Aditya Kumar Singh struct cur_reg_rule *reg_rule, *reg_rule_6ghz; u8 i = 0, j = 0, k = 0; u8 num_rules; -@@ -688,26 +560,26 @@ ath11k_reg_build_regd(struct ath11k_base +@@ -686,26 +558,26 @@ ath11k_reg_build_regd(struct ath11k_base } if (!num_rules) @@ -206,7 +206,7 @@ Signed-off-by: Aditya Kumar Singh reg_info->dfs_region, num_rules); /* Update reg_rules[] below. Firmware is expected to * send these rules in order(2 GHz rules first and then 5 GHz) -@@ -746,7 +618,7 @@ ath11k_reg_build_regd(struct ath11k_base +@@ -744,7 +616,7 @@ ath11k_reg_build_regd(struct ath11k_base flags |= ath11k_map_fw_reg_flags(reg_rule->flags); flags |= ath11k_map_fw_phy_flags(reg_info->phybitmap); @@ -215,7 +215,7 @@ Signed-off-by: Aditya Kumar Singh reg_rule->start_freq, reg_rule->end_freq, max_bw, reg_rule->ant_gain, reg_rule->reg_power, -@@ -761,7 +633,7 @@ ath11k_reg_build_regd(struct ath11k_base +@@ -759,7 +631,7 @@ ath11k_reg_build_regd(struct ath11k_base reg_info->dfs_region == ATH11K_DFS_REG_ETSI && (reg_rule->end_freq > ETSI_WEATHER_RADAR_BAND_LOW && reg_rule->start_freq < ETSI_WEATHER_RADAR_BAND_HIGH)){ @@ -224,7 +224,7 @@ Signed-off-by: Aditya Kumar Singh reg_rule, &i, flags, max_bw); continue; -@@ -772,51 +644,23 @@ ath11k_reg_build_regd(struct ath11k_base +@@ -770,51 +642,23 @@ ath11k_reg_build_regd(struct ath11k_base "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d) (%d, %d)\n", i + 1, reg_rule->start_freq, reg_rule->end_freq, max_bw, reg_rule->ant_gain, reg_rule->reg_power, @@ -279,7 +279,7 @@ Signed-off-by: Aditya Kumar Singh static enum wmi_vdev_type ath11k_reg_get_ar_vdev_type(struct ath11k *ar) { struct ath11k_vif *arvif; -@@ -839,7 +683,6 @@ int ath11k_reg_handle_chan_list(struct a +@@ -837,7 +681,6 @@ int ath11k_reg_handle_chan_list(struct a enum ieee80211_ap_reg_power power_type) { struct ieee80211_regdomain *regd; @@ -287,7 +287,7 @@ Signed-off-by: Aditya Kumar Singh int pdev_idx; struct ath11k *ar; enum wmi_vdev_type vdev_type; -@@ -891,24 +734,14 @@ int ath11k_reg_handle_chan_list(struct a +@@ -889,24 +732,14 @@ int ath11k_reg_handle_chan_list(struct a (char *)reg_info->alpha2, 2)) goto retfail; diff --git a/package/kernel/mac80211/patches/ath12k/001-wifi-ath12k-add-11d-scan-offload-support-and-handle-country-code-for-WCN7850.patch b/package/kernel/mac80211/patches/ath12k/001-wifi-ath12k-add-11d-scan-offload-support-and-handle-country-code-for-WCN7850.patch new file mode 100644 index 00000000000..d370db10471 --- /dev/null +++ b/package/kernel/mac80211/patches/ath12k/001-wifi-ath12k-add-11d-scan-offload-support-and-handle-country-code-for-WCN7850.patch @@ -0,0 +1,924 @@ +From patchwork Thu Sep 5 02:35:08 2024 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Kang Yang +X-Patchwork-Id: 13791624 +X-Patchwork-Delegate: kvalo@adurom.com +Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com + [205.220.180.131]) + (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by smtp.subspace.kernel.org (Postfix) with ESMTPS id D313D33CFC + for ; Thu, 5 Sep 2024 02:36:17 +0000 (UTC) +Authentication-Results: smtp.subspace.kernel.org; + arc=none smtp.client-ip=205.220.180.131 +ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; + t=1725503779; cv=none; + b=blv4mH95IN2AR7Rt90gw/V7DnZRtr3upgAP50X6ew3jh0CusPG6/OTO9CSJVthJnqHU3Y3GT88jaeMzb9+f2xzqgl7+E35TmwN3uf6dFmbp7CD8LL0W6xu76ZZgFGxzRspv9YoVy/fydZY6I4JRc2faWqI540+n9bHEXdSJTZMM= +ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; + s=arc-20240116; t=1725503779; c=relaxed/simple; + bh=vjzfDc6UXtw2Li6Q3bAgcW0K1rcTpi3dAxkQgbT5ogI=; + h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: + MIME-Version:Content-Type; + b=VMgF0PfIOoXmfB6EARb/O+dooXutjAm/cnemJ0RC7uc8TSIAusH1ffc6jF1XndEp+nPTWnuMQ5/d1cE/bPeIvSTxrtWaUepnKNjQDrNKm4NrqmjR446CT9t0VHG16RZ1cmCmU74qXnfgus4XfTqD093lc1N5Q/YRh/kwmcCzxhY= +ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; + dmarc=pass (p=none dis=none) header.from=quicinc.com; + spf=pass smtp.mailfrom=quicinc.com; + dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com + header.b=E5hktrdm; arc=none smtp.client-ip=205.220.180.131 +Authentication-Results: smtp.subspace.kernel.org; + dmarc=pass (p=none dis=none) header.from=quicinc.com +Authentication-Results: smtp.subspace.kernel.org; + spf=pass smtp.mailfrom=quicinc.com +Authentication-Results: smtp.subspace.kernel.org; + dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com + header.b="E5hktrdm" +Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) + by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id + 484MRZwS008193; + Thu, 5 Sep 2024 02:36:12 GMT +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= + cc:content-transfer-encoding:content-type:date:from:in-reply-to + :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= + No6X3gHpioHamjfMDccV8LJEZBGk/uDqbZ/fuGUTvJM=; b=E5hktrdmmOb3KcP6 + Qi3M5Y06Yd8RxNJTps8WMEoXZ7xzROVuhmRmlG/mw21NjBMTTMgtjcaen/n8Anj3 + Ash1VFK6s7PrLcwoUT/uui6hzleGE+X9Wh8DJXYnZKKWmeQ+8E0yEzNR0kt9FG0n + S+asFc8VYEJHid6QDNAfM9e4JqJgU3NGXYJBTBM2lpdbqeWU7LEYnVTGCqvOPaH2 + K+QDwvNiNeXlqbaxnqCYimUrSDnTbSUoiVxSpTe9/muWWAB+6YuUbXRfTceqgcd1 + xFIOE1KrtAowMOk5mO3tn6Tjl7nJzewVUm9hncBRfynP8k2jt1xosMezL42dmb56 + a9VWLQ== +Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com + [129.46.96.20]) + by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 41bt674mq1-1 + (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); + Thu, 05 Sep 2024 02:36:11 +0000 (GMT) +Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com + [10.47.209.197]) + by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id + 4852aAdV010181 + (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); + Thu, 5 Sep 2024 02:36:10 GMT +Received: from kangyang.ap.qualcomm.com (10.80.80.8) by + nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server + (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id + 15.2.1544.9; Wed, 4 Sep 2024 19:36:09 -0700 +From: Kang Yang +To: +CC: , +Subject: [PATCH v3 1/4] wifi: ath12k: add configure country code for WCN7850 +Date: Thu, 5 Sep 2024 10:35:08 +0800 +Message-ID: <20240905023511.362-2-quic_kangyang@quicinc.com> +X-Mailer: git-send-email 2.34.1.windows.1 +In-Reply-To: <20240905023511.362-1-quic_kangyang@quicinc.com> +References: <20240905023511.362-1-quic_kangyang@quicinc.com> +Precedence: bulk +X-Mailing-List: linux-wireless@vger.kernel.org +List-Id: +List-Subscribe: +List-Unsubscribe: +MIME-Version: 1.0 +X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To + nalasex01b.na.qualcomm.com (10.47.209.197) +X-QCInternal: smtphost +X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 + signatures=585085 +X-Proofpoint-ORIG-GUID: FzfHe7cZy6IUVu8IKORVKLxkYG9f8WUl +X-Proofpoint-GUID: FzfHe7cZy6IUVu8IKORVKLxkYG9f8WUl +X-Proofpoint-Virus-Version: vendor=baseguard + engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 + definitions=2024-09-05_01,2024-09-04_01,2024-09-02_01 +X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 + malwarescore=0 adultscore=0 + bulkscore=0 mlxscore=0 impostorscore=0 suspectscore=0 phishscore=0 + mlxlogscore=999 lowpriorityscore=0 spamscore=0 clxscore=1015 + priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 + engine=8.19.0-2407110000 definitions=main-2409050018 + +From: Wen Gong + +Add handler to send WMI_SET_CURRENT_COUNTRY_CMDID to firmware, which +is used for WCN7850 to update country code. + +Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 + +Signed-off-by: Wen Gong +Signed-off-by: Kang Yang +Acked-by: Jeff Johnson +--- + drivers/net/wireless/ath/ath12k/wmi.c | 36 +++++++++++++++++++++++++++ + drivers/net/wireless/ath/ath12k/wmi.h | 13 ++++++++++ + 2 files changed, 49 insertions(+) + +--- a/drivers/net/wireless/ath/ath12k/wmi.c ++++ b/drivers/net/wireless/ath/ath12k/wmi.c +@@ -171,6 +171,8 @@ static const struct ath12k_wmi_tlv_polic + .min_len = sizeof(struct ath12k_wmi_p2p_noa_info) }, + [WMI_TAG_P2P_NOA_EVENT] = { + .min_len = sizeof(struct wmi_p2p_noa_event) }, ++ [WMI_TAG_11D_NEW_COUNTRY_EVENT] = { ++ .min_len = sizeof(struct wmi_11d_new_cc_event) }, + }; + + static __le32 ath12k_wmi_tlv_hdr(u32 cmd, u32 len) +@@ -2363,7 +2365,10 @@ int ath12k_wmi_send_scan_start_cmd(struc + cmd->scan_id = cpu_to_le32(arg->scan_id); + cmd->scan_req_id = cpu_to_le32(arg->scan_req_id); + cmd->vdev_id = cpu_to_le32(arg->vdev_id); +- cmd->scan_priority = cpu_to_le32(arg->scan_priority); ++ if (ar->state_11d == ATH12K_11D_PREPARING) ++ arg->scan_priority = WMI_SCAN_PRIORITY_MEDIUM; ++ else ++ arg->scan_priority = WMI_SCAN_PRIORITY_LOW; + cmd->notify_scan_events = cpu_to_le32(arg->notify_scan_events); + + ath12k_wmi_copy_scan_event_cntrl_flags(cmd, arg); +@@ -3083,6 +3088,110 @@ out: + return ret; + } + ++int ath12k_wmi_send_set_current_country_cmd(struct ath12k *ar, ++ struct wmi_set_current_country_arg *arg) ++{ ++ struct ath12k_wmi_pdev *wmi = ar->wmi; ++ struct wmi_set_current_country_cmd *cmd; ++ struct sk_buff *skb; ++ int ret; ++ ++ skb = ath12k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd)); ++ if (!skb) ++ return -ENOMEM; ++ ++ cmd = (struct wmi_set_current_country_cmd *)skb->data; ++ cmd->tlv_header = ++ ath12k_wmi_tlv_cmd_hdr(WMI_TAG_SET_CURRENT_COUNTRY_CMD, ++ sizeof(*cmd)); ++ ++ cmd->pdev_id = cpu_to_le32(ar->pdev->pdev_id); ++ memcpy(&cmd->new_alpha2, &arg->alpha2, sizeof(arg->alpha2)); ++ ret = ath12k_wmi_cmd_send(wmi, skb, WMI_SET_CURRENT_COUNTRY_CMDID); ++ ++ ath12k_dbg(ar->ab, ATH12K_DBG_WMI, ++ "set current country pdev id %d alpha2 %c%c\n", ++ ar->pdev->pdev_id, ++ arg->alpha2[0], ++ arg->alpha2[1]); ++ ++ if (ret) { ++ ath12k_warn(ar->ab, ++ "failed to send WMI_SET_CURRENT_COUNTRY_CMDID: %d\n", ret); ++ dev_kfree_skb(skb); ++ } ++ ++ return ret; ++} ++ ++int ath12k_wmi_send_11d_scan_start_cmd(struct ath12k *ar, ++ struct wmi_11d_scan_start_arg *arg) ++{ ++ struct ath12k_wmi_pdev *wmi = ar->wmi; ++ struct wmi_11d_scan_start_cmd *cmd; ++ struct sk_buff *skb; ++ int ret; ++ ++ skb = ath12k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd)); ++ if (!skb) ++ return -ENOMEM; ++ ++ cmd = (struct wmi_11d_scan_start_cmd *)skb->data; ++ cmd->tlv_header = ++ ath12k_wmi_tlv_cmd_hdr(WMI_TAG_11D_SCAN_START_CMD, ++ sizeof(*cmd)); ++ ++ cmd->vdev_id = cpu_to_le32(arg->vdev_id); ++ cmd->scan_period_msec = cpu_to_le32(arg->scan_period_msec); ++ cmd->start_interval_msec = cpu_to_le32(arg->start_interval_msec); ++ ret = ath12k_wmi_cmd_send(wmi, skb, WMI_11D_SCAN_START_CMDID); ++ ++ ath12k_dbg(ar->ab, ATH12K_DBG_WMI, ++ "send 11d scan start vdev id %d period %d ms internal %d ms\n", ++ arg->vdev_id, arg->scan_period_msec, ++ arg->start_interval_msec); ++ ++ if (ret) { ++ ath12k_warn(ar->ab, ++ "failed to send WMI_11D_SCAN_START_CMDID: %d\n", ret); ++ dev_kfree_skb(skb); ++ } ++ ++ return ret; ++} ++ ++int ath12k_wmi_send_11d_scan_stop_cmd(struct ath12k *ar, u32 vdev_id) ++{ ++ struct ath12k_wmi_pdev *wmi = ar->wmi; ++ struct wmi_11d_scan_stop_cmd *cmd; ++ struct sk_buff *skb; ++ int ret; ++ ++ skb = ath12k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd)); ++ if (!skb) ++ return -ENOMEM; ++ ++ cmd = (struct wmi_11d_scan_stop_cmd *)skb->data; ++ cmd->tlv_header = ++ ath12k_wmi_tlv_cmd_hdr(WMI_TAG_11D_SCAN_STOP_CMD, ++ sizeof(*cmd)); ++ ++ cmd->vdev_id = cpu_to_le32(vdev_id); ++ ret = ath12k_wmi_cmd_send(wmi, skb, WMI_11D_SCAN_STOP_CMDID); ++ ++ ath12k_dbg(ar->ab, ATH12K_DBG_WMI, ++ "send 11d scan stop vdev id %d\n", ++ cmd->vdev_id); ++ ++ if (ret) { ++ ath12k_warn(ar->ab, ++ "failed to send WMI_11D_SCAN_STOP_CMDID: %d\n", ret); ++ dev_kfree_skb(skb); ++ } ++ ++ return ret; ++} ++ + int + ath12k_wmi_send_twt_enable_cmd(struct ath12k *ar, u32 pdev_id) + { +@@ -5668,6 +5777,50 @@ static void ath12k_wmi_op_ep_tx_credits( + wake_up(&ab->wmi_ab.tx_credits_wq); + } + ++static int ath12k_reg_11d_new_cc_event(struct ath12k_base *ab, struct sk_buff *skb) ++{ ++ const struct wmi_11d_new_cc_event *ev; ++ struct ath12k *ar; ++ struct ath12k_pdev *pdev; ++ const void **tb; ++ int ret, i; ++ ++ tb = ath12k_wmi_tlv_parse_alloc(ab, skb, GFP_ATOMIC); ++ if (IS_ERR(tb)) { ++ ret = PTR_ERR(tb); ++ ath12k_warn(ab, "failed to parse tlv: %d\n", ret); ++ return ret; ++ } ++ ++ ev = tb[WMI_TAG_11D_NEW_COUNTRY_EVENT]; ++ if (!ev) { ++ kfree(tb); ++ ath12k_warn(ab, "failed to fetch 11d new cc ev"); ++ return -EPROTO; ++ } ++ ++ spin_lock_bh(&ab->base_lock); ++ memcpy(&ab->new_alpha2, &ev->new_alpha2, REG_ALPHA2_LEN); ++ spin_unlock_bh(&ab->base_lock); ++ ++ ath12k_dbg(ab, ATH12K_DBG_WMI, "wmi 11d new cc %c%c\n", ++ ab->new_alpha2[0], ++ ab->new_alpha2[1]); ++ ++ kfree(tb); ++ ++ for (i = 0; i < ab->num_radios; i++) { ++ pdev = &ab->pdevs[i]; ++ ar = pdev->ar; ++ ar->state_11d = ATH12K_11D_IDLE; ++ complete(&ar->completed_11d_scan); ++ } ++ ++ queue_work(ab->workqueue, &ab->update_11d_work); ++ ++ return 0; ++} ++ + static void ath12k_wmi_htc_tx_complete(struct ath12k_base *ab, + struct sk_buff *skb) + { +@@ -7269,6 +7422,9 @@ static void ath12k_wmi_op_rx(struct ath1 + case WMI_GTK_OFFLOAD_STATUS_EVENTID: + ath12k_wmi_gtk_offload_status_event(ab, skb); + break; ++ case WMI_11D_NEW_COUNTRY_EVENTID: ++ ath12k_reg_11d_new_cc_event(ab, skb); ++ break; + /* TODO: Add remaining events */ + default: + ath12k_dbg(ab, ATH12K_DBG_WMI, "Unknown eventid: 0x%x\n", id); +--- a/drivers/net/wireless/ath/ath12k/wmi.h ++++ b/drivers/net/wireless/ath/ath12k/wmi.h +@@ -3859,6 +3859,28 @@ struct wmi_init_country_cmd { + } cc_info; + } __packed; + ++struct wmi_11d_scan_start_arg { ++ u32 vdev_id; ++ u32 scan_period_msec; ++ u32 start_interval_msec; ++}; ++ ++struct wmi_11d_scan_start_cmd { ++ __le32 tlv_header; ++ __le32 vdev_id; ++ __le32 scan_period_msec; ++ __le32 start_interval_msec; ++} __packed; ++ ++struct wmi_11d_scan_stop_cmd { ++ __le32 tlv_header; ++ __le32 vdev_id; ++} __packed; ++ ++struct wmi_11d_new_cc_event { ++ __le32 new_alpha2; ++} __packed; ++ + struct wmi_delba_send_cmd { + __le32 tlv_header; + __le32 vdev_id; +@@ -3944,6 +3966,16 @@ struct ath12k_wmi_eht_rate_set_params { + #define MAX_6G_REG_RULES 5 + #define REG_US_5G_NUM_REG_RULES 4 + ++struct wmi_set_current_country_arg { ++ u8 alpha2[REG_ALPHA2_LEN]; ++}; ++ ++struct wmi_set_current_country_cmd { ++ __le32 tlv_header; ++ __le32 pdev_id; ++ __le32 new_alpha2; ++} __packed; ++ + enum wmi_start_event_param { + WMI_VDEV_START_RESP_EVENT = 0, + WMI_VDEV_RESTART_RESP_EVENT, +@@ -5546,11 +5578,17 @@ int ath12k_wmi_send_bcn_offload_control_ + u32 vdev_id, u32 bcn_ctrl_op); + int ath12k_wmi_send_init_country_cmd(struct ath12k *ar, + struct ath12k_wmi_init_country_arg *arg); ++int ++ath12k_wmi_send_set_current_country_cmd(struct ath12k *ar, ++ struct wmi_set_current_country_arg *arg); + int ath12k_wmi_peer_rx_reorder_queue_setup(struct ath12k *ar, + int vdev_id, const u8 *addr, + dma_addr_t paddr, u8 tid, + u8 ba_window_size_valid, + u32 ba_window_size); ++int ath12k_wmi_send_11d_scan_start_cmd(struct ath12k *ar, ++ struct wmi_11d_scan_start_arg *arg); ++int ath12k_wmi_send_11d_scan_stop_cmd(struct ath12k *ar, u32 vdev_id); + int + ath12k_wmi_rx_reord_queue_remove(struct ath12k *ar, + struct ath12k_wmi_rx_reorder_queue_remove_arg *arg); +--- a/drivers/net/wireless/ath/ath12k/core.c ++++ b/drivers/net/wireless/ath/ath12k/core.c +@@ -1014,6 +1014,7 @@ void ath12k_core_halt(struct ath12k *ar) + cancel_delayed_work_sync(&ar->scan.timeout); + cancel_work_sync(&ar->regd_update_work); + cancel_work_sync(&ab->rfkill_work); ++ cancel_work_sync(&ab->update_11d_work); + + rcu_assign_pointer(ab->pdevs_active[ar->pdev_idx], NULL); + synchronize_rcu(); +@@ -1021,6 +1022,34 @@ void ath12k_core_halt(struct ath12k *ar) + idr_init(&ar->txmgmt_idr); + } + ++static void ath12k_update_11d(struct work_struct *work) ++{ ++ struct ath12k_base *ab = container_of(work, struct ath12k_base, update_11d_work); ++ struct ath12k *ar; ++ struct ath12k_pdev *pdev; ++ struct wmi_set_current_country_arg arg = {}; ++ int ret, i; ++ ++ spin_lock_bh(&ab->base_lock); ++ memcpy(&arg.alpha2, &ab->new_alpha2, 2); ++ spin_unlock_bh(&ab->base_lock); ++ ++ ath12k_dbg(ab, ATH12K_DBG_WMI, "update 11d new cc %c%c\n", ++ arg.alpha2[0], arg.alpha2[1]); ++ ++ for (i = 0; i < ab->num_radios; i++) { ++ pdev = &ab->pdevs[i]; ++ ar = pdev->ar; ++ ++ memcpy(&ar->alpha2, &arg.alpha2, 2); ++ ret = ath12k_wmi_send_set_current_country_cmd(ar, &arg); ++ if (ret) ++ ath12k_warn(ar->ab, ++ "pdev id %d failed set current country code: %d\n", ++ i, ret); ++ } ++} ++ + static void ath12k_core_pre_reconfigure_recovery(struct ath12k_base *ab) + { + struct ath12k *ar; +@@ -1045,8 +1074,10 @@ static void ath12k_core_pre_reconfigure_ + ar = &ah->radio[j]; + + ath12k_mac_drain_tx(ar); ++ ar->state_11d = ATH12K_11D_IDLE; ++ complete(&ar->completed_11d_scan); + complete(&ar->scan.started); +- complete(&ar->scan.completed); ++ complete_all(&ar->scan.completed); + complete(&ar->scan.on_channel); + complete(&ar->peer_assoc_done); + complete(&ar->peer_delete_done); +@@ -1312,6 +1343,7 @@ struct ath12k_base *ath12k_core_alloc(st + INIT_WORK(&ab->restart_work, ath12k_core_restart); + INIT_WORK(&ab->reset_work, ath12k_core_reset); + INIT_WORK(&ab->rfkill_work, ath12k_rfkill_work); ++ INIT_WORK(&ab->update_11d_work, ath12k_update_11d); + + timer_setup(&ab->rx_replenish_retry, ath12k_ce_rx_replenish_retry, 0); + init_completion(&ab->htc_suspend); +--- a/drivers/net/wireless/ath/ath12k/core.h ++++ b/drivers/net/wireless/ath/ath12k/core.h +@@ -199,6 +199,12 @@ enum ath12k_scan_state { + ATH12K_SCAN_ABORTING, + }; + ++enum ath12k_11d_state { ++ ATH12K_11D_IDLE, ++ ATH12K_11D_PREPARING, ++ ATH12K_11D_RUNNING, ++}; ++ + enum ath12k_dev_flags { + ATH12K_CAC_RUNNING, + ATH12K_FLAG_CRASH_FLUSH, +@@ -313,6 +319,8 @@ struct ath12k_vif_iter { + #define ATH12K_RX_RATE_TABLE_11AX_NUM 576 + #define ATH12K_RX_RATE_TABLE_NUM 320 + ++#define ATH12K_SCAN_TIMEOUT_HZ (20 * HZ) ++ + struct ath12k_rx_peer_rate_stats { + u64 ht_mcs_count[HAL_RX_MAX_MCS_HT + 1]; + u64 vht_mcs_count[HAL_RX_MAX_MCS_VHT + 1]; +@@ -648,6 +656,13 @@ struct ath12k { + u32 freq_low; + u32 freq_high; + ++ /* Protected by wiphy::mtx lock. */ ++ u32 vdev_id_11d_scan; ++ struct completion completed_11d_scan; ++ enum ath12k_11d_state state_11d; ++ u8 alpha2[REG_ALPHA2_LEN]; ++ bool regdom_set_by_user; ++ + bool nlo_enabled; + }; + +@@ -880,6 +895,8 @@ struct ath12k_base { + /* continuous recovery fail count */ + atomic_t fail_cont_count; + unsigned long reset_fail_timeout; ++ struct work_struct update_11d_work; ++ u8 new_alpha2[2]; + struct { + /* protected by data_lock */ + u32 fw_crash_counter; +--- a/drivers/net/wireless/ath/ath12k/mac.c ++++ b/drivers/net/wireless/ath/ath12k/mac.c +@@ -2947,6 +2947,11 @@ static void ath12k_bss_assoc(struct ath1 + if (ret) + ath12k_warn(ar->ab, "failed to set vdev %i OBSS PD parameters: %d\n", + arvif->vdev_id, ret); ++ ++ if (test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ar->ab->wmi_ab.svc_map) && ++ arvif->vdev_type == WMI_VDEV_TYPE_STA && ++ arvif->vdev_subtype == WMI_VDEV_SUBTYPE_NONE) ++ ath12k_mac_11d_scan_stop_all(ar->ab); + } + + static void ath12k_bss_disassoc(struct ath12k *ar, +@@ -3522,7 +3527,7 @@ void __ath12k_mac_scan_finish(struct ath + ar->scan_channel = NULL; + ar->scan.roc_freq = 0; + cancel_delayed_work(&ar->scan.timeout); +- complete(&ar->scan.completed); ++ complete_all(&ar->scan.completed); + break; + } + } +@@ -3783,7 +3788,12 @@ scan: + + ret = ath12k_start_scan(ar, &arg); + if (ret) { +- ath12k_warn(ar->ab, "failed to start hw scan: %d\n", ret); ++ if (ret == -EBUSY) ++ ath12k_dbg(ar->ab, ATH12K_DBG_MAC, ++ "scan engine is busy 11d state %d\n", ar->state_11d); ++ else ++ ath12k_warn(ar->ab, "failed to start hw scan: %d\n", ret); ++ + spin_lock_bh(&ar->data_lock); + ar->scan.state = ATH12K_SCAN_IDLE; + spin_unlock_bh(&ar->data_lock); +@@ -3802,6 +3812,11 @@ exit: + + mutex_unlock(&ar->conf_mutex); + ++ if (ar->state_11d == ATH12K_11D_PREPARING && ++ arvif->vdev_type == WMI_VDEV_TYPE_STA && ++ arvif->vdev_subtype == WMI_VDEV_SUBTYPE_NONE) ++ ath12k_mac_11d_scan_start(ar, arvif->vdev_id); ++ + return ret; + } + +@@ -5986,7 +6001,7 @@ static int ath12k_mac_start(struct ath12 + + /* TODO: Do we need to enable ANI? */ + +- ath12k_reg_update_chan_list(ar); ++ ath12k_reg_update_chan_list(ar, false); + + ar->num_started_vdevs = 0; + ar->num_created_vdevs = 0; +@@ -6166,6 +6181,9 @@ static void ath12k_mac_stop(struct ath12 + cancel_delayed_work_sync(&ar->scan.timeout); + cancel_work_sync(&ar->regd_update_work); + cancel_work_sync(&ar->ab->rfkill_work); ++ cancel_work_sync(&ar->ab->update_11d_work); ++ ar->state_11d = ATH12K_11D_IDLE; ++ complete(&ar->completed_11d_scan); + + spin_lock_bh(&ar->data_lock); + list_for_each_entry_safe(ppdu_stats, tmp, &ar->ppdu_stats_info, list) { +@@ -6412,6 +6430,117 @@ static void ath12k_mac_op_update_vif_off + ath12k_mac_update_vif_offload(arvif); + } + ++static bool ath12k_mac_vif_ap_active_any(struct ath12k_base *ab) ++{ ++ struct ath12k *ar; ++ struct ath12k_pdev *pdev; ++ struct ath12k_vif *arvif; ++ int i; ++ ++ for (i = 0; i < ab->num_radios; i++) { ++ pdev = &ab->pdevs[i]; ++ ar = pdev->ar; ++ list_for_each_entry(arvif, &ar->arvifs, list) { ++ if (arvif->is_up && arvif->vdev_type == WMI_VDEV_TYPE_AP) ++ return true; ++ } ++ } ++ return false; ++} ++ ++void ath12k_mac_11d_scan_start(struct ath12k *ar, u32 vdev_id) ++{ ++ struct wmi_11d_scan_start_arg arg; ++ int ret; ++ ++ lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy); ++ ++ if (ar->regdom_set_by_user) ++ goto fin; ++ ++ if (ar->vdev_id_11d_scan != ATH12K_11D_INVALID_VDEV_ID) ++ goto fin; ++ ++ if (!test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ar->ab->wmi_ab.svc_map)) ++ goto fin; ++ ++ if (ath12k_mac_vif_ap_active_any(ar->ab)) ++ goto fin; ++ ++ arg.vdev_id = vdev_id; ++ arg.start_interval_msec = 0; ++ arg.scan_period_msec = ATH12K_SCAN_11D_INTERVAL; ++ ++ ath12k_dbg(ar->ab, ATH12K_DBG_MAC, ++ "mac start 11d scan for vdev %d\n", vdev_id); ++ ++ ret = ath12k_wmi_send_11d_scan_start_cmd(ar, &arg); ++ if (ret) { ++ ath12k_warn(ar->ab, "failed to start 11d scan vdev %d ret: %d\n", ++ vdev_id, ret); ++ } else { ++ ar->vdev_id_11d_scan = vdev_id; ++ if (ar->state_11d == ATH12K_11D_PREPARING) ++ ar->state_11d = ATH12K_11D_RUNNING; ++ } ++ ++fin: ++ if (ar->state_11d == ATH12K_11D_PREPARING) { ++ ar->state_11d = ATH12K_11D_IDLE; ++ complete(&ar->completed_11d_scan); ++ } ++} ++ ++void ath12k_mac_11d_scan_stop(struct ath12k *ar) ++{ ++ int ret; ++ u32 vdev_id; ++ ++ lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy); ++ ++ if (!test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ar->ab->wmi_ab.svc_map)) ++ return; ++ ++ ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "mac stop 11d for vdev %d\n", ++ ar->vdev_id_11d_scan); ++ ++ if (ar->state_11d == ATH12K_11D_PREPARING) { ++ ar->state_11d = ATH12K_11D_IDLE; ++ complete(&ar->completed_11d_scan); ++ } ++ ++ if (ar->vdev_id_11d_scan != ATH12K_11D_INVALID_VDEV_ID) { ++ vdev_id = ar->vdev_id_11d_scan; ++ ++ ret = ath12k_wmi_send_11d_scan_stop_cmd(ar, vdev_id); ++ if (ret) { ++ ath12k_warn(ar->ab, ++ "failed to stopt 11d scan vdev %d ret: %d\n", ++ vdev_id, ret); ++ } else { ++ ar->vdev_id_11d_scan = ATH12K_11D_INVALID_VDEV_ID; ++ ar->state_11d = ATH12K_11D_IDLE; ++ complete(&ar->completed_11d_scan); ++ } ++ } ++} ++ ++void ath12k_mac_11d_scan_stop_all(struct ath12k_base *ab) ++{ ++ struct ath12k *ar; ++ struct ath12k_pdev *pdev; ++ int i; ++ ++ ath12k_dbg(ab, ATH12K_DBG_MAC, "mac stop soc 11d scan\n"); ++ ++ for (i = 0; i < ab->num_radios; i++) { ++ pdev = &ab->pdevs[i]; ++ ar = pdev->ar; ++ ++ ath12k_mac_11d_scan_stop(ar); ++ } ++} ++ + static int ath12k_mac_vdev_create(struct ath12k *ar, struct ieee80211_vif *vif) + { + struct ath12k_hw *ah = ar->ah; +@@ -6526,6 +6655,7 @@ static int ath12k_mac_vdev_create(struct + arvif->vdev_id, ret); + goto err_peer_del; + } ++ ath12k_mac_11d_scan_stop_all(ar->ab); + break; + case WMI_VDEV_TYPE_STA: + param_id = WMI_STA_PS_PARAM_RX_WAKE_POLICY; +@@ -6564,6 +6694,13 @@ static int ath12k_mac_vdev_create(struct + arvif->vdev_id, ret); + goto err_peer_del; + } ++ ++ if (test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ab->wmi_ab.svc_map) && ++ arvif->vdev_type == WMI_VDEV_TYPE_STA && ++ arvif->vdev_subtype == WMI_VDEV_SUBTYPE_NONE) { ++ reinit_completion(&ar->completed_11d_scan); ++ ar->state_11d = ATH12K_11D_PREPARING; ++ } + break; + default: + break; +@@ -6904,6 +7041,11 @@ static void ath12k_mac_op_remove_interfa + ath12k_dbg(ab, ATH12K_DBG_MAC, "mac remove interface (vdev %d)\n", + arvif->vdev_id); + ++ if (test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ab->wmi_ab.svc_map) && ++ arvif->vdev_type == WMI_VDEV_TYPE_STA && ++ arvif->vdev_subtype == WMI_VDEV_SUBTYPE_NONE) ++ ath12k_mac_11d_scan_stop(ar); ++ + if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { + ret = ath12k_peer_delete(ar, arvif->vdev_id, vif->addr); + if (ret) +@@ -7744,6 +7886,14 @@ ath12k_mac_op_unassign_vif_chanctx(struc + ar->num_started_vdevs == 1 && ar->monitor_vdev_created) + ath12k_mac_monitor_stop(ar); + ++ if (test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ab->wmi_ab.svc_map) && ++ arvif->vdev_type == WMI_VDEV_TYPE_STA && ++ arvif->vdev_subtype == WMI_VDEV_SUBTYPE_NONE && ++ ar->state_11d != ATH12K_11D_PREPARING) { ++ reinit_completion(&ar->completed_11d_scan); ++ ar->state_11d = ATH12K_11D_PREPARING; ++ } ++ + mutex_unlock(&ar->conf_mutex); + } + +@@ -8282,6 +8432,14 @@ ath12k_mac_op_reconfig_complete(struct i + ath12k_warn(ar->ab, "pdev %d successfully recovered\n", + ar->pdev->pdev_id); + ++ if (ar->ab->hw_params->current_cc_support && ++ ar->alpha2[0] != 0 && ar->alpha2[1] != 0) { ++ struct wmi_set_current_country_arg arg = {}; ++ ++ memcpy(&arg.alpha2, ar->alpha2, 2); ++ ath12k_wmi_send_set_current_country_cmd(ar, &arg); ++ } ++ + if (ab->is_reset) { + recovery_count = atomic_inc_return(&ab->recovery_count); + +@@ -9331,6 +9489,9 @@ static void ath12k_mac_setup(struct ath1 + + INIT_WORK(&ar->wmi_mgmt_tx_work, ath12k_mgmt_over_wmi_tx_work); + skb_queue_head_init(&ar->wmi_mgmt_tx_queue); ++ ++ ar->vdev_id_11d_scan = ATH12K_11D_INVALID_VDEV_ID; ++ init_completion(&ar->completed_11d_scan); + } + + int ath12k_mac_register(struct ath12k_base *ab) +--- a/drivers/net/wireless/ath/ath12k/mac.h ++++ b/drivers/net/wireless/ath/ath12k/mac.h +@@ -51,6 +51,13 @@ enum ath12k_supported_bw { + + extern const struct htt_rx_ring_tlv_filter ath12k_mac_mon_status_filter_default; + ++#define ATH12K_SCAN_11D_INTERVAL 600000 ++#define ATH12K_11D_INVALID_VDEV_ID 0xFFFF ++ ++void ath12k_mac_11d_scan_start(struct ath12k *ar, u32 vdev_id); ++void ath12k_mac_11d_scan_stop(struct ath12k *ar); ++void ath12k_mac_11d_scan_stop_all(struct ath12k_base *ab); ++ + void ath12k_mac_destroy(struct ath12k_base *ab); + void ath12k_mac_unregister(struct ath12k_base *ab); + int ath12k_mac_register(struct ath12k_base *ab); +--- a/drivers/net/wireless/ath/ath12k/reg.c ++++ b/drivers/net/wireless/ath/ath12k/reg.c +@@ -48,6 +48,7 @@ ath12k_reg_notifier(struct wiphy *wiphy, + { + struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); + struct ath12k_wmi_init_country_arg arg; ++ struct wmi_set_current_country_arg current_arg = {}; + struct ath12k_hw *ah = ath12k_hw_to_ah(hw); + struct ath12k *ar = ath12k_ah_to_ar(ah, 0); + int ret, i; +@@ -77,27 +78,38 @@ ath12k_reg_notifier(struct wiphy *wiphy, + return; + } + +- /* Set the country code to the firmware and wait for +- * the WMI_REG_CHAN_LIST_CC EVENT for updating the +- * reg info +- */ +- arg.flags = ALPHA_IS_SET; +- memcpy(&arg.cc_info.alpha2, request->alpha2, 2); +- arg.cc_info.alpha2[2] = 0; +- + /* Allow fresh updates to wiphy regd */ + ah->regd_updated = false; + + /* Send the reg change request to all the radios */ + for_each_ar(ah, ar, i) { +- ret = ath12k_wmi_send_init_country_cmd(ar, &arg); +- if (ret) +- ath12k_warn(ar->ab, +- "INIT Country code set to fw failed : %d\n", ret); ++ if (ar->ab->hw_params->current_cc_support) { ++ memcpy(¤t_arg.alpha2, request->alpha2, 2); ++ memcpy(&ar->alpha2, ¤t_arg.alpha2, 2); ++ ret = ath12k_wmi_send_set_current_country_cmd(ar, ¤t_arg); ++ if (ret) ++ ath12k_warn(ar->ab, ++ "failed set current country code: %d\n", ret); ++ } else { ++ arg.flags = ALPHA_IS_SET; ++ memcpy(&arg.cc_info.alpha2, request->alpha2, 2); ++ arg.cc_info.alpha2[2] = 0; ++ ++ ret = ath12k_wmi_send_init_country_cmd(ar, &arg); ++ if (ret) ++ ath12k_warn(ar->ab, ++ "failed set INIT Country code: %d\n", ret); ++ } ++ ++ wiphy_lock(wiphy); ++ ath12k_mac_11d_scan_stop(ar); ++ wiphy_unlock(wiphy); ++ ++ ar->regdom_set_by_user = true; + } + } + +-int ath12k_reg_update_chan_list(struct ath12k *ar) ++int ath12k_reg_update_chan_list(struct ath12k *ar, bool wait) + { + struct ieee80211_supported_band **bands; + struct ath12k_wmi_scan_chan_list_arg *arg; +@@ -106,7 +118,35 @@ int ath12k_reg_update_chan_list(struct a + struct ath12k_wmi_channel_arg *ch; + enum nl80211_band band; + int num_channels = 0; +- int i, ret; ++ int i, ret, left; ++ ++ if (wait && ar->state_11d != ATH12K_11D_IDLE) { ++ left = wait_for_completion_timeout(&ar->completed_11d_scan, ++ ATH12K_SCAN_TIMEOUT_HZ); ++ if (!left) { ++ ath12k_dbg(ar->ab, ATH12K_DBG_REG, ++ "failed to receive 11d scan complete: timed out\n"); ++ ar->state_11d = ATH12K_11D_IDLE; ++ } ++ ath12k_dbg(ar->ab, ATH12K_DBG_REG, ++ "reg 11d scan wait left time %d\n", left); ++ } ++ ++ if (wait && ++ (ar->scan.state == ATH12K_SCAN_STARTING || ++ ar->scan.state == ATH12K_SCAN_RUNNING)) { ++ left = wait_for_completion_timeout(&ar->scan.completed, ++ ATH12K_SCAN_TIMEOUT_HZ); ++ if (!left) ++ ath12k_dbg(ar->ab, ATH12K_DBG_REG, ++ "failed to receive hw scan complete: timed out\n"); ++ ++ ath12k_dbg(ar->ab, ATH12K_DBG_REG, ++ "reg hw scan wait left time %d\n", left); ++ } ++ ++ if (ar->ah->state == ATH12K_HW_STATE_RESTARTING) ++ return 0; + + bands = hw->wiphy->bands; + for (band = 0; band < NUM_NL80211_BANDS; band++) { +@@ -295,7 +335,7 @@ int ath12k_regd_update(struct ath12k *ar + */ + for_each_ar(ah, ar, i) { + ab = ar->ab; +- ret = ath12k_reg_update_chan_list(ar); ++ ret = ath12k_reg_update_chan_list(ar, true); + if (ret) + goto err; + } +--- a/drivers/net/wireless/ath/ath12k/reg.h ++++ b/drivers/net/wireless/ath/ath12k/reg.h +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: BSD-3-Clause-Clear */ + /* + * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved. +- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. ++ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. + */ + + #ifndef ATH12K_REG_H +@@ -96,6 +96,6 @@ struct ieee80211_regdomain *ath12k_reg_b + struct ath12k_reg_info *reg_info, + bool intersect); + int ath12k_regd_update(struct ath12k *ar, bool init); +-int ath12k_reg_update_chan_list(struct ath12k *ar); ++int ath12k_reg_update_chan_list(struct ath12k *ar, bool wait); + + #endif +--- a/drivers/net/wireless/ath/ath12k/hw.c ++++ b/drivers/net/wireless/ath/ath12k/hw.c +@@ -926,6 +926,7 @@ static const struct ath12k_hw_params ath + .supports_dynamic_smps_6ghz = true, + + .iova_mask = 0, ++ .current_cc_support = false, + }, + { + .name = "wcn7850 hw2.0", +@@ -1004,6 +1005,7 @@ static const struct ath12k_hw_params ath + .supports_dynamic_smps_6ghz = false, + + .iova_mask = ATH12K_PCIE_MAX_PAYLOAD_SIZE - 1, ++ .current_cc_support = true, + }, + { + .name = "qcn9274 hw2.0", +@@ -1078,6 +1080,7 @@ static const struct ath12k_hw_params ath + .supports_dynamic_smps_6ghz = true, + + .iova_mask = 0, ++ .current_cc_support = false, + }, + }; + +--- a/drivers/net/wireless/ath/ath12k/hw.h ++++ b/drivers/net/wireless/ath/ath12k/hw.h +@@ -189,6 +189,7 @@ struct ath12k_hw_params { + bool tcl_ring_retry:1; + bool reoq_lut_support:1; + bool supports_shadow_regs:1; ++ bool current_cc_support:1; + + u32 num_tcl_banks; + u32 max_tx_ring; diff --git a/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch b/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch index a0ec7ef972f..f1431526bcd 100644 --- a/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch +++ b/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -1431,6 +1431,7 @@ int ath9k_init_debug(struct ath_hw *ah) +@@ -1429,6 +1429,7 @@ int ath9k_init_debug(struct ath_hw *ah) ath9k_cmn_debug_base_eeprom(sc->debug.debugfs_phy, sc->sc_ah); ath9k_cmn_debug_modal_eeprom(sc->debug.debugfs_phy, sc->sc_ah); @@ -82,7 +82,7 @@ void ath9k_cmn_debug_recv(struct dentry *debugfs_phy, --- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c -@@ -514,6 +514,7 @@ int ath9k_htc_init_debug(struct ath_hw * +@@ -512,6 +512,7 @@ int ath9k_htc_init_debug(struct ath_hw * ath9k_cmn_debug_base_eeprom(priv->debug.debugfs_phy, priv->ah); ath9k_cmn_debug_modal_eeprom(priv->debug.debugfs_phy, priv->ah); diff --git a/package/kernel/mac80211/patches/ath9k/511-ath9k_reduce_rxbuf.patch b/package/kernel/mac80211/patches/ath9k/511-ath9k_reduce_rxbuf.patch index 3abf16b03e3..d8067828896 100644 --- a/package/kernel/mac80211/patches/ath9k/511-ath9k_reduce_rxbuf.patch +++ b/package/kernel/mac80211/patches/ath9k/511-ath9k_reduce_rxbuf.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -89,7 +89,7 @@ int ath_descdma_setup(struct ath_softc * +@@ -90,7 +90,7 @@ int ath_descdma_setup(struct ath_softc * (_l) &= ((_sz) - 1); \ } while (0) diff --git a/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch b/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch index 72eae8c7d6e..87d18626da3 100644 --- a/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch +++ b/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -1432,6 +1432,7 @@ int ath9k_init_debug(struct ath_hw *ah) +@@ -1430,6 +1430,7 @@ int ath9k_init_debug(struct ath_hw *ah) ath9k_cmn_debug_base_eeprom(sc->debug.debugfs_phy, sc->sc_ah); ath9k_cmn_debug_modal_eeprom(sc->debug.debugfs_phy, sc->sc_ah); ath9k_cmn_debug_eeprom(sc->debug.debugfs_phy, sc->sc_ah); @@ -137,7 +137,7 @@ +EXPORT_SYMBOL(ath9k_cmn_debug_chanbw); --- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c -@@ -515,6 +515,7 @@ int ath9k_htc_init_debug(struct ath_hw * +@@ -513,6 +513,7 @@ int ath9k_htc_init_debug(struct ath_hw * ath9k_cmn_debug_base_eeprom(priv->debug.debugfs_phy, priv->ah); ath9k_cmn_debug_modal_eeprom(priv->debug.debugfs_phy, priv->ah); ath9k_cmn_debug_eeprom(priv->debug.debugfs_phy, priv->ah); diff --git a/package/kernel/mac80211/patches/ath9k/513-ath9k_add_pci_ids.patch b/package/kernel/mac80211/patches/ath9k/513-ath9k_add_pci_ids.patch index a085e3a1fbe..6b60d3c089b 100644 --- a/package/kernel/mac80211/patches/ath9k/513-ath9k_add_pci_ids.patch +++ b/package/kernel/mac80211/patches/ath9k/513-ath9k_add_pci_ids.patch @@ -20,7 +20,7 @@ #define AR9160_DEVID_PCI 0x0027 --- a/drivers/net/wireless/ath/ath9k/pci.c +++ b/drivers/net/wireless/ath/ath9k/pci.c -@@ -774,6 +774,7 @@ static const struct pci_device_id ath_pc +@@ -772,6 +772,7 @@ static const struct pci_device_id ath_pc .driver_data = ATH9K_PCI_BT_ANT_DIV }, #endif diff --git a/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch index 1b2d4cb5d41..4bb27d558cc 100644 --- a/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch +++ b/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -844,6 +844,9 @@ static inline int ath9k_dump_btcoex(stru +@@ -845,6 +845,9 @@ static inline int ath9k_dump_btcoex(stru #ifdef CPTCFG_MAC80211_LEDS void ath_init_leds(struct ath_softc *sc); void ath_deinit_leds(struct ath_softc *sc); @@ -10,7 +10,7 @@ #else static inline void ath_init_leds(struct ath_softc *sc) { -@@ -980,6 +983,13 @@ void ath_ant_comb_scan(struct ath_softc +@@ -981,6 +984,13 @@ void ath_ant_comb_scan(struct ath_softc #define ATH9K_NUM_CHANCTX 2 /* supports 2 operating channels */ @@ -24,7 +24,7 @@ struct ath_softc { struct ieee80211_hw *hw; struct device *dev; -@@ -1033,9 +1043,8 @@ struct ath_softc { +@@ -1034,9 +1044,8 @@ struct ath_softc { spinlock_t chan_lock; #ifdef CPTCFG_MAC80211_LEDS @@ -254,7 +254,7 @@ static ssize_t read_file_ani(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) -@@ -1392,6 +1447,10 @@ int ath9k_init_debug(struct ath_hw *ah) +@@ -1390,6 +1445,10 @@ int ath9k_init_debug(struct ath_hw *ah) ath9k_tx99_init_debug(sc); ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy); diff --git a/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch index a0e5a24ed8e..f08301c7f4f 100644 --- a/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch +++ b/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch @@ -51,7 +51,7 @@ int ath9k_init_debug(struct ath_hw *ah) { struct ath_common *common = ath9k_hw_common(ah); -@@ -1451,6 +1495,8 @@ int ath9k_init_debug(struct ath_hw *ah) +@@ -1449,6 +1493,8 @@ int ath9k_init_debug(struct ath_hw *ah) debugfs_create_file("gpio_led", S_IWUSR, sc->debug.debugfs_phy, sc, &fops_gpio_led); #endif diff --git a/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch index 0967ccb9b33..9fb549cc19b 100644 --- a/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch +++ b/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch @@ -18,7 +18,7 @@ Signed-off-by: Felix Fietkau #include "common.h" #include "debug.h" -@@ -990,6 +991,14 @@ struct ath_led { +@@ -991,6 +992,14 @@ struct ath_led { struct led_classdev cdev; }; @@ -33,7 +33,7 @@ Signed-off-by: Felix Fietkau struct ath_softc { struct ieee80211_hw *hw; struct device *dev; -@@ -1045,6 +1054,9 @@ struct ath_softc { +@@ -1046,6 +1055,9 @@ struct ath_softc { #ifdef CPTCFG_MAC80211_LEDS const char *led_default_trigger; struct list_head leds; diff --git a/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch index fc3a0a9fdb0..d164d890314 100644 --- a/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch +++ b/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch @@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau --- --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -1056,6 +1056,7 @@ struct ath_softc { +@@ -1057,6 +1057,7 @@ struct ath_softc { struct list_head leds; #ifdef CONFIG_GPIOLIB struct ath9k_gpio_chip *gpiochip; diff --git a/package/kernel/mac80211/patches/ath9k/551-ath9k_ubnt_uap_plus_hsr.patch b/package/kernel/mac80211/patches/ath9k/551-ath9k_ubnt_uap_plus_hsr.patch index 4e4cab986b3..3ccd3fc4871 100644 --- a/package/kernel/mac80211/patches/ath9k/551-ath9k_ubnt_uap_plus_hsr.patch +++ b/package/kernel/mac80211/patches/ath9k/551-ath9k_ubnt_uap_plus_hsr.patch @@ -371,7 +371,7 @@ --- a/local-symbols +++ b/local-symbols -@@ -121,6 +121,7 @@ ATH9K_WOW= +@@ -123,6 +123,7 @@ ATH9K_WOW= ATH9K_RFKILL= ATH9K_CHANNEL_CONTEXT= ATH9K_PCOEM= diff --git a/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch b/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch index a4efdcd1bcb..3adc8bb8d68 100644 --- a/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch +++ b/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch @@ -272,7 +272,7 @@ #include "common.h" #include "debug.h" -@@ -1012,6 +1013,9 @@ struct ath_softc { +@@ -1013,6 +1014,9 @@ struct ath_softc { struct ath_hw *sc_ah; void __iomem *mem; int irq; diff --git a/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch b/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch index 9f91b29c400..3472ff6afc6 100644 --- a/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch +++ b/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch @@ -14,7 +14,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -3313,6 +3313,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip +@@ -3314,6 +3314,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip * preference in cfg struct to apply this to * FW later while initializing the dongle */ diff --git a/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch b/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch index f873528e263..25f0d254c0d 100644 --- a/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch +++ b/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch @@ -49,7 +49,7 @@ Signed-off-by: Rafał Miłecki void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, struct brcmf_mp_device *settings) { -@@ -113,6 +143,8 @@ void brcmf_of_probe(struct device *dev, +@@ -114,6 +144,8 @@ void brcmf_of_probe(struct device *dev, of_node_put(root); } diff --git a/package/kernel/mac80211/patches/brcm/865-brcmfmac-disable-dump_survey-on-bcm2835.patch b/package/kernel/mac80211/patches/brcm/865-brcmfmac-disable-dump_survey-on-bcm2835.patch index 975647444f9..275f0aa166e 100644 --- a/package/kernel/mac80211/patches/brcm/865-brcmfmac-disable-dump_survey-on-bcm2835.patch +++ b/package/kernel/mac80211/patches/brcm/865-brcmfmac-disable-dump_survey-on-bcm2835.patch @@ -9,7 +9,7 @@ Signed-off-by: Álvaro Fernández Rojas --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -7979,6 +7979,7 @@ static s32 brcmf_translate_country_code( +@@ -7986,6 +7986,7 @@ static s32 brcmf_translate_country_code( return 0; } @@ -17,7 +17,7 @@ Signed-off-by: Álvaro Fernández Rojas static int brcmf_parse_dump_obss(char *buf, struct brcmf_dump_survey *survey) { -@@ -8201,6 +8202,7 @@ exit: +@@ -8208,6 +8209,7 @@ exit: brcmf_set_mpc(ifp, 1); return err; } @@ -25,7 +25,7 @@ Signed-off-by: Álvaro Fernández Rojas static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy, struct regulatory_request *req) -@@ -8353,8 +8355,10 @@ struct brcmf_cfg80211_info *brcmf_cfg802 +@@ -8360,8 +8362,10 @@ struct brcmf_cfg80211_info *brcmf_cfg802 if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_GTK)) ops->set_rekey_data = brcmf_cfg80211_set_rekey_data; #endif diff --git a/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch deleted file mode 100644 index 0dad745b4fa..00000000000 --- a/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch +++ /dev/null @@ -1,314 +0,0 @@ ---- a/local-symbols -+++ b/local-symbols -@@ -471,43 +471,6 @@ USB_VL600= - USB_NET_CH9200= - USB_NET_AQC111= - USB_RTL8153_ECM= --SSB_POSSIBLE= --SSB= --SSB_SPROM= --SSB_BLOCKIO= --SSB_PCIHOST_POSSIBLE= --SSB_PCIHOST= --SSB_B43_PCI_BRIDGE= --SSB_PCMCIAHOST_POSSIBLE= --SSB_PCMCIAHOST= --SSB_SDIOHOST_POSSIBLE= --SSB_SDIOHOST= --SSB_HOST_SOC= --SSB_SERIAL= --SSB_DRIVER_PCICORE_POSSIBLE= --SSB_DRIVER_PCICORE= --SSB_PCICORE_HOSTMODE= --SSB_DRIVER_MIPS= --SSB_SFLASH= --SSB_EMBEDDED= --SSB_DRIVER_EXTIF= --SSB_DRIVER_GIGE= --SSB_DRIVER_GPIO= --BCMA_POSSIBLE= --BCMA= --BCMA_BLOCKIO= --BCMA_HOST_PCI_POSSIBLE= --BCMA_HOST_PCI= --BCMA_HOST_SOC= --BCMA_DRIVER_PCI= --BCMA_DRIVER_PCI_HOSTMODE= --BCMA_DRIVER_MIPS= --BCMA_PFLASH= --BCMA_SFLASH= --BCMA_NFLASH= --BCMA_DRIVER_GMAC_CMN= --BCMA_DRIVER_GPIO= --BCMA_DEBUG= - USB_ACM= - USB_PRINTER= - USB_WDM= ---- a/drivers/net/wireless/broadcom/b43/Kconfig -+++ b/drivers/net/wireless/broadcom/b43/Kconfig -@@ -63,21 +63,21 @@ endchoice - config B43_PCI_AUTOSELECT - bool - depends on B43 && SSB_PCIHOST_POSSIBLE -- select SSB_PCIHOST -- select SSB_B43_PCI_BRIDGE -+ depends on SSB_PCIHOST -+ depends on SSB_B43_PCI_BRIDGE - default y - - # Auto-select SSB PCICORE driver, if possible - config B43_PCICORE_AUTOSELECT - bool - depends on B43 && SSB_DRIVER_PCICORE_POSSIBLE -- select SSB_DRIVER_PCICORE -+ depends on SSB_DRIVER_PCICORE - default y - - config B43_SDIO - bool "Broadcom 43xx SDIO device support" - depends on B43 && B43_SSB && SSB_SDIOHOST_POSSIBLE -- select SSB_SDIOHOST -+ depends on SSB_SDIOHOST - help - Broadcom 43xx device support for Soft-MAC SDIO devices. - -@@ -96,13 +96,13 @@ config B43_SDIO - config B43_BCMA_PIO - bool - depends on B43 && B43_BCMA -- select BCMA_BLOCKIO -+ depends on BCMA_BLOCKIO - default y - - config B43_PIO - bool - depends on B43 && B43_SSB -- select SSB_BLOCKIO -+ depends on SSB_BLOCKIO - default y - - config B43_PHY_G ---- a/drivers/net/wireless/broadcom/b43/main.c -+++ b/drivers/net/wireless/broadcom/b43/main.c -@@ -2854,7 +2854,7 @@ static struct ssb_device *b43_ssb_gpio_d - { - struct ssb_bus *bus = dev->dev->sdev->bus; - --#ifdef CPTCFG_SSB_DRIVER_PCICORE -+#ifdef CONFIG_SSB_DRIVER_PCICORE - return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev); - #else - return bus->chipco.dev; -@@ -4873,7 +4873,7 @@ static int b43_wireless_core_init(struct - } - if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW) - hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */ --#if defined(CPTCFG_B43_SSB) && defined(CPTCFG_SSB_DRIVER_PCICORE) -+#if defined(CPTCFG_B43_SSB) && defined(CONFIG_SSB_DRIVER_PCICORE) - if (dev->dev->bus_type == B43_BUS_SSB && - dev->dev->sdev->bus->bustype == SSB_BUSTYPE_PCI && - dev->dev->sdev->bus->pcicore.dev->id.revision <= 10) ---- a/drivers/net/wireless/broadcom/b43legacy/Kconfig -+++ b/drivers/net/wireless/broadcom/b43legacy/Kconfig -@@ -3,7 +3,7 @@ config B43LEGACY - tristate "Broadcom 43xx-legacy wireless support (mac80211 stack)" - depends on m - depends on SSB_POSSIBLE && MAC80211 && HAS_DMA -- select SSB -+ depends on SSB - depends on FW_LOADER - help - b43legacy is a driver for 802.11b devices from Broadcom (BCM4301 and -@@ -25,15 +25,15 @@ config B43LEGACY - config B43LEGACY_PCI_AUTOSELECT - bool - depends on B43LEGACY && SSB_PCIHOST_POSSIBLE -- select SSB_PCIHOST -- select SSB_B43_PCI_BRIDGE -+ depends on SSB_PCIHOST -+ depends on SSB_B43_PCI_BRIDGE - default y - - # Auto-select SSB PCICORE driver, if possible - config B43LEGACY_PCICORE_AUTOSELECT - bool - depends on B43LEGACY && SSB_DRIVER_PCICORE_POSSIBLE -- select SSB_DRIVER_PCICORE -+ depends on SSB_DRIVER_PCICORE - default y - - # LED support ---- a/drivers/net/wireless/broadcom/b43legacy/main.c -+++ b/drivers/net/wireless/broadcom/b43legacy/main.c -@@ -1907,7 +1907,7 @@ static int b43legacy_gpio_init(struct b4 - if (dev->dev->id.revision >= 2) - mask |= 0x0010; /* FIXME: This is redundant. */ - --#ifdef CPTCFG_SSB_DRIVER_PCICORE -+#ifdef CONFIG_SSB_DRIVER_PCICORE - pcidev = bus->pcicore.dev; - #endif - gpiodev = bus->chipco.dev ? : pcidev; -@@ -1926,7 +1926,7 @@ static void b43legacy_gpio_cleanup(struc - struct ssb_bus *bus = dev->dev->bus; - struct ssb_device *gpiodev, *pcidev = NULL; - --#ifdef CPTCFG_SSB_DRIVER_PCICORE -+#ifdef CONFIG_SSB_DRIVER_PCICORE - pcidev = bus->pcicore.dev; - #endif - gpiodev = bus->chipco.dev ? : pcidev; ---- a/drivers/net/wireless/broadcom/brcm80211/Kconfig -+++ b/drivers/net/wireless/broadcom/brcm80211/Kconfig -@@ -8,7 +8,7 @@ config BRCMSMAC - depends on m - depends on MAC80211 - depends on BCMA_POSSIBLE -- select BCMA -+ depends on BCMA - select BRCMUTIL - depends on FW_LOADER - depends on CORDIC ---- a/Kconfig.local -+++ b/Kconfig.local -@@ -1417,117 +1417,6 @@ config BACKPORTED_USB_NET_AQC111 - config BACKPORTED_USB_RTL8153_ECM - tristate - default USB_RTL8153_ECM --config BACKPORTED_SSB_POSSIBLE -- tristate -- default SSB_POSSIBLE --config BACKPORTED_SSB -- tristate -- default SSB --config BACKPORTED_SSB_SPROM -- tristate -- default SSB_SPROM --config BACKPORTED_SSB_BLOCKIO -- tristate -- default SSB_BLOCKIO --config BACKPORTED_SSB_PCIHOST_POSSIBLE -- tristate -- default SSB_PCIHOST_POSSIBLE --config BACKPORTED_SSB_PCIHOST -- tristate -- default SSB_PCIHOST --config BACKPORTED_SSB_B43_PCI_BRIDGE -- tristate -- default SSB_B43_PCI_BRIDGE --config BACKPORTED_SSB_PCMCIAHOST_POSSIBLE -- tristate -- default SSB_PCMCIAHOST_POSSIBLE --config BACKPORTED_SSB_PCMCIAHOST -- tristate -- default SSB_PCMCIAHOST --config BACKPORTED_SSB_SDIOHOST_POSSIBLE -- tristate -- default SSB_SDIOHOST_POSSIBLE --config BACKPORTED_SSB_SDIOHOST -- tristate -- default SSB_SDIOHOST --config BACKPORTED_SSB_HOST_SOC -- tristate -- default SSB_HOST_SOC --config BACKPORTED_SSB_SERIAL -- tristate -- default SSB_SERIAL --config BACKPORTED_SSB_DRIVER_PCICORE_POSSIBLE -- tristate -- default SSB_DRIVER_PCICORE_POSSIBLE --config BACKPORTED_SSB_DRIVER_PCICORE -- tristate -- default SSB_DRIVER_PCICORE --config BACKPORTED_SSB_PCICORE_HOSTMODE -- tristate -- default SSB_PCICORE_HOSTMODE --config BACKPORTED_SSB_DRIVER_MIPS -- tristate -- default SSB_DRIVER_MIPS --config BACKPORTED_SSB_SFLASH -- tristate -- default SSB_SFLASH --config BACKPORTED_SSB_EMBEDDED -- tristate -- default SSB_EMBEDDED --config BACKPORTED_SSB_DRIVER_EXTIF -- tristate -- default SSB_DRIVER_EXTIF --config BACKPORTED_SSB_DRIVER_GIGE -- tristate -- default SSB_DRIVER_GIGE --config BACKPORTED_SSB_DRIVER_GPIO -- tristate -- default SSB_DRIVER_GPIO --config BACKPORTED_BCMA_POSSIBLE -- tristate -- default BCMA_POSSIBLE --config BACKPORTED_BCMA -- tristate -- default BCMA --config BACKPORTED_BCMA_BLOCKIO -- tristate -- default BCMA_BLOCKIO --config BACKPORTED_BCMA_HOST_PCI_POSSIBLE -- tristate -- default BCMA_HOST_PCI_POSSIBLE --config BACKPORTED_BCMA_HOST_PCI -- tristate -- default BCMA_HOST_PCI --config BACKPORTED_BCMA_HOST_SOC -- tristate -- default BCMA_HOST_SOC --config BACKPORTED_BCMA_DRIVER_PCI -- tristate -- default BCMA_DRIVER_PCI --config BACKPORTED_BCMA_DRIVER_PCI_HOSTMODE -- tristate -- default BCMA_DRIVER_PCI_HOSTMODE --config BACKPORTED_BCMA_DRIVER_MIPS -- tristate -- default BCMA_DRIVER_MIPS --config BACKPORTED_BCMA_PFLASH -- tristate -- default BCMA_PFLASH --config BACKPORTED_BCMA_SFLASH -- tristate -- default BCMA_SFLASH --config BACKPORTED_BCMA_NFLASH -- tristate -- default BCMA_NFLASH --config BACKPORTED_BCMA_DRIVER_GMAC_CMN -- tristate -- default BCMA_DRIVER_GMAC_CMN --config BACKPORTED_BCMA_DRIVER_GPIO -- tristate -- default BCMA_DRIVER_GPIO --config BACKPORTED_BCMA_DEBUG -- tristate -- default BCMA_DEBUG - config BACKPORTED_USB_ACM - tristate - default USB_ACM ---- a/Kconfig.sources -+++ b/Kconfig.sources -@@ -10,9 +10,6 @@ source "$BACKPORT_DIR/drivers/soc/qcom/K - source "$BACKPORT_DIR/drivers/net/wireless/Kconfig" - source "$BACKPORT_DIR/drivers/net/usb/Kconfig" - --source "$BACKPORT_DIR/drivers/ssb/Kconfig" --source "$BACKPORT_DIR/drivers/bcma/Kconfig" -- - source "$BACKPORT_DIR/drivers/usb/class/Kconfig" - - source "$BACKPORT_DIR/drivers/staging/Kconfig" ---- a/Makefile.kernel -+++ b/Makefile.kernel -@@ -42,8 +42,6 @@ obj-$(CPTCFG_QRTR) += net/qrtr/ - obj-$(CPTCFG_QCOM_QMI_HELPERS) += drivers/soc/qcom/ - obj-$(CPTCFG_MHI_BUS) += drivers/bus/mhi/ - obj-$(CPTCFG_WLAN) += drivers/net/wireless/ --obj-$(CPTCFG_SSB) += drivers/ssb/ --obj-$(CPTCFG_BCMA) += drivers/bcma/ - obj-$(CPTCFG_USB_NET_RNDIS_WLAN) += drivers/net/usb/ - - obj-$(CPTCFG_USB_WDM) += drivers/usb/class/ diff --git a/package/kernel/mac80211/patches/build/090-bcma-otp.patch b/package/kernel/mac80211/patches/build/090-bcma-otp.patch deleted file mode 100644 index 39747761246..00000000000 --- a/package/kernel/mac80211/patches/build/090-bcma-otp.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- /dev/null -+++ b/backport-include/linux/bcma/bcma_driver_chipcommon.h -@@ -0,0 +1,10 @@ -+#ifndef __BACKPORT_BCMA_DRIVER_CHIPCOMMON_H -+#define __BACKPORT_BCMA_DRIVER_CHIPCOMMON_H -+ -+#include_next -+ -+#ifndef BCMA_CC_SROM_CONTROL_OTP_PRESENT -+#define BCMA_CC_SROM_CONTROL_OTP_PRESENT 0x00000020 -+#endif -+ -+#endif diff --git a/package/kernel/mac80211/patches/build/100-backports-drop-QRTR-and-MHI.patch b/package/kernel/mac80211/patches/build/100-backports-drop-QRTR-and-MHI.patch index a3a65c2d2ab..f4dc5508b11 100644 --- a/package/kernel/mac80211/patches/build/100-backports-drop-QRTR-and-MHI.patch +++ b/package/kernel/mac80211/patches/build/100-backports-drop-QRTR-and-MHI.patch @@ -54,9 +54,9 @@ Signed-off-by: Robert Marko + depends on MHI_BUS + depends on QRTR + depends on QRTR_MHI + select PCI_PWRCTL_PWRSEQ if HAVE_PWRCTL help This module adds support for PCIE bus - --- a/local-symbols +++ b/local-symbols @@ -59,14 +59,6 @@ MAC80211_MESH_PS_DEBUG= diff --git a/package/kernel/mac80211/patches/build/140-trace_backport.patch b/package/kernel/mac80211/patches/build/140-trace_backport.patch new file mode 100644 index 00000000000..00ee47e1a46 --- /dev/null +++ b/package/kernel/mac80211/patches/build/140-trace_backport.patch @@ -0,0 +1,541 @@ +--- a/drivers/bus/mhi/host/trace.h ++++ b/drivers/bus/mhi/host/trace.h +@@ -103,7 +103,7 @@ TRACE_EVENT(mhi_gen_tre, + ), + + TP_fast_assign( +- __assign_str(name); ++ __assign_str(name, mhi_cntrl->mhi_dev->name); + __entry->ch_num = mhi_chan->chan; + __entry->wp = mhi_tre; + __entry->tre_ptr = mhi_tre->ptr; +@@ -131,7 +131,7 @@ TRACE_EVENT(mhi_intvec_states, + ), + + TP_fast_assign( +- __assign_str(name); ++ __assign_str(name, mhi_cntrl->mhi_dev->name); + __entry->local_ee = mhi_cntrl->ee; + __entry->state = mhi_cntrl->dev_state; + __entry->dev_ee = dev_ee; +@@ -158,7 +158,7 @@ TRACE_EVENT(mhi_tryset_pm_state, + ), + + TP_fast_assign( +- __assign_str(name); ++ __assign_str(name, mhi_cntrl->mhi_dev->name); + if (pm_state) + pm_state = __fls(pm_state); + __entry->pm_state = pm_state; +@@ -184,7 +184,7 @@ DECLARE_EVENT_CLASS(mhi_process_event_ri + ), + + TP_fast_assign( +- __assign_str(name); ++ __assign_str(name, mhi_cntrl->mhi_dev->name); + __entry->rp = rp; + __entry->ptr = rp->ptr; + __entry->dword0 = rp->dword[0]; +@@ -226,7 +226,7 @@ DECLARE_EVENT_CLASS(mhi_update_channel_s + ), + + TP_fast_assign( +- __assign_str(name); ++ __assign_str(name, mhi_cntrl->mhi_dev->name); + __entry->ch_num = mhi_chan->chan; + __entry->state = state; + __entry->reason = reason; +@@ -265,7 +265,7 @@ TRACE_EVENT(mhi_pm_st_transition, + ), + + TP_fast_assign( +- __assign_str(name); ++ __assign_str(name, mhi_cntrl->mhi_dev->name); + __entry->state = state; + ), + +--- a/drivers/net/wireless/ath/ath10k/trace.h ++++ b/drivers/net/wireless/ath/ath10k/trace.h +@@ -55,8 +55,8 @@ DECLARE_EVENT_CLASS(ath10k_log_event, + __vstring(msg, vaf->fmt, vaf->va) + ), + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ar->dev)); ++ __assign_str(driver, dev_driver_string(ar->dev)); + __assign_vstr(msg, vaf->fmt, vaf->va); + ), + TP_printk( +@@ -92,8 +92,8 @@ TRACE_EVENT(ath10k_log_dbg, + __vstring(msg, vaf->fmt, vaf->va) + ), + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ar->dev)); ++ __assign_str(driver, dev_driver_string(ar->dev)); + __entry->level = level; + __assign_vstr(msg, vaf->fmt, vaf->va); + ), +@@ -121,10 +121,10 @@ TRACE_EVENT(ath10k_log_dbg_dump, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); +- __assign_str(msg); +- __assign_str(prefix); ++ __assign_str(device, dev_name(ar->dev)); ++ __assign_str(driver, dev_driver_string(ar->dev)); ++ __assign_str(msg, msg); ++ __assign_str(prefix, prefix); + __entry->buf_len = buf_len; + memcpy(__get_dynamic_array(buf), buf, buf_len); + ), +@@ -152,8 +152,8 @@ TRACE_EVENT(ath10k_wmi_cmd, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ar->dev)); ++ __assign_str(driver, dev_driver_string(ar->dev)); + __entry->id = id; + __entry->buf_len = buf_len; + memcpy(__get_dynamic_array(buf), buf, buf_len); +@@ -182,8 +182,8 @@ TRACE_EVENT(ath10k_wmi_event, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ar->dev)); ++ __assign_str(driver, dev_driver_string(ar->dev)); + __entry->id = id; + __entry->buf_len = buf_len; + memcpy(__get_dynamic_array(buf), buf, buf_len); +@@ -211,8 +211,8 @@ TRACE_EVENT(ath10k_htt_stats, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ar->dev)); ++ __assign_str(driver, dev_driver_string(ar->dev)); + __entry->buf_len = buf_len; + memcpy(__get_dynamic_array(buf), buf, buf_len); + ), +@@ -239,8 +239,8 @@ TRACE_EVENT(ath10k_wmi_dbglog, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ar->dev)); ++ __assign_str(driver, dev_driver_string(ar->dev)); + __entry->hw_type = ar->hw_rev; + __entry->buf_len = buf_len; + memcpy(__get_dynamic_array(buf), buf, buf_len); +@@ -269,8 +269,8 @@ TRACE_EVENT(ath10k_htt_pktlog, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ar->dev)); ++ __assign_str(driver, dev_driver_string(ar->dev)); + __entry->hw_type = ar->hw_rev; + __entry->buf_len = buf_len; + memcpy(__get_dynamic_array(pktlog), buf, buf_len); +@@ -301,8 +301,8 @@ TRACE_EVENT(ath10k_htt_tx, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ar->dev)); ++ __assign_str(driver, dev_driver_string(ar->dev)); + __entry->msdu_id = msdu_id; + __entry->msdu_len = msdu_len; + __entry->vdev_id = vdev_id; +@@ -332,8 +332,8 @@ TRACE_EVENT(ath10k_txrx_tx_unref, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ar->dev)); ++ __assign_str(driver, dev_driver_string(ar->dev)); + __entry->msdu_id = msdu_id; + ), + +@@ -358,8 +358,8 @@ DECLARE_EVENT_CLASS(ath10k_hdr_event, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ar->dev)); ++ __assign_str(driver, dev_driver_string(ar->dev)); + __entry->len = ath10k_frm_hdr_len(data, len); + memcpy(__get_dynamic_array(data), data, __entry->len); + ), +@@ -386,8 +386,8 @@ DECLARE_EVENT_CLASS(ath10k_payload_event + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ar->dev)); ++ __assign_str(driver, dev_driver_string(ar->dev)); + __entry->len = len - ath10k_frm_hdr_len(data, len); + memcpy(__get_dynamic_array(payload), + data + ath10k_frm_hdr_len(data, len), __entry->len); +@@ -435,8 +435,8 @@ TRACE_EVENT(ath10k_htt_rx_desc, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ar->dev)); ++ __assign_str(driver, dev_driver_string(ar->dev)); + __entry->hw_type = ar->hw_rev; + __entry->len = len; + memcpy(__get_dynamic_array(rxdesc), data, len); +@@ -472,8 +472,8 @@ TRACE_EVENT(ath10k_wmi_diag_container, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ar->dev)); ++ __assign_str(driver, dev_driver_string(ar->dev)); + __entry->type = type; + __entry->timestamp = timestamp; + __entry->code = code; +@@ -505,8 +505,8 @@ TRACE_EVENT(ath10k_wmi_diag, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ar->dev)); ++ __assign_str(driver, dev_driver_string(ar->dev)); + __entry->len = len; + memcpy(__get_dynamic_array(data), data, len); + ), +--- a/drivers/net/wireless/ath/ath11k/trace.h ++++ b/drivers/net/wireless/ath/ath11k/trace.h +@@ -48,8 +48,8 @@ TRACE_EVENT(ath11k_htt_pktlog, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ar->ab->dev)); ++ __assign_str(driver, dev_driver_string(ar->ab->dev)); + __entry->buf_len = buf_len; + __entry->pktlog_checksum = pktlog_checksum; + memcpy(__get_dynamic_array(pktlog), buf, buf_len); +@@ -77,8 +77,8 @@ TRACE_EVENT(ath11k_htt_ppdu_stats, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ar->ab->dev)); ++ __assign_str(driver, dev_driver_string(ar->ab->dev)); + __entry->len = len; + memcpy(__get_dynamic_array(ppdu), data, len); + ), +@@ -105,8 +105,8 @@ TRACE_EVENT(ath11k_htt_rxdesc, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ar->ab->dev)); ++ __assign_str(driver, dev_driver_string(ar->ab->dev)); + __entry->len = len; + __entry->log_type = log_type; + memcpy(__get_dynamic_array(rxdesc), data, len); +@@ -130,8 +130,8 @@ DECLARE_EVENT_CLASS(ath11k_log_event, + __vstring(msg, vaf->fmt, vaf->va) + ), + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ab->dev)); ++ __assign_str(driver, dev_driver_string(ab->dev)); + __assign_vstr(msg, vaf->fmt, vaf->va); + ), + TP_printk( +@@ -171,8 +171,8 @@ TRACE_EVENT(ath11k_wmi_cmd, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ab->dev)); ++ __assign_str(driver, dev_driver_string(ab->dev)); + __entry->id = id; + __entry->buf_len = buf_len; + memcpy(__get_dynamic_array(buf), buf, buf_len); +@@ -201,8 +201,8 @@ TRACE_EVENT(ath11k_wmi_event, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ab->dev)); ++ __assign_str(driver, dev_driver_string(ab->dev)); + __entry->id = id; + __entry->buf_len = buf_len; + memcpy(__get_dynamic_array(buf), buf, buf_len); +@@ -230,8 +230,8 @@ TRACE_EVENT(ath11k_log_dbg, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ab->dev)); ++ __assign_str(driver, dev_driver_string(ab->dev)); + __entry->level = level; + WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), + ATH11K_MSG_MAX, vaf->fmt, +@@ -262,10 +262,10 @@ TRACE_EVENT(ath11k_log_dbg_dump, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); +- __assign_str(msg); +- __assign_str(prefix); ++ __assign_str(device, dev_name(ab->dev)); ++ __assign_str(driver, dev_driver_string(ab->dev)); ++ __assign_str(msg, msg); ++ __assign_str(prefix, prefix); + __entry->buf_len = buf_len; + memcpy(__get_dynamic_array(buf), buf, buf_len); + ), +@@ -292,8 +292,8 @@ TRACE_EVENT(ath11k_wmi_diag, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ab->dev)); ++ __assign_str(driver, dev_driver_string(ab->dev)); + __entry->len = len; + memcpy(__get_dynamic_array(data), data, len); + ), +@@ -318,8 +318,8 @@ TRACE_EVENT(ath11k_ps_timekeeper, + __field(u32, peer_ps_timestamp) + ), + +- TP_fast_assign(__assign_str(device); +- __assign_str(driver); ++ TP_fast_assign(__assign_str(device, dev_name(ar->ab->dev)); ++ __assign_str(driver, dev_driver_string(ar->ab->dev)); + memcpy(__get_dynamic_array(peer_addr), peer_addr, + ETH_ALEN); + __entry->peer_ps_state = peer_ps_state; +--- a/drivers/net/wireless/ath/ath12k/trace.h ++++ b/drivers/net/wireless/ath/ath12k/trace.h +@@ -36,8 +36,8 @@ TRACE_EVENT(ath12k_htt_pktlog, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ar->ab->dev)); ++ __assign_str(driver, dev_driver_string(ar->ab->dev)); + __entry->buf_len = buf_len; + __entry->pktlog_checksum = pktlog_checksum; + memcpy(__get_dynamic_array(pktlog), buf, buf_len); +@@ -73,8 +73,8 @@ TRACE_EVENT(ath12k_htt_ppdu_stats, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ar->ab->dev)); ++ __assign_str(driver, dev_driver_string(ar->ab->dev)); + __entry->len = len; + __entry->info = ar->pdev->timestamp.info; + __entry->sync_tstmp_lo_us = ar->pdev->timestamp.sync_timestamp_hi_us; +@@ -117,8 +117,8 @@ TRACE_EVENT(ath12k_htt_rxdesc, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ar->ab->dev)); ++ __assign_str(driver, dev_driver_string(ar->ab->dev)); + __entry->len = len; + __entry->type = type; + __entry->info = ar->pdev->timestamp.info; +@@ -153,8 +153,8 @@ TRACE_EVENT(ath12k_wmi_diag, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, dev_name(ab->dev)); ++ __assign_str(driver, dev_driver_string(ab->dev)); + __entry->len = len; + memcpy(__get_dynamic_array(data), data, len); + ), +--- a/drivers/net/wireless/ath/ath6kl/trace.h ++++ b/drivers/net/wireless/ath/ath6kl/trace.h +@@ -304,8 +304,8 @@ TRACE_EVENT(ath6kl_log_dbg_dump, + ), + + TP_fast_assign( +- __assign_str(msg); +- __assign_str(prefix); ++ __assign_str(msg, msg); ++ __assign_str(prefix, prefix); + __entry->buf_len = buf_len; + memcpy(__get_dynamic_array(buf), buf, buf_len); + ), +--- a/drivers/net/wireless/ath/trace.h ++++ b/drivers/net/wireless/ath/trace.h +@@ -44,8 +44,8 @@ TRACE_EVENT(ath_log, + ), + + TP_fast_assign( +- __assign_str(device); +- __assign_str(driver); ++ __assign_str(device, wiphy_name(wiphy)); ++ __assign_str(driver, KBUILD_MODNAME); + __assign_vstr(msg, vaf->fmt, vaf->va); + ), + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.h +@@ -41,7 +41,7 @@ TRACE_EVENT(brcmf_err, + __vstring(msg, vaf->fmt, vaf->va) + ), + TP_fast_assign( +- __assign_str(func); ++ __assign_str(func, func); + __assign_vstr(msg, vaf->fmt, vaf->va); + ), + TP_printk("%s: %s", __get_str(func), __get_str(msg)) +@@ -57,7 +57,7 @@ TRACE_EVENT(brcmf_dbg, + ), + TP_fast_assign( + __entry->level = level; +- __assign_str(func); ++ __assign_str(func, func); + __assign_vstr(msg, vaf->fmt, vaf->va); + ), + TP_printk("%s: %s", __get_str(func), __get_str(msg)) +--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcms_trace_brcmsmac.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcms_trace_brcmsmac.h +@@ -81,7 +81,7 @@ TRACE_EVENT(brcms_macintstatus, + __field(u32, mask) + ), + TP_fast_assign( +- __assign_str(dev); ++ __assign_str(dev, dev_name(dev)); + __entry->in_isr = in_isr; + __entry->macintstatus = macintstatus; + __entry->mask = mask; +--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcms_trace_brcmsmac_msg.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcms_trace_brcmsmac_msg.h +@@ -71,7 +71,7 @@ TRACE_EVENT(brcms_dbg, + ), + TP_fast_assign( + __entry->level = level; +- __assign_str(func); ++ __assign_str(func, func); + __assign_vstr(msg, vaf->fmt, vaf->va); + ), + TP_printk("%s: %s", __get_str(func), __get_str(msg)) +--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcms_trace_brcmsmac_tx.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcms_trace_brcmsmac_tx.h +@@ -31,7 +31,7 @@ TRACE_EVENT(brcms_txdesc, + __dynamic_array(u8, txh, txh_len) + ), + TP_fast_assign( +- __assign_str(dev); ++ __assign_str(dev, dev_name(dev)); + memcpy(__get_dynamic_array(txh), txh, txh_len); + ), + TP_printk("[%s] txdesc", __get_str(dev)) +@@ -54,7 +54,7 @@ TRACE_EVENT(brcms_txstatus, + __field(u16, ackphyrxsh) + ), + TP_fast_assign( +- __assign_str(dev); ++ __assign_str(dev, dev_name(dev)); + __entry->framelen = framelen; + __entry->frameid = frameid; + __entry->status = status; +@@ -85,7 +85,7 @@ TRACE_EVENT(brcms_ampdu_session, + __field(u16, dma_len) + ), + TP_fast_assign( +- __assign_str(dev); ++ __assign_str(dev, dev_name(dev)); + __entry->max_ampdu_len = max_ampdu_len; + __entry->max_ampdu_frames = max_ampdu_frames; + __entry->ampdu_len = ampdu_len; +--- a/drivers/net/wireless/intel/iwlwifi/iwl-devtrace-msg.h ++++ b/drivers/net/wireless/intel/iwlwifi/iwl-devtrace-msg.h +@@ -57,7 +57,7 @@ TRACE_EVENT(iwlwifi_dbg, + ), + TP_fast_assign( + __entry->level = level; +- __assign_str(function); ++ __assign_str(function, function); + __assign_vstr(msg, vaf->fmt, vaf->va); + ), + TP_printk("%s", __get_str(msg)) +--- a/drivers/net/wireless/intel/iwlwifi/iwl-devtrace.h ++++ b/drivers/net/wireless/intel/iwlwifi/iwl-devtrace.h +@@ -87,7 +87,7 @@ static inline void trace_ ## name(proto) + #endif + + #define DEV_ENTRY __string(dev, dev_name(dev)) +-#define DEV_ASSIGN __assign_str(dev) ++#define DEV_ASSIGN __assign_str(dev, dev_name(dev)) + + #include "iwl-devtrace-io.h" + #include "iwl-devtrace-ucode.h" +--- a/include/trace/events/qrtr.h ++++ b/include/trace/events/qrtr.h +@@ -102,7 +102,7 @@ TRACE_EVENT(qrtr_ns_message, + ), + + TP_fast_assign( +- __assign_str(ctrl_pkt_str); ++ __assign_str(ctrl_pkt_str, ctrl_pkt_str); + __entry->sq_node = sq_node; + __entry->sq_port = sq_port; + ), +--- a/net/mac80211/trace.h ++++ b/net/mac80211/trace.h +@@ -33,7 +33,7 @@ + __string(vif_name, sdata->name) + #define VIF_ASSIGN __entry->vif_type = sdata->vif.type; __entry->sdata = sdata; \ + __entry->p2p = sdata->vif.p2p; \ +- __assign_str(vif_name) ++ __assign_str(vif_name, sdata->name) + #define VIF_PR_FMT " vif:%s(%d%s)" + #define VIF_PR_ARG __get_str(vif_name), __entry->vif_type, __entry->p2p ? "/p2p" : "" + +--- a/net/wireless/trace.h ++++ b/net/wireless/trace.h +@@ -446,7 +446,7 @@ TRACE_EVENT(rdev_add_virtual_intf, + ), + TP_fast_assign( + WIPHY_ASSIGN; +- __assign_str(vir_intf_name); ++ __assign_str(vir_intf_name, name ? name : ""); + __entry->type = type; + ), + TP_printk(WIPHY_PR_FMT ", virtual intf name: %s, type: %d", diff --git a/package/kernel/mac80211/patches/build/150-ath_iommu_paging_domain_revert.patch b/package/kernel/mac80211/patches/build/150-ath_iommu_paging_domain_revert.patch new file mode 100644 index 00000000000..2c5235e49f1 --- /dev/null +++ b/package/kernel/mac80211/patches/build/150-ath_iommu_paging_domain_revert.patch @@ -0,0 +1,32 @@ +--- a/drivers/net/wireless/ath/ath10k/snoc.c ++++ b/drivers/net/wireless/ath/ath10k/snoc.c +@@ -1635,10 +1635,10 @@ static int ath10k_fw_init(struct ath10k + + ar_snoc->fw.dev = &pdev->dev; + +- iommu_dom = iommu_paging_domain_alloc(ar_snoc->fw.dev); +- if (IS_ERR(iommu_dom)) { ++ iommu_dom = iommu_domain_alloc(&platform_bus_type); ++ if (!iommu_dom) { + ath10k_err(ar, "failed to allocate iommu domain\n"); +- ret = PTR_ERR(iommu_dom); ++ ret = -ENOMEM; + goto err_unregister; + } + +--- a/drivers/net/wireless/ath/ath11k/ahb.c ++++ b/drivers/net/wireless/ath/ath11k/ahb.c +@@ -1031,10 +1031,10 @@ static int ath11k_ahb_fw_resources_init( + + ab_ahb->fw.dev = &pdev->dev; + +- iommu_dom = iommu_paging_domain_alloc(ab_ahb->fw.dev); +- if (IS_ERR(iommu_dom)) { ++ iommu_dom = iommu_domain_alloc(&platform_bus_type); ++ if (!iommu_dom) { + ath11k_err(ab, "failed to allocate iommu domain\n"); +- ret = PTR_ERR(iommu_dom); ++ ret = -ENOMEM; + goto err_unregister; + } + diff --git a/package/kernel/mac80211/patches/build/200-iwlwifi_thermal_backport.patch b/package/kernel/mac80211/patches/build/200-iwlwifi_thermal_backport.patch index ad398d4d9de..a8ffce1e30d 100644 --- a/package/kernel/mac80211/patches/build/200-iwlwifi_thermal_backport.patch +++ b/package/kernel/mac80211/patches/build/200-iwlwifi_thermal_backport.patch @@ -1,6 +1,20 @@ --- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c -@@ -689,13 +689,23 @@ static void iwl_mvm_thermal_zone_registe +@@ -638,8 +638,13 @@ static int iwl_mvm_tzone_get_temp(struct + return 0; + } + ++#if LINUX_VERSION_IS_GEQ(6,11,0) + static int iwl_mvm_tzone_set_trip_temp(struct thermal_zone_device *device, + const struct thermal_trip *trip, int temp) ++#else ++static int iwl_mvm_tzone_set_trip_temp(struct thermal_zone_device *device, ++ int trip, int temp) ++#endif + { + struct iwl_mvm *mvm = thermal_zone_device_priv(device); + +@@ -682,13 +687,23 @@ static void iwl_mvm_thermal_zone_registe for (i = 0 ; i < IWL_MAX_DTS_TRIPS; i++) { mvm->tz_device.trips[i].temperature = THERMAL_TEMP_INVALID; mvm->tz_device.trips[i].type = THERMAL_TRIP_PASSIVE; diff --git a/package/kernel/mac80211/patches/build/230-brcmfmac_usb_driver_backport.patch b/package/kernel/mac80211/patches/build/230-brcmfmac_usb_driver_backport.patch index daeea38372f..25dab469054 100644 --- a/package/kernel/mac80211/patches/build/230-brcmfmac_usb_driver_backport.patch +++ b/package/kernel/mac80211/patches/build/230-brcmfmac_usb_driver_backport.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c -@@ -1581,7 +1581,11 @@ static int brcmf_usb_reset_device(struct +@@ -1574,7 +1574,11 @@ static int brcmf_usb_reset_device(struct void brcmf_usb_exit(void) { diff --git a/package/kernel/mac80211/patches/build/235-fix-init_vqs-build-error-on-kernel-6.6.patch b/package/kernel/mac80211/patches/build/235-fix-init_vqs-build-error-on-kernel-6.6.patch new file mode 100644 index 00000000000..4b0fe6003f6 --- /dev/null +++ b/package/kernel/mac80211/patches/build/235-fix-init_vqs-build-error-on-kernel-6.6.patch @@ -0,0 +1,30 @@ +--- a/drivers/net/wireless/virtual/mac80211_hwsim.c ++++ b/drivers/net/wireless/virtual/mac80211_hwsim.c +@@ -6629,6 +6629,7 @@ static void hwsim_virtio_rx_done(struct + + static int init_vqs(struct virtio_device *vdev) + { ++#if LINUX_VERSION_IS_GEQ(6,11,0) + struct virtqueue_info vqs_info[HWSIM_NUM_VQS] = { + [HWSIM_VQ_TX] = { "tx", hwsim_virtio_tx_done }, + [HWSIM_VQ_RX] = { "rx", hwsim_virtio_rx_done }, +@@ -6636,6 +6637,19 @@ static int init_vqs(struct virtio_device + + return virtio_find_vqs(vdev, HWSIM_NUM_VQS, + hwsim_vqs, vqs_info, NULL); ++#else /* Using the old ABI, copied from kernel 6.6 */ ++ vq_callback_t *callbacks[HWSIM_NUM_VQS] = { ++ [HWSIM_VQ_TX] = hwsim_virtio_tx_done, ++ [HWSIM_VQ_RX] = hwsim_virtio_rx_done, ++ }; ++ const char *names[HWSIM_NUM_VQS] = { ++ [HWSIM_VQ_TX] = "tx", ++ [HWSIM_VQ_RX] = "rx", ++ }; ++ ++ return virtio_find_vqs(vdev, HWSIM_NUM_VQS, ++ hwsim_vqs, callbacks, names, NULL); ++#endif + } + + static int fill_vq(struct virtqueue *vq) diff --git a/package/kernel/mac80211/patches/mwl/700-mwl8k-missing-pci-id-for-WNR854T.patch b/package/kernel/mac80211/patches/mwl/700-mwl8k-missing-pci-id-for-WNR854T.patch index fb774b52011..c3324f4289f 100644 --- a/package/kernel/mac80211/patches/mwl/700-mwl8k-missing-pci-id-for-WNR854T.patch +++ b/package/kernel/mac80211/patches/mwl/700-mwl8k-missing-pci-id-for-WNR854T.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/marvell/mwl8k.c +++ b/drivers/net/wireless/marvell/mwl8k.c -@@ -5707,6 +5707,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw") +@@ -5709,6 +5709,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw") MODULE_FIRMWARE(MWL8K_8366_AP_FW(MWL8K_8366_AP_FW_API)); static const struct pci_device_id mwl8k_pci_id_table[] = { diff --git a/package/kernel/mac80211/patches/mwl/801-libertas-configure-sysfs-links.patch b/package/kernel/mac80211/patches/mwl/801-libertas-configure-sysfs-links.patch index 4d9d3de4655..e6111871c04 100644 --- a/package/kernel/mac80211/patches/mwl/801-libertas-configure-sysfs-links.patch +++ b/package/kernel/mac80211/patches/mwl/801-libertas-configure-sysfs-links.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/marvell/libertas/cfg.c +++ b/drivers/net/wireless/marvell/libertas/cfg.c -@@ -2101,6 +2101,8 @@ struct wireless_dev *lbs_cfg_alloc(struc +@@ -2102,6 +2102,8 @@ struct wireless_dev *lbs_cfg_alloc(struc goto err_wiphy_new; } diff --git a/package/kernel/mac80211/patches/mwl/802-libertas-set-wireless-macaddr.patch b/package/kernel/mac80211/patches/mwl/802-libertas-set-wireless-macaddr.patch index 9aa559979c3..97ddd66b324 100644 --- a/package/kernel/mac80211/patches/mwl/802-libertas-set-wireless-macaddr.patch +++ b/package/kernel/mac80211/patches/mwl/802-libertas-set-wireless-macaddr.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/marvell/libertas/cfg.c +++ b/drivers/net/wireless/marvell/libertas/cfg.c -@@ -2178,6 +2178,8 @@ int lbs_cfg_register(struct lbs_private +@@ -2179,6 +2179,8 @@ int lbs_cfg_register(struct lbs_private wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); wdev->wiphy->reg_notifier = lbs_reg_notifier; diff --git a/package/kernel/mac80211/patches/mwl/940-mwl8k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/mwl/940-mwl8k_init_devices_synchronously.patch index 06edc441ecc..062b0600d0c 100644 --- a/package/kernel/mac80211/patches/mwl/940-mwl8k_init_devices_synchronously.patch +++ b/package/kernel/mac80211/patches/mwl/940-mwl8k_init_devices_synchronously.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/marvell/mwl8k.c +++ b/drivers/net/wireless/marvell/mwl8k.c -@@ -6293,6 +6293,8 @@ static int mwl8k_probe(struct pci_dev *p +@@ -6295,6 +6295,8 @@ static int mwl8k_probe(struct pci_dev *p priv->running_bsses = 0; @@ -9,7 +9,7 @@ return rc; err_stop_firmware: -@@ -6326,8 +6328,6 @@ static void mwl8k_remove(struct pci_dev +@@ -6328,8 +6330,6 @@ static void mwl8k_remove(struct pci_dev return; priv = hw->priv; diff --git a/package/kernel/mac80211/patches/nss/ath10k/999-800-ath10k-Add-threaded-napi.patch b/package/kernel/mac80211/patches/nss/ath10k/999-800-ath10k-Add-threaded-napi.patch index 4293e2ccfdf..c97fd769193 100644 --- a/package/kernel/mac80211/patches/nss/ath10k/999-800-ath10k-Add-threaded-napi.patch +++ b/package/kernel/mac80211/patches/nss/ath10k/999-800-ath10k-Add-threaded-napi.patch @@ -4,7 +4,7 @@ ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif start\n"); -+ dev_set_threaded(&ar->napi_dev, true); ++ dev_set_threaded(ar->napi_dev, true); ath10k_core_napi_enable(ar); ath10k_pci_irq_enable(ar); @@ -20,22 +20,23 @@ /* Sleep 20 ms before HIF interrupts are disabled. --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -3722,6 +3722,9 @@ struct ath10k *ath10k_core_create(size_t - ath10k_core_set_coverage_class_work); +@@ -3707,6 +3707,10 @@ struct ath10k *ath10k_core_create(size_t + if (!ar->napi_dev) + goto err_free_tx_complete; - init_dummy_netdev(&ar->napi_dev); -+ snprintf(ar->napi_dev.name, sizeof(ar->napi_dev.name), "ath10k_%s", ++ snprintf(ar->napi_dev->name, sizeof(ar->napi_dev->name), "ath10k_%s", + wiphy_name(ar->hw->wiphy)); -+ dev_set_threaded(&ar->napi_dev, true); - ++ dev_set_threaded(ar->napi_dev, true); ++ ret = ath10k_coredump_create(ar); if (ret) + goto err_free_netdev; --- a/drivers/net/wireless/ath/ath10k/ahb.c +++ b/drivers/net/wireless/ath/ath10k/ahb.c @@ -622,6 +622,7 @@ static int ath10k_ahb_hif_start(struct a ath10k_core_napi_enable(ar); ath10k_ce_enable_interrupts(ar); - ath10k_pci_enable_legacy_irq(ar); + ath10k_pci_enable_intx_irq(ar); + dev_set_threaded(&ar->napi_dev, true); ath10k_pci_rx_post(ar); diff --git a/package/kernel/mac80211/patches/nss/ath11k/033-ath11k-fix-for-peer-memory-corruption.patch b/package/kernel/mac80211/patches/nss/ath11k/033-ath11k-fix-for-peer-memory-corruption.patch index a537d85cd1e..6764ffbcebc 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/033-ath11k-fix-for-peer-memory-corruption.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/033-ath11k-fix-for-peer-memory-corruption.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -4186,22 +4186,28 @@ static int ath11k_clear_peer_keys(struct +@@ -4275,22 +4275,28 @@ static int ath11k_clear_peer_keys(struct int ret; int i; u32 flags = 0; @@ -35,7 +35,7 @@ DISABLE_KEY, addr, flags); if (ret < 0 && first_errno == 0) first_errno = ret; -@@ -4209,10 +4215,6 @@ static int ath11k_clear_peer_keys(struct +@@ -4298,10 +4304,6 @@ static int ath11k_clear_peer_keys(struct if (ret < 0) ath11k_warn(ab, "failed to remove peer key %d: %d\n", i, ret); diff --git a/package/kernel/mac80211/patches/nss/ath11k/068-ath11k-add-rx-histogram-stats.patch b/package/kernel/mac80211/patches/nss/ath11k/068-ath11k-add-rx-histogram-stats.patch index 5f6b37633af..3b21ce04e7c 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/068-ath11k-add-rx-histogram-stats.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/068-ath11k-add-rx-histogram-stats.patch @@ -29,7 +29,7 @@ Signed-off-by: Manikanta Pubbisetty /* SMBIOS type containing Board Data File Name Extension */ #define ATH11K_SMBIOS_BDF_EXT_TYPE 0xF8 -@@ -415,6 +417,17 @@ struct ath11k_vif_iter { +@@ -419,6 +421,17 @@ struct ath11k_vif_iter { struct ath11k_vif *arvif; }; @@ -47,7 +47,7 @@ Signed-off-by: Manikanta Pubbisetty struct ath11k_rx_peer_stats { u64 num_msdu; u64 num_mpdu_fcs_ok; -@@ -426,10 +439,6 @@ struct ath11k_rx_peer_stats { +@@ -430,10 +443,6 @@ struct ath11k_rx_peer_stats { u64 non_ampdu_msdu_count; u64 stbc_count; u64 beamformed_count; @@ -58,7 +58,7 @@ Signed-off-by: Manikanta Pubbisetty u64 coding_count[HAL_RX_SU_MU_CODING_MAX]; u64 tid_count[IEEE80211_NUM_TIDS + 1]; u64 pream_cnt[HAL_RX_PREAMBLE_MAX]; -@@ -437,6 +446,8 @@ struct ath11k_rx_peer_stats { +@@ -441,6 +450,8 @@ struct ath11k_rx_peer_stats { u64 rx_duration; u64 dcm_count; u64 ru_alloc_cnt[HAL_RX_RU_ALLOC_TYPE_MAX]; @@ -269,7 +269,7 @@ Signed-off-by: Manikanta Pubbisetty &fops_htt_peer_stats); --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -2763,10 +2763,43 @@ exit: +@@ -2762,10 +2762,43 @@ exit: return total_msdu_reaped; } @@ -313,7 +313,7 @@ Signed-off-by: Manikanta Pubbisetty u32 num_msdu; int i; -@@ -2776,6 +2809,8 @@ static void ath11k_dp_rx_update_peer_sta +@@ -2775,6 +2808,8 @@ static void ath11k_dp_rx_update_peer_sta arsta->rssi_comb = ppdu_info->rssi_comb; ewma_avg_rssi_add(&arsta->avg_rssi, ppdu_info->rssi_comb); @@ -322,7 +322,7 @@ Signed-off-by: Manikanta Pubbisetty num_msdu = ppdu_info->tcp_msdu_count + ppdu_info->tcp_ack_msdu_count + ppdu_info->udp_msdu_count + ppdu_info->other_msdu_count; -@@ -2792,18 +2827,6 @@ static void ath11k_dp_rx_update_peer_sta +@@ -2791,18 +2826,6 @@ static void ath11k_dp_rx_update_peer_sta ppdu_info->tid = IEEE80211_NUM_TIDS; } @@ -341,7 +341,7 @@ Signed-off-by: Manikanta Pubbisetty if (ppdu_info->ldpc < HAL_RX_SU_MU_CODING_MAX) rx_stats->coding_count[ppdu_info->ldpc] += num_msdu; -@@ -2832,8 +2855,6 @@ static void ath11k_dp_rx_update_peer_sta +@@ -2831,8 +2854,6 @@ static void ath11k_dp_rx_update_peer_sta rx_stats->dcm_count += ppdu_info->dcm; rx_stats->ru_alloc_cnt[ppdu_info->ru_alloc] += num_msdu; @@ -350,7 +350,7 @@ Signed-off-by: Manikanta Pubbisetty BUILD_BUG_ON(ARRAY_SIZE(arsta->chain_signal) > ARRAY_SIZE(ppdu_info->rssi_chain_pri20)); -@@ -2842,6 +2863,52 @@ static void ath11k_dp_rx_update_peer_sta +@@ -2841,6 +2862,52 @@ static void ath11k_dp_rx_update_peer_sta rx_stats->rx_duration += ppdu_info->rx_duration; arsta->rx_duration = rx_stats->rx_duration; @@ -405,27 +405,27 @@ Signed-off-by: Manikanta Pubbisetty static struct sk_buff *ath11k_dp_rx_alloc_mon_status_buf(struct ath11k_base *ab, --- a/drivers/net/wireless/ath/ath11k/dp_rx.h +++ b/drivers/net/wireless/ath/ath11k/dp_rx.h -@@ -41,6 +41,25 @@ struct ath11k_dp_rfc1042_hdr { +@@ -42,6 +42,25 @@ struct ath11k_dp_rfc1042_hdr { __be16 snap_type; } __packed; +static inline u32 ath11k_he_gi_to_nl80211_he_gi(u8 sgi) +{ -+ u32 ret = 0; -+ -+ switch (sgi) { -+ case RX_MSDU_START_SGI_0_8_US: -+ ret = NL80211_RATE_INFO_HE_GI_0_8; -+ break; -+ case RX_MSDU_START_SGI_1_6_US: -+ ret = NL80211_RATE_INFO_HE_GI_1_6; -+ break; -+ case RX_MSDU_START_SGI_3_2_US: -+ ret = NL80211_RATE_INFO_HE_GI_3_2; -+ break; -+ } ++ u32 ret = 0; ++ ++ switch (sgi) { ++ case RX_MSDU_START_SGI_0_8_US: ++ ret = NL80211_RATE_INFO_HE_GI_0_8; ++ break; ++ case RX_MSDU_START_SGI_1_6_US: ++ ret = NL80211_RATE_INFO_HE_GI_1_6; ++ break; ++ case RX_MSDU_START_SGI_3_2_US: ++ ret = NL80211_RATE_INFO_HE_GI_3_2; ++ break; ++ } + -+ return ret; ++ return ret; +} + int ath11k_dp_rx_ampdu_start(struct ath11k *ar, diff --git a/package/kernel/mac80211/patches/nss/ath11k/069-ath11k-add-HE-stats-in-peer-stats.patch b/package/kernel/mac80211/patches/nss/ath11k/069-ath11k-add-HE-stats-in-peer-stats.patch index 13c87a0470c..d1773499512 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/069-ath11k-add-HE-stats-in-peer-stats.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/069-ath11k-add-HE-stats-in-peer-stats.patch @@ -23,7 +23,7 @@ Signed-off-by: Miles Hu #include "fw.h" #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK) -@@ -508,6 +509,8 @@ struct ath11k_htt_data_stats { +@@ -512,6 +513,8 @@ struct ath11k_htt_data_stats { u64 bw[ATH11K_COUNTER_TYPE_MAX][ATH11K_BW_NUM]; u64 nss[ATH11K_COUNTER_TYPE_MAX][ATH11K_NSS_NUM]; u64 gi[ATH11K_COUNTER_TYPE_MAX][ATH11K_GI_NUM]; @@ -32,7 +32,7 @@ Signed-off-by: Miles Hu }; struct ath11k_htt_tx_stats { -@@ -515,6 +518,9 @@ struct ath11k_htt_tx_stats { +@@ -519,6 +522,9 @@ struct ath11k_htt_tx_stats { u64 tx_duration; u64 ba_fails; u64 ack_fails; @@ -42,7 +42,7 @@ Signed-off-by: Miles Hu }; struct ath11k_per_ppdu_tx_stats { -@@ -631,11 +637,16 @@ struct ath11k_per_peer_tx_stats { +@@ -635,11 +641,16 @@ struct ath11k_per_peer_tx_stats { u32 succ_bytes; u32 retry_bytes; u32 failed_bytes; diff --git a/package/kernel/mac80211/patches/nss/ath11k/087-ath11k-fix-ul-ofdma-counter-increamenting-improperly.patch b/package/kernel/mac80211/patches/nss/ath11k/087-ath11k-fix-ul-ofdma-counter-increamenting-improperly.patch index 706082dc511..2a98923fa46 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/087-ath11k-fix-ul-ofdma-counter-increamenting-improperly.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/087-ath11k-fix-ul-ofdma-counter-increamenting-improperly.patch @@ -5,7 +5,7 @@ --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -5452,8 +5452,11 @@ int ath11k_dp_rx_process_mon_status(stru +@@ -5515,8 +5515,11 @@ int ath11k_dp_rx_process_mon_status(stru goto next_skb; } diff --git a/package/kernel/mac80211/patches/nss/ath11k/108-ath11k-enable-ul-ofdma-ru-allocation-in-peer-stats.patch b/package/kernel/mac80211/patches/nss/ath11k/108-ath11k-enable-ul-ofdma-ru-allocation-in-peer-stats.patch index 3406836981d..ce57ea9aed2 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/108-ath11k-enable-ul-ofdma-ru-allocation-in-peer-stats.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/108-ath11k-enable-ul-ofdma-ru-allocation-in-peer-stats.patch @@ -15,7 +15,7 @@ --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -2902,11 +2902,12 @@ exit: +@@ -2901,11 +2901,12 @@ exit: static void ath11k_dp_rx_update_peer_rate_table_stats(struct ath11k_rx_peer_stats *rx_stats, struct hal_rx_mon_ppdu_info *ppdu_info, @@ -30,7 +30,7 @@ u32 bw_idx = ppdu_info->bw; u32 gi_idx = ppdu_info->gi; -@@ -2928,10 +2929,13 @@ ath11k_dp_rx_update_peer_rate_table_stat +@@ -2927,10 +2928,13 @@ ath11k_dp_rx_update_peer_rate_table_stat } rx_stats->pkt_stats.rx_rate[rate_idx] += num_msdu; @@ -46,7 +46,7 @@ struct hal_rx_mon_ppdu_info *ppdu_info) { struct ath11k_rx_peer_stats *rx_stats = arsta->rx_stats; -@@ -2989,7 +2993,6 @@ static void ath11k_dp_rx_update_peer_sta +@@ -2988,7 +2992,6 @@ static void ath11k_dp_rx_update_peer_sta rx_stats->num_mpdu_fcs_ok += ppdu_info->num_mpdu_fcs_ok; rx_stats->num_mpdu_fcs_err += ppdu_info->num_mpdu_fcs_err; rx_stats->dcm_count += ppdu_info->dcm; @@ -54,7 +54,7 @@ BUILD_BUG_ON(ARRAY_SIZE(arsta->chain_signal) > ARRAY_SIZE(ppdu_info->rssi_chain_pri20)); -@@ -3007,10 +3010,10 @@ static void ath11k_dp_rx_update_peer_sta +@@ -3006,10 +3009,10 @@ static void ath11k_dp_rx_update_peer_sta if (ppdu_info->preamble_type == HAL_RX_PREAMBLE_11N && ppdu_info->mcs <= HAL_RX_MAX_MCS_HT) { @@ -69,7 +69,7 @@ } if (ppdu_info->preamble_type == HAL_RX_PREAMBLE_11AC && -@@ -3043,7 +3046,120 @@ static void ath11k_dp_rx_update_peer_sta +@@ -3042,7 +3045,120 @@ static void ath11k_dp_rx_update_peer_sta rx_stats->byte_stats.bw_count[ppdu_info->bw] += ppdu_info->mpdu_len; } @@ -191,7 +191,7 @@ } -@@ -5381,6 +5497,55 @@ static void ath11k_dp_rx_mon_dest_proces +@@ -5444,6 +5560,55 @@ static void ath11k_dp_rx_mon_dest_proces } } @@ -247,7 +247,7 @@ int ath11k_dp_rx_process_mon_status(struct ath11k_base *ab, int mac_id, struct napi_struct *napi, int budget) { -@@ -5454,8 +5619,13 @@ int ath11k_dp_rx_process_mon_status(stru +@@ -5517,8 +5682,13 @@ int ath11k_dp_rx_process_mon_status(stru if ((ppdu_info->fc_valid) && (ppdu_info->ast_index != HAL_AST_IDX_INVALID)) { diff --git a/package/kernel/mac80211/patches/nss/ath11k/113-ath11k-add-8023-undecap-support.patch b/package/kernel/mac80211/patches/nss/ath11k/113-ath11k-add-8023-undecap-support.patch index c08aa58c8c6..2ba2411c3ef 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/113-ath11k-add-8023-undecap-support.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/113-ath11k-add-8023-undecap-support.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -2306,6 +2306,42 @@ static void ath11k_dp_rx_h_undecap_eth(s +@@ -2305,6 +2305,42 @@ static void ath11k_dp_rx_h_undecap_eth(s ether_addr_copy(ieee80211_get_SA(hdr), sa); } @@ -43,7 +43,7 @@ static void ath11k_dp_rx_h_undecap(struct ath11k *ar, struct sk_buff *msdu, struct hal_rx_desc *rx_desc, enum hal_encrypt_type enctype, -@@ -2347,7 +2383,8 @@ static void ath11k_dp_rx_h_undecap(struc +@@ -2346,7 +2382,8 @@ static void ath11k_dp_rx_h_undecap(struc enctype, status); break; case DP_RX_DECAP_TYPE_8023: diff --git a/package/kernel/mac80211/patches/nss/ath11k/142-ath11k-adding-support-for-mgmt-frame-stats.patch b/package/kernel/mac80211/patches/nss/ath11k/142-ath11k-adding-support-for-mgmt-frame-stats.patch index d6b94cdde10..7d33113a097 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/142-ath11k-adding-support-for-mgmt-frame-stats.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/142-ath11k-adding-support-for-mgmt-frame-stats.patch @@ -16,8 +16,8 @@ #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK) -@@ -355,6 +355,16 @@ struct ath11k_reg_tpc_power_info { - struct ath11k_chan_power_info chan_power_info[IEEE80211_MAX_NUM_PWR_LEVEL]; +@@ -358,6 +358,16 @@ struct ath11k_reg_tpc_power_info { + struct ath11k_chan_power_info chan_power_info[ATH11K_NUM_PWR_LEVELS]; }; +#define ATH11K_STATS_MGMT_FRM_TYPE_MAX 16 @@ -33,7 +33,7 @@ struct ath11k_vif { u32 vdev_id; enum wmi_vdev_type vdev_type; -@@ -411,6 +421,7 @@ struct ath11k_vif { +@@ -415,6 +425,7 @@ struct ath11k_vif { struct ath11k_rekey_data rekey_data; struct ath11k_reg_tpc_power_info reg_tpc_info; @@ -143,7 +143,7 @@ debugfs_create_file("dfs_simulate_radar", 0200, --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -5934,9 +5934,9 @@ static int ath11k_mac_mgmt_tx(struct ath +@@ -6031,9 +6031,9 @@ static int ath11k_mac_mgmt_tx(struct ath */ if (is_prb_rsp && atomic_read(&ar->num_pending_mgmt_tx) > ATH11K_PRB_RSP_DROP_THRESHOLD) { @@ -155,7 +155,7 @@ } if (skb_queue_len_lockless(q) >= ATH11K_TX_MGMT_NUM_PENDING_MAX) { -@@ -5962,9 +5962,11 @@ static void ath11k_mac_op_tx(struct ieee +@@ -6059,9 +6059,11 @@ static void ath11k_mac_op_tx(struct ieee struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; struct ieee80211_key_conf *key = info->control.hw_key; @@ -167,7 +167,7 @@ int ret; memset(skb_cb, 0, sizeof(*skb_cb)); -@@ -5978,12 +5980,21 @@ static void ath11k_mac_op_tx(struct ieee +@@ -6075,12 +6077,21 @@ static void ath11k_mac_op_tx(struct ieee if (info_flags & IEEE80211_TX_CTL_HW_80211_ENCAP) { skb_cb->flags |= ATH11K_SKB_HW_80211_ENCAP; } else if (ieee80211_is_mgmt(hdr->frame_control)) { @@ -213,7 +213,7 @@ int peer_id; --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -5896,6 +5896,12 @@ static int wmi_process_mgmt_tx_comp(stru +@@ -5941,6 +5941,12 @@ static int wmi_process_mgmt_tx_comp(stru struct sk_buff *msdu; struct ieee80211_tx_info *info; struct ath11k_skb_cb *skb_cb; @@ -226,7 +226,7 @@ int num_mgmt; spin_lock_bh(&ar->txmgmt_idr_lock); -@@ -5923,6 +5929,31 @@ static int wmi_process_mgmt_tx_comp(stru +@@ -5968,6 +5974,31 @@ static int wmi_process_mgmt_tx_comp(stru info->status.ack_signal = tx_compl_param->ack_rssi; } @@ -258,7 +258,7 @@ ieee80211_tx_status_irqsafe(ar->hw, msdu); num_mgmt = atomic_dec_if_positive(&ar->num_pending_mgmt_tx); -@@ -7500,6 +7531,11 @@ static void ath11k_mgmt_rx_event(struct +@@ -7547,6 +7578,11 @@ static void ath11k_mgmt_rx_event(struct struct ieee80211_hdr *hdr; u16 fc; struct ieee80211_supported_band *sband; @@ -270,7 +270,7 @@ if (ath11k_pull_mgmt_rx_params_tlv(ab, skb, &rx_ev) != 0) { ath11k_warn(ab, "failed to extract mgmt rx event"); -@@ -7565,7 +7601,34 @@ static void ath11k_mgmt_rx_event(struct +@@ -7612,7 +7648,34 @@ static void ath11k_mgmt_rx_event(struct hdr = (struct ieee80211_hdr *)skb->data; fc = le16_to_cpu(hdr->frame_control); diff --git a/package/kernel/mac80211/patches/nss/ath11k/181-ath11k-remove-error-on-soc-debugfs-fail.patch b/package/kernel/mac80211/patches/nss/ath11k/181-ath11k-remove-error-on-soc-debugfs-fail.patch index 0e46d98da44..05055586cce 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/181-ath11k-remove-error-on-soc-debugfs-fail.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/181-ath11k-remove-error-on-soc-debugfs-fail.patch @@ -34,7 +34,7 @@ Signed-off-by: Anilkumar Kolli --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -2294,5 +2294,17 @@ err_sc_free: +@@ -2303,5 +2303,17 @@ err_sc_free: } EXPORT_SYMBOL(ath11k_core_alloc); diff --git a/package/kernel/mac80211/patches/nss/ath11k/191-ath11k-add-mgmt-and-data-ack-rssi.patch b/package/kernel/mac80211/patches/nss/ath11k/191-ath11k-add-mgmt-and-data-ack-rssi.patch index 35d05f1b687..0d1de3b2f45 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/191-ath11k-add-mgmt-and-data-ack-rssi.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/191-ath11k-add-mgmt-and-data-ack-rssi.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -10159,6 +10159,8 @@ static int __ath11k_mac_register(struct +@@ -10211,6 +10211,8 @@ static int __ath11k_mac_register(struct wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT); @@ -11,7 +11,7 @@ ar->hw->offchannel_tx_hw_queue = ATH11K_HW_MAX_QUEUES - 1; --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -4128,6 +4128,7 @@ ath11k_wmi_copy_resource_config(struct w +@@ -4173,6 +4173,7 @@ ath11k_wmi_copy_resource_config(struct w wmi_cfg->max_bssid_rx_filters = tg_cfg->max_bssid_rx_filters; wmi_cfg->use_pdev_id = tg_cfg->use_pdev_id; wmi_cfg->flag1 = tg_cfg->flag1; diff --git a/package/kernel/mac80211/patches/nss/ath11k/199-002-ath11k_nss-add-nss-driver-interface.patch b/package/kernel/mac80211/patches/nss/ath11k/199-002-ath11k_nss-add-nss-driver-interface.patch index 77489c20b3c..4bb181536a3 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/199-002-ath11k_nss-add-nss-driver-interface.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/199-002-ath11k_nss-add-nss-driver-interface.patch @@ -38,7 +38,7 @@ Signed-off-by: Sriram R depends on m --- a/drivers/net/wireless/ath/ath11k/Makefile +++ b/drivers/net/wireless/ath/ath11k/Makefile -@@ -26,6 +26,7 @@ ath11k-$(CPTCFG_ATH11K_TRACING) += trace +@@ -27,6 +27,7 @@ ath11k-$(CPTCFG_ATH11K_TRACING) += trace ath11k-$(CPTCFG_ATH11K_THERMAL) += thermal.o ath11k-$(CPTCFG_ATH11K_SPECTRAL) += spectral.o ath11k-$(CONFIG_PM) += wow.o @@ -2848,7 +2848,7 @@ Signed-off-by: Sriram R enum hal_pn_type pn_type) --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -1164,6 +1164,44 @@ int ath11k_wmi_send_pdev_set_regdomain(s +@@ -1169,6 +1169,44 @@ int ath11k_wmi_send_pdev_set_regdomain(s return ret; } @@ -2895,7 +2895,7 @@ Signed-off-by: Sriram R { --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -2894,6 +2894,27 @@ struct pdev_set_regdomain_params { +@@ -2890,6 +2890,27 @@ struct pdev_set_regdomain_params { u32 pdev_id; }; @@ -2923,7 +2923,7 @@ Signed-off-by: Sriram R struct rx_reorder_queue_remove_params { u8 *peer_macaddr; u16 vdev_id; -@@ -3142,6 +3163,16 @@ struct wmi_pdev_set_regdomain_cmd { +@@ -3138,6 +3159,16 @@ struct wmi_pdev_set_regdomain_cmd { u32 dfs_domain; } __packed; @@ -2940,7 +2940,7 @@ Signed-off-by: Sriram R struct wmi_peer_set_param_cmd { u32 tlv_header; u32 vdev_id; -@@ -6384,6 +6415,8 @@ int ath11k_wmi_send_peer_create_cmd(stru +@@ -6390,6 +6421,8 @@ int ath11k_wmi_send_peer_create_cmd(stru int ath11k_wmi_vdev_set_param_cmd(struct ath11k *ar, u32 vdev_id, u32 param_id, u32 param_value); @@ -2951,7 +2951,7 @@ Signed-off-by: Sriram R int ath11k_wmi_force_fw_hang_cmd(struct ath11k *ar, u32 type, u32 delay_time_ms); --- a/drivers/net/wireless/ath/ath11k/dp_rx.h +++ b/drivers/net/wireless/ath/ath11k/dp_rx.h -@@ -20,6 +20,34 @@ +@@ -21,6 +21,34 @@ #define DP_RX_MPDU_ERR_MPDU_LEN BIT(6) #define DP_RX_MPDU_ERR_UNENCRYPTED_FRAME BIT(7) @@ -2986,7 +2986,7 @@ Signed-off-by: Sriram R enum dp_rx_decap_type { DP_RX_DECAP_TYPE_RAW, DP_RX_DECAP_TYPE_NATIVE_WIFI, -@@ -75,6 +103,9 @@ void ath11k_peer_rx_tid_delete(struct at +@@ -76,6 +104,9 @@ void ath11k_peer_rx_tid_delete(struct at int ath11k_peer_rx_tid_setup(struct ath11k *ar, const u8 *peer_mac, int vdev_id, u8 tid, u32 ba_win_sz, u16 ssn, enum hal_pn_type pn_type); @@ -2998,7 +2998,7 @@ Signed-off-by: Sriram R int ath11k_dp_pdev_reo_setup(struct ath11k_base *ab); --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -6153,6 +6153,16 @@ static int ath11k_mac_op_start(struct ie +@@ -6250,6 +6250,16 @@ static int ath11k_mac_op_start(struct ie goto err; } @@ -3017,7 +3017,7 @@ Signed-off-by: Sriram R /* TODO: Do we need to enable ANI? */ --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -887,6 +887,8 @@ struct ath11k_soc_dp_tx_err_stats { +@@ -891,6 +891,8 @@ struct ath11k_soc_dp_tx_err_stats { * idr unavailable etc. */ atomic_t misc_fail; @@ -3026,7 +3026,7 @@ Signed-off-by: Sriram R }; struct ath11k_soc_dp_stats { -@@ -973,6 +975,7 @@ struct ath11k_base { +@@ -977,6 +979,7 @@ struct ath11k_base { struct list_head peers; wait_queue_head_t peer_mapping_wq; u8 mac_addr[ETH_ALEN]; diff --git a/package/kernel/mac80211/patches/nss/ath11k/199-003-ath11k-add-nss-support.patch b/package/kernel/mac80211/patches/nss/ath11k/199-003-ath11k-add-nss-support.patch index 57d507173e5..63148a4a922 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/199-003-ath11k-add-nss-support.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/199-003-ath11k-add-nss-support.patch @@ -24,7 +24,7 @@ Signed-off-by: Sriram R --- a/drivers/net/wireless/ath/ath11k/ahb.c +++ b/drivers/net/wireless/ath/ath11k/ahb.c -@@ -526,6 +526,12 @@ static int ath11k_ahb_config_ext_irq(str +@@ -527,6 +527,12 @@ static int ath11k_ahb_config_ext_irq(str int i, j; int irq; int ret; @@ -37,7 +37,7 @@ Signed-off-by: Sriram R for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; -@@ -538,20 +544,20 @@ static int ath11k_ahb_config_ext_irq(str +@@ -543,20 +549,20 @@ static int ath11k_ahb_config_ext_irq(str ath11k_ahb_ext_grp_napi_poll); for (j = 0; j < ATH11K_EXT_IRQ_NUM_MAX; j++) { @@ -62,7 +62,7 @@ Signed-off-by: Sriram R irq_grp->irqs[num_irq++] = wbm2host_rx_release; if (ab->hw_params.ring_mask->reo_status[i] & BIT(j)) -@@ -564,7 +570,7 @@ static int ath11k_ahb_config_ext_irq(str +@@ -569,7 +575,7 @@ static int ath11k_ahb_config_ext_irq(str ath11k_hw_get_mac_from_pdev_id(hw, j); } @@ -71,7 +71,7 @@ Signed-off-by: Sriram R irq_grp->irqs[num_irq++] = host2rxdma_host_buf_ring_mac1 - ath11k_hw_get_mac_from_pdev_id(hw, j); -@@ -905,6 +911,7 @@ static int ath11k_ahb_setup_resources(st +@@ -910,6 +916,7 @@ static int ath11k_ahb_setup_resources(st } ab->mem = mem; @@ -94,7 +94,7 @@ Signed-off-by: Sriram R unsigned int ath11k_debug_mask; EXPORT_SYMBOL(ath11k_debug_mask); module_param_named(debug_mask, ath11k_debug_mask, uint, 0644); -@@ -1624,10 +1630,16 @@ static int ath11k_core_pdev_create(struc +@@ -1636,10 +1642,16 @@ static int ath11k_core_pdev_create(struc goto err_pdev_debug; } @@ -112,7 +112,7 @@ Signed-off-by: Sriram R } ret = ath11k_thermal_register(ab); -@@ -1649,6 +1661,8 @@ err_thermal_unregister: +@@ -1661,6 +1673,8 @@ err_thermal_unregister: ath11k_thermal_unregister(ab); err_mac_unregister: ath11k_mac_unregister(ab); @@ -121,7 +121,7 @@ Signed-off-by: Sriram R err_dp_pdev_free: ath11k_dp_pdev_free(ab); err_pdev_debug: -@@ -1662,6 +1676,10 @@ static void ath11k_core_pdev_destroy(str +@@ -1674,6 +1688,10 @@ static void ath11k_core_pdev_destroy(str ath11k_spectral_deinit(ab); ath11k_thermal_unregister(ab); ath11k_mac_unregister(ab); @@ -132,7 +132,7 @@ Signed-off-by: Sriram R ath11k_hif_irq_disable(ab); ath11k_dp_pdev_free(ab); ath11k_debugfs_pdev_destroy(ab); -@@ -1868,6 +1886,10 @@ static int ath11k_core_reconfigure_on_cr +@@ -1880,6 +1898,10 @@ static int ath11k_core_reconfigure_on_cr int ret; mutex_lock(&ab->core_lock); @@ -143,7 +143,7 @@ Signed-off-by: Sriram R ath11k_thermal_unregister(ab); ath11k_dp_pdev_free(ab); ath11k_spectral_deinit(ab); -@@ -2199,6 +2221,10 @@ int ath11k_core_pre_init(struct ath11k_b +@@ -2208,6 +2230,10 @@ int ath11k_core_pre_init(struct ath11k_b ath11k_err(ab, "failed to pre init firmware: %d", ret); return ret; } @@ -164,7 +164,7 @@ Signed-off-by: Sriram R #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK) -@@ -422,6 +423,9 @@ struct ath11k_vif { +@@ -426,6 +427,9 @@ struct ath11k_vif { struct ath11k_reg_tpc_power_info reg_tpc_info; struct ath11k_mgmt_frame_stats mgmt_stats; @@ -174,7 +174,7 @@ Signed-off-by: Sriram R }; struct ath11k_vif_iter { -@@ -575,6 +579,9 @@ struct ath11k_sta { +@@ -579,6 +583,9 @@ struct ath11k_sta { #endif bool use_4addr_set; @@ -184,7 +184,7 @@ Signed-off-by: Sriram R u16 tcl_metadata; /* Protected with ar->data_lock */ -@@ -669,6 +676,9 @@ struct ath11k { +@@ -673,6 +680,9 @@ struct ath11k { struct ath11k_pdev *pdev; struct ieee80211_hw *hw; struct ath11k_pdev_wmi *wmi; @@ -194,7 +194,7 @@ Signed-off-by: Sriram R struct ath11k_pdev_dp dp; u8 mac_addr[ETH_ALEN]; struct ath11k_he ar_he; -@@ -930,9 +940,11 @@ struct ath11k_base { +@@ -934,9 +944,11 @@ struct ath11k_base { struct ath11k_htc htc; struct ath11k_dp dp; @@ -292,8 +292,8 @@ Signed-off-by: Sriram R - for (i = 0; i < ab->num_radios; i++) { + for (i = 0; !nss_offload && i < ab->num_radios; i++) { - for (j = 0; j < ab->hw_params.num_rxmda_per_pdev; j++) { - int id = i * ab->hw_params.num_rxmda_per_pdev + j; + for (j = 0; j < ab->hw_params.num_rxdma_per_pdev; j++) { + int id = i * ab->hw_params.num_rxdma_per_pdev + j; --- a/drivers/net/wireless/ath/ath11k/dp.h +++ b/drivers/net/wireless/ath/ath11k/dp.h @@ -357,16 +357,7 @@ Signed-off-by: Sriram R if (ar->ab->hw_params.rxdma1_enable) { rx_ring = &dp->rxdma_mon_buf_ring; -@@ -2036,7 +2039,7 @@ static void ath11k_dp_rx_h_csum_offload( - CHECKSUM_NONE : CHECKSUM_UNNECESSARY; - } - --static int ath11k_dp_rx_crypto_mic_len(struct ath11k *ar, -+int ath11k_dp_rx_crypto_mic_len(struct ath11k *ar, - enum hal_encrypt_type enctype) - { - switch (enctype) { -@@ -2063,7 +2066,7 @@ static int ath11k_dp_rx_crypto_mic_len(s +@@ -2062,7 +2065,7 @@ int ath11k_dp_rx_crypto_mic_len(struct a return 0; } @@ -375,7 +366,7 @@ Signed-off-by: Sriram R enum hal_encrypt_type enctype) { switch (enctype) { -@@ -2091,7 +2094,7 @@ static int ath11k_dp_rx_crypto_param_len +@@ -2090,7 +2093,7 @@ static int ath11k_dp_rx_crypto_param_len return 0; } @@ -384,7 +375,7 @@ Signed-off-by: Sriram R enum hal_encrypt_type enctype) { switch (enctype) { -@@ -2827,6 +2830,22 @@ static void ath11k_dp_rx_process_receive +@@ -2826,6 +2829,22 @@ static void ath11k_dp_rx_process_receive } } @@ -407,7 +398,7 @@ Signed-off-by: Sriram R int ath11k_dp_process_rx(struct ath11k_base *ab, int ring_id, struct napi_struct *napi, int budget) { -@@ -3126,7 +3145,8 @@ static void ath11k_dp_rx_update_user_sta +@@ -3125,7 +3144,8 @@ static void ath11k_dp_rx_update_user_sta peer = ath11k_peer_find_by_ast(ar->ab, user_stats->ast_index); if (peer == NULL) { @@ -417,7 +408,7 @@ Signed-off-by: Sriram R user_stats->ast_index); return; } -@@ -3134,6 +3154,13 @@ static void ath11k_dp_rx_update_user_sta +@@ -3133,6 +3153,13 @@ static void ath11k_dp_rx_update_user_sta arsta = (struct ath11k_sta *)peer->sta->drv_priv; rx_stats = arsta->rx_stats; @@ -431,7 +422,7 @@ Signed-off-by: Sriram R if (!rx_stats) return; -@@ -3210,8 +3237,10 @@ static void ath11k_dp_rx_update_peer_mu_ +@@ -3209,8 +3236,10 @@ static void ath11k_dp_rx_update_peer_mu_ { u32 num_users, i; @@ -443,7 +434,7 @@ Signed-off-by: Sriram R num_users = ppdu_info->num_users; if (num_users > HAL_MAX_UL_MU_USERS) -@@ -5614,7 +5643,7 @@ int ath11k_dp_rx_process_mon_status(stru +@@ -5677,7 +5706,7 @@ int ath11k_dp_rx_process_mon_status(stru struct sk_buff *skb; struct sk_buff_head skb_list; struct ath11k_peer *peer; @@ -452,7 +443,7 @@ Signed-off-by: Sriram R int num_buffs_reaped = 0; u32 rx_buf_sz; u16 log_type; -@@ -5682,6 +5711,7 @@ int ath11k_dp_rx_process_mon_status(stru +@@ -5745,6 +5774,7 @@ int ath11k_dp_rx_process_mon_status(stru if (ppdu_info->reception_type == HAL_RX_RECEPTION_TYPE_SU) { arsta = (struct ath11k_sta *)peer->sta->drv_priv; ath11k_dp_rx_update_peer_su_stats(arsta, ppdu_info); @@ -462,12 +453,10 @@ Signed-off-by: Sriram R ath11k_dp_rx_update_peer_mu_stats(ar, ppdu_info); --- a/drivers/net/wireless/ath/ath11k/dp_rx.h +++ b/drivers/net/wireless/ath/ath11k/dp_rx.h -@@ -145,4 +145,18 @@ int ath11k_peer_rx_frag_setup(struct ath - int ath11k_dp_rx_pktlog_start(struct ath11k_base *ab); - int ath11k_dp_rx_pktlog_stop(struct ath11k_base *ab, bool stop_timer); +@@ -148,4 +148,16 @@ int ath11k_dp_rx_pktlog_stop(struct ath1 + + int ath11k_dp_rx_crypto_mic_len(struct ath11k *ar, enum hal_encrypt_type enctype); -+int ath11k_dp_rx_crypto_mic_len(struct ath11k *ar, -+ enum hal_encrypt_type enctype); +int ath11k_dp_rx_crypto_param_len(struct ath11k *ar, + enum hal_encrypt_type enctype); +int ath11k_dp_rx_crypto_icv_len(struct ath11k *ar, @@ -517,7 +506,7 @@ Signed-off-by: Sriram R #define CHAN2G(_channel, _freq, _flags) { \ .band = NL80211_BAND_2GHZ, \ -@@ -1593,6 +1594,11 @@ static void ath11k_control_beaconing(str +@@ -1680,6 +1681,11 @@ static void ath11k_control_beaconing(str lockdep_assert_held(&arvif->ar->conf_mutex); if (!info->enable_beacon) { @@ -529,7 +518,7 @@ Signed-off-by: Sriram R ret = ath11k_wmi_vdev_down(ar, arvif->vdev_id); if (ret) ath11k_warn(ar->ab, "failed to down vdev_id %i: %d\n", -@@ -1632,6 +1638,12 @@ static void ath11k_control_beaconing(str +@@ -1719,6 +1725,12 @@ static void ath11k_control_beaconing(str arvif->is_up = true; @@ -542,7 +531,7 @@ Signed-off-by: Sriram R ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev %d up\n", arvif->vdev_id); } -@@ -3070,6 +3082,12 @@ static void ath11k_bss_assoc(struct ieee +@@ -3157,6 +3169,12 @@ static void ath11k_bss_assoc(struct ieee "vdev %d up (associated) bssid %pM aid %d\n", arvif->vdev_id, bss_conf->bssid, vif->cfg.aid); @@ -555,7 +544,7 @@ Signed-off-by: Sriram R spin_lock_bh(&ar->ab->base_lock); peer = ath11k_peer_find(ar->ab, arvif->vdev_id, arvif->bssid); -@@ -3112,6 +3130,10 @@ static void ath11k_bss_disassoc(struct i +@@ -3199,6 +3217,10 @@ static void ath11k_bss_disassoc(struct i lockdep_assert_held(&ar->conf_mutex); @@ -566,7 +555,7 @@ Signed-off-by: Sriram R ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev %i disassoc bssid %pM\n", arvif->vdev_id, arvif->bssid); -@@ -3404,6 +3426,28 @@ static bool ath11k_mac_supports_station_ +@@ -3491,6 +3513,28 @@ static bool ath11k_mac_supports_station_ chandef->chan->band == NL80211_BAND_6GHZ; } @@ -595,7 +584,7 @@ Signed-off-by: Sriram R static void ath11k_mac_op_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_bss_conf *info, -@@ -4303,6 +4347,26 @@ static int ath11k_mac_op_set_key(struct +@@ -4392,6 +4436,26 @@ static int ath11k_mac_op_set_key(struct spin_lock_bh(&ab->base_lock); peer = ath11k_peer_find(ab, arvif->vdev_id, peer_addr); @@ -622,7 +611,7 @@ Signed-off-by: Sriram R if (peer && cmd == SET_KEY) { peer->keys[key->keyidx] = key; if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) { -@@ -4341,9 +4405,8 @@ static int ath11k_mac_op_set_key(struct +@@ -4430,9 +4494,8 @@ static int ath11k_mac_op_set_key(struct break; } } @@ -633,7 +622,7 @@ Signed-off-by: Sriram R exit: mutex_unlock(&ar->conf_mutex); return ret; -@@ -6002,10 +6065,14 @@ static void ath11k_mac_op_tx(struct ieee +@@ -6099,10 +6162,14 @@ static void ath11k_mac_op_tx(struct ieee if (control->sta) arsta = ath11k_sta_to_arsta(control->sta); @@ -649,7 +638,7 @@ Signed-off-by: Sriram R } } -@@ -6027,6 +6094,8 @@ static int ath11k_mac_config_mon_status_ +@@ -6124,6 +6191,8 @@ static int ath11k_mac_config_mon_status_ if (enable) { tlv_filter = ath11k_mac_mon_status_filter_default; @@ -658,7 +647,7 @@ Signed-off-by: Sriram R if (ath11k_debugfs_rx_filter(ar)) tlv_filter.rx_filter = ath11k_debugfs_rx_filter(ar); } -@@ -6325,7 +6394,7 @@ static int ath11k_mac_setup_vdev_create_ +@@ -6422,7 +6491,7 @@ static int ath11k_mac_setup_vdev_create_ return 0; } @@ -667,7 +656,7 @@ Signed-off-by: Sriram R struct ieee80211_vif *vif) { struct ath11k *ar = hw->priv; -@@ -6371,6 +6440,8 @@ static void ath11k_mac_op_update_vif_off +@@ -6468,6 +6537,8 @@ static void ath11k_mac_op_update_vif_off arvif->vdev_id, ret); vif->offload_flags &= ~IEEE80211_OFFLOAD_DECAP_ENABLED; } @@ -676,7 +665,7 @@ Signed-off-by: Sriram R } static bool ath11k_mac_vif_ap_active_any(struct ath11k_base *ab) -@@ -6501,6 +6572,8 @@ static int ath11k_mac_vdev_delete(struct +@@ -6598,6 +6669,8 @@ static int ath11k_mac_vdev_delete(struct reinit_completion(&ar->vdev_delete_done); @@ -685,7 +674,7 @@ Signed-off-by: Sriram R ret = ath11k_wmi_vdev_delete(ar, arvif->vdev_id); if (ret) { ath11k_warn(ar->ab, "failed to delete WMI vdev %d: %d\n", -@@ -6634,7 +6707,34 @@ static int ath11k_mac_op_add_interface(s +@@ -6751,7 +6824,34 @@ static int ath11k_mac_op_add_interface(s list_add(&arvif->list, &ar->arvifs); spin_unlock_bh(&ar->data_lock); @@ -721,7 +710,7 @@ Signed-off-by: Sriram R nss = get_num_chains(ar->cfg_tx_chainmask) ? : 1; ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, -@@ -6764,6 +6864,7 @@ err_peer_del: +@@ -6881,6 +6981,7 @@ err_peer_del: } err_vdev_del: @@ -729,7 +718,7 @@ Signed-off-by: Sriram R ath11k_mac_vdev_delete(ar, arvif); spin_lock_bh(&ar->data_lock); list_del(&arvif->list); -@@ -7281,6 +7382,10 @@ ath11k_mac_update_vif_chan(struct ath11k +@@ -7399,6 +7500,10 @@ ath11k_mac_update_vif_chan(struct ath11k arvif->vdev_id, ret); continue; } @@ -740,16 +729,16 @@ Signed-off-by: Sriram R } /* Restart the internal monitor vdev on new channel */ -@@ -8982,6 +9087,8 @@ static void ath11k_mac_op_sta_statistics - sinfo->signal_avg = ewma_avg_rssi_read(&arsta->avg_rssi) + - ATH11K_DEFAULT_NOISE_FLOOR; +@@ -9026,6 +9131,8 @@ static void ath11k_mac_op_sta_statistics + sinfo->signal_avg += ATH11K_DEFAULT_NOISE_FLOOR; + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); + + ath11k_nss_update_sta_stats(sinfo, sta, arsta); } #if IS_ENABLED(CONFIG_IPV6) -@@ -9674,6 +9781,7 @@ static const struct ieee80211_ops ath11k +@@ -9723,6 +9830,7 @@ static const struct ieee80211_ops ath11k .update_vif_offload = ath11k_mac_op_update_vif_offload, .config = ath11k_mac_op_config, .bss_info_changed = ath11k_mac_op_bss_info_changed, @@ -757,7 +746,7 @@ Signed-off-by: Sriram R .configure_filter = ath11k_mac_op_configure_filter, .hw_scan = ath11k_mac_op_hw_scan, .cancel_hw_scan = ath11k_mac_op_cancel_hw_scan, -@@ -10109,7 +10217,8 @@ static int __ath11k_mac_register(struct +@@ -10161,7 +10269,8 @@ static int __ath11k_mac_register(struct ieee80211_hw_set(ar->hw, TX_AMPDU_SETUP_IN_HW); ieee80211_hw_set(ar->hw, SUPPORTS_REORDERING_BUFFER); ieee80211_hw_set(ar->hw, SUPPORTS_AMSDU_IN_AMPDU); @@ -767,7 +756,7 @@ Signed-off-by: Sriram R } ar->hw->wiphy->features |= NL80211_FEATURE_STATIC_SMPS; -@@ -10224,6 +10333,9 @@ static int __ath11k_mac_register(struct +@@ -10276,6 +10385,9 @@ static int __ath11k_mac_register(struct ab->hw_params.bios_sar_capa) ar->hw->wiphy->sar_capa = ab->hw_params.bios_sar_capa; @@ -1195,8 +1184,8 @@ Signed-off-by: Sriram R ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_3, --- a/drivers/net/wireless/ath/ath11k/pcic.c +++ b/drivers/net/wireless/ath/ath11k/pcic.c -@@ -582,6 +582,12 @@ static int ath11k_pcic_ext_irq_config(st - netif_napi_add(&irq_grp->napi_ndev, &irq_grp->napi, +@@ -589,6 +589,12 @@ static int ath11k_pcic_ext_irq_config(st + netif_napi_add(irq_grp->napi_ndev, &irq_grp->napi, ath11k_pcic_ext_grp_napi_poll); + /* tcl, reo, rx_err, wbm release, rxdma rings are offloaded to nss. */ @@ -1210,7 +1199,7 @@ Signed-off-by: Sriram R ab->hw_params.ring_mask->rx_err[i] || --- a/local-symbols +++ b/local-symbols -@@ -163,6 +163,7 @@ WCN36XX_DEBUGFS= +@@ -165,6 +165,7 @@ WCN36XX_DEBUGFS= ATH11K= ATH11K_AHB= ATH11K_PCI= diff --git a/package/kernel/mac80211/patches/nss/ath11k/203-mac80211-ath11k-fw-dynamic-muedca.patch b/package/kernel/mac80211/patches/nss/ath11k/203-mac80211-ath11k-fw-dynamic-muedca.patch index a5200d21833..7c3b2cc605c 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/203-mac80211-ath11k-fw-dynamic-muedca.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/203-mac80211-ath11k-fw-dynamic-muedca.patch @@ -31,7 +31,7 @@ Signed-off-by: Muna Sinada --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -148,6 +148,8 @@ static const struct wmi_tlv_policy wmi_t +@@ -149,6 +149,8 @@ static const struct wmi_tlv_policy wmi_t .min_len = sizeof(struct wmi_vdev_delete_resp_event) }, [WMI_TAG_OBSS_COLOR_COLLISION_EVT] = { .min_len = sizeof(struct wmi_obss_color_collision_event) }, @@ -40,7 +40,7 @@ Signed-off-by: Muna Sinada [WMI_TAG_11D_NEW_COUNTRY_EVENT] = { .min_len = sizeof(struct wmi_11d_new_cc_ev) }, [WMI_TAG_PER_CHAIN_RSSI_STATS] = { -@@ -8708,6 +8710,74 @@ exit: +@@ -8807,6 +8809,74 @@ out: kfree(tb); } @@ -115,7 +115,7 @@ Signed-off-by: Muna Sinada static void ath11k_wmi_tlv_op_rx(struct ath11k_base *ab, struct sk_buff *skb) { struct wmi_cmd_hdr *cmd_hdr; -@@ -8826,6 +8896,9 @@ static void ath11k_wmi_tlv_op_rx(struct +@@ -8925,6 +8995,9 @@ static void ath11k_wmi_tlv_op_rx(struct case WMI_11D_NEW_COUNTRY_EVENTID: ath11k_reg_11d_new_cc_event(ab, skb); break; @@ -127,7 +127,7 @@ Signed-off-by: Muna Sinada break; --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -776,6 +776,7 @@ enum wmi_tlv_event_id { +@@ -772,6 +772,7 @@ enum wmi_tlv_event_id { WMI_READ_DATA_FROM_FLASH_EVENTID, WMI_REPORT_RX_AGGR_FAILURE_EVENTID, WMI_PKGID_EVENTID, @@ -135,7 +135,7 @@ Signed-off-by: Muna Sinada WMI_GPIO_INPUT_EVENTID = WMI_TLV_CMD(WMI_GRP_GPIO), WMI_UPLOADH_EVENTID, WMI_CAPTUREH_EVENTID, -@@ -1888,6 +1889,7 @@ enum wmi_tlv_tag { +@@ -1884,6 +1885,7 @@ enum wmi_tlv_tag { WMI_TAG_NDP_EVENT, WMI_TAG_PDEV_PEER_PKTLOG_FILTER_CMD = 0x301, WMI_TAG_PDEV_PEER_PKTLOG_FILTER_INFO, @@ -143,7 +143,7 @@ Signed-off-by: Muna Sinada WMI_TAG_FILS_DISCOVERY_TMPL_CMD = 0x344, WMI_TAG_PDEV_SRG_BSS_COLOR_BITMAP_CMD = 0x37b, WMI_TAG_PDEV_SRG_PARTIAL_BSSID_BITMAP_CMD, -@@ -4890,6 +4892,16 @@ struct wmi_pdev_temperature_event { +@@ -4896,6 +4898,16 @@ struct wmi_pdev_temperature_event { u32 pdev_id; } __packed; diff --git a/package/kernel/mac80211/patches/nss/ath11k/207-ath11k-Add-support-for-dynamic-vlan.patch b/package/kernel/mac80211/patches/nss/ath11k/207-ath11k-Add-support-for-dynamic-vlan.patch index 809c61df4ab..1b9cae352af 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/207-ath11k-Add-support-for-dynamic-vlan.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/207-ath11k-Add-support-for-dynamic-vlan.patch @@ -369,7 +369,7 @@ Signed-off-by: Seevalamuthu Mariappan int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif, --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -10350,6 +10350,9 @@ static int __ath11k_mac_register(struct +@@ -10402,6 +10402,9 @@ static int __ath11k_mac_register(struct */ ar->hw->wiphy->interface_modes &= ~BIT(NL80211_IFTYPE_MONITOR); diff --git a/package/kernel/mac80211/patches/nss/ath11k/207-ath11k-Enable-256_512MB-profiles.patch b/package/kernel/mac80211/patches/nss/ath11k/207-ath11k-Enable-256_512MB-profiles.patch index 2adfb3ba99b..37ef93a5574 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/207-ath11k-Enable-256_512MB-profiles.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/207-ath11k-Enable-256_512MB-profiles.patch @@ -125,7 +125,7 @@ Signed-off-by: Ramya Gnanasekar ATH11K_QMI_FILE_TYPE_BDF_GOLDEN, --- a/local-symbols +++ b/local-symbols -@@ -164,6 +164,8 @@ ATH11K= +@@ -166,6 +166,8 @@ ATH11K= ATH11K_AHB= ATH11K_PCI= ATH11K_NSS_SUPPORT= @@ -152,7 +152,7 @@ Signed-off-by: Ramya Gnanasekar #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK) -@@ -925,6 +925,11 @@ struct ath11k_msi_config { +@@ -929,6 +929,11 @@ struct ath11k_msi_config { u16 hw_rev; }; @@ -164,7 +164,7 @@ Signed-off-by: Ramya Gnanasekar /* Master structure to hold the hw data which may be used in core module */ struct ath11k_base { enum ath11k_hw_rev hw_rev; -@@ -1082,6 +1087,8 @@ struct ath11k_base { +@@ -1086,6 +1091,8 @@ struct ath11k_base { DECLARE_BITMAP(fw_features, ATH11K_FW_FEATURE_COUNT); } fw; @@ -225,7 +225,7 @@ Signed-off-by: Ramya Gnanasekar dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); -@@ -825,6 +828,7 @@ void ath11k_dp_tx_completion_handler(str +@@ -833,6 +836,7 @@ void ath11k_dp_tx_completion_handler(str wake_up(&ar->dp.tx_empty_waitq); ath11k_dp_tx_complete_msdu(ar, msdu, &ts); @@ -261,7 +261,7 @@ Signed-off-by: Ramya Gnanasekar .num_vdevs = 16 + 1, .num_peers = 512, .supports_suspend = false, -@@ -262,7 +265,7 @@ static struct ath11k_hw_params ath11k_hw +@@ -265,7 +268,7 @@ static struct ath11k_hw_params ath11k_hw .coldboot_cal_mm = false, .coldboot_cal_ftm = false, .cbcal_restart_fw = false, @@ -270,7 +270,7 @@ Signed-off-by: Ramya Gnanasekar .num_vdevs = 2 + 1, .num_peers = 512, .supports_suspend = true, -@@ -431,7 +434,7 @@ static struct ath11k_hw_params ath11k_hw +@@ -437,7 +440,7 @@ static struct ath11k_hw_params ath11k_hw .coldboot_cal_mm = false, .coldboot_cal_ftm = false, .cbcal_restart_fw = false, @@ -279,7 +279,7 @@ Signed-off-by: Ramya Gnanasekar .num_vdevs = 2 + 1, .num_peers = 512, .supports_suspend = true, -@@ -467,6 +470,7 @@ static struct ath11k_hw_params ath11k_hw +@@ -473,6 +476,7 @@ static struct ath11k_hw_params ath11k_hw .tx_ring_size = DP_TCL_DATA_RING_SIZE, .smp2p_wow_exit = false, .support_fw_mac_sequence = true, @@ -287,7 +287,7 @@ Signed-off-by: Ramya Gnanasekar .support_dual_stations = true, }, { -@@ -515,7 +519,7 @@ static struct ath11k_hw_params ath11k_hw +@@ -524,7 +528,7 @@ static struct ath11k_hw_params ath11k_hw .coldboot_cal_mm = false, .coldboot_cal_ftm = false, .cbcal_restart_fw = false, @@ -296,7 +296,7 @@ Signed-off-by: Ramya Gnanasekar .num_vdevs = 2 + 1, .num_peers = 512, .supports_suspend = true, -@@ -551,6 +555,7 @@ static struct ath11k_hw_params ath11k_hw +@@ -560,6 +564,7 @@ static struct ath11k_hw_params ath11k_hw .tx_ring_size = DP_TCL_DATA_RING_SIZE, .smp2p_wow_exit = false, .support_fw_mac_sequence = true, @@ -304,7 +304,7 @@ Signed-off-by: Ramya Gnanasekar .support_dual_stations = true, }, { -@@ -600,7 +605,7 @@ static struct ath11k_hw_params ath11k_hw +@@ -609,7 +614,7 @@ static struct ath11k_hw_params ath11k_hw .coldboot_cal_mm = true, .coldboot_cal_ftm = true, .cbcal_restart_fw = false, @@ -313,7 +313,7 @@ Signed-off-by: Ramya Gnanasekar .num_vdevs = 3, .num_peers = 512, .supports_suspend = false, -@@ -680,7 +685,7 @@ static struct ath11k_hw_params ath11k_hw +@@ -689,7 +694,7 @@ static struct ath11k_hw_params ath11k_hw .supports_monitor = false, .supports_sta_ps = false, .supports_shadow_regs = false, @@ -322,7 +322,7 @@ Signed-off-by: Ramya Gnanasekar .num_vdevs = 16 + 1, .num_peers = 512, .supports_regdb = false, -@@ -715,6 +720,7 @@ static struct ath11k_hw_params ath11k_hw +@@ -724,6 +729,7 @@ static struct ath11k_hw_params ath11k_hw .tx_ring_size = DP_TCL_DATA_RING_SIZE, .smp2p_wow_exit = false, .support_fw_mac_sequence = false, @@ -330,7 +330,7 @@ Signed-off-by: Ramya Gnanasekar .support_dual_stations = false, }, { -@@ -805,6 +811,21 @@ static struct ath11k_hw_params ath11k_hw +@@ -817,6 +823,21 @@ static struct ath11k_hw_params ath11k_hw }, }; diff --git a/package/kernel/mac80211/patches/nss/ath11k/211-002-ath11k-add-WDS-offload-support-on-NSS-offload-for-STA-mode.patch b/package/kernel/mac80211/patches/nss/ath11k/211-002-ath11k-add-WDS-offload-support-on-NSS-offload-for-STA-mode.patch index 6086cff8dcb..70d217b8c73 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/211-002-ath11k-add-WDS-offload-support-on-NSS-offload-for-STA-mode.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/211-002-ath11k-add-WDS-offload-support-on-NSS-offload-for-STA-mode.patch @@ -26,7 +26,7 @@ Signed-off-by: Sathishkumar Muruganandam --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -679,6 +679,7 @@ struct ath11k { +@@ -683,6 +683,7 @@ struct ath11k { struct ath11k_pdev_wmi *wmi; #ifdef CPTCFG_ATH11K_NSS_SUPPORT struct ath11k_nss nss; @@ -34,7 +34,7 @@ Signed-off-by: Sathishkumar Muruganandam #endif struct ath11k_pdev_dp dp; u8 mac_addr[ETH_ALEN]; -@@ -1097,6 +1098,9 @@ struct ath11k_base { +@@ -1101,6 +1102,9 @@ struct ath11k_base { } testmode; #endif @@ -111,7 +111,7 @@ Signed-off-by: Sathishkumar Muruganandam break; --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c -@@ -495,7 +495,7 @@ ath11k_dp_tx_process_htt_tx_complete(str +@@ -499,7 +499,7 @@ ath11k_dp_tx_process_htt_tx_complete(str break; case HAL_WBM_REL_HTT_TX_COMP_STATUS_MEC_NOTIFY: /* This event is to be handled only when the driver decides to @@ -776,16 +776,16 @@ Signed-off-by: Sathishkumar Muruganandam #endif /* _PEER_H_ */ --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -156,6 +156,8 @@ static const struct wmi_tlv_policy wmi_t - .min_len = sizeof(struct wmi_per_chain_rssi_stats) }, - [WMI_TAG_TWT_ADD_DIALOG_COMPLETE_EVENT] = { - .min_len = sizeof(struct wmi_twt_add_dialog_event) }, +@@ -161,6 +161,8 @@ static const struct wmi_tlv_policy wmi_t + .min_len = sizeof(struct ath11k_wmi_p2p_noa_info) }, + [WMI_TAG_P2P_NOA_EVENT] = { + .min_len = sizeof(struct wmi_p2p_noa_event) }, + [WMI_TAG_WDS_ADDR_EVENT] = { + .min_len = sizeof(struct wmi_wds_addr_event) }, }; #define PRIMAP(_hw_mode_) \ -@@ -1126,6 +1128,51 @@ int ath11k_wmi_send_peer_delete_cmd(stru +@@ -1131,6 +1133,51 @@ int ath11k_wmi_send_peer_delete_cmd(stru return ret; } @@ -837,7 +837,7 @@ Signed-off-by: Sathishkumar Muruganandam int ath11k_wmi_send_pdev_set_regdomain(struct ath11k *ar, struct pdev_set_regdomain_params *param) { -@@ -6436,6 +6483,36 @@ static int ath11k_pull_peer_assoc_conf_e +@@ -6481,6 +6528,36 @@ static int ath11k_pull_peer_assoc_conf_e return 0; } @@ -874,7 +874,7 @@ Signed-off-by: Sathishkumar Muruganandam static void ath11k_wmi_pull_pdev_stats_base(const struct wmi_pdev_stats_base *src, struct ath11k_fw_stats_pdev *dst) { -@@ -7260,6 +7337,7 @@ static int ath11k_wmi_tlv_rdy_parse(stru +@@ -7305,6 +7382,7 @@ static int ath11k_wmi_tlv_rdy_parse(stru ether_addr_copy(ab->mac_addr, fixed_param.ready_event_min.mac_addr.addr); @@ -882,7 +882,7 @@ Signed-off-by: Sathishkumar Muruganandam ab->pktlog_defs_checksum = fixed_param.pktlog_defs_checksum; break; case WMI_TAG_ARRAY_FIXED_STRUCT: -@@ -8778,6 +8856,22 @@ exit: +@@ -8877,6 +8955,22 @@ exit: kfree(tb); } @@ -905,9 +905,9 @@ Signed-off-by: Sathishkumar Muruganandam static void ath11k_wmi_tlv_op_rx(struct ath11k_base *ab, struct sk_buff *skb) { struct wmi_cmd_hdr *cmd_hdr; -@@ -8908,6 +9002,9 @@ static void ath11k_wmi_tlv_op_rx(struct - case WMI_GTK_OFFLOAD_STATUS_EVENTID: - ath11k_wmi_gtk_offload_status_event(ab, skb); +@@ -9010,6 +9104,9 @@ static void ath11k_wmi_tlv_op_rx(struct + case WMI_P2P_NOA_EVENTID: + ath11k_wmi_p2p_noa_event(ab, skb); break; + case WMI_WDS_PEER_EVENTID: + ath11k_wmi_wds_peer_event(ab, skb); @@ -917,7 +917,7 @@ Signed-off-by: Sathishkumar Muruganandam break; --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -3032,6 +3032,21 @@ struct wmi_peer_delete_cmd { +@@ -3028,6 +3028,21 @@ struct wmi_peer_delete_cmd { struct wmi_mac_addr peer_macaddr; } __packed; @@ -939,7 +939,7 @@ Signed-off-by: Sathishkumar Muruganandam struct wmi_peer_reorder_queue_setup_cmd { u32 tlv_header; u32 vdev_id; -@@ -4635,6 +4650,21 @@ struct wmi_probe_resp_tx_status_event { +@@ -4641,6 +4656,21 @@ struct wmi_probe_resp_tx_status_event { u32 tx_status; } __packed; @@ -961,7 +961,7 @@ Signed-off-by: Sathishkumar Muruganandam /* * PDEV statistics */ -@@ -6434,6 +6464,9 @@ int ath11k_wmi_set_sta_ps_param(struct a +@@ -6440,6 +6470,9 @@ int ath11k_wmi_set_sta_ps_param(struct a int ath11k_wmi_force_fw_hang_cmd(struct ath11k *ar, u32 type, u32 delay_time_ms); int ath11k_wmi_send_peer_delete_cmd(struct ath11k *ar, const u8 *peer_addr, u8 vdev_id); diff --git a/package/kernel/mac80211/patches/nss/ath11k/214-ath11k-qos-null-frame-tx-over-wmi.patch b/package/kernel/mac80211/patches/nss/ath11k/214-ath11k-qos-null-frame-tx-over-wmi.patch index aca1676d6fc..80bbf23a58b 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/214-ath11k-qos-null-frame-tx-over-wmi.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/214-ath11k-qos-null-frame-tx-over-wmi.patch @@ -22,7 +22,7 @@ Signed-off-by: Sowmiya Sree Elavalagan --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -5915,6 +5915,16 @@ static int ath11k_mac_mgmt_tx_wmi(struct +@@ -6012,6 +6012,16 @@ static int ath11k_mac_mgmt_tx_wmi(struct ATH11K_SKB_CB(skb)->paddr = paddr; @@ -39,7 +39,7 @@ Signed-off-by: Sowmiya Sree Elavalagan ret = ath11k_wmi_mgmt_send(ar, arvif->vdev_id, buf_id, skb); if (ret) { ath11k_warn(ar->ab, "failed to send mgmt frame: %d\n", ret); -@@ -5982,8 +5992,8 @@ static void ath11k_mgmt_over_wmi_tx_work +@@ -6079,8 +6089,8 @@ static void ath11k_mgmt_over_wmi_tx_work } } @@ -50,7 +50,7 @@ Signed-off-by: Sowmiya Sree Elavalagan { struct sk_buff_head *q = &ar->wmi_mgmt_tx_queue; -@@ -6045,7 +6055,7 @@ static void ath11k_mac_op_tx(struct ieee +@@ -6142,7 +6152,7 @@ static void ath11k_mac_op_tx(struct ieee } else if (ieee80211_is_mgmt(hdr->frame_control)) { frm_type = FIELD_GET(IEEE80211_FCTL_STYPE, hdr->frame_control); is_prb_rsp = ieee80211_is_probe_resp(hdr->frame_control); @@ -59,7 +59,7 @@ Signed-off-by: Sowmiya Sree Elavalagan if (ret) { if (ret != -EBUSY) ath11k_warn(ar->ab, "failed to queue management frame %d\n", -@@ -6060,6 +6070,20 @@ static void ath11k_mac_op_tx(struct ieee +@@ -6157,6 +6167,20 @@ static void ath11k_mac_op_tx(struct ieee spin_unlock_bh(&ar->data_lock); } return; @@ -82,7 +82,7 @@ Signed-off-by: Sowmiya Sree Elavalagan if (control->sta) --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -117,7 +117,7 @@ static const struct wmi_tlv_policy wmi_t +@@ -118,7 +118,7 @@ static const struct wmi_tlv_policy wmi_t [WMI_TAG_MGMT_RX_HDR] = { .min_len = sizeof(struct wmi_mgmt_rx_hdr) }, [WMI_TAG_MGMT_TX_COMPL_EVENT] @@ -91,7 +91,7 @@ Signed-off-by: Sowmiya Sree Elavalagan [WMI_TAG_SCAN_EVENT] = { .min_len = sizeof(struct wmi_scan_event) }, [WMI_TAG_PEER_STA_KICKOUT_EVENT] -@@ -701,6 +701,55 @@ int ath11k_wmi_mgmt_send(struct ath11k * +@@ -706,6 +706,55 @@ int ath11k_wmi_mgmt_send(struct ath11k * return ret; } @@ -147,7 +147,7 @@ Signed-off-by: Sowmiya Sree Elavalagan int ath11k_wmi_vdev_create(struct ath11k *ar, u8 *macaddr, struct vdev_create_params *param) { -@@ -5978,8 +6027,8 @@ static int ath11k_pull_mgmt_rx_params_tl +@@ -6023,8 +6072,8 @@ static int ath11k_pull_mgmt_rx_params_tl return 0; } @@ -158,7 +158,7 @@ Signed-off-by: Sowmiya Sree Elavalagan { struct sk_buff *msdu; struct ieee80211_tx_info *info; -@@ -6017,6 +6066,11 @@ static int wmi_process_mgmt_tx_comp(stru +@@ -6062,6 +6111,11 @@ static int wmi_process_mgmt_tx_comp(stru info->status.ack_signal = tx_compl_param->ack_rssi; } @@ -170,7 +170,7 @@ Signed-off-by: Sowmiya Sree Elavalagan hdr = (struct ieee80211_hdr *)msdu->data; frm_type = FIELD_GET(IEEE80211_FCTL_STYPE, hdr->frame_control); -@@ -6035,10 +6089,13 @@ static int wmi_process_mgmt_tx_comp(stru +@@ -6080,10 +6134,13 @@ static int wmi_process_mgmt_tx_comp(stru arvif = ath11k_vif_to_arvif(vif); mgmt_stats = &arvif->mgmt_stats; @@ -188,7 +188,7 @@ Signed-off-by: Sowmiya Sree Elavalagan spin_unlock_bh(&ar->data_lock); skip_mgmt_stats: -@@ -6060,12 +6117,13 @@ skip_mgmt_stats: +@@ -6105,12 +6162,13 @@ skip_mgmt_stats: return 0; } @@ -206,7 +206,7 @@ Signed-off-by: Sowmiya Sree Elavalagan int ret; tb = ath11k_wmi_tlv_parse_alloc(ab, skb, GFP_ATOMIC); -@@ -6075,7 +6133,7 @@ static int ath11k_pull_mgmt_tx_compl_par +@@ -6120,7 +6178,7 @@ static int ath11k_pull_mgmt_tx_compl_par return ret; } @@ -215,7 +215,7 @@ Signed-off-by: Sowmiya Sree Elavalagan if (!ev) { ath11k_warn(ab, "failed to fetch mgmt tx compl ev"); kfree(tb); -@@ -7791,10 +7849,11 @@ exit: +@@ -7838,10 +7896,11 @@ exit: static void ath11k_mgmt_tx_compl_event(struct ath11k_base *ab, struct sk_buff *skb) { @@ -229,7 +229,7 @@ Signed-off-by: Sowmiya Sree Elavalagan ath11k_warn(ab, "failed to extract mgmt tx compl event"); return; } -@@ -7807,7 +7866,7 @@ static void ath11k_mgmt_tx_compl_event(s +@@ -7854,7 +7913,7 @@ static void ath11k_mgmt_tx_compl_event(s goto exit; } @@ -238,7 +238,7 @@ Signed-off-by: Sowmiya Sree Elavalagan ath11k_dbg(ab, ATH11K_DBG_MGMT, "event mgmt tx compl ev pdev_id %d, desc_id %d, status %d ack_rssi %d", -@@ -7818,6 +7877,36 @@ exit: +@@ -7865,6 +7924,36 @@ exit: rcu_read_unlock(); } @@ -275,7 +275,7 @@ Signed-off-by: Sowmiya Sree Elavalagan static struct ath11k *ath11k_get_ar_on_scan_state(struct ath11k_base *ab, u32 vdev_id, enum ath11k_scan_state state) -@@ -9005,6 +9094,10 @@ static void ath11k_wmi_tlv_op_rx(struct +@@ -9107,6 +9196,10 @@ static void ath11k_wmi_tlv_op_rx(struct case WMI_WDS_PEER_EVENTID: ath11k_wmi_wds_peer_event(ab, skb); break; @@ -288,7 +288,7 @@ Signed-off-by: Sowmiya Sree Elavalagan break; --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -380,6 +380,7 @@ enum wmi_tlv_cmd_id { +@@ -376,6 +376,7 @@ enum wmi_tlv_cmd_id { WMI_BSS_COLOR_CHANGE_ENABLE_CMDID, WMI_VDEV_BCN_OFFLOAD_QUIET_CONFIG_CMDID, WMI_FILS_DISCOVERY_TMPL_CMDID, @@ -296,7 +296,7 @@ Signed-off-by: Sowmiya Sree Elavalagan WMI_ADDBA_CLEAR_RESP_CMDID = WMI_TLV_CMD(WMI_GRP_BA_NEG), WMI_ADDBA_SEND_CMDID, WMI_ADDBA_STATUS_CMDID, -@@ -710,6 +711,8 @@ enum wmi_tlv_event_id { +@@ -706,6 +707,8 @@ enum wmi_tlv_event_id { WMI_TBTTOFFSET_EXT_UPDATE_EVENTID, WMI_OFFCHAN_DATA_TX_COMPLETION_EVENTID, WMI_HOST_FILS_DISCOVERY_EVENTID, @@ -305,7 +305,7 @@ Signed-off-by: Sowmiya Sree Elavalagan WMI_TX_DELBA_COMPLETE_EVENTID = WMI_TLV_CMD(WMI_GRP_BA_NEG), WMI_TX_ADDBA_COMPLETE_EVENTID, WMI_BA_RSP_SSN_EVENTID, -@@ -1899,6 +1902,9 @@ enum wmi_tlv_tag { +@@ -1895,6 +1898,9 @@ enum wmi_tlv_tag { WMI_TAG_PDEV_NON_SRG_OBSS_BSSID_ENABLE_BITMAP_CMD, WMI_TAG_REGULATORY_RULE_EXT_STRUCT = 0x3A9, WMI_TAG_REG_CHAN_LIST_CC_EXT_EVENT, @@ -315,7 +315,7 @@ Signed-off-by: Sowmiya Sree Elavalagan WMI_TAG_VDEV_SET_TPC_POWER_CMD = 0x3B5, WMI_TAG_VDEV_CH_POWER_INFO, WMI_TAG_PDEV_SET_BIOS_SAR_TABLE_CMD = 0x3D8, -@@ -2130,7 +2136,17 @@ enum wmi_tlv_service { +@@ -2126,7 +2132,17 @@ enum wmi_tlv_service { WMI_TLV_SERVICE_PEER_POWER_SAVE_DURATION_SUPPORT = 246, WMI_TLV_SERVICE_SRG_SRP_SPATIAL_REUSE_SUPPORT = 249, WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT = 253, @@ -333,7 +333,7 @@ Signed-off-by: Sowmiya Sree Elavalagan /* The second 128 bits */ WMI_MAX_EXT_SERVICE = 256, -@@ -3877,6 +3893,7 @@ struct wmi_scan_prob_req_oui_cmd { +@@ -3883,6 +3899,7 @@ struct wmi_scan_prob_req_oui_cmd { } __packed; #define WMI_MGMT_SEND_DOWNLD_LEN 64 @@ -341,7 +341,7 @@ Signed-off-by: Sowmiya Sree Elavalagan #define WMI_TX_PARAMS_DWORD0_POWER GENMASK(7, 0) #define WMI_TX_PARAMS_DWORD0_MCS_MASK GENMASK(19, 8) -@@ -3887,9 +3904,10 @@ struct wmi_scan_prob_req_oui_cmd { +@@ -3893,9 +3910,10 @@ struct wmi_scan_prob_req_oui_cmd { #define WMI_TX_PARAMS_DWORD1_BW_MASK GENMASK(14, 8) #define WMI_TX_PARAMS_DWORD1_PREAMBLE_TYPE GENMASK(19, 15) #define WMI_TX_PARAMS_DWORD1_FRAME_TYPE BIT(20) @@ -354,7 +354,7 @@ Signed-off-by: Sowmiya Sree Elavalagan u32 tlv_header; u32 tx_params_dword0; u32 tx_params_dword1; -@@ -4981,7 +4999,7 @@ struct wmi_rssi_ctl_ext { +@@ -4987,7 +5005,7 @@ struct wmi_rssi_ctl_ext { u32 rssi_ctl_ext[MAX_ANTENNA_EIGHT - ATH_MAX_ANTENNA]; }; @@ -363,7 +363,7 @@ Signed-off-by: Sowmiya Sree Elavalagan u32 desc_id; u32 status; u32 pdev_id; -@@ -5813,6 +5831,17 @@ struct wmi_debug_log_config_cmd_fixed_pa +@@ -5819,6 +5837,17 @@ struct wmi_debug_log_config_cmd_fixed_pa u32 value; } __packed; @@ -378,13 +378,13 @@ Signed-off-by: Sowmiya Sree Elavalagan + u32 tx_params_valid; +} __packed; + - #define WMI_MAX_MEM_REQS 32 - #define MAX_RADIOS 3 -@@ -6422,6 +6451,8 @@ int ath11k_wmi_cmd_send(struct ath11k_pd - struct sk_buff *ath11k_wmi_alloc_skb(struct ath11k_wmi_base *wmi_sc, u32 len); - int ath11k_wmi_mgmt_send(struct ath11k *ar, u32 vdev_id, u32 buf_id, + + #define WMI_SERVICE_READY_TIMEOUT_HZ (5 * HZ) +@@ -6428,6 +6457,8 @@ int ath11k_wmi_mgmt_send(struct ath11k * struct sk_buff *frame); + int ath11k_wmi_p2p_go_bcn_ie(struct ath11k *ar, u32 vdev_id, + const u8 *p2p_ie); +int ath11k_wmi_qos_null_send(struct ath11k *ar, u32 vdev_id, u32 buf_id, + struct sk_buff *frame); int ath11k_wmi_bcn_tmpl(struct ath11k *ar, u32 vdev_id, diff --git a/package/kernel/mac80211/patches/nss/ath11k/235-003-ath11k-add-AP_VLAN-vif-support-for-WDS-offload-in-NSS-offload.patch b/package/kernel/mac80211/patches/nss/ath11k/235-003-ath11k-add-AP_VLAN-vif-support-for-WDS-offload-in-NSS-offload.patch index 815701e062e..0be8370d4eb 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/235-003-ath11k-add-AP_VLAN-vif-support-for-WDS-offload-in-NSS-offload.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/235-003-ath11k-add-AP_VLAN-vif-support-for-WDS-offload-in-NSS-offload.patch @@ -33,7 +33,7 @@ Signed-off-by: Sathishkumar Muruganandam --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -427,6 +427,7 @@ struct ath11k_vif { +@@ -431,6 +431,7 @@ struct ath11k_vif { #ifdef CPTCFG_ATH11K_NSS_SUPPORT struct arvif_nss nss; #endif @@ -43,7 +43,7 @@ Signed-off-by: Sathishkumar Muruganandam struct ath11k_vif_iter { --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -4755,6 +4755,11 @@ static void ath11k_sta_rc_update_wk(stru +@@ -4844,6 +4844,11 @@ static void ath11k_sta_rc_update_wk(stru arvif = arsta->arvif; ar = arvif->ar; @@ -55,7 +55,7 @@ Signed-off-by: Sathishkumar Muruganandam if (WARN_ON(ath11k_mac_vif_chan(arvif->vif, &def))) return; -@@ -4924,17 +4929,28 @@ err_rc_bw_changed: +@@ -5013,17 +5018,28 @@ err_rc_bw_changed: static void ath11k_sta_set_4addr_wk(struct work_struct *wk) { struct ath11k *ar; @@ -86,7 +86,7 @@ Signed-off-by: Sathishkumar Muruganandam "setting USE_4ADDR for peer %pM\n", sta->addr); ret = ath11k_wmi_set_peer_param(ar, sta->addr, -@@ -4942,8 +4958,93 @@ static void ath11k_sta_set_4addr_wk(stru +@@ -5031,8 +5047,93 @@ static void ath11k_sta_set_4addr_wk(stru WMI_PEER_USE_4ADDR, 1); if (ret) @@ -181,7 +181,7 @@ Signed-off-by: Sathishkumar Muruganandam } static int ath11k_mac_inc_num_stations(struct ath11k_vif *arvif, -@@ -5045,9 +5146,32 @@ static void ath11k_mac_op_sta_set_4addr( +@@ -5134,9 +5235,32 @@ static void ath11k_mac_op_sta_set_4addr( struct ieee80211_sta *sta, bool enabled) { struct ath11k *ar = hw->priv; @@ -214,7 +214,7 @@ Signed-off-by: Sathishkumar Muruganandam ieee80211_queue_work(ar->hw, &arsta->set_4addr_wk); arsta->use_4addr_set = true; } -@@ -6427,6 +6551,9 @@ static int ath11k_mac_op_update_vif_offl +@@ -6524,6 +6648,9 @@ static int ath11k_mac_op_update_vif_offl u32 param_id, param_value; int ret; @@ -224,7 +224,7 @@ Signed-off-by: Sathishkumar Muruganandam param_id = WMI_VDEV_PARAM_TX_ENCAP_TYPE; if (ath11k_frame_mode != ATH11K_HW_TXRX_ETHERNET || (vif->type != NL80211_IFTYPE_STATION && -@@ -6647,7 +6774,8 @@ static int ath11k_mac_op_add_interface(s +@@ -6754,7 +6881,8 @@ static int ath11k_mac_op_add_interface(s goto err; } @@ -234,7 +234,7 @@ Signed-off-by: Sathishkumar Muruganandam ath11k_warn(ab, "failed to create vdev %u, reached max vdev limit %d\n", ar->num_created_vdevs, TARGET_NUM_VDEVS(ab)); ret = -EBUSY; -@@ -6660,6 +6788,28 @@ static int ath11k_mac_op_add_interface(s +@@ -6767,6 +6895,28 @@ static int ath11k_mac_op_add_interface(s arvif->vif = vif; INIT_LIST_HEAD(&arvif->list); @@ -260,18 +260,18 @@ Signed-off-by: Sathishkumar Muruganandam + } + } + + INIT_WORK(&arvif->bcn_tx_work, ath11k_mac_bcn_tx_work); INIT_DELAYED_WORK(&arvif->connection_loss_work, ath11k_mac_vif_sta_connection_loss_work); - -@@ -6689,6 +6839,7 @@ static int ath11k_mac_op_add_interface(s +@@ -6799,6 +6949,7 @@ static int ath11k_mac_op_add_interface(s fallthrough; case NL80211_IFTYPE_AP: arvif->vdev_type = WMI_VDEV_TYPE_AP; + INIT_LIST_HEAD(&arvif->ap_vlan_arvifs); + if (vif->p2p) + arvif->vdev_subtype = WMI_VDEV_SUBTYPE_P2P_GO; break; - case NL80211_IFTYPE_MONITOR: - arvif->vdev_type = WMI_VDEV_TYPE_MONITOR; -@@ -6917,13 +7068,30 @@ static void ath11k_mac_op_remove_interfa +@@ -7034,14 +7185,31 @@ static void ath11k_mac_op_remove_interfa struct ath11k *ar = hw->priv; struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); struct ath11k_base *ab = ar->ab; @@ -279,10 +279,8 @@ Signed-off-by: Sathishkumar Muruganandam int ret; int i; -- cancel_delayed_work_sync(&arvif->connection_loss_work); -- - mutex_lock(&ar->conf_mutex); - ++ mutex_lock(&ar->conf_mutex); ++ + if (vif->type == NL80211_IFTYPE_AP_VLAN) { + ath11k_nss_ext_vdev_delete(arvif); + @@ -299,12 +297,15 @@ Signed-off-by: Sathishkumar Muruganandam + goto unlock; + } + -+ cancel_delayed_work_sync(&arvif->connection_loss_work); -+ + cancel_delayed_work_sync(&arvif->connection_loss_work); + cancel_work_sync(&arvif->bcn_tx_work); + +- mutex_lock(&ar->conf_mutex); +- ath11k_dbg(ab, ATH11K_DBG_MAC, "remove interface (vdev %d)\n", arvif->vdev_id); -@@ -6940,6 +7108,14 @@ static void ath11k_mac_op_remove_interfa +@@ -7058,6 +7226,14 @@ static void ath11k_mac_op_remove_interfa if (ret) ath11k_warn(ab, "failed to submit AP self-peer removal on vdev %d: %d\n", arvif->vdev_id, ret); @@ -319,7 +320,7 @@ Signed-off-by: Sathishkumar Muruganandam } ret = ath11k_mac_vdev_delete(ar, arvif); -@@ -6981,8 +7157,7 @@ err_vdev_del: +@@ -7099,8 +7275,7 @@ err_vdev_del: /* Recalc txpower for remaining vdev */ ath11k_mac_txpower_recalc(ar); @@ -329,7 +330,7 @@ Signed-off-by: Sathishkumar Muruganandam mutex_unlock(&ar->conf_mutex); } -@@ -7042,16 +7217,17 @@ static int ath11k_mac_op_ampdu_action(st +@@ -7160,16 +7335,17 @@ static int ath11k_mac_op_ampdu_action(st struct ieee80211_ampdu_params *params) { struct ath11k *ar = hw->priv; @@ -349,7 +350,7 @@ Signed-off-by: Sathishkumar Muruganandam break; case IEEE80211_AMPDU_TX_START: case IEEE80211_AMPDU_TX_STOP_CONT: -@@ -9056,6 +9232,7 @@ static void ath11k_mac_op_sta_statistics +@@ -9097,6 +9273,7 @@ static void ath11k_mac_op_sta_statistics { struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); struct ath11k *ar = arsta->arvif->ar; @@ -357,8 +358,8 @@ Signed-off-by: Sathishkumar Muruganandam s8 signal; bool db2dbm = test_bit(WMI_TLV_SERVICE_HW_DB2DBM_CONVERSION_SUPPORT, ar->ab->wmi_ab.svc_map); -@@ -9112,7 +9289,8 @@ static void ath11k_mac_op_sta_statistics - ATH11K_DEFAULT_NOISE_FLOOR; +@@ -9156,7 +9333,8 @@ static void ath11k_mac_op_sta_statistics + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); - ath11k_nss_update_sta_stats(sinfo, sta, arsta); @@ -369,7 +370,7 @@ Signed-off-by: Sathishkumar Muruganandam #if IS_ENABLED(CONFIG_IPV6) --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -5105,6 +5105,8 @@ enum wmi_vdev_subtype { +@@ -5111,6 +5111,8 @@ enum wmi_vdev_subtype { WMI_VDEV_SUBTYPE_MESH_11S, }; @@ -415,8 +416,8 @@ Signed-off-by: Sathishkumar Muruganandam int ret; --- a/drivers/net/wireless/ath/ath11k/dp_rx.h +++ b/drivers/net/wireless/ath/ath11k/dp_rx.h -@@ -88,9 +88,9 @@ static inline u32 ath11k_he_gi_to_nl8021 - return ret; +@@ -89,9 +89,9 @@ static inline u32 ath11k_he_gi_to_nl8021 + return ret; } -int ath11k_dp_rx_ampdu_start(struct ath11k *ar, diff --git a/package/kernel/mac80211/patches/nss/ath11k/236-003-ath11k-add-dynamic-VLAN-support-in-NSS-offload.patch b/package/kernel/mac80211/patches/nss/ath11k/236-003-ath11k-add-dynamic-VLAN-support-in-NSS-offload.patch index c394188fe77..360ff221271 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/236-003-ath11k-add-dynamic-VLAN-support-in-NSS-offload.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/236-003-ath11k-add-dynamic-VLAN-support-in-NSS-offload.patch @@ -48,7 +48,7 @@ Signed-off-by: Sathishkumar Muruganandam static inline enum wme_ac ath11k_tid_to_ac(u32 tid) { return (((tid == 0) || (tid == 3)) ? WME_AC_BE : -@@ -367,6 +372,20 @@ struct ath11k_mgmt_frame_stats { +@@ -370,6 +375,20 @@ struct ath11k_mgmt_frame_stats { u32 tx_compl_fail[ATH11K_STATS_MGMT_FRM_TYPE_MAX]; }; @@ -69,7 +69,7 @@ Signed-off-by: Sathishkumar Muruganandam struct ath11k_vif { u32 vdev_id; enum wmi_vdev_type vdev_type; -@@ -428,6 +447,11 @@ struct ath11k_vif { +@@ -432,6 +451,11 @@ struct ath11k_vif { struct arvif_nss nss; #endif struct list_head ap_vlan_arvifs; @@ -128,7 +128,7 @@ Signed-off-by: Sathishkumar Muruganandam static void ath11k_pdev_caps_update(struct ath11k *ar) { struct ath11k_base *ab = ar->ab; -@@ -4175,6 +4206,9 @@ static int ath11k_install_key(struct ath +@@ -4265,6 +4296,9 @@ static int ath11k_install_key(struct ath if (test_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, &ar->ab->dev_flags)) return 0; @@ -138,7 +138,7 @@ Signed-off-by: Sathishkumar Muruganandam if (cmd == DISABLE_KEY) { arg.key_cipher = WMI_CIPHER_NONE; arg.key_data = NULL; -@@ -4264,15 +4298,40 @@ static int ath11k_clear_peer_keys(struct +@@ -4353,15 +4387,40 @@ static int ath11k_clear_peer_keys(struct return first_errno; } @@ -181,7 +181,7 @@ Signed-off-by: Sathishkumar Muruganandam const u8 *peer_addr; int ret = 0; u32 flags = 0; -@@ -4290,17 +4349,38 @@ static int ath11k_mac_op_set_key(struct +@@ -4379,17 +4438,38 @@ static int ath11k_mac_op_set_key(struct if (key->keyidx > WMI_MAX_KEY_INDEX) return -ENOSPC; @@ -224,7 +224,7 @@ Signed-off-by: Sathishkumar Muruganandam /* the peer should not disappear in mid-way (unless FW goes awry) since * we already hold conf_mutex. we just make sure its there now. */ -@@ -4345,6 +4425,74 @@ static int ath11k_mac_op_set_key(struct +@@ -4434,6 +4514,74 @@ static int ath11k_mac_op_set_key(struct goto exit; } @@ -299,7 +299,7 @@ Signed-off-by: Sathishkumar Muruganandam spin_lock_bh(&ab->base_lock); peer = ath11k_peer_find(ab, arvif->vdev_id, peer_addr); -@@ -4367,6 +4515,27 @@ static int ath11k_mac_op_set_key(struct +@@ -4456,6 +4604,27 @@ static int ath11k_mac_op_set_key(struct goto unlock; } @@ -327,7 +327,7 @@ Signed-off-by: Sathishkumar Muruganandam if (peer && cmd == SET_KEY) { peer->keys[key->keyidx] = key; if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) { -@@ -4376,18 +4545,23 @@ static int ath11k_mac_op_set_key(struct +@@ -4465,18 +4634,23 @@ static int ath11k_mac_op_set_key(struct peer->mcast_keyidx = key->keyidx; peer->sec_type_grp = ath11k_dp_tx_get_encrypt_type(key->cipher); } @@ -354,7 +354,7 @@ Signed-off-by: Sathishkumar Muruganandam switch (key->cipher) { case WLAN_CIPHER_SUITE_TKIP: -@@ -6792,7 +6966,7 @@ static int ath11k_mac_op_add_interface(s +@@ -6899,7 +7073,7 @@ static int ath11k_mac_op_add_interface(s if ((vif->type == NL80211_IFTYPE_AP_VLAN || vif->type == NL80211_IFTYPE_STATION) && ab->nss.enabled) { if (ath11k_frame_mode == ATH11K_HW_TXRX_ETHERNET && @@ -363,7 +363,7 @@ Signed-off-by: Sathishkumar Muruganandam vif->offload_flags |= IEEE80211_OFFLOAD_ENCAP_4ADDR; arvif->nss.encap = ATH11K_HW_TXRX_ETHERNET; arvif->nss.decap = ATH11K_HW_TXRX_ETHERNET; -@@ -6805,6 +6979,7 @@ static int ath11k_mac_op_add_interface(s +@@ -6912,6 +7086,7 @@ static int ath11k_mac_op_add_interface(s vif->addr, ret); goto err; } @@ -371,7 +371,7 @@ Signed-off-by: Sathishkumar Muruganandam mutex_unlock(&ar->conf_mutex); return ret; } -@@ -6829,6 +7004,20 @@ static int ath11k_mac_op_add_interface(s +@@ -6937,6 +7112,20 @@ static int ath11k_mac_op_add_interface(s arvif->vdev_id = bit; arvif->vdev_subtype = WMI_VDEV_SUBTYPE_NONE; @@ -392,7 +392,7 @@ Signed-off-by: Sathishkumar Muruganandam switch (vif->type) { case NL80211_IFTYPE_UNSPECIFIED: case NL80211_IFTYPE_STATION: -@@ -6869,7 +7058,7 @@ static int ath11k_mac_op_add_interface(s +@@ -6986,7 +7175,7 @@ static int ath11k_mac_op_add_interface(s if (ret) { ath11k_warn(ab, "failed to create WMI vdev %d: %d\n", arvif->vdev_id, ret); @@ -401,7 +401,7 @@ Signed-off-by: Sathishkumar Muruganandam } ar->num_created_vdevs++; -@@ -7034,7 +7223,7 @@ err_peer_del: +@@ -7151,7 +7340,7 @@ err_peer_del: if (fbret) { ath11k_warn(ar->ab, "fallback fail to delete peer addr %pM vdev_id %d ret %d\n", vif->addr, arvif->vdev_id, fbret); @@ -410,7 +410,7 @@ Signed-off-by: Sathishkumar Muruganandam } } -@@ -7045,6 +7234,8 @@ err_vdev_del: +@@ -7162,6 +7351,8 @@ err_vdev_del: list_del(&arvif->list); spin_unlock_bh(&ar->data_lock); @@ -419,7 +419,7 @@ Signed-off-by: Sathishkumar Muruganandam err: mutex_unlock(&ar->conf_mutex); -@@ -7142,6 +7333,7 @@ err_vdev_del: +@@ -7260,6 +7451,7 @@ err_vdev_del: list_del(&arvif->list); spin_unlock_bh(&ar->data_lock); @@ -427,7 +427,7 @@ Signed-off-by: Sathishkumar Muruganandam ath11k_peer_cleanup(ar, arvif->vdev_id); idr_for_each(&ar->txmgmt_idr, -@@ -9835,6 +10027,33 @@ static int ath11k_mac_station_remove(str +@@ -9884,6 +10076,33 @@ static int ath11k_mac_station_remove(str return ret; } @@ -461,7 +461,7 @@ Signed-off-by: Sathishkumar Muruganandam static int ath11k_mac_op_sta_state(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, -@@ -9924,6 +10143,34 @@ static int ath11k_mac_op_sta_state(struc +@@ -9973,6 +10192,34 @@ static int ath11k_mac_op_sta_state(struc if (ret) ath11k_warn(ar->ab, "Unable to authorize peer %pM vdev %d: %d\n", sta->addr, arvif->vdev_id, ret); @@ -496,7 +496,7 @@ Signed-off-by: Sathishkumar Muruganandam } if (!ret && -@@ -10535,8 +10782,11 @@ static int __ath11k_mac_register(struct +@@ -10587,8 +10834,11 @@ static int __ath11k_mac_register(struct ab->hw_params.bios_sar_capa) ar->hw->wiphy->sar_capa = ab->hw_params.bios_sar_capa; @@ -511,7 +511,7 @@ Signed-off-by: Sathishkumar Muruganandam if (ret) { --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -1938,6 +1938,7 @@ int ath11k_wmi_vdev_install_key(struct a +@@ -1982,6 +1982,7 @@ int ath11k_wmi_vdev_install_key(struct a cmd->key_len = arg->key_len; cmd->key_txmic_len = arg->key_txmic_len; cmd->key_rxmic_len = arg->key_rxmic_len; @@ -519,7 +519,7 @@ Signed-off-by: Sathishkumar Muruganandam if (arg->key_rsc_counter) memcpy(&cmd->key_rsc_counter, &arg->key_rsc_counter, -@@ -4276,6 +4277,7 @@ ath11k_wmi_copy_resource_config(struct w +@@ -4321,6 +4322,7 @@ ath11k_wmi_copy_resource_config(struct w wmi_cfg->flags2 = WMI_RSRC_CFG_FLAG2_CALC_NEXT_DTIM_COUNT_SET; wmi_cfg->ema_max_vap_cnt = tg_cfg->ema_max_vap_cnt; wmi_cfg->ema_max_profile_period = tg_cfg->ema_max_profile_period; @@ -527,7 +527,7 @@ Signed-off-by: Sathishkumar Muruganandam } static int ath11k_init_cmd_send(struct ath11k_pdev_wmi *wmi, -@@ -4498,6 +4500,9 @@ int ath11k_wmi_cmd_init(struct ath11k_ba +@@ -4543,6 +4545,9 @@ int ath11k_wmi_cmd_init(struct ath11k_ba memset(&init_param, 0, sizeof(init_param)); memset(&config, 0, sizeof(config)); @@ -539,7 +539,7 @@ Signed-off-by: Sathishkumar Muruganandam if (test_bit(WMI_TLV_SERVICE_REG_CC_EXT_EVENT_SUPPORT, --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -3749,6 +3749,7 @@ struct wmi_vdev_install_key_arg { +@@ -3755,6 +3755,7 @@ struct wmi_vdev_install_key_arg { u32 vdev_id; const u8 *macaddr; u32 key_idx; @@ -547,7 +547,7 @@ Signed-off-by: Sathishkumar Muruganandam u32 key_flags; u32 key_cipher; u32 key_len; -@@ -5809,6 +5810,7 @@ struct target_resource_config { +@@ -5815,6 +5816,7 @@ struct target_resource_config { u32 bpf_instruction_size; u32 max_bssid_rx_filters; u32 use_pdev_id; diff --git a/package/kernel/mac80211/patches/nss/ath11k/237-003-ath11k-allocate-dst-ring-descriptors-from-cacheable-.patch b/package/kernel/mac80211/patches/nss/ath11k/237-003-ath11k-allocate-dst-ring-descriptors-from-cacheable-.patch index 2342ebcba91..5316894fd2e 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/237-003-ath11k-allocate-dst-ring-descriptors-from-cacheable-.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/237-003-ath11k-allocate-dst-ring-descriptors-from-cacheable-.patch @@ -24,7 +24,7 @@ Signed-off-by: P Praneesh --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c -@@ -761,6 +761,7 @@ void ath11k_dp_tx_completion_handler(str +@@ -769,6 +769,7 @@ void ath11k_dp_tx_completion_handler(str struct sk_buff *msdu; struct hal_tx_status ts = { 0 }; struct dp_tx_ring *tx_ring = &dp->tx_ring[ring_id]; @@ -32,7 +32,7 @@ Signed-off-by: P Praneesh u32 *desc; u32 msdu_id; u8 mac_id; -@@ -769,9 +770,18 @@ void ath11k_dp_tx_completion_handler(str +@@ -777,9 +778,18 @@ void ath11k_dp_tx_completion_handler(str ath11k_hal_srng_access_begin(ab, status_ring); @@ -143,5 +143,5 @@ Signed-off-by: P Praneesh +void ath11k_hal_srng_dst_invalidate_entry(struct ath11k_base *ab, + struct hal_srng *srng, int entries); u32 *ath11k_hal_srng_src_peek(struct ath11k_base *ab, struct hal_srng *srng); - u32 *ath11k_hal_srng_src_get_next_reaped(struct ath11k_base *ab, - struct hal_srng *srng); + u32 *ath11k_hal_srng_src_next_peek(struct ath11k_base *ab, + struct hal_srng *srng); diff --git a/package/kernel/mac80211/patches/nss/ath11k/237-006-ath11k-Allow-fast-rx-by-bypassing-stats-update.patch b/package/kernel/mac80211/patches/nss/ath11k/237-006-ath11k-Allow-fast-rx-by-bypassing-stats-update.patch index a71c0ec6908..b73f78772b8 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/237-006-ath11k-Allow-fast-rx-by-bypassing-stats-update.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/237-006-ath11k-Allow-fast-rx-by-bypassing-stats-update.patch @@ -10,14 +10,12 @@ bypassing mac80211 stats update Signed-off-by: Sriram R Signed-off-by: P Praneesh - -Co-authored-by: Sean Khan --- - drivers/net/wireless/ath/ath11k/core.h | 2 + drivers/net/wireless/ath/ath11k/core.h | 2 drivers/net/wireless/ath/ath11k/debugfs.c | 75 ++++++++++++++++++ drivers/net/wireless/ath/ath11k/dp_rx.c | 119 +++++++++++++++++++++++++++--- drivers/net/wireless/ath/ath11k/hw.c | 22 +++++ - drivers/net/wireless/ath/ath11k/hw.h | 1 + drivers/net/wireless/ath/ath11k/hw.h | 1 drivers/net/wireless/ath/ath11k/mac.c | 8 ++ 6 files changed, 218 insertions(+), 9 deletions(-) @@ -31,7 +29,7 @@ Co-authored-by: Sean Khan }; enum ath11k_hw_rev { -@@ -1126,6 +1127,7 @@ struct ath11k_base { +@@ -1130,6 +1131,7 @@ struct ath11k_base { u32 max_ast_index; u32 num_ast_entries; @@ -55,7 +53,7 @@ Co-authored-by: Sean Khan + if (enable) + tlv_filter = ath11k_mac_mon_status_filter_default; + -+ for (i = 0; i < ab->hw_params.num_rxmda_per_pdev; i++) { ++ for (i = 0; i < ab->hw_params.num_rxdma_per_pdev; i++) { + ring_id = ar->dp.rx_mon_status_refill_ring[i].refill_buf_ring.ring_id; + ath11k_dp_tx_htt_rx_filter_setup(ar->ab, ring_id, + ar->dp.mac_id + i, @@ -126,7 +124,7 @@ Co-authored-by: Sean Khan goto out; } + debugfs_create_file("stats_disable", 0600, ab->debugfs_soc, ab, -+ &fops_soc_stats_disable); ++ &fops_soc_stats_disable); ret = 0; @@ -154,7 +152,7 @@ Co-authored-by: Sean Khan tlv_tag, ptr - begin, len, tlv_len); return -EINVAL; } -@@ -2455,10 +2461,60 @@ ath11k_dp_rx_h_find_peer(struct ath11k_b +@@ -2454,10 +2460,60 @@ ath11k_dp_rx_h_find_peer(struct ath11k_b return peer; } @@ -216,7 +214,7 @@ Co-authored-by: Sean Khan { bool fill_crypto_hdr; enum hal_encrypt_type enctype; -@@ -2469,9 +2525,13 @@ static void ath11k_dp_rx_h_mpdu(struct a +@@ -2468,9 +2524,13 @@ static void ath11k_dp_rx_h_mpdu(struct a struct rx_attention *rx_attention; u32 err_bitmap; @@ -231,7 +229,7 @@ Co-authored-by: Sean Khan rxcb->is_mcbc = fill_crypto_hdr; if (rxcb->is_mcbc) { -@@ -2482,6 +2542,26 @@ static void ath11k_dp_rx_h_mpdu(struct a +@@ -2481,6 +2541,26 @@ static void ath11k_dp_rx_h_mpdu(struct a spin_lock_bh(&ar->ab->base_lock); peer = ath11k_dp_rx_h_find_peer(ar->ab, msdu); if (peer) { @@ -258,7 +256,7 @@ Co-authored-by: Sean Khan if (rxcb->is_mcbc) enctype = peer->sec_type_grp; else -@@ -2491,6 +2571,8 @@ static void ath11k_dp_rx_h_mpdu(struct a +@@ -2490,6 +2570,8 @@ static void ath11k_dp_rx_h_mpdu(struct a } spin_unlock_bh(&ar->ab->base_lock); @@ -267,7 +265,7 @@ Co-authored-by: Sean Khan rx_attention = ath11k_dp_rx_get_attention(ar->ab, rx_desc); err_bitmap = ath11k_dp_rx_h_attn_mpdu_err(rx_attention); if (enctype != HAL_ENCRYPT_TYPE_OPEN && !err_bitmap) -@@ -2732,7 +2814,8 @@ static void ath11k_dp_rx_deliver_msdu(st +@@ -2731,7 +2813,8 @@ static void ath11k_dp_rx_deliver_msdu(st static int ath11k_dp_rx_process_msdu(struct ath11k *ar, struct sk_buff *msdu, struct sk_buff_head *msdu_list, @@ -277,7 +275,7 @@ Co-authored-by: Sean Khan { struct ath11k_base *ab = ar->ab; struct hal_rx_desc *rx_desc, *lrx_desc; -@@ -2799,8 +2882,13 @@ static int ath11k_dp_rx_process_msdu(str +@@ -2798,8 +2881,13 @@ static int ath11k_dp_rx_process_msdu(str } } @@ -292,7 +290,7 @@ Co-authored-by: Sean Khan rx_status->flag |= RX_FLAG_SKIP_MONITOR | RX_FLAG_DUP_VALIDATED; -@@ -2815,10 +2903,12 @@ static void ath11k_dp_rx_process_receive +@@ -2814,10 +2902,12 @@ static void ath11k_dp_rx_process_receive struct sk_buff_head *msdu_list, int mac_id) { @@ -305,7 +303,7 @@ Co-authored-by: Sean Khan if (skb_queue_empty(msdu_list)) return; -@@ -2835,7 +2925,12 @@ static void ath11k_dp_rx_process_receive +@@ -2834,7 +2924,12 @@ static void ath11k_dp_rx_process_receive } while ((msdu = __skb_dequeue(msdu_list))) { @@ -319,7 +317,7 @@ Co-authored-by: Sean Khan if (unlikely(ret)) { ath11k_dbg(ab, ATH11K_DBG_DATA, "Unable to process msdu %d", ret); -@@ -2843,7 +2938,10 @@ static void ath11k_dp_rx_process_receive +@@ -2842,7 +2937,10 @@ static void ath11k_dp_rx_process_receive continue; } @@ -331,7 +329,7 @@ Co-authored-by: Sean Khan } } -@@ -2852,11 +2950,12 @@ void ath11k_dp_rx_from_nss(struct ath11k +@@ -2851,11 +2949,12 @@ void ath11k_dp_rx_from_nss(struct ath11k { struct ieee80211_rx_status rx_status = {0}; struct ath11k_skb_rxcb *rxcb; @@ -345,7 +343,7 @@ Co-authored-by: Sean Khan rx_status.flag |= RX_FLAG_SKIP_MONITOR | RX_FLAG_DUP_VALIDATED; -@@ -4324,6 +4423,7 @@ static int ath11k_dp_rx_h_null_q_desc(st +@@ -4387,6 +4486,7 @@ static int ath11k_dp_rx_h_null_q_desc(st struct ieee80211_rx_status *status, struct sk_buff_head *msdu_list) { @@ -353,7 +351,7 @@ Co-authored-by: Sean Khan u16 msdu_len; struct hal_rx_desc *desc = (struct hal_rx_desc *)msdu->data; struct rx_attention *rx_attention; -@@ -4373,7 +4473,8 @@ static int ath11k_dp_rx_h_null_q_desc(st +@@ -4436,7 +4536,8 @@ static int ath11k_dp_rx_h_null_q_desc(st } ath11k_dp_rx_h_ppdu(ar, desc, status); @@ -427,7 +425,7 @@ Co-authored-by: Sean Khan bool (*rx_desc_get_mpdu_fc_valid)(struct hal_rx_desc *desc); --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -10197,6 +10197,14 @@ static int ath11k_mac_op_sta_state(struc +@@ -10246,6 +10246,14 @@ static int ath11k_mac_op_sta_state(struc } } else if (old_state == IEEE80211_STA_AUTHORIZED && new_state == IEEE80211_STA_ASSOC) { diff --git a/package/kernel/mac80211/patches/nss/ath11k/244-ath11k-dp-tx-perf.patch b/package/kernel/mac80211/patches/nss/ath11k/244-ath11k-dp-tx-perf.patch index c7acb122a58..11c07f2f5de 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/244-ath11k-dp-tx-perf.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/244-ath11k-dp-tx-perf.patch @@ -34,7 +34,7 @@ Signed-off-by: P Praneesh }; struct ath11k_skb_cb { -@@ -921,10 +922,13 @@ struct ath11k_dp_ring_bp_stats { +@@ -925,10 +926,13 @@ struct ath11k_dp_ring_bp_stats { struct ath11k_soc_dp_tx_err_stats { /* TCL Ring Descriptor unavailable */ u32 desc_na[DP_TCL_NUM_RING_MAX]; @@ -295,7 +295,7 @@ Signed-off-by: P Praneesh if (!skb_cb->vif) { ieee80211_free_txskb(ar->hw, msdu); return; -@@ -632,6 +663,7 @@ static void ath11k_dp_tx_complete_msdu(s +@@ -636,6 +667,7 @@ static void ath11k_dp_tx_complete_msdu(s struct ath11k_peer *peer; struct ath11k_sta *arsta; struct rate_info rate; @@ -303,7 +303,7 @@ Signed-off-by: P Praneesh if (WARN_ON_ONCE(ts->buf_rel_source != HAL_WBM_REL_SRC_MODULE_TQM)) { /* Must not happen */ -@@ -642,6 +674,20 @@ static void ath11k_dp_tx_complete_msdu(s +@@ -646,6 +678,20 @@ static void ath11k_dp_tx_complete_msdu(s dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); @@ -324,7 +324,7 @@ Signed-off-by: P Praneesh if (unlikely(!rcu_access_pointer(ab->pdevs_active[ar->pdev_idx]))) { ieee80211_free_txskb(ar->hw, msdu); return; -@@ -696,7 +742,7 @@ static void ath11k_dp_tx_complete_msdu(s +@@ -704,7 +750,7 @@ static void ath11k_dp_tx_complete_msdu(s spin_lock_bh(&ab->base_lock); peer = ath11k_peer_find_by_id(ab, ts->peer_id); @@ -333,7 +333,7 @@ Signed-off-by: P Praneesh ath11k_dbg(ab, ATH11K_DBG_DATA, "dp_tx: failed to find the peer with peer_id %d\n", ts->peer_id); -@@ -752,19 +798,36 @@ static inline void ath11k_dp_tx_status_p +@@ -760,19 +806,36 @@ static inline void ath11k_dp_tx_status_p ts->rate_stats = 0; } @@ -372,7 +372,7 @@ Signed-off-by: P Praneesh spin_lock_bh(&status_ring->lock); -@@ -779,33 +842,27 @@ void ath11k_dp_tx_completion_handler(str +@@ -787,33 +850,27 @@ void ath11k_dp_tx_completion_handler(str ath11k_hal_srng_dst_invalidate_entry(ab, status_ring, valid_entries); @@ -420,7 +420,7 @@ Signed-off-by: P Praneesh ath11k_dp_tx_status_parse(ab, tx_status, &ts); desc_id = FIELD_GET(BUFFER_ADDR_INFO1_SW_COOKIE, -@@ -838,7 +895,6 @@ void ath11k_dp_tx_completion_handler(str +@@ -846,7 +903,6 @@ void ath11k_dp_tx_completion_handler(str wake_up(&ar->dp.tx_empty_waitq); ath11k_dp_tx_complete_msdu(ar, msdu, &ts); @@ -430,7 +430,7 @@ Signed-off-by: P Praneesh --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -6387,12 +6387,22 @@ static void ath11k_mac_op_tx(struct ieee +@@ -6484,12 +6484,22 @@ static void ath11k_mac_op_tx(struct ieee if (control->sta) arsta = ath11k_sta_to_arsta(control->sta); @@ -454,7 +454,7 @@ Signed-off-by: P Praneesh ieee80211_free_txskb(ar->hw, skb); return; } -@@ -7339,7 +7349,7 @@ err_vdev_del: +@@ -7457,7 +7467,7 @@ err_vdev_del: idr_for_each(&ar->txmgmt_idr, ath11k_mac_vif_txmgmt_idr_remove, vif); @@ -507,7 +507,7 @@ Signed-off-by: P Praneesh }, { .name = "qca6390 hw2.0", -@@ -359,7 +360,6 @@ static struct ath11k_hw_params ath11k_hw +@@ -362,7 +363,6 @@ static struct ath11k_hw_params ath11k_hw .supports_regdb = false, .fix_l1ss = true, .credit_flow = false, @@ -515,7 +515,7 @@ Signed-off-by: P Praneesh .hal_params = &ath11k_hw_hal_params_ipq8074, .supports_dynamic_smps_6ghz = true, .alloc_cacheable_memory = true, -@@ -385,6 +385,8 @@ static struct ath11k_hw_params ath11k_hw +@@ -388,6 +388,8 @@ static struct ath11k_hw_params ath11k_hw .smp2p_wow_exit = false, .support_fw_mac_sequence = false, .support_dual_stations = false, @@ -524,7 +524,7 @@ Signed-off-by: P Praneesh }, { .name = "wcn6855 hw2.0", -@@ -2247,6 +2249,9 @@ int ath11k_core_pre_init(struct ath11k_b +@@ -2256,6 +2258,9 @@ int ath11k_core_pre_init(struct ath11k_b if (nss_offload) ab->nss.stats_enabled = 1; diff --git a/package/kernel/mac80211/patches/nss/ath11k/300-ath11k-nss-mesh-offload-support.patch b/package/kernel/mac80211/patches/nss/ath11k/300-ath11k-nss-mesh-offload-support.patch index 69a7c8ac317..32ad0a5b549 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/300-ath11k-nss-mesh-offload-support.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/300-ath11k-nss-mesh-offload-support.patch @@ -36,7 +36,7 @@ Signed-off-by: Vasanthakumar Thiagarajan --- a/drivers/net/wireless/ath/ath11k/Makefile +++ b/drivers/net/wireless/ath/ath11k/Makefile -@@ -28,6 +28,10 @@ ath11k-$(CPTCFG_ATH11K_SPECTRAL) += spec +@@ -29,6 +29,10 @@ ath11k-$(CPTCFG_ATH11K_SPECTRAL) += spec ath11k-$(CONFIG_PM) += wow.o ath11k-$(CPTCFG_ATH11K_NSS_SUPPORT) += nss.o @@ -1238,7 +1238,7 @@ Signed-off-by: Vasanthakumar Thiagarajan --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -3476,6 +3476,18 @@ static void ath11k_mac_op_nss_bss_info_c +@@ -3563,6 +3563,18 @@ static void ath11k_mac_op_nss_bss_info_c ath11k_warn(ar->ab, "failed to set ap_isolate in nss %d\n", ret); } @@ -1257,7 +1257,7 @@ Signed-off-by: Vasanthakumar Thiagarajan mutex_unlock(&ar->conf_mutex); } -@@ -10237,6 +10249,28 @@ static int ath11k_mac_op_sta_state(struc +@@ -10286,6 +10298,28 @@ static int ath11k_mac_op_sta_state(struc return ret; } @@ -1286,7 +1286,7 @@ Signed-off-by: Vasanthakumar Thiagarajan static const struct ieee80211_ops ath11k_ops = { .tx = ath11k_mac_op_tx, .wake_tx_queue = ieee80211_handle_wake_tx_queue, -@@ -10295,6 +10329,9 @@ static const struct ieee80211_ops ath11k +@@ -10344,6 +10378,9 @@ static const struct ieee80211_ops ath11k .set_sar_specs = ath11k_mac_op_set_bios_sar_specs, .remain_on_channel = ath11k_mac_op_remain_on_channel, .cancel_remain_on_channel = ath11k_mac_op_cancel_remain_on_channel, @@ -1296,7 +1296,7 @@ Signed-off-by: Vasanthakumar Thiagarajan }; static void ath11k_mac_update_ch_list(struct ath11k *ar, -@@ -10804,6 +10841,8 @@ static int __ath11k_mac_register(struct +@@ -10856,6 +10893,8 @@ static int __ath11k_mac_register(struct ieee80211_hw_set(ar->hw, SUPPORTS_NSS_OFFLOAD); wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_VLAN_OFFLOAD); @@ -3337,7 +3337,7 @@ Signed-off-by: Vasanthakumar Thiagarajan ATH11K_DBG_WMI = 0x00000002, --- a/local-symbols +++ b/local-symbols -@@ -164,6 +164,7 @@ ATH11K= +@@ -166,6 +166,7 @@ ATH11K= ATH11K_AHB= ATH11K_PCI= ATH11K_NSS_SUPPORT= diff --git a/package/kernel/mac80211/patches/nss/ath11k/314-ath11k-Fix-peer-lookup-failure-in-mgmt-tx-completion.patch b/package/kernel/mac80211/patches/nss/ath11k/314-ath11k-Fix-peer-lookup-failure-in-mgmt-tx-completion.patch index d0b57fe27e5..5a3497c1ee0 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/314-ath11k-Fix-peer-lookup-failure-in-mgmt-tx-completion.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/314-ath11k-Fix-peer-lookup-failure-in-mgmt-tx-completion.patch @@ -23,7 +23,7 @@ Signed-off-by: Rameshkumar Sundaram --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -7358,8 +7358,10 @@ err_vdev_del: +@@ -7476,8 +7476,10 @@ err_vdev_del: kfree(arvif->vlan_keyid_map); ath11k_peer_cleanup(ar, arvif->vdev_id); @@ -36,7 +36,7 @@ Signed-off-by: Rameshkumar Sundaram spin_lock_bh(&ab->dp.tx_ring[i].tx_idr_lock); --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -6039,13 +6039,13 @@ static int wmi_process_tx_comp(struct at +@@ -6084,13 +6084,13 @@ static int wmi_process_tx_comp(struct at struct ieee80211_tx_info *info; struct ath11k_skb_cb *skb_cb; struct ieee80211_hdr *hdr; @@ -51,7 +51,7 @@ Signed-off-by: Rameshkumar Sundaram spin_lock_bh(&ar->txmgmt_idr_lock); msdu = idr_find(&ar->txmgmt_idr, tx_compl_param->desc_id); -@@ -6053,6 +6053,7 @@ static int wmi_process_tx_comp(struct at +@@ -6098,6 +6098,7 @@ static int wmi_process_tx_comp(struct at ath11k_warn(ar->ab, "received mgmt tx compl for invalid msdu_id: %d\n", tx_compl_param->desc_id); spin_unlock_bh(&ar->txmgmt_idr_lock); @@ -59,7 +59,7 @@ Signed-off-by: Rameshkumar Sundaram return -ENOENT; } -@@ -6061,6 +6062,28 @@ static int wmi_process_tx_comp(struct at +@@ -6106,6 +6107,28 @@ static int wmi_process_tx_comp(struct at skb_cb = ATH11K_SKB_CB(msdu); dma_unmap_single(ar->ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); @@ -88,7 +88,7 @@ Signed-off-by: Rameshkumar Sundaram info = IEEE80211_SKB_CB(msdu); if ((!(info->flags & IEEE80211_TX_CTL_NO_ACK)) && -@@ -6076,34 +6099,6 @@ static int wmi_process_tx_comp(struct at +@@ -6121,34 +6144,6 @@ static int wmi_process_tx_comp(struct at */ info->status.rates[0].idx = -1; diff --git a/package/kernel/mac80211/patches/nss/ath11k/318-ath11k-avoid-stack-corrupt-in-nwifi-undecap.patch b/package/kernel/mac80211/patches/nss/ath11k/318-ath11k-avoid-stack-corrupt-in-nwifi-undecap.patch index 9189729b77f..770c6dc6645 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/318-ath11k-avoid-stack-corrupt-in-nwifi-undecap.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/318-ath11k-avoid-stack-corrupt-in-nwifi-undecap.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath11k/dp_rx.h +++ b/drivers/net/wireless/ath/ath11k/dp_rx.h -@@ -9,7 +9,7 @@ +@@ -10,7 +10,7 @@ #include "rx_desc.h" #include "debug.h" diff --git a/package/kernel/mac80211/patches/nss/ath11k/330-ath11k-sync-wds_ast_entry-updates.patch b/package/kernel/mac80211/patches/nss/ath11k/330-ath11k-sync-wds_ast_entry-updates.patch index af270a81468..504d3b959b1 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/330-ath11k-sync-wds_ast_entry-updates.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/330-ath11k-sync-wds_ast_entry-updates.patch @@ -46,7 +46,7 @@ Signed-off-by: Rameshkumar Sundaram --- a/drivers/net/wireless/ath/ath11k/ahb.c +++ b/drivers/net/wireless/ath/ath11k/ahb.c -@@ -1239,6 +1239,7 @@ static void ath11k_ahb_remove_prepare(st +@@ -1265,6 +1265,7 @@ static void ath11k_ahb_remove_prepare(st set_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags); cancel_work_sync(&ab->restart_work); cancel_work_sync(&ab->qmi.event_work); @@ -56,7 +56,7 @@ Signed-off-by: Rameshkumar Sundaram static void ath11k_ahb_free_resources(struct ath11k_base *ab) --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -2316,6 +2316,7 @@ struct ath11k_base *ath11k_core_alloc(st +@@ -2325,6 +2325,7 @@ struct ath11k_base *ath11k_core_alloc(st mutex_init(&ab->core_lock); mutex_init(&ab->tbl_mtx_lock); @@ -64,7 +64,7 @@ Signed-off-by: Rameshkumar Sundaram spin_lock_init(&ab->base_lock); mutex_init(&ab->vdev_id_11d_lock); init_completion(&ab->reset_complete); -@@ -2329,6 +2330,8 @@ struct ath11k_base *ath11k_core_alloc(st +@@ -2338,6 +2339,8 @@ struct ath11k_base *ath11k_core_alloc(st INIT_WORK(&ab->restart_work, ath11k_core_restart); INIT_WORK(&ab->update_11d_work, ath11k_update_11d); INIT_WORK(&ab->reset_work, ath11k_core_reset); @@ -83,7 +83,7 @@ Signed-off-by: Rameshkumar Sundaram #include "fw.h" #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK) -@@ -1130,6 +1131,9 @@ struct ath11k_base { +@@ -1134,6 +1135,9 @@ struct ath11k_base { u32 max_ast_index; u32 num_ast_entries; diff --git a/package/kernel/mac80211/patches/nss/ath11k/335-0001-ath11k-optimize-tx-completions.patch b/package/kernel/mac80211/patches/nss/ath11k/335-0001-ath11k-optimize-tx-completions.patch index 60f3b246550..000e75f1db6 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/335-0001-ath11k-optimize-tx-completions.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/335-0001-ath11k-optimize-tx-completions.patch @@ -13,7 +13,7 @@ Signed-off-by: Venkateswara Naralasetty --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c -@@ -651,9 +651,41 @@ err_out: +@@ -655,9 +655,41 @@ err_out: spin_unlock_bh(&ab->base_lock); } @@ -56,7 +56,7 @@ Signed-off-by: Venkateswara Naralasetty { struct ieee80211_tx_status status = { 0 }; struct ieee80211_rate_status status_rate = { 0 }; -@@ -663,9 +695,11 @@ static void ath11k_dp_tx_complete_msdu(s +@@ -667,9 +699,11 @@ static void ath11k_dp_tx_complete_msdu(s struct ath11k_peer *peer; struct ath11k_sta *arsta; struct rate_info rate; @@ -69,7 +69,7 @@ Signed-off-by: Venkateswara Naralasetty /* Must not happen */ return; } -@@ -674,11 +708,14 @@ static void ath11k_dp_tx_complete_msdu(s +@@ -678,11 +712,14 @@ static void ath11k_dp_tx_complete_msdu(s dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); @@ -86,7 +86,7 @@ Signed-off-by: Venkateswara Naralasetty } if (skb_has_frag_list(msdu)) { kfree_skb_list(skb_shinfo(msdu)->frag_list); -@@ -688,6 +725,8 @@ static void ath11k_dp_tx_complete_msdu(s +@@ -692,6 +729,8 @@ static void ath11k_dp_tx_complete_msdu(s return; } @@ -95,7 +95,7 @@ Signed-off-by: Venkateswara Naralasetty if (unlikely(!rcu_access_pointer(ab->pdevs_active[ar->pdev_idx]))) { ieee80211_free_txskb(ar->hw, msdu); return; -@@ -704,48 +743,48 @@ static void ath11k_dp_tx_complete_msdu(s +@@ -708,10 +747,10 @@ static void ath11k_dp_tx_complete_msdu(s /* skip tx rate update from ieee80211_status*/ info->status.rates[0].idx = -1; @@ -103,9 +103,12 @@ Signed-off-by: Venkateswara Naralasetty + if (ts.status == HAL_WBM_TQM_REL_REASON_FRAME_ACKED && !(info->flags & IEEE80211_TX_CTL_NO_ACK)) { info->flags |= IEEE80211_TX_STAT_ACK; - info->status.ack_signal = ATH11K_DEFAULT_NOISE_FLOOR + -- ts->ack_rssi; -+ ts.ack_rssi; +- info->status.ack_signal = ts->ack_rssi; ++ info->status.ack_signal = ts.ack_rssi; + + if (!test_bit(WMI_TLV_SERVICE_HW_DB2DBM_CONVERSION_SUPPORT, + ab->wmi_ab.svc_map)) +@@ -720,40 +759,40 @@ static void ath11k_dp_tx_complete_msdu(s info->status.flags |= IEEE80211_TX_STATUS_ACK_SIGNAL_VALID; } @@ -156,7 +159,7 @@ Signed-off-by: Venkateswara Naralasetty spin_unlock_bh(&ab->base_lock); ieee80211_free_txskb(ar->hw, msdu); return; -@@ -767,37 +806,6 @@ static void ath11k_dp_tx_complete_msdu(s +@@ -775,37 +814,6 @@ static void ath11k_dp_tx_complete_msdu(s ieee80211_tx_status_ext(ar->hw, &status); } @@ -194,7 +197,7 @@ Signed-off-by: Venkateswara Naralasetty static inline bool ath11k_dp_tx_completion_valid(struct hal_wbm_release_ring *desc) { struct htt_tx_wbm_completion *status_desc; -@@ -821,9 +829,9 @@ void ath11k_dp_tx_completion_handler(str +@@ -829,9 +837,9 @@ void ath11k_dp_tx_completion_handler(str int hal_ring_id = dp->tx_ring[ring_id].tcl_comp_ring.ring_id, count = 0, i = 0; struct hal_srng *status_ring = &ab->hal.srng_list[hal_ring_id]; struct sk_buff *msdu; @@ -205,7 +208,7 @@ Signed-off-by: Venkateswara Naralasetty u32 *desc; u32 msdu_id, desc_id; u8 mac_id; -@@ -863,14 +871,16 @@ void ath11k_dp_tx_completion_handler(str +@@ -871,14 +879,16 @@ void ath11k_dp_tx_completion_handler(str while (count--) { tx_status = &tx_ring->tx_status[i++]; @@ -224,7 +227,7 @@ Signed-off-by: Venkateswara Naralasetty ath11k_dp_tx_process_htt_tx_complete(ab, (void *)tx_status, mac_id, msdu_id, -@@ -894,7 +904,7 @@ void ath11k_dp_tx_completion_handler(str +@@ -902,7 +912,7 @@ void ath11k_dp_tx_completion_handler(str if (atomic_dec_and_test(&ar->dp.num_tx_pending)) wake_up(&ar->dp.tx_empty_waitq); diff --git a/package/kernel/mac80211/patches/nss/ath11k/335-0002-ath11k-use-DECLARE_BITMAP-for-idr-operations.patch b/package/kernel/mac80211/patches/nss/ath11k/335-0002-ath11k-use-DECLARE_BITMAP-for-idr-operations.patch index 4efdbe00c2a..7cff4f768dd 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/335-0002-ath11k-use-DECLARE_BITMAP-for-idr-operations.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/335-0002-ath11k-use-DECLARE_BITMAP-for-idr-operations.patch @@ -251,7 +251,7 @@ Signed-off-by: Venkateswara Naralasetty if (unlikely(!msdu)) { ath11k_warn(ab, "htt tx completion for unknown msdu_id %d\n", -@@ -870,6 +881,7 @@ void ath11k_dp_tx_completion_handler(str +@@ -878,6 +889,7 @@ void ath11k_dp_tx_completion_handler(str } while (count--) { @@ -259,7 +259,7 @@ Signed-off-by: Venkateswara Naralasetty tx_status = &tx_ring->tx_status[i++]; desc_id = FIELD_GET(BUFFER_ADDR_INFO1_SW_COOKIE, -@@ -888,17 +900,19 @@ void ath11k_dp_tx_completion_handler(str +@@ -896,17 +908,19 @@ void ath11k_dp_tx_completion_handler(str continue; } diff --git a/package/kernel/mac80211/patches/nss/ath11k/335-0003-ath11k-skip-HAL_TCL_DATA_CMD_INFO2_TID_OVERWRITE-con.patch b/package/kernel/mac80211/patches/nss/ath11k/335-0003-ath11k-skip-HAL_TCL_DATA_CMD_INFO2_TID_OVERWRITE-con.patch index 851a32bc35c..ddce2ead1ba 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/335-0003-ath11k-skip-HAL_TCL_DATA_CMD_INFO2_TID_OVERWRITE-con.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/335-0003-ath11k-skip-HAL_TCL_DATA_CMD_INFO2_TID_OVERWRITE-con.patch @@ -58,7 +58,7 @@ Signed-off-by: Venkateswara Naralasetty tcl_cmd.info3 = FIELD_PREP(HAL_TCL_DATA_CMD_INFO3_DSCP_TID_TABLE_IDX, --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -10727,6 +10727,8 @@ static int __ath11k_mac_register(struct +@@ -10779,6 +10779,8 @@ static int __ath11k_mac_register(struct ieee80211_hw_set(ar->hw, USES_RSS); } diff --git a/package/kernel/mac80211/patches/nss/ath11k/336-ath11k-Fix-updating-rx-stats-with-monitor-vif-enable.patch b/package/kernel/mac80211/patches/nss/ath11k/336-ath11k-Fix-updating-rx-stats-with-monitor-vif-enable.patch index cf0f88068a3..730d7487429 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/336-ath11k-Fix-updating-rx-stats-with-monitor-vif-enable.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/336-ath11k-Fix-updating-rx-stats-with-monitor-vif-enable.patch @@ -16,7 +16,7 @@ Signed-off-by: Anilkumar Kolli --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -5955,12 +5955,23 @@ int ath11k_dp_rx_process_mon_status(stru +@@ -6018,12 +6018,23 @@ int ath11k_dp_rx_process_mon_status(stru pmon->mon_ppdu_status = DP_PPDU_STATUS_START; } @@ -43,7 +43,7 @@ Signed-off-by: Anilkumar Kolli rcu_read_lock(); spin_lock_bh(&ab->base_lock); peer = ath11k_peer_find_by_id(ab, ppdu_info->peer_id); -@@ -6284,6 +6295,13 @@ static int ath11k_dp_full_mon_process_rx +@@ -6347,6 +6358,13 @@ static int ath11k_dp_full_mon_process_rx spin_lock_bh(&pmon->mon_lock); @@ -57,7 +57,7 @@ Signed-off-by: Anilkumar Kolli sw_mon_entries = &pmon->sw_mon_entries; rx_mon_stats = &pmon->rx_mon_stats; -@@ -6323,7 +6341,6 @@ static int ath11k_dp_full_mon_process_rx +@@ -6386,7 +6404,6 @@ static int ath11k_dp_full_mon_process_rx } rx_mon_stats->dest_ppdu_done++; @@ -65,7 +65,7 @@ Signed-off-by: Anilkumar Kolli pmon->buf_state = DP_MON_STATUS_LAG; pmon->mon_status_paddr = sw_mon_entries->mon_status_paddr; pmon->hold_mon_dst_ring = true; -@@ -6354,16 +6371,10 @@ reap_status_ring: +@@ -6417,16 +6434,10 @@ reap_status_ring: int ath11k_dp_rx_process_mon_rings(struct ath11k_base *ab, int mac_id, struct napi_struct *napi, int budget) { diff --git a/package/kernel/mac80211/patches/nss/ath11k/336-ath11k-skip-status-ring-entry-processing.patch b/package/kernel/mac80211/patches/nss/ath11k/336-ath11k-skip-status-ring-entry-processing.patch deleted file mode 100644 index c912fe604c6..00000000000 --- a/package/kernel/mac80211/patches/nss/ath11k/336-ath11k-skip-status-ring-entry-processing.patch +++ /dev/null @@ -1,220 +0,0 @@ -From: Venkateswara Naralasetty -Date: Mon, 29 Apr 2024 13:06:24 +0530 -Subject: [PATCHv5] wifi: ath11k: skip status ring entry processing - -If STATUS_BUFFER_DONE is not set for a monitor status ring entry, -we don't process the status ring until STATUS_BUFFER_DONE set -for that status ring entry. - -During LMAC reset it may happen that hardware will not write -STATUS_BUFFER_DONE tlv in status buffer, in that case we end up -waiting for STATUS_BUFFER_DONE leading to backpressure on monitor -status ring. - -To fix the issue, when HP(Head Pointer) + 1 entry is peeked and if DMA -is not done and if HP + 2 entry's DMA done is set, -replenish HP + 1 entry and start processing in next interrupt. -If HP + 2 entry's DMA done is not set, poll onto HP + 1 entry DMA -done to be set. - -Also, during monitor attach HP points to the end of the ring and -TP(Tail Pointer) points to the start of the ring. -Using ath11k_hal_srng_src_peek() may result in processing invalid buffer -for the very first interrupt. Since, HW starts writing buffer from TP. - -To avoid this issue call ath11k_hal_srng_src_next_peek() instead of -calling ath11k_hal_srng_src_peek(). - -Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Venkateswara Naralasetty -Co-developed-by: Tamizh Chelvam Raja -Signed-off-by: Tamizh Chelvam Raja -Acked-by: Jeff Johnson ---- -v5: - * Updated copyright info in dp_rx.c and hal.c -v4: - * Removed kernel reported compilation warning from Signed off place -v3: - * Rebased on top of ToT -v2: - * Fixed compilation warning Reported-by: kernel test robot - - drivers/net/wireless/ath/ath11k/dp_rx.c | 90 ++++++++++++++++++++++--- - drivers/net/wireless/ath/ath11k/hal.c | 16 ++++- - drivers/net/wireless/ath/ath11k/hal.h | 2 + - 3 files changed, 96 insertions(+), 12 deletions(-) - - -base-commit: bf99bc7423e18aa3475ef00a7a6fb773c31ce6df - ---- a/drivers/net/wireless/ath/ath11k/dp_rx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BSD-3-Clause-Clear - /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. -+ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. - */ - - #include -@@ -3662,11 +3662,52 @@ ath11k_dp_rx_mon_update_status_buf_state - } - } - -+static enum dp_mon_status_buf_state -+ath11k_dp_rx_mon_handle_status_buf_done(struct ath11k_base *ab, struct hal_srng *srng, -+ struct dp_rxdma_ring *rx_ring) -+{ -+ struct ath11k_skb_rxcb *rxcb; -+ struct hal_tlv_hdr *tlv; -+ struct sk_buff *skb; -+ void *status_desc; -+ dma_addr_t paddr; -+ u32 cookie; -+ int buf_id; -+ u8 rbm; -+ -+ status_desc = ath11k_hal_srng_src_next_peek(ab, srng); -+ if (!status_desc) -+ return DP_MON_STATUS_NO_DMA; -+ -+ ath11k_hal_rx_buf_addr_info_get(status_desc, &paddr, &cookie, &rbm); -+ -+ buf_id = FIELD_GET(DP_RXDMA_BUF_COOKIE_BUF_ID, cookie); -+ -+ spin_lock_bh(&rx_ring->idr_lock); -+ skb = idr_find(&rx_ring->bufs_idr, buf_id); -+ spin_unlock_bh(&rx_ring->idr_lock); -+ -+ if (!skb) -+ return DP_MON_STATUS_NO_DMA; -+ -+ rxcb = ATH11K_SKB_RXCB(skb); -+ dma_sync_single_for_cpu(ab->dev, rxcb->paddr, -+ skb->len + skb_tailroom(skb), -+ DMA_FROM_DEVICE); -+ -+ tlv = (struct hal_tlv_hdr *)skb->data; -+ if (FIELD_GET(HAL_TLV_HDR_TAG, tlv->tl) != HAL_RX_STATUS_BUFFER_DONE) -+ return DP_MON_STATUS_NO_DMA; -+ -+ return DP_MON_STATUS_REPLINISH; -+} -+ - static int ath11k_dp_rx_reap_mon_status_ring(struct ath11k_base *ab, int mac_id, - int *budget, struct sk_buff_head *skb_list) - { - struct ath11k *ar; - const struct ath11k_hw_hal_params *hal_params; -+ enum dp_mon_status_buf_state reap_status; - struct ath11k_pdev_dp *dp; - struct dp_rxdma_ring *rx_ring; - struct ath11k_mon_data *pmon; -@@ -3694,8 +3735,7 @@ static int ath11k_dp_rx_reap_mon_status_ - ath11k_hal_srng_access_begin(ab, srng); - while (*budget) { - *budget -= 1; -- rx_mon_status_desc = -- ath11k_hal_srng_src_peek(ab, srng); -+ rx_mon_status_desc = ath11k_hal_srng_src_peek(ab, srng); - if (!rx_mon_status_desc) { - pmon->buf_state = DP_MON_STATUS_REPLINISH; - break; -@@ -3729,15 +3769,43 @@ static int ath11k_dp_rx_reap_mon_status_ - ath11k_warn(ab, "mon status DONE not set %lx, buf_id %d\n", - FIELD_GET(HAL_TLV_HDR_TAG, - tlv->tl), buf_id); -- /* If done status is missing, hold onto status -- * ring until status is done for this status -- * ring buffer. -- * Keep HP in mon_status_ring unchanged, -- * and break from here. -- * Check status for same buffer for next time -+ /* RxDMA status done bit might not be set even -+ * though tp is moved by HW. - */ -- pmon->buf_state = DP_MON_STATUS_NO_DMA; -- break; -+ -+ /* If done status is missing: -+ * 1. As per MAC team's suggestion, -+ * when HP + 1 entry is peeked and if DMA -+ * is not done and if HP + 2 entry's DMA done -+ * is set. skip HP + 1 entry and -+ * start processing in next interrupt. -+ * 2. If HP + 2 entry's DMA done is not set, -+ * poll onto HP + 1 entry DMA done to be set. -+ * Check status for same buffer for next time -+ * dp_rx_mon_status_srng_process -+ */ -+ -+ reap_status = ath11k_dp_rx_mon_handle_status_buf_done(ab, srng, -+ rx_ring); -+ if (reap_status == DP_MON_STATUS_NO_DMA) { -+ continue; -+ } else if (reap_status == DP_MON_STATUS_REPLINISH) { -+ ath11k_warn(ab, "mon status DONE not set %lx, buf_id %d\n", -+ FIELD_GET(HAL_TLV_HDR_TAG, tlv->tl), -+ buf_id); -+ -+ spin_lock_bh(&rx_ring->idr_lock); -+ idr_remove(&rx_ring->bufs_idr, buf_id); -+ spin_unlock_bh(&rx_ring->idr_lock); -+ -+ dma_unmap_single(ab->dev, rxcb->paddr, -+ skb->len + skb_tailroom(skb), -+ DMA_FROM_DEVICE); -+ -+ dev_kfree_skb_any(skb); -+ pmon->buf_state = DP_MON_STATUS_REPLINISH; -+ goto move_next; -+ } - } - - spin_lock_bh(&rx_ring->idr_lock); ---- a/drivers/net/wireless/ath/ath11k/hal.c -+++ b/drivers/net/wireless/ath/ath11k/hal.c -@@ -1,7 +1,7 @@ - // SPDX-License-Identifier: BSD-3-Clause-Clear - /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. -- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. -+ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. - */ - #include - #include "hal_tx.h" -@@ -852,6 +852,20 @@ u32 *ath11k_hal_srng_src_get_next_reaped - return desc; - } - -+u32 *ath11k_hal_srng_src_next_peek(struct ath11k_base *ab, struct hal_srng *srng) -+{ -+ u32 next_hp; -+ -+ lockdep_assert_held(&srng->lock); -+ -+ next_hp = (srng->u.src_ring.hp + srng->entry_size) % srng->ring_size; -+ -+ if (next_hp != srng->u.src_ring.cached_tp) -+ return srng->ring_base_vaddr + next_hp; -+ -+ return NULL; -+} -+ - u32 *ath11k_hal_srng_src_peek(struct ath11k_base *ab, struct hal_srng *srng) - { - lockdep_assert_held(&srng->lock); ---- a/drivers/net/wireless/ath/ath11k/hal.h -+++ b/drivers/net/wireless/ath/ath11k/hal.h -@@ -953,6 +953,8 @@ int ath11k_hal_srng_dst_num_free(struct - void ath11k_hal_srng_dst_invalidate_entry(struct ath11k_base *ab, - struct hal_srng *srng, int entries); - u32 *ath11k_hal_srng_src_peek(struct ath11k_base *ab, struct hal_srng *srng); -+u32 *ath11k_hal_srng_src_next_peek(struct ath11k_base *ab, -+ struct hal_srng *srng); - u32 *ath11k_hal_srng_src_get_next_reaped(struct ath11k_base *ab, - struct hal_srng *srng); - u32 *ath11k_hal_srng_src_reap_next(struct ath11k_base *ab, diff --git a/package/kernel/mac80211/patches/nss/ath11k/341-ath11k-fix-support-for-ext-vdev-in-NSS-for-AP_VLAN-v.patch b/package/kernel/mac80211/patches/nss/ath11k/341-ath11k-fix-support-for-ext-vdev-in-NSS-for-AP_VLAN-v.patch index 1a02b0db6ce..dbc2b61dc16 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/341-ath11k-fix-support-for-ext-vdev-in-NSS-for-AP_VLAN-v.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/341-ath11k-fix-support-for-ext-vdev-in-NSS-for-AP_VLAN-v.patch @@ -38,7 +38,7 @@ Signed-off-by: Aditya Kumar Singh --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -1932,6 +1932,11 @@ static int ath11k_core_reconfigure_on_cr +@@ -1944,6 +1944,11 @@ static int ath11k_core_reconfigure_on_cr clear_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags); diff --git a/package/kernel/mac80211/patches/nss/ath11k/356-ath11k-invalid-desc-sanity-check.patch b/package/kernel/mac80211/patches/nss/ath11k/356-ath11k-invalid-desc-sanity-check.patch index c2980acbe58..efb38b457b1 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/356-ath11k-invalid-desc-sanity-check.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/356-ath11k-invalid-desc-sanity-check.patch @@ -57,7 +57,7 @@ Signed-off-by: Nagarajan Maran spin_unlock_bh(&rx_ring->idr_lock); if (buf_id <= 0) goto fail_dma_unmap; -@@ -3142,6 +3142,16 @@ try_again: +@@ -3141,6 +3141,16 @@ try_again: while (likely(desc = (struct hal_reo_dest_ring *)ath11k_hal_srng_dst_get_next_entry(ab, srng))) { @@ -74,7 +74,7 @@ Signed-off-by: Nagarajan Maran cookie = FIELD_GET(BUFFER_ADDR_INFO1_SW_COOKIE, desc->buf_addr_info.info1); buf_id = FIELD_GET(DP_RXDMA_BUF_COOKIE_BUF_ID, -@@ -3172,8 +3182,6 @@ try_again: +@@ -3171,8 +3181,6 @@ try_again: num_buffs_reaped[mac_id]++; diff --git a/package/kernel/mac80211/patches/nss/ath11k/357-ath11k-fix-clear-peer-keys-during-disassoc.patch b/package/kernel/mac80211/patches/nss/ath11k/357-ath11k-fix-clear-peer-keys-during-disassoc.patch index 4bb88126851..7bf1eadb943 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/357-ath11k-fix-clear-peer-keys-during-disassoc.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/357-ath11k-fix-clear-peer-keys-during-disassoc.patch @@ -17,7 +17,7 @@ Signed-off-by: Karthikeyan Kathirvel --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -4902,12 +4902,6 @@ static int ath11k_station_disassoc(struc +@@ -4991,12 +4991,6 @@ static int ath11k_station_disassoc(struc return ret; } @@ -30,7 +30,7 @@ Signed-off-by: Karthikeyan Kathirvel return 0; } -@@ -10149,6 +10143,17 @@ static int ath11k_mac_op_sta_state(struc +@@ -10198,6 +10192,17 @@ static int ath11k_mac_op_sta_state(struc arsta->bw = ath11k_mac_ieee80211_sta_bw_to_wmi(ar, sta); arsta->bw_prev = arsta->bw; spin_unlock_bh(&ar->data_lock); diff --git a/package/kernel/mac80211/patches/nss/ath11k/373-ath11k-Add-retry-mechanism-for-update_rx_qu.patch b/package/kernel/mac80211/patches/nss/ath11k/373-ath11k-Add-retry-mechanism-for-update_rx_qu.patch index 74f8e85acab..dcc20f88098 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/373-ath11k-Add-retry-mechanism-for-update_rx_qu.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/373-ath11k-Add-retry-mechanism-for-update_rx_qu.patch @@ -41,7 +41,7 @@ Signed-off-by: Tamizh Chelvam Raja --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -940,6 +940,9 @@ struct ath11k_soc_dp_stats { +@@ -944,6 +944,9 @@ struct ath11k_soc_dp_stats { u32 rxdma_error[HAL_REO_ENTR_RING_RXDMA_ECODE_MAX]; u32 reo_error[HAL_REO_DEST_RING_ERROR_CODE_MAX]; u32 hal_reo_error[DP_REO_DST_RING_MAX]; diff --git a/package/kernel/mac80211/patches/nss/ath11k/401-ath11k-Fix-mutex-dead-lock-and-q6-dump-crash.patch b/package/kernel/mac80211/patches/nss/ath11k/401-ath11k-Fix-mutex-dead-lock-and-q6-dump-crash.patch index 0514302a0d2..9f8295e77c5 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/401-ath11k-Fix-mutex-dead-lock-and-q6-dump-crash.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/401-ath11k-Fix-mutex-dead-lock-and-q6-dump-crash.patch @@ -36,7 +36,7 @@ Signed-off-by: Rajat Soni --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -6496,7 +6496,9 @@ static int ath11k_mac_op_start(struct ie +@@ -6593,7 +6593,9 @@ static int ath11k_mac_op_start(struct ie break; case ATH11K_STATE_RESTARTING: ar->state = ATH11K_STATE_RESTARTED; diff --git a/package/kernel/mac80211/patches/nss/ath11k/453-ath11k-flush-management-frames-to-firmware-before-wa.patch b/package/kernel/mac80211/patches/nss/ath11k/453-ath11k-flush-management-frames-to-firmware-before-wa.patch index ad090f56ba0..9321d845c6e 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/453-ath11k-flush-management-frames-to-firmware-before-wa.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/453-ath11k-flush-management-frames-to-firmware-before-wa.patch @@ -27,7 +27,7 @@ Signed-off-by: Hari Chandrakanthan --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -8655,6 +8655,8 @@ static int ath11k_mac_flush_tx_complete( +@@ -8700,6 +8700,8 @@ static int ath11k_mac_flush_tx_complete( ret = -ETIMEDOUT; } diff --git a/package/kernel/mac80211/patches/nss/ath11k/456-wifi-ath11k-Advertise-TX_QUEUE-mac-hw-flag.patch b/package/kernel/mac80211/patches/nss/ath11k/456-wifi-ath11k-Advertise-TX_QUEUE-mac-hw-flag.patch index 48696c975db..124f62f9242 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/456-wifi-ath11k-Advertise-TX_QUEUE-mac-hw-flag.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/456-wifi-ath11k-Advertise-TX_QUEUE-mac-hw-flag.patch @@ -13,7 +13,7 @@ Signed-off-by: Yuvasree Sivasankaran --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -10718,6 +10718,7 @@ static int __ath11k_mac_register(struct +@@ -10770,6 +10770,7 @@ static int __ath11k_mac_register(struct ieee80211_hw_set(ar->hw, QUEUE_CONTROL); ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG); ieee80211_hw_set(ar->hw, REPORTS_LOW_ACK); diff --git a/package/kernel/mac80211/patches/nss/ath11k/457-wifi-ath11k-Avoid-memset-of-ppdu-info-for-next-skb.patch b/package/kernel/mac80211/patches/nss/ath11k/457-wifi-ath11k-Avoid-memset-of-ppdu-info-for-next-skb.patch index f2a0b74f627..6f02ed6b50a 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/457-wifi-ath11k-Avoid-memset-of-ppdu-info-for-next-skb.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/457-wifi-ath11k-Avoid-memset-of-ppdu-info-for-next-skb.patch @@ -48,7 +48,7 @@ Signed-off-by: Yuvasree Sivasankaran --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -6094,7 +6094,9 @@ int ath11k_dp_rx_process_mon_status(stru +@@ -6089,7 +6089,9 @@ int ath11k_dp_rx_process_mon_status(stru if (!num_buffs_reaped) goto exit; @@ -59,7 +59,7 @@ Signed-off-by: Yuvasree Sivasankaran ppdu_info->peer_id = HAL_INVALID_PEERID; while ((skb = __skb_dequeue(&skb_list))) { -@@ -6112,7 +6114,6 @@ int ath11k_dp_rx_process_mon_status(stru +@@ -6107,7 +6109,6 @@ int ath11k_dp_rx_process_mon_status(stru if (log_type != ATH11K_PKTLOG_TYPE_INVALID) trace_ath11k_htt_rxdesc(ar, skb->data, log_type, rx_buf_sz); @@ -67,7 +67,7 @@ Signed-off-by: Yuvasree Sivasankaran ppdu_info->peer_id = HAL_INVALID_PEERID; hal_status = ath11k_hal_rx_parse_mon_status(ab, ppdu_info, skb); -@@ -6140,6 +6141,7 @@ int ath11k_dp_rx_process_mon_status(stru +@@ -6135,6 +6136,7 @@ int ath11k_dp_rx_process_mon_status(stru if ((ppdu_info->peer_id == HAL_INVALID_PEERID || hal_status != HAL_RX_MON_STATUS_PPDU_DONE)) { dev_kfree_skb_any(skb); diff --git a/package/kernel/mac80211/patches/nss/ath11k/908-ath11k-make-debugfs-sta-htt-stats-modular.patch b/package/kernel/mac80211/patches/nss/ath11k/908-ath11k-make-debugfs-sta-htt-stats-modular.patch index 3ebad50617b..a7968c4e10f 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/908-ath11k-make-debugfs-sta-htt-stats-modular.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/908-ath11k-make-debugfs-sta-htt-stats-modular.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath11k/Kconfig +++ b/drivers/net/wireless/ath/ath11k/Kconfig -@@ -80,6 +80,24 @@ config ATH11K_DEBUGFS +@@ -81,6 +81,24 @@ config ATH11K_DEBUGFS If unsure, say Y to make it easier to debug problems. @@ -27,9 +27,9 @@ depends on ATH11K && EVENT_TRACING --- a/drivers/net/wireless/ath/ath11k/Makefile +++ b/drivers/net/wireless/ath/ath11k/Makefile -@@ -20,7 +20,9 @@ ath11k-y += core.o \ - pcic.o \ - fw.o +@@ -21,7 +21,9 @@ ath11k-y += core.o \ + fw.o \ + p2p.o -ath11k-$(CPTCFG_ATH11K_DEBUGFS) += debugfs.o debugfs_htt_stats.o debugfs_sta.o +ath11k-$(CPTCFG_ATH11K_DEBUGFS) += debugfs.o @@ -153,7 +153,7 @@ #include "hw.h" #include "peer.h" #include "mac.h" -@@ -550,7 +552,9 @@ static void ath11k_dp_tx_cache_peer_stat +@@ -554,7 +556,9 @@ static void ath11k_dp_tx_cache_peer_stat void ath11k_dp_tx_update_txcompl(struct ath11k *ar, struct hal_tx_status *ts) { struct ath11k_base *ab = ar->ab; @@ -163,7 +163,7 @@ enum hal_tx_rate_stats_pkt_type pkt_type; enum hal_tx_rate_stats_sgi sgi; enum hal_tx_rate_stats_bw bw; -@@ -639,8 +643,10 @@ void ath11k_dp_tx_update_txcompl(struct +@@ -643,8 +647,10 @@ void ath11k_dp_tx_update_txcompl(struct ath11k_mac_he_ru_tones_to_nl80211_he_ru_alloc(ru_tones); } @@ -176,7 +176,7 @@ spin_unlock_bh(&ab->base_lock); --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -10327,7 +10327,7 @@ static const struct ieee80211_ops ath11k +@@ -10376,7 +10376,7 @@ static const struct ieee80211_ops ath11k .set_wakeup = ath11k_wow_op_set_wakeup, #endif @@ -187,7 +187,7 @@ #endif --- a/local-symbols +++ b/local-symbols -@@ -169,6 +169,8 @@ ATH11K_MEM_PROFILE_256M= +@@ -171,6 +171,8 @@ ATH11K_MEM_PROFILE_256M= ATH11K_MEM_PROFILE_512M= ATH11K_DEBUG= ATH11K_DEBUGFS= diff --git a/package/kernel/mac80211/patches/nss/ath11k/910-wifi-ath11k-Add-lock-when-accessing-idr_pool-of-tx_r.patch b/package/kernel/mac80211/patches/nss/ath11k/910-wifi-ath11k-Add-lock-when-accessing-idr_pool-of-tx_r.patch index 38188636a58..3bcd37c665d 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/910-wifi-ath11k-Add-lock-when-accessing-idr_pool-of-tx_r.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/910-wifi-ath11k-Add-lock-when-accessing-idr_pool-of-tx_r.patch @@ -58,7 +58,7 @@ Signed-off-by: Aishwarya R if (unlikely(!msdu)) { ath11k_warn(ab, "htt tx completion for unknown msdu_id %d\n", -@@ -890,12 +896,14 @@ void ath11k_dp_tx_completion_handler(str +@@ -898,12 +904,14 @@ void ath11k_dp_tx_completion_handler(str continue; } diff --git a/package/kernel/mac80211/patches/nss/ath11k/999-233-ath11k-Disable-rx_header-tlv-for-2K-SKB.patch b/package/kernel/mac80211/patches/nss/ath11k/999-233-ath11k-Disable-rx_header-tlv-for-2K-SKB.patch index 97559a003b3..3de8497a321 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/999-233-ath11k-Disable-rx_header-tlv-for-2K-SKB.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/999-233-ath11k-Disable-rx_header-tlv-for-2K-SKB.patch @@ -18,14 +18,14 @@ Signed-off-by: Ramya Gnanasekar ar->debug.rx_filter = tlv_filter.rx_filter; + tlv_filter.offset_valid = false; - for (i = 0; i < ab->hw_params.num_rxmda_per_pdev; i++) { + for (i = 0; i < ab->hw_params.num_rxdma_per_pdev; i++) { ring_id = ar->dp.rx_mon_status_refill_ring[i].refill_buf_ring.ring_id; @@ -1229,6 +1230,7 @@ static ssize_t ath11k_write_pktlog_filte } /* Clear rx filter set for monitor mode and rx status */ + tlv_filter.offset_valid = false; - for (i = 0; i < ab->hw_params.num_rxmda_per_pdev; i++) { + for (i = 0; i < ab->hw_params.num_rxdma_per_pdev; i++) { ring_id = ar->dp.rx_mon_status_refill_ring[i].refill_buf_ring.ring_id; ret = ath11k_dp_tx_htt_rx_filter_setup(ar->ab, ring_id, ar->dp.mac_id, --- a/drivers/net/wireless/ath/ath11k/dp.h @@ -228,7 +228,7 @@ Signed-off-by: Ramya Gnanasekar static void ath11k_dp_service_mon_ring(struct timer_list *t) { struct ath11k_base *ab = from_timer(ab, t, mon_reap_timer); -@@ -2390,6 +2425,49 @@ int ath11k_dp_rx_crypto_icv_len(struct a +@@ -2389,6 +2424,49 @@ int ath11k_dp_rx_crypto_icv_len(struct a return 0; } @@ -278,7 +278,7 @@ Signed-off-by: Ramya Gnanasekar static void ath11k_dp_rx_h_undecap_nwifi(struct ath11k *ar, struct sk_buff *msdu, u8 *first_hdr, -@@ -2403,7 +2481,8 @@ static void ath11k_dp_rx_h_undecap_nwifi +@@ -2402,7 +2480,8 @@ static void ath11k_dp_rx_h_undecap_nwifi u8 da[ETH_ALEN]; u8 sa[ETH_ALEN]; u16 qos_ctl = 0; @@ -288,7 +288,7 @@ Signed-off-by: Ramya Gnanasekar /* copy SA & DA and pull decapped header */ hdr = (struct ieee80211_hdr *)msdu->data; -@@ -2412,7 +2491,7 @@ static void ath11k_dp_rx_h_undecap_nwifi +@@ -2411,7 +2490,7 @@ static void ath11k_dp_rx_h_undecap_nwifi ether_addr_copy(sa, ieee80211_get_SA(hdr)); skb_pull(msdu, ieee80211_hdrlen(hdr->frame_control)); @@ -297,7 +297,7 @@ Signed-off-by: Ramya Gnanasekar /* original 802.11 header is valid for the first msdu * hence we can reuse the same header */ -@@ -2442,16 +2521,23 @@ static void ath11k_dp_rx_h_undecap_nwifi +@@ -2441,16 +2520,23 @@ static void ath11k_dp_rx_h_undecap_nwifi /* copy decap header before overwriting for reuse below */ memcpy(decap_hdr, (uint8_t *)hdr, hdr_len); @@ -326,7 +326,7 @@ Signed-off-by: Ramya Gnanasekar memcpy(skb_push(msdu, IEEE80211_QOS_CTL_LEN), &qos_ctl, IEEE80211_QOS_CTL_LEN); -@@ -2567,6 +2653,20 @@ static void ath11k_dp_rx_h_undecap_eth(s +@@ -2566,6 +2652,20 @@ static void ath11k_dp_rx_h_undecap_eth(s u8 da[ETH_ALEN]; u8 sa[ETH_ALEN]; void *rfc1042; @@ -347,7 +347,7 @@ Signed-off-by: Ramya Gnanasekar rfc1042 = ath11k_dp_rx_h_find_rfc1042(ar, msdu, enctype); if (WARN_ON_ONCE(!rfc1042)) -@@ -2595,6 +2695,7 @@ static void ath11k_dp_rx_h_undecap_eth(s +@@ -2594,6 +2694,7 @@ static void ath11k_dp_rx_h_undecap_eth(s memcpy(skb_push(msdu, hdr_len), hdr, hdr_len); @@ -355,7 +355,7 @@ Signed-off-by: Ramya Gnanasekar /* original 802.11 header has a different DA and in * case of 4addr it may also have different SA */ -@@ -2613,6 +2714,7 @@ static void ath11k_dp_rx_h_undecap_snap( +@@ -2612,6 +2713,7 @@ static void ath11k_dp_rx_h_undecap_snap( size_t hdr_len; u8 l3_pad_bytes; struct hal_rx_desc *rx_desc; @@ -363,7 +363,7 @@ Signed-off-by: Ramya Gnanasekar /* Delivered decapped frame: * [amsdu header] <-- replaced with 802.11 hdr -@@ -2626,6 +2728,11 @@ static void ath11k_dp_rx_h_undecap_snap( +@@ -2625,6 +2727,11 @@ static void ath11k_dp_rx_h_undecap_snap( skb_put(msdu, l3_pad_bytes); skb_pull(msdu, sizeof(struct ath11k_dp_amsdu_subframe_hdr) + l3_pad_bytes); @@ -375,7 +375,7 @@ Signed-off-by: Ramya Gnanasekar hdr = (struct ieee80211_hdr *)first_hdr; hdr_len = ieee80211_hdrlen(hdr->frame_control); -@@ -3099,6 +3206,20 @@ static int ath11k_dp_rx_process_msdu(str +@@ -3098,6 +3205,20 @@ static int ath11k_dp_rx_process_msdu(str goto free_out; } @@ -396,7 +396,7 @@ Signed-off-by: Ramya Gnanasekar rxcb = ATH11K_SKB_RXCB(msdu); rxcb->rx_desc = rx_desc; msdu_len = ath11k_dp_rx_h_msdu_start_msdu_len(ab, rx_desc); -@@ -3111,8 +3232,9 @@ static int ath11k_dp_rx_process_msdu(str +@@ -3110,8 +3231,9 @@ static int ath11k_dp_rx_process_msdu(str hdr_status = ath11k_dp_rx_h_80211_hdr(ab, rx_desc); ret = -EINVAL; ath11k_warn(ab, "invalid msdu len %u\n", msdu_len); @@ -408,7 +408,7 @@ Signed-off-by: Ramya Gnanasekar ath11k_dbg_dump(ab, ATH11K_DBG_DATA, NULL, "", rx_desc, sizeof(struct hal_rx_desc)); goto free_out; -@@ -4075,6 +4197,7 @@ static int ath11k_dp_rx_h_verify_tkip_mi +@@ -4070,6 +4192,7 @@ static int ath11k_dp_rx_h_verify_tkip_mi hdr = (struct ieee80211_hdr *)(msdu->data + hal_rx_desc_sz); hdr_len = ieee80211_hdrlen(hdr->frame_control); @@ -416,7 +416,7 @@ Signed-off-by: Ramya Gnanasekar head_len = hdr_len + hal_rx_desc_sz + IEEE80211_TKIP_IV_LEN; tail_len = IEEE80211_CCMP_MIC_LEN + IEEE80211_TKIP_ICV_LEN + FCS_LEN; -@@ -4355,8 +4478,8 @@ static void ath11k_dp_rx_h_sort_frags(st +@@ -4350,8 +4473,8 @@ static void ath11k_dp_rx_h_sort_frags(st static u64 ath11k_dp_rx_h_get_pn(struct ath11k *ar, struct sk_buff *skb) { @@ -426,7 +426,7 @@ Signed-off-by: Ramya Gnanasekar u8 *ehdr; u32 hal_rx_desc_sz = ar->ab->hw_params.hal_desc_sz; -@@ -4586,8 +4709,9 @@ ath11k_dp_process_rx_err_buf(struct ath1 +@@ -4581,8 +4704,9 @@ ath11k_dp_process_rx_err_buf(struct ath1 if ((msdu_len + hal_rx_desc_sz) > DP_RX_BUFFER_SIZE) { hdr_status = ath11k_dp_rx_h_80211_hdr(ar->ab, rx_desc); ath11k_warn(ar->ab, "invalid msdu leng %u", msdu_len); @@ -438,7 +438,7 @@ Signed-off-by: Ramya Gnanasekar ath11k_dbg_dump(ar->ab, ATH11K_DBG_DATA, NULL, "", rx_desc, sizeof(struct hal_rx_desc)); dev_kfree_skb_any(msdu); -@@ -5212,6 +5336,47 @@ void ath11k_dp_rx_pdev_free(struct ath11 +@@ -5207,6 +5331,47 @@ void ath11k_dp_rx_pdev_free(struct ath11 ath11k_dp_rxdma_pdev_buf_free(ar); } @@ -486,7 +486,7 @@ Signed-off-by: Ramya Gnanasekar int ath11k_dp_rx_pdev_alloc(struct ath11k_base *ab, int mac_id) { struct ath11k *ar = ab->pdevs[mac_id].ar; -@@ -5305,6 +5470,12 @@ config_refill_ring: +@@ -5300,6 +5465,12 @@ config_refill_ring: } } @@ -501,7 +501,7 @@ Signed-off-by: Ramya Gnanasekar --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c -@@ -1275,6 +1275,8 @@ int ath11k_dp_tx_htt_rx_filter_setup(str +@@ -1283,6 +1283,8 @@ int ath11k_dp_tx_htt_rx_filter_setup(str !!(params.flags & HAL_SRNG_FLAGS_MSI_SWAP)); cmd->info0 |= FIELD_PREP(HTT_RX_RING_SELECTION_CFG_CMD_INFO0_PS, !!(params.flags & HAL_SRNG_FLAGS_DATA_TLV_SWAP)); @@ -510,7 +510,7 @@ Signed-off-by: Ramya Gnanasekar cmd->info1 = FIELD_PREP(HTT_RX_RING_SELECTION_CFG_CMD_INFO1_BUF_SIZE, rx_buf_size); -@@ -1284,6 +1286,26 @@ int ath11k_dp_tx_htt_rx_filter_setup(str +@@ -1292,6 +1294,26 @@ int ath11k_dp_tx_htt_rx_filter_setup(str cmd->pkt_type_en_flags3 = tlv_filter->pkt_filter_flags3; cmd->rx_filter_tlv = tlv_filter->rx_filter; @@ -537,7 +537,7 @@ Signed-off-by: Ramya Gnanasekar ret = ath11k_htc_send(&ab->htc, ab->dp.eid, skb); if (ret) goto err_free; -@@ -1362,6 +1384,7 @@ int ath11k_dp_tx_htt_monitor_mode_ring_c +@@ -1370,6 +1392,7 @@ int ath11k_dp_tx_htt_monitor_mode_ring_c } ring_id = dp->rxdma_mon_buf_ring.refill_buf_ring.ring_id; @@ -933,12 +933,12 @@ Signed-off-by: Ramya Gnanasekar extern const struct ath11k_hw_ops ipq8074_ops; --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -6438,6 +6438,7 @@ static int ath11k_mac_config_mon_status_ +@@ -6535,6 +6535,7 @@ static int ath11k_mac_config_mon_status_ tlv_filter.rx_filter = ath11k_debugfs_rx_filter(ar); } + tlv_filter.offset_valid = false; - for (i = 0; i < ab->hw_params.num_rxmda_per_pdev; i++) { + for (i = 0; i < ab->hw_params.num_rxdma_per_pdev; i++) { ring_id = ar->dp.rx_mon_status_refill_ring[i].refill_buf_ring.ring_id; ret = ath11k_dp_tx_htt_rx_filter_setup(ar->ab, ring_id, --- a/drivers/net/wireless/ath/ath11k/rx_desc.h diff --git a/package/kernel/mac80211/patches/nss/ath11k/999-336-0001-ath11k-idr-optimization.patch b/package/kernel/mac80211/patches/nss/ath11k/999-336-0001-ath11k-idr-optimization.patch index 2c74d53d7d3..abcc7a197e4 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/999-336-0001-ath11k-idr-optimization.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/999-336-0001-ath11k-idr-optimization.patch @@ -28,7 +28,7 @@ Signed-off-by: Tamizh Chelvam } --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -3386,18 +3386,16 @@ try_again: +@@ -3385,18 +3385,16 @@ try_again: ar = ab->pdevs[mac_id].ar; rx_ring = &ar->dp.rx_refill_buf_ring; spin_lock_bh(&rx_ring->idr_lock); @@ -50,7 +50,7 @@ Signed-off-by: Tamizh Chelvam dma_unmap_single(ab->dev, rxcb->paddr, msdu->len + skb_tailroom(msdu), DMA_FROM_DEVICE); -@@ -4672,17 +4670,14 @@ ath11k_dp_process_rx_err_buf(struct ath1 +@@ -4667,17 +4665,14 @@ ath11k_dp_process_rx_err_buf(struct ath1 u32 hal_rx_desc_sz = ar->ab->hw_params.hal_desc_sz; spin_lock_bh(&rx_ring->idr_lock); @@ -70,7 +70,7 @@ Signed-off-by: Tamizh Chelvam rxcb = ATH11K_SKB_RXCB(msdu); dma_unmap_single(ar->ab->dev, rxcb->paddr, msdu->len + skb_tailroom(msdu), -@@ -5088,18 +5083,16 @@ int ath11k_dp_rx_process_wbm_err(struct +@@ -5083,18 +5078,16 @@ int ath11k_dp_rx_process_wbm_err(struct rx_ring = &ar->dp.rx_refill_buf_ring; spin_lock_bh(&rx_ring->idr_lock); @@ -92,7 +92,7 @@ Signed-off-by: Tamizh Chelvam dma_unmap_single(ab->dev, rxcb->paddr, msdu->len + skb_tailroom(msdu), DMA_FROM_DEVICE); -@@ -5214,16 +5207,14 @@ int ath11k_dp_process_rxdma_err(struct a +@@ -5209,16 +5202,14 @@ int ath11k_dp_process_rxdma_err(struct a msdu_cookies[i]); spin_lock_bh(&rx_ring->idr_lock); @@ -111,7 +111,7 @@ Signed-off-by: Tamizh Chelvam rxcb = ATH11K_SKB_RXCB(skb); dma_unmap_single(ab->dev, rxcb->paddr, -@@ -6428,16 +6419,14 @@ ath11k_dp_rx_full_mon_mpdu_pop(struct at +@@ -6423,16 +6414,14 @@ ath11k_dp_rx_full_mon_mpdu_pop(struct at msdu_list.sw_cookie[i]); spin_lock_bh(&rx_ring->idr_lock); diff --git a/package/kernel/mac80211/patches/nss/ath11k/999-336-0002-ath11k-Use-idr_replace.patch b/package/kernel/mac80211/patches/nss/ath11k/999-336-0002-ath11k-Use-idr_replace.patch index a43ebff80fb..aa0f1f80af5 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/999-336-0002-ath11k-Use-idr_replace.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/999-336-0002-ath11k-Use-idr_replace.patch @@ -18,7 +18,7 @@ Signed-off-by: Tamizh Chelvam --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -700,6 +700,11 @@ struct ath11k_per_peer_tx_stats { +@@ -704,6 +704,11 @@ struct ath11k_per_peer_tx_stats { #define ATH11K_FLUSH_TIMEOUT (5 * HZ) #define ATH11K_VDEV_DELETE_TIMEOUT_HZ (5 * HZ) @@ -30,7 +30,7 @@ Signed-off-by: Tamizh Chelvam struct ath11k { struct ath11k_base *ab; struct ath11k_pdev *pdev; -@@ -849,6 +854,7 @@ struct ath11k { +@@ -853,6 +858,7 @@ struct ath11k { bool ps_state_enable; bool ps_timekeeper_enable; s8 max_allowed_tx_power; @@ -114,7 +114,7 @@ Signed-off-by: Tamizh Chelvam return 0; } -@@ -3348,11 +3367,14 @@ int ath11k_dp_process_rx(struct ath11k_b +@@ -3347,11 +3366,14 @@ int ath11k_dp_process_rx(struct ath11k_b struct ath11k *ar; struct hal_reo_dest_ring *desc; enum hal_reo_dest_ring_push_reason push_reason; @@ -130,7 +130,7 @@ Signed-off-by: Tamizh Chelvam srng = &ab->hal.srng_list[dp->reo_dst_ring[ring_id].ring_id]; -@@ -3385,8 +3407,15 @@ try_again: +@@ -3384,8 +3406,15 @@ try_again: ar = ab->pdevs[mac_id].ar; rx_ring = &ar->dp.rx_refill_buf_ring; @@ -147,7 +147,7 @@ Signed-off-by: Tamizh Chelvam spin_unlock_bh(&rx_ring->idr_lock); if (unlikely(!msdu)) { ath11k_warn(ab, "frame rx with invalid buf_id %d\n", -@@ -3464,9 +3493,12 @@ try_again: +@@ -3463,9 +3492,12 @@ try_again: rx_ring = &ar->dp.rx_refill_buf_ring; ath11k_dp_rxbufs_replenish(ab, i, rx_ring, num_buffs_reaped[i], @@ -161,7 +161,7 @@ Signed-off-by: Tamizh Chelvam return total_msdu_reaped; } -@@ -4832,7 +4864,7 @@ exit: +@@ -4827,7 +4859,7 @@ exit: rx_ring = &ar->dp.rx_refill_buf_ring; ath11k_dp_rxbufs_replenish(ab, i, rx_ring, n_bufs_reaped[i], @@ -170,7 +170,7 @@ Signed-off-by: Tamizh Chelvam } return tot_n_bufs_reaped; -@@ -5048,14 +5080,17 @@ int ath11k_dp_rx_process_wbm_err(struct +@@ -5043,14 +5075,17 @@ int ath11k_dp_rx_process_wbm_err(struct struct sk_buff *msdu; struct sk_buff_head msdu_list[MAX_RADIOS]; struct ath11k_skb_rxcb *rxcb; @@ -189,7 +189,7 @@ Signed-off-by: Tamizh Chelvam srng = &ab->hal.srng_list[dp->rx_rel_ring.ring_id]; -@@ -5081,9 +5116,15 @@ int ath11k_dp_rx_process_wbm_err(struct +@@ -5076,9 +5111,15 @@ int ath11k_dp_rx_process_wbm_err(struct ar = ab->pdevs[mac_id].ar; rx_ring = &ar->dp.rx_refill_buf_ring; @@ -206,7 +206,7 @@ Signed-off-by: Tamizh Chelvam spin_unlock_bh(&rx_ring->idr_lock); if (!msdu) { ath11k_warn(ab, "frame rx with invalid buf_id %d pdev %d\n", -@@ -5128,7 +5169,7 @@ int ath11k_dp_rx_process_wbm_err(struct +@@ -5123,7 +5164,7 @@ int ath11k_dp_rx_process_wbm_err(struct rx_ring = &ar->dp.rx_refill_buf_ring; ath11k_dp_rxbufs_replenish(ab, i, rx_ring, num_buffs_reaped[i], @@ -215,7 +215,7 @@ Signed-off-by: Tamizh Chelvam } rcu_read_lock(); -@@ -5150,6 +5191,8 @@ int ath11k_dp_rx_process_wbm_err(struct +@@ -5145,6 +5186,8 @@ int ath11k_dp_rx_process_wbm_err(struct } rcu_read_unlock(); done: @@ -224,7 +224,7 @@ Signed-off-by: Tamizh Chelvam return total_num_buffs_reaped; } -@@ -5235,7 +5278,7 @@ int ath11k_dp_process_rxdma_err(struct a +@@ -5230,7 +5273,7 @@ int ath11k_dp_process_rxdma_err(struct a if (num_buf_freed) ath11k_dp_rxbufs_replenish(ab, mac_id, rx_ring, num_buf_freed, @@ -233,7 +233,7 @@ Signed-off-by: Tamizh Chelvam return budget - quota; } -@@ -6181,12 +6224,12 @@ static void ath11k_dp_rx_mon_dest_proces +@@ -6176,12 +6219,12 @@ static void ath11k_dp_rx_mon_dest_proces ath11k_dp_rxbufs_replenish(ar->ab, dp->mac_id, &dp->rxdma_mon_buf_ring, rx_bufs_used, @@ -248,7 +248,7 @@ Signed-off-by: Tamizh Chelvam } } -@@ -6696,7 +6739,7 @@ next_entry: +@@ -6691,7 +6734,7 @@ next_entry: ath11k_dp_rxbufs_replenish(ar->ab, dp->mac_id, &dp->rxdma_mon_buf_ring, rx_bufs_used, @@ -259,7 +259,7 @@ Signed-off-by: Tamizh Chelvam reap_status_ring: --- a/drivers/net/wireless/ath/ath11k/dp_rx.h +++ b/drivers/net/wireless/ath/ath11k/dp_rx.h -@@ -11,6 +11,8 @@ +@@ -12,6 +12,8 @@ #define DP_MAX_NWIFI_HDR_LEN 36 @@ -268,7 +268,7 @@ Signed-off-by: Tamizh Chelvam #define DP_RX_MPDU_ERR_FCS BIT(0) #define DP_RX_MPDU_ERR_DECRYPT BIT(1) #define DP_RX_MPDU_ERR_TKIP_MIC BIT(2) -@@ -125,7 +127,8 @@ int ath11k_dp_process_rx(struct ath11k_b +@@ -126,7 +128,8 @@ int ath11k_dp_process_rx(struct ath11k_b int ath11k_dp_rxbufs_replenish(struct ath11k_base *ab, int mac_id, struct dp_rxdma_ring *rx_ring, int req_entries, diff --git a/package/kernel/mac80211/patches/nss/ath11k/999-374-ath11k-Check-skb_headroom-before-using-skb_push.patch b/package/kernel/mac80211/patches/nss/ath11k/999-374-ath11k-Check-skb_headroom-before-using-skb_push.patch index 513d9759548..988717c1dbc 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/999-374-ath11k-Check-skb_headroom-before-using-skb_push.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/999-374-ath11k-Check-skb_headroom-before-using-skb_push.patch @@ -35,7 +35,7 @@ Signed-off-by: Tamizh Chelvam Raja --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -2455,16 +2455,27 @@ static void ath11k_get_dot11_hdr_from_rx +@@ -2454,16 +2454,27 @@ static void ath11k_get_dot11_hdr_from_rx size_t hdr_len, crypto_len; struct ieee80211_hdr *hdr; u16 fc, qos_ctl = 0; @@ -63,7 +63,7 @@ Signed-off-by: Tamizh Chelvam Raja skb_push(msdu, hdr_len); hdr = (struct ieee80211_hdr *)msdu->data; hdr->frame_control = fc; -@@ -2500,6 +2511,7 @@ static void ath11k_dp_rx_h_undecap_nwifi +@@ -2499,6 +2510,7 @@ static void ath11k_dp_rx_h_undecap_nwifi u8 da[ETH_ALEN]; u8 sa[ETH_ALEN]; u16 qos_ctl = 0; @@ -71,7 +71,7 @@ Signed-off-by: Tamizh Chelvam Raja u8 *qos, *crypto_hdr; bool add_qos_ctrl = false; -@@ -2544,26 +2556,46 @@ static void ath11k_dp_rx_h_undecap_nwifi +@@ -2543,26 +2555,46 @@ static void ath11k_dp_rx_h_undecap_nwifi } if (!(status->flag & RX_FLAG_IV_STRIPPED)) { @@ -123,7 +123,7 @@ Signed-off-by: Tamizh Chelvam Raja memcpy(skb_push(msdu, hdr_len), hdr, hdr_len); /* original 802.11 header has a different DA and in -@@ -2672,6 +2704,7 @@ static void ath11k_dp_rx_h_undecap_eth(s +@@ -2671,6 +2703,7 @@ static void ath11k_dp_rx_h_undecap_eth(s u8 da[ETH_ALEN]; u8 sa[ETH_ALEN]; void *rfc1042; @@ -131,7 +131,7 @@ Signed-off-by: Tamizh Chelvam Raja struct ath11k_skb_rxcb *rxcb = ATH11K_SKB_RXCB(msdu); struct ath11k_dp_rfc1042_hdr rfc = {0xaa, 0xaa, 0x03, {0x00, 0x00, 0x00}}; -@@ -2681,6 +2714,11 @@ static void ath11k_dp_rx_h_undecap_eth(s +@@ -2680,6 +2713,11 @@ static void ath11k_dp_rx_h_undecap_eth(s ether_addr_copy(sa, eth->h_source); rfc.snap_type = eth->h_proto; skb_pull(msdu, sizeof(struct ethhdr)); @@ -143,7 +143,7 @@ Signed-off-by: Tamizh Chelvam Raja memcpy(skb_push(msdu, sizeof(struct ath11k_dp_rfc1042_hdr)), &rfc, sizeof(struct ath11k_dp_rfc1042_hdr)); ath11k_get_dot11_hdr_from_rx_desc(ar, msdu, rxcb, status, enctype); -@@ -2698,6 +2736,11 @@ static void ath11k_dp_rx_h_undecap_eth(s +@@ -2697,6 +2735,11 @@ static void ath11k_dp_rx_h_undecap_eth(s skb_pull(msdu, sizeof(struct ethhdr)); /* push rfc1042/llc/snap */ @@ -155,7 +155,7 @@ Signed-off-by: Tamizh Chelvam Raja memcpy(skb_push(msdu, sizeof(struct ath11k_dp_rfc1042_hdr)), rfc1042, sizeof(struct ath11k_dp_rfc1042_hdr)); -@@ -2706,12 +2749,22 @@ static void ath11k_dp_rx_h_undecap_eth(s +@@ -2705,12 +2748,22 @@ static void ath11k_dp_rx_h_undecap_eth(s hdr_len = ieee80211_hdrlen(hdr->frame_control); if (!(status->flag & RX_FLAG_IV_STRIPPED)) { @@ -182,7 +182,7 @@ Signed-off-by: Tamizh Chelvam Raja memcpy(skb_push(msdu, hdr_len), hdr, hdr_len); exit: -@@ -2732,6 +2785,7 @@ static void ath11k_dp_rx_h_undecap_snap( +@@ -2731,6 +2784,7 @@ static void ath11k_dp_rx_h_undecap_snap( struct ieee80211_hdr *hdr; size_t hdr_len; u8 l3_pad_bytes; @@ -190,7 +190,7 @@ Signed-off-by: Tamizh Chelvam Raja struct hal_rx_desc *rx_desc; struct ath11k_skb_rxcb *rxcb = ATH11K_SKB_RXCB(msdu); -@@ -2756,12 +2810,22 @@ static void ath11k_dp_rx_h_undecap_snap( +@@ -2755,12 +2809,22 @@ static void ath11k_dp_rx_h_undecap_snap( hdr_len = ieee80211_hdrlen(hdr->frame_control); if (!(status->flag & RX_FLAG_IV_STRIPPED)) { @@ -217,7 +217,7 @@ Signed-off-by: Tamizh Chelvam Raja memcpy(skb_push(msdu, hdr_len), hdr, hdr_len); } -@@ -2890,7 +2954,7 @@ static void ath11k_dp_rx_h_mpdu(struct a +@@ -2889,7 +2953,7 @@ static void ath11k_dp_rx_h_mpdu(struct a struct ieee80211_rx_status *rx_status, bool *fast_rx) { @@ -226,7 +226,7 @@ Signed-off-by: Tamizh Chelvam Raja enum hal_encrypt_type enctype; bool is_decrypted = false; struct ath11k_skb_rxcb *rxcb; -@@ -3123,10 +3187,16 @@ static void ath11k_dp_rx_deliver_msdu(st +@@ -3122,10 +3186,16 @@ static void ath11k_dp_rx_deliver_msdu(st u8 decap = DP_RX_DECAP_TYPE_RAW; bool is_mcbc = rxcb->is_mcbc; bool is_eapol = rxcb->is_eapol; @@ -243,7 +243,7 @@ Signed-off-by: Tamizh Chelvam Raja he = skb_push(msdu, sizeof(known)); memcpy(he, &known, sizeof(known)); status->flag |= RX_FLAG_RADIOTAP_HE; -@@ -3182,6 +3252,7 @@ static void ath11k_dp_rx_deliver_msdu(st +@@ -3181,6 +3251,7 @@ static void ath11k_dp_rx_deliver_msdu(st !(is_mcbc && rx_status->flag & RX_FLAG_DECRYPTED)) rx_status->flag |= RX_FLAG_8023; diff --git a/package/kernel/mac80211/patches/nss/ath11k/999-783-001-wifi-ath11k-Fix-BCCA-counter-for-EMA.patch b/package/kernel/mac80211/patches/nss/ath11k/999-783-001-wifi-ath11k-Fix-BCCA-counter-for-EMA.patch deleted file mode 100644 index e04b01aa4d4..00000000000 --- a/package/kernel/mac80211/patches/nss/ath11k/999-783-001-wifi-ath11k-Fix-BCCA-counter-for-EMA.patch +++ /dev/null @@ -1,115 +0,0 @@ -From ea4988df80e62204c411a60bafadfbff23eaa773 Mon Sep 17 00:00:00 2001 -From: Rameshkumar Sundaram -Date: Thu, 15 Jun 2023 14:33:55 +0530 -Subject: [PATCH] wifi: ath11k: Fix BCCA counter for EMA - -Currently BCCA counter is updated to FW via csa counter offs and -beacon with new countdown is updated for every beacon tx completion event. -For EMA, all EMA beacons are updated in one shot, and counter update for -every tx event will mess up the actual sequence of countdown sent over the air. - -Allow FW to update the countdown till 1 and finalize the color -change. - -Signed-off-by: Rameshkumar Sundaram ---- - drivers/net/wireless/ath/ath11k/mac.c | 21 --------------------- - drivers/net/wireless/ath/ath11k/mac.h | 1 - - drivers/net/wireless/ath/ath11k/wmi.c | 23 +++++++++++++++-------- - 3 files changed, 15 insertions(+), 30 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -1594,27 +1594,6 @@ static int ath11k_mac_setup_bcn_tmpl(str - return ath11k_mac_setup_bcn_tmpl_mbssid(arvif); - } - --void ath11k_mac_bcn_tx_event(struct ath11k_vif *arvif) --{ -- struct ieee80211_vif *vif = arvif->vif; -- -- if (!vif->bss_conf.color_change_active && !arvif->bcca_zero_sent) -- return; -- -- if (vif->bss_conf.color_change_active && -- ieee80211_beacon_cntdwn_is_complete(vif, 0)) { -- arvif->bcca_zero_sent = true; -- ieee80211_color_change_finish(vif); -- return; -- } -- -- arvif->bcca_zero_sent = false; -- -- if (vif->bss_conf.color_change_active) -- ieee80211_beacon_update_cntdwn(vif, 0); -- ath11k_mac_setup_bcn_tmpl(arvif); --} -- - static void ath11k_control_beaconing(struct ath11k_vif *arvif, - struct ieee80211_bss_conf *info) - { ---- a/drivers/net/wireless/ath/ath11k/mac.h -+++ b/drivers/net/wireless/ath/ath11k/mac.h -@@ -171,7 +171,6 @@ enum ath11k_supported_bw ath11k_mac_mac8 - enum hal_encrypt_type ath11k_dp_tx_get_encrypt_type(u32 cipher); - void ath11k_mac_handle_beacon(struct ath11k *ar, struct sk_buff *skb); - void ath11k_mac_handle_beacon_miss(struct ath11k *ar, u32 vdev_id); --void ath11k_mac_bcn_tx_event(struct ath11k_vif *arvif); - int ath11k_mac_wait_tx_complete(struct ath11k *ar); - int ath11k_mac_vif_set_keepalive(struct ath11k_vif *arvif, - enum wmi_sta_keepalive_method method, ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -1874,9 +1874,10 @@ int ath11k_wmi_bcn_tmpl(struct ath11k *a - cmd->vdev_id = vdev_id; - cmd->tim_ie_offset = offs->tim_offset; - -- if (vif->bss_conf.csa_active) { -+ if (vif->bss_conf.csa_active || vif->bss_conf.color_change_active) { - cmd->csa_switch_count_offset = offs->cntdwn_counter_offs[0]; - cmd->ext_csa_switch_count_offset = offs->cntdwn_counter_offs[1]; -+ cmd->csa_event_bitmap = cpu_to_le32(0xFFFFFFFF); - } - - cmd->buf_len = bcn->len; -@@ -7567,7 +7568,6 @@ static void ath11k_bcn_tx_status_event(s - rcu_read_unlock(); - return; - } -- ath11k_mac_bcn_tx_event(arvif); - rcu_read_unlock(); - } - -@@ -8481,10 +8481,7 @@ ath11k_wmi_process_csa_switch_count_even - { - int i; - struct ath11k_vif *arvif; -- -- /* Finish CSA once the switch count becomes NULL */ -- if (ev->current_switch_count) -- return; -+ struct ieee80211_bss_conf *bss_conf; - - rcu_read_lock(); - for (i = 0; i < ev->num_vdevs; i++) { -@@ -8496,8 +8493,18 @@ ath11k_wmi_process_csa_switch_count_even - continue; - } - -- if (arvif->is_up && arvif->vif->bss_conf.csa_active) -- ieee80211_csa_finish(arvif->vif, 0); -+ bss_conf = &arvif->vif->bss_conf; -+ if (arvif->is_up && (bss_conf->csa_active || bss_conf->color_change_active)) { -+ if (!ev->current_switch_count) { -+ if (bss_conf->csa_active) -+ ieee80211_csa_finish(arvif->vif, 0); -+ } else if (ev->current_switch_count > 1) { -+ ieee80211_beacon_update_cntdwn(arvif->vif, 0); -+ } else { -+ if (bss_conf->color_change_active) -+ ieee80211_color_change_finish(arvif->vif); -+ } -+ } - } - rcu_read_unlock(); - } diff --git a/package/kernel/mac80211/patches/nss/ath11k/999-800-ath11k-Add-threaded-napi.patch b/package/kernel/mac80211/patches/nss/ath11k/999-800-ath11k-Add-threaded-napi.patch index e11983a03d9..7abc6dc66c2 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/999-800-ath11k-Add-threaded-napi.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/999-800-ath11k-Add-threaded-napi.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath11k/ahb.c +++ b/drivers/net/wireless/ath/ath11k/ahb.c -@@ -495,8 +495,7 @@ static int ath11k_ahb_ext_grp_napi_poll( +@@ -496,8 +496,7 @@ static int ath11k_ahb_ext_grp_napi_poll( int work_done; work_done = ath11k_dp_service_srng(ab, irq_grp, budget); @@ -10,7 +10,7 @@ ath11k_ahb_ext_grp_enable(irq_grp); } -@@ -527,6 +526,7 @@ static int ath11k_ahb_config_ext_irq(str +@@ -528,6 +527,7 @@ static int ath11k_ahb_config_ext_irq(str int irq; int ret; bool nss_offload; @@ -18,20 +18,22 @@ /* TCL Completion, REO Dest, ERR, Exception and h2rxdma rings are offloaded * to nss when its enabled, hence don't enable these interrupts -@@ -540,8 +540,12 @@ static int ath11k_ahb_config_ext_irq(str - irq_grp->ab = ab; - irq_grp->grp_id = i; - init_dummy_netdev(&irq_grp->napi_ndev); -+ snprintf(irq_grp->napi_ndev.name, sizeof(irq_grp->napi_ndev.name), "%s%d:%d", +@@ -545,9 +545,14 @@ static int ath11k_ahb_config_ext_irq(str + if (!irq_grp->napi_ndev) + return -ENOMEM; + ++ snprintf(irq_grp->napi_ndev->name, sizeof(irq_grp->napi_ndev->name), "%s%d:%d", + "ath11k_ahb", devidx, i); + - netif_napi_add(&irq_grp->napi_ndev, &irq_grp->napi, + netif_napi_add(irq_grp->napi_ndev, &irq_grp->napi, ath11k_ahb_ext_grp_napi_poll); -+ dev_set_threaded(&irq_grp->napi_ndev, true); ++ dev_set_threaded(irq_grp->napi_ndev, true); ++ for (j = 0; j < ATH11K_EXT_IRQ_NUM_MAX; j++) { if (!nss_offload && ab->hw_params.ring_mask->tx[i] & BIT(j)) { -@@ -605,6 +609,8 @@ static int ath11k_ahb_config_ext_irq(str + irq_grp->irqs[num_irq++] = +@@ -610,6 +615,8 @@ static int ath11k_ahb_config_ext_irq(str } } @@ -42,7 +44,7 @@ --- a/drivers/net/wireless/ath/ath11k/pcic.c +++ b/drivers/net/wireless/ath/ath11k/pcic.c -@@ -516,8 +516,7 @@ static int ath11k_pcic_ext_grp_napi_poll +@@ -517,8 +517,7 @@ static int ath11k_pcic_ext_grp_napi_poll int i; work_done = ath11k_dp_service_srng(ab, irq_grp, budget); @@ -52,33 +54,35 @@ for (i = 0; i < irq_grp->num_irq; i++) enable_irq(irq_grp->ab->irq_num[irq_grp->irqs[i]]); } -@@ -561,6 +560,7 @@ static int ath11k_pcic_ext_irq_config(st - int i, j, ret, num_vectors = 0; +@@ -563,6 +562,7 @@ static int ath11k_pcic_ext_irq_config(st u32 user_base_data = 0, base_vector = 0; + struct ath11k_ext_irq_grp *irq_grp; unsigned long irq_flags; + static int devidx = 0; ret = ath11k_pcic_get_user_msi_assignment(ab, "DP", &num_vectors, &user_base_data, -@@ -579,8 +579,12 @@ static int ath11k_pcic_ext_irq_config(st - irq_grp->ab = ab; - irq_grp->grp_id = i; - init_dummy_netdev(&irq_grp->napi_ndev); -+ snprintf(irq_grp->napi_ndev.name, sizeof(irq_grp->napi_ndev.name), "%s%d:%d", +@@ -586,9 +586,14 @@ static int ath11k_pcic_ext_irq_config(st + goto fail_allocate; + } + ++ snprintf(irq_grp->napi_ndev->name, sizeof(irq_grp->napi_ndev->name), "%s%d:%d", + "ath11k_pci", devidx, i); + - netif_napi_add(&irq_grp->napi_ndev, &irq_grp->napi, + netif_napi_add(irq_grp->napi_ndev, &irq_grp->napi, ath11k_pcic_ext_grp_napi_poll); -+ dev_set_threaded(&irq_grp->napi_ndev, true); ++ dev_set_threaded(irq_grp->napi_ndev, true); ++ /* tcl, reo, rx_err, wbm release, rxdma rings are offloaded to nss. */ if (ab->nss.enabled && -@@ -627,6 +631,8 @@ static int ath11k_pcic_ext_irq_config(st + !(ab->hw_params.ring_mask->reo_status[i] || +@@ -640,6 +645,8 @@ static int ath11k_pcic_ext_irq_config(st ath11k_pcic_ext_grp_disable(irq_grp); } + devidx++; + return 0; - } - + fail_irq: + /* i ->napi_ndev was properly allocated. Free it also */ diff --git a/package/kernel/mac80211/patches/nss/ath11k/999-802-ath11k-fixup-thermal-throttle.patch b/package/kernel/mac80211/patches/nss/ath11k/999-802-ath11k-fixup-thermal-throttle.patch index 432af8c3b69..6b9626b423f 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/999-802-ath11k-fixup-thermal-throttle.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/999-802-ath11k-fixup-thermal-throttle.patch @@ -137,7 +137,7 @@ #define ATH11K_HWMON_NAME_LEN 15 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -3193,6 +3193,7 @@ ath11k_wmi_send_thermal_mitigation_param +@@ -3236,6 +3236,7 @@ ath11k_wmi_send_thermal_mitigation_param lvl_conf->temp_hwm = param->levelconf[i].tmphwm; lvl_conf->dc_off_percent = param->levelconf[i].dcoffpercent; lvl_conf->prio = param->levelconf[i].priority; @@ -147,7 +147,7 @@ --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -4053,12 +4053,14 @@ struct wmi_11d_new_cc_ev { +@@ -4059,12 +4059,14 @@ struct wmi_11d_new_cc_ev { u32 new_alpha2; } __packed; @@ -163,7 +163,7 @@ }; struct thermal_mitigation_params { -@@ -4069,6 +4071,14 @@ struct thermal_mitigation_params { +@@ -4075,6 +4077,14 @@ struct thermal_mitigation_params { struct tt_level_config levelconf[THERMAL_LEVELS]; }; @@ -178,7 +178,7 @@ struct wmi_therm_throt_config_request_cmd { u32 tlv_header; u32 pdev_id; -@@ -4076,14 +4086,48 @@ struct wmi_therm_throt_config_request_cm +@@ -4082,14 +4092,48 @@ struct wmi_therm_throt_config_request_cm u32 dc; u32 dc_per_event; u32 therm_throt_levels; @@ -229,7 +229,7 @@ struct wmi_delba_send_cmd { --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -6586,6 +6586,9 @@ static int ath11k_mac_op_start(struct ie +@@ -6704,6 +6704,9 @@ static int ath11k_mac_op_start(struct ie } } diff --git a/package/kernel/mac80211/patches/nss/ath11k/999-900-bss-transition-handling.patch b/package/kernel/mac80211/patches/nss/ath11k/999-900-bss-transition-handling.patch index 557c1c5cd9b..ab66b9306b1 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/999-900-bss-transition-handling.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/999-900-bss-transition-handling.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -2041,10 +2041,10 @@ void ath11k_core_pre_reconfigure_recover +@@ -2050,10 +2050,10 @@ void ath11k_core_pre_reconfigure_recover ar->monitor_vdev_id = -1; clear_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags); clear_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags); @@ -12,7 +12,7 @@ reinit_completion(&ab->driver_recovery); } -@@ -2320,7 +2320,6 @@ struct ath11k_base *ath11k_core_alloc(st +@@ -2329,7 +2329,6 @@ struct ath11k_base *ath11k_core_alloc(st goto err_free_wq; mutex_init(&ab->core_lock); @@ -20,7 +20,7 @@ mutex_init(&ab->base_ast_lock); spin_lock_init(&ab->base_lock); mutex_init(&ab->vdev_id_11d_lock); -@@ -2328,8 +2327,6 @@ struct ath11k_base *ath11k_core_alloc(st +@@ -2337,8 +2336,6 @@ struct ath11k_base *ath11k_core_alloc(st init_completion(&ab->reconfigure_complete); init_completion(&ab->recovery_start); @@ -31,7 +31,7 @@ INIT_WORK(&ab->restart_work, ath11k_core_restart); --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -737,9 +737,22 @@ struct ath11k { +@@ -741,9 +741,22 @@ struct ath11k { iftype[NUM_NL80211_BANDS][NUM_NL80211_IFTYPES]; } mac; @@ -54,7 +54,7 @@ u32 min_tx_power; u32 max_tx_power; u32 txpower_limit_2g; -@@ -817,6 +830,9 @@ struct ath11k { +@@ -821,6 +834,9 @@ struct ath11k { struct work_struct wmi_mgmt_tx_work; struct sk_buff_head wmi_mgmt_tx_queue; @@ -64,7 +64,7 @@ struct ath11k_wow wow; struct completion target_suspend; bool target_suspend_ack; -@@ -1020,19 +1036,7 @@ struct ath11k_base { +@@ -1024,19 +1040,7 @@ struct ath11k_base { struct ath11k_hal_reg_capabilities_ext hal_reg_cap[MAX_RADIOS]; unsigned long long free_vdev_map; @@ -84,7 +84,7 @@ u8 mac_addr[ETH_ALEN]; int userpd_id; int irq_num[ATH11K_IRQ_NUM_MAX]; -@@ -1409,4 +1413,36 @@ static inline const char *ath11k_bus_str +@@ -1413,4 +1417,36 @@ static inline const char *ath11k_bus_str return "unknown"; } @@ -517,7 +517,7 @@ break; case HTT_T2H_MSG_TYPE_PPDU_STATS_IND: ath11k_htt_pull_ppdu_stats(ab, skb); -@@ -2877,25 +2893,25 @@ static void ath11k_dp_rx_h_undecap(struc +@@ -2876,25 +2892,25 @@ static void ath11k_dp_rx_h_undecap(struc } static struct ath11k_peer * @@ -549,7 +549,7 @@ return peer; } -@@ -2939,7 +2955,7 @@ static bool ath11k_dp_rx_check_fast_rx(s +@@ -2938,7 +2954,7 @@ static bool ath11k_dp_rx_check_fast_rx(s return false; /* check if the msdu needs to be bridged to our connected peer */ @@ -558,7 +558,7 @@ if (f_peer && f_peer != peer) return false; -@@ -2978,7 +2994,7 @@ static void ath11k_dp_rx_h_mpdu(struct a +@@ -2977,7 +2993,7 @@ static void ath11k_dp_rx_h_mpdu(struct a } spin_lock_bh(&ar->ab->base_lock); @@ -567,7 +567,7 @@ if (peer) { /* If the pkt is a valid IP packet and peer supports * fast rx, deliver directly to net, also note that -@@ -3206,7 +3222,7 @@ static void ath11k_dp_rx_deliver_msdu(st +@@ -3205,7 +3221,7 @@ static void ath11k_dp_rx_deliver_msdu(st decap = ath11k_dp_rx_h_msdu_start_decap_type(ar->ab, rxcb->rx_desc); spin_lock_bh(&ar->ab->base_lock); @@ -576,7 +576,7 @@ if (peer && peer->sta) pubsta = peer->sta; spin_unlock_bh(&ar->ab->base_lock); -@@ -3505,7 +3521,7 @@ try_again: +@@ -3504,7 +3520,7 @@ try_again: if (unlikely(push_reason != HAL_REO_DEST_RING_PUSH_REASON_ROUTING_INSTRUCTION)) { dev_kfree_skb_any(msdu); @@ -585,7 +585,7 @@ continue; } -@@ -3737,11 +3753,10 @@ static void ath11k_dp_rx_update_user_sta +@@ -3736,7 +3752,7 @@ static void ath11k_dp_rx_update_user_sta if (user_stats->ast_index == 0 || user_stats->ast_index == 0xFFFF) return; @@ -593,13 +593,8 @@ + peer = ath11k_peer_find_by_ast(ar, user_stats->ast_index); if (peer == NULL) { -- if (!ar->ab->nss.enabled) -- ath11k_warn(ar->ab, "peer ast idx %d can't be found\n", -+ ath11k_warn(ar->ab, "peer ast idx %d can't be found\n", - user_stats->ast_index); - return; - } -@@ -4215,7 +4230,7 @@ int ath11k_peer_rx_frag_setup(struct ath + if (!ar->ab->nss.enabled) +@@ -4210,7 +4226,7 @@ int ath11k_peer_rx_frag_setup(struct ath spin_lock_bh(&ab->base_lock); @@ -608,7 +603,7 @@ if (!peer) { ath11k_warn(ab, "failed to find the peer to set up fragment info\n"); spin_unlock_bh(&ab->base_lock); -@@ -4671,7 +4686,7 @@ static int ath11k_dp_rx_frag_h_mpdu(stru +@@ -4666,7 +4682,7 @@ static int ath11k_dp_rx_frag_h_mpdu(stru return -EINVAL; spin_lock_bh(&ab->base_lock); @@ -617,7 +612,7 @@ if (!peer) { ath11k_warn(ab, "failed to find the peer to de-fragment received fragment peer_id %d\n", peer_id); -@@ -4733,7 +4748,7 @@ static int ath11k_dp_rx_frag_h_mpdu(stru +@@ -4728,7 +4744,7 @@ static int ath11k_dp_rx_frag_h_mpdu(stru del_timer_sync(&rx_tid->frag_timer); spin_lock_bh(&ab->base_lock); @@ -626,7 +621,7 @@ if (!peer) goto err_frags_cleanup; -@@ -6397,7 +6412,7 @@ int ath11k_dp_rx_process_mon_status(stru +@@ -6392,7 +6408,7 @@ int ath11k_dp_rx_process_mon_status(stru trace_ath11k_htt_rxdesc(ar, skb->data, log_type, rx_buf_sz); ppdu_info->peer_id = HAL_INVALID_PEERID; @@ -635,7 +630,7 @@ if (test_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags) && pmon->mon_ppdu_status == DP_PPDU_STATUS_START && -@@ -6428,7 +6443,7 @@ int ath11k_dp_rx_process_mon_status(stru +@@ -6423,7 +6439,7 @@ int ath11k_dp_rx_process_mon_status(stru } rcu_read_lock(); spin_lock_bh(&ab->base_lock); @@ -646,7 +641,7 @@ ath11k_dbg(ab, ATH11K_DBG_DATA, --- a/drivers/net/wireless/ath/ath11k/dp_rx.h +++ b/drivers/net/wireless/ath/ath11k/dp_rx.h -@@ -129,8 +129,8 @@ int ath11k_dp_rxbufs_replenish(struct at +@@ -130,8 +130,8 @@ int ath11k_dp_rxbufs_replenish(struct at int req_entries, enum hal_rx_buf_return_buf_manager mgr, u32 *buf_id); @@ -659,7 +654,7 @@ int ath11k_dp_rx_process_mon_rings(struct ath11k_base *ab, int mac_id, --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c -@@ -478,7 +478,7 @@ ath11k_dp_tx_htt_tx_complete_buf(struct +@@ -482,7 +482,7 @@ ath11k_dp_tx_htt_tx_complete_buf(struct } spin_lock_bh(&ab->base_lock); @@ -668,7 +663,7 @@ if (!peer || !peer->sta) { ath11k_dbg(ab, ATH11K_DBG_DATA, "dp_tx: failed to find the peer with peer_id %d\n", -@@ -576,7 +576,7 @@ void ath11k_dp_tx_update_txcompl(struct +@@ -580,7 +580,7 @@ void ath11k_dp_tx_update_txcompl(struct int ret; spin_lock_bh(&ab->base_lock); @@ -677,7 +672,7 @@ if (!peer || !peer->sta) { ath11k_dbg(ab, ATH11K_DBG_DP_TX, "failed to find the peer by id %u\n", ts->peer_id); -@@ -791,7 +791,7 @@ static void ath11k_dp_tx_complete_msdu(s +@@ -799,7 +799,7 @@ static void ath11k_dp_tx_complete_msdu(s } spin_lock_bh(&ab->base_lock); @@ -789,7 +784,7 @@ ar->num_peers = 0; ar->num_stations = 0; -@@ -3100,7 +3100,7 @@ static void ath11k_bss_assoc(struct ieee +@@ -3208,7 +3208,7 @@ static void ath11k_bss_assoc(struct ieee spin_lock_bh(&ar->ab->base_lock); @@ -798,7 +793,7 @@ if (peer && peer->is_authorized) is_auth = true; -@@ -4260,7 +4260,7 @@ static int ath11k_clear_peer_keys(struct +@@ -4370,7 +4370,7 @@ static int ath11k_clear_peer_keys(struct lockdep_assert_held(&ar->conf_mutex); spin_lock_bh(&ab->base_lock); @@ -807,7 +802,7 @@ if (!peer) { spin_unlock_bh(&ab->base_lock); return -ENOENT; -@@ -4376,7 +4376,7 @@ static int ath11k_mac_op_set_key(struct +@@ -4486,7 +4486,7 @@ static int ath11k_mac_op_set_key(struct * we already hold conf_mutex. we just make sure its there now. */ spin_lock_bh(&ab->base_lock); @@ -816,7 +811,7 @@ /* flush the fragments cache during key (re)install to * ensure all frags in the new frag list belong to the same key. -@@ -4485,7 +4485,7 @@ static int ath11k_mac_op_set_key(struct +@@ -4595,7 +4595,7 @@ static int ath11k_mac_op_set_key(struct } spin_lock_bh(&ab->base_lock); @@ -825,7 +820,7 @@ /* TODO: Check if vdev specific security cfg is mandatory */ ret = ath11k_nss_vdev_set_cmd(arvif, ATH11K_NSS_WIFI_VDEV_SECURITY_TYPE_CMD, key->cipher); -@@ -4516,7 +4516,7 @@ static int ath11k_mac_op_set_key(struct +@@ -4626,7 +4626,7 @@ static int ath11k_mac_op_set_key(struct list_for_each_entry_safe(dyn_vlan_cfg, tmp, &ap_vlan_arvif->dyn_vlan_cfg, cfg_list) { struct ieee80211_sta *vlan_sta = dyn_vlan_cfg->sta; @@ -834,7 +829,7 @@ if (ret) ath11k_warn(ar->ab, "failed to cfg dyn vlan for peer %pM: %d\n", vlan_sta->addr, ret); -@@ -5126,7 +5126,7 @@ static void ath11k_sta_set_4addr_wk(stru +@@ -5236,7 +5236,7 @@ static void ath11k_sta_set_4addr_wk(stru vif = ap_vlan_arvif->vif; spin_lock_bh(&ab->base_lock); @@ -843,7 +838,7 @@ if (!wds_peer) { spin_unlock_bh(&ab->base_lock); ath11k_warn(ab, "mac sta use 4addr failed to find peer %pM\n", -@@ -5349,7 +5349,7 @@ static void ath11k_mac_op_sta_rc_update( +@@ -5459,7 +5459,7 @@ static void ath11k_mac_op_sta_rc_update( spin_lock_bh(&ar->ab->base_lock); @@ -852,7 +847,7 @@ if (!peer) { spin_unlock_bh(&ar->ab->base_lock); ath11k_warn(ar->ab, "mac sta rc update failed to find peer %pM on vdev %i\n", -@@ -8430,7 +8430,7 @@ ath11k_mac_op_assign_vif_chanctx(struct +@@ -8496,7 +8496,7 @@ ath11k_mac_op_assign_vif_chanctx(struct if (ab->hw_params.vdev_start_delay && arvif->vdev_type != WMI_VDEV_TYPE_AP && arvif->vdev_type != WMI_VDEV_TYPE_MONITOR && @@ -861,7 +856,7 @@ memcpy(&arvif->chanctx, ctx, sizeof(*ctx)); ret = 0; goto out; -@@ -8506,7 +8506,7 @@ ath11k_mac_op_unassign_vif_chanctx(struc +@@ -8572,7 +8572,7 @@ ath11k_mac_op_unassign_vif_chanctx(struc if (ab->hw_params.vdev_start_delay && arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { spin_lock_bh(&ab->base_lock); @@ -870,7 +865,7 @@ spin_unlock_bh(&ab->base_lock); if (peer) ath11k_peer_delete(ar, arvif->vdev_id, ar->mac_addr); -@@ -9080,7 +9080,7 @@ ath11k_mac_validate_vht_he_fixed_rate_se +@@ -9146,7 +9146,7 @@ ath11k_mac_validate_vht_he_fixed_rate_se rcu_read_lock(); spin_lock_bh(&ar->ab->base_lock); @@ -879,7 +874,7 @@ if (peer->sta) { deflink = &peer->sta->deflink; -@@ -10032,26 +10032,26 @@ static int ath11k_mac_station_remove(str +@@ -10102,26 +10102,26 @@ static int ath11k_mac_station_remove(str return ret; } @@ -913,7 +908,7 @@ sta->addr, ret); return ret; } -@@ -10101,20 +10101,20 @@ static int ath11k_mac_op_sta_state(struc +@@ -10171,20 +10171,20 @@ static int ath11k_mac_op_sta_state(struc ath11k_warn(ar->ab, "Failed to remove station: %pM for VDEV: %d\n", sta->addr, arvif->vdev_id); @@ -938,7 +933,7 @@ } else if (old_state == IEEE80211_STA_AUTH && new_state == IEEE80211_STA_ASSOC && (vif->type == NL80211_IFTYPE_AP || -@@ -10145,7 +10145,7 @@ static int ath11k_mac_op_sta_state(struc +@@ -10215,7 +10215,7 @@ static int ath11k_mac_op_sta_state(struc new_state == IEEE80211_STA_AUTHORIZED) { spin_lock_bh(&ar->ab->base_lock); @@ -947,7 +942,7 @@ if (peer) peer->is_authorized = true; -@@ -10182,7 +10182,7 @@ static int ath11k_mac_op_sta_state(struc +@@ -10252,7 +10252,7 @@ static int ath11k_mac_op_sta_state(struc list_add_tail(&ar_dyn_vlan_cfg->cfg_list, &arvif->dyn_vlan_cfg); } } else { @@ -956,7 +951,7 @@ if (ret) ath11k_warn(ar->ab, "failed to cfg dyn vlan for peer %pM: %d\n", sta->addr, ret); -@@ -10215,7 +10215,7 @@ static int ath11k_mac_op_sta_state(struc +@@ -10285,7 +10285,7 @@ static int ath11k_mac_op_sta_state(struc new_state == IEEE80211_STA_ASSOC) { spin_lock_bh(&ar->ab->base_lock); @@ -965,7 +960,7 @@ if (peer) peer->is_authorized = false; spin_unlock_bh(&ar->ab->base_lock); -@@ -10223,7 +10223,7 @@ static int ath11k_mac_op_sta_state(struc +@@ -10293,7 +10293,7 @@ static int ath11k_mac_op_sta_state(struc new_state == IEEE80211_STA_ASSOC) { spin_lock_bh(&ar->ab->base_lock); @@ -974,7 +969,7 @@ if (peer) peer->is_authorized = false; -@@ -10628,9 +10628,9 @@ void ath11k_mac_unregister(struct ath11k +@@ -10701,9 +10701,9 @@ void ath11k_mac_unregister(struct ath11k continue; __ath11k_mac_unregister(ar); @@ -985,7 +980,7 @@ } static int __ath11k_mac_register(struct ath11k *ar) -@@ -10917,15 +10917,15 @@ int ath11k_mac_register(struct ath11k_ba +@@ -10987,15 +10987,15 @@ int ath11k_mac_register(struct ath11k_ba ab->cc_freq_hz = IPQ8074_CC_FREQ_HERTZ; ab->free_vdev_map = (1LL << (ab->num_radios * TARGET_NUM_VDEVS(ab))) - 1; @@ -1004,7 +999,7 @@ if (ab->pdevs_macaddr_valid) { ether_addr_copy(ar->mac_addr, pdev->mac_addr); } else { -@@ -10953,9 +10953,9 @@ err_cleanup: +@@ -11023,9 +11023,9 @@ err_cleanup: pdev = &ab->pdevs[i]; ar = pdev->ar; __ath11k_mac_unregister(ar); @@ -1015,7 +1010,7 @@ return ret; } -@@ -10999,9 +10999,12 @@ int ath11k_mac_allocate(struct ath11k_ba +@@ -11069,9 +11069,12 @@ int ath11k_mac_allocate(struct ath11k_ba ar->num_rx_chains = get_num_chains(pdev->cap.rx_chain_mask); pdev->ar = ar; @@ -2434,7 +2429,7 @@ { --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -7579,10 +7579,12 @@ static void ath11k_wmi_event_peer_sta_ps +@@ -7626,10 +7626,12 @@ static void ath11k_wmi_event_peer_sta_ps struct ieee80211_sta *sta; struct ath11k_peer *peer; struct ath11k *ar; @@ -2447,7 +2442,7 @@ tb = ath11k_wmi_tlv_parse_alloc(ab, skb, GFP_ATOMIC); if (IS_ERR(tb)) { -@@ -7606,64 +7608,60 @@ static void ath11k_wmi_event_peer_sta_ps +@@ -7653,64 +7655,60 @@ static void ath11k_wmi_event_peer_sta_ps rcu_read_lock(); @@ -2554,7 +2549,7 @@ } out: -@@ -7783,9 +7781,9 @@ static void ath11k_mgmt_rx_event(struct +@@ -7830,9 +7828,9 @@ static void ath11k_mgmt_rx_event(struct spin_lock_bh(&ab->base_lock); @@ -2566,7 +2561,7 @@ if (!peer) { spin_unlock_bh(&ab->base_lock); goto skip_mgmt_stats; -@@ -8013,9 +8011,8 @@ static void ath11k_peer_sta_kickout_even +@@ -8060,9 +8058,8 @@ static void ath11k_peer_sta_kickout_even { struct wmi_peer_sta_kickout_arg arg = {}; struct ieee80211_sta *sta; @@ -2577,7 +2572,7 @@ if (ath11k_pull_peer_sta_kickout_ev(ab, skb, &arg) != 0) { ath11k_warn(ab, "failed to extract peer sta kickout event"); -@@ -8024,42 +8021,22 @@ static void ath11k_peer_sta_kickout_even +@@ -8071,42 +8068,22 @@ static void ath11k_peer_sta_kickout_even rcu_read_lock(); diff --git a/package/kernel/mac80211/patches/nss/ath11k/999-901-ath11k-peer-ast-warning.patch b/package/kernel/mac80211/patches/nss/ath11k/999-901-ath11k-peer-ast-warning.patch deleted file mode 100644 index 84aa154aba2..00000000000 --- a/package/kernel/mac80211/patches/nss/ath11k/999-901-ath11k-peer-ast-warning.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/drivers/net/wireless/ath/ath11k/dp_rx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -3402,7 +3402,7 @@ static void ath11k_dp_rx_process_receive - - while ((msdu = __skb_dequeue(msdu_list))) { - rxcb = ATH11K_SKB_RXCB(msdu); -- /* Enable fast rx by default, the value will cahnge based on peer cap -+ /* Enable fast rx by default, the value will change based on peer cap - * and packet type */ - fast_rx = true; - rxcb->napi = napi; -@@ -3755,13 +3755,13 @@ static void ath11k_dp_rx_update_user_sta - - peer = ath11k_peer_find_by_ast(ar, user_stats->ast_index); - -- if (peer == NULL) { -+ if (!peer && !ar->ab->nss.enabled) { - ath11k_warn(ar->ab, "peer ast idx %d can't be found\n", - user_stats->ast_index); - return; - } - -- arsta = (struct ath11k_sta *)peer->sta->drv_priv; -+ arsta = ath11k_sta_to_arsta(peer->sta); - rx_stats = arsta->rx_stats; - - if (ar->ab->nss.enabled) diff --git a/package/kernel/mac80211/patches/nss/ath11k/999-902-ath11k-fix-WDS-by-disabling-nwds.patch b/package/kernel/mac80211/patches/nss/ath11k/999-902-ath11k-fix-WDS-by-disabling-nwds.patch index f8856b0048c..2fa2b082dbe 100644 --- a/package/kernel/mac80211/patches/nss/ath11k/999-902-ath11k-fix-WDS-by-disabling-nwds.patch +++ b/package/kernel/mac80211/patches/nss/ath11k/999-902-ath11k-fix-WDS-by-disabling-nwds.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -5185,14 +5185,19 @@ skip_nss_ext: +@@ -5295,14 +5295,19 @@ skip_nss_ext: * AP vif of the AP_VLAN vif */ ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, @@ -23,7 +23,7 @@ return; ext_vdev_down: -@@ -7101,6 +7106,23 @@ static int ath11k_mac_op_add_interface(s +@@ -7239,6 +7244,23 @@ static int ath11k_mac_op_add_interface(s goto err_vdev_del; } @@ -63,7 +63,7 @@ free_ext_vdev: --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h -@@ -1116,6 +1116,10 @@ enum wmi_tlv_vdev_param { +@@ -1112,6 +1112,10 @@ enum wmi_tlv_vdev_param { WMI_VDEV_PARAM_HEOPS_0_31 = 0x8003, }; diff --git a/package/kernel/mac80211/patches/nss/ath11k/999-903-ath11k-use-ath11k_sta_to_arsta.patch b/package/kernel/mac80211/patches/nss/ath11k/999-903-ath11k-use-ath11k_sta_to_arsta.patch new file mode 100644 index 00000000000..ae3b44597e1 --- /dev/null +++ b/package/kernel/mac80211/patches/nss/ath11k/999-903-ath11k-use-ath11k_sta_to_arsta.patch @@ -0,0 +1,70 @@ +--- a/drivers/net/wireless/ath/ath11k/debugfs_sta.c ++++ b/drivers/net/wireless/ath/ath11k/debugfs_sta.c +@@ -1074,7 +1074,7 @@ static ssize_t ath11k_dbg_sta_reset_rx_s + size_t count, loff_t *ppos) + { + struct ieee80211_sta *sta = file->private_data; +- struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; ++ struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); + struct ath11k *ar = arsta->arvif->ar; + int ret, reset; + +--- a/drivers/net/wireless/ath/ath11k/dp_rx.c ++++ b/drivers/net/wireless/ath/ath11k/dp_rx.c +@@ -1584,7 +1584,7 @@ static void ath11k_dp_ppdu_stats_flush_t + goto exit; + + sta = peer->sta; +- arsta = (struct ath11k_sta *)sta->drv_priv; ++ arsta = ath11k_sta_to_arsta(sta); + + memset(&status, 0, sizeof(status)); + +@@ -1950,7 +1950,7 @@ ath11k_dp_rx_ppdu_stats_update_tx_comp_s + } + + sta = peer->sta; +- arsta = (struct ath11k_sta *)sta->drv_priv; ++ arsta = ath11k_sta_to_arsta(sta); + + memset(&status, 0, sizeof(status)); + +@@ -3009,8 +3009,7 @@ static void ath11k_dp_rx_h_mpdu(struct a + msdu->protocol = eth_type_trans(msdu, msdu->dev); + napi_gro_receive(rxcb->napi, msdu); + if (peer->sta) +- arsta = +- (struct ath11k_sta *)peer->sta->drv_priv; ++ arsta = ath11k_sta_to_arsta(peer->sta); + return; + } + } +@@ -3761,7 +3760,7 @@ static void ath11k_dp_rx_update_user_sta + return; + } + +- arsta = (struct ath11k_sta *)peer->sta->drv_priv; ++ arsta = ath11k_sta_to_arsta(peer->sta); + rx_stats = arsta->rx_stats; + + if (ar->ab->nss.enabled) +@@ -6451,7 +6450,7 @@ int ath11k_dp_rx_process_mon_status(stru + if ((ppdu_info->fc_valid) && + (ppdu_info->ast_index != HAL_AST_IDX_INVALID)) { + if (ppdu_info->reception_type == HAL_RX_RECEPTION_TYPE_SU) { +- arsta = (struct ath11k_sta *)peer->sta->drv_priv; ++ arsta = ath11k_sta_to_arsta(peer->sta); + ath11k_dp_rx_update_peer_su_stats(arsta, ppdu_info); + ath11k_nss_update_sta_rxrate(ppdu_info, peer, NULL); + } else { +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -4455,7 +4455,7 @@ static int ath11k_mac_op_set_key(struct + mutex_lock(&ar->conf_mutex); + if (sta) { + peer_addr = sta->addr; +- arsta = (struct ath11k_sta *)sta->drv_priv; ++ arsta = ath11k_sta_to_arsta(sta); + } else if (arvif->vdev_type == WMI_VDEV_TYPE_STA) { + peer_addr = vif->bss_conf.bssid; + } else { diff --git a/package/kernel/mac80211/patches/nss/subsys/146-mac80211-enable-TKIP-when-using-encapsulation-offloading.patch b/package/kernel/mac80211/patches/nss/subsys/146-mac80211-enable-TKIP-when-using-encapsulation-offloading.patch index a97eb7b987e..65b94504309 100644 --- a/package/kernel/mac80211/patches/nss/subsys/146-mac80211-enable-TKIP-when-using-encapsulation-offloading.patch +++ b/package/kernel/mac80211/patches/nss/subsys/146-mac80211-enable-TKIP-when-using-encapsulation-offloading.patch @@ -1,6 +1,6 @@ --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -4716,8 +4716,7 @@ netdev_tx_t ieee80211_subif_start_xmit_8 +@@ -4715,8 +4715,7 @@ netdev_tx_t ieee80211_subif_start_xmit_8 if (!key) key = rcu_dereference(sdata->default_unicast_key); diff --git a/package/kernel/mac80211/patches/nss/subsys/199-001-mac80211-add-nss-support.patch b/package/kernel/mac80211/patches/nss/subsys/199-001-mac80211-add-nss-support.patch index 52ee26cb1ef..a1a39556d3d 100644 --- a/package/kernel/mac80211/patches/nss/subsys/199-001-mac80211-add-nss-support.patch +++ b/package/kernel/mac80211/patches/nss/subsys/199-001-mac80211-add-nss-support.patch @@ -27,7 +27,7 @@ Signed-off-by: Sriram R struct net_device *upper_dev) --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -404,6 +404,20 @@ enum ieee80211_bss_change { +@@ -406,6 +406,20 @@ enum ieee80211_bss_change { /* when adding here, make sure to change ieee80211_reconfig */ }; @@ -48,23 +48,23 @@ Signed-off-by: Sriram R /* * The maximum number of IPv4 addresses listed for ARP filtering. If the number * of addresses for an interface increase beyond this value, hardware ARP -@@ -703,6 +717,7 @@ struct ieee80211_fils_discovery { - * beamformee - * @eht_mu_beamformer: in AP-mode, does this BSS enable operation as an EHT MU - * beamformer +@@ -740,6 +754,7 @@ struct ieee80211_parsed_tpe { + * @eht_80mhz_full_bw_ul_mumimo: in AP-mode, does this BSS support the + * reception of an EHT TB PPDU on an RU that spans the entire PPDU + * bandwidth + * @nss_ap_isolate: Used for notifying the NSS host about AP isolate feature */ struct ieee80211_bss_conf { struct ieee80211_vif *vif; -@@ -795,6 +810,7 @@ struct ieee80211_bss_conf { - bool eht_su_beamformer; +@@ -834,6 +849,7 @@ struct ieee80211_bss_conf { bool eht_su_beamformee; bool eht_mu_beamformer; + bool eht_80mhz_full_bw_ul_mumimo; + bool nss_ap_isolate; }; /** -@@ -1445,7 +1461,7 @@ ieee80211_tx_info_clear_status(struct ie +@@ -1485,7 +1501,7 @@ ieee80211_tx_info_clear_status(struct ie * @RX_FLAG_AMPDU_EOF_BIT_KNOWN: The EOF value is known * @RX_FLAG_RADIOTAP_HE: HE radiotap data is present * (&struct ieee80211_radiotap_he, mac80211 will fill in @@ -73,7 +73,7 @@ Signed-off-by: Sriram R * - DATA3_DATA_MCS * - DATA3_DATA_DCM * - DATA3_CODING -@@ -1453,7 +1469,7 @@ ieee80211_tx_info_clear_status(struct ie +@@ -1493,7 +1509,7 @@ ieee80211_tx_info_clear_status(struct ie * - DATA5_DATA_BW_RU_ALLOC * - DATA6_NSTS * - DATA3_STBC @@ -82,7 +82,7 @@ Signed-off-by: Sriram R * from the RX info data, so leave those zeroed when building this data) * @RX_FLAG_RADIOTAP_HE_MU: HE MU radiotap data is present * (&struct ieee80211_radiotap_he_mu) -@@ -2084,6 +2100,16 @@ static inline bool lockdep_vif_wiphy_mut +@@ -2128,6 +2144,16 @@ static inline bool lockdep_vif_wiphy_mut lockdep_vif_wiphy_mutex_held(vif)) /** @@ -99,7 +99,7 @@ Signed-off-by: Sriram R * enum ieee80211_key_flags - key flags * * These flags are used for communication about keys between the driver -@@ -2788,6 +2814,8 @@ struct ieee80211_txq { +@@ -2826,6 +2852,8 @@ struct ieee80211_txq { * implements MLO, so operation can continue on other links when one * link is switching. * @@ -108,15 +108,15 @@ Signed-off-by: Sriram R * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays */ enum ieee80211_hw_flags { -@@ -2847,6 +2875,7 @@ enum ieee80211_hw_flags { - IEEE80211_HW_MLO_MCAST_MULTI_LINK_TX, +@@ -2885,6 +2913,7 @@ enum ieee80211_hw_flags { IEEE80211_HW_DISALLOW_PUNCTURING, + IEEE80211_HW_DISALLOW_PUNCTURING_5GHZ, IEEE80211_HW_HANDLES_QUIET_CSA, + IEEE80211_HW_SUPPORTS_NSS_OFFLOAD, /* keep last, obviously */ NUM_IEEE80211_HW_FLAGS -@@ -3860,6 +3889,10 @@ struct ieee80211_prep_tx_info { +@@ -3900,6 +3929,10 @@ struct ieee80211_prep_tx_info { * non-MLO connections. * The callback can sleep. * @@ -127,7 +127,7 @@ Signed-off-by: Sriram R * @prepare_multicast: Prepare for multicast filter configuration. * This callback is optional, and its return value is passed * to configure_filter(). This callback must be atomic. -@@ -4425,7 +4458,9 @@ struct ieee80211_ops { +@@ -4462,7 +4495,9 @@ struct ieee80211_ops { struct ieee80211_vif *vif, struct ieee80211_bss_conf *info, u64 changed); @@ -138,7 +138,7 @@ Signed-off-by: Sriram R int (*start_ap)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_bss_conf *link_conf); void (*stop_ap)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, -@@ -4735,7 +4770,7 @@ struct ieee80211_ops { +@@ -4772,7 +4807,7 @@ struct ieee80211_ops { int (*reset_tid_config)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, u8 tids); @@ -150,8 +150,8 @@ Signed-off-by: Sriram R --- a/net/mac80211/debugfs.c +++ b/net/mac80211/debugfs.c @@ -508,6 +508,7 @@ static const char *hw_flag_names[] = { - FLAG(MLO_MCAST_MULTI_LINK_TX), FLAG(DISALLOW_PUNCTURING), + FLAG(DISALLOW_PUNCTURING_5GHZ), FLAG(HANDLES_QUIET_CSA), + FLAG(SUPPORTS_NSS_OFFLOAD), #undef FLAG @@ -184,7 +184,7 @@ Signed-off-by: Sriram R * the suspend->resume cycle. Since we can't check each caller --- a/net/mac80211/main.c +++ b/net/mac80211/main.c -@@ -413,6 +413,17 @@ void ieee80211_link_info_change_notify(s +@@ -414,6 +414,17 @@ void ieee80211_link_info_change_notify(s drv_link_info_changed(local, sdata, link->conf, link->link_id, changed); } @@ -202,7 +202,7 @@ Signed-off-by: Sriram R u64 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata) { sdata->vif.bss_conf.use_cts_prot = false; -@@ -844,12 +855,6 @@ struct ieee80211_hw *ieee80211_alloc_hw_ +@@ -852,12 +863,6 @@ struct ieee80211_hw *ieee80211_alloc_hw_ NL80211_FEATURE_FULL_AP_CLIENT_STATE; wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_FILS_STA); wiphy_ext_feature_set(wiphy, @@ -215,7 +215,7 @@ Signed-off-by: Sriram R NL80211_EXT_FEATURE_SCAN_FREQ_KHZ); wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_POWERED_ADDR_CHANGE); -@@ -1180,6 +1185,18 @@ int ieee80211_register_hw(struct ieee802 +@@ -1185,6 +1190,18 @@ int ieee80211_register_hw(struct ieee802 return -EINVAL; } @@ -272,7 +272,7 @@ Signed-off-by: Sriram R ac = skb_get_queue_mapping(skb); tx->sta->deflink.tx_stats.bytes[ac] += skb->len; } -@@ -2877,7 +2889,9 @@ static struct sk_buff *ieee80211_build_h +@@ -2876,7 +2888,9 @@ static struct sk_buff *ieee80211_build_h if (unlikely(!multicast && ((skb->sk && skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS) || @@ -283,7 +283,7 @@ Signed-off-by: Sriram R info_id = ieee80211_store_ack_skb(local, skb, &info_flags, cookie); -@@ -4666,7 +4680,8 @@ static void ieee80211_8023_xmit(struct i +@@ -4665,7 +4679,8 @@ static void ieee80211_8023_xmit(struct i } if (unlikely(skb->sk && @@ -293,7 +293,7 @@ Signed-off-by: Sriram R info->status_data = ieee80211_store_ack_skb(local, skb, &info->flags, NULL); if (info->status_data) -@@ -4674,8 +4689,10 @@ static void ieee80211_8023_xmit(struct i +@@ -4673,8 +4688,10 @@ static void ieee80211_8023_xmit(struct i } dev_sw_netstats_tx_add(dev, skbs, len); @@ -308,7 +308,7 @@ Signed-off-by: Sriram R --- a/net/wireless/util.c +++ b/net/wireless/util.c -@@ -2627,6 +2627,9 @@ bool cfg80211_does_bw_fit_range(const st +@@ -2631,6 +2631,9 @@ bool cfg80211_does_bw_fit_range(const st int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp) { @@ -320,7 +320,7 @@ Signed-off-by: Sriram R gfp); --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2676,7 +2676,7 @@ static int ieee80211_change_bss(struct w +@@ -2695,7 +2695,7 @@ static int ieee80211_change_bss(struct w struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_link_data *link; struct ieee80211_supported_band *sband; @@ -329,7 +329,7 @@ Signed-off-by: Sriram R link = ieee80211_link_or_deflink(sdata, params->link_id, true); if (IS_ERR(link)) -@@ -2726,6 +2726,8 @@ static int ieee80211_change_bss(struct w +@@ -2745,6 +2745,8 @@ static int ieee80211_change_bss(struct w sdata->flags |= IEEE80211_SDATA_DONT_BRIDGE_PACKETS; else sdata->flags &= ~IEEE80211_SDATA_DONT_BRIDGE_PACKETS; @@ -338,7 +338,7 @@ Signed-off-by: Sriram R ieee80211_check_fast_rx_iface(sdata); } -@@ -2754,6 +2756,8 @@ static int ieee80211_change_bss(struct w +@@ -2773,6 +2775,8 @@ static int ieee80211_change_bss(struct w ieee80211_link_info_change_notify(sdata, link, changed); @@ -375,7 +375,7 @@ Signed-off-by: Sriram R { --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -1842,6 +1842,8 @@ void ieee80211_vif_cfg_change_notify(str +@@ -1860,6 +1860,8 @@ void ieee80211_vif_cfg_change_notify(str void ieee80211_link_info_change_notify(struct ieee80211_sub_if_data *sdata, struct ieee80211_link_data *link, u64 changed); @@ -386,7 +386,7 @@ Signed-off-by: Sriram R --- a/net/mac80211/trace.h +++ b/net/mac80211/trace.h -@@ -412,6 +412,38 @@ TRACE_EVENT(drv_config, +@@ -421,6 +421,38 @@ TRACE_EVENT(drv_config, LOCAL_PR_ARG, __entry->changed, CHANDEF_PR_ARG ) ); @@ -427,7 +427,7 @@ Signed-off-by: Sriram R TP_PROTO(struct ieee80211_local *local, --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c -@@ -982,7 +982,8 @@ static bool ieee80211_set_sdata_offload_ +@@ -984,7 +984,8 @@ static bool ieee80211_set_sdata_offload_ local->hw.wiphy->frag_threshold != (u32)-1) flags &= ~IEEE80211_OFFLOAD_ENCAP_ENABLED; diff --git a/package/kernel/mac80211/patches/nss/subsys/199-mac80211-fix-xmit-callback-when-hwencap-enable-in-st.patch b/package/kernel/mac80211/patches/nss/subsys/199-mac80211-fix-xmit-callback-when-hwencap-enable-in-st.patch index 0a1afb841e2..7ae59db8cf1 100644 --- a/package/kernel/mac80211/patches/nss/subsys/199-mac80211-fix-xmit-callback-when-hwencap-enable-in-st.patch +++ b/package/kernel/mac80211/patches/nss/subsys/199-mac80211-fix-xmit-callback-when-hwencap-enable-in-st.patch @@ -18,7 +18,7 @@ Signed-off-by: P Praneesh --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -6259,7 +6259,13 @@ int ieee80211_tx_control_port(struct wip +@@ -6260,7 +6260,13 @@ int ieee80211_tx_control_port(struct wip start_xmit: local_bh_disable(); diff --git a/package/kernel/mac80211/patches/nss/subsys/203-mac80211-ath11k-fw-dynamic-muedca.patch b/package/kernel/mac80211/patches/nss/subsys/203-mac80211-ath11k-fw-dynamic-muedca.patch index b9d8021040f..c5e8e270486 100644 --- a/package/kernel/mac80211/patches/nss/subsys/203-mac80211-ath11k-fw-dynamic-muedca.patch +++ b/package/kernel/mac80211/patches/nss/subsys/203-mac80211-ath11k-fw-dynamic-muedca.patch @@ -31,7 +31,7 @@ Signed-off-by: Muna Sinada --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h -@@ -9574,4 +9574,15 @@ ssize_t wiphy_locked_debugfs_write(struc +@@ -9701,4 +9701,15 @@ ssize_t wiphy_locked_debugfs_write(struc void *data); #endif @@ -49,7 +49,7 @@ Signed-off-by: Muna Sinada #endif /* __NET_CFG80211_H */ --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -7506,6 +7506,20 @@ u32 ieee80211_calc_rx_airtime(struct iee +@@ -7561,6 +7561,20 @@ u32 ieee80211_calc_rx_airtime(struct iee int len); /** @@ -72,7 +72,7 @@ Signed-off-by: Muna Sinada * This function calculates the estimated airtime usage of a frame based on the --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h -@@ -1334,6 +1334,10 @@ +@@ -1329,6 +1329,10 @@ * %NL80211_ATTR_MLO_TTLM_ULINK attributes are used to specify the * TID to Link mapping for downlink/uplink traffic. * @@ -83,7 +83,7 @@ Signed-off-by: Muna Sinada * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use */ -@@ -1591,6 +1595,7 @@ enum nl80211_commands { +@@ -1586,6 +1590,7 @@ enum nl80211_commands { NL80211_CMD_SET_TID_TO_LINK_MAPPING, @@ -111,7 +111,7 @@ Signed-off-by: Muna Sinada __NL80211_ATTR_AFTER_LAST, --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c -@@ -8727,3 +8727,15 @@ void ieee80211_disable_rssi_reports(stru +@@ -9341,3 +9341,15 @@ void ieee80211_disable_rssi_reports(stru _ieee80211_enable_rssi_reports(sdata, 0, 0); } EXPORT_SYMBOL(ieee80211_disable_rssi_reports); @@ -129,7 +129,7 @@ Signed-off-by: Muna Sinada +EXPORT_SYMBOL(ieee80211_update_muedca_params); --- a/net/mac80211/trace.h +++ b/net/mac80211/trace.h -@@ -3125,6 +3125,26 @@ TRACE_EVENT(stop_queue, +@@ -3134,6 +3134,26 @@ TRACE_EVENT(stop_queue, ) ); @@ -158,7 +158,7 @@ Signed-off-by: Muna Sinada struct ieee80211_sub_if_data *sdata, --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -820,6 +820,7 @@ static const struct nla_policy nl80211_p +@@ -825,6 +825,7 @@ static const struct nla_policy nl80211_p [NL80211_ATTR_HW_TIMESTAMP_ENABLED] = { .type = NLA_FLAG }, [NL80211_ATTR_EMA_RNR_ELEMS] = { .type = NLA_NESTED }, [NL80211_ATTR_MLO_LINK_DISABLED] = { .type = NLA_FLAG }, @@ -166,7 +166,7 @@ Signed-off-by: Muna Sinada [NL80211_ATTR_BSS_DUMP_INCLUDE_USE_DATA] = { .type = NLA_FLAG }, [NL80211_ATTR_MLO_TTLM_DLINK] = NLA_POLICY_EXACT_LEN(sizeof(u16) * 8), [NL80211_ATTR_MLO_TTLM_ULINK] = NLA_POLICY_EXACT_LEN(sizeof(u16) * 8), -@@ -20314,6 +20315,42 @@ void cfg80211_schedule_channels_check(st +@@ -20396,6 +20397,42 @@ void cfg80211_schedule_channels_check(st } EXPORT_SYMBOL(cfg80211_schedule_channels_check); @@ -211,7 +211,7 @@ Signed-off-by: Muna Sinada int __init nl80211_init(void) --- a/net/wireless/trace.h +++ b/net/wireless/trace.h -@@ -3809,6 +3809,46 @@ TRACE_EVENT(cfg80211_update_owe_info_eve +@@ -3975,6 +3975,46 @@ TRACE_EVENT(cfg80211_update_owe_info_eve __entry->assoc_link_id, __entry->peer_mld_addr) ); diff --git a/package/kernel/mac80211/patches/nss/subsys/207-ath11k-Add-support-for-dynamic-vlan.patch b/package/kernel/mac80211/patches/nss/subsys/207-ath11k-Add-support-for-dynamic-vlan.patch index ab75fef4e52..03d6e9db15b 100644 --- a/package/kernel/mac80211/patches/nss/subsys/207-ath11k-Add-support-for-dynamic-vlan.patch +++ b/package/kernel/mac80211/patches/nss/subsys/207-ath11k-Add-support-for-dynamic-vlan.patch @@ -29,7 +29,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran /* misc utils */ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, -@@ -4293,6 +4296,8 @@ void __ieee80211_subif_start_xmit(struct +@@ -4292,6 +4295,8 @@ void __ieee80211_subif_start_xmit(struct struct sta_info *sta; struct sk_buff *next; int len = skb->len; @@ -38,7 +38,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran if (unlikely(!ieee80211_sdata_running(sdata) || skb->len < ETH_HLEN)) { kfree_skb(skb); -@@ -4314,6 +4319,19 @@ void __ieee80211_subif_start_xmit(struct +@@ -4313,6 +4318,19 @@ void __ieee80211_subif_start_xmit(struct if (IS_ERR(sta)) sta = NULL; diff --git a/package/kernel/mac80211/patches/nss/subsys/207-mac80211-add-nss-redirect-support.patch b/package/kernel/mac80211/patches/nss/subsys/207-mac80211-add-nss-redirect-support.patch index 32a4f78e870..63b2f9e9546 100644 --- a/package/kernel/mac80211/patches/nss/subsys/207-mac80211-add-nss-redirect-support.patch +++ b/package/kernel/mac80211/patches/nss/subsys/207-mac80211-add-nss-redirect-support.patch @@ -30,7 +30,7 @@ Signed-off-by: Sowmiya Sree Elavalagan --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -34,6 +34,9 @@ +@@ -35,6 +35,9 @@ #include "sta_info.h" #include "debug.h" #include "drop.h" @@ -40,7 +40,7 @@ Signed-off-by: Sowmiya Sree Elavalagan extern const struct cfg80211_ops mac80211_config_ops; -@@ -1171,6 +1174,9 @@ struct ieee80211_sub_if_data { +@@ -1185,6 +1188,9 @@ struct ieee80211_sub_if_data { struct dentry *default_beacon_key; } debugfs; #endif @@ -65,7 +65,7 @@ Signed-off-by: Sowmiya Sree Elavalagan /** * DOC: Interface list locking * -@@ -763,6 +769,13 @@ static int ieee80211_stop(struct net_dev +@@ -774,6 +780,13 @@ static int ieee80211_stop(struct net_dev ieee80211_stop_mbssid(sdata); } @@ -79,7 +79,7 @@ Signed-off-by: Sowmiya Sree Elavalagan wiphy_lock(sdata->local->hw.wiphy); wiphy_work_cancel(sdata->local->hw.wiphy, &sdata->activate_links_work); -@@ -1217,6 +1230,34 @@ void ieee80211_del_virtual_monitor(struc +@@ -1219,6 +1232,34 @@ void ieee80211_del_virtual_monitor(struc kfree(sdata); } @@ -114,7 +114,7 @@ Signed-off-by: Sowmiya Sree Elavalagan /* * NOTE: Be very careful when changing this function, it must NOT return * an error on interface type changes that have been pre-checked, so most -@@ -1444,6 +1485,21 @@ int ieee80211_do_open(struct wireless_de +@@ -1446,6 +1487,21 @@ int ieee80211_do_open(struct wireless_de ieee80211_recalc_ps(local); @@ -217,7 +217,7 @@ Signed-off-by: Sowmiya Sree Elavalagan --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -4526,6 +4526,35 @@ static void ieee80211_mlo_multicast_tx(s +@@ -4525,6 +4525,35 @@ static void ieee80211_mlo_multicast_tx(s kfree_skb(skb); } @@ -253,7 +253,7 @@ Signed-off-by: Sowmiya Sree Elavalagan /** * ieee80211_subif_start_xmit - netif start_xmit function for 802.3 vifs * @skb: packet to be sent -@@ -4541,6 +4570,10 @@ netdev_tx_t ieee80211_subif_start_xmit(s +@@ -4540,6 +4569,10 @@ netdev_tx_t ieee80211_subif_start_xmit(s struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); const struct ethhdr *eth = (void *)skb->data; @@ -264,7 +264,7 @@ Signed-off-by: Sowmiya Sree Elavalagan if (likely(!is_multicast_ether_addr(eth->h_dest))) goto normal; -@@ -4730,6 +4763,9 @@ netdev_tx_t ieee80211_subif_start_xmit_8 +@@ -4729,6 +4762,9 @@ netdev_tx_t ieee80211_subif_start_xmit_8 struct ieee80211_key *key; struct sta_info *sta; diff --git a/package/kernel/mac80211/patches/nss/subsys/235-001-mac80211-add-AP_VLAN-iftype-support-on-NSS-offload-case.patch b/package/kernel/mac80211/patches/nss/subsys/235-001-mac80211-add-AP_VLAN-iftype-support-on-NSS-offload-case.patch index 77e7c3b637e..92f6c120a63 100644 --- a/package/kernel/mac80211/patches/nss/subsys/235-001-mac80211-add-AP_VLAN-iftype-support-on-NSS-offload-case.patch +++ b/package/kernel/mac80211/patches/nss/subsys/235-001-mac80211-add-AP_VLAN-iftype-support-on-NSS-offload-case.patch @@ -21,7 +21,7 @@ Signed-off-by: Sathishkumar Muruganandam --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -5234,6 +5234,17 @@ void ieee80211_sta_pspoll(struct ieee802 +@@ -5271,6 +5271,17 @@ void ieee80211_sta_pspoll(struct ieee802 */ void ieee80211_sta_uapsd_trigger(struct ieee80211_sta *sta, u8 tid); @@ -41,7 +41,7 @@ Signed-off-by: Sathishkumar Muruganandam * This is enough for the radiotap header. --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2189,7 +2189,13 @@ static int ieee80211_change_station(stru +@@ -2208,7 +2208,13 @@ static int ieee80211_change_station(stru rcu_assign_pointer(vlansdata->u.vlan.sta, sta); __ieee80211_check_fast_rx_iface(vlansdata); @@ -73,7 +73,7 @@ Signed-off-by: Sathishkumar Muruganandam trace_drv_add_interface(local, sdata); --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c -@@ -686,6 +686,9 @@ static void ieee80211_do_stop(struct iee +@@ -697,6 +697,9 @@ static void ieee80211_do_stop(struct iee switch (sdata->vif.type) { case NL80211_IFTYPE_AP_VLAN: @@ -83,7 +83,7 @@ Signed-off-by: Sathishkumar Muruganandam break; case NL80211_IFTYPE_MONITOR: if (local->monitors == 0) -@@ -973,6 +976,7 @@ static bool ieee80211_iftype_supports_hd +@@ -975,6 +978,7 @@ static bool ieee80211_iftype_supports_hd switch (iftype) { /* P2P GO and client are mapped to AP/STATION types */ case NL80211_IFTYPE_AP: @@ -91,7 +91,7 @@ Signed-off-by: Sathishkumar Muruganandam case NL80211_IFTYPE_STATION: return true; default: -@@ -1027,7 +1031,8 @@ static void ieee80211_set_vif_encap_ops( +@@ -1029,7 +1033,8 @@ static void ieee80211_set_vif_encap_ops( struct ieee80211_sub_if_data *bss = sdata; bool enabled; @@ -101,7 +101,7 @@ Signed-off-by: Sathishkumar Muruganandam if (!sdata->bss) return; -@@ -1353,10 +1358,17 @@ int ieee80211_do_open(struct wireless_de +@@ -1355,10 +1360,17 @@ int ieee80211_do_open(struct wireless_de switch (sdata->vif.type) { case NL80211_IFTYPE_AP_VLAN: @@ -137,7 +137,7 @@ Signed-off-by: Sathishkumar Muruganandam { --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -4320,8 +4320,11 @@ void __ieee80211_subif_start_xmit(struct +@@ -4319,8 +4319,11 @@ void __ieee80211_subif_start_xmit(struct sta = NULL; if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { @@ -151,7 +151,7 @@ Signed-off-by: Sathishkumar Muruganandam if (ap_sdata->vif.offload_flags & IEEE80211_OFFLOAD_ENCAP_ENABLED && !is_multicast_ether_addr(skb->data)) { if (sta) -@@ -4713,7 +4716,8 @@ static void ieee80211_8023_xmit(struct i +@@ -4712,7 +4715,8 @@ static void ieee80211_8023_xmit(struct i info->hw_queue = sdata->vif.hw_queue[queue]; @@ -163,7 +163,7 @@ Signed-off-by: Sathishkumar Muruganandam --- a/net/mac80211/util.c +++ b/net/mac80211/util.c -@@ -1664,6 +1664,9 @@ static void ieee80211_assign_chanctx(str +@@ -1668,6 +1668,9 @@ static void ieee80211_assign_chanctx(str lockdep_assert_wiphy(local->hw.wiphy); @@ -173,7 +173,7 @@ Signed-off-by: Sathishkumar Muruganandam conf = rcu_dereference_protected(link->conf->chanctx_conf, lockdep_is_held(&local->hw.wiphy->mtx)); if (conf) { -@@ -1869,7 +1872,8 @@ int ieee80211_reconfig(struct ieee80211_ +@@ -1873,7 +1876,8 @@ int ieee80211_reconfig(struct ieee80211_ } list_for_each_entry(sdata, &local->interfaces, list) { @@ -183,7 +183,7 @@ Signed-off-by: Sathishkumar Muruganandam sdata->vif.type != NL80211_IFTYPE_MONITOR && ieee80211_sdata_running(sdata)) { res = drv_add_interface(local, sdata); -@@ -1884,7 +1888,8 @@ int ieee80211_reconfig(struct ieee80211_ +@@ -1888,7 +1892,8 @@ int ieee80211_reconfig(struct ieee80211_ if (res) { list_for_each_entry_continue_reverse(sdata, &local->interfaces, list) @@ -195,7 +195,7 @@ Signed-off-by: Sathishkumar Muruganandam drv_remove_interface(local, sdata); --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c -@@ -5297,7 +5297,8 @@ static bool ieee80211_assoc_success(stru +@@ -5700,7 +5700,8 @@ static bool ieee80211_assoc_success(stru * If we're using 4-addr mode, let the AP know that we're * doing so, so that it can create the STA VLAN on its side */ diff --git a/package/kernel/mac80211/patches/nss/subsys/236-001-mac80211-add-dynamic-VLAN-support-on-NSS-offload.patch b/package/kernel/mac80211/patches/nss/subsys/236-001-mac80211-add-dynamic-VLAN-support-on-NSS-offload.patch index fd5d052ce14..3795dcf9ac2 100644 --- a/package/kernel/mac80211/patches/nss/subsys/236-001-mac80211-add-dynamic-VLAN-support-on-NSS-offload.patch +++ b/package/kernel/mac80211/patches/nss/subsys/236-001-mac80211-add-dynamic-VLAN-support-on-NSS-offload.patch @@ -24,7 +24,7 @@ Signed-off-by: Sathishkumar Muruganandam --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -2184,6 +2184,8 @@ enum ieee80211_key_flags { +@@ -2228,6 +2228,8 @@ enum ieee80211_key_flags { * @tx_pn: PN used for TX keys, may be used by the driver as well if it * needs to do software PN assignment by itself (e.g. due to TSO) * @flags: key flags, see &enum ieee80211_key_flags. @@ -33,7 +33,7 @@ Signed-off-by: Sathishkumar Muruganandam * @keyidx: the key index (0-3) * @keylen: key material length * @key: key material. For ALG_TKIP the key is encoded as a 256-bit (32 byte) -@@ -2203,6 +2205,7 @@ struct ieee80211_key_conf { +@@ -2247,6 +2249,7 @@ struct ieee80211_key_conf { u8 hw_key_idx; s8 keyidx; u16 flags; @@ -102,7 +102,7 @@ Signed-off-by: Sathishkumar Muruganandam key->conf.cipher = cipher; --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -4672,16 +4672,25 @@ static void ieee80211_8023_xmit(struct i +@@ -4671,16 +4671,25 @@ static void ieee80211_8023_xmit(struct i struct ieee80211_key *key, struct sk_buff *skb) { struct ieee80211_tx_info *info; diff --git a/package/kernel/mac80211/patches/nss/subsys/245-compilation_fix.patch b/package/kernel/mac80211/patches/nss/subsys/245-compilation_fix.patch index 427b1aa264a..43bef1ef8c4 100644 --- a/package/kernel/mac80211/patches/nss/subsys/245-compilation_fix.patch +++ b/package/kernel/mac80211/patches/nss/subsys/245-compilation_fix.patch @@ -20,7 +20,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -216,6 +216,7 @@ enum ieee80211_rx_flags { +@@ -218,6 +218,7 @@ enum ieee80211_rx_flags { }; struct ieee80211_rx_data { @@ -30,7 +30,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran struct ieee80211_local *local; --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -4701,19 +4701,21 @@ static void ieee80211_8023_xmit(struct i +@@ -4700,19 +4700,21 @@ static void ieee80211_8023_xmit(struct i ieee80211_aggr_check(sdata, sta, skb); @@ -64,7 +64,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran } skb = ieee80211_tx_skb_fixup(skb, ieee80211_sdata_netdev_features(sdata)); -@@ -4773,7 +4775,7 @@ netdev_tx_t ieee80211_subif_start_xmit_8 +@@ -4772,7 +4774,7 @@ netdev_tx_t ieee80211_subif_start_xmit_8 { struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ethhdr *ehdr = (struct ethhdr *)skb->data; @@ -73,7 +73,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran struct sta_info *sta; #ifdef CPTCFG_MAC80211_NSS_SUPPORT -@@ -4791,9 +4793,13 @@ netdev_tx_t ieee80211_subif_start_xmit_8 +@@ -4790,9 +4792,13 @@ netdev_tx_t ieee80211_subif_start_xmit_8 goto out; } @@ -90,7 +90,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran goto skip_offload; key = rcu_dereference(sta->ptk[sta->ptk_idx]); -@@ -4804,6 +4810,7 @@ netdev_tx_t ieee80211_subif_start_xmit_8 +@@ -4803,6 +4809,7 @@ netdev_tx_t ieee80211_subif_start_xmit_8 goto skip_offload; sk_pacing_shift_update(skb->sk, sdata->local->hw.tx_sk_pacing_shift); @@ -98,7 +98,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran ieee80211_8023_xmit(sdata, dev, sta, key, skb); goto out; -@@ -6326,13 +6333,7 @@ int ieee80211_tx_control_port(struct wip +@@ -6327,13 +6334,7 @@ int ieee80211_tx_control_port(struct wip start_xmit: local_bh_disable(); diff --git a/package/kernel/mac80211/patches/nss/subsys/300-ath11k-nss-mesh-offload-support.patch b/package/kernel/mac80211/patches/nss/subsys/300-ath11k-nss-mesh-offload-support.patch index 0915c24550c..d1140193157 100644 --- a/package/kernel/mac80211/patches/nss/subsys/300-ath11k-nss-mesh-offload-support.patch +++ b/package/kernel/mac80211/patches/nss/subsys/300-ath11k-nss-mesh-offload-support.patch @@ -48,7 +48,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran /** * enum ieee80211_max_queues - maximum number of queues * -@@ -411,11 +414,17 @@ enum ieee80211_bss_change { +@@ -413,11 +416,17 @@ enum ieee80211_bss_change { * to indicate which NSS BSS parameter changed. * * @BSS_CHANGED_NSS_AP_ISOLATE: AP Isolate feature in NSS mode @@ -66,7 +66,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran }; /* -@@ -809,6 +818,11 @@ struct ieee80211_bss_conf { +@@ -847,6 +856,11 @@ struct ieee80211_bss_conf { bool he_full_ul_mumimo; bool eht_su_beamformer; bool eht_su_beamformee; @@ -76,9 +76,9 @@ Signed-off-by: Gautham Kumar Senthilkumaran + bool nss_offld_mesh_forward_enabled; + u32 nss_offld_mpath_refresh_time; bool eht_mu_beamformer; + bool eht_80mhz_full_bw_ul_mumimo; bool nss_ap_isolate; - }; -@@ -1302,6 +1316,8 @@ struct ieee80211_rate_status { +@@ -1342,6 +1356,8 @@ struct ieee80211_rate_status { * @ack_hwtstamp: Hardware timestamp of the received ack in nanoseconds * Only needed for Timing measurement and Fine timing measurement action * frames. Only reported by devices that have timestamping enabled. @@ -87,7 +87,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran */ struct ieee80211_tx_status { struct ieee80211_sta *sta; -@@ -1312,6 +1328,8 @@ struct ieee80211_tx_status { +@@ -1352,6 +1368,8 @@ struct ieee80211_tx_status { u8 n_rates; struct list_head *free_list; @@ -96,7 +96,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran }; /** -@@ -1820,6 +1838,7 @@ struct ieee80211_channel_switch { +@@ -1860,6 +1878,7 @@ struct ieee80211_channel_switch { * operation on this interface and request a channel context without * the AP definition. Use this e.g. because the device is able to * handle OFDMA (downlink and trigger for uplink) on a per-AP basis. @@ -104,7 +104,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran */ enum ieee80211_vif_flags { IEEE80211_VIF_BEACON_FILTER = BIT(0), -@@ -1828,6 +1847,7 @@ enum ieee80211_vif_flags { +@@ -1868,6 +1887,7 @@ enum ieee80211_vif_flags { IEEE80211_VIF_GET_NOA_UPDATE = BIT(3), IEEE80211_VIF_EML_ACTIVE = BIT(4), IEEE80211_VIF_IGNORE_OFDMA_WIDER_BW = BIT(5), @@ -112,15 +112,15 @@ Signed-off-by: Gautham Kumar Senthilkumaran }; -@@ -2879,6 +2899,7 @@ enum ieee80211_hw_flags { - IEEE80211_HW_DISALLOW_PUNCTURING, +@@ -2917,6 +2937,7 @@ enum ieee80211_hw_flags { + IEEE80211_HW_DISALLOW_PUNCTURING_5GHZ, IEEE80211_HW_HANDLES_QUIET_CSA, IEEE80211_HW_SUPPORTS_NSS_OFFLOAD, + IEEE80211_HW_SUPPORTS_MESH_NSS_OFFLOAD, /* keep last, obviously */ NUM_IEEE80211_HW_FLAGS -@@ -4388,6 +4409,8 @@ struct ieee80211_prep_tx_info { +@@ -4425,6 +4446,8 @@ struct ieee80211_prep_tx_info { * @set_sar_specs: Update the SAR (TX power) settings. * @sta_set_decap_offload: Called to notify the driver when a station is allowed * to use rx decapsulation offload @@ -129,7 +129,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran * @add_twt_setup: Update hw with TWT agreement parameters received from the peer. * This callback allows the hw to check if requested parameters * are supported and if there is enough room for a new agreement. -@@ -4782,6 +4805,12 @@ struct ieee80211_ops { +@@ -4819,6 +4842,12 @@ struct ieee80211_ops { void (*sta_set_decap_offload)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, bool enabled); @@ -142,7 +142,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran void (*add_twt_setup)(struct ieee80211_hw *hw, struct ieee80211_sta *sta, struct ieee80211_twt_setup *twt); -@@ -7667,4 +7696,100 @@ int ieee80211_emulate_switch_vif_chanctx +@@ -7726,4 +7755,100 @@ int ieee80211_emulate_switch_vif_chanctx int n_vifs, enum ieee80211_chanctx_switch_mode mode); @@ -245,7 +245,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran #endif /* MAC80211_H */ --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2519,6 +2519,7 @@ static int ieee80211_update_mesh_config( +@@ -2538,6 +2538,7 @@ static int ieee80211_update_mesh_config( struct mesh_config *conf; struct ieee80211_sub_if_data *sdata; struct ieee80211_if_mesh *ifmsh; @@ -253,7 +253,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran sdata = IEEE80211_DEV_TO_SUB_IF(dev); ifmsh = &sdata->u.mesh; -@@ -2535,8 +2536,11 @@ static int ieee80211_update_mesh_config( +@@ -2554,8 +2555,11 @@ static int ieee80211_update_mesh_config( conf->dot11MeshMaxPeerLinks = nconf->dot11MeshMaxPeerLinks; if (_chg_mesh_attr(NL80211_MESHCONF_MAX_RETRIES, mask)) conf->dot11MeshMaxRetries = nconf->dot11MeshMaxRetries; @@ -266,7 +266,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran if (_chg_mesh_attr(NL80211_MESHCONF_ELEMENT_TTL, mask)) conf->element_ttl = nconf->element_ttl; if (_chg_mesh_attr(NL80211_MESHCONF_AUTO_OPEN_PLINKS, mask)) { -@@ -2550,8 +2554,12 @@ static int ieee80211_update_mesh_config( +@@ -2569,8 +2573,12 @@ static int ieee80211_update_mesh_config( if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, mask)) conf->dot11MeshHWMPmaxPREQretries = nconf->dot11MeshHWMPmaxPREQretries; @@ -280,7 +280,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran if (_chg_mesh_attr(NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT, mask)) conf->min_discovery_timeout = nconf->min_discovery_timeout; if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, mask)) -@@ -2586,8 +2594,12 @@ static int ieee80211_update_mesh_config( +@@ -2605,8 +2613,12 @@ static int ieee80211_update_mesh_config( if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_RANN_INTERVAL, mask)) conf->dot11MeshHWMPRannInterval = nconf->dot11MeshHWMPRannInterval; @@ -294,7 +294,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran if (_chg_mesh_attr(NL80211_MESHCONF_RSSI_THRESHOLD, mask)) { /* our RSSI threshold implementation is supported only for * devices that report signal in dBm. -@@ -2629,6 +2641,7 @@ static int ieee80211_update_mesh_config( +@@ -2648,6 +2660,7 @@ static int ieee80211_update_mesh_config( conf->dot11MeshConnectedToAuthServer = nconf->dot11MeshConnectedToAuthServer; ieee80211_mbss_info_change_notify(sdata, BSS_CHANGED_BEACON); @@ -331,7 +331,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran --- a/net/mac80211/debugfs.c +++ b/net/mac80211/debugfs.c @@ -509,6 +509,7 @@ static const char *hw_flag_names[] = { - FLAG(DISALLOW_PUNCTURING), + FLAG(DISALLOW_PUNCTURING_5GHZ), FLAG(HANDLES_QUIET_CSA), FLAG(SUPPORTS_NSS_OFFLOAD), + FLAG(SUPPORTS_MESH_NSS_OFFLOAD), @@ -1193,7 +1193,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran if (!is_multicast_ether_addr(skb->data)) { struct sta_info *next_hop; bool mpp_lookup = true; -@@ -2974,6 +2984,9 @@ static struct sk_buff *ieee80211_build_h +@@ -2973,6 +2983,9 @@ static struct sk_buff *ieee80211_build_h skb_reset_mac_header(skb); @@ -1203,7 +1203,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran info = IEEE80211_SKB_CB(skb); memset(info, 0, sizeof(*info)); -@@ -4297,6 +4310,7 @@ void __ieee80211_subif_start_xmit(struct +@@ -4296,6 +4309,7 @@ void __ieee80211_subif_start_xmit(struct struct sk_buff *next; int len = skb->len; struct ieee80211_key *key = NULL; @@ -1211,7 +1211,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran struct ieee80211_sub_if_data *ap_sdata; if (unlikely(!ieee80211_sdata_running(sdata) || skb->len < ETH_HLEN)) { -@@ -4371,9 +4385,15 @@ void __ieee80211_subif_start_xmit(struct +@@ -4370,9 +4384,15 @@ void __ieee80211_subif_start_xmit(struct goto out; } @@ -1232,7 +1232,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran out_free: --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h -@@ -1737,4 +1737,10 @@ drv_can_neg_ttlm(struct ieee80211_local +@@ -1749,4 +1749,10 @@ drv_can_neg_ttlm(struct ieee80211_local return res; } diff --git a/package/kernel/mac80211/patches/nss/subsys/335-0003-ath11k-skip-HAL_TCL_DATA_CMD_INFO2_TID_OVERWRITE-con.patch b/package/kernel/mac80211/patches/nss/subsys/335-0003-ath11k-skip-HAL_TCL_DATA_CMD_INFO2_TID_OVERWRITE-con.patch index 81b4e1b2474..1adf62f35f9 100644 --- a/package/kernel/mac80211/patches/nss/subsys/335-0003-ath11k-skip-HAL_TCL_DATA_CMD_INFO2_TID_OVERWRITE-con.patch +++ b/package/kernel/mac80211/patches/nss/subsys/335-0003-ath11k-skip-HAL_TCL_DATA_CMD_INFO2_TID_OVERWRITE-con.patch @@ -16,7 +16,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -2839,6 +2839,8 @@ struct ieee80211_txq { +@@ -2877,6 +2877,8 @@ struct ieee80211_txq { * * @IEEE80211_HW_SUPPORTS_NSS_OFFLOAD: Hardware/driver supports NSS offload * @@ -25,7 +25,7 @@ Signed-off-by: Gautham Kumar Senthilkumaran * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays */ enum ieee80211_hw_flags { -@@ -2900,6 +2902,7 @@ enum ieee80211_hw_flags { +@@ -2938,6 +2940,7 @@ enum ieee80211_hw_flags { IEEE80211_HW_HANDLES_QUIET_CSA, IEEE80211_HW_SUPPORTS_NSS_OFFLOAD, IEEE80211_HW_SUPPORTS_MESH_NSS_OFFLOAD, diff --git a/package/kernel/mac80211/patches/nss/subsys/335-0005-mac80211-simple-tx-for-AP-mode.patch b/package/kernel/mac80211/patches/nss/subsys/335-0005-mac80211-simple-tx-for-AP-mode.patch index 5a5b7906083..f69088b2540 100644 --- a/package/kernel/mac80211/patches/nss/subsys/335-0005-mac80211-simple-tx-for-AP-mode.patch +++ b/package/kernel/mac80211/patches/nss/subsys/335-0005-mac80211-simple-tx-for-AP-mode.patch @@ -14,7 +14,7 @@ Signed-off-by: Aloka Dixit --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -4790,6 +4790,67 @@ out_free: +@@ -4789,6 +4789,67 @@ out_free: kfree_skb(skb); } @@ -82,7 +82,7 @@ Signed-off-by: Aloka Dixit netdev_tx_t ieee80211_subif_start_xmit_8023(struct sk_buff *skb, struct net_device *dev) { -@@ -4829,6 +4890,11 @@ netdev_tx_t ieee80211_subif_start_xmit_8 +@@ -4828,6 +4889,11 @@ netdev_tx_t ieee80211_subif_start_xmit_8 if (key && (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE))) goto skip_offload; diff --git a/package/kernel/mac80211/patches/nss/subsys/336-mac80211-Mesh-Fast-rx-support.patch b/package/kernel/mac80211/patches/nss/subsys/336-mac80211-Mesh-Fast-rx-support.patch index 3ea2eef1267..ba3b7211012 100644 --- a/package/kernel/mac80211/patches/nss/subsys/336-mac80211-Mesh-Fast-rx-support.patch +++ b/package/kernel/mac80211/patches/nss/subsys/336-mac80211-Mesh-Fast-rx-support.patch @@ -20,7 +20,7 @@ Signed-off-by: Sriram R --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -1759,6 +1759,8 @@ static void sta_apply_mesh_params(struct +@@ -1761,6 +1761,8 @@ static void sta_apply_mesh_params(struct /* init at low value */ ewma_mesh_tx_rate_avg_add(&sta->mesh->tx_rate_avg, 10); @@ -29,7 +29,7 @@ Signed-off-by: Sriram R break; case NL80211_PLINK_LISTEN: case NL80211_PLINK_BLOCKED: -@@ -1773,6 +1775,7 @@ static void sta_apply_mesh_params(struct +@@ -1775,6 +1777,7 @@ static void sta_apply_mesh_params(struct ieee80211_mps_sta_status_update(sta); changed |= ieee80211_mps_set_sta_local_pm(sta, NL80211_MESH_POWER_UNKNOWN); @@ -94,7 +94,7 @@ Signed-off-by: Sriram R if (action) { --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c -@@ -4713,10 +4713,15 @@ void ieee80211_check_fast_rx(struct sta_ +@@ -4717,10 +4717,15 @@ void ieee80211_check_fast_rx(struct sta_ break; case NL80211_IFTYPE_MESH_POINT: @@ -112,7 +112,7 @@ Signed-off-by: Sriram R break; default: goto clear; -@@ -4757,7 +4762,7 @@ void ieee80211_check_fast_rx(struct sta_ +@@ -4761,7 +4766,7 @@ void ieee80211_check_fast_rx(struct sta_ __release(check_fast_rx); if (assign) @@ -121,7 +121,7 @@ Signed-off-by: Sriram R offload_flags = get_bss_sdata(sdata)->vif.offload_flags; offload = offload_flags & IEEE80211_OFFLOAD_DECAP_ENABLED; -@@ -4939,6 +4944,10 @@ static bool ieee80211_invoke_fast_rx(str +@@ -4943,6 +4948,10 @@ static bool ieee80211_invoke_fast_rx(str u8 sa[ETH_ALEN]; } addrs __aligned(2); struct ieee80211_sta_rx_stats *stats; @@ -132,7 +132,7 @@ Signed-off-by: Sriram R /* for parallel-rx, we need to have DUP_VALIDATED, otherwise we write * to a common data structure; drivers can implement that per queue -@@ -4988,6 +4997,37 @@ static bool ieee80211_invoke_fast_rx(str +@@ -4992,6 +5001,37 @@ static bool ieee80211_invoke_fast_rx(str snap_offs += IEEE80211_CCMP_HDR_LEN; } @@ -170,7 +170,7 @@ Signed-off-by: Sriram R if (!ieee80211_vif_is_mesh(&rx->sdata->vif) && !(status->rx_flags & IEEE80211_RX_AMSDU)) { if (!pskb_may_pull(skb, snap_offs + sizeof(*payload))) -@@ -5025,9 +5065,33 @@ static bool ieee80211_invoke_fast_rx(str +@@ -5029,9 +5069,33 @@ static bool ieee80211_invoke_fast_rx(str return true; } diff --git a/package/kernel/mac80211/patches/nss/subsys/342-mac80211-fix-unconditional-sta-usage.patch b/package/kernel/mac80211/patches/nss/subsys/342-mac80211-fix-unconditional-sta-usage.patch index 941a2b77371..e87a824ab06 100644 --- a/package/kernel/mac80211/patches/nss/subsys/342-mac80211-fix-unconditional-sta-usage.patch +++ b/package/kernel/mac80211/patches/nss/subsys/342-mac80211-fix-unconditional-sta-usage.patch @@ -33,7 +33,7 @@ Signed-off-by: Tamizh Chelvam --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -4721,7 +4721,7 @@ static void ieee80211_8023_xmit(struct i +@@ -4720,7 +4720,7 @@ static void ieee80211_8023_xmit(struct i ieee80211_aggr_check(sdata, sta, skb); @@ -42,7 +42,7 @@ Signed-off-by: Tamizh Chelvam tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]); if (tid_tx) { -@@ -4775,7 +4775,7 @@ static void ieee80211_8023_xmit(struct i +@@ -4774,7 +4774,7 @@ static void ieee80211_8023_xmit(struct i } dev_sw_netstats_tx_add(dev, skbs, len); diff --git a/package/kernel/mac80211/patches/nss/subsys/353-mac80211-fix-dynamic-vlan-warning-with-monitor-interface-restart.patch b/package/kernel/mac80211/patches/nss/subsys/353-mac80211-fix-dynamic-vlan-warning-with-monitor-interface-restart.patch index 6c6bca1b16f..15905c1090a 100644 --- a/package/kernel/mac80211/patches/nss/subsys/353-mac80211-fix-dynamic-vlan-warning-with-monitor-interface-restart.patch +++ b/package/kernel/mac80211/patches/nss/subsys/353-mac80211-fix-dynamic-vlan-warning-with-monitor-interface-restart.patch @@ -21,7 +21,7 @@ Signed-off-by: Nagarajan Maran --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c -@@ -1011,7 +1011,8 @@ static bool ieee80211_set_sdata_offload_ +@@ -1013,7 +1013,8 @@ static bool ieee80211_set_sdata_offload_ flags |= IEEE80211_OFFLOAD_DECAP_ENABLED; if (local->monitors && diff --git a/package/kernel/mac80211/patches/nss/subsys/640-006-01-mac80211-Remove-unused-RX_FLAGS-from-mac80211_rx_fla.patch b/package/kernel/mac80211/patches/nss/subsys/640-006-01-mac80211-Remove-unused-RX_FLAGS-from-mac80211_rx_fla.patch index 0cfa65742f9..c1b285366dd 100644 --- a/package/kernel/mac80211/patches/nss/subsys/640-006-01-mac80211-Remove-unused-RX_FLAGS-from-mac80211_rx_fla.patch +++ b/package/kernel/mac80211/patches/nss/subsys/640-006-01-mac80211-Remove-unused-RX_FLAGS-from-mac80211_rx_fla.patch @@ -14,7 +14,7 @@ Signed-off-by: P Praneesh --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -1442,8 +1442,6 @@ ieee80211_tx_info_clear_status(struct ie +@@ -1482,8 +1482,6 @@ ieee80211_tx_info_clear_status(struct ie * @RX_FLAG_AMPDU_IS_LAST: this subframe is the last subframe of the A-MPDU * @RX_FLAG_AMPDU_DELIM_CRC_ERROR: A delimiter CRC error has been detected * on this subframe @@ -23,7 +23,7 @@ Signed-off-by: P Praneesh * @RX_FLAG_MIC_STRIPPED: The mic was stripped of this packet. Decryption was * done by the hardware * @RX_FLAG_ONLY_MONITOR: Report frame only to monitor interfaces without -@@ -1500,39 +1498,38 @@ ieee80211_tx_info_clear_status(struct ie +@@ -1540,39 +1538,38 @@ ieee80211_tx_info_clear_status(struct ie * hardware or driver) */ enum mac80211_rx_flags { diff --git a/package/kernel/mac80211/patches/nss/subsys/657-mac80211-Avoid-encapsulation-of-EAPOL-frames-if-OFFL.patch b/package/kernel/mac80211/patches/nss/subsys/657-mac80211-Avoid-encapsulation-of-EAPOL-frames-if-OFFL.patch index 99feb3b6b05..3a034ac1c07 100644 --- a/package/kernel/mac80211/patches/nss/subsys/657-mac80211-Avoid-encapsulation-of-EAPOL-frames-if-OFFL.patch +++ b/package/kernel/mac80211/patches/nss/subsys/657-mac80211-Avoid-encapsulation-of-EAPOL-frames-if-OFFL.patch @@ -20,7 +20,7 @@ Signed-off-by: Aaradhana Sahu --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -2060,6 +2060,11 @@ netdev_tx_t ieee80211_subif_start_xmit(s +@@ -2081,6 +2081,11 @@ netdev_tx_t ieee80211_subif_start_xmit(s struct net_device *dev); netdev_tx_t ieee80211_subif_start_xmit_8023(struct sk_buff *skb, struct net_device *dev); @@ -44,7 +44,7 @@ Signed-off-by: Aaradhana Sahu /* misc utils */ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, -@@ -4343,7 +4344,7 @@ void __ieee80211_subif_start_xmit(struct +@@ -4342,7 +4343,7 @@ void __ieee80211_subif_start_xmit(struct !is_multicast_ether_addr(skb->data)) { if (sta) key = rcu_dereference(sta->ptk[sta->ptk_idx]); @@ -53,7 +53,7 @@ Signed-off-by: Aaradhana Sahu rcu_read_unlock(); return; } -@@ -4389,7 +4390,7 @@ void __ieee80211_subif_start_xmit(struct +@@ -4388,7 +4389,7 @@ void __ieee80211_subif_start_xmit(struct if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) { if (sta) key = rcu_dereference(sta->ptk[sta->ptk_idx]); @@ -62,7 +62,7 @@ Signed-off-by: Aaradhana Sahu } else { dev_sw_netstats_tx_add(dev, 1, skb->len); ieee80211_xmit(sdata, sta, skb); -@@ -4689,7 +4690,8 @@ static bool ieee80211_tx_8023(struct iee +@@ -4688,7 +4689,8 @@ static bool ieee80211_tx_8023(struct iee static void ieee80211_8023_xmit(struct ieee80211_sub_if_data *sdata, struct net_device *dev, struct sta_info *sta, @@ -72,7 +72,7 @@ Signed-off-by: Aaradhana Sahu { struct ieee80211_tx_info *info; struct ethhdr *ehdr = (struct ethhdr *)skb->data; -@@ -4745,6 +4747,7 @@ static void ieee80211_8023_xmit(struct i +@@ -4744,6 +4746,7 @@ static void ieee80211_8023_xmit(struct i info = IEEE80211_SKB_CB(skb); memset(info, 0, sizeof(*info)); @@ -80,7 +80,7 @@ Signed-off-by: Aaradhana Sahu info->hw_queue = sdata->vif.hw_queue[queue]; if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN && -@@ -4765,11 +4768,12 @@ static void ieee80211_8023_xmit(struct i +@@ -4764,11 +4767,12 @@ static void ieee80211_8023_xmit(struct i memcpy(IEEE80211_SKB_CB(seg), info, sizeof(*info)); } @@ -96,7 +96,7 @@ Signed-off-by: Aaradhana Sahu if (info->status_data) info->status_data_idr = 1; } -@@ -4792,7 +4796,8 @@ out_free: +@@ -4791,7 +4795,8 @@ out_free: void ieee80211_8023_xmit_ap(struct ieee80211_sub_if_data *sdata, struct net_device *dev, struct sta_info *sta, @@ -106,7 +106,7 @@ Signed-off-by: Aaradhana Sahu { struct ieee80211_tx_info *info; struct ieee80211_local *local = sdata->local; -@@ -4801,6 +4806,9 @@ void ieee80211_8023_xmit_ap(struct ieee8 +@@ -4800,6 +4805,9 @@ void ieee80211_8023_xmit_ap(struct ieee8 unsigned long flags; int q; u16 q_map; @@ -116,7 +116,7 @@ Signed-off-by: Aaradhana Sahu /* * If the skb is shared we need to obtain our own copy. -@@ -4812,11 +4820,13 @@ void ieee80211_8023_xmit_ap(struct ieee8 +@@ -4811,11 +4819,13 @@ void ieee80211_8023_xmit_ap(struct ieee8 info = IEEE80211_SKB_CB(skb); memset(info, 0, sizeof(*info)); @@ -133,7 +133,7 @@ Signed-off-by: Aaradhana Sahu info->flags |= IEEE80211_TX_CTL_HW_80211_ENCAP; info->control.vif = &sdata->vif; -@@ -4850,14 +4860,23 @@ void ieee80211_8023_xmit_ap(struct ieee8 +@@ -4849,14 +4859,23 @@ void ieee80211_8023_xmit_ap(struct ieee8 drv_tx(local, &control, skb); } @@ -158,7 +158,7 @@ Signed-off-by: Aaradhana Sahu #ifdef CPTCFG_MAC80211_NSS_SUPPORT ieee80211_xmit_nss_fixup(skb, dev); -@@ -4873,14 +4892,15 @@ netdev_tx_t ieee80211_subif_start_xmit_8 +@@ -4872,14 +4891,15 @@ netdev_tx_t ieee80211_subif_start_xmit_8 kfree_skb(skb); goto out; } @@ -176,7 +176,7 @@ Signed-off-by: Aaradhana Sahu goto skip_offload; key = rcu_dereference(sta->ptk[sta->ptk_idx]); -@@ -4891,13 +4911,13 @@ netdev_tx_t ieee80211_subif_start_xmit_8 +@@ -4890,13 +4910,13 @@ netdev_tx_t ieee80211_subif_start_xmit_8 goto skip_offload; if (sdata->vif.type == NL80211_IFTYPE_AP) { @@ -192,7 +192,7 @@ Signed-off-by: Aaradhana Sahu goto out; skip_offload: -@@ -6419,7 +6439,10 @@ int ieee80211_tx_control_port(struct wip +@@ -6420,7 +6440,10 @@ int ieee80211_tx_control_port(struct wip start_xmit: local_bh_disable(); diff --git a/package/kernel/mac80211/patches/nss/subsys/686-mac80211-fix-RCU-stall-in-mesh-fast-xmit-path.patch b/package/kernel/mac80211/patches/nss/subsys/686-mac80211-fix-RCU-stall-in-mesh-fast-xmit-path.patch index 3d15c53397f..03bdf150828 100644 --- a/package/kernel/mac80211/patches/nss/subsys/686-mac80211-fix-RCU-stall-in-mesh-fast-xmit-path.patch +++ b/package/kernel/mac80211/patches/nss/subsys/686-mac80211-fix-RCU-stall-in-mesh-fast-xmit-path.patch @@ -72,7 +72,7 @@ Signed-off-by: P Praneesh --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2346,7 +2346,7 @@ static void mpath_set_pinfo(struct mesh_ +@@ -2365,7 +2365,7 @@ static void mpath_set_pinfo(struct mesh_ if (mpath->flags & MESH_PATH_RESOLVED) pinfo->flags |= NL80211_MPATH_FLAG_RESOLVED; pinfo->hop_count = mpath->hop_count; diff --git a/package/kernel/mac80211/patches/nss/subsys/780-mac80211-Advertise-HW-checksum-offload-only-for-ethm.patch b/package/kernel/mac80211/patches/nss/subsys/780-mac80211-Advertise-HW-checksum-offload-only-for-ethm.patch index e4a9c645cf5..9243aff80d5 100644 --- a/package/kernel/mac80211/patches/nss/subsys/780-mac80211-Advertise-HW-checksum-offload-only-for-ethm.patch +++ b/package/kernel/mac80211/patches/nss/subsys/780-mac80211-Advertise-HW-checksum-offload-only-for-ethm.patch @@ -31,7 +31,7 @@ Signed-off-by: Tamizh Chelvam Raja static void ieee80211_8023_xmit(struct ieee80211_sub_if_data *sdata, struct net_device *dev, struct sta_info *sta, struct ieee80211_key *key, struct sk_buff *skb, -@@ -3658,7 +3660,7 @@ ieee80211_sdata_netdev_features(struct i +@@ -3656,7 +3658,7 @@ ieee80211_sdata_netdev_features(struct i } static struct sk_buff * @@ -40,7 +40,7 @@ Signed-off-by: Tamizh Chelvam Raja { if (skb_is_gso(skb)) { struct sk_buff *segs; -@@ -3676,7 +3678,7 @@ ieee80211_tx_skb_fixup(struct sk_buff *s +@@ -3674,7 +3676,7 @@ ieee80211_tx_skb_fixup(struct sk_buff *s if (skb_needs_linearize(skb, features) && __skb_linearize(skb)) goto free; @@ -49,7 +49,7 @@ Signed-off-by: Tamizh Chelvam Raja int ofs = skb_checksum_start_offset(skb); if (skb->encapsulation) -@@ -3822,7 +3824,7 @@ static bool ieee80211_xmit_fast(struct i +@@ -3820,7 +3822,7 @@ static bool ieee80211_xmit_fast(struct i memcpy(ð, skb->data, ETH_HLEN - 2); /* after this point (skb is modified) we cannot return false */ @@ -58,7 +58,7 @@ Signed-off-by: Tamizh Chelvam Raja if (!skb) return true; -@@ -4367,7 +4369,7 @@ void __ieee80211_subif_start_xmit(struct +@@ -4366,7 +4368,7 @@ void __ieee80211_subif_start_xmit(struct * things so we cannot really handle checksum or GSO offload. * fix it up in software before we handle anything else. */ @@ -67,7 +67,7 @@ Signed-off-by: Tamizh Chelvam Raja if (!skb) { len = 0; goto out; -@@ -4740,7 +4742,7 @@ static void ieee80211_8023_xmit(struct i +@@ -4739,7 +4741,7 @@ static void ieee80211_8023_xmit(struct i } } @@ -78,7 +78,7 @@ Signed-off-by: Tamizh Chelvam Raja --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c -@@ -2263,6 +2263,10 @@ int ieee80211_if_add(struct ieee80211_lo +@@ -2259,6 +2259,10 @@ int ieee80211_if_add(struct ieee80211_lo ndev->features |= local->hw.netdev_features; ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE; diff --git a/package/kernel/mac80211/patches/nss/subsys/785-wifi-mac80211-Add-mac-hw-flag-to-avoid-queue-skb.patch b/package/kernel/mac80211/patches/nss/subsys/785-wifi-mac80211-Add-mac-hw-flag-to-avoid-queue-skb.patch index 08c69d8ecd0..338a9d2dd1a 100644 --- a/package/kernel/mac80211/patches/nss/subsys/785-wifi-mac80211-Add-mac-hw-flag-to-avoid-queue-skb.patch +++ b/package/kernel/mac80211/patches/nss/subsys/785-wifi-mac80211-Add-mac-hw-flag-to-avoid-queue-skb.patch @@ -23,7 +23,7 @@ Signed-off-by: Yuvasree Sivasankaran --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -2838,6 +2838,9 @@ struct ieee80211_txq { +@@ -2876,6 +2876,9 @@ struct ieee80211_txq { * * @IEEE80211_HW_SUPPORTS_TID_CLASS_OFFLOAD: Hardware suports tid calssification offload. * @@ -33,7 +33,7 @@ Signed-off-by: Yuvasree Sivasankaran * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays */ enum ieee80211_hw_flags { -@@ -2900,6 +2903,7 @@ enum ieee80211_hw_flags { +@@ -2938,6 +2941,7 @@ enum ieee80211_hw_flags { IEEE80211_HW_SUPPORTS_NSS_OFFLOAD, IEEE80211_HW_SUPPORTS_MESH_NSS_OFFLOAD, IEEE80211_HW_SUPPORTS_TID_CLASS_OFFLOAD, @@ -70,7 +70,7 @@ Signed-off-by: Yuvasree Sivasankaran + if (ieee80211_hw_check(&local->hw, HAS_TX_QUEUE)) + return; + - kfree(local->cvars); + kvfree(local->cvars); local->cvars = NULL; @@ -1664,7 +1670,8 @@ static bool ieee80211_queue_skb(struct i @@ -83,7 +83,7 @@ Signed-off-by: Yuvasree Sivasankaran return false; if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) -@@ -4352,7 +4359,8 @@ void __ieee80211_subif_start_xmit(struct +@@ -4351,7 +4358,8 @@ void __ieee80211_subif_start_xmit(struct } } @@ -93,7 +93,7 @@ Signed-off-by: Yuvasree Sivasankaran ieee80211_aggr_check(sdata, sta, skb); if (sta) { -@@ -4706,8 +4714,10 @@ static void ieee80211_8023_xmit(struct i +@@ -4705,8 +4713,10 @@ static void ieee80211_8023_xmit(struct i bool multicast; u8 tid; @@ -106,7 +106,7 @@ Signed-off-by: Yuvasree Sivasankaran multicast = is_multicast_ether_addr(ra); -@@ -6426,9 +6436,12 @@ int ieee80211_tx_control_port(struct wip +@@ -6427,9 +6437,12 @@ int ieee80211_tx_control_port(struct wip } if (!IS_ERR(sta)) { @@ -123,7 +123,7 @@ Signed-off-by: Yuvasree Sivasankaran * for MLO STA, the SA should be the AP MLD address, but --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -4566,6 +4566,9 @@ static int ieee80211_get_txq_stats(struc +@@ -4584,6 +4584,9 @@ static int ieee80211_get_txq_stats(struc struct ieee80211_sub_if_data *sdata; int ret = 0; @@ -135,7 +135,7 @@ Signed-off-by: Yuvasree Sivasankaran --- a/net/mac80211/main.c +++ b/net/mac80211/main.c -@@ -993,7 +993,10 @@ struct ieee80211_hw *ieee80211_alloc_hw_ +@@ -1001,7 +1001,10 @@ struct ieee80211_hw *ieee80211_alloc_hw_ atomic_set(&local->agg_queue_stop[i], 0); } tasklet_setup(&local->tx_pending_tasklet, ieee80211_tx_pending); diff --git a/package/kernel/mac80211/patches/nss/subsys/829-mac80211-fix-mesh-ping-issue.patch b/package/kernel/mac80211/patches/nss/subsys/829-mac80211-fix-mesh-ping-issue.patch index 5a4423d5c79..0a805bd2e6d 100644 --- a/package/kernel/mac80211/patches/nss/subsys/829-mac80211-fix-mesh-ping-issue.patch +++ b/package/kernel/mac80211/patches/nss/subsys/829-mac80211-fix-mesh-ping-issue.patch @@ -10,7 +10,7 @@ Signed-off-by: Aaradhana Sahu --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c -@@ -4711,16 +4711,14 @@ void ieee80211_check_fast_rx(struct sta_ +@@ -4715,16 +4715,14 @@ void ieee80211_check_fast_rx(struct sta_ break; case NL80211_IFTYPE_MESH_POINT: @@ -30,7 +30,7 @@ Signed-off-by: Aaradhana Sahu default: goto clear; } -@@ -4942,10 +4940,7 @@ static bool ieee80211_invoke_fast_rx(str +@@ -4946,10 +4944,7 @@ static bool ieee80211_invoke_fast_rx(str u8 sa[ETH_ALEN]; } addrs __aligned(2); struct ieee80211_sta_rx_stats *stats; @@ -41,7 +41,7 @@ Signed-off-by: Aaradhana Sahu /* for parallel-rx, we need to have DUP_VALIDATED, otherwise we write * to a common data structure; drivers can implement that per queue -@@ -4995,37 +4990,6 @@ static bool ieee80211_invoke_fast_rx(str +@@ -4999,37 +4994,6 @@ static bool ieee80211_invoke_fast_rx(str snap_offs += IEEE80211_CCMP_HDR_LEN; } @@ -79,7 +79,7 @@ Signed-off-by: Aaradhana Sahu if (!ieee80211_vif_is_mesh(&rx->sdata->vif) && !(status->rx_flags & IEEE80211_RX_AMSDU)) { if (!pskb_may_pull(skb, snap_offs + sizeof(*payload))) -@@ -5063,30 +5027,6 @@ static bool ieee80211_invoke_fast_rx(str +@@ -5067,30 +5031,6 @@ static bool ieee80211_invoke_fast_rx(str return true; } diff --git a/package/kernel/mac80211/patches/nss/subsys/902-wifi-mac80211-Fix-memory-corruption-during-mesh-beac.patch b/package/kernel/mac80211/patches/nss/subsys/902-wifi-mac80211-Fix-memory-corruption-during-mesh-beac.patch index 2f03604b6c4..a070e2c4b5f 100644 --- a/package/kernel/mac80211/patches/nss/subsys/902-wifi-mac80211-Fix-memory-corruption-during-mesh-beac.patch +++ b/package/kernel/mac80211/patches/nss/subsys/902-wifi-mac80211-Fix-memory-corruption-during-mesh-beac.patch @@ -25,7 +25,7 @@ Signed-off-by: Manish Dharanenthiran --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -728,7 +728,7 @@ struct ieee80211_if_mesh { +@@ -731,7 +731,7 @@ struct ieee80211_if_mesh { struct timer_list mesh_path_root_timer; unsigned long wrkq_flags; diff --git a/package/kernel/mac80211/patches/nss/subsys/917-QSDK-mac80211-WAR-for-association-failure-issue-with.patch b/package/kernel/mac80211/patches/nss/subsys/917-QSDK-mac80211-WAR-for-association-failure-issue-with.patch index 6efc6233079..c0e43a73c34 100644 --- a/package/kernel/mac80211/patches/nss/subsys/917-QSDK-mac80211-WAR-for-association-failure-issue-with.patch +++ b/package/kernel/mac80211/patches/nss/subsys/917-QSDK-mac80211-WAR-for-association-failure-issue-with.patch @@ -27,7 +27,7 @@ Signed-off-by: Balamurugan Ramar --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c -@@ -7144,7 +7144,7 @@ void ieee80211_sta_work(struct ieee80211 +@@ -7757,7 +7757,7 @@ void ieee80211_sta_work(struct ieee80211 */ if (status_acked) { ifmgd->assoc_data->timeout = diff --git a/package/kernel/mac80211/patches/nss/subsys/999-775-wifi-mac80211-Changes-for-WDS-MLD.patch b/package/kernel/mac80211/patches/nss/subsys/999-775-wifi-mac80211-Changes-for-WDS-MLD.patch index 59a607f8bbb..3246b1f9304 100644 --- a/package/kernel/mac80211/patches/nss/subsys/999-775-wifi-mac80211-Changes-for-WDS-MLD.patch +++ b/package/kernel/mac80211/patches/nss/subsys/999-775-wifi-mac80211-Changes-for-WDS-MLD.patch @@ -17,7 +17,7 @@ Signed-off-by: Ramasamy Kaliappan --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h -@@ -8756,6 +8756,7 @@ bool cfg80211_rx_spurious_frame(struct n +@@ -8806,6 +8806,7 @@ bool cfg80211_rx_spurious_frame(struct n * @dev: The device the frame matched to * @addr: the transmitter address * @gfp: context flags @@ -25,7 +25,7 @@ Signed-off-by: Ramasamy Kaliappan * * This function is used in AP mode (only!) to inform userspace that * an associated station sent a 4addr frame but that wasn't expected. -@@ -8765,7 +8766,8 @@ bool cfg80211_rx_spurious_frame(struct n +@@ -8815,7 +8816,8 @@ bool cfg80211_rx_spurious_frame(struct n * for a reason other than not having a subscription.) */ bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, @@ -37,7 +37,7 @@ Signed-off-by: Ramasamy Kaliappan * cfg80211_probe_status - notify userspace about probe status --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2188,9 +2188,16 @@ static int ieee80211_change_station(stru +@@ -2207,9 +2207,16 @@ static int ieee80211_change_station(stru vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); if (params->vlan->ieee80211_ptr->use_4addr) { @@ -54,7 +54,7 @@ Signed-off-by: Ramasamy Kaliappan rcu_assign_pointer(vlansdata->u.vlan.sta, sta); __ieee80211_check_fast_rx_iface(vlansdata); -@@ -2200,6 +2207,39 @@ static int ieee80211_change_station(stru +@@ -2219,6 +2226,39 @@ static int ieee80211_change_station(stru else drv_sta_set_4addr(local, sta->sdata, &sta->sta, true); @@ -127,7 +127,7 @@ Signed-off-by: Ramasamy Kaliappan --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -18867,7 +18867,8 @@ void cfg80211_conn_failed(struct net_dev +@@ -18945,7 +18945,8 @@ void cfg80211_conn_failed(struct net_dev EXPORT_SYMBOL(cfg80211_conn_failed); static bool __nl80211_unexpected_frame(struct net_device *dev, u8 cmd, @@ -137,7 +137,7 @@ Signed-off-by: Ramasamy Kaliappan { struct wireless_dev *wdev = dev->ieee80211_ptr; struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); -@@ -18893,6 +18894,9 @@ static bool __nl80211_unexpected_frame(s +@@ -18971,6 +18972,9 @@ static bool __nl80211_unexpected_frame(s nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr)) goto nla_put_failure; @@ -147,7 +147,7 @@ Signed-off-by: Ramasamy Kaliappan genlmsg_end(msg, hdr); genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid); return true; -@@ -18916,14 +18920,15 @@ bool cfg80211_rx_spurious_frame(struct n +@@ -18994,14 +18998,15 @@ bool cfg80211_rx_spurious_frame(struct n return false; } ret = __nl80211_unexpected_frame(dev, NL80211_CMD_UNEXPECTED_FRAME, @@ -165,7 +165,7 @@ Signed-off-by: Ramasamy Kaliappan { struct wireless_dev *wdev = dev->ieee80211_ptr; bool ret; -@@ -18938,7 +18943,7 @@ bool cfg80211_rx_unexpected_4addr_frame( +@@ -19016,7 +19021,7 @@ bool cfg80211_rx_unexpected_4addr_frame( } ret = __nl80211_unexpected_frame(dev, NL80211_CMD_UNEXPECTED_4ADDR_FRAME, @@ -176,7 +176,7 @@ Signed-off-by: Ramasamy Kaliappan } --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c -@@ -979,6 +979,8 @@ __ieee80211_link_copy_chanctx_to_vlans(s +@@ -1036,6 +1036,8 @@ __ieee80211_link_copy_chanctx_to_vlans(s list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) { struct ieee80211_bss_conf *vlan_conf; @@ -185,7 +185,7 @@ Signed-off-by: Ramasamy Kaliappan vlan_conf = wiphy_dereference(local->hw.wiphy, vlan->vif.link_conf[link_id]); if (WARN_ON(!vlan_conf)) -@@ -1220,6 +1222,8 @@ ieee80211_link_update_chanreq(struct iee +@@ -1277,6 +1279,8 @@ ieee80211_link_update_chanreq(struct iee list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) { struct ieee80211_bss_conf *vlan_conf; @@ -196,7 +196,7 @@ Signed-off-by: Ramasamy Kaliappan if (WARN_ON(!vlan_conf)) --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c -@@ -1847,9 +1847,9 @@ void ieee80211_send_4addr_nullfunc(struc +@@ -2062,9 +2062,9 @@ void ieee80211_send_4addr_nullfunc(struc fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); nullfunc->frame_control = fc; diff --git a/package/kernel/mac80211/patches/nss/subsys/999-918-mac80211-fix-NULL-pointer-access-Klocwork-issue.patch b/package/kernel/mac80211/patches/nss/subsys/999-918-mac80211-fix-NULL-pointer-access-Klocwork-issue.patch new file mode 100644 index 00000000000..633b70fb140 --- /dev/null +++ b/package/kernel/mac80211/patches/nss/subsys/999-918-mac80211-fix-NULL-pointer-access-Klocwork-issue.patch @@ -0,0 +1,62 @@ +From f5a907934f596f77b4c59e549eff5d56b1a4e226 Mon Sep 17 00:00:00 2001 +From: Monika Korada +Date: Mon, 27 May 2024 11:32:49 +0530 +Subject: [PATCH] KW: wifi: mac80211: fix NULL pointer access, Klocwork issue + +Currently we are dereferencing dev pointer without a NULL +check. + +Fix this issue by adding a NULL check. + +Patch-dependency: none +Patch-work: none +Fixes: 4b7afb52c8e2 (mac80211: reorganize code to remove a forward declaration) +Note: ath.git commit id is mentioned in the Fixes tag + +Signed-off-by: Monika Korada +--- + net/mac80211/iface.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +--- a/net/mac80211/iface.c ++++ b/net/mac80211/iface.c +@@ -1363,7 +1363,8 @@ int ieee80211_do_open(struct wireless_de + case NL80211_IFTYPE_AP_VLAN: + if (sdata->bss->active) { + ieee80211_link_vlan_copy_chanctx(&sdata->deflink); +- netif_carrier_on(dev); ++ if (dev) ++ netif_carrier_on(dev); + + if (ieee80211_hw_check(&local->hw, SUPPORTS_NSS_OFFLOAD)) { + ieee80211_set_sdata_offload_flags(sdata); +@@ -1374,7 +1375,8 @@ int ieee80211_do_open(struct wireless_de + + ieee80211_set_vif_encap_ops(sdata); + } else { +- netif_carrier_off(dev); ++ if (dev) ++ netif_carrier_off(dev); + } + break; + case NL80211_IFTYPE_MONITOR: +@@ -1405,7 +1407,8 @@ int ieee80211_do_open(struct wireless_de + ieee80211_recalc_offload(local); + ieee80211_recalc_idle(local); + +- netif_carrier_on(dev); ++ if (dev) ++ netif_carrier_on(dev); + break; + default: + if (coming_up) { +@@ -1449,7 +1452,8 @@ int ieee80211_do_open(struct wireless_de + case NL80211_IFTYPE_AP: + case NL80211_IFTYPE_MESH_POINT: + case NL80211_IFTYPE_OCB: +- netif_carrier_off(dev); ++ if (dev) ++ netif_carrier_off(dev); + break; + case NL80211_IFTYPE_P2P_DEVICE: + case NL80211_IFTYPE_NAN: diff --git a/package/kernel/mac80211/patches/rt2x00/602-01-wifi-rt2x00-Add-support-for-loading-EEPROM-from-user.patch b/package/kernel/mac80211/patches/rt2x00/602-01-wifi-rt2x00-Add-support-for-loading-EEPROM-from-user.patch index 1516c6cb434..b6b1e0da963 100644 --- a/package/kernel/mac80211/patches/rt2x00/602-01-wifi-rt2x00-Add-support-for-loading-EEPROM-from-user.patch +++ b/package/kernel/mac80211/patches/rt2x00/602-01-wifi-rt2x00-Add-support-for-loading-EEPROM-from-user.patch @@ -21,7 +21,7 @@ Signed-off-by: Christian Marangi --- a/local-symbols +++ b/local-symbols -@@ -334,6 +334,7 @@ RT2X00_LIB_FIRMWARE= +@@ -339,6 +339,7 @@ RT2X00_LIB_FIRMWARE= RT2X00_LIB_CRYPTO= RT2X00_LIB_LEDS= RT2X00_LIB_DEBUGFS= @@ -100,7 +100,7 @@ Signed-off-by: Christian Marangi .drv_init_registers = rt2800mmio_init_registers, --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -703,6 +703,7 @@ enum rt2x00_capability_flags { +@@ -693,6 +693,7 @@ enum rt2x00_capability_flags { REQUIRE_HT_TX_DESC, REQUIRE_PS_AUTOWAKE, REQUIRE_DELAYED_RFKILL, diff --git a/package/kernel/mac80211/patches/rt2x00/606-rt2x00-allow_disabling_bands_through_platform_data.patch b/package/kernel/mac80211/patches/rt2x00/606-rt2x00-allow_disabling_bands_through_platform_data.patch index ab09a68297f..a554707bda1 100644 --- a/package/kernel/mac80211/patches/rt2x00/606-rt2x00-allow_disabling_bands_through_platform_data.patch +++ b/package/kernel/mac80211/patches/rt2x00/606-rt2x00-allow_disabling_bands_through_platform_data.patch @@ -37,7 +37,7 @@ num_rates += 4; --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h -@@ -408,6 +408,7 @@ struct hw_mode_spec { +@@ -398,6 +398,7 @@ struct hw_mode_spec { unsigned int supported_bands; #define SUPPORT_BAND_2GHZ 0x00000001 #define SUPPORT_BAND_5GHZ 0x00000002 diff --git a/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch b/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch index 5b950539b98..bb3f8197020 100644 --- a/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch +++ b/package/kernel/mac80211/patches/rt2x00/994-rt2x00-import-support-for-external-LNA-on-MT7620.patch @@ -83,7 +83,7 @@ Signed-off-by: Daniel Golle #include #include -@@ -1027,6 +1028,11 @@ struct rt2x00_dev { +@@ -1017,6 +1018,11 @@ struct rt2x00_dev { /* Clock for System On Chip devices. */ struct clk *clk; diff --git a/package/kernel/mac80211/patches/rtl/001-v6.10-wifi-rtw88-usb-schedule-rx-work-after-everything-is-.patch b/package/kernel/mac80211/patches/rtl/001-v6.10-wifi-rtw88-usb-schedule-rx-work-after-everything-is-.patch deleted file mode 100644 index 2fa581f2888..00000000000 --- a/package/kernel/mac80211/patches/rtl/001-v6.10-wifi-rtw88-usb-schedule-rx-work-after-everything-is-.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 25eaef533bf3ccc6fee5067aac16f41f280e343e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Marcin=20=C5=9Alusarz?= -Date: Tue, 28 May 2024 13:02:46 +0200 -Subject: [PATCH] wifi: rtw88: usb: schedule rx work after everything is set up -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -[ Upstream commit adc539784c98a7cc602cbf557debfc2e7b9be8b3 ] - -Right now it's possible to hit NULL pointer dereference in -rtw_rx_fill_rx_status on hw object and/or its fields because -initialization routine can start getting USB replies before -rtw_dev is fully setup. - -The stack trace looks like this: - -rtw_rx_fill_rx_status -rtw8821c_query_rx_desc -rtw_usb_rx_handler -... -queue_work -rtw_usb_read_port_complete -... -usb_submit_urb -rtw_usb_rx_resubmit -rtw_usb_init_rx -rtw_usb_probe - -So while we do the async stuff rtw_usb_probe continues and calls -rtw_register_hw, which does all kinds of initialization (e.g. -via ieee80211_register_hw) that rtw_rx_fill_rx_status relies on. - -Fix this by moving the first usb_submit_urb after everything -is set up. - -For me, this bug manifested as: -[ 8.893177] rtw_8821cu 1-1:1.2: band wrong, packet dropped -[ 8.910904] rtw_8821cu 1-1:1.2: hw->conf.chandef.chan NULL in rtw_rx_fill_rx_status -because I'm using Larry's backport of rtw88 driver with the NULL -checks in rtw_rx_fill_rx_status. - -Link: https://lore.kernel.org/linux-wireless/CA+shoWQ7P49jhQasofDcTdQhiuarPTjYEDa--NiVVx494WcuQw@mail.gmail.com/ -Signed-off-by: Marcin Ślusarz -Cc: Tim K -Cc: Ping-Ke Shih -Cc: Larry Finger -Cc: Kalle Valo -Cc: linux-wireless@vger.kernel.org -Cc: linux-kernel@vger.kernel.org -Signed-off-by: Ping-Ke Shih -Link: https://patch.msgid.link/20240528110246.477321-1-marcin.slusarz@gmail.com -Signed-off-by: Sasha Levin ---- - drivers/net/wireless/realtek/rtw88/usb.c | 13 ++++++++++--- - 1 file changed, 10 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/realtek/rtw88/usb.c -+++ b/drivers/net/wireless/realtek/rtw88/usb.c -@@ -740,7 +740,6 @@ static struct rtw_hci_ops rtw_usb_ops = - static int rtw_usb_init_rx(struct rtw_dev *rtwdev) - { - struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); -- int i; - - rtwusb->rxwq = create_singlethread_workqueue("rtw88_usb: rx wq"); - if (!rtwusb->rxwq) { -@@ -752,13 +751,19 @@ static int rtw_usb_init_rx(struct rtw_de - - INIT_WORK(&rtwusb->rx_work, rtw_usb_rx_handler); - -+ return 0; -+} -+ -+static void rtw_usb_setup_rx(struct rtw_dev *rtwdev) -+{ -+ struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); -+ int i; -+ - for (i = 0; i < RTW_USB_RXCB_NUM; i++) { - struct rx_usb_ctrl_block *rxcb = &rtwusb->rx_cb[i]; - - rtw_usb_rx_resubmit(rtwusb, rxcb); - } -- -- return 0; - } - - static void rtw_usb_deinit_rx(struct rtw_dev *rtwdev) -@@ -895,6 +900,8 @@ int rtw_usb_probe(struct usb_interface * - goto err_destroy_rxwq; - } - -+ rtw_usb_setup_rx(rtwdev); -+ - return 0; - - err_destroy_rxwq: diff --git a/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch b/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch index c71f1f2ffca..68534f4e7b4 100644 --- a/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch +++ b/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch @@ -9,7 +9,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnect --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -1647,12 +1647,6 @@ static int ieee80211_stop_ap(struct wiph +@@ -1649,12 +1649,6 @@ static int ieee80211_stop_ap(struct wiph __sta_info_flush(sdata, true, link_id); diff --git a/package/kernel/mac80211/patches/subsys/130-disable_auto_vif.patch b/package/kernel/mac80211/patches/subsys/130-disable_auto_vif.patch index d4341a13502..eea165ccca9 100644 --- a/package/kernel/mac80211/patches/subsys/130-disable_auto_vif.patch +++ b/package/kernel/mac80211/patches/subsys/130-disable_auto_vif.patch @@ -1,6 +1,6 @@ --- a/net/mac80211/main.c +++ b/net/mac80211/main.c -@@ -1564,24 +1564,6 @@ int ieee80211_register_hw(struct ieee802 +@@ -1581,24 +1581,6 @@ int ieee80211_register_hw(struct ieee802 ieee80211_check_wbrf_support(local); diff --git a/package/kernel/mac80211/patches/subsys/210-ap_scan.patch b/package/kernel/mac80211/patches/subsys/210-ap_scan.patch index a1f96cb3a04..ca4ac8adb62 100644 --- a/package/kernel/mac80211/patches/subsys/210-ap_scan.patch +++ b/package/kernel/mac80211/patches/subsys/210-ap_scan.patch @@ -8,7 +8,7 @@ Subject: [PATCH] mac80211: allow scans in access point mode (for site survey) --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2844,6 +2844,8 @@ static int ieee80211_scan(struct wiphy * +@@ -2863,6 +2863,8 @@ static int ieee80211_scan(struct wiphy * */ fallthrough; case NL80211_IFTYPE_AP: diff --git a/package/kernel/mac80211/patches/subsys/220-allow-ibss-mixed.patch b/package/kernel/mac80211/patches/subsys/220-allow-ibss-mixed.patch index 7a96f9f2bec..55376362a5b 100644 --- a/package/kernel/mac80211/patches/subsys/220-allow-ibss-mixed.patch +++ b/package/kernel/mac80211/patches/subsys/220-allow-ibss-mixed.patch @@ -16,7 +16,7 @@ and we should ignore this. --- a/net/wireless/core.c +++ b/net/wireless/core.c -@@ -651,21 +651,6 @@ static int wiphy_verify_combinations(str +@@ -654,21 +654,6 @@ static int wiphy_verify_combinations(str c->limits[j].max > 1)) return -EINVAL; diff --git a/package/kernel/mac80211/patches/subsys/305-mac80211-increase-quantum-for-airtime-scheduler.patch b/package/kernel/mac80211/patches/subsys/305-mac80211-increase-quantum-for-airtime-scheduler.patch index 71ce340d311..6cf46ce7e51 100644 --- a/package/kernel/mac80211/patches/subsys/305-mac80211-increase-quantum-for-airtime-scheduler.patch +++ b/package/kernel/mac80211/patches/subsys/305-mac80211-increase-quantum-for-airtime-scheduler.patch @@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -101,6 +101,8 @@ ieee80211_sta_keep_active(struct sta_inf +@@ -103,6 +103,8 @@ ieee80211_sta_keep_active(struct sta_inf return time_before_eq(jiffies, sta->airtime[ac].last_active + HZ / 10); } @@ -23,7 +23,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -4082,7 +4082,7 @@ struct ieee80211_txq *ieee80211_next_txq +@@ -4081,7 +4081,7 @@ struct ieee80211_txq *ieee80211_next_txq if (deficit < 0) sta->airtime[txqi->txq.ac].deficit += @@ -32,7 +32,7 @@ Signed-off-by: Felix Fietkau if (deficit < 0 || !aql_check) { list_move_tail(&txqi->schedule_order, -@@ -4225,7 +4225,8 @@ bool ieee80211_txq_may_transmit(struct i +@@ -4224,7 +4224,8 @@ bool ieee80211_txq_may_transmit(struct i } sta = container_of(iter->txq.sta, struct sta_info, sta); if (ieee80211_sta_deficit(sta, ac) < 0) @@ -42,7 +42,7 @@ Signed-off-by: Felix Fietkau list_move_tail(&iter->schedule_order, &local->active_txqs[ac]); } -@@ -4233,7 +4234,7 @@ bool ieee80211_txq_may_transmit(struct i +@@ -4232,7 +4233,7 @@ bool ieee80211_txq_may_transmit(struct i if (sta->airtime[ac].deficit >= 0) goto out; diff --git a/package/kernel/mac80211/patches/subsys/306-wifi-mac80211-clear-vif-drv_priv-after-calling-remov.patch b/package/kernel/mac80211/patches/subsys/306-wifi-mac80211-clear-vif-drv_priv-after-calling-remov.patch deleted file mode 100644 index b0119988d3d..00000000000 --- a/package/kernel/mac80211/patches/subsys/306-wifi-mac80211-clear-vif-drv_priv-after-calling-remov.patch +++ /dev/null @@ -1,29 +0,0 @@ -From: Felix Fietkau -Date: Wed, 3 Jul 2024 12:10:01 +0200 -Subject: [PATCH] wifi: mac80211: clear vif drv_priv after calling - remove_interface - -Avoid reusing stale driver data when an interface is brought down and up -again. In order to avoid having to duplicate the memset in every single -driver, do it here. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/iface.c -+++ b/net/mac80211/iface.c -@@ -693,8 +693,12 @@ static void ieee80211_do_stop(struct iee - - fallthrough; - default: -- if (going_down) -- drv_remove_interface(local, sdata); -+ if (!going_down) -+ break; -+ drv_remove_interface(local, sdata); -+ -+ /* Clear private driver data to prevent reuse */ -+ memset(sdata->vif.drv_priv, 0, local->hw.vif_data_size); - } - - ieee80211_recalc_ps(local); diff --git a/package/kernel/mac80211/patches/subsys/310-cfg80211-allow-grace-period-for-DFS-available-after-.patch b/package/kernel/mac80211/patches/subsys/310-cfg80211-allow-grace-period-for-DFS-available-after-.patch index 39f23f78391..7e9be59e044 100644 --- a/package/kernel/mac80211/patches/subsys/310-cfg80211-allow-grace-period-for-DFS-available-after-.patch +++ b/package/kernel/mac80211/patches/subsys/310-cfg80211-allow-grace-period-for-DFS-available-after-.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h -@@ -189,6 +189,8 @@ enum ieee80211_channel_flags { +@@ -187,6 +187,8 @@ enum ieee80211_channel_flags { * @dfs_state: current state of this channel. Only relevant if radar is required * on this channel. * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered. @@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels. * @psd: power spectral density (in dBm) */ -@@ -206,6 +208,7 @@ struct ieee80211_channel { +@@ -204,6 +206,7 @@ struct ieee80211_channel { int orig_mag, orig_mpwr; enum nl80211_dfs_state dfs_state; unsigned long dfs_state_entered; @@ -52,7 +52,7 @@ Signed-off-by: Felix Fietkau --- a/net/wireless/chan.c +++ b/net/wireless/chan.c -@@ -560,6 +560,8 @@ static void cfg80211_set_chans_dfs_state +@@ -598,6 +598,8 @@ static void cfg80211_set_chans_dfs_state c->dfs_state = dfs_state; c->dfs_state_entered = jiffies; @@ -61,7 +61,7 @@ Signed-off-by: Felix Fietkau } } -@@ -1049,6 +1051,49 @@ static bool cfg80211_get_chans_dfs_avail +@@ -1087,6 +1089,49 @@ static bool cfg80211_get_chans_dfs_avail return true; } diff --git a/package/kernel/mac80211/patches/subsys/320-mac80211-add-AQL-support-for-broadcast-packets.patch b/package/kernel/mac80211/patches/subsys/320-mac80211-add-AQL-support-for-broadcast-packets.patch index 9fd539d3a53..c03f40d9b4f 100644 --- a/package/kernel/mac80211/patches/subsys/320-mac80211-add-AQL-support-for-broadcast-packets.patch +++ b/package/kernel/mac80211/patches/subsys/320-mac80211-add-AQL-support-for-broadcast-packets.patch @@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h -@@ -3416,6 +3416,7 @@ enum wiphy_params_flags { +@@ -3423,6 +3423,7 @@ enum wiphy_params_flags { /* The per TXQ device queue limit in airtime */ #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L 5000 #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H 12000 @@ -70,7 +70,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -1338,10 +1338,12 @@ struct ieee80211_local { +@@ -1351,10 +1351,12 @@ struct ieee80211_local { spinlock_t handle_wake_tx_queue_lock; u16 airtime_flags; @@ -85,7 +85,7 @@ Signed-off-by: Felix Fietkau const struct ieee80211_ops *ops; --- a/net/mac80211/main.c +++ b/net/mac80211/main.c -@@ -944,6 +944,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ +@@ -952,6 +952,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ spin_lock_init(&local->rx_path_lock); spin_lock_init(&local->queue_stop_reason_lock); @@ -136,7 +136,7 @@ Signed-off-by: Felix Fietkau spin_unlock_irqrestore(&local->ack_status_lock, flags); if (id >= 0) { -@@ -3983,20 +3983,20 @@ begin: +@@ -3982,20 +3982,20 @@ begin: encap_out: info->control.vif = vif; @@ -167,7 +167,7 @@ Signed-off-by: Felix Fietkau } return skb; -@@ -4048,6 +4048,7 @@ struct ieee80211_txq *ieee80211_next_txq +@@ -4047,6 +4047,7 @@ struct ieee80211_txq *ieee80211_next_txq struct ieee80211_txq *ret = NULL; struct txq_info *txqi = NULL, *head = NULL; bool found_eligible_txq = false; @@ -175,7 +175,7 @@ Signed-off-by: Felix Fietkau spin_lock_bh(&local->active_txq_lock[ac]); -@@ -4071,26 +4072,26 @@ struct ieee80211_txq *ieee80211_next_txq +@@ -4070,26 +4071,26 @@ struct ieee80211_txq *ieee80211_next_txq if (!head) head = txqi; @@ -214,7 +214,7 @@ Signed-off-by: Felix Fietkau if (txqi->schedule_round == local->schedule_round[ac]) goto out; -@@ -4155,7 +4156,8 @@ bool ieee80211_txq_airtime_check(struct +@@ -4154,7 +4155,8 @@ bool ieee80211_txq_airtime_check(struct return true; if (!txq->sta) @@ -224,7 +224,7 @@ Signed-off-by: Felix Fietkau if (unlikely(txq->tid == IEEE80211_NUM_TIDS)) return true; -@@ -4204,15 +4206,15 @@ bool ieee80211_txq_may_transmit(struct i +@@ -4203,15 +4205,15 @@ bool ieee80211_txq_may_transmit(struct i spin_lock_bh(&local->active_txq_lock[ac]); @@ -245,7 +245,7 @@ Signed-off-by: Felix Fietkau if (iter == txqi) --- a/include/net/mac80211.h +++ b/include/net/mac80211.h -@@ -1180,8 +1180,8 @@ struct ieee80211_tx_info { +@@ -1222,8 +1222,8 @@ struct ieee80211_tx_info { status_data_idr:1, status_data:13, hw_queue:4, @@ -269,7 +269,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/status.c +++ b/net/mac80211/status.c -@@ -717,7 +717,7 @@ static void ieee80211_report_used_skb(st +@@ -734,7 +734,7 @@ static void ieee80211_report_used_skb(st ieee80211_sta_update_pending_airtime(local, sta, skb_get_queue_mapping(skb), tx_time_est, @@ -278,7 +278,7 @@ Signed-off-by: Felix Fietkau rcu_read_unlock(); } -@@ -1138,10 +1138,11 @@ void ieee80211_tx_status_ext(struct ieee +@@ -1158,10 +1158,11 @@ void ieee80211_tx_status_ext(struct ieee /* Do this here to avoid the expensive lookup of the sta * in ieee80211_report_used_skb(). */ diff --git a/package/kernel/mac80211/patches/subsys/321-wifi-mac80211-do-not-pass-a-stopped-vif-to-the-drive.patch b/package/kernel/mac80211/patches/subsys/321-wifi-mac80211-do-not-pass-a-stopped-vif-to-the-drive.patch index 9fed5221cb2..f48fa38e5e9 100644 --- a/package/kernel/mac80211/patches/subsys/321-wifi-mac80211-do-not-pass-a-stopped-vif-to-the-drive.patch +++ b/package/kernel/mac80211/patches/subsys/321-wifi-mac80211-do-not-pass-a-stopped-vif-to-the-drive.patch @@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -3111,7 +3111,8 @@ static int ieee80211_get_tx_power(struct +@@ -3134,7 +3134,8 @@ static int ieee80211_get_tx_power(struct struct ieee80211_local *local = wiphy_priv(wiphy); struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); diff --git a/package/kernel/mac80211/patches/subsys/331-wifi-mac80211-extend-IEEE80211_KEY_FLAG_GENERATE_MMI.patch b/package/kernel/mac80211/patches/subsys/331-wifi-mac80211-extend-IEEE80211_KEY_FLAG_GENERATE_MMI.patch deleted file mode 100644 index 5c202c26c29..00000000000 --- a/package/kernel/mac80211/patches/subsys/331-wifi-mac80211-extend-IEEE80211_KEY_FLAG_GENERATE_MMI.patch +++ /dev/null @@ -1,70 +0,0 @@ -From: Michael-CY Lee -Date: Tue, 26 Mar 2024 08:30:36 +0800 -Subject: [PATCH] wifi: mac80211: extend IEEE80211_KEY_FLAG_GENERATE_MMIE to - other ciphers - -Extend the flag IEEE80211_KEY_FLAG_GENERATE_MMIE to BIP-CMAC-256, -BIP-GMAC-128 and BIP-GMAC-256 for the same reason and in the same -way that the flag was added originally in commit a0b4496a4368 -("mac80211: add IEEE80211_KEY_FLAG_GENERATE_MMIE to ieee80211_key_flags"). - -Signed-off-by: Michael-CY Lee -Link: https://msgid.link/20240326003036.15215-1-michael-cy.lee@mediatek.com -Signed-off-by: Johannes Berg ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -2123,8 +2123,8 @@ static inline bool lockdep_vif_wiphy_mut - * @IEEE80211_KEY_FLAG_GENERATE_MMIC on the same key. - * @IEEE80211_KEY_FLAG_NO_AUTO_TX: Key needs explicit Tx activation. - * @IEEE80211_KEY_FLAG_GENERATE_MMIE: This flag should be set by the driver -- * for a AES_CMAC key to indicate that it requires sequence number -- * generation only -+ * for a AES_CMAC or a AES_GMAC key to indicate that it requires sequence -+ * number generation only - * @IEEE80211_KEY_FLAG_SPP_AMSDU: SPP A-MSDUs can be used with this key - * (set by mac80211 from the sta->spp_amsdu flag) - */ ---- a/net/mac80211/wpa.c -+++ b/net/mac80211/wpa.c -@@ -895,7 +895,8 @@ ieee80211_crypto_aes_cmac_256_encrypt(st - - info = IEEE80211_SKB_CB(skb); - -- if (info->control.hw_key) -+ if (info->control.hw_key && -+ !(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIE)) - return TX_CONTINUE; - - if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie))) -@@ -911,6 +912,9 @@ ieee80211_crypto_aes_cmac_256_encrypt(st - - bip_ipn_set64(mmie->sequence_number, pn64); - -+ if (info->control.hw_key) -+ return TX_CONTINUE; -+ - bip_aad(skb, aad); - - /* MIC = AES-256-CMAC(IGTK, AAD || Management Frame Body || MMIE, 128) -@@ -1040,7 +1044,8 @@ ieee80211_crypto_aes_gmac_encrypt(struct - - info = IEEE80211_SKB_CB(skb); - -- if (info->control.hw_key) -+ if (info->control.hw_key && -+ !(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIE)) - return TX_CONTINUE; - - if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie))) -@@ -1056,6 +1061,9 @@ ieee80211_crypto_aes_gmac_encrypt(struct - - bip_ipn_set64(mmie->sequence_number, pn64); - -+ if (info->control.hw_key) -+ return TX_CONTINUE; -+ - bip_aad(skb, aad); - - hdr = (struct ieee80211_hdr *)skb->data; diff --git a/package/kernel/mac80211/patches/subsys/332-wifi-cfg80211-Set-correct-chandef-when-starting-CAC.patch b/package/kernel/mac80211/patches/subsys/332-wifi-cfg80211-Set-correct-chandef-when-starting-CAC.patch new file mode 100644 index 00000000000..72a3510aacf --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/332-wifi-cfg80211-Set-correct-chandef-when-starting-CAC.patch @@ -0,0 +1,64 @@ +From: Issam Hamdi +Date: Fri, 16 Aug 2024 16:24:18 +0200 +Subject: [PATCH] wifi: cfg80211: Set correct chandef when starting CAC + +When starting CAC in a mode other than AP mode, it return a +"WARNING: CPU: 0 PID: 63 at cfg80211_chandef_dfs_usable+0x20/0xaf [cfg80211]" +caused by the chandef.chan being null at the end of CAC. + +Solution: Ensure the channel definition is set for the different modes +when starting CAC to avoid getting a NULL 'chan' at the end of CAC. + + Call Trace: + ? show_regs.part.0+0x14/0x16 + ? __warn+0x67/0xc0 + ? cfg80211_chandef_dfs_usable+0x20/0xaf [cfg80211] + ? report_bug+0xa7/0x130 + ? exc_overflow+0x30/0x30 + ? handle_bug+0x27/0x50 + ? exc_invalid_op+0x18/0x60 + ? handle_exception+0xf6/0xf6 + ? exc_overflow+0x30/0x30 + ? cfg80211_chandef_dfs_usable+0x20/0xaf [cfg80211] + ? exc_overflow+0x30/0x30 + ? cfg80211_chandef_dfs_usable+0x20/0xaf [cfg80211] + ? regulatory_propagate_dfs_state.cold+0x1b/0x4c [cfg80211] + ? cfg80211_propagate_cac_done_wk+0x1a/0x30 [cfg80211] + ? process_one_work+0x165/0x280 + ? worker_thread+0x120/0x3f0 + ? kthread+0xc2/0xf0 + ? process_one_work+0x280/0x280 + ? kthread_complete_and_exit+0x20/0x20 + ? ret_from_fork+0x19/0x24 + +Reported-by: Kretschmer Mathias +Signed-off-by: Issam Hamdi +Link: https://patch.msgid.link/20240816142418.3381951-1-ih@simonwunderlich.de +[shorten subject, remove OCB, reorder cases to match previous list] +Signed-off-by: Johannes Berg +--- + +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -10144,7 +10144,20 @@ static int nl80211_start_radar_detection + + err = rdev_start_radar_detection(rdev, dev, &chandef, cac_time_ms); + if (!err) { +- wdev->links[0].ap.chandef = chandef; ++ switch (wdev->iftype) { ++ case NL80211_IFTYPE_AP: ++ case NL80211_IFTYPE_P2P_GO: ++ wdev->links[0].ap.chandef = chandef; ++ break; ++ case NL80211_IFTYPE_ADHOC: ++ wdev->u.ibss.chandef = chandef; ++ break; ++ case NL80211_IFTYPE_MESH_POINT: ++ wdev->u.mesh.chandef = chandef; ++ break; ++ default: ++ break; ++ } + wdev->cac_started = true; + wdev->cac_start_time = jiffies; + wdev->cac_time_ms = cac_time_ms; diff --git a/package/kernel/mac80211/patches/subsys/333-Revert-wifi-mac80211-move-radar-detect-work-to-sdata.patch b/package/kernel/mac80211/patches/subsys/333-Revert-wifi-mac80211-move-radar-detect-work-to-sdata.patch new file mode 100644 index 00000000000..d12df8f53ea --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/333-Revert-wifi-mac80211-move-radar-detect-work-to-sdata.patch @@ -0,0 +1,136 @@ +From: Aditya Kumar Singh +Date: Fri, 6 Sep 2024 12:14:19 +0530 +Subject: [PATCH] Revert "wifi: mac80211: move radar detect work to sdata" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This reverts commit ce9e660ef32e ("wifi: mac80211: move radar detect work to sdata"). + +To enable radar detection with MLO, it’s essential to handle it on a +per-link basis. This is because when using MLO, multiple links may already +be active and beaconing. In this scenario, another link should be able to +initiate a radar detection. Also, if underlying links are associated with +different hardware devices but grouped together for MLO, they could +potentially start radar detection simultaneously. Therefore, it makes +sense to manage radar detection settings separately for each link by moving +them back to a per-link data structure. + +Signed-off-by: Aditya Kumar Singh +Link: https://patch.msgid.link/20240906064426.2101315-2-quic_adisi@quicinc.com +Signed-off-by: Johannes Berg +--- + +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -1658,7 +1658,7 @@ static int ieee80211_stop_ap(struct wiph + + if (sdata->wdev.cac_started) { + chandef = link_conf->chanreq.oper; +- wiphy_delayed_work_cancel(wiphy, &sdata->dfs_cac_timer_work); ++ wiphy_delayed_work_cancel(wiphy, &link->dfs_cac_timer_work); + cfg80211_cac_event(sdata->dev, &chandef, + NL80211_RADAR_CAC_ABORTED, + GFP_KERNEL); +@@ -3482,7 +3482,7 @@ static int ieee80211_start_radar_detecti + if (err) + goto out_unlock; + +- wiphy_delayed_work_queue(wiphy, &sdata->dfs_cac_timer_work, ++ wiphy_delayed_work_queue(wiphy, &sdata->deflink.dfs_cac_timer_work, + msecs_to_jiffies(cac_time_ms)); + + out_unlock: +@@ -3499,7 +3499,7 @@ static void ieee80211_end_cac(struct wip + + list_for_each_entry(sdata, &local->interfaces, list) { + wiphy_delayed_work_cancel(wiphy, +- &sdata->dfs_cac_timer_work); ++ &sdata->deflink.dfs_cac_timer_work); + + if (sdata->wdev.cac_started) { + ieee80211_link_release_channel(&sdata->deflink); +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -1069,6 +1069,7 @@ struct ieee80211_link_data { + int ap_power_level; /* in dBm */ + + bool radar_required; ++ struct wiphy_delayed_work dfs_cac_timer_work; + + union { + struct ieee80211_link_data_managed mgd; +@@ -1167,8 +1168,6 @@ struct ieee80211_sub_if_data { + struct ieee80211_link_data deflink; + struct ieee80211_link_data __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS]; + +- struct wiphy_delayed_work dfs_cac_timer_work; +- + /* for ieee80211_set_active_links_async() */ + struct wiphy_work activate_links_work; + u16 desired_active_links; +--- a/net/mac80211/iface.c ++++ b/net/mac80211/iface.c +@@ -551,7 +551,7 @@ static void ieee80211_do_stop(struct iee + wiphy_work_cancel(local->hw.wiphy, + &sdata->deflink.color_change_finalize_work); + wiphy_delayed_work_cancel(local->hw.wiphy, +- &sdata->dfs_cac_timer_work); ++ &sdata->deflink.dfs_cac_timer_work); + + if (sdata->wdev.cac_started) { + chandef = sdata->vif.bss_conf.chanreq.oper; +@@ -1744,8 +1744,6 @@ static void ieee80211_setup_sdata(struct + wiphy_work_init(&sdata->work, ieee80211_iface_work); + wiphy_work_init(&sdata->activate_links_work, + ieee80211_activate_links_work); +- wiphy_delayed_work_init(&sdata->dfs_cac_timer_work, +- ieee80211_dfs_cac_timer_work); + + switch (type) { + case NL80211_IFTYPE_P2P_GO: +--- a/net/mac80211/link.c ++++ b/net/mac80211/link.c +@@ -45,6 +45,8 @@ void ieee80211_link_init(struct ieee8021 + ieee80211_color_collision_detection_work); + INIT_LIST_HEAD(&link->assigned_chanctx_list); + INIT_LIST_HEAD(&link->reserved_chanctx_list); ++ wiphy_delayed_work_init(&link->dfs_cac_timer_work, ++ ieee80211_dfs_cac_timer_work); + + if (!deflink) { + switch (sdata->vif.type) { +--- a/net/mac80211/mlme.c ++++ b/net/mac80211/mlme.c +@@ -3031,15 +3031,16 @@ void ieee80211_dynamic_ps_timer(struct t + + void ieee80211_dfs_cac_timer_work(struct wiphy *wiphy, struct wiphy_work *work) + { +- struct ieee80211_sub_if_data *sdata = +- container_of(work, struct ieee80211_sub_if_data, ++ struct ieee80211_link_data *link = ++ container_of(work, struct ieee80211_link_data, + dfs_cac_timer_work.work); +- struct cfg80211_chan_def chandef = sdata->vif.bss_conf.chanreq.oper; ++ struct cfg80211_chan_def chandef = link->conf->chanreq.oper; ++ struct ieee80211_sub_if_data *sdata = link->sdata; + + lockdep_assert_wiphy(sdata->local->hw.wiphy); + + if (sdata->wdev.cac_started) { +- ieee80211_link_release_channel(&sdata->deflink); ++ ieee80211_link_release_channel(link); + cfg80211_cac_event(sdata->dev, &chandef, + NL80211_RADAR_CAC_FINISHED, + GFP_KERNEL); +--- a/net/mac80211/util.c ++++ b/net/mac80211/util.c +@@ -3460,7 +3460,7 @@ void ieee80211_dfs_cac_cancel(struct iee + + list_for_each_entry(sdata, &local->interfaces, list) { + wiphy_delayed_work_cancel(local->hw.wiphy, +- &sdata->dfs_cac_timer_work); ++ &sdata->deflink.dfs_cac_timer_work); + + if (sdata->wdev.cac_started) { + chandef = sdata->vif.bss_conf.chanreq.oper; diff --git a/package/kernel/mac80211/patches/subsys/334-wifi-mac80211-remove-label-usage-in-ieee80211_start_.patch b/package/kernel/mac80211/patches/subsys/334-wifi-mac80211-remove-label-usage-in-ieee80211_start_.patch new file mode 100644 index 00000000000..329b6454628 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/334-wifi-mac80211-remove-label-usage-in-ieee80211_start_.patch @@ -0,0 +1,50 @@ +From: Aditya Kumar Singh +Date: Fri, 6 Sep 2024 12:14:20 +0530 +Subject: [PATCH] wifi: mac80211: remove label usage in + ieee80211_start_radar_detection() + +After locks rework [1], ieee80211_start_radar_detection() function is no +longer acquiring any lock as such explicitly. Hence, it is not unlocking +anything as well. However, label "out_unlock" is still used which creates +confusion. Also, now there is no need of goto label as such. + +Get rid of the goto logic and use direct return statements. + +[1]: https://lore.kernel.org/all/20230828135928.b1c6efffe9ad.I4aec875e25abc9ef0b5ad1e70b5747fd483fbd3c@changeid/ + +Signed-off-by: Aditya Kumar Singh +Link: https://patch.msgid.link/20240906064426.2101315-3-quic_adisi@quicinc.com +Signed-off-by: Johannes Berg +--- + +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -3468,10 +3468,8 @@ static int ieee80211_start_radar_detecti + + lockdep_assert_wiphy(local->hw.wiphy); + +- if (!list_empty(&local->roc_list) || local->scanning) { +- err = -EBUSY; +- goto out_unlock; +- } ++ if (!list_empty(&local->roc_list) || local->scanning) ++ return -EBUSY; + + /* whatever, but channel contexts should not complain about that one */ + sdata->deflink.smps_mode = IEEE80211_SMPS_OFF; +@@ -3480,13 +3478,12 @@ static int ieee80211_start_radar_detecti + err = ieee80211_link_use_channel(&sdata->deflink, &chanreq, + IEEE80211_CHANCTX_SHARED); + if (err) +- goto out_unlock; ++ return err; + + wiphy_delayed_work_queue(wiphy, &sdata->deflink.dfs_cac_timer_work, + msecs_to_jiffies(cac_time_ms)); + +- out_unlock: +- return err; ++ return 0; + } + + static void ieee80211_end_cac(struct wiphy *wiphy, diff --git a/package/kernel/mac80211/patches/subsys/335-wifi-trace-unlink-rdev_end_cac-trace-event-from-wiph.patch b/package/kernel/mac80211/patches/subsys/335-wifi-trace-unlink-rdev_end_cac-trace-event-from-wiph.patch new file mode 100644 index 00000000000..98bc0c26fdb --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/335-wifi-trace-unlink-rdev_end_cac-trace-event-from-wiph.patch @@ -0,0 +1,42 @@ +From: Aditya Kumar Singh +Date: Fri, 6 Sep 2024 12:14:21 +0530 +Subject: [PATCH] wifi: trace: unlink rdev_end_cac trace event from + wiphy_netdev_evt class + +rdev_end_cac trace event is linked with wiphy_netdev_evt event class. +There is no option to pass link ID currently to wiphy_netdev_evt class. +A subsequent change would pass link ID to rdev_end_cac event and hence +it can no longer derive the event class from wiphy_netdev_evt. + +Therefore, unlink rdev_end_cac event from wiphy_netdev_evt and define it's +own independent trace event. Link ID would be passed in subsequent change. + +Signed-off-by: Aditya Kumar Singh +Link: https://patch.msgid.link/20240906064426.2101315-4-quic_adisi@quicinc.com +Signed-off-by: Johannes Berg +--- + +--- a/net/wireless/trace.h ++++ b/net/wireless/trace.h +@@ -805,9 +805,18 @@ DEFINE_EVENT(wiphy_netdev_evt, rdev_flus + TP_ARGS(wiphy, netdev) + ); + +-DEFINE_EVENT(wiphy_netdev_evt, rdev_end_cac, +- TP_PROTO(struct wiphy *wiphy, struct net_device *netdev), +- TP_ARGS(wiphy, netdev) ++TRACE_EVENT(rdev_end_cac, ++ TP_PROTO(struct wiphy *wiphy, struct net_device *netdev), ++ TP_ARGS(wiphy, netdev), ++ TP_STRUCT__entry( ++ WIPHY_ENTRY ++ NETDEV_ENTRY ++ ), ++ TP_fast_assign( ++ WIPHY_ASSIGN; ++ NETDEV_ASSIGN; ++ ), ++ TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT, WIPHY_PR_ARG, NETDEV_PR_ARG) + ); + + DECLARE_EVENT_CLASS(station_add_change, diff --git a/package/kernel/mac80211/patches/subsys/336-wifi-cfg80211-move-DFS-related-members-to-links-in-w.patch b/package/kernel/mac80211/patches/subsys/336-wifi-cfg80211-move-DFS-related-members-to-links-in-w.patch new file mode 100644 index 00000000000..95dac04de5e --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/336-wifi-cfg80211-move-DFS-related-members-to-links-in-w.patch @@ -0,0 +1,309 @@ +From: Aditya Kumar Singh +Date: Fri, 6 Sep 2024 12:14:22 +0530 +Subject: [PATCH] wifi: cfg80211: move DFS related members to links[] in + wireless_dev + +A few members related to DFS handling are currently under per wireless +device data structure. However, in order to support DFS with MLO, there is +a need to have them on a per-link manner. + +Hence, as a preliminary step, move members cac_started, cac_start_time +and cac_time_ms to be on a per-link basis. + +Since currently, link ID is not known at all places, use default value of +0 for now. + +Signed-off-by: Aditya Kumar Singh +Link: https://patch.msgid.link/20240906064426.2101315-5-quic_adisi@quicinc.com +Signed-off-by: Johannes Berg +--- + +--- a/drivers/net/wireless/marvell/mwifiex/11h.c ++++ b/drivers/net/wireless/marvell/mwifiex/11h.c +@@ -117,7 +117,7 @@ void mwifiex_dfs_cac_work_queue(struct w + dfs_cac_work); + + chandef = priv->dfs_chandef; +- if (priv->wdev.cac_started) { ++ if (priv->wdev.links[0].cac_started) { + mwifiex_dbg(priv->adapter, MSG, + "CAC timer finished; No radar detected\n"); + cfg80211_cac_event(priv->netdev, &chandef, +@@ -174,7 +174,7 @@ int mwifiex_stop_radar_detection(struct + */ + void mwifiex_abort_cac(struct mwifiex_private *priv) + { +- if (priv->wdev.cac_started) { ++ if (priv->wdev.links[0].cac_started) { + if (mwifiex_stop_radar_detection(priv, &priv->dfs_chandef)) + mwifiex_dbg(priv->adapter, ERROR, + "failed to stop CAC in FW\n"); +--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c ++++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c +@@ -1880,7 +1880,7 @@ mwifiex_cfg80211_del_station(struct wiph + struct mwifiex_sta_node *sta_node; + u8 deauth_mac[ETH_ALEN]; + +- if (!priv->bss_started && priv->wdev.cac_started) { ++ if (!priv->bss_started && priv->wdev.links[0].cac_started) { + mwifiex_dbg(priv->adapter, INFO, "%s: abort CAC!\n", __func__); + mwifiex_abort_cac(priv); + } +@@ -3978,7 +3978,7 @@ mwifiex_cfg80211_channel_switch(struct w + return -EBUSY; + } + +- if (priv->wdev.cac_started) ++ if (priv->wdev.links[0].cac_started) + return -EBUSY; + + if (cfg80211_chandef_identical(¶ms->chandef, +--- a/drivers/net/wireless/quantenna/qtnfmac/event.c ++++ b/drivers/net/wireless/quantenna/qtnfmac/event.c +@@ -520,21 +520,21 @@ static int qtnf_event_handle_radar(struc + cfg80211_radar_event(wiphy, &chandef, GFP_KERNEL); + break; + case QLINK_RADAR_CAC_FINISHED: +- if (!vif->wdev.cac_started) ++ if (!vif->wdev.links[0].cac_started) + break; + + cfg80211_cac_event(vif->netdev, &chandef, + NL80211_RADAR_CAC_FINISHED, GFP_KERNEL); + break; + case QLINK_RADAR_CAC_ABORTED: +- if (!vif->wdev.cac_started) ++ if (!vif->wdev.links[0].cac_started) + break; + + cfg80211_cac_event(vif->netdev, &chandef, + NL80211_RADAR_CAC_ABORTED, GFP_KERNEL); + break; + case QLINK_RADAR_CAC_STARTED: +- if (vif->wdev.cac_started) ++ if (vif->wdev.links[0].cac_started) + break; + + if (!wiphy_ext_feature_isset(wiphy, +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -6198,9 +6198,6 @@ enum ieee80211_ap_reg_power { + * @address: The address for this device, valid only if @netdev is %NULL + * @is_running: true if this is a non-netdev device that has been started, e.g. + * the P2P Device. +- * @cac_started: true if DFS channel availability check has been started +- * @cac_start_time: timestamp (jiffies) when the dfs state was entered. +- * @cac_time_ms: CAC time in ms + * @ps: powersave mode is enabled + * @ps_timeout: dynamic powersave timeout + * @ap_unexpected_nlportid: (private) netlink port ID of application +@@ -6224,6 +6221,11 @@ enum ieee80211_ap_reg_power { + * unprotected beacon report + * @links: array of %IEEE80211_MLD_MAX_NUM_LINKS elements containing @addr + * @ap and @client for each link ++ * @links[].cac_started: true if DFS channel availability check has been ++ * started ++ * @links[].cac_start_time: timestamp (jiffies) when the dfs state was ++ * entered. ++ * @links[].cac_time_ms: CAC time in ms + * @valid_links: bitmap describing what elements of @links are valid + */ + struct wireless_dev { +@@ -6265,11 +6267,6 @@ struct wireless_dev { + u32 owner_nlportid; + bool nl_owner_dead; + +- /* FIXME: need to rework radar detection for MLO */ +- bool cac_started; +- unsigned long cac_start_time; +- unsigned int cac_time_ms; +- + #ifdef CPTCFG_CFG80211_WEXT + /* wext data */ + struct { +@@ -6336,6 +6333,10 @@ struct wireless_dev { + struct cfg80211_internal_bss *current_bss; + } client; + }; ++ ++ bool cac_started; ++ unsigned long cac_start_time; ++ unsigned int cac_time_ms; + } links[IEEE80211_MLD_MAX_NUM_LINKS]; + u16 valid_links; + }; +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -1656,7 +1656,7 @@ static int ieee80211_stop_ap(struct wiph + ieee80211_link_info_change_notify(sdata, link, + BSS_CHANGED_BEACON_ENABLED); + +- if (sdata->wdev.cac_started) { ++ if (sdata->wdev.links[0].cac_started) { + chandef = link_conf->chanreq.oper; + wiphy_delayed_work_cancel(wiphy, &link->dfs_cac_timer_work); + cfg80211_cac_event(sdata->dev, &chandef, +@@ -3498,9 +3498,9 @@ static void ieee80211_end_cac(struct wip + wiphy_delayed_work_cancel(wiphy, + &sdata->deflink.dfs_cac_timer_work); + +- if (sdata->wdev.cac_started) { ++ if (sdata->wdev.links[0].cac_started) { + ieee80211_link_release_channel(&sdata->deflink); +- sdata->wdev.cac_started = false; ++ sdata->wdev.links[0].cac_started = false; + } + } + } +@@ -3955,7 +3955,7 @@ __ieee80211_channel_switch(struct wiphy + if (!list_empty(&local->roc_list) || local->scanning) + return -EBUSY; + +- if (sdata->wdev.cac_started) ++ if (sdata->wdev.links[0].cac_started) + return -EBUSY; + + if (WARN_ON(link_id >= IEEE80211_MLD_MAX_NUM_LINKS)) +--- a/net/mac80211/iface.c ++++ b/net/mac80211/iface.c +@@ -553,7 +553,7 @@ static void ieee80211_do_stop(struct iee + wiphy_delayed_work_cancel(local->hw.wiphy, + &sdata->deflink.dfs_cac_timer_work); + +- if (sdata->wdev.cac_started) { ++ if (sdata->wdev.links[0].cac_started) { + chandef = sdata->vif.bss_conf.chanreq.oper; + WARN_ON(local->suspended); + ieee80211_link_release_channel(&sdata->deflink); +--- a/net/mac80211/mlme.c ++++ b/net/mac80211/mlme.c +@@ -3039,7 +3039,7 @@ void ieee80211_dfs_cac_timer_work(struct + + lockdep_assert_wiphy(sdata->local->hw.wiphy); + +- if (sdata->wdev.cac_started) { ++ if (sdata->wdev.links[0].cac_started) { + ieee80211_link_release_channel(link); + cfg80211_cac_event(sdata->dev, &chandef, + NL80211_RADAR_CAC_FINISHED, +--- a/net/mac80211/scan.c ++++ b/net/mac80211/scan.c +@@ -585,7 +585,7 @@ static bool __ieee80211_can_leave_ch(str + return false; + + list_for_each_entry(sdata_iter, &local->interfaces, list) { +- if (sdata_iter->wdev.cac_started) ++ if (sdata_iter->wdev.links[0].cac_started) + return false; + } + +--- a/net/mac80211/util.c ++++ b/net/mac80211/util.c +@@ -3462,7 +3462,7 @@ void ieee80211_dfs_cac_cancel(struct iee + wiphy_delayed_work_cancel(local->hw.wiphy, + &sdata->deflink.dfs_cac_timer_work); + +- if (sdata->wdev.cac_started) { ++ if (sdata->wdev.links[0].cac_started) { + chandef = sdata->vif.bss_conf.chanreq.oper; + ieee80211_link_release_channel(&sdata->deflink); + cfg80211_cac_event(sdata->dev, +--- a/net/wireless/ibss.c ++++ b/net/wireless/ibss.c +@@ -94,7 +94,7 @@ int __cfg80211_join_ibss(struct cfg80211 + + lockdep_assert_held(&rdev->wiphy.mtx); + +- if (wdev->cac_started) ++ if (wdev->links[0].cac_started) + return -EBUSY; + + if (wdev->u.ibss.ssid_len) +--- a/net/wireless/mesh.c ++++ b/net/wireless/mesh.c +@@ -127,7 +127,7 @@ int __cfg80211_join_mesh(struct cfg80211 + if (!rdev->ops->join_mesh) + return -EOPNOTSUPP; + +- if (wdev->cac_started) ++ if (wdev->links[0].cac_started) + return -EBUSY; + + if (!setup->chandef.chan) { +--- a/net/wireless/mlme.c ++++ b/net/wireless/mlme.c +@@ -1124,13 +1124,14 @@ void cfg80211_cac_event(struct net_devic + + trace_cfg80211_cac_event(netdev, event); + +- if (WARN_ON(!wdev->cac_started && event != NL80211_RADAR_CAC_STARTED)) ++ if (WARN_ON(!wdev->links[0].cac_started && ++ event != NL80211_RADAR_CAC_STARTED)) + return; + + switch (event) { + case NL80211_RADAR_CAC_FINISHED: +- timeout = wdev->cac_start_time + +- msecs_to_jiffies(wdev->cac_time_ms); ++ timeout = wdev->links[0].cac_start_time + ++ msecs_to_jiffies(wdev->links[0].cac_time_ms); + WARN_ON(!time_after_eq(jiffies, timeout)); + cfg80211_set_dfs_state(wiphy, chandef, NL80211_DFS_AVAILABLE); + memcpy(&rdev->cac_done_chandef, chandef, +@@ -1139,10 +1140,10 @@ void cfg80211_cac_event(struct net_devic + cfg80211_sched_dfs_chan_update(rdev); + fallthrough; + case NL80211_RADAR_CAC_ABORTED: +- wdev->cac_started = false; ++ wdev->links[0].cac_started = false; + break; + case NL80211_RADAR_CAC_STARTED: +- wdev->cac_started = true; ++ wdev->links[0].cac_started = true; + break; + default: + WARN_ON(1); +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -6066,7 +6066,7 @@ static int nl80211_start_ap(struct sk_bu + if (!rdev->ops->start_ap) + return -EOPNOTSUPP; + +- if (wdev->cac_started) ++ if (wdev->links[0].cac_started) + return -EBUSY; + + if (wdev->links[link_id].ap.beacon_interval) +@@ -10122,7 +10122,7 @@ static int nl80211_start_radar_detection + goto unlock; + } + +- if (cfg80211_beaconing_iface_active(wdev) || wdev->cac_started) { ++ if (cfg80211_beaconing_iface_active(wdev) || wdev->links[0].cac_started) { + err = -EBUSY; + goto unlock; + } +@@ -10158,9 +10158,9 @@ static int nl80211_start_radar_detection + default: + break; + } +- wdev->cac_started = true; +- wdev->cac_start_time = jiffies; +- wdev->cac_time_ms = cac_time_ms; ++ wdev->links[0].cac_started = true; ++ wdev->links[0].cac_start_time = jiffies; ++ wdev->links[0].cac_time_ms = cac_time_ms; + } + unlock: + wiphy_unlock(wiphy); +--- a/net/wireless/reg.c ++++ b/net/wireless/reg.c +@@ -4241,7 +4241,7 @@ static void cfg80211_check_and_end_cac(s + list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { + struct cfg80211_chan_def *chandef; + +- if (!wdev->cac_started) ++ if (!wdev->links[0].cac_started) + continue; + + /* FIXME: radar detection is tied to link 0 for now */ diff --git a/package/kernel/mac80211/patches/subsys/337-wifi-cfg80211-handle-DFS-per-link.patch b/package/kernel/mac80211/patches/subsys/337-wifi-cfg80211-handle-DFS-per-link.patch new file mode 100644 index 00000000000..a4e0333642a --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/337-wifi-cfg80211-handle-DFS-per-link.patch @@ -0,0 +1,435 @@ +From: Aditya Kumar Singh +Date: Fri, 6 Sep 2024 12:14:23 +0530 +Subject: [PATCH] wifi: cfg80211: handle DFS per link + +Currently, during starting a radar detection, no link id information is +parsed and passed down. In order to support starting radar detection +during Multi Link Operation, it is required to pass link id as well. + +Add changes to first parse and then pass link id in the start radar +detection path. + +Additionally, update notification APIs to allow drivers/mac80211 to +pass the link ID. + +However, everything is handled at link 0 only until all API's are ready to +handle it per link. + +Signed-off-by: Aditya Kumar Singh +Link: https://patch.msgid.link/20240906064426.2101315-6-quic_adisi@quicinc.com +Signed-off-by: Johannes Berg +--- + +--- a/drivers/net/wireless/marvell/mwifiex/11h.c ++++ b/drivers/net/wireless/marvell/mwifiex/11h.c +@@ -122,7 +122,7 @@ void mwifiex_dfs_cac_work_queue(struct w + "CAC timer finished; No radar detected\n"); + cfg80211_cac_event(priv->netdev, &chandef, + NL80211_RADAR_CAC_FINISHED, +- GFP_KERNEL); ++ GFP_KERNEL, 0); + } + } + +@@ -182,7 +182,8 @@ void mwifiex_abort_cac(struct mwifiex_pr + "Aborting delayed work for CAC.\n"); + cancel_delayed_work_sync(&priv->dfs_cac_work); + cfg80211_cac_event(priv->netdev, &priv->dfs_chandef, +- NL80211_RADAR_CAC_ABORTED, GFP_KERNEL); ++ NL80211_RADAR_CAC_ABORTED, GFP_KERNEL, ++ 0); + } + } + +@@ -221,7 +222,7 @@ int mwifiex_11h_handle_chanrpt_ready(str + cfg80211_cac_event(priv->netdev, + &priv->dfs_chandef, + NL80211_RADAR_DETECTED, +- GFP_KERNEL); ++ GFP_KERNEL, 0); + } + break; + default: +--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c ++++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c +@@ -4145,7 +4145,7 @@ static int + mwifiex_cfg80211_start_radar_detection(struct wiphy *wiphy, + struct net_device *dev, + struct cfg80211_chan_def *chandef, +- u32 cac_time_ms) ++ u32 cac_time_ms, int link_id) + { + struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); + struct mwifiex_radar_params radar_params; +--- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c ++++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +@@ -837,7 +837,7 @@ static int qtnf_channel_switch(struct wi + static int qtnf_start_radar_detection(struct wiphy *wiphy, + struct net_device *ndev, + struct cfg80211_chan_def *chandef, +- u32 cac_time_ms) ++ u32 cac_time_ms, int link_id) + { + struct qtnf_vif *vif = qtnf_netdev_get_priv(ndev); + int ret; +--- a/drivers/net/wireless/quantenna/qtnfmac/event.c ++++ b/drivers/net/wireless/quantenna/qtnfmac/event.c +@@ -524,14 +524,14 @@ static int qtnf_event_handle_radar(struc + break; + + cfg80211_cac_event(vif->netdev, &chandef, +- NL80211_RADAR_CAC_FINISHED, GFP_KERNEL); ++ NL80211_RADAR_CAC_FINISHED, GFP_KERNEL, 0); + break; + case QLINK_RADAR_CAC_ABORTED: + if (!vif->wdev.links[0].cac_started) + break; + + cfg80211_cac_event(vif->netdev, &chandef, +- NL80211_RADAR_CAC_ABORTED, GFP_KERNEL); ++ NL80211_RADAR_CAC_ABORTED, GFP_KERNEL, 0); + break; + case QLINK_RADAR_CAC_STARTED: + if (vif->wdev.links[0].cac_started) +@@ -542,7 +542,7 @@ static int qtnf_event_handle_radar(struc + break; + + cfg80211_cac_event(vif->netdev, &chandef, +- NL80211_RADAR_CAC_STARTED, GFP_KERNEL); ++ NL80211_RADAR_CAC_STARTED, GFP_KERNEL, 0); + break; + default: + pr_warn("%s: unhandled radar event %u\n", +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -4841,9 +4841,9 @@ struct cfg80211_ops { + int (*start_radar_detection)(struct wiphy *wiphy, + struct net_device *dev, + struct cfg80211_chan_def *chandef, +- u32 cac_time_ms); ++ u32 cac_time_ms, int link_id); + void (*end_cac)(struct wiphy *wiphy, +- struct net_device *dev); ++ struct net_device *dev, unsigned int link_id); + int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_update_ft_ies_params *ftie); + int (*crit_proto_start)(struct wiphy *wiphy, +@@ -8745,6 +8745,7 @@ void cfg80211_sta_opmode_change_notify(s + * @chandef: chandef for the current channel + * @event: type of event + * @gfp: context flags ++ * @link_id: valid link_id for MLO operation or 0 otherwise. + * + * This function is called when a Channel availability check (CAC) is finished + * or aborted. This must be called to notify the completion of a CAC process, +@@ -8752,7 +8753,8 @@ void cfg80211_sta_opmode_change_notify(s + */ + void cfg80211_cac_event(struct net_device *netdev, + const struct cfg80211_chan_def *chandef, +- enum nl80211_radar_event event, gfp_t gfp); ++ enum nl80211_radar_event event, gfp_t gfp, ++ unsigned int link_id); + + /** + * cfg80211_background_cac_abort - Channel Availability Check offchan abort event +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -1661,7 +1661,7 @@ static int ieee80211_stop_ap(struct wiph + wiphy_delayed_work_cancel(wiphy, &link->dfs_cac_timer_work); + cfg80211_cac_event(sdata->dev, &chandef, + NL80211_RADAR_CAC_ABORTED, +- GFP_KERNEL); ++ GFP_KERNEL, 0); + } + + drv_stop_ap(sdata->local, sdata, link_conf); +@@ -3459,7 +3459,7 @@ static int ieee80211_set_bitrate_mask(st + static int ieee80211_start_radar_detection(struct wiphy *wiphy, + struct net_device *dev, + struct cfg80211_chan_def *chandef, +- u32 cac_time_ms) ++ u32 cac_time_ms, int link_id) + { + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); + struct ieee80211_chan_req chanreq = { .oper = *chandef }; +@@ -3487,7 +3487,7 @@ static int ieee80211_start_radar_detecti + } + + static void ieee80211_end_cac(struct wiphy *wiphy, +- struct net_device *dev) ++ struct net_device *dev, unsigned int link_id) + { + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); + struct ieee80211_local *local = sdata->local; +--- a/net/mac80211/iface.c ++++ b/net/mac80211/iface.c +@@ -559,7 +559,7 @@ static void ieee80211_do_stop(struct iee + ieee80211_link_release_channel(&sdata->deflink); + cfg80211_cac_event(sdata->dev, &chandef, + NL80211_RADAR_CAC_ABORTED, +- GFP_KERNEL); ++ GFP_KERNEL, 0); + } + + if (sdata->vif.type == NL80211_IFTYPE_AP) { +--- a/net/mac80211/mlme.c ++++ b/net/mac80211/mlme.c +@@ -3043,7 +3043,7 @@ void ieee80211_dfs_cac_timer_work(struct + ieee80211_link_release_channel(link); + cfg80211_cac_event(sdata->dev, &chandef, + NL80211_RADAR_CAC_FINISHED, +- GFP_KERNEL); ++ GFP_KERNEL, 0); + } + } + +--- a/net/mac80211/util.c ++++ b/net/mac80211/util.c +@@ -3468,7 +3468,7 @@ void ieee80211_dfs_cac_cancel(struct iee + cfg80211_cac_event(sdata->dev, + &chandef, + NL80211_RADAR_CAC_ABORTED, +- GFP_KERNEL); ++ GFP_KERNEL, 0); + } + } + } +--- a/net/wireless/mlme.c ++++ b/net/wireless/mlme.c +@@ -1111,18 +1111,19 @@ EXPORT_SYMBOL(__cfg80211_radar_event); + + void cfg80211_cac_event(struct net_device *netdev, + const struct cfg80211_chan_def *chandef, +- enum nl80211_radar_event event, gfp_t gfp) ++ enum nl80211_radar_event event, gfp_t gfp, ++ unsigned int link_id) + { + struct wireless_dev *wdev = netdev->ieee80211_ptr; + struct wiphy *wiphy = wdev->wiphy; + struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); + unsigned long timeout; + +- /* not yet supported */ +- if (wdev->valid_links) ++ if (WARN_ON(wdev->valid_links && ++ !(wdev->valid_links & BIT(link_id)))) + return; + +- trace_cfg80211_cac_event(netdev, event); ++ trace_cfg80211_cac_event(netdev, event, link_id); + + if (WARN_ON(!wdev->links[0].cac_started && + event != NL80211_RADAR_CAC_STARTED)) +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -10122,7 +10122,20 @@ static int nl80211_start_radar_detection + goto unlock; + } + +- if (cfg80211_beaconing_iface_active(wdev) || wdev->links[0].cac_started) { ++ if (cfg80211_beaconing_iface_active(wdev)) { ++ /* During MLO other link(s) can beacon, only the current link ++ * can not already beacon ++ */ ++ if (wdev->valid_links && ++ !wdev->links[0].ap.beacon_interval) { ++ /* nothing */ ++ } else { ++ err = -EBUSY; ++ goto unlock; ++ } ++ } ++ ++ if (wdev->links[0].cac_started) { + err = -EBUSY; + goto unlock; + } +@@ -10142,7 +10155,8 @@ static int nl80211_start_radar_detection + if (WARN_ON(!cac_time_ms)) + cac_time_ms = IEEE80211_DFS_MIN_CAC_TIME_MS; + +- err = rdev_start_radar_detection(rdev, dev, &chandef, cac_time_ms); ++ err = rdev_start_radar_detection(rdev, dev, &chandef, cac_time_ms, ++ 0); + if (!err) { + switch (wdev->iftype) { + case NL80211_IFTYPE_AP: +@@ -16512,10 +16526,10 @@ nl80211_set_ttlm(struct sk_buff *skb, st + SELECTOR(__sel, NETDEV_UP_NOTMX, \ + NL80211_FLAG_NEED_NETDEV_UP | \ + NL80211_FLAG_NO_WIPHY_MTX) \ +- SELECTOR(__sel, NETDEV_UP_NOTMX_NOMLO, \ ++ SELECTOR(__sel, NETDEV_UP_NOTMX_MLO, \ + NL80211_FLAG_NEED_NETDEV_UP | \ + NL80211_FLAG_NO_WIPHY_MTX | \ +- NL80211_FLAG_MLO_UNSUPPORTED) \ ++ NL80211_FLAG_MLO_VALID_LINK_ID) \ + SELECTOR(__sel, NETDEV_UP_CLEAR, \ + NL80211_FLAG_NEED_NETDEV_UP | \ + NL80211_FLAG_CLEAR_SKB) \ +@@ -17410,7 +17424,7 @@ static const struct genl_small_ops nl802 + .flags = GENL_UNS_ADMIN_PERM, + .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP | + NL80211_FLAG_NO_WIPHY_MTX | +- NL80211_FLAG_MLO_UNSUPPORTED), ++ NL80211_FLAG_MLO_VALID_LINK_ID), + }, + { + .cmd = NL80211_CMD_GET_PROTOCOL_FEATURES, +--- a/net/wireless/rdev-ops.h ++++ b/net/wireless/rdev-ops.h +@@ -1200,26 +1200,27 @@ static inline int + rdev_start_radar_detection(struct cfg80211_registered_device *rdev, + struct net_device *dev, + struct cfg80211_chan_def *chandef, +- u32 cac_time_ms) ++ u32 cac_time_ms, int link_id) + { + int ret = -EOPNOTSUPP; + + trace_rdev_start_radar_detection(&rdev->wiphy, dev, chandef, +- cac_time_ms); ++ cac_time_ms, link_id); + if (rdev->ops->start_radar_detection) + ret = rdev->ops->start_radar_detection(&rdev->wiphy, dev, +- chandef, cac_time_ms); ++ chandef, cac_time_ms, ++ link_id); + trace_rdev_return_int(&rdev->wiphy, ret); + return ret; + } + + static inline void + rdev_end_cac(struct cfg80211_registered_device *rdev, +- struct net_device *dev) ++ struct net_device *dev, unsigned int link_id) + { +- trace_rdev_end_cac(&rdev->wiphy, dev); ++ trace_rdev_end_cac(&rdev->wiphy, dev, link_id); + if (rdev->ops->end_cac) +- rdev->ops->end_cac(&rdev->wiphy, dev); ++ rdev->ops->end_cac(&rdev->wiphy, dev, link_id); + trace_rdev_return_void(&rdev->wiphy); + } + +--- a/net/wireless/reg.c ++++ b/net/wireless/reg.c +@@ -4229,6 +4229,8 @@ EXPORT_SYMBOL(regulatory_pre_cac_allowed + static void cfg80211_check_and_end_cac(struct cfg80211_registered_device *rdev) + { + struct wireless_dev *wdev; ++ unsigned int link_id; ++ + /* If we finished CAC or received radar, we should end any + * CAC running on the same channels. + * the check !cfg80211_chandef_dfs_usable contain 2 options: +@@ -4241,16 +4243,17 @@ static void cfg80211_check_and_end_cac(s + list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { + struct cfg80211_chan_def *chandef; + +- if (!wdev->links[0].cac_started) +- continue; ++ for_each_valid_link(wdev, link_id) { ++ if (!wdev->links[link_id].cac_started) ++ continue; + +- /* FIXME: radar detection is tied to link 0 for now */ +- chandef = wdev_chandef(wdev, 0); +- if (!chandef) +- continue; ++ chandef = wdev_chandef(wdev, link_id); ++ if (!chandef) ++ continue; + +- if (!cfg80211_chandef_dfs_usable(&rdev->wiphy, chandef)) +- rdev_end_cac(rdev, wdev->netdev); ++ if (!cfg80211_chandef_dfs_usable(&rdev->wiphy, chandef)) ++ rdev_end_cac(rdev, wdev->netdev, link_id); ++ } + } + } + +--- a/net/wireless/trace.h ++++ b/net/wireless/trace.h +@@ -806,17 +806,21 @@ DEFINE_EVENT(wiphy_netdev_evt, rdev_flus + ); + + TRACE_EVENT(rdev_end_cac, +- TP_PROTO(struct wiphy *wiphy, struct net_device *netdev), +- TP_ARGS(wiphy, netdev), ++ TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, ++ unsigned int link_id), ++ TP_ARGS(wiphy, netdev, link_id), + TP_STRUCT__entry( + WIPHY_ENTRY + NETDEV_ENTRY ++ __field(unsigned int, link_id) + ), + TP_fast_assign( + WIPHY_ASSIGN; + NETDEV_ASSIGN; ++ __entry->link_id = link_id; + ), +- TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT, WIPHY_PR_ARG, NETDEV_PR_ARG) ++ TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", link_id: %d", ++ WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->link_id) + ); + + DECLARE_EVENT_CLASS(station_add_change, +@@ -2661,24 +2665,26 @@ TRACE_EVENT(rdev_external_auth, + TRACE_EVENT(rdev_start_radar_detection, + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, + struct cfg80211_chan_def *chandef, +- u32 cac_time_ms), +- TP_ARGS(wiphy, netdev, chandef, cac_time_ms), ++ u32 cac_time_ms, int link_id), ++ TP_ARGS(wiphy, netdev, chandef, cac_time_ms, link_id), + TP_STRUCT__entry( + WIPHY_ENTRY + NETDEV_ENTRY + CHAN_DEF_ENTRY + __field(u32, cac_time_ms) ++ __field(int, link_id) + ), + TP_fast_assign( + WIPHY_ASSIGN; + NETDEV_ASSIGN; + CHAN_DEF_ASSIGN(chandef); + __entry->cac_time_ms = cac_time_ms; ++ __entry->link_id = link_id; + ), + TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT +- ", cac_time_ms=%u", ++ ", cac_time_ms=%u, link_id=%d", + WIPHY_PR_ARG, NETDEV_PR_ARG, CHAN_DEF_PR_ARG, +- __entry->cac_time_ms) ++ __entry->cac_time_ms, __entry->link_id) + ); + + TRACE_EVENT(rdev_set_mcast_rate, +@@ -3492,18 +3498,21 @@ TRACE_EVENT(cfg80211_radar_event, + ); + + TRACE_EVENT(cfg80211_cac_event, +- TP_PROTO(struct net_device *netdev, enum nl80211_radar_event evt), +- TP_ARGS(netdev, evt), ++ TP_PROTO(struct net_device *netdev, enum nl80211_radar_event evt, ++ unsigned int link_id), ++ TP_ARGS(netdev, evt, link_id), + TP_STRUCT__entry( + NETDEV_ENTRY + __field(enum nl80211_radar_event, evt) ++ __field(unsigned int, link_id) + ), + TP_fast_assign( + NETDEV_ASSIGN; + __entry->evt = evt; ++ __entry->link_id = link_id; + ), +- TP_printk(NETDEV_PR_FMT ", event: %d", +- NETDEV_PR_ARG, __entry->evt) ++ TP_printk(NETDEV_PR_FMT ", event: %d, link_id=%u", ++ NETDEV_PR_ARG, __entry->evt, __entry->link_id) + ); + + DECLARE_EVENT_CLASS(cfg80211_rx_evt, diff --git a/package/kernel/mac80211/patches/subsys/338-wifi-mac80211-handle-DFS-per-link.patch b/package/kernel/mac80211/patches/subsys/338-wifi-mac80211-handle-DFS-per-link.patch new file mode 100644 index 00000000000..388c0575c88 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/338-wifi-mac80211-handle-DFS-per-link.patch @@ -0,0 +1,134 @@ +From: Aditya Kumar Singh +Date: Fri, 6 Sep 2024 12:14:24 +0530 +Subject: [PATCH] wifi: mac80211: handle DFS per link + +In order to support DFS with MLO, handle the link ID now passed from +cfg80211, adjust the code to do everything per link and call the +notifications to cfg80211 correctly. + +Signed-off-by: Aditya Kumar Singh +Link: https://patch.msgid.link/20240906064426.2101315-7-quic_adisi@quicinc.com +Signed-off-by: Johannes Berg +--- + +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -3464,6 +3464,7 @@ static int ieee80211_start_radar_detecti + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); + struct ieee80211_chan_req chanreq = { .oper = *chandef }; + struct ieee80211_local *local = sdata->local; ++ struct ieee80211_link_data *link_data; + int err; + + lockdep_assert_wiphy(local->hw.wiphy); +@@ -3471,16 +3472,20 @@ static int ieee80211_start_radar_detecti + if (!list_empty(&local->roc_list) || local->scanning) + return -EBUSY; + ++ link_data = sdata_dereference(sdata->link[link_id], sdata); ++ if (!link_data) ++ return -ENOLINK; ++ + /* whatever, but channel contexts should not complain about that one */ +- sdata->deflink.smps_mode = IEEE80211_SMPS_OFF; +- sdata->deflink.needed_rx_chains = local->rx_chains; ++ link_data->smps_mode = IEEE80211_SMPS_OFF; ++ link_data->needed_rx_chains = local->rx_chains; + +- err = ieee80211_link_use_channel(&sdata->deflink, &chanreq, ++ err = ieee80211_link_use_channel(link_data, &chanreq, + IEEE80211_CHANCTX_SHARED); + if (err) + return err; + +- wiphy_delayed_work_queue(wiphy, &sdata->deflink.dfs_cac_timer_work, ++ wiphy_delayed_work_queue(wiphy, &link_data->dfs_cac_timer_work, + msecs_to_jiffies(cac_time_ms)); + + return 0; +@@ -3491,16 +3496,21 @@ static void ieee80211_end_cac(struct wip + { + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); + struct ieee80211_local *local = sdata->local; ++ struct ieee80211_link_data *link_data; + + lockdep_assert_wiphy(local->hw.wiphy); + + list_for_each_entry(sdata, &local->interfaces, list) { ++ link_data = sdata_dereference(sdata->link[link_id], sdata); ++ if (!link_data) ++ continue; ++ + wiphy_delayed_work_cancel(wiphy, +- &sdata->deflink.dfs_cac_timer_work); ++ &link_data->dfs_cac_timer_work); + +- if (sdata->wdev.links[0].cac_started) { +- ieee80211_link_release_channel(&sdata->deflink); +- sdata->wdev.links[0].cac_started = false; ++ if (sdata->wdev.links[link_id].cac_started) { ++ ieee80211_link_release_channel(link_data); ++ sdata->wdev.links[link_id].cac_started = false; + } + } + } +--- a/net/mac80211/link.c ++++ b/net/mac80211/link.c +@@ -77,6 +77,16 @@ void ieee80211_link_stop(struct ieee8021 + &link->color_change_finalize_work); + wiphy_work_cancel(link->sdata->local->hw.wiphy, + &link->csa.finalize_work); ++ ++ if (link->sdata->wdev.links[link->link_id].cac_started) { ++ wiphy_delayed_work_cancel(link->sdata->local->hw.wiphy, ++ &link->dfs_cac_timer_work); ++ cfg80211_cac_event(link->sdata->dev, ++ &link->conf->chanreq.oper, ++ NL80211_RADAR_CAC_ABORTED, ++ GFP_KERNEL, link->link_id); ++ } ++ + ieee80211_link_release_channel(link); + } + +--- a/net/mac80211/util.c ++++ b/net/mac80211/util.c +@@ -3455,20 +3455,30 @@ void ieee80211_dfs_cac_cancel(struct iee + { + struct ieee80211_sub_if_data *sdata; + struct cfg80211_chan_def chandef; ++ struct ieee80211_link_data *link; ++ unsigned int link_id; + + lockdep_assert_wiphy(local->hw.wiphy); + + list_for_each_entry(sdata, &local->interfaces, list) { +- wiphy_delayed_work_cancel(local->hw.wiphy, +- &sdata->deflink.dfs_cac_timer_work); ++ for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS; ++ link_id++) { ++ link = sdata_dereference(sdata->link[link_id], ++ sdata); ++ if (!link) ++ continue; + +- if (sdata->wdev.links[0].cac_started) { +- chandef = sdata->vif.bss_conf.chanreq.oper; +- ieee80211_link_release_channel(&sdata->deflink); +- cfg80211_cac_event(sdata->dev, +- &chandef, ++ wiphy_delayed_work_cancel(local->hw.wiphy, ++ &link->dfs_cac_timer_work); ++ ++ if (!sdata->wdev.links[link_id].cac_started) ++ continue; ++ ++ chandef = link->conf->chanreq.oper; ++ ieee80211_link_release_channel(link); ++ cfg80211_cac_event(sdata->dev, &chandef, + NL80211_RADAR_CAC_ABORTED, +- GFP_KERNEL, 0); ++ GFP_KERNEL, link_id); + } + } + } diff --git a/package/kernel/mac80211/patches/subsys/339-wifi-cfg80211-mac80211-use-proper-link-ID-for-DFS.patch b/package/kernel/mac80211/patches/subsys/339-wifi-cfg80211-mac80211-use-proper-link-ID-for-DFS.patch new file mode 100644 index 00000000000..53079b6cf62 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/339-wifi-cfg80211-mac80211-use-proper-link-ID-for-DFS.patch @@ -0,0 +1,168 @@ +From: Aditya Kumar Singh +Date: Fri, 6 Sep 2024 12:14:25 +0530 +Subject: [PATCH] wifi: cfg80211/mac80211: use proper link ID for DFS + +Now that all APIs have support to handle DFS per link, use proper link ID +instead of 0. + +Signed-off-by: Aditya Kumar Singh +Link: https://patch.msgid.link/20240906064426.2101315-8-quic_adisi@quicinc.com +Signed-off-by: Johannes Berg +--- + +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -1656,12 +1656,12 @@ static int ieee80211_stop_ap(struct wiph + ieee80211_link_info_change_notify(sdata, link, + BSS_CHANGED_BEACON_ENABLED); + +- if (sdata->wdev.links[0].cac_started) { ++ if (sdata->wdev.links[link_id].cac_started) { + chandef = link_conf->chanreq.oper; + wiphy_delayed_work_cancel(wiphy, &link->dfs_cac_timer_work); + cfg80211_cac_event(sdata->dev, &chandef, + NL80211_RADAR_CAC_ABORTED, +- GFP_KERNEL, 0); ++ GFP_KERNEL, link_id); + } + + drv_stop_ap(sdata->local, sdata, link_conf); +@@ -3965,7 +3965,7 @@ __ieee80211_channel_switch(struct wiphy + if (!list_empty(&local->roc_list) || local->scanning) + return -EBUSY; + +- if (sdata->wdev.links[0].cac_started) ++ if (sdata->wdev.links[link_id].cac_started) + return -EBUSY; + + if (WARN_ON(link_id >= IEEE80211_MLD_MAX_NUM_LINKS)) +--- a/net/mac80211/mlme.c ++++ b/net/mac80211/mlme.c +@@ -3039,11 +3039,11 @@ void ieee80211_dfs_cac_timer_work(struct + + lockdep_assert_wiphy(sdata->local->hw.wiphy); + +- if (sdata->wdev.links[0].cac_started) { ++ if (sdata->wdev.links[link->link_id].cac_started) { + ieee80211_link_release_channel(link); + cfg80211_cac_event(sdata->dev, &chandef, + NL80211_RADAR_CAC_FINISHED, +- GFP_KERNEL, 0); ++ GFP_KERNEL, link->link_id); + } + } + +--- a/net/mac80211/scan.c ++++ b/net/mac80211/scan.c +@@ -575,6 +575,7 @@ static bool __ieee80211_can_leave_ch(str + { + struct ieee80211_local *local = sdata->local; + struct ieee80211_sub_if_data *sdata_iter; ++ unsigned int link_id; + + lockdep_assert_wiphy(local->hw.wiphy); + +@@ -585,8 +586,9 @@ static bool __ieee80211_can_leave_ch(str + return false; + + list_for_each_entry(sdata_iter, &local->interfaces, list) { +- if (sdata_iter->wdev.links[0].cac_started) +- return false; ++ for_each_valid_link(&sdata_iter->wdev, link_id) ++ if (sdata_iter->wdev.links[link_id].cac_started) ++ return false; + } + + return true; +--- a/net/wireless/mlme.c ++++ b/net/wireless/mlme.c +@@ -1125,14 +1125,14 @@ void cfg80211_cac_event(struct net_devic + + trace_cfg80211_cac_event(netdev, event, link_id); + +- if (WARN_ON(!wdev->links[0].cac_started && ++ if (WARN_ON(!wdev->links[link_id].cac_started && + event != NL80211_RADAR_CAC_STARTED)) + return; + + switch (event) { + case NL80211_RADAR_CAC_FINISHED: +- timeout = wdev->links[0].cac_start_time + +- msecs_to_jiffies(wdev->links[0].cac_time_ms); ++ timeout = wdev->links[link_id].cac_start_time + ++ msecs_to_jiffies(wdev->links[link_id].cac_time_ms); + WARN_ON(!time_after_eq(jiffies, timeout)); + cfg80211_set_dfs_state(wiphy, chandef, NL80211_DFS_AVAILABLE); + memcpy(&rdev->cac_done_chandef, chandef, +@@ -1141,10 +1141,10 @@ void cfg80211_cac_event(struct net_devic + cfg80211_sched_dfs_chan_update(rdev); + fallthrough; + case NL80211_RADAR_CAC_ABORTED: +- wdev->links[0].cac_started = false; ++ wdev->links[link_id].cac_started = false; + break; + case NL80211_RADAR_CAC_STARTED: +- wdev->links[0].cac_started = true; ++ wdev->links[link_id].cac_started = true; + break; + default: + WARN_ON(1); +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -6066,7 +6066,7 @@ static int nl80211_start_ap(struct sk_bu + if (!rdev->ops->start_ap) + return -EOPNOTSUPP; + +- if (wdev->links[0].cac_started) ++ if (wdev->links[link_id].cac_started) + return -EBUSY; + + if (wdev->links[link_id].ap.beacon_interval) +@@ -10073,6 +10073,7 @@ static int nl80211_start_radar_detection + struct cfg80211_registered_device *rdev = info->user_ptr[0]; + struct net_device *dev = info->user_ptr[1]; + struct wireless_dev *wdev = dev->ieee80211_ptr; ++ int link_id = nl80211_link_id(info->attrs); + struct wiphy *wiphy = wdev->wiphy; + struct cfg80211_chan_def chandef; + enum nl80211_dfs_regions dfs_region; +@@ -10127,7 +10128,7 @@ static int nl80211_start_radar_detection + * can not already beacon + */ + if (wdev->valid_links && +- !wdev->links[0].ap.beacon_interval) { ++ !wdev->links[link_id].ap.beacon_interval) { + /* nothing */ + } else { + err = -EBUSY; +@@ -10135,7 +10136,7 @@ static int nl80211_start_radar_detection + } + } + +- if (wdev->links[0].cac_started) { ++ if (wdev->links[link_id].cac_started) { + err = -EBUSY; + goto unlock; + } +@@ -10156,7 +10157,7 @@ static int nl80211_start_radar_detection + cac_time_ms = IEEE80211_DFS_MIN_CAC_TIME_MS; + + err = rdev_start_radar_detection(rdev, dev, &chandef, cac_time_ms, +- 0); ++ link_id); + if (!err) { + switch (wdev->iftype) { + case NL80211_IFTYPE_AP: +@@ -10172,9 +10173,9 @@ static int nl80211_start_radar_detection + default: + break; + } +- wdev->links[0].cac_started = true; +- wdev->links[0].cac_start_time = jiffies; +- wdev->links[0].cac_time_ms = cac_time_ms; ++ wdev->links[link_id].cac_started = true; ++ wdev->links[link_id].cac_start_time = jiffies; ++ wdev->links[link_id].cac_time_ms = cac_time_ms; + } + unlock: + wiphy_unlock(wiphy); diff --git a/package/kernel/mac80211/patches/subsys/340-wifi-mac80211-handle-ieee80211_radar_detected-for-ML.patch b/package/kernel/mac80211/patches/subsys/340-wifi-mac80211-handle-ieee80211_radar_detected-for-ML.patch new file mode 100644 index 00000000000..3f64864bd41 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/340-wifi-mac80211-handle-ieee80211_radar_detected-for-ML.patch @@ -0,0 +1,360 @@ +From: Aditya Kumar Singh +Date: Fri, 6 Sep 2024 12:14:26 +0530 +Subject: [PATCH] wifi: mac80211: handle ieee80211_radar_detected() for MLO + +Currently DFS works under assumption there could be only one channel +context in the hardware. Hence, drivers just calls the function +ieee80211_radar_detected() passing the hardware structure. However, with +MLO, this obviously will not work since number of channel contexts will be +more than one and hence drivers would need to pass the channel information +as well on which the radar is detected. + +Also, when radar is detected in one of the links, other link's CAC should +not be cancelled. + +Hence, in order to support DFS with MLO, do the following changes - + * Add channel context conf pointer as an argument to the function + ieee80211_radar_detected(). During MLO, drivers would have to pass on + which channel context conf radar is detected. Otherwise, drivers could + just pass NULL. + * ieee80211_radar_detected() will iterate over all channel contexts + present and + * if channel context conf is passed, only mark that as radar + detected + * if NULL is passed, then mark all channel contexts as radar + detected + * Then as usual, schedule the radar detected work. + * In the worker, go over all the contexts again and for all such context + which is marked with radar detected, cancel the ongoing CAC by calling + ieee80211_dfs_cac_cancel() and then notify cfg80211 via + cfg80211_radar_event(). + * To cancel the CAC, pass the channel context as well where radar is + detected to ieee80211_dfs_cac_cancel(). This ensures that CAC is + canceled only on the links using the provided context, leaving other + links unaffected. + +This would also help in scenarios where there is split phy 5 GHz radio, +which is capable of DFS channels in both lower and upper band. In this +case, simultaneous radars can be detected. + +Signed-off-by: Aditya Kumar Singh +Link: https://patch.msgid.link/20240906064426.2101315-9-quic_adisi@quicinc.com +Signed-off-by: Johannes Berg +--- + +--- a/drivers/net/wireless/ath/ath10k/debug.c ++++ b/drivers/net/wireless/ath/ath10k/debug.c +@@ -3,7 +3,7 @@ + * Copyright (c) 2005-2011 Atheros Communications Inc. + * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. + * Copyright (c) 2018, The Linux Foundation. All rights reserved. +- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. ++ * Copyright (c) 2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved. + */ + + #include +@@ -1774,7 +1774,7 @@ static ssize_t ath10k_write_simulate_rad + if (!arvif->is_started) + return -EINVAL; + +- ieee80211_radar_detected(ar->hw); ++ ieee80211_radar_detected(ar->hw, NULL); + + return count; + } +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -1437,7 +1437,7 @@ static void ath10k_recalc_radar_detectio + * by indicating that radar was detected. + */ + ath10k_warn(ar, "failed to start CAC: %d\n", ret); +- ieee80211_radar_detected(ar->hw); ++ ieee80211_radar_detected(ar->hw, NULL); + } + } + +--- a/drivers/net/wireless/ath/ath10k/wmi.c ++++ b/drivers/net/wireless/ath/ath10k/wmi.c +@@ -3990,7 +3990,7 @@ static void ath10k_radar_detected(struct + if (ar->dfs_block_radar_events) + ath10k_info(ar, "DFS Radar detected, but ignored as requested\n"); + else +- ieee80211_radar_detected(ar->hw); ++ ieee80211_radar_detected(ar->hw, NULL); + } + + static void ath10k_radar_confirmation_work(struct work_struct *work) +--- a/drivers/net/wireless/ath/ath11k/wmi.c ++++ b/drivers/net/wireless/ath/ath11k/wmi.c +@@ -8358,7 +8358,7 @@ ath11k_wmi_pdev_dfs_radar_detected_event + if (ar->dfs_block_radar_events) + ath11k_info(ab, "DFS Radar detected, but ignored as requested\n"); + else +- ieee80211_radar_detected(ar->hw); ++ ieee80211_radar_detected(ar->hw, NULL); + + exit: + rcu_read_unlock(); +--- a/drivers/net/wireless/ath/ath12k/wmi.c ++++ b/drivers/net/wireless/ath/ath12k/wmi.c +@@ -6789,7 +6789,7 @@ ath12k_wmi_pdev_dfs_radar_detected_event + if (ar->dfs_block_radar_events) + ath12k_info(ab, "DFS Radar detected, but ignored as requested\n"); + else +- ieee80211_radar_detected(ath12k_ar_to_hw(ar)); ++ ieee80211_radar_detected(ath12k_ar_to_hw(ar), NULL); + + exit: + rcu_read_unlock(); +--- a/drivers/net/wireless/ath/ath9k/dfs.c ++++ b/drivers/net/wireless/ath/ath9k/dfs.c +@@ -280,7 +280,7 @@ ath9k_dfs_process_radar_pulse(struct ath + if (!pd->add_pulse(pd, pe, NULL)) + return; + DFS_STAT_INC(sc, radar_detected); +- ieee80211_radar_detected(sc->hw); ++ ieee80211_radar_detected(sc->hw, NULL); + } + + /* +--- a/drivers/net/wireless/ath/ath9k/dfs_debug.c ++++ b/drivers/net/wireless/ath/ath9k/dfs_debug.c +@@ -116,7 +116,7 @@ static ssize_t write_file_simulate_radar + { + struct ath_softc *sc = file->private_data; + +- ieee80211_radar_detected(sc->hw); ++ ieee80211_radar_detected(sc->hw, NULL); + + return count; + } +--- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +@@ -394,7 +394,7 @@ mt7615_mcu_rx_radar_detected(struct mt76 + if (mt76_phy_dfs_state(mphy) < MT_DFS_STATE_CAC) + return; + +- ieee80211_radar_detected(mphy->hw); ++ ieee80211_radar_detected(mphy->hw, NULL); + dev->hw_pattern++; + } + +--- a/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c ++++ b/drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c +@@ -630,7 +630,7 @@ static void mt76x02_dfs_tasklet(struct t + radar_detected = mt76x02_dfs_check_detection(dev); + if (radar_detected) { + /* sw detector rx radar pattern */ +- ieee80211_radar_detected(dev->mt76.hw); ++ ieee80211_radar_detected(dev->mt76.hw, NULL); + mt76x02_dfs_detector_reset(dev); + + return; +@@ -658,7 +658,7 @@ static void mt76x02_dfs_tasklet(struct t + + /* hw detector rx radar pattern */ + dfs_pd->stats[i].hw_pattern++; +- ieee80211_radar_detected(dev->mt76.hw); ++ ieee80211_radar_detected(dev->mt76.hw, NULL); + mt76x02_dfs_detector_reset(dev); + + return; +--- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +@@ -293,7 +293,7 @@ mt7915_mcu_rx_radar_detected(struct mt79 + &dev->rdd2_chandef, + GFP_ATOMIC); + else +- ieee80211_radar_detected(mphy->hw); ++ ieee80211_radar_detected(mphy->hw, NULL); + dev->hw_pattern++; + } + +--- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +@@ -371,7 +371,7 @@ mt7996_mcu_rx_radar_detected(struct mt79 + &dev->rdd2_chandef, + GFP_ATOMIC); + else +- ieee80211_radar_detected(mphy->hw); ++ ieee80211_radar_detected(mphy->hw, NULL); + dev->hw_pattern++; + } + +--- a/drivers/net/wireless/ti/wl18xx/event.c ++++ b/drivers/net/wireless/ti/wl18xx/event.c +@@ -142,7 +142,7 @@ int wl18xx_process_mailbox_events(struct + wl18xx_radar_type_decode(mbox->radar_type)); + + if (!wl->radar_debug_mode) +- ieee80211_radar_detected(wl->hw); ++ ieee80211_radar_detected(wl->hw, NULL); + } + + if (vector & PERIODIC_SCAN_REPORT_EVENT_ID) { +--- a/drivers/net/wireless/virtual/mac80211_hwsim.c ++++ b/drivers/net/wireless/virtual/mac80211_hwsim.c +@@ -1146,7 +1146,7 @@ static int hwsim_write_simulate_radar(vo + { + struct mac80211_hwsim_data *data = dat; + +- ieee80211_radar_detected(data->hw); ++ ieee80211_radar_detected(data->hw, NULL); + + return 0; + } +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -6717,8 +6717,11 @@ void ieee80211_cqm_beacon_loss_notify(st + * ieee80211_radar_detected - inform that a radar was detected + * + * @hw: pointer as obtained from ieee80211_alloc_hw() ++ * @chanctx_conf: Channel context on which radar is detected. Mandatory to ++ * pass a valid pointer during MLO. For non-MLO %NULL can be passed + */ +-void ieee80211_radar_detected(struct ieee80211_hw *hw); ++void ieee80211_radar_detected(struct ieee80211_hw *hw, ++ struct ieee80211_chanctx_conf *chanctx_conf); + + /** + * ieee80211_chswitch_done - Complete channel switch process +--- a/net/mac80211/chan.c ++++ b/net/mac80211/chan.c +@@ -681,6 +681,7 @@ ieee80211_alloc_chanctx(struct ieee80211 + ctx->mode = mode; + ctx->conf.radar_enabled = false; + ctx->conf.radio_idx = radio_idx; ++ ctx->radar_detected = false; + _ieee80211_recalc_chanctx_min_def(local, ctx, NULL, false); + + return ctx; +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -895,6 +895,8 @@ struct ieee80211_chanctx { + struct ieee80211_chan_req req; + + struct ieee80211_chanctx_conf conf; ++ ++ bool radar_detected; + }; + + struct mac80211_qos_map { +@@ -2632,7 +2634,8 @@ void ieee80211_recalc_chanctx_min_def(st + bool ieee80211_is_radar_required(struct ieee80211_local *local); + + void ieee80211_dfs_cac_timer_work(struct wiphy *wiphy, struct wiphy_work *work); +-void ieee80211_dfs_cac_cancel(struct ieee80211_local *local); ++void ieee80211_dfs_cac_cancel(struct ieee80211_local *local, ++ struct ieee80211_chanctx *chanctx); + void ieee80211_dfs_radar_detected_work(struct wiphy *wiphy, + struct wiphy_work *work); + int ieee80211_send_action_csa(struct ieee80211_sub_if_data *sdata, +--- a/net/mac80211/pm.c ++++ b/net/mac80211/pm.c +@@ -32,7 +32,7 @@ int __ieee80211_suspend(struct ieee80211 + + ieee80211_scan_cancel(local); + +- ieee80211_dfs_cac_cancel(local); ++ ieee80211_dfs_cac_cancel(local, NULL); + + ieee80211_roc_purge(local, NULL); + +--- a/net/mac80211/util.c ++++ b/net/mac80211/util.c +@@ -3451,11 +3451,16 @@ u64 ieee80211_calculate_rx_timestamp(str + return ts; + } + +-void ieee80211_dfs_cac_cancel(struct ieee80211_local *local) ++/* Cancel CAC for the interfaces under the specified @local. If @ctx is ++ * also provided, only the interfaces using that ctx will be canceled. ++ */ ++void ieee80211_dfs_cac_cancel(struct ieee80211_local *local, ++ struct ieee80211_chanctx *ctx) + { + struct ieee80211_sub_if_data *sdata; + struct cfg80211_chan_def chandef; + struct ieee80211_link_data *link; ++ struct ieee80211_chanctx_conf *chanctx_conf; + unsigned int link_id; + + lockdep_assert_wiphy(local->hw.wiphy); +@@ -3468,6 +3473,11 @@ void ieee80211_dfs_cac_cancel(struct iee + if (!link) + continue; + ++ chanctx_conf = sdata_dereference(link->conf->chanctx_conf, ++ sdata); ++ if (ctx && &ctx->conf != chanctx_conf) ++ continue; ++ + wiphy_delayed_work_cancel(local->hw.wiphy, + &link->dfs_cac_timer_work); + +@@ -3488,9 +3498,8 @@ void ieee80211_dfs_radar_detected_work(s + { + struct ieee80211_local *local = + container_of(work, struct ieee80211_local, radar_detected_work); +- struct cfg80211_chan_def chandef = local->hw.conf.chandef; ++ struct cfg80211_chan_def chandef; + struct ieee80211_chanctx *ctx; +- int num_chanctx = 0; + + lockdep_assert_wiphy(local->hw.wiphy); + +@@ -3498,25 +3507,46 @@ void ieee80211_dfs_radar_detected_work(s + if (ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER) + continue; + +- num_chanctx++; ++ if (!ctx->radar_detected) ++ continue; ++ ++ ctx->radar_detected = false; ++ + chandef = ctx->conf.def; ++ ++ ieee80211_dfs_cac_cancel(local, ctx); ++ cfg80211_radar_event(local->hw.wiphy, &chandef, GFP_KERNEL); + } ++} + +- ieee80211_dfs_cac_cancel(local); ++static void ++ieee80211_radar_mark_chan_ctx_iterator(struct ieee80211_hw *hw, ++ struct ieee80211_chanctx_conf *chanctx_conf, ++ void *data) ++{ ++ struct ieee80211_chanctx *ctx = ++ container_of(chanctx_conf, struct ieee80211_chanctx, ++ conf); + +- if (num_chanctx > 1) +- /* XXX: multi-channel is not supported yet */ +- WARN_ON(1); +- else +- cfg80211_radar_event(local->hw.wiphy, &chandef, GFP_KERNEL); ++ if (ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER) ++ return; ++ ++ if (data && data != chanctx_conf) ++ return; ++ ++ ctx->radar_detected = true; + } + +-void ieee80211_radar_detected(struct ieee80211_hw *hw) ++void ieee80211_radar_detected(struct ieee80211_hw *hw, ++ struct ieee80211_chanctx_conf *chanctx_conf) + { + struct ieee80211_local *local = hw_to_local(hw); + + trace_api_radar_detected(local); + ++ ieee80211_iter_chan_contexts_atomic(hw, ieee80211_radar_mark_chan_ctx_iterator, ++ chanctx_conf); ++ + wiphy_work_queue(hw->wiphy, &local->radar_detected_work); + } + EXPORT_SYMBOL(ieee80211_radar_detected); diff --git a/package/kernel/mac80211/patches/subsys/340-wifi-nl80211-split-helper-function-from-nl80211_put_.patch b/package/kernel/mac80211/patches/subsys/340-wifi-nl80211-split-helper-function-from-nl80211_put_.patch deleted file mode 100644 index 40757e3777f..00000000000 --- a/package/kernel/mac80211/patches/subsys/340-wifi-nl80211-split-helper-function-from-nl80211_put_.patch +++ /dev/null @@ -1,145 +0,0 @@ -From: Felix Fietkau -Date: Tue, 4 Jun 2024 14:31:09 +0200 -Subject: [PATCH] wifi: nl80211: split helper function from - nl80211_put_iface_combinations - -Create a helper function that puts the data from struct -ieee80211_iface_combination to a nl80211 message. -This will be used for adding per-radio interface combination data. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -1620,71 +1620,78 @@ nla_put_failure: - return -ENOBUFS; - } - --static int nl80211_put_iface_combinations(struct wiphy *wiphy, -- struct sk_buff *msg, -- bool large) -+static int nl80211_put_ifcomb_data(struct sk_buff *msg, bool large, int idx, -+ const struct ieee80211_iface_combination *c) - { -- struct nlattr *nl_combis; -- int i, j; -+ struct nlattr *nl_combi, *nl_limits; -+ int i; - -- nl_combis = nla_nest_start_noflag(msg, -- NL80211_ATTR_INTERFACE_COMBINATIONS); -- if (!nl_combis) -+ nl_combi = nla_nest_start_noflag(msg, idx); -+ if (!nl_combi) - goto nla_put_failure; - -- for (i = 0; i < wiphy->n_iface_combinations; i++) { -- const struct ieee80211_iface_combination *c; -- struct nlattr *nl_combi, *nl_limits; -+ nl_limits = nla_nest_start_noflag(msg, NL80211_IFACE_COMB_LIMITS); -+ if (!nl_limits) -+ goto nla_put_failure; - -- c = &wiphy->iface_combinations[i]; -+ for (i = 0; i < c->n_limits; i++) { -+ struct nlattr *nl_limit; - -- nl_combi = nla_nest_start_noflag(msg, i + 1); -- if (!nl_combi) -+ nl_limit = nla_nest_start_noflag(msg, i + 1); -+ if (!nl_limit) - goto nla_put_failure; -- -- nl_limits = nla_nest_start_noflag(msg, -- NL80211_IFACE_COMB_LIMITS); -- if (!nl_limits) -+ if (nla_put_u32(msg, NL80211_IFACE_LIMIT_MAX, c->limits[i].max)) - goto nla_put_failure; -+ if (nl80211_put_iftypes(msg, NL80211_IFACE_LIMIT_TYPES, -+ c->limits[i].types)) -+ goto nla_put_failure; -+ nla_nest_end(msg, nl_limit); -+ } - -- for (j = 0; j < c->n_limits; j++) { -- struct nlattr *nl_limit; -+ nla_nest_end(msg, nl_limits); - -- nl_limit = nla_nest_start_noflag(msg, j + 1); -- if (!nl_limit) -- goto nla_put_failure; -- if (nla_put_u32(msg, NL80211_IFACE_LIMIT_MAX, -- c->limits[j].max)) -- goto nla_put_failure; -- if (nl80211_put_iftypes(msg, NL80211_IFACE_LIMIT_TYPES, -- c->limits[j].types)) -- goto nla_put_failure; -- nla_nest_end(msg, nl_limit); -- } -+ if (c->beacon_int_infra_match && -+ nla_put_flag(msg, NL80211_IFACE_COMB_STA_AP_BI_MATCH)) -+ goto nla_put_failure; -+ if (nla_put_u32(msg, NL80211_IFACE_COMB_NUM_CHANNELS, -+ c->num_different_channels) || -+ nla_put_u32(msg, NL80211_IFACE_COMB_MAXNUM, -+ c->max_interfaces)) -+ goto nla_put_failure; -+ if (large && -+ (nla_put_u32(msg, NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS, -+ c->radar_detect_widths) || -+ nla_put_u32(msg, NL80211_IFACE_COMB_RADAR_DETECT_REGIONS, -+ c->radar_detect_regions))) -+ goto nla_put_failure; -+ if (c->beacon_int_min_gcd && -+ nla_put_u32(msg, NL80211_IFACE_COMB_BI_MIN_GCD, -+ c->beacon_int_min_gcd)) -+ goto nla_put_failure; - -- nla_nest_end(msg, nl_limits); -+ nla_nest_end(msg, nl_combi); - -- if (c->beacon_int_infra_match && -- nla_put_flag(msg, NL80211_IFACE_COMB_STA_AP_BI_MATCH)) -- goto nla_put_failure; -- if (nla_put_u32(msg, NL80211_IFACE_COMB_NUM_CHANNELS, -- c->num_different_channels) || -- nla_put_u32(msg, NL80211_IFACE_COMB_MAXNUM, -- c->max_interfaces)) -- goto nla_put_failure; -- if (large && -- (nla_put_u32(msg, NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS, -- c->radar_detect_widths) || -- nla_put_u32(msg, NL80211_IFACE_COMB_RADAR_DETECT_REGIONS, -- c->radar_detect_regions))) -- goto nla_put_failure; -- if (c->beacon_int_min_gcd && -- nla_put_u32(msg, NL80211_IFACE_COMB_BI_MIN_GCD, -- c->beacon_int_min_gcd)) -- goto nla_put_failure; -+ return 0; -+nla_put_failure: -+ return -ENOBUFS; -+} - -- nla_nest_end(msg, nl_combi); -- } -+static int nl80211_put_iface_combinations(struct wiphy *wiphy, -+ struct sk_buff *msg, -+ bool large) -+{ -+ struct nlattr *nl_combis; -+ int i; -+ -+ nl_combis = nla_nest_start_noflag(msg, -+ NL80211_ATTR_INTERFACE_COMBINATIONS); -+ if (!nl_combis) -+ goto nla_put_failure; -+ -+ for (i = 0; i < wiphy->n_iface_combinations; i++) -+ if (nl80211_put_ifcomb_data(msg, large, i + 1, -+ &wiphy->iface_combinations[i])) -+ goto nla_put_failure; - - nla_nest_end(msg, nl_combis); - diff --git a/package/kernel/mac80211/patches/subsys/341-wifi-cfg80211-add-support-for-advertising-multiple-r.patch b/package/kernel/mac80211/patches/subsys/341-wifi-cfg80211-add-support-for-advertising-multiple-r.patch deleted file mode 100644 index 45349891b69..00000000000 --- a/package/kernel/mac80211/patches/subsys/341-wifi-cfg80211-add-support-for-advertising-multiple-r.patch +++ /dev/null @@ -1,348 +0,0 @@ -From: Felix Fietkau -Date: Wed, 22 May 2024 11:42:57 +0200 -Subject: [PATCH] wifi: cfg80211: add support for advertising multiple - radios belonging to a wiphy - -The prerequisite for MLO support in cfg80211/mac80211 is that all the links -participating in MLO must be from the same wiphy/ieee80211_hw. To meet this -expectation, some drivers may need to group multiple discrete hardware each -acting as a link in MLO under single wiphy. - -With this change, supported frequencies and interface combinations of each -individual radio are reported to user space. This allows user space to figure -out the limitations of what combination of channels can be used concurrently. - -Even for non-MLO devices, this improves support for devices capable of -running on multiple channels at the same time. - -Signed-off-by: Felix Fietkau ---- - ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -5045,7 +5045,9 @@ struct ieee80211_iface_limit { - * struct ieee80211_iface_combination - possible interface combination - * - * With this structure the driver can describe which interface -- * combinations it supports concurrently. -+ * combinations it supports concurrently. When set in a struct wiphy_radio, -+ * the combinations refer to combinations of interfaces currently active on -+ * that radio. - * - * Examples: - * -@@ -5403,6 +5405,38 @@ struct wiphy_iftype_akm_suites { - int n_akm_suites; - }; - -+/** -+ * struct wiphy_radio_freq_range - wiphy frequency range -+ * @start_freq: start range edge frequency (kHz) -+ * @end_freq: end range edge frequency (kHz) -+ */ -+struct wiphy_radio_freq_range { -+ u32 start_freq; -+ u32 end_freq; -+}; -+ -+ -+/** -+ * struct wiphy_radio - physical radio of a wiphy -+ * This structure describes a physical radio belonging to a wiphy. -+ * It is used to describe concurrent-channel capabilities. Only one channel -+ * can be active on the radio described by struct wiphy_radio. -+ * -+ * @freq_range: frequency range that the radio can operate on. -+ * @n_freq_range: number of elements in @freq_range -+ * -+ * @iface_combinations: Valid interface combinations array, should not -+ * list single interface types. -+ * @n_iface_combinations: number of entries in @iface_combinations array. -+ */ -+struct wiphy_radio { -+ const struct wiphy_radio_freq_range *freq_range; -+ int n_freq_range; -+ -+ const struct ieee80211_iface_combination *iface_combinations; -+ int n_iface_combinations; -+}; -+ - #define CFG80211_HW_TIMESTAMP_ALL_PEERS 0xffff - - /** -@@ -5621,6 +5655,9 @@ struct wiphy_iftype_akm_suites { - * A value of %CFG80211_HW_TIMESTAMP_ALL_PEERS indicates the driver - * supports enabling HW timestamping for all peers (i.e. no need to - * specify a mac address). -+ * -+ * @radio: radios belonging to this wiphy -+ * @n_radio: number of radios - */ - struct wiphy { - struct mutex mtx; -@@ -5771,6 +5808,9 @@ struct wiphy { - - u16 hw_timestamp_max_peers; - -+ int n_radio; -+ const struct wiphy_radio *radio; -+ - char priv[] __aligned(NETDEV_ALIGN); - }; - ---- a/include/uapi/linux/nl80211.h -+++ b/include/uapi/linux/nl80211.h -@@ -2061,6 +2061,10 @@ enum nl80211_commands { - * @NL80211_ATTR_INTERFACE_COMBINATIONS: Nested attribute listing the supported - * interface combinations. In each nested item, it contains attributes - * defined in &enum nl80211_if_combination_attrs. -+ * If the wiphy uses multiple radios (@NL80211_ATTR_WIPHY_RADIOS is set), -+ * this attribute contains the interface combinations of the first radio. -+ * See @NL80211_ATTR_WIPHY_INTERFACE_COMBINATIONS for the global wiphy -+ * combinations for the sum of all radios. - * @NL80211_ATTR_SOFTWARE_IFTYPES: Nested attribute (just like - * %NL80211_ATTR_SUPPORTED_IFTYPES) containing the interface types that - * are managed in software: interfaces of these types aren't subject to -@@ -2856,6 +2860,14 @@ enum nl80211_commands { - * %NL80211_CMD_ASSOCIATE indicating the SPP A-MSDUs - * are used on this connection - * -+ * @NL80211_ATTR_WIPHY_RADIOS: Nested attribute describing physical radios -+ * belonging to this wiphy. See &enum nl80211_wiphy_radio_attrs. -+ * -+ * @NL80211_ATTR_WIPHY_INTERFACE_COMBINATIONS: Nested attribute listing the -+ * supported interface combinations for all radios combined. In each -+ * nested item, it contains attributes defined in -+ * &enum nl80211_if_combination_attrs. -+ * - * @NUM_NL80211_ATTR: total number of nl80211_attrs available - * @NL80211_ATTR_MAX: highest attribute number currently defined - * @__NL80211_ATTR_AFTER_LAST: internal use -@@ -3401,6 +3413,9 @@ enum nl80211_attrs { - - NL80211_ATTR_ASSOC_SPP_AMSDU, - -+ NL80211_ATTR_WIPHY_RADIOS, -+ NL80211_ATTR_WIPHY_INTERFACE_COMBINATIONS, -+ - /* add attributes here, update the policy in nl80211.c */ - - __NL80211_ATTR_AFTER_LAST, -@@ -7987,4 +8002,54 @@ enum nl80211_ap_settings_flags { - NL80211_AP_SETTINGS_SA_QUERY_OFFLOAD_SUPPORT = 1 << 1, - }; - -+/** -+ * enum nl80211_wiphy_radio_attrs - wiphy radio attributes -+ * -+ * @__NL80211_WIPHY_RADIO_ATTR_INVALID: Invalid -+ * -+ * @NL80211_WIPHY_RADIO_ATTR_INDEX: Index of this radio (u32) -+ * @NL80211_WIPHY_RADIO_ATTR_FREQ_RANGE: Frequency range supported by this -+ * radio. Attribute may be present multiple times. -+ * @NL80211_WIPHY_RADIO_ATTR_INTERFACE_COMBINATION: Supported interface -+ * combination for this radio. Attribute may be present multiple times -+ * and contains attributes defined in &enum nl80211_if_combination_attrs. -+ * -+ * @__NL80211_WIPHY_RADIO_ATTR_LAST: Internal -+ * @NL80211_WIPHY_RADIO_ATTR_MAX: Highest attribute -+ */ -+enum nl80211_wiphy_radio_attrs { -+ __NL80211_WIPHY_RADIO_ATTR_INVALID, -+ -+ NL80211_WIPHY_RADIO_ATTR_INDEX, -+ NL80211_WIPHY_RADIO_ATTR_FREQ_RANGE, -+ NL80211_WIPHY_RADIO_ATTR_INTERFACE_COMBINATION, -+ -+ /* keep last */ -+ __NL80211_WIPHY_RADIO_ATTR_LAST, -+ NL80211_WIPHY_RADIO_ATTR_MAX = __NL80211_WIPHY_RADIO_ATTR_LAST - 1, -+}; -+ -+/** -+ * enum nl80211_wiphy_radio_freq_range - wiphy radio frequency range -+ * -+ * @__NL80211_WIPHY_RADIO_FREQ_ATTR_INVALID: Invalid -+ * -+ * @NL80211_WIPHY_RADIO_FREQ_ATTR_START: Frequency range start (u32). -+ * The unit is kHz. -+ * @NL80211_WIPHY_RADIO_FREQ_ATTR_END: Frequency range end (u32). -+ * The unit is kHz. -+ * -+ * @__NL80211_WIPHY_RADIO_FREQ_ATTR_LAST: Internal -+ * @NL80211_WIPHY_RADIO_FREQ_ATTR_MAX: Highest attribute -+ */ -+enum nl80211_wiphy_radio_freq_range { -+ __NL80211_WIPHY_RADIO_FREQ_ATTR_INVALID, -+ -+ NL80211_WIPHY_RADIO_FREQ_ATTR_START, -+ NL80211_WIPHY_RADIO_FREQ_ATTR_END, -+ -+ __NL80211_WIPHY_RADIO_FREQ_ATTR_LAST, -+ NL80211_WIPHY_RADIO_FREQ_ATTR_MAX = __NL80211_WIPHY_RADIO_FREQ_ATTR_LAST - 1, -+}; -+ - #endif /* __LINUX_NL80211_H */ ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -1621,16 +1621,18 @@ nla_put_failure: - } - - static int nl80211_put_ifcomb_data(struct sk_buff *msg, bool large, int idx, -- const struct ieee80211_iface_combination *c) -+ const struct ieee80211_iface_combination *c, -+ u16 nested) - { - struct nlattr *nl_combi, *nl_limits; - int i; - -- nl_combi = nla_nest_start_noflag(msg, idx); -+ nl_combi = nla_nest_start_noflag(msg, idx | nested); - if (!nl_combi) - goto nla_put_failure; - -- nl_limits = nla_nest_start_noflag(msg, NL80211_IFACE_COMB_LIMITS); -+ nl_limits = nla_nest_start_noflag(msg, NL80211_IFACE_COMB_LIMITS | -+ nested); - if (!nl_limits) - goto nla_put_failure; - -@@ -1678,19 +1680,26 @@ nla_put_failure: - - static int nl80211_put_iface_combinations(struct wiphy *wiphy, - struct sk_buff *msg, -- bool large) -+ int attr, int radio, -+ bool large, u16 nested) - { -+ const struct ieee80211_iface_combination *c; - struct nlattr *nl_combis; -- int i; -+ int i, n; - -- nl_combis = nla_nest_start_noflag(msg, -- NL80211_ATTR_INTERFACE_COMBINATIONS); -+ nl_combis = nla_nest_start_noflag(msg, attr | nested); - if (!nl_combis) - goto nla_put_failure; - -- for (i = 0; i < wiphy->n_iface_combinations; i++) -- if (nl80211_put_ifcomb_data(msg, large, i + 1, -- &wiphy->iface_combinations[i])) -+ if (radio >= 0) { -+ c = wiphy->radio[0].iface_combinations; -+ n = wiphy->radio[0].n_iface_combinations; -+ } else { -+ c = wiphy->iface_combinations; -+ n = wiphy->n_iface_combinations; -+ } -+ for (i = 0; i < n; i++) -+ if (nl80211_put_ifcomb_data(msg, large, i + 1, &c[i], nested)) - goto nla_put_failure; - - nla_nest_end(msg, nl_combis); -@@ -2397,6 +2406,80 @@ fail: - return -ENOBUFS; - } - -+static int nl80211_put_radio(struct wiphy *wiphy, struct sk_buff *msg, int idx) -+{ -+ const struct wiphy_radio *r = &wiphy->radio[idx]; -+ struct nlattr *radio, *freq; -+ int i; -+ -+ radio = nla_nest_start(msg, idx); -+ if (!radio) -+ return -ENOBUFS; -+ -+ if (nla_put_u32(msg, NL80211_WIPHY_RADIO_ATTR_INDEX, idx)) -+ goto nla_put_failure; -+ -+ for (i = 0; i < r->n_freq_range; i++) { -+ const struct wiphy_radio_freq_range *range = &r->freq_range[i]; -+ -+ freq = nla_nest_start(msg, NL80211_WIPHY_RADIO_ATTR_FREQ_RANGE); -+ if (!freq) -+ goto nla_put_failure; -+ -+ if (nla_put_u32(msg, NL80211_WIPHY_RADIO_FREQ_ATTR_START, -+ range->start_freq) || -+ nla_put_u32(msg, NL80211_WIPHY_RADIO_FREQ_ATTR_END, -+ range->end_freq)) -+ goto nla_put_failure; -+ -+ nla_nest_end(msg, freq); -+ } -+ -+ for (i = 0; i < r->n_iface_combinations; i++) -+ if (nl80211_put_ifcomb_data(msg, true, -+ NL80211_WIPHY_RADIO_ATTR_INTERFACE_COMBINATION, -+ &r->iface_combinations[i], -+ NLA_F_NESTED)) -+ goto nla_put_failure; -+ -+ nla_nest_end(msg, radio); -+ -+ return 0; -+ -+nla_put_failure: -+ return -ENOBUFS; -+} -+ -+static int nl80211_put_radios(struct wiphy *wiphy, struct sk_buff *msg) -+{ -+ struct nlattr *radios; -+ int i; -+ -+ if (!wiphy->n_radio) -+ return 0; -+ -+ radios = nla_nest_start(msg, NL80211_ATTR_WIPHY_RADIOS); -+ if (!radios) -+ return -ENOBUFS; -+ -+ for (i = 0; i < wiphy->n_radio; i++) -+ if (nl80211_put_radio(wiphy, msg, i)) -+ goto fail; -+ -+ nla_nest_end(msg, radios); -+ -+ if (nl80211_put_iface_combinations(wiphy, msg, -+ NL80211_ATTR_WIPHY_INTERFACE_COMBINATIONS, -+ -1, true, NLA_F_NESTED)) -+ return -ENOBUFS; -+ -+ return 0; -+ -+fail: -+ nla_nest_cancel(msg, radios); -+ return -ENOBUFS; -+} -+ - struct nl80211_dump_wiphy_state { - s64 filter_wiphy; - long start; -@@ -2692,7 +2775,9 @@ static int nl80211_send_wiphy(struct cfg - goto nla_put_failure; - - if (nl80211_put_iface_combinations(&rdev->wiphy, msg, -- state->split)) -+ NL80211_ATTR_INTERFACE_COMBINATIONS, -+ rdev->wiphy.n_radio ? 0 : -1, -+ state->split, 0)) - goto nla_put_failure; - - state->split_start++; -@@ -3006,6 +3091,12 @@ static int nl80211_send_wiphy(struct cfg - rdev->wiphy.hw_timestamp_max_peers)) - goto nla_put_failure; - -+ state->split_start++; -+ break; -+ case 17: -+ if (nl80211_put_radios(&rdev->wiphy, msg)) -+ goto nla_put_failure; -+ - /* done */ - state->split_start = 0; - break; diff --git a/package/kernel/mac80211/patches/subsys/342-wifi-cfg80211-extend-interface-combination-check-for.patch b/package/kernel/mac80211/patches/subsys/342-wifi-cfg80211-extend-interface-combination-check-for.patch deleted file mode 100644 index 0ba97a2c0fe..00000000000 --- a/package/kernel/mac80211/patches/subsys/342-wifi-cfg80211-extend-interface-combination-check-for.patch +++ /dev/null @@ -1,172 +0,0 @@ -From: Felix Fietkau -Date: Tue, 4 Jun 2024 21:01:50 +0200 -Subject: [PATCH] wifi: cfg80211: extend interface combination check for - multi-radio - -Add a field in struct iface_combination_params to check per-radio -interface combinations instead of per-wiphy ones. - -Signed-off-by: Felix Fietkau ---- - ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -1598,6 +1598,7 @@ struct cfg80211_color_change_settings { - * - * Used to pass interface combination parameters - * -+ * @radio_idx: wiphy radio index or -1 for global - * @num_different_channels: the number of different channels we want - * to use for verification - * @radar_detect: a bitmap where each bit corresponds to a channel -@@ -1611,6 +1612,7 @@ struct cfg80211_color_change_settings { - * the verification - */ - struct iface_combination_params { -+ int radio_idx; - int num_different_channels; - u8 radar_detect; - int iftype_num[NUM_NL80211_IFTYPES]; -@@ -4579,6 +4581,8 @@ struct mgmt_frame_regs { - * - * @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames. - * @set_ttlm: set the TID to link mapping. -+ * @get_radio_mask: get bitmask of radios in use. -+ * (invoked with the wiphy mutex held) - */ - struct cfg80211_ops { - int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); -@@ -4940,6 +4944,7 @@ struct cfg80211_ops { - struct cfg80211_set_hw_timestamp *hwts); - int (*set_ttlm)(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_ttlm_params *params); -+ u32 (*get_radio_mask)(struct wiphy *wiphy, struct net_device *dev); - }; - - /* ---- a/net/mac80211/util.c -+++ b/net/mac80211/util.c -@@ -3930,6 +3930,7 @@ int ieee80211_check_combinations(struct - int total = 1; - struct iface_combination_params params = { - .radar_detect = radar_detect, -+ .radio_idx = -1, - }; - - lockdep_assert_wiphy(local->hw.wiphy); -@@ -4020,7 +4021,9 @@ int ieee80211_max_num_channels(struct ie - struct ieee80211_chanctx *ctx; - u32 max_num_different_channels = 1; - int err; -- struct iface_combination_params params = {0}; -+ struct iface_combination_params params = { -+ .radio_idx = -1, -+ }; - - lockdep_assert_wiphy(local->hw.wiphy); - ---- a/net/wireless/rdev-ops.h -+++ b/net/wireless/rdev-ops.h -@@ -1542,4 +1542,16 @@ rdev_set_ttlm(struct cfg80211_registered - - return ret; - } -+ -+static inline u32 -+rdev_get_radio_mask(struct cfg80211_registered_device *rdev, -+ struct net_device *dev) -+{ -+ struct wiphy *wiphy = &rdev->wiphy; -+ -+ if (!rdev->ops->get_radio_mask) -+ return 0; -+ -+ return rdev->ops->get_radio_mask(wiphy, dev); -+} - #endif /* __CFG80211_RDEV_OPS */ ---- a/net/wireless/util.c -+++ b/net/wireless/util.c -@@ -2305,13 +2305,16 @@ static int cfg80211_wdev_bi(struct wirel - - static void cfg80211_calculate_bi_data(struct wiphy *wiphy, u32 new_beacon_int, - u32 *beacon_int_gcd, -- bool *beacon_int_different) -+ bool *beacon_int_different, -+ int radio_idx) - { -+ struct cfg80211_registered_device *rdev; - struct wireless_dev *wdev; - - *beacon_int_gcd = 0; - *beacon_int_different = false; - -+ rdev = wiphy_to_rdev(wiphy); - list_for_each_entry(wdev, &wiphy->wdev_list, list) { - int wdev_bi; - -@@ -2319,6 +2322,11 @@ static void cfg80211_calculate_bi_data(s - if (wdev->valid_links) - continue; - -+ /* skip wdevs not active on the given wiphy radio */ -+ if (radio_idx >= 0 && -+ !(rdev_get_radio_mask(rdev, wdev->netdev) & BIT(radio_idx))) -+ continue; -+ - wdev_bi = cfg80211_wdev_bi(wdev); - - if (!wdev_bi) -@@ -2366,14 +2374,19 @@ int cfg80211_iter_combinations(struct wi - void *data), - void *data) - { -+ const struct wiphy_radio *radio = NULL; -+ const struct ieee80211_iface_combination *c, *cs; - const struct ieee80211_regdomain *regdom; - enum nl80211_dfs_regions region = 0; -- int i, j, iftype; -+ int i, j, n, iftype; - int num_interfaces = 0; - u32 used_iftypes = 0; - u32 beacon_int_gcd; - bool beacon_int_different; - -+ if (params->radio_idx >= 0) -+ radio = &wiphy->radio[params->radio_idx]; -+ - /* - * This is a bit strange, since the iteration used to rely only on - * the data given by the driver, but here it now relies on context, -@@ -2385,7 +2398,8 @@ int cfg80211_iter_combinations(struct wi - * interfaces (while being brought up) and channel/radar data. - */ - cfg80211_calculate_bi_data(wiphy, params->new_beacon_int, -- &beacon_int_gcd, &beacon_int_different); -+ &beacon_int_gcd, &beacon_int_different, -+ params->radio_idx); - - if (params->radar_detect) { - rcu_read_lock(); -@@ -2402,13 +2416,18 @@ int cfg80211_iter_combinations(struct wi - used_iftypes |= BIT(iftype); - } - -- for (i = 0; i < wiphy->n_iface_combinations; i++) { -- const struct ieee80211_iface_combination *c; -+ if (radio) { -+ cs = radio->iface_combinations; -+ n = radio->n_iface_combinations; -+ } else { -+ cs = wiphy->iface_combinations; -+ n = wiphy->n_iface_combinations; -+ } -+ for (i = 0; i < n; i++) { - struct ieee80211_iface_limit *limits; - u32 all_iftypes = 0; - -- c = &wiphy->iface_combinations[i]; -- -+ c = &cs[i]; - if (num_interfaces > c->max_interfaces) - continue; - if (params->num_different_channels > c->num_different_channels) diff --git a/package/kernel/mac80211/patches/subsys/343-wifi-cfg80211-add-helper-for-checking-if-a-chandef-i.patch b/package/kernel/mac80211/patches/subsys/343-wifi-cfg80211-add-helper-for-checking-if-a-chandef-i.patch deleted file mode 100644 index d115dd2e540..00000000000 --- a/package/kernel/mac80211/patches/subsys/343-wifi-cfg80211-add-helper-for-checking-if-a-chandef-i.patch +++ /dev/null @@ -1,69 +0,0 @@ -From: Felix Fietkau -Date: Fri, 7 Jun 2024 17:58:54 +0200 -Subject: [PATCH] wifi: cfg80211: add helper for checking if a chandef is - valid on a radio - -Check if the full channel width is in the radio's frequency range. - -Signed-off-by: Felix Fietkau ---- - ---- a/include/net/cfg80211.h -+++ b/include/net/cfg80211.h -@@ -6485,6 +6485,15 @@ static inline bool cfg80211_channel_is_p - } - - /** -+ * cfg80211_radio_chandef_valid - Check if the radio supports the chandef -+ * -+ * @radio: wiphy radio -+ * @chandef: chandef for current channel -+ */ -+bool cfg80211_radio_chandef_valid(const struct wiphy_radio *radio, -+ const struct cfg80211_chan_def *chandef); -+ -+/** - * ieee80211_get_response_rate - get basic rate for a given rate - * - * @sband: the band to look for rates in ---- a/net/wireless/util.c -+++ b/net/wireless/util.c -@@ -2884,3 +2884,38 @@ cfg80211_get_iftype_ext_capa(struct wiph - return NULL; - } - EXPORT_SYMBOL(cfg80211_get_iftype_ext_capa); -+ -+static bool -+ieee80211_radio_freq_range_valid(const struct wiphy_radio *radio, -+ u32 freq, u32 width) -+{ -+ const struct wiphy_radio_freq_range *r; -+ int i; -+ -+ for (i = 0; i < radio->n_freq_range; i++) { -+ r = &radio->freq_range[i]; -+ if (freq - width / 2 >= r->start_freq && -+ freq + width / 2 <= r->end_freq) -+ return true; -+ } -+ -+ return false; -+} -+ -+bool cfg80211_radio_chandef_valid(const struct wiphy_radio *radio, -+ const struct cfg80211_chan_def *chandef) -+{ -+ u32 freq, width; -+ -+ freq = ieee80211_chandef_to_khz(chandef); -+ width = nl80211_chan_width_to_mhz(chandef->width); -+ if (!ieee80211_radio_freq_range_valid(radio, freq, width)) -+ return false; -+ -+ freq = MHZ_TO_KHZ(chandef->center_freq2); -+ if (freq && !ieee80211_radio_freq_range_valid(radio, freq, width)) -+ return false; -+ -+ return true; -+} -+EXPORT_SYMBOL(cfg80211_radio_chandef_valid); diff --git a/package/kernel/mac80211/patches/subsys/344-wifi-mac80211-add-support-for-DFS-with-multiple-radi.patch b/package/kernel/mac80211/patches/subsys/344-wifi-mac80211-add-support-for-DFS-with-multiple-radi.patch deleted file mode 100644 index 18634fe1465..00000000000 --- a/package/kernel/mac80211/patches/subsys/344-wifi-mac80211-add-support-for-DFS-with-multiple-radi.patch +++ /dev/null @@ -1,88 +0,0 @@ -From: Felix Fietkau -Date: Thu, 6 Jun 2024 12:19:08 +0200 -Subject: [PATCH] wifi: mac80211: add support for DFS with multiple - radios - -DFS can be supported with multi-channel combinations, as long as each DFS -capable radio only supports one channel. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/main.c -+++ b/net/mac80211/main.c -@@ -1084,6 +1084,27 @@ static int ieee80211_init_cipher_suites( - return 0; - } - -+static bool -+ieee80211_ifcomb_check(const struct ieee80211_iface_combination *c, int n_comb) -+{ -+ int i, j; -+ -+ for (i = 0; i < n_comb; i++, c++) { -+ /* DFS is not supported with multi-channel combinations yet */ -+ if (c->radar_detect_widths && -+ c->num_different_channels > 1) -+ return false; -+ -+ /* mac80211 doesn't support more than one IBSS interface */ -+ for (j = 0; j < c->n_limits; j++) -+ if ((c->limits[j].types & BIT(NL80211_IFTYPE_ADHOC)) && -+ c->limits[j].max > 1) -+ return false; -+ } -+ -+ return true; -+} -+ - int ieee80211_register_hw(struct ieee80211_hw *hw) - { - struct ieee80211_local *local = hw_to_local(hw); -@@ -1173,17 +1194,20 @@ int ieee80211_register_hw(struct ieee802 - if (comb->num_different_channels > 1) - return -EINVAL; - } -- } else { -- /* DFS is not supported with multi-channel combinations yet */ -- for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) { -- const struct ieee80211_iface_combination *comb; -+ } - -- comb = &local->hw.wiphy->iface_combinations[i]; -+ if (hw->wiphy->n_radio) { -+ for (i = 0; i < hw->wiphy->n_radio; i++) { -+ const struct wiphy_radio *radio = &hw->wiphy->radio[i]; - -- if (comb->radar_detect_widths && -- comb->num_different_channels > 1) -+ if (!ieee80211_ifcomb_check(radio->iface_combinations, -+ radio->n_iface_combinations)) - return -EINVAL; - } -+ } else { -+ if (!ieee80211_ifcomb_check(hw->wiphy->iface_combinations, -+ hw->wiphy->n_iface_combinations)) -+ return -EINVAL; - } - - /* Only HW csum features are currently compatible with mac80211 */ -@@ -1313,18 +1337,6 @@ int ieee80211_register_hw(struct ieee802 - hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR); - hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_MONITOR); - -- /* mac80211 doesn't support more than one IBSS interface right now */ -- for (i = 0; i < hw->wiphy->n_iface_combinations; i++) { -- const struct ieee80211_iface_combination *c; -- int j; -- -- c = &hw->wiphy->iface_combinations[i]; -- -- for (j = 0; j < c->n_limits; j++) -- if ((c->limits[j].types & BIT(NL80211_IFTYPE_ADHOC)) && -- c->limits[j].max > 1) -- return -EINVAL; -- } - - local->int_scan_req = kzalloc(sizeof(*local->int_scan_req) + - sizeof(void *) * channels, GFP_KERNEL); diff --git a/package/kernel/mac80211/patches/subsys/345-wifi-mac80211-add-radio-index-to-ieee80211_chanctx_c.patch b/package/kernel/mac80211/patches/subsys/345-wifi-mac80211-add-radio-index-to-ieee80211_chanctx_c.patch deleted file mode 100644 index b832a2a1240..00000000000 --- a/package/kernel/mac80211/patches/subsys/345-wifi-mac80211-add-radio-index-to-ieee80211_chanctx_c.patch +++ /dev/null @@ -1,66 +0,0 @@ -From: Felix Fietkau -Date: Wed, 5 Jun 2024 10:41:34 +0200 -Subject: [PATCH] wifi: mac80211: add radio index to - ieee80211_chanctx_conf - -Will be used to explicitly assign a channel context to a wiphy radio. - -Signed-off-by: Felix Fietkau ---- - ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -250,6 +250,7 @@ struct ieee80211_chan_req { - * @min_def: the minimum channel definition currently required. - * @ap: the channel definition the AP actually is operating as, - * for use with (wider bandwidth) OFDMA -+ * @radio_idx: index of the wiphy radio used used for this channel - * @rx_chains_static: The number of RX chains that must always be - * active on the channel to receive MIMO transmissions - * @rx_chains_dynamic: The number of RX chains that must be enabled -@@ -264,6 +265,7 @@ struct ieee80211_chanctx_conf { - struct cfg80211_chan_def min_def; - struct cfg80211_chan_def ap; - -+ int radio_idx; - u8 rx_chains_static, rx_chains_dynamic; - - bool radar_enabled; ---- a/net/mac80211/chan.c -+++ b/net/mac80211/chan.c -@@ -623,7 +623,8 @@ ieee80211_chanctx_radar_required(struct - static struct ieee80211_chanctx * - ieee80211_alloc_chanctx(struct ieee80211_local *local, - const struct ieee80211_chan_req *chanreq, -- enum ieee80211_chanctx_mode mode) -+ enum ieee80211_chanctx_mode mode, -+ int radio_idx) - { - struct ieee80211_chanctx *ctx; - -@@ -641,6 +642,7 @@ ieee80211_alloc_chanctx(struct ieee80211 - ctx->conf.rx_chains_dynamic = 1; - ctx->mode = mode; - ctx->conf.radar_enabled = false; -+ ctx->conf.radio_idx = radio_idx; - _ieee80211_recalc_chanctx_min_def(local, ctx, NULL); - - return ctx; -@@ -680,7 +682,7 @@ ieee80211_new_chanctx(struct ieee80211_l - - lockdep_assert_wiphy(local->hw.wiphy); - -- ctx = ieee80211_alloc_chanctx(local, chanreq, mode); -+ ctx = ieee80211_alloc_chanctx(local, chanreq, mode, -1); - if (!ctx) - return ERR_PTR(-ENOMEM); - -@@ -1098,7 +1100,7 @@ int ieee80211_link_reserve_chanctx(struc - !list_empty(&curr_ctx->reserved_links)) - return -EBUSY; - -- new_ctx = ieee80211_alloc_chanctx(local, chanreq, mode); -+ new_ctx = ieee80211_alloc_chanctx(local, chanreq, mode, -1); - if (!new_ctx) - return -ENOMEM; - diff --git a/package/kernel/mac80211/patches/subsys/346-wifi-mac80211-extend-ifcomb-check-functions-for-mult.patch b/package/kernel/mac80211/patches/subsys/346-wifi-mac80211-extend-ifcomb-check-functions-for-mult.patch deleted file mode 100644 index 0182180fcb0..00000000000 --- a/package/kernel/mac80211/patches/subsys/346-wifi-mac80211-extend-ifcomb-check-functions-for-mult.patch +++ /dev/null @@ -1,322 +0,0 @@ -From: Felix Fietkau -Date: Tue, 4 Jun 2024 21:48:48 +0200 -Subject: [PATCH] wifi: mac80211: extend ifcomb check functions for - multi-radio - -Add support for counting global and per-radio max/current number of -channels, as well as checking radio-specific interface combinations. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -263,7 +263,7 @@ static int ieee80211_start_p2p_device(st - - lockdep_assert_wiphy(sdata->local->hw.wiphy); - -- ret = ieee80211_check_combinations(sdata, NULL, 0, 0); -+ ret = ieee80211_check_combinations(sdata, NULL, 0, 0, -1); - if (ret < 0) - return ret; - -@@ -285,7 +285,7 @@ static int ieee80211_start_nan(struct wi - - lockdep_assert_wiphy(sdata->local->hw.wiphy); - -- ret = ieee80211_check_combinations(sdata, NULL, 0, 0); -+ ret = ieee80211_check_combinations(sdata, NULL, 0, 0, -1); - if (ret < 0) - return ret; - -@@ -3993,7 +3993,7 @@ __ieee80211_channel_switch(struct wiphy - goto out; - - /* if reservation is invalid then this will fail */ -- err = ieee80211_check_combinations(sdata, NULL, chanctx->mode, 0); -+ err = ieee80211_check_combinations(sdata, NULL, chanctx->mode, 0, -1); - if (err) { - ieee80211_link_unreserve_chanctx(link_data); - goto out; -@@ -5162,4 +5162,5 @@ const struct cfg80211_ops mac80211_confi - .del_link_station = ieee80211_del_link_station, - .set_hw_timestamp = ieee80211_set_hw_timestamp, - .set_ttlm = ieee80211_set_ttlm, -+ .get_radio_mask = ieee80211_get_radio_mask, - }; ---- a/net/mac80211/chan.c -+++ b/net/mac80211/chan.c -@@ -47,24 +47,29 @@ int ieee80211_chanctx_refcount(struct ie - ieee80211_chanctx_num_reserved(local, ctx); - } - --static int ieee80211_num_chanctx(struct ieee80211_local *local) -+static int ieee80211_num_chanctx(struct ieee80211_local *local, int radio_idx) - { - struct ieee80211_chanctx *ctx; - int num = 0; - - lockdep_assert_wiphy(local->hw.wiphy); - -- list_for_each_entry(ctx, &local->chanctx_list, list) -+ list_for_each_entry(ctx, &local->chanctx_list, list) { -+ if (radio_idx >= 0 && ctx->conf.radio_idx != radio_idx) -+ continue; - num++; -+ } - - return num; - } - --static bool ieee80211_can_create_new_chanctx(struct ieee80211_local *local) -+static bool ieee80211_can_create_new_chanctx(struct ieee80211_local *local, -+ int radio_idx) - { - lockdep_assert_wiphy(local->hw.wiphy); - -- return ieee80211_num_chanctx(local) < ieee80211_max_num_channels(local); -+ return ieee80211_num_chanctx(local, radio_idx) < -+ ieee80211_max_num_channels(local, radio_idx); - } - - static struct ieee80211_chanctx * -@@ -1045,7 +1050,7 @@ int ieee80211_link_reserve_chanctx(struc - - new_ctx = ieee80211_find_reservation_chanctx(local, chanreq, mode); - if (!new_ctx) { -- if (ieee80211_can_create_new_chanctx(local)) { -+ if (ieee80211_can_create_new_chanctx(local, -1)) { - new_ctx = ieee80211_new_chanctx(local, chanreq, mode); - if (IS_ERR(new_ctx)) - return PTR_ERR(new_ctx); -@@ -1736,7 +1741,7 @@ int ieee80211_link_use_channel(struct ie - link->radar_required = ret; - - ret = ieee80211_check_combinations(sdata, &chanreq->oper, mode, -- radar_detect_width); -+ radar_detect_width, -1); - if (ret < 0) - goto out; - ---- a/net/mac80211/ibss.c -+++ b/net/mac80211/ibss.c -@@ -1745,7 +1745,7 @@ int ieee80211_ibss_join(struct ieee80211 - IEEE80211_CHANCTX_SHARED : IEEE80211_CHANCTX_EXCLUSIVE; - - ret = ieee80211_check_combinations(sdata, ¶ms->chandef, chanmode, -- radar_detect_width); -+ radar_detect_width, -1); - if (ret < 0) - return ret; - ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -2596,8 +2596,9 @@ void ieee80211_recalc_dtim(struct ieee80 - int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata, - const struct cfg80211_chan_def *chandef, - enum ieee80211_chanctx_mode chanmode, -- u8 radar_detect); --int ieee80211_max_num_channels(struct ieee80211_local *local); -+ u8 radar_detect, int radio_idx); -+int ieee80211_max_num_channels(struct ieee80211_local *local, int radio_idx); -+u32 ieee80211_get_radio_mask(struct wiphy *wiphy, struct net_device *dev); - void ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local, - struct ieee80211_chanctx *ctx); - ---- a/net/mac80211/iface.c -+++ b/net/mac80211/iface.c -@@ -397,7 +397,7 @@ static int ieee80211_check_concurrent_if - } - } - -- return ieee80211_check_combinations(sdata, NULL, 0, 0); -+ return ieee80211_check_combinations(sdata, NULL, 0, 0, -1); - } - - static int ieee80211_check_queues(struct ieee80211_sub_if_data *sdata, ---- a/net/mac80211/util.c -+++ b/net/mac80211/util.c -@@ -3918,20 +3918,103 @@ static u8 ieee80211_chanctx_radar_detect - return radar_detect; - } - -+static u32 -+__ieee80211_get_radio_mask(struct ieee80211_sub_if_data *sdata) -+{ -+ struct ieee80211_bss_conf *link_conf; -+ struct ieee80211_chanctx_conf *conf; -+ unsigned int link_id; -+ u32 mask = 0; -+ -+ for_each_vif_active_link(&sdata->vif, link_conf, link_id) { -+ conf = sdata_dereference(link_conf->chanctx_conf, sdata); -+ if (!conf || conf->radio_idx < 0) -+ continue; -+ -+ mask |= BIT(conf->radio_idx); -+ } -+ -+ return mask; -+} -+ -+u32 ieee80211_get_radio_mask(struct wiphy *wiphy, struct net_device *dev) -+{ -+ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); -+ -+ return __ieee80211_get_radio_mask(sdata); -+} -+ -+static bool -+ieee80211_sdata_uses_radio(struct ieee80211_sub_if_data *sdata, int radio_idx) -+{ -+ if (radio_idx < 0) -+ return true; -+ -+ return __ieee80211_get_radio_mask(sdata) & BIT(radio_idx); -+} -+ -+static int -+ieee80211_fill_ifcomb_params(struct ieee80211_local *local, -+ struct iface_combination_params *params, -+ const struct cfg80211_chan_def *chandef, -+ struct ieee80211_sub_if_data *sdata) -+{ -+ struct ieee80211_sub_if_data *sdata_iter; -+ struct ieee80211_chanctx *ctx; -+ int total = !!sdata; -+ -+ list_for_each_entry(ctx, &local->chanctx_list, list) { -+ if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED) -+ continue; -+ -+ if (params->radio_idx >= 0 && -+ ctx->conf.radio_idx != params->radio_idx) -+ continue; -+ -+ params->radar_detect |= -+ ieee80211_chanctx_radar_detect(local, ctx); -+ -+ if (chandef && ctx->mode != IEEE80211_CHANCTX_EXCLUSIVE && -+ cfg80211_chandef_compatible(chandef, &ctx->conf.def)) -+ continue; -+ -+ params->num_different_channels++; -+ } -+ -+ list_for_each_entry(sdata_iter, &local->interfaces, list) { -+ struct wireless_dev *wdev_iter; -+ -+ wdev_iter = &sdata_iter->wdev; -+ -+ if (sdata_iter == sdata || -+ !ieee80211_sdata_running(sdata_iter) || -+ cfg80211_iftype_allowed(local->hw.wiphy, -+ wdev_iter->iftype, 0, 1)) -+ continue; -+ -+ if (!ieee80211_sdata_uses_radio(sdata_iter, params->radio_idx)) -+ continue; -+ -+ params->iftype_num[wdev_iter->iftype]++; -+ total++; -+ } -+ -+ return total; -+} -+ - int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata, - const struct cfg80211_chan_def *chandef, - enum ieee80211_chanctx_mode chanmode, -- u8 radar_detect) -+ u8 radar_detect, int radio_idx) - { -+ bool shared = chanmode == IEEE80211_CHANCTX_SHARED; - struct ieee80211_local *local = sdata->local; -- struct ieee80211_sub_if_data *sdata_iter; - enum nl80211_iftype iftype = sdata->wdev.iftype; -- struct ieee80211_chanctx *ctx; -- int total = 1; - struct iface_combination_params params = { - .radar_detect = radar_detect, -- .radio_idx = -1, -+ .radio_idx = radio_idx, - }; -+ int total; - - lockdep_assert_wiphy(local->hw.wiphy); - -@@ -3968,37 +4051,9 @@ int ieee80211_check_combinations(struct - if (iftype != NL80211_IFTYPE_UNSPECIFIED) - params.iftype_num[iftype] = 1; - -- list_for_each_entry(ctx, &local->chanctx_list, list) { -- if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED) -- continue; -- params.radar_detect |= -- ieee80211_chanctx_radar_detect(local, ctx); -- if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE) { -- params.num_different_channels++; -- continue; -- } -- if (chandef && chanmode == IEEE80211_CHANCTX_SHARED && -- cfg80211_chandef_compatible(chandef, -- &ctx->conf.def)) -- continue; -- params.num_different_channels++; -- } -- -- list_for_each_entry_rcu(sdata_iter, &local->interfaces, list) { -- struct wireless_dev *wdev_iter; -- -- wdev_iter = &sdata_iter->wdev; -- -- if (sdata_iter == sdata || -- !ieee80211_sdata_running(sdata_iter) || -- cfg80211_iftype_allowed(local->hw.wiphy, -- wdev_iter->iftype, 0, 1)) -- continue; -- -- params.iftype_num[wdev_iter->iftype]++; -- total++; -- } -- -+ total = ieee80211_fill_ifcomb_params(local, ¶ms, -+ shared ? chandef : NULL, -+ sdata); - if (total == 1 && !params.radar_detect) - return 0; - -@@ -4015,30 +4070,17 @@ ieee80211_iter_max_chans(const struct ie - c->num_different_channels); - } - --int ieee80211_max_num_channels(struct ieee80211_local *local) -+int ieee80211_max_num_channels(struct ieee80211_local *local, int radio_idx) - { -- struct ieee80211_sub_if_data *sdata; -- struct ieee80211_chanctx *ctx; - u32 max_num_different_channels = 1; - int err; - struct iface_combination_params params = { -- .radio_idx = -1, -+ .radio_idx = radio_idx, - }; - - lockdep_assert_wiphy(local->hw.wiphy); - -- list_for_each_entry(ctx, &local->chanctx_list, list) { -- if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED) -- continue; -- -- params.num_different_channels++; -- -- params.radar_detect |= -- ieee80211_chanctx_radar_detect(local, ctx); -- } -- -- list_for_each_entry_rcu(sdata, &local->interfaces, list) -- params.iftype_num[sdata->wdev.iftype]++; -+ ieee80211_fill_ifcomb_params(local, ¶ms, NULL, NULL); - - err = cfg80211_iter_combinations(local->hw.wiphy, ¶ms, - ieee80211_iter_max_chans, diff --git a/package/kernel/mac80211/patches/subsys/347-wifi-mac80211-move-code-in-ieee80211_link_reserve_ch.patch b/package/kernel/mac80211/patches/subsys/347-wifi-mac80211-move-code-in-ieee80211_link_reserve_ch.patch deleted file mode 100644 index 9a850676022..00000000000 --- a/package/kernel/mac80211/patches/subsys/347-wifi-mac80211-move-code-in-ieee80211_link_reserve_ch.patch +++ /dev/null @@ -1,175 +0,0 @@ -From: Felix Fietkau -Date: Wed, 5 Jun 2024 10:49:22 +0200 -Subject: [PATCH] wifi: mac80211: move code in - ieee80211_link_reserve_chanctx to a helper - -Reduces indentation in preparation for further changes - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/chan.c -+++ b/net/mac80211/chan.c -@@ -1033,6 +1033,71 @@ int ieee80211_link_unreserve_chanctx(str - return 0; - } - -+static struct ieee80211_chanctx * -+ieee80211_replace_chanctx(struct ieee80211_local *local, -+ const struct ieee80211_chan_req *chanreq, -+ enum ieee80211_chanctx_mode mode, -+ struct ieee80211_chanctx *curr_ctx) -+{ -+ struct ieee80211_chanctx *new_ctx, *ctx; -+ -+ if (!curr_ctx || (curr_ctx->replace_state == -+ IEEE80211_CHANCTX_WILL_BE_REPLACED) || -+ !list_empty(&curr_ctx->reserved_links)) { -+ /* -+ * Another link already requested this context for a -+ * reservation. Find another one hoping all links assigned -+ * to it will also switch soon enough. -+ * -+ * TODO: This needs a little more work as some cases -+ * (more than 2 chanctx capable devices) may fail which could -+ * otherwise succeed provided some channel context juggling was -+ * performed. -+ * -+ * Consider ctx1..3, link1..6, each ctx has 2 links. link1 and -+ * link2 from ctx1 request new different chandefs starting 2 -+ * in-place reserations with ctx4 and ctx5 replacing ctx1 and -+ * ctx2 respectively. Next link5 and link6 from ctx3 reserve -+ * ctx4. If link3 and link4 remain on ctx2 as they are then this -+ * fails unless `replace_ctx` from ctx5 is replaced with ctx3. -+ */ -+ list_for_each_entry(ctx, &local->chanctx_list, list) { -+ if (ctx->replace_state != -+ IEEE80211_CHANCTX_REPLACE_NONE) -+ continue; -+ -+ if (!list_empty(&ctx->reserved_links)) -+ continue; -+ -+ curr_ctx = ctx; -+ break; -+ } -+ } -+ -+ /* -+ * If that's true then all available contexts already have reservations -+ * and cannot be used. -+ */ -+ if (!curr_ctx || (curr_ctx->replace_state == -+ IEEE80211_CHANCTX_WILL_BE_REPLACED) || -+ !list_empty(&curr_ctx->reserved_links)) -+ return ERR_PTR(-EBUSY); -+ -+ new_ctx = ieee80211_alloc_chanctx(local, chanreq, mode, -1); -+ if (!new_ctx) -+ return ERR_PTR(-ENOMEM); -+ -+ new_ctx->replace_ctx = curr_ctx; -+ new_ctx->replace_state = IEEE80211_CHANCTX_REPLACES_OTHER; -+ -+ curr_ctx->replace_ctx = new_ctx; -+ curr_ctx->replace_state = IEEE80211_CHANCTX_WILL_BE_REPLACED; -+ -+ list_add_rcu(&new_ctx->list, &local->chanctx_list); -+ -+ return new_ctx; -+} -+ - int ieee80211_link_reserve_chanctx(struct ieee80211_link_data *link, - const struct ieee80211_chan_req *chanreq, - enum ieee80211_chanctx_mode mode, -@@ -1040,7 +1105,7 @@ int ieee80211_link_reserve_chanctx(struc - { - struct ieee80211_sub_if_data *sdata = link->sdata; - struct ieee80211_local *local = sdata->local; -- struct ieee80211_chanctx *new_ctx, *curr_ctx, *ctx; -+ struct ieee80211_chanctx *new_ctx, *curr_ctx; - - lockdep_assert_wiphy(local->hw.wiphy); - -@@ -1050,75 +1115,13 @@ int ieee80211_link_reserve_chanctx(struc - - new_ctx = ieee80211_find_reservation_chanctx(local, chanreq, mode); - if (!new_ctx) { -- if (ieee80211_can_create_new_chanctx(local, -1)) { -+ if (ieee80211_can_create_new_chanctx(local, -1)) - new_ctx = ieee80211_new_chanctx(local, chanreq, mode); -- if (IS_ERR(new_ctx)) -- return PTR_ERR(new_ctx); -- } else { -- if (!curr_ctx || -- (curr_ctx->replace_state == -- IEEE80211_CHANCTX_WILL_BE_REPLACED) || -- !list_empty(&curr_ctx->reserved_links)) { -- /* -- * Another link already requested this context -- * for a reservation. Find another one hoping -- * all links assigned to it will also switch -- * soon enough. -- * -- * TODO: This needs a little more work as some -- * cases (more than 2 chanctx capable devices) -- * may fail which could otherwise succeed -- * provided some channel context juggling was -- * performed. -- * -- * Consider ctx1..3, link1..6, each ctx has 2 -- * links. link1 and link2 from ctx1 request new -- * different chandefs starting 2 in-place -- * reserations with ctx4 and ctx5 replacing -- * ctx1 and ctx2 respectively. Next link5 and -- * link6 from ctx3 reserve ctx4. If link3 and -- * link4 remain on ctx2 as they are then this -- * fails unless `replace_ctx` from ctx5 is -- * replaced with ctx3. -- */ -- list_for_each_entry(ctx, &local->chanctx_list, -- list) { -- if (ctx->replace_state != -- IEEE80211_CHANCTX_REPLACE_NONE) -- continue; -- -- if (!list_empty(&ctx->reserved_links)) -- continue; -- -- curr_ctx = ctx; -- break; -- } -- } -- -- /* -- * If that's true then all available contexts already -- * have reservations and cannot be used. -- */ -- if (!curr_ctx || -- (curr_ctx->replace_state == -- IEEE80211_CHANCTX_WILL_BE_REPLACED) || -- !list_empty(&curr_ctx->reserved_links)) -- return -EBUSY; -- -- new_ctx = ieee80211_alloc_chanctx(local, chanreq, mode, -1); -- if (!new_ctx) -- return -ENOMEM; -- -- new_ctx->replace_ctx = curr_ctx; -- new_ctx->replace_state = -- IEEE80211_CHANCTX_REPLACES_OTHER; -- -- curr_ctx->replace_ctx = new_ctx; -- curr_ctx->replace_state = -- IEEE80211_CHANCTX_WILL_BE_REPLACED; -- -- list_add_rcu(&new_ctx->list, &local->chanctx_list); -- } -+ else -+ new_ctx = ieee80211_replace_chanctx(local, chanreq, -+ mode, curr_ctx); -+ if (IS_ERR(new_ctx)) -+ return PTR_ERR(new_ctx); - } - - list_add(&link->reserved_chanctx_list, &new_ctx->reserved_links); diff --git a/package/kernel/mac80211/patches/subsys/348-wifi-mac80211-add-wiphy-radio-assignment-and-validat.patch b/package/kernel/mac80211/patches/subsys/348-wifi-mac80211-add-wiphy-radio-assignment-and-validat.patch deleted file mode 100644 index c559f070e87..00000000000 --- a/package/kernel/mac80211/patches/subsys/348-wifi-mac80211-add-wiphy-radio-assignment-and-validat.patch +++ /dev/null @@ -1,132 +0,0 @@ -From: Felix Fietkau -Date: Wed, 5 Jun 2024 18:39:55 +0200 -Subject: [PATCH] wifi: mac80211: add wiphy radio assignment and - validation - -Validate number of channels and interface combinations per radio. -Assign each channel context to a radio. - -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/chan.c -+++ b/net/mac80211/chan.c -@@ -680,14 +680,15 @@ static int ieee80211_add_chanctx(struct - static struct ieee80211_chanctx * - ieee80211_new_chanctx(struct ieee80211_local *local, - const struct ieee80211_chan_req *chanreq, -- enum ieee80211_chanctx_mode mode) -+ enum ieee80211_chanctx_mode mode, -+ int radio_idx) - { - struct ieee80211_chanctx *ctx; - int err; - - lockdep_assert_wiphy(local->hw.wiphy); - -- ctx = ieee80211_alloc_chanctx(local, chanreq, mode, -1); -+ ctx = ieee80211_alloc_chanctx(local, chanreq, mode, radio_idx); - if (!ctx) - return ERR_PTR(-ENOMEM); - -@@ -1040,6 +1041,8 @@ ieee80211_replace_chanctx(struct ieee802 - struct ieee80211_chanctx *curr_ctx) - { - struct ieee80211_chanctx *new_ctx, *ctx; -+ struct wiphy *wiphy = local->hw.wiphy; -+ const struct wiphy_radio *radio; - - if (!curr_ctx || (curr_ctx->replace_state == - IEEE80211_CHANCTX_WILL_BE_REPLACED) || -@@ -1069,6 +1072,12 @@ ieee80211_replace_chanctx(struct ieee802 - if (!list_empty(&ctx->reserved_links)) - continue; - -+ if (ctx->conf.radio_idx >= 0) { -+ radio = &wiphy->radio[ctx->conf.radio_idx]; -+ if (!cfg80211_radio_chandef_valid(radio, &chanreq->oper)) -+ continue; -+ } -+ - curr_ctx = ctx; - break; - } -@@ -1098,6 +1107,34 @@ ieee80211_replace_chanctx(struct ieee802 - return new_ctx; - } - -+static bool -+ieee80211_find_available_radio(struct ieee80211_local *local, -+ const struct ieee80211_chan_req *chanreq, -+ int *radio_idx) -+{ -+ struct wiphy *wiphy = local->hw.wiphy; -+ const struct wiphy_radio *radio; -+ int i; -+ -+ *radio_idx = -1; -+ if (!wiphy->n_radio) -+ return true; -+ -+ for (i = 0; i < wiphy->n_radio; i++) { -+ radio = &wiphy->radio[i]; -+ if (!cfg80211_radio_chandef_valid(radio, &chanreq->oper)) -+ continue; -+ -+ if (!ieee80211_can_create_new_chanctx(local, i)) -+ continue; -+ -+ *radio_idx = i; -+ return true; -+ } -+ -+ return false; -+} -+ - int ieee80211_link_reserve_chanctx(struct ieee80211_link_data *link, - const struct ieee80211_chan_req *chanreq, - enum ieee80211_chanctx_mode mode, -@@ -1106,6 +1143,7 @@ int ieee80211_link_reserve_chanctx(struc - struct ieee80211_sub_if_data *sdata = link->sdata; - struct ieee80211_local *local = sdata->local; - struct ieee80211_chanctx *new_ctx, *curr_ctx; -+ int radio_idx; - - lockdep_assert_wiphy(local->hw.wiphy); - -@@ -1115,8 +1153,10 @@ int ieee80211_link_reserve_chanctx(struc - - new_ctx = ieee80211_find_reservation_chanctx(local, chanreq, mode); - if (!new_ctx) { -- if (ieee80211_can_create_new_chanctx(local, -1)) -- new_ctx = ieee80211_new_chanctx(local, chanreq, mode); -+ if (ieee80211_can_create_new_chanctx(local, -1) && -+ ieee80211_find_available_radio(local, chanreq, &radio_idx)) -+ new_ctx = ieee80211_new_chanctx(local, chanreq, mode, -+ radio_idx); - else - new_ctx = ieee80211_replace_chanctx(local, chanreq, - mode, curr_ctx); -@@ -1724,6 +1764,7 @@ int ieee80211_link_use_channel(struct ie - struct ieee80211_local *local = sdata->local; - struct ieee80211_chanctx *ctx; - u8 radar_detect_width = 0; -+ int radio_idx; - int ret; - - lockdep_assert_wiphy(local->hw.wiphy); -@@ -1751,8 +1792,12 @@ int ieee80211_link_use_channel(struct ie - __ieee80211_link_release_channel(link); - - ctx = ieee80211_find_chanctx(local, chanreq, mode); -- if (!ctx) -- ctx = ieee80211_new_chanctx(local, chanreq, mode); -+ if (!ctx) { -+ if (!ieee80211_find_available_radio(local, chanreq, &radio_idx)) -+ ctx = ERR_PTR(-EBUSY); -+ else -+ ctx = ieee80211_new_chanctx(local, chanreq, mode, radio_idx); -+ } - if (IS_ERR(ctx)) { - ret = PTR_ERR(ctx); - goto out; diff --git a/package/kernel/mac80211/patches/subsys/349-wifi-mac80211_hwsim-add-support-for-multi-radio-wiph.patch b/package/kernel/mac80211/patches/subsys/349-wifi-mac80211_hwsim-add-support-for-multi-radio-wiph.patch deleted file mode 100644 index 91fe6d83d9f..00000000000 --- a/package/kernel/mac80211/patches/subsys/349-wifi-mac80211_hwsim-add-support-for-multi-radio-wiph.patch +++ /dev/null @@ -1,199 +0,0 @@ -From: Felix Fietkau -Date: Tue, 11 Jun 2024 09:02:55 +0200 -Subject: [PATCH] wifi: mac80211_hwsim: add support for multi-radio wiphy - -This registers one wiphy radio per supported band. Number of different -channels is set per radio. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/net/wireless/virtual/mac80211_hwsim.c -+++ b/drivers/net/wireless/virtual/mac80211_hwsim.c -@@ -69,6 +69,10 @@ static bool mlo; - module_param(mlo, bool, 0444); - MODULE_PARM_DESC(mlo, "Support MLO"); - -+static bool multi_radio; -+module_param(multi_radio, bool, 0444); -+MODULE_PARM_DESC(mlo, "Support Multiple Radios per wiphy"); -+ - /** - * enum hwsim_regtest - the type of regulatory tests we offer - * -@@ -669,6 +673,10 @@ struct mac80211_hwsim_data { - struct ieee80211_iface_limit if_limits[3]; - int n_if_limits; - -+ struct ieee80211_iface_combination if_combination_radio; -+ struct wiphy_radio_freq_range radio_range[NUM_NL80211_BANDS]; -+ struct wiphy_radio radio[NUM_NL80211_BANDS]; -+ - u32 ciphers[ARRAY_SIZE(hwsim_ciphers)]; - - struct mac_address addresses[2]; -@@ -917,6 +925,7 @@ static const struct nla_policy hwsim_gen - [HWSIM_ATTR_MLO_SUPPORT] = { .type = NLA_FLAG }, - [HWSIM_ATTR_PMSR_SUPPORT] = NLA_POLICY_NESTED(hwsim_pmsr_capa_policy), - [HWSIM_ATTR_PMSR_RESULT] = NLA_POLICY_NESTED(hwsim_pmsr_peers_result_policy), -+ [HWSIM_ATTR_MULTI_RADIO] = { .type = NLA_FLAG }, - }; - - #if IS_REACHABLE(CONFIG_VIRTIO) -@@ -4007,6 +4016,7 @@ struct hwsim_new_radio_params { - bool reg_strict; - bool p2p_device; - bool use_chanctx; -+ bool multi_radio; - bool destroy_on_close; - const char *hwname; - bool no_vif; -@@ -4083,6 +4093,12 @@ static int append_radio_msg(struct sk_bu - return ret; - } - -+ if (param->multi_radio) { -+ ret = nla_put_flag(skb, HWSIM_ATTR_MULTI_RADIO); -+ if (ret < 0) -+ return ret; -+ } -+ - if (param->hwname) { - ret = nla_put(skb, HWSIM_ATTR_RADIO_NAME, - strlen(param->hwname), param->hwname); -@@ -5099,6 +5115,7 @@ static int mac80211_hwsim_new_radio(stru - struct net *net; - int idx, i; - int n_limits = 0; -+ int n_bands = 0; - - if (WARN_ON(param->channels > 1 && !param->use_chanctx)) - return -EINVAL; -@@ -5202,22 +5219,22 @@ static int mac80211_hwsim_new_radio(stru - n_limits++; - } - -+ data->if_combination.radar_detect_widths = -+ BIT(NL80211_CHAN_WIDTH_5) | -+ BIT(NL80211_CHAN_WIDTH_10) | -+ BIT(NL80211_CHAN_WIDTH_20_NOHT) | -+ BIT(NL80211_CHAN_WIDTH_20) | -+ BIT(NL80211_CHAN_WIDTH_40) | -+ BIT(NL80211_CHAN_WIDTH_80) | -+ BIT(NL80211_CHAN_WIDTH_160); -+ - if (data->use_chanctx) { - hw->wiphy->max_scan_ssids = 255; - hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; - hw->wiphy->max_remain_on_channel_duration = 1000; -- data->if_combination.radar_detect_widths = 0; - data->if_combination.num_different_channels = data->channels; - } else { - data->if_combination.num_different_channels = 1; -- data->if_combination.radar_detect_widths = -- BIT(NL80211_CHAN_WIDTH_5) | -- BIT(NL80211_CHAN_WIDTH_10) | -- BIT(NL80211_CHAN_WIDTH_20_NOHT) | -- BIT(NL80211_CHAN_WIDTH_20) | -- BIT(NL80211_CHAN_WIDTH_40) | -- BIT(NL80211_CHAN_WIDTH_80) | -- BIT(NL80211_CHAN_WIDTH_160); - } - - if (!n_limits) { -@@ -5333,6 +5350,9 @@ static int mac80211_hwsim_new_radio(stru - - for (band = NL80211_BAND_2GHZ; band < NUM_NL80211_BANDS; band++) { - struct ieee80211_supported_band *sband = &data->bands[band]; -+ struct wiphy_radio_freq_range *radio_range; -+ const struct ieee80211_channel *c; -+ struct wiphy_radio *radio; - - sband->band = band; - -@@ -5406,8 +5426,36 @@ static int mac80211_hwsim_new_radio(stru - mac80211_hwsim_sband_capab(sband); - - hw->wiphy->bands[band] = sband; -+ -+ if (!param->multi_radio) -+ continue; -+ -+ c = sband->channels; -+ radio_range = &data->radio_range[n_bands]; -+ radio_range->start_freq = ieee80211_channel_to_khz(c) - 10000; -+ -+ c += sband->n_channels - 1; -+ radio_range->end_freq = ieee80211_channel_to_khz(c) + 10000; -+ -+ radio = &data->radio[n_bands++]; -+ radio->freq_range = radio_range; -+ radio->n_freq_range = 1; -+ radio->iface_combinations = &data->if_combination_radio; -+ radio->n_iface_combinations = 1; - } - -+ if (param->multi_radio) { -+ hw->wiphy->radio = data->radio; -+ hw->wiphy->n_radio = n_bands; -+ -+ memcpy(&data->if_combination_radio, &data->if_combination, -+ sizeof(data->if_combination)); -+ data->if_combination.num_different_channels *= n_bands; -+ } -+ -+ if (data->use_chanctx) -+ data->if_combination.radar_detect_widths = 0; -+ - /* By default all radios belong to the first group */ - data->group = 1; - mutex_init(&data->mutex); -@@ -6025,6 +6073,9 @@ static int hwsim_new_radio_nl(struct sk_ - else - param.use_chanctx = (param.channels > 1); - -+ if (info->attrs[HWSIM_ATTR_MULTI_RADIO]) -+ param.multi_radio = true; -+ - if (info->attrs[HWSIM_ATTR_REG_HINT_ALPHA2]) - param.reg_alpha2 = - nla_data(info->attrs[HWSIM_ATTR_REG_HINT_ALPHA2]); -@@ -6105,7 +6156,7 @@ static int hwsim_new_radio_nl(struct sk_ - - param.mlo = info->attrs[HWSIM_ATTR_MLO_SUPPORT]; - -- if (param.mlo) -+ if (param.mlo || param.multi_radio) - param.use_chanctx = true; - - if (info->attrs[HWSIM_ATTR_RADIO_NAME]) { -@@ -6802,7 +6853,8 @@ static int __init init_mac80211_hwsim(vo - - param.p2p_device = support_p2p_device; - param.mlo = mlo; -- param.use_chanctx = channels > 1 || mlo; -+ param.multi_radio = multi_radio; -+ param.use_chanctx = channels > 1 || mlo || multi_radio; - param.iftypes = HWSIM_IFTYPE_SUPPORT_MASK; - if (param.p2p_device) - param.iftypes |= BIT(NL80211_IFTYPE_P2P_DEVICE); ---- a/drivers/net/wireless/virtual/mac80211_hwsim.h -+++ b/drivers/net/wireless/virtual/mac80211_hwsim.h -@@ -157,6 +157,9 @@ enum hwsim_commands { - * to provide details about peer measurement request (nl80211_peer_measurement_attrs) - * @HWSIM_ATTR_PMSR_RESULT: nested attributed used with %HWSIM_CMD_REPORT_PMSR - * to provide peer measurement result (nl80211_peer_measurement_attrs) -+ * @HWSIM_ATTR_MULTI_RADIO: Register multiple wiphy radios (flag). -+ * Adds one radio for each band. Number of supported channels will be set for -+ * each radio instead of for the wiphy. - * @__HWSIM_ATTR_MAX: enum limit - */ - enum hwsim_attrs { -@@ -189,6 +192,7 @@ enum hwsim_attrs { - HWSIM_ATTR_PMSR_SUPPORT, - HWSIM_ATTR_PMSR_REQUEST, - HWSIM_ATTR_PMSR_RESULT, -+ HWSIM_ATTR_MULTI_RADIO, - __HWSIM_ATTR_MAX, - }; - #define HWSIM_ATTR_MAX (__HWSIM_ATTR_MAX - 1) diff --git a/package/kernel/mac80211/realtek.mk b/package/kernel/mac80211/realtek.mk index 221158bee61..5aeddb99bc0 100644 --- a/package/kernel/mac80211/realtek.mk +++ b/package/kernel/mac80211/realtek.mk @@ -1,10 +1,10 @@ PKG_DRIVERS += \ - rtlwifi rtlwifi-pci rtlwifi-btcoexist rtlwifi-usb rtl8192c-common \ + rtlwifi rtlwifi-pci rtlwifi-btcoexist rtlwifi-usb rtl8192c-common rtl8192d-common \ rtl8192ce rtl8192se rtl8192de rtl8192cu rtl8723-common rtl8723be rtl8723bs rtl8821ae \ rtl8xxxu rtw88 rtw88-pci rtw88-usb rtw88-sdio rtw88-8821c rtw88-8822b rtw88-8822c \ - rtw88-8723d rtw88-8821ce rtw88-8821cu rtw88-8822be rtw88-8822bu \ + rtw88-8723x rtw88-8723d rtw88-8821ce rtw88-8821cu rtw88-8822be rtw88-8822bu \ rtw88-8822ce rtw88-8822cu rtw88-8723de rtw88-8723ds rtw88-8723du \ - rtw89 rtw89-pci rtw89-8851be rtw89-8852ae rtw89-8852be rtw89-8852ce + rtw89 rtw89-pci rtw89-8851be rtw89-8852ae rtw89-8852b-common rtw89-8852be rtw89-8852ce config-$(call config_package,rtlwifi) += RTL_CARDS RTLWIFI config-$(call config_package,rtlwifi-pci) += RTLWIFI_PCI @@ -13,6 +13,7 @@ config-$(call config_package,rtlwifi-usb) += RTLWIFI_USB config-$(call config_package,rtl8192c-common) += RTL8192C_COMMON config-$(call config_package,rtl8192ce) += RTL8192CE config-$(call config_package,rtl8192se) += RTL8192SE +config-$(call config_package,rtl8192d-common) += RTL8192D_COMMON config-$(call config_package,rtl8192de) += RTL8192DE config-$(call config_package,rtl8192cu) += RTL8192CU config-$(call config_package,rtl8821ae) += RTL8821AE @@ -40,6 +41,7 @@ config-$(call config_package,rtw88-8822bu) += RTW88_8822BU config-$(call config_package,rtw88-8822c) += RTW88_8822C config-$(call config_package,rtw88-8822ce) += RTW88_8822CE config-$(call config_package,rtw88-8822cu) += RTW88_8822CU +config-$(call config_package,rtw88-8723x) += RTW88_8723X config-$(call config_package,rtw88-8723d) += RTW88_8723D config-$(call config_package,rtw88-8723de) += RTW88_8723DE config-$(call config_package,rtw88-8723ds) += RTW88_8723DS @@ -51,6 +53,7 @@ config-$(call config_package,rtw89) += RTW89 RTW89_CORE config-$(call config_package,rtw89-pci) += RTW89_PCI config-$(call config_package,rtw89-8851be) += RTW89_8851B RTW89_8851BE config-$(call config_package,rtw89-8852ae) += RTW89_8852A RTW89_8852AE +config-$(call config_package,rtw89-8852b-common) += RTW89_8852B_COMMON config-$(call config_package,rtw89-8852be) += RTW89_8852B RTW89_8852BE config-$(call config_package,rtw89-8852ce) += RTW89_8852C RTW89_8852CE config-$(CONFIG_PACKAGE_RTW89_DEBUG) += RTW89_DEBUG @@ -125,10 +128,18 @@ define KernelPackage/rtl8192se AUTOLOAD:=$(call AutoProbe,rtl8192se) endef +define KernelPackage/rtl8192d-common + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8192DE/RTL8192DU common support module + DEPENDS+= +kmod-rtlwifi + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8192d/rtl8192d-common.ko + HIDDEN:=1 +endef + define KernelPackage/rtl8192de $(call KernelPackage/mac80211/Default) TITLE:=Realtek RTL8192DE/RTL8188DE support - DEPENDS+= +kmod-rtlwifi-pci +rtl8192de-firmware + DEPENDS+= +kmod-rtlwifi-pci +kmod-rtl8192d-common +rtl8192de-firmware FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8192de/rtl8192de.ko AUTOLOAD:=$(call AutoProbe,rtl8192de) endef @@ -260,10 +271,19 @@ define KernelPackage/rtw88-8822c HIDDEN:=1 endef +define KernelPackage/rtw88-8723x + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8723x family support + DEPENDS+= +kmod-rtw88 + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8723x.ko + AUTOLOAD:=$(call AutoProbe,rtw88_8723x) + HIDDEN:=1 +endef + define KernelPackage/rtw88-8723d $(call KernelPackage/mac80211/Default) TITLE:=Realtek RTL8723D family support - DEPENDS+= +kmod-rtw88 +rtl8723de-firmware + DEPENDS+= +kmod-rtw88-8723x +rtl8723de-firmware FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw88/rtw88_8723d.ko AUTOLOAD:=$(call AutoProbe,rtw88_8723d) HIDDEN:=1 @@ -431,10 +451,20 @@ define KernelPackage/rtw89-8852ae AUTOLOAD:=$(call AutoProbe,rtw89_8852ae) endef +define KernelPackage/rtw89-8852b-common + $(call KernelPackage/mac80211/Default) + TITLE:=Realtek RTL8852B family support + DEPENDS+= +kmod-rtw89-pci + FILES:= \ + $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw89/rtw89_8852b_common.ko + AUTOLOAD:=$(call AutoProbe,rtw89_8852b_common) + HIDDEN:=1 +endef + define KernelPackage/rtw89-8852be $(call KernelPackage/mac80211/Default) TITLE:=Realtek RTL8852BE support - DEPENDS+= +kmod-rtw89-pci +rtl8852be-firmware + DEPENDS+= +kmod-rtw89-8852b-common +rtl8852be-firmware FILES:= \ $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw89/rtw89_8852b.ko \ $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtw89/rtw89_8852be.ko diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 070d0f3c2b5..73f34d8edad 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -8,9 +8,9 @@ PKG_LICENSE_FILES:= PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2024-09-29 -PKG_SOURCE_VERSION:=680bc70f161fde0f167e2ae50c771be4775eb50a -PKG_MIRROR_HASH:=bcdb95e40cfceba56a565ad6b6d9f92a122e7230d0f7f950b3d39e4280723cca +PKG_SOURCE_DATE:=2024-10-11.1 +PKG_SOURCE_VERSION:=ecca0e77b4bce629ec1f79d83bbd14a68f919188 +PKG_MIRROR_HASH:=770823f282c76532567a651bb020208c3ddd5a728c656fcde43129fc95edf538 PKG_MAINTAINER:=Felix Fietkau PKG_USE_NINJA:=0 diff --git a/package/kernel/mt76/patches/100-api_update.patch b/package/kernel/mt76/patches/100-api_update.patch deleted file mode 100644 index 8b528f05f72..00000000000 --- a/package/kernel/mt76/patches/100-api_update.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/tx.c -+++ b/tx.c -@@ -350,7 +350,7 @@ mt76_tx(struct mt76_phy *phy, struct iee - info->hw_queue |= FIELD_PREP(MT_TX_HW_QUEUE_PHY, phy->band_idx); - - if ((info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) || -- (info->control.flags & IEEE80211_TX_CTRL_SCAN_TX)) -+ (info->control.flags & IEEE80211_TX_CTRL_DONT_USE_RATE_MASK)) - head = &wcid->tx_offchannel; - else - head = &wcid->tx_pending; diff --git a/package/kernel/mwlwifi/patches/005-mac80211_update.patch b/package/kernel/mwlwifi/patches/005-mac80211_update.patch index 877053fdf1d..11a05509549 100644 --- a/package/kernel/mwlwifi/patches/005-mac80211_update.patch +++ b/package/kernel/mwlwifi/patches/005-mac80211_update.patch @@ -68,6 +68,15 @@ sta->tdls, sta->tdls_initiator, sta->wme, +@@ -1158,7 +1158,7 @@ static ssize_t mwl_debugfs_dfs_radar_wri + struct mwl_priv *priv = (struct mwl_priv *)file->private_data; + + wiphy_info(priv->hw->wiphy, "simulate radar detected\n"); +- ieee80211_radar_detected(priv->hw); ++ ieee80211_radar_detected(priv->hw, NULL); + + return count; + } --- a/hif/fwcmd.c +++ b/hif/fwcmd.c @@ -633,11 +633,15 @@ einval: @@ -482,3 +491,32 @@ switch (format) { case TX_RATE_FORMAT_LEGACY: +--- a/hif/pcie/pcie.c ++++ b/hif/pcie/pcie.c +@@ -546,7 +546,7 @@ static irqreturn_t pcie_isr_8864(struct + + if (int_status & MACREG_A2HRIC_BIT_RADAR_DETECT) { + wiphy_info(hw->wiphy, "radar detected by firmware\n"); +- ieee80211_radar_detected(hw); ++ ieee80211_radar_detected(hw, NULL); + } + + if (int_status & MACREG_A2HRIC_BIT_CHAN_SWITCH) ieee80211_queue_work(hw, &priv->chnl_switch_handle); +@@ -593,7 +593,7 @@ static irqreturn_t pcie_isr_8997(struct + + if (int_status & MACREG_A2HRIC_BIT_RADAR_DETECT) { + wiphy_info(hw->wiphy, "radar detected by firmware\n"); +- ieee80211_radar_detected(hw); ++ ieee80211_radar_detected(hw, NULL); + } + + if (int_status & MACREG_A2HRIC_BIT_CHAN_SWITCH) +@@ -1071,7 +1071,7 @@ static irqreturn_t pcie_isr_ndp(struct i + + if (int_status & MACREG_A2HRIC_NEWDP_DFS) { + wiphy_info(hw->wiphy, "radar detected by firmware\n"); +- ieee80211_radar_detected(hw); ++ ieee80211_radar_detected(hw, NULL); + } + + if (int_status & MACREG_A2HRIC_NEWDP_CHANNEL_SWITCH) diff --git a/package/kernel/ubnt-ledbar/src/leds-ubnt-ledbar.c b/package/kernel/ubnt-ledbar/src/leds-ubnt-ledbar.c index 52b33ef43d8..c36a74779c5 100644 --- a/package/kernel/ubnt-ledbar/src/leds-ubnt-ledbar.c +++ b/package/kernel/ubnt-ledbar/src/leds-ubnt-ledbar.c @@ -164,6 +164,7 @@ static int ubnt_ledbar_probe(struct i2c_client *client) { struct device_node *np = client->dev.of_node; struct ubnt_ledbar *ledbar; + int err; ledbar = devm_kzalloc(&client->dev, sizeof(*ledbar), GFP_KERNEL); if (!ledbar) @@ -184,7 +185,9 @@ static int ubnt_ledbar_probe(struct i2c_client *client) ledbar->client = client; - mutex_init(&ledbar->lock); + err = devm_mutex_init(&client->dev, &ledbar->lock); + if (err) + return err; i2c_set_clientdata(client, ledbar); @@ -203,13 +206,6 @@ static int ubnt_ledbar_probe(struct i2c_client *client) return ubnt_ledbar_apply_state(ledbar); } -static void ubnt_ledbar_remove(struct i2c_client *client) -{ - struct ubnt_ledbar *ledbar = i2c_get_clientdata(client); - - mutex_destroy(&ledbar->lock); -} - static const struct i2c_device_id ubnt_ledbar_id[] = { { "ubnt-ledbar", 0 }, { } @@ -228,7 +224,6 @@ static struct i2c_driver ubnt_ledbar_driver = { .of_match_table = of_ubnt_ledbar_match, }, .probe = ubnt_ledbar_probe, - .remove = ubnt_ledbar_remove, .id_table = ubnt_ledbar_id, }; module_i2c_driver(ubnt_ledbar_driver); diff --git a/package/libs/libbpf/Makefile b/package/libs/libbpf/Makefile index a6fe9831d73..89fe730a98a 100644 --- a/package/libs/libbpf/Makefile +++ b/package/libs/libbpf/Makefile @@ -8,11 +8,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libbpf -PKG_VERSION:=1.4.5 +PKG_VERSION:=1.4.6 PKG_RELEASE:=1 PKG_SOURCE_URL:=https://github.com/libbpf/libbpf -PKG_MIRROR_HASH:=09ad44597d170c12f9f710f7ac4bacfa2b01d110c45810ac0f16c6a3f5d51a0d +PKG_MIRROR_HASH:=0d0d70750c8e45baba19f8cc065771e5d842a90f3ad1637003cae6887dabf11e PKG_SOURCE_PROTO:=git PKG_SOURCE_VERSION:=v$(PKG_VERSION) PKG_ABI_VERSION:=$(firstword $(subst .,$(space),$(PKG_VERSION))) diff --git a/package/libs/libjson-c/Makefile b/package/libs/libjson-c/Makefile index 88781469dc9..9c32ca500f0 100644 --- a/package/libs/libjson-c/Makefile +++ b/package/libs/libjson-c/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=json-c -PKG_VERSION:=0.17 +PKG_VERSION:=0.18 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-nodoc.tar.gz PKG_SOURCE_URL:=https://s3.amazonaws.com/json-c_releases/releases/ -PKG_HASH:=8df3b66597333dd365762cab2de2ff68e41e3808a04b692e696e0550648eefaa +PKG_HASH:=602cdefc1d2aab8318fc0814b7ce7d59e72514d4276ca3eff92f35f86cf1c160 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=MIT diff --git a/package/libs/libjson-c/patches/001-dont-build-docs.patch b/package/libs/libjson-c/patches/001-dont-build-docs.patch index 1de420f8b87..68fbc17fd57 100644 --- a/package/libs/libjson-c/patches/001-dont-build-docs.patch +++ b/package/libs/libjson-c/patches/001-dont-build-docs.patch @@ -1,6 +1,6 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -451,8 +451,6 @@ configure_file(json.h.cmakein ${PROJECT_ +@@ -449,8 +449,6 @@ configure_file(json.h.cmakein ${PROJECT_ include_directories(${PROJECT_SOURCE_DIR}) include_directories(${PROJECT_BINARY_DIR}) diff --git a/package/libs/libnl/Makefile b/package/libs/libnl/Makefile index 93817e5f404..f8f45e0713e 100644 --- a/package/libs/libnl/Makefile +++ b/package/libs/libnl/Makefile @@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libnl -PKG_VERSION:=3.9.0 +PKG_VERSION:=3.10.0 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/thom311/libnl/releases/download/libnl$(subst .,_,$(PKG_VERSION)) -PKG_HASH:=aed507004d728a5cf11eab48ca4bf9e6e1874444e33939b9d3dfed25018ee9bb +PKG_HASH:=49b3e2235fdb58f5910bbb3ed0de8143b71ffc220571540502eb6c2471f204f5 PKG_LICENSE:=LGPL-2.1 PKG_LICENSE_FILES:=COPYING diff --git a/package/libs/libxml2/Makefile b/package/libs/libxml2/Makefile index 2be8026e89d..c2a804b98f3 100644 --- a/package/libs/libxml2/Makefile +++ b/package/libs/libxml2/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libxml2 -PKG_VERSION:=2.12.6 +PKG_VERSION:=2.13.4 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNOME/libxml2/$(basename $(PKG_VERSION)) -PKG_HASH:=889c593a881a3db5fdd96cc9318c87df34eb648edfc458272ad46fd607353fbb +PKG_HASH:=65d042e1c8010243e617efb02afda20b85c2160acdbfbcb5b26b80cec6515650 PKG_LICENSE:=MIT PKG_LICENSE_FILES:=COPYING diff --git a/package/network/config/firewall/Makefile b/package/network/config/firewall/Makefile index 13716472877..54eb09e822e 100644 --- a/package/network/config/firewall/Makefile +++ b/package/network/config/firewall/Makefile @@ -9,13 +9,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=firewall -PKG_RELEASE:=3 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firewall3.git -PKG_SOURCE_DATE:=2022-02-17 -PKG_SOURCE_VERSION:=4cd7d4f36bea731bf901cb067456f1d460294926 -PKG_MIRROR_HASH:=d48a1937328b4a46b4771839d7f281a0e95e024169caa02253fc216a0907d0b9 +PKG_SOURCE_DATE:=2024-10-18 +PKG_SOURCE_VERSION:=1aef9791a21e3d15d4357060f09a7bb9ed3d6e4e +PKG_MIRROR_HASH:=61a4f03a34edf5bf25c13b7ae04e4be40ecbaebff77b9f2d1e730dcaa2c77143 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC diff --git a/package/network/config/firewall/files/firewall.config b/package/network/config/firewall/files/firewall.config index d7e01757a28..231ee7116d6 100644 --- a/package/network/config/firewall/files/firewall.config +++ b/package/network/config/firewall/files/firewall.config @@ -3,6 +3,7 @@ config defaults option input REJECT option output ACCEPT option forward REJECT + option flow_offloading 1 option fullcone 1 # Uncomment this line to disable ipv6 rules # option disable_ipv6 1 diff --git a/package/network/config/firewall4/patches/001-firewall4-Add-fullcone-support.patch b/package/network/config/firewall4/patches/001-firewall4-Add-fullcone-support.patch index 7c46a78d889..3ed2caef003 100644 --- a/package/network/config/firewall4/patches/001-firewall4-Add-fullcone-support.patch +++ b/package/network/config/firewall4/patches/001-firewall4-Add-fullcone-support.patch @@ -26,7 +26,7 @@ Renew: ZiMing Mo option forward REJECT # Uncomment this line to disable ipv6 rules # option disable_ipv6 1 -+ option flow_offloading 0 ++ option flow_offloading 1 + option fullcone 1 + option fullcone6 0 diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index 649b7ccd85b..771d7dadafd 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2024-09-21 -PKG_SOURCE_VERSION:=24f9a93a9559c93cf1e794fdfcd87a38d27a8e0e -PKG_MIRROR_HASH:=a3baa049b86f65cf9709d57bb5a9ea7a5b7405f63c77e2bd641fe9b59865838c +PKG_SOURCE_DATE:=2024-10-06 +PKG_SOURCE_VERSION:=3c6265fdbd02ebd35fa3e7a58d6dfeed081a09d7 +PKG_MIRROR_HASH:=00b01243b99995dc52a047e5663cf5c7732f8defd6b726f73ac15e142b02b4fa PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 diff --git a/package/network/services/hostapd/files/hostapd.uc b/package/network/services/hostapd/files/hostapd.uc index 6774fbf3ba8..6bcb32131d9 100644 --- a/package/network/services/hostapd/files/hostapd.uc +++ b/package/network/services/hostapd/files/hostapd.uc @@ -22,6 +22,14 @@ hostapd.data.file_fields = { eap_sim_db: true, }; +hostapd.data.iface_fields = { + ft_iface: true, + upnp_iface: true, + snoop_iface: true, + bridge: true, + iapp_interface: true, +}; + function iface_remove(cfg) { if (!cfg || !cfg.bss || !cfg.bss[0] || !cfg.bss[0].ifname) @@ -324,9 +332,24 @@ function bss_remove_file_fields(config) return new_cfg; } +function bss_ifindex_list(config) +{ + config = filter(config, (line) => !!hostapd.data.iface_fields[split(line, "=")[0]]); + + return join(",", map(config, (line) => { + try { + let file = "/sys/class/net/" + split(line, "=")[1] + "/ifindex"; + let val = trim(readfile(file)); + return val; + } catch (e) { + return ""; + } + })); +} + function bss_config_hash(config) { - return hostapd.sha1(remove_file_fields(config) + ""); + return hostapd.sha1(remove_file_fields(config) + bss_ifindex_list(config)); } function bss_find_existing(config, prev_config, prev_hash) diff --git a/package/network/services/hostapd/patches/900-hostapd-update-muedca-params.patch b/package/network/services/hostapd/patches/900-hostapd-update-muedca-params.patch index 684122d5be1..097b155305f 100644 --- a/package/network/services/hostapd/patches/900-hostapd-update-muedca-params.patch +++ b/package/network/services/hostapd/patches/900-hostapd-update-muedca-params.patch @@ -82,7 +82,7 @@ case EVENT_MLD_INTERFACE_FREED: --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c -@@ -4511,6 +4511,10 @@ static int hostapd_fill_csa_settings(str +@@ -4509,6 +4509,10 @@ static int hostapd_fill_csa_settings(str hapd->cs_count = settings->cs_count; hapd->cs_block_tx = settings->block_tx; diff --git a/package/network/services/ppp/Makefile b/package/network/services/ppp/Makefile index 6d5db5c7040..5f1ebd4e7d1 100644 --- a/package/network/services/ppp/Makefile +++ b/package/network/services/ppp/Makefile @@ -9,28 +9,38 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=ppp -PKG_RELEASE:=6 +PKG_VERSION:=2.5.1 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/paulusmack/ppp -PKG_SOURCE_DATE:=2021-01-04 -PKG_SOURCE_VERSION:=4fb319056f168bb8379865b91b4fd3e1ada73f1e -PKG_MIRROR_HASH:=58b415e17bdcac81bb9594a1b2ba65ec90598817850d22e98c1690e8ed0cd3d8 +PKG_SOURCE_URL:=https://github.com/ppp-project/ppp +PKG_SOURCE_DATE:=2024-09-18 +PKG_SOURCE_VERSION:=d5aeec65752d4a9b3bb46771d0b221c4a4a6539e +PKG_MIRROR_HASH:=b98125933d8160ff3476b053414e787e65a94948c0ecee53f6261cd403ff4b03 + PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-4-Clause PKG_CPE_ID:=cpe:/a:samba:ppp -PKG_RELEASE_VERSION:=2.4.9 -PKG_VERSION:=$(PKG_RELEASE_VERSION)_git$(subst -,,$(PKG_SOURCE_DATE)) - -PKG_BUILD_DEPENDS:=libpcap - PKG_ASLR_PIE_REGULAR:=1 +PKG_BUILD_DEPENDS:=libpcap PKG_BUILD_FLAGS:=gc-sections lto PKG_BUILD_PARALLEL:=1 +PKG_FIXUP:=autoreconf PKG_INSTALL:=1 include $(INCLUDE_DIR)/package.mk +CONFIGURE_VARS += \ + enable_eaptls=no \ + enable_microsoft_extensions=yes \ + enable_peap=no + +CONFIGURE_ARGS += \ + with_openssl=no \ + with_pam=no \ + with_pcap=no \ + with_srp=no \ + with_static_pcap=yes define Package/ppp/Default SECTION:=net @@ -174,51 +184,23 @@ This tool performs the same discovery process as pppoe, but does not initiate a session. Can be useful to debug pppoe. endef - -define Build/Configure -$(call Build/Configure/Default,, \ - UNAME_S="Linux" \ - UNAME_R="$(LINUX_VERSION)" \ - UNAME_M="$(ARCH)" \ -) - mkdir -p $(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux - $(CP) \ - $(LINUX_DIR)/include/linux/compiler.h \ - $(LINUX_DIR)/include/$(LINUX_UAPI_DIR)linux/atm*.h \ - $(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux/ - - # Kernel 4.14.9+ only, ignore the exit status of cp in case the file - # doesn't exits - -$(CP) $(LINUX_DIR)/include/linux/compiler_types.h \ - $(PKG_BUILD_DIR)/pppd/plugins/pppoatm/linux/ -endef - -MAKE_FLAGS += COPTS="$(TARGET_CFLAGS)" \ - PRECOMPILED_FILTER=1 \ - STAGING_DIR="$(STAGING_DIR)" - ifeq ($(BUILD_VARIANT),multilink) - MAKE_FLAGS += HAVE_MULTILINK=y -else - MAKE_FLAGS += HAVE_MULTILINK= -endif - -ifdef CONFIG_USE_MUSL - MAKE_FLAGS += USE_LIBUTIL= + CONFIGURE_VARS += \ + enable_multilink=yes endif define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include - $(CP) $(PKG_INSTALL_DIR)/include/pppd $(1)/usr/include/ + $(CP) $(PKG_INSTALL_DIR)/usr/include/pppd $(1)/usr/include/ endef define Package/ppp/script_install endef define Package/ppp/install - $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION) + $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION) $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/pppd $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/pppd $(1)/usr/sbin/ $(INSTALL_DIR) $(1)/etc/ppp $(INSTALL_CONF) ./files/etc/ppp/chap-secrets $(1)/etc/ppp/ $(INSTALL_DATA) ./files/etc/ppp/filter $(1)/etc/ppp/ @@ -233,21 +215,21 @@ endef Package/ppp-multilink/install=$(Package/ppp/install) define Package/ppp-mod-pppoa/install - $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION) - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/pppoatm.so \ - $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/ + $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/pppoatm.so \ + $(1)/usr/lib/pppd/$(PKG_VERSION)/ endef define Package/ppp-mod-pppoe/install - $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION) - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/pppoe.so \ - $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/ + $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/pppoe.so \ + $(1)/usr/lib/pppd/$(PKG_VERSION)/ endef define Package/ppp-mod-radius/install - $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION) - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/radius.so \ - $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/ + $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/radius.so \ + $(1)/usr/lib/pppd/$(PKG_VERSION)/ $(INSTALL_DIR) $(1)/etc/ppp $(INSTALL_DATA) ./files/etc/ppp/radius.conf $(1)/etc/ppp/ $(INSTALL_DIR) $(1)/etc/ppp/radius @@ -258,43 +240,43 @@ define Package/ppp-mod-radius/install endef define Package/ppp-mod-pppol2tp/install - $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION) - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/pppol2tp.so \ - $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/ + $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/pppol2tp.so \ + $(1)/usr/lib/pppd/$(PKG_VERSION)/ endef define Package/ppp-mod-pptp/install - $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION) - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/pptp.so \ - $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/ + $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/pptp.so \ + $(1)/usr/lib/pppd/$(PKG_VERSION)/ $(INSTALL_DIR) $(1)/etc/ppp $(INSTALL_DATA) ./files/etc/ppp/options.pptp $(1)/etc/ppp/ endef define Package/ppp-mod-passwordfd/install - $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION) - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/lib/pppd/$(PKG_RELEASE_VERSION)/passwordfd.so \ - $(1)/usr/lib/pppd/$(PKG_RELEASE_VERSION)/ + $(INSTALL_DIR) $(1)/usr/lib/pppd/$(PKG_VERSION) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/pppd/$(PKG_VERSION)/passwordfd.so \ + $(1)/usr/lib/pppd/$(PKG_VERSION)/ endef define Package/chat/install $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/chat $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/chat $(1)/usr/sbin/ endef define Package/pppdump/install $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/pppdump $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/pppdump $(1)/usr/sbin/ endef define Package/pppstats/install $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/pppstats $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/pppstats $(1)/usr/sbin/ endef define Package/pppoe-discovery/install $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/pppoe-discovery $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/pppoe-discovery $(1)/usr/sbin/ endef $(eval $(call BuildPackage,ppp)) diff --git a/package/network/services/ppp/patches/010-use_target_for_configure.patch b/package/network/services/ppp/patches/010-use_target_for_configure.patch deleted file mode 100644 index 9e8618f83ce..00000000000 --- a/package/network/services/ppp/patches/010-use_target_for_configure.patch +++ /dev/null @@ -1,24 +0,0 @@ -configure: Allow overriding uname results - -In a cross compile setting it makes no sense to rely on the "uname" values -reported by the build host system. This patch allows overriding the -"uname -r", "uname -s" and "uname -m" results with the "UNAME_R", "UNAME_S" -and "UNAME_M" environment variables. - -Signed-off-by: Jo-Philipp Wich - ---- a/configure -+++ b/configure -@@ -10,9 +10,9 @@ CROSS_COMPILE= - CC=cc - CFLAGS= - --system=`uname -s` --release=`uname -r` --arch=`uname -m` -+system=${UNAME_S:-`uname -s`} -+release=${UNAME_R:-`uname -r`} -+arch=${UNAME_M:-`uname -m`} - state="unknown" - - case $system in diff --git a/package/network/services/ppp/patches/101-pppd-crypto-fix-build-without-openssl.patch b/package/network/services/ppp/patches/101-pppd-crypto-fix-build-without-openssl.patch new file mode 100644 index 00000000000..eb243694ec7 --- /dev/null +++ b/package/network/services/ppp/patches/101-pppd-crypto-fix-build-without-openssl.patch @@ -0,0 +1,45 @@ +From: Shiji Yang +Date: Fri, 4 Oct 2024 12:19:42 +0000 +Subject: [PATCH] pppd/crypto: fix build without openssl + +Compile openssl relevant code only when PPP_WITH_OPENSSL is defined. + +Signed-off-by: Shiji Yang +--- + pppd/crypto.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/pppd/crypto.c ++++ b/pppd/crypto.c +@@ -199,6 +199,7 @@ int PPP_crypto_init() + { + int retval = 0; + ++#ifdef PPP_WITH_OPENSSL + #if OPENSSL_VERSION_NUMBER >= 0x30000000L + g_crypto_ctx.legacy = OSSL_PROVIDER_load(NULL, "legacy"); + if (g_crypto_ctx.legacy == NULL) +@@ -214,6 +215,7 @@ int PPP_crypto_init() + goto done; + } + #endif ++#endif + + retval = 1; + +@@ -224,6 +226,7 @@ done: + + int PPP_crypto_deinit() + { ++#ifdef PPP_WITH_OPENSSL + #if OPENSSL_VERSION_NUMBER >= 0x30000000L + if (g_crypto_ctx.legacy) { + OSSL_PROVIDER_unload(g_crypto_ctx.legacy); +@@ -239,6 +242,7 @@ int PPP_crypto_deinit() + #if OPENSSL_VERSION_NUMBER < 0x10100000L + ERR_free_strings(); + #endif ++#endif + return 1; + } + diff --git a/package/network/services/ppp/patches/102-pppd-make-pid-directory-before-create-the-pid-file.patch b/package/network/services/ppp/patches/102-pppd-make-pid-directory-before-create-the-pid-file.patch new file mode 100644 index 00000000000..69e68cdff40 --- /dev/null +++ b/package/network/services/ppp/patches/102-pppd-make-pid-directory-before-create-the-pid-file.patch @@ -0,0 +1,27 @@ +From: Shiji Yang +Date: Fri, 4 Oct 2024 14:02:14 +0000 +Subject: [PATCH] pppd: make pid directory before create the pid file + +If multilink feature is not enabled, the '/var/run/pppd' directory +won't be created before adding pid file. + +Fixes error message: +'Failed to create pid file /var/run/pppd/pppoe-wan.pid: No such file or directory' + +Signed-off-by: Shiji Yang +--- + pppd/main.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/pppd/main.c ++++ b/pppd/main.c +@@ -921,6 +921,9 @@ create_pidfile(int pid) + { + FILE *pidfile; + ++#ifndef PPP_WITH_TDB ++ mkdir_recursive(PPP_PATH_VARRUN); ++#endif + slprintf(pidfilename, sizeof(pidfilename), "%s/%s.pid", + PPP_PATH_VARRUN, ifname); + if ((pidfile = fopen(pidfilename, "w")) != NULL) { diff --git a/package/network/services/ppp/patches/103-pppd-crypto-fix-gcc-14-build.patch b/package/network/services/ppp/patches/103-pppd-crypto-fix-gcc-14-build.patch new file mode 100644 index 00000000000..3a76deb0427 --- /dev/null +++ b/package/network/services/ppp/patches/103-pppd-crypto-fix-gcc-14-build.patch @@ -0,0 +1,42 @@ +From: Tan Zien +Date: Tue, 1 Oct 2024 10:38:45 +0800 +Subject: [PATCH] pppd/crypto: fix gcc 14 build + +fix this: + +crypto.c: In function 'PPP_crypto_error': +crypto.c:178:11: error: implicit declaration of function 'vsnprintf' [-Wimplicit-function-declaration] + 178 | off = vsnprintf(buf, len, fmt, args); + | ^~~~~~~~~ +crypto.c:41:1: note: include '' or provide a declaration of 'vsnprintf' + 40 | #include "crypto-priv.h" + +++ |+#include + 41 | +crypto.c:178:26: warning: 'vsnprintf' argument 2 type is 'int' where 'long unsigned int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch] + 178 | off = vsnprintf(buf, len, fmt, args); + | ^~~ +: note: built-in 'vsnprintf' declared here + +Signed-off-by: Tan Zien +--- + pppd/crypto.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/pppd/crypto.c ++++ b/pppd/crypto.c +@@ -34,6 +34,7 @@ + + #include + #include ++#include + + #include "pppd.h" + #include "crypto.h" +@@ -247,7 +248,6 @@ int PPP_crypto_deinit() + } + + #ifdef UNIT_TEST +-#include + + int debug; + int error_count; diff --git a/package/network/services/ppp/patches/105-debian_demand.patch b/package/network/services/ppp/patches/105-debian_demand.patch index ff66aa8ea5a..10ce13b2535 100644 --- a/package/network/services/ppp/patches/105-debian_demand.patch +++ b/package/network/services/ppp/patches/105-debian_demand.patch @@ -1,6 +1,6 @@ --- a/pppd/demand.c +++ b/pppd/demand.c -@@ -36,6 +36,8 @@ +@@ -40,6 +40,8 @@ #include #include #include @@ -9,16 +9,16 @@ #include #include #include -@@ -43,6 +45,8 @@ +@@ -47,6 +49,8 @@ #include #include #include +#include +#include - #ifdef PPP_FILTER + #ifdef PPP_WITH_FILTER #include #endif -@@ -218,6 +222,14 @@ loop_chars(unsigned char *p, int n) +@@ -223,6 +227,14 @@ loop_chars(unsigned char *p, int n) int c, rv; rv = 0; @@ -33,7 +33,7 @@ for (; n > 0; --n) { c = *p++; if (c == PPP_FLAG) { -@@ -294,16 +306,100 @@ loop_frame(unsigned char *frame, int len +@@ -299,16 +311,100 @@ loop_frame(unsigned char *frame, int len * loopback, now that the real serial link is up. */ void @@ -137,7 +137,7 @@ } else { --- a/pppd/ipcp.c +++ b/pppd/ipcp.c -@@ -1850,7 +1850,7 @@ ipcp_up(fsm *f) +@@ -1915,7 +1915,7 @@ ipcp_up(fsm *f) proxy_arp_set[f->unit] = 1; } @@ -148,7 +148,7 @@ } else { --- a/pppd/ipv6cp.c +++ b/pppd/ipv6cp.c -@@ -1253,7 +1253,7 @@ ipv6cp_up(fsm *f) +@@ -1338,7 +1338,7 @@ ipv6cp_up(fsm *f) if (sif6defaultroute(f->unit, go->ourid, ho->hisid)) default_route_set[f->unit] = 1; } @@ -157,14 +157,14 @@ sifnpmode(f->unit, PPP_IPV6, NPMODE_PASS); } else { ---- a/pppd/pppd.h -+++ b/pppd/pppd.h -@@ -598,7 +598,7 @@ void demand_conf(void); /* config interf +--- a/pppd/pppd-private.h ++++ b/pppd/pppd-private.h +@@ -368,7 +368,7 @@ void demand_conf(void); /* config interf void demand_block(void); /* set all NPs to queue up packets */ void demand_unblock(void); /* set all NPs to pass packets */ void demand_discard(void); /* set all NPs to discard packets */ -void demand_rexmit(int); /* retransmit saved frames for an NP */ -+void demand_rexmit(int, u_int32_t); /* retransmit saved frames for an NP*/ ++void demand_rexmit(int, u_int32_t); /* retransmit saved frames for an NP */ int loop_chars(unsigned char *, int); /* process chars from loopback */ int loop_frame(unsigned char *, int); /* should we bring link up? */ diff --git a/package/network/services/ppp/patches/120-debian_ipv6_updown_option.patch b/package/network/services/ppp/patches/120-debian_ipv6_updown_option.patch deleted file mode 100644 index 11e8d81f431..00000000000 --- a/package/network/services/ppp/patches/120-debian_ipv6_updown_option.patch +++ /dev/null @@ -1,95 +0,0 @@ -pppd: Allow specifying ipv6-up and ipv6-down scripts - -This patch implements the "ipv6-up-script" and "ipv6-down-script" options -which allow to specify the path of the ipv6-up and ipv6-down scripts to call. - -These options default to _PATH_IPV6UP and _PATH_IPV6DOWN to retain the -existing behaviour. - -The patch originated from the Debian project. - -Signed-off-by: Jo-Philipp Wich - ---- a/pppd/main.c -+++ b/pppd/main.c -@@ -295,6 +295,8 @@ main(int argc, char *argv[]) - - strlcpy(path_ipup, _PATH_IPUP, sizeof(path_ipup)); - strlcpy(path_ipdown, _PATH_IPDOWN, sizeof(path_ipdown)); -+ strlcpy(path_ipv6up, _PATH_IPV6UP, sizeof(path_ipv6up)); -+ strlcpy(path_ipv6down, _PATH_IPV6DOWN, sizeof(path_ipv6down)); - - link_stats_valid = 0; - new_phase(PHASE_INITIALIZE); ---- a/pppd/options.c -+++ b/pppd/options.c -@@ -118,6 +118,8 @@ int req_unit = -1; /* requested interfa - char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */ - char path_ipdown[MAXPATHLEN];/* pathname of ip-down script */ - char req_ifname[MAXIFNAMELEN]; /* requested interface name */ -+char path_ipv6up[MAXPATHLEN]; /* pathname of ipv6-up script */ -+char path_ipv6down[MAXPATHLEN];/* pathname of ipv6-down script */ - bool multilink = 0; /* Enable multilink operation */ - char *bundle_name = NULL; /* bundle name for multilink */ - bool dump_options; /* print out option values */ -@@ -324,6 +326,13 @@ option_t general_options[] = { - "Set pathname of ip-down script", - OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN }, - -+ { "ipv6-up-script", o_string, path_ipv6up, -+ "Set pathname of ipv6-up script", -+ OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN }, -+ { "ipv6-down-script", o_string, path_ipv6down, -+ "Set pathname of ipv6-down script", -+ OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN }, -+ - #ifdef HAVE_MULTILINK - { "multilink", o_bool, &multilink, - "Enable multilink operation", OPT_PRIO | 1 }, ---- a/pppd/ipv6cp.c -+++ b/pppd/ipv6cp.c -@@ -1295,7 +1295,7 @@ ipv6cp_up(fsm *f) - */ - if (ipv6cp_script_state == s_down && ipv6cp_script_pid == 0) { - ipv6cp_script_state = s_up; -- ipv6cp_script(_PATH_IPV6UP); -+ ipv6cp_script(path_ipv6up); - } - } - -@@ -1346,7 +1346,7 @@ ipv6cp_down(fsm *f) - /* Execute the ipv6-down script */ - if (ipv6cp_script_state == s_up && ipv6cp_script_pid == 0) { - ipv6cp_script_state = s_down; -- ipv6cp_script(_PATH_IPV6DOWN); -+ ipv6cp_script(path_ipv6down); - } - } - -@@ -1384,13 +1384,13 @@ ipv6cp_script_done(void *arg) - case s_up: - if (ipv6cp_fsm[0].state != OPENED) { - ipv6cp_script_state = s_down; -- ipv6cp_script(_PATH_IPV6DOWN); -+ ipv6cp_script(path_ipv6down); - } - break; - case s_down: - if (ipv6cp_fsm[0].state == OPENED) { - ipv6cp_script_state = s_up; -- ipv6cp_script(_PATH_IPV6UP); -+ ipv6cp_script(path_ipv6up); - } - break; - } ---- a/pppd/pppd.h -+++ b/pppd/pppd.h -@@ -328,6 +328,8 @@ extern int req_unit; /* interface unit n - extern char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */ - extern char path_ipdown[MAXPATHLEN]; /* pathname of ip-down script */ - extern char req_ifname[MAXIFNAMELEN]; /* interface name to use */ -+extern char path_ipv6up[MAXPATHLEN]; /* pathname of ipv6-up script */ -+extern char path_ipv6down[MAXPATHLEN]; /* pathname of ipv6-down script */ - extern bool multilink; /* enable multilink operation */ - extern bool noendpoint; /* don't send or accept endpt. discrim. */ - extern char *bundle_name; /* bundle name for multilink */ diff --git a/package/network/services/ppp/patches/133-fix_sha1_include.patch b/package/network/services/ppp/patches/133-fix_sha1_include.patch deleted file mode 100644 index 357d9514418..00000000000 --- a/package/network/services/ppp/patches/133-fix_sha1_include.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/pppd/sha1.c -+++ b/pppd/sha1.c -@@ -19,7 +19,7 @@ - #include - #include - #include /* htonl() */ --#include -+#include "pppd.h" - #include "sha1.h" - - static void diff --git a/package/network/services/ppp/patches/140-pppd-Fix-compilation-with-older-glibc-or-kernel-head.patch b/package/network/services/ppp/patches/140-pppd-Fix-compilation-with-older-glibc-or-kernel-head.patch deleted file mode 100644 index 154ac7270bf..00000000000 --- a/package/network/services/ppp/patches/140-pppd-Fix-compilation-with-older-glibc-or-kernel-head.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 98ec18f098e5ef68e3a8cc6954fcaf5a7fb8b7be Mon Sep 17 00:00:00 2001 -From: pali <7141871+pali@users.noreply.github.com> -Date: Mon, 15 Feb 2021 07:54:01 +0100 -Subject: [PATCH] pppd: Fix compilation with older glibc or kernel headers - (#248) -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -glibc versions prior to 2.24 do not define SOL_NETLINK and linux kernel -versions prior to 4.3 do not define NETLINK_CAP_ACK. So add fallback -definitions for these macros into pppd/sys-linux.c file. - -Also extend description why we call SOL_NETLINK/NETLINK_CAP_ACK option. - -Signed-off-by: Pali Rohár ---- - pppd/sys-linux.c | 18 +++++++++++++++++- - 1 file changed, 17 insertions(+), 1 deletion(-) - ---- a/pppd/sys-linux.c -+++ b/pppd/sys-linux.c -@@ -125,6 +125,14 @@ - #include - #include - #include -+/* glibc versions prior to 2.24 do not define SOL_NETLINK */ -+#ifndef SOL_NETLINK -+#define SOL_NETLINK 270 -+#endif -+/* linux kernel versions prior to 4.3 do not define/support NETLINK_CAP_ACK */ -+#ifndef NETLINK_CAP_ACK -+#define NETLINK_CAP_ACK 10 -+#endif - #endif - - #include "pppd.h" -@@ -2843,7 +2851,15 @@ static int append_peer_ipv6_address(unsi - if (fd < 0) - return 0; - -- /* do not ask for error message content */ -+ /* -+ * Tell kernel to not send to us payload of acknowledgment error message. -+ * NETLINK_CAP_ACK option is supported since Linux kernel version 4.3 and -+ * older kernel versions always send full payload in acknowledgment netlink -+ * message. We ignore payload of this message as we need only error code, -+ * to check if our set remote peer address request succeeded or failed. -+ * So ignore return value from the following setsockopt() call as setting -+ * option NETLINK_CAP_ACK means for us just a kernel hint / optimization. -+ */ - one = 1; - setsockopt(fd, SOL_NETLINK, NETLINK_CAP_ACK, &one, sizeof(one)); - diff --git a/package/network/services/ppp/patches/141-Expand-byte-count-statistics-to-64-bits-298.patch b/package/network/services/ppp/patches/141-Expand-byte-count-statistics-to-64-bits-298.patch deleted file mode 100644 index e4de5c0aa21..00000000000 --- a/package/network/services/ppp/patches/141-Expand-byte-count-statistics-to-64-bits-298.patch +++ /dev/null @@ -1,518 +0,0 @@ -From 81ad945630120cc1c27c8bb00503be42b76ff202 Mon Sep 17 00:00:00 2001 -From: Jaco Kroon -Date: Thu, 13 Jan 2022 08:38:04 +0200 -Subject: [PATCH] Expand byte count statistics to 64 bits (#298) - -* Add Gigawords to radius packets where applicable. - -IMPORTANT NOTE: The ioctl() only supports 32-bit counters. In order t -obtain 64-bit counters, these are now pulled in from sysfs (it's assumed -to be mounted on /sys which I'm assuming is standard). - -It is unknown whether sysfs will be available everywhere, as such, keep -the ioctl() method in place, but attempt to detect wrap-overs. - -If the sysfs mechanism fails, fail back to the ioctl(). - -Given maximum data rates, the intervals between calling this needs to be -such that no more than 4GB (2^32) bytes are sent or received in any -given interval. Mostly important for radius plugin where data -accounting may be in effect. - -Towards this, a timer interval on 25 seconds is set to force a ioctl() -poll irrespective of the rate of stats update calls. This may be -important for especially radius that needs to provide interim-update -intervals, if the interim updates is too long and the counters could -wrap-over twice in a single interval. At 25 seconds we should detect -all wraps up to an effective data rate of 1.37Gbps, which for my -purposes is adequate. - -Possible downsides, 4 files are opened, read and closed every time -statistics is requested. This results in 12 system calls every single -time statistics is required, compared to 1 for the ioctl. Efficiency is -unknown, but as a rule of thumb fewer system calls are better, this is -however not a critical path in my opinion, so should not be a problem. -If required I can run a few benchmarks using gettimeofday() to measure -actual impact. - -Signed-off-by: Jaco Kroon - -* Use netlink if possible to obtain 64-bit stats. - -This uses two system calls per round. - -This should be preferred where available. It seems the RTM_GETSTATS was -only added from 2016 some point (4.7.0 as per pali), which is in my -opinion old, but given experience with certain embedded systems does -need to be supported. - -Signed-off-by: Jaco Kroon - -Co-authored-by: Jaco Kroon ---- - pppd/main.c | 5 +- - pppd/plugins/radius/etc/dictionary | 2 + - pppd/plugins/radius/radius.c | 28 ++- - pppd/plugins/radius/radiusclient.h | 2 + - pppd/pppd.h | 9 +- - pppd/sys-linux.c | 281 ++++++++++++++++++++++++++++- - 6 files changed, 313 insertions(+), 14 deletions(-) - ---- a/pppd/main.c -+++ b/pppd/main.c -@@ -87,6 +87,7 @@ - #include - #include - #include -+#include - - #include "pppd.h" - #include "magic.h" -@@ -1230,9 +1231,9 @@ update_link_stats(int u) - - slprintf(numbuf, sizeof(numbuf), "%u", link_connect_time); - script_setenv("CONNECT_TIME", numbuf, 0); -- slprintf(numbuf, sizeof(numbuf), "%u", link_stats.bytes_out); -+ snprintf(numbuf, sizeof(numbuf), "%" PRIu64, link_stats.bytes_out); - script_setenv("BYTES_SENT", numbuf, 0); -- slprintf(numbuf, sizeof(numbuf), "%u", link_stats.bytes_in); -+ snprintf(numbuf, sizeof(numbuf), "%" PRIu64, link_stats.bytes_in); - script_setenv("BYTES_RCVD", numbuf, 0); - } - ---- a/pppd/plugins/radius/etc/dictionary -+++ b/pppd/plugins/radius/etc/dictionary -@@ -82,6 +82,8 @@ ATTRIBUTE Acct-Session-Time 46 integer - ATTRIBUTE Acct-Input-Packets 47 integer - ATTRIBUTE Acct-Output-Packets 48 integer - ATTRIBUTE Acct-Terminate-Cause 49 integer -+ATTRIBUTE Acct-Input-Gigawords 52 integer -+ATTRIBUTE Acct-Output-Gigawords 53 integer - ATTRIBUTE Chap-Challenge 60 string - ATTRIBUTE NAS-Port-Type 61 integer - ATTRIBUTE Port-Limit 62 integer ---- a/pppd/plugins/radius/radius.c -+++ b/pppd/plugins/radius/radius.c -@@ -1020,12 +1020,22 @@ radius_acct_stop(void) - av_type = link_connect_time; - rc_avpair_add(&send, PW_ACCT_SESSION_TIME, &av_type, 0, VENDOR_NONE); - -- av_type = link_stats.bytes_out; -+ av_type = link_stats.bytes_out & 0xFFFFFFFF; - rc_avpair_add(&send, PW_ACCT_OUTPUT_OCTETS, &av_type, 0, VENDOR_NONE); - -- av_type = link_stats.bytes_in; -+ if (link_stats.bytes_out > 0xFFFFFFFF) { -+ av_type = link_stats.bytes_out >> 32; -+ rc_avpair_add(&send, PW_ACCT_OUTPUT_GIGAWORDS, &av_type, 0, VENDOR_NONE); -+ } -+ -+ av_type = link_stats.bytes_in & 0xFFFFFFFF; - rc_avpair_add(&send, PW_ACCT_INPUT_OCTETS, &av_type, 0, VENDOR_NONE); - -+ if (link_stats.bytes_in > 0xFFFFFFFF) { -+ av_type = link_stats.bytes_in >> 32; -+ rc_avpair_add(&send, PW_ACCT_INPUT_GIGAWORDS, &av_type, 0, VENDOR_NONE); -+ } -+ - av_type = link_stats.pkts_out; - rc_avpair_add(&send, PW_ACCT_OUTPUT_PACKETS, &av_type, 0, VENDOR_NONE); - -@@ -1172,12 +1182,22 @@ radius_acct_interim(void *ignored) - av_type = link_connect_time; - rc_avpair_add(&send, PW_ACCT_SESSION_TIME, &av_type, 0, VENDOR_NONE); - -- av_type = link_stats.bytes_out; -+ av_type = link_stats.bytes_out & 0xFFFFFFFF; - rc_avpair_add(&send, PW_ACCT_OUTPUT_OCTETS, &av_type, 0, VENDOR_NONE); - -- av_type = link_stats.bytes_in; -+ if (link_stats.bytes_out > 0xFFFFFFFF) { -+ av_type = link_stats.bytes_out >> 32; -+ rc_avpair_add(&send, PW_ACCT_OUTPUT_GIGAWORDS, &av_type, 0, VENDOR_NONE); -+ } -+ -+ av_type = link_stats.bytes_in & 0xFFFFFFFF; - rc_avpair_add(&send, PW_ACCT_INPUT_OCTETS, &av_type, 0, VENDOR_NONE); - -+ if (link_stats.bytes_in > 0xFFFFFFFF) { -+ av_type = link_stats.bytes_in >> 32; -+ rc_avpair_add(&send, PW_ACCT_INPUT_GIGAWORDS, &av_type, 0, VENDOR_NONE); -+ } -+ - av_type = link_stats.pkts_out; - rc_avpair_add(&send, PW_ACCT_OUTPUT_PACKETS, &av_type, 0, VENDOR_NONE); - ---- a/pppd/plugins/radius/radiusclient.h -+++ b/pppd/plugins/radius/radiusclient.h -@@ -184,6 +184,8 @@ typedef struct pw_auth_hdr - #define PW_ACCT_LINK_COUNT 51 /* integer */ - - /* From RFC 2869 */ -+#define PW_ACCT_INPUT_GIGAWORDS 52 /* integer */ -+#define PW_ACCT_OUTPUT_GIGAWORDS 53 /* integer */ - #define PW_ACCT_INTERIM_INTERVAL 85 /* integer */ - - /* Merit Experimental Extensions */ ---- a/pppd/pppd.h -+++ b/pppd/pppd.h -@@ -53,6 +53,7 @@ - #include /* for encrypt */ - #include /* for setkey */ - #include -+#include - #include /* for NGROUPS_MAX */ - #include /* for MAXPATHLEN and BSD4_4, if defined */ - #include /* for u_int32_t, if defined */ -@@ -173,8 +174,8 @@ struct permitted_ip { - * pppd needs. - */ - struct pppd_stats { -- unsigned int bytes_in; -- unsigned int bytes_out; -+ uint64_t bytes_in; -+ uint64_t bytes_out; - unsigned int pkts_in; - unsigned int pkts_out; - }; -@@ -347,7 +348,7 @@ extern char *max_tls_version; - extern unsigned int maxoctets; /* Maximum octetes per session (in bytes) */ - extern int maxoctets_dir; /* Direction : - 0 - in+out (default) -- 1 - in -+ 1 - in - 2 - out - 3 - max(in,out) */ - extern int maxoctets_timeout; /* Timeout for check of octets limit */ -@@ -356,7 +357,7 @@ extern int maxoctets_timeout; /* - #define PPP_OCTETS_DIRECTION_OUT 2 - #define PPP_OCTETS_DIRECTION_MAXOVERAL 3 - /* same as previos, but little different on RADIUS side */ --#define PPP_OCTETS_DIRECTION_MAXSESSION 4 -+#define PPP_OCTETS_DIRECTION_MAXSESSION 4 - #endif - - #ifdef PPP_FILTER ---- a/pppd/sys-linux.c -+++ b/pppd/sys-linux.c -@@ -79,6 +79,7 @@ - #include - - #include -+#include - #include - #include - #include -@@ -92,6 +93,7 @@ - #include - #include - #include -+#include - - /* This is in netdevice.h. However, this compile will fail miserably if - you attempt to include netdevice.h because it has so many references -@@ -121,9 +123,19 @@ - #include - #include - --#ifdef INET6 - #include - #include -+#include -+/* Attempt at retaining compile-support with older than 4.7 kernels, or kernels -+ * where RTM_NEWSTATS isn't defined for whatever reason. -+ */ -+#ifndef RTM_NEWSTATS -+#define RTM_NEWSTATS 92 -+#define RTM_GETSTATS 94 -+#define IFLA_STATS_LINK_64 1 -+#endif -+ -+#ifdef INET6 - #include - /* glibc versions prior to 2.24 do not define SOL_NETLINK */ - #ifndef SOL_NETLINK -@@ -1407,11 +1419,17 @@ get_idle_time(int u, struct ppp_idle *ip - - /******************************************************************** - * -- * get_ppp_stats - return statistics for the link. -+ * get_ppp_stats_iocl - return statistics for the link, using the ioctl() method, -+ * this only supports 32-bit counters, so need to count the wraps. - */ --int --get_ppp_stats(int u, struct pppd_stats *stats) -+static int -+get_ppp_stats_ioctl(int u, struct pppd_stats *stats) - { -+ static u_int32_t previbytes = 0; -+ static u_int32_t prevobytes = 0; -+ static u_int32_t iwraps = 0; -+ static u_int32_t owraps = 0; -+ - struct ifpppstatsreq req; - - memset (&req, 0, sizeof (req)); -@@ -1426,7 +1444,262 @@ get_ppp_stats(int u, struct pppd_stats * - stats->bytes_out = req.stats.p.ppp_obytes; - stats->pkts_in = req.stats.p.ppp_ipackets; - stats->pkts_out = req.stats.p.ppp_opackets; -+ -+ if (stats->bytes_in < previbytes) -+ ++iwraps; -+ if (stats->bytes_out < prevobytes) -+ ++owraps; -+ -+ previbytes = stats->bytes_in; -+ prevobytes = stats->bytes_out; -+ -+ stats->bytes_in += (uint64_t)iwraps << 32; -+ stats->bytes_out += (uint64_t)owraps << 32; -+ -+ return 1; -+} -+ -+/******************************************************************** -+ * get_ppp_stats_rtnetlink - return statistics for the link, using rtnetlink -+ * This provides native 64-bit counters. -+ */ -+static int -+get_ppp_stats_rtnetlink(int u, struct pppd_stats *stats) -+{ -+ static int rtnl_fd = -1; -+ -+ struct sockaddr_nl nladdr; -+ struct { -+ struct nlmsghdr nlh; -+ struct if_stats_msg ifsm; -+ } nlreq; -+ struct nlresp { -+ struct nlmsghdr nlh; -+ union { -+ struct { -+ struct nlmsgerr nlerr; -+ char __end_err[0]; -+ }; -+ struct { -+ struct rtmsg rth; -+ struct { -+ /* We only case about these first fields from rtnl_link_stats64 */ -+ uint64_t rx_packets; -+ uint64_t tx_packets; -+ uint64_t rx_bytes; -+ uint64_t tx_bytes; -+ } stats; -+ char __end_stats[0]; -+ }; -+ }; -+ } nlresp; -+ ssize_t nlresplen; -+ struct iovec iov; -+ struct msghdr msg; -+ -+ memset(&nladdr, 0, sizeof(nladdr)); -+ nladdr.nl_family = AF_NETLINK; -+ -+ if (rtnl_fd < 0) { -+ rtnl_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); -+ if (rtnl_fd < 0) { -+ error("get_ppp_stats_rtnetlink: error creating NETLINK socket: %m (line %d)", __LINE__); -+ return 0; -+ } -+ -+ if (bind(rtnl_fd, (struct sockaddr *)&nladdr, sizeof(nladdr)) < 0) { -+ error("get_ppp_stats_rtnetlink: bind(AF_NETLINK): %m (line %d)", __LINE__); -+ goto err; -+ } -+ } -+ -+ memset(&nlreq, 0, sizeof(nlreq)); -+ nlreq.nlh.nlmsg_len = sizeof(nlreq); -+ nlreq.nlh.nlmsg_type = RTM_GETSTATS; -+ nlreq.nlh.nlmsg_flags = NLM_F_REQUEST; -+ -+ nlreq.ifsm.ifindex = if_nametoindex(ifname); -+ nlreq.ifsm.filter_mask = IFLA_STATS_LINK_64; -+ -+ memset(&iov, 0, sizeof(iov)); -+ iov.iov_base = &nlreq; -+ iov.iov_len = sizeof(nlreq); -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.msg_name = &nladdr; -+ msg.msg_namelen = sizeof(nladdr); -+ msg.msg_iov = &iov; -+ msg.msg_iovlen = 1; -+ -+ if (sendmsg(rtnl_fd, &msg, 0) < 0) { -+ error("get_ppp_stats_rtnetlink: sendmsg(RTM_GETSTATS): %m (line %d)", __LINE__); -+ goto err; -+ } -+ -+ /* We just need to repoint to IOV ... everything else stays the same */ -+ iov.iov_base = &nlresp; -+ iov.iov_len = sizeof(nlresp); -+ -+ nlresplen = recvmsg(rtnl_fd, &msg, 0); -+ -+ if (nlresplen < 0) { -+ error("get_ppp_stats_rtnetlink: recvmsg(RTM_GETSTATS): %m (line %d)", __LINE__); -+ goto err; -+ } -+ -+ if (nlresplen < sizeof(nlresp.nlh)) { -+ error("get_ppp_stats_rtnetlink: Netlink response message was incomplete (line %d)", __LINE__); -+ goto err; -+ } -+ -+ if (nlresp.nlh.nlmsg_type == NLMSG_ERROR) { -+ if (nlresplen < offsetof(struct nlresp, __end_err)) { -+ if (kernel_version >= KVERSION(4,7,0)) -+ error("get_ppp_stats_rtnetlink: Netlink responded with error: %s (line %d)", strerror(-nlresp.nlerr.error), __LINE__); -+ } else { -+ error("get_ppp_stats_rtnetlink: Netlink responded with an error message, but the nlmsgerr structure is incomplete (line %d).", -+ __LINE__); -+ } -+ goto err; -+ } -+ -+ if (nlresp.nlh.nlmsg_type != RTM_NEWSTATS) { -+ error("get_ppp_stats_rtnetlink: Expected RTM_NEWSTATS response, found something else (mlmsg_type %d, line %d)", -+ nlresp.nlh.nlmsg_type, __LINE__); -+ goto err; -+ } -+ -+ if (nlresplen < offsetof(struct nlresp, __end_stats)) { -+ error("get_ppp_stats_rtnetlink: Obtained an insufficiently sized rtnl_link_stats64 struct from the kernel (line %d).", __LINE__); -+ goto err; -+ } -+ -+ stats->bytes_in = nlresp.stats.rx_bytes; -+ stats->bytes_out = nlresp.stats.tx_bytes; -+ stats->pkts_in = nlresp.stats.rx_packets; -+ stats->pkts_out = nlresp.stats.tx_packets; -+ - return 1; -+err: -+ close(rtnl_fd); -+ rtnl_fd = -1; -+ return 0; -+} -+ -+/******************************************************************** -+ * get_ppp_stats_sysfs - return statistics for the link, using the files in sysfs, -+ * this provides native 64-bit counters. -+ */ -+static int -+get_ppp_stats_sysfs(int u, struct pppd_stats *stats) -+{ -+ char fname[PATH_MAX+1]; -+ char buf[21], *err; /* 2^64 < 10^20 */ -+ int blen, fd, rlen; -+ unsigned long long val; -+ -+ struct { -+ const char* fname; -+ void* ptr; -+ unsigned size; -+ } slist[] = { -+#define statfield(fn, field) { .fname = #fn, .ptr = &stats->field, .size = sizeof(stats->field) } -+ statfield(rx_bytes, bytes_in), -+ statfield(tx_bytes, bytes_out), -+ statfield(rx_packets, pkts_in), -+ statfield(tx_packets, pkts_out), -+#undef statfield -+ }; -+ -+ blen = snprintf(fname, sizeof(fname), "/sys/class/net/%s/statistics/", ifname); -+ if (blen >= sizeof(fname)) -+ return 0; /* ifname max 15, so this should be impossible */ -+ -+ for (int i = 0; i < sizeof(slist) / sizeof(*slist); ++i) { -+ if (snprintf(fname + blen, sizeof(fname) - blen, "%s", slist[i].fname) >= sizeof(fname) - blen) { -+ fname[blen] = 0; -+ error("sysfs stats: filename %s/%s overflowed PATH_MAX", fname, slist[i].fname); -+ return 0; -+ } -+ -+ fd = open(fname, O_RDONLY); -+ if (fd < 0) { -+ error("%s: %m", fname); -+ return 0; -+ } -+ -+ rlen = read(fd, buf, sizeof(buf) - 1); -+ close(fd); -+ if (rlen < 0) { -+ error("%s: %m", fname); -+ return 0; -+ } -+ /* trim trailing \n if present */ -+ while (rlen > 0 && buf[rlen-1] == '\n') -+ rlen--; -+ buf[rlen] = 0; -+ -+ errno = 0; -+ val = strtoull(buf, &err, 10); -+ if (*buf < '0' || *buf > '9' || errno != 0 || *err) { -+ error("string to number conversion error converting %s (from %s) for remaining string %s%s%s", -+ buf, fname, err, errno ? ": " : "", errno ? strerror(errno) : ""); -+ return 0; -+ } -+ switch (slist[i].size) { -+#define stattype(type) case sizeof(type): *(type*)slist[i].ptr = (type)val; break -+ stattype(uint64_t); -+ stattype(uint32_t); -+ stattype(uint16_t); -+ stattype(uint8_t); -+#undef stattype -+ default: -+ error("Don't know how to store stats for %s of size %u", slist[i].fname, slist[i].size); -+ return 0; -+ } -+ } -+ -+ return 1; -+} -+ -+/******************************************************************** -+ * Periodic timer function to be used to keep stats up to date in case of ioctl -+ * polling. -+ * -+ * Given the 25s interval this should be fine up to data rates of 1.37Gbps. -+ * If you do change the timer, remember to also bring the get_ppp_stats (which -+ * sets up the initial trigger) as well. -+ */ -+static void -+ppp_stats_poller(void* u) -+{ -+ struct pppd_stats dummy; -+ get_ppp_stats_ioctl((long)u, &dummy); -+ TIMEOUT(ppp_stats_poller, u, 25); -+} -+ -+/******************************************************************** -+ * get_ppp_stats - return statistics for the link. -+ */ -+int get_ppp_stats(int u, struct pppd_stats *stats) -+{ -+ static int (*func)(int, struct pppd_stats*) = NULL; -+ -+ if (!func) { -+ if (get_ppp_stats_rtnetlink(u, stats)) { -+ func = get_ppp_stats_rtnetlink; -+ return 1; -+ } -+ if (get_ppp_stats_sysfs(u, stats)) { -+ func = get_ppp_stats_sysfs; -+ return 1; -+ } -+ warn("statistics falling back to ioctl which only supports 32-bit counters"); -+ func = get_ppp_stats_ioctl; -+ TIMEOUT(ppp_stats_poller, (void*)(long)u, 25); -+ } -+ -+ return func(u, stats); - } - - /******************************************************************** diff --git a/package/network/services/ppp/patches/142-pppd-Add-support-for-registering-ppp-interface-via-L.patch b/package/network/services/ppp/patches/142-pppd-Add-support-for-registering-ppp-interface-via-L.patch deleted file mode 100644 index 9987d3dce9d..00000000000 --- a/package/network/services/ppp/patches/142-pppd-Add-support-for-registering-ppp-interface-via-L.patch +++ /dev/null @@ -1,299 +0,0 @@ -From 4a54e34cf5629f9fed61f0b7d69ee3ba4d874bc6 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Pali=20Roh=C3=A1r?= -Date: Sat, 9 Jul 2022 13:40:24 +0200 -Subject: [PATCH] pppd: Add support for registering ppp interface via Linux - rtnetlink API -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -pppd currently creates ppp network interface via PPPIOCNEWUNIT ioctl API. -This API creates a new ppp network interface named "ppp". If user -supply option "ifname" with custom network name then pppd calls SIOCSIFNAME -ioctl to rename "ppp" to custom name immediately after successful -PPPIOCNEWUNIT ioctl call. If custom name is already registered then -SIOCSIFNAME ioctl fails and pppd close current channel (which destroy also -network interface). - -This has side effect that in the first few miliseconds interface has -different name as what user supplied. - -Tools like systemd, udev or NetworkManager are trying to query -interface attributes based on interface name immediately when new -network interface is created. - -But if interface is renamed immediately after creation then these tools -fails. For example when running pppd with option "ifname ppp-wan" following -error is reported by systemd / udev into dmesg log: - - [ 35.718732] PPP generic driver version 2.4.2 - [ 35.793914] NET: Registered protocol family 24 - [ 35.889924] systemd-udevd[1852]: link_config: autonegotiation is unset or enabled, the speed and duplex are not writable. - [ 35.901450] ppp-wan: renamed from ppp0 - [ 35.930332] systemd-udevd[1852]: link_config: could not get ethtool features for ppp0 - [ 35.939473] systemd-udevd[1852]: Could not set offload features of ppp0: No such device - -There is an easy way to fix this issue: Use new rtnetlink API. - -Via rtnetlink API it is possible to create ppp network interface with -custom ifname atomically. Just it is not possible to specify custom ppp -unit id. - -So use new rtnetlink API when user requested custom ifname without custom -ppp unit id. This will avoid system issues with interface renaming as ppp -interface is directly registered with specified final name. - -This has also advantage that if requested interface name already exists -then pppd fail during registering of networking interface and not during -renaming network interface which happens after successful registration. - -If user supply custom ppp unit id then it is required to use old ioctl API -as currently it is the only API which allows specifying ppp unit id. - -When user does not specify custom ifname stay also with old ioctl API. -There is currently a bug in kernel which cause that when empty interface is -specified in rtnetlink message for creating ppp interface then kernel -creates ppp interface but with pseudo-random name, not derived from ppp -unit id. And therefore it is not possible to retrieve what is the name of -newly created network interface. So when user does not specify interface -name via "ifname" option (which means that want from kernel to choose some -"free" interface name) it is needed to use old ioctl API which do it -correctly for now. - -Signed-off-by: Pali Rohár ---- - pppd/sys-linux.c | 194 ++++++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 192 insertions(+), 2 deletions(-) - ---- a/pppd/sys-linux.c -+++ b/pppd/sys-linux.c -@@ -126,6 +126,11 @@ - #include - #include - #include -+ -+#ifdef INET6 -+#include -+#endif -+ - /* Attempt at retaining compile-support with older than 4.7 kernels, or kernels - * where RTM_NEWSTATS isn't defined for whatever reason. - */ -@@ -135,16 +140,20 @@ - #define IFLA_STATS_LINK_64 1 - #endif - --#ifdef INET6 --#include - /* glibc versions prior to 2.24 do not define SOL_NETLINK */ - #ifndef SOL_NETLINK - #define SOL_NETLINK 270 - #endif -+ - /* linux kernel versions prior to 4.3 do not define/support NETLINK_CAP_ACK */ - #ifndef NETLINK_CAP_ACK - #define NETLINK_CAP_ACK 10 - #endif -+ -+/* linux kernel versions prior to 4.7 do not define/support IFLA_PPP_DEV_FD */ -+#ifndef IFLA_PPP_MAX -+/* IFLA_PPP_DEV_FD is declared as enum when IFLA_PPP_MAX is defined */ -+#define IFLA_PPP_DEV_FD 1 - #endif - - #include "pppd.h" -@@ -657,6 +666,160 @@ void generic_disestablish_ppp(int dev_fd - } - - /* -+ * make_ppp_unit_rtnetlink - register a new ppp network interface for ppp_dev_fd -+ * with specified req_ifname via rtnetlink. Interface name req_ifname must not -+ * be empty. Custom ppp unit id req_unit is ignored and kernel choose some free. -+ */ -+static int make_ppp_unit_rtnetlink(void) -+{ -+ struct { -+ struct nlmsghdr nlh; -+ struct ifinfomsg ifm; -+ struct { -+ struct rtattr rta; -+ char ifname[IFNAMSIZ]; -+ } ifn; -+ struct { -+ struct rtattr rta; -+ struct { -+ struct rtattr rta; -+ char ifkind[sizeof("ppp")]; -+ } ifik; -+ struct { -+ struct rtattr rta; -+ struct { -+ struct rtattr rta; -+ union { -+ int ppp_dev_fd; -+ } ppp; -+ } ifdata[1]; -+ } ifid; -+ } ifli; -+ } nlreq; -+ struct { -+ struct nlmsghdr nlh; -+ struct nlmsgerr nlerr; -+ } nlresp; -+ struct sockaddr_nl nladdr; -+ struct iovec iov; -+ struct msghdr msg; -+ ssize_t nlresplen; -+ int one; -+ int fd; -+ -+ fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); -+ if (fd < 0) { -+ error("make_ppp_unit_rtnetlink: socket(NETLINK_ROUTE): %m (line %d)", __LINE__); -+ return 0; -+ } -+ -+ /* Tell kernel to not send to us payload of acknowledgment error message. */ -+ one = 1; -+ setsockopt(fd, SOL_NETLINK, NETLINK_CAP_ACK, &one, sizeof(one)); -+ -+ memset(&nladdr, 0, sizeof(nladdr)); -+ nladdr.nl_family = AF_NETLINK; -+ -+ if (bind(fd, (struct sockaddr *)&nladdr, sizeof(nladdr)) < 0) { -+ error("make_ppp_unit_rtnetlink: bind(AF_NETLINK): %m (line %d)", __LINE__); -+ close(fd); -+ return 0; -+ } -+ -+ memset(&nlreq, 0, sizeof(nlreq)); -+ nlreq.nlh.nlmsg_len = sizeof(nlreq); -+ nlreq.nlh.nlmsg_type = RTM_NEWLINK; -+ nlreq.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | NLM_F_EXCL | NLM_F_CREATE; -+ nlreq.ifm.ifi_family = AF_UNSPEC; -+ nlreq.ifm.ifi_type = ARPHRD_NETROM; -+ nlreq.ifn.rta.rta_len = sizeof(nlreq.ifn); -+ nlreq.ifn.rta.rta_type = IFLA_IFNAME; -+ strlcpy(nlreq.ifn.ifname, req_ifname, sizeof(nlreq.ifn.ifname)); -+ nlreq.ifli.rta.rta_len = sizeof(nlreq.ifli); -+ nlreq.ifli.rta.rta_type = IFLA_LINKINFO; -+ nlreq.ifli.ifik.rta.rta_len = sizeof(nlreq.ifli.ifik); -+ nlreq.ifli.ifik.rta.rta_type = IFLA_INFO_KIND; -+ strcpy(nlreq.ifli.ifik.ifkind, "ppp"); -+ nlreq.ifli.ifid.rta.rta_len = sizeof(nlreq.ifli.ifid); -+ nlreq.ifli.ifid.rta.rta_type = IFLA_INFO_DATA; -+ nlreq.ifli.ifid.ifdata[0].rta.rta_len = sizeof(nlreq.ifli.ifid.ifdata[0]); -+ nlreq.ifli.ifid.ifdata[0].rta.rta_type = IFLA_PPP_DEV_FD; -+ nlreq.ifli.ifid.ifdata[0].ppp.ppp_dev_fd = ppp_dev_fd; -+ -+ memset(&nladdr, 0, sizeof(nladdr)); -+ nladdr.nl_family = AF_NETLINK; -+ -+ memset(&iov, 0, sizeof(iov)); -+ iov.iov_base = &nlreq; -+ iov.iov_len = sizeof(nlreq); -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.msg_name = &nladdr; -+ msg.msg_namelen = sizeof(nladdr); -+ msg.msg_iov = &iov; -+ msg.msg_iovlen = 1; -+ -+ if (sendmsg(fd, &msg, 0) < 0) { -+ error("make_ppp_unit_rtnetlink: sendmsg(RTM_NEWLINK/NLM_F_CREATE): %m (line %d)", __LINE__); -+ close(fd); -+ return 0; -+ } -+ -+ memset(&iov, 0, sizeof(iov)); -+ iov.iov_base = &nlresp; -+ iov.iov_len = sizeof(nlresp); -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.msg_name = &nladdr; -+ msg.msg_namelen = sizeof(nladdr); -+ msg.msg_iov = &iov; -+ msg.msg_iovlen = 1; -+ -+ nlresplen = recvmsg(fd, &msg, 0); -+ -+ if (nlresplen < 0) { -+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): %m (line %d)", __LINE__); -+ close(fd); -+ return 0; -+ } -+ -+ close(fd); -+ -+ if (nladdr.nl_family != AF_NETLINK) { -+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Not a netlink packet (line %d)", __LINE__); -+ return 0; -+ } -+ -+ if ((size_t)nlresplen < sizeof(nlresp) || nlresp.nlh.nlmsg_len < sizeof(nlresp)) { -+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Acknowledgment netlink packet too short (line %d)", __LINE__); -+ return 0; -+ } -+ -+ /* acknowledgment packet for NLM_F_ACK is NLMSG_ERROR */ -+ if (nlresp.nlh.nlmsg_type != NLMSG_ERROR) { -+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Not an acknowledgment netlink packet (line %d)", __LINE__); -+ return 0; -+ } -+ -+ /* error == 0 indicates success, negative value is errno code */ -+ if (nlresp.nlerr.error != 0) { -+ /* -+ * Linux kernel versions prior to 4.7 do not support creating ppp -+ * interfaces via rtnetlink API and therefore error response is -+ * expected. On older kernel versions do not show this error message. -+ * When error is different than EEXIST then pppd tries to fallback to -+ * the old ioctl method. -+ */ -+ errno = (nlresp.nlerr.error < 0) ? -nlresp.nlerr.error : EINVAL; -+ if (kernel_version >= KVERSION(4,7,0)) -+ error("Couldn't create ppp interface %s: %m", req_ifname); -+ return 0; -+ } -+ -+ return 1; -+} -+ -+/* - * make_ppp_unit - make a new ppp unit for ppp_dev_fd. - * Assumes new_style_driver. - */ -@@ -676,6 +839,33 @@ static int make_ppp_unit(void) - || fcntl(ppp_dev_fd, F_SETFL, flags | O_NONBLOCK) == -1) - warn("Couldn't set /dev/ppp to nonblock: %m"); - -+ /* -+ * Via rtnetlink it is possible to create ppp network interface with -+ * custom ifname atomically. But it is not possible to specify custom -+ * ppp unit id. -+ * -+ * Tools like systemd, udev or NetworkManager are trying to query -+ * interface attributes based on interface name immediately when new -+ * network interface is created. And therefore immediate interface -+ * renaming is causing issues. -+ * -+ * So use rtnetlink API only when user requested custom ifname. It will -+ * avoid system issues with interface renaming. -+ */ -+ if (req_unit == -1 && req_ifname[0] != '\0' && kernel_version >= KVERSION(2,1,16)) { -+ if (make_ppp_unit_rtnetlink()) { -+ if (ioctl(ppp_dev_fd, PPPIOCGUNIT, &ifunit)) -+ fatal("Couldn't retrieve PPP unit id: %m"); -+ return 0; -+ } -+ /* -+ * If interface with requested name already exist return error -+ * otherwise fallback to old ioctl method. -+ */ -+ if (errno == EEXIST) -+ return -1; -+ } -+ - ifunit = req_unit; - x = ioctl(ppp_dev_fd, PPPIOCNEWUNIT, &ifunit); - if (x < 0 && req_unit >= 0 && errno == EEXIST) { diff --git a/package/network/services/ppp/patches/143-pppd-Workaround-for-generating-ppp-unit-id-on-Linux-.patch b/package/network/services/ppp/patches/143-pppd-Workaround-for-generating-ppp-unit-id-on-Linux-.patch deleted file mode 100644 index abe559e0748..00000000000 --- a/package/network/services/ppp/patches/143-pppd-Workaround-for-generating-ppp-unit-id-on-Linux-.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 44609bfc974bdafc0316d069aabf5e2903efa805 Mon Sep 17 00:00:00 2001 -From: pali <7141871+pali@users.noreply.github.com> -Date: Tue, 9 Aug 2022 11:20:15 +0200 -Subject: [PATCH] pppd: Workaround for generating ppp unit id on Linux (#355) -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Linux kernel has nasty bug / feature. If PPPIOCNEWUNIT is called with -negative ppp unit id (which is default option when command line argument -"unit" is not specified; and tells kernel to choose some free ppp unit id) -and the lowest unused/free ppp unit id is present in some existing network -interface name prefixed by "ppp" string then this PPPIOCNEWUNIT ioctl -fails. In this case kernel is basically unable to create a new ppp -interface via PPPIOCNEWUNIT ioctl when user does not specify some unused -and non-conflicted unit id. - -Linux kernel should be fixed to choose usable ppp unit id when was -requested via PPPIOCNEWUNIT parameter -1. - -Until this happens, add a workaround for pppd to help choosing some random -ppp unit id when kernel returns this error. - -Simple test case (run on system when there is no ppp interface): - - sudo ./pppd ifname ppp1 nodefaultroute noauth nolock local nodetach pty "./pppd nodefaultroute noauth nolock local nodetach notty" - -Second pppd process without this patch prints into syslog following error: - - pppd 2.4.10-dev started by pali, uid 0 - Couldn't create new ppp unit: File exists - Exit. - -With this patch it falls back to random ppp unit id and succeeds: - - pppd 2.4.10-dev started by pali, uid 0 - Using interface ppp1361 - Connect: ppp1361 <--> /dev/pts/14 - ... - -Signed-off-by: Pali Rohár ---- - pppd/sys-linux.c | 5 +++++ - 1 file changed, 5 insertions(+) - ---- a/pppd/sys-linux.c -+++ b/pppd/sys-linux.c -@@ -873,6 +873,11 @@ static int make_ppp_unit(void) - ifunit = -1; - x = ioctl(ppp_dev_fd, PPPIOCNEWUNIT, &ifunit); - } -+ if (x < 0 && errno == EEXIST) { -+ srand(time(NULL) * getpid()); -+ ifunit = rand() % 10000; -+ x = ioctl(ppp_dev_fd, PPPIOCNEWUNIT, &ifunit); -+ } - if (x < 0) - error("Couldn't create new ppp unit: %m"); - diff --git a/package/network/services/ppp/patches/144-pppd-Retry-registering-interface-when-on-rtnetlink-E.patch b/package/network/services/ppp/patches/144-pppd-Retry-registering-interface-when-on-rtnetlink-E.patch deleted file mode 100644 index 26c1e34683a..00000000000 --- a/package/network/services/ppp/patches/144-pppd-Retry-registering-interface-when-on-rtnetlink-E.patch +++ /dev/null @@ -1,218 +0,0 @@ -From 089687fbcc6524809ae9f4b2f8145fe3c2a91147 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Pali=20Roh=C3=A1r?= -Date: Sat, 7 Aug 2021 19:48:01 +0200 -Subject: [PATCH] pppd: Retry registering interface when on rtnetlink -EBUSY - error -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Due to workaround in kernel module ppp_generic.ko in function -ppp_nl_newlink(), kernel may return -EBUSY error to prevent possible -mutex deadlock. In this case userspace needs to retry its request. - -Proper way would be to fix kernel module to order requests and mutex -locking, so prevent deadlock in kernel and so never return this error to -userspace. Until it happens we need retry code in userspace. - -Signed-off-by: Pali Rohár -[ backport to ppp 2.4.9 ] -Signed-off-by: Christian Marangi ---- - pppd/sys-linux.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - ---- a/pppd/sys-linux.c -+++ b/pppd/sys-linux.c -@@ -707,99 +707,101 @@ static int make_ppp_unit_rtnetlink(void) - int one; - int fd; - -- fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); -- if (fd < 0) { -- error("make_ppp_unit_rtnetlink: socket(NETLINK_ROUTE): %m (line %d)", __LINE__); -- return 0; -- } -- -- /* Tell kernel to not send to us payload of acknowledgment error message. */ -- one = 1; -- setsockopt(fd, SOL_NETLINK, NETLINK_CAP_ACK, &one, sizeof(one)); -+ do { -+ fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); -+ if (fd < 0) { -+ error("make_ppp_unit_rtnetlink: socket(NETLINK_ROUTE): %m (line %d)", __LINE__); -+ return 0; -+ } -+ -+ /* Tell kernel to not send to us payload of acknowledgment error message. */ -+ one = 1; -+ setsockopt(fd, SOL_NETLINK, NETLINK_CAP_ACK, &one, sizeof(one)); -+ -+ memset(&nladdr, 0, sizeof(nladdr)); -+ nladdr.nl_family = AF_NETLINK; -+ -+ if (bind(fd, (struct sockaddr *)&nladdr, sizeof(nladdr)) < 0) { -+ error("make_ppp_unit_rtnetlink: bind(AF_NETLINK): %m (line %d)", __LINE__); -+ close(fd); -+ return 0; -+ } -+ -+ memset(&nlreq, 0, sizeof(nlreq)); -+ nlreq.nlh.nlmsg_len = sizeof(nlreq); -+ nlreq.nlh.nlmsg_type = RTM_NEWLINK; -+ nlreq.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | NLM_F_EXCL | NLM_F_CREATE; -+ nlreq.ifm.ifi_family = AF_UNSPEC; -+ nlreq.ifm.ifi_type = ARPHRD_NETROM; -+ nlreq.ifn.rta.rta_len = sizeof(nlreq.ifn); -+ nlreq.ifn.rta.rta_type = IFLA_IFNAME; -+ strlcpy(nlreq.ifn.ifname, req_ifname, sizeof(nlreq.ifn.ifname)); -+ nlreq.ifli.rta.rta_len = sizeof(nlreq.ifli); -+ nlreq.ifli.rta.rta_type = IFLA_LINKINFO; -+ nlreq.ifli.ifik.rta.rta_len = sizeof(nlreq.ifli.ifik); -+ nlreq.ifli.ifik.rta.rta_type = IFLA_INFO_KIND; -+ strcpy(nlreq.ifli.ifik.ifkind, "ppp"); -+ nlreq.ifli.ifid.rta.rta_len = sizeof(nlreq.ifli.ifid); -+ nlreq.ifli.ifid.rta.rta_type = IFLA_INFO_DATA; -+ nlreq.ifli.ifid.ifdata[0].rta.rta_len = sizeof(nlreq.ifli.ifid.ifdata[0]); -+ nlreq.ifli.ifid.ifdata[0].rta.rta_type = IFLA_PPP_DEV_FD; -+ nlreq.ifli.ifid.ifdata[0].ppp.ppp_dev_fd = ppp_dev_fd; -+ -+ memset(&nladdr, 0, sizeof(nladdr)); -+ nladdr.nl_family = AF_NETLINK; -+ -+ memset(&iov, 0, sizeof(iov)); -+ iov.iov_base = &nlreq; -+ iov.iov_len = sizeof(nlreq); -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.msg_name = &nladdr; -+ msg.msg_namelen = sizeof(nladdr); -+ msg.msg_iov = &iov; -+ msg.msg_iovlen = 1; -+ -+ if (sendmsg(fd, &msg, 0) < 0) { -+ error("make_ppp_unit_rtnetlink: sendmsg(RTM_NEWLINK/NLM_F_CREATE): %m (line %d)", __LINE__); -+ close(fd); -+ return 0; -+ } -+ -+ memset(&iov, 0, sizeof(iov)); -+ iov.iov_base = &nlresp; -+ iov.iov_len = sizeof(nlresp); -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.msg_name = &nladdr; -+ msg.msg_namelen = sizeof(nladdr); -+ msg.msg_iov = &iov; -+ msg.msg_iovlen = 1; -+ -+ nlresplen = recvmsg(fd, &msg, 0); -+ -+ if (nlresplen < 0) { -+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): %m (line %d)", __LINE__); -+ close(fd); -+ return 0; -+ } - -- memset(&nladdr, 0, sizeof(nladdr)); -- nladdr.nl_family = AF_NETLINK; -- -- if (bind(fd, (struct sockaddr *)&nladdr, sizeof(nladdr)) < 0) { -- error("make_ppp_unit_rtnetlink: bind(AF_NETLINK): %m (line %d)", __LINE__); - close(fd); -- return 0; -- } -- -- memset(&nlreq, 0, sizeof(nlreq)); -- nlreq.nlh.nlmsg_len = sizeof(nlreq); -- nlreq.nlh.nlmsg_type = RTM_NEWLINK; -- nlreq.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | NLM_F_EXCL | NLM_F_CREATE; -- nlreq.ifm.ifi_family = AF_UNSPEC; -- nlreq.ifm.ifi_type = ARPHRD_NETROM; -- nlreq.ifn.rta.rta_len = sizeof(nlreq.ifn); -- nlreq.ifn.rta.rta_type = IFLA_IFNAME; -- strlcpy(nlreq.ifn.ifname, req_ifname, sizeof(nlreq.ifn.ifname)); -- nlreq.ifli.rta.rta_len = sizeof(nlreq.ifli); -- nlreq.ifli.rta.rta_type = IFLA_LINKINFO; -- nlreq.ifli.ifik.rta.rta_len = sizeof(nlreq.ifli.ifik); -- nlreq.ifli.ifik.rta.rta_type = IFLA_INFO_KIND; -- strcpy(nlreq.ifli.ifik.ifkind, "ppp"); -- nlreq.ifli.ifid.rta.rta_len = sizeof(nlreq.ifli.ifid); -- nlreq.ifli.ifid.rta.rta_type = IFLA_INFO_DATA; -- nlreq.ifli.ifid.ifdata[0].rta.rta_len = sizeof(nlreq.ifli.ifid.ifdata[0]); -- nlreq.ifli.ifid.ifdata[0].rta.rta_type = IFLA_PPP_DEV_FD; -- nlreq.ifli.ifid.ifdata[0].ppp.ppp_dev_fd = ppp_dev_fd; -- -- memset(&nladdr, 0, sizeof(nladdr)); -- nladdr.nl_family = AF_NETLINK; -- -- memset(&iov, 0, sizeof(iov)); -- iov.iov_base = &nlreq; -- iov.iov_len = sizeof(nlreq); -- -- memset(&msg, 0, sizeof(msg)); -- msg.msg_name = &nladdr; -- msg.msg_namelen = sizeof(nladdr); -- msg.msg_iov = &iov; -- msg.msg_iovlen = 1; -- -- if (sendmsg(fd, &msg, 0) < 0) { -- error("make_ppp_unit_rtnetlink: sendmsg(RTM_NEWLINK/NLM_F_CREATE): %m (line %d)", __LINE__); -- close(fd); -- return 0; -- } -- -- memset(&iov, 0, sizeof(iov)); -- iov.iov_base = &nlresp; -- iov.iov_len = sizeof(nlresp); -- -- memset(&msg, 0, sizeof(msg)); -- msg.msg_name = &nladdr; -- msg.msg_namelen = sizeof(nladdr); -- msg.msg_iov = &iov; -- msg.msg_iovlen = 1; -- -- nlresplen = recvmsg(fd, &msg, 0); -- -- if (nlresplen < 0) { -- error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): %m (line %d)", __LINE__); -- close(fd); -- return 0; -- } -- -- close(fd); - -- if (nladdr.nl_family != AF_NETLINK) { -- error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Not a netlink packet (line %d)", __LINE__); -- return 0; -- } -- -- if ((size_t)nlresplen < sizeof(nlresp) || nlresp.nlh.nlmsg_len < sizeof(nlresp)) { -- error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Acknowledgment netlink packet too short (line %d)", __LINE__); -- return 0; -- } -- -- /* acknowledgment packet for NLM_F_ACK is NLMSG_ERROR */ -- if (nlresp.nlh.nlmsg_type != NLMSG_ERROR) { -- error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Not an acknowledgment netlink packet (line %d)", __LINE__); -- return 0; -- } -+ if (nladdr.nl_family != AF_NETLINK) { -+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Not a netlink packet (line %d)", __LINE__); -+ return 0; -+ } -+ -+ if ((size_t)nlresplen < sizeof(nlresp) || nlresp.nlh.nlmsg_len < sizeof(nlresp)) { -+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Acknowledgment netlink packet too short (line %d)", __LINE__); -+ return 0; -+ } -+ -+ /* acknowledgment packet for NLM_F_ACK is NLMSG_ERROR */ -+ if (nlresp.nlh.nlmsg_type != NLMSG_ERROR) { -+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Not an acknowledgment netlink packet (line %d)", __LINE__); -+ return 0; -+ } -+ } while (nlresp.nlerr.error == -EBUSY); - - /* error == 0 indicates success, negative value is errno code */ - if (nlresp.nlerr.error != 0) { diff --git a/package/network/services/ppp/patches/200-makefile.patch b/package/network/services/ppp/patches/200-makefile.patch deleted file mode 100644 index d0b9a9a99bd..00000000000 --- a/package/network/services/ppp/patches/200-makefile.patch +++ /dev/null @@ -1,56 +0,0 @@ -pppd: tune Linux config defaults for OpenWrt - -This patch adjusts a number defaults to properly match the OpenWrt environment. -It is not intended for upstream. - -Signed-off-by: Jo-Philipp Wich - ---- a/pppd/Makefile.linux -+++ b/pppd/Makefile.linux -@@ -49,7 +49,7 @@ MPPE=y - # Uncomment the next line to include support for PPP packet filtering. - # This requires that the libpcap library and headers be installed - # and that the kernel driver support PPP packet filtering. --FILTER=y -+#FILTER=y - - # Uncomment the next line to enable multilink PPP (enabled by default) - # Linux distributions: Please leave multilink ENABLED in your builds -@@ -59,7 +59,7 @@ HAVE_MULTILINK=y - # Uncomment the next line to enable the TDB database (enabled by default.) - # If you enable multilink, then TDB is automatically enabled also. - # Linux distributions: Please leave TDB ENABLED in your builds. --USE_TDB=y -+#USE_TDB=y - - # Uncomment the next line to enable Type=notify services in systemd - # If enabled, and the user sets the up_sdnotify option, then -@@ -85,13 +85,13 @@ USE_LIBUTIL=y - endif - - # Enable EAP-TLS authentication (requires MPPE support, libssl and libcrypto) --USE_EAPTLS=y -+#USE_EAPTLS=y - - MAXOCTETS=y - - INCLUDE_DIRS= -I../include - --COMPILE_FLAGS= -DHAVE_PATHS_H -DIPX_CHANGE -DHAVE_MMAP -pipe -+COMPILE_FLAGS= -DHAVE_PATHS_H -DHAVE_MMAP -pipe - - CFLAGS= $(COPTS) $(COMPILE_FLAGS) $(INCLUDE_DIRS) '-DDESTDIR="@DESTDIR@"' - -@@ -143,10 +143,10 @@ CFLAGS += -DHAS_SHADOW - #LIBS += -lshadow $(LIBS) - endif - --ifeq ($(shell echo '\#include ' | $(CC) -E - >/dev/null 2>&1 && echo yes),yes) -+#ifeq ($(shell echo '\#include ' | $(CC) -E - >/dev/null 2>&1 && echo yes),yes) - CFLAGS += -DHAVE_CRYPT_H=1 - LIBS += -lcrypt --endif -+#endif - - ifdef USE_LIBUTIL - CFLAGS += -DHAVE_LOGWTMP=1 diff --git a/package/network/services/ppp/patches/201-mppe_mppc_1.1.patch b/package/network/services/ppp/patches/201-mppe_mppc_1.1.patch deleted file mode 100644 index 3c30517e42f..00000000000 --- a/package/network/services/ppp/patches/201-mppe_mppc_1.1.patch +++ /dev/null @@ -1,1518 +0,0 @@ -pppd: add support for MPPE and MPPC encryption and compression protocols - -This is a forward ported version of ppp-2.4.3-mppe-mppc-1.1.patch.gz found on -http://mppe-mppc.alphacron.de/ . - -Signed-off-by: Jo-Philipp Wich - ---- a/include/linux/ppp-comp.h -+++ b/include/linux/ppp-comp.h -@@ -36,7 +36,7 @@ - */ - - /* -- * ==FILEVERSION 20020319== -+ * ==FILEVERSION 20020715== - * - * NOTE TO MAINTAINERS: - * If you modify this file at all, please set the above date. -@@ -201,6 +201,33 @@ struct compressor { - #define CI_MPPE 18 /* config option for MPPE */ - #define CILEN_MPPE 6 /* length of config option */ - -+/* MPPE/MPPC definitions by J.D.*/ -+#define MPPE_STATELESS MPPE_H_BIT /* configuration bit H */ -+#define MPPE_40BIT MPPE_L_BIT /* configuration bit L */ -+#define MPPE_56BIT MPPE_M_BIT /* configuration bit M */ -+#define MPPE_128BIT MPPE_S_BIT /* configuration bit S */ -+#define MPPE_MPPC MPPE_C_BIT /* configuration bit C */ -+ -+/* -+ * Definitions for Stac LZS. -+ */ -+ -+#define CI_LZS 17 /* config option for Stac LZS */ -+#define CILEN_LZS 5 /* length of config option */ -+ -+#define LZS_OVHD 4 /* max. LZS overhead */ -+#define LZS_HIST_LEN 2048 /* LZS history size */ -+#define LZS_MAX_CCOUNT 0x0FFF /* max. coherency counter value */ -+ -+#define LZS_MODE_NONE 0 -+#define LZS_MODE_LCB 1 -+#define LZS_MODE_CRC 2 -+#define LZS_MODE_SEQ 3 -+#define LZS_MODE_EXT 4 -+ -+#define LZS_EXT_BIT_FLUSHED 0x80 /* bit A */ -+#define LZS_EXT_BIT_COMP 0x20 /* bit C */ -+ - /* - * Definitions for other, as yet unsupported, compression methods. - */ ---- a/include/net/ppp-comp.h -+++ b/include/net/ppp-comp.h -@@ -168,6 +168,33 @@ struct compressor { - #define CI_MPPE 18 /* config option for MPPE */ - #define CILEN_MPPE 6 /* length of config option */ - -+/* MPPE/MPPC definitions by J.D.*/ -+#define MPPE_STATELESS MPPE_H_BIT /* configuration bit H */ -+#define MPPE_40BIT MPPE_L_BIT /* configuration bit L */ -+#define MPPE_56BIT MPPE_M_BIT /* configuration bit M */ -+#define MPPE_128BIT MPPE_S_BIT /* configuration bit S */ -+#define MPPE_MPPC MPPE_C_BIT /* configuration bit C */ -+ -+/* -+ * Definitions for Stac LZS. -+ */ -+ -+#define CI_LZS 17 /* config option for Stac LZS */ -+#define CILEN_LZS 5 /* length of config option */ -+ -+#define LZS_OVHD 4 /* max. LZS overhead */ -+#define LZS_HIST_LEN 2048 /* LZS history size */ -+#define LZS_MAX_CCOUNT 0x0FFF /* max. coherency counter value */ -+ -+#define LZS_MODE_NONE 0 -+#define LZS_MODE_LCB 1 -+#define LZS_MODE_CRC 2 -+#define LZS_MODE_SEQ 3 -+#define LZS_MODE_EXT 4 -+ -+#define LZS_EXT_BIT_FLUSHED 0x80 /* bit A */ -+#define LZS_EXT_BIT_COMP 0x20 /* bit C */ -+ - /* - * Definitions for other, as yet unsupported, compression methods. - */ ---- a/pppd/ccp.c -+++ b/pppd/ccp.c -@@ -61,12 +61,10 @@ static int setdeflate (char **); - static char bsd_value[8]; - static char deflate_value[8]; - --/* -- * Option variables. -- */ - #ifdef MPPE --bool refuse_mppe_stateful = 1; /* Allow stateful mode? */ --#endif -+static int setmppe(char **); -+static int setnomppe(void); -+#endif /* MPPE */ - - static option_t ccp_option_list[] = { - { "noccp", o_bool, &ccp_protent.enabled_flag, -@@ -107,54 +105,36 @@ static option_t ccp_option_list[] = { - "don't allow Predictor-1", OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLR, - &ccp_allowoptions[0].predictor_1 }, - -+ { "lzs", o_bool, &ccp_wantoptions[0].lzs, -+ "request Stac LZS", 1, &ccp_allowoptions[0].lzs, OPT_PRIO }, -+ { "+lzs", o_bool, &ccp_wantoptions[0].lzs, -+ "request Stac LZS", 1, &ccp_allowoptions[0].lzs, OPT_ALIAS | OPT_PRIO }, -+ { "nolzs", o_bool, &ccp_wantoptions[0].lzs, -+ "don't allow Stac LZS", OPT_PRIOSUB | OPT_A2CLR, -+ &ccp_allowoptions[0].lzs }, -+ { "-lzs", o_bool, &ccp_wantoptions[0].lzs, -+ "don't allow Stac LZS", OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLR, -+ &ccp_allowoptions[0].lzs }, -+ - #ifdef MPPE -- /* MPPE options are symmetrical ... we only set wantoptions here */ -- { "require-mppe", o_bool, &ccp_wantoptions[0].mppe, -- "require MPPE encryption", -- OPT_PRIO | MPPE_OPT_40 | MPPE_OPT_128 }, -- { "+mppe", o_bool, &ccp_wantoptions[0].mppe, -- "require MPPE encryption", -- OPT_ALIAS | OPT_PRIO | MPPE_OPT_40 | MPPE_OPT_128 }, -- { "nomppe", o_bool, &ccp_wantoptions[0].mppe, -- "don't allow MPPE encryption", OPT_PRIO }, -- { "-mppe", o_bool, &ccp_wantoptions[0].mppe, -- "don't allow MPPE encryption", OPT_ALIAS | OPT_PRIO }, -- -- /* We use ccp_allowoptions[0].mppe as a junk var ... it is reset later */ -- { "require-mppe-40", o_bool, &ccp_allowoptions[0].mppe, -- "require MPPE 40-bit encryption", OPT_PRIO | OPT_A2OR | MPPE_OPT_40, -- &ccp_wantoptions[0].mppe }, -- { "+mppe-40", o_bool, &ccp_allowoptions[0].mppe, -- "require MPPE 40-bit encryption", OPT_PRIO | OPT_A2OR | MPPE_OPT_40, -- &ccp_wantoptions[0].mppe }, -- { "nomppe-40", o_bool, &ccp_allowoptions[0].mppe, -- "don't allow MPPE 40-bit encryption", -- OPT_PRIOSUB | OPT_A2CLRB | MPPE_OPT_40, &ccp_wantoptions[0].mppe }, -- { "-mppe-40", o_bool, &ccp_allowoptions[0].mppe, -- "don't allow MPPE 40-bit encryption", -- OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLRB | MPPE_OPT_40, -- &ccp_wantoptions[0].mppe }, -- -- { "require-mppe-128", o_bool, &ccp_allowoptions[0].mppe, -- "require MPPE 128-bit encryption", OPT_PRIO | OPT_A2OR | MPPE_OPT_128, -- &ccp_wantoptions[0].mppe }, -- { "+mppe-128", o_bool, &ccp_allowoptions[0].mppe, -- "require MPPE 128-bit encryption", -- OPT_ALIAS | OPT_PRIO | OPT_A2OR | MPPE_OPT_128, -- &ccp_wantoptions[0].mppe }, -- { "nomppe-128", o_bool, &ccp_allowoptions[0].mppe, -- "don't allow MPPE 128-bit encryption", -- OPT_PRIOSUB | OPT_A2CLRB | MPPE_OPT_128, &ccp_wantoptions[0].mppe }, -- { "-mppe-128", o_bool, &ccp_allowoptions[0].mppe, -- "don't allow MPPE 128-bit encryption", -- OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLRB | MPPE_OPT_128, -- &ccp_wantoptions[0].mppe }, -- -- /* strange one; we always request stateless, but will we allow stateful? */ -- { "mppe-stateful", o_bool, &refuse_mppe_stateful, -- "allow MPPE stateful mode", OPT_PRIO }, -- { "nomppe-stateful", o_bool, &refuse_mppe_stateful, -- "disallow MPPE stateful mode", OPT_PRIO | 1 }, -+ { "mppc", o_bool, &ccp_wantoptions[0].mppc, -+ "request MPPC compression", 1, &ccp_allowoptions[0].mppc }, -+ { "+mppc", o_bool, &ccp_wantoptions[0].mppc, -+ "request MPPC compression", 1, &ccp_allowoptions[0].mppc, OPT_ALIAS }, -+ { "nomppc", o_bool, &ccp_wantoptions[0].mppc, -+ "don't allow MPPC compression", OPT_PRIOSUB | OPT_A2CLR, -+ &ccp_allowoptions[0].mppc }, -+ { "-mppc", o_bool, &ccp_wantoptions[0].mppc, -+ "don't allow MPPC compression", OPT_ALIAS | OPT_PRIOSUB | OPT_A2CLR, -+ &ccp_allowoptions[0].mppc }, -+ { "mppe", o_special, (void *)setmppe, -+ "request MPPE encryption" }, -+ { "+mppe", o_special, (void *)setmppe, -+ "request MPPE encryption" }, -+ { "nomppe", o_special_noarg, (void *)setnomppe, -+ "don't allow MPPE encryption" }, -+ { "-mppe", o_special_noarg, (void *)setnomppe, -+ "don't allow MPPE encryption" }, - #endif /* MPPE */ - - { NULL } -@@ -240,7 +220,7 @@ static fsm_callbacks ccp_callbacks = { - */ - #define ANY_COMPRESS(opt) ((opt).deflate || (opt).bsd_compress \ - || (opt).predictor_1 || (opt).predictor_2 \ -- || (opt).mppe) -+ || (opt).lzs || (opt).mppc || (opt).mppe) - - /* - * Local state (mainly for handling reset-reqs and reset-acks). -@@ -341,6 +321,100 @@ setdeflate(char **argv) - return 1; - } - -+#ifdef MPPE -+/* -+ * Functions called from config options -+ */ -+/* -+ MPPE suboptions: -+ required - require MPPE; disconnect if peer doesn't support it -+ stateless - use stateless mode -+ no40 - disable 40 bit keys -+ no56 - disable 56 bit keys -+ no128 - disable 128 bit keys -+*/ -+int setmppe(char **argv) -+{ -+ int i; -+ char *str, cmdbuf[16]; -+ -+ ccp_allowoptions[0].mppe = 1; -+ ccp_allowoptions[0].mppe_40 = 1; -+ ccp_allowoptions[0].mppe_56 = 1; -+ ccp_allowoptions[0].mppe_128 = 1; -+ ccp_allowoptions[0].mppe_stateless = 0; -+ ccp_wantoptions[0].mppe = 0; -+ -+ str = *argv; -+ -+ while (1) { -+ i = 0; -+ memset(cmdbuf, '\0', 16); -+ while ((i < 16) && (*str != ',') && (*str != '\0')) -+ cmdbuf[i++] = *str++; -+ cmdbuf[i] = '\0'; -+ if (!strncasecmp(cmdbuf, "no40", strlen("no40"))) { -+ ccp_allowoptions[0].mppe_40 = 0; -+ goto next_param; -+ } else if (!strncasecmp(cmdbuf, "no56", strlen("no56"))) { -+ ccp_allowoptions[0].mppe_56 = 0; -+ goto next_param; -+ } else if (!strncasecmp(cmdbuf, "no128", strlen("no128"))) { -+ ccp_allowoptions[0].mppe_128 = 0; -+ goto next_param; -+ } else if (!strncasecmp(cmdbuf, "stateless", strlen("stateless"))) { -+ ccp_allowoptions[0].mppe_stateless = 1; -+ goto next_param; -+ } else if (!strncasecmp(cmdbuf, "required", strlen("required"))) { -+ ccp_wantoptions[0].mppe = 1; -+ goto next_param; -+ } else { -+ option_error("invalid parameter '%s' for mppe option", cmdbuf); -+ return 0; -+ } -+ -+ next_param: -+ if (*str == ',') { -+ str++; -+ continue; -+ } -+ if (*str == '\0') { -+ if (!(ccp_allowoptions[0].mppe_40 || ccp_allowoptions[0].mppe_56 || -+ ccp_allowoptions[0].mppe_128)) { -+ if (ccp_wantoptions[0].mppe == 1) { -+ option_error("You require MPPE but you have switched off " -+ "all encryption key lengths."); -+ return 0; -+ } -+ ccp_wantoptions[0].mppe = ccp_allowoptions[0].mppe = 0; -+ ccp_wantoptions[0].mppe_stateless = -+ ccp_allowoptions[0].mppe_stateless = 0; -+ } else { -+ ccp_allowoptions[0].mppe = 1; -+ ccp_wantoptions[0].mppe_stateless = -+ ccp_allowoptions[0].mppe_stateless; -+ if (ccp_wantoptions[0].mppe == 1) { -+ ccp_wantoptions[0].mppe_40 = ccp_allowoptions[0].mppe_40; -+ ccp_wantoptions[0].mppe_56 = ccp_allowoptions[0].mppe_56; -+ ccp_wantoptions[0].mppe_128 = ccp_allowoptions[0].mppe_128; -+ } -+ } -+ return 1; -+ } -+ } -+} -+ -+int setnomppe(void) -+{ -+ ccp_wantoptions[0].mppe = ccp_allowoptions[0].mppe = 0; -+ ccp_wantoptions[0].mppe_40 = ccp_allowoptions[0].mppe_40 = 0; -+ ccp_wantoptions[0].mppe_56 = ccp_allowoptions[0].mppe_56 = 0; -+ ccp_wantoptions[0].mppe_128 = ccp_allowoptions[0].mppe_128 = 0; -+ ccp_wantoptions[0].mppe_stateless = ccp_allowoptions[0].mppe_stateless = 0; -+ return 1; -+} -+#endif /* MPPE */ -+ - /* - * ccp_init - initialize CCP. - */ -@@ -374,6 +448,30 @@ ccp_init(int unit) - ccp_allowoptions[0].bsd_bits = BSD_MAX_BITS; - - ccp_allowoptions[0].predictor_1 = 1; -+ -+ ccp_wantoptions[0].lzs = 0; /* Stac LZS - will be enabled in the future */ -+ ccp_wantoptions[0].lzs_mode = LZS_MODE_SEQ; -+ ccp_wantoptions[0].lzs_hists = 1; -+ ccp_allowoptions[0].lzs = 0; /* Stac LZS - will be enabled in the future */ -+ ccp_allowoptions[0].lzs_mode = LZS_MODE_SEQ; -+ ccp_allowoptions[0].lzs_hists = 1; -+ -+#ifdef MPPE -+ /* by default allow and request MPPC... */ -+ ccp_wantoptions[0].mppc = ccp_allowoptions[0].mppc = 1; -+ -+ /* ... and allow but don't request MPPE */ -+ ccp_allowoptions[0].mppe = 1; -+ ccp_allowoptions[0].mppe_40 = 1; -+ ccp_allowoptions[0].mppe_56 = 1; -+ ccp_allowoptions[0].mppe_128 = 1; -+ ccp_allowoptions[0].mppe_stateless = 1; -+ ccp_wantoptions[0].mppe = 0; -+ ccp_wantoptions[0].mppe_40 = 0; -+ ccp_wantoptions[0].mppe_56 = 0; -+ ccp_wantoptions[0].mppe_128 = 0; -+ ccp_wantoptions[0].mppe_stateless = 0; -+#endif /* MPPE */ - } - - /* -@@ -443,11 +541,11 @@ ccp_input(int unit, u_char *p, int len) - if (oldstate == OPENED && p[0] == TERMREQ && f->state != OPENED) { - notice("Compression disabled by peer."); - #ifdef MPPE -- if (ccp_gotoptions[unit].mppe) { -+ if (ccp_wantoptions[unit].mppe) { - error("MPPE disabled, closing LCP"); - lcp_close(unit, "MPPE disabled by peer"); - } --#endif -+#endif /* MPPE */ - } - - /* -@@ -471,6 +569,15 @@ ccp_extcode(fsm *f, int code, int id, u_ - break; - /* send a reset-ack, which the transmitter will see and - reset its compression state. */ -+ -+ /* In case of MPPE/MPPC or LZS we shouldn't send CCP_RESETACK, -+ but we do it in order to reset compressor; CCP_RESETACK is -+ then silently discarded. See functions ppp_send_frame and -+ ppp_ccp_peek in ppp_generic.c (Linux only !!!). All the -+ confusion is caused by the fact that CCP code is splited -+ into two parts - one part is handled by pppd, the other one -+ is handled by kernel. */ -+ - fsm_sdata(f, CCP_RESETACK, id, NULL, 0); - break; - -@@ -498,12 +605,11 @@ ccp_protrej(int unit) - fsm_lowerdown(&ccp_fsm[unit]); - - #ifdef MPPE -- if (ccp_gotoptions[unit].mppe) { -+ if (ccp_wantoptions[unit].mppe) { - error("MPPE required but peer negotiation failed"); - lcp_close(unit, "MPPE required but peer negotiation failed"); - } --#endif -- -+#endif /* MPPE */ - } - - /* -@@ -519,7 +625,7 @@ ccp_resetci(fsm *f) - all_rejected[f->unit] = 0; - - #ifdef MPPE -- if (go->mppe) { -+ if (go->mppe || go->mppc) { - ccp_options *ao = &ccp_allowoptions[f->unit]; - int auth_mschap_bits = auth_done[f->unit]; - #ifdef USE_EAPTLS -@@ -536,95 +642,124 @@ ccp_resetci(fsm *f) - * NB: If MPPE is required, all other compression opts are invalid. - * So, we return right away if we can't do it. - */ -- -- /* Leave only the mschap auth bits set */ -- auth_mschap_bits &= (CHAP_MS_WITHPEER | CHAP_MS_PEER | -- CHAP_MS2_WITHPEER | CHAP_MS2_PEER); -- /* Count the mschap auths */ -- auth_mschap_bits >>= CHAP_MS_SHIFT; -- numbits = 0; -- do { -- numbits += auth_mschap_bits & 1; -- auth_mschap_bits >>= 1; -- } while (auth_mschap_bits); -- if (numbits > 1) { -- error("MPPE required, but auth done in both directions."); -- lcp_close(f->unit, "MPPE required but not available"); -- return; -- } -+ if (ccp_wantoptions[f->unit].mppe) { -+ /* Leave only the mschap auth bits set */ -+ auth_mschap_bits &= (CHAP_MS_WITHPEER | CHAP_MS_PEER | -+ CHAP_MS2_WITHPEER | CHAP_MS2_PEER); -+ /* Count the mschap auths */ -+ auth_mschap_bits >>= CHAP_MS_SHIFT; -+ numbits = 0; -+ do { -+ numbits += auth_mschap_bits & 1; -+ auth_mschap_bits >>= 1; -+ } while (auth_mschap_bits); -+ if (numbits > 1) { -+ error("MPPE required, but auth done in both directions."); -+ lcp_close(f->unit, "MPPE required but not available"); -+ return; -+ } - - #ifdef USE_EAPTLS -- /* -- * MPPE is also possible in combination with EAP-TLS. -- * It is not possible to detect if we're doing EAP or EAP-TLS -- * at this stage, hence we accept all forms of EAP. If TLS is -- * not used then the MPPE keys will not be derived anyway. -- */ -- /* Leave only the eap auth bits set */ -- auth_eap_bits &= (EAP_WITHPEER | EAP_PEER ); -+ /* -+ * MPPE is also possible in combination with EAP-TLS. -+ * It is not possible to detect if we're doing EAP or EAP-TLS -+ * at this stage, hence we accept all forms of EAP. If TLS is -+ * not used then the MPPE keys will not be derived anyway. -+ */ -+ /* Leave only the eap auth bits set */ -+ auth_eap_bits &= (EAP_WITHPEER | EAP_PEER ); - -- if ((numbits == 0) && (auth_eap_bits == 0)) { -- error("MPPE required, but MS-CHAP[v2] nor EAP-TLS auth are performed."); -+ if ((numbits == 0) && (auth_eap_bits == 0)) { -+ error("MPPE required, but MS-CHAP[v2] nor EAP-TLS auth are performed."); - #else -- if (!numbits) { -- error("MPPE required, but MS-CHAP[v2] auth not performed."); -+ if (!numbits) { -+ error("MPPE required, but MS-CHAP[v2] auth not performed."); - #endif -- lcp_close(f->unit, "MPPE required but not available"); -- return; -- } -+ lcp_close(f->unit, "MPPE required but not available"); -+ return; -+ } - -- /* A plugin (eg radius) may not have obtained key material. */ -- if (!mppe_keys_set) { -- error("MPPE required, but keys are not available. " -- "Possible plugin problem?"); -- lcp_close(f->unit, "MPPE required but not available"); -- return; -- } -- -- /* LM auth not supported for MPPE */ -- if (auth_done[f->unit] & (CHAP_MS_WITHPEER | CHAP_MS_PEER)) { -- /* This might be noise */ -- if (go->mppe & MPPE_OPT_40) { -- notice("Disabling 40-bit MPPE; MS-CHAP LM not supported"); -- go->mppe &= ~MPPE_OPT_40; -- ccp_wantoptions[f->unit].mppe &= ~MPPE_OPT_40; -+ /* A plugin (eg radius) may not have obtained key material. */ -+ if (!mppe_keys_set) { -+ error("MPPE required, but keys are not available. " -+ "Possible plugin problem?"); -+ lcp_close(f->unit, "MPPE required but not available"); -+ return; - } - } - -- /* Last check: can we actually negotiate something? */ -- if (!(go->mppe & (MPPE_OPT_40 | MPPE_OPT_128))) { -- /* Could be misconfig, could be 40-bit disabled above. */ -- error("MPPE required, but both 40-bit and 128-bit disabled."); -- lcp_close(f->unit, "MPPE required but not available"); -- return; -+ /* -+ * Check whether the kernel knows about the various -+ * compression methods we might request. Key material -+ * unimportant here. -+ */ -+ if (go->mppc) { -+ opt_buf[0] = CI_MPPE; -+ opt_buf[1] = CILEN_MPPE; -+ opt_buf[2] = 0; -+ opt_buf[3] = 0; -+ opt_buf[4] = 0; -+ opt_buf[5] = MPPE_MPPC; -+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE, 0) <= 0) -+ go->mppc = 0; -+ } -+ if (go->mppe_40) { -+ opt_buf[0] = CI_MPPE; -+ opt_buf[1] = CILEN_MPPE; -+ opt_buf[2] = MPPE_STATELESS; -+ opt_buf[3] = 0; -+ opt_buf[4] = 0; -+ opt_buf[5] = MPPE_40BIT; -+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0) <= 0) -+ go->mppe_40 = 0; -+ } -+ if (go->mppe_56) { -+ opt_buf[0] = CI_MPPE; -+ opt_buf[1] = CILEN_MPPE; -+ opt_buf[2] = MPPE_STATELESS; -+ opt_buf[3] = 0; -+ opt_buf[4] = 0; -+ opt_buf[5] = MPPE_56BIT; -+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0) <= 0) -+ go->mppe_56 = 0; -+ } -+ if (go->mppe_128) { -+ opt_buf[0] = CI_MPPE; -+ opt_buf[1] = CILEN_MPPE; -+ opt_buf[2] = MPPE_STATELESS; -+ opt_buf[3] = 0; -+ opt_buf[4] = 0; -+ opt_buf[5] = MPPE_128BIT; -+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0) <= 0) -+ go->mppe_128 = 0; -+ } -+ if (!go->mppe_40 && !go->mppe_56 && !go->mppe_128) { -+ if (ccp_wantoptions[f->unit].mppe) { -+ error("MPPE required, but kernel has no support."); -+ lcp_close(f->unit, "MPPE required but not available"); -+ } -+ go->mppe = go->mppe_stateless = 0; -+ } else { -+ /* MPPE is not compatible with other compression types */ -+ if (ccp_wantoptions[f->unit].mppe) { -+ ao->bsd_compress = go->bsd_compress = 0; -+ ao->predictor_1 = go->predictor_1 = 0; -+ ao->predictor_2 = go->predictor_2 = 0; -+ ao->deflate = go->deflate = 0; -+ ao->lzs = go->lzs = 0; -+ } - } -- -- /* sync options */ -- ao->mppe = go->mppe; -- /* MPPE is not compatible with other compression types */ -- ao->bsd_compress = go->bsd_compress = 0; -- ao->predictor_1 = go->predictor_1 = 0; -- ao->predictor_2 = go->predictor_2 = 0; -- ao->deflate = go->deflate = 0; - } - #endif /* MPPE */ -- -- /* -- * Check whether the kernel knows about the various -- * compression methods we might request. -- */ --#ifdef MPPE -- if (go->mppe) { -- opt_buf[0] = CI_MPPE; -- opt_buf[1] = CILEN_MPPE; -- MPPE_OPTS_TO_CI(go->mppe, &opt_buf[2]); -- /* Key material unimportant here. */ -- if (ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0) <= 0) { -- error("MPPE required, but kernel has no support."); -- lcp_close(f->unit, "MPPE required but not available"); -- } -+ if (go->lzs) { -+ opt_buf[0] = CI_LZS; -+ opt_buf[1] = CILEN_LZS; -+ opt_buf[2] = go->lzs_hists >> 8; -+ opt_buf[3] = go->lzs_hists & 0xff; -+ opt_buf[4] = LZS_MODE_SEQ; -+ if (ccp_test(f->unit, opt_buf, CILEN_LZS, 0) <= 0) -+ go->lzs = 0; - } --#endif - if (go->bsd_compress) { - opt_buf[0] = CI_BSD_COMPRESS; - opt_buf[1] = CILEN_BSD_COMPRESS; -@@ -679,7 +814,8 @@ static int - + (go->deflate && go->deflate_draft? CILEN_DEFLATE: 0) - + (go->predictor_1? CILEN_PREDICTOR_1: 0) - + (go->predictor_2? CILEN_PREDICTOR_2: 0) -- + (go->mppe? CILEN_MPPE: 0); -+ + (go->lzs? CILEN_LZS: 0) -+ + ((go->mppe || go->mppc)? CILEN_MPPE: 0); - } - - /* -@@ -690,6 +826,8 @@ static void - { - int res; - ccp_options *go = &ccp_gotoptions[f->unit]; -+ ccp_options *ao = &ccp_allowoptions[f->unit]; -+ ccp_options *wo = &ccp_wantoptions[f->unit]; - u_char *p0 = p; - - /* -@@ -698,22 +836,43 @@ static void - * in case it gets Acked. - */ - #ifdef MPPE -- if (go->mppe) { -+ if (go->mppe || go->mppc || (!wo->mppe && ao->mppe)) { - u_char opt_buf[CILEN_MPPE + MPPE_MAX_KEY_LEN]; - -- p[0] = opt_buf[0] = CI_MPPE; -- p[1] = opt_buf[1] = CILEN_MPPE; -- MPPE_OPTS_TO_CI(go->mppe, &p[2]); -- MPPE_OPTS_TO_CI(go->mppe, &opt_buf[2]); -+ p[0] = CI_MPPE; -+ p[1] = CILEN_MPPE; -+ p[2] = (go->mppe_stateless ? MPPE_STATELESS : 0); -+ p[3] = 0; -+ p[4] = 0; -+ p[5] = (go->mppe_40 ? MPPE_40BIT : 0) | (go->mppe_56 ? MPPE_56BIT : 0) | -+ (go->mppe_128 ? MPPE_128BIT : 0) | (go->mppc ? MPPE_MPPC : 0); -+ -+ BCOPY(p, opt_buf, CILEN_MPPE); - BCOPY(mppe_recv_key, &opt_buf[CILEN_MPPE], MPPE_MAX_KEY_LEN); - res = ccp_test(f->unit, opt_buf, CILEN_MPPE + MPPE_MAX_KEY_LEN, 0); -- if (res > 0) -+ if (res > 0) { - p += CILEN_MPPE; -- else -+ } else { - /* This shouldn't happen, we've already tested it! */ -- lcp_close(f->unit, "MPPE required but not available in kernel"); -+ go->mppe = go->mppe_40 = go->mppe_56 = go->mppe_128 = -+ go->mppe_stateless = go->mppc = 0; -+ if (ccp_wantoptions[f->unit].mppe) -+ lcp_close(f->unit, "MPPE required but not available in kernel"); -+ } -+ } -+#endif /* MPPE */ -+ if (go->lzs) { -+ p[0] = CI_LZS; -+ p[1] = CILEN_LZS; -+ p[2] = go->lzs_hists >> 8; -+ p[3] = go->lzs_hists & 0xff; -+ p[4] = LZS_MODE_SEQ; -+ res = ccp_test(f->unit, p, CILEN_LZS, 0); -+ if (res > 0) { -+ p += CILEN_LZS; -+ } else -+ go->lzs = 0; - } --#endif - if (go->deflate) { - p[0] = go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT; - p[1] = CILEN_DEFLATE; -@@ -799,30 +958,50 @@ static void - - /* - * ccp_ackci - process a received configure-ack, and return -- * 1 iff the packet was OK. -+ * 1 if the packet was OK. - */ - static int - ccp_ackci(fsm *f, u_char *p, int len) - { - ccp_options *go = &ccp_gotoptions[f->unit]; -+ ccp_options *ao = &ccp_allowoptions[f->unit]; -+ ccp_options *wo = &ccp_wantoptions[f->unit]; - u_char *p0 = p; - - #ifdef MPPE -- if (go->mppe) { -- u_char opt_buf[CILEN_MPPE]; -- -- opt_buf[0] = CI_MPPE; -- opt_buf[1] = CILEN_MPPE; -- MPPE_OPTS_TO_CI(go->mppe, &opt_buf[2]); -- if (len < CILEN_MPPE || memcmp(opt_buf, p, CILEN_MPPE)) -+ if (go->mppe || go->mppc || (!wo->mppe && ao->mppe)) { -+ if (len < CILEN_MPPE -+ || p[1] != CILEN_MPPE || p[0] != CI_MPPE -+ || p[2] != (go->mppe_stateless ? MPPE_STATELESS : 0) -+ || p[3] != 0 -+ || p[4] != 0 -+ || (p[5] != ((go->mppe_40 ? MPPE_40BIT : 0) | -+ (go->mppc ? MPPE_MPPC : 0)) -+ && p[5] != ((go->mppe_56 ? MPPE_56BIT : 0) | -+ (go->mppc ? MPPE_MPPC : 0)) -+ && p[5] != ((go->mppe_128 ? MPPE_128BIT : 0) | -+ (go->mppc ? MPPE_MPPC : 0)))) - return 0; -+ if (go->mppe_40 || go->mppe_56 || go->mppe_128) -+ go->mppe = 1; - p += CILEN_MPPE; - len -= CILEN_MPPE; -+ /* Cope with first/fast ack */ -+ if (p == p0 && len == 0) -+ return 1; -+ } -+#endif /* MPPE */ -+ if (go->lzs) { -+ if (len < CILEN_LZS || p[0] != CI_LZS || p[1] != CILEN_LZS -+ || p[2] != go->lzs_hists>>8 || p[3] != (go->lzs_hists&0xff) -+ || p[4] != LZS_MODE_SEQ) -+ return 0; -+ p += CILEN_LZS; -+ len -= CILEN_LZS; - /* XXX Cope with first/fast ack */ -- if (len == 0) -+ if (p == p0 && len == 0) - return 1; - } --#endif - if (go->deflate) { - if (len < CILEN_DEFLATE - || p[0] != (go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT) -@@ -891,6 +1070,8 @@ static int - ccp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) - { - ccp_options *go = &ccp_gotoptions[f->unit]; -+ ccp_options *ao = &ccp_allowoptions[f->unit]; -+ ccp_options *wo = &ccp_wantoptions[f->unit]; - ccp_options no; /* options we've seen already */ - ccp_options try; /* options to ask for next time */ - -@@ -898,28 +1079,100 @@ static int - try = *go; - - #ifdef MPPE -- if (go->mppe && len >= CILEN_MPPE -- && p[0] == CI_MPPE && p[1] == CILEN_MPPE) { -- no.mppe = 1; -- /* -- * Peer wants us to use a different strength or other setting. -- * Fail if we aren't willing to use his suggestion. -- */ -- MPPE_CI_TO_OPTS(&p[2], try.mppe); -- if ((try.mppe & MPPE_OPT_STATEFUL) && refuse_mppe_stateful) { -- error("Refusing MPPE stateful mode offered by peer"); -- try.mppe = 0; -- } else if (((go->mppe | MPPE_OPT_STATEFUL) & try.mppe) != try.mppe) { -- /* Peer must have set options we didn't request (suggest) */ -- try.mppe = 0; -- } -+ if ((go->mppe || go->mppc || (!wo->mppe && ao->mppe)) && -+ len >= CILEN_MPPE && p[0] == CI_MPPE && p[1] == CILEN_MPPE) { - -- if (!try.mppe) { -- error("MPPE required but peer negotiation failed"); -- lcp_close(f->unit, "MPPE required but peer negotiation failed"); -+ if (go->mppc) { -+ no.mppc = 1; -+ if (!(p[5] & MPPE_MPPC)) -+ try.mppc = 0; -+ } -+ -+ if (go->mppe) -+ no.mppe = 1; -+ if (go->mppe_40) -+ no.mppe_40 = 1; -+ if (go->mppe_56) -+ no.mppe_56 = 1; -+ if (go->mppe_128) -+ no.mppe_128 = 1; -+ if (go->mppe_stateless) -+ no.mppe_stateless = 1; -+ -+ if (ao->mppe_40) { -+ if ((p[5] & MPPE_40BIT)) -+ try.mppe_40 = 1; -+ else -+ try.mppe_40 = (p[5] == 0) ? 1 : 0; -+ } -+ if (ao->mppe_56) { -+ if ((p[5] & MPPE_56BIT)) -+ try.mppe_56 = 1; -+ else -+ try.mppe_56 = (p[5] == 0) ? 1 : 0; -+ } -+ if (ao->mppe_128) { -+ if ((p[5] & MPPE_128BIT)) -+ try.mppe_128 = 1; -+ else -+ try.mppe_128 = (p[5] == 0) ? 1 : 0; -+ } -+ -+ if (ao->mppe_stateless) { -+ if ((p[2] & MPPE_STATELESS) || wo->mppe_stateless) -+ try.mppe_stateless = 1; -+ else -+ try.mppe_stateless = 0; -+ } -+ -+ if (!try.mppe_56 && !try.mppe_40 && !try.mppe_128) { -+ try.mppe = try.mppe_stateless = 0; -+ if (wo->mppe) { -+ /* we require encryption, but peer doesn't support it -+ so we close connection */ -+ wo->mppc = wo->mppe = wo->mppe_stateless = wo->mppe_40 = -+ wo->mppe_56 = wo->mppe_128 = 0; -+ lcp_close(f->unit, "MPPE required but cannot negotiate MPPE " -+ "key length"); -+ } -+ } -+ if (wo->mppe && (wo->mppe_40 != try.mppe_40) && -+ (wo->mppe_56 != try.mppe_56) && (wo->mppe_128 != try.mppe_128)) { -+ /* cannot negotiate key length */ -+ wo->mppc = wo->mppe = wo->mppe_stateless = wo->mppe_40 = -+ wo->mppe_56 = wo->mppe_128 = 0; -+ lcp_close(f->unit, "Cannot negotiate MPPE key length"); - } -+ if (try.mppe_40 && try.mppe_56 && try.mppe_128) -+ try.mppe_40 = try.mppe_56 = 0; -+ else -+ if (try.mppe_56 && try.mppe_128) -+ try.mppe_56 = 0; -+ else -+ if (try.mppe_40 && try.mppe_128) -+ try.mppe_40 = 0; -+ else -+ if (try.mppe_40 && try.mppe_56) -+ try.mppe_40 = 0; -+ -+ p += CILEN_MPPE; -+ len -= CILEN_MPPE; - } - #endif /* MPPE */ -+ -+ if (go->lzs && len >= CILEN_LZS && p[0] == CI_LZS && p[1] == CILEN_LZS) { -+ no.lzs = 1; -+ if (((p[2]<<8)|p[3]) > 1 || (p[4] != LZS_MODE_SEQ && -+ p[4] != LZS_MODE_EXT)) -+ try.lzs = 0; -+ else { -+ try.lzs_mode = p[4]; -+ try.lzs_hists = (p[2] << 8) | p[3]; -+ } -+ p += CILEN_LZS; -+ len -= CILEN_LZS; -+ } -+ - if (go->deflate && len >= CILEN_DEFLATE - && p[0] == (go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT) - && p[1] == CILEN_DEFLATE) { -@@ -989,14 +1242,50 @@ ccp_rejci(fsm *f, u_char *p, int len) - return -1; - - #ifdef MPPE -- if (go->mppe && len >= CILEN_MPPE -+ if ((go->mppe || go->mppc) && len >= CILEN_MPPE - && p[0] == CI_MPPE && p[1] == CILEN_MPPE) { -- error("MPPE required but peer refused"); -- lcp_close(f->unit, "MPPE required but peer refused"); -+ ccp_options *wo = &ccp_wantoptions[f->unit]; -+ if (p[2] != (go->mppe_stateless ? MPPE_STATELESS : 0) || -+ p[3] != 0 || -+ p[4] != 0 || -+ p[5] != ((go->mppe_40 ? MPPE_40BIT : 0) | -+ (go->mppe_56 ? MPPE_56BIT : 0) | -+ (go->mppe_128 ? MPPE_128BIT : 0) | -+ (go->mppc ? MPPE_MPPC : 0))) -+ return 0; -+ if (go->mppc) -+ try.mppc = 0; -+ if (go->mppe) { -+ try.mppe = 0; -+ if (go->mppe_40) -+ try.mppe_40 = 0; -+ if (go->mppe_56) -+ try.mppe_56 = 0; -+ if (go->mppe_128) -+ try.mppe_128 = 0; -+ if (go->mppe_stateless) -+ try.mppe_stateless = 0; -+ if (!try.mppe_56 && !try.mppe_40 && !try.mppe_128) -+ try.mppe = try.mppe_stateless = 0; -+ if (wo->mppe) { /* we want MPPE but cannot negotiate key length */ -+ wo->mppc = wo->mppe = wo->mppe_stateless = wo->mppe_40 = -+ wo->mppe_56 = wo->mppe_128 = 0; -+ lcp_close(f->unit, "MPPE required but cannot negotiate MPPE " -+ "key length"); -+ } -+ } - p += CILEN_MPPE; - len -= CILEN_MPPE; - } --#endif -+#endif /* MPPE */ -+ if (go->lzs && len >= CILEN_LZS && p[0] == CI_LZS && p[1] == CILEN_LZS) { -+ if (p[2] != go->lzs_hists>>8 || p[3] != (go->lzs_hists&0xff) -+ || p[4] != go->lzs_mode) -+ return 0; -+ try.lzs = 0; -+ p += CILEN_LZS; -+ len -= CILEN_LZS; -+ } - if (go->deflate_correct && len >= CILEN_DEFLATE - && p[0] == CI_DEFLATE && p[1] == CILEN_DEFLATE) { - if (p[2] != DEFLATE_MAKE_OPT(go->deflate_size) -@@ -1056,14 +1345,15 @@ static int - ccp_reqci(fsm *f, u_char *p, int *lenp, int dont_nak) - { - int ret, newret, res; -- u_char *p0, *retp; -+ u_char *p0, *retp, p2, p5; - int len, clen, type, nb; - ccp_options *ho = &ccp_hisoptions[f->unit]; - ccp_options *ao = &ccp_allowoptions[f->unit]; -+ ccp_options *wo = &ccp_wantoptions[f->unit]; - #ifdef MPPE -- bool rej_for_ci_mppe = 1; /* Are we rejecting based on a bad/missing */ -- /* CI_MPPE, or due to other options? */ --#endif -+ u_char opt_buf[CILEN_MPPE + MPPE_MAX_KEY_LEN]; -+/* int mtu; */ -+#endif /* MPPE */ - - ret = CONFACK; - retp = p0 = p; -@@ -1086,106 +1376,302 @@ ccp_reqci(fsm *f, u_char *p, int *lenp, - switch (type) { - #ifdef MPPE - case CI_MPPE: -- if (!ao->mppe || clen != CILEN_MPPE) { -+ if ((!ao->mppc && !ao->mppe) || clen != CILEN_MPPE) { - newret = CONFREJ; - break; - } -- MPPE_CI_TO_OPTS(&p[2], ho->mppe); -- -- /* Nak if anything unsupported or unknown are set. */ -- if (ho->mppe & MPPE_OPT_UNSUPPORTED) { -+ p2 = p[2]; -+ p5 = p[5]; -+ /* not sure what they want, tell 'em what we got */ -+ if (((p[2] & ~MPPE_STATELESS) != 0 || p[3] != 0 || p[4] != 0 || -+ (p[5] & ~(MPPE_40BIT | MPPE_56BIT | MPPE_128BIT | -+ MPPE_MPPC)) != 0 || p[5] == 0) || -+ (p[2] == 0 && p[3] == 0 && p[4] == 0 && p[5] == 0)) { - newret = CONFNAK; -- ho->mppe &= ~MPPE_OPT_UNSUPPORTED; -- } -- if (ho->mppe & MPPE_OPT_UNKNOWN) { -- newret = CONFNAK; -- ho->mppe &= ~MPPE_OPT_UNKNOWN; -- } -- -- /* Check state opt */ -- if (ho->mppe & MPPE_OPT_STATEFUL) { -- /* -- * We can Nak and request stateless, but it's a -- * lot easier to just assume the peer will request -- * it if he can do it; stateful mode is bad over -- * the Internet -- which is where we expect MPPE. -- */ -- if (refuse_mppe_stateful) { -- error("Refusing MPPE stateful mode offered by peer"); -- newret = CONFREJ; -- break; -+ p[2] = (wo->mppe_stateless ? MPPE_STATELESS : 0); -+ p[3] = 0; -+ p[4] = 0; -+ p[5] = (wo->mppe_40 ? MPPE_40BIT : 0) | -+ (wo->mppe_56 ? MPPE_56BIT : 0) | -+ (wo->mppe_128 ? MPPE_128BIT : 0) | -+ (wo->mppc ? MPPE_MPPC : 0); -+ break; -+ } -+ -+ if ((p[5] & MPPE_MPPC)) { -+ if (ao->mppc) { -+ ho->mppc = 1; -+ BCOPY(p, opt_buf, CILEN_MPPE); -+ opt_buf[2] = opt_buf[3] = opt_buf[4] = 0; -+ opt_buf[5] = MPPE_MPPC; -+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE, 1) <= 0) { -+ ho->mppc = 0; -+ p[5] &= ~MPPE_MPPC; -+ newret = CONFNAK; -+ } -+ } else { -+ newret = CONFREJ; -+ if (wo->mppe || ao->mppe) { -+ p[5] &= ~MPPE_MPPC; -+ newret = CONFNAK; -+ } - } - } -- -- /* Find out which of {S,L} are set. */ -- if ((ho->mppe & MPPE_OPT_128) -- && (ho->mppe & MPPE_OPT_40)) { -- /* Both are set, negotiate the strongest. */ -- newret = CONFNAK; -- if (ao->mppe & MPPE_OPT_128) -- ho->mppe &= ~MPPE_OPT_40; -- else if (ao->mppe & MPPE_OPT_40) -- ho->mppe &= ~MPPE_OPT_128; -- else { -- newret = CONFREJ; -- break; -- } -- } else if (ho->mppe & MPPE_OPT_128) { -- if (!(ao->mppe & MPPE_OPT_128)) { -- newret = CONFREJ; -- break; -- } -- } else if (ho->mppe & MPPE_OPT_40) { -- if (!(ao->mppe & MPPE_OPT_40)) { -- newret = CONFREJ; -- break; -- } -+ if (ao->mppe) -+ ho->mppe = 1; -+ -+ if ((p[2] & MPPE_STATELESS)) { -+ if (ao->mppe_stateless) { -+ if (wo->mppe_stateless) -+ ho->mppe_stateless = 1; -+ else { -+ newret = CONFNAK; -+ if (!dont_nak) -+ p[2] &= ~MPPE_STATELESS; -+ } -+ } else { -+ newret = CONFNAK; -+ if (!dont_nak) -+ p[2] &= ~MPPE_STATELESS; -+ } -+ } else { -+ if (wo->mppe_stateless && !dont_nak) { -+ wo->mppe_stateless = 0; -+ newret = CONFNAK; -+ p[2] |= MPPE_STATELESS; -+ } -+ } -+ -+ if ((p[5] & ~MPPE_MPPC) == (MPPE_40BIT|MPPE_56BIT|MPPE_128BIT)) { -+ newret = CONFNAK; -+ if (ao->mppe_128) { -+ ho->mppe_128 = 1; -+ p[5] &= ~(MPPE_40BIT|MPPE_56BIT); -+ BCOPY(p, opt_buf, CILEN_MPPE); -+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], -+ MPPE_MAX_KEY_LEN); -+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + -+ MPPE_MAX_KEY_LEN, 1) <= 0) { -+ ho->mppe_128 = 0; -+ p[5] |= (MPPE_40BIT|MPPE_56BIT); -+ p[5] &= ~MPPE_128BIT; -+ goto check_mppe_56_40; -+ } -+ goto check_mppe; -+ } -+ p[5] &= ~MPPE_128BIT; -+ goto check_mppe_56_40; -+ } -+ if ((p[5] & ~MPPE_MPPC) == (MPPE_56BIT|MPPE_128BIT)) { -+ newret = CONFNAK; -+ if (ao->mppe_128) { -+ ho->mppe_128 = 1; -+ p[5] &= ~MPPE_56BIT; -+ BCOPY(p, opt_buf, CILEN_MPPE); -+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], -+ MPPE_MAX_KEY_LEN); -+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + -+ MPPE_MAX_KEY_LEN, 1) <= 0) { -+ ho->mppe_128 = 0; -+ p[5] |= MPPE_56BIT; -+ p[5] &= ~MPPE_128BIT; -+ goto check_mppe_56; -+ } -+ goto check_mppe; -+ } -+ p[5] &= ~MPPE_128BIT; -+ goto check_mppe_56; -+ } -+ if ((p[5] & ~MPPE_MPPC) == (MPPE_40BIT|MPPE_128BIT)) { -+ newret = CONFNAK; -+ if (ao->mppe_128) { -+ ho->mppe_128 = 1; -+ p[5] &= ~MPPE_40BIT; -+ BCOPY(p, opt_buf, CILEN_MPPE); -+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], -+ MPPE_MAX_KEY_LEN); -+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + -+ MPPE_MAX_KEY_LEN, 1) <= 0) { -+ ho->mppe_128 = 0; -+ p[5] |= MPPE_40BIT; -+ p[5] &= ~MPPE_128BIT; -+ goto check_mppe_40; -+ } -+ goto check_mppe; -+ } -+ p[5] &= ~MPPE_128BIT; -+ goto check_mppe_40; -+ } -+ if ((p[5] & ~MPPE_MPPC) == MPPE_128BIT) { -+ if (ao->mppe_128) { -+ ho->mppe_128 = 1; -+ BCOPY(p, opt_buf, CILEN_MPPE); -+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], -+ MPPE_MAX_KEY_LEN); -+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + -+ MPPE_MAX_KEY_LEN, 1) <= 0) { -+ ho->mppe_128 = 0; -+ p[5] &= ~MPPE_128BIT; -+ newret = CONFNAK; -+ } -+ goto check_mppe; -+ } -+ p[5] &= ~MPPE_128BIT; -+ newret = CONFNAK; -+ goto check_mppe; -+ } -+ check_mppe_56_40: -+ if ((p[5] & ~MPPE_MPPC) == (MPPE_40BIT|MPPE_56BIT)) { -+ newret = CONFNAK; -+ if (ao->mppe_56) { -+ ho->mppe_56 = 1; -+ p[5] &= ~MPPE_40BIT; -+ BCOPY(p, opt_buf, CILEN_MPPE); -+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], -+ MPPE_MAX_KEY_LEN); -+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + -+ MPPE_MAX_KEY_LEN, 1) <= 0) { -+ ho->mppe_56 = 0; -+ p[5] |= MPPE_40BIT; -+ p[5] &= ~MPPE_56BIT; -+ newret = CONFNAK; -+ goto check_mppe_40; -+ } -+ goto check_mppe; -+ } -+ p[5] &= ~MPPE_56BIT; -+ goto check_mppe_40; -+ } -+ check_mppe_56: -+ if ((p[5] & ~MPPE_MPPC) == MPPE_56BIT) { -+ if (ao->mppe_56) { -+ ho->mppe_56 = 1; -+ BCOPY(p, opt_buf, CILEN_MPPE); -+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], -+ MPPE_MAX_KEY_LEN); -+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + -+ MPPE_MAX_KEY_LEN, 1) <= 0) { -+ ho->mppe_56 = 0; -+ p[5] &= ~MPPE_56BIT; -+ newret = CONFNAK; -+ } -+ goto check_mppe; -+ } -+ p[5] &= ~MPPE_56BIT; -+ newret = CONFNAK; -+ goto check_mppe; -+ } -+ check_mppe_40: -+ if ((p[5] & ~MPPE_MPPC) == MPPE_40BIT) { -+ if (ao->mppe_40) { -+ ho->mppe_40 = 1; -+ BCOPY(p, opt_buf, CILEN_MPPE); -+ BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], -+ MPPE_MAX_KEY_LEN); -+ if (ccp_test(f->unit, opt_buf, CILEN_MPPE + -+ MPPE_MAX_KEY_LEN, 1) <= 0) { -+ ho->mppe_40 = 0; -+ p[5] &= ~MPPE_40BIT; -+ newret = CONFNAK; -+ } -+ goto check_mppe; -+ } -+ p[5] &= ~MPPE_40BIT; -+ } -+ -+ check_mppe: -+ if (!ho->mppe_40 && !ho->mppe_56 && !ho->mppe_128) { -+ if (wo->mppe_40 || wo->mppe_56 || wo->mppe_128) { -+ newret = CONFNAK; -+ p[2] |= (wo->mppe_stateless ? MPPE_STATELESS : 0); -+ p[5] |= (wo->mppe_40 ? MPPE_40BIT : 0) | -+ (wo->mppe_56 ? MPPE_56BIT : 0) | -+ (wo->mppe_128 ? MPPE_128BIT : 0) | -+ (wo->mppc ? MPPE_MPPC : 0); -+ } else { -+ ho->mppe = ho->mppe_stateless = 0; -+ } - } else { -- /* Neither are set. */ -- /* We cannot accept this. */ -- newret = CONFNAK; -- /* Give the peer our idea of what can be used, -- so it can choose and confirm */ -- ho->mppe = ao->mppe; -- } -- -- /* rebuild the opts */ -- MPPE_OPTS_TO_CI(ho->mppe, &p[2]); -- if (newret == CONFACK) { -- u_char opt_buf[CILEN_MPPE + MPPE_MAX_KEY_LEN]; -- int mtu; -- -- BCOPY(p, opt_buf, CILEN_MPPE); -- BCOPY(mppe_send_key, &opt_buf[CILEN_MPPE], -- MPPE_MAX_KEY_LEN); -- if (ccp_test(f->unit, opt_buf, -- CILEN_MPPE + MPPE_MAX_KEY_LEN, 1) <= 0) { -- /* This shouldn't happen, we've already tested it! */ -- error("MPPE required, but kernel has no support."); -- lcp_close(f->unit, "MPPE required but not available"); -- newret = CONFREJ; -- break; -- } -- /* -- * We need to decrease the interface MTU by MPPE_PAD -- * because MPPE frames **grow**. The kernel [must] -- * allocate MPPE_PAD extra bytes in xmit buffers. -- */ -- mtu = netif_get_mtu(f->unit); -- if (mtu) -- netif_set_mtu(f->unit, mtu - MPPE_PAD); -- else -- newret = CONFREJ; -- } -- -- /* -- * We have accepted MPPE or are willing to negotiate -- * MPPE parameters. A CONFREJ is due to subsequent -- * (non-MPPE) processing. -- */ -- rej_for_ci_mppe = 0; -- break; --#endif /* MPPE */ -+ /* MPPE is not compatible with other compression types */ -+ if (wo->mppe) { -+ ao->bsd_compress = 0; -+ ao->predictor_1 = 0; -+ ao->predictor_2 = 0; -+ ao->deflate = 0; -+ ao->lzs = 0; -+ } -+ } -+ if ((!ho->mppc || !ao->mppc) && !ho->mppe) { -+ p[2] = p2; -+ p[5] = p5; -+ newret = CONFREJ; -+ break; -+ } -+ -+ /* -+ * I have commented the code below because according to RFC1547 -+ * MTU is only information for higher level protocols about -+ * "the maximum allowable length for a packet (q.v.) transmitted -+ * over a point-to-point link without incurring network layer -+ * fragmentation." Of course a PPP implementation should be able -+ * to handle overhead added by MPPE - in our case apropriate code -+ * is located in drivers/net/ppp_generic.c in the kernel sources. -+ * -+ * According to RFC1661: -+ * - when negotiated MRU is less than 1500 octets, a PPP -+ * implementation must still be able to receive at least 1500 -+ * octets, -+ * - when PFC is negotiated, a PPP implementation is still -+ * required to receive frames with uncompressed protocol field. -+ * -+ * So why not to handle MPPE overhead without changing MTU value? -+ * I am sure that RFC3078, unfortunately silently, assumes that. -+ */ -+ -+ /* -+ * We need to decrease the interface MTU by MPPE_PAD -+ * because MPPE frames **grow**. The kernel [must] -+ * allocate MPPE_PAD extra bytes in xmit buffers. -+ */ -+ /* -+ mtu = netif_get_mtu(f->unit); -+ if (mtu) { -+ netif_set_mtu(f->unit, mtu - MPPE_PAD); -+ } else { -+ newret = CONFREJ; -+ if (ccp_wantoptions[f->unit].mppe) { -+ error("Cannot adjust MTU needed by MPPE."); -+ lcp_close(f->unit, "Cannot adjust MTU needed by MPPE."); -+ } -+ } -+ */ -+ break; -+ #endif /* MPPE */ -+ -+ case CI_LZS: -+ if (!ao->lzs || clen != CILEN_LZS) { -+ newret = CONFREJ; -+ break; -+ } -+ -+ ho->lzs = 1; -+ ho->lzs_hists = (p[2] << 8) | p[3]; -+ ho->lzs_mode = p[4]; -+ if ((ho->lzs_hists != ao->lzs_hists) || -+ (ho->lzs_mode != ao->lzs_mode)) { -+ newret = CONFNAK; -+ if (!dont_nak) { -+ p[2] = ao->lzs_hists >> 8; -+ p[3] = ao->lzs_hists & 0xff; -+ p[4] = ao->lzs_mode; -+ } else -+ break; -+ } -+ -+ if (p == p0 && ccp_test(f->unit, p, CILEN_LZS, 1) <= 0) { -+ newret = CONFREJ; -+ } -+ break; - case CI_DEFLATE: - case CI_DEFLATE_DRAFT: - if (!ao->deflate || clen != CILEN_DEFLATE -@@ -1327,12 +1813,6 @@ ccp_reqci(fsm *f, u_char *p, int *lenp, - else - *lenp = retp - p0; - } --#ifdef MPPE -- if (ret == CONFREJ && ao->mppe && rej_for_ci_mppe) { -- error("MPPE required but peer negotiation failed"); -- lcp_close(f->unit, "MPPE required but peer negotiation failed"); -- } --#endif - return ret; - } - -@@ -1353,24 +1833,35 @@ method_name(ccp_options *opt, ccp_option - char *p = result; - char *q = result + sizeof(result); /* 1 past result */ - -- slprintf(p, q - p, "MPPE "); -- p += 5; -- if (opt->mppe & MPPE_OPT_128) { -- slprintf(p, q - p, "128-bit "); -- p += 8; -- } -- if (opt->mppe & MPPE_OPT_40) { -- slprintf(p, q - p, "40-bit "); -- p += 7; -- } -- if (opt->mppe & MPPE_OPT_STATEFUL) -- slprintf(p, q - p, "stateful"); -- else -- slprintf(p, q - p, "stateless"); -- -+ if (opt->mppe) { -+ if (opt->mppc) { -+ slprintf(p, q - p, "MPPC/MPPE "); -+ p += 10; -+ } else { -+ slprintf(p, q - p, "MPPE "); -+ p += 5; -+ } -+ if (opt->mppe_128) { -+ slprintf(p, q - p, "128-bit "); -+ p += 8; -+ } else if (opt->mppe_56) { -+ slprintf(p, q - p, "56-bit "); -+ p += 7; -+ } else if (opt->mppe_40) { -+ slprintf(p, q - p, "40-bit "); -+ p += 7; -+ } -+ if (opt->mppe_stateless) -+ slprintf(p, q - p, "stateless"); -+ else -+ slprintf(p, q - p, "stateful"); -+ } else if (opt->mppc) -+ slprintf(p, q - p, "MPPC"); - break; - } --#endif -+#endif /* MPPE */ -+ case CI_LZS: -+ return "Stac LZS"; - case CI_DEFLATE: - case CI_DEFLATE_DRAFT: - if (opt2 != NULL && opt2->deflate_size != opt->deflate_size) -@@ -1425,12 +1916,12 @@ ccp_up(fsm *f) - } else if (ANY_COMPRESS(*ho)) - notice("%s transmit compression enabled", method_name(ho, NULL)); - #ifdef MPPE -- if (go->mppe) { -+ if (go->mppe || go->mppc) { - BZERO(mppe_recv_key, MPPE_MAX_KEY_LEN); - BZERO(mppe_send_key, MPPE_MAX_KEY_LEN); - continue_networks(f->unit); /* Bring up IP et al */ - } --#endif -+#endif /* MPPE */ - } - - /* -@@ -1452,7 +1943,7 @@ ccp_down(fsm *f) - lcp_close(f->unit, "MPPE disabled"); - } - } --#endif -+#endif /* MPPE */ - } - - /* -@@ -1509,24 +2000,28 @@ ccp_printpkt(u_char *p, int plen, - #ifdef MPPE - case CI_MPPE: - if (optlen >= CILEN_MPPE) { -- u_char mppe_opts; -- -- MPPE_CI_TO_OPTS(&p[2], mppe_opts); -- printer(arg, "mppe %s %s %s %s %s %s%s", -- (p[2] & MPPE_H_BIT)? "+H": "-H", -- (p[5] & MPPE_M_BIT)? "+M": "-M", -- (p[5] & MPPE_S_BIT)? "+S": "-S", -- (p[5] & MPPE_L_BIT)? "+L": "-L", -+ printer(arg, "mppe %s %s %s %s %s %s", -+ (p[2] & MPPE_STATELESS)? "+H": "-H", -+ (p[5] & MPPE_56BIT)? "+M": "-M", -+ (p[5] & MPPE_128BIT)? "+S": "-S", -+ (p[5] & MPPE_40BIT)? "+L": "-L", - (p[5] & MPPE_D_BIT)? "+D": "-D", -- (p[5] & MPPE_C_BIT)? "+C": "-C", -- (mppe_opts & MPPE_OPT_UNKNOWN)? " +U": ""); -- if (mppe_opts & MPPE_OPT_UNKNOWN) -+ (p[5] & MPPE_MPPC)? "+C": "-C"); -+ if ((p[5] & ~(MPPE_56BIT | MPPE_128BIT | MPPE_40BIT | -+ MPPE_D_BIT | MPPE_MPPC)) || -+ (p[2] & ~MPPE_STATELESS)) - printer(arg, " (%.2x %.2x %.2x %.2x)", - p[2], p[3], p[4], p[5]); - p += CILEN_MPPE; - } - break; --#endif -+#endif /* MPPE */ -+ case CI_LZS: -+ if (optlen >= CILEN_LZS) { -+ printer(arg, "lzs %.2x %.2x %.2x", p[2], p[3], p[4]); -+ p += CILEN_LZS; -+ } -+ break; - case CI_DEFLATE: - case CI_DEFLATE_DRAFT: - if (optlen >= CILEN_DEFLATE) { -@@ -1609,6 +2104,7 @@ ccp_datainput(int unit, u_char *pkt, int - error("Lost compression sync: disabling compression"); - ccp_close(unit, "Lost compression sync"); - #ifdef MPPE -+ /* My module dosn't need this. J.D., 2003-07-06 */ - /* - * If we were doing MPPE, we must also take the link down. - */ -@@ -1616,9 +2112,18 @@ ccp_datainput(int unit, u_char *pkt, int - error("Too many MPPE errors, closing LCP"); - lcp_close(unit, "Too many MPPE errors"); - } --#endif -+#endif /* MPPE */ - } else { - /* -+ * When LZS or MPPE/MPPC is negotiated we just send CCP_RESETREQ -+ * and don't wait for CCP_RESETACK -+ */ -+ if ((ccp_gotoptions[f->unit].method == CI_LZS) || -+ (ccp_gotoptions[f->unit].method == CI_MPPE)) { -+ fsm_sdata(f, CCP_RESETREQ, f->reqid = ++f->id, NULL, 0); -+ return; -+ } -+ /* - * Send a reset-request to reset the peer's compressor. - * We don't do that if we are still waiting for an - * acknowledgement to a previous reset-request. ---- a/pppd/ccp.h -+++ b/pppd/ccp.h -@@ -37,9 +37,17 @@ typedef struct ccp_options { - bool predictor_2; /* do Predictor-2? */ - bool deflate_correct; /* use correct code for deflate? */ - bool deflate_draft; /* use draft RFC code for deflate? */ -+ bool lzs; /* do Stac LZS? */ -+ bool mppc; /* do MPPC? */ - u_char mppe; /* MPPE bitfield */ -+ bool mppe_40; /* allow 40 bit encryption? */ -+ bool mppe_56; /* allow 56 bit encryption? */ -+ bool mppe_128; /* allow 128 bit encryption? */ -+ bool mppe_stateless; /* allow stateless encryption */ - u_short bsd_bits; /* # bits/code for BSD Compress */ - u_short deflate_size; /* lg(window size) for Deflate */ -+ u_short lzs_mode; /* LZS check mode */ -+ u_short lzs_hists; /* number of LZS histories */ - short method; /* code for chosen compression method */ - } ccp_options; - ---- a/pppd/chap_ms.c -+++ b/pppd/chap_ms.c -@@ -964,13 +964,17 @@ set_mppe_enc_types(int policy, int types - /* - * Disable undesirable encryption types. Note that we don't ENABLE - * any encryption types, to avoid overriding manual configuration. -+ * -+ * It seems that 56 bit keys are unsupported in MS-RADIUS (see RFC 2548) - */ - switch(types) { - case MPPE_ENC_TYPES_RC4_40: -- ccp_wantoptions[0].mppe &= ~MPPE_OPT_128; /* disable 128-bit */ -+ ccp_wantoptions[0].mppe_128 = 0; /* disable 128-bit */ -+ ccp_wantoptions[0].mppe_56 = 0; /* disable 56-bit */ - break; - case MPPE_ENC_TYPES_RC4_128: -- ccp_wantoptions[0].mppe &= ~MPPE_OPT_40; /* disable 40-bit */ -+ ccp_wantoptions[0].mppe_56 = 0; /* disable 56-bit */ -+ ccp_wantoptions[0].mppe_40 = 0; /* disable 40-bit */ - break; - default: - break; diff --git a/package/network/services/ppp/patches/203-opt_flags.patch b/package/network/services/ppp/patches/203-opt_flags.patch deleted file mode 100644 index 705959e7ba2..00000000000 --- a/package/network/services/ppp/patches/203-opt_flags.patch +++ /dev/null @@ -1,38 +0,0 @@ -build: Move optimization flags into a separate variable - -Isolate optimization related compiler flags from CFLAGS and move them into a -separate COPTS variable so that it is easier to override optimizations from -the environment. - -Signed-off-by: Jo-Philipp Wich - ---- a/pppd/plugins/radius/Makefile.linux -+++ b/pppd/plugins/radius/Makefile.linux -@@ -47,13 +47,13 @@ install: all - $(INSTALL) -c -m 444 pppd-radattr.8 $(MANDIR) - - radius.so: radius.o libradiusclient.a -- $(CC) $(LDFLAGS) -o radius.so -shared radius.o libradiusclient.a -+ $(CC) $(LDFLAGS) -fPIC -o radius.so -shared radius.o libradiusclient.a - - radattr.so: radattr.o -- $(CC) $(LDFLAGS) -o radattr.so -shared radattr.o -+ $(CC) $(LDFLAGS) -fPIC -o radattr.so -shared radattr.o - - radrealms.so: radrealms.o -- $(CC) $(LDFLAGS) -o radrealms.so -shared radrealms.o -+ $(CC) $(LDFLAGS) -fPIC -o radrealms.so -shared radrealms.o - - CLIENTOBJS = avpair.o buildreq.o config.o dict.o ip_util.o \ - clientid.o sendserver.o lock.o util.o md5.o ---- a/pppd/plugins/pppoe/Makefile.linux -+++ b/pppd/plugins/pppoe/Makefile.linux -@@ -38,7 +38,7 @@ debug.o: debug.c - $(CC) $(CFLAGS) -I../../.. -c -o debug.o debug.c - - pppoe.so: plugin.o discovery.o if.o common.o -- $(CC) $(LDFLAGS) -o pppoe.so -shared plugin.o discovery.o if.o common.o -+ $(CC) $(LDFLAGS) -fPIC -o pppoe.so -shared plugin.o discovery.o if.o common.o - - install: all - $(INSTALL) -d -m 755 $(LIBDIR) diff --git a/package/network/services/ppp/patches/204-radius_config.patch b/package/network/services/ppp/patches/204-radius_config.patch index 2f30b9d3dcd..3f6db59b710 100644 --- a/package/network/services/ppp/patches/204-radius_config.patch +++ b/package/network/services/ppp/patches/204-radius_config.patch @@ -1,6 +1,6 @@ --- a/pppd/plugins/radius/config.c +++ b/pppd/plugins/radius/config.c -@@ -371,31 +371,37 @@ static int test_config(char *filename) +@@ -381,31 +381,37 @@ static int test_config(char *filename) } #endif diff --git a/package/network/services/ppp/patches/205-no_exponential_timeout.patch b/package/network/services/ppp/patches/205-no_exponential_timeout.patch deleted file mode 100644 index b08c2eff891..00000000000 --- a/package/network/services/ppp/patches/205-no_exponential_timeout.patch +++ /dev/null @@ -1,29 +0,0 @@ -pppd: Don't use exponential timeout in discovery phase - -This patch removes the exponential timeout increase between PADO or PADS -discovery attempts. - -Signed-off-by: Jo-Philipp Wich - ---- a/pppd/plugins/pppoe/discovery.c -+++ b/pppd/plugins/pppoe/discovery.c -@@ -632,7 +632,9 @@ discovery(PPPoEConnection *conn) - conn->discoveryState = STATE_SENT_PADI; - waitForPADO(conn, timeout); - -+#if 0 - timeout *= 2; -+#endif - } while (conn->discoveryState == STATE_SENT_PADI); - - timeout = conn->discoveryTimeout; -@@ -647,7 +649,9 @@ discovery(PPPoEConnection *conn) - sendPADR(conn); - conn->discoveryState = STATE_SENT_PADR; - waitForPADS(conn, timeout); -+#if 0 - timeout *= 2; -+#endif - } while (conn->discoveryState == STATE_SENT_PADR); - - if (!conn->seenMaxPayload) { diff --git a/package/network/services/ppp/patches/207-lcp_mtu_max.patch b/package/network/services/ppp/patches/207-lcp_mtu_max.patch index 522576c6272..3ca0534f360 100644 --- a/package/network/services/ppp/patches/207-lcp_mtu_max.patch +++ b/package/network/services/ppp/patches/207-lcp_mtu_max.patch @@ -8,18 +8,18 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/lcp.c +++ b/pppd/lcp.c -@@ -1862,12 +1862,12 @@ lcp_up(fsm *f) +@@ -1888,12 +1888,12 @@ lcp_up(fsm *f) * the interface MTU is set to the lowest of that, the * MTU we want to use, and our link MRU. */ - mtu = ho->neg_mru? ho->mru: PPP_MRU; + mtu = MIN(ho->neg_mru? ho->mru: PPP_MRU, ao->mru); mru = go->neg_mru? MAX(wo->mru, go->mru): PPP_MRU; - #ifdef HAVE_MULTILINK + #ifdef PPP_WITH_MULTILINK if (!(multilink && go->neg_mrru && ho->neg_mrru)) - #endif /* HAVE_MULTILINK */ -- netif_set_mtu(f->unit, MIN(MIN(mtu, mru), ao->mru)); -+ netif_set_mtu(f->unit, MIN(mtu, mru)); + #endif /* PPP_WITH_MULTILINK */ +- ppp_set_mtu(f->unit, MIN(MIN(mtu, mru), ao->mru)); ++ ppp_set_mtu(f->unit, MIN(mtu, mru)); ppp_send_config(f->unit, mtu, (ho->neg_asyncmap? ho->asyncmap: 0xffffffff), ho->neg_pcompression, ho->neg_accompression); diff --git a/package/network/services/ppp/patches/208-fix_status_code.patch b/package/network/services/ppp/patches/208-fix_status_code.patch index 1d991e79490..10cd9453742 100644 --- a/package/network/services/ppp/patches/208-fix_status_code.patch +++ b/package/network/services/ppp/patches/208-fix_status_code.patch @@ -12,13 +12,13 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/main.c +++ b/pppd/main.c -@@ -1035,7 +1035,8 @@ get_input(void) +@@ -1152,7 +1152,8 @@ get_input(void) } notice("Modem hangup"); hungup = 1; -- status = EXIT_HANGUP; -+ if (status == EXIT_OK) -+ status = EXIT_HANGUP; +- code = EXIT_HANGUP; ++ if (code == EXIT_OK) ++ code = EXIT_HANGUP; lcp_lowerdown(0); /* serial link is no longer available */ link_terminated(0); return; diff --git a/package/network/services/ppp/patches/300-filter-pcap-includes-lib.patch b/package/network/services/ppp/patches/300-filter-pcap-includes-lib.patch deleted file mode 100644 index 87e340b3f11..00000000000 --- a/package/network/services/ppp/patches/300-filter-pcap-includes-lib.patch +++ /dev/null @@ -1,20 +0,0 @@ -build: Add required CFLAGS for libpcap - -This patch adds some flags to required to properly link libpcap within the -OpenWrt environment. - -Signed-off-by: Jo-Philipp Wich - ---- a/pppd/Makefile.linux -+++ b/pppd/Makefile.linux -@@ -210,8 +210,8 @@ LIBS += -ldl - endif - - ifdef FILTER --LIBS += -lpcap --CFLAGS += -DPPP_FILTER -+LIBS += -lpcap -L$(STAGING_DIR)/usr/lib -+CFLAGS += -DPPP_FILTER -I$(STAGING_DIR)/usr/include - endif - - ifdef HAVE_INET6 diff --git a/package/network/services/ppp/patches/310-precompile_filter.patch b/package/network/services/ppp/patches/310-precompile_filter.patch index ca91d153e9b..ad0dd03de8e 100644 --- a/package/network/services/ppp/patches/310-precompile_filter.patch +++ b/package/network/services/ppp/patches/310-precompile_filter.patch @@ -11,62 +11,70 @@ packets which are treated as active. Signed-off-by: Jo-Philipp Wich ---- a/pppd/Makefile.linux -+++ b/pppd/Makefile.linux -@@ -51,6 +51,9 @@ MPPE=y - # and that the kernel driver support PPP packet filtering. - #FILTER=y +--- a/configure.ac ++++ b/configure.ac +@@ -306,6 +306,9 @@ AM_CONDITIONAL(PPP_WITH_PAM, test "x${wi + # With libpcap support, activate pppd on network activity + AX_CHECK_PCAP -+# Support for precompiled filters -+PRECOMPILED_FILTER=y ++# internal statically linked pcap ++AM_CONDITIONAL(PPP_WITH_PRECOMPILED_FILTER, test "x${with_static_pcap}" = "xyes") + - # Uncomment the next line to enable multilink PPP (enabled by default) - # Linux distributions: Please leave multilink ENABLED in your builds - # of pppd! -@@ -214,6 +217,14 @@ LIBS += -lpcap -L$(STAGING_DIR)/usr/l - CFLAGS += -DPPP_FILTER -I$(STAGING_DIR)/usr/include + # + # SunOS provides a version of libpcap that would work, but SunOS has no support for activity filter + AM_CONDITIONAL([PPP_WITH_FILTER], [ test "x${with_pcap}" = "xyes" && test "x${build_sunos}" != "xyes" ]) +@@ -359,6 +362,7 @@ $PACKAGE_NAME version $PACKAGE_VERSION + With libatm..........: ${with_atm:-no} + With libpam..........: ${with_pam:-no} + With libpcap.........: ${with_pcap:-no} ++ With static libpcap..: ${with_static_pcap:-no} + With libsrp..........: ${with_srp:-no} + C Compiler...........: $CC $CFLAGS + Linker...............: $LD $LDFLAGS $LIBS +--- a/pppd/Makefile.am ++++ b/pppd/Makefile.am +@@ -138,6 +138,12 @@ pppd_LDFLAGS += $(PCAP_LDFLAGS) + pppd_LIBS += $(PCAP_LIBS) endif -+ifdef PRECOMPILED_FILTER -+PPPDSRCS += pcap_pcc.c -+HEADERS += pcap_pcc.h -+PPPDOBJS += pcap_pcc.o -+LIBS += $(STAGING_DIR)/usr/lib/libpcap.a -+CFLAGS += -DPPP_FILTER -DPPP_PRECOMPILED_FILTER -I$(STAGING_DIR)/usr/include ++if PPP_WITH_PRECOMPILED_FILTER ++pppd_SOURCES += pcap_pcc.c ++pppd_include_HEADERS += pcap_pcc.h ++pppd_LIBS += $(STAGING_DIR)/usr/lib/libpcap.a +endif + - ifdef HAVE_INET6 - PPPDSRCS += ipv6cp.c eui64.c - HEADERS += ipv6cp.h eui64.h + if PPP_WITH_PLUGINS + pppd_CPPFLAGS += -DPPPD_PLUGIN_DIR='"@PPPD_PLUGIN_DIR@"' + pppd_LIBS += -ldl --- a/pppd/options.c +++ b/pppd/options.c -@@ -56,6 +56,7 @@ +@@ -62,6 +62,7 @@ - #ifdef PPP_FILTER + #ifdef PPP_WITH_FILTER #include +#include /* * There have been 3 or 4 different names for this in libpcap CVS, but * this seems to be what they have settled on... -@@ -168,6 +169,13 @@ static int setlogfile(char **); +@@ -182,6 +183,13 @@ static int setlogfile(char **); static int loadplugin(char **); #endif -+#ifdef PPP_PRECOMPILED_FILTER ++#ifdef PPP_WITH_PRECOMPILED_FILTER +#include "pcap_pcc.h" +static int setprecompiledpassfilter(char **); +static int setprecompiledactivefilter(char **); -+#undef PPP_FILTER ++#undef PPP_WITH_FILTER +#endif + - #ifdef PPP_FILTER + #ifdef PPP_WITH_FILTER static int setpassfilter(char **); static int setactivefilter(char **); -@@ -360,6 +368,14 @@ option_t general_options[] = { +@@ -391,6 +399,14 @@ struct option general_options[] = { "set filter for active pkts", OPT_PRIO }, #endif -+#ifdef PPP_PRECOMPILED_FILTER ++#ifdef PPP_WITH_PRECOMPILED_FILTER + { "precompiled-pass-filter", 1, setprecompiledpassfilter, + "set precompiled filter for packets to pass", OPT_PRIO }, + @@ -74,14 +82,14 @@ Signed-off-by: Jo-Philipp Wich + "set precompiled filter for active pkts", OPT_PRIO }, +#endif + - #ifdef MAXOCTETS { "maxoctets", o_int, &maxoctets, "Set connection traffic limit", -@@ -1468,6 +1484,27 @@ callfile(char **argv) + OPT_PRIO | OPT_LLIMIT | OPT_NOINCR | OPT_ZEROINF }, +@@ -1666,6 +1682,27 @@ callfile(char **argv) return ok; } -+#ifdef PPP_PRECOMPILED_FILTER ++#ifdef PPP_WITH_PRECOMPILED_FILTER +/* + * setprecompiledpassfilter - Set the pass filter for packets using a + * precompiled expression @@ -102,18 +110,19 @@ Signed-off-by: Jo-Philipp Wich +} +#endif + - #ifdef PPP_FILTER + #ifdef PPP_WITH_FILTER /* * setpassfilter - Set the pass filter for packets --- /dev/null +++ b/pppd/pcap_pcc.c -@@ -0,0 +1,74 @@ +@@ -0,0 +1,75 @@ +#include +#include +#include +#include +#include +#include ++#include "options.h" +#include "pppd.h" + +int pcap_pre_compiled (char * fname, struct bpf_program *p) @@ -123,7 +132,7 @@ Signed-off-by: Jo-Philipp Wich + FILE *f = fopen (fname, "r"); + if (!f) + { -+ option_error("error opening precompiled active-filter '%s': %s", ++ ppp_option_error("error opening precompiled active-filter '%s': %s", + fname, strerror (errno)); + return 0; + } @@ -167,18 +176,18 @@ Signed-off-by: Jo-Philipp Wich + } + if (size != index) + { -+ option_error("error in precompiled active-filter," -+ " expected %d expressions, got %dn", -+ size, index); ++ ppp_option_error("error in precompiled active-filter," ++ " expected %d expressions, got %dn", ++ size, index); + ret = 0; + } + fclose(f); + return ret; + +err: -+ option_error("error in precompiled active-filter" -+ " expression line %s:%d (wrong size)\n", -+ fname, line); ++ ppp_option_error("error in precompiled active-filter" ++ " expression line %s:%d (wrong size)\n", ++ fname, line); + fclose (f); + return 0; +} diff --git a/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch b/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch index 0ae84ae1ed9..a761ca650d6 100644 --- a/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch +++ b/package/network/services/ppp/patches/321-multilink_support_custom_iface_names.patch @@ -8,15 +8,15 @@ Signed-off-by: George Kashperko 2 files changed, 53 insertions(+), 14 deletions(-) --- a/pppd/multilink.c +++ b/pppd/multilink.c -@@ -35,6 +35,7 @@ +@@ -40,6 +40,7 @@ #include #include #include +#include - #include "pppd.h" + #include "pppd-private.h" #include "fsm.h" -@@ -56,7 +57,8 @@ static void iterate_bundle_links(void (* +@@ -62,7 +63,8 @@ static void iterate_bundle_links(void (* static int get_default_epdisc(struct epdisc *); static int parse_num(char *str, const char *key, int *valp); @@ -26,7 +26,7 @@ Signed-off-by: George Kashperko #define set_ip_epdisc(ep, addr) do { \ ep->length = 4; \ -@@ -197,35 +199,38 @@ mp_join_bundle(void) +@@ -215,35 +217,38 @@ mp_join_bundle(void) key.dptr = bundle_id; key.dsize = p - bundle_id; pid = tdb_fetch(pppdb, key); @@ -61,7 +61,7 @@ Signed-off-by: George Kashperko - if (bundle_attach(unit)) { + if (unit >= 0 && bundle_attach(unit)) { set_ifunit(0); - script_setenv("BUNDLE", bundle_id + 7, 0); + ppp_script_setenv("BUNDLE", bundle_id + 7, 0); make_bundle_links(1); unlock_db(); - info("Link attached to %s", ifname); @@ -73,7 +73,7 @@ Signed-off-by: George Kashperko } /* we have to make a new bundle */ -@@ -405,20 +410,39 @@ parse_num(char *str, const char *key, in +@@ -423,20 +428,39 @@ parse_num(char *str, const char *key, in return 0; } @@ -119,7 +119,7 @@ Signed-off-by: George Kashperko && memcmp(vd.dptr, key.dptr, vd.dsize) == 0; --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -923,6 +923,16 @@ void cfg_bundle(int mrru, int mtru, int +@@ -984,6 +984,16 @@ void cfg_bundle(int mrru, int mtru, int add_fd(ppp_dev_fd); } @@ -129,14 +129,14 @@ Signed-off-by: George Kashperko +#ifdef USE_TDB + char tmp[11]; + slprintf(tmp, sizeof(tmp), "%d", ifunit); -+ script_setenv("IFUNIT", tmp, 0); ++ ppp_script_setenv("IFUNIT", tmp, 0); +#endif +} + /* * make_new_bundle - create a new PPP unit (i.e. a bundle) * and connect our channel to it. This should only get called -@@ -941,6 +951,8 @@ void make_new_bundle(int mrru, int mtru, +@@ -1002,6 +1012,8 @@ void make_new_bundle(int mrru, int mtru, /* set the mrru and flags */ cfg_bundle(mrru, mtru, rssn, tssn); diff --git a/package/network/services/ppp/patches/330-retain_foreign_default_routes.patch b/package/network/services/ppp/patches/330-retain_foreign_default_routes.patch deleted file mode 100644 index 3d2a815dbd9..00000000000 --- a/package/network/services/ppp/patches/330-retain_foreign_default_routes.patch +++ /dev/null @@ -1,22 +0,0 @@ -pppd: Retain foreign default routes on Linux - -On Linux, when pppd attempts to delete its default route it does not fill -the rt_dev field of the struct rtentry used to match the system default route. -As a consequence, pppd happily deletes any default route even if it belongs -to another interface. - -This patch makes pppd fill out the rt_dev field so that only own default -routes are ever matched. - -Signed-off-by: Jo-Philipp Wich - ---- a/pppd/sys-linux.c -+++ b/pppd/sys-linux.c -@@ -2248,6 +2248,7 @@ int cifdefaultroute (int unit, u_int32_t - SIN_ADDR(rt.rt_genmask) = 0L; - } - -+ rt.rt_dev = ifname; - rt.rt_flags = RTF_UP; - if (ioctl(sock_fd, SIOCDELRT, &rt) < 0 && errno != ESRCH) { - if (still_ppp()) { diff --git a/package/network/services/ppp/patches/340-populate_default_gateway.patch b/package/network/services/ppp/patches/340-populate_default_gateway.patch index 64d03fb5c47..f3279713469 100644 --- a/package/network/services/ppp/patches/340-populate_default_gateway.patch +++ b/package/network/services/ppp/patches/340-populate_default_gateway.patch @@ -13,7 +13,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -2198,6 +2198,9 @@ int sifdefaultroute (int unit, u_int32_t +@@ -2251,6 +2251,9 @@ int sifdefaultroute (int unit, u_int32_t memset (&rt, 0, sizeof (rt)); SET_SA_FAMILY (rt.rt_dst, AF_INET); @@ -23,7 +23,7 @@ Signed-off-by: Jo-Philipp Wich rt.rt_dev = ifname; rt.rt_metric = dfl_route_metric + 1; /* +1 for binary compatibility */ -@@ -2206,7 +2209,7 @@ int sifdefaultroute (int unit, u_int32_t +@@ -2259,7 +2262,7 @@ int sifdefaultroute (int unit, u_int32_t SIN_ADDR(rt.rt_genmask) = 0L; } diff --git a/package/network/services/ppp/patches/400-simplify_kernel_checks.patch b/package/network/services/ppp/patches/400-simplify_kernel_checks.patch index 9d0ea9a0b84..137937c2448 100644 --- a/package/network/services/ppp/patches/400-simplify_kernel_checks.patch +++ b/package/network/services/ppp/patches/400-simplify_kernel_checks.patch @@ -10,7 +10,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c -@@ -235,7 +235,7 @@ static int driver_is_old = 0; +@@ -231,7 +231,7 @@ static int driver_is_old = 0; static int restore_term = 0; /* 1 => we've munged the terminal */ static struct termios inittermios; /* Initial TTY termios */ @@ -19,7 +19,7 @@ Signed-off-by: Jo-Philipp Wich static char loop_name[20]; static unsigned char inbuf[512]; /* buffer for chars read from loopback */ -@@ -254,8 +254,8 @@ static int looped; /* 1 if using loop +@@ -250,8 +250,8 @@ static int looped; /* 1 if using loop static int link_mtu; /* mtu for the link (not bundle) */ static struct utsname utsname; /* for the kernel version */ @@ -29,7 +29,7 @@ Signed-off-by: Jo-Philipp Wich #define MAX_IFS 100 -@@ -1933,11 +1933,12 @@ int ccp_fatal_error (int unit) +@@ -1970,11 +1970,12 @@ int ccp_fatal_error (int unit) * * path_to_procfs - find the path to the proc file system mount point */ @@ -44,7 +44,7 @@ Signed-off-by: Jo-Philipp Wich struct mntent *mntent; FILE *fp; -@@ -1959,6 +1960,7 @@ static char *path_to_procfs(const char * +@@ -1996,6 +1997,7 @@ static char *path_to_procfs(const char * fclose (fp); } } @@ -52,7 +52,7 @@ Signed-off-by: Jo-Philipp Wich strlcpy(proc_path + proc_path_len, tail, sizeof(proc_path) - proc_path_len); -@@ -2843,15 +2845,19 @@ int ppp_available(void) +@@ -2895,15 +2897,19 @@ int ppp_check_kernel_support(void) int my_version, my_modification, my_patch; int osmaj, osmin, ospatch; @@ -72,7 +72,7 @@ Signed-off-by: Jo-Philipp Wich /* XXX should get from driver */ driver_version = 2; -@@ -2911,6 +2917,7 @@ int ppp_available(void) +@@ -2963,6 +2969,7 @@ int ppp_check_kernel_support(void) if (ok && ((ifr.ifr_hwaddr.sa_family & ~0xFF) != ARPHRD_PPP)) ok = 0; @@ -80,7 +80,7 @@ Signed-off-by: Jo-Philipp Wich /* * This is the PPP device. Validate the version of the driver at this -@@ -3592,6 +3599,7 @@ get_pty(int *master_fdp, int *slave_fdp, +@@ -3577,6 +3584,7 @@ get_pty(int *master_fdp, int *slave_fdp, } #endif /* TIOCGPTN */ @@ -88,7 +88,7 @@ Signed-off-by: Jo-Philipp Wich if (sfd < 0) { /* the old way - scan through the pty name space */ for (i = 0; i < 64; ++i) { -@@ -3610,6 +3618,7 @@ get_pty(int *master_fdp, int *slave_fdp, +@@ -3601,6 +3609,7 @@ get_pty(int *master_fdp, int *slave_fdp, } } } @@ -98,26 +98,26 @@ Signed-off-by: Jo-Philipp Wich return 0; --- a/pppd/plugins/pppoatm/pppoatm.c +++ b/pppd/plugins/pppoatm/pppoatm.c -@@ -171,14 +171,6 @@ static void disconnect_pppoatm(void) +@@ -179,14 +179,6 @@ static void disconnect_pppoatm(void) void plugin_init(void) { -#ifdef linux - extern int new_style_driver; /* From sys-linux.c */ -- if (!ppp_available() && !new_style_driver) +- if (!ppp_check_kernel_support() && !new_style_driver) - fatal("Kernel doesn't support ppp_generic - " - "needed for PPPoATM"); -#else - fatal("No PPPoATM support on this OS"); -#endif - add_options(pppoa_options); + ppp_add_options(pppoa_options); } --- a/pppd/plugins/pppoe/plugin.c +++ b/pppd/plugins/pppoe/plugin.c -@@ -58,9 +58,6 @@ static char const RCSID[] = +@@ -57,9 +57,6 @@ static char const RCSID[] = - char pppd_version[] = VERSION; + char pppd_version[] = PPPD_VERSION; -/* From sys-linux.c in pppd -- MUST FIX THIS! */ -extern int new_style_driver; @@ -125,30 +125,30 @@ Signed-off-by: Jo-Philipp Wich char *pppd_pppoe_service = NULL; static char *acName = NULL; static char *existingSession = NULL; -@@ -407,10 +404,6 @@ PPPoEDevnameHook(char *cmd, char **argv, +@@ -421,10 +418,6 @@ PPPoEDevnameHook(char *cmd, char **argv, void plugin_init(void) { -- if (!ppp_available() && !new_style_driver) { +- if (!ppp_check_kernel_support() && !new_style_driver) { - fatal("Linux kernel does not support PPPoE -- are you running 2.4.x?"); - } - - add_options(Options); + ppp_add_options(Options); - info("PPPoE plugin from pppd %s", VERSION); + info("PPPoE plugin from pppd %s", PPPD_VERSION); --- a/pppd/plugins/pppol2tp/pppol2tp.c +++ b/pppd/plugins/pppol2tp/pppol2tp.c -@@ -490,12 +490,7 @@ static void pppol2tp_cleanup(void) +@@ -500,12 +500,7 @@ static void pppol2tp_cleanup(void) void plugin_init(void) { -#if defined(__linux__) - extern int new_style_driver; /* From sys-linux.c */ -- if (!ppp_available() && !new_style_driver) +- if (!ppp_check_kernel_support() && !new_style_driver) - fatal("Kernel doesn't support ppp_generic - " - "needed for PPPoL2TP"); -#else +#if !defined(__linux__) fatal("No PPPoL2TP support on this OS"); #endif - add_options(pppol2tp_options); + ppp_add_options(pppol2tp_options); diff --git a/package/network/services/ppp/patches/401-no_record_file.patch b/package/network/services/ppp/patches/401-no_record_file.patch index 0304f36fe2b..5ef1a178d70 100644 --- a/package/network/services/ppp/patches/401-no_record_file.patch +++ b/package/network/services/ppp/patches/401-no_record_file.patch @@ -5,19 +5,19 @@ information to the permanent storage, therfore remove this option. Signed-off-by: Jo-Philipp Wich ---- a/pppd/pppd.h -+++ b/pppd/pppd.h -@@ -318,7 +318,6 @@ extern int holdoff; /* Dead time before +--- a/pppd/pppd-private.h ++++ b/pppd/pppd-private.h +@@ -187,7 +187,6 @@ extern int holdoff; /* Dead time before extern bool holdoff_specified; /* true if user gave a holdoff value */ extern bool notty; /* Stdin/out is not a tty */ extern char *pty_socket; /* Socket to connect to pty */ -extern char *record_file; /* File to record chars sent/received */ - extern bool sync_serial; /* Device is synchronous serial device */ extern int maxfail; /* Max # of unsuccessful connection attempts */ - extern char linkname[MAXPATHLEN]; /* logical name for link */ + extern char linkname[]; /* logical name for link */ + extern bool tune_kernel; /* May alter kernel settings as necessary */ --- a/pppd/tty.c +++ b/pppd/tty.c -@@ -143,7 +143,7 @@ char *disconnect_script = NULL; /* Scrip +@@ -150,7 +150,7 @@ char *disconnect_script = NULL; /* Scrip char *welcomer = NULL; /* Script to run after phys link estab. */ char *ptycommand = NULL; /* Command to run on other side of pty */ bool notty = 0; /* Stdin/out is not a tty */ @@ -26,7 +26,7 @@ Signed-off-by: Jo-Philipp Wich int max_data_rate; /* max bytes/sec through charshunt */ bool sync_serial = 0; /* Device is synchronous serial device */ char *pty_socket = NULL; /* Socket to connect to pty */ -@@ -199,8 +199,10 @@ option_t tty_options[] = { +@@ -206,8 +206,10 @@ static struct option tty_options[] = { "Send and receive over socket, arg is host:port", OPT_PRIO | OPT_DEVNAM }, diff --git a/package/network/services/ppp/patches/403-no_wtmp.patch b/package/network/services/ppp/patches/403-no_wtmp.patch deleted file mode 100644 index 90c2a8208a5..00000000000 --- a/package/network/services/ppp/patches/403-no_wtmp.patch +++ /dev/null @@ -1,25 +0,0 @@ -pppd: Disable wtmp support - -Many uClibc based environments lack wtmp and utmp support, therfore remove -the code updating the wtmp information. - -Signed-off-by: Jo-Philipp Wich - ---- a/pppd/sys-linux.c -+++ b/pppd/sys-linux.c -@@ -2981,6 +2981,7 @@ int ppp_available(void) - - void logwtmp (const char *line, const char *name, const char *host) - { -+#if 0 - struct utmp ut, *utp; - pid_t mypid = getpid(); - #if __GLIBC__ < 2 -@@ -3046,6 +3047,7 @@ void logwtmp (const char *line, const ch - close (wtmp); - } - #endif -+#endif - } - #endif /* HAVE_LOGWTMP */ - diff --git a/package/network/services/ppp/patches/404-remove_obsolete_protocol_names.patch b/package/network/services/ppp/patches/404-remove_obsolete_protocol_names.patch index 8bed425a5b3..6b2d15ed256 100644 --- a/package/network/services/ppp/patches/404-remove_obsolete_protocol_names.patch +++ b/package/network/services/ppp/patches/404-remove_obsolete_protocol_names.patch @@ -7,7 +7,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/main.c +++ b/pppd/main.c -@@ -867,14 +867,17 @@ struct protocol_list { +@@ -984,14 +984,17 @@ struct protocol_list { const char *name; } protocol_list[] = { { 0x21, "IP" }, @@ -25,7 +25,7 @@ Signed-off-by: Jo-Philipp Wich { 0x33, "Stream Protocol ST-II" }, { 0x35, "Banyan Vines" }, { 0x39, "AppleTalk EDDP" }, -@@ -888,8 +891,11 @@ struct protocol_list { +@@ -1005,8 +1008,11 @@ struct protocol_list { { 0x49, "Serial Data Transport Protocol (PPP-SDTP)" }, { 0x4b, "SNA over 802.2" }, { 0x4d, "SNA" }, @@ -37,7 +37,7 @@ Signed-off-by: Jo-Philipp Wich { 0x53, "Encryption" }, { 0x55, "Individual Link Encryption" }, { 0x57, "IPv6" }, -@@ -900,12 +906,15 @@ struct protocol_list { +@@ -1017,12 +1023,15 @@ struct protocol_list { { 0x65, "RTP IPHC Compressed non-TCP" }, { 0x67, "RTP IPHC Compressed UDP 8" }, { 0x69, "RTP IPHC Compressed RTP 8" }, @@ -53,7 +53,7 @@ Signed-off-by: Jo-Philipp Wich { 0x0203, "IBM Source Routing BPDU" }, { 0x0205, "DEC LANBridge100 Spanning Tree" }, { 0x0207, "Cisco Discovery Protocol" }, -@@ -917,15 +926,19 @@ struct protocol_list { +@@ -1034,15 +1043,19 @@ struct protocol_list { { 0x0231, "Luxcom" }, { 0x0233, "Sigma Network Systems" }, { 0x0235, "Apple Client Server Protocol" }, @@ -73,7 +73,7 @@ Signed-off-by: Jo-Philipp Wich { 0x4001, "Cray Communications Control Protocol" }, { 0x4003, "CDPD Mobile Network Registration Protocol" }, { 0x4005, "Expand accelerator protocol" }, -@@ -936,8 +949,10 @@ struct protocol_list { +@@ -1053,8 +1066,10 @@ struct protocol_list { { 0x4023, "RefTek Protocol" }, { 0x4025, "Fibre Channel" }, { 0x4027, "EMIT Protocols" }, @@ -84,7 +84,7 @@ Signed-off-by: Jo-Philipp Wich { 0x8023, "OSI Network Layer Control Protocol" }, { 0x8025, "Xerox NS IDP Control Protocol" }, { 0x8027, "DECnet Phase IV Control Protocol" }, -@@ -946,7 +961,9 @@ struct protocol_list { +@@ -1063,7 +1078,9 @@ struct protocol_list { { 0x8031, "Bridging NCP" }, { 0x8033, "Stream Protocol Control Protocol" }, { 0x8035, "Banyan Vines Control Protocol" }, @@ -94,7 +94,7 @@ Signed-off-by: Jo-Philipp Wich { 0x803f, "NETBIOS Framing Control Protocol" }, { 0x8041, "Cisco Systems Control Protocol" }, { 0x8043, "Ascom Timeplex" }, -@@ -955,18 +972,24 @@ struct protocol_list { +@@ -1072,18 +1089,24 @@ struct protocol_list { { 0x8049, "Serial Data Control Protocol (PPP-SDCP)" }, { 0x804b, "SNA over 802.2 Control Protocol" }, { 0x804d, "SNA Control Protocol" }, @@ -119,7 +119,7 @@ Signed-off-by: Jo-Philipp Wich { 0x8207, "Cisco Discovery Protocol Control" }, { 0x8209, "Netcs Twin Routing" }, { 0x820b, "STP - Control Protocol" }, -@@ -975,24 +998,29 @@ struct protocol_list { +@@ -1092,24 +1115,29 @@ struct protocol_list { { 0x8281, "MPLSCP" }, { 0x8285, "IEEE p1284.4 standard - Protocol Control" }, { 0x8287, "ETSI TETRA TNP1 Control Protocol" }, diff --git a/package/network/services/ppp/patches/405-no_multilink_option.patch b/package/network/services/ppp/patches/405-no_multilink_option.patch index a34ec57b0a9..654bebd5692 100644 --- a/package/network/services/ppp/patches/405-no_multilink_option.patch +++ b/package/network/services/ppp/patches/405-no_multilink_option.patch @@ -9,7 +9,7 @@ Signed-off-by: Jo-Philipp Wich --- a/pppd/options.c +++ b/pppd/options.c -@@ -348,13 +348,14 @@ option_t general_options[] = { +@@ -379,13 +379,14 @@ struct option general_options[] = { "Enable multilink operation", OPT_PRIOSUB | OPT_ALIAS | 1 }, { "nomultilink", o_bool, &multilink, "Disable multilink operation", OPT_PRIOSUB | 0 }, @@ -18,11 +18,11 @@ Signed-off-by: Jo-Philipp Wich { "bundle", o_string, &bundle_name, "Bundle name for multilink", OPT_PRIO }, - #endif /* HAVE_MULTILINK */ + #endif /* PPP_WITH_MULTILINK */ + { "nomp", o_bool, &multilink, + "Disable multilink operation", OPT_PRIOSUB | OPT_ALIAS | 0 }, + - #ifdef PLUGIN + #ifdef PPP_WITH_PLUGINS { "plugin", o_special, (void *)loadplugin, "Load a plug-in module into pppd", OPT_PRIV | OPT_A2LIST }, diff --git a/package/network/services/ppp/patches/500-add-pptp-plugin.patch b/package/network/services/ppp/patches/500-add-pptp-plugin.patch index 96f4bcaf702..4b66cd21657 100644 --- a/package/network/services/ppp/patches/500-add-pptp-plugin.patch +++ b/package/network/services/ppp/patches/500-add-pptp-plugin.patch @@ -1,59 +1,43 @@ ---- a/configure -+++ b/configure -@@ -133,7 +133,7 @@ if [ -d "$ksrc" ]; then - mkmkf $ksrc/Makedefs$compiletype Makedefs.com - for dir in pppd pppstats chat pppdump pppd/plugins pppd/plugins/pppoe \ - pppd/plugins/radius pppd/plugins/pppoatm \ -- pppd/plugins/pppol2tp; do -+ pppd/plugins/pppol2tp pppd/plugins/pptp ; do - mkmkf $dir/Makefile.$makext $dir/Makefile - done - if [ -f $ksrc/Makefile.$makext$archvariant ]; then ---- a/pppd/plugins/Makefile.linux -+++ b/pppd/plugins/Makefile.linux -@@ -14,7 +14,7 @@ INSTALL = install - # EAP-TLS - CFLAGS += -DUSE_EAPTLS=1 +--- a/configure.ac ++++ b/configure.ac +@@ -344,6 +344,7 @@ AC_CONFIG_FILES([ + pppd/plugins/pppoatm/Makefile + pppd/plugins/pppol2tp/Makefile + pppd/plugins/radius/Makefile ++ pppd/plugins/pptp/Makefile + pppdump/Makefile + pppstats/Makefile + scripts/Makefile +--- a/pppd/plugins/Makefile.am ++++ b/pppd/plugins/Makefile.am +@@ -21,5 +21,5 @@ winbind_la_LDFLAGS = $(PLUGIN_LDFLAGS) + winbind_la_SOURCES = winbind.c --SUBDIRS := pppoe pppoatm pppol2tp -+SUBDIRS := pppoe pppoatm pppol2tp pptp - # Uncomment the next line to include the radius authentication plugin - SUBDIRS += radius - PLUGINS := minconn.so passprompt.so passwordfd.so winbind.so + if !SUNOS +-SUBDIRS = pppoe pppoatm pppol2tp radius ++SUBDIRS = pppoe pppoatm pppol2tp radius pptp + endif --- /dev/null -+++ b/pppd/plugins/pptp/Makefile.linux -@@ -0,0 +1,31 @@ -+# -+# This program may be distributed according to the terms of the GNU -+# General Public License, version 2 or (at your option) any later version. -+# -+# $Id: Makefile.linux,v 1.9 2012/05/04 21:48:00 dgolle Exp $ -+#*********************************************************************** -+ -+DESTDIR = $(INSTROOT)@DESTDIR@ -+LIBDIR = $(DESTDIR)/lib/pppd/$(PPPDVERSION) -+ -+PPPDVERSION = $(shell awk -F '"' '/VERSION/ { print $$2; }' ../../patchlevel.h) -+ -+INSTALL = install -+ -+COPTS=-O2 -g -+CFLAGS = $(COPTS) -I. -I../.. -I../../../include -fPIC -DPPPD_VERSION=\"$(PPPDVERSION)\" -+all: pptp.so -+ -+%.o: %.c -+ $(CC) $(CFLAGS) -c -o $@ $< -+ -+pptp.so: dirutil.o orckit_quirks.o pptp.o pptp_callmgr.o pptp_ctrl.o pptp_quirks.o util.o vector.o -+ $(CC) -o pptp.so -shared dirutil.o orckit_quirks.o pptp.o pptp_callmgr.o pptp_ctrl.o pptp_quirks.o util.o vector.o -+ -+install: all -+ $(INSTALL) -d -m 755 $(LIBDIR) -+ $(INSTALL) -c -m 4550 pptp.so $(LIBDIR) -+ -+clean: -+ rm -f *.o *.so -+ ++++ b/pppd/plugins/pptp/Makefile.am +@@ -0,0 +1,18 @@ ++pppd_plugin_LTLIBRARIES = pptp.la ++pppd_plugindir = $(PPPD_PLUGIN_DIR) ++ ++noinst_HEADERS = \ ++ dirutil.h \ ++ orckit_quirks.h \ ++ pptp_callmgr.h \ ++ pptp_ctrl.h \ ++ pptp_msg.h \ ++ pptp_options.h \ ++ pptp_quirks.h \ ++ util.h \ ++ vector.h ++ ++pptp_la_CPPFLAGS = -I${top_srcdir} -DSYSCONFDIR=\"${sysconfdir}\" -DPLUGIN ++pptp_la_LDFLAGS = -fPIC -module -avoid-version ++pptp_la_SOURCES = dirutil.c orckit_quirks.c pptp.c pptp_callmgr.c pptp_ctrl.c \ ++ pptp_quirks.c util.c vector.c --- /dev/null +++ b/pppd/plugins/pptp/dirutil.c @@ -0,0 +1,68 @@ @@ -334,7 +318,7 @@ +xeb xeb@mail.ru --- /dev/null +++ b/pppd/plugins/pptp/pptp.c -@@ -0,0 +1,323 @@ +@@ -0,0 +1,325 @@ +/*************************************************************************** + * Copyright (C) 2006 by Kozlov D. * + * some cleanup done (C) 2012 by Daniel Golle * @@ -377,6 +361,8 @@ +#include + +#include "pppd.h" ++#include "pppd-private.h" ++#include "options.h" +#include "fsm.h" +#include "lcp.h" +#include "ipcp.h" @@ -385,7 +371,7 @@ + +#include "pptp_callmgr.h" +#include -+#include ++#include +#include + +#include @@ -437,8 +423,8 @@ + check_options: NULL, + connect: &pptp_connect, + disconnect: &pptp_disconnect, -+ establish_ppp: &generic_establish_ppp, -+ disestablish_ppp: &generic_disestablish_ppp, ++ establish_ppp: &ppp_generic_establish, ++ disestablish_ppp: &ppp_generic_disestablish, + close: NULL, + cleanup: NULL +}; @@ -446,7 +432,7 @@ +static int pptp_start_server(void) +{ + pptp_fd=pptp_sock; -+ sprintf(ppp_devnam,"pptp (%s)",pptp_client); ++ sprintf(ppp_devname,"pptp (%s)",pptp_client); + + return pptp_fd; +} @@ -527,7 +513,7 @@ + return -1; + } + -+ sprintf(ppp_devnam,"pptp (%s)",pptp_server); ++ sprintf(ppp_devname,"pptp (%s)",pptp_server); + + return pptp_fd; +} @@ -651,7 +637,7 @@ + +void plugin_init(void) +{ -+ add_options(Options); ++ ppp_add_options(Options); + + info("PPTP plugin version %s", PPTP_VERSION); + diff --git a/package/network/services/ppp/patches/510-pptp_compile_fix.patch b/package/network/services/ppp/patches/510-pptp_compile_fix.patch deleted file mode 100644 index 04bb620e76e..00000000000 --- a/package/network/services/ppp/patches/510-pptp_compile_fix.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/pppd/plugins/pptp/pptp.c -+++ b/pppd/plugins/pptp/pptp.c -@@ -48,7 +48,7 @@ - - #include "pptp_callmgr.h" - #include --#include -+#include - #include - - #include diff --git a/package/network/services/ppp/patches/511-pptp_cflags.patch b/package/network/services/ppp/patches/511-pptp_cflags.patch deleted file mode 100644 index 548bf41c1f4..00000000000 --- a/package/network/services/ppp/patches/511-pptp_cflags.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/pppd/plugins/pptp/Makefile.linux -+++ b/pppd/plugins/pptp/Makefile.linux -@@ -20,7 +20,7 @@ all: pptp.so - $(CC) $(CFLAGS) -c -o $@ $< - - pptp.so: dirutil.o orckit_quirks.o pptp.o pptp_callmgr.o pptp_ctrl.o pptp_quirks.o util.o vector.o -- $(CC) -o pptp.so -shared dirutil.o orckit_quirks.o pptp.o pptp_callmgr.o pptp_ctrl.o pptp_quirks.o util.o vector.o -+ $(CC) -fPIC -o pptp.so -shared dirutil.o orckit_quirks.o pptp.o pptp_callmgr.o pptp_ctrl.o pptp_quirks.o util.o vector.o - - install: all - $(INSTALL) -d -m 755 $(LIBDIR) diff --git a/package/network/services/ppp/patches/600-Revert-pppd-Use-openssl-for-the-DES-instead-of-the-l.patch b/package/network/services/ppp/patches/600-Revert-pppd-Use-openssl-for-the-DES-instead-of-the-l.patch deleted file mode 100644 index dc18156a042..00000000000 --- a/package/network/services/ppp/patches/600-Revert-pppd-Use-openssl-for-the-DES-instead-of-the-l.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 831dca008699d485f2c8e91749657ef2d0b06166 Mon Sep 17 00:00:00 2001 -From: Martin Schiller -Date: Thu, 6 Dec 2018 08:43:17 +0100 -Subject: [PATCH] Revert "pppd: Use openssl for the DES instead of the libcrypt - / glibc" - -For musl and glibc2.27 we can keep linking to crypt; however if we -switch to glibc 2.28 we will have to link to one of the SSL libraries. - -This reverts commit 3c7b86229f7bd2600d74db14b1fe5b3896be3875. ---- - pppd/Makefile.linux | 7 +++---- - pppd/pppcrypt.c | 18 +++++++++--------- - 2 files changed, 12 insertions(+), 13 deletions(-) - ---- a/pppd/Makefile.linux -+++ b/pppd/Makefile.linux -@@ -36,10 +36,10 @@ endif - - LIBS = -lrt - --# Uncomment the next line to include support for Microsoft's -+# Uncomment the next 2 lines to include support for Microsoft's - # MS-CHAP authentication protocol. Also, edit plugins/radius/Makefile.linux. - CHAPMS=y --#USE_CRYPT=y -+USE_CRYPT=y - # Don't use MSLANMAN unless you really know what you're doing. - #MSLANMAN=y - # Uncomment the next line to include support for MPPE. CHAPMS (above) must -@@ -158,8 +158,7 @@ endif - - ifdef NEEDDES - ifndef USE_CRYPT --CFLAGS += -I$(shell $(CC) --print-sysroot)/usr/include/openssl --NEEDCRYPTOLIB = y -+LIBS += -ldes $(LIBS) - else - CFLAGS += -DUSE_CRYPT=1 - endif ---- a/pppd/pppcrypt.c -+++ b/pppd/pppcrypt.c -@@ -62,7 +62,7 @@ MakeKey(u_char *key, u_char *des_key) - des_key[7] = Get7Bits(key, 49); - - #ifndef USE_CRYPT -- DES_set_odd_parity((DES_cblock *)des_key); -+ des_set_odd_parity((des_cblock *)des_key); - #endif - } - -@@ -147,30 +147,30 @@ DesDecrypt(u_char *cipher, u_char *clear - } - - #else /* USE_CRYPT */ --static DES_key_schedule key_schedule; -+static des_key_schedule key_schedule; - - bool - DesSetkey(u_char *key) - { -- DES_cblock des_key; -+ des_cblock des_key; - MakeKey(key, des_key); -- DES_set_key(&des_key, &key_schedule); -+ des_set_key(&des_key, key_schedule); - return (1); - } - - bool - DesEncrypt(u_char *clear, u_char *cipher) - { -- DES_ecb_encrypt((DES_cblock *)clear, (DES_cblock *)cipher, -- &key_schedule, 1); -+ des_ecb_encrypt((des_cblock *)clear, (des_cblock *)cipher, -+ key_schedule, 1); - return (1); - } - - bool - DesDecrypt(u_char *cipher, u_char *clear) - { -- DES_ecb_encrypt((DES_cblock *)cipher, (DES_cblock *)clear, -- &key_schedule, 0); -+ des_ecb_encrypt((des_cblock *)cipher, (des_cblock *)clear, -+ key_schedule, 0); - return (1); - } - diff --git a/package/network/services/ppp/patches/610-pppd_compile_fix.patch b/package/network/services/ppp/patches/610-pppd_compile_fix.patch deleted file mode 100644 index 4f66e5d71f0..00000000000 --- a/package/network/services/ppp/patches/610-pppd_compile_fix.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/pppd/Makefile.linux -+++ b/pppd/Makefile.linux -@@ -49,7 +49,8 @@ MPPE=y - # Uncomment the next line to include support for PPP packet filtering. - # This requires that the libpcap library and headers be installed - # and that the kernel driver support PPP packet filtering. --#FILTER=y -+# libpcap statically linked in OpenWRT, hence disabled here. -+FILTER= - - # Support for precompiled filters - PRECOMPILED_FILTER=y diff --git a/package/network/utils/ethtool/Makefile b/package/network/utils/ethtool/Makefile index bc2b13e4234..cfb4cfaeb94 100644 --- a/package/network/utils/ethtool/Makefile +++ b/package/network/utils/ethtool/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ethtool -PKG_VERSION:=6.6 +PKG_VERSION:=6.10 PKG_RELEASE:=1 PKG_MAINTAINER:=Felix Fietkau PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/network/ethtool -PKG_HASH:=833a8493cb9cd5809ab59743092d9a38742c282290800e9626407511bbcebf9e +PKG_HASH:=cc613fe8a2bcddee17a1e6e0d763c0f3ea33c7e930658d2d7f601aa65e426a1f PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING diff --git a/package/network/utils/iproute2/Makefile b/package/network/utils/iproute2/Makefile index 85d9f437f63..04a4df24c99 100644 --- a/package/network/utils/iproute2/Makefile +++ b/package/network/utils/iproute2/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=iproute2 -PKG_VERSION:=6.9.0 +PKG_VERSION:=6.11.0 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2 -PKG_HASH:=2f643d09ea11a4a2a043c92e2b469b5f73228cbf241ae806760296ed0ec413d0 +PKG_HASH:=1f795398a04aeaacd06a8f6ace2cfd913c33fa5953ca99daae83bb5c534611c3 PKG_BUILD_PARALLEL:=1 PKG_BUILD_DEPENDS:=iptables PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/iproute2/patches/010-bridge-mst-fix-a-musl-build-issue.patch b/package/network/utils/iproute2/patches/010-bridge-mst-fix-a-musl-build-issue.patch new file mode 100644 index 00000000000..1630415eb51 --- /dev/null +++ b/package/network/utils/iproute2/patches/010-bridge-mst-fix-a-musl-build-issue.patch @@ -0,0 +1,68 @@ +From 6a77abab92516e65f07f8657fc4e384c4541ce0e Mon Sep 17 00:00:00 2001 +From: Dario Binacchi +Date: Sun, 22 Sep 2024 16:50:10 +0200 +Subject: bridge: mst: fix a musl build issue + +This patch fixes a compilation error raised by the bump to version 6.11.0 +in Buildroot using musl as the C library for the cross-compilation +toolchain. + +After setting the CFLGAS + +ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y) +IPROUTE2_CFLAGS += -D__UAPI_DEF_IN6_ADDR=0 -D__UAPI_DEF_SOCKADDR_IN6=0 \ + -D__UAPI_DEF_IPV6_MREQ=0 +endif + +to fix the following errors: + +In file included from ../../../host/mips64-buildroot-linux-musl/sysroot/usr/include/arpa/inet.h:9, + from ../include/libnetlink.h:14, + from mst.c:10: +../../../host/mips64-buildroot-linux-musl/sysroot/usr/include/netinet/in.h:23:8: error: redefinition of 'struct in6_addr' + 23 | struct in6_addr { + | ^~~~~~~~ +In file included from ../include/uapi/linux/if_bridge.h:19, + from mst.c:7: +../include/uapi/linux/in6.h:33:8: note: originally defined here + 33 | struct in6_addr { + | ^~~~~~~~ +../../../host/mips64-buildroot-linux-musl/sysroot/usr/include/netinet/in.h:34:8: error: redefinition of 'struct sockaddr_in6' + 34 | struct sockaddr_in6 { + | ^~~~~~~~~~~~ +../include/uapi/linux/in6.h:50:8: note: originally defined here + 50 | struct sockaddr_in6 { + | ^~~~~~~~~~~~ +../../../host/mips64-buildroot-linux-musl/sysroot/usr/include/netinet/in.h:42:8: error: redefinition of 'struct ipv6_mreq' + 42 | struct ipv6_mreq { + | ^~~~~~~~~ +../include/uapi/linux/in6.h:60:8: note: originally defined here + 60 | struct ipv6_mreq { + +I got this further errors + +../include/uapi/linux/in6.h:72:25: error: field 'flr_dst' has incomplete type + 72 | struct in6_addr flr_dst; + | ^~~~~~~ +../include/uapi/linux/if_bridge.h:711:41: error: field 'ip6' has incomplete type + 711 | struct in6_addr ip6; + | ^~~ + +fixed by including the netinet/in.h header. + +Signed-off-by: Dario Binacchi +Signed-off-by: Stephen Hemminger +--- + bridge/mst.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/bridge/mst.c ++++ b/bridge/mst.c +@@ -4,6 +4,7 @@ + */ + + #include ++#include + #include + #include + diff --git a/package/network/utils/iproute2/patches/401-bridge-vlan.c-bridge-vlan.c-fix-build-with-gcc-14-on.patch b/package/network/utils/iproute2/patches/011-bridge-mst-fix-a-further-musl-build-issue.patch similarity index 57% rename from package/network/utils/iproute2/patches/401-bridge-vlan.c-bridge-vlan.c-fix-build-with-gcc-14-on.patch rename to package/network/utils/iproute2/patches/011-bridge-mst-fix-a-further-musl-build-issue.patch index a90c9fc80a3..1bdab398f73 100644 --- a/package/network/utils/iproute2/patches/401-bridge-vlan.c-bridge-vlan.c-fix-build-with-gcc-14-on.patch +++ b/package/network/utils/iproute2/patches/011-bridge-mst-fix-a-further-musl-build-issue.patch @@ -1,15 +1,11 @@ -From 53a89bfd86fff1a00cc77cabb8457a03eaa3bc7d Mon Sep 17 00:00:00 2001 -From: Gabi Falk -Date: Fri, 10 May 2024 14:36:12 +0000 -Subject: [PATCH] bridge/vlan.c: bridge/vlan.c: fix build with gcc 14 on musl - systems +From 043ef90e2fa94397eb5c85330889ca4146a6d58a Mon Sep 17 00:00:00 2001 +From: Dario Binacchi +Date: Sun, 22 Sep 2024 16:50:11 +0200 +Subject: bridge: mst: fix a further musl build issue -On glibc based systems the definition of 'struct timeval' is pulled in -with inclusion of header, but on musl based systems it -doesn't work this way. Missing definition triggers an -incompatible-pointer-types error with gcc 14 (warning on previous -versions of gcc): +This patch fixes the following build errors: +In file included from mst.c:11: ../include/json_print.h:80:30: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration 80 | _PRINT_FUNC(tv, const struct timeval *) | ^~~~~~~ @@ -28,42 +24,28 @@ versions of gcc): | ^~~~~ | | | const struct timeval * +../include/json_print.h:80:1: note: in expansion of macro '_PRINT_FUNC' + 80 | _PRINT_FUNC(tv, const struct timeval *) + | ^~~~~~~~~~~ +../include/json_print.h:50:42: note: expected 'const struct timeval *' but argument is of type 'const struct timeval *' + 50 | type value); \ + | ^ +../include/json_print.h:80:1: note: in expansion of macro '_PRINT_FUNC' + 80 | _PRINT_FUNC(tv, const struct timeval *) -Signed-off-by: Gabi Falk +Signed-off-by: Dario Binacchi Signed-off-by: Stephen Hemminger --- - bridge/vlan.c | 1 + - bridge/vni.c | 1 + - vdpa/vdpa.c | 1 + - 3 files changed, 3 insertions(+) + bridge/mst.c | 1 + + 1 file changed, 1 insertion(+) ---- a/bridge/vlan.c -+++ b/bridge/vlan.c +--- a/bridge/mst.c ++++ b/bridge/mst.c @@ -4,6 +4,7 @@ - #include - #include - #include + */ + + #include +#include - #include #include #include ---- a/bridge/vni.c -+++ b/bridge/vni.c -@@ -10,6 +10,7 @@ - #include - #include - #include -+#include #include - #include - #include ---- a/vdpa/vdpa.c -+++ b/vdpa/vdpa.c -@@ -3,6 +3,7 @@ - #include - #include - #include -+#include - #include - #include - #include diff --git a/package/network/utils/iproute2/patches/012-libnetlink-fix-build-with-musl-and-gcc-14.patch b/package/network/utils/iproute2/patches/012-libnetlink-fix-build-with-musl-and-gcc-14.patch new file mode 100644 index 00000000000..749176a8dee --- /dev/null +++ b/package/network/utils/iproute2/patches/012-libnetlink-fix-build-with-musl-and-gcc-14.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Thu, 8 Aug 2024 09:19:01 +0200 +Subject: libnetlink: fix build with musl and gcc 14 + +Fixes compilation error with musl libc and gcc 14: + +../include/libnetlink.h: In function 'rta_getattr_be64': +../include/libnetlink.h:280:16: error: implicit declaration of function 'htobe64' [-Wimplicit-function-declaration] + 280 | return htobe64(rta_getattr_u64(rta)); + | ^~~~~~~ + +Reference: https://man7.org/linux/man-pages/man3/endian.3.html +Signed-off-by: Natanael Copa +--- + include/libnetlink.h | 1 + + 1 file changed, 1 insertion(+) + +--- a/include/libnetlink.h ++++ b/include/libnetlink.h +@@ -2,6 +2,7 @@ + #ifndef __LIBNETLINK_H__ + #define __LIBNETLINK_H__ 1 + ++#include + #include + #include + #include diff --git a/package/network/utils/iproute2/patches/140-keep_libmnl_optional.patch b/package/network/utils/iproute2/patches/140-keep_libmnl_optional.patch index ee18f17d54f..48a4ae75196 100644 --- a/package/network/utils/iproute2/patches/140-keep_libmnl_optional.patch +++ b/package/network/utils/iproute2/patches/140-keep_libmnl_optional.patch @@ -1,6 +1,6 @@ --- a/configure +++ b/configure -@@ -362,7 +362,7 @@ check_tirpc() +@@ -368,7 +368,7 @@ check_tirpc() check_mnl() { diff --git a/package/network/utils/iproute2/patches/150-keep_libcap_optional.patch b/package/network/utils/iproute2/patches/150-keep_libcap_optional.patch index 767c968e74c..49873f87b16 100644 --- a/package/network/utils/iproute2/patches/150-keep_libcap_optional.patch +++ b/package/network/utils/iproute2/patches/150-keep_libcap_optional.patch @@ -1,6 +1,6 @@ --- a/configure +++ b/configure -@@ -421,7 +421,7 @@ EOF +@@ -427,7 +427,7 @@ EOF check_cap() { diff --git a/package/network/utils/iproute2/patches/155-keep_tirpc_optional.patch b/package/network/utils/iproute2/patches/155-keep_tirpc_optional.patch index 011dd48f8e1..9e5e4330cf8 100644 --- a/package/network/utils/iproute2/patches/155-keep_tirpc_optional.patch +++ b/package/network/utils/iproute2/patches/155-keep_tirpc_optional.patch @@ -1,6 +1,6 @@ --- a/configure +++ b/configure -@@ -349,7 +349,7 @@ check_selinux() +@@ -355,7 +355,7 @@ check_selinux() check_tirpc() { diff --git a/package/network/utils/iproute2/patches/200-drop_libbsd_dependency.patch b/package/network/utils/iproute2/patches/200-drop_libbsd_dependency.patch index e41be20f108..38193be156b 100644 --- a/package/network/utils/iproute2/patches/200-drop_libbsd_dependency.patch +++ b/package/network/utils/iproute2/patches/200-drop_libbsd_dependency.patch @@ -1,6 +1,6 @@ --- a/configure +++ b/configure -@@ -407,14 +407,8 @@ EOF +@@ -413,14 +413,8 @@ EOF if $CC -I$INCLUDE -o $TMPDIR/strtest $TMPDIR/strtest.c >/dev/null 2>&1; then echo "no" else diff --git a/package/network/utils/iproute2/patches/300-selinux-configurable.patch b/package/network/utils/iproute2/patches/300-selinux-configurable.patch index 36ecc735a74..9f07d31768f 100644 --- a/package/network/utils/iproute2/patches/300-selinux-configurable.patch +++ b/package/network/utils/iproute2/patches/300-selinux-configurable.patch @@ -1,6 +1,6 @@ --- a/configure +++ b/configure -@@ -336,7 +336,7 @@ check_libbpf() +@@ -342,7 +342,7 @@ check_libbpf() check_selinux() # SELinux is a compile time option in the ss utility { diff --git a/package/network/utils/iproute2/patches/500-add-nssmirred.patch b/package/network/utils/iproute2/patches/500-add-nssmirred.patch index 08bc935b2cc..ba6074943e4 100644 --- a/package/network/utils/iproute2/patches/500-add-nssmirred.patch +++ b/package/network/utils/iproute2/patches/500-add-nssmirred.patch @@ -176,7 +176,7 @@ + if (show_stats) { + if (tb[TCA_NSS_MIRRED_TM]) { + struct tcf_t *tm = RTA_DATA(tb[TCA_NSS_MIRRED_TM]); -+ print_tm(f,tm); ++ print_tm(tm); + } + } + return 0; diff --git a/package/network/utils/xdp-tools/Makefile b/package/network/utils/xdp-tools/Makefile index 4d6ca312f6d..8c4071991fd 100644 --- a/package/network/utils/xdp-tools/Makefile +++ b/package/network/utils/xdp-tools/Makefile @@ -2,8 +2,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=xdp-tools PKG_RELEASE:=1 -PKG_VERSION:=1.4.2 -PKG_HASH:=49c2b96b2be878449a797a74ca515a63e13418cb8ea904df08f8ef9cb2ac5570 +PKG_VERSION:=1.4.3 +PKG_HASH:=6e727e2c7c079dec86575c5d0e7aac7ecd582aabe04b3b176d7ef50e653b60c0 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/xdp-project/xdp-tools/tar.gz/v$(PKG_VERSION)? diff --git a/package/network/utils/xdp-tools/patches/023-libxdp-fix-compilation-on-multiarch-systems.patch b/package/network/utils/xdp-tools/patches/023-libxdp-fix-compilation-on-multiarch-systems.patch deleted file mode 100644 index 89276fca897..00000000000 --- a/package/network/utils/xdp-tools/patches/023-libxdp-fix-compilation-on-multiarch-systems.patch +++ /dev/null @@ -1,30 +0,0 @@ -From cb1ef3322671a67e2050a3eee18b49cdb4ed4bed Mon Sep 17 00:00:00 2001 -From: Andre Heider -Date: Wed, 18 Jan 2023 20:54:41 +0100 -Subject: [PATCH] libxdp: fix compilation on multiarch systems - -Multiarch systems require an additional include path, which is covered -by ARCH_INCLUDES here. Just as lib/util, add it to BPF_CFLAGS. - -Fixes compilation on debian: - -In file included from xdp-dispatcher.c:3: -In file included from ../../headers/linux/bpf.h:11: -/usr/include/linux/types.h:5:10: fatal error: 'asm/types.h' file not found - -Signed-off-by: Andre Heider ---- - lib/libxdp/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/lib/libxdp/Makefile -+++ b/lib/libxdp/Makefile -@@ -28,7 +28,7 @@ PC_FILE := $(OBJDIR)/libxdp.pc - TEMPLATED_SOURCES := xdp-dispatcher.c - - CFLAGS += -I$(HEADER_DIR) --BPF_CFLAGS += -I$(HEADER_DIR) -+BPF_CFLAGS += -I$(HEADER_DIR) $(ARCH_INCLUDES) - - - ifndef BUILD_STATIC_ONLY diff --git a/package/system/openwrt-keyring/Makefile b/package/system/openwrt-keyring/Makefile index d8b15d46e47..9344ec321d9 100644 --- a/package/system/openwrt-keyring/Makefile +++ b/package/system/openwrt-keyring/Makefile @@ -3,13 +3,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openwrt-keyring -PKG_RELEASE:=2 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/keyring.git -PKG_SOURCE_DATE:=2022-03-25 -PKG_SOURCE_VERSION:=62471e693b4f9f19dd88afa6827fc3a2cf121d9a -PKG_MIRROR_HASH:=dbc6cf709f702f92f6aabcd9f981a14901ec61c9b340bd506986f8b438503632 +PKG_SOURCE_DATE:=2024-09-28 +PKG_SOURCE_VERSION:=3c066ce24e80d8f537d582406930d60c7cafb251 +PKG_MIRROR_HASH:=27a52fd164d38cc57d052e0e04c95ac941ce90be6231c2eb85dcbbde9d3b916e PKG_MAINTAINER:=John Crispin PKG_LICENSE:=GPL-2.0 @@ -30,10 +30,17 @@ endef Build/Compile= +ifneq ($(CONFIG_USE_APK),) +define Package/openwrt-keyring/install + $(INSTALL_DIR) $(1)/etc/apk/keys/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/apk/*.pem $(1)/etc/apk/keys/ +endef +else define Package/openwrt-keyring/install $(INSTALL_DIR) $(1)/etc/opkg/keys/ # Public usign key for unattended snapshot builds $(INSTALL_DATA) $(PKG_BUILD_DIR)/usign/b5043e70f9a75cde $(1)/etc/opkg/keys/ endef +endif $(eval $(call BuildPackage,openwrt-keyring)) diff --git a/package/system/opkg/Makefile b/package/system/opkg/Makefile index 8a086a50c16..3b0a6ae4976 100644 --- a/package/system/opkg/Makefile +++ b/package/system/opkg/Makefile @@ -7,14 +7,14 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=opkg -PKG_RELEASE:=3 +PKG_RELEASE:=1 PKG_FLAGS:=essential PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/opkg-lede.git -PKG_SOURCE_DATE:=2022-02-24 -PKG_SOURCE_VERSION:=d038e5b6d155784575f62a66a8bb7e874173e92e -PKG_MIRROR_HASH:=6889f7d322996f9291f42d7d6a5877d256b91d4a01d6015cebaae9227702eb43 +PKG_SOURCE_DATE:=2024-10-16 +PKG_SOURCE_VERSION:=38eccbb1fd694d4798ac1baf88f9ba83d1eac616 +PKG_MIRROR_HASH:=de58ff1c99c14789f9ba8946623c8c1e58d022e7e2a659d6f97c6fde54f2c4f4 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index bf3e8e2f75f..4ef470df755 100644 --- a/package/utils/busybox/Makefile +++ b/package/utils/busybox/Makefile @@ -11,7 +11,7 @@ PKG_FLAGS:=essential PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://www.busybox.net/downloads \ - http://sources.buildroot.net + https://sources.buildroot.net/$(PKG_NAME) PKG_HASH:=b8cc24c9574d809e7279c3be349795c5d5ceb6fdf19ca709f80cde50e47de314 PKG_BUILD_DEPENDS:=BUSYBOX_CONFIG_PAM:libpam diff --git a/package/utils/mtd-utils/Makefile b/package/utils/mtd-utils/Makefile index a73f5e1eb1f..046572e83b4 100644 --- a/package/utils/mtd-utils/Makefile +++ b/package/utils/mtd-utils/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mtd-utils -PKG_VERSION:=2.2.0 +PKG_VERSION:=2.2.1 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://infraroot.at/pub/mtd/ -PKG_HASH:=250d082f67375ca8451b5fcfc9a23a53ced3ebebd8312c288daf2507bbab1324 +PKG_HASH:=f7ae20b2eb79ee83441468f0b99d897024cd96ff853eea59106fb1952065c803 PKG_INSTALL:=1 diff --git a/scripts/belkin-header.py b/scripts/belkin-header.py index 4dc3d2652e8..f62d55cab7c 100755 --- a/scripts/belkin-header.py +++ b/scripts/belkin-header.py @@ -35,7 +35,7 @@ MODULE = "IMG" def xcrc32(buf): - return (0xffffffff - zlib.crc32(buf, 0xffffffff)).to_bytes(4, 'big') + return (0xffffffff - zlib.crc32(buf, 0xffffffff)).to_bytes(4, byteorder='big') def encode_model(model): map = " 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-" @@ -63,12 +63,12 @@ def create_header(buf, belkin_header, belkin_model): head[0:4] = int(belkin_header, 0).to_bytes(4, 'big') head[8:12] = int(time.time()).to_bytes(4, 'big') - head[12:16] = len(buf).to_bytes(4, 'big') + head[12:16] = len(buf).to_bytes(4, byteorder='big') head[24:28] = xcrc32(buf) - head[28:29] = VERSION1.to_bytes(1) - head[29:30] = VERSION2.to_bytes(1) - head[30:31] = VERSION3.to_bytes(1) - head[31:32] = VERSION4.to_bytes(1) + head[28:29] = VERSION1.to_bytes(1, byteorder='big') + head[29:30] = VERSION2.to_bytes(1, byteorder='big') + head[30:31] = VERSION3.to_bytes(1, byteorder='big') + head[31:32] = VERSION4.to_bytes(1, byteorder='big') head[16:16 + len(COMPANY)] = bytes(COMPANY,'ascii') mod = MODULE + "-{:1d}.{:02d}.{:02d}.{:02d}".format(VERSION1, VERSION2, VERSION3, VERSION4) diff --git a/scripts/download.pl b/scripts/download.pl index 5449a3406aa..c6c9b8e56cd 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -11,6 +11,7 @@ use warnings; use File::Basename; use File::Copy; +use File::Path; use Text::ParseWords; use JSON::PP; @@ -173,7 +174,7 @@ sub download } if (! -d "$target") { - system("mkdir", "-p", "$target/"); + make_path($target); } if (! open TMPDLS, "find $mirror -follow -name $filename 2>/dev/null |") { @@ -244,7 +245,7 @@ sub download }; unlink "$target/$filename"; - system("mv", "$target/$filename.dl", "$target/$filename"); + move("$target/$filename.dl", "$target/$filename"); cleanup(); } diff --git a/scripts/feeds b/scripts/feeds index 8aa37b8c29b..ff3aa2d5949 100755 --- a/scripts/feeds +++ b/scripts/feeds @@ -461,6 +461,11 @@ sub do_install_target($) { return 1; } + # Clean packageinfo of linux kernel to force the scan. + # Otherwise kernel modules defined at target level are not scanned, as the + # linux kernel package was scanned before the installation of the target. + unlink "tmp/info/.packageinfo-kernel_linux"; + return 0; } diff --git a/target/linux/apm821xx/image/Makefile b/target/linux/apm821xx/image/Makefile index 03799bcc106..1f09f8de756 100644 --- a/target/linux/apm821xx/image/Makefile +++ b/target/linux/apm821xx/image/Makefile @@ -17,7 +17,8 @@ define Build/boot-img # convert it to revision 1 - needed for u-boot ext2load $(STAGING_DIR_HOST)/bin/tune2fs -O filetype $@.boot - $(STAGING_DIR_HOST)/bin/e2fsck -pDf $@.boot > /dev/null + # Ignore errors because file system was intentionally broken with tune2fs + -$(STAGING_DIR_HOST)/bin/e2fsck -pDf $@.boot > /dev/null endef define Build/boot-script diff --git a/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c b/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c index 70f091b79ff..6e3f0f9690e 100644 --- a/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c +++ b/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c @@ -110,14 +110,19 @@ static int gpio_latch_probe(struct platform_device *pdev) struct gpio_latch_chip *glc; struct gpio_chip *gc; struct device *dev = &pdev->dev; - int i, n; + int err, i, n; glc = devm_kzalloc(dev, sizeof(*glc), GFP_KERNEL); if (!glc) return -ENOMEM; - mutex_init(&glc->mutex); - mutex_init(&glc->latch_mutex); + err = devm_mutex_init(&pdev->dev, &glc->mutex); + if (err) + return err; + + err = devm_mutex_init(&pdev->dev, &glc->latch_mutex); + if (err) + return err; n = gpiod_count(dev, NULL); if (n <= 0) diff --git a/target/linux/ath79/files/drivers/gpio/gpio-rb4xx.c b/target/linux/ath79/files/drivers/gpio/gpio-rb4xx.c index f8022436e09..db381f5d30f 100644 --- a/target/linux/ath79/files/drivers/gpio/gpio-rb4xx.c +++ b/target/linux/ath79/files/drivers/gpio/gpio-rb4xx.c @@ -105,6 +105,7 @@ static int rb4xx_gpio_probe(struct platform_device *pdev) struct device *parent = dev->parent; struct rb4xx_gpio *gpio; u32 val; + int err; if (!parent) return -ENODEV; @@ -117,7 +118,10 @@ static int rb4xx_gpio_probe(struct platform_device *pdev) gpio->cpld = dev_get_drvdata(parent); gpio->dev = dev; gpio->values = 0; - mutex_init(&gpio->lock); + + err = devm_mutex_init(&pdev->dev, &gpio->lock); + if (err) + return err; gpio->chip.label = "rb4xx-gpio"; gpio->chip.parent = dev; @@ -134,17 +138,7 @@ static int rb4xx_gpio_probe(struct platform_device *pdev) if (!of_property_read_u32(dev->of_node, "base", &val)) gpio->chip.base = val; - return gpiochip_add_data(&gpio->chip, gpio); -} - -static int rb4xx_gpio_remove(struct platform_device *pdev) -{ - struct rb4xx_gpio *gpio = platform_get_drvdata(pdev); - - gpiochip_remove(&gpio->chip); - mutex_destroy(&gpio->lock); - - return 0; + return devm_gpiochip_add_data(&pdev->dev, &gpio->chip, gpio); } static const struct platform_device_id rb4xx_gpio_id_table[] = { @@ -155,7 +149,6 @@ MODULE_DEVICE_TABLE(platform, rb4xx_gpio_id_table); static struct platform_driver rb4xx_gpio_driver = { .probe = rb4xx_gpio_probe, - .remove = rb4xx_gpio_remove, .id_table = rb4xx_gpio_id_table, .driver = { .name = "rb4xx-gpio", diff --git a/target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c b/target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c index 4b21c93469f..b2c8e633051 100644 --- a/target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c +++ b/target/linux/ath79/files/drivers/gpio/gpio-rb91x-key.c @@ -144,13 +144,19 @@ static int gpio_rb91x_key_probe(struct platform_device *pdev) struct gpio_rb91x_key *drvdata; struct gpio_chip *gc; struct device *dev = &pdev->dev; + int err; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; - mutex_init(&drvdata->mutex); - mutex_init(&drvdata->poll_mutex); + err = devm_mutex_init(dev, &drvdata->mutex); + if (err) + return err; + + err = devm_mutex_init(dev, &drvdata->poll_mutex); + if (err) + return err; drvdata->gpio = devm_gpiod_get(dev, NULL, GPIOD_OUT_LOW); if (IS_ERR(drvdata->gpio)) @@ -167,8 +173,6 @@ static int gpio_rb91x_key_probe(struct platform_device *pdev) gc->direction_output = gpio_rb91x_key_direction_output; gc->direction_input = gpio_rb91x_key_direction_input; - platform_set_drvdata(pdev, drvdata); - return devm_gpiochip_add_data(dev, gc, drvdata); } diff --git a/target/linux/ath79/mikrotik/config-default b/target/linux/ath79/mikrotik/config-default index 0dd79d9adc0..2976c244706 100644 --- a/target/linux/ath79/mikrotik/config-default +++ b/target/linux/ath79/mikrotik/config-default @@ -15,6 +15,7 @@ CONFIG_MFD_CORE=y CONFIG_MFD_RB4XX_CPLD=y CONFIG_MIKROTIK=y CONFIG_MIKROTIK_RB_SYSFS=y +CONFIG_MIKROTIK_WLAN_DECOMPRESS_LZ77=y CONFIG_MTD_NAND_AR934X=y CONFIG_MTD_NAND_CORE=y CONFIG_MTD_NAND_ECC=y diff --git a/target/linux/ath79/patches-6.6/700-phy-add-ath79-usb-phys.patch b/target/linux/ath79/patches-6.6/700-phy-add-ath79-usb-phys.patch index 0a9de68a398..98c399c9e09 100644 --- a/target/linux/ath79/patches-6.6/700-phy-add-ath79-usb-phys.patch +++ b/target/linux/ath79/patches-6.6/700-phy-add-ath79-usb-phys.patch @@ -51,7 +51,7 @@ Signed-off-by: John Crispin obj-$(CONFIG_PHY_LPC18XX_USB_OTG) += phy-lpc18xx-usb-otg.o --- /dev/null +++ b/drivers/phy/phy-ar7100-usb.c -@@ -0,0 +1,140 @@ +@@ -0,0 +1,127 @@ +/* + * Copyright (C) 2018 John Crispin + * @@ -118,50 +118,38 @@ Signed-off-by: John Crispin +static int ar7100_usb_phy_probe(struct platform_device *pdev) +{ + struct phy_provider *phy_provider; -+ struct resource *res; + struct ar7100_usb_phy *priv; + + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ priv->io_base = devm_ioremap_resource(&pdev->dev, res); ++ priv->io_base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(priv->io_base)) + return PTR_ERR(priv->io_base); + + priv->rst_phy = devm_reset_control_get(&pdev->dev, "usb-phy"); -+ if (IS_ERR(priv->rst_phy)) { -+ dev_err(&pdev->dev, "phy reset is missing\n"); -+ return PTR_ERR(priv->rst_phy); -+ } ++ if (IS_ERR(priv->rst_phy)) ++ return dev_err_probe(&pdev->dev, PTR_ERR(priv->rst_phy), "phy reset is missing"); + + priv->rst_host = devm_reset_control_get(&pdev->dev, "usb-host"); -+ if (IS_ERR(priv->rst_host)) { -+ dev_err(&pdev->dev, "host reset is missing\n"); -+ return PTR_ERR(priv->rst_host); -+ } ++ if (IS_ERR(priv->rst_host)) ++ return dev_err_probe(&pdev->dev, PTR_ERR(priv->rst_host), "host reset is missing"); + + priv->rst_ohci_dll = devm_reset_control_get(&pdev->dev, "usb-ohci-dll"); -+ if (IS_ERR(priv->rst_ohci_dll)) { -+ dev_err(&pdev->dev, "ohci-dll reset is missing\n"); -+ return PTR_ERR(priv->rst_host); -+ } ++ if (IS_ERR(priv->rst_ohci_dll)) ++ return dev_err_probe(&pdev->dev, PTR_ERR(priv->rst_host), "ohci-dll reset is missing"); + + priv->phy = devm_phy_create(&pdev->dev, NULL, &ar7100_usb_phy_ops); -+ if (IS_ERR(priv->phy)) { -+ dev_err(&pdev->dev, "failed to create PHY\n"); -+ return PTR_ERR(priv->phy); -+ } ++ if (IS_ERR(priv->phy)) ++ return dev_err_probe(&pdev->dev, PTR_ERR(priv->phy), "failed to create PHY"); + + priv->gpio = of_get_named_gpio(pdev->dev.of_node, "gpios", 0); + if (gpio_is_valid(priv->gpio)) { + int ret = devm_gpio_request(&pdev->dev, priv->gpio, dev_name(&pdev->dev)); ++ if (ret) ++ return dev_err_probe(&pdev->dev, ret, "failed to request gpio"); + -+ if (ret) { -+ dev_err(&pdev->dev, "failed to request gpio\n"); -+ return ret; -+ } + gpio_export_with_name(gpio_to_desc(priv->gpio), 0, dev_name(&pdev->dev)); + gpio_set_value(priv->gpio, 1); + } @@ -170,7 +158,6 @@ Signed-off-by: John Crispin + + phy_provider = devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate); + -+ + return PTR_ERR_OR_ZERO(phy_provider); +} + @@ -194,7 +181,7 @@ Signed-off-by: John Crispin +MODULE_LICENSE("GPL"); --- /dev/null +++ b/drivers/phy/phy-ar7200-usb.c -@@ -0,0 +1,136 @@ +@@ -0,0 +1,120 @@ +/* + * Copyright (C) 2015 Alban Bedel + * @@ -264,44 +251,28 @@ Signed-off-by: John Crispin + return -ENOMEM; + + priv->rst_phy = devm_reset_control_get(&pdev->dev, "usb-phy"); -+ if (IS_ERR(priv->rst_phy)) { -+ if (PTR_ERR(priv->rst_phy) != -EPROBE_DEFER) -+ dev_err(&pdev->dev, "phy reset is missing\n"); -+ return PTR_ERR(priv->rst_phy); -+ } ++ if (IS_ERR(priv->rst_phy)) ++ return dev_err_probe(&pdev->dev, PTR_ERR(priv->rst_phy), "phy reset is missing"); + + priv->rst_phy_analog = devm_reset_control_get_optional( + &pdev->dev, "usb-phy-analog"); -+ if (IS_ERR(priv->rst_phy_analog)) { -+ if (PTR_ERR(priv->rst_phy_analog) == -ENOENT) -+ priv->rst_phy_analog = NULL; -+ else -+ return PTR_ERR(priv->rst_phy_analog); -+ } ++ if (IS_ERR(priv->rst_phy_analog)) ++ return PTR_ERR(priv->rst_phy_analog); + + priv->suspend_override = devm_reset_control_get_optional( + &pdev->dev, "usb-suspend-override"); -+ if (IS_ERR(priv->suspend_override)) { -+ if (PTR_ERR(priv->suspend_override) == -ENOENT) -+ priv->suspend_override = NULL; -+ else -+ return PTR_ERR(priv->suspend_override); -+ } ++ if (IS_ERR(priv->suspend_override)) ++ return PTR_ERR(priv->suspend_override); + + priv->phy = devm_phy_create(&pdev->dev, NULL, &ar7200_usb_phy_ops); -+ if (IS_ERR(priv->phy)) { -+ dev_err(&pdev->dev, "failed to create PHY\n"); -+ return PTR_ERR(priv->phy); -+ } ++ if (IS_ERR(priv->phy)) ++ return dev_err_probe(&pdev->dev, PTR_ERR(priv->phy), "failed to create PHY"); + + priv->gpio = of_get_named_gpio(pdev->dev.of_node, "gpios", 0); + if (gpio_is_valid(priv->gpio)) { + int ret = devm_gpio_request(&pdev->dev, priv->gpio, dev_name(&pdev->dev)); -+ -+ if (ret) { -+ dev_err(&pdev->dev, "failed to request gpio\n"); -+ return ret; -+ } ++ if (ret) ++ return dev_err_probe(&pdev->dev, ret, "failed to request gpio"); + gpio_export_with_name(gpio_to_desc(priv->gpio), 0, dev_name(&pdev->dev)); + gpio_set_value(priv->gpio, 1); + } diff --git a/target/linux/bcm27xx/patches-6.6/950-0028-drm-vc4_hdmi-Allow-hotplug-detect-to-be-forced.patch b/target/linux/bcm27xx/patches-6.6/950-0028-drm-vc4_hdmi-Allow-hotplug-detect-to-be-forced.patch index bcef11a2f8a..95b3ec7a248 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0028-drm-vc4_hdmi-Allow-hotplug-detect-to-be-forced.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0028-drm-vc4_hdmi-Allow-hotplug-detect-to-be-forced.patch @@ -45,9 +45,9 @@ Signed-off-by: Dom Cobley static const char * const output_format_str[] = { [VC4_HDMI_OUTPUT_RGB] = "RGB", [VC4_HDMI_OUTPUT_YUV420] = "YUV 4:2:0", -@@ -472,7 +478,9 @@ static int vc4_hdmi_connector_detect_ctx - - WARN_ON(pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev)); +@@ -478,7 +484,9 @@ static int vc4_hdmi_connector_detect_ctx + return connector_status_unknown; + } - if (vc4_hdmi->hpd_gpio) { + if (force_hotplug & BIT(vc4_hdmi->encoder.type - VC4_ENCODER_TYPE_HDMI0)) diff --git a/target/linux/bcm27xx/patches-6.6/950-0029-vc4_hdmi-Avoid-log-spam-for-audio-start-failure.patch b/target/linux/bcm27xx/patches-6.6/950-0029-vc4_hdmi-Avoid-log-spam-for-audio-start-failure.patch index ab66e4f6e5a..0baf803edf8 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0029-vc4_hdmi-Avoid-log-spam-for-audio-start-failure.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0029-vc4_hdmi-Avoid-log-spam-for-audio-start-failure.patch @@ -30,7 +30,7 @@ Signed-off-by: Dom Cobley --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -2394,7 +2394,7 @@ static int vc4_hdmi_audio_startup(struct +@@ -2400,7 +2400,7 @@ static int vc4_hdmi_audio_startup(struct } if (!vc4_hdmi_audio_can_stream(vc4_hdmi)) { diff --git a/target/linux/bcm27xx/patches-6.6/950-0035-drm-vc4-Calculate-bpc-based-on-max_requested_bpc.patch b/target/linux/bcm27xx/patches-6.6/950-0035-drm-vc4-Calculate-bpc-based-on-max_requested_bpc.patch index cdd85524389..f0fb3eb7d47 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0035-drm-vc4-Calculate-bpc-based-on-max_requested_bpc.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0035-drm-vc4-Calculate-bpc-based-on-max_requested_bpc.patch @@ -18,7 +18,7 @@ Signed-off-by: Matthias Reichl --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -2126,7 +2126,7 @@ vc4_hdmi_encoder_compute_config(const st +@@ -2132,7 +2132,7 @@ vc4_hdmi_encoder_compute_config(const st { struct drm_device *dev = vc4_hdmi->connector.dev; struct drm_connector_state *conn_state = &vc4_state->base; diff --git a/target/linux/bcm27xx/patches-6.6/950-0037-drm-vc4-drop-unnecessary-and-harmful-HDMI-RGB-format.patch b/target/linux/bcm27xx/patches-6.6/950-0037-drm-vc4-drop-unnecessary-and-harmful-HDMI-RGB-format.patch index b0b3080b7ff..b9fba16f695 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0037-drm-vc4-drop-unnecessary-and-harmful-HDMI-RGB-format.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0037-drm-vc4-drop-unnecessary-and-harmful-HDMI-RGB-format.patch @@ -25,7 +25,7 @@ Signed-off-by: Matthias Reichl --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1952,9 +1952,6 @@ vc4_hdmi_sink_supports_format_bpc(const +@@ -1958,9 +1958,6 @@ vc4_hdmi_sink_supports_format_bpc(const case VC4_HDMI_OUTPUT_RGB: drm_dbg(dev, "RGB Format, checking the constraints.\n"); diff --git a/target/linux/bcm27xx/patches-6.6/950-0038-drm-vc4-Limit-max_bpc-to-8-on-Pi0-3.patch b/target/linux/bcm27xx/patches-6.6/950-0038-drm-vc4-Limit-max_bpc-to-8-on-Pi0-3.patch index 96abd64f23f..2b86f419529 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0038-drm-vc4-Limit-max_bpc-to-8-on-Pi0-3.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0038-drm-vc4-Limit-max_bpc-to-8-on-Pi0-3.patch @@ -13,7 +13,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -756,7 +756,6 @@ static int vc4_hdmi_connector_init(struc +@@ -762,7 +762,6 @@ static int vc4_hdmi_connector_init(struc drm_connector_attach_colorspace_property(connector); drm_connector_attach_tv_margin_properties(connector); @@ -21,7 +21,7 @@ Signed-off-by: Dave Stevenson connector->polled = (DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT); -@@ -765,8 +764,12 @@ static int vc4_hdmi_connector_init(struc +@@ -771,8 +770,12 @@ static int vc4_hdmi_connector_init(struc connector->doublescan_allowed = 0; connector->stereo_allowed = 1; diff --git a/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch b/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch index cbaf6ac1e22..9470fb96943 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0061-Revert-Revert-xhci-add-quirk-for-host-controllers-th.patch @@ -14,7 +14,7 @@ We don't agree with upstream revert so undo it. --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -486,8 +486,10 @@ static void xhci_pci_quirks(struct devic +@@ -489,8 +489,10 @@ static void xhci_pci_quirks(struct devic pdev->device == 0x3432) xhci->quirks |= XHCI_BROKEN_STREAMS; diff --git a/target/linux/bcm27xx/patches-6.6/950-0076-bcm2835-rng-Avoid-initialising-if-already-enabled.patch b/target/linux/bcm27xx/patches-6.6/950-0076-bcm2835-rng-Avoid-initialising-if-already-enabled.patch index dff9974049e..ae559255356 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0076-bcm2835-rng-Avoid-initialising-if-already-enabled.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0076-bcm2835-rng-Avoid-initialising-if-already-enabled.patch @@ -10,7 +10,7 @@ Avoids the 0x40000 cycles of warmup again if firmware has already used it --- a/drivers/char/hw_random/bcm2835-rng.c +++ b/drivers/char/hw_random/bcm2835-rng.c -@@ -105,8 +105,10 @@ static int bcm2835_rng_init(struct hwrng +@@ -107,8 +107,10 @@ static int bcm2835_rng_init(struct hwrng } /* set warm-up count & enable */ diff --git a/target/linux/bcm27xx/patches-6.6/950-0086-Main-bcm2708-bcm2709-linux-port.patch b/target/linux/bcm27xx/patches-6.6/950-0086-Main-bcm2708-bcm2709-linux-port.patch index 22e182ba482..ad005dc2e15 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0086-Main-bcm2708-bcm2709-linux-port.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0086-Main-bcm2708-bcm2709-linux-port.patch @@ -125,10 +125,10 @@ board_bcm2835: Remove coherent dma pool increase - API has gone - ret = devm_request_irq(dev, irq_of_parse_and_map(dev->of_node, 0), + ret = devm_request_irq(dev, platform_get_irq(pdev, 0), - bcm2835_mbox_irq, 0, dev_name(dev), mbox); + bcm2835_mbox_irq, IRQF_NO_SUSPEND, dev_name(dev), + mbox); if (ret) { - dev_err(dev, "Failed to register a mailbox IRQ handler: %d\n", -@@ -192,7 +195,18 @@ static struct platform_driver bcm2835_mb +@@ -193,7 +196,18 @@ static struct platform_driver bcm2835_mb }, .probe = bcm2835_mbox_probe, }; diff --git a/target/linux/bcm27xx/patches-6.6/950-0092-MMC-added-alternative-MMC-driver.patch b/target/linux/bcm27xx/patches-6.6/950-0092-MMC-added-alternative-MMC-driver.patch index 48baa904039..aebb491f32a 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0092-MMC-added-alternative-MMC-driver.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0092-MMC-added-alternative-MMC-driver.patch @@ -285,7 +285,7 @@ Signed-off-by: Phil Elwell static inline int mmc_blk_part_switch(struct mmc_card *card, unsigned int part_type); static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, -@@ -3016,6 +3023,8 @@ static int mmc_blk_probe(struct mmc_card +@@ -3066,6 +3073,8 @@ static int mmc_blk_probe(struct mmc_card { struct mmc_blk_data *md; int ret = 0; @@ -294,7 +294,7 @@ Signed-off-by: Phil Elwell /* * Check that the card supports the command class(es) we need. -@@ -3023,7 +3032,16 @@ static int mmc_blk_probe(struct mmc_card +@@ -3073,7 +3082,16 @@ static int mmc_blk_probe(struct mmc_card if (!(card->csd.cmdclass & CCC_BLOCK_READ)) return -ENODEV; @@ -312,7 +312,7 @@ Signed-off-by: Phil Elwell card->complete_wq = alloc_workqueue("mmc_complete", WQ_MEM_RECLAIM | WQ_HIGHPRI, 0); -@@ -3038,6 +3056,17 @@ static int mmc_blk_probe(struct mmc_card +@@ -3088,6 +3106,17 @@ static int mmc_blk_probe(struct mmc_card goto out_free; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch index b35df5a3813..8685508ddf6 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0106-Add-support-for-all-the-downstream-rpi-sound-card-dr.patch @@ -17565,7 +17565,7 @@ Signed-off-by: Phil Elwell } --- a/sound/usb/card.c +++ b/sound/usb/card.c -@@ -857,8 +857,14 @@ static int usb_audio_probe(struct usb_in +@@ -863,8 +863,14 @@ static int usb_audio_probe(struct usb_in if (ignore_ctl_error) chip->quirk_flags |= QUIRK_FLAG_IGNORE_CTL_ERROR; @@ -17583,7 +17583,7 @@ Signed-off-by: Phil Elwell * For devices with more than one control interface, we assume the --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c -@@ -2191,6 +2191,8 @@ static const struct usb_audio_quirk_flag +@@ -2195,6 +2195,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x534d, 0x2109, /* MacroSilicon MS2109 */ QUIRK_FLAG_ALIGN_TRANSFER), diff --git a/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch b/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch index b102bc33fc4..8a04903f7d3 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0169-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch @@ -33,7 +33,7 @@ Signed-off-by: Jonathan Bell #define USB_VENDOR_ID_BELKIN 0x050d #define USB_DEVICE_ID_FLIP_KVM 0x3201 -@@ -1409,6 +1412,9 @@ +@@ -1394,6 +1397,9 @@ #define USB_VENDOR_ID_XIAOMI 0x2717 #define USB_DEVICE_ID_MI_SILENT_MOUSE 0x5014 diff --git a/target/linux/bcm27xx/patches-6.6/950-0468-drm-vc4-hdmi-Increase-MAI-fifo-dreq-threshold.patch b/target/linux/bcm27xx/patches-6.6/950-0468-drm-vc4-hdmi-Increase-MAI-fifo-dreq-threshold.patch index f618bbeb8d5..a0c1eba9310 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0468-drm-vc4-hdmi-Increase-MAI-fifo-dreq-threshold.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0468-drm-vc4-hdmi-Increase-MAI-fifo-dreq-threshold.patch @@ -16,7 +16,7 @@ Signed-off-by: Dom Cobley --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -2521,6 +2521,7 @@ static int vc4_hdmi_audio_prepare(struct +@@ -2527,6 +2527,7 @@ static int vc4_hdmi_audio_prepare(struct { struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); struct drm_device *drm = vc4_hdmi->connector.dev; @@ -24,7 +24,7 @@ Signed-off-by: Dom Cobley struct drm_encoder *encoder = &vc4_hdmi->encoder.base; unsigned int sample_rate = params->sample_rate; unsigned int channels = params->channels; -@@ -2579,11 +2580,18 @@ static int vc4_hdmi_audio_prepare(struct +@@ -2585,11 +2586,18 @@ static int vc4_hdmi_audio_prepare(struct VC4_HDMI_AUDIO_PACKET_CEA_MASK); /* Set the MAI threshold */ diff --git a/target/linux/bcm27xx/patches-6.6/950-0481-xhci-Use-more-event-ring-segment-table-entries.patch b/target/linux/bcm27xx/patches-6.6/950-0481-xhci-Use-more-event-ring-segment-table-entries.patch index f9fa454aeb1..27a43828dd4 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0481-xhci-Use-more-event-ring-segment-table-entries.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0481-xhci-Use-more-event-ring-segment-table-entries.patch @@ -52,7 +52,7 @@ Signed-off-by: Jonathan Bell erst_base = xhci_read_64(xhci, &ir->ir_set->erst_base); --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1680,8 +1680,9 @@ struct urb_priv { +@@ -1681,8 +1681,9 @@ struct urb_priv { * Each segment table entry is 4*32bits long. 1K seems like an ok size: * (1K bytes * 8bytes/bit) / (4*32 bits) = 64 segment entries in the table, * meaning 64 ring segments. diff --git a/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch b/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch index 65d04a01ee7..948610d5763 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0482-xhci-quirks-add-link-TRB-quirk-for-VL805.patch @@ -24,7 +24,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -489,6 +489,7 @@ static void xhci_pci_quirks(struct devic +@@ -492,6 +492,7 @@ static void xhci_pci_quirks(struct devic if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) { xhci->quirks |= XHCI_LPM_SUPPORT; xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; @@ -52,9 +52,9 @@ Signed-off-by: Jonathan Bell addr = xhci_trb_virt_to_dma(new_seg, new_deq); --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1915,6 +1915,9 @@ struct xhci_hcd { - #define XHCI_ZHAOXIN_TRB_FETCH BIT_ULL(45) - #define XHCI_ZHAOXIN_HOST BIT_ULL(46) +@@ -1918,6 +1918,9 @@ struct xhci_hcd { + #define XHCI_WRITE_64_HI_LO BIT_ULL(47) + #define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48) +/* Downstream VLI fixes */ +#define XHCI_AVOID_DQ_ON_LINK BIT_ULL(56) diff --git a/target/linux/bcm27xx/patches-6.6/950-0483-usb-xhci-borrow-upstream-TRB_FETCH-quirk-on-VL805-ho.patch b/target/linux/bcm27xx/patches-6.6/950-0483-usb-xhci-borrow-upstream-TRB_FETCH-quirk-on-VL805-ho.patch index fa7a10e3163..db805590694 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0483-usb-xhci-borrow-upstream-TRB_FETCH-quirk-on-VL805-ho.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0483-usb-xhci-borrow-upstream-TRB_FETCH-quirk-on-VL805-ho.patch @@ -22,7 +22,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -490,6 +490,7 @@ static void xhci_pci_quirks(struct devic +@@ -493,6 +493,7 @@ static void xhci_pci_quirks(struct devic xhci->quirks |= XHCI_LPM_SUPPORT; xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; xhci->quirks |= XHCI_AVOID_DQ_ON_LINK; diff --git a/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch b/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch index ef0ef479693..9af7fc81764 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0484-usb-xhci-add-VLI_SS_BULK_OUT_BUG-quirk.patch @@ -90,7 +90,7 @@ Signed-off-by: Jonathan Bell /* Allow 3 retries for everything but isoc, set CErr = 3 */ --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -491,6 +491,7 @@ static void xhci_pci_quirks(struct devic +@@ -494,6 +494,7 @@ static void xhci_pci_quirks(struct devic xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; xhci->quirks |= XHCI_AVOID_DQ_ON_LINK; xhci->quirks |= XHCI_ZHAOXIN_TRB_FETCH; @@ -100,7 +100,7 @@ Signed-off-by: Jonathan Bell if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1917,6 +1917,7 @@ struct xhci_hcd { +@@ -1920,6 +1920,7 @@ struct xhci_hcd { /* Downstream VLI fixes */ #define XHCI_AVOID_DQ_ON_LINK BIT_ULL(56) diff --git a/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch index e1846dc8f51..45cf1b57255 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0485-usb-xhci-add-XHCI_VLI_HUB_TT_QUIRK.patch @@ -47,7 +47,7 @@ Signed-off-by: Jonathan Bell /* Device for a quirk */ #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73 #define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000 -@@ -291,6 +293,16 @@ static int xhci_pci_reinit(struct xhci_h +@@ -294,6 +296,16 @@ static int xhci_pci_reinit(struct xhci_h return 0; } @@ -64,7 +64,7 @@ Signed-off-by: Jonathan Bell static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) { struct pci_dev *pdev = to_pci_dev(dev); -@@ -492,6 +504,8 @@ static void xhci_pci_quirks(struct devic +@@ -495,6 +507,8 @@ static void xhci_pci_quirks(struct devic xhci->quirks |= XHCI_AVOID_DQ_ON_LINK; xhci->quirks |= XHCI_ZHAOXIN_TRB_FETCH; xhci->quirks |= XHCI_VLI_SS_BULK_OUT_BUG; @@ -75,7 +75,7 @@ Signed-off-by: Jonathan Bell if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -3657,6 +3657,48 @@ static int xhci_align_td(struct xhci_hcd +@@ -3671,6 +3671,48 @@ static int xhci_align_td(struct xhci_hcd return 1; } @@ -124,7 +124,7 @@ Signed-off-by: Jonathan Bell /* This is very similar to what ehci-q.c qtd_fill() does */ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, int slot_id, unsigned int ep_index) -@@ -3813,6 +3855,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3827,6 +3869,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * } check_trb_math(urb, enqd_len); @@ -133,7 +133,7 @@ Signed-off-by: Jonathan Bell giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, start_cycle, start_trb); return 0; -@@ -3948,6 +3992,8 @@ int xhci_queue_ctrl_tx(struct xhci_hcd * +@@ -3962,6 +4006,8 @@ int xhci_queue_ctrl_tx(struct xhci_hcd * /* Event on completion */ field | TRB_IOC | TRB_TYPE(TRB_STATUS) | ep_ring->cycle_state); @@ -144,7 +144,7 @@ Signed-off-by: Jonathan Bell return 0; --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1918,6 +1918,7 @@ struct xhci_hcd { +@@ -1921,6 +1921,7 @@ struct xhci_hcd { /* Downstream VLI fixes */ #define XHCI_AVOID_DQ_ON_LINK BIT_ULL(56) #define XHCI_VLI_SS_BULK_OUT_BUG BIT_ULL(57) diff --git a/target/linux/bcm27xx/patches-6.6/950-0535-i2c-designware-Add-SMBUS-quick-command-support.patch b/target/linux/bcm27xx/patches-6.6/950-0535-i2c-designware-Add-SMBUS-quick-command-support.patch index 329b8375735..ed57365598a 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0535-i2c-designware-Add-SMBUS-quick-command-support.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0535-i2c-designware-Add-SMBUS-quick-command-support.patch @@ -17,7 +17,7 @@ Signed-off-by: Phil Elwell --- a/drivers/i2c/busses/i2c-designware-core.h +++ b/drivers/i2c/busses/i2c-designware-core.h -@@ -122,7 +122,9 @@ +@@ -123,7 +123,9 @@ #define DW_IC_ERR_TX_ABRT 0x1 @@ -40,7 +40,7 @@ Signed-off-by: Phil Elwell regmap_update_bits(dev->map, DW_IC_CON, DW_IC_CON_10BITADDR_MASTER, ic_con); -@@ -472,6 +476,14 @@ i2c_dw_xfer_msg(struct dw_i2c_dev *dev) +@@ -500,6 +504,14 @@ i2c_dw_xfer_msg(struct dw_i2c_dev *dev) regmap_read(dev->map, DW_IC_RXFLR, &flr); rx_limit = dev->rx_fifo_depth - flr; @@ -55,7 +55,7 @@ Signed-off-by: Phil Elwell while (buf_len > 0 && tx_limit > 0 && rx_limit > 0) { u32 cmd = 0; -@@ -743,7 +755,7 @@ static const struct i2c_algorithm i2c_dw +@@ -781,7 +793,7 @@ static const struct i2c_algorithm i2c_dw }; static const struct i2c_adapter_quirks i2c_dw_quirks = { @@ -64,7 +64,7 @@ Signed-off-by: Phil Elwell }; static u32 i2c_dw_read_clear_intrbits(struct dw_i2c_dev *dev) -@@ -876,7 +888,8 @@ void i2c_dw_configure_master(struct dw_i +@@ -914,7 +926,8 @@ void i2c_dw_configure_master(struct dw_i { struct i2c_timings *t = &dev->timings; diff --git a/target/linux/bcm27xx/patches-6.6/950-0578-drm-vc4-hdmi-Enable-the-audio-clock.patch b/target/linux/bcm27xx/patches-6.6/950-0578-drm-vc4-hdmi-Enable-the-audio-clock.patch index c7d6fed16e7..79d040070f0 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0578-drm-vc4-hdmi-Enable-the-audio-clock.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0578-drm-vc4-hdmi-Enable-the-audio-clock.patch @@ -18,7 +18,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -3589,6 +3589,7 @@ static int vc4_hdmi_runtime_suspend(stru +@@ -3595,6 +3595,7 @@ static int vc4_hdmi_runtime_suspend(stru { struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); @@ -26,7 +26,7 @@ Signed-off-by: Maxime Ripard clk_disable_unprepare(vc4_hdmi->hsm_clock); return 0; -@@ -3621,6 +3622,10 @@ static int vc4_hdmi_runtime_resume(struc +@@ -3627,6 +3628,10 @@ static int vc4_hdmi_runtime_resume(struc goto err_disable_clk; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0585-drm-vc4-Introduce-generation-number-enum.patch b/target/linux/bcm27xx/patches-6.6/950-0585-drm-vc4-Introduce-generation-number-enum.patch index fe6ecf9293f..ce5361905be 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0585-drm-vc4-Introduce-generation-number-enum.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0585-drm-vc4-Introduce-generation-number-enum.patch @@ -470,7 +470,7 @@ Signed-off-by: Maxime Ripard switch (args->madv) { --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -2580,7 +2580,7 @@ static int vc4_hdmi_audio_prepare(struct +@@ -2586,7 +2586,7 @@ static int vc4_hdmi_audio_prepare(struct VC4_HDMI_AUDIO_PACKET_CEA_MASK); /* Set the MAI threshold */ diff --git a/target/linux/bcm27xx/patches-6.6/950-0601-drm-vc4-hvs-Remove-ABORT_ON_EMPTY-flag.patch b/target/linux/bcm27xx/patches-6.6/950-0601-drm-vc4-hvs-Remove-ABORT_ON_EMPTY-flag.patch index 2ed6d7400b6..12a37f1d95a 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0601-drm-vc4-hvs-Remove-ABORT_ON_EMPTY-flag.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0601-drm-vc4-hvs-Remove-ABORT_ON_EMPTY-flag.patch @@ -30,7 +30,7 @@ Signed-off-by: Dom Cobley --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1862,6 +1862,7 @@ static void vc4_hdmi_encoder_post_crtc_e +@@ -1868,6 +1868,7 @@ static void vc4_hdmi_encoder_post_crtc_e VC4_HD_VID_CTL_CLRRGB | VC4_HD_VID_CTL_UNDERFLOW_ENABLE | VC4_HD_VID_CTL_FRAME_COUNTER_RESET | diff --git a/target/linux/bcm27xx/patches-6.6/950-0612-drm-vc4-hdmi-Add-support-for-BCM2712-HDMI-controller.patch b/target/linux/bcm27xx/patches-6.6/950-0612-drm-vc4-hdmi-Add-support-for-BCM2712-HDMI-controller.patch index d34ead0f5eb..20b24b1c443 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0612-drm-vc4-hdmi-Add-support-for-BCM2712-HDMI-controller.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0612-drm-vc4-hdmi-Add-support-for-BCM2712-HDMI-controller.patch @@ -20,7 +20,7 @@ Signed-off-by: Maxime Ripard --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1102,6 +1102,7 @@ static void vc4_hdmi_encoder_post_crtc_d +@@ -1108,6 +1108,7 @@ static void vc4_hdmi_encoder_post_crtc_d { struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); struct drm_device *drm = vc4_hdmi->connector.dev; @@ -28,7 +28,7 @@ Signed-off-by: Maxime Ripard unsigned long flags; int idx; -@@ -1118,14 +1119,25 @@ static void vc4_hdmi_encoder_post_crtc_d +@@ -1124,14 +1125,25 @@ static void vc4_hdmi_encoder_post_crtc_d HDMI_WRITE(HDMI_VID_CTL, HDMI_READ(HDMI_VID_CTL) | VC4_HD_VID_CTL_CLRRGB); @@ -58,7 +58,7 @@ Signed-off-by: Maxime Ripard vc4_hdmi_disable_scrambling(encoder); -@@ -1753,7 +1765,6 @@ static void vc4_hdmi_encoder_pre_crtc_co +@@ -1759,7 +1771,6 @@ static void vc4_hdmi_encoder_pre_crtc_co goto err_put_runtime_pm; } @@ -66,7 +66,7 @@ Signed-off-by: Maxime Ripard vc4_hdmi_cec_update_clk_div(vc4_hdmi); if (tmds_char_rate > 297000000) -@@ -1858,6 +1869,7 @@ static void vc4_hdmi_encoder_post_crtc_e +@@ -1864,6 +1875,7 @@ static void vc4_hdmi_encoder_post_crtc_e spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); HDMI_WRITE(HDMI_VID_CTL, @@ -74,7 +74,7 @@ Signed-off-by: Maxime Ripard VC4_HD_VID_CTL_ENABLE | VC4_HD_VID_CTL_CLRRGB | VC4_HD_VID_CTL_UNDERFLOW_ENABLE | -@@ -3751,7 +3763,9 @@ static int vc4_hdmi_bind(struct device * +@@ -3757,7 +3769,9 @@ static int vc4_hdmi_bind(struct device * return ret; if ((of_device_is_compatible(dev->of_node, "brcm,bcm2711-hdmi0") || @@ -85,7 +85,7 @@ Signed-off-by: Maxime Ripard HDMI_READ(HDMI_VID_CTL) & VC4_HD_VID_CTL_ENABLE) { clk_prepare_enable(vc4_hdmi->pixel_clock); clk_prepare_enable(vc4_hdmi->hsm_clock); -@@ -3885,10 +3899,66 @@ static const struct vc4_hdmi_variant bcm +@@ -3891,10 +3905,66 @@ static const struct vc4_hdmi_variant bcm .hp_detect = vc5_hdmi_hp_detect, }; diff --git a/target/linux/bcm27xx/patches-6.6/950-0713-drm-vc4-crtc-Support-odd-horizontal-timings-on-BCM27.patch b/target/linux/bcm27xx/patches-6.6/950-0713-drm-vc4-crtc-Support-odd-horizontal-timings-on-BCM27.patch index be9fce689b3..26d2e50d03a 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0713-drm-vc4-crtc-Support-odd-horizontal-timings-on-BCM27.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0713-drm-vc4-crtc-Support-odd-horizontal-timings-on-BCM27.patch @@ -75,7 +75,7 @@ Signed-off-by: Dom Cobley }, --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -3912,7 +3912,7 @@ static const struct vc4_hdmi_variant bcm +@@ -3918,7 +3918,7 @@ static const struct vc4_hdmi_variant bcm PHY_LANE_2, PHY_LANE_CK, }, @@ -84,7 +84,7 @@ Signed-off-by: Dom Cobley .external_irq_controller = true, .init_resources = vc5_hdmi_init_resources, -@@ -3939,7 +3939,7 @@ static const struct vc4_hdmi_variant bcm +@@ -3945,7 +3945,7 @@ static const struct vc4_hdmi_variant bcm PHY_LANE_2, PHY_LANE_CK, }, diff --git a/target/linux/bcm27xx/patches-6.6/950-0831-vc4-hdmi-Update-MAI_THR-for-D0.patch b/target/linux/bcm27xx/patches-6.6/950-0831-vc4-hdmi-Update-MAI_THR-for-D0.patch index c8d41311ada..eaf2cb09516 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0831-vc4-hdmi-Update-MAI_THR-for-D0.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0831-vc4-hdmi-Update-MAI_THR-for-D0.patch @@ -14,7 +14,7 @@ Signed-off-by: Dom Cobley --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -2597,7 +2597,13 @@ static int vc4_hdmi_audio_prepare(struct +@@ -2603,7 +2603,13 @@ static int vc4_hdmi_audio_prepare(struct VC4_HDMI_AUDIO_PACKET_CEA_MASK); /* Set the MAI threshold */ diff --git a/target/linux/bcm27xx/patches-6.6/950-0864-i2c-designware-Support-non-standard-bus-speeds.patch b/target/linux/bcm27xx/patches-6.6/950-0864-i2c-designware-Support-non-standard-bus-speeds.patch index 6bc3ca65d4e..0e1cd5bf2a1 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0864-i2c-designware-Support-non-standard-bus-speeds.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0864-i2c-designware-Support-non-standard-bus-speeds.patch @@ -59,7 +59,7 @@ Signed-off-by: Phil Elwell --- a/drivers/i2c/busses/i2c-designware-core.h +++ b/drivers/i2c/busses/i2c-designware-core.h -@@ -291,6 +291,7 @@ struct dw_i2c_dev { +@@ -292,6 +292,7 @@ struct dw_i2c_dev { u16 fp_lcnt; u16 hs_hcnt; u16 hs_lcnt; diff --git a/target/linux/bcm27xx/patches-6.6/950-0930-vc4-Add-jack-detection-to-HDMI-audio-driver.patch b/target/linux/bcm27xx/patches-6.6/950-0930-vc4-Add-jack-detection-to-HDMI-audio-driver.patch index 465ae34ed76..325f0d61243 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0930-vc4-Add-jack-detection-to-HDMI-audio-driver.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0930-vc4-Add-jack-detection-to-HDMI-audio-driver.patch @@ -58,7 +58,7 @@ Signed-off-by: David Turner if (!edid) return; -@@ -2691,8 +2705,23 @@ static int vc4_hdmi_audio_get_eld(struct +@@ -2697,8 +2711,23 @@ static int vc4_hdmi_audio_get_eld(struct return 0; } @@ -82,7 +82,7 @@ Signed-off-by: David Turner .prepare = vc4_hdmi_audio_prepare, .audio_shutdown = vc4_hdmi_audio_shutdown, .audio_startup = vc4_hdmi_audio_startup, -@@ -2712,6 +2741,22 @@ static void vc4_hdmi_audio_codec_release +@@ -2718,6 +2747,22 @@ static void vc4_hdmi_audio_codec_release vc4_hdmi->audio.codec_pdev = NULL; } @@ -105,7 +105,7 @@ Signed-off-by: David Turner static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) { const struct vc4_hdmi_register *mai_data = -@@ -2841,6 +2886,8 @@ static int vc4_hdmi_audio_init(struct vc +@@ -2847,6 +2892,8 @@ static int vc4_hdmi_audio_init(struct vc dai_link->codecs->name = dev_name(&codec_pdev->dev); dai_link->platforms->name = dev_name(dev); @@ -114,7 +114,7 @@ Signed-off-by: David Turner card->dai_link = dai_link; card->num_links = 1; card->name = vc4_hdmi->variant->card_name; -@@ -3701,6 +3748,8 @@ static int vc4_hdmi_bind(struct device * +@@ -3707,6 +3754,8 @@ static int vc4_hdmi_bind(struct device * if (ret) return ret; @@ -123,7 +123,7 @@ Signed-off-by: David Turner spin_lock_init(&vc4_hdmi->hw_lock); INIT_DELAYED_WORK(&vc4_hdmi->scrambling_work, vc4_hdmi_scrambling_wq); -@@ -3813,8 +3862,16 @@ err_put_runtime_pm: +@@ -3819,8 +3868,16 @@ err_put_runtime_pm: return ret; } diff --git a/target/linux/bcm27xx/patches-6.6/950-0998-i2c-designware-Add-support-for-bus-clear-feature.patch b/target/linux/bcm27xx/patches-6.6/950-0998-i2c-designware-Add-support-for-bus-clear-feature.patch index 15bce96265a..5eb4bcc5d2a 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0998-i2c-designware-Add-support-for-bus-clear-feature.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0998-i2c-designware-Add-support-for-bus-clear-feature.patch @@ -33,7 +33,7 @@ Signed-off-by: Phil Elwell }; static int dw_reg_read(void *context, unsigned int reg, unsigned int *val) -@@ -593,8 +595,16 @@ int i2c_dw_wait_bus_not_busy(struct dw_i +@@ -607,8 +609,16 @@ int i2c_dw_wait_bus_not_busy(struct dw_i int i2c_dw_handle_tx_abort(struct dw_i2c_dev *dev) { unsigned long abort_source = dev->abort_source; @@ -50,7 +50,7 @@ Signed-off-by: Phil Elwell if (abort_source & DW_IC_TX_ABRT_NOACK) { for_each_set_bit(i, &abort_source, ARRAY_SIZE(abort_sources)) dev_dbg(dev->dev, -@@ -609,6 +619,8 @@ int i2c_dw_handle_tx_abort(struct dw_i2c +@@ -623,6 +633,8 @@ int i2c_dw_handle_tx_abort(struct dw_i2c return -EAGAIN; else if (abort_source & DW_IC_TX_ABRT_GCALL_READ) return -EINVAL; /* wrong msgs[] data */ @@ -74,11 +74,9 @@ Signed-off-by: Phil Elwell #define DW_IC_COMP_TYPE 0xfc #define DW_IC_COMP_TYPE_VALUE 0x44570140 /* "DW" + 0x0140 */ -@@ -109,13 +112,16 @@ - DW_IC_INTR_RX_UNDER | \ - DW_IC_INTR_RD_REQ) +@@ -111,12 +114,14 @@ -+#define DW_IC_ENABLE_ENABLE BIT(0) + #define DW_IC_ENABLE_ENABLE BIT(0) #define DW_IC_ENABLE_ABORT BIT(1) +#define DW_IC_ENABLE_BUS_RECOVERY BIT(3) @@ -91,7 +89,7 @@ Signed-off-by: Phil Elwell #define DW_IC_SDA_HOLD_RX_SHIFT 16 #define DW_IC_SDA_HOLD_RX_MASK GENMASK(23, 16) -@@ -163,6 +169,7 @@ +@@ -164,6 +169,7 @@ #define ABRT_SLAVE_FLUSH_TXFIFO 13 #define ABRT_SLAVE_ARBLOST 14 #define ABRT_SLAVE_RD_INTX 15 @@ -99,7 +97,7 @@ Signed-off-by: Phil Elwell #define DW_IC_TX_ABRT_7B_ADDR_NOACK BIT(ABRT_7B_ADDR_NOACK) #define DW_IC_TX_ABRT_10ADDR1_NOACK BIT(ABRT_10ADDR1_NOACK) -@@ -178,6 +185,7 @@ +@@ -179,6 +185,7 @@ #define DW_IC_RX_ABRT_SLAVE_RD_INTX BIT(ABRT_SLAVE_RD_INTX) #define DW_IC_RX_ABRT_SLAVE_ARBLOST BIT(ABRT_SLAVE_ARBLOST) #define DW_IC_RX_ABRT_SLAVE_FLUSH_TXFIFO BIT(ABRT_SLAVE_FLUSH_TXFIFO) @@ -135,7 +133,7 @@ Signed-off-by: Phil Elwell /* Write SDA hold time if supported */ if (dev->sda_hold_time) regmap_write(dev->map, DW_IC_SDA_HOLD, dev->sda_hold_time); -@@ -1033,6 +1045,7 @@ int i2c_dw_probe_master(struct dw_i2c_de +@@ -1071,6 +1083,7 @@ int i2c_dw_probe_master(struct dw_i2c_de struct i2c_adapter *adap = &dev->adapter; unsigned long irq_flags; unsigned int ic_con; @@ -143,7 +141,7 @@ Signed-off-by: Phil Elwell int ret; init_completion(&dev->cmd_complete); -@@ -1068,7 +1081,11 @@ int i2c_dw_probe_master(struct dw_i2c_de +@@ -1106,7 +1119,11 @@ int i2c_dw_probe_master(struct dw_i2c_de if (ret) return ret; diff --git a/target/linux/bcm27xx/patches-6.6/950-1049-vc4-hdmi-Ignore-hotplug-interrupt-with-force_hotplug.patch b/target/linux/bcm27xx/patches-6.6/950-1049-vc4-hdmi-Ignore-hotplug-interrupt-with-force_hotplug.patch index 0aa56916b26..43226876434 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1049-vc4-hdmi-Ignore-hotplug-interrupt-with-force_hotplug.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1049-vc4-hdmi-Ignore-hotplug-interrupt-with-force_hotplug.patch @@ -31,7 +31,7 @@ Signed-off-by: Dom Cobley --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -2917,7 +2917,7 @@ static irqreturn_t vc4_hdmi_hpd_irq_thre +@@ -2923,7 +2923,7 @@ static irqreturn_t vc4_hdmi_hpd_irq_thre struct drm_connector *connector = &vc4_hdmi->connector; struct drm_device *dev = connector->dev; diff --git a/target/linux/bcm27xx/patches-6.6/950-1109-fix-Hsync-and-Vsync-polarity-can-t-change-from-negat.patch b/target/linux/bcm27xx/patches-6.6/950-1109-fix-Hsync-and-Vsync-polarity-can-t-change-from-negat.patch index c680279eabc..a55f6bab529 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1109-fix-Hsync-and-Vsync-polarity-can-t-change-from-negat.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1109-fix-Hsync-and-Vsync-polarity-can-t-change-from-negat.patch @@ -20,7 +20,7 @@ Signed-off-by: Michiel Vanbiervliet --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -1883,14 +1883,15 @@ static void vc4_hdmi_encoder_post_crtc_e +@@ -1889,14 +1889,15 @@ static void vc4_hdmi_encoder_post_crtc_e spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); HDMI_WRITE(HDMI_VID_CTL, diff --git a/target/linux/bcm27xx/patches-6.6/950-1117-drm-vc4-hdmi-Add-property-to-allow-manual-config-of-.patch b/target/linux/bcm27xx/patches-6.6/950-1117-drm-vc4-hdmi-Add-property-to-allow-manual-config-of-.patch index e8d0224ab1a..01437fa6d29 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1117-drm-vc4-hdmi-Add-property-to-allow-manual-config-of-.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1117-drm-vc4-hdmi-Add-property-to-allow-manual-config-of-.patch @@ -20,7 +20,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -599,6 +599,7 @@ static int vc4_hdmi_connector_atomic_che +@@ -605,6 +605,7 @@ static int vc4_hdmi_connector_atomic_che if (old_state->colorspace != new_state->colorspace || old_vc4_state->broadcast_rgb != new_vc4_state->broadcast_rgb || @@ -28,7 +28,7 @@ Signed-off-by: Dave Stevenson !drm_connector_atomic_hdr_metadata_equal(old_state, new_state)) { struct drm_crtc_state *crtc_state; -@@ -625,6 +626,8 @@ static int vc4_hdmi_connector_get_proper +@@ -631,6 +632,8 @@ static int vc4_hdmi_connector_get_proper if (property == vc4_hdmi->broadcast_rgb_property) { *val = vc4_conn_state->broadcast_rgb; @@ -37,7 +37,7 @@ Signed-off-by: Dave Stevenson } else { drm_dbg(drm, "Unknown property [PROP:%d:%s]\n", property->base.id, property->name); -@@ -648,6 +651,9 @@ static int vc4_hdmi_connector_set_proper +@@ -654,6 +657,9 @@ static int vc4_hdmi_connector_set_proper if (property == vc4_hdmi->broadcast_rgb_property) { vc4_conn_state->broadcast_rgb = val; return 0; @@ -47,7 +47,7 @@ Signed-off-by: Dave Stevenson } drm_dbg(drm, "Unknown property [PROP:%d:%s]\n", -@@ -692,6 +698,7 @@ vc4_hdmi_connector_duplicate_state(struc +@@ -698,6 +704,7 @@ vc4_hdmi_connector_duplicate_state(struc new_state->tmds_char_rate = vc4_state->tmds_char_rate; new_state->output_bpc = vc4_state->output_bpc; new_state->output_format = vc4_state->output_format; @@ -55,7 +55,7 @@ Signed-off-by: Dave Stevenson new_state->broadcast_rgb = vc4_state->broadcast_rgb; __drm_atomic_helper_connector_duplicate_state(connector, &new_state->base); -@@ -740,6 +747,33 @@ vc4_hdmi_attach_broadcast_rgb_property(s +@@ -746,6 +753,33 @@ vc4_hdmi_attach_broadcast_rgb_property(s VC4_HDMI_BROADCAST_RGB_AUTO); } @@ -89,7 +89,7 @@ Signed-off-by: Dave Stevenson static int vc4_hdmi_connector_init(struct drm_device *dev, struct vc4_hdmi *vc4_hdmi) { -@@ -790,6 +824,7 @@ static int vc4_hdmi_connector_init(struc +@@ -796,6 +830,7 @@ static int vc4_hdmi_connector_init(struc } vc4_hdmi_attach_broadcast_rgb_property(dev, vc4_hdmi); @@ -97,7 +97,7 @@ Signed-off-by: Dave Stevenson drm_connector_attach_encoder(connector, encoder); -@@ -1960,6 +1995,10 @@ static void vc4_hdmi_encoder_atomic_mode +@@ -1966,6 +2001,10 @@ static void vc4_hdmi_encoder_atomic_mode &crtc_state->adjusted_mode); vc4_hdmi->output_bpc = vc4_state->output_bpc; vc4_hdmi->output_format = vc4_state->output_format; @@ -108,7 +108,7 @@ Signed-off-by: Dave Stevenson mutex_unlock(&vc4_hdmi->mutex); } -@@ -2118,6 +2157,26 @@ vc4_hdmi_encoder_compute_format(const st +@@ -2124,6 +2163,26 @@ vc4_hdmi_encoder_compute_format(const st const struct drm_display_info *info = &connector->display_info; unsigned int format; diff --git a/target/linux/bcm27xx/patches-6.6/950-1127-drm-vc4-Use-phys-addresses-for-slave-DMA-config.patch b/target/linux/bcm27xx/patches-6.6/950-1127-drm-vc4-Use-phys-addresses-for-slave-DMA-config.patch index 119a90ae126..32b2afb68da 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1127-drm-vc4-Use-phys-addresses-for-slave-DMA-config.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1127-drm-vc4-Use-phys-addresses-for-slave-DMA-config.patch @@ -13,7 +13,7 @@ Signed-off-by: Phil Elwell --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -2825,7 +2825,7 @@ static int vc4_hdmi_audio_init(struct vc +@@ -2831,7 +2831,7 @@ static int vc4_hdmi_audio_init(struct vc struct snd_soc_card *card = &vc4_hdmi->audio.card; struct device *dev = &vc4_hdmi->pdev->dev; struct platform_device *codec_pdev; @@ -22,7 +22,7 @@ Signed-off-by: Phil Elwell int index, len; int ret; -@@ -2861,22 +2861,18 @@ static int vc4_hdmi_audio_init(struct vc +@@ -2867,22 +2867,18 @@ static int vc4_hdmi_audio_init(struct vc } /* diff --git a/target/linux/bcm27xx/patches-6.6/950-1199-drm-vc4-Disable-the-2pixel-clock-odd-timings-workaro.patch b/target/linux/bcm27xx/patches-6.6/950-1199-drm-vc4-Disable-the-2pixel-clock-odd-timings-workaro.patch index 4c429e284d4..78806c2b155 100644 --- a/target/linux/bcm27xx/patches-6.6/950-1199-drm-vc4-Disable-the-2pixel-clock-odd-timings-workaro.patch +++ b/target/linux/bcm27xx/patches-6.6/950-1199-drm-vc4-Disable-the-2pixel-clock-odd-timings-workaro.patch @@ -146,7 +146,7 @@ Signed-off-by: Dave Stevenson }; --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c -@@ -2263,7 +2263,9 @@ static int vc4_hdmi_encoder_atomic_check +@@ -2269,7 +2269,9 @@ static int vc4_hdmi_encoder_atomic_check unsigned long long tmds_bit_rate; int ret; @@ -157,7 +157,7 @@ Signed-off-by: Dave Stevenson if (mode->flags & DRM_MODE_FLAG_DBLCLK) { /* Only try to fixup DBLCLK modes to get 480i and 576i * working. -@@ -3974,6 +3976,7 @@ static const struct vc4_hdmi_variant bcm +@@ -3980,6 +3982,7 @@ static const struct vc4_hdmi_variant bcm PHY_LANE_CK, }, .unsupported_odd_h_timings = true, @@ -165,7 +165,7 @@ Signed-off-by: Dave Stevenson .external_irq_controller = true, .init_resources = vc5_hdmi_init_resources, -@@ -4003,6 +4006,7 @@ static const struct vc4_hdmi_variant bcm +@@ -4009,6 +4012,7 @@ static const struct vc4_hdmi_variant bcm PHY_LANE_2, }, .unsupported_odd_h_timings = true, @@ -173,7 +173,7 @@ Signed-off-by: Dave Stevenson .external_irq_controller = true, .init_resources = vc5_hdmi_init_resources, -@@ -4032,6 +4036,7 @@ static const struct vc4_hdmi_variant bcm +@@ -4038,6 +4042,7 @@ static const struct vc4_hdmi_variant bcm PHY_LANE_CK, }, .unsupported_odd_h_timings = false, @@ -181,7 +181,7 @@ Signed-off-by: Dave Stevenson .external_irq_controller = true, .init_resources = vc5_hdmi_init_resources, -@@ -4059,6 +4064,7 @@ static const struct vc4_hdmi_variant bcm +@@ -4065,6 +4070,7 @@ static const struct vc4_hdmi_variant bcm PHY_LANE_CK, }, .unsupported_odd_h_timings = false, diff --git a/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch b/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch index eb6317a2d13..efcda986796 100644 --- a/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch +++ b/target/linux/bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch @@ -103,11 +103,11 @@ it on BCM4708 family. if (xhci->quirks & XHCI_NEC_HOST) --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1913,6 +1913,7 @@ struct xhci_hcd { - #define XHCI_RESET_TO_DEFAULT BIT_ULL(44) - #define XHCI_ZHAOXIN_TRB_FETCH BIT_ULL(45) +@@ -1916,6 +1916,7 @@ struct xhci_hcd { #define XHCI_ZHAOXIN_HOST BIT_ULL(46) -+#define XHCI_FAKE_DOORBELL BIT_ULL(47) + #define XHCI_WRITE_64_HI_LO BIT_ULL(47) + #define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48) ++#define XHCI_FAKE_DOORBELL BIT_ULL(49) unsigned int num_active_eps; unsigned int limit_active_eps; diff --git a/target/linux/gemini/image/Makefile b/target/linux/gemini/image/Makefile index 3ddb6e5554a..a7988cf5fbe 100644 --- a/target/linux/gemini/image/Makefile +++ b/target/linux/gemini/image/Makefile @@ -55,8 +55,9 @@ define Build/dns313-images --root $@.tmp $@.tmp-boot # The device firmware needs revision 1 of EXT2 - tune2fs -O filetype $@.tmp-boot - e2fsck -pDf $@.tmp-boot > /dev/null + $(STAGING_DIR_HOST)/bin/tune2fs -O filetype $@.tmp-boot + # Ignore errors because file system was intentionally broken with tune2fs + -$(STAGING_DIR_HOST)/bin/e2fsck -pDf $@.tmp-boot > /dev/null ./dns313_gen_hdd_img.sh $@ $@.tmp-boot $(IMAGE_ROOTFS) \ $(CONFIG_TARGET_KERNEL_PARTSIZE) \ diff --git a/target/linux/generic/backport-6.6/410-v6.13-01-block-add-support-for-defining-read-only-partitions.patch b/target/linux/generic/backport-6.6/410-v6.13-01-block-add-support-for-defining-read-only-partitions.patch new file mode 100644 index 00000000000..fabf16a2e63 --- /dev/null +++ b/target/linux/generic/backport-6.6/410-v6.13-01-block-add-support-for-defining-read-only-partitions.patch @@ -0,0 +1,53 @@ +From 03cb793b26834ddca170ba87057c8f883772dd45 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Thu, 3 Oct 2024 00:11:41 +0200 +Subject: [PATCH 1/5] block: add support for defining read-only partitions + +Add support for defining read-only partitions and complete support for +it in the cmdline partition parser as the additional "ro" after a +partition is scanned but never actually applied. + +Signed-off-by: Christian Marangi +Reviewed-by: Christoph Hellwig +Link: https://lore.kernel.org/r/20241002221306.4403-2-ansuelsmth@gmail.com +Signed-off-by: Jens Axboe +--- + block/blk.h | 1 + + block/partitions/cmdline.c | 3 +++ + block/partitions/core.c | 3 +++ + 3 files changed, 7 insertions(+) + +--- a/block/blk.h ++++ b/block/blk.h +@@ -424,6 +424,7 @@ void blk_free_ext_minor(unsigned int min + #define ADDPART_FLAG_NONE 0 + #define ADDPART_FLAG_RAID 1 + #define ADDPART_FLAG_WHOLEDISK 2 ++#define ADDPART_FLAG_READONLY 4 + int bdev_add_partition(struct gendisk *disk, int partno, sector_t start, + sector_t length); + int bdev_del_partition(struct gendisk *disk, int partno); +--- a/block/partitions/cmdline.c ++++ b/block/partitions/cmdline.c +@@ -237,6 +237,9 @@ static int add_part(int slot, struct cmd + put_partition(state, slot, subpart->from >> 9, + subpart->size >> 9); + ++ if (subpart->flags & PF_RDONLY) ++ state->parts[slot].flags |= ADDPART_FLAG_READONLY; ++ + info = &state->parts[slot].info; + + strscpy(info->volname, subpart->name, sizeof(info->volname)); +--- a/block/partitions/core.c ++++ b/block/partitions/core.c +@@ -392,6 +392,9 @@ static struct block_device *add_partitio + goto out_del; + } + ++ if (flags & ADDPART_FLAG_READONLY) ++ bdev->bd_read_only = true; ++ + /* everything is up and running, commence */ + err = xa_insert(&disk->part_tbl, partno, bdev, GFP_KERNEL); + if (err) diff --git a/target/linux/generic/backport-6.6/410-v6.13-03-block-introduce-add_disk_fwnode.patch b/target/linux/generic/backport-6.6/410-v6.13-03-block-introduce-add_disk_fwnode.patch new file mode 100644 index 00000000000..41b51ab215c --- /dev/null +++ b/target/linux/generic/backport-6.6/410-v6.13-03-block-introduce-add_disk_fwnode.patch @@ -0,0 +1,94 @@ +From e5f587242b6072ffab4f4a084a459a59f3035873 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Thu, 3 Oct 2024 00:11:43 +0200 +Subject: [PATCH 3/5] block: introduce add_disk_fwnode() + +Introduce add_disk_fwnode() as a replacement of device_add_disk() that +permits to pass and attach a fwnode to disk dev. + +This variant can be useful for eMMC that might have the partition table +for the disk defined in DT. A parser can later make use of the attached +fwnode to parse the related table and init the hardcoded partition for +the disk. + +device_add_disk() is converted to a simple wrapper of add_disk_fwnode() +with the fwnode entry set as NULL. + +Signed-off-by: Christian Marangi +Reviewed-by: Christoph Hellwig +Link: https://lore.kernel.org/r/20241002221306.4403-4-ansuelsmth@gmail.com +Signed-off-by: Jens Axboe +--- + block/genhd.c | 28 ++++++++++++++++++++++++---- + include/linux/blkdev.h | 3 +++ + 2 files changed, 27 insertions(+), 4 deletions(-) + +--- a/block/genhd.c ++++ b/block/genhd.c +@@ -383,16 +383,18 @@ int disk_scan_partitions(struct gendisk + } + + /** +- * device_add_disk - add disk information to kernel list ++ * add_disk_fwnode - add disk information to kernel list with fwnode + * @parent: parent device for the disk + * @disk: per-device partitioning information + * @groups: Additional per-device sysfs groups ++ * @fwnode: attached disk fwnode + * + * This function registers the partitioning information in @disk +- * with the kernel. ++ * with the kernel. Also attach a fwnode to the disk device. + */ +-int __must_check device_add_disk(struct device *parent, struct gendisk *disk, +- const struct attribute_group **groups) ++int __must_check add_disk_fwnode(struct device *parent, struct gendisk *disk, ++ const struct attribute_group **groups, ++ struct fwnode_handle *fwnode) + + { + struct device *ddev = disk_to_dev(disk); +@@ -451,6 +453,8 @@ int __must_check device_add_disk(struct + ddev->parent = parent; + ddev->groups = groups; + dev_set_name(ddev, "%s", disk->disk_name); ++ if (fwnode) ++ device_set_node(ddev, fwnode); + if (!(disk->flags & GENHD_FL_HIDDEN)) + ddev->devt = MKDEV(disk->major, disk->first_minor); + ret = device_add(ddev); +@@ -552,6 +556,22 @@ out_exit_elevator: + elevator_exit(disk->queue); + return ret; + } ++EXPORT_SYMBOL_GPL(add_disk_fwnode); ++ ++/** ++ * device_add_disk - add disk information to kernel list ++ * @parent: parent device for the disk ++ * @disk: per-device partitioning information ++ * @groups: Additional per-device sysfs groups ++ * ++ * This function registers the partitioning information in @disk ++ * with the kernel. ++ */ ++int __must_check device_add_disk(struct device *parent, struct gendisk *disk, ++ const struct attribute_group **groups) ++{ ++ return add_disk_fwnode(parent, disk, groups, NULL); ++} + EXPORT_SYMBOL(device_add_disk); + + static void blk_report_disk_dead(struct gendisk *disk, bool surprise) +--- a/include/linux/blkdev.h ++++ b/include/linux/blkdev.h +@@ -741,6 +741,9 @@ static inline unsigned int blk_queue_dep + #define for_each_bio(_bio) \ + for (; _bio; _bio = _bio->bi_next) + ++int __must_check add_disk_fwnode(struct device *parent, struct gendisk *disk, ++ const struct attribute_group **groups, ++ struct fwnode_handle *fwnode); + int __must_check device_add_disk(struct device *parent, struct gendisk *disk, + const struct attribute_group **groups); + static inline int __must_check add_disk(struct gendisk *disk) diff --git a/target/linux/generic/backport-6.6/410-v6.13-04-mmc-block-attach-partitions-fwnode-if-found-in-mmc-c.patch b/target/linux/generic/backport-6.6/410-v6.13-04-mmc-block-attach-partitions-fwnode-if-found-in-mmc-c.patch new file mode 100644 index 00000000000..cf0d18cf063 --- /dev/null +++ b/target/linux/generic/backport-6.6/410-v6.13-04-mmc-block-attach-partitions-fwnode-if-found-in-mmc-c.patch @@ -0,0 +1,104 @@ +From 45ff6c340ddfc2dade74d5b7a8962c778ab7042c Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Thu, 3 Oct 2024 00:11:44 +0200 +Subject: [PATCH 4/5] mmc: block: attach partitions fwnode if found in mmc-card + +Attach partitions fwnode if found in mmc-card and register disk with it. + +This permits block partition to reference the node and register a +partition table defined in DT for the special case for embedded device +that doesn't have a partition table flashed but have an hardcoded +partition table passed from the system. + +JEDEC BOOT partition boot0/boot1 are supported but in DT we refer with +the JEDEC name of boot1 and boot2 to better adhere to documentation. + +Also JEDEC GP partition gp0/1/2/3 are supported but in DT we refer with +the JEDEC name of gp1/2/3/4 to better adhere to documentration. + +Signed-off-by: Christian Marangi +Reviewed-by: Linus Walleij +Link: https://lore.kernel.org/r/20241002221306.4403-5-ansuelsmth@gmail.com +Signed-off-by: Jens Axboe +--- + drivers/mmc/core/block.c | 55 +++++++++++++++++++++++++++++++++++++++- + 1 file changed, 54 insertions(+), 1 deletion(-) + +--- a/drivers/mmc/core/block.c ++++ b/drivers/mmc/core/block.c +@@ -2455,6 +2455,56 @@ static inline int mmc_blk_readonly(struc + !(card->csd.cmdclass & CCC_BLOCK_WRITE); + } + ++/* ++ * Search for a declared partitions node for the disk in mmc-card related node. ++ * ++ * This is to permit support for partition table defined in DT in special case ++ * where a partition table is not written in the disk and is expected to be ++ * passed from the running system. ++ * ++ * For the user disk, "partitions" node is searched. ++ * For the special HW disk, "partitions-" node with the appended name is used ++ * following this conversion table (to adhere to JEDEC naming) ++ * - boot0 -> partitions-boot1 ++ * - boot1 -> partitions-boot2 ++ * - gp0 -> partitions-gp1 ++ * - gp1 -> partitions-gp2 ++ * - gp2 -> partitions-gp3 ++ * - gp3 -> partitions-gp4 ++ */ ++static struct fwnode_handle *mmc_blk_get_partitions_node(struct device *mmc_dev, ++ const char *subname) ++{ ++ const char *node_name = "partitions"; ++ ++ if (subname) { ++ mmc_dev = mmc_dev->parent; ++ ++ /* ++ * Check if we are allocating a BOOT disk boot0/1 disk. ++ * In DT we use the JEDEC naming boot1/2. ++ */ ++ if (!strcmp(subname, "boot0")) ++ node_name = "partitions-boot1"; ++ if (!strcmp(subname, "boot1")) ++ node_name = "partitions-boot2"; ++ /* ++ * Check if we are allocating a GP disk gp0/1/2/3 disk. ++ * In DT we use the JEDEC naming gp1/2/3/4. ++ */ ++ if (!strcmp(subname, "gp0")) ++ node_name = "partitions-gp1"; ++ if (!strcmp(subname, "gp1")) ++ node_name = "partitions-gp2"; ++ if (!strcmp(subname, "gp2")) ++ node_name = "partitions-gp3"; ++ if (!strcmp(subname, "gp3")) ++ node_name = "partitions-gp4"; ++ } ++ ++ return device_get_named_child_node(mmc_dev, node_name); ++} ++ + static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, + struct device *parent, + sector_t size, +@@ -2463,6 +2513,7 @@ static struct mmc_blk_data *mmc_blk_allo + int area_type, + unsigned int part_type) + { ++ struct fwnode_handle *disk_fwnode; + struct mmc_blk_data *md; + int devidx, ret; + char cap_str[10]; +@@ -2568,7 +2619,9 @@ static struct mmc_blk_data *mmc_blk_allo + /* used in ->open, must be set before add_disk: */ + if (area_type == MMC_BLK_DATA_AREA_MAIN) + dev_set_drvdata(&card->dev, md); +- ret = device_add_disk(md->parent, md->disk, mmc_disk_attr_groups); ++ disk_fwnode = mmc_blk_get_partitions_node(parent, subname); ++ ret = add_disk_fwnode(md->parent, md->disk, mmc_disk_attr_groups, ++ disk_fwnode); + if (ret) + goto err_put_disk; + return md; diff --git a/target/linux/generic/backport-6.6/410-v6.13-05-block-add-support-for-partition-table-defined-in-OF.patch b/target/linux/generic/backport-6.6/410-v6.13-05-block-add-support-for-partition-table-defined-in-OF.patch new file mode 100644 index 00000000000..d260be168cd --- /dev/null +++ b/target/linux/generic/backport-6.6/410-v6.13-05-block-add-support-for-partition-table-defined-in-OF.patch @@ -0,0 +1,200 @@ +From 884555b557e5e6d41c866e2cd8d7b32f50ec974b Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Thu, 3 Oct 2024 00:11:45 +0200 +Subject: [PATCH 5/5] block: add support for partition table defined in OF + +Add support for partition table defined in Device Tree. Similar to how +it's done with MTD, add support for defining a fixed partition table in +device tree. + +A common scenario for this is fixed block (eMMC) embedded devices that +have no MBR or GPT partition table to save storage space. Bootloader +access the block device with absolute address of data. + +This is to complete the functionality with an equivalent implementation +with providing partition table with bootargs, for case where the booargs +can't be modified and tweaking the Device Tree is the only solution to +have an usabe partition table. + +The implementation follow the fixed-partitions parser used on MTD +devices where a "partitions" node is expected to be declared with +"fixed-partitions" compatible in the OF node of the disk device +(mmc-card for eMMC for example) and each child node declare a label +and a reg with offset and size. If label is not declared, the node name +is used as fallback. Eventually is also possible to declare the read-only +property to flag the partition as read-only. + +Signed-off-by: Christian Marangi +Reviewed-by: Christoph Hellwig +Link: https://lore.kernel.org/r/20241002221306.4403-6-ansuelsmth@gmail.com +Signed-off-by: Jens Axboe +--- + block/partitions/Kconfig | 9 ++++ + block/partitions/Makefile | 1 + + block/partitions/check.h | 1 + + block/partitions/core.c | 3 ++ + block/partitions/of.c | 110 ++++++++++++++++++++++++++++++++++++++ + 5 files changed, 124 insertions(+) + create mode 100644 block/partitions/of.c + +--- a/block/partitions/Kconfig ++++ b/block/partitions/Kconfig +@@ -270,4 +270,13 @@ config CMDLINE_PARTITION + Say Y here if you want to read the partition table from bootargs. + The format for the command line is just like mtdparts. + ++config OF_PARTITION ++ bool "Device Tree partition support" if PARTITION_ADVANCED ++ depends on OF ++ help ++ Say Y here if you want to enable support for partition table ++ defined in Device Tree. (mainly for eMMC) ++ The format for the device tree node is just like MTD fixed-partition ++ schema. ++ + endmenu +--- a/block/partitions/Makefile ++++ b/block/partitions/Makefile +@@ -12,6 +12,7 @@ obj-$(CONFIG_CMDLINE_PARTITION) += cmdli + obj-$(CONFIG_MAC_PARTITION) += mac.o + obj-$(CONFIG_LDM_PARTITION) += ldm.o + obj-$(CONFIG_MSDOS_PARTITION) += msdos.o ++obj-$(CONFIG_OF_PARTITION) += of.o + obj-$(CONFIG_OSF_PARTITION) += osf.o + obj-$(CONFIG_SGI_PARTITION) += sgi.o + obj-$(CONFIG_SUN_PARTITION) += sun.o +--- a/block/partitions/check.h ++++ b/block/partitions/check.h +@@ -62,6 +62,7 @@ int karma_partition(struct parsed_partit + int ldm_partition(struct parsed_partitions *state); + int mac_partition(struct parsed_partitions *state); + int msdos_partition(struct parsed_partitions *state); ++int of_partition(struct parsed_partitions *state); + int osf_partition(struct parsed_partitions *state); + int sgi_partition(struct parsed_partitions *state); + int sun_partition(struct parsed_partitions *state); +--- a/block/partitions/core.c ++++ b/block/partitions/core.c +@@ -43,6 +43,9 @@ static int (*const check_part[])(struct + #ifdef CONFIG_CMDLINE_PARTITION + cmdline_partition, + #endif ++#ifdef CONFIG_OF_PARTITION ++ of_partition, /* cmdline have priority to OF */ ++#endif + #ifdef CONFIG_EFI_PARTITION + efi_partition, /* this must come before msdos */ + #endif +--- /dev/null ++++ b/block/partitions/of.c +@@ -0,0 +1,110 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++#include ++#include ++#include ++#include ++#include "check.h" ++ ++static int validate_of_partition(struct device_node *np, int slot) ++{ ++ u64 offset, size; ++ int len; ++ ++ const __be32 *reg = of_get_property(np, "reg", &len); ++ int a_cells = of_n_addr_cells(np); ++ int s_cells = of_n_size_cells(np); ++ ++ /* Make sure reg len match the expected addr and size cells */ ++ if (len / sizeof(*reg) != a_cells + s_cells) ++ return -EINVAL; ++ ++ /* Validate offset conversion from bytes to sectors */ ++ offset = of_read_number(reg, a_cells); ++ if (offset % SECTOR_SIZE) ++ return -EINVAL; ++ ++ /* Validate size conversion from bytes to sectors */ ++ size = of_read_number(reg + a_cells, s_cells); ++ if (!size || size % SECTOR_SIZE) ++ return -EINVAL; ++ ++ return 0; ++} ++ ++static void add_of_partition(struct parsed_partitions *state, int slot, ++ struct device_node *np) ++{ ++ struct partition_meta_info *info; ++ char tmp[sizeof(info->volname) + 4]; ++ const char *partname; ++ int len; ++ ++ const __be32 *reg = of_get_property(np, "reg", &len); ++ int a_cells = of_n_addr_cells(np); ++ int s_cells = of_n_size_cells(np); ++ ++ /* Convert bytes to sector size */ ++ u64 offset = of_read_number(reg, a_cells) / SECTOR_SIZE; ++ u64 size = of_read_number(reg + a_cells, s_cells) / SECTOR_SIZE; ++ ++ put_partition(state, slot, offset, size); ++ ++ if (of_property_read_bool(np, "read-only")) ++ state->parts[slot].flags |= ADDPART_FLAG_READONLY; ++ ++ /* ++ * Follow MTD label logic, search for label property, ++ * fallback to node name if not found. ++ */ ++ info = &state->parts[slot].info; ++ partname = of_get_property(np, "label", &len); ++ if (!partname) ++ partname = of_get_property(np, "name", &len); ++ strscpy(info->volname, partname, sizeof(info->volname)); ++ ++ snprintf(tmp, sizeof(tmp), "(%s)", info->volname); ++ strlcat(state->pp_buf, tmp, PAGE_SIZE); ++} ++ ++int of_partition(struct parsed_partitions *state) ++{ ++ struct device *ddev = disk_to_dev(state->disk); ++ struct device_node *np; ++ int slot; ++ ++ struct device_node *partitions_np = of_node_get(ddev->of_node); ++ ++ if (!partitions_np || ++ !of_device_is_compatible(partitions_np, "fixed-partitions")) ++ return 0; ++ ++ slot = 1; ++ /* Validate parition offset and size */ ++ for_each_child_of_node(partitions_np, np) { ++ if (validate_of_partition(np, slot)) { ++ of_node_put(np); ++ of_node_put(partitions_np); ++ ++ return -1; ++ } ++ ++ slot++; ++ } ++ ++ slot = 1; ++ for_each_child_of_node(partitions_np, np) { ++ if (slot >= state->limit) { ++ of_node_put(np); ++ break; ++ } ++ ++ add_of_partition(state, slot, np); ++ ++ slot++; ++ } ++ ++ strlcat(state->pp_buf, "\n", PAGE_SIZE); ++ ++ return 1; ++} diff --git a/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch b/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch index ef7963b6013..3f75dffde71 100644 --- a/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch +++ b/target/linux/generic/backport-6.6/600-v6.10-net-Remove-conditional-threaded-NAPI-wakeup-based-on.patch @@ -32,7 +32,7 @@ Signed-off-by: Paolo Abeni --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -4473,13 +4473,7 @@ static inline void ____napi_schedule(str +@@ -4477,13 +4477,7 @@ static inline void ____napi_schedule(str */ thread = READ_ONCE(napi->thread); if (thread) { @@ -47,7 +47,7 @@ Signed-off-by: Paolo Abeni wake_up_process(thread); return; } -@@ -6635,8 +6629,6 @@ static int napi_poll(struct napi_struct +@@ -6639,8 +6633,6 @@ static int napi_poll(struct napi_struct static int napi_thread_wait(struct napi_struct *napi) { @@ -56,7 +56,7 @@ Signed-off-by: Paolo Abeni set_current_state(TASK_INTERRUPTIBLE); while (!kthread_should_stop()) { -@@ -6645,15 +6637,13 @@ static int napi_thread_wait(struct napi_ +@@ -6649,15 +6641,13 @@ static int napi_thread_wait(struct napi_ * Testing SCHED bit is not enough because SCHED bit might be * set by some other busy poll thread or by napi_disable(). */ diff --git a/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch b/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch index 40e6514264c..b343a3f9642 100644 --- a/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch +++ b/target/linux/generic/backport-6.6/601-v6.10-net-Allow-to-use-SMP-threads-for-backlog-NAPI.patch @@ -108,7 +108,7 @@ Signed-off-by: Paolo Abeni static inline void rps_lock_irqsave(struct softnet_data *sd, unsigned long *flags) { -@@ -4441,6 +4467,7 @@ EXPORT_SYMBOL(__dev_direct_xmit); +@@ -4445,6 +4471,7 @@ EXPORT_SYMBOL(__dev_direct_xmit); /************************************************************************* * Receiver routines *************************************************************************/ @@ -116,7 +116,7 @@ Signed-off-by: Paolo Abeni int netdev_max_backlog __read_mostly = 1000; EXPORT_SYMBOL(netdev_max_backlog); -@@ -4473,12 +4500,16 @@ static inline void ____napi_schedule(str +@@ -4477,12 +4504,16 @@ static inline void ____napi_schedule(str */ thread = READ_ONCE(napi->thread); if (thread) { @@ -133,7 +133,7 @@ Signed-off-by: Paolo Abeni list_add_tail(&napi->poll_list, &sd->poll_list); WRITE_ONCE(napi->list_owner, smp_processor_id()); /* If not called from net_rx_action() -@@ -4724,6 +4755,11 @@ static void napi_schedule_rps(struct sof +@@ -4728,6 +4759,11 @@ static void napi_schedule_rps(struct sof #ifdef CONFIG_RPS if (sd != mysd) { @@ -145,7 +145,7 @@ Signed-off-by: Paolo Abeni sd->rps_ipi_next = mysd->rps_ipi_list; mysd->rps_ipi_list = sd; -@@ -5947,7 +5983,7 @@ static void net_rps_action_and_irq_enabl +@@ -5951,7 +5987,7 @@ static void net_rps_action_and_irq_enabl #ifdef CONFIG_RPS struct softnet_data *remsd = sd->rps_ipi_list; @@ -154,7 +154,7 @@ Signed-off-by: Paolo Abeni sd->rps_ipi_list = NULL; local_irq_enable(); -@@ -5962,7 +5998,7 @@ static void net_rps_action_and_irq_enabl +@@ -5966,7 +6002,7 @@ static void net_rps_action_and_irq_enabl static bool sd_has_rps_ipi_waiting(struct softnet_data *sd) { #ifdef CONFIG_RPS @@ -163,7 +163,7 @@ Signed-off-by: Paolo Abeni #else return false; #endif -@@ -6006,7 +6042,7 @@ static int process_backlog(struct napi_s +@@ -6010,7 +6046,7 @@ static int process_backlog(struct napi_s * We can use a plain write instead of clear_bit(), * and we dont need an smp_mb() memory barrier. */ @@ -172,7 +172,7 @@ Signed-off-by: Paolo Abeni again = false; } else { skb_queue_splice_tail_init(&sd->input_pkt_queue, -@@ -6672,43 +6708,48 @@ static void skb_defer_free_flush(struct +@@ -6676,43 +6712,48 @@ static void skb_defer_free_flush(struct } } @@ -250,7 +250,7 @@ Signed-off-by: Paolo Abeni return 0; } -@@ -11289,7 +11330,7 @@ static int dev_cpu_dead(unsigned int old +@@ -11293,7 +11334,7 @@ static int dev_cpu_dead(unsigned int old list_del_init(&napi->poll_list); if (napi->poll == process_backlog) @@ -259,7 +259,7 @@ Signed-off-by: Paolo Abeni else ____napi_schedule(sd, napi); } -@@ -11297,12 +11338,14 @@ static int dev_cpu_dead(unsigned int old +@@ -11301,12 +11342,14 @@ static int dev_cpu_dead(unsigned int old raise_softirq_irqoff(NET_TX_SOFTIRQ); local_irq_enable(); @@ -278,7 +278,7 @@ Signed-off-by: Paolo Abeni /* Process offline CPU's input_pkt_queue */ while ((skb = __skb_dequeue(&oldsd->process_queue))) { -@@ -11565,6 +11608,38 @@ static struct pernet_operations __net_in +@@ -11569,6 +11612,38 @@ static struct pernet_operations __net_in * */ @@ -317,7 +317,7 @@ Signed-off-by: Paolo Abeni /* * This is called single threaded during boot, so no need * to take the rtnl semaphore. -@@ -11615,7 +11690,10 @@ static int __init net_dev_init(void) +@@ -11619,7 +11694,10 @@ static int __init net_dev_init(void) init_gro_hash(&sd->backlog); sd->backlog.poll = process_backlog; sd->backlog.weight = weight_p; diff --git a/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch b/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch index 6a9c113124e..3b1a64e4c64 100644 --- a/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch +++ b/target/linux/generic/backport-6.6/602-v6.10-net-Use-backlog-NAPI-to-clean-up-the-defer_list.patch @@ -82,7 +82,7 @@ Signed-off-by: Paolo Abeni spin_unlock_irq(&sd->input_pkt_queue.lock); else if (!IS_ENABLED(CONFIG_PREEMPT_RT)) local_irq_enable(); -@@ -4774,6 +4774,23 @@ static void napi_schedule_rps(struct sof +@@ -4778,6 +4778,23 @@ static void napi_schedule_rps(struct sof __napi_schedule_irqoff(&mysd->backlog); } diff --git a/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch b/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch index 801067287b3..dab96763fc2 100644 --- a/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch +++ b/target/linux/generic/backport-6.6/603-v6.10-net-Rename-rps_lock-to-backlog_lock.patch @@ -67,7 +67,7 @@ Signed-off-by: Paolo Abeni { if (IS_ENABLED(CONFIG_RPS) || use_backlog_threads()) spin_unlock_irq(&sd->input_pkt_queue.lock); -@@ -4779,12 +4779,12 @@ void kick_defer_list_purge(struct softne +@@ -4783,12 +4783,12 @@ void kick_defer_list_purge(struct softne unsigned long flags; if (use_backlog_threads()) { @@ -82,7 +82,7 @@ Signed-off-by: Paolo Abeni } else if (!cmpxchg(&sd->defer_ipi_scheduled, 0, 1)) { smp_call_function_single_async(cpu, &sd->defer_csd); -@@ -4846,7 +4846,7 @@ static int enqueue_to_backlog(struct sk_ +@@ -4850,7 +4850,7 @@ static int enqueue_to_backlog(struct sk_ reason = SKB_DROP_REASON_NOT_SPECIFIED; sd = &per_cpu(softnet_data, cpu); @@ -91,7 +91,7 @@ Signed-off-by: Paolo Abeni if (!netif_running(skb->dev)) goto drop; qlen = skb_queue_len(&sd->input_pkt_queue); -@@ -4855,7 +4855,7 @@ static int enqueue_to_backlog(struct sk_ +@@ -4859,7 +4859,7 @@ static int enqueue_to_backlog(struct sk_ enqueue: __skb_queue_tail(&sd->input_pkt_queue, skb); input_queue_tail_incr_save(sd, qtail); @@ -100,7 +100,7 @@ Signed-off-by: Paolo Abeni return NET_RX_SUCCESS; } -@@ -4870,7 +4870,7 @@ enqueue: +@@ -4874,7 +4874,7 @@ enqueue: drop: sd->dropped++; @@ -109,7 +109,7 @@ Signed-off-by: Paolo Abeni dev_core_stats_rx_dropped_inc(skb->dev); kfree_skb_reason(skb, reason); -@@ -5901,7 +5901,7 @@ static void flush_backlog(struct work_st +@@ -5905,7 +5905,7 @@ static void flush_backlog(struct work_st local_bh_disable(); sd = this_cpu_ptr(&softnet_data); @@ -118,7 +118,7 @@ Signed-off-by: Paolo Abeni skb_queue_walk_safe(&sd->input_pkt_queue, skb, tmp) { if (skb->dev->reg_state == NETREG_UNREGISTERING) { __skb_unlink(skb, &sd->input_pkt_queue); -@@ -5909,7 +5909,7 @@ static void flush_backlog(struct work_st +@@ -5913,7 +5913,7 @@ static void flush_backlog(struct work_st input_queue_head_incr(sd); } } @@ -127,7 +127,7 @@ Signed-off-by: Paolo Abeni skb_queue_walk_safe(&sd->process_queue, skb, tmp) { if (skb->dev->reg_state == NETREG_UNREGISTERING) { -@@ -5927,14 +5927,14 @@ static bool flush_required(int cpu) +@@ -5931,14 +5931,14 @@ static bool flush_required(int cpu) struct softnet_data *sd = &per_cpu(softnet_data, cpu); bool do_flush; @@ -144,7 +144,7 @@ Signed-off-by: Paolo Abeni return do_flush; #endif -@@ -6049,7 +6049,7 @@ static int process_backlog(struct napi_s +@@ -6053,7 +6053,7 @@ static int process_backlog(struct napi_s } @@ -153,7 +153,7 @@ Signed-off-by: Paolo Abeni if (skb_queue_empty(&sd->input_pkt_queue)) { /* * Inline a custom version of __napi_complete(). -@@ -6065,7 +6065,7 @@ static int process_backlog(struct napi_s +@@ -6069,7 +6069,7 @@ static int process_backlog(struct napi_s skb_queue_splice_tail_init(&sd->input_pkt_queue, &sd->process_queue); } diff --git a/target/linux/generic/backport-6.6/611-01-v6.11-udp-Allow-GSO-transmit-from-devices-with-no-checksum.patch b/target/linux/generic/backport-6.6/611-01-v6.11-udp-Allow-GSO-transmit-from-devices-with-no-checksum.patch index 4a71d1203a9..2f03074bc9a 100644 --- a/target/linux/generic/backport-6.6/611-01-v6.11-udp-Allow-GSO-transmit-from-devices-with-no-checksum.patch +++ b/target/linux/generic/backport-6.6/611-01-v6.11-udp-Allow-GSO-transmit-from-devices-with-no-checksum.patch @@ -65,7 +65,7 @@ Signed-off-by: Jakub Kicinski } --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c -@@ -362,6 +362,14 @@ struct sk_buff *__udp_gso_segment(struct +@@ -380,6 +380,14 @@ struct sk_buff *__udp_gso_segment(struct else uh->check = gso_make_checksum(seg, ~check) ? : CSUM_MANGLED_0; diff --git a/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch b/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch index 8eecb063049..30758f180f3 100644 --- a/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch +++ b/target/linux/generic/backport-6.6/611-02-v6.11-net-Make-USO-depend-on-CSUM-offload.patch @@ -20,7 +20,7 @@ Signed-off-by: Jakub Kicinski --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -9751,6 +9751,15 @@ static void netdev_sync_lower_features(s +@@ -9755,6 +9755,15 @@ static void netdev_sync_lower_features(s } } @@ -36,7 +36,7 @@ Signed-off-by: Jakub Kicinski static netdev_features_t netdev_fix_features(struct net_device *dev, netdev_features_t features) { -@@ -9832,15 +9841,9 @@ static netdev_features_t netdev_fix_feat +@@ -9836,15 +9845,9 @@ static netdev_features_t netdev_fix_feat features &= ~NETIF_F_LRO; } @@ -55,7 +55,7 @@ Signed-off-by: Jakub Kicinski } if ((features & NETIF_F_HW_TLS_RX) && !(features & NETIF_F_RXCSUM)) { -@@ -9848,6 +9851,11 @@ static netdev_features_t netdev_fix_feat +@@ -9852,6 +9855,11 @@ static netdev_features_t netdev_fix_feat features &= ~NETIF_F_HW_TLS_RX; } diff --git a/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch b/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch new file mode 100644 index 00000000000..2db89c5a05a --- /dev/null +++ b/target/linux/generic/backport-6.6/612-v6.9-net-get-stats64-if-device-if-driver-is-configured.patch @@ -0,0 +1,29 @@ +From: Breno Leitao +Date: Wed, 28 Feb 2024 03:31:21 -0800 +Subject: [PATCH] net: get stats64 if device if driver is configured + +If the network driver is relying in the net core to do stats allocation, +then we want to dev_get_tstats64() instead of netdev_stats_to_stats64(), +since there are per-cpu stats that needs to be taken in consideration. + +This will also simplify the drivers in regard to statistics. Once the +driver sets NETDEV_PCPU_STAT_TSTATS, it doesn't not need to allocate the +stacks, neither it needs to set `.ndo_get_stats64 = dev_get_tstats64` +for the generic stats collection function anymore. + +Signed-off-by: Breno Leitao +Reviewed-by: Simon Horman +Signed-off-by: Paolo Abeni +--- + +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -10662,6 +10662,8 @@ struct rtnl_link_stats64 *dev_get_stats( + ops->ndo_get_stats64(dev, storage); + } else if (ops->ndo_get_stats) { + netdev_stats_to_stats64(storage, ops->ndo_get_stats(dev)); ++ } else if (dev->pcpu_stat_type == NETDEV_PCPU_STAT_TSTATS) { ++ dev_get_tstats64(dev, storage); + } else { + netdev_stats_to_stats64(storage, &dev->stats); + } diff --git a/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch b/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch index 6449cd6a3a1..838bd03c8c5 100644 --- a/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch +++ b/target/linux/generic/backport-6.6/770-net-introduce-napi_is_scheduled-helper.patch @@ -85,7 +85,7 @@ Signed-off-by: Paolo Abeni /** --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -6602,7 +6602,7 @@ static int __napi_poll(struct napi_struc +@@ -6606,7 +6606,7 @@ static int __napi_poll(struct napi_struc * accidentally calling ->poll() when NAPI is not scheduled. */ work = 0; diff --git a/target/linux/generic/backport-6.6/780-01-v6.8-r8169-improve-RTL8411b-phy-down-fixup.patch b/target/linux/generic/backport-6.6/780-01-v6.8-r8169-improve-RTL8411b-phy-down-fixup.patch index 9a17fe4f78e..b44627ea299 100644 --- a/target/linux/generic/backport-6.6/780-01-v6.8-r8169-improve-RTL8411b-phy-down-fixup.patch +++ b/target/linux/generic/backport-6.6/780-01-v6.8-r8169-improve-RTL8411b-phy-down-fixup.patch @@ -18,7 +18,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -3129,6 +3129,33 @@ static void rtl_hw_start_8168g_2(struct +@@ -3156,6 +3156,33 @@ static void rtl_hw_start_8168g_2(struct rtl_ephy_init(tp, e_info_8168g_2); } @@ -52,7 +52,7 @@ Signed-off-by: David S. Miller static void rtl_hw_start_8411_2(struct rtl8169_private *tp) { static const struct ephy_info e_info_8411_2[] = { -@@ -3162,117 +3189,7 @@ static void rtl_hw_start_8411_2(struct r +@@ -3189,117 +3216,7 @@ static void rtl_hw_start_8411_2(struct r mdelay(3); r8168_mac_ocp_write(tp, 0xFC26, 0x0000); diff --git a/target/linux/generic/backport-6.6/780-03-v6.8-r8169-remove-multicast-filter-limit.patch b/target/linux/generic/backport-6.6/780-03-v6.8-r8169-remove-multicast-filter-limit.patch index 4186e14e171..ad36db13725 100644 --- a/target/linux/generic/backport-6.6/780-03-v6.8-r8169-remove-multicast-filter-limit.patch +++ b/target/linux/generic/backport-6.6/780-03-v6.8-r8169-remove-multicast-filter-limit.patch @@ -35,7 +35,7 @@ Signed-off-by: Jakub Kicinski #define TX_DMA_BURST 7 /* Maximum PCI burst, '7' is unlimited */ #define InterFrameGap 0x03 /* 3 means InterFrameGap = the shortest one */ -@@ -2626,8 +2622,7 @@ static void rtl_set_rx_mode(struct net_d +@@ -2653,8 +2649,7 @@ static void rtl_set_rx_mode(struct net_d rx_mode |= AcceptAllPhys; } else if (!(dev->flags & IFF_MULTICAST)) { rx_mode &= ~AcceptMulticast; diff --git a/target/linux/generic/backport-6.6/780-04-v6.8-r8169-improve-handling-task-scheduling.patch b/target/linux/generic/backport-6.6/780-04-v6.8-r8169-improve-handling-task-scheduling.patch index a809e8213aa..f020284cc80 100644 --- a/target/linux/generic/backport-6.6/780-04-v6.8-r8169-improve-handling-task-scheduling.patch +++ b/target/linux/generic/backport-6.6/780-04-v6.8-r8169-improve-handling-task-scheduling.patch @@ -19,7 +19,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -2252,6 +2252,9 @@ u16 rtl8168h_2_get_adc_bias_ioffset(stru +@@ -2279,6 +2279,9 @@ u16 rtl8168h_2_get_adc_bias_ioffset(stru static void rtl_schedule_task(struct rtl8169_private *tp, enum rtl_flag flag) { @@ -29,7 +29,7 @@ Signed-off-by: Jakub Kicinski set_bit(flag, tp->wk.flags); schedule_work(&tp->wk.work); } -@@ -4491,8 +4494,7 @@ static void rtl_task(struct work_struct +@@ -4518,8 +4521,7 @@ static void rtl_task(struct work_struct rtnl_lock(); diff --git a/target/linux/generic/backport-6.6/780-05-v6.8-r8169-add-support-for-LED-s-on-RTL8168-RTL8101.patch b/target/linux/generic/backport-6.6/780-05-v6.8-r8169-add-support-for-LED-s-on-RTL8168-RTL8101.patch index 7a5d5a66a12..95245b9a54c 100644 --- a/target/linux/generic/backport-6.6/780-05-v6.8-r8169-add-support-for-LED-s-on-RTL8168-RTL8101.patch +++ b/target/linux/generic/backport-6.6/780-05-v6.8-r8169-add-support-for-LED-s-on-RTL8168-RTL8101.patch @@ -225,7 +225,7 @@ Signed-off-by: David S. Miller LED_FREQ = 0x1a, EEE_LED = 0x1b, ERIDR = 0x70, -@@ -616,6 +617,7 @@ struct rtl8169_private { +@@ -643,6 +644,7 @@ struct rtl8169_private { raw_spinlock_t config25_lock; raw_spinlock_t mac_ocp_lock; @@ -233,7 +233,7 @@ Signed-off-by: David S. Miller raw_spinlock_t cfg9346_usage_lock; int cfg9346_usage_count; -@@ -788,6 +790,62 @@ static const struct rtl_cond name = { +@@ -815,6 +817,62 @@ static const struct rtl_cond name = { \ static bool name ## _check(struct rtl8169_private *tp) @@ -296,7 +296,7 @@ Signed-off-by: David S. Miller static void r8168fp_adjust_ocp_cmd(struct rtl8169_private *tp, u32 *cmd, int type) { /* based on RTL8168FP_OOBMAC_BASE in vendor driver */ -@@ -5168,6 +5226,7 @@ static int rtl_init_one(struct pci_dev * +@@ -5195,6 +5253,7 @@ static int rtl_init_one(struct pci_dev * raw_spin_lock_init(&tp->cfg9346_usage_lock); raw_spin_lock_init(&tp->config25_lock); raw_spin_lock_init(&tp->mac_ocp_lock); @@ -304,7 +304,7 @@ Signed-off-by: David S. Miller dev->tstats = devm_netdev_alloc_pcpu_stats(&pdev->dev, struct pcpu_sw_netstats); -@@ -5324,6 +5383,12 @@ static int rtl_init_one(struct pci_dev * +@@ -5351,6 +5410,12 @@ static int rtl_init_one(struct pci_dev * if (rc) return rc; diff --git a/target/linux/generic/backport-6.6/780-06-v6.8-r8169-fix-building-with-CONFIG_LEDS_CLASS-m.patch b/target/linux/generic/backport-6.6/780-06-v6.8-r8169-fix-building-with-CONFIG_LEDS_CLASS-m.patch index 67f215cadfb..819a611cb3f 100644 --- a/target/linux/generic/backport-6.6/780-06-v6.8-r8169-fix-building-with-CONFIG_LEDS_CLASS-m.patch +++ b/target/linux/generic/backport-6.6/780-06-v6.8-r8169-fix-building-with-CONFIG_LEDS_CLASS-m.patch @@ -59,7 +59,7 @@ Signed-off-by: Jakub Kicinski obj-$(CONFIG_R8169) += r8169.o --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -5383,11 +5383,10 @@ static int rtl_init_one(struct pci_dev * +@@ -5410,11 +5410,10 @@ static int rtl_init_one(struct pci_dev * if (rc) return rc; diff --git a/target/linux/generic/backport-6.6/780-07-v6.9-r8169-simplify-EEE-handling.patch b/target/linux/generic/backport-6.6/780-07-v6.9-r8169-simplify-EEE-handling.patch index bdd33305805..d3a26303ef0 100644 --- a/target/linux/generic/backport-6.6/780-07-v6.9-r8169-simplify-EEE-handling.patch +++ b/target/linux/generic/backport-6.6/780-07-v6.9-r8169-simplify-EEE-handling.patch @@ -16,7 +16,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -629,7 +629,6 @@ struct rtl8169_private { +@@ -656,7 +656,6 @@ struct rtl8169_private { struct rtl8169_counters *counters; struct rtl8169_tc_offsets tc_offset; u32 saved_wolopts; @@ -24,7 +24,7 @@ Signed-off-by: Jakub Kicinski const char *fw_name; struct rtl_fw *rtl_fw; -@@ -2010,17 +2009,11 @@ static int rtl8169_get_eee(struct net_de +@@ -2037,17 +2036,11 @@ static int rtl8169_get_eee(struct net_de static int rtl8169_set_eee(struct net_device *dev, struct ethtool_eee *data) { struct rtl8169_private *tp = netdev_priv(dev); @@ -43,7 +43,7 @@ Signed-off-by: Jakub Kicinski } static void rtl8169_get_ringparam(struct net_device *dev, -@@ -2085,21 +2078,6 @@ static const struct ethtool_ops rtl8169_ +@@ -2112,21 +2105,6 @@ static const struct ethtool_ops rtl8169_ .set_pauseparam = rtl8169_set_pauseparam, }; @@ -65,7 +65,7 @@ Signed-off-by: Jakub Kicinski static enum mac_version rtl8169_get_mac_version(u16 xid, bool gmii) { /* -@@ -2336,9 +2314,6 @@ static void rtl8169_init_phy(struct rtl8 +@@ -2363,9 +2341,6 @@ static void rtl8169_init_phy(struct rtl8 /* We may have called phy_speed_down before */ phy_speed_up(tp->phydev); @@ -75,7 +75,7 @@ Signed-off-by: Jakub Kicinski genphy_soft_reset(tp->phydev); } -@@ -5085,7 +5060,9 @@ static int r8169_mdio_register(struct rt +@@ -5112,7 +5087,9 @@ static int r8169_mdio_register(struct rt } tp->phydev->mac_managed_pm = true; @@ -86,7 +86,7 @@ Signed-off-by: Jakub Kicinski phy_support_asym_pause(tp->phydev); /* PHY will be woken up in rtl_open() */ -@@ -5220,7 +5197,6 @@ static int rtl_init_one(struct pci_dev * +@@ -5247,7 +5224,6 @@ static int rtl_init_one(struct pci_dev * tp->dev = dev; tp->pci_dev = pdev; tp->supports_gmii = ent->driver_data == RTL_CFG_NO_GBIT ? 0 : 1; diff --git a/target/linux/generic/backport-6.6/780-08-v6.9-r8169-add-support-for-RTL8126A.patch b/target/linux/generic/backport-6.6/780-08-v6.9-r8169-add-support-for-RTL8126A.patch index 65aa5449ec6..6dfaa904a17 100644 --- a/target/linux/generic/backport-6.6/780-08-v6.9-r8169-add-support-for-RTL8126A.patch +++ b/target/linux/generic/backport-6.6/780-08-v6.9-r8169-add-support-for-RTL8126A.patch @@ -65,7 +65,7 @@ Signed-off-by: David S. Miller TxPoll_8125 = 0x90, MAC0_BKP = 0x19e0, EEE_TXIDLE_TIMER_8125 = 0x6048, -@@ -1139,7 +1146,7 @@ static void rtl_writephy(struct rtl8169_ +@@ -1166,7 +1173,7 @@ static void rtl_writephy(struct rtl8169_ case RTL_GIGA_MAC_VER_31: r8168dp_2_mdio_write(tp, location, val); break; @@ -74,7 +74,7 @@ Signed-off-by: David S. Miller r8168g_mdio_write(tp, location, val); break; default: -@@ -1154,7 +1161,7 @@ static int rtl_readphy(struct rtl8169_pr +@@ -1181,7 +1188,7 @@ static int rtl_readphy(struct rtl8169_pr case RTL_GIGA_MAC_VER_28: case RTL_GIGA_MAC_VER_31: return r8168dp_2_mdio_read(tp, location); @@ -83,7 +83,7 @@ Signed-off-by: David S. Miller return r8168g_mdio_read(tp, location); default: return r8169_mdio_read(tp, location); -@@ -1363,7 +1370,7 @@ static void rtl_set_d3_pll_down(struct r +@@ -1390,7 +1397,7 @@ static void rtl_set_d3_pll_down(struct r case RTL_GIGA_MAC_VER_25 ... RTL_GIGA_MAC_VER_26: case RTL_GIGA_MAC_VER_29 ... RTL_GIGA_MAC_VER_30: case RTL_GIGA_MAC_VER_32 ... RTL_GIGA_MAC_VER_37: @@ -92,7 +92,7 @@ Signed-off-by: David S. Miller if (enable) RTL_W8(tp, PMCH, RTL_R8(tp, PMCH) & ~D3_NO_PLL_DOWN); else -@@ -1530,7 +1537,7 @@ static void __rtl8169_set_wol(struct rtl +@@ -1557,7 +1564,7 @@ static void __rtl8169_set_wol(struct rtl break; case RTL_GIGA_MAC_VER_34: case RTL_GIGA_MAC_VER_37: @@ -101,7 +101,7 @@ Signed-off-by: David S. Miller if (wolopts) rtl_mod_config2(tp, 0, PME_SIGNAL); else -@@ -2096,6 +2103,9 @@ static enum mac_version rtl8169_get_mac_ +@@ -2123,6 +2130,9 @@ static enum mac_version rtl8169_get_mac_ u16 val; enum mac_version ver; } mac_info[] = { @@ -111,7 +111,7 @@ Signed-off-by: David S. Miller /* 8125B family. */ { 0x7cf, 0x641, RTL_GIGA_MAC_VER_63 }, -@@ -2366,6 +2376,7 @@ static void rtl_init_rxcfg(struct rtl816 +@@ -2393,6 +2403,7 @@ static void rtl_init_rxcfg(struct rtl816 RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST); break; case RTL_GIGA_MAC_VER_63: @@ -119,7 +119,7 @@ Signed-off-by: David S. Miller RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST | RX_PAUSE_SLOT_ON); break; -@@ -2552,7 +2563,7 @@ static void rtl_wait_txrx_fifo_empty(str +@@ -2579,7 +2590,7 @@ static void rtl_wait_txrx_fifo_empty(str case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_61: rtl_loop_wait_high(tp, &rtl_rxtx_empty_cond, 100, 42); break; @@ -128,7 +128,7 @@ Signed-off-by: David S. Miller RTL_W8(tp, ChipCmd, RTL_R8(tp, ChipCmd) | StopReq); rtl_loop_wait_high(tp, &rtl_rxtx_empty_cond, 100, 42); rtl_loop_wait_high(tp, &rtl_rxtx_empty_cond_2, 100, 42); -@@ -2795,7 +2806,7 @@ static void rtl_enable_exit_l1(struct rt +@@ -2822,7 +2833,7 @@ static void rtl_enable_exit_l1(struct rt case RTL_GIGA_MAC_VER_37 ... RTL_GIGA_MAC_VER_38: rtl_eri_set_bits(tp, 0xd4, 0x0c00); break; @@ -137,7 +137,7 @@ Signed-off-by: David S. Miller r8168_mac_ocp_modify(tp, 0xc0ac, 0, 0x1f80); break; default: -@@ -2809,7 +2820,7 @@ static void rtl_disable_exit_l1(struct r +@@ -2836,7 +2847,7 @@ static void rtl_disable_exit_l1(struct r case RTL_GIGA_MAC_VER_34 ... RTL_GIGA_MAC_VER_38: rtl_eri_clear_bits(tp, 0xd4, 0x1f00); break; @@ -146,7 +146,7 @@ Signed-off-by: David S. Miller r8168_mac_ocp_modify(tp, 0xc0ac, 0x1f80, 0); break; default: -@@ -2819,6 +2830,8 @@ static void rtl_disable_exit_l1(struct r +@@ -2846,6 +2857,8 @@ static void rtl_disable_exit_l1(struct r static void rtl_hw_aspm_clkreq_enable(struct rtl8169_private *tp, bool enable) { @@ -155,7 +155,7 @@ Signed-off-by: David S. Miller if (tp->mac_version < RTL_GIGA_MAC_VER_32) return; -@@ -2832,11 +2845,19 @@ static void rtl_hw_aspm_clkreq_enable(st +@@ -2859,11 +2872,19 @@ static void rtl_hw_aspm_clkreq_enable(st return; rtl_mod_config5(tp, 0, ASPM_en); @@ -177,7 +177,7 @@ Signed-off-by: David S. Miller /* reset ephy tx/rx disable timer */ r8168_mac_ocp_modify(tp, 0xe094, 0xff00, 0); /* chip can trigger L1.2 */ -@@ -2848,14 +2869,22 @@ static void rtl_hw_aspm_clkreq_enable(st +@@ -2875,14 +2896,22 @@ static void rtl_hw_aspm_clkreq_enable(st } else { switch (tp->mac_version) { case RTL_GIGA_MAC_VER_46 ... RTL_GIGA_MAC_VER_48: @@ -202,7 +202,7 @@ Signed-off-by: David S. Miller rtl_mod_config5(tp, ASPM_en, 0); } } -@@ -3568,10 +3597,15 @@ static void rtl_hw_start_8125_common(str +@@ -3595,10 +3624,15 @@ static void rtl_hw_start_8125_common(str /* disable new tx descriptor format */ r8168_mac_ocp_modify(tp, 0xeb58, 0x0001, 0x0000); @@ -220,7 +220,7 @@ Signed-off-by: David S. Miller if (tp->mac_version == RTL_GIGA_MAC_VER_63) r8168_mac_ocp_modify(tp, 0xe63e, 0x0c30, 0x0000); -@@ -3584,6 +3618,10 @@ static void rtl_hw_start_8125_common(str +@@ -3611,6 +3645,10 @@ static void rtl_hw_start_8125_common(str r8168_mac_ocp_modify(tp, 0xe056, 0x00f0, 0x0030); r8168_mac_ocp_modify(tp, 0xe040, 0x1000, 0x0000); r8168_mac_ocp_modify(tp, 0xea1c, 0x0003, 0x0001); @@ -231,7 +231,7 @@ Signed-off-by: David S. Miller r8168_mac_ocp_modify(tp, 0xe0c0, 0x4f0f, 0x4403); r8168_mac_ocp_modify(tp, 0xe052, 0x0080, 0x0068); r8168_mac_ocp_modify(tp, 0xd430, 0x0fff, 0x047f); -@@ -3598,10 +3636,10 @@ static void rtl_hw_start_8125_common(str +@@ -3625,10 +3663,10 @@ static void rtl_hw_start_8125_common(str rtl_loop_wait_low(tp, &rtl_mac_ocp_e00e_cond, 1000, 10); @@ -245,7 +245,7 @@ Signed-off-by: David S. Miller rtl_disable_rxdvgate(tp); } -@@ -3645,6 +3683,12 @@ static void rtl_hw_start_8125b(struct rt +@@ -3672,6 +3710,12 @@ static void rtl_hw_start_8125b(struct rt rtl_hw_start_8125_common(tp); } @@ -258,7 +258,7 @@ Signed-off-by: David S. Miller static void rtl_hw_config(struct rtl8169_private *tp) { static const rtl_generic_fct hw_configs[] = { -@@ -3687,6 +3731,7 @@ static void rtl_hw_config(struct rtl8169 +@@ -3714,6 +3758,7 @@ static void rtl_hw_config(struct rtl8169 [RTL_GIGA_MAC_VER_53] = rtl_hw_start_8117, [RTL_GIGA_MAC_VER_61] = rtl_hw_start_8125a_2, [RTL_GIGA_MAC_VER_63] = rtl_hw_start_8125b, @@ -266,7 +266,7 @@ Signed-off-by: David S. Miller }; if (hw_configs[tp->mac_version]) -@@ -3697,9 +3742,23 @@ static void rtl_hw_start_8125(struct rtl +@@ -3724,9 +3769,23 @@ static void rtl_hw_start_8125(struct rtl { int i; @@ -292,7 +292,7 @@ Signed-off-by: David S. Miller rtl_hw_config(tp); } -@@ -3777,8 +3836,7 @@ static int rtl8169_change_mtu(struct net +@@ -3804,8 +3863,7 @@ static int rtl8169_change_mtu(struct net rtl_jumbo_config(tp); switch (tp->mac_version) { @@ -302,7 +302,7 @@ Signed-off-by: David S. Miller rtl8125_set_eee_txidle_timer(tp); break; default: -@@ -3927,7 +3985,7 @@ static void rtl8169_cleanup(struct rtl81 +@@ -3954,7 +4012,7 @@ static void rtl8169_cleanup(struct rtl81 RTL_W8(tp, ChipCmd, RTL_R8(tp, ChipCmd) | StopReq); rtl_loop_wait_high(tp, &rtl_txcfg_empty_cond, 100, 666); break; @@ -311,7 +311,7 @@ Signed-off-by: David S. Miller rtl_enable_rxdvgate(tp); fsleep(2000); break; -@@ -4078,8 +4136,7 @@ static unsigned int rtl_quirk_packet_pad +@@ -4105,8 +4163,7 @@ static unsigned int rtl_quirk_packet_pad switch (tp->mac_version) { case RTL_GIGA_MAC_VER_34: @@ -321,7 +321,7 @@ Signed-off-by: David S. Miller padto = max_t(unsigned int, padto, ETH_ZLEN); break; default: -@@ -5112,7 +5169,7 @@ static void rtl_hw_initialize(struct rtl +@@ -5139,7 +5196,7 @@ static void rtl_hw_initialize(struct rtl case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_48: rtl_hw_init_8168g(tp); break; @@ -332,7 +332,7 @@ Signed-off-by: David S. Miller default: --- a/drivers/net/ethernet/realtek/r8169_phy_config.c +++ b/drivers/net/ethernet/realtek/r8169_phy_config.c -@@ -1102,6 +1102,12 @@ static void rtl8125b_hw_phy_config(struc +@@ -1104,6 +1104,12 @@ static void rtl8125b_hw_phy_config(struc rtl8125b_config_eee_phy(phydev); } @@ -345,7 +345,7 @@ Signed-off-by: David S. Miller void r8169_hw_phy_config(struct rtl8169_private *tp, struct phy_device *phydev, enum mac_version ver) { -@@ -1152,6 +1158,7 @@ void r8169_hw_phy_config(struct rtl8169_ +@@ -1154,6 +1160,7 @@ void r8169_hw_phy_config(struct rtl8169_ [RTL_GIGA_MAC_VER_53] = rtl8117_hw_phy_config, [RTL_GIGA_MAC_VER_61] = rtl8125a_2_hw_phy_config, [RTL_GIGA_MAC_VER_63] = rtl8125b_hw_phy_config, diff --git a/target/linux/generic/backport-6.6/780-10-v6.9-r8169-simplify-code-by-using-core-provided-pcpu-stat.patch b/target/linux/generic/backport-6.6/780-10-v6.9-r8169-simplify-code-by-using-core-provided-pcpu-stat.patch index 510123767a9..0288dcb11e7 100644 --- a/target/linux/generic/backport-6.6/780-10-v6.9-r8169-simplify-code-by-using-core-provided-pcpu-stat.patch +++ b/target/linux/generic/backport-6.6/780-10-v6.9-r8169-simplify-code-by-using-core-provided-pcpu-stat.patch @@ -16,7 +16,7 @@ Signed-off-by: Paolo Abeni --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -5261,11 +5261,6 @@ static int rtl_init_one(struct pci_dev * +@@ -5288,11 +5288,6 @@ static int rtl_init_one(struct pci_dev * raw_spin_lock_init(&tp->mac_ocp_lock); mutex_init(&tp->led_lock); @@ -28,7 +28,7 @@ Signed-off-by: Paolo Abeni /* Get the *optional* external "ether_clk" used on some boards */ tp->clk = devm_clk_get_optional_enabled(&pdev->dev, "ether_clk"); if (IS_ERR(tp->clk)) -@@ -5380,6 +5375,8 @@ static int rtl_init_one(struct pci_dev * +@@ -5407,6 +5402,8 @@ static int rtl_init_one(struct pci_dev * dev->hw_features |= NETIF_F_RXALL; dev->hw_features |= NETIF_F_RXFCS; diff --git a/target/linux/generic/backport-6.6/780-11-v6.9-r8169-add-LED-support-for-RTL8125-RTL8126.patch b/target/linux/generic/backport-6.6/780-11-v6.9-r8169-add-LED-support-for-RTL8125-RTL8126.patch index 2059551b507..449aa11591a 100644 --- a/target/linux/generic/backport-6.6/780-11-v6.9-r8169-add-LED-support-for-RTL8125-RTL8126.patch +++ b/target/linux/generic/backport-6.6/780-11-v6.9-r8169-add-LED-support-for-RTL8125-RTL8126.patch @@ -173,7 +173,7 @@ Signed-off-by: Jakub Kicinski #define RX_VLAN_INNER_8125 BIT(22) #define RX_VLAN_OUTER_8125 BIT(23) #define RX_VLAN_8125 (RX_VLAN_INNER_8125 | RX_VLAN_OUTER_8125) -@@ -830,6 +836,51 @@ int rtl8168_get_led_mode(struct rtl8169_ +@@ -857,6 +863,51 @@ int rtl8168_get_led_mode(struct rtl8169_ return ret; } @@ -225,7 +225,7 @@ Signed-off-by: Jakub Kicinski void r8169_get_led_name(struct rtl8169_private *tp, int idx, char *buf, int buf_len) { -@@ -5413,10 +5464,12 @@ static int rtl_init_one(struct pci_dev * +@@ -5440,10 +5491,12 @@ static int rtl_init_one(struct pci_dev * if (rc) return rc; diff --git a/target/linux/generic/backport-6.6/780-12-v6.9-r8169-add-generic-rtl_set_eee_txidle_timer-function.patch b/target/linux/generic/backport-6.6/780-12-v6.9-r8169-add-generic-rtl_set_eee_txidle_timer-function.patch index 1a7eed191f6..5f762f7729e 100644 --- a/target/linux/generic/backport-6.6/780-12-v6.9-r8169-add-generic-rtl_set_eee_txidle_timer-function.patch +++ b/target/linux/generic/backport-6.6/780-12-v6.9-r8169-add-generic-rtl_set_eee_txidle_timer-function.patch @@ -18,7 +18,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -619,6 +619,7 @@ struct rtl8169_private { +@@ -646,6 +646,7 @@ struct rtl8169_private { struct page *Rx_databuff[NUM_RX_DESC]; /* Rx data buffers */ struct ring_info tx_skb[NUM_TX_DESC]; /* Tx data buffers */ u16 cp_cmd; @@ -26,7 +26,7 @@ Signed-off-by: Jakub Kicinski u32 irq_mask; int irq; struct clk *clk; -@@ -2054,6 +2055,22 @@ static int rtl_set_coalesce(struct net_d +@@ -2081,6 +2082,22 @@ static int rtl_set_coalesce(struct net_d return 0; } @@ -49,7 +49,7 @@ Signed-off-by: Jakub Kicinski static int rtl8169_get_eee(struct net_device *dev, struct ethtool_eee *data) { struct rtl8169_private *tp = netdev_priv(dev); -@@ -2312,14 +2329,8 @@ static void rtl8125a_config_eee_mac(stru +@@ -2339,14 +2356,8 @@ static void rtl8125a_config_eee_mac(stru r8168_mac_ocp_modify(tp, 0xeb62, 0, BIT(2) | BIT(1)); } @@ -64,7 +64,7 @@ Signed-off-by: Jakub Kicinski r8168_mac_ocp_modify(tp, 0xe040, 0, BIT(1) | BIT(0)); } -@@ -3852,6 +3863,8 @@ static void rtl_hw_start(struct rtl8169 +@@ -3879,6 +3890,8 @@ static void rtl_hw_start(struct rtl8169 rtl_hw_aspm_clkreq_enable(tp, false); RTL_W16(tp, CPlusCmd, tp->cp_cmd); @@ -73,7 +73,7 @@ Signed-off-by: Jakub Kicinski if (tp->mac_version <= RTL_GIGA_MAC_VER_06) rtl_hw_start_8169(tp); else if (rtl_is_8125(tp)) -@@ -3885,14 +3898,7 @@ static int rtl8169_change_mtu(struct net +@@ -3912,14 +3925,7 @@ static int rtl8169_change_mtu(struct net dev->mtu = new_mtu; netdev_update_features(dev); rtl_jumbo_config(tp); diff --git a/target/linux/generic/backport-6.6/780-13-v6.9-r8169-support-setting-the-EEE-tx-idle-timer-on-RTL81.patch b/target/linux/generic/backport-6.6/780-13-v6.9-r8169-support-setting-the-EEE-tx-idle-timer-on-RTL81.patch index 917c7c194fc..8669dd2fea3 100644 --- a/target/linux/generic/backport-6.6/780-13-v6.9-r8169-support-setting-the-EEE-tx-idle-timer-on-RTL81.patch +++ b/target/linux/generic/backport-6.6/780-13-v6.9-r8169-support-setting-the-EEE-tx-idle-timer-on-RTL81.patch @@ -16,7 +16,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -2060,6 +2060,11 @@ static void rtl_set_eee_txidle_timer(str +@@ -2087,6 +2087,11 @@ static void rtl_set_eee_txidle_timer(str unsigned int timer_val = READ_ONCE(tp->dev->mtu) + ETH_HLEN + 0x20; switch (tp->mac_version) { diff --git a/target/linux/generic/backport-6.6/780-14-v6.9-r8169-add-support-for-returning-tx_lpi_timer-in-etht.patch b/target/linux/generic/backport-6.6/780-14-v6.9-r8169-add-support-for-returning-tx_lpi_timer-in-etht.patch index 51477d0142f..1a27bd190fb 100644 --- a/target/linux/generic/backport-6.6/780-14-v6.9-r8169-add-support-for-returning-tx_lpi_timer-in-etht.patch +++ b/target/linux/generic/backport-6.6/780-14-v6.9-r8169-add-support-for-returning-tx_lpi_timer-in-etht.patch @@ -17,7 +17,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -2076,14 +2076,34 @@ static void rtl_set_eee_txidle_timer(str +@@ -2103,14 +2103,34 @@ static void rtl_set_eee_txidle_timer(str } } diff --git a/target/linux/generic/backport-6.6/780-15-v6.9-r8169-add-MODULE_FIRMWARE-entry-for-RTL8126A.patch b/target/linux/generic/backport-6.6/780-15-v6.9-r8169-add-MODULE_FIRMWARE-entry-for-RTL8126A.patch index 6a7ebc885b3..da33372306c 100644 --- a/target/linux/generic/backport-6.6/780-15-v6.9-r8169-add-MODULE_FIRMWARE-entry-for-RTL8126A.patch +++ b/target/linux/generic/backport-6.6/780-15-v6.9-r8169-add-MODULE_FIRMWARE-entry-for-RTL8126A.patch @@ -15,7 +15,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -676,6 +676,7 @@ MODULE_FIRMWARE(FIRMWARE_8168FP_3); +@@ -703,6 +703,7 @@ MODULE_FIRMWARE(FIRMWARE_8168FP_3); MODULE_FIRMWARE(FIRMWARE_8107E_2); MODULE_FIRMWARE(FIRMWARE_8125A_3); MODULE_FIRMWARE(FIRMWARE_8125B_2); diff --git a/target/linux/generic/backport-6.6/780-16-v6.9-r8169-fix-LED-related-deadlock-on-module-removal.patch b/target/linux/generic/backport-6.6/780-16-v6.9-r8169-fix-LED-related-deadlock-on-module-removal.patch index d8e4a4f6ff1..6e0ff9b14bd 100644 --- a/target/linux/generic/backport-6.6/780-16-v6.9-r8169-fix-LED-related-deadlock-on-module-removal.patch +++ b/target/linux/generic/backport-6.6/780-16-v6.9-r8169-fix-LED-related-deadlock-on-module-removal.patch @@ -115,7 +115,7 @@ Signed-off-by: David S. Miller } --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -647,6 +647,8 @@ struct rtl8169_private { +@@ -674,6 +674,8 @@ struct rtl8169_private { const char *fw_name; struct rtl_fw *rtl_fw; @@ -124,7 +124,7 @@ Signed-off-by: David S. Miller u32 ocp_base; }; -@@ -5040,6 +5042,8 @@ static void rtl_remove_one(struct pci_de +@@ -5067,6 +5069,8 @@ static void rtl_remove_one(struct pci_de cancel_work_sync(&tp->wk.work); @@ -133,7 +133,7 @@ Signed-off-by: David S. Miller unregister_netdev(tp->dev); if (tp->dash_type != RTL_DASH_NONE) -@@ -5498,9 +5502,9 @@ static int rtl_init_one(struct pci_dev * +@@ -5525,9 +5529,9 @@ static int rtl_init_one(struct pci_dev * if (IS_ENABLED(CONFIG_R8169_LEDS)) { if (rtl_is_8125(tp)) diff --git a/target/linux/generic/backport-6.6/780-17-v6.9-r8169-add-missing-conditional-compiling-for-call-to-.patch b/target/linux/generic/backport-6.6/780-17-v6.9-r8169-add-missing-conditional-compiling-for-call-to-.patch index 366ae803f9d..e647e18167e 100644 --- a/target/linux/generic/backport-6.6/780-17-v6.9-r8169-add-missing-conditional-compiling-for-call-to-.patch +++ b/target/linux/generic/backport-6.6/780-17-v6.9-r8169-add-missing-conditional-compiling-for-call-to-.patch @@ -19,7 +19,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -5042,7 +5042,8 @@ static void rtl_remove_one(struct pci_de +@@ -5069,7 +5069,8 @@ static void rtl_remove_one(struct pci_de cancel_work_sync(&tp->wk.work); diff --git a/target/linux/generic/backport-6.6/780-18-v6.10-r8169-add-support-for-RTL8168M.patch b/target/linux/generic/backport-6.6/780-18-v6.10-r8169-add-support-for-RTL8168M.patch index 2abbe2ccf15..95455ee2cbb 100644 --- a/target/linux/generic/backport-6.6/780-18-v6.10-r8169-add-support-for-RTL8168M.patch +++ b/target/linux/generic/backport-6.6/780-18-v6.10-r8169-add-support-for-RTL8168M.patch @@ -19,7 +19,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -2230,6 +2230,8 @@ static enum mac_version rtl8169_get_mac_ +@@ -2257,6 +2257,8 @@ static enum mac_version rtl8169_get_mac_ * the wild. Let's disable detection. * { 0x7cf, 0x540, RTL_GIGA_MAC_VER_45 }, */ diff --git a/target/linux/generic/backport-6.6/780-19-v6.10-net-annotate-writes-on-dev-mtu-from-ndo_change_mtu.patch b/target/linux/generic/backport-6.6/780-19-v6.10-net-annotate-writes-on-dev-mtu-from-ndo_change_mtu.patch index cad1210e4dd..4c05976d2e5 100644 --- a/target/linux/generic/backport-6.6/780-19-v6.10-net-annotate-writes-on-dev-mtu-from-ndo_change_mtu.patch +++ b/target/linux/generic/backport-6.6/780-19-v6.10-net-annotate-writes-on-dev-mtu-from-ndo_change_mtu.patch @@ -49,7 +49,7 @@ Signed-off-by: Jakub Kicinski } --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -3925,7 +3925,7 @@ static int rtl8169_change_mtu(struct net +@@ -3952,7 +3952,7 @@ static int rtl8169_change_mtu(struct net { struct rtl8169_private *tp = netdev_priv(dev); diff --git a/target/linux/generic/backport-6.6/780-20-v6.11-r8169-disable-interrupt-source-RxOverflow.patch b/target/linux/generic/backport-6.6/780-20-v6.11-r8169-disable-interrupt-source-RxOverflow.patch index cef5d95252e..9389585f160 100644 --- a/target/linux/generic/backport-6.6/780-20-v6.11-r8169-disable-interrupt-source-RxOverflow.patch +++ b/target/linux/generic/backport-6.6/780-20-v6.11-r8169-disable-interrupt-source-RxOverflow.patch @@ -18,7 +18,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -5083,12 +5083,10 @@ static void rtl_set_irq_mask(struct rtl8 +@@ -5110,12 +5110,10 @@ static void rtl_set_irq_mask(struct rtl8 tp->irq_mask = RxOK | RxErr | TxOK | TxErr | LinkChg; if (tp->mac_version <= RTL_GIGA_MAC_VER_06) diff --git a/target/linux/generic/backport-6.6/780-21-v6.11-r8169-remove-detection-of-chip-version-11-early-RTL8.patch b/target/linux/generic/backport-6.6/780-21-v6.11-r8169-remove-detection-of-chip-version-11-early-RTL8.patch index 7f0f23fccb6..5e9e765a7eb 100644 --- a/target/linux/generic/backport-6.6/780-21-v6.11-r8169-remove-detection-of-chip-version-11-early-RTL8.patch +++ b/target/linux/generic/backport-6.6/780-21-v6.11-r8169-remove-detection-of-chip-version-11-early-RTL8.patch @@ -19,7 +19,7 @@ Signed-off-by: Jakub Kicinski --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -2275,7 +2275,9 @@ static enum mac_version rtl8169_get_mac_ +@@ -2302,7 +2302,9 @@ static enum mac_version rtl8169_get_mac_ /* 8168B family. */ { 0x7c8, 0x380, RTL_GIGA_MAC_VER_17 }, diff --git a/target/linux/generic/backport-6.6/780-22-v6.12-r8169-add-support-for-RTL8126A-rev.b.patch b/target/linux/generic/backport-6.6/780-22-v6.12-r8169-add-support-for-RTL8126A-rev.b.patch index a8ba1a57194..0915cb729fd 100644 --- a/target/linux/generic/backport-6.6/780-22-v6.12-r8169-add-support-for-RTL8126A-rev.b.patch +++ b/target/linux/generic/backport-6.6/780-22-v6.12-r8169-add-support-for-RTL8126A-rev.b.patch @@ -44,7 +44,7 @@ Signed-off-by: Jakub Kicinski }; static const struct pci_device_id rtl8169_pci_tbl[] = { -@@ -1201,7 +1203,7 @@ static void rtl_writephy(struct rtl8169_ +@@ -1228,7 +1230,7 @@ static void rtl_writephy(struct rtl8169_ case RTL_GIGA_MAC_VER_31: r8168dp_2_mdio_write(tp, location, val); break; @@ -53,7 +53,7 @@ Signed-off-by: Jakub Kicinski r8168g_mdio_write(tp, location, val); break; default: -@@ -1216,7 +1218,7 @@ static int rtl_readphy(struct rtl8169_pr +@@ -1243,7 +1245,7 @@ static int rtl_readphy(struct rtl8169_pr case RTL_GIGA_MAC_VER_28: case RTL_GIGA_MAC_VER_31: return r8168dp_2_mdio_read(tp, location); @@ -62,7 +62,7 @@ Signed-off-by: Jakub Kicinski return r8168g_mdio_read(tp, location); default: return r8169_mdio_read(tp, location); -@@ -1425,7 +1427,7 @@ static void rtl_set_d3_pll_down(struct r +@@ -1452,7 +1454,7 @@ static void rtl_set_d3_pll_down(struct r case RTL_GIGA_MAC_VER_25 ... RTL_GIGA_MAC_VER_26: case RTL_GIGA_MAC_VER_29 ... RTL_GIGA_MAC_VER_30: case RTL_GIGA_MAC_VER_32 ... RTL_GIGA_MAC_VER_37: @@ -71,7 +71,7 @@ Signed-off-by: Jakub Kicinski if (enable) RTL_W8(tp, PMCH, RTL_R8(tp, PMCH) & ~D3_NO_PLL_DOWN); else -@@ -1592,7 +1594,7 @@ static void __rtl8169_set_wol(struct rtl +@@ -1619,7 +1621,7 @@ static void __rtl8169_set_wol(struct rtl break; case RTL_GIGA_MAC_VER_34: case RTL_GIGA_MAC_VER_37: @@ -80,7 +80,7 @@ Signed-off-by: Jakub Kicinski if (wolopts) rtl_mod_config2(tp, 0, PME_SIGNAL); else -@@ -2071,6 +2073,7 @@ static void rtl_set_eee_txidle_timer(str +@@ -2098,6 +2100,7 @@ static void rtl_set_eee_txidle_timer(str case RTL_GIGA_MAC_VER_61: case RTL_GIGA_MAC_VER_63: case RTL_GIGA_MAC_VER_65: @@ -88,7 +88,7 @@ Signed-off-by: Jakub Kicinski tp->tx_lpi_timer = timer_val; RTL_W16(tp, EEE_TXIDLE_TIMER_8125, timer_val); break; -@@ -2200,6 +2203,7 @@ static enum mac_version rtl8169_get_mac_ +@@ -2227,6 +2230,7 @@ static enum mac_version rtl8169_get_mac_ enum mac_version ver; } mac_info[] = { /* 8126A family. */ @@ -96,7 +96,7 @@ Signed-off-by: Jakub Kicinski { 0x7cf, 0x649, RTL_GIGA_MAC_VER_65 }, /* 8125B family. */ -@@ -2471,6 +2475,7 @@ static void rtl_init_rxcfg(struct rtl816 +@@ -2498,6 +2502,7 @@ static void rtl_init_rxcfg(struct rtl816 break; case RTL_GIGA_MAC_VER_63: case RTL_GIGA_MAC_VER_65: @@ -104,7 +104,7 @@ Signed-off-by: Jakub Kicinski RTL_W32(tp, RxConfig, RX_FETCH_DFLT_8125 | RX_DMA_BURST | RX_PAUSE_SLOT_ON); break; -@@ -2657,7 +2662,7 @@ static void rtl_wait_txrx_fifo_empty(str +@@ -2684,7 +2689,7 @@ static void rtl_wait_txrx_fifo_empty(str case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_61: rtl_loop_wait_high(tp, &rtl_rxtx_empty_cond, 100, 42); break; @@ -113,7 +113,7 @@ Signed-off-by: Jakub Kicinski RTL_W8(tp, ChipCmd, RTL_R8(tp, ChipCmd) | StopReq); rtl_loop_wait_high(tp, &rtl_rxtx_empty_cond, 100, 42); rtl_loop_wait_high(tp, &rtl_rxtx_empty_cond_2, 100, 42); -@@ -2900,7 +2905,7 @@ static void rtl_enable_exit_l1(struct rt +@@ -2927,7 +2932,7 @@ static void rtl_enable_exit_l1(struct rt case RTL_GIGA_MAC_VER_37 ... RTL_GIGA_MAC_VER_38: rtl_eri_set_bits(tp, 0xd4, 0x0c00); break; @@ -122,7 +122,7 @@ Signed-off-by: Jakub Kicinski r8168_mac_ocp_modify(tp, 0xc0ac, 0, 0x1f80); break; default: -@@ -2914,7 +2919,7 @@ static void rtl_disable_exit_l1(struct r +@@ -2941,7 +2946,7 @@ static void rtl_disable_exit_l1(struct r case RTL_GIGA_MAC_VER_34 ... RTL_GIGA_MAC_VER_38: rtl_eri_clear_bits(tp, 0xd4, 0x1f00); break; @@ -131,7 +131,7 @@ Signed-off-by: Jakub Kicinski r8168_mac_ocp_modify(tp, 0xc0ac, 0x1f80, 0); break; default: -@@ -2941,6 +2946,7 @@ static void rtl_hw_aspm_clkreq_enable(st +@@ -2968,6 +2973,7 @@ static void rtl_hw_aspm_clkreq_enable(st rtl_mod_config5(tp, 0, ASPM_en); switch (tp->mac_version) { case RTL_GIGA_MAC_VER_65: @@ -139,7 +139,7 @@ Signed-off-by: Jakub Kicinski val8 = RTL_R8(tp, INT_CFG0_8125) | INT_CFG0_CLKREQEN; RTL_W8(tp, INT_CFG0_8125, val8); break; -@@ -2951,7 +2957,7 @@ static void rtl_hw_aspm_clkreq_enable(st +@@ -2978,7 +2984,7 @@ static void rtl_hw_aspm_clkreq_enable(st switch (tp->mac_version) { case RTL_GIGA_MAC_VER_46 ... RTL_GIGA_MAC_VER_48: @@ -148,7 +148,7 @@ Signed-off-by: Jakub Kicinski /* reset ephy tx/rx disable timer */ r8168_mac_ocp_modify(tp, 0xe094, 0xff00, 0); /* chip can trigger L1.2 */ -@@ -2963,7 +2969,7 @@ static void rtl_hw_aspm_clkreq_enable(st +@@ -2990,7 +2996,7 @@ static void rtl_hw_aspm_clkreq_enable(st } else { switch (tp->mac_version) { case RTL_GIGA_MAC_VER_46 ... RTL_GIGA_MAC_VER_48: @@ -157,7 +157,7 @@ Signed-off-by: Jakub Kicinski r8168_mac_ocp_modify(tp, 0xe092, 0x00ff, 0); break; default: -@@ -2972,6 +2978,7 @@ static void rtl_hw_aspm_clkreq_enable(st +@@ -2999,6 +3005,7 @@ static void rtl_hw_aspm_clkreq_enable(st switch (tp->mac_version) { case RTL_GIGA_MAC_VER_65: @@ -165,7 +165,7 @@ Signed-off-by: Jakub Kicinski val8 = RTL_R8(tp, INT_CFG0_8125) & ~INT_CFG0_CLKREQEN; RTL_W8(tp, INT_CFG0_8125, val8); break; -@@ -3691,10 +3698,12 @@ static void rtl_hw_start_8125_common(str +@@ -3718,10 +3725,12 @@ static void rtl_hw_start_8125_common(str /* disable new tx descriptor format */ r8168_mac_ocp_modify(tp, 0xeb58, 0x0001, 0x0000); @@ -180,7 +180,7 @@ Signed-off-by: Jakub Kicinski r8168_mac_ocp_modify(tp, 0xe614, 0x0700, 0x0400); else if (tp->mac_version == RTL_GIGA_MAC_VER_63) r8168_mac_ocp_modify(tp, 0xe614, 0x0700, 0x0200); -@@ -3712,7 +3721,8 @@ static void rtl_hw_start_8125_common(str +@@ -3739,7 +3748,8 @@ static void rtl_hw_start_8125_common(str r8168_mac_ocp_modify(tp, 0xe056, 0x00f0, 0x0030); r8168_mac_ocp_modify(tp, 0xe040, 0x1000, 0x0000); r8168_mac_ocp_modify(tp, 0xea1c, 0x0003, 0x0001); @@ -190,7 +190,7 @@ Signed-off-by: Jakub Kicinski r8168_mac_ocp_modify(tp, 0xea1c, 0x0300, 0x0000); else r8168_mac_ocp_modify(tp, 0xea1c, 0x0004, 0x0000); -@@ -3826,6 +3836,7 @@ static void rtl_hw_config(struct rtl8169 +@@ -3853,6 +3863,7 @@ static void rtl_hw_config(struct rtl8169 [RTL_GIGA_MAC_VER_61] = rtl_hw_start_8125a_2, [RTL_GIGA_MAC_VER_63] = rtl_hw_start_8125b, [RTL_GIGA_MAC_VER_65] = rtl_hw_start_8126a, @@ -198,7 +198,7 @@ Signed-off-by: Jakub Kicinski }; if (hw_configs[tp->mac_version]) -@@ -3846,6 +3857,7 @@ static void rtl_hw_start_8125(struct rtl +@@ -3873,6 +3884,7 @@ static void rtl_hw_start_8125(struct rtl break; case RTL_GIGA_MAC_VER_63: case RTL_GIGA_MAC_VER_65: @@ -206,7 +206,7 @@ Signed-off-by: Jakub Kicinski for (i = 0xa00; i < 0xa80; i += 4) RTL_W32(tp, i, 0); RTL_W16(tp, INT_CFG1_8125, 0x0000); -@@ -4074,7 +4086,7 @@ static void rtl8169_cleanup(struct rtl81 +@@ -4101,7 +4113,7 @@ static void rtl8169_cleanup(struct rtl81 RTL_W8(tp, ChipCmd, RTL_R8(tp, ChipCmd) | StopReq); rtl_loop_wait_high(tp, &rtl_txcfg_empty_cond, 100, 666); break; @@ -215,7 +215,7 @@ Signed-off-by: Jakub Kicinski rtl_enable_rxdvgate(tp); fsleep(2000); break; -@@ -4225,7 +4237,7 @@ static unsigned int rtl_quirk_packet_pad +@@ -4252,7 +4264,7 @@ static unsigned int rtl_quirk_packet_pad switch (tp->mac_version) { case RTL_GIGA_MAC_VER_34: @@ -224,7 +224,7 @@ Signed-off-by: Jakub Kicinski padto = max_t(unsigned int, padto, ETH_ZLEN); break; default: -@@ -5259,7 +5271,7 @@ static void rtl_hw_initialize(struct rtl +@@ -5286,7 +5298,7 @@ static void rtl_hw_initialize(struct rtl case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_48: rtl_hw_init_8168g(tp); break; @@ -235,7 +235,7 @@ Signed-off-by: Jakub Kicinski default: --- a/drivers/net/ethernet/realtek/r8169_phy_config.c +++ b/drivers/net/ethernet/realtek/r8169_phy_config.c -@@ -1159,6 +1159,7 @@ void r8169_hw_phy_config(struct rtl8169_ +@@ -1161,6 +1161,7 @@ void r8169_hw_phy_config(struct rtl8169_ [RTL_GIGA_MAC_VER_61] = rtl8125a_2_hw_phy_config, [RTL_GIGA_MAC_VER_63] = rtl8125b_hw_phy_config, [RTL_GIGA_MAC_VER_65] = rtl8126a_hw_phy_config, diff --git a/target/linux/generic/backport-6.6/780-23-v6.12-r8169-Fix-spelling-mistake-tx_underun-tx_underrun.patch b/target/linux/generic/backport-6.6/780-23-v6.12-r8169-Fix-spelling-mistake-tx_underun-tx_underrun.patch deleted file mode 100644 index 9d0992fcbb2..00000000000 --- a/target/linux/generic/backport-6.6/780-23-v6.12-r8169-Fix-spelling-mistake-tx_underun-tx_underrun.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 8df9439389a44fb2cc4ef695e08d6a8870b1616c Mon Sep 17 00:00:00 2001 -From: Colin Ian King -Date: Mon, 9 Sep 2024 15:00:21 +0100 -Subject: [PATCH 44/47] r8169: Fix spelling mistake: "tx_underun" -> - "tx_underrun" - -There is a spelling mistake in the struct field tx_underun, rename -it to tx_underrun. - -Signed-off-by: Colin Ian King -Reviewed-by: Simon Horman -Reviewed-by: Heiner Kallweit -Link: https://patch.msgid.link/20240909140021.64884-1-colin.i.king@gmail.com -Signed-off-by: Jakub Kicinski ---- - drivers/net/ethernet/realtek/r8169_main.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/drivers/net/ethernet/realtek/r8169_main.c -+++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -578,7 +578,7 @@ struct rtl8169_counters { - __le64 rx_broadcast; - __le32 rx_multicast; - __le16 tx_aborted; -- __le16 tx_underun; -+ __le16 tx_underrun; - }; - - struct rtl8169_tc_offsets { -@@ -1843,7 +1843,7 @@ static void rtl8169_get_ethtool_stats(st - data[9] = le64_to_cpu(counters->rx_broadcast); - data[10] = le32_to_cpu(counters->rx_multicast); - data[11] = le16_to_cpu(counters->tx_aborted); -- data[12] = le16_to_cpu(counters->tx_underun); -+ data[12] = le16_to_cpu(counters->tx_underrun); - } - - static void rtl8169_get_strings(struct net_device *dev, u32 stringset, u8 *data) diff --git a/target/linux/generic/backport-6.6/780-24-v6.12-r8169-disable-ALDPS-per-default-for-RTL8125.patch b/target/linux/generic/backport-6.6/780-24-v6.12-r8169-disable-ALDPS-per-default-for-RTL8125.patch deleted file mode 100644 index db37c484cff..00000000000 --- a/target/linux/generic/backport-6.6/780-24-v6.12-r8169-disable-ALDPS-per-default-for-RTL8125.patch +++ /dev/null @@ -1,41 +0,0 @@ -From b9c7ac4fe22c608acf6153a3329df2b6b6cd416c Mon Sep 17 00:00:00 2001 -From: Heiner Kallweit -Date: Wed, 11 Sep 2024 15:51:11 +0200 -Subject: [PATCH 45/47] r8169: disable ALDPS per default for RTL8125 - -En-Wei reported that traffic breaks if cable is unplugged for more -than 3s and then re-plugged. This was supposed to be fixed by -621735f59064 ("r8169: fix rare issue with broken rx after link-down on -RTL8125"). But apparently this didn't fix the issue for everybody. -The 3s threshold rang a bell, as this is the delay after which ALDPS -kicks in. And indeed disabling ALDPS fixes the issue for this user. -Maybe this fixes the issue in general. In a follow-up step we could -remove the first fix attempt and see whether anybody complains. - -Fixes: f1bce4ad2f1c ("r8169: add support for RTL8125") -Tested-by: En-Wei WU -Signed-off-by: Heiner Kallweit -Link: https://patch.msgid.link/778b9d86-05c4-4856-be59-cde4487b9e52@gmail.com -Signed-off-by: Jakub Kicinski ---- - drivers/net/ethernet/realtek/r8169_phy_config.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/net/ethernet/realtek/r8169_phy_config.c -+++ b/drivers/net/ethernet/realtek/r8169_phy_config.c -@@ -1060,6 +1060,7 @@ static void rtl8125a_2_hw_phy_config(str - phy_modify_paged(phydev, 0xa86, 0x15, 0x0001, 0x0000); - rtl8168g_enable_gphy_10m(phydev); - -+ rtl8168g_disable_aldps(phydev); - rtl8125a_config_eee_phy(phydev); - } - -@@ -1099,6 +1100,7 @@ static void rtl8125b_hw_phy_config(struc - phy_modify_paged(phydev, 0xbf8, 0x12, 0xe000, 0xa000); - - rtl8125_legacy_force_mode(phydev); -+ rtl8168g_disable_aldps(phydev); - rtl8125b_config_eee_phy(phydev); - } - diff --git a/target/linux/generic/backport-6.6/780-25-v6.12-r8169-add-tally-counter-fields-added-with-RTL8125.patch b/target/linux/generic/backport-6.6/780-25-v6.12-r8169-add-tally-counter-fields-added-with-RTL8125.patch deleted file mode 100644 index 3b1110fb67a..00000000000 --- a/target/linux/generic/backport-6.6/780-25-v6.12-r8169-add-tally-counter-fields-added-with-RTL8125.patch +++ /dev/null @@ -1,56 +0,0 @@ -From ced8e8b8f40accfcce4a2bbd8b150aa76d5eff9a Mon Sep 17 00:00:00 2001 -From: Heiner Kallweit -Date: Tue, 17 Sep 2024 23:04:46 +0200 -Subject: [PATCH 46/47] r8169: add tally counter fields added with RTL8125 - -RTL8125 added fields to the tally counter, what may result in the chip -dma'ing these new fields to unallocated memory. Therefore make sure -that the allocated memory area is big enough to hold all of the -tally counter values, even if we use only parts of it. - -Fixes: f1bce4ad2f1c ("r8169: add support for RTL8125") -Cc: stable@vger.kernel.org -Signed-off-by: Heiner Kallweit -Reviewed-by: Simon Horman -Link: https://patch.msgid.link/741d26a9-2b2b-485d-91d9-ecb302e345b5@gmail.com -Signed-off-by: Paolo Abeni ---- - drivers/net/ethernet/realtek/r8169_main.c | 27 +++++++++++++++++++++++ - 1 file changed, 27 insertions(+) - ---- a/drivers/net/ethernet/realtek/r8169_main.c -+++ b/drivers/net/ethernet/realtek/r8169_main.c -@@ -579,6 +579,33 @@ struct rtl8169_counters { - __le32 rx_multicast; - __le16 tx_aborted; - __le16 tx_underrun; -+ /* new since RTL8125 */ -+ __le64 tx_octets; -+ __le64 rx_octets; -+ __le64 rx_multicast64; -+ __le64 tx_unicast64; -+ __le64 tx_broadcast64; -+ __le64 tx_multicast64; -+ __le32 tx_pause_on; -+ __le32 tx_pause_off; -+ __le32 tx_pause_all; -+ __le32 tx_deferred; -+ __le32 tx_late_collision; -+ __le32 tx_all_collision; -+ __le32 tx_aborted32; -+ __le32 align_errors32; -+ __le32 rx_frame_too_long; -+ __le32 rx_runt; -+ __le32 rx_pause_on; -+ __le32 rx_pause_off; -+ __le32 rx_pause_all; -+ __le32 rx_unknown_opcode; -+ __le32 rx_mac_error; -+ __le32 tx_underrun32; -+ __le32 rx_mac_missed; -+ __le32 rx_tcam_dropped; -+ __le32 tdu; -+ __le32 rdu; - }; - - struct rtl8169_tc_offsets { diff --git a/target/linux/generic/backport-6.6/781-13-v6.12-net-phy-realtek-Check-the-index-value-in-led_hw_cont.patch b/target/linux/generic/backport-6.6/781-13-v6.12-net-phy-realtek-Check-the-index-value-in-led_hw_cont.patch new file mode 100644 index 00000000000..a6f8b6d1c51 --- /dev/null +++ b/target/linux/generic/backport-6.6/781-13-v6.12-net-phy-realtek-Check-the-index-value-in-led_hw_cont.patch @@ -0,0 +1,32 @@ +From c283782fc5d60c4d8169137c6f955aa3553d3b3d Mon Sep 17 00:00:00 2001 +From: Hui Wang +Date: Fri, 27 Sep 2024 19:46:10 +0800 +Subject: [PATCH] net: phy: realtek: Check the index value in + led_hw_control_get + +Just like rtl8211f_led_hw_is_supported() and +rtl8211f_led_hw_control_set(), the rtl8211f_led_hw_control_get() also +needs to check the index value, otherwise the caller is likely to get +an incorrect rules. + +Fixes: 17784801d888 ("net: phy: realtek: Add support for PHY LEDs on RTL8211F") +Signed-off-by: Hui Wang +Reviewed-by: Marek Vasut +Link: https://patch.msgid.link/20240927114610.1278935-1-hui.wang@canonical.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/phy/realtek.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -527,6 +527,9 @@ static int rtl8211f_led_hw_control_get(s + { + int val; + ++ if (index >= RTL8211F_LED_COUNT) ++ return -EINVAL; ++ + val = phy_read_paged(phydev, 0xd04, RTL8211F_LEDCR); + if (val < 0) + return val; diff --git a/target/linux/generic/backport-6.6/781-14-v6.12-net-phy-realtek-Fix-MMD-access-on-RTL8126A-integrate.patch b/target/linux/generic/backport-6.6/781-14-v6.12-net-phy-realtek-Fix-MMD-access-on-RTL8126A-integrate.patch new file mode 100644 index 00000000000..b50e133a670 --- /dev/null +++ b/target/linux/generic/backport-6.6/781-14-v6.12-net-phy-realtek-Fix-MMD-access-on-RTL8126A-integrate.patch @@ -0,0 +1,67 @@ +From a6ad589c1d118f9d5b1bc4c6888d42919f830340 Mon Sep 17 00:00:00 2001 +From: Heiner Kallweit +Date: Mon, 7 Oct 2024 11:57:41 +0200 +Subject: [PATCH] net: phy: realtek: Fix MMD access on RTL8126A-integrated PHY + +All MMD reads return 0 for the RTL8126A-integrated PHY. Therefore phylib +assumes it doesn't support EEE, what results in higher power consumption, +and a significantly higher chip temperature in my case. +To fix this split out the PHY driver for the RTL8126A-integrated PHY +and set the read_mmd/write_mmd callbacks to read from vendor-specific +registers. + +Fixes: 5befa3728b85 ("net: phy: realtek: add support for RTL8126A-integrated 5Gbps PHY") +Cc: stable@vger.kernel.org +Signed-off-by: Heiner Kallweit +Signed-off-by: David S. Miller +--- + drivers/net/phy/realtek.c | 24 +++++++++++++++++++++++- + 1 file changed, 23 insertions(+), 1 deletion(-) + +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -1081,6 +1081,16 @@ static int rtl8221b_vn_cg_c45_match_phy_ + return rtlgen_is_c45_match(phydev, RTL_8221B_VN_CG, true); + } + ++static int rtl8251b_c22_match_phy_device(struct phy_device *phydev) ++{ ++ return rtlgen_is_c45_match(phydev, RTL_8251B, false); ++} ++ ++static int rtl8251b_c45_match_phy_device(struct phy_device *phydev) ++{ ++ return rtlgen_is_c45_match(phydev, RTL_8251B, true); ++} ++ + static int rtlgen_resume(struct phy_device *phydev) + { + int ret = genphy_resume(phydev); +@@ -1418,7 +1428,7 @@ static struct phy_driver realtek_drvs[] + .suspend = genphy_c45_pma_suspend, + .resume = rtlgen_c45_resume, + }, { +- PHY_ID_MATCH_EXACT(0x001cc862), ++ .match_phy_device = rtl8251b_c45_match_phy_device, + .name = "RTL8251B 5Gbps PHY", + .get_features = rtl822x_get_features, + .config_aneg = rtl822x_config_aneg, +@@ -1428,6 +1438,18 @@ static struct phy_driver realtek_drvs[] + .read_page = rtl821x_read_page, + .write_page = rtl821x_write_page, + }, { ++ .match_phy_device = rtl8251b_c22_match_phy_device, ++ .name = "RTL8126A-internal 5Gbps PHY", ++ .get_features = rtl822x_get_features, ++ .config_aneg = rtl822x_config_aneg, ++ .read_status = rtl822x_read_status, ++ .suspend = genphy_suspend, ++ .resume = rtlgen_resume, ++ .read_page = rtl821x_read_page, ++ .write_page = rtl821x_write_page, ++ .read_mmd = rtl822x_read_mmd, ++ .write_mmd = rtl822x_write_mmd, ++ }, { + PHY_ID_MATCH_EXACT(0x001ccad0), + .name = "RTL8224 2.5Gbps PHY", + .get_features = rtl822x_c45_get_features, diff --git a/target/linux/generic/backport-6.6/781-15-v6.13-net-phy-realtek-read-duplex-and-gbit-master-from-PHY.patch b/target/linux/generic/backport-6.6/781-15-v6.13-net-phy-realtek-read-duplex-and-gbit-master-from-PHY.patch new file mode 100644 index 00000000000..e15218b169e --- /dev/null +++ b/target/linux/generic/backport-6.6/781-15-v6.13-net-phy-realtek-read-duplex-and-gbit-master-from-PHY.patch @@ -0,0 +1,106 @@ +From 081c9c0265c91b8333165aa6230c20bcbc6f7cbf Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Thu, 10 Oct 2024 14:07:16 +0100 +Subject: [PATCH 3/5] net: phy: realtek: read duplex and gbit master from PHYSR + register + +The PHYSR MMD register is present and defined equally for all RTL82xx +Ethernet PHYs. +Read duplex and Gbit master bits from rtlgen_decode_speed() and rename +it to rtlgen_decode_physr(). + +Signed-off-by: Daniel Golle +Link: https://patch.msgid.link/b9a76341da851a18c985bc4774fa295babec79bb.1728565530.git.daniel@makrotopia.org +Signed-off-by: Paolo Abeni +--- + drivers/net/phy/realtek.c | 41 +++++++++++++++++++++++++++++++-------- + 1 file changed, 33 insertions(+), 8 deletions(-) + +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -80,15 +80,18 @@ + + #define RTL822X_VND2_GANLPAR 0xa414 + +-#define RTL822X_VND2_PHYSR 0xa434 +- + #define RTL8366RB_POWER_SAVE 0x15 + #define RTL8366RB_POWER_SAVE_ON BIT(12) + + #define RTL9000A_GINMR 0x14 + #define RTL9000A_GINMR_LINK_STATUS BIT(4) + +-#define RTLGEN_SPEED_MASK 0x0630 ++#define RTL_VND2_PHYSR 0xa434 ++#define RTL_VND2_PHYSR_DUPLEX BIT(3) ++#define RTL_VND2_PHYSR_SPEEDL GENMASK(5, 4) ++#define RTL_VND2_PHYSR_SPEEDH GENMASK(10, 9) ++#define RTL_VND2_PHYSR_MASTER BIT(11) ++#define RTL_VND2_PHYSR_SPEED_MASK (RTL_VND2_PHYSR_SPEEDL | RTL_VND2_PHYSR_SPEEDH) + + #define RTL_GENERIC_PHYID 0x001cc800 + #define RTL_8211FVD_PHYID 0x001cc878 +@@ -660,9 +663,18 @@ static int rtl8366rb_config_init(struct + } + + /* get actual speed to cover the downshift case */ +-static void rtlgen_decode_speed(struct phy_device *phydev, int val) ++static void rtlgen_decode_physr(struct phy_device *phydev, int val) + { +- switch (val & RTLGEN_SPEED_MASK) { ++ /* bit 3 ++ * 0: Half Duplex ++ * 1: Full Duplex ++ */ ++ if (val & RTL_VND2_PHYSR_DUPLEX) ++ phydev->duplex = DUPLEX_FULL; ++ else ++ phydev->duplex = DUPLEX_HALF; ++ ++ switch (val & RTL_VND2_PHYSR_SPEED_MASK) { + case 0x0000: + phydev->speed = SPEED_10; + break; +@@ -684,6 +696,19 @@ static void rtlgen_decode_speed(struct p + default: + break; + } ++ ++ /* bit 11 ++ * 0: Slave Mode ++ * 1: Master Mode ++ */ ++ if (phydev->speed >= 1000) { ++ if (val & RTL_VND2_PHYSR_MASTER) ++ phydev->master_slave_state = MASTER_SLAVE_STATE_MASTER; ++ else ++ phydev->master_slave_state = MASTER_SLAVE_STATE_SLAVE; ++ } else { ++ phydev->master_slave_state = MASTER_SLAVE_STATE_UNSUPPORTED; ++ } + } + + static int rtlgen_read_status(struct phy_device *phydev) +@@ -701,7 +726,7 @@ static int rtlgen_read_status(struct phy + if (val < 0) + return val; + +- rtlgen_decode_speed(phydev, val); ++ rtlgen_decode_physr(phydev, val); + + return 0; + } +@@ -1007,11 +1032,11 @@ static int rtl822x_c45_read_status(struc + return 0; + + /* Read actual speed from vendor register. */ +- val = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL822X_VND2_PHYSR); ++ val = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL_VND2_PHYSR); + if (val < 0) + return val; + +- rtlgen_decode_speed(phydev, val); ++ rtlgen_decode_physr(phydev, val); + + return 0; + } diff --git a/target/linux/generic/backport-6.6/781-16-v6.13-net-phy-realtek-change-order-of-calls-in-C22-read_st.patch b/target/linux/generic/backport-6.6/781-16-v6.13-net-phy-realtek-change-order-of-calls-in-C22-read_st.patch new file mode 100644 index 00000000000..be7136b3751 --- /dev/null +++ b/target/linux/generic/backport-6.6/781-16-v6.13-net-phy-realtek-change-order-of-calls-in-C22-read_st.patch @@ -0,0 +1,54 @@ +From 68d5cd09e8919679ce13b85950debea4b2e98e04 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Thu, 10 Oct 2024 14:07:26 +0100 +Subject: [PATCH 4/5] net: phy: realtek: change order of calls in C22 + read_status() + +Always call rtlgen_read_status() first, so genphy_read_status() which +is called by it clears bits in case auto-negotiation has not completed. +Also clear 10GBT link-partner advertisement bits in case auto-negotiation +is disabled or has not completed. + +Suggested-by: Russell King (Oracle) +Signed-off-by: Daniel Golle +Link: https://patch.msgid.link/b15929a41621d215c6b2b57393368086589569ec.1728565530.git.daniel@makrotopia.org +Signed-off-by: Paolo Abeni +--- + drivers/net/phy/realtek.c | 22 +++++++++++++++------- + 1 file changed, 15 insertions(+), 7 deletions(-) + +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -949,17 +949,25 @@ static void rtl822xb_update_interface(st + + static int rtl822x_read_status(struct phy_device *phydev) + { +- if (phydev->autoneg == AUTONEG_ENABLE) { +- int lpadv = phy_read_paged(phydev, 0xa5d, 0x13); ++ int lpadv, ret; + +- if (lpadv < 0) +- return lpadv; ++ ret = rtlgen_read_status(phydev); ++ if (ret < 0) ++ return ret; + +- mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, +- lpadv); ++ if (phydev->autoneg == AUTONEG_DISABLE || ++ !phydev->autoneg_complete) { ++ mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, 0); ++ return 0; + } + +- return rtlgen_read_status(phydev); ++ lpadv = phy_read_paged(phydev, 0xa5d, 0x13); ++ if (lpadv < 0) ++ return lpadv; ++ ++ mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, lpadv); ++ ++ return 0; + } + + static int rtl822xb_read_status(struct phy_device *phydev) diff --git a/target/linux/generic/backport-6.6/781-17-v6.13-net-phy-realtek-clear-1000Base-T-link-partner-advert.patch b/target/linux/generic/backport-6.6/781-17-v6.13-net-phy-realtek-clear-1000Base-T-link-partner-advert.patch new file mode 100644 index 00000000000..3847d5803a0 --- /dev/null +++ b/target/linux/generic/backport-6.6/781-17-v6.13-net-phy-realtek-clear-1000Base-T-link-partner-advert.patch @@ -0,0 +1,30 @@ +From 5cb409b3960e75467cbb0a8e1e5596b4490570e3 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Thu, 10 Oct 2024 14:07:39 +0100 +Subject: [PATCH 5/5] net: phy: realtek: clear 1000Base-T link partner + advertisement + +Clear 1000Base-T link partner advertisement bits in Clause-45 +read_status() function in case auto-negotiation is disabled or has not +been completed. + +Signed-off-by: Daniel Golle +Link: https://patch.msgid.link/9dc9b47b2d675708afef3ad366bfd78eb584d958.1728565530.git.daniel@makrotopia.org +Signed-off-by: Paolo Abeni +--- + drivers/net/phy/realtek.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -1026,6 +1026,10 @@ static int rtl822x_c45_read_status(struc + if (ret < 0) + return ret; + ++ if (phydev->autoneg == AUTONEG_DISABLE || ++ !genphy_c45_aneg_done(phydev)) ++ mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, 0); ++ + /* Vendor register as C45 has no standardized support for 1000BaseT */ + if (phydev->autoneg == AUTONEG_ENABLE) { + val = phy_read_mmd(phydev, MDIO_MMD_VEND2, diff --git a/target/linux/generic/pending-6.6/750-net-phy-aquantia-fix-setting-active_low-bit.patch b/target/linux/generic/backport-6.6/837-v6.12-net-phy-aquantia-fix-setting-active_low-bit.patch similarity index 100% rename from target/linux/generic/pending-6.6/750-net-phy-aquantia-fix-setting-active_low-bit.patch rename to target/linux/generic/backport-6.6/837-v6.12-net-phy-aquantia-fix-setting-active_low-bit.patch diff --git a/target/linux/generic/pending-6.6/751-net-phy-aquantia-fix-applying-active_low-bit-after-reset.patch b/target/linux/generic/backport-6.6/838-v6.12-net-phy-aquantia-fix-applying-active_low-bit-after-reset.patch similarity index 100% rename from target/linux/generic/pending-6.6/751-net-phy-aquantia-fix-applying-active_low-bit-after-reset.patch rename to target/linux/generic/backport-6.6/838-v6.12-net-phy-aquantia-fix-applying-active_low-bit-after-reset.patch diff --git a/target/linux/generic/pending-6.6/752-net-phy-aquantia-allow-forcing-order-of-MDI-pairs.patch b/target/linux/generic/backport-6.6/839-v6.13-net-phy-aquantia-allow-forcing-order-of-MDI-pairs.patch similarity index 91% rename from target/linux/generic/pending-6.6/752-net-phy-aquantia-allow-forcing-order-of-MDI-pairs.patch rename to target/linux/generic/backport-6.6/839-v6.13-net-phy-aquantia-allow-forcing-order-of-MDI-pairs.patch index f3ae893b32b..c1655ce71e7 100644 --- a/target/linux/generic/pending-6.6/752-net-phy-aquantia-allow-forcing-order-of-MDI-pairs.patch +++ b/target/linux/generic/backport-6.6/839-v6.13-net-phy-aquantia-allow-forcing-order-of-MDI-pairs.patch @@ -1,6 +1,6 @@ -From 49d46df79404a37685e0f32deb36506f5723e3a0 Mon Sep 17 00:00:00 2001 +From a2e1ba275eae96a8171deb19e9c7c2f5978fee7b Mon Sep 17 00:00:00 2001 From: Daniel Golle -Date: Wed, 28 Aug 2024 23:52:09 +0100 +Date: Fri, 4 Oct 2024 17:18:16 +0100 Subject: [PATCH] net: phy: aquantia: allow forcing order of MDI pairs Despite supporting Auto MDI-X, it looks like Aquantia only supports @@ -35,6 +35,9 @@ Forcing normal pair order is required on the Adtran SDG-8733A Wi-Fi 7 residential gateway. Signed-off-by: Daniel Golle +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/9ed760ff87d5fc456f31e407ead548bbb754497d.1728058550.git.daniel@makrotopia.org +Signed-off-by: Jakub Kicinski --- drivers/net/phy/aquantia/aquantia_main.c | 33 ++++++++++++++++++++++++ 1 file changed, 33 insertions(+) @@ -74,7 +77,7 @@ Signed-off-by: Daniel Golle + ret = of_property_read_u32(np, "marvell,mdi-cfg-order", &mdi_conf); + + /* Do nothing in case property "marvell,mdi-cfg-order" is not present */ -+ if (ret == -EINVAL) ++ if (ret == -ENOENT) + return 0; + + if (ret) diff --git a/target/linux/generic/backport-6.6/840-v6.13-net-phy-aquantia-fix-return-value-check-in-aqr107_co.patch b/target/linux/generic/backport-6.6/840-v6.13-net-phy-aquantia-fix-return-value-check-in-aqr107_co.patch new file mode 100644 index 00000000000..73be78a0582 --- /dev/null +++ b/target/linux/generic/backport-6.6/840-v6.13-net-phy-aquantia-fix-return-value-check-in-aqr107_co.patch @@ -0,0 +1,31 @@ +From ce21b8fb255ebf0b49913fb4c62741d7eb05c6f6 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Fri, 11 Oct 2024 22:28:43 +0100 +Subject: [PATCH] net: phy: aquantia: fix return value check in + aqr107_config_mdi() + +of_property_read_u32() returns -EINVAL in case the property cannot be +found rather than -ENOENT. Fix the check to not abort probing in case +of the property being missing, and also in case CONFIG_OF is not set +which will result in -ENOSYS. + +Fixes: a2e1ba275eae ("net: phy: aquantia: allow forcing order of MDI pairs") +Reported-by: Jon Hunter +Closes: https://lore.kernel.org/all/114b4c03-5d16-42ed-945d-cf78eabea12b@nvidia.com/ +Suggested-by: Hans-Frieder Vogt +Signed-off-by: Daniel Golle +--- + drivers/net/phy/aquantia/aquantia_main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/phy/aquantia/aquantia_main.c ++++ b/drivers/net/phy/aquantia/aquantia_main.c +@@ -512,7 +512,7 @@ static int aqr107_config_mdi(struct phy_ + ret = of_property_read_u32(np, "marvell,mdi-cfg-order", &mdi_conf); + + /* Do nothing in case property "marvell,mdi-cfg-order" is not present */ +- if (ret == -ENOENT) ++ if (ret == -EINVAL || ret == -ENOSYS) + return 0; + + if (ret) diff --git a/target/linux/generic/backport-6.6/841-v6.13-net-phy-support-active-high-property-for-PHY-LEDs.patch b/target/linux/generic/backport-6.6/841-v6.13-net-phy-support-active-high-property-for-PHY-LEDs.patch new file mode 100644 index 00000000000..02706ccd3f6 --- /dev/null +++ b/target/linux/generic/backport-6.6/841-v6.13-net-phy-support-active-high-property-for-PHY-LEDs.patch @@ -0,0 +1,53 @@ +From a274465cc3bef2dfd9c9ea5100848dda0a8641e1 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Thu, 10 Oct 2024 13:54:19 +0100 +Subject: [PATCH 1/4] net: phy: support 'active-high' property for PHY LEDs + +In addition to 'active-low' and 'inactive-high-impedance' also +support 'active-high' property for PHY LED pin configuration. +As only either 'active-high' or 'active-low' can be set at the +same time, WARN and return an error in case both are set. + +Signed-off-by: Daniel Golle +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/91598487773d768f254d5faf06cf65b13e972f0e.1728558223.git.daniel@makrotopia.org +Signed-off-by: Paolo Abeni +--- + drivers/net/phy/phy_device.c | 6 ++++++ + include/linux/phy.h | 5 +++-- + 2 files changed, 9 insertions(+), 2 deletions(-) + +--- a/drivers/net/phy/phy_device.c ++++ b/drivers/net/phy/phy_device.c +@@ -3219,11 +3219,17 @@ static int of_phy_led(struct phy_device + if (index > U8_MAX) + return -EINVAL; + ++ if (of_property_read_bool(led, "active-high")) ++ set_bit(PHY_LED_ACTIVE_HIGH, &modes); + if (of_property_read_bool(led, "active-low")) + set_bit(PHY_LED_ACTIVE_LOW, &modes); + if (of_property_read_bool(led, "inactive-high-impedance")) + set_bit(PHY_LED_INACTIVE_HIGH_IMPEDANCE, &modes); + ++ if (WARN_ON(modes & BIT(PHY_LED_ACTIVE_LOW) && ++ modes & BIT(PHY_LED_ACTIVE_HIGH))) ++ return -EINVAL; ++ + if (modes) { + /* Return error if asked to set polarity modes but not supported */ + if (!phydev->drv->led_polarity_set) +--- a/include/linux/phy.h ++++ b/include/linux/phy.h +@@ -872,8 +872,9 @@ struct phy_led { + + /* Modes for PHY LED configuration */ + enum phy_led_modes { +- PHY_LED_ACTIVE_LOW = 0, +- PHY_LED_INACTIVE_HIGH_IMPEDANCE = 1, ++ PHY_LED_ACTIVE_HIGH = 0, ++ PHY_LED_ACTIVE_LOW = 1, ++ PHY_LED_INACTIVE_HIGH_IMPEDANCE = 2, + + /* keep it last */ + __PHY_LED_MODES_NUM, diff --git a/target/linux/generic/backport-6.6/842-v6.13-net-phy-aquantia-correctly-describe-LED-polarity-ove.patch b/target/linux/generic/backport-6.6/842-v6.13-net-phy-aquantia-correctly-describe-LED-polarity-ove.patch new file mode 100644 index 00000000000..f26bb829e45 --- /dev/null +++ b/target/linux/generic/backport-6.6/842-v6.13-net-phy-aquantia-correctly-describe-LED-polarity-ove.patch @@ -0,0 +1,108 @@ +From 9d55e68b19f222e6334ef4021c5527998f5ab537 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Thu, 10 Oct 2024 13:55:00 +0100 +Subject: [PATCH 2/4] net: phy: aquantia: correctly describe LED polarity + override + +Use newly defined 'active-high' property to set the +VEND1_GLOBAL_LED_DRIVE_VDD bit and let 'active-low' clear that bit. This +reflects the technical reality which was inverted in the previous +description in which the 'active-low' property was used to actually set +the VEND1_GLOBAL_LED_DRIVE_VDD bit, which means that VDD (ie. supply +voltage) of the LED is driven rather than GND. + +Signed-off-by: Daniel Golle +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/86a413b4387c42dcb54f587cc2433a06f16aae83.1728558223.git.daniel@makrotopia.org +Signed-off-by: Paolo Abeni +--- + drivers/net/phy/aquantia/aquantia.h | 1 + + drivers/net/phy/aquantia/aquantia_leds.c | 19 ++++++++++++++----- + drivers/net/phy/aquantia/aquantia_main.c | 12 +++++++++--- + 3 files changed, 24 insertions(+), 8 deletions(-) + +--- a/drivers/net/phy/aquantia/aquantia.h ++++ b/drivers/net/phy/aquantia/aquantia.h +@@ -169,6 +169,7 @@ static const struct aqr107_hw_stat aqr10 + struct aqr107_priv { + u64 sgmii_stats[AQR107_SGMII_STAT_SZ]; + unsigned long leds_active_low; ++ unsigned long leds_active_high; + }; + + #if IS_REACHABLE(CONFIG_HWMON) +--- a/drivers/net/phy/aquantia/aquantia_leds.c ++++ b/drivers/net/phy/aquantia/aquantia_leds.c +@@ -121,13 +121,13 @@ int aqr_phy_led_active_low_set(struct ph + { + return phy_modify_mmd(phydev, MDIO_MMD_VEND1, AQR_LED_DRIVE(index), + VEND1_GLOBAL_LED_DRIVE_VDD, +- enable ? VEND1_GLOBAL_LED_DRIVE_VDD : 0); ++ enable ? 0 : VEND1_GLOBAL_LED_DRIVE_VDD); + } + + int aqr_phy_led_polarity_set(struct phy_device *phydev, int index, unsigned long modes) + { ++ bool force_active_low = false, force_active_high = false; + struct aqr107_priv *priv = phydev->priv; +- bool active_low = false; + u32 mode; + + if (index >= AQR_MAX_LEDS) +@@ -136,7 +136,10 @@ int aqr_phy_led_polarity_set(struct phy_ + for_each_set_bit(mode, &modes, __PHY_LED_MODES_NUM) { + switch (mode) { + case PHY_LED_ACTIVE_LOW: +- active_low = true; ++ force_active_low = true; ++ break; ++ case PHY_LED_ACTIVE_HIGH: ++ force_active_high = true; + break; + default: + return -EINVAL; +@@ -144,8 +147,14 @@ int aqr_phy_led_polarity_set(struct phy_ + } + + /* Save LED driver vdd state to restore on SW reset */ +- if (active_low) ++ if (force_active_low) + priv->leds_active_low |= BIT(index); + +- return aqr_phy_led_active_low_set(phydev, index, active_low); ++ if (force_active_high) ++ priv->leds_active_high |= BIT(index); ++ ++ if (force_active_high || force_active_low) ++ return aqr_phy_led_active_low_set(phydev, index, force_active_low); ++ ++ unreachable(); + } +--- a/drivers/net/phy/aquantia/aquantia_main.c ++++ b/drivers/net/phy/aquantia/aquantia_main.c +@@ -529,7 +529,7 @@ static int aqr107_config_mdi(struct phy_ + static int aqr107_config_init(struct phy_device *phydev) + { + struct aqr107_priv *priv = phydev->priv; +- u32 led_active_low; ++ u32 led_idx; + int ret; + + /* Check that the PHY interface type is compatible */ +@@ -569,8 +569,14 @@ static int aqr107_config_init(struct phy + return ret; + + /* Restore LED polarity state after reset */ +- for_each_set_bit(led_active_low, &priv->leds_active_low, AQR_MAX_LEDS) { +- ret = aqr_phy_led_active_low_set(phydev, led_active_low, true); ++ for_each_set_bit(led_idx, &priv->leds_active_low, AQR_MAX_LEDS) { ++ ret = aqr_phy_led_active_low_set(phydev, led_idx, true); ++ if (ret) ++ return ret; ++ } ++ ++ for_each_set_bit(led_idx, &priv->leds_active_high, AQR_MAX_LEDS) { ++ ret = aqr_phy_led_active_low_set(phydev, led_idx, false); + if (ret) + return ret; + } diff --git a/target/linux/generic/backport-6.6/843-v6.13-net-phy-mxl-gpy-add-basic-LED-support.patch b/target/linux/generic/backport-6.6/843-v6.13-net-phy-mxl-gpy-add-basic-LED-support.patch new file mode 100644 index 00000000000..2ceaa0ad3d0 --- /dev/null +++ b/target/linux/generic/backport-6.6/843-v6.13-net-phy-mxl-gpy-add-basic-LED-support.patch @@ -0,0 +1,332 @@ +From 78997e9a5e4d8a4df561e083a92c91ae23010e07 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Tue, 1 Oct 2024 01:17:18 +0100 +Subject: [PATCH] net: phy: mxl-gpy: add basic LED support + +Add basic support for LEDs connected to MaxLinear GPY2xx and GPY115 PHYs. +The PHYs allow up to 4 LEDs to be connected. +Implement controlling LEDs in software as well as netdev trigger offloading +and LED polarity setup. + +The hardware claims to support 16 PWM brightness levels but there is no +documentation on how to use that feature, hence this is not supported. + +Signed-off-by: Daniel Golle +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/b6ec9050339f8244ff898898a1cecc33b13a48fc.1727741563.git.daniel@makrotopia.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/phy/mxl-gpy.c | 218 ++++++++++++++++++++++++++++++++++++++ + 1 file changed, 218 insertions(+) + +--- a/drivers/net/phy/mxl-gpy.c ++++ b/drivers/net/phy/mxl-gpy.c +@@ -38,6 +38,7 @@ + #define PHY_MIISTAT 0x18 /* MII state */ + #define PHY_IMASK 0x19 /* interrupt mask */ + #define PHY_ISTAT 0x1A /* interrupt status */ ++#define PHY_LED 0x1B /* LEDs */ + #define PHY_FWV 0x1E /* firmware version */ + + #define PHY_MIISTAT_SPD_MASK GENMASK(2, 0) +@@ -61,6 +62,11 @@ + PHY_IMASK_ADSC | \ + PHY_IMASK_ANC) + ++#define GPY_MAX_LEDS 4 ++#define PHY_LED_POLARITY(idx) BIT(12 + (idx)) ++#define PHY_LED_HWCONTROL(idx) BIT(8 + (idx)) ++#define PHY_LED_ON(idx) BIT(idx) ++ + #define PHY_FWV_REL_MASK BIT(15) + #define PHY_FWV_MAJOR_MASK GENMASK(11, 8) + #define PHY_FWV_MINOR_MASK GENMASK(7, 0) +@@ -72,6 +78,23 @@ + #define PHY_MDI_MDI_X_CD 0x1 + #define PHY_MDI_MDI_X_CROSS 0x0 + ++/* LED */ ++#define VSPEC1_LED(idx) (1 + (idx)) ++#define VSPEC1_LED_BLINKS GENMASK(15, 12) ++#define VSPEC1_LED_PULSE GENMASK(11, 8) ++#define VSPEC1_LED_CON GENMASK(7, 4) ++#define VSPEC1_LED_BLINKF GENMASK(3, 0) ++ ++#define VSPEC1_LED_LINK10 BIT(0) ++#define VSPEC1_LED_LINK100 BIT(1) ++#define VSPEC1_LED_LINK1000 BIT(2) ++#define VSPEC1_LED_LINK2500 BIT(3) ++ ++#define VSPEC1_LED_TXACT BIT(0) ++#define VSPEC1_LED_RXACT BIT(1) ++#define VSPEC1_LED_COL BIT(2) ++#define VSPEC1_LED_NO_CON BIT(3) ++ + /* SGMII */ + #define VSPEC1_SGMII_CTRL 0x08 + #define VSPEC1_SGMII_CTRL_ANEN BIT(12) /* Aneg enable */ +@@ -827,6 +850,156 @@ static int gpy115_loopback(struct phy_de + return genphy_soft_reset(phydev); + } + ++static int gpy_led_brightness_set(struct phy_device *phydev, ++ u8 index, enum led_brightness value) ++{ ++ int ret; ++ ++ if (index >= GPY_MAX_LEDS) ++ return -EINVAL; ++ ++ /* clear HWCONTROL and set manual LED state */ ++ ret = phy_modify(phydev, PHY_LED, ++ ((value == LED_OFF) ? PHY_LED_HWCONTROL(index) : 0) | ++ PHY_LED_ON(index), ++ (value == LED_OFF) ? 0 : PHY_LED_ON(index)); ++ if (ret) ++ return ret; ++ ++ /* ToDo: set PWM brightness */ ++ ++ /* clear HW LED setup */ ++ if (value == LED_OFF) ++ return phy_write_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_LED(index), 0); ++ else ++ return 0; ++} ++ ++static const unsigned long supported_triggers = (BIT(TRIGGER_NETDEV_LINK) | ++ BIT(TRIGGER_NETDEV_LINK_100) | ++ BIT(TRIGGER_NETDEV_LINK_1000) | ++ BIT(TRIGGER_NETDEV_LINK_2500) | ++ BIT(TRIGGER_NETDEV_RX) | ++ BIT(TRIGGER_NETDEV_TX)); ++ ++static int gpy_led_hw_is_supported(struct phy_device *phydev, u8 index, ++ unsigned long rules) ++{ ++ if (index >= GPY_MAX_LEDS) ++ return -EINVAL; ++ ++ /* All combinations of the supported triggers are allowed */ ++ if (rules & ~supported_triggers) ++ return -EOPNOTSUPP; ++ ++ return 0; ++} ++ ++static int gpy_led_hw_control_get(struct phy_device *phydev, u8 index, ++ unsigned long *rules) ++{ ++ int val; ++ ++ if (index >= GPY_MAX_LEDS) ++ return -EINVAL; ++ ++ val = phy_read_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_LED(index)); ++ if (val < 0) ++ return val; ++ ++ if (FIELD_GET(VSPEC1_LED_CON, val) & VSPEC1_LED_LINK10) ++ *rules |= BIT(TRIGGER_NETDEV_LINK_10); ++ ++ if (FIELD_GET(VSPEC1_LED_CON, val) & VSPEC1_LED_LINK100) ++ *rules |= BIT(TRIGGER_NETDEV_LINK_100); ++ ++ if (FIELD_GET(VSPEC1_LED_CON, val) & VSPEC1_LED_LINK1000) ++ *rules |= BIT(TRIGGER_NETDEV_LINK_1000); ++ ++ if (FIELD_GET(VSPEC1_LED_CON, val) & VSPEC1_LED_LINK2500) ++ *rules |= BIT(TRIGGER_NETDEV_LINK_2500); ++ ++ if (FIELD_GET(VSPEC1_LED_CON, val) == (VSPEC1_LED_LINK10 | ++ VSPEC1_LED_LINK100 | ++ VSPEC1_LED_LINK1000 | ++ VSPEC1_LED_LINK2500)) ++ *rules |= BIT(TRIGGER_NETDEV_LINK); ++ ++ if (FIELD_GET(VSPEC1_LED_PULSE, val) & VSPEC1_LED_TXACT) ++ *rules |= BIT(TRIGGER_NETDEV_TX); ++ ++ if (FIELD_GET(VSPEC1_LED_PULSE, val) & VSPEC1_LED_RXACT) ++ *rules |= BIT(TRIGGER_NETDEV_RX); ++ ++ return 0; ++} ++ ++static int gpy_led_hw_control_set(struct phy_device *phydev, u8 index, ++ unsigned long rules) ++{ ++ u16 val = 0; ++ int ret; ++ ++ if (index >= GPY_MAX_LEDS) ++ return -EINVAL; ++ ++ if (rules & BIT(TRIGGER_NETDEV_LINK) || ++ rules & BIT(TRIGGER_NETDEV_LINK_10)) ++ val |= FIELD_PREP(VSPEC1_LED_CON, VSPEC1_LED_LINK10); ++ ++ if (rules & BIT(TRIGGER_NETDEV_LINK) || ++ rules & BIT(TRIGGER_NETDEV_LINK_100)) ++ val |= FIELD_PREP(VSPEC1_LED_CON, VSPEC1_LED_LINK100); ++ ++ if (rules & BIT(TRIGGER_NETDEV_LINK) || ++ rules & BIT(TRIGGER_NETDEV_LINK_1000)) ++ val |= FIELD_PREP(VSPEC1_LED_CON, VSPEC1_LED_LINK1000); ++ ++ if (rules & BIT(TRIGGER_NETDEV_LINK) || ++ rules & BIT(TRIGGER_NETDEV_LINK_2500)) ++ val |= FIELD_PREP(VSPEC1_LED_CON, VSPEC1_LED_LINK2500); ++ ++ if (rules & BIT(TRIGGER_NETDEV_TX)) ++ val |= FIELD_PREP(VSPEC1_LED_PULSE, VSPEC1_LED_TXACT); ++ ++ if (rules & BIT(TRIGGER_NETDEV_RX)) ++ val |= FIELD_PREP(VSPEC1_LED_PULSE, VSPEC1_LED_RXACT); ++ ++ /* allow RX/TX pulse without link indication */ ++ if ((rules & BIT(TRIGGER_NETDEV_TX) || rules & BIT(TRIGGER_NETDEV_RX)) && ++ !(val & VSPEC1_LED_CON)) ++ val |= FIELD_PREP(VSPEC1_LED_PULSE, VSPEC1_LED_NO_CON) | VSPEC1_LED_CON; ++ ++ ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_LED(index), val); ++ if (ret) ++ return ret; ++ ++ return phy_set_bits(phydev, PHY_LED, PHY_LED_HWCONTROL(index)); ++} ++ ++static int gpy_led_polarity_set(struct phy_device *phydev, int index, ++ unsigned long modes) ++{ ++ bool active_low = false; ++ u32 mode; ++ ++ if (index >= GPY_MAX_LEDS) ++ return -EINVAL; ++ ++ for_each_set_bit(mode, &modes, __PHY_LED_MODES_NUM) { ++ switch (mode) { ++ case PHY_LED_ACTIVE_LOW: ++ active_low = true; ++ break; ++ default: ++ return -EINVAL; ++ } ++ } ++ ++ return phy_modify(phydev, PHY_LED, PHY_LED_POLARITY(index), ++ active_low ? 0 : PHY_LED_POLARITY(index)); ++} ++ + static struct phy_driver gpy_drivers[] = { + { + PHY_ID_MATCH_MODEL(PHY_ID_GPY2xx), +@@ -844,6 +1017,11 @@ static struct phy_driver gpy_drivers[] = + .set_wol = gpy_set_wol, + .get_wol = gpy_get_wol, + .set_loopback = gpy_loopback, ++ .led_brightness_set = gpy_led_brightness_set, ++ .led_hw_is_supported = gpy_led_hw_is_supported, ++ .led_hw_control_get = gpy_led_hw_control_get, ++ .led_hw_control_set = gpy_led_hw_control_set, ++ .led_polarity_set = gpy_led_polarity_set, + }, + { + .phy_id = PHY_ID_GPY115B, +@@ -862,6 +1040,11 @@ static struct phy_driver gpy_drivers[] = + .set_wol = gpy_set_wol, + .get_wol = gpy_get_wol, + .set_loopback = gpy115_loopback, ++ .led_brightness_set = gpy_led_brightness_set, ++ .led_hw_is_supported = gpy_led_hw_is_supported, ++ .led_hw_control_get = gpy_led_hw_control_get, ++ .led_hw_control_set = gpy_led_hw_control_set, ++ .led_polarity_set = gpy_led_polarity_set, + }, + { + PHY_ID_MATCH_MODEL(PHY_ID_GPY115C), +@@ -879,6 +1062,11 @@ static struct phy_driver gpy_drivers[] = + .set_wol = gpy_set_wol, + .get_wol = gpy_get_wol, + .set_loopback = gpy115_loopback, ++ .led_brightness_set = gpy_led_brightness_set, ++ .led_hw_is_supported = gpy_led_hw_is_supported, ++ .led_hw_control_get = gpy_led_hw_control_get, ++ .led_hw_control_set = gpy_led_hw_control_set, ++ .led_polarity_set = gpy_led_polarity_set, + }, + { + .phy_id = PHY_ID_GPY211B, +@@ -897,6 +1085,11 @@ static struct phy_driver gpy_drivers[] = + .set_wol = gpy_set_wol, + .get_wol = gpy_get_wol, + .set_loopback = gpy_loopback, ++ .led_brightness_set = gpy_led_brightness_set, ++ .led_hw_is_supported = gpy_led_hw_is_supported, ++ .led_hw_control_get = gpy_led_hw_control_get, ++ .led_hw_control_set = gpy_led_hw_control_set, ++ .led_polarity_set = gpy_led_polarity_set, + }, + { + PHY_ID_MATCH_MODEL(PHY_ID_GPY211C), +@@ -914,6 +1107,11 @@ static struct phy_driver gpy_drivers[] = + .set_wol = gpy_set_wol, + .get_wol = gpy_get_wol, + .set_loopback = gpy_loopback, ++ .led_brightness_set = gpy_led_brightness_set, ++ .led_hw_is_supported = gpy_led_hw_is_supported, ++ .led_hw_control_get = gpy_led_hw_control_get, ++ .led_hw_control_set = gpy_led_hw_control_set, ++ .led_polarity_set = gpy_led_polarity_set, + }, + { + .phy_id = PHY_ID_GPY212B, +@@ -932,6 +1130,11 @@ static struct phy_driver gpy_drivers[] = + .set_wol = gpy_set_wol, + .get_wol = gpy_get_wol, + .set_loopback = gpy_loopback, ++ .led_brightness_set = gpy_led_brightness_set, ++ .led_hw_is_supported = gpy_led_hw_is_supported, ++ .led_hw_control_get = gpy_led_hw_control_get, ++ .led_hw_control_set = gpy_led_hw_control_set, ++ .led_polarity_set = gpy_led_polarity_set, + }, + { + PHY_ID_MATCH_MODEL(PHY_ID_GPY212C), +@@ -949,6 +1152,11 @@ static struct phy_driver gpy_drivers[] = + .set_wol = gpy_set_wol, + .get_wol = gpy_get_wol, + .set_loopback = gpy_loopback, ++ .led_brightness_set = gpy_led_brightness_set, ++ .led_hw_is_supported = gpy_led_hw_is_supported, ++ .led_hw_control_get = gpy_led_hw_control_get, ++ .led_hw_control_set = gpy_led_hw_control_set, ++ .led_polarity_set = gpy_led_polarity_set, + }, + { + .phy_id = PHY_ID_GPY215B, +@@ -967,6 +1175,11 @@ static struct phy_driver gpy_drivers[] = + .set_wol = gpy_set_wol, + .get_wol = gpy_get_wol, + .set_loopback = gpy_loopback, ++ .led_brightness_set = gpy_led_brightness_set, ++ .led_hw_is_supported = gpy_led_hw_is_supported, ++ .led_hw_control_get = gpy_led_hw_control_get, ++ .led_hw_control_set = gpy_led_hw_control_set, ++ .led_polarity_set = gpy_led_polarity_set, + }, + { + PHY_ID_MATCH_MODEL(PHY_ID_GPY215C), +@@ -984,6 +1197,11 @@ static struct phy_driver gpy_drivers[] = + .set_wol = gpy_set_wol, + .get_wol = gpy_get_wol, + .set_loopback = gpy_loopback, ++ .led_brightness_set = gpy_led_brightness_set, ++ .led_hw_is_supported = gpy_led_hw_is_supported, ++ .led_hw_control_get = gpy_led_hw_control_get, ++ .led_hw_control_set = gpy_led_hw_control_set, ++ .led_polarity_set = gpy_led_polarity_set, + }, + { + PHY_ID_MATCH_MODEL(PHY_ID_GPY241B), diff --git a/target/linux/generic/backport-6.6/844-v6.13-net-phy-mxl-gpy-add-missing-support-for-TRIGGER_NETD.patch b/target/linux/generic/backport-6.6/844-v6.13-net-phy-mxl-gpy-add-missing-support-for-TRIGGER_NETD.patch new file mode 100644 index 00000000000..067c62da11e --- /dev/null +++ b/target/linux/generic/backport-6.6/844-v6.13-net-phy-mxl-gpy-add-missing-support-for-TRIGGER_NETD.patch @@ -0,0 +1,28 @@ +From f95b4725e796b12e5f347a0d161e1d3843142aa8 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Fri, 4 Oct 2024 16:56:35 +0100 +Subject: [PATCH] net: phy: mxl-gpy: add missing support for + TRIGGER_NETDEV_LINK_10 + +The PHY also support 10MBit/s links as well as the corresponding link +indication trigger to be offloaded. Add TRIGGER_NETDEV_LINK_10 to the +supported triggers. + +Signed-off-by: Daniel Golle +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/cc5da0a989af8b0d49d823656d88053c4de2ab98.1728057367.git.daniel@makrotopia.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/phy/mxl-gpy.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/phy/mxl-gpy.c ++++ b/drivers/net/phy/mxl-gpy.c +@@ -876,6 +876,7 @@ static int gpy_led_brightness_set(struct + } + + static const unsigned long supported_triggers = (BIT(TRIGGER_NETDEV_LINK) | ++ BIT(TRIGGER_NETDEV_LINK_10) | + BIT(TRIGGER_NETDEV_LINK_100) | + BIT(TRIGGER_NETDEV_LINK_1000) | + BIT(TRIGGER_NETDEV_LINK_2500) | diff --git a/target/linux/generic/backport-6.6/845-v6.13-net-phy-mxl-gpy-correctly-describe-LED-polarity.patch b/target/linux/generic/backport-6.6/845-v6.13-net-phy-mxl-gpy-correctly-describe-LED-polarity.patch new file mode 100644 index 00000000000..5b88548dd06 --- /dev/null +++ b/target/linux/generic/backport-6.6/845-v6.13-net-phy-mxl-gpy-correctly-describe-LED-polarity.patch @@ -0,0 +1,58 @@ +From eb89c79c1b8f17fc1611540768678e60df89ac42 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Thu, 10 Oct 2024 13:55:17 +0100 +Subject: [PATCH 3/4] net: phy: mxl-gpy: correctly describe LED polarity + +According the datasheet covering the LED (0x1b) register: +0B Active High LEDx pin driven high when activated +1B Active Low LEDx pin driven low when activated + +Make use of the now available 'active-high' property and correctly +reflect the polarity setting which was previously inverted. + +Signed-off-by: Daniel Golle +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/180ccafa837f09908b852a8a874a3808c5ecd2d0.1728558223.git.daniel@makrotopia.org +Signed-off-by: Paolo Abeni +--- + drivers/net/phy/mxl-gpy.c | 16 ++++++++++++---- + 1 file changed, 12 insertions(+), 4 deletions(-) + +--- a/drivers/net/phy/mxl-gpy.c ++++ b/drivers/net/phy/mxl-gpy.c +@@ -981,7 +981,7 @@ static int gpy_led_hw_control_set(struct + static int gpy_led_polarity_set(struct phy_device *phydev, int index, + unsigned long modes) + { +- bool active_low = false; ++ bool force_active_low = false, force_active_high = false; + u32 mode; + + if (index >= GPY_MAX_LEDS) +@@ -990,15 +990,23 @@ static int gpy_led_polarity_set(struct p + for_each_set_bit(mode, &modes, __PHY_LED_MODES_NUM) { + switch (mode) { + case PHY_LED_ACTIVE_LOW: +- active_low = true; ++ force_active_low = true; ++ break; ++ case PHY_LED_ACTIVE_HIGH: ++ force_active_high = true; + break; + default: + return -EINVAL; + } + } + +- return phy_modify(phydev, PHY_LED, PHY_LED_POLARITY(index), +- active_low ? 0 : PHY_LED_POLARITY(index)); ++ if (force_active_low) ++ return phy_set_bits(phydev, PHY_LED, PHY_LED_POLARITY(index)); ++ ++ if (force_active_high) ++ return phy_clear_bits(phydev, PHY_LED, PHY_LED_POLARITY(index)); ++ ++ unreachable(); + } + + static struct phy_driver gpy_drivers[] = { diff --git a/target/linux/generic/backport-6.6/846-v6.13-net-phy-intel-xway-add-support-for-PHY-LEDs.patch b/target/linux/generic/backport-6.6/846-v6.13-net-phy-intel-xway-add-support-for-PHY-LEDs.patch new file mode 100644 index 00000000000..c57b5777ad5 --- /dev/null +++ b/target/linux/generic/backport-6.6/846-v6.13-net-phy-intel-xway-add-support-for-PHY-LEDs.patch @@ -0,0 +1,379 @@ +From 1758af47b98c17da464cb45f476875150955dd48 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Thu, 10 Oct 2024 13:55:29 +0100 +Subject: [PATCH 4/4] net: phy: intel-xway: add support for PHY LEDs + +The intel-xway PHY driver predates the PHY LED framework and currently +initializes all LED pins to equal default values. + +Add PHY LED functions to the drivers and don't set default values if +LEDs are defined in device tree. + +According the datasheets 3 LEDs are supported on all Intel XWAY PHYs. + +Signed-off-by: Daniel Golle +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/81f4717ab9acf38f3239727a4540ae96fd01109b.1728558223.git.daniel@makrotopia.org +Signed-off-by: Paolo Abeni +--- + drivers/net/phy/intel-xway.c | 253 +++++++++++++++++++++++++++++++++-- + 1 file changed, 244 insertions(+), 9 deletions(-) + +--- a/drivers/net/phy/intel-xway.c ++++ b/drivers/net/phy/intel-xway.c +@@ -151,6 +151,13 @@ + #define XWAY_MMD_LED3H 0x01E8 + #define XWAY_MMD_LED3L 0x01E9 + ++#define XWAY_GPHY_MAX_LEDS 3 ++#define XWAY_GPHY_LED_INV(idx) BIT(12 + (idx)) ++#define XWAY_GPHY_LED_EN(idx) BIT(8 + (idx)) ++#define XWAY_GPHY_LED_DA(idx) BIT(idx) ++#define XWAY_MMD_LEDxH(idx) (XWAY_MMD_LED0H + 2 * (idx)) ++#define XWAY_MMD_LEDxL(idx) (XWAY_MMD_LED0L + 2 * (idx)) ++ + #define PHY_ID_PHY11G_1_3 0x030260D1 + #define PHY_ID_PHY22F_1_3 0x030260E1 + #define PHY_ID_PHY11G_1_4 0xD565A400 +@@ -229,20 +236,12 @@ static int xway_gphy_rgmii_init(struct p + XWAY_MDIO_MIICTRL_TXSKEW_MASK, val); + } + +-static int xway_gphy_config_init(struct phy_device *phydev) ++static int xway_gphy_init_leds(struct phy_device *phydev) + { + int err; + u32 ledxh; + u32 ledxl; + +- /* Mask all interrupts */ +- err = phy_write(phydev, XWAY_MDIO_IMASK, 0); +- if (err) +- return err; +- +- /* Clear all pending interrupts */ +- phy_read(phydev, XWAY_MDIO_ISTAT); +- + /* Ensure that integrated led function is enabled for all leds */ + err = phy_write(phydev, XWAY_MDIO_LED, + XWAY_MDIO_LED_LED0_EN | +@@ -276,6 +275,26 @@ static int xway_gphy_config_init(struct + phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LED2H, ledxh); + phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LED2L, ledxl); + ++ return 0; ++} ++ ++static int xway_gphy_config_init(struct phy_device *phydev) ++{ ++ struct device_node *np = phydev->mdio.dev.of_node; ++ int err; ++ ++ /* Mask all interrupts */ ++ err = phy_write(phydev, XWAY_MDIO_IMASK, 0); ++ if (err) ++ return err; ++ ++ /* Use default LED configuration if 'leds' node isn't defined */ ++ if (!of_get_child_by_name(np, "leds")) ++ xway_gphy_init_leds(phydev); ++ ++ /* Clear all pending interrupts */ ++ phy_read(phydev, XWAY_MDIO_ISTAT); ++ + err = xway_gphy_rgmii_init(phydev); + if (err) + return err; +@@ -347,6 +366,172 @@ static irqreturn_t xway_gphy_handle_inte + return IRQ_HANDLED; + } + ++static int xway_gphy_led_brightness_set(struct phy_device *phydev, ++ u8 index, enum led_brightness value) ++{ ++ int ret; ++ ++ if (index >= XWAY_GPHY_MAX_LEDS) ++ return -EINVAL; ++ ++ /* clear EN and set manual LED state */ ++ ret = phy_modify(phydev, XWAY_MDIO_LED, ++ ((value == LED_OFF) ? XWAY_GPHY_LED_EN(index) : 0) | ++ XWAY_GPHY_LED_DA(index), ++ (value == LED_OFF) ? 0 : XWAY_GPHY_LED_DA(index)); ++ if (ret) ++ return ret; ++ ++ /* clear HW LED setup */ ++ if (value == LED_OFF) { ++ ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LEDxH(index), 0); ++ if (ret) ++ return ret; ++ ++ return phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LEDxL(index), 0); ++ } else { ++ return 0; ++ } ++} ++ ++static const unsigned long supported_triggers = (BIT(TRIGGER_NETDEV_LINK) | ++ BIT(TRIGGER_NETDEV_LINK_10) | ++ BIT(TRIGGER_NETDEV_LINK_100) | ++ BIT(TRIGGER_NETDEV_LINK_1000) | ++ BIT(TRIGGER_NETDEV_RX) | ++ BIT(TRIGGER_NETDEV_TX)); ++ ++static int xway_gphy_led_hw_is_supported(struct phy_device *phydev, u8 index, ++ unsigned long rules) ++{ ++ if (index >= XWAY_GPHY_MAX_LEDS) ++ return -EINVAL; ++ ++ /* activity triggers are not possible without combination with a link ++ * trigger. ++ */ ++ if (rules & (BIT(TRIGGER_NETDEV_RX) | BIT(TRIGGER_NETDEV_TX)) && ++ !(rules & (BIT(TRIGGER_NETDEV_LINK) | ++ BIT(TRIGGER_NETDEV_LINK_10) | ++ BIT(TRIGGER_NETDEV_LINK_100) | ++ BIT(TRIGGER_NETDEV_LINK_1000)))) ++ return -EOPNOTSUPP; ++ ++ /* All other combinations of the supported triggers are allowed */ ++ if (rules & ~supported_triggers) ++ return -EOPNOTSUPP; ++ ++ return 0; ++} ++ ++static int xway_gphy_led_hw_control_get(struct phy_device *phydev, u8 index, ++ unsigned long *rules) ++{ ++ int lval, hval; ++ ++ if (index >= XWAY_GPHY_MAX_LEDS) ++ return -EINVAL; ++ ++ hval = phy_read_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LEDxH(index)); ++ if (hval < 0) ++ return hval; ++ ++ lval = phy_read_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LEDxL(index)); ++ if (lval < 0) ++ return lval; ++ ++ if (hval & XWAY_MMD_LEDxH_CON_LINK10) ++ *rules |= BIT(TRIGGER_NETDEV_LINK_10); ++ ++ if (hval & XWAY_MMD_LEDxH_CON_LINK100) ++ *rules |= BIT(TRIGGER_NETDEV_LINK_100); ++ ++ if (hval & XWAY_MMD_LEDxH_CON_LINK1000) ++ *rules |= BIT(TRIGGER_NETDEV_LINK_1000); ++ ++ if ((hval & XWAY_MMD_LEDxH_CON_LINK10) && ++ (hval & XWAY_MMD_LEDxH_CON_LINK100) && ++ (hval & XWAY_MMD_LEDxH_CON_LINK1000)) ++ *rules |= BIT(TRIGGER_NETDEV_LINK); ++ ++ if (lval & XWAY_MMD_LEDxL_PULSE_TXACT) ++ *rules |= BIT(TRIGGER_NETDEV_TX); ++ ++ if (lval & XWAY_MMD_LEDxL_PULSE_RXACT) ++ *rules |= BIT(TRIGGER_NETDEV_RX); ++ ++ return 0; ++} ++ ++static int xway_gphy_led_hw_control_set(struct phy_device *phydev, u8 index, ++ unsigned long rules) ++{ ++ u16 hval = 0, lval = 0; ++ int ret; ++ ++ if (index >= XWAY_GPHY_MAX_LEDS) ++ return -EINVAL; ++ ++ if (rules & BIT(TRIGGER_NETDEV_LINK) || ++ rules & BIT(TRIGGER_NETDEV_LINK_10)) ++ hval |= XWAY_MMD_LEDxH_CON_LINK10; ++ ++ if (rules & BIT(TRIGGER_NETDEV_LINK) || ++ rules & BIT(TRIGGER_NETDEV_LINK_100)) ++ hval |= XWAY_MMD_LEDxH_CON_LINK100; ++ ++ if (rules & BIT(TRIGGER_NETDEV_LINK) || ++ rules & BIT(TRIGGER_NETDEV_LINK_1000)) ++ hval |= XWAY_MMD_LEDxH_CON_LINK1000; ++ ++ if (rules & BIT(TRIGGER_NETDEV_TX)) ++ lval |= XWAY_MMD_LEDxL_PULSE_TXACT; ++ ++ if (rules & BIT(TRIGGER_NETDEV_RX)) ++ lval |= XWAY_MMD_LEDxL_PULSE_RXACT; ++ ++ ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LEDxH(index), hval); ++ if (ret) ++ return ret; ++ ++ ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LEDxL(index), lval); ++ if (ret) ++ return ret; ++ ++ return phy_set_bits(phydev, XWAY_MDIO_LED, XWAY_GPHY_LED_EN(index)); ++} ++ ++static int xway_gphy_led_polarity_set(struct phy_device *phydev, int index, ++ unsigned long modes) ++{ ++ bool force_active_low = false, force_active_high = false; ++ u32 mode; ++ ++ if (index >= XWAY_GPHY_MAX_LEDS) ++ return -EINVAL; ++ ++ for_each_set_bit(mode, &modes, __PHY_LED_MODES_NUM) { ++ switch (mode) { ++ case PHY_LED_ACTIVE_LOW: ++ force_active_low = true; ++ break; ++ case PHY_LED_ACTIVE_HIGH: ++ force_active_high = true; ++ break; ++ default: ++ return -EINVAL; ++ } ++ } ++ ++ if (force_active_low) ++ return phy_set_bits(phydev, XWAY_MDIO_LED, XWAY_GPHY_LED_INV(index)); ++ ++ if (force_active_high) ++ return phy_clear_bits(phydev, XWAY_MDIO_LED, XWAY_GPHY_LED_INV(index)); ++ ++ unreachable(); ++} ++ + static struct phy_driver xway_gphy[] = { + { + .phy_id = PHY_ID_PHY11G_1_3, +@@ -359,6 +544,11 @@ static struct phy_driver xway_gphy[] = { + .config_intr = xway_gphy_config_intr, + .suspend = genphy_suspend, + .resume = genphy_resume, ++ .led_brightness_set = xway_gphy_led_brightness_set, ++ .led_hw_is_supported = xway_gphy_led_hw_is_supported, ++ .led_hw_control_get = xway_gphy_led_hw_control_get, ++ .led_hw_control_set = xway_gphy_led_hw_control_set, ++ .led_polarity_set = xway_gphy_led_polarity_set, + }, { + .phy_id = PHY_ID_PHY22F_1_3, + .phy_id_mask = 0xffffffff, +@@ -370,6 +560,11 @@ static struct phy_driver xway_gphy[] = { + .config_intr = xway_gphy_config_intr, + .suspend = genphy_suspend, + .resume = genphy_resume, ++ .led_brightness_set = xway_gphy_led_brightness_set, ++ .led_hw_is_supported = xway_gphy_led_hw_is_supported, ++ .led_hw_control_get = xway_gphy_led_hw_control_get, ++ .led_hw_control_set = xway_gphy_led_hw_control_set, ++ .led_polarity_set = xway_gphy_led_polarity_set, + }, { + .phy_id = PHY_ID_PHY11G_1_4, + .phy_id_mask = 0xffffffff, +@@ -381,6 +576,11 @@ static struct phy_driver xway_gphy[] = { + .config_intr = xway_gphy_config_intr, + .suspend = genphy_suspend, + .resume = genphy_resume, ++ .led_brightness_set = xway_gphy_led_brightness_set, ++ .led_hw_is_supported = xway_gphy_led_hw_is_supported, ++ .led_hw_control_get = xway_gphy_led_hw_control_get, ++ .led_hw_control_set = xway_gphy_led_hw_control_set, ++ .led_polarity_set = xway_gphy_led_polarity_set, + }, { + .phy_id = PHY_ID_PHY22F_1_4, + .phy_id_mask = 0xffffffff, +@@ -392,6 +592,11 @@ static struct phy_driver xway_gphy[] = { + .config_intr = xway_gphy_config_intr, + .suspend = genphy_suspend, + .resume = genphy_resume, ++ .led_brightness_set = xway_gphy_led_brightness_set, ++ .led_hw_is_supported = xway_gphy_led_hw_is_supported, ++ .led_hw_control_get = xway_gphy_led_hw_control_get, ++ .led_hw_control_set = xway_gphy_led_hw_control_set, ++ .led_polarity_set = xway_gphy_led_polarity_set, + }, { + .phy_id = PHY_ID_PHY11G_1_5, + .phy_id_mask = 0xffffffff, +@@ -402,6 +607,11 @@ static struct phy_driver xway_gphy[] = { + .config_intr = xway_gphy_config_intr, + .suspend = genphy_suspend, + .resume = genphy_resume, ++ .led_brightness_set = xway_gphy_led_brightness_set, ++ .led_hw_is_supported = xway_gphy_led_hw_is_supported, ++ .led_hw_control_get = xway_gphy_led_hw_control_get, ++ .led_hw_control_set = xway_gphy_led_hw_control_set, ++ .led_polarity_set = xway_gphy_led_polarity_set, + }, { + .phy_id = PHY_ID_PHY22F_1_5, + .phy_id_mask = 0xffffffff, +@@ -412,6 +622,11 @@ static struct phy_driver xway_gphy[] = { + .config_intr = xway_gphy_config_intr, + .suspend = genphy_suspend, + .resume = genphy_resume, ++ .led_brightness_set = xway_gphy_led_brightness_set, ++ .led_hw_is_supported = xway_gphy_led_hw_is_supported, ++ .led_hw_control_get = xway_gphy_led_hw_control_get, ++ .led_hw_control_set = xway_gphy_led_hw_control_set, ++ .led_polarity_set = xway_gphy_led_polarity_set, + }, { + .phy_id = PHY_ID_PHY11G_VR9_1_1, + .phy_id_mask = 0xffffffff, +@@ -422,6 +637,11 @@ static struct phy_driver xway_gphy[] = { + .config_intr = xway_gphy_config_intr, + .suspend = genphy_suspend, + .resume = genphy_resume, ++ .led_brightness_set = xway_gphy_led_brightness_set, ++ .led_hw_is_supported = xway_gphy_led_hw_is_supported, ++ .led_hw_control_get = xway_gphy_led_hw_control_get, ++ .led_hw_control_set = xway_gphy_led_hw_control_set, ++ .led_polarity_set = xway_gphy_led_polarity_set, + }, { + .phy_id = PHY_ID_PHY22F_VR9_1_1, + .phy_id_mask = 0xffffffff, +@@ -432,6 +652,11 @@ static struct phy_driver xway_gphy[] = { + .config_intr = xway_gphy_config_intr, + .suspend = genphy_suspend, + .resume = genphy_resume, ++ .led_brightness_set = xway_gphy_led_brightness_set, ++ .led_hw_is_supported = xway_gphy_led_hw_is_supported, ++ .led_hw_control_get = xway_gphy_led_hw_control_get, ++ .led_hw_control_set = xway_gphy_led_hw_control_set, ++ .led_polarity_set = xway_gphy_led_polarity_set, + }, { + .phy_id = PHY_ID_PHY11G_VR9_1_2, + .phy_id_mask = 0xffffffff, +@@ -442,6 +667,11 @@ static struct phy_driver xway_gphy[] = { + .config_intr = xway_gphy_config_intr, + .suspend = genphy_suspend, + .resume = genphy_resume, ++ .led_brightness_set = xway_gphy_led_brightness_set, ++ .led_hw_is_supported = xway_gphy_led_hw_is_supported, ++ .led_hw_control_get = xway_gphy_led_hw_control_get, ++ .led_hw_control_set = xway_gphy_led_hw_control_set, ++ .led_polarity_set = xway_gphy_led_polarity_set, + }, { + .phy_id = PHY_ID_PHY22F_VR9_1_2, + .phy_id_mask = 0xffffffff, +@@ -452,6 +682,11 @@ static struct phy_driver xway_gphy[] = { + .config_intr = xway_gphy_config_intr, + .suspend = genphy_suspend, + .resume = genphy_resume, ++ .led_brightness_set = xway_gphy_led_brightness_set, ++ .led_hw_is_supported = xway_gphy_led_hw_is_supported, ++ .led_hw_control_get = xway_gphy_led_hw_control_get, ++ .led_hw_control_set = xway_gphy_led_hw_control_set, ++ .led_polarity_set = xway_gphy_led_polarity_set, + }, + }; + module_phy_driver(xway_gphy); diff --git a/target/linux/generic/backport-6.6/851-v6.8-bus-mhi-host-pci_generic-Add-SDX75-based-modem-suppo.patch b/target/linux/generic/backport-6.6/851-v6.8-bus-mhi-host-pci_generic-Add-SDX75-based-modem-suppo.patch index d0f7df5007e..6a09e619749 100644 --- a/target/linux/generic/backport-6.6/851-v6.8-bus-mhi-host-pci_generic-Add-SDX75-based-modem-suppo.patch +++ b/target/linux/generic/backport-6.6/851-v6.8-bus-mhi-host-pci_generic-Add-SDX75-based-modem-suppo.patch @@ -51,8 +51,8 @@ Signed-off-by: Manivannan Sadhasivam static const struct mhi_pci_dev_info mhi_qcom_sdx65_info = { .name = "qcom-sdx65m", .fw = "qcom/sdx65m/xbl.elf", -@@ -600,6 +620,8 @@ static const struct pci_device_id mhi_pc - .driver_data = (kernel_ulong_t) &mhi_telit_fn990_info }, +@@ -609,6 +629,8 @@ static const struct pci_device_id mhi_pc + .driver_data = (kernel_ulong_t) &mhi_telit_fe990a_info }, { PCI_DEVICE(PCI_VENDOR_ID_QCOM, 0x0308), .driver_data = (kernel_ulong_t) &mhi_qcom_sdx65_info }, + { PCI_DEVICE(PCI_VENDOR_ID_QCOM, 0x0309), diff --git a/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch b/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch index 31beb11d54c..52d6ff1e445 100644 --- a/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch +++ b/target/linux/generic/backport-6.6/900-v6.11-net-free_netdev-exit-earlier-if-dummy.patch @@ -23,7 +23,7 @@ Signed-off-by: David S. Miller --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -10966,7 +10966,8 @@ void free_netdev(struct net_device *dev) +@@ -10972,7 +10972,8 @@ void free_netdev(struct net_device *dev) dev->xdp_bulkq = NULL; /* Compatibility with error handling in drivers */ diff --git a/target/linux/generic/backport-6.6/901-v6.13-net-dsa-mv88e6xxx-Support-LED-control.patch b/target/linux/generic/backport-6.6/901-v6.13-net-dsa-mv88e6xxx-Support-LED-control.patch new file mode 100644 index 00000000000..8557fe2510b --- /dev/null +++ b/target/linux/generic/backport-6.6/901-v6.13-net-dsa-mv88e6xxx-Support-LED-control.patch @@ -0,0 +1,1250 @@ +From 7b590490e3aa6bfa38bf6e2069a529017fd3c1d2 Mon Sep 17 00:00:00 2001 +From: Linus Walleij +Date: Fri, 13 Oct 2023 00:08:35 +0200 +Subject: [PATCH] net: dsa: mv88e6xxx: Support LED control + +This adds control over the hardware LEDs in the Marvell +MV88E6xxx DSA switch and enables it for MV88E6352. + +This fixes an imminent problem on the Inteno XG6846 which +has a WAN LED that simply do not work with hardware +defaults: driver amendment is necessary. + +The patch is modeled after Christian Marangis LED support +code for the QCA8k DSA switch, I got help with the register +definitions from Tim Harvey. + +After this patch it is possible to activate hardware link +indication like this (or with a similar script): + + cd /sys/class/leds/Marvell\ 88E6352:05:00:green:wan/ + echo netdev > trigger + echo 1 > link + +This makes the green link indicator come up on any link +speed. It is also possible to be more elaborate, like this: + + cd /sys/class/leds/Marvell\ 88E6352:05:00:green:wan/ + echo netdev > trigger + echo 1 > link_1000 + cd /sys/class/leds/Marvell\ 88E6352:05:01:amber:wan/ + echo netdev > trigger + echo 1 > link_100 + +Making the green LED come on for a gigabit link and the +amber LED come on for a 100 mbit link. + +Each port has 2 LED slots (the hardware may use just one or +none) and the hardware triggers are specified in four bits per +LED, and some of the hardware triggers are only available on the +SFP (fiber) uplink. The restrictions are described in the +port.h header file where the registers are described. For +example, selector 1 set for LED 1 on port 5 or 6 will indicate +Fiber 1000 (gigabit) and activity with a blinking LED, but +ONLY for an SFP connection. If port 5/6 is used with something +not SFP, this selector is a noop: something else need to be +selected. + +After the previous series rewriting the MV88E6xxx DT +bindings to use YAML a "leds" subnode is already valid +for each port, in my scratch device tree it looks like +this: + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + default-state = "off"; + linux,default-trigger = "netdev"; + }; + led@1 { + reg = <1>; + color = ; + function = LED_FUNCTION_LAN; + default-state = "off"; + }; + }; + +This DT config is not yet configuring everything: when the netdev +default trigger is assigned the hw acceleration callbacks are +not called, and there is no way to set the netdev sub-trigger +type (such as link_1000) from the device tree, such as if you want +a gigabit link indicator. This has to be done from userspace at +this point. + +We add LED operations to all switches in the 6352 family: +6172, 6176, 6240 and 6352. + +Signed-off-by: Linus Walleij +--- + drivers/net/dsa/mv88e6xxx/Kconfig | 10 + + drivers/net/dsa/mv88e6xxx/Makefile | 1 + + drivers/net/dsa/mv88e6xxx/chip.c | 38 +- + drivers/net/dsa/mv88e6xxx/chip.h | 11 + + drivers/net/dsa/mv88e6xxx/leds.c | 839 +++++++++++++++++++++++++++++ + drivers/net/dsa/mv88e6xxx/port.c | 1 + + drivers/net/dsa/mv88e6xxx/port.h | 133 +++++ + 7 files changed, 1031 insertions(+), 2 deletions(-) + create mode 100644 drivers/net/dsa/mv88e6xxx/leds.c + +--- a/drivers/net/dsa/mv88e6xxx/Kconfig ++++ b/drivers/net/dsa/mv88e6xxx/Kconfig +@@ -17,3 +17,13 @@ config NET_DSA_MV88E6XXX_PTP + help + Say Y to enable PTP hardware timestamping on Marvell 88E6xxx switch + chips that support it. ++ ++config NET_DSA_MV88E6XXX_LEDS ++ bool "LED support for Marvell 88E6xxx" ++ default y ++ depends on NET_DSA_MV88E6XXX ++ depends on LEDS_CLASS=y || LEDS_CLASS=NET_DSA_MV88E6XXX ++ depends on LEDS_TRIGGERS ++ help ++ This enabled support for controlling the LEDs attached to the ++ Marvell 88E6xxx switch chips. +--- a/drivers/net/dsa/mv88e6xxx/Makefile ++++ b/drivers/net/dsa/mv88e6xxx/Makefile +@@ -9,6 +9,7 @@ mv88e6xxx-objs += global2.o + mv88e6xxx-objs += global2_avb.o + mv88e6xxx-objs += global2_scratch.o + mv88e6xxx-$(CONFIG_NET_DSA_MV88E6XXX_PTP) += hwtstamp.o ++mv88e6xxx-$(CONFIG_NET_DSA_MV88E6XXX_LEDS) += leds.o + mv88e6xxx-objs += pcs-6185.o + mv88e6xxx-objs += pcs-6352.o + mv88e6xxx-objs += pcs-639x.o +--- a/drivers/net/dsa/mv88e6xxx/chip.c ++++ b/drivers/net/dsa/mv88e6xxx/chip.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -3235,14 +3236,43 @@ static int mv88e6xxx_setup_upstream_port + static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port) + { + struct device_node *phy_handle = NULL; ++ struct fwnode_handle *ports_fwnode; ++ struct fwnode_handle *port_fwnode; + struct dsa_switch *ds = chip->ds; ++ struct mv88e6xxx_port *p; + struct dsa_port *dp; + int tx_amp; + int err; + u16 reg; ++ u32 val; + +- chip->ports[port].chip = chip; +- chip->ports[port].port = port; ++ p = &chip->ports[port]; ++ p->chip = chip; ++ p->port = port; ++ ++ /* Look up corresponding fwnode if any */ ++ ports_fwnode = device_get_named_child_node(chip->dev, "ethernet-ports"); ++ if (!ports_fwnode) ++ ports_fwnode = device_get_named_child_node(chip->dev, "ports"); ++ if (ports_fwnode) { ++ fwnode_for_each_child_node(ports_fwnode, port_fwnode) { ++ if (fwnode_property_read_u32(port_fwnode, "reg", &val)) ++ continue; ++ if (val == port) { ++ p->fwnode = port_fwnode; ++ p->fiber = fwnode_property_present(port_fwnode, "sfp"); ++ break; ++ } ++ } ++ } else { ++ dev_dbg(chip->dev, "no ethernet ports node defined for the device\n"); ++ } ++ ++ if (chip->info->ops->port_setup_leds) { ++ err = chip->info->ops->port_setup_leds(chip, port); ++ if (err && err != -EOPNOTSUPP) ++ return err; ++ } + + err = mv88e6xxx_port_setup_mac(chip, port, LINK_UNFORCED, + SPEED_UNFORCED, DUPLEX_UNFORCED, +@@ -4461,6 +4491,7 @@ static const struct mv88e6xxx_ops mv88e6 + .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, + .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, + .port_get_cmode = mv88e6352_port_get_cmode, ++ .port_setup_leds = mv88e6xxx_port_setup_leds, + .port_setup_message_port = mv88e6xxx_setup_message_port, + .stats_snapshot = mv88e6320_g1_stats_snapshot, + .stats_set_histogram = mv88e6095_g1_stats_set_histogram, +@@ -4563,6 +4594,7 @@ static const struct mv88e6xxx_ops mv88e6 + .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, + .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, + .port_get_cmode = mv88e6352_port_get_cmode, ++ .port_setup_leds = mv88e6xxx_port_setup_leds, + .port_setup_message_port = mv88e6xxx_setup_message_port, + .stats_snapshot = mv88e6320_g1_stats_snapshot, + .stats_set_histogram = mv88e6095_g1_stats_set_histogram, +@@ -4838,6 +4870,7 @@ static const struct mv88e6xxx_ops mv88e6 + .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, + .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, + .port_get_cmode = mv88e6352_port_get_cmode, ++ .port_setup_leds = mv88e6xxx_port_setup_leds, + .port_setup_message_port = mv88e6xxx_setup_message_port, + .stats_snapshot = mv88e6320_g1_stats_snapshot, + .stats_set_histogram = mv88e6095_g1_stats_set_histogram, +@@ -5260,6 +5293,7 @@ static const struct mv88e6xxx_ops mv88e6 + .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, + .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, + .port_get_cmode = mv88e6352_port_get_cmode, ++ .port_setup_leds = mv88e6xxx_port_setup_leds, + .port_setup_message_port = mv88e6xxx_setup_message_port, + .stats_snapshot = mv88e6320_g1_stats_snapshot, + .stats_set_histogram = mv88e6095_g1_stats_set_histogram, +--- a/drivers/net/dsa/mv88e6xxx/chip.h ++++ b/drivers/net/dsa/mv88e6xxx/chip.h +@@ -13,7 +13,9 @@ + #include + #include + #include ++#include + #include ++#include + #include + #include + #include +@@ -275,6 +277,7 @@ struct mv88e6xxx_vlan { + struct mv88e6xxx_port { + struct mv88e6xxx_chip *chip; + int port; ++ struct fwnode_handle *fwnode; + struct mv88e6xxx_vlan bridge_pvid; + u64 serdes_stats[2]; + u64 atu_member_violation; +@@ -289,6 +292,11 @@ struct mv88e6xxx_port { + struct devlink_region *region; + void *pcs_private; + ++ /* LED related information */ ++ bool fiber; ++ struct led_classdev led0; ++ struct led_classdev led1; ++ + /* MacAuth Bypass control flag */ + bool mab; + }; +@@ -561,6 +569,9 @@ struct mv88e6xxx_ops { + phy_interface_t mode); + int (*port_get_cmode)(struct mv88e6xxx_chip *chip, int port, u8 *cmode); + ++ /* LED control */ ++ int (*port_setup_leds)(struct mv88e6xxx_chip *chip, int port); ++ + /* Some devices have a per port register indicating what is + * the upstream port this port should forward to. + */ +--- /dev/null ++++ b/drivers/net/dsa/mv88e6xxx/leds.c +@@ -0,0 +1,839 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later ++#include ++#include ++#include ++ ++#include "chip.h" ++#include "global2.h" ++#include "port.h" ++ ++/* Offset 0x16: LED control */ ++ ++static int mv88e6xxx_port_led_write(struct mv88e6xxx_chip *chip, int port, u16 reg) ++{ ++ reg |= MV88E6XXX_PORT_LED_CONTROL_UPDATE; ++ ++ return mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_LED_CONTROL, reg); ++} ++ ++static int mv88e6xxx_port_led_read(struct mv88e6xxx_chip *chip, int port, ++ u16 ptr, u16 *val) ++{ ++ int err; ++ ++ err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_LED_CONTROL, ptr); ++ if (err) ++ return err; ++ ++ err = mv88e6xxx_port_read(chip, port, MV88E6XXX_PORT_LED_CONTROL, val); ++ *val &= 0x3ff; ++ ++ return err; ++} ++ ++static int mv88e6xxx_led_brightness_set(struct mv88e6xxx_port *p, int led, ++ int brightness) ++{ ++ u16 reg; ++ int err; ++ ++ err = mv88e6xxx_port_led_read(p->chip, p->port, ++ MV88E6XXX_PORT_LED_CONTROL_POINTER_LED01_CTRL, ++ ®); ++ if (err) ++ return err; ++ ++ if (led == 1) ++ reg &= ~MV88E6XXX_PORT_LED_CONTROL_LED1_SEL_MASK; ++ else ++ reg &= ~MV88E6XXX_PORT_LED_CONTROL_LED0_SEL_MASK; ++ ++ if (brightness) { ++ /* Selector 0x0f == Force LED ON */ ++ if (led == 1) ++ reg |= MV88E6XXX_PORT_LED_CONTROL_LED1_SELF; ++ else ++ reg |= MV88E6XXX_PORT_LED_CONTROL_LED0_SELF; ++ } else { ++ /* Selector 0x0e == Force LED OFF */ ++ if (led == 1) ++ reg |= MV88E6XXX_PORT_LED_CONTROL_LED1_SELE; ++ else ++ reg |= MV88E6XXX_PORT_LED_CONTROL_LED0_SELE; ++ } ++ ++ reg |= MV88E6XXX_PORT_LED_CONTROL_POINTER_LED01_CTRL; ++ ++ return mv88e6xxx_port_led_write(p->chip, p->port, reg); ++} ++ ++static int mv88e6xxx_led0_brightness_set_blocking(struct led_classdev *ldev, ++ enum led_brightness brightness) ++{ ++ struct mv88e6xxx_port *p = container_of(ldev, struct mv88e6xxx_port, led0); ++ int err; ++ ++ mv88e6xxx_reg_lock(p->chip); ++ err = mv88e6xxx_led_brightness_set(p, 0, brightness); ++ mv88e6xxx_reg_unlock(p->chip); ++ ++ return err; ++} ++ ++static int mv88e6xxx_led1_brightness_set_blocking(struct led_classdev *ldev, ++ enum led_brightness brightness) ++{ ++ struct mv88e6xxx_port *p = container_of(ldev, struct mv88e6xxx_port, led1); ++ int err; ++ ++ mv88e6xxx_reg_lock(p->chip); ++ err = mv88e6xxx_led_brightness_set(p, 1, brightness); ++ mv88e6xxx_reg_unlock(p->chip); ++ ++ return err; ++} ++ ++struct mv88e6xxx_led_hwconfig { ++ int led; ++ u8 portmask; ++ unsigned long rules; ++ bool fiber; ++ bool blink_activity; ++ u16 selector; ++}; ++ ++/* The following is a lookup table to check what rules we can support on a ++ * certain LED given restrictions such as that some rules only work with fiber ++ * (SFP) connections and some blink on activity by default. ++ */ ++#define MV88E6XXX_PORTS_0_3 (BIT(0) | BIT(1) | BIT(2) | BIT(3)) ++#define MV88E6XXX_PORTS_4_5 (BIT(4) | BIT(5)) ++#define MV88E6XXX_PORT_4 BIT(4) ++#define MV88E6XXX_PORT_5 BIT(5) ++ ++/* Entries are listed in selector order. ++ * ++ * These configurations vary across different switch families, list ++ * different tables per-family here. ++ */ ++static const struct mv88e6xxx_led_hwconfig mv88e6352_led_hwconfigs[] = { ++ { ++ .led = 0, ++ .portmask = MV88E6XXX_PORT_4, ++ .rules = BIT(TRIGGER_NETDEV_LINK), ++ .blink_activity = true, ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED0_SEL0, ++ }, ++ { ++ .led = 1, ++ .portmask = MV88E6XXX_PORT_5, ++ .rules = BIT(TRIGGER_NETDEV_LINK_1000), ++ .blink_activity = true, ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED1_SEL0, ++ }, ++ { ++ .led = 0, ++ .portmask = MV88E6XXX_PORTS_0_3, ++ .rules = BIT(TRIGGER_NETDEV_LINK_100) | BIT(TRIGGER_NETDEV_LINK_1000), ++ .blink_activity = true, ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED0_SEL1, ++ }, ++ { ++ .led = 1, ++ .portmask = MV88E6XXX_PORTS_0_3, ++ .rules = BIT(TRIGGER_NETDEV_LINK_10) | BIT(TRIGGER_NETDEV_LINK_100), ++ .blink_activity = true, ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED1_SEL1, ++ }, ++ { ++ .led = 0, ++ .portmask = MV88E6XXX_PORTS_4_5, ++ .rules = BIT(TRIGGER_NETDEV_LINK_100), ++ .blink_activity = true, ++ .fiber = true, ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED0_SEL1, ++ }, ++ { ++ .led = 1, ++ .portmask = MV88E6XXX_PORTS_4_5, ++ .rules = BIT(TRIGGER_NETDEV_LINK_1000), ++ .blink_activity = true, ++ .fiber = true, ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED1_SEL1, ++ }, ++ { ++ .led = 0, ++ .portmask = MV88E6XXX_PORTS_0_3, ++ .rules = BIT(TRIGGER_NETDEV_LINK_1000), ++ .blink_activity = true, ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED0_SEL2, ++ }, ++ { ++ .led = 1, ++ .portmask = MV88E6XXX_PORTS_0_3, ++ .rules = BIT(TRIGGER_NETDEV_LINK_10) | BIT(TRIGGER_NETDEV_LINK_100), ++ .blink_activity = true, ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED1_SEL2, ++ }, ++ { ++ .led = 0, ++ .portmask = MV88E6XXX_PORTS_4_5, ++ .rules = BIT(TRIGGER_NETDEV_LINK_1000), ++ .blink_activity = true, ++ .fiber = true, ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED0_SEL2, ++ }, ++ { ++ .led = 1, ++ .portmask = MV88E6XXX_PORTS_4_5, ++ .rules = BIT(TRIGGER_NETDEV_LINK_100), ++ .blink_activity = true, ++ .fiber = true, ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED1_SEL2, ++ }, ++ { ++ .led = 0, ++ .portmask = MV88E6XXX_PORTS_0_3, ++ .rules = BIT(TRIGGER_NETDEV_LINK), ++ .blink_activity = true, ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED0_SEL3, ++ }, ++ { ++ .led = 1, ++ .portmask = MV88E6XXX_PORTS_0_3, ++ .rules = BIT(TRIGGER_NETDEV_LINK_1000), ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED1_SEL3, ++ }, ++ { ++ .led = 1, ++ .portmask = MV88E6XXX_PORTS_4_5, ++ .rules = BIT(TRIGGER_NETDEV_LINK), ++ .fiber = true, ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED1_SEL3, ++ }, ++ { ++ .led = 1, ++ .portmask = MV88E6XXX_PORT_4, ++ .rules = BIT(TRIGGER_NETDEV_LINK), ++ .blink_activity = true, ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED1_SEL4, ++ }, ++ { ++ .led = 1, ++ .portmask = MV88E6XXX_PORT_5, ++ .rules = BIT(TRIGGER_NETDEV_LINK), ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED1_SEL5, ++ }, ++ { ++ .led = 0, ++ .portmask = MV88E6XXX_PORTS_0_3, ++ .rules = BIT(TRIGGER_NETDEV_FULL_DUPLEX), ++ .blink_activity = true, ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED0_SEL6, ++ }, ++ { ++ .led = 1, ++ .portmask = MV88E6XXX_PORTS_0_3, ++ .rules = BIT(TRIGGER_NETDEV_LINK_10) | BIT(TRIGGER_NETDEV_LINK_1000), ++ .blink_activity = true, ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED1_SEL6, ++ }, ++ { ++ .led = 0, ++ .portmask = MV88E6XXX_PORT_4, ++ .rules = BIT(TRIGGER_NETDEV_FULL_DUPLEX), ++ .blink_activity = true, ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED0_SEL6, ++ }, ++ { ++ .led = 1, ++ .portmask = MV88E6XXX_PORT_5, ++ .rules = BIT(TRIGGER_NETDEV_FULL_DUPLEX), ++ .blink_activity = true, ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED1_SEL6, ++ }, ++ { ++ .led = 0, ++ .portmask = MV88E6XXX_PORTS_0_3, ++ .rules = BIT(TRIGGER_NETDEV_LINK_10) | BIT(TRIGGER_NETDEV_LINK_1000), ++ .blink_activity = true, ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED0_SEL7, ++ }, ++ { ++ .led = 1, ++ .portmask = MV88E6XXX_PORTS_0_3, ++ .rules = BIT(TRIGGER_NETDEV_LINK_10) | BIT(TRIGGER_NETDEV_LINK_1000), ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED1_SEL7, ++ }, ++ { ++ .led = 0, ++ .portmask = MV88E6XXX_PORTS_0_3, ++ .rules = BIT(TRIGGER_NETDEV_LINK), ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED0_SEL8, ++ }, ++ { ++ .led = 1, ++ .portmask = MV88E6XXX_PORTS_0_3, ++ .rules = BIT(TRIGGER_NETDEV_LINK), ++ .blink_activity = true, ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED1_SEL8, ++ }, ++ { ++ .led = 0, ++ .portmask = MV88E6XXX_PORT_5, ++ .rules = BIT(TRIGGER_NETDEV_LINK), ++ .blink_activity = true, ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED0_SEL8, ++ }, ++ { ++ .led = 0, ++ .portmask = MV88E6XXX_PORTS_0_3, ++ .rules = BIT(TRIGGER_NETDEV_LINK_10), ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED0_SEL9, ++ }, ++ { ++ .led = 1, ++ .portmask = MV88E6XXX_PORTS_0_3, ++ .rules = BIT(TRIGGER_NETDEV_LINK_100), ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED1_SEL9, ++ }, ++ { ++ .led = 0, ++ .portmask = MV88E6XXX_PORTS_0_3, ++ .rules = BIT(TRIGGER_NETDEV_LINK_10), ++ .blink_activity = true, ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED0_SELA, ++ }, ++ { ++ .led = 1, ++ .portmask = MV88E6XXX_PORTS_0_3, ++ .rules = BIT(TRIGGER_NETDEV_LINK_100), ++ .blink_activity = true, ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED1_SELA, ++ }, ++ { ++ .led = 0, ++ .portmask = MV88E6XXX_PORTS_0_3, ++ .rules = BIT(TRIGGER_NETDEV_LINK_100) | BIT(TRIGGER_NETDEV_LINK_1000), ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED0_SELB, ++ }, ++ { ++ .led = 1, ++ .portmask = MV88E6XXX_PORTS_0_3, ++ .rules = BIT(TRIGGER_NETDEV_LINK_100) | BIT(TRIGGER_NETDEV_LINK_1000), ++ .blink_activity = true, ++ .selector = MV88E6XXX_PORT_LED_CONTROL_LED1_SELB, ++ }, ++}; ++ ++/* mv88e6xxx_led_match_selector() - look up the appropriate LED mode selector ++ * @p: port state container ++ * @led: LED number, 0 or 1 ++ * @blink_activity: blink the LED (usually blink on indicated activity) ++ * @fiber: the link is connected to fiber such as SFP ++ * @rules: LED status flags from the LED classdev core ++ * @selector: fill in the selector in this parameter with an OR operation ++ */ ++static int mv88e6xxx_led_match_selector(struct mv88e6xxx_port *p, int led, bool blink_activity, ++ bool fiber, unsigned long rules, u16 *selector) ++{ ++ const struct mv88e6xxx_led_hwconfig *conf; ++ int i; ++ ++ /* No rules means we turn the LED off */ ++ if (!rules) { ++ if (led == 1) ++ *selector |= MV88E6XXX_PORT_LED_CONTROL_LED1_SELE; ++ else ++ *selector |= MV88E6XXX_PORT_LED_CONTROL_LED0_SELE; ++ return 0; ++ } ++ ++ /* TODO: these rules are for MV88E6352, when adding other families, ++ * think about making sure you select the table that match the ++ * specific switch family. ++ */ ++ for (i = 0; i < ARRAY_SIZE(mv88e6352_led_hwconfigs); i++) { ++ conf = &mv88e6352_led_hwconfigs[i]; ++ ++ if (conf->led != led) ++ continue; ++ ++ if (!(conf->portmask & BIT(p->port))) ++ continue; ++ ++ if (conf->blink_activity != blink_activity) ++ continue; ++ ++ if (conf->fiber != fiber) ++ continue; ++ ++ if (conf->rules == rules) { ++ dev_dbg(p->chip->dev, "port%d LED %d set selector %04x for rules %08lx\n", ++ p->port, led, conf->selector, rules); ++ *selector |= conf->selector; ++ return 0; ++ } ++ } ++ ++ return -EOPNOTSUPP; ++} ++ ++/* mv88e6xxx_led_match_selector() - find Linux netdev rules from a selector value ++ * @p: port state container ++ * @selector: the selector value from the LED actity register ++ * @led: LED number, 0 or 1 ++ * @rules: Linux netdev activity rules found from selector ++ */ ++static int ++mv88e6xxx_led_match_rule(struct mv88e6xxx_port *p, u16 selector, int led, unsigned long *rules) ++{ ++ const struct mv88e6xxx_led_hwconfig *conf; ++ int i; ++ ++ /* Find the selector in the table, we just look for the right selector ++ * and ignore if the activity has special properties such as blinking ++ * or is fiber-only. ++ */ ++ for (i = 0; i < ARRAY_SIZE(mv88e6352_led_hwconfigs); i++) { ++ conf = &mv88e6352_led_hwconfigs[i]; ++ ++ if (conf->led != led) ++ continue; ++ ++ if (!(conf->portmask & BIT(p->port))) ++ continue; ++ ++ if (conf->selector == selector) { ++ dev_dbg(p->chip->dev, "port%d LED %d has selector %04x, rules %08lx\n", ++ p->port, led, selector, conf->rules); ++ *rules = conf->rules; ++ return 0; ++ } ++ } ++ ++ return -EINVAL; ++} ++ ++/* mv88e6xxx_led_get_selector() - get the appropriate LED mode selector ++ * @p: port state container ++ * @led: LED number, 0 or 1 ++ * @fiber: the link is connected to fiber such as SFP ++ * @rules: LED status flags from the LED classdev core ++ * @selector: fill in the selector in this parameter with an OR operation ++ */ ++static int mv88e6xxx_led_get_selector(struct mv88e6xxx_port *p, int led, ++ bool fiber, unsigned long rules, u16 *selector) ++{ ++ int err; ++ ++ /* What happens here is that we first try to locate a trigger with solid ++ * indicator (such as LED is on for a 1000 link) else we try a second ++ * sweep to find something suitable with a trigger that will blink on ++ * activity. ++ */ ++ err = mv88e6xxx_led_match_selector(p, led, false, fiber, rules, selector); ++ if (err) ++ return mv88e6xxx_led_match_selector(p, led, true, fiber, rules, selector); ++ ++ return 0; ++} ++ ++/* Sets up the hardware blinking period */ ++static int mv88e6xxx_led_set_blinking_period(struct mv88e6xxx_port *p, int led, ++ unsigned long delay_on, unsigned long delay_off) ++{ ++ unsigned long period; ++ u16 reg; ++ ++ period = delay_on + delay_off; ++ ++ reg = 0; ++ ++ switch (period) { ++ case 21: ++ reg |= MV88E6XXX_PORT_LED_CONTROL_0x06_BLINK_RATE_21MS; ++ break; ++ case 42: ++ reg |= MV88E6XXX_PORT_LED_CONTROL_0x06_BLINK_RATE_42MS; ++ break; ++ case 84: ++ reg |= MV88E6XXX_PORT_LED_CONTROL_0x06_BLINK_RATE_84MS; ++ break; ++ case 168: ++ reg |= MV88E6XXX_PORT_LED_CONTROL_0x06_BLINK_RATE_168MS; ++ break; ++ case 336: ++ reg |= MV88E6XXX_PORT_LED_CONTROL_0x06_BLINK_RATE_336MS; ++ break; ++ case 672: ++ reg |= MV88E6XXX_PORT_LED_CONTROL_0x06_BLINK_RATE_672MS; ++ break; ++ default: ++ /* Fall back to software blinking */ ++ return -EINVAL; ++ } ++ ++ /* This is essentially PWM duty cycle: how long time of the period ++ * will the LED be on. Zero isn't great in most cases. ++ */ ++ switch (delay_on) { ++ case 0: ++ /* This is usually pretty useless and will make the LED look OFF */ ++ reg |= MV88E6XXX_PORT_LED_CONTROL_0x06_PULSE_STRETCH_NONE; ++ break; ++ case 21: ++ reg |= MV88E6XXX_PORT_LED_CONTROL_0x06_PULSE_STRETCH_21MS; ++ break; ++ case 42: ++ reg |= MV88E6XXX_PORT_LED_CONTROL_0x06_PULSE_STRETCH_42MS; ++ break; ++ case 84: ++ reg |= MV88E6XXX_PORT_LED_CONTROL_0x06_PULSE_STRETCH_84MS; ++ break; ++ case 168: ++ reg |= MV88E6XXX_PORT_LED_CONTROL_0x06_PULSE_STRETCH_168MS; ++ break; ++ default: ++ /* Just use something non-zero */ ++ reg |= MV88E6XXX_PORT_LED_CONTROL_0x06_PULSE_STRETCH_21MS; ++ break; ++ } ++ ++ /* Set up blink rate */ ++ reg |= MV88E6XXX_PORT_LED_CONTROL_POINTER_STRETCH_BLINK; ++ ++ return mv88e6xxx_port_led_write(p->chip, p->port, reg); ++} ++ ++static int mv88e6xxx_led_blink_set(struct mv88e6xxx_port *p, int led, ++ unsigned long *delay_on, unsigned long *delay_off) ++{ ++ u16 reg; ++ int err; ++ ++ /* Choose a sensible default 336 ms (~3 Hz) */ ++ if ((*delay_on == 0) && (*delay_off == 0)) { ++ *delay_on = 168; ++ *delay_off = 168; ++ } ++ ++ /* No off delay is just on */ ++ if (*delay_off == 0) ++ return mv88e6xxx_led_brightness_set(p, led, 1); ++ ++ err = mv88e6xxx_led_set_blinking_period(p, led, *delay_on, *delay_off); ++ if (err) ++ return err; ++ ++ err = mv88e6xxx_port_led_read(p->chip, p->port, ++ MV88E6XXX_PORT_LED_CONTROL_POINTER_LED01_CTRL, ++ ®); ++ if (err) ++ return err; ++ ++ if (led == 1) ++ reg &= ~MV88E6XXX_PORT_LED_CONTROL_LED1_SEL_MASK; ++ else ++ reg &= ~MV88E6XXX_PORT_LED_CONTROL_LED0_SEL_MASK; ++ ++ /* This will select the forced blinking status */ ++ if (led == 1) ++ reg |= MV88E6XXX_PORT_LED_CONTROL_LED1_SELD; ++ else ++ reg |= MV88E6XXX_PORT_LED_CONTROL_LED0_SELD; ++ ++ reg |= MV88E6XXX_PORT_LED_CONTROL_POINTER_LED01_CTRL; ++ ++ return mv88e6xxx_port_led_write(p->chip, p->port, reg); ++} ++ ++static int mv88e6xxx_led0_blink_set(struct led_classdev *ldev, ++ unsigned long *delay_on, ++ unsigned long *delay_off) ++{ ++ struct mv88e6xxx_port *p = container_of(ldev, struct mv88e6xxx_port, led0); ++ int err; ++ ++ mv88e6xxx_reg_lock(p->chip); ++ err = mv88e6xxx_led_blink_set(p, 0, delay_on, delay_off); ++ mv88e6xxx_reg_unlock(p->chip); ++ ++ return err; ++} ++ ++static int mv88e6xxx_led1_blink_set(struct led_classdev *ldev, ++ unsigned long *delay_on, ++ unsigned long *delay_off) ++{ ++ struct mv88e6xxx_port *p = container_of(ldev, struct mv88e6xxx_port, led1); ++ int err; ++ ++ mv88e6xxx_reg_lock(p->chip); ++ err = mv88e6xxx_led_blink_set(p, 1, delay_on, delay_off); ++ mv88e6xxx_reg_unlock(p->chip); ++ ++ return err; ++} ++ ++static int ++mv88e6xxx_led0_hw_control_is_supported(struct led_classdev *ldev, unsigned long rules) ++{ ++ struct mv88e6xxx_port *p = container_of(ldev, struct mv88e6xxx_port, led0); ++ u16 selector = 0; ++ ++ return mv88e6xxx_led_get_selector(p, 0, p->fiber, rules, &selector); ++} ++ ++static int ++mv88e6xxx_led1_hw_control_is_supported(struct led_classdev *ldev, unsigned long rules) ++{ ++ struct mv88e6xxx_port *p = container_of(ldev, struct mv88e6xxx_port, led1); ++ u16 selector = 0; ++ ++ return mv88e6xxx_led_get_selector(p, 1, p->fiber, rules, &selector); ++} ++ ++static int mv88e6xxx_led_hw_control_set(struct mv88e6xxx_port *p, ++ int led, unsigned long rules) ++{ ++ u16 reg; ++ int err; ++ ++ err = mv88e6xxx_port_led_read(p->chip, p->port, ++ MV88E6XXX_PORT_LED_CONTROL_POINTER_LED01_CTRL, ++ ®); ++ if (err) ++ return err; ++ ++ if (led == 1) ++ reg &= ~MV88E6XXX_PORT_LED_CONTROL_LED1_SEL_MASK; ++ else ++ reg &= ~MV88E6XXX_PORT_LED_CONTROL_LED0_SEL_MASK; ++ ++ err = mv88e6xxx_led_get_selector(p, led, p->fiber, rules, ®); ++ if (err) ++ return err; ++ ++ reg |= MV88E6XXX_PORT_LED_CONTROL_POINTER_LED01_CTRL; ++ ++ if (led == 0) ++ dev_dbg(p->chip->dev, "LED 0 hw control on port %d trigger selector 0x%02x\n", ++ p->port, ++ (unsigned int)(reg & MV88E6XXX_PORT_LED_CONTROL_LED0_SEL_MASK)); ++ else ++ dev_dbg(p->chip->dev, "LED 1 hw control on port %d trigger selector 0x%02x\n", ++ p->port, ++ (unsigned int)(reg & MV88E6XXX_PORT_LED_CONTROL_LED1_SEL_MASK) >> 4); ++ ++ return mv88e6xxx_port_led_write(p->chip, p->port, reg); ++} ++ ++static int ++mv88e6xxx_led_hw_control_get(struct mv88e6xxx_port *p, int led, unsigned long *rules) ++{ ++ u16 val; ++ int err; ++ ++ mv88e6xxx_reg_lock(p->chip); ++ err = mv88e6xxx_port_led_read(p->chip, p->port, ++ MV88E6XXX_PORT_LED_CONTROL_POINTER_LED01_CTRL, &val); ++ mv88e6xxx_reg_unlock(p->chip); ++ if (err) ++ return err; ++ ++ /* Mask out the selector bits for this port */ ++ if (led == 1) { ++ val &= MV88E6XXX_PORT_LED_CONTROL_LED1_SEL_MASK; ++ /* It's forced blinking/OFF/ON */ ++ if (val == MV88E6XXX_PORT_LED_CONTROL_LED1_SELD || ++ val == MV88E6XXX_PORT_LED_CONTROL_LED1_SELE || ++ val == MV88E6XXX_PORT_LED_CONTROL_LED1_SELF) { ++ *rules = 0; ++ return 0; ++ } ++ } else { ++ val &= MV88E6XXX_PORT_LED_CONTROL_LED0_SEL_MASK; ++ /* It's forced blinking/OFF/ON */ ++ if (val == MV88E6XXX_PORT_LED_CONTROL_LED0_SELD || ++ val == MV88E6XXX_PORT_LED_CONTROL_LED0_SELE || ++ val == MV88E6XXX_PORT_LED_CONTROL_LED0_SELF) { ++ *rules = 0; ++ return 0; ++ } ++ } ++ ++ err = mv88e6xxx_led_match_rule(p, val, led, rules); ++ if (!err) ++ return 0; ++ ++ dev_dbg(p->chip->dev, "couldn't find matching selector for %04x\n", val); ++ *rules = 0; ++ return 0; ++} ++ ++static int ++mv88e6xxx_led0_hw_control_set(struct led_classdev *ldev, unsigned long rules) ++{ ++ struct mv88e6xxx_port *p = container_of(ldev, struct mv88e6xxx_port, led0); ++ int err; ++ ++ mv88e6xxx_reg_lock(p->chip); ++ err = mv88e6xxx_led_hw_control_set(p, 0, rules); ++ mv88e6xxx_reg_unlock(p->chip); ++ ++ return err; ++} ++ ++static int ++mv88e6xxx_led1_hw_control_set(struct led_classdev *ldev, unsigned long rules) ++{ ++ struct mv88e6xxx_port *p = container_of(ldev, struct mv88e6xxx_port, led1); ++ int err; ++ ++ mv88e6xxx_reg_lock(p->chip); ++ err = mv88e6xxx_led_hw_control_set(p, 1, rules); ++ mv88e6xxx_reg_unlock(p->chip); ++ ++ return err; ++} ++ ++static int ++mv88e6xxx_led0_hw_control_get(struct led_classdev *ldev, unsigned long *rules) ++{ ++ struct mv88e6xxx_port *p = container_of(ldev, struct mv88e6xxx_port, led0); ++ ++ return mv88e6xxx_led_hw_control_get(p, 0, rules); ++} ++ ++static int ++mv88e6xxx_led1_hw_control_get(struct led_classdev *ldev, unsigned long *rules) ++{ ++ struct mv88e6xxx_port *p = container_of(ldev, struct mv88e6xxx_port, led1); ++ ++ return mv88e6xxx_led_hw_control_get(p, 1, rules); ++} ++ ++static struct device *mv88e6xxx_led_hw_control_get_device(struct mv88e6xxx_port *p) ++{ ++ struct dsa_port *dp; ++ ++ dp = dsa_to_port(p->chip->ds, p->port); ++ if (!dp) ++ return NULL; ++ if (dp->slave) ++ return &dp->slave->dev; ++ return NULL; ++} ++ ++static struct device * ++mv88e6xxx_led0_hw_control_get_device(struct led_classdev *ldev) ++{ ++ struct mv88e6xxx_port *p = container_of(ldev, struct mv88e6xxx_port, led0); ++ ++ return mv88e6xxx_led_hw_control_get_device(p); ++} ++ ++static struct device * ++mv88e6xxx_led1_hw_control_get_device(struct led_classdev *ldev) ++{ ++ struct mv88e6xxx_port *p = container_of(ldev, struct mv88e6xxx_port, led1); ++ ++ return mv88e6xxx_led_hw_control_get_device(p); ++} ++ ++int mv88e6xxx_port_setup_leds(struct mv88e6xxx_chip *chip, int port) ++{ ++ struct fwnode_handle *led = NULL, *leds = NULL; ++ struct led_init_data init_data = { }; ++ enum led_default_state state; ++ struct mv88e6xxx_port *p; ++ struct led_classdev *l; ++ struct device *dev; ++ u32 led_num; ++ int ret; ++ ++ /* LEDs are on ports 1,2,3,4, 5 and 6 (index 0..5), no more */ ++ if (port > 5) ++ return -EOPNOTSUPP; ++ ++ p = &chip->ports[port]; ++ if (!p->fwnode) ++ return 0; ++ ++ dev = chip->dev; ++ ++ leds = fwnode_get_named_child_node(p->fwnode, "leds"); ++ if (!leds) { ++ dev_dbg(dev, "No Leds node specified in device tree for port %d!\n", ++ port); ++ return 0; ++ } ++ ++ fwnode_for_each_child_node(leds, led) { ++ /* Reg represent the led number of the port, max 2 ++ * LEDs can be connected to each port, in some designs ++ * only one LED is connected. ++ */ ++ if (fwnode_property_read_u32(led, "reg", &led_num)) ++ continue; ++ if (led_num > 1) { ++ dev_err(dev, "invalid LED specified port %d\n", port); ++ return -EINVAL; ++ } ++ ++ if (led_num == 0) ++ l = &p->led0; ++ else ++ l = &p->led1; ++ ++ state = led_init_default_state_get(led); ++ switch (state) { ++ case LEDS_DEFSTATE_ON: ++ l->brightness = 1; ++ mv88e6xxx_led_brightness_set(p, led_num, 1); ++ break; ++ case LEDS_DEFSTATE_KEEP: ++ break; ++ default: ++ l->brightness = 0; ++ mv88e6xxx_led_brightness_set(p, led_num, 0); ++ } ++ ++ l->max_brightness = 1; ++ if (led_num == 0) { ++ l->brightness_set_blocking = mv88e6xxx_led0_brightness_set_blocking; ++ l->blink_set = mv88e6xxx_led0_blink_set; ++ l->hw_control_is_supported = mv88e6xxx_led0_hw_control_is_supported; ++ l->hw_control_set = mv88e6xxx_led0_hw_control_set; ++ l->hw_control_get = mv88e6xxx_led0_hw_control_get; ++ l->hw_control_get_device = mv88e6xxx_led0_hw_control_get_device; ++ } else { ++ l->brightness_set_blocking = mv88e6xxx_led1_brightness_set_blocking; ++ l->blink_set = mv88e6xxx_led1_blink_set; ++ l->hw_control_is_supported = mv88e6xxx_led1_hw_control_is_supported; ++ l->hw_control_set = mv88e6xxx_led1_hw_control_set; ++ l->hw_control_get = mv88e6xxx_led1_hw_control_get; ++ l->hw_control_get_device = mv88e6xxx_led1_hw_control_get_device; ++ } ++ l->hw_control_trigger = "netdev"; ++ ++ init_data.default_label = ":port"; ++ init_data.fwnode = led; ++ init_data.devname_mandatory = true; ++ init_data.devicename = kasprintf(GFP_KERNEL, "%s:0%d:0%d", chip->info->name, ++ port, led_num); ++ if (!init_data.devicename) ++ return -ENOMEM; ++ ++ ret = devm_led_classdev_register_ext(dev, l, &init_data); ++ kfree(init_data.devicename); ++ ++ if (ret) { ++ dev_err(dev, "Failed to init LED %d for port %d", led_num, port); ++ return ret; ++ } ++ } ++ ++ return 0; ++} +--- a/drivers/net/dsa/mv88e6xxx/port.c ++++ b/drivers/net/dsa/mv88e6xxx/port.c +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + + #include "chip.h" + #include "global2.h" +--- a/drivers/net/dsa/mv88e6xxx/port.h ++++ b/drivers/net/dsa/mv88e6xxx/port.h +@@ -309,6 +309,130 @@ + /* Offset 0x13: OutFiltered Counter */ + #define MV88E6XXX_PORT_OUT_FILTERED 0x13 + ++/* Offset 0x16: LED Control */ ++#define MV88E6XXX_PORT_LED_CONTROL 0x16 ++#define MV88E6XXX_PORT_LED_CONTROL_UPDATE BIT(15) ++#define MV88E6XXX_PORT_LED_CONTROL_POINTER_MASK GENMASK(14, 12) ++#define MV88E6XXX_PORT_LED_CONTROL_POINTER_LED01_CTRL (0x00 << 12) /* Control for LED 0 and 1 */ ++#define MV88E6XXX_PORT_LED_CONTROL_POINTER_STRETCH_BLINK (0x06 << 12) /* Stetch and Blink Rate */ ++#define MV88E6XXX_PORT_LED_CONTROL_POINTER_CNTL_SPECIAL (0x07 << 12) /* Control for the Port's Special LED */ ++#define MV88E6XXX_PORT_LED_CONTROL_DATA_MASK GENMASK(10, 0) ++/* Selection masks valid for either port 1,2,3,4 or 5 */ ++#define MV88E6XXX_PORT_LED_CONTROL_LED0_SEL_MASK GENMASK(3, 0) ++#define MV88E6XXX_PORT_LED_CONTROL_LED1_SEL_MASK GENMASK(7, 4) ++/* Selection control for LED 0 and 1, ports 5 and 6 only has LED 0 ++ * Bits Function ++ * 0..3 LED 0 control selector on ports 1-5 ++ * 4..7 LED 1 control selector on ports 1-4 on port 5 this controls LED 0 of port 6 ++ * ++ * Sel Port LED Function for the 6352 family: ++ * 0 1-4 0 Link/Act/Speed by Blink Rate (off=no link, on=link, blink=activity, blink speed=link speed) ++ * 1-4 1 Port 2's Special LED ++ * 5-6 0 Port 5 Link/Act (off=no link, on=link, blink=activity) ++ * 5-6 1 Port 6 Link/Act (off=no link, on=link 1000, blink=activity) ++ * 1 1-4 0 100/1000 Link/Act (off=no link, on=100 or 1000 link, blink=activity) ++ * 1-4 1 10/100 Link Act (off=no link, on=10 or 100 link, blink=activity) ++ * 5-6 0 Fiber 100 Link/Act (off=no link, on=link 100, blink=activity) ++ * 5-6 1 Fiber 1000 Link/Act (off=no link, on=link 1000, blink=activity) ++ * 2 1-4 0 1000 Link/Act (off=no link, on=link 1000, blink=activity) ++ * 1-4 1 10/100 Link/Act (off=no link, on=10 or 100 link, blink=activity) ++ * 5-6 0 Fiber 1000 Link/Act (off=no link, on=link 1000, blink=activity) ++ * 5-6 1 Fiber 100 Link/Act (off=no link, on=link 100, blink=activity) ++ * 3 1-4 0 Link/Act (off=no link, on=link, blink=activity) ++ * 1-4 1 1000 Link (off=no link, on=1000 link) ++ * 5-6 0 Port 0's Special LED ++ * 5-6 1 Fiber Link (off=no link, on=link) ++ * 4 1-4 0 Port 0's Special LED ++ * 1-4 1 Port 1's Special LED ++ * 5-6 0 Port 1's Special LED ++ * 5-6 1 Port 5 Link/Act (off=no link, on=link, blink=activity) ++ * 5 1-4 0 Reserved ++ * 1-4 1 Reserved ++ * 5-6 0 Port 2's Special LED ++ * 5-6 1 Port 6 Link (off=no link, on=link) ++ * 6 1-4 0 Duplex/Collision (off=half-duplex,on=full-duplex,blink=collision) ++ * 1-4 1 10/1000 Link/Act (off=no link, on=10 or 1000 link, blink=activity) ++ * 5-6 0 Port 5 Duplex/Collision (off=half-duplex, on=full-duplex, blink=col) ++ * 5-6 1 Port 6 Duplex/Collision (off=half-duplex, on=full-duplex, blink=col) ++ * 7 1-4 0 10/1000 Link/Act (off=no link, on=10 or 1000 link, blink=activity) ++ * 1-4 1 10/1000 Link (off=no link, on=10 or 1000 link) ++ * 5-6 0 Port 5 Link/Act/Speed by Blink rate (off=no link, on=link, blink=activity, blink speed=link speed) ++ * 5-6 1 Port 6 Link/Act/Speed by Blink rate (off=no link, on=link, blink=activity, blink speed=link speed) ++ * 8 1-4 0 Link (off=no link, on=link) ++ * 1-4 1 Activity (off=no link, blink on=activity) ++ * 5-6 0 Port 6 Link/Act (off=no link, on=link, blink=activity) ++ * 5-6 1 Port 0's Special LED ++ * 9 1-4 0 10 Link (off=no link, on=10 link) ++ * 1-4 1 100 Link (off=no link, on=100 link) ++ * 5-6 0 Reserved ++ * 5-6 1 Port 1's Special LED ++ * a 1-4 0 10 Link/Act (off=no link, on=10 link, blink=activity) ++ * 1-4 1 100 Link/Act (off=no link, on=100 link, blink=activity) ++ * 5-6 0 Reserved ++ * 5-6 1 Port 2's Special LED ++ * b 1-4 0 100/1000 Link (off=no link, on=100 or 1000 link) ++ * 1-4 1 10/100 Link (off=no link, on=100 link, blink=activity) ++ * 5-6 0 Reserved ++ * 5-6 1 Reserved ++ * c * * PTP Act (blink on=PTP activity) ++ * d * * Force Blink ++ * e * * Force Off ++ * f * * Force On ++ */ ++/* Select LED0 output */ ++#define MV88E6XXX_PORT_LED_CONTROL_LED0_SEL0 0x0 ++#define MV88E6XXX_PORT_LED_CONTROL_LED0_SEL1 0x1 ++#define MV88E6XXX_PORT_LED_CONTROL_LED0_SEL2 0x2 ++#define MV88E6XXX_PORT_LED_CONTROL_LED0_SEL3 0x3 ++#define MV88E6XXX_PORT_LED_CONTROL_LED0_SEL4 0x4 ++#define MV88E6XXX_PORT_LED_CONTROL_LED0_SEL5 0x5 ++#define MV88E6XXX_PORT_LED_CONTROL_LED0_SEL6 0x6 ++#define MV88E6XXX_PORT_LED_CONTROL_LED0_SEL7 0x7 ++#define MV88E6XXX_PORT_LED_CONTROL_LED0_SEL8 0x8 ++#define MV88E6XXX_PORT_LED_CONTROL_LED0_SEL9 0x9 ++#define MV88E6XXX_PORT_LED_CONTROL_LED0_SELA 0xa ++#define MV88E6XXX_PORT_LED_CONTROL_LED0_SELB 0xb ++#define MV88E6XXX_PORT_LED_CONTROL_LED0_SELC 0xc ++#define MV88E6XXX_PORT_LED_CONTROL_LED0_SELD 0xd ++#define MV88E6XXX_PORT_LED_CONTROL_LED0_SELE 0xe ++#define MV88E6XXX_PORT_LED_CONTROL_LED0_SELF 0xf ++#define MV88E6XXX_PORT_LED_CONTROL_LED1_SEL0 (0x0 << 4) ++#define MV88E6XXX_PORT_LED_CONTROL_LED1_SEL1 (0x1 << 4) ++#define MV88E6XXX_PORT_LED_CONTROL_LED1_SEL2 (0x2 << 4) ++#define MV88E6XXX_PORT_LED_CONTROL_LED1_SEL3 (0x3 << 4) ++#define MV88E6XXX_PORT_LED_CONTROL_LED1_SEL4 (0x4 << 4) ++#define MV88E6XXX_PORT_LED_CONTROL_LED1_SEL5 (0x5 << 4) ++#define MV88E6XXX_PORT_LED_CONTROL_LED1_SEL6 (0x6 << 4) ++#define MV88E6XXX_PORT_LED_CONTROL_LED1_SEL7 (0x7 << 4) ++#define MV88E6XXX_PORT_LED_CONTROL_LED1_SEL8 (0x8 << 4) ++#define MV88E6XXX_PORT_LED_CONTROL_LED1_SEL9 (0x9 << 4) ++#define MV88E6XXX_PORT_LED_CONTROL_LED1_SELA (0xa << 4) ++#define MV88E6XXX_PORT_LED_CONTROL_LED1_SELB (0xb << 4) ++#define MV88E6XXX_PORT_LED_CONTROL_LED1_SELC (0xc << 4) ++#define MV88E6XXX_PORT_LED_CONTROL_LED1_SELD (0xd << 4) ++#define MV88E6XXX_PORT_LED_CONTROL_LED1_SELE (0xe << 4) ++#define MV88E6XXX_PORT_LED_CONTROL_LED1_SELF (0xf << 4) ++/* Stretch and Blink Rate Control (Index 0x06 of LED Control) */ ++/* Pulse Stretch Selection for all LED's on this port */ ++#define MV88E6XXX_PORT_LED_CONTROL_0x06_PULSE_STRETCH_NONE (0 << 4) ++#define MV88E6XXX_PORT_LED_CONTROL_0x06_PULSE_STRETCH_21MS (1 << 4) ++#define MV88E6XXX_PORT_LED_CONTROL_0x06_PULSE_STRETCH_42MS (2 << 4) ++#define MV88E6XXX_PORT_LED_CONTROL_0x06_PULSE_STRETCH_84MS (3 << 4) ++#define MV88E6XXX_PORT_LED_CONTROL_0x06_PULSE_STRETCH_168MS (4 << 4) ++/* Blink Rate Selection for all LEDs on this port */ ++#define MV88E6XXX_PORT_LED_CONTROL_0x06_BLINK_RATE_21MS 0 ++#define MV88E6XXX_PORT_LED_CONTROL_0x06_BLINK_RATE_42MS 1 ++#define MV88E6XXX_PORT_LED_CONTROL_0x06_BLINK_RATE_84MS 2 ++#define MV88E6XXX_PORT_LED_CONTROL_0x06_BLINK_RATE_168MS 3 ++#define MV88E6XXX_PORT_LED_CONTROL_0x06_BLINK_RATE_336MS 4 ++#define MV88E6XXX_PORT_LED_CONTROL_0x06_BLINK_RATE_672MS 5 ++ /* Control for Special LED (Index 0x7 of LED Control on Port0) */ ++#define MV88E6XXX_PORT_LED_CONTROL_0x07_P0_LAN_LINKACT_SHIFT 0 /* bits 6:0 LAN Link Activity LED */ ++/* Control for Special LED (Index 0x7 of LED Control on Port 1) */ ++#define MV88E6XXX_PORT_LED_CONTROL_0x07_P1_WAN_LINKACT_SHIFT 0 /* bits 6:0 WAN Link Activity LED */ ++/* Control for Special LED (Index 0x7 of LED Control on Port 2) */ ++#define MV88E6XXX_PORT_LED_CONTROL_0x07_P2_PTP_ACT 0 /* bits 6:0 PTP Activity */ ++ + /* Offset 0x18: IEEE Priority Mapping Table */ + #define MV88E6390_PORT_IEEE_PRIO_MAP_TABLE 0x18 + #define MV88E6390_PORT_IEEE_PRIO_MAP_TABLE_UPDATE 0x8000 +@@ -457,6 +581,15 @@ int mv88e6393x_port_set_cmode(struct mv8 + phy_interface_t mode); + int mv88e6185_port_get_cmode(struct mv88e6xxx_chip *chip, int port, u8 *cmode); + int mv88e6352_port_get_cmode(struct mv88e6xxx_chip *chip, int port, u8 *cmode); ++#ifdef CONFIG_NET_DSA_MV88E6XXX_LEDS ++int mv88e6xxx_port_setup_leds(struct mv88e6xxx_chip *chip, int port); ++#else ++static inline int mv88e6xxx_port_setup_leds(struct mv88e6xxx_chip *chip, ++ int port) ++{ ++ return 0; ++} ++#endif + int mv88e6xxx_port_drop_untagged(struct mv88e6xxx_chip *chip, int port, + bool drop_untagged); + int mv88e6xxx_port_set_map_da(struct mv88e6xxx_chip *chip, int port, bool map); diff --git a/target/linux/generic/config-6.6 b/target/linux/generic/config-6.6 index d588c617b84..349e21204ed 100644 --- a/target/linux/generic/config-6.6 +++ b/target/linux/generic/config-6.6 @@ -3991,6 +3991,7 @@ CONFIG_NET_CORE=y # CONFIG_NET_DSA_MT7530 is not set # CONFIG_NET_DSA_MV88E6060 is not set # CONFIG_NET_DSA_MV88E6XXX is not set +# CONFIG_NET_DSA_MV88E6XXX_LEDS is not set # CONFIG_NET_DSA_MV88E6XXX_PTP is not set # CONFIG_NET_DSA_QCA8K is not set # CONFIG_NET_DSA_QCA8K_LEDS_SUPPORT is not set @@ -4380,6 +4381,7 @@ CONFIG_NLS_DEFAULT="iso8859-1" # CONFIG_OCTEONTX2_PF is not set # CONFIG_OCTEON_EP is not set # CONFIG_OF_OVERLAY is not set +CONFIG_OF_PARTITION=y CONFIG_OF_RESERVED_MEM=y # CONFIG_OF_UNITTEST is not set # CONFIG_OID_REGISTRY is not set @@ -4753,6 +4755,9 @@ CONFIG_PRINT_STACK_DEPTH=64 # CONFIG_PROC_CHILDREN is not set CONFIG_PROC_FS=y # CONFIG_PROC_KCORE is not set +CONFIG_PROC_MEM_ALWAYS_FORCE=y +# CONFIG_PROC_MEM_FORCE_PTRACE is not set +# CONFIG_PROC_MEM_NO_FORCE is not set # CONFIG_PROC_PAGE_MONITOR is not set # CONFIG_PROC_STRIPPED is not set CONFIG_PROC_SYSCTL=y diff --git a/target/linux/generic/files/drivers/platform/mikrotik/Kconfig b/target/linux/generic/files/drivers/platform/mikrotik/Kconfig index 32ef8f29de8..85fe7b20503 100644 --- a/target/linux/generic/files/drivers/platform/mikrotik/Kconfig +++ b/target/linux/generic/files/drivers/platform/mikrotik/Kconfig @@ -21,4 +21,11 @@ config NVMEM_LAYOUT_MIKROTIK help This driver exposes MikroTik hard_config via NVMEM layout. +config MIKROTIK_WLAN_DECOMPRESS_LZ77 + tristate "Mikrotik factory Wi-Fi caldata LZ77 decompression support" + depends on MIKROTIK_RB_SYSFS + help + Allow Mikrotik LZ77 factory flashed Wi-Fi calibration data to be + decompressed + endif # MIKROTIK diff --git a/target/linux/generic/files/drivers/platform/mikrotik/Makefile b/target/linux/generic/files/drivers/platform/mikrotik/Makefile index 164b23b7016..9ffb355c1e3 100644 --- a/target/linux/generic/files/drivers/platform/mikrotik/Makefile +++ b/target/linux/generic/files/drivers/platform/mikrotik/Makefile @@ -3,3 +3,4 @@ # obj-$(CONFIG_MIKROTIK_RB_SYSFS) += routerboot.o rb_hardconfig.o rb_softconfig.o obj-$(CONFIG_NVMEM_LAYOUT_MIKROTIK) += rb_nvmem.o +obj-$(CONFIG_MIKROTIK_WLAN_DECOMPRESS_LZ77) += rb_lz77.o diff --git a/target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c b/target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c index 78e39a7f948..4c1edad0817 100644 --- a/target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c +++ b/target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c @@ -39,8 +39,9 @@ #include "rb_hardconfig.h" #include "routerboot.h" +#include "rb_lz77.h" -#define RB_HARDCONFIG_VER "0.07" +#define RB_HARDCONFIG_VER "0.08" #define RB_HC_PR_PFX "[rb_hardconfig] " /* Bit definitions for hardware options */ @@ -465,23 +466,24 @@ static int hc_wlan_data_unpack_erd(const u16 tag_id, const u8 *inbuf, size_t inl /* * If the RB_ID_WLAN_DATA payload starts with RB_MAGIC_LZOR, then past * that magic number is a payload that must be appended to the hc_lzor_prefix, - * the resulting blob is LZO-compressed. In the LZO decompression result, + * the resulting blob is LZO-compressed. + * If payload starts with RB_MAGIC_LZ77, a separate (bit level LZ77) + * decompression function needs to be used. In the decompressed result, * the RB_MAGIC_ERD magic number (aligned) must be located. Following that * magic, there is one or more routerboot tag node(s) locating the RLE-encoded * calibration data payload. */ -static int hc_wlan_data_unpack_lzor(const u16 tag_id, const u8 *inbuf, size_t inlen, - void *outbuf, size_t *outlen) +static int hc_wlan_data_unpack_lzor_lz77(const u16 tag_id, const u8 *inbuf, size_t inlen, + void *outbuf, size_t *outlen, u32 magic) { u16 rle_ofs, rle_len; const u32 *needle; u8 *tempbuf; size_t templen, lzo_len; int ret; - - lzo_len = inlen + sizeof(hc_lzor_prefix); - if (lzo_len > *outlen) - return -EFBIG; + const char lzor[] = "LZOR"; + const char lz77[] = "LZ77"; + const char *lz_type; /* Temporary buffer same size as the outbuf */ templen = *outlen; @@ -489,23 +491,50 @@ static int hc_wlan_data_unpack_lzor(const u16 tag_id, const u8 *inbuf, size_t in if (!tempbuf) return -ENOMEM; - /* Concatenate into the outbuf */ - memcpy(outbuf, hc_lzor_prefix, sizeof(hc_lzor_prefix)); - memcpy(outbuf + sizeof(hc_lzor_prefix), inbuf, inlen); + lzo_len = inlen; + if (magic == RB_MAGIC_LZOR) + lzo_len += sizeof(hc_lzor_prefix); + if (lzo_len > *outlen) + return -EFBIG; - /* LZO-decompress lzo_len bytes of outbuf into the tempbuf */ - ret = lzo1x_decompress_safe(outbuf, lzo_len, tempbuf, &templen); - if (ret) { - if (LZO_E_INPUT_NOT_CONSUMED == ret) { - /* - * The tag length is always aligned thus the LZO payload may be padded, - * which can trigger a spurious error which we ignore here. - */ - pr_debug(RB_HC_PR_PFX "LZOR: LZO EOF before buffer end - this may be harmless\n"); - } else { - pr_debug(RB_HC_PR_PFX "LZOR: LZO decompression error (%d)\n", ret); + switch (magic) { + case RB_MAGIC_LZOR: + lz_type = lzor; + + /* Concatenate into the outbuf */ + memcpy(outbuf, hc_lzor_prefix, sizeof(hc_lzor_prefix)); + memcpy(outbuf + sizeof(hc_lzor_prefix), inbuf, inlen); + + /* LZO-decompress lzo_len bytes of outbuf into the tempbuf */ + ret = lzo1x_decompress_safe(outbuf, lzo_len, tempbuf, &templen); + if (ret) { + if (LZO_E_INPUT_NOT_CONSUMED == ret) { + /* + * The tag length is always aligned thus the LZO payload may be padded, + * which can trigger a spurious error which we ignore here. + */ + pr_debug(RB_HC_PR_PFX "LZOR: LZO EOF before buffer end - this may be harmless\n"); + } else { + pr_debug(RB_HC_PR_PFX "LZOR: LZO decompression error (%d)\n", ret); + goto fail; + } + } + break; + case RB_MAGIC_LZ77: + lz_type = lz77; + /* LZO-decompress lzo_len bytes of inbuf into the tempbuf */ + ret = rb_lz77_decompress(inbuf, inlen, tempbuf, &templen); + if (ret) { + pr_err(RB_HC_PR_PFX "LZ77: LZ77 decompress error %d\n", ret); goto fail; } + + pr_debug(RB_HC_PR_PFX "LZ77: decompressed from %zu to %zu\n", + inlen, templen); + break; + default: + return -EINVAL; + break; } /* @@ -516,7 +545,7 @@ static int hc_wlan_data_unpack_lzor(const u16 tag_id, const u8 *inbuf, size_t in needle = (const u32 *)tempbuf; while (RB_MAGIC_ERD != *needle++) { if ((u8 *)needle >= tempbuf+templen) { - pr_debug(RB_HC_PR_PFX "LZOR: ERD magic not found\n"); + pr_warn(RB_HC_PR_PFX "%s: ERD magic not found. Decompressed first word: 0x%08x\n", lz_type, *(u32 *)tempbuf); ret = -ENODATA; goto fail; } @@ -526,12 +555,12 @@ static int hc_wlan_data_unpack_lzor(const u16 tag_id, const u8 *inbuf, size_t in /* Past magic. Look for tag node */ ret = routerboot_tag_find((u8 *)needle, templen, tag_id, &rle_ofs, &rle_len); if (ret) { - pr_debug(RB_HC_PR_PFX "LZOR: no RLE data for id 0x%04x\n", tag_id); + pr_debug(RB_HC_PR_PFX "%s: no RLE data for id 0x%04x\n", lz_type, tag_id); goto fail; } if (rle_len > templen) { - pr_debug(RB_HC_PR_PFX "LZOR: Invalid RLE data length\n"); + pr_debug(RB_HC_PR_PFX "%s: Invalid RLE data length\n", lz_type); ret = -EINVAL; goto fail; } @@ -539,7 +568,7 @@ static int hc_wlan_data_unpack_lzor(const u16 tag_id, const u8 *inbuf, size_t in /* RLE-decode tempbuf from needle back into the outbuf */ ret = routerboot_rle_decode((u8 *)needle+rle_ofs, rle_len, outbuf, outlen); if (ret) - pr_debug(RB_HC_PR_PFX "LZOR: RLE decoding error (%d)\n", ret); + pr_debug(RB_HC_PR_PFX "%s: RLE decoding error (%d)\n", lz_type, ret); fail: kfree(tempbuf); @@ -562,11 +591,18 @@ static int hc_wlan_data_unpack(const u16 tag_id, const size_t tofs, size_t tlen, ret = -ENODATA; switch (magic) { + case RB_MAGIC_LZ77: + /* no known instances of lz77 without 8001/8201 data, skip SOLO */ + if (tag_id == RB_WLAN_ERD_ID_SOLO) { + pr_debug(RB_HC_PR_PFX "skipped LZ77 decompress in search for SOLO tag\n"); + break; + } + fallthrough; case RB_MAGIC_LZOR: /* Skip magic */ lbuf += sizeof(magic); tlen -= sizeof(magic); - ret = hc_wlan_data_unpack_lzor(tag_id, lbuf, tlen, outbuf, outlen); + ret = hc_wlan_data_unpack_lzor_lz77(tag_id, lbuf, tlen, outbuf, outlen, magic); break; case RB_MAGIC_ERD: /* Skip magic */ diff --git a/target/linux/generic/files/drivers/platform/mikrotik/rb_lz77.c b/target/linux/generic/files/drivers/platform/mikrotik/rb_lz77.c new file mode 100644 index 00000000000..d443adb128e --- /dev/null +++ b/target/linux/generic/files/drivers/platform/mikrotik/rb_lz77.c @@ -0,0 +1,446 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2023 John Thomson + */ + +#include +#include +#include +#include +#include + +#include "rb_lz77.h" + +#define MIKRO_LZ77 "[rb lz77] " + +/* + * The maximum number of bits used in a counter. + * For the look behind window, long instruction match offsets + * up to 6449 have been seen in provided compressed caldata blobs + * (that would need 21 counter bits: 4 to 12 + 11 to 0). + * conservative value here: 27 provides offset up to 0x8000 bytes + * uses a u8 in this code + */ +#define MIKRO_LZ77_MAX_COUNT_BIT_LEN 27 + +enum rb_lz77_instruction { + INSTR_ERROR = -1, + INSTR_LITERAL_BYTE = 0, + /* a (non aligned) byte follows this instruction, + * which is directly copied into output + */ + INSTR_PREVIOUS_OFFSET = 1, + /* this group is a match, with a bytes length defined by + * following counter bits, starting at bitshift 0, + * less the built-in count of 1 + * using the previous offset as source + */ + INSTR_LONG = 2 + /* this group has two counters, + * the first counter starts at bitshift 4, + * if this counter == 0, this is a non-matching group + * the second counter (bytes length) starts at bitshift 4, + * less the built-in count of 11+1. + * The final match group has this count 0, + * and following bits which pad to byte-alignment. + * + * if this counter > 0, this is a matching group + * this first count is the match offset (in bytes) + * the second count is the match length (in bytes), + * less the built-in count of 2 + * these groups can source bytes that are part of this group + */ +}; + +struct rb_lz77_instr_opcodes { + /* group instruction */ + enum rb_lz77_instruction instruction; + /* if >0, a match group, + * which starts at byte output_position - 1*offset + */ + size_t offset; + /* how long the match group is, + * or how long the (following counter) non-match group is + */ + size_t length; + /* how many bits were used for this instruction + op code(s) */ + size_t bits_used; + /* input char */ + u8 *in; + /* offset where this instruction started */ + size_t in_pos; +}; + +/** + * rb_lz77_get_bit + * + * @in: compressed data ptr + * @in_offset_bit: bit offset to extract + * + * convert the bit offset to byte offset, + * shift to modulo of bits per bytes, so that wanted bit is lsb + * and to extract only that bit. + * Caller is responsible for ensuring that in_offset_bit/8 + * does not exceed input length + */ +static inline u8 rb_lz77_get_bit(const u8 *in, const size_t in_offset_bit) +{ + return ((in[in_offset_bit / BITS_PER_BYTE] >> + (in_offset_bit % BITS_PER_BYTE)) & + 1); +} + +/** + * rb_lz77_get_byte + * + * @in: compressed data + * @in_offset_bit: bit offset to extract byte + */ +static inline u8 rb_lz77_get_byte(const u8 *in, const size_t in_offset_bit) +{ + u8 buf = 0; + int i; + + /* built a reversed byte from (likely) unaligned bits */ + for (i = 0; i <= 7; ++i) + buf += rb_lz77_get_bit(in, in_offset_bit + i) << (7 - i); + return buf; +} + +/** + * rb_lz77_decode_count - decode bits at given offset as a count + * + * @in: compressed data + * @in_len: length of compressed data + * @in_offset_bit: bit offset where count starts + * @shift: left shift operand value of first count bit + * @count: initial count + * @bits_used: how many bits were consumed by this count + * @max_bits: maximum bit count for this counter + * + * Returns the decoded count + */ +static int rb_lz77_decode_count(const u8 *in, const size_t in_len, + const size_t in_offset_bit, u8 shift, + size_t count, u8 *bits_used, const u8 max_bits) +{ + size_t pos = in_offset_bit; + const size_t max_pos = min(pos + max_bits, in_len * BITS_PER_BYTE); + bool up = true; + + *bits_used = 0; + pr_debug(MIKRO_LZ77 + "decode_count inbit: %zu, start shift:%u, initial count:%zu\n", + in_offset_bit, shift, count); + + while (true) { + /* check the input offset bit does not overflow the minimum of + * a reasonable length for this encoded count, and + * the end of the input */ + if (unlikely(pos >= max_pos)) { + pr_err(MIKRO_LZ77 + "max bit index reached before count completed\n"); + return -EFBIG; + } + + /* if the bit value at offset is set */ + if (rb_lz77_get_bit(in, pos)) + count += (1 << shift); + + /* shift increases until we find an unsed bit */ + else if (up) + up = false; + + if (up) + ++shift; + else { + if (!shift) { + *bits_used = pos - in_offset_bit + 1; + return count; + } + --shift; + } + + ++pos; + } + + return -EINVAL; +} + +/** + * rb_lz77_decode_instruction + * + * @in: compressed data + * @in_offset_bit: bit offset where instruction starts + * @bits_used: how many bits were consumed by this count + * + * Returns the decoded instruction + */ +static enum rb_lz77_instruction +rb_lz77_decode_instruction(const u8 *in, size_t in_offset_bit, u8 *bits_used) +{ + if (rb_lz77_get_bit(in, in_offset_bit)) { + *bits_used = 2; + if (rb_lz77_get_bit(in, ++in_offset_bit)) + return INSTR_LONG; + else + return INSTR_PREVIOUS_OFFSET; + } else { + *bits_used = 1; + return INSTR_LITERAL_BYTE; + } + return INSTR_ERROR; +} + +/** + * rb_lz77_decode_instruction_operators + * + * @in: compressed data + * @in_len: length of compressed data + * @in_offset_bit: bit offset where instruction starts + * @previous_offset: last used match offset + * @opcode: struct to hold instruction & operators + * + * Returns error code + */ +static int rb_lz77_decode_instruction_operators( + const u8 *in, const size_t in_len, const size_t in_offset_bit, + const size_t previous_offset, struct rb_lz77_instr_opcodes *opcode) +{ + enum rb_lz77_instruction instruction; + u8 bit_count = 0; + u8 bits_used = 0; + int offset = 0; + int length = 0; + + instruction = rb_lz77_decode_instruction(in, in_offset_bit, &bit_count); + + /* skip bits used by instruction */ + bits_used += bit_count; + + switch (instruction) { + case INSTR_LITERAL_BYTE: + /* non-matching char */ + offset = 0; + length = 1; + break; + + case INSTR_PREVIOUS_OFFSET: + /* matching group uses previous offset */ + offset = previous_offset; + + length = rb_lz77_decode_count(in, in_len, + in_offset_bit + bits_used, 0, 1, + &bit_count, + MIKRO_LZ77_MAX_COUNT_BIT_LEN); + if (unlikely(length < 0)) + return length; + /* skip bits used by count */ + bits_used += bit_count; + break; + + case INSTR_LONG: + offset = rb_lz77_decode_count(in, in_len, + in_offset_bit + bits_used, 4, 0, + &bit_count, + MIKRO_LZ77_MAX_COUNT_BIT_LEN); + if (unlikely(offset < 0)) + return offset; + + /* skip bits used by offset count */ + bits_used += bit_count; + + if (offset == 0) { + /* non-matching long group */ + length = rb_lz77_decode_count( + in, in_len, in_offset_bit + bits_used, 4, 12, + &bit_count, MIKRO_LZ77_MAX_COUNT_BIT_LEN); + if (unlikely(length < 0)) + return length; + /* skip bits used by length count */ + bits_used += bit_count; + } else { + /* matching group */ + length = rb_lz77_decode_count( + in, in_len, in_offset_bit + bits_used, 0, 2, + &bit_count, MIKRO_LZ77_MAX_COUNT_BIT_LEN); + if (unlikely(length < 0)) + return length; + /* skip bits used by length count */ + bits_used += bit_count; + } + + break; + + case INSTR_ERROR: + return -EINVAL; + } + + opcode->instruction = instruction; + opcode->offset = offset; + opcode->length = length; + opcode->bits_used = bits_used; + opcode->in = (u8 *)in; + opcode->in_pos = in_offset_bit; + return 0; +} + +/** + * rb_lz77_decompress + * + * @in: compressed data ptr + * @in_len: length of compressed data + * @out: buffer ptr to decompress into + * @out_len: length of decompressed buffer in input, + * length of decompressed data in success + * + * Returns 0 on success, or negative error + */ +int rb_lz77_decompress(const u8 *in, const size_t in_len, u8 *out, + size_t *out_len) +{ + u8 *output_ptr; + size_t input_bit = 0; + const u8 *output_end = out + *out_len; + struct rb_lz77_instr_opcodes *opcode; + size_t match_offset = 0; + int rc = 0; + size_t match_length, partial_count, i; + + output_ptr = out; + + if (unlikely((in_len * BITS_PER_BYTE) > SIZE_MAX)) { + pr_err(MIKRO_LZ77 "input longer than expected\n"); + return -EFBIG; + } + + opcode = kmalloc(sizeof(*opcode), GFP_KERNEL); + if (!opcode) + return -ENOMEM; + + while (true) { + if (unlikely(output_ptr > output_end)) { + pr_err(MIKRO_LZ77 "output overrun\n"); + rc = -EOVERFLOW; + goto free_lz77_struct; + } + if (unlikely(input_bit > in_len * BITS_PER_BYTE)) { + pr_err(MIKRO_LZ77 "input overrun\n"); + rc = -ENODATA; + goto free_lz77_struct; + } + + rc = rb_lz77_decode_instruction_operators(in, in_len, input_bit, + match_offset, opcode); + if (unlikely(rc < 0)) { + pr_err(MIKRO_LZ77 + "instruction operands decode error\n"); + goto free_lz77_struct; + } + + pr_debug(MIKRO_LZ77 "inbit:0x%zx->outbyte:0x%zx", input_bit, + output_ptr - out); + + input_bit += opcode->bits_used; + switch (opcode->instruction) { + case INSTR_LITERAL_BYTE: + pr_debug(" short"); + fallthrough; + case INSTR_LONG: + if (opcode->offset == 0) { + /* this is a non-matching group */ + pr_debug(" non-match, len: 0x%zx\n", + opcode->length); + /* test end marker */ + if (opcode->length == 0xc && + ((input_bit + + opcode->length * BITS_PER_BYTE) > + in_len)) { + *out_len = output_ptr - out; + pr_debug( + MIKRO_LZ77 + "lz77 decompressed from %zu to %zu\n", + in_len, *out_len); + rc = 0; + goto free_lz77_struct; + } + for (i = opcode->length; i > 0; --i) { + *output_ptr = + rb_lz77_get_byte(in, input_bit); + ++output_ptr; + input_bit += BITS_PER_BYTE; + } + /* do no fallthrough if a non-match group */ + break; + } + match_offset = opcode->offset; + fallthrough; + case INSTR_PREVIOUS_OFFSET: + match_length = opcode->length; + partial_count = 0; + + pr_debug(" match, offset: 0x%zx, len: 0x%zx", + opcode->offset, match_length); + + if (unlikely(opcode->offset == 0)) { + pr_err(MIKRO_LZ77 + "match group missing opcode->offset\n"); + rc = -EBADMSG; + goto free_lz77_struct; + } + + /* overflow */ + if (unlikely((output_ptr + match_length) > + output_end)) { + pr_err(MIKRO_LZ77 + "match group output overflow\n"); + rc = -ENOBUFS; + goto free_lz77_struct; + } + + /* underflow */ + if (unlikely((output_ptr - opcode->offset) < out)) { + pr_err(MIKRO_LZ77 + "match group offset underflow\n"); + rc = -ESPIPE; + goto free_lz77_struct; + } + + /* there are cases where the match (length) includes + * data that is a part of the same match + */ + while (opcode->offset < match_length) { + ++partial_count; + memcpy(output_ptr, output_ptr - opcode->offset, + opcode->offset); + output_ptr += opcode->offset; + match_length -= opcode->offset; + } + memcpy(output_ptr, output_ptr - opcode->offset, + match_length); + output_ptr += match_length; + if (partial_count) + pr_debug(" (%zu partial memcpy)", + partial_count); + pr_debug("\n"); + + break; + + case INSTR_ERROR: + rc = -EINVAL; + goto free_lz77_struct; + } + } + + pr_err(MIKRO_LZ77 "decode loop broken\n"); + rc = -EINVAL; + +free_lz77_struct: + kfree(opcode); + return rc; +} +EXPORT_SYMBOL_GPL(rb_lz77_decompress); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Mikrotik Wi-Fi caldata LZ77 decompressor"); +MODULE_AUTHOR("John Thomson"); diff --git a/target/linux/generic/files/drivers/platform/mikrotik/rb_lz77.h b/target/linux/generic/files/drivers/platform/mikrotik/rb_lz77.h new file mode 100644 index 00000000000..55179fcbc8e --- /dev/null +++ b/target/linux/generic/files/drivers/platform/mikrotik/rb_lz77.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2024 John Thomson + */ + +#ifndef __MIKROTIK_WLAN_LZ77_H__ +#define __MIKROTIK_WLAN_LZ77_H__ + +#include + +#ifdef CONFIG_MIKROTIK_WLAN_DECOMPRESS_LZ77 +/** + * rb_lz77_decompress + * + * @in: compressed data ptr + * @in_len: length of compressed data + * @out: buffer ptr to decompress into + * @out_len: length of decompressed buffer in input, + * length of decompressed data in success + * + * Returns 0 on success, or negative error + */ +int rb_lz77_decompress(const u8 *in, const size_t in_len, u8 *out, + size_t *out_len); + +#else /* CONFIG_MIKROTIK_WLAN_DECOMPRESS_LZ77 */ + +static inline int rb_lz77_decompress(const u8 *in, const size_t in_len, u8 *out, + size_t *out_len) +{ + return -EOPNOTSUPP; +} + +#endif /* CONFIG_MIKROTIK_WLAN_DECOMPRESS_LZ77 */ +#endif /* __MIKROTIK_WLAN_LZ77_H__ */ diff --git a/target/linux/generic/files/drivers/platform/mikrotik/routerboot.h b/target/linux/generic/files/drivers/platform/mikrotik/routerboot.h index e858a524af4..723f993eebe 100644 --- a/target/linux/generic/files/drivers/platform/mikrotik/routerboot.h +++ b/target/linux/generic/files/drivers/platform/mikrotik/routerboot.h @@ -15,6 +15,7 @@ #define RB_MAGIC_HARD (('H') | ('a' << 8) | ('r' << 16) | ('d' << 24)) #define RB_MAGIC_SOFT (('S') | ('o' << 8) | ('f' << 16) | ('t' << 24)) #define RB_MAGIC_LZOR (('L') | ('Z' << 8) | ('O' << 16) | ('R' << 24)) +#define RB_MAGIC_LZ77 (('L' << 24) | ('Z' << 16) | ('7' << 8) | ('7')) #define RB_MAGIC_ERD (('E' << 16) | ('R' << 8) | ('D')) #define RB_ART_SIZE 0x10000 diff --git a/target/linux/generic/hack-6.6/711-net-dsa-mv88e6xxx-disable-ATU-violation.patch b/target/linux/generic/hack-6.6/711-net-dsa-mv88e6xxx-disable-ATU-violation.patch index dbf1da04ef7..bf93a87e02e 100644 --- a/target/linux/generic/hack-6.6/711-net-dsa-mv88e6xxx-disable-ATU-violation.patch +++ b/target/linux/generic/hack-6.6/711-net-dsa-mv88e6xxx-disable-ATU-violation.patch @@ -9,7 +9,7 @@ Subject: [PATCH] net/dsa/mv88e6xxx: disable ATU violation --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c -@@ -3375,6 +3375,9 @@ static int mv88e6xxx_setup_port(struct m +@@ -3405,6 +3405,9 @@ static int mv88e6xxx_setup_port(struct m else reg = 1 << port; diff --git a/target/linux/generic/hack-6.6/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch b/target/linux/generic/hack-6.6/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch index 4ebddb3b456..522dbaf68f4 100644 --- a/target/linux/generic/hack-6.6/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch +++ b/target/linux/generic/hack-6.6/722-net-phy-aquantia-enable-AQR112-and-AQR412.patch @@ -97,7 +97,7 @@ Signed-off-by: Alex Marginean static int aqr_config_intr(struct phy_device *phydev) { bool en = phydev->interrupts == PHY_INTERRUPT_ENABLED; -@@ -848,7 +916,7 @@ static struct phy_driver aqr_driver[] = +@@ -854,7 +922,7 @@ static struct phy_driver aqr_driver[] = PHY_ID_MATCH_MODEL(PHY_ID_AQR112), .name = "Aquantia AQR112", .probe = aqr107_probe, @@ -106,7 +106,7 @@ Signed-off-by: Alex Marginean .config_intr = aqr_config_intr, .handle_interrupt = aqr_handle_interrupt, .get_tunable = aqr107_get_tunable, -@@ -871,7 +939,7 @@ static struct phy_driver aqr_driver[] = +@@ -877,7 +945,7 @@ static struct phy_driver aqr_driver[] = PHY_ID_MATCH_MODEL(PHY_ID_AQR412), .name = "Aquantia AQR412", .probe = aqr107_probe, diff --git a/target/linux/generic/hack-6.6/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch b/target/linux/generic/hack-6.6/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch index b3767f13464..ed47187a3e8 100644 --- a/target/linux/generic/hack-6.6/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch +++ b/target/linux/generic/hack-6.6/725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch @@ -21,7 +21,7 @@ Signed-off-by: Daniel Golle #define MDIO_PHYXS_VEND_IF_STATUS 0xe812 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK GENMASK(7, 3) -@@ -1055,6 +1057,30 @@ static struct phy_driver aqr_driver[] = +@@ -1061,6 +1063,30 @@ static struct phy_driver aqr_driver[] = .led_hw_control_get = aqr_phy_led_hw_control_get, .led_polarity_set = aqr_phy_led_polarity_set, }, @@ -52,7 +52,7 @@ Signed-off-by: Daniel Golle }; module_phy_driver(aqr_driver); -@@ -1075,6 +1101,8 @@ static struct mdio_device_id __maybe_unu +@@ -1081,6 +1107,8 @@ static struct mdio_device_id __maybe_unu { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR114C) }, { PHY_ID_MATCH_MODEL(PHY_ID_AQR813) }, diff --git a/target/linux/generic/hack-6.6/765-mxl-gpy-control-LED-reg-from-DT.patch b/target/linux/generic/hack-6.6/765-mxl-gpy-control-LED-reg-from-DT.patch index fd2a3278114..041f05e59b4 100644 --- a/target/linux/generic/hack-6.6/765-mxl-gpy-control-LED-reg-from-DT.patch +++ b/target/linux/generic/hack-6.6/765-mxl-gpy-control-LED-reg-from-DT.patch @@ -31,45 +31,21 @@ Signed-off-by: David Bauer #include #include #include -@@ -38,6 +39,7 @@ - #define PHY_MIISTAT 0x18 /* MII state */ - #define PHY_IMASK 0x19 /* interrupt mask */ - #define PHY_ISTAT 0x1A /* interrupt status */ -+#define PHY_LED 0x1B /* LED control */ - #define PHY_FWV 0x1E /* firmware version */ - - #define PHY_MIISTAT_SPD_MASK GENMASK(2, 0) -@@ -61,10 +63,15 @@ - PHY_IMASK_ADSC | \ - PHY_IMASK_ANC) - -+#define PHY_LED_NUM_LEDS 4 -+ - #define PHY_FWV_REL_MASK BIT(15) - #define PHY_FWV_MAJOR_MASK GENMASK(11, 8) - #define PHY_FWV_MINOR_MASK GENMASK(7, 0) - -+/* LED */ -+#define VSPEC1_LED(x) (0x1 + x) -+ - #define PHY_PMA_MGBT_POLARITY 0x82 - #define PHY_MDI_MDI_X_MASK GENMASK(1, 0) - #define PHY_MDI_MDI_X_NORMAL 0x3 -@@ -270,10 +277,39 @@ out: +@@ -293,10 +294,39 @@ out: return ret; } +static int gpy_led_write(struct phy_device *phydev) +{ + struct device_node *node = phydev->mdio.dev.of_node; -+ u32 led_regs[PHY_LED_NUM_LEDS]; ++ u32 led_regs[GPY_MAX_LEDS]; + int i, ret; + u16 val = 0xff00; + + if (!IS_ENABLED(CONFIG_OF_MDIO)) + return 0; + -+ if (of_property_read_u32_array(node, "mxl,led-config", led_regs, PHY_LED_NUM_LEDS)) ++ if (of_property_read_u32_array(node, "mxl,led-config", led_regs, GPY_MAX_LEDS)) + return 0; + + if (of_property_read_bool(node, "mxl,led-drive-vdd")) @@ -79,7 +55,7 @@ Signed-off-by: David Bauer + phy_write(phydev, PHY_LED, val); + + /* Write LED register values */ -+ for (i = 0; i < PHY_LED_NUM_LEDS; i++) { ++ for (i = 0; i < GPY_MAX_LEDS; i++) { + ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_LED(i), (u16)led_regs[i]); + if (ret < 0) + return ret; diff --git a/target/linux/generic/pending-6.6/360-selftests-bpf-portability-of-unprivileged-tests.patch b/target/linux/generic/pending-6.6/360-selftests-bpf-portability-of-unprivileged-tests.patch deleted file mode 100644 index 0f28834d48c..00000000000 --- a/target/linux/generic/pending-6.6/360-selftests-bpf-portability-of-unprivileged-tests.patch +++ /dev/null @@ -1,26 +0,0 @@ -From ecb8f9a7d69698ce20fc6f4d107718d56fa861df Mon Sep 17 00:00:00 2001 -From: Tony Ambardar -Date: Sat, 9 Mar 2024 16:44:53 -0800 -Subject: [PATCH] selftests/bpf: Improve portability of unprivileged tests - -The addition of general support for unprivileged tests in test_loader.c -breaks building test_verifier on non-glibc (e.g. musl) systems, due to the -inclusion of glibc extension '' in 'unpriv_helpers.c'. However, -the header is actually not needed, so remove it to restore building. - -Fixes: 1d56ade032a4 ("selftests/bpf: Unprivileged tests for test_loader.c") -Signed-off-by: Tony Ambardar ---- - tools/testing/selftests/bpf/unpriv_helpers.c | 1 - - 1 file changed, 1 deletion(-) - ---- a/tools/testing/selftests/bpf/unpriv_helpers.c -+++ b/tools/testing/selftests/bpf/unpriv_helpers.c -@@ -2,7 +2,6 @@ - - #include - #include --#include - #include - - #include "unpriv_helpers.h" diff --git a/target/linux/generic/pending-6.6/451-block-partitions-populate-fwnode.patch b/target/linux/generic/pending-6.6/451-block-partitions-populate-fwnode.patch index e279b711737..35b908ca6d6 100644 --- a/target/linux/generic/pending-6.6/451-block-partitions-populate-fwnode.patch +++ b/target/linux/generic/pending-6.6/451-block-partitions-populate-fwnode.patch @@ -49,7 +49,7 @@ Signed-off-by: Daniel Golle #include "check.h" static int (*const check_part[])(struct parsed_partitions *) = { -@@ -292,6 +294,74 @@ static ssize_t whole_disk_show(struct de +@@ -295,6 +297,74 @@ static ssize_t whole_disk_show(struct de } static const DEVICE_ATTR(whole_disk, 0444, whole_disk_show, NULL); @@ -124,7 +124,7 @@ Signed-off-by: Daniel Golle /* * Must be called either with open_mutex held, before a disk can be opened or * after all disk users are gone. -@@ -374,6 +444,8 @@ static struct block_device *add_partitio +@@ -377,6 +447,8 @@ static struct block_device *add_partitio goto out_put; } diff --git a/target/linux/generic/pending-6.6/452-block-add-support-for-notifications.patch b/target/linux/generic/pending-6.6/452-block-add-support-for-notifications.patch index cad3fbfa900..667852e3879 100644 --- a/target/linux/generic/pending-6.6/452-block-add-support-for-notifications.patch +++ b/target/linux/generic/pending-6.6/452-block-add-support-for-notifications.patch @@ -156,7 +156,7 @@ Signed-off-by: Daniel Golle +device_initcall(blk_notifications_init); --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h -@@ -1564,4 +1564,15 @@ struct io_comp_batch { +@@ -1567,4 +1567,15 @@ struct io_comp_batch { #define DEFINE_IO_COMP_BATCH(name) struct io_comp_batch name = { } diff --git a/target/linux/generic/pending-6.6/457-mmc-block-set-fwnode-of-disk-devices.patch b/target/linux/generic/pending-6.6/457-mmc-block-set-fwnode-of-disk-devices.patch index b45a0ebb1ad..66f35156218 100644 --- a/target/linux/generic/pending-6.6/457-mmc-block-set-fwnode-of-disk-devices.patch +++ b/target/linux/generic/pending-6.6/457-mmc-block-set-fwnode-of-disk-devices.patch @@ -14,24 +14,14 @@ Signed-off-by: Daniel Golle --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c -@@ -2463,6 +2463,7 @@ static struct mmc_blk_data *mmc_blk_allo - int area_type, - unsigned int part_type) - { -+ struct fwnode_handle *fwnode; - struct mmc_blk_data *md; - int devidx, ret; - char cap_str[10]; -@@ -2559,6 +2560,12 @@ static struct mmc_blk_data *mmc_blk_allo - - blk_queue_write_cache(md->queue.queue, cache_enabled, fua_enabled); - -+ fwnode = device_get_named_child_node(subname ? md->parent->parent : -+ md->parent, -+ subname ? subname : "block"); -+ if (fwnode) -+ device_set_node(disk_to_dev(md->disk), fwnode); -+ - string_get_size((u64)size, 512, STRING_UNITS_2, - cap_str, sizeof(cap_str)); - pr_info("%s: %s %s %s%s\n", +@@ -2620,6 +2620,10 @@ static struct mmc_blk_data *mmc_blk_allo + if (area_type == MMC_BLK_DATA_AREA_MAIN) + dev_set_drvdata(&card->dev, md); + disk_fwnode = mmc_blk_get_partitions_node(parent, subname); ++ if (!disk_fwnode) ++ disk_fwnode = device_get_named_child_node(subname ? md->parent->parent : ++ md->parent, ++ subname ? subname : "block"); + ret = add_disk_fwnode(md->parent, md->disk, mmc_disk_attr_groups, + disk_fwnode); + if (ret) diff --git a/target/linux/generic/pending-6.6/458-mmc-block-set-GENHD_FL_NVMEM.patch b/target/linux/generic/pending-6.6/458-mmc-block-set-GENHD_FL_NVMEM.patch index 713401f1042..7f9c512e457 100644 --- a/target/linux/generic/pending-6.6/458-mmc-block-set-GENHD_FL_NVMEM.patch +++ b/target/linux/generic/pending-6.6/458-mmc-block-set-GENHD_FL_NVMEM.patch @@ -12,7 +12,7 @@ Signed-off-by: Daniel Golle --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c -@@ -2516,6 +2516,7 @@ static struct mmc_blk_data *mmc_blk_allo +@@ -2566,6 +2566,7 @@ static struct mmc_blk_data *mmc_blk_allo md->disk->major = MMC_BLOCK_MAJOR; md->disk->minors = perdev_minors; md->disk->first_minor = devidx * perdev_minors; diff --git a/target/linux/generic/pending-6.6/680-net-add-TCP-fraglist-GRO-support.patch b/target/linux/generic/pending-6.6/680-net-add-TCP-fraglist-GRO-support.patch index 68ebf4e68a8..b810e7ec91a 100644 --- a/target/linux/generic/pending-6.6/680-net-add-TCP-fraglist-GRO-support.patch +++ b/target/linux/generic/pending-6.6/680-net-add-TCP-fraglist-GRO-support.patch @@ -45,7 +45,7 @@ Signe-off-by: Felix Fietkau INDIRECT_CALLABLE_DECLARE(int tcp6_gro_complete(struct sk_buff *skb, int thoff)); --- a/net/core/gro.c +++ b/net/core/gro.c -@@ -233,6 +233,33 @@ done: +@@ -228,6 +228,33 @@ done: return 0; } @@ -379,7 +379,7 @@ Signe-off-by: Felix Fietkau skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV4; --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c -@@ -452,33 +452,6 @@ out: +@@ -470,33 +470,6 @@ out: return segs; } diff --git a/target/linux/generic/pending-6.6/684-gso-fix-gso-fraglist-segmentation-after-pull-from-fr.patch b/target/linux/generic/pending-6.6/684-gso-fix-gso-fraglist-segmentation-after-pull-from-fr.patch deleted file mode 100644 index 5a7ba07fd04..00000000000 --- a/target/linux/generic/pending-6.6/684-gso-fix-gso-fraglist-segmentation-after-pull-from-fr.patch +++ /dev/null @@ -1,53 +0,0 @@ -From: Willem de Bruijn -Date: Sun, 22 Sep 2024 11:03:45 -0400 -Subject: [PATCH] gso: fix gso fraglist segmentation after pull from - frag_list - -Detect gso fraglist skbs with corrupted geometry (see below) and -pass these to skb_segment instead of skb_segment_list, as the first -can segment them correctly. - -Valid SKB_GSO_FRAGLIST skbs -- consist of two or more segments -- the head_skb holds the protocol headers plus first gso_size -- one or more frag_list skbs hold exactly one segment -- all but the last must be gso_size - -Optional datapath hooks such as NAT and BPF (bpf_skb_pull_data) can -modify these skbs, breaking these invariants. - -In extreme cases they pull all data into skb linear. For UDP, this -causes a NULL ptr deref in __udpv4_gso_segment_list_csum at -udp_hdr(seg->next)->dest. - -Detect invalid geometry due to pull, by checking head_skb size. -Don't just drop, as this may blackhole a destination. Convert to be -able to pass to regular skb_segment. - -Link: https://lore.kernel.org/netdev/20240428142913.18666-1-shiming.cheng@mediatek.com/ -Fixes: 3a1296a38d0c ("net: Support GRO/GSO fraglist chaining.") -Signed-off-by: Willem de Bruijn -Cc: stable@vger.kernel.org ---- - ---- a/net/ipv4/udp_offload.c -+++ b/net/ipv4/udp_offload.c -@@ -296,8 +296,16 @@ struct sk_buff *__udp_gso_segment(struct - return NULL; - } - -- if (skb_shinfo(gso_skb)->gso_type & SKB_GSO_FRAGLIST) -- return __udp_gso_segment_list(gso_skb, features, is_ipv6); -+ if (skb_shinfo(gso_skb)->gso_type & SKB_GSO_FRAGLIST) { -+ /* Detect modified geometry and pass these to skb_segment. */ -+ if (skb_pagelen(gso_skb) - sizeof(*uh) == skb_shinfo(gso_skb)->gso_size) -+ return __udp_gso_segment_list(gso_skb, features, is_ipv6); -+ -+ /* Setup csum, as fraglist skips this in udp4_gro_receive. */ -+ gso_skb->csum_start = skb_transport_header(gso_skb) - gso_skb->head; -+ gso_skb->csum_offset = offsetof(struct udphdr, check); -+ gso_skb->ip_summed = CHECKSUM_PARTIAL; -+ } - - skb_pull(gso_skb, sizeof(*uh)); - diff --git a/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch b/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch index be7405c1a2d..f27581d3e92 100644 --- a/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch +++ b/target/linux/generic/pending-6.6/701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch @@ -18,7 +18,7 @@ Signed-off-by: Felix Fietkau --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -8327,7 +8327,7 @@ static int nft_register_flowtable_net_ho +@@ -8376,7 +8376,7 @@ static int nft_register_flowtable_net_ho err = flowtable->data.type->setup(&flowtable->data, hook->ops.dev, FLOW_BLOCK_BIND); diff --git a/target/linux/generic/pending-6.6/703-phy-add-detach-callback-to-struct-phy_driver.patch b/target/linux/generic/pending-6.6/703-phy-add-detach-callback-to-struct-phy_driver.patch index aa839682633..a556a9cc407 100644 --- a/target/linux/generic/pending-6.6/703-phy-add-detach-callback-to-struct-phy_driver.patch +++ b/target/linux/generic/pending-6.6/703-phy-add-detach-callback-to-struct-phy_driver.patch @@ -23,7 +23,7 @@ Signed-off-by: Gabor Juhos sysfs_remove_link(&dev->dev.kobj, "phydev"); --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -979,6 +979,12 @@ struct phy_driver { +@@ -980,6 +980,12 @@ struct phy_driver { /** @handle_interrupt: Override default interrupt handling */ irqreturn_t (*handle_interrupt)(struct phy_device *phydev); diff --git a/target/linux/generic/pending-6.6/706-net-phy-populate-host_interfaces-when-attaching-PHY.patch b/target/linux/generic/pending-6.6/706-net-phy-populate-host_interfaces-when-attaching-PHY.patch new file mode 100644 index 00000000000..78e0049f052 --- /dev/null +++ b/target/linux/generic/pending-6.6/706-net-phy-populate-host_interfaces-when-attaching-PHY.patch @@ -0,0 +1,57 @@ +From 4e432e530db0056450fbc4a3cee793f16adc39a7 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Tue, 8 Oct 2024 23:58:41 +0100 +Subject: [PATCH] net: phy: populate host_interfaces when attaching PHY + +Use bitmask of interfaces supported by the MAC for the PHY to choose +from if the declared interface mode is among those using a single pair +of SerDes lanes. +This will allow 2500Base-T PHYs to switch to SGMII on most hosts, which +results in half-duplex being supported in case the MAC supports them. +Without this change, 2500Base-T PHYs will always operate in 2500Base-X +mode with rate-matching, which is not only wasteful in terms of energy +consumption, but also limits the supported interface modes to +full-duplex only. + +Signed-off-by: Daniel Golle +--- + drivers/net/phy/phylink.c | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) + +--- a/drivers/net/phy/phylink.c ++++ b/drivers/net/phy/phylink.c +@@ -2017,7 +2017,7 @@ int phylink_fwnode_phy_connect(struct ph + { + struct fwnode_handle *phy_fwnode; + struct phy_device *phy_dev; +- int ret; ++ int i, ret; + + /* Fixed links and 802.3z are handled without needing a PHY */ + if (pl->cfg_link_an_mode == MLO_AN_FIXED || +@@ -2044,6 +2044,25 @@ int phylink_fwnode_phy_connect(struct ph + pl->link_config.interface = pl->link_interface; + } + ++ /* Assume single-lane SerDes interface modes share the same ++ * lanes and allow the PHY to switch to slower also supported modes ++ */ ++ for (i = ARRAY_SIZE(phylink_sfp_interface_preference) - 1; i >= 0; i--) { ++ /* skip unsupported modes */ ++ if (!test_bit(phylink_sfp_interface_preference[i], pl->config->supported_interfaces)) ++ continue; ++ ++ __set_bit(phylink_sfp_interface_preference[i], phy_dev->host_interfaces); ++ ++ /* skip all faster modes */ ++ if (phylink_sfp_interface_preference[i] == pl->link_interface) ++ break; ++ } ++ ++ if (test_bit(pl->link_interface, phylink_sfp_interfaces)) ++ phy_interface_and(phy_dev->host_interfaces, phylink_sfp_interfaces, ++ pl->config->supported_interfaces); ++ + ret = phy_attach_direct(pl->netdev, phy_dev, flags, + pl->link_interface); + phy_device_free(phy_dev); diff --git a/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch b/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch index fe8ee7b5fa1..2b77b6e02f9 100644 --- a/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch +++ b/target/linux/generic/pending-6.6/720-01-net-phy-realtek-use-genphy_soft_reset-for-2.5G-PHYs.patch @@ -15,7 +15,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c -@@ -1325,6 +1325,7 @@ static struct phy_driver realtek_drvs[] +@@ -1375,6 +1375,7 @@ static struct phy_driver realtek_drvs[] }, { .name = "RTL8226 2.5Gbps PHY", .match_phy_device = rtl8226_match_phy_device, @@ -23,7 +23,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, -@@ -1337,6 +1338,7 @@ static struct phy_driver realtek_drvs[] +@@ -1387,6 +1388,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc840), .name = "RTL8226B_RTL8221B 2.5Gbps PHY", @@ -31,7 +31,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1351,6 +1353,7 @@ static struct phy_driver realtek_drvs[] +@@ -1401,6 +1403,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc838), .name = "RTL8226-CG 2.5Gbps PHY", @@ -39,7 +39,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, -@@ -1361,6 +1364,7 @@ static struct phy_driver realtek_drvs[] +@@ -1411,6 +1414,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc848), .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", @@ -47,7 +47,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1373,6 +1377,7 @@ static struct phy_driver realtek_drvs[] +@@ -1423,6 +1427,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", @@ -55,7 +55,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1385,6 +1390,7 @@ static struct phy_driver realtek_drvs[] +@@ -1435,6 +1440,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", @@ -63,7 +63,7 @@ Signed-off-by: Daniel Golle .config_init = rtl822xb_config_init, .get_rate_matching = rtl822xb_get_rate_matching, .get_features = rtl822x_c45_get_features, -@@ -1395,6 +1401,7 @@ static struct phy_driver realtek_drvs[] +@@ -1445,6 +1451,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", @@ -71,7 +71,7 @@ Signed-off-by: Daniel Golle .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .config_init = rtl822xb_config_init, -@@ -1407,6 +1414,7 @@ static struct phy_driver realtek_drvs[] +@@ -1457,6 +1464,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", diff --git a/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch b/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch index 0c729acb7fe..cbef74d317b 100644 --- a/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch +++ b/target/linux/generic/pending-6.6/720-02-net-phy-realtek-disable-SGMII-in-band-AN-for-2-5G-PHYs.patch @@ -20,7 +20,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c -@@ -786,8 +786,8 @@ static int rtl822x_write_mmd(struct phy_ +@@ -814,8 +814,8 @@ static int rtl822x_write_mmd(struct phy_ static int rtl822xb_config_init(struct phy_device *phydev) { bool has_2500, has_sgmii; @@ -30,7 +30,7 @@ Signed-off-by: Daniel Golle has_2500 = test_bit(PHY_INTERFACE_MODE_2500BASEX, phydev->host_interfaces) || -@@ -837,7 +837,29 @@ static int rtl822xb_config_init(struct p +@@ -865,7 +865,29 @@ static int rtl822xb_config_init(struct p if (ret < 0) return ret; diff --git a/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch b/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch index 8b8dca8f278..216fa918e1f 100644 --- a/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch +++ b/target/linux/generic/pending-6.6/720-03-net-phy-realtek-make-sure-paged-read-is-protected-by.patch @@ -18,7 +18,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c -@@ -1052,9 +1052,11 @@ static bool rtlgen_supports_2_5gbps(stru +@@ -1092,9 +1092,11 @@ static bool rtlgen_supports_2_5gbps(stru { int val; diff --git a/target/linux/generic/pending-6.6/720-06-net-phy-realtek-introduce-rtl822x_probe.patch b/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_probe.patch similarity index 84% rename from target/linux/generic/pending-6.6/720-06-net-phy-realtek-introduce-rtl822x_probe.patch rename to target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_probe.patch index ee4de599ab2..08c13f34e44 100644 --- a/target/linux/generic/pending-6.6/720-06-net-phy-realtek-introduce-rtl822x_probe.patch +++ b/target/linux/generic/pending-6.6/720-04-net-phy-realtek-introduce-rtl822x_probe.patch @@ -13,9 +13,9 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c -@@ -82,6 +82,10 @@ +@@ -80,6 +80,10 @@ - #define RTL822X_VND2_PHYSR 0xa434 + #define RTL822X_VND2_GANLPAR 0xa414 +#define RTL8221B_PHYCR1 0xa430 +#define RTL8221B_PHYCR1_ALDPS_EN BIT(2) @@ -24,8 +24,8 @@ Signed-off-by: Daniel Golle #define RTL8366RB_POWER_SAVE 0x15 #define RTL8366RB_POWER_SAVE_ON BIT(12) -@@ -1107,6 +1111,25 @@ static int rtl8221b_vn_cg_c45_match_phy_ - return rtlgen_is_c45_match(phydev, RTL_8221B_VN_CG, true); +@@ -1152,6 +1156,25 @@ static int rtl8251b_c45_match_phy_device + return rtlgen_is_c45_match(phydev, RTL_8251B, true); } +static int rtl822x_probe(struct phy_device *phydev) @@ -50,7 +50,7 @@ Signed-off-by: Daniel Golle static int rtlgen_resume(struct phy_device *phydev) { int ret = genphy_resume(phydev); -@@ -1382,6 +1405,7 @@ static struct phy_driver realtek_drvs[] +@@ -1427,6 +1450,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc838), .name = "RTL8226-CG 2.5Gbps PHY", @@ -58,7 +58,7 @@ Signed-off-by: Daniel Golle .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1393,6 +1417,7 @@ static struct phy_driver realtek_drvs[] +@@ -1438,6 +1462,7 @@ static struct phy_driver realtek_drvs[] }, { PHY_ID_MATCH_EXACT(0x001cc848), .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", @@ -66,7 +66,7 @@ Signed-off-by: Daniel Golle .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1406,6 +1431,7 @@ static struct phy_driver realtek_drvs[] +@@ -1451,6 +1476,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", @@ -74,7 +74,7 @@ Signed-off-by: Daniel Golle .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1419,6 +1445,7 @@ static struct phy_driver realtek_drvs[] +@@ -1464,6 +1490,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", @@ -82,7 +82,7 @@ Signed-off-by: Daniel Golle .soft_reset = genphy_soft_reset, .config_init = rtl822xb_config_init, .get_rate_matching = rtl822xb_get_rate_matching, -@@ -1430,6 +1457,7 @@ static struct phy_driver realtek_drvs[] +@@ -1475,6 +1502,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", @@ -90,7 +90,7 @@ Signed-off-by: Daniel Golle .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, -@@ -1443,6 +1471,7 @@ static struct phy_driver realtek_drvs[] +@@ -1488,6 +1516,7 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", diff --git a/target/linux/generic/pending-6.6/720-04-net-phy-realtek-use-inline-functions-for-10GbE-adver.patch b/target/linux/generic/pending-6.6/720-04-net-phy-realtek-use-inline-functions-for-10GbE-adver.patch deleted file mode 100644 index 8b204519799..00000000000 --- a/target/linux/generic/pending-6.6/720-04-net-phy-realtek-use-inline-functions-for-10GbE-adver.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 92c8b9d558160d94b981dd8a2b9c47657627ffdc Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Sat, 22 Apr 2023 01:23:08 +0100 -Subject: [PATCH 2/3] net: phy: realtek: use inline functions for 10GbE - advertisement - -Use existing generic inline functions to encode local advertisement -of 10GbE link modes as well as to decode link-partner advertisement. - -Signed-off-by: Daniel Golle ---- - drivers/net/phy/realtek.c | 22 +++++----------------- - 1 file changed, 5 insertions(+), 17 deletions(-) - ---- a/drivers/net/phy/realtek.c -+++ b/drivers/net/phy/realtek.c -@@ -910,7 +910,8 @@ static int rtl822x_config_aneg(struct ph - - ret = phy_modify_paged_changed(phydev, 0xa5d, 0x12, - MDIO_AN_10GBT_CTRL_ADV2_5G | -- MDIO_AN_10GBT_CTRL_ADV5G, -+ MDIO_AN_10GBT_CTRL_ADV5G | -+ MDIO_AN_10GBT_CTRL_ADV10G, - adv); - if (ret < 0) - return ret; diff --git a/target/linux/generic/pending-6.6/720-05-net-phy-realtek-check-validity-of-10GbE-link-partner.patch b/target/linux/generic/pending-6.6/720-05-net-phy-realtek-check-validity-of-10GbE-link-partner.patch deleted file mode 100644 index 1ba3353f191..00000000000 --- a/target/linux/generic/pending-6.6/720-05-net-phy-realtek-check-validity-of-10GbE-link-partner.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 929bb4d3cfbc7878326c0771a01a636d49c54b40 Mon Sep 17 00:00:00 2001 -From: Daniel Golle -Date: Sat, 22 Apr 2023 01:25:39 +0100 -Subject: [PATCH 3/3] net: phy: realtek: check validity of 10GbE link-partner - advertisement - -Only use link-partner advertisement bits for 10GbE modes if they are -actually valid. Check LOCALOK and REMOTEOK bits and clear 10GbE modes -unless both of them are set. - -Signed-off-by: Daniel Golle ---- - drivers/net/phy/realtek.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/drivers/net/phy/realtek.c -+++ b/drivers/net/phy/realtek.c -@@ -950,6 +950,10 @@ static int rtl822x_read_status(struct ph - if (lpadv < 0) - return lpadv; - -+ if (!(lpadv & MDIO_AN_10GBT_STAT_REMOK) || -+ !(lpadv & MDIO_AN_10GBT_STAT_LOCOK)) -+ lpadv = 0; -+ - mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, - lpadv); - } diff --git a/target/linux/generic/pending-6.6/720-07-net-phy-realtek-detect-early-version-of-RTL8221B.patch b/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch similarity index 95% rename from target/linux/generic/pending-6.6/720-07-net-phy-realtek-detect-early-version-of-RTL8221B.patch rename to target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch index cca5da0e131..6938552d14d 100644 --- a/target/linux/generic/pending-6.6/720-07-net-phy-realtek-detect-early-version-of-RTL8221B.patch +++ b/target/linux/generic/pending-6.6/720-05-net-phy-realtek-detect-early-version-of-RTL8221B.patch @@ -14,7 +14,7 @@ Signed-off-by: Daniel Golle Signed-off-by: Mieczyslaw Nalewaj --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c -@@ -1085,10 +1085,32 @@ static int rtl8226_match_phy_device(stru +@@ -1120,10 +1120,32 @@ static int rtl8226_match_phy_device(stru static int rtlgen_is_c45_match(struct phy_device *phydev, unsigned int id, bool is_c45) { diff --git a/target/linux/generic/pending-6.6/720-08-net-phy-realtek-support-interrupt-of-RTL8221B.patch b/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch similarity index 89% rename from target/linux/generic/pending-6.6/720-08-net-phy-realtek-support-interrupt-of-RTL8221B.patch rename to target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch index ee28bfbcfc4..a796b8f011d 100644 --- a/target/linux/generic/pending-6.6/720-08-net-phy-realtek-support-interrupt-of-RTL8221B.patch +++ b/target/linux/generic/pending-6.6/720-06-net-phy-realtek-support-interrupt-of-RTL8221B.patch @@ -12,7 +12,7 @@ Signed-off-by: Jianhui Zhao --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c -@@ -1287,6 +1287,51 @@ static irqreturn_t rtl9000a_handle_inter +@@ -1332,6 +1332,51 @@ static irqreturn_t rtl9000a_handle_inter return IRQ_HANDLED; } @@ -64,7 +64,7 @@ Signed-off-by: Jianhui Zhao static struct phy_driver realtek_drvs[] = { { PHY_ID_MATCH_EXACT(0x00008201), -@@ -1453,6 +1498,8 @@ static struct phy_driver realtek_drvs[] +@@ -1498,6 +1543,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c22_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C22)", @@ -73,7 +73,7 @@ Signed-off-by: Jianhui Zhao .probe = rtl822x_probe, .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, -@@ -1467,6 +1514,8 @@ static struct phy_driver realtek_drvs[] +@@ -1512,6 +1559,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vb_cg_c45_match_phy_device, .name = "RTL8221B-VB-CG 2.5Gbps PHY (C45)", @@ -82,7 +82,7 @@ Signed-off-by: Jianhui Zhao .probe = rtl822x_probe, .soft_reset = genphy_soft_reset, .config_init = rtl822xb_config_init, -@@ -1479,6 +1528,8 @@ static struct phy_driver realtek_drvs[] +@@ -1524,6 +1573,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c22_match_phy_device, .name = "RTL8221B-VM-CG 2.5Gbps PHY (C22)", @@ -91,7 +91,7 @@ Signed-off-by: Jianhui Zhao .probe = rtl822x_probe, .soft_reset = genphy_soft_reset, .get_features = rtl822x_get_features, -@@ -1493,6 +1544,8 @@ static struct phy_driver realtek_drvs[] +@@ -1538,6 +1589,8 @@ static struct phy_driver realtek_drvs[] }, { .match_phy_device = rtl8221b_vn_cg_c45_match_phy_device, .name = "RTL8221B-VN-CG 2.5Gbps PHY (C45)", diff --git a/target/linux/generic/pending-6.6/735-net-ethernet-mtk_eth_soc-fix-memory-corruption-durin.patch b/target/linux/generic/pending-6.6/735-net-ethernet-mtk_eth_soc-fix-memory-corruption-durin.patch new file mode 100644 index 00000000000..5d7902b1cf7 --- /dev/null +++ b/target/linux/generic/pending-6.6/735-net-ethernet-mtk_eth_soc-fix-memory-corruption-durin.patch @@ -0,0 +1,24 @@ +From: Felix Fietkau +Date: Tue, 15 Oct 2024 10:13:55 +0200 +Subject: [PATCH] net: ethernet: mtk_eth_soc: fix memory corruption during fq + dma init + +The loop responsible for allocating up to MTK_FQ_DMA_LENGTH buffers must +only touch as many descriptors, otherwise it ends up corrupting unrelated +memory. Fix the loop iteration count accordingly. + +Fixes: c57e55819443 ("net: ethernet: mtk_eth_soc: handle dma buffer size soc specific") +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -1172,7 +1172,7 @@ static int mtk_init_fq_dma(struct mtk_et + if (unlikely(dma_mapping_error(eth->dma_dev, dma_addr))) + return -ENOMEM; + +- for (i = 0; i < cnt; i++) { ++ for (i = 0; i < len; i++) { + struct mtk_tx_dma_v2 *txd; + + txd = eth->scratch_ring + (j * MTK_FQ_DMA_LENGTH + i) * soc->tx.desc_size; diff --git a/target/linux/generic/pending-6.6/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch b/target/linux/generic/pending-6.6/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch deleted file mode 100644 index 3f3d7572e01..00000000000 --- a/target/linux/generic/pending-6.6/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: Tobias Waldekranz -Subject: [RFC net-next 7/7] net: dsa: mv88e6xxx: Request assisted learning on CPU port -Date: Sat, 16 Jan 2021 02:25:15 +0100 -Archived-At: - -While the hardware is capable of performing learning on the CPU port, -it requires alot of additions to the bridge's forwarding path in order -to handle multi-destination traffic correctly. - -Until that is in place, opt for the next best thing and let DSA sync -the relevant addresses down to the hardware FDB. - -Signed-off-by: Tobias Waldekranz ---- - drivers/net/dsa/mv88e6xxx/chip.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/dsa/mv88e6xxx/chip.c -+++ b/drivers/net/dsa/mv88e6xxx/chip.c -@@ -6993,6 +6993,7 @@ static int mv88e6xxx_register_switch(str - ds->ops = &mv88e6xxx_switch_ops; - ds->ageing_time_min = chip->info->age_time_coeff; - ds->ageing_time_max = chip->info->age_time_coeff * U8_MAX; -+ ds->assisted_learning_on_cpu_port = true; - - /* Some chips support up to 32, but that requires enabling the - * 5-bit port mode, which we do not support. 640k^W16 ought to diff --git a/target/linux/generic/pending-6.6/810-pci_disable_common_quirks.patch b/target/linux/generic/pending-6.6/810-pci_disable_common_quirks.patch index 9bdfcc74866..e4c8caff22f 100644 --- a/target/linux/generic/pending-6.6/810-pci_disable_common_quirks.patch +++ b/target/linux/generic/pending-6.6/810-pci_disable_common_quirks.patch @@ -25,7 +25,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c -@@ -300,6 +300,7 @@ static void quirk_mmio_always_on(struct +@@ -313,6 +313,7 @@ static void quirk_mmio_always_on(struct DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_BRIDGE_HOST, 8, quirk_mmio_always_on); @@ -33,7 +33,7 @@ Signed-off-by: Gabor Juhos /* * The Mellanox Tavor device gives false positive parity errors. Disable * parity error reporting. -@@ -3488,6 +3489,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_I +@@ -3501,6 +3502,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_I DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65f9, quirk_intel_mc_errata); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65fa, quirk_intel_mc_errata); @@ -42,7 +42,7 @@ Signed-off-by: Gabor Juhos /* * Ivytown NTB BAR sizes are misreported by the hardware due to an erratum. * To work around this, query the size it should be configured to by the -@@ -3513,6 +3516,8 @@ static void quirk_intel_ntb(struct pci_d +@@ -3526,6 +3529,8 @@ static void quirk_intel_ntb(struct pci_d DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x0e08, quirk_intel_ntb); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x0e0d, quirk_intel_ntb); @@ -51,7 +51,7 @@ Signed-off-by: Gabor Juhos /* * Some BIOS implementations leave the Intel GPU interrupts enabled, even * though no one is handling them (e.g., if the i915 driver is never -@@ -3551,6 +3556,8 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_IN +@@ -3564,6 +3569,8 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_IN DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq); DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0152, disable_igfx_irq); diff --git a/target/linux/generic/pending-6.6/840-hwrng-bcm2835-set-quality-to-1000.patch b/target/linux/generic/pending-6.6/840-hwrng-bcm2835-set-quality-to-1000.patch index 3172ad5a167..3d3b0341998 100644 --- a/target/linux/generic/pending-6.6/840-hwrng-bcm2835-set-quality-to-1000.patch +++ b/target/linux/generic/pending-6.6/840-hwrng-bcm2835-set-quality-to-1000.patch @@ -16,7 +16,7 @@ Signed-off-by: Álvaro Fernández Rojas --- a/drivers/char/hw_random/bcm2835-rng.c +++ b/drivers/char/hw_random/bcm2835-rng.c -@@ -169,6 +169,7 @@ static int bcm2835_rng_probe(struct plat +@@ -171,6 +171,7 @@ static int bcm2835_rng_probe(struct plat priv->rng.init = bcm2835_rng_init; priv->rng.read = bcm2835_rng_read; priv->rng.cleanup = bcm2835_rng_cleanup; diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network index 7a2874a6e44..e3a6e242284 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -117,6 +117,9 @@ ipq40xx_setup_interfaces() qxwlan,e2600ac-c2) ucidef_set_interfaces_lan_wan "sw-eth1 sw-eth2" "sw-eth3" ;; + skspruce,wia3300-20) + ucidef_set_interfaces_lan_wan "ETH2" "ETH1" + ;; zte,mf286d) ucidef_set_interfaces_lan_wan "lan2 lan3 lan4" "wan" ;; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wia3300-20.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wia3300-20.dts new file mode 100644 index 00000000000..cb7d3a918f0 --- /dev/null +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-wia3300-20.dts @@ -0,0 +1,446 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qcom-ipq4019.dtsi" +#include +#include +#include +#include + +/ { + compatible = "skspruce,wia3300-20", "qcom,ipq4019"; + model = "SKSpruce WIA3300-20"; + + aliases { + label-mac-device = &gmac; + led-boot = &led_status_red; + led-failsafe = &led_status_lime; + led-running = &led_status_lime; + led-upgrade = &led_status_red; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + keys { + compatible = "gpio-keys"; + + pinctrl-0 = <&key_pins>; + pinctrl-names = "default"; + + reset { + label = "reset"; + gpios = <&tlmm 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + pinctrl-0 = <&led_pins>; + pinctrl-names = "default"; + + led_status_red: led-0 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&tlmm 8 GPIO_ACTIVE_LOW>; + }; + + led_status_lime: led-1 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&tlmm 9 GPIO_ACTIVE_LOW>; + }; + + led-2 { + color = ; + function = LED_FUNCTION_WLAN_2GHZ; + gpios = <&tlmm 11 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led-3 { + color = ; + function = LED_FUNCTION_WLAN_5GHZ; + gpios = <&tlmm 28 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; + + output-usb-power { + compatible = "regulator-output"; + vout-supply = <®_usb>; + }; + + reg_usb: regulator-usb { + compatible = "regulator-fixed"; + + pinctrl-0 = <®_usb_pins>; + pinctrl-names = "default"; + + enable-active-high; + gpios = <&tlmm 25 GPIO_ACTIVE_HIGH>; + regulator-max-microvolt = <5000000>; + regulator-min-microvolt = <5000000>; + regulator-name = "reg_usb"; + regulator-boot-on; + }; + + soc { + 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 = ; + }; + }; +}; + +&blsp_dma { + status = "okay"; +}; + +&blsp1_spi1 { + status = "okay"; + + pinctrl-0 = <&spi0_pins>; + pinctrl-names = "default"; + + cs-gpios = <&tlmm 12 GPIO_ACTIVE_LOW>; + + flash@0 { + compatible = "jedec,spi-nor"; + spi-max-frequency = <24000000>; + reg = <0>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "0:SBL1"; + reg = <0x00000000 0x00040000>; + read-only; + }; + + partition@40000 { + label = "0:MIBIB"; + reg = <0x00040000 0x00020000>; + read-only; + }; + + partition@60000 { + label = "0:QSEE"; + reg = <0x00060000 0x00060000>; + read-only; + }; + + partition@c0000 { + label = "0:CDT"; + reg = <0x000c0000 0x00010000>; + read-only; + }; + + partition@d0000 { + label = "0:DDRPARAMS"; + reg = <0x000d0000 0x00010000>; + read-only; + }; + + partition@e0000 { + compatible = "u-boot,env"; + label = "0:APPSBLENV"; + reg = <0x000e0000 0x00010000>; + }; + + partition@f0000 { + label = "0:APPSBL"; + reg = <0x000f0000 0x00080000>; + read-only; + }; + + partition@170000 { + label = "0:oldART"; + reg = <0x00170000 0x00010000>; + read-only; + }; + + partition@180000 { + label = "0:HLOS"; + reg = <0x00180000 0x00800000>; + read-only; + }; + + partition@980000 { + compatible = "denx,fit"; + label = "firmware"; + reg = <0x980000 0x35d0000>; + }; + + partition@3f50000 { + label = "0:APPSBL1"; + reg = <0x03f50000 0x00080000>; + read-only; + }; + + partition@3fd0000 { + label = "BoardInfo"; + reg = <0x03fd0000 0x00010000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_boardinfo_108a: macaddr@108a { + compatible = "mac-base"; + reg = <0x108a 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + partition@3fe0000 { + label = "RebootCause"; + reg = <0x03fe0000 0x00010000>; + read-only; + }; + + partition@3ff0000 { + label = "0:ART"; + reg = <0x03ff0000 0x00010000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + precal_art_1000: precal@1000 { + reg = <0x1000 0x2f20>; + }; + + precal_art_5000: precal@5000 { + reg = <0x5000 0x2f20>; + }; + }; + }; + }; + }; +}; + +&blsp1_uart1 { + status = "okay"; + + pinctrl-0 = <&serial0_pins>; + pinctrl-names = "default"; +}; + +&crypto { + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +ðphy3 { + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@1 { + reg = <1>; + color = ; + function = LED_FUNCTION_LAN; + }; + }; +}; + +ðphy4 { + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@1 { + reg = <1>; + color = ; + function = LED_FUNCTION_WAN; + }; + }; +}; + +&gmac { + status = "okay"; + + nvmem-cells = <&macaddr_boardinfo_108a 0>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + status = "okay"; + + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + + reset-delay-us = <2000>; + reset-post-delay-us = <2000>; + reset-gpios = <&tlmm 43 GPIO_ACTIVE_LOW>; +}; + +&prng { + status = "okay"; +}; + +&qpic_bam { + status = "okay"; +}; + +&switch { + status = "okay"; +}; + +&swport4 { + status = "okay"; + + label = "ETH2"; + nvmem-cells = <&macaddr_boardinfo_108a 1>; + nvmem-cell-names = "mac-address"; +}; + +&swport5 { + status = "okay"; + + label = "ETH1"; + nvmem-cells = <&macaddr_boardinfo_108a 0>; + nvmem-cell-names = "mac-address"; +}; + +&tlmm { + key_pins: key_pinmux { + gpio { + pins = "gpio18"; + function = "gpio"; + bias-disable; + }; + }; + + led_pins: led_pinmux { + gpio { + pins = "gpio8", "gpio9", "gpio11", "gpio28"; + function = "gpio"; + drive-strength = <8>; + drive-open-drain; + bias-disable; + }; + }; + + mdio_pins: mdio_pinmux { + gpio { + pins = "gpio43"; + function = "gpio"; + drive-strength = <4>; + bias-disable; + output-high; + }; + + mdc { + pins = "gpio7"; + function = "mdc"; + drive-strength = <4>; + bias-disable; + }; + + mdio { + pins = "gpio6"; + function = "mdio"; + drive-strength = <4>; + drive-open-drain; + bias-pull-up; + }; + }; + + reg_usb_pins: reg_usb_pinmux { + gpio { + pins = "gpio25"; + function = "gpio"; + drive-strength = <8>; + bias-disable; + output-high; + }; + }; + + serial0_pins: serial0_pinmux { + blsp_uart0 { + pins = "gpio16", "gpio17"; + function = "blsp_uart0"; + drive-strength = <8>; + bias-disable; + }; + }; + + spi0_pins: spi0_pinmux { + blsp_spi0 { + pins = "gpio13", "gpio14", "gpio15"; + function = "blsp_spi0"; + drive-strength = <4>; + bias-disable; + }; + + gpio { + pins = "gpio12"; + function = "gpio"; + drive-strength = <4>; + bias-disable; + output-high; + }; + }; +}; + +&usb2 { + status = "okay"; +}; + +&usb2_hs_phy { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi0 { + status = "okay"; + + nvmem-cell-names = "mac-address", "pre-calibration"; + nvmem-cells = <&macaddr_boardinfo_108a 3>, <&precal_art_1000>; + qcom,ath10k-calibration-variant = "SKSpruce_WIA3300-20"; +}; + +&wifi1 { + status = "okay"; + + nvmem-cell-names = "mac-address", "pre-calibration"; + nvmem-cells = <&macaddr_boardinfo_108a 4>, <&precal_art_5000>; + qcom,ath10k-calibration-variant = "SKSpruce_WIA3300-20"; +}; diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-insect-common.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-insect-common.dtsi index 3637b96d24d..8286e1899f8 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-insect-common.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4029-insect-common.dtsi @@ -128,13 +128,17 @@ pagesize = <32>; reg = <0x50>; read-only; /* This holds our MAC & Meraki board-data */ - #address-cells = <1>; - #size-cells = <1>; - mac_address: mac-address@66 { - compatible = "mac-base"; - reg = <0x66 0x6>; - #nvmem-cell-cells = <1>; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + mac_address: mac-address@66 { + compatible = "mac-base"; + reg = <0x66 0x6>; + #nvmem-cell-cells = <1>; + }; }; }; }; diff --git a/target/linux/ipq40xx/generic/config-default b/target/linux/ipq40xx/generic/config-default index bd9876a0b64..4999ad36223 100644 --- a/target/linux/ipq40xx/generic/config-default +++ b/target/linux/ipq40xx/generic/config-default @@ -3,4 +3,5 @@ CONFIG_MTD_UBI_BEB_LIMIT=20 CONFIG_MTD_UBI_BLOCK=y CONFIG_MTD_UBI_NVMEM=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 +CONFIG_REGULATOR_USERSPACE_CONSUMER=y CONFIG_UBIFS_FS=y diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk index a2931ff01e3..478e399d0ce 100644 --- a/target/linux/ipq40xx/image/generic.mk +++ b/target/linux/ipq40xx/image/generic.mk @@ -1092,6 +1092,19 @@ define Device/qxwlan_e2600ac-c2 endef TARGET_DEVICES += qxwlan_e2600ac-c2 +define Device/skspruce_wia3300-20 + $(call Device/FitzImage) + BLOCKSIZE := 64k + IMAGE_SIZE := 55104k + SOC := qcom-ipq4019 + DEVICE_VENDOR := SKSpruce + DEVICE_MODEL := WIA3300-20 + DEVICE_PACKAGES := -ath10k-board-qca4019 ipq-wifi-skspruce_wia3300-20 + IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \ + append-rootfs | pad-rootfs | check-size | append-metadata +endef +TARGET_DEVICES +=skspruce_wia3300-20 + define Device/sony_ncp-hg100-cellular $(call Device/FitImage) DEVICE_VENDOR := Sony diff --git a/target/linux/ipq40xx/mikrotik/config-default b/target/linux/ipq40xx/mikrotik/config-default index 805e6db23bb..7234e4b8f61 100644 --- a/target/linux/ipq40xx/mikrotik/config-default +++ b/target/linux/ipq40xx/mikrotik/config-default @@ -1,5 +1,6 @@ CONFIG_MIKROTIK=y CONFIG_MIKROTIK_RB_SYSFS=y +CONFIG_MIKROTIK_WLAN_DECOMPRESS_LZ77=y CONFIG_MTD_ROUTERBOOT_PARTS=y CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y CONFIG_MTD_SPLIT_MINOR_FW=y diff --git a/target/linux/lantiq/ase/config-6.6 b/target/linux/lantiq/ase/config-6.6 index c4d8e575ebf..f47a91c3801 100644 --- a/target/linux/lantiq/ase/config-6.6 +++ b/target/linux/lantiq/ase/config-6.6 @@ -1,10 +1,10 @@ -CONFIG_ADM6996_PHY=y CONFIG_CPU_MIPS32_R1=y # CONFIG_CPU_MIPS32_R2 is not set CONFIG_CPU_MIPSR1=y CONFIG_CRC16=y CONFIG_CRYPTO_DEFLATE=y CONFIG_FIRMWARE_MEMMAP=y +CONFIG_FORCE_NR_CPUS=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GPIO_GENERIC=y CONFIG_GPIO_GENERIC_PLATFORM=y @@ -15,7 +15,6 @@ CONFIG_NLS=y CONFIG_SGL_ALLOC=y CONFIG_SOC_AMAZON_SE=y # CONFIG_SOC_XWAY is not set -CONFIG_SWCONFIG=y CONFIG_TARGET_ISA_REV=1 CONFIG_USB=y CONFIG_USB_COMMON=y diff --git a/target/linux/lantiq/patches-6.6/0023-NET-PHY-add-led-support-for-intel-xway.patch b/target/linux/lantiq/patches-6.6/0023-NET-PHY-add-led-support-for-intel-xway.patch index fcc760b911a..a6a517dbf60 100644 --- a/target/linux/lantiq/patches-6.6/0023-NET-PHY-add-led-support-for-intel-xway.patch +++ b/target/linux/lantiq/patches-6.6/0023-NET-PHY-add-led-support-for-intel-xway.patch @@ -13,8 +13,8 @@ Signed-off-by: John Crispin --- a/drivers/net/phy/intel-xway.c +++ b/drivers/net/phy/intel-xway.c -@@ -229,6 +229,51 @@ static int xway_gphy_rgmii_init(struct p - XWAY_MDIO_MIICTRL_TXSKEW_MASK, val); +@@ -278,6 +278,51 @@ static int xway_gphy_init_leds(struct ph + return 0; } +#if IS_ENABLED(CONFIG_OF_MDIO) @@ -64,8 +64,8 @@ Signed-off-by: John Crispin + static int xway_gphy_config_init(struct phy_device *phydev) { - int err; -@@ -280,6 +325,7 @@ static int xway_gphy_config_init(struct + struct device_node *np = phydev->mdio.dev.of_node; +@@ -299,6 +344,7 @@ static int xway_gphy_config_init(struct if (err) return err; diff --git a/target/linux/lantiq/patches-6.6/0025-v6.12-net-ethernet-lantiq_etop-fix-memory-disclosure.patch b/target/linux/lantiq/patches-6.6/0025-v6.12-net-ethernet-lantiq_etop-fix-memory-disclosure.patch deleted file mode 100644 index 3b2ac250650..00000000000 --- a/target/linux/lantiq/patches-6.6/0025-v6.12-net-ethernet-lantiq_etop-fix-memory-disclosure.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 45c0de18ff2dc9af01236380404bbd6a46502c69 Mon Sep 17 00:00:00 2001 -From: Aleksander Jan Bajkowski -Date: Mon, 23 Sep 2024 23:49:49 +0200 -Subject: net: ethernet: lantiq_etop: fix memory disclosure - -When applying padding, the buffer is not zeroed, which results in memory -disclosure. The mentioned data is observed on the wire. This patch uses -skb_put_padto() to pad Ethernet frames properly. The mentioned function -zeroes the expanded buffer. - -In case the packet cannot be padded it is silently dropped. Statistics -are also not incremented. This driver does not support statistics in the -old 32-bit format or the new 64-bit format. These will be added in the -future. In its current form, the patch should be easily backported to -stable versions. - -Ethernet MACs on Amazon-SE and Danube cannot do padding of the packets -in hardware, so software padding must be applied. - -Fixes: 504d4721ee8e ("MIPS: Lantiq: Add ethernet driver") -Signed-off-by: Aleksander Jan Bajkowski -Reviewed-by: Jacob Keller -Reviewed-by: Florian Fainelli -Link: https://patch.msgid.link/20240923214949.231511-2-olek2@wp.pl -Signed-off-by: Paolo Abeni ---- - drivers/net/ethernet/lantiq_etop.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - ---- a/drivers/net/ethernet/lantiq_etop.c -+++ b/drivers/net/ethernet/lantiq_etop.c -@@ -482,7 +482,9 @@ ltq_etop_tx(struct sk_buff *skb, struct - unsigned long flags; - u32 byte_offset; - -- len = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len; -+ if (skb_put_padto(skb, ETH_ZLEN)) -+ return NETDEV_TX_OK; -+ len = skb->len; - - if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) || ch->skb[ch->dma.desc]) { - netdev_err(dev, "tx ring full\n"); diff --git a/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface b/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface index c982a8f1d8f..0deab424813 100644 --- a/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface +++ b/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface @@ -13,6 +13,7 @@ set_preinit_iface() { ip link set eth0 up ifname=eth0 ;; + smartrg,sdg-841-t6|\ smartrg,sdg-8622|\ smartrg,sdg-8632|\ smartrg,sdg-8733a) diff --git a/target/linux/mediatek/dts/mt7622-linksys-e8450-ubi.dts b/target/linux/mediatek/dts/mt7622-linksys-e8450-ubi.dts index 88538c8b0a6..5ee8ba5cd9b 100644 --- a/target/linux/mediatek/dts/mt7622-linksys-e8450-ubi.dts +++ b/target/linux/mediatek/dts/mt7622-linksys-e8450-ubi.dts @@ -38,14 +38,14 @@ ubi-volume-ubootenv { volname = "ubootenv"; nvmem-layout { - compatible = "u-boot,env-redundant-bool-layout"; + compatible = "u-boot,env-redundant-bool"; }; }; ubi-volume-ubootenv2 { volname = "ubootenv2"; nvmem-layout { - compatible = "u-boot,env-redundant-bool-layout"; + compatible = "u-boot,env-redundant-bool"; }; }; diff --git a/target/linux/mediatek/dts/mt7622-smartrg-SDG-841-t6.dts b/target/linux/mediatek/dts/mt7622-smartrg-SDG-841-t6.dts new file mode 100644 index 00000000000..05fd74a7d30 --- /dev/null +++ b/target/linux/mediatek/dts/mt7622-smartrg-SDG-841-t6.dts @@ -0,0 +1,518 @@ +/* + * SPDX-License-Identifier: (GPL-2.0 OR MIT) + * Copyright (c) 2018-2023 MediaTek Inc. + * Authors: Daniel Golle + * Chad Monroe + * Ryder Lee + * + */ + +/dts-v1/; +#include +#include +#include + +#include "mt7622.dtsi" +#include "mt6380.dtsi" + +/ { + model = "Adtran SmartRG 841-t6"; + compatible = "smartrg,sdg-841-t6", "mediatek,mt7622"; + + aliases { + ethernet0 = &gmac1; + label-mac-device = &gmac0; + led-boot = &sys_status_blue; + led-failsafe = &sys_status_blue; + led-running = &sys_status_white; + led-upgrade = &sys_status_blue; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n1 swiotlb=512 root=PARTLABEL=res1"; + }; + + cpus { + cpu@0 { + proc-supply = <&mt6380_vcpu_reg>; + sram-supply = <&mt6380_vm_reg>; + }; + + cpu@1 { + proc-supply = <&mt6380_vcpu_reg>; + sram-supply = <&mt6380_vm_reg>; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 102 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wps"; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + wifi2g { + label = "wifi2g"; + gpios = <&pio 96 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0radio"; + }; + + wifi5g-1 { + label = "wifi5g"; + gpios = <&pio 97 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1radio"; + }; + + wifi5g-2 { + label = "wifi5g2"; + gpios = <&pio 98 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy2radio"; + }; + + wps { + label = "wps"; + gpios = <&pio 99 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + }; + + memory { + reg = <0x0 0x40000000 0x0 0x40000000>; + }; + + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + /delete-node/ramoops@42ff0000; + + bootdata@45000000 { + no-map; + reg = <0x0 0x45000000 0x0 0x00001000>; + }; + + ramoops_reserved: ramoops1@45001000 { + no-map; + compatible = "ramoops"; + reg = <0x0 0x45001000 0x0 0x00140000>; + ftrace-size = <0x20000>; + record-size = <0x20000>; + console-size = <0x20000>; + pmsg-size = <0x80000>; + }; + }; + + reg_1p8v: regulator-1p8v { + compatible = "regulator-fixed"; + regulator-name = "fixed-1.8V"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + }; + + reg_5v: regulator-5v { + compatible = "regulator-fixed"; + regulator-name = "fixed-5V"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + regulator-always-on; + }; +}; + +ð { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <ð_pins>; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + label = "wan"; + + nvmem-cells = <&macaddr 0x0>; + nvmem-cell-names = "mac-address"; + + phy-handle = <&phy5>; + phy-mode = "2500base-x"; + phy-connection-type = "2500base-x"; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + label = "lan"; + + nvmem-cells = <&macaddr 0x1>; + nvmem-cell-names = "mac-address"; + + phy-handle = <&phy0>; + phy-mode = "rgmii-rxid"; + rx-internal-delay-ps = <2000>; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + phy0: ethernet-phy@0 { + /* PEF7071 */ + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0>; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + }; + + led@1 { + reg = <1>; + color = ; + function = LED_FUNCTION_LAN; + }; + }; + }; + + phy5: ethernet-phy@5 { + /* GPY211 */ + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <5>; + + interrupt-parent = <&pio>; + interrupts = <52 IRQ_TYPE_LEVEL_HIGH>; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@1 { + reg = <1>; + color = ; + function = LED_FUNCTION_WAN; + }; + + led@2 { + reg = <2>; + color = ; + function = LED_FUNCTION_WAN; + }; + }; + }; + }; +}; + +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_pins>; + status = "okay"; + + system-leds@30 { + compatible = "srg,sysled"; + reg = <0x30>; + #address-cells = <1>; + #size-cells = <0>; + + sys_status_blue: system_blue@3 { + label = "blue"; + reg = <3>; + }; + + sys_status_white: system_white@4 { + label = "white"; + reg = <4>; + }; + }; +}; + +&mmc0 { + pinctrl-names = "default", "state_uhs"; + pinctrl-0 = <&emmc_pins_default>; + pinctrl-1 = <&emmc_pins_uhs>; + status = "okay"; + bus-width = <8>; + max-frequency = <50000000>; + cap-mmc-highspeed; + mmc-hs200-1_8v; + vmmc-supply = <®_3p3v>; + vqmmc-supply = <®_1p8v>; + assigned-clocks = <&topckgen CLK_TOP_MSDC30_0_SEL>; + assigned-clock-parents = <&topckgen CLK_TOP_UNIV48M>; + non-removable; + #address-cells = <1>; + #size-cells = <0>; + + card@0 { + compatible = "mmc-card"; + reg = <0>; + + block { + partitions { + block-partition-nvram { + partnum = <3>; + partname = "nvram"; + + nvmem-layout { + compatible = "u-boot,env"; + }; + }; + + block-partition-rf { + partnum = <4>; + partname = "rf"; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom0: eeprom@0 { + reg = <0x0 0x5000>; + }; + + eeprom1: eeprom@5000 { + reg = <0x5000 0x5000>; + }; + }; + }; + + block-partition-mfginfo { + partnum = <7>; + partname = "mfginfo"; + + nvmem-layout { + compatible = "adtran,mfginfo"; + + macaddr: mfg-mac { + #nvmem-cell-cells = <1>; + }; + }; + }; + }; + }; + }; +}; + +&pcie0 { + pinctrl-names = "default"; + pinctrl-0 = <&pcie0_pins>; + status = "okay"; +}; + +&slot0 { + mt7915@0,0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&eeprom0>; + nvmem-cell-names = "eeprom"; + ieee80211-freq-limit = <2400000 5330000>; + + band@0 { + /* 2.4 GHz */ + reg = <0>; + nvmem-cells = <&macaddr 0x4>; + nvmem-cell-names = "mac-address"; + }; + + band@1 { + /* lower 5 GHz */ + reg = <1>; + nvmem-cells = <&macaddr 0xa>; + nvmem-cell-names = "mac-address"; + }; + }; +}; + +&pcie1 { + pinctrl-names = "default"; + pinctrl-0 = <&pcie1_pins>; + status = "okay"; +}; + +&slot1 { + mt7915@0,0 { + /* upper 5 GHz */ + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&eeprom1>, <&macaddr 0xf>; + nvmem-cell-names = "eeprom", "mac-address"; + ieee80211-freq-limit = <5490000 5835000>; + rdd_antenna = <0x02>; + }; +}; + +&pio { + /* eMMC is shared pin with parallel NAND */ + emmc_pins_default: emmc-pins-default { + mux { + function = "emmc", "emmc_rst"; + groups = "emmc"; + }; + + /* "NDL0","NDL1","NDL2","NDL3","NDL4","NDL5","NDL6","NDL7", + * "NRB","NCLE" pins are used as DAT0,DAT1,DAT2,DAT3,DAT4, + * DAT5,DAT6,DAT7,CMD,CLK for eMMC respectively + */ + conf-cmd-dat { + pins = "NDL0", "NDL1", "NDL2", + "NDL3", "NDL4", "NDL5", + "NDL6", "NDL7", "NRB"; + input-enable; + bias-pull-up; + }; + + conf-clk { + pins = "NCLE"; + bias-pull-down; + }; + }; + + emmc_pins_uhs: emmc-pins-uhs { + mux { + function = "emmc"; + groups = "emmc"; + }; + + conf-cmd-dat { + pins = "NDL0", "NDL1", "NDL2", + "NDL3", "NDL4", "NDL5", + "NDL6", "NDL7", "NRB"; + input-enable; + drive-strength = <4>; + bias-pull-up; + }; + + conf-clk { + pins = "NCLE"; + drive-strength = <4>; + bias-pull-down; + }; + }; + + eth_pins: eth-pins { + mux { + function = "eth"; + groups = "mdc_mdio", "rgmii_via_gmac2"; + }; + }; + + i2c0_pins: i2c0-pins { + mux { + function = "i2c"; + groups = "i2c0"; + }; + }; + + pcie0_pins: pcie0-pins { + mux { + function = "pcie"; + groups = "pcie0_pad_perst", + "pcie0_1_waken", + "pcie0_1_clkreq"; + }; + }; + + pcie1_pins: pcie1-pins { + mux { + function = "pcie"; + groups = "pcie1_pad_perst"; + }; + }; + + pmic_bus_pins: pmic-bus-pins { + mux { + function = "pmic"; + groups = "pmic_bus"; + }; + }; + + uart0_pins: uart0-pins { + mux { + function = "uart"; + groups = "uart0_0_tx_rx" ; + }; + }; + + uart3_pins: uart3-pins { + mux { + function = "uart"; + groups = "uart3_1_tx_rx" ; + }; + }; + + watchdog_pins: watchdog-pins { + mux { + function = "watchdog"; + groups = "watchdog"; + }; + }; +}; + +&pwrap { + pinctrl-names = "default"; + pinctrl-0 = <&pmic_bus_pins>; + status = "okay"; +}; + +&ssusb { + vusb33-supply = <®_3p3v>; + vbus-supply = <®_5v>; + status = "okay"; +}; + +&u3phy { + status = "okay"; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins>; + status = "okay"; +}; + +&uart3 { + status = "okay"; + + bluetooth { + compatible = "mediatek,mt7915-bluetooth"; + vcc-supply = <®_5v>; + pinctrl-names = "runtime"; + pinctrl-0 = <&uart3_pins>; + boot-gpios = <&pio 81 GPIO_ACTIVE_LOW>; + current-speed = <921600>; + }; +}; + +&watchdog { + pinctrl-names = "default"; + pinctrl-0 = <&watchdog_pins>; + status = "okay"; +}; diff --git a/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts b/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts index 612f3c73342..c27264a8d2e 100644 --- a/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts +++ b/target/linux/mediatek/dts/mt7986a-acer-predator-w6.dts @@ -446,10 +446,12 @@ }; &wifi { - status = "okay"; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; pinctrl-names = "default", "dbdc"; pinctrl-0 = <&wf_2g_5g_pins>; pinctrl-1 = <&wf_dbdc_pins>; + status = "okay"; }; &trng { @@ -494,12 +496,52 @@ non-removable; no-sd; no-sdio; + + card@0 { + compatible = "mmc-card"; + reg = <0>; + + block { + compatible = "block-device"; + + partitions { + block-partition-factory { + partname = "factory"; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + + eeprom_factory_a0000: eeprom@a0000 { + reg = <0xa0000 0x1000>; + }; + }; + }; + }; + }; + }; }; &pcie { pinctrl-names = "default"; pinctrl-0 = <&pcie_pins>; status = "okay"; + + slot0: pcie@0,0 { + reg = <0x0000 0 0 0 0>; + + radio0: mt7915@0,0 { + reg = <0x0000 0 0 0 0>; + + nvmem-cells = <&eeprom_factory_a0000>; + nvmem-cell-names = "eeprom"; + }; + }; }; &pcie_phy { diff --git a/target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts b/target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts index 891d56853b2..957d8deebb1 100644 --- a/target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts +++ b/target/linux/mediatek/dts/mt7986a-asus-tuf-ax6000.dts @@ -70,6 +70,16 @@ label = "blue:cover"; gpios = <&pio 20 GPIO_ACTIVE_HIGH>; }; + + cover-red { + label = "red:cover"; + gpios = <&pio 21 GPIO_ACTIVE_HIGH>; + }; + + cover-green { + label = "green:cover"; + gpios = <&pio 22 GPIO_ACTIVE_HIGH>; + }; }; reg_3p3v: regulator-3p3v { diff --git a/target/linux/mediatek/dts/mt7986a-smartrg-bonanza-peak.dtsi b/target/linux/mediatek/dts/mt7986a-smartrg-bonanza-peak.dtsi index 038a76ad73c..deab53dc45f 100644 --- a/target/linux/mediatek/dts/mt7986a-smartrg-bonanza-peak.dtsi +++ b/target/linux/mediatek/dts/mt7986a-smartrg-bonanza-peak.dtsi @@ -14,8 +14,7 @@ / { aliases { serial0 = &uart0; - ethernet0 = &gmac0; - ethernet1 = &gmac1; + label-mac-device = &gmac1; led-boot = &led_status_green; led-failsafe = &led_status_red; led-running = &led_status_white; @@ -188,16 +187,17 @@ gmac0: mac@0 { compatible = "mediatek,eth-mac"; reg = <0>; - + nvmem-cells = <&macaddr 1>; + nvmem-cell-names = "mac-address"; phy-mode = "2500base-x"; }; gmac1: mac@1 { - label = "wan"; - compatible = "mediatek,eth-mac"; reg = <1>; - + label = "wan"; + nvmem-cells = <&macaddr 0>; + nvmem-cell-names = "mac-address"; phy-mode = "2500base-x"; }; @@ -254,6 +254,47 @@ no-sd; no-sdio; status = "okay"; + + card@0 { + compatible = "mmc-card"; + reg = <0>; + + block { + compatible = "block-device"; + + partitions { + block-partition-factory { + partname = "factory"; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + + eeprom_factory_a0000: eeprom@a0000 { + reg = <0xa0000 0x1000>; + }; + }; + }; + + block-partition-mfginfo { + partname = "mfginfo"; + + nvmem-layout { + compatible = "adtran,mfginfo"; + + macaddr: mfg-mac { + #nvmem-cell-cells = <1>; + }; + }; + }; + }; + }; + }; }; &pcie { @@ -266,6 +307,9 @@ radio0: mt7915@0,0 { reg = <0x0000 0 0 0 0>; + + nvmem-cells = <&eeprom_factory_a0000>, <&macaddr 4>; + nvmem-cell-names = "eeprom", "mac-address"; }; }; }; @@ -275,9 +319,28 @@ }; &wifi { - status = "okay"; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; pinctrl-names = "default"; pinctrl-0 = <&wf_2g_5g_pins>; + #address-cells = <1>; + #size-cells = <0>; + + status = "okay"; + + band@0 { + /* 2.4 GHz */ + reg = <0>; + nvmem-cells = <&macaddr 2>; + nvmem-cell-names = "mac-address"; + }; + + band@1 { + /* lower 5 GHz */ + reg = <1>; + nvmem-cells = <&macaddr 3>; + nvmem-cell-names = "mac-address"; + }; }; &pio { diff --git a/target/linux/mediatek/dts/mt7988a-smartrg-mt-stuart.dtsi b/target/linux/mediatek/dts/mt7988a-smartrg-mt-stuart.dtsi index 93bbd0103bb..a3db288d274 100644 --- a/target/linux/mediatek/dts/mt7988a-smartrg-mt-stuart.dtsi +++ b/target/linux/mediatek/dts/mt7988a-smartrg-mt-stuart.dtsi @@ -15,8 +15,7 @@ / { aliases { serial0 = &uart0; - ethernet0 = &gmac0; - ethernet1 = &gmac1; + label-mac-device = &gmac1; led-boot = &led_sys_green; led-failsafe = &led_sys_blue; led-running = &led_sys_white; @@ -250,21 +249,30 @@ }; &gmac0 { + nvmem-cells = <&macaddr 1>; + nvmem-cell-names = "mac-address"; + status = "okay"; }; &gmac1 { + nvmem-cells = <&macaddr 0>; + nvmem-cell-names = "mac-address"; label = "wan"; - status = "okay"; phy-mode = "usxgmii"; + + status = "okay"; }; &gmac2 { + nvmem-cells = <&macaddr 1>; + nvmem-cell-names = "mac-address"; label = "lan1"; - status = "okay"; phy-mode = "usxgmii"; phy-connection-type = "usxgmii"; phy = <&phy8>; + + status = "okay"; }; &gsw_phy0 { @@ -433,7 +441,7 @@ reg = <2>; function = LED_FUNCTION_WAN; color = ; - active-low; + active-high; }; }; }; @@ -467,7 +475,7 @@ reg = <2>; function = LED_FUNCTION_LAN; color = ; - active-low; + active-high; }; }; }; @@ -513,6 +521,18 @@ }; }; }; + + block-partition-mfginfo { + partname = "mfginfo"; + + nvmem-layout { + compatible = "adtran,mfginfo"; + + macaddr: mfg-mac { + #nvmem-cell-cells = <1>; + }; + }; + }; }; }; }; @@ -532,6 +552,27 @@ nvmem-cells = <&eeprom_factory_0>; nvmem-cell-names = "eeprom"; ieee80211-freq-limit = <2400000 2500000>, <5170000 5835000>, <5945000 7125000>; + + band@0 { + /* 2.4 GHz */ + reg = <0>; + nvmem-cells = <&macaddr 4>; + nvmem-cell-names = "mac-address"; + }; + + band@1 { + /* 5 GHz */ + reg = <1>; + nvmem-cells = <&macaddr 10>; + nvmem-cell-names = "mac-address"; + }; + + band@2 { + /* 6 GHz */ + reg = <2>; + nvmem-cells = <&macaddr 6>; + nvmem-cell-names = "mac-address"; + }; }; }; }; diff --git a/target/linux/mediatek/dts/mt7988d-smartrg-SDG-8733A.dts b/target/linux/mediatek/dts/mt7988d-smartrg-SDG-8733A.dts index 54fbbea0ba4..b72ef48bea7 100644 --- a/target/linux/mediatek/dts/mt7988d-smartrg-SDG-8733A.dts +++ b/target/linux/mediatek/dts/mt7988d-smartrg-SDG-8733A.dts @@ -62,6 +62,8 @@ &gmac1 { label = "lan"; + nvmem-cells = <&macaddr 1>; + nvmem-cell-names = "mac-address"; phy-mode = "internal"; phy-connection-type = "internal"; phy = <&int_2p5g_phy>; @@ -69,6 +71,8 @@ &gmac2 { label = "wan"; + nvmem-cells = <&macaddr 0>; + nvmem-cell-names = "mac-address"; phy-mode = "usxgmii"; phy-connection-type = "usxgmii"; phy = <&phy8>; diff --git a/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi b/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi index 14c615b67c1..fae5d0ebfa8 100644 --- a/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi +++ b/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi @@ -349,14 +349,14 @@ ubi-volume-ubootenv { volname = "ubootenv"; nvmem-layout { - compatible = "u-boot,env-redundant-bool-layout"; + compatible = "u-boot,env-redundant-bool"; }; }; ubi-volume-ubootenv2 { volname = "ubootenv2"; nvmem-layout { - compatible = "u-boot,env-redundant-bool-layout"; + compatible = "u-boot,env-redundant-bool"; }; }; diff --git a/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtso b/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtso index b5a67c725bf..02ecedda72e 100644 --- a/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtso +++ b/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtso @@ -44,14 +44,14 @@ ubi-volume-ubootenv { volname = "ubootenv"; nvmem-layout { - compatible = "u-boot,env-redundant-bool-layout"; + compatible = "u-boot,env-redundant-bool"; }; }; ubi-volume-ubootenv2 { volname = "ubootenv2"; nvmem-layout { - compatible = "u-boot,env-redundant-bool-layout"; + compatible = "u-boot,env-redundant-bool"; }; }; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds index 1437a120f56..dad5c293dec 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -105,16 +105,16 @@ smartrg,sdg-8733a) ucidef_set_led_netdev "wan-orange" "WAN" "mdio-bus:08:orange:wan" "wan" "link_100 link_1000" ucidef_set_led_netdev "wan-white" "WAN" "mdio-bus:08:white:wan" "wan" "link_10000" ;; -wavlink,wl-wn586x3) - ucidef_set_led_netdev "lan-1" "lan-1" "blue:lan-1" "lan1" "link tx rx" - ucidef_set_led_netdev "lan-2" "lan-2" "blue:lan-2" "lan2" "link tx rx" - ucidef_set_led_netdev "wan" "wan" "blue:wan" "eth1" "link tx rx" - ;; tplink,re6000xd) ucidef_set_led_netdev "lan-1" "lan-1" "blue:lan-0" "lan1" "link tx rx" ucidef_set_led_netdev "lan-2" "lan-2" "blue:lan-1" "lan2" "link tx rx" ucidef_set_led_netdev "eth1" "lan-3" "blue:lan-2" "eth1" "link tx rx" ;; +wavlink,wl-wn586x3) + ucidef_set_led_netdev "lan-1" "lan-1" "blue:lan-1" "lan1" "link tx rx" + ucidef_set_led_netdev "lan-2" "lan-2" "blue:lan-2" "lan2" "link tx rx" + ucidef_set_led_netdev "wan" "wan" "blue:wan" "eth1" "link tx rx" + ;; xiaomi,mi-router-wr30u-stock|\ xiaomi,mi-router-wr30u-ubootmod) ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" "link tx rx" @@ -132,7 +132,7 @@ zyxel,ex5601-t0-ubootmod) ucidef_set_led_netdev "wan" "WAN" "green:inet" "eth1" "link tx rx" ucidef_set_led_netdev "wifi-24g" "WIFI-2.4G" "green:wifi24g" "phy0-ap0" "link tx rx" ucidef_set_led_netdev "wifi-5g" "WIFI-5G" "green:wifi5g" "phy1-ap0" "link tx rx" - ;; + ;; esac board_config_flush diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 74ee571bc02..af5c4ceafee 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -8,9 +8,6 @@ mediatek_setup_interfaces() local board="$1" case $board in - acelink,ew-7886cax) - ucidef_set_interface_lan "eth0" "dhcp" - ;; abt,asr3000|\ cmcc,rax3000m|\ h3c,magic-nx30-pro|\ @@ -18,6 +15,9 @@ mediatek_setup_interfaces() zbtlink,zbt-z8103ax) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" eth1 ;; + acelink,ew-7886cax) + ucidef_set_interface_lan "eth0" "dhcp" + ;; acer,predator-w6) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 game" eth1 ;; @@ -36,10 +36,16 @@ mediatek_setup_interfaces() netcore,n60|\ ruijie,rg-x60-pro|\ unielec,u7981-01*|\ - zbtlink,zbt-z8102ax) + zbtlink,zbt-z8102ax|\ + zyxel,ex5601-t0-stock|\ + zyxel,ex5601-t0-ubootmod) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" eth1 ;; - asus,tuf-ax6000) + asus,tuf-ax6000|\ + glinet,gl-mt6000|\ + tplink,tl-xdr4288|\ + tplink,tl-xdr6088|\ + tplink,tl-xtr8488) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5" eth1 ;; bananapi,bpi-r3) @@ -56,6 +62,13 @@ mediatek_setup_interfaces() comfast,cf-e393ax) ucidef_set_interfaces_lan_wan "lan1" eth1 ;; + cudy,ap3000outdoor-v1|\ + cudy,re3000-v1|\ + netgear,wax220|\ + ubnt,unifi-6-plus|\ + zyxel,nwa50ax-pro) + ucidef_set_interface_lan "eth0" + ;; cudy,m3000-v1|\ cudy,tr3000-v1|\ glinet,gl-mt2500|\ @@ -69,17 +82,11 @@ mediatek_setup_interfaces() dlink,aquila-pro-ai-m30-a1) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" internet ;; - glinet,gl-mt6000|\ - tplink,tl-xdr4288|\ - tplink,tl-xdr6088|\ - tplink,tl-xtr8488) - ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5" eth1 - ;; mediatek,mt7986a-rfb) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan6" "eth1 wan" ;; mediatek,mt7986b-rfb) - ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" eth1 + ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3 lan4" eth1 ;; mediatek,mt7988a-rfb) ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3 eth2" eth1 @@ -87,13 +94,6 @@ mediatek_setup_interfaces() mercusys,mr90x-v1) ucidef_set_interfaces_lan_wan "lan0 lan1 lan2" eth1 ;; - cudy,ap3000outdoor-v1|\ - cudy,re3000-v1|\ - netgear,wax220|\ - ubnt,unifi-6-plus|\ - zyxel,nwa50ax-pro) - ucidef_set_interface_lan "eth0" - ;; smartrg,sdg-8622|\ smartrg,sdg-8632|\ smartrg,sdg-8733a|\ @@ -115,10 +115,6 @@ mediatek_setup_interfaces() xiaomi,redmi-router-ax6000-ubootmod) ucidef_set_interfaces_lan_wan "lan2 lan3 lan4" wan ;; - zyxel,ex5601-t0-stock|\ - zyxel,ex5601-t0-ubootmod) - ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" eth1 - ;; *) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" wan ;; @@ -162,16 +158,6 @@ mediatek_setup_macs() wan_mac=$label_mac lan_mac=$(macaddr_add "$label_mac" 1) ;; - smartrg,sdg-8612|\ - smartrg,sdg-8614|\ - smartrg,sdg-8622|\ - smartrg,sdg-8632|\ - smartrg,sdg-8733|\ - smartrg,sdg-8734) - label_mac=$(mmc_get_mac_ascii mfginfo MFG_MAC) - wan_mac=$label_mac - lan_mac=$(macaddr_add "$label_mac" 1) - ;; xiaomi,mi-router-ax3000t|\ xiaomi,mi-router-ax3000t-ubootmod|\ xiaomi,mi-router-wr30u-stock|\ diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata index c6900e6ebd7..8456c462b63 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata @@ -7,21 +7,6 @@ board=$(board_name) case "$FIRMWARE" in -"mediatek/mt7915_eeprom.bin") - case "$board" in - smartrg,sdg-8622) - caldata_extract_mmc "factory" 0xa0000 0x1000 - ;; - esac - ;; -"mediatek/mt7916_eeprom.bin") - case "$board" in - acer,predator-w6|\ - smartrg,sdg-8632) - caldata_extract_mmc "factory" 0xa0000 0x1000 - ;; - esac - ;; "mediatek/mt7981_eeprom_mt7976_dbdc.bin") case "$board" in ubnt,unifi-6-plus) @@ -36,19 +21,6 @@ case "$FIRMWARE" in ln -sf /tmp/tp_data/MT7986_EEPROM.bin \ /lib/firmware/$FIRMWARE ;; - smartrg,sdg-8612|\ - smartrg,sdg-8614|\ - smartrg,sdg-8622|\ - smartrg,sdg-8632) - caldata_extract_mmc "factory" 0x0 0x1000 - ;; - esac - ;; -"mediatek/mt7986_eeprom_mt7976.bin") - case "$board" in - acer,predator-w6) - caldata_extract_mmc "factory" 0x0 0x1000 - ;; esac ;; *) diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 3600e323409..3042858353a 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -139,23 +139,6 @@ case "$board" in [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress ;; - smartrg,sdg-8612|\ - smartrg,sdg-8614|\ - smartrg,sdg-8622|\ - smartrg,sdg-8632) - addr=$(mmc_get_mac_ascii mfginfo MFG_MAC) - [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress - [ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress - [ "$PHYNBR" = "2" ] && macaddr_add $addr 4 > /sys${DEVPATH}/macaddress - ;; - smartrg,sdg-8733|\ - smartrg,sdg-8733a|\ - smartrg,sdg-8734) - addr=$(mmc_get_mac_ascii mfginfo MFG_MAC) - [ "$PHYNBR" = "0" ] && macaddr_add $addr 4 > /sys${DEVPATH}/macaddress - [ "$PHYNBR" = "1" ] && macaddr_add $addr a > /sys${DEVPATH}/macaddress - [ "$PHYNBR" = "2" ] && macaddr_add $addr 6 > /sys${DEVPATH}/macaddress - ;; tplink,tl-xdr4288|\ tplink,tl-xdr6086|\ tplink,tl-xdr6088) diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh b/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh index 65bd5178242..0497d7dfa24 100644 --- a/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh +++ b/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh @@ -22,26 +22,6 @@ preinit_set_mac_address() { addr=$(get_mac_binary "/tmp/tp_data/default-mac" 0) ip link set dev eth1 address "$(macaddr_add $addr 1)" ;; - smartrg,sdg-8612|\ - smartrg,sdg-8614|\ - smartrg,sdg-8733|\ - smartrg,sdg-8734) - addr=$(mmc_get_mac_ascii mfginfo MFG_MAC) - lan_addr=$(macaddr_add $addr 1) - ip link set dev wan address "$addr" - ip link set dev eth0 address "$lan_addr" - ip link set dev lan1 address "$lan_addr" - ip link set dev lan2 address "$lan_addr" - ip link set dev lan3 address "$lan_addr" - ip link set dev lan4 address "$lan_addr" - ;; - smartrg,sdg-8622|\ - smartrg,sdg-8632|\ - smartrg,sdg-8733a) - addr=$(mmc_get_mac_ascii mfginfo MFG_MAC) - ip link set dev wan address "$addr" - ip link set dev lan address "$(macaddr_add $addr 1)" - ;; *) ;; esac diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index 429728392a1..edc04565663 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -131,13 +131,6 @@ platform_do_upgrade() { EMMC_ROOT_DEV="$(cmdline_get_var root)" emmc_do_upgrade "$1" ;; - xiaomi,mi-router-ax3000t|\ - xiaomi,mi-router-wr30u-stock|\ - xiaomi,redmi-router-ax6000-stock) - CI_KERN_UBIPART=ubi_kernel - CI_ROOT_UBIPART=ubi - nand_do_upgrade "$1" - ;; unielec,u7981-01*) local rootdev="$(cmdline_get_var root)" rootdev="${rootdev##*/}" @@ -155,6 +148,13 @@ platform_do_upgrade() { ;; esac ;; + xiaomi,mi-router-ax3000t|\ + xiaomi,mi-router-wr30u-stock|\ + xiaomi,redmi-router-ax6000-stock) + CI_KERN_UBIPART=ubi_kernel + CI_ROOT_UBIPART=ubi + nand_do_upgrade "$1" + ;; *) nand_do_upgrade "$1" ;; diff --git a/target/linux/mediatek/filogic/config-6.6 b/target/linux/mediatek/filogic/config-6.6 index 818bcfa081e..7cf045ade2a 100644 --- a/target/linux/mediatek/filogic/config-6.6 +++ b/target/linux/mediatek/filogic/config-6.6 @@ -313,6 +313,7 @@ CONFIG_NR_CPUS=4 CONFIG_NVMEM=y CONFIG_NVMEM_BLOCK=y CONFIG_NVMEM_LAYOUTS=y +CONFIG_NVMEM_LAYOUT_ADTRAN=y CONFIG_NVMEM_MTK_EFUSE=y CONFIG_NVMEM_SYSFS=y CONFIG_OF=y diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 3e10003e4c2..83f1336444d 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -83,6 +83,10 @@ define Build/append-gl-metadata } endef +define Build/append-openwrt-one-eeprom + dd if=$(STAGING_DIR_IMAGE)/mt7981_eeprom_mt7976_dbdc.bin >> $@ +endef + define Build/zyxel-nwa-fit-filogic $(TOPDIR)/scripts/mkits-zyxel-fit-filogic.sh \ $@.its $@ "80 e1 ff ff ff ff ff ff ff ff" @@ -1047,10 +1051,6 @@ define Device/openembed_som7981 endef TARGET_DEVICES += openembed_som7981 -define Build/append-openwrt-one-eeprom - dd if=$(STAGING_DIR_IMAGE)/mt7981_eeprom_mt7976_dbdc.bin >> $@ -endef - define Device/openwrt_one DEVICE_VENDOR := OpenWrt DEVICE_MODEL := One @@ -1404,7 +1404,6 @@ define Device/yuncore_ax835 endef TARGET_DEVICES += yuncore_ax835 - define Device/zbtlink_zbt-z8102ax DEVICE_VENDOR := Zbtlink DEVICE_MODEL := ZBT-Z8102AX diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk index e1d9a09c643..9f5fdc86888 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -52,6 +52,17 @@ define Build/mt7622-gpt rm $@.tmp endef +define Device/smartrg_sdg-841-t6 + DEVICE_VENDOR := Adtran + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := e2fsprogs f2fsck mkf2fs + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + DEVICE_MODEL := SDG-841-t6 + DEVICE_DTS := mt7622-smartrg-SDG-841-t6 + DEVICE_PACKAGES += kmod-mt7915e kmod-mt7915-firmware +endef +TARGET_DEVICES += smartrg_sdg-841-t6 + define Device/bananapi_bpi-r64 DEVICE_VENDOR := Bananapi DEVICE_MODEL := BPi-R64 diff --git a/target/linux/mediatek/mt7622/base-files/etc/board.d/01_leds b/target/linux/mediatek/mt7622/base-files/etc/board.d/01_leds index 7cb54186fd1..51d483b31fc 100644 --- a/target/linux/mediatek/mt7622/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/mt7622/base-files/etc/board.d/01_leds @@ -11,6 +11,12 @@ linksys,e8450-ubi|\ netgear,wax206) ucidef_set_led_netdev "wan" "WAN" "inet:blue" "wan" ;; +smartrg,sdg-841-t6) + ucidef_set_led_netdev "lan-green" "LAN" "mdio-bus:00:green:lan" "lan" "link_1000" + ucidef_set_led_netdev "lan-amber" "LAN" "mdio-bus:00:amber:lan" "lan" "link_10 link_100" + ucidef_set_led_netdev "wan-green" "WAN" "mdio-bus:05:green:wan" "wan" "link_1000 link_2500" + ucidef_set_led_netdev "wan-amber" "WAN" "mdio-bus:05:amber:wan" "wan" "link_10 link_100" + ;; xiaomi,redmi-router-ax6s) ucidef_set_led_netdev "wan" "WAN" "blue:net" "wan" ;; diff --git a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network index 6bda6e11f37..ff4ff0c480c 100644 --- a/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/mt7622/base-files/etc/board.d/02_network @@ -20,6 +20,9 @@ mediatek_setup_interfaces() ucidef_add_switch "switch0" \ "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6u@eth0" "5u@eth1" ;; + smartrg,sdg-841-t6) + ucidef_set_interfaces_lan_wan lan wan + ;; ubnt,unifi-6-lr*) ucidef_set_interface_lan "eth0" ;; diff --git a/target/linux/mediatek/mt7622/base-files/lib/preinit/04_set_netdev_label b/target/linux/mediatek/mt7622/base-files/lib/preinit/04_set_netdev_label new file mode 100644 index 00000000000..110e023b962 --- /dev/null +++ b/target/linux/mediatek/mt7622/base-files/lib/preinit/04_set_netdev_label @@ -0,0 +1,15 @@ +set_netdev_labels() { + local dir + local label + local netdev + + for dir in /sys/class/net/*; do + [ -r "$dir/of_node/label" ] || continue + read -r label < "$dir/of_node/label" + netdev="${dir##*/}" + [ "$netdev" = "$label" ] && continue + ip link set "$netdev" name "$label" + done +} + +boot_hook_add preinit_main set_netdev_labels diff --git a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh index 61025fb380d..2607f170e05 100755 --- a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh @@ -43,6 +43,11 @@ platform_do_upgrade() { fi default_do_upgrade "$1" ;; + smartrg,sdg-841-t6) + CI_KERNPART="boot" + CI_ROOTPART="res1" + emmc_do_upgrade "$1" + ;; *) default_do_upgrade "$1" ;; @@ -67,6 +72,7 @@ platform_check_image() { elecom,wrc-x3200gst3|\ mediatek,mt7622-rfb1-ubi|\ netgear,wax206|\ + smartrg,sdg-841-t6|\ totolink,a8000ru) nand_do_platform_check "$board" "$1" return $? @@ -90,5 +96,8 @@ platform_copy_config() { emmc_copy_config fi ;; + smartrg,sdg-841-t6) + emmc_copy_config + ;; esac } diff --git a/target/linux/mediatek/mt7622/config-6.6 b/target/linux/mediatek/mt7622/config-6.6 index cf445b2b719..138eb2aaca0 100644 --- a/target/linux/mediatek/mt7622/config-6.6 +++ b/target/linux/mediatek/mt7622/config-6.6 @@ -213,6 +213,7 @@ CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT=y CONFIG_HAS_IOPORT_MAP=y +CONFIG_HWMON=y CONFIG_HW_RANDOM=y CONFIG_HW_RANDOM_MTK=y CONFIG_I2C=y @@ -222,6 +223,7 @@ CONFIG_I2C_MT65XX=y CONFIG_ICPLUS_PHY=y CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 CONFIG_INITRAMFS_SOURCE="" +CONFIG_INTEL_XWAY_PHY=y CONFIG_IRQCHIP=y CONFIG_IRQ_DOMAIN=y CONFIG_IRQ_DOMAIN_HIERARCHY=y @@ -230,7 +232,7 @@ CONFIG_IRQ_TIME_ACCOUNTING=y CONFIG_IRQ_WORK=y CONFIG_JBD2=y CONFIG_JUMP_LABEL=y -# CONFIG_LEDS_SMARTRG_LED is not set +CONFIG_LEDS_SMARTRG_LED=y CONFIG_LIBFDT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y CONFIG_LOCK_SPIN_ON_OWNER=y @@ -313,7 +315,9 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=2 CONFIG_NVMEM=y +CONFIG_NVMEM_BLOCK=y CONFIG_NVMEM_LAYOUTS=y +CONFIG_NVMEM_LAYOUT_ADTRAN=y CONFIG_NVMEM_MTK_EFUSE=y CONFIG_NVMEM_SYSFS=y CONFIG_OF=y @@ -464,6 +468,7 @@ CONFIG_THERMAL_GOV_BANG_BANG=y CONFIG_THERMAL_GOV_FAIR_SHARE=y CONFIG_THERMAL_GOV_STEP_WISE=y CONFIG_THERMAL_GOV_USER_SPACE=y +CONFIG_THERMAL_HWMON=y CONFIG_THERMAL_OF=y CONFIG_THERMAL_WRITABLE_TRIPS=y CONFIG_THREAD_INFO_IN_TASK=y diff --git a/target/linux/mediatek/mt7623/config-6.6 b/target/linux/mediatek/mt7623/config-6.6 index bb00bee8f31..e34822d9922 100644 --- a/target/linux/mediatek/mt7623/config-6.6 +++ b/target/linux/mediatek/mt7623/config-6.6 @@ -436,6 +436,7 @@ CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=4 CONFIG_NVMEM=y CONFIG_NVMEM_LAYOUTS=y +# CONFIG_NVMEM_LAYOUT_ADTRAN is not set CONFIG_NVMEM_MTK_EFUSE=y # CONFIG_NVMEM_SPMI_SDAM is not set CONFIG_NVMEM_SYSFS=y diff --git a/target/linux/mediatek/mt7629/config-6.6 b/target/linux/mediatek/mt7629/config-6.6 index 1748efab775..81c07a54922 100644 --- a/target/linux/mediatek/mt7629/config-6.6 +++ b/target/linux/mediatek/mt7629/config-6.6 @@ -239,6 +239,7 @@ CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=2 CONFIG_NVMEM=y CONFIG_NVMEM_LAYOUTS=y +# CONFIG_NVMEM_LAYOUT_ADTRAN is not set # CONFIG_NVMEM_MTK_EFUSE is not set CONFIG_NVMEM_SYSFS=y CONFIG_OF=y diff --git a/target/linux/mediatek/patches-6.6/450-nvmem-add-layout-for-Adtran-devices.patch b/target/linux/mediatek/patches-6.6/450-nvmem-add-layout-for-Adtran-devices.patch new file mode 100644 index 00000000000..496fc6c53f7 --- /dev/null +++ b/target/linux/mediatek/patches-6.6/450-nvmem-add-layout-for-Adtran-devices.patch @@ -0,0 +1,191 @@ +From c22bc82183c2dea64919f975473ec518738baa3e Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Wed, 12 Jul 2023 13:38:35 +0100 +Subject: [PATCH] nvmem: add layout for Adtran devices + +Adtran stores unique factory data on GPT partitions on the eMMC. +Using blk-nvmem the 'mfginfo' partition gets exposes as NVMEM provider. + +Add layout driver to parse mfginfo, mainly to provide MAC addresses to +Ethernet and wireless interfaces. + +Variable names are converted to lower-case and '_' is replaced with '-' +in order to comply with the device tree node naming convention. +The main MAC address always ends on a 0 and up to 16 addresses are +alocated for each device to use for various interfaces. + +Implement post-processing function for 'MFG_MAC' variable ('mfg-mac' +node name in device tree) adding the nvmem cell index to the least +significant digit of the MAC address. + +Signed-off-by: Daniel Golle +--- + drivers/nvmem/layouts/Kconfig | 9 +++ + drivers/nvmem/layouts/Makefile | 1 + + drivers/nvmem/layouts/adtran.c | 135 +++++++++++++++++++++++++++++++++ + 3 files changed, 145 insertions(+) + create mode 100644 drivers/nvmem/layouts/adtran.c + +--- a/drivers/nvmem/layouts/Kconfig ++++ b/drivers/nvmem/layouts/Kconfig +@@ -8,6 +8,15 @@ if NVMEM_LAYOUTS + + menu "Layout Types" + ++config NVMEM_LAYOUT_ADTRAN ++ tristate "Adtran mfginfo layout support" ++ select GENERIC_NET_UTILS ++ help ++ Say Y here if you want to support the layout used by Adtran for ++ mfginfo. ++ ++ If unsure, say N. ++ + config NVMEM_LAYOUT_SL28_VPD + tristate "Kontron sl28 VPD layout support" + select CRC8 +--- a/drivers/nvmem/layouts/Makefile ++++ b/drivers/nvmem/layouts/Makefile +@@ -6,3 +6,4 @@ + obj-$(CONFIG_NVMEM_LAYOUT_SL28_VPD) += sl28vpd.o + obj-$(CONFIG_NVMEM_LAYOUT_ONIE_TLV) += onie-tlv.o + obj-$(CONFIG_NVMEM_LAYOUT_U_BOOT_ENV) += u-boot-env.o ++obj-$(CONFIG_NVMEM_LAYOUT_ADTRAN) += adtran.o +--- /dev/null ++++ b/drivers/nvmem/layouts/adtran.c +@@ -0,0 +1,135 @@ ++// SPDX-License-Identifier: GPL-2.0 ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* ++ * Adtran devices usually come with a main MAC address ending on 0 and ++ * hence may have up to 16 MAC addresses per device. ++ * The main MAC address is stored as variable MFG_MAC in ASCII format. ++ */ ++static int adtran_mac_address_pp(void *priv, const char *id, int index, ++ unsigned int offset, void *buf, ++ size_t bytes) ++{ ++ u8 mac[ETH_ALEN]; ++ ++ if (WARN_ON(bytes != 3 * ETH_ALEN - 1)) ++ return -EINVAL; ++ ++ if (!mac_pton(buf, mac)) ++ return -EINVAL; ++ ++ if (index) ++ eth_addr_add(mac, index); ++ ++ ether_addr_copy(buf, mac); ++ ++ return 0; ++} ++ ++static int adtran_add_cells(struct nvmem_layout *layout) ++{ ++ struct nvmem_device *nvmem = layout->nvmem; ++ struct nvmem_cell_info info; ++ struct device_node *layout_np; ++ char mfginfo[1024], *c, *t, *p; ++ int ret = -EINVAL; ++ ++ ret = nvmem_device_read(nvmem, 0, sizeof(mfginfo), mfginfo); ++ if (ret < 0) ++ return ret; ++ else if (ret != sizeof(mfginfo)) ++ return -EIO; ++ ++ layout_np = of_nvmem_layout_get_container(nvmem); ++ if (!layout_np) ++ return -ENOENT; ++ ++ c = mfginfo; ++ while (*c != 0xff) { ++ memset(&info, 0, sizeof(info)); ++ if (*c == '#') ++ goto nextline; ++ ++ t = strchr(c, '='); ++ if (!t) ++ goto nextline; ++ ++ *t = '\0'; ++ ++t; ++ info.offset = t - mfginfo; ++ /* process variable name: convert to lower-case, '_' -> '-' */ ++ p = c; ++ do { ++ *p = tolower(*p); ++ if (*p == '_') ++ *p = '-'; ++ } while (*++p); ++ info.name = c; ++ c = strchr(t, 0xa); /* find newline */ ++ if (!c) ++ break; ++ ++ info.bytes = c - t; ++ if (!strcmp(info.name, "mfg-mac")) { ++ info.raw_len = info.bytes; ++ info.bytes = ETH_ALEN; ++ info.read_post_process = adtran_mac_address_pp; ++ } ++ ++ info.np = of_get_child_by_name(layout_np, info.name); ++ ret = nvmem_add_one_cell(nvmem, &info); ++ if (ret) ++ break; ++ ++ ++c; ++ continue; ++ ++nextline: ++ c = strchr(c, 0xa); /* find newline */ ++ if (!c) ++ break; ++ ++c; ++ } ++ ++ of_node_put(layout_np); ++ ++ return ret; ++} ++ ++static int adtran_probe(struct nvmem_layout *layout) ++{ ++ layout->add_cells = adtran_add_cells; ++ ++ return nvmem_layout_register(layout); ++} ++ ++static void adtran_remove(struct nvmem_layout *layout) ++{ ++ nvmem_layout_unregister(layout); ++} ++ ++static const struct of_device_id adtran_of_match_table[] = { ++ { .compatible = "adtran,mfginfo" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, adtran_of_match_table); ++ ++static struct nvmem_layout_driver adtran_layout = { ++ .driver = { ++ .owner = THIS_MODULE, ++ .name = "adtran-layout", ++ .of_match_table = adtran_of_match_table, ++ }, ++ .probe = adtran_probe, ++ .remove = adtran_remove, ++}; ++module_nvmem_layout_driver(adtran_layout); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Daniel Golle "); ++MODULE_DESCRIPTION("NVMEM layout driver for Adtran mfginfo"); diff --git a/target/linux/mediatek/patches-6.6/732-net-phy-mxl-gpy-don-t-use-SGMII-AN-if-using-phylink.patch b/target/linux/mediatek/patches-6.6/732-net-phy-mxl-gpy-don-t-use-SGMII-AN-if-using-phylink.patch index 99d0a0dbc20..252263ad118 100644 --- a/target/linux/mediatek/patches-6.6/732-net-phy-mxl-gpy-don-t-use-SGMII-AN-if-using-phylink.patch +++ b/target/linux/mediatek/patches-6.6/732-net-phy-mxl-gpy-don-t-use-SGMII-AN-if-using-phylink.patch @@ -14,7 +14,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/mxl-gpy.c +++ b/drivers/net/phy/mxl-gpy.c -@@ -385,8 +385,11 @@ static bool gpy_2500basex_chk(struct phy +@@ -402,8 +402,11 @@ static bool gpy_2500basex_chk(struct phy phydev->speed = SPEED_2500; phydev->interface = PHY_INTERFACE_MODE_2500BASEX; @@ -28,7 +28,7 @@ Signed-off-by: Daniel Golle return true; } -@@ -437,6 +440,14 @@ static int gpy_config_aneg(struct phy_de +@@ -454,6 +457,14 @@ static int gpy_config_aneg(struct phy_de u32 adv; int ret; @@ -43,7 +43,7 @@ Signed-off-by: Daniel Golle if (phydev->autoneg == AUTONEG_DISABLE) { /* Configure half duplex with genphy_setup_forced, * because genphy_c45_pma_setup_forced does not support. -@@ -559,6 +570,8 @@ static int gpy_update_interface(struct p +@@ -576,6 +587,8 @@ static int gpy_update_interface(struct p switch (phydev->speed) { case SPEED_2500: phydev->interface = PHY_INTERFACE_MODE_2500BASEX; @@ -52,7 +52,7 @@ Signed-off-by: Daniel Golle ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL, VSPEC1_SGMII_CTRL_ANEN, 0); if (ret < 0) { -@@ -572,7 +585,7 @@ static int gpy_update_interface(struct p +@@ -589,7 +602,7 @@ static int gpy_update_interface(struct p case SPEED_100: case SPEED_10: phydev->interface = PHY_INTERFACE_MODE_SGMII; diff --git a/target/linux/mediatek/patches-6.6/733-01-net-phy-mediatek-Re-organize-MediaTek-ethernet-phy-d.patch b/target/linux/mediatek/patches-6.6/733-01-net-phy-mediatek-Re-organize-MediaTek-ethernet-phy-d.patch index 3ec756bb4b0..cf8e5cd38a9 100644 --- a/target/linux/mediatek/patches-6.6/733-01-net-phy-mediatek-Re-organize-MediaTek-ethernet-phy-d.patch +++ b/target/linux/mediatek/patches-6.6/733-01-net-phy-mediatek-Re-organize-MediaTek-ethernet-phy-d.patch @@ -1,14 +1,15 @@ -From c14e7c954fd752fbb3da17a8bcf65cd9dbf41186 Mon Sep 17 00:00:00 2001 +From 656f5fdeb6ee6fa95c28cab3b535e2e09ef59c57 Mon Sep 17 00:00:00 2001 From: "SkyLake.Huang" -Date: Mon, 1 Jul 2024 18:54:05 +0800 -Subject: [PATCH 01/13] net: phy: mediatek: Re-organize MediaTek ethernet phy +Date: Fri, 4 Oct 2024 18:24:05 +0800 +Subject: [PATCH 1/9] net: phy: mediatek: Re-organize MediaTek ethernet phy drivers Re-organize MediaTek ethernet phy driver files and get ready to integrate -some common functions and add new 2.5G phy driver. +some common functions (and add new 2.5G phy driver). mtk-ge.c: MT7530 Gphy on MT7621 & MT7531 Gphy mtk-ge-soc.c: Built-in Gphy on MT7981 & Built-in switch Gphy on MT7988 -mtk-2p5ge.c: Planned for built-in 2.5G phy on MT7988 +(mtk-2p5ge.c: Planned for built-in 2.5G phy on MT7988 + --> in another patchset) Signed-off-by: SkyLake.Huang --- @@ -18,7 +19,7 @@ Signed-off-by: SkyLake.Huang drivers/net/phy/mediatek/Makefile | 3 +++ .../mtk-ge-soc.c} | 0 .../phy/{mediatek-ge.c => mediatek/mtk-ge.c} | 0 - 7 files changed, 29 insertions(+), 20 deletions(-) + 6 files changed, 27 insertions(+), 18 deletions(-) create mode 100644 drivers/net/phy/mediatek/Kconfig create mode 100644 drivers/net/phy/mediatek/Makefile rename drivers/net/phy/{mediatek-ge-soc.c => mediatek/mtk-ge-soc.c} (100%) diff --git a/target/linux/mediatek/patches-6.6/733-02-net-phy-mediatek-Fix-spelling-errors-and-rearrange-v.patch b/target/linux/mediatek/patches-6.6/733-02-net-phy-mediatek-Fix-spelling-errors-and-rearrange-v.patch index 901949fe9f2..ed68e97dbbe 100644 --- a/target/linux/mediatek/patches-6.6/733-02-net-phy-mediatek-Fix-spelling-errors-and-rearrange-v.patch +++ b/target/linux/mediatek/patches-6.6/733-02-net-phy-mediatek-Fix-spelling-errors-and-rearrange-v.patch @@ -1,7 +1,7 @@ -From 12054d38fc55adbfa2b40299ad8af3449d882ee2 Mon Sep 17 00:00:00 2001 +From 61bcabdb69418215ea05bdc48cb88459d757f505 Mon Sep 17 00:00:00 2001 From: "SkyLake.Huang" -Date: Mon, 1 Jul 2024 18:54:06 +0800 -Subject: [PATCH 02/13] net: phy: mediatek: Fix spelling errors and rearrange +Date: Fri, 4 Oct 2024 18:24:06 +0800 +Subject: [PATCH 2/9] net: phy: mediatek: Fix spelling errors and rearrange variables This patch fixes spelling errors which comes from mediatek-ge-soc.c and diff --git a/target/linux/mediatek/patches-6.6/733-03-net-phy-mediatek-Move-LED-helper-functions-into-mtk-.patch b/target/linux/mediatek/patches-6.6/733-03-net-phy-mediatek-Move-LED-helper-functions-into-mtk-.patch index 9e6ae4b1360..61bde761f0e 100644 --- a/target/linux/mediatek/patches-6.6/733-03-net-phy-mediatek-Move-LED-helper-functions-into-mtk-.patch +++ b/target/linux/mediatek/patches-6.6/733-03-net-phy-mediatek-Move-LED-helper-functions-into-mtk-.patch @@ -1,7 +1,7 @@ -From 434e41555c45ec10b19320024163bb009da168bc Mon Sep 17 00:00:00 2001 +From 16bbd4ecb67ec1899ad8aa1eb1219a6d576cbaaf Mon Sep 17 00:00:00 2001 From: "SkyLake.Huang" -Date: Mon, 1 Jul 2024 18:54:07 +0800 -Subject: [PATCH 03/13] net: phy: mediatek: Move LED helper functions into mtk +Date: Fri, 4 Oct 2024 18:24:07 +0800 +Subject: [PATCH 3/9] net: phy: mediatek: Move LED helper functions into mtk phy lib This patch creates mtk-phy-lib.c & mtk-phy.h and integrates mtk-ge-soc.c's @@ -15,7 +15,7 @@ Signed-off-by: SkyLake.Huang drivers/net/phy/mediatek/mtk-ge-soc.c | 262 +++---------------------- drivers/net/phy/mediatek/mtk-phy-lib.c | 251 +++++++++++++++++++++++ drivers/net/phy/mediatek/mtk.h | 82 ++++++++ - 6 files changed, 368 insertions(+), 235 deletions(-) + 5 files changed, 366 insertions(+), 235 deletions(-) create mode 100644 drivers/net/phy/mediatek/mtk-phy-lib.c create mode 100644 drivers/net/phy/mediatek/mtk.h diff --git a/target/linux/mediatek/patches-6.6/733-04-net-phy-mediatek-Improve-readability-of-mtk-phy-lib..patch b/target/linux/mediatek/patches-6.6/733-04-net-phy-mediatek-Improve-readability-of-mtk-phy-lib..patch index 717dc890e3f..78413d28ead 100644 --- a/target/linux/mediatek/patches-6.6/733-04-net-phy-mediatek-Improve-readability-of-mtk-phy-lib..patch +++ b/target/linux/mediatek/patches-6.6/733-04-net-phy-mediatek-Improve-readability-of-mtk-phy-lib..patch @@ -1,7 +1,7 @@ -From 2783929879854d5750ba82e2e203663313362abb Mon Sep 17 00:00:00 2001 +From 2b118202583eb05a1799d435d2dce974dc3f5b16 Mon Sep 17 00:00:00 2001 From: "SkyLake.Huang" -Date: Mon, 1 Jul 2024 18:54:08 +0800 -Subject: [PATCH 04/13] net: phy: mediatek: Improve readability of +Date: Fri, 4 Oct 2024 18:24:08 +0800 +Subject: [PATCH 4/9] net: phy: mediatek: Improve readability of mtk-phy-lib.c's mtk_phy_led_hw_ctrl_set() This patch removes parens around TRIGGER_NETDEV_RX/TRIGGER_NETDEV_TX in diff --git a/target/linux/mediatek/patches-6.6/733-05-net-phy-mediatek-Integrate-read-write-page-helper-fu.patch b/target/linux/mediatek/patches-6.6/733-05-net-phy-mediatek-Integrate-read-write-page-helper-fu.patch index 4a112a202c9..9dd9f7d99da 100644 --- a/target/linux/mediatek/patches-6.6/733-05-net-phy-mediatek-Integrate-read-write-page-helper-fu.patch +++ b/target/linux/mediatek/patches-6.6/733-05-net-phy-mediatek-Integrate-read-write-page-helper-fu.patch @@ -1,7 +1,7 @@ -From 58c1270423ab48464cdc31ef71ffe7f5b2441961 Mon Sep 17 00:00:00 2001 +From 59e7082cb8c8e89bceb44cc60df156d818c8da96 Mon Sep 17 00:00:00 2001 From: "SkyLake.Huang" -Date: Mon, 1 Jul 2024 18:54:09 +0800 -Subject: [PATCH 05/13] net: phy: mediatek: Integrate read/write page helper +Date: Fri, 4 Oct 2024 18:24:09 +0800 +Subject: [PATCH 5/9] net: phy: mediatek: Integrate read/write page helper functions This patch integrates read/write page helper functions as MTK phy lib. diff --git a/target/linux/mediatek/patches-6.6/733-06-net-phy-mediatek-Hook-LED-helper-functions-in-mtk-ge.patch b/target/linux/mediatek/patches-6.6/733-06-net-phy-mediatek-Hook-LED-helper-functions-in-mtk-ge.patch index 485e2621340..9f6dac9431b 100644 --- a/target/linux/mediatek/patches-6.6/733-06-net-phy-mediatek-Hook-LED-helper-functions-in-mtk-ge.patch +++ b/target/linux/mediatek/patches-6.6/733-06-net-phy-mediatek-Hook-LED-helper-functions-in-mtk-ge.patch @@ -1,8 +1,7 @@ -From 9403f1d54598ae56386a8bf47a5b6b34c884e4f5 Mon Sep 17 00:00:00 2001 +From 5b605457b93d0979ab623ef2aa6eb456c46e511c Mon Sep 17 00:00:00 2001 From: "SkyLake.Huang" -Date: Mon, 1 Jul 2024 18:54:10 +0800 -Subject: [PATCH 06/13] net: phy: mediatek: Hook LED helper functions in - mtk-ge.c +Date: Fri, 4 Oct 2024 18:24:10 +0800 +Subject: [PATCH 6/9] net: phy: mediatek: Hook LED helper functions in mtk-ge.c We have mtk-phy-lib.c now so that we can use LED helper functions in mtk-ge.c(mt7531 part). It also means that mt7531/mt7981/mt7988's @@ -83,14 +82,14 @@ Signed-off-by: SkyLake.Huang +} + +static const unsigned long supported_triggers = -+ (BIT(TRIGGER_NETDEV_FULL_DUPLEX) | -+ BIT(TRIGGER_NETDEV_HALF_DUPLEX) | -+ BIT(TRIGGER_NETDEV_LINK) | -+ BIT(TRIGGER_NETDEV_LINK_10) | -+ BIT(TRIGGER_NETDEV_LINK_100) | -+ BIT(TRIGGER_NETDEV_LINK_1000) | -+ BIT(TRIGGER_NETDEV_RX) | -+ BIT(TRIGGER_NETDEV_TX)); ++ BIT(TRIGGER_NETDEV_FULL_DUPLEX) | ++ BIT(TRIGGER_NETDEV_HALF_DUPLEX) | ++ BIT(TRIGGER_NETDEV_LINK) | ++ BIT(TRIGGER_NETDEV_LINK_10) | ++ BIT(TRIGGER_NETDEV_LINK_100) | ++ BIT(TRIGGER_NETDEV_LINK_1000) | ++ BIT(TRIGGER_NETDEV_RX) | ++ BIT(TRIGGER_NETDEV_TX); + +static int mt753x_phy_led_hw_is_supported(struct phy_device *phydev, u8 index, + unsigned long rules) diff --git a/target/linux/mediatek/patches-6.6/733-07-net-phy-mediatek-add-MT7530-MT7531-s-PHY-ID-macros.patch b/target/linux/mediatek/patches-6.6/733-07-net-phy-mediatek-add-MT7530-MT7531-s-PHY-ID-macros.patch index bfdf864f8d5..7ea81612e3c 100644 --- a/target/linux/mediatek/patches-6.6/733-07-net-phy-mediatek-add-MT7530-MT7531-s-PHY-ID-macros.patch +++ b/target/linux/mediatek/patches-6.6/733-07-net-phy-mediatek-add-MT7530-MT7531-s-PHY-ID-macros.patch @@ -1,7 +1,7 @@ -From 51ee83602dbb84716180d9b6e43f6bebb0c2d7bd Mon Sep 17 00:00:00 2001 +From c5ff7bece642dbba601be89e70f78ff037ca084f Mon Sep 17 00:00:00 2001 From: "SkyLake.Huang" -Date: Mon, 1 Jul 2024 18:54:11 +0800 -Subject: [PATCH 07/13] net: phy: mediatek: add MT7530 & MT7531's PHY ID macros +Date: Fri, 4 Oct 2024 18:24:11 +0800 +Subject: [PATCH 7/9] net: phy: mediatek: add MT7530 & MT7531's PHY ID macros This patch adds MT7530 & MT7531's PHY ID macros in mtk-ge.c so that it follows the same rule of mtk-ge-soc.c. diff --git a/target/linux/mediatek/patches-6.6/733-08-net-phy-mediatek-Change-mtk-ge-soc.c-line-wrapping.patch b/target/linux/mediatek/patches-6.6/733-08-net-phy-mediatek-Change-mtk-ge-soc.c-line-wrapping.patch index ca155e50127..8cb2b549e5b 100644 --- a/target/linux/mediatek/patches-6.6/733-08-net-phy-mediatek-Change-mtk-ge-soc.c-line-wrapping.patch +++ b/target/linux/mediatek/patches-6.6/733-08-net-phy-mediatek-Change-mtk-ge-soc.c-line-wrapping.patch @@ -1,7 +1,7 @@ -From e73df692396b0d6bdcb2317299fa1e8e547f3446 Mon Sep 17 00:00:00 2001 +From dbe70a9353b5095a90af61a051486484765ada6f Mon Sep 17 00:00:00 2001 From: "SkyLake.Huang" -Date: Mon, 1 Jul 2024 18:54:12 +0800 -Subject: [PATCH 08/13] net: phy: mediatek: Change mtk-ge-soc.c line wrapping +Date: Fri, 4 Oct 2024 18:24:12 +0800 +Subject: [PATCH 8/9] net: phy: mediatek: Change mtk-ge-soc.c line wrapping This patch shrinks mtk-ge-soc.c line wrapping to 80 characters. diff --git a/target/linux/mediatek/patches-6.6/733-09-net-phy-mediatek-Add-token-ring-access-helper-functi.patch b/target/linux/mediatek/patches-6.6/733-09-net-phy-mediatek-Add-token-ring-access-helper-functi.patch index 49e4c2057fc..62c063462b9 100644 --- a/target/linux/mediatek/patches-6.6/733-09-net-phy-mediatek-Add-token-ring-access-helper-functi.patch +++ b/target/linux/mediatek/patches-6.6/733-09-net-phy-mediatek-Add-token-ring-access-helper-functi.patch @@ -1,7 +1,7 @@ -From 60228de48d8bfde62b4db5945314e6a62079f091 Mon Sep 17 00:00:00 2001 +From ca024bc7267a8c0439325d352f9b8818ba0f2cf0 Mon Sep 17 00:00:00 2001 From: "SkyLake.Huang" -Date: Mon, 1 Jul 2024 18:54:13 +0800 -Subject: [PATCH 09/13] net: phy: mediatek: Add token ring access helper +Date: Fri, 4 Oct 2024 18:24:13 +0800 +Subject: [PATCH 9/9] net: phy: mediatek: Add token ring access helper functions in mtk-phy-lib This patch adds TR(token ring) manipulations and adds correct diff --git a/target/linux/mediatek/patches-6.6/733-10-net-phy-mediatek-Extend-1G-TX-RX-link-pulse-time.patch b/target/linux/mediatek/patches-6.6/733-10-net-phy-mediatek-Extend-1G-TX-RX-link-pulse-time.patch deleted file mode 100644 index 2fc1adb5ec1..00000000000 --- a/target/linux/mediatek/patches-6.6/733-10-net-phy-mediatek-Extend-1G-TX-RX-link-pulse-time.patch +++ /dev/null @@ -1,219 +0,0 @@ -From 3c05195fc2c232cd853fc8cebf55310c4605111d Mon Sep 17 00:00:00 2001 -From: "SkyLake.Huang" -Date: Mon, 1 Jul 2024 18:54:14 +0800 -Subject: [PATCH 10/13] net: phy: mediatek: Extend 1G TX/RX link pulse time - -We observe that some 10G devices' (mostly Marvell's chips inside) 1G -training time violates specification, which may last 2230ms and affect -later TX/RX link pulse time. This will invalidate MediaTek series -gigabit Ethernet PHYs' hardware auto downshift mechanism. - -Without this patch, if someone is trying to use "4-wire" cable to -connect above devices, MediaTek' gigabit Ethernet PHYs may fail -to downshift to 100Mbps. (If partner 10G devices' downshift mechanism -stops at 1G) - -This patch extends our 1G TX/RX link pulse time so that we can still -link up with those 10G devices. - -Tested device: -- Netgear GS110EMX's 10G port (Marvell 88X3340P) -- QNAP QSW-M408-4C - -Signed-off-by: SkyLake.Huang ---- - drivers/net/phy/mediatek/mtk-ge-soc.c | 2 + - drivers/net/phy/mediatek/mtk-ge.c | 5 +- - drivers/net/phy/mediatek/mtk-phy-lib.c | 92 ++++++++++++++++++++++++++ - drivers/net/phy/mediatek/mtk.h | 21 ++++++ - 4 files changed, 116 insertions(+), 4 deletions(-) - ---- a/drivers/net/phy/mediatek/mtk-ge-soc.c -+++ b/drivers/net/phy/mediatek/mtk-ge-soc.c -@@ -1396,6 +1396,7 @@ static struct phy_driver mtk_socphy_driv - PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7981), - .name = "MediaTek MT7981 PHY", - .config_init = mt798x_phy_config_init, -+ .read_status = mtk_gphy_cl22_read_status, - .config_intr = genphy_no_config_intr, - .handle_interrupt = genphy_handle_interrupt_no_ack, - .probe = mt7981_phy_probe, -@@ -1413,6 +1414,7 @@ static struct phy_driver mtk_socphy_driv - PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7988), - .name = "MediaTek MT7988 PHY", - .config_init = mt798x_phy_config_init, -+ .read_status = mtk_gphy_cl22_read_status, - .config_intr = genphy_no_config_intr, - .handle_interrupt = genphy_handle_interrupt_no_ack, - .probe = mt7988_phy_probe, ---- a/drivers/net/phy/mediatek/mtk-ge.c -+++ b/drivers/net/phy/mediatek/mtk-ge.c -@@ -9,10 +9,6 @@ - #define MTK_GPHY_ID_MT7530 0x03a29412 - #define MTK_GPHY_ID_MT7531 0x03a29441 - --#define MTK_PHY_PAGE_EXTENDED_1 0x0001 --#define MTK_PHY_AUX_CTRL_AND_STATUS 0x14 --#define MTK_PHY_ENABLE_DOWNSHIFT BIT(4) -- - #define MTK_PHY_PAGE_EXTENDED_2 0x0002 - #define MTK_PHY_PAGE_EXTENDED_3 0x0003 - #define MTK_PHY_RG_LPI_PCS_DSP_CTRL_REG11 0x11 -@@ -251,6 +247,7 @@ static struct phy_driver mtk_gephy_drive - .name = "MediaTek MT7531 PHY", - .probe = mt7531_phy_probe, - .config_init = mt7531_phy_config_init, -+ .read_status = mtk_gphy_cl22_read_status, - /* Interrupts are handled by the switch, not the PHY - * itself. - */ ---- a/drivers/net/phy/mediatek/mtk-phy-lib.c -+++ b/drivers/net/phy/mediatek/mtk-phy-lib.c -@@ -109,6 +109,108 @@ int mtk_phy_write_page(struct phy_device - } - EXPORT_SYMBOL_GPL(mtk_phy_write_page); - -+/* This function deals with the case that 1G AN starts but isn't completed. We -+ * set AN_NEW_LP_CNT_LIMIT with different values time after time to let our -+ * 1G->100Mbps hardware automatic downshift to fit more partner devices. -+ */ -+static int extend_an_new_lp_cnt_limit(struct phy_device *phydev) -+{ -+ int ret; -+ u32 reg_val; -+ int timeout; -+ -+ /* According to table 28-9 & Figure 28-18 in IEEE 802.3, -+ * link_fail_inhibit_timer of 10/100/1000 Mbps devices ranges from 750 -+ * to "1000ms". Once MTK_PHY_FINAL_SPEED_1000 is set, it means that we -+ * enter "FLP LINK GOOD CHECK" state, link_fail_inhibit_timer starts and -+ * this PHY's 1G training starts. If 1G training never starts, we do -+ * nothing but leave. -+ */ -+ timeout = read_poll_timeout(ret = phy_read_mmd, reg_val, -+ (ret < 0) || -+ reg_val & MTK_PHY_FINAL_SPEED_1000, -+ 10000, 500000, false, phydev, -+ MDIO_MMD_VEND1, MTK_PHY_LINK_STATUS_MISC); -+ phydev_dbg(phydev, "%s: Training Indicator: 0x%x\n", __func__, reg_val); -+ if (ret < 0) -+ return ret; -+ -+ if (!timeout) { -+ /* Once we found MTK_PHY_FINAL_SPEED_1000 is set, no matter 1G -+ * AN is completed or not, we'll set AN_NEW_LP_CNT_LIMIT again -+ * and again. -+ */ -+ mtk_tr_modify(phydev, 0x0, 0xf, 0x3c, AN_NEW_LP_CNT_LIMIT_MASK, -+ FIELD_PREP(AN_NEW_LP_CNT_LIMIT_MASK, 0xf)); -+ msleep(1500); -+ -+ /* Read phy status again to make sure the following step won't -+ * affect normal devices. -+ */ -+ ret = genphy_read_status(phydev); -+ if (ret) -+ return ret; -+ if (phydev->link) -+ return 0; -+ -+ timeout = read_poll_timeout(mtk_tr_read, reg_val, -+ (reg_val & AN_STATE_MASK) != -+ (AN_STATE_TX_DISABLE << -+ AN_STATE_SHIFT), -+ 10000, 1000000, false, phydev, -+ 0x0, 0xf, 0x2); -+ phydev_dbg(phydev, "%s: AN State: 0x%x\n", __func__, reg_val); -+ if (!timeout) { -+ msleep(625); -+ mtk_tr_modify(phydev, 0x0, 0xf, 0x3c, -+ AN_NEW_LP_CNT_LIMIT_MASK, -+ FIELD_PREP(AN_NEW_LP_CNT_LIMIT_MASK, -+ 0x8)); -+ msleep(500); -+ mtk_tr_modify(phydev, 0x0, 0xf, 0x3c, -+ AN_NEW_LP_CNT_LIMIT_MASK, -+ FIELD_PREP(AN_NEW_LP_CNT_LIMIT_MASK, -+ 0xf)); -+ } -+ } -+ -+ return 0; -+} -+ -+int mtk_gphy_cl22_read_status(struct phy_device *phydev) -+{ -+ int ret; -+ -+ ret = genphy_read_status(phydev); -+ if (ret) -+ return ret; -+ -+ if (phydev->autoneg == AUTONEG_ENABLE && !phydev->autoneg_complete) { -+ ret = phy_read_paged(phydev, MTK_PHY_PAGE_EXTENDED_1, -+ MTK_PHY_AUX_CTRL_AND_STATUS); -+ if (ret < 0) -+ return ret; -+ -+ /* Once LP_DETECTED is set, it means that"ability_match" in -+ * IEEE 802.3 Figure 28-18 is set. This happens after we plug in -+ * cable. Also, LP_DETECTED will be cleared after AN complete. -+ */ -+ if (!FIELD_GET(MTK_PHY_LP_DETECTED_MASK, ret)) -+ return 0; -+ -+ ret = phy_read(phydev, MII_CTRL1000); -+ if (ret & (ADVERTISE_1000FULL | ADVERTISE_1000HALF)) { -+ ret = extend_an_new_lp_cnt_limit(phydev); -+ phydev_dbg(phydev, "%s: counter limit ret: %d\n", __func__, ret); -+ if (ret < 0) -+ return ret; -+ } -+ } -+ -+ return 0; -+} -+EXPORT_SYMBOL_GPL(mtk_gphy_cl22_read_status); -+ - int mtk_phy_led_hw_is_supported(struct phy_device *phydev, u8 index, - unsigned long rules, - unsigned long supported_triggers) ---- a/drivers/net/phy/mediatek/mtk.h -+++ b/drivers/net/phy/mediatek/mtk.h -@@ -10,8 +10,28 @@ - - #define MTK_EXT_PAGE_ACCESS 0x1f - #define MTK_PHY_PAGE_STANDARD 0x0000 -+#define MTK_PHY_PAGE_EXTENDED_1 0x0001 -+#define MTK_PHY_AUX_CTRL_AND_STATUS 0x14 -+/* suprv_media_select_RefClk */ -+#define MTK_PHY_LP_DETECTED_MASK GENMASK(7, 6) -+#define MTK_PHY_ENABLE_DOWNSHIFT BIT(4) -+ - #define MTK_PHY_PAGE_EXTENDED_52B5 0x52b5 - -+/* Registers on Token Ring debug nodes */ -+/* ch_addr = 0x0, node_addr = 0xf, data_addr = 0x2 */ -+#define AN_STATE_MASK GENMASK(22, 19) -+#define AN_STATE_SHIFT 19 -+#define AN_STATE_TX_DISABLE 1 -+ -+/* ch_addr = 0x0, node_addr = 0xf, data_addr = 0x3c */ -+#define AN_NEW_LP_CNT_LIMIT_MASK GENMASK(23, 20) -+#define AUTO_NP_10XEN BIT(6) -+ -+/* Registers on MDIO_MMD_VEND1 */ -+#define MTK_PHY_LINK_STATUS_MISC (0xa2) -+#define MTK_PHY_FINAL_SPEED_1000 BIT(3) -+ - /* Registers on MDIO_MMD_VEND2 */ - #define MTK_PHY_LED0_ON_CTRL 0x24 - #define MTK_PHY_LED1_ON_CTRL 0x26 -@@ -78,6 +98,7 @@ void __mtk_tr_clr_bits(struct phy_device - int mtk_phy_read_page(struct phy_device *phydev); - int mtk_phy_write_page(struct phy_device *phydev, int page); - -+int mtk_gphy_cl22_read_status(struct phy_device *phydev); - int mtk_phy_led_hw_is_supported(struct phy_device *phydev, u8 index, - unsigned long rules, - unsigned long supported_triggers); diff --git a/target/linux/mediatek/patches-6.6/733-11-net-phy-add-driver-for-built-in-2.5G-ethernet-PHY-on.patch b/target/linux/mediatek/patches-6.6/733-11-net-phy-add-driver-for-built-in-2.5G-ethernet-PHY-on.patch index a9595157ffb..2548e789f06 100644 --- a/target/linux/mediatek/patches-6.6/733-11-net-phy-add-driver-for-built-in-2.5G-ethernet-PHY-on.patch +++ b/target/linux/mediatek/patches-6.6/733-11-net-phy-add-driver-for-built-in-2.5G-ethernet-PHY-on.patch @@ -42,7 +42,7 @@ Signed-off-by: SkyLake.Huang +obj-$(CONFIG_MEDIATEK_2P5GE_PHY) += mtk-2p5ge.o --- /dev/null +++ b/drivers/net/phy/mediatek/mtk-2p5ge.c -@@ -0,0 +1,432 @@ +@@ -0,0 +1,436 @@ +// SPDX-License-Identifier: GPL-2.0+ +#include +#include @@ -59,6 +59,10 @@ Signed-off-by: SkyLake.Huang + +#define MTK_2P5GPHY_ID_MT7988 (0x00339c11) + ++#define MTK_PHY_PAGE_EXTENDED_1 0x0001 ++#define MTK_PHY_AUX_CTRL_AND_STATUS 0x14 ++#define MTK_PHY_ENABLE_DOWNSHIFT BIT(4) ++ +#define MT7988_2P5GE_PMB_FW "mediatek/mt7988/i2p5ge-phy-pmb.bin" +#define MT7988_2P5GE_PMB_FW_SIZE (0x20000) +#define MT7988_2P5GE_PMB_FW_BASE (0x0f100000) diff --git a/target/linux/mediatek/patches-6.6/733-12-net-phy-mediatek-Fix-alignment-in-callback-functions.patch b/target/linux/mediatek/patches-6.6/733-12-net-phy-mediatek-Fix-alignment-in-callback-functions.patch deleted file mode 100644 index 8657886138e..00000000000 --- a/target/linux/mediatek/patches-6.6/733-12-net-phy-mediatek-Fix-alignment-in-callback-functions.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 07e90eb1819319a0c34b0cf3a57a4a3878e96e4d Mon Sep 17 00:00:00 2001 -From: "SkyLake.Huang" -Date: Mon, 1 Jul 2024 18:54:16 +0800 -Subject: [PATCH 12/13] net: phy: mediatek: Fix alignment in callback - functions' hook - -Align declarations in mtk_gephy_driver(mtk-ge.c) and -mtk_socphy_driver(mtk-ge-soc.c). At first, some of them are -".foo= method_foo", and others are ".bar= method_bar". -Use space instead for all of them here in case line is longer than -80 chars. - -Signed-off-by: SkyLake.Huang ---- - drivers/net/phy/mediatek/mtk-ge-soc.c | 40 +++++++++++++-------------- - drivers/net/phy/mediatek/mtk-ge.c | 34 +++++++++++------------ - 2 files changed, 37 insertions(+), 37 deletions(-) - ---- a/drivers/net/phy/mediatek/mtk-ge-soc.c -+++ b/drivers/net/phy/mediatek/mtk-ge-soc.c -@@ -1394,17 +1394,17 @@ static int mt7981_phy_probe(struct phy_d - static struct phy_driver mtk_socphy_driver[] = { - { - PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7981), -- .name = "MediaTek MT7981 PHY", -- .config_init = mt798x_phy_config_init, -- .read_status = mtk_gphy_cl22_read_status, -- .config_intr = genphy_no_config_intr, -+ .name = "MediaTek MT7981 PHY", -+ .config_init = mt798x_phy_config_init, -+ .read_status = mtk_gphy_cl22_read_status, -+ .config_intr = genphy_no_config_intr, - .handle_interrupt = genphy_handle_interrupt_no_ack, -- .probe = mt7981_phy_probe, -- .suspend = genphy_suspend, -- .resume = genphy_resume, -- .read_page = mtk_phy_read_page, -- .write_page = mtk_phy_write_page, -- .led_blink_set = mt798x_phy_led_blink_set, -+ .probe = mt7981_phy_probe, -+ .suspend = genphy_suspend, -+ .resume = genphy_resume, -+ .read_page = mtk_phy_read_page, -+ .write_page = mtk_phy_write_page, -+ .led_blink_set = mt798x_phy_led_blink_set, - .led_brightness_set = mt798x_phy_led_brightness_set, - .led_hw_is_supported = mt798x_phy_led_hw_is_supported, - .led_hw_control_set = mt798x_phy_led_hw_control_set, -@@ -1412,17 +1412,17 @@ static struct phy_driver mtk_socphy_driv - }, - { - PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7988), -- .name = "MediaTek MT7988 PHY", -- .config_init = mt798x_phy_config_init, -- .read_status = mtk_gphy_cl22_read_status, -- .config_intr = genphy_no_config_intr, -+ .name = "MediaTek MT7988 PHY", -+ .config_init = mt798x_phy_config_init, -+ .read_status = mtk_gphy_cl22_read_status, -+ .config_intr = genphy_no_config_intr, - .handle_interrupt = genphy_handle_interrupt_no_ack, -- .probe = mt7988_phy_probe, -- .suspend = genphy_suspend, -- .resume = genphy_resume, -- .read_page = mtk_phy_read_page, -- .write_page = mtk_phy_write_page, -- .led_blink_set = mt798x_phy_led_blink_set, -+ .probe = mt7988_phy_probe, -+ .suspend = genphy_suspend, -+ .resume = genphy_resume, -+ .read_page = mtk_phy_read_page, -+ .write_page = mtk_phy_write_page, -+ .led_blink_set = mt798x_phy_led_blink_set, - .led_brightness_set = mt798x_phy_led_brightness_set, - .led_hw_is_supported = mt798x_phy_led_hw_is_supported, - .led_hw_control_set = mt798x_phy_led_hw_control_set, ---- a/drivers/net/phy/mediatek/mtk-ge.c -+++ b/drivers/net/phy/mediatek/mtk-ge.c -@@ -230,34 +230,34 @@ static int mt753x_phy_led_hw_control_set - static struct phy_driver mtk_gephy_driver[] = { - { - PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7530), -- .name = "MediaTek MT7530 PHY", -- .config_init = mt7530_phy_config_init, -+ .name = "MediaTek MT7530 PHY", -+ .config_init = mt7530_phy_config_init, - /* Interrupts are handled by the switch, not the PHY - * itself. - */ -- .config_intr = genphy_no_config_intr, -+ .config_intr = genphy_no_config_intr, - .handle_interrupt = genphy_handle_interrupt_no_ack, -- .suspend = genphy_suspend, -- .resume = genphy_resume, -- .read_page = mtk_phy_read_page, -- .write_page = mtk_phy_write_page, -+ .suspend = genphy_suspend, -+ .resume = genphy_resume, -+ .read_page = mtk_phy_read_page, -+ .write_page = mtk_phy_write_page, - }, - { - PHY_ID_MATCH_EXACT(MTK_GPHY_ID_MT7531), -- .name = "MediaTek MT7531 PHY", -- .probe = mt7531_phy_probe, -- .config_init = mt7531_phy_config_init, -- .read_status = mtk_gphy_cl22_read_status, -+ .name = "MediaTek MT7531 PHY", -+ .probe = mt7531_phy_probe, -+ .config_init = mt7531_phy_config_init, -+ .read_status = mtk_gphy_cl22_read_status, - /* Interrupts are handled by the switch, not the PHY - * itself. - */ -- .config_intr = genphy_no_config_intr, -+ .config_intr = genphy_no_config_intr, - .handle_interrupt = genphy_handle_interrupt_no_ack, -- .suspend = genphy_suspend, -- .resume = genphy_resume, -- .read_page = mtk_phy_read_page, -- .write_page = mtk_phy_write_page, -- .led_blink_set = mt753x_phy_led_blink_set, -+ .suspend = genphy_suspend, -+ .resume = genphy_resume, -+ .read_page = mtk_phy_read_page, -+ .write_page = mtk_phy_write_page, -+ .led_blink_set = mt753x_phy_led_blink_set, - .led_brightness_set = mt753x_phy_led_brightness_set, - .led_hw_is_supported = mt753x_phy_led_hw_is_supported, - .led_hw_control_set = mt753x_phy_led_hw_control_set, diff --git a/target/linux/mediatek/patches-6.6/733-13-net-phy-mediatek-Remove-unnecessary-outer-parens-of-.patch b/target/linux/mediatek/patches-6.6/733-13-net-phy-mediatek-Remove-unnecessary-outer-parens-of-.patch deleted file mode 100644 index dd99bbba9a0..00000000000 --- a/target/linux/mediatek/patches-6.6/733-13-net-phy-mediatek-Remove-unnecessary-outer-parens-of-.patch +++ /dev/null @@ -1,65 +0,0 @@ -From e59883b637ae317c2ac275b542e8a50670d76e7c Mon Sep 17 00:00:00 2001 -From: "SkyLake.Huang" -Date: Mon, 1 Jul 2024 18:54:17 +0800 -Subject: [PATCH 13/13] net: phy: mediatek: Remove unnecessary outer parens of - "supported_triggers" var - -This patch removes unnecessary outer parens of "supported_triggers" vars -in mtk-ge.c & mtk-ge-soc.c to improve readability. - -Signed-off-by: SkyLake.Huang ---- - drivers/net/phy/mediatek/mtk-ge-soc.c | 16 ++++++++-------- - drivers/net/phy/mediatek/mtk-ge.c | 16 ++++++++-------- - 2 files changed, 16 insertions(+), 16 deletions(-) - ---- a/drivers/net/phy/mediatek/mtk-ge-soc.c -+++ b/drivers/net/phy/mediatek/mtk-ge-soc.c -@@ -1224,14 +1224,14 @@ static int mt798x_phy_led_brightness_set - } - - static const unsigned long supported_triggers = -- (BIT(TRIGGER_NETDEV_FULL_DUPLEX) | -- BIT(TRIGGER_NETDEV_HALF_DUPLEX) | -- BIT(TRIGGER_NETDEV_LINK) | -- BIT(TRIGGER_NETDEV_LINK_10) | -- BIT(TRIGGER_NETDEV_LINK_100) | -- BIT(TRIGGER_NETDEV_LINK_1000) | -- BIT(TRIGGER_NETDEV_RX) | -- BIT(TRIGGER_NETDEV_TX)); -+ BIT(TRIGGER_NETDEV_FULL_DUPLEX) | -+ BIT(TRIGGER_NETDEV_HALF_DUPLEX) | -+ BIT(TRIGGER_NETDEV_LINK) | -+ BIT(TRIGGER_NETDEV_LINK_10) | -+ BIT(TRIGGER_NETDEV_LINK_100) | -+ BIT(TRIGGER_NETDEV_LINK_1000) | -+ BIT(TRIGGER_NETDEV_RX) | -+ BIT(TRIGGER_NETDEV_TX); - - static int mt798x_phy_led_hw_is_supported(struct phy_device *phydev, u8 index, - unsigned long rules) ---- a/drivers/net/phy/mediatek/mtk-ge.c -+++ b/drivers/net/phy/mediatek/mtk-ge.c -@@ -189,14 +189,14 @@ static int mt753x_phy_led_brightness_set - } - - static const unsigned long supported_triggers = -- (BIT(TRIGGER_NETDEV_FULL_DUPLEX) | -- BIT(TRIGGER_NETDEV_HALF_DUPLEX) | -- BIT(TRIGGER_NETDEV_LINK) | -- BIT(TRIGGER_NETDEV_LINK_10) | -- BIT(TRIGGER_NETDEV_LINK_100) | -- BIT(TRIGGER_NETDEV_LINK_1000) | -- BIT(TRIGGER_NETDEV_RX) | -- BIT(TRIGGER_NETDEV_TX)); -+ BIT(TRIGGER_NETDEV_FULL_DUPLEX) | -+ BIT(TRIGGER_NETDEV_HALF_DUPLEX) | -+ BIT(TRIGGER_NETDEV_LINK) | -+ BIT(TRIGGER_NETDEV_LINK_10) | -+ BIT(TRIGGER_NETDEV_LINK_100) | -+ BIT(TRIGGER_NETDEV_LINK_1000) | -+ BIT(TRIGGER_NETDEV_RX) | -+ BIT(TRIGGER_NETDEV_TX); - - static int mt753x_phy_led_hw_is_supported(struct phy_device *phydev, u8 index, - unsigned long rules) diff --git a/target/linux/mediatek/patches-6.6/901-arm-add-cmdline-override.patch b/target/linux/mediatek/patches-6.6/901-arm-add-cmdline-override.patch index 21bbed88d7b..034826253df 100644 --- a/target/linux/mediatek/patches-6.6/901-arm-add-cmdline-override.patch +++ b/target/linux/mediatek/patches-6.6/901-arm-add-cmdline-override.patch @@ -37,7 +37,7 @@ * CONFIG_CMDLINE is meant to be a default in case nothing else --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig -@@ -2307,6 +2307,14 @@ config CMDLINE_FORCE +@@ -2308,6 +2308,14 @@ config CMDLINE_FORCE endchoice diff --git a/target/linux/mediatek/patches-6.6/911-dts-mt7622-bpi-r64-add-rootdisk.patch b/target/linux/mediatek/patches-6.6/911-dts-mt7622-bpi-r64-add-rootdisk.patch index a28d274493d..c378a302d4b 100644 --- a/target/linux/mediatek/patches-6.6/911-dts-mt7622-bpi-r64-add-rootdisk.patch +++ b/target/linux/mediatek/patches-6.6/911-dts-mt7622-bpi-r64-add-rootdisk.patch @@ -85,14 +85,14 @@ + ubi-volume-ubootenv { + volname = "ubootenv"; + nvmem-layout { -+ compatible = "u-boot,env-redundant-bool-layout"; ++ compatible = "u-boot,env-redundant-bool"; + }; + }; + + ubi-volume-ubootenv2 { + volname = "ubootenv2"; + nvmem-layout { -+ compatible = "u-boot,env-redundant-bool-layout"; ++ compatible = "u-boot,env-redundant-bool"; + }; + }; + diff --git a/target/linux/mpc85xx/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac b/target/linux/mpc85xx/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac index 0e27dfb8ccd..20ad8eb44f4 100644 --- a/target/linux/mpc85xx/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac +++ b/target/linux/mpc85xx/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac @@ -20,11 +20,6 @@ enterasys,ws-ap3710i|\ extreme-networks,ws-ap3825i) mtd_get_mac_ascii cfg2 RADIOADDR${PHYNBR} > /sys${DEVPATH}/macaddress ;; -hpe,msm460) - wifi_mac=$(mtd_get_mac_binary colubris-bid 0x1f9bd) - [ "$PHYNBR" -eq 0 ] && echo "$wifi_mac" > /sys${DEVPATH}/macaddress - [ "$PHYNBR" -eq 1 ] && echo "$(macaddr_add $wifi_mac 16)" > /sys${DEVPATH}/macaddress - ;; ocedo,panda) mtd_get_mac_ascii uboot-env0 wmac$(($PHYNBR + 1)) > /sys${DEVPATH}/macaddress ;; diff --git a/target/linux/mpc85xx/base-files/lib/preinit/10_fix_eth_mac.sh b/target/linux/mpc85xx/base-files/lib/preinit/10_fix_eth_mac.sh index fc4beaef1a8..23d20ed08cf 100644 --- a/target/linux/mpc85xx/base-files/lib/preinit/10_fix_eth_mac.sh +++ b/target/linux/mpc85xx/base-files/lib/preinit/10_fix_eth_mac.sh @@ -11,11 +11,6 @@ preinit_set_mac_address() { ip link set dev eth0 address $(mtd_get_mac_ascii cfg1 ethaddr) ip link set dev eth1 address $(mtd_get_mac_ascii cfg1 eth1addr) ;; - watchguard,firebox-t10) - ip link set dev eth0 address "$(mtd_get_mac_text "device_id" 0x1830)" - ip link set dev eth1 address "$(mtd_get_mac_text "device_id" 0x1844)" - ip link set dev eth2 address "$(mtd_get_mac_text "device_id" 0x1858)" - ;; esac } diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/firebox-t10.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/firebox-t10.dts index 087138bbc2f..7f6235ad35a 100644 --- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/firebox-t10.dts +++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/firebox-t10.dts @@ -21,6 +21,9 @@ led-failsafe = &led_failover; led-running = &led_mode; led-upgrade = &led_attention; + /delete-property/ ethernet0; + /delete-property/ ethernet1; + /delete-property/ ethernet2; }; memory { @@ -105,6 +108,30 @@ reg = <0xc0000 0x40000>; label = "device_id"; read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_device_id_1830: mac-address@1830 { + compatible = "mac-base"; + reg = <0x1830 0x11>; + #nvmem-cell-cells = <1>; + }; + + macaddr_device_id_1844: mac-address@1844 { + compatible = "mac-base"; + reg = <0x1844 0x11>; + #nvmem-cell-cells = <1>; + }; + + macaddr_device_id_1858: mac-address@1858 { + compatible = "mac-base"; + reg = <0x1858 0x11>; + #nvmem-cell-cells = <1>; + }; + }; }; }; }; @@ -149,18 +176,27 @@ enet0: ethernet@b0000 { phy-handle = <&phy1>; phy-connection-type = "rgmii-id"; + + nvmem-cells = <&macaddr_device_id_1830 0>; + nvmem-cell-names = "mac-address"; }; enet1: ethernet@b1000 { tbi-handle = <&tbi_phy1>; phy-handle = <&phy2>; phy-connection-type = "sgmii"; + + nvmem-cells = <&macaddr_device_id_1844 0>; + nvmem-cell-names = "mac-address"; }; enet2: ethernet@b2000 { tbi-handle = <&tbi_phy2>; phy-handle = <&phy3>; phy-connection-type = "sgmii"; + + nvmem-cells = <&macaddr_device_id_1858 0>; + nvmem-cell-names = "mac-address"; }; sdhc@2e000 { diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/msm460.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/msm460.dts index 46f8e514c98..3666350271b 100644 --- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/msm460.dts +++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/msm460.dts @@ -175,6 +175,12 @@ 0x1000000 0x0 0x0 0x1000000 0x0 0x0 0x0 0x100000>; + + wifi@0,0 { + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&macaddr_hwinfo_1f9bd 0>; + nvmem-cell-names = "mac-address"; + }; }; }; @@ -190,6 +196,12 @@ 0x1000000 0x0 0x0 0x1000000 0x0 0x0 0x0 0x100000>; + + wifi@0,0 { + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&macaddr_hwinfo_1f9bd 16>; + nvmem-cell-names = "mac-address"; + }; }; }; diff --git a/target/linux/mpc85xx/p1010/config-default b/target/linux/mpc85xx/p1010/config-default index afa930f4b4c..1cd84b52cad 100644 --- a/target/linux/mpc85xx/p1010/config-default +++ b/target/linux/mpc85xx/p1010/config-default @@ -2,7 +2,9 @@ CONFIG_BR200_WP=y CONFIG_CMDLINE_OVERRIDE=y CONFIG_FIREBOX_T10=y # CONFIG_FSL_CORENET_CF is not set +CONFIG_FSL_IFC=y CONFIG_GPIO_74X164=y +CONFIG_MEMORY=y CONFIG_MTD_CFI=y CONFIG_MTD_NAND_FSL_IFC=y CONFIG_MTD_PHYSMAP=y diff --git a/target/linux/mvebu/cortexa72/config-6.6 b/target/linux/mvebu/cortexa72/config-6.6 index 19ca2b29d1b..af9dcf36329 100644 --- a/target/linux/mvebu/cortexa72/config-6.6 +++ b/target/linux/mvebu/cortexa72/config-6.6 @@ -63,6 +63,7 @@ CONFIG_MMC_SDHCI_XENON=y CONFIG_MODULES_USE_ELF_RELA=y CONFIG_MIKROTIK=y CONFIG_MIKROTIK_RB_SYSFS=y +# CONFIG_MIKROTIK_WLAN_DECOMPRESS_LZ77 is not set CONFIG_MTD_ROUTERBOOT_PARTS=y CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y CONFIG_MVEBU_GICP=y diff --git a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh index 049f8eeb8c8..70678622d34 100755 --- a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh +++ b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh @@ -6,7 +6,6 @@ RAMFS_COPY_BIN='fw_printenv fw_setenv seq strings' RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock' -PART_NAME=firmware REQUIRE_IMAGE_METADATA=1 platform_check_image() { @@ -74,6 +73,10 @@ platform_do_upgrade() { esac default_do_upgrade "$1" ;; + iptime,nas1dual) + PART_NAME=firmware + default_do_upgrade "$1" + ;; linksys,wrt1200ac|\ linksys,wrt1900ac-v1|\ linksys,wrt1900ac-v2|\ diff --git a/target/linux/qoriq/Makefile b/target/linux/qoriq/Makefile index 59c413aa506..6320cdfeb0e 100644 --- a/target/linux/qoriq/Makefile +++ b/target/linux/qoriq/Makefile @@ -8,7 +8,7 @@ ARCH:=powerpc64 BOARD:=qoriq BOARDNAME:=NXP QorIQ (PowerPC) CPU_TYPE:=e5500 -FEATURES:=boot-part ext4 fpu legacy-sdcard powerpc64 ramdisk rootfs-part rtc source-only +FEATURES:=boot-part ext4 fpu legacy-sdcard powerpc64 ramdisk rootfs-part rtc squashfs SUBTARGETS:=generic KERNEL_PATCHVER:=6.6 diff --git a/target/linux/qoriq/base-files/etc/board.d/02_network b/target/linux/qoriq/base-files/etc/board.d/02_network index 355c8d37a46..12adca2a8d8 100644 --- a/target/linux/qoriq/base-files/etc/board.d/02_network +++ b/target/linux/qoriq/base-files/etc/board.d/02_network @@ -19,15 +19,9 @@ watchguard,firebox-m300) ucidef_set_interfaces_lan_wan "eth1" "eth0" wg_set_opt_interface "eth2" "2" - sweth_mac_offset=0x186d - for sweth in $(find /sys/class/net/ -name 'sweth*' -print); do device="$(basename "$sweth")" - mac="$(mtd_get_mac_text wg_cfg0 "$sweth_mac_offset")" - switchports="$switchports $device" - ucidef_set_network_device_mac "$device" "$mac" wg_set_opt_interface "$device" "${device#sweth}" - sweth_mac_offset=$(printf "0x%X\n" $(( $sweth_mac_offset + 0x14))) done ;; diff --git a/target/linux/qoriq/config-6.6 b/target/linux/qoriq/config-6.6 index 3f42563db14..70edd18bd0d 100644 --- a/target/linux/qoriq/config-6.6 +++ b/target/linux/qoriq/config-6.6 @@ -103,6 +103,7 @@ CONFIG_DMA_ENGINE=y CONFIG_DMA_OF=y CONFIG_DMA_OPS=y CONFIG_DMA_OPS_BYPASS=y +# CONFIG_DRM_OFDRM is not set CONFIG_DTC=y CONFIG_DUMMY_CONSOLE=y # CONFIG_E5500_CPU is not set @@ -280,6 +281,8 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=24 CONFIG_NR_IRQS=512 +CONFIG_NVMEM=y +CONFIG_NVMEM_LAYOUTS=y CONFIG_OF=y CONFIG_OF_ADDRESS=y CONFIG_OF_EARLY_FLATTREE=y diff --git a/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/watchguard-firebox-m300.dts b/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/watchguard-firebox-m300.dts index c611263099d..6628e0eb23e 100644 --- a/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/watchguard-firebox-m300.dts +++ b/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/watchguard-firebox-m300.dts @@ -115,6 +115,42 @@ reg = <0x10000 0x20000>; label = "wg_cfg0"; read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_cfg_186c: macaddr@186c { + compatible = "mac-base"; + reg = <0x186c 0x11>; + #nvmem-cell-cells = <1>; + }; + + macaddr_cfg_1880: macaddr@1880 { + compatible = "mac-base"; + reg = <0x1880 0x11>; + #nvmem-cell-cells = <1>; + }; + + macaddr_cfg_1894: macaddr@1894 { + compatible = "mac-base"; + reg = <0x1894 0x11>; + #nvmem-cell-cells = <1>; + }; + + macaddr_cfg_18a8: macaddr@18a8 { + compatible = "mac-base"; + reg = <0x18a8 0x11>; + #nvmem-cell-cells = <1>; + }; + + macaddr_cfg_18bc: macaddr@18bc { + compatible = "mac-base"; + reg = <0x18bc 0x11>; + #nvmem-cell-cells = <1>; + }; + }; }; partition@30000 { @@ -237,30 +273,45 @@ reg = <0>; label = "sweth3"; phy-handle = <&switch0phy0>; + + nvmem-cells = <&macaddr_cfg_186c 0>; + nvmem-cell-names = "mac-address"; }; port@1 { reg = <1>; label = "sweth4"; phy-handle = <&switch0phy1>; + + nvmem-cells = <&macaddr_cfg_1880 0>; + nvmem-cell-names = "mac-address"; }; port@2 { reg = <2>; label = "sweth5"; phy-handle = <&switch0phy2>; + + nvmem-cells = <&macaddr_cfg_1894 0>; + nvmem-cell-names = "mac-address"; }; port@3 { reg = <3>; label = "sweth6"; phy-handle = <&switch0phy3>; + + nvmem-cells = <&macaddr_cfg_18a8 0>; + nvmem-cell-names = "mac-address"; }; port@4 { reg = <4>; label = "sweth7"; phy-handle = <&switch0phy4>; + + nvmem-cells = <&macaddr_cfg_18bc 0>; + nvmem-cell-names = "mac-address"; }; // OEM bootlog suggests multiple ports are attached to switch diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-gl-ax1800.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-gl-ax1800.dts new file mode 100644 index 00000000000..7e31dd03744 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-gl-ax1800.dts @@ -0,0 +1,70 @@ +/dts-v1/; +/* + * Copyright (c) 2019, The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "ipq6000-glinet.dtsi" + +/ { + model = "GL Technologies, Inc. AX1800"; + compatible = "glinet,gl-ax1800", "qcom,ipq6018", "qcom,ipq6018-cp03"; + + aliases { + ethernet3 = &dp4; + ethernet4 = &dp5; + }; +}; + +ðernet_0 { + qca8075_3: ethernet-phy@3 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <3>; + }; + + qca8075_4: ethernet-phy@4 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <4>; + }; +}; + +&switch { + switch_lan_bmp = <(ESS_PORT2|ESS_PORT3|ESS_PORT4|ESS_PORT5)>; /* lan port bitmap */ + + qcom,port_phyinfo { + port@3 { + port_id = <4>; + phy_address = <3>; + }; + port@4 { + port_id = <5>; + phy_address = <4>; + }; + }; +}; + +&dp4 { + phy-handle = <&qca8075_3>; + status = "okay"; +}; + +&dp5 { + phy-handle = <&qca8075_4>; + phy-mode = "psgmii"; + status = "okay"; +}; + +&wifi { + qcom,ath11k-calibration-variant = "GL-iNet-GL-AX1800"; +}; \ No newline at end of file diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-gl-axt1800.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-gl-axt1800.dts new file mode 100644 index 00000000000..b319e5e74e2 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-gl-axt1800.dts @@ -0,0 +1,130 @@ +/dts-v1/; +/* + * Copyright (c) 2019, The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "ipq6000-glinet.dtsi" + +/ { + model = "GL Technologies, Inc. AXT1800"; + compatible = "glinet,gl-axt1800", "qcom,ipq6018", "qcom,ipq6018-cp03"; + + aliases { + sdhc0 = &sdhc_1; + }; + + V30:V30 { + compatible = "regulator-fixed"; + regulator-name = "vmmc-supply"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-always-on; + }; + + V18:V18 { + compatible = "regulator-fixed"; + regulator-name = "vqmmc-supply"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; +}; + + +&tlmm { + + sd_pins: sd_pins { + sd { + pins = "gpio62"; + function = "sd_card"; + bias-pull-up; + }; + ldo { + pins = "gpio66"; + function = "gpio"; + bias-pull-up; + }; + }; + + pwm_pins: pwm_pinmux { + pwm { + pins = "gpio30"; + function = "pwm13"; + drive-strength = <8>; + }; + }; + + fan_pins: fan_pins { + pwr { + pins = "gpio29"; + function = "gpio"; + bias-pull-up; + output-high; + }; + speed { + pins = "gpio31"; + function = "gpio"; + drive-strength = <8>; + bias-pull-down; + }; + }; +}; + +&soc { + fan0: pwm-fan { + compatible = "pwm-fan"; + pinctrl-0 = <&fan_pins>; + pinctrl-names = "default"; + cooling-min-state = <0>; + cooling-max-state = <255>; + #cooling-cells = <2>; + pwms = <&pwm 1 40000 0>; + cooling-levels = <0 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 + 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 37 38 39 + 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 + 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 + 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 + 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 + 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 + 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 + 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 + 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 + 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 + 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 + 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255>; + }; + +}; + + +&pwm{ + pinctrl-0 = <&pwm_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&sdhc_1 { + pinctrl-0 = <&sd_pins>; + pinctrl-names = "default"; + cd-gpios = <&tlmm 62 1>; + sd-ldo-gpios = <&tlmm 66 1>; + vqmmc-supply = <&V18>; + vmmc-supply = <&V30>; + status = "okay"; +}; + +&wifi { + qcom,ath11k-calibration-variant = "GL-iNet-GL-AXT1800"; +}; \ No newline at end of file diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-glinet.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-glinet.dtsi new file mode 100644 index 00000000000..3d60e9037ed --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-glinet.dtsi @@ -0,0 +1,348 @@ +/* + * Copyright (c) 2019, The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "ipq6018.dtsi" +#include "ipq6018-ess.dtsi" +#include "ipq6018-512m.dtsi" +#include "ipq6018-nss.dtsi" + + +#include +#include +#include + +/ { + aliases { + ethernet0 = &dp1; + ethernet1 = &dp2; + ethernet2 = &dp3; + label-mac-device = &dp1; + serial0 = &blsp1_uart3; + led-boot = &led_system_white; + led-failsafe = &led_system_white; + led-running = &led_system_white; + led-upgrade = &led_system_white; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs-append = " root=/dev/ubiblock0_1"; + }; + + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&tlmm 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + switch { + label = "switch"; + gpios = <&tlmm 9 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_system_white: system-white { + label = "white:system"; + gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>; + color = ; + }; + + led_system_blue: system-blue { + label = "blue:system"; + gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>; + color = ; + }; + }; +}; + +&tlmm { + gpio-reserved-ranges = <20 1>; + + spi_1_pins: spi_1_pins { + mux { + pins = "gpio38", "gpio39", "gpio40", "gpio41"; + function = "blsp0_spi"; + drive-strength = <8>; + bias-pull-down; + }; + }; + + button_pins: button_pins { + switch_button { + pins = "gpio9"; + function = "gpio"; + drive-strength = <8>; + bias-pull-up; + }; + reset_button { + pins = "gpio18"; + function = "gpio"; + drive-strength = <8>; + bias-pull-up; + }; + }; + + mdio_pins: mdio-pins { + mdc { + pins = "gpio64"; + function = "mdc"; + drive-strength = <8>; + bias-pull-up; + }; + + mdio { + pins = "gpio65"; + function = "mdio"; + drive-strength = <8>; + bias-pull-up; + }; + + mux_2 { + pins = "gpio74"; + function = "gpio"; + bias-pull-up; + }; + }; + + usb_power_pins: usb_power_pins { + mux { + pins = "gpio0"; + function = "gpio"; + bias-pull-up; + output-high; + }; + }; + + leds_pins: leds_pins { + white { + pins = "gpio35"; + function = "gpio"; + drive-strength = <8>; + bias-pull-down; + }; + blue { + pins = "gpio37"; + function = "gpio"; + drive-strength = <8>; + bias-pull-down; + }; + }; + + i2c_1_pins: i2c_1_pins { + mux { + pins = "gpio42", "gpio43"; + function = "blsp2_i2c"; + drive-strength = <8>; + bias-pull-down; + }; + }; +}; + +&blsp1_uart3 { + pinctrl-0 = <&serial_3_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&blsp1_spi1 { + pinctrl-0 = <&spi_1_pins>; + pinctrl-names = "default"; + cs-select = <0>; + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + compatible = "n25q128a11"; + linux,modalias = "m25p80", "n25q128a11"; + spi-max-frequency = <50000000>; + use-default-sizes; + }; +}; + +&blsp1_i2c3 { + pinctrl-0 = <&i2c_1_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&prng { + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&crypto { + status = "okay"; +}; + +&qpic_bam { + status = "okay"; +}; + +&qusb_phy_0 { + status = "okay"; +}; + +&qusb_phy_1 { + status = "okay"; +}; + + +&ssphy_0 { + status = "okay"; +}; + +&usb3 { + pinctrl-0 = <&usb_power_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&usb2 { + status = "okay"; +}; + +&edma { + status = "okay"; +}; + +&rpm { + status = "disabled"; +}; + +&mdio { + status = "okay"; + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 74 GPIO_ACTIVE_LOW>; + + ethernet_0: ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + qcom,package-mode = "psgmii"; + + qca8075_0: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0>; + }; + + qca8075_1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + }; + + qca8075_2: ethernet-phy@2 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <2>; + }; + }; +}; + +&switch { + status = "okay"; + + switch_lan_bmp = <(ESS_PORT2|ESS_PORT3)>; /* lan port bitmap */ + switch_wan_bmp = ; /* wan port bitmap */ + switch_mac_mode = ; + + qcom,port_phyinfo { + port@0 { + port_id = <1>; + phy_address = <0>; + }; + port@1 { + port_id = <2>; + phy_address = <1>; + }; + port@2 { + port_id = <3>; + phy_address = <2>; + }; + }; +}; + +&dp1{ + phy-handle = <&qca8075_0>; + status = "okay"; +}; + +&dp2{ + phy-handle = <&qca8075_1>; + status = "okay"; +}; + +&dp3{ + phy-handle = <&qca8075_2>; + status = "okay"; +}; + +&qpic_bam { + status = "okay"; +}; + +&qpic_nand { + status = "okay"; + + nand@0 { + reg = <0>; + + nand-ecc-strength = <4>; + nand-ecc-step-size = <512>; + nand-bus-width = <8>; + + partitions { + compatible = "qcom,smem-part"; + }; + }; +}; + + +&wifi { + status = "okay"; + + qcom,ath11k-fw-memory-mode = <1>; + }; + + +&CPU0 { + /delete-property/ cpu-supply; +}; + +&CPU1 { + /delete-property/ cpu-supply; +}; + +&CPU2 { + /delete-property/ cpu-supply; +}; + +&CPU3 { + /delete-property/ cpu-supply; +}; \ No newline at end of file diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-jdc-ax1800-pro.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-jdc-ax1800-pro.dts new file mode 100644 index 00000000000..c9fa47e8f9e --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-jdc-ax1800-pro.dts @@ -0,0 +1,336 @@ +/dts-v1/; +/* + * Copyright (c) 2019, The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "ipq6018.dtsi" +#include "ipq6018-512m.dtsi" +#include "ipq6018-ess.dtsi" +#include "ipq6018-nss.dtsi" + + +#include +#include +#include + +/ { + model = "JDCloud AX1800 Pro"; + compatible = "jdc,ax1800-pro", "qcom,ipq6018-cp03", "qcom,ipq6018"; + + aliases { + sdhc1 = &sdhc_1; + serial0 = &blsp1_uart3; + led-boot = &status_red; + led-failsafe = &status_red; + led-running = &status_green; + led-upgrade = &status_green; + ethernet1 = &dp2; + ethernet2 = &dp3; + ethernet3 = &dp4; + ethernet4 = &dp5; + }; + + chosen { + bootargs = "console=ttyMSM0,115200,n8"; + bootargs-append = " rootfstype=squashfs,ext4 coherent_pool=2M"; + }; + + gpio_keys { + compatible = "gpio-keys"; + pinctrl-0 = <&button_pins>; + pinctrl-names = "default"; + + wps { + label = "wps"; + linux,code = ; + gpios = <&tlmm 8 GPIO_ACTIVE_LOW>; + linux,input-type = ; + debounce-interval = <60>; + }; + + reset { + label = "reset"; + linux,code = ; + gpios = <&tlmm 9 GPIO_ACTIVE_LOW>; + linux,input-type = ; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-0 = <&leds_pins>; + pinctrl-names = "default"; + + status_blue: status_blue { + label = "blue:status"; + gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>; + }; + + status_red: status_red { + label = "red:status"; + gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>; + }; + + status_green: status_green { + label = "green:status"; + gpios = <&tlmm 50 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&tlmm { + gpio-reserved-ranges = <20 1>; + + spi_1_pins: spi_1_pins { + mux { + pins = "gpio38","gpio39","gpio40","gpio41"; + function = "blsp0_spi"; + drive-strength = <0x08>; + bias-pull-down; + }; + }; + + button_pins: button_pins { + mux { + pins = "gpio8", "gpio9"; + function = "gpio"; + drive-strength = <8>; + bias-pull-up; + }; + }; + + leds_pins: leds_pins { + mux { + pins = "gpio34", "gpio36", "gpio49"; + function = "gpio"; + drive-strength = <8>; + bias-pull-down; + }; + }; + + mdio_pinmux: mdio_pinmux { + mux_0 { + pins = "gpio64"; + function = "mdc"; + drive-strength = <0x08>; + bias-pull-up; + }; + + mux_1 { + pins = "gpio65"; + function = "mdio"; + drive-strength = <0x08>; + bias-pull-up; + }; + + mux_2 { + pins = "gpio75"; + function = "gpio"; + bias-pull-up; + }; + }; +}; + + +&blsp1_uart3 { + pinctrl-0 = <&serial_3_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&blsp1_spi1 { + pinctrl-0 = <&spi_1_pins>; + pinctrl-names = "default"; + cs-select = <0>; + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + compatible = "n25q128a11"; + linux,modalias = "m25p80", "n25q128a11"; + spi-max-frequency = <50000000>; + use-default-sizes; + }; +}; + +&prng { + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&crypto { + status = "okay"; +}; + +&qpic_bam { + status = "okay"; +}; + +&qusb_phy_0 { + status = "okay"; +}; + +&qusb_phy_1 { + status = "okay"; +}; + + +&ssphy_0 { + status = "okay"; +}; + +&usb3 { + status = "okay"; +}; + +&usb2 { + status = "okay"; +}; + +&edma { + status = "okay"; +}; + +&rpm { + status = "disabled"; +}; + +&mdio { + status = "okay"; + + pinctrl-0 = <&mdio_pinmux>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 75 GPIO_ACTIVE_LOW>; + + ethernet_0: ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + qcom,package-mode = "psgmii"; + + qca8075_1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + }; + + qca8075_2: ethernet-phy@2 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <2>; + }; + + qca8075_3: ethernet-phy@3 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <3>; + }; + + qca8075_4: ethernet-phy@4 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <4>; + }; + }; +}; + +&switch { + status = "okay"; + + switch_lan_bmp = <(ESS_PORT3 | ESS_PORT4 | ESS_PORT5)>; /* lan port bitmap */ + switch_wan_bmp = ; /* wan port bitmap */ + switch_mac_mode = ; + + qcom,port_phyinfo { + port@1 { + port_id = <2>; + phy_address = <1>; + }; + + port@2 { + port_id = <3>; + phy_address = <2>; + }; + + port@3 { + port_id = <4>; + phy_address = <3>; + }; + + port@4 { + port_id = <5>; + phy_address = <4>; + }; + }; +}; + +&qpic_bam { + status = "okay"; +}; + +&wifi { + status = "okay"; + qcom,ath11k-calibration-variant = "JDC-AX1800-Pro"; + qcom,ath11k-fw-memory-mode = <1>; +}; + + +&dp2 { + phy-handle = <&qca8075_1>; + status = "okay"; +}; + +&dp3 { + phy-handle = <&qca8075_2>; + status = "okay"; +}; + +&dp4 { + phy-handle = <&qca8075_3>; + status = "okay"; +}; + +&dp5 { + phy-handle = <&qca8075_4>; + phy-mode = "psgmii"; + status = "okay"; +}; + +&sdhc_1 { + status = "okay"; + + /delete-property/ mmc-hs400-1_8v; + mmc-hs200-1_8v; + mmc-ddr-1_8v; +}; + +&CPU0 { + /delete-property/ cpu-supply; +}; + +&CPU1 { + /delete-property/ cpu-supply; +}; + +&CPU2 { + /delete-property/ cpu-supply; +}; + +&CPU3 { + /delete-property/ cpu-supply; +}; diff --git a/target/linux/qualcommax/image/ipq60xx.mk b/target/linux/qualcommax/image/ipq60xx.mk index 722771ea501..306059c8863 100644 --- a/target/linux/qualcommax/image/ipq60xx.mk +++ b/target/linux/qualcommax/image/ipq60xx.mk @@ -88,6 +88,51 @@ define Device/cambiumnetworks_xe3-4 endef TARGET_DEVICES += cambiumnetworks_xe3-4 +define Device/glinet_gl-ax1800 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := GL-iNet + DEVICE_MODEL := GL-AX1800 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_DTS_CONFIG := config@cp03-c1 + SOC := ipq6000 + DEVICE_PACKAGES := ipq-wifi-glinet_gl-ax1800 e2fsprogs dosfstools kmod-fs-ext4 kmod-fs-ntfs kmod-fs-vfat \ + kmod-fs-exfat block-mount kmod-usb-storage kmod-usb2 fdisk +endef +TARGET_DEVICES += glinet_gl-ax1800 + +define Device/glinet_gl-axt1800 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := GL-iNet + DEVICE_MODEL := GL-AXT1800 + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_DTS_CONFIG := config@cp03-c1 + SOC := ipq6000 + DEVICE_PACKAGES := ipq-wifi-glinet_gl-axt1800 kmod-hwmon-core e2fsprogs dosfstools kmod-fs-ext4 kmod-fs-ntfs kmod-fs-vfat \ + kmod-fs-exfat kmod-hwmon-pwmfan block-mount kmod-usb-storage kmod-usb2 fdisk +endef +TARGET_DEVICES += glinet_gl-axt1800 + +define Device/jdc_ax1800-pro + $(call Device/FitImage) + DEVICE_VENDOR := JD Cloud + DEVICE_MODEL := JDC AX1800 Pro + DEVICE_DTS_CONFIG := config@cp03-c2 + DEVICE_DTS := ipq6000-jdc-ax1800-pro + SOC := ipq6000 + DEVICE_PACKAGES := ipq-wifi-jdc_ax1800-pro kmod-fs-ext4 mkf2fs f2fsck kmod-fs-f2fs + BLOCKSIZE := 64k + KERNEL_SIZE := 6144k + IMAGES += kernel.bin rootfs.bin factory.bin + IMAGE/kernel.bin := append-kernel + IMAGE/rootfs.bin := append-rootfs | pad-rootfs | pad-to $$(BLOCKSIZE) + IMAGE/factory.bin := append-kernel | pad-to $$$${KERNEL_SIZE} | append-rootfs | append-metadata +endef +TARGET_DEVICES += jdc_ax1800-pro + define Device/netgear_wax214 $(call Device/FitImage) $(call Device/UbiFit) @@ -195,7 +240,6 @@ define Device/yuncore_fap650 endef TARGET_DEVICES += yuncore_fap650 - define Device/linksys_mr7350 $(call Device/FitImage) DEVICE_VENDOR := Linksys diff --git a/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/01_leds b/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/01_leds index 9aeb8ae35c0..880ea501339 100644 --- a/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/01_leds +++ b/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/01_leds @@ -20,7 +20,7 @@ case "$board" in redmi,ax5-jdcloud|\ jdcloud,ax1800-pro|\ jdcloud,ax6600) - ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth3" "link" + ucidef_set_led_netdev "wan" "WAN" "green:wan" "wan" "link" ;; yuncore,fap650) ucidef_set_led_netdev "wlan5ghz" "WLAN 5GHz LED" "blue:wlan-5ghz" "wlan0" "tx rx" diff --git a/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network index 4149249f246..ea289ea9699 100644 --- a/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network +++ b/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network @@ -34,6 +34,15 @@ ipq60xx_setup_interfaces() cambiumnetworks,xe3-4) ucidef_set_interface_lan "lan1 lan2" "dhcp" ;; + glinet,gl-ax1800) + ucidef_set_interfaces_lan_wan "eth1 eth2 eth3 eth4" "eth0" + ;; + glinet,gl-axt1800) + ucidef_set_interfaces_lan_wan "eth1 eth2" "eth0" + ;; + jdc,ax1800-pro) + ucidef_set_interfaces_lan_wan "eth0 eth1 eth2" "eth3" + ;; netgear,wax214) ucidef_set_interfaces_lan_wan "lan" ;; diff --git a/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11-caldata b/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11-caldata index d4a2c7ca9b8..d6b4183f62e 100644 --- a/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11-caldata +++ b/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11-caldata @@ -31,6 +31,9 @@ case "$FIRMWARE" in jdcloud,ax1800-pro) caldata_extract_mmc "0:ART" 0x1000 0x10000 ;; + jdc,ax1800-pro) + caldata_extract_mmc "0:ART" 0x1000 0x10000 + ;; yuncore,fap650) caldata_extract "0:art" 0x1000 0x20000 ;; diff --git a/target/linux/qualcommax/ipq60xx/base-files/etc/init.d/smp_affinity b/target/linux/qualcommax/ipq60xx/base-files/etc/init.d/smp_affinity index 1492fef1e44..7e3cafa4e08 100755 --- a/target/linux/qualcommax/ipq60xx/base-files/etc/init.d/smp_affinity +++ b/target/linux/qualcommax/ipq60xx/base-files/etc/init.d/smp_affinity @@ -1,122 +1,36 @@ #!/bin/sh /etc/rc.common -###################################################################### -# vim: set ft=bash -# shellcheck disable=2155,3019,3043,3057,3060 -###################################################################### START=93 -PROG=smp_affinity - -log_msg() { - - local irq_name="$1" affinity="$2" irq="$3" - - msg="$(printf "Pinning IRQ($irq) %-24s to CPU ${affinity}\n" "$irq_name")" - - logger -t "$PROG" "$msg" -} - -###################################################################### -### Takes a comma, space separated, or range list of CPU numbers and -## returns a bitmask of CPUs. -## cpus_to_bitmask "0,1,2,3" -> f -## cpus_to_bitmask "0 1 2 3" -> f -## cpus_to_bitmask "0-3" -> f -## cpus_to_bitmask "3" -> 8 -####################################################################### - -cpus_to_bitmask() { - - local bitmask=0 - # shellcheck disable=2048 - for range in ${*//,/ }; do - start="${range%-*}" - end="${range#*-}" - if [ -z "$end" ]; then - bitmask="$((bitmask | 1 << start))" - else - bitmask="$((bitmask | (2 ** (end - start + 1) - 1) << start))" - fi - done - printf '%x' $bitmask -} - -###################################################################### -### Takes a bitmask of CPUs and returns a space separated list of -## CPU numbers. -## bitmask_to_cpus f -> 0 1 2 3 -###################################################################### - -bitmask_to_cpus() { - - [ "${1:0:2}" != "0x" ] && set -- "0x$1" - local bitmask="$(printf '%d' "$1")" - - local cpus="" - for i in $(seq 0 63); do - if [ $((bitmask & 1)) -ne 0 ]; then - cpus="$cpus $i" - fi - bitmask=$((bitmask >> 1)) - done - echo "${cpus# }" -} - -###################################################################### -### Sets the affinity of the IRQs with the given name to the given CPU. -## 1st argument: IRQ name ("reo2host-destination-ring1") (req) -## 2nd argument: CPU number (req) -###################################################################### - -set_affinity() { - - local irq_name="$1" affinity="$2" bitmask irq - awk -v irq_name="$1" '$0 ~ irq_name { print substr($1, 1, length($1)-1); exit }' /proc/interrupts \ - | while read -r irq; do - $enable_log && { - log_msg "$irq_name" "$affinity" "$irq" - } - bitmask=$(cpus_to_bitmask "$affinity") && echo "$bitmask" > "/proc/irq/$irq/smp_affinity" - done -} - enable_affinity_ipq() { - - # assign 4 rx interrupts to each core - set_affinity 'reo2host-destination-ring1' 0 - set_affinity 'reo2host-destination-ring2' 1 - set_affinity 'reo2host-destination-ring3' 2 - set_affinity 'reo2host-destination-ring4' 3 - - # assign 3 tcl completions to last 3 CPUs - set_affinity 'wbm2host-tx-completions-ring1' 1 - set_affinity 'wbm2host-tx-completions-ring2' 2 - set_affinity 'wbm2host-tx-completions-ring3' 3 - - # assign 3 ppdu mac interrupts to last 3 cores - set_affinity 'ppdu-end-interrupts-mac1' 1 - set_affinity 'ppdu-end-interrupts-mac2' 2 - set_affinity 'ppdu-end-interrupts-mac3' 3 - - # assign 4 lan/wan to core 4 - set_affinity 'edma_txcmpl' 3 - set_affinity 'edma_rxfill' 3 - set_affinity 'edma_rxdesc' 3 - set_affinity 'edma_misc' 3 + set_affinity() { + irq=$(awk "/$1/{ print substr(\$1, 1, length(\$1)-1); exit }" /proc/interrupts) + [ -n "$irq" ] && echo $2 > /proc/irq/$irq/smp_affinity + } + + # assign 4 rx interrupts to each core + set_affinity 'reo2host-destination-ring1' 1 + set_affinity 'reo2host-destination-ring2' 2 + set_affinity 'reo2host-destination-ring3' 4 + set_affinity 'reo2host-destination-ring4' 8 + + # assign 3 tcl completions to last 3 CPUs + set_affinity 'wbm2host-tx-completions-ring1' 2 + set_affinity 'wbm2host-tx-completions-ring2' 4 + set_affinity 'wbm2host-tx-completions-ring3' 8 + + # assign 3 ppdu mac interrupts to last 3 cores + set_affinity 'ppdu-end-interrupts-mac1' 2 + set_affinity 'ppdu-end-interrupts-mac2' 4 + set_affinity 'ppdu-end-interrupts-mac3' 8 + + # assign lan/wan to core 4 + set_affinity 'edma_txcmpl' 8 + set_affinity 'edma_rxfill' 8 + set_affinity 'edma_rxdesc' 8 + set_affinity 'edma_misc' 8 } boot() { - - local enable - - config_load smp_affinity - - config_get_bool enable "general" enable 1 - config_get_bool enable_log "general" enable_log 1 - - [ "$enable" -eq 1 ] && enable=true || enable=false - [ "$enable_log" -eq 1 ] && enable_log=true || enable_log=false - - $enable && enable_affinity_ipq + enable_affinity_ipq } diff --git a/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh index 115c95348a6..fdd9a435a60 100644 --- a/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh @@ -54,6 +54,11 @@ platform_do_upgrade() { rootfsname="rootfs" mmc_do_upgrade "$1" ;; + jdc,ax1800-pro) + kernelname="0:HLOS" + rootfsname="rootfs" + mmc_do_upgrade "$1" + ;; yuncore,fap650) [ "$(fw_printenv -n owrt_env_ver 2>/dev/null)" != "7" ] && yuncore_fap650_env_setup local active="$(fw_printenv -n owrt_slotactive 2>/dev/null)" diff --git a/target/linux/qualcommax/patches-6.6/0060-v6.9-clk-qcom-gcc-ipq6018-add-qdss_at-clock-needed-for-wi.patch b/target/linux/qualcommax/patches-6.6/0060-v6.9-clk-qcom-gcc-ipq6018-add-qdss_at-clock-needed-for-wi.patch index 5f0af1352a8..f798fffb28b 100644 --- a/target/linux/qualcommax/patches-6.6/0060-v6.9-clk-qcom-gcc-ipq6018-add-qdss_at-clock-needed-for-wi.patch +++ b/target/linux/qualcommax/patches-6.6/0060-v6.9-clk-qcom-gcc-ipq6018-add-qdss_at-clock-needed-for-wi.patch @@ -31,7 +31,7 @@ Signed-off-by: Bjorn Andersson + .parent_hws = (const struct clk_hw *[]){ + &qdss_at_clk_src.clkr.hw }, + .num_parents = 1, -+ .flags = CLK_SET_RATE_PARENT, ++ .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, + .ops = &clk_branch2_ops, + }, + }, diff --git a/target/linux/qualcommax/patches-6.6/1002-arm64-dts-qcom-ipq6018-add-blsp1_i2c6-node.patch b/target/linux/qualcommax/patches-6.6/1002-arm64-dts-qcom-ipq6018-add-blsp1_i2c6-node.patch new file mode 100644 index 00000000000..45197366dd0 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/1002-arm64-dts-qcom-ipq6018-add-blsp1_i2c6-node.patch @@ -0,0 +1,33 @@ +From ba4cdc72744a217ba1d0d345e074ff65d7ec8c37 Mon Sep 17 00:00:00 2001 +From: JiaY-shi +Date: Tue, 6 Jun 2023 19:35:55 +0800 +Subject: [PATCH 155/155] arm64: dts: qcom: ipq6018: add blsp1_i2c6 node + +--- + arch/arm64/boot/dts/qcom/ipq6018.dtsi | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +--- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi ++++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi +@@ -626,6 +626,21 @@ + status = "disabled"; + }; + ++ blsp1_i2c6: i2c@78ba000 { ++ compatible = "qcom,i2c-qup-v2.2.1"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0x0 0x078ba000 0x0 0x600>; ++ interrupts = ; ++ clocks = <&gcc GCC_BLSP1_QUP6_I2C_APPS_CLK>, ++ <&gcc GCC_BLSP1_AHB_CLK>; ++ clock-names = "core", "iface"; ++ clock-frequency = <400000>; ++ dmas = <&blsp_dma 22>, <&blsp_dma 23>; ++ dma-names = "tx", "rx"; ++ status = "disabled"; ++ }; ++ + qpic_bam: dma-controller@7984000 { + compatible = "qcom,bam-v1.7.0"; + reg = <0x0 0x07984000 0x0 0x1a000>; diff --git a/target/linux/qualcommax/patches-6.6/1003-arm64-dts-qcom-ipq6018-repair-reserved-memory-missin.patch b/target/linux/qualcommax/patches-6.6/1003-arm64-dts-qcom-ipq6018-repair-reserved-memory-missin.patch new file mode 100644 index 00000000000..d502277a7b6 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/1003-arm64-dts-qcom-ipq6018-repair-reserved-memory-missin.patch @@ -0,0 +1,35 @@ +From 0ad5a9666e0eca72fc4546ed384a40b1430ddd8b Mon Sep 17 00:00:00 2001 +From: JiaY-shi +Date: Mon, 12 Jun 2023 15:06:01 +0800 +Subject: [PATCH] arm64: dts: qcom: ipq6018: repair reserved-memory missing + nodes + +--- + arch/arm64/boot/dts/qcom/ipq6018.dtsi | 31 +++++++++++++++++++++++++++ + 1 file changed, 31 insertions(+) + +--- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi ++++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi +@@ -223,6 +223,22 @@ + reg = <0x0 0x4ab00000 0x0 0x5500000>; + no-map; + }; ++ ++ nss_region: nss@40000000 { ++ no-map; ++ reg = <0x0 0x40000000 0x0 0x01000000>; ++ }; ++ ++ q6_etr_region: q6_etr_dump@1 { ++ no-map; ++ reg = <0x0 0x50000000 0x0 0x00100000>; ++ }; ++ ++ m3_dump_region: m3_dump@50100000 { ++ no-map; ++ reg = <0x0 0x50100000 0x0 0x00100000>; ++ }; ++ + }; + + smem { diff --git a/target/linux/qualcommax/patches-6.6/1004-arm64-dts-qcom-ipq6018-Add-missing-fixed-clocks.patch b/target/linux/qualcommax/patches-6.6/1004-arm64-dts-qcom-ipq6018-Add-missing-fixed-clocks.patch new file mode 100644 index 00000000000..4f96b319599 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/1004-arm64-dts-qcom-ipq6018-Add-missing-fixed-clocks.patch @@ -0,0 +1,40 @@ +From 48d8e82ed977f07211f827834d6ee6e6fe3336d8 Mon Sep 17 00:00:00 2001 +From: Alexandru Gagniuc +Date: Sat, 27 Aug 2022 17:33:37 -0500 +Subject: [PATCH 1004/1010] arm64: dts: qcom: ipq6018: Add missing fixed-clocks + +Signed-off-by: Alexandru Gagniuc +--- + arch/arm64/boot/dts/qcom/ipq6018.dtsi | 24 ++++++++++++++++++++++-- + 1 file changed, 22 insertions(+), 2 deletions(-) + +--- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi ++++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi +@@ -28,6 +28,12 @@ + clock-frequency = <24000000>; + #clock-cells = <0>; + }; ++ ++ usb3phy_0_cc_pipe_clk: usb3phy-0-cc-pipe-clk { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ #clock-cells = <0>; ++ }; + }; + + cpus: cpus { +@@ -433,8 +439,12 @@ + gcc: gcc@1800000 { + compatible = "qcom,gcc-ipq6018"; + reg = <0x0 0x01800000 0x0 0x80000>; +- clocks = <&xo>, <&sleep_clk>; +- clock-names = "xo", "sleep_clk"; ++ clocks = <&xo>, ++ <&sleep_clk>, ++ <&usb3phy_0_cc_pipe_clk>; ++ clock-names = "xo", ++ "sleep_clk", ++ "usb3phy_0_cc_pipe_clk"; + #clock-cells = <1>; + #reset-cells = <1>; + }; diff --git a/target/linux/qualcommax/patches-6.6/1005-clk-qcom-ipq6018-add-missing-clocks.patch b/target/linux/qualcommax/patches-6.6/1005-clk-qcom-ipq6018-add-missing-clocks.patch new file mode 100644 index 00000000000..1f210fc24c3 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/1005-clk-qcom-ipq6018-add-missing-clocks.patch @@ -0,0 +1,642 @@ +From 86c704b73063eb61d1dc7aaf0d110a88b09c6134 Mon Sep 17 00:00:00 2001 +From: anusha +Date: Wed, 19 Aug 2020 17:59:22 +0530 +Subject: [PATCH 1001/1010] clk: qcom: ipq6018: add missing clocks + +A large number of clocks are missing for the IPQ6018. Add those clocks +from the downstream QCA 5.4 kernel. + +Signed-off-by: anusha +Signed-off-by: Alexandru Gagniuc +--- + drivers/clk/qcom/gcc-ipq6018.c | 587 +++++++++++++++++++++++++++++++++ + 1 file changed, 587 insertions(+) + +--- a/drivers/clk/qcom/gcc-ipq6018.c ++++ b/drivers/clk/qcom/gcc-ipq6018.c +@@ -212,6 +212,19 @@ static struct clk_rcg2 pcnoc_bfdcd_clk_s + }, + }; + ++static struct clk_fixed_factor pcnoc_clk_src = { ++ .mult = 1, ++ .div = 1, ++ .hw.init = &(struct clk_init_data){ ++ .name = "pcnoc_clk_src", ++ .parent_hws = (const struct clk_hw *[]){ ++ &pcnoc_bfdcd_clk_src.clkr.hw }, ++ .num_parents = 1, ++ .ops = &clk_fixed_factor_ops, ++ .flags = CLK_SET_RATE_PARENT, ++ }, ++}; ++ + static struct clk_alpha_pll gpll2_main = { + .offset = 0x4a000, + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], +@@ -490,6 +503,19 @@ static struct clk_rcg2 snoc_nssnoc_bfdcd + }, + }; + ++static struct clk_fixed_factor snoc_nssnoc_clk_src = { ++ .mult = 1, ++ .div = 1, ++ .hw.init = &(struct clk_init_data){ ++ .name = "snoc_nssnoc_clk_src", ++ .parent_hws = (const struct clk_hw *[]){ ++ &snoc_nssnoc_bfdcd_clk_src.clkr.hw }, ++ .num_parents = 1, ++ .ops = &clk_fixed_factor_ops, ++ .flags = CLK_SET_RATE_PARENT, ++ }, ++}; ++ + static const struct freq_tbl ftbl_apss_ahb_clk_src[] = { + F(24000000, P_XO, 1, 0, 0), + F(25000000, P_GPLL0_DIV2, 16, 0, 0), +@@ -1890,6 +1916,19 @@ static struct clk_rcg2 system_noc_bfdcd_ + }, + }; + ++static struct clk_fixed_factor system_noc_clk_src = { ++ .mult = 1, ++ .div = 1, ++ .hw.init = &(struct clk_init_data){ ++ .name = "system_noc_clk_src", ++ .parent_hws = (const struct clk_hw *[]){ ++ &system_noc_bfdcd_clk_src.clkr.hw }, ++ .num_parents = 1, ++ .ops = &clk_fixed_factor_ops, ++ .flags = CLK_SET_RATE_PARENT, ++ }, ++}; ++ + static const struct freq_tbl ftbl_ubi32_mem_noc_bfdcd_clk_src[] = { + F(24000000, P_XO, 1, 0, 0), + F(307670000, P_BIAS_PLL_NSS_NOC, 1.5, 0, 0), +@@ -1924,6 +1963,19 @@ static struct clk_rcg2 ubi32_mem_noc_bfd + }, + }; + ++static struct clk_fixed_factor ubi32_mem_noc_clk_src = { ++ .mult = 1, ++ .div = 1, ++ .hw.init = &(struct clk_init_data){ ++ .name = "ubi32_mem_noc_clk_src", ++ .parent_hws = (const struct clk_hw *[]){ ++ &ubi32_mem_noc_bfdcd_clk_src.clkr.hw }, ++ .num_parents = 1, ++ .ops = &clk_fixed_factor_ops, ++ .flags = CLK_SET_RATE_PARENT, ++ }, ++}; ++ + static struct clk_branch gcc_apss_axi_clk = { + .halt_reg = 0x46020, + .halt_check = BRANCH_HALT_VOTED, +@@ -2681,6 +2733,454 @@ static struct clk_rcg2 lpass_q6_axim_clk + }, + }; + ++static struct clk_branch gcc_wcss_axi_m_clk = { ++ .halt_reg = 0x5903C, ++ .clkr = { ++ .enable_reg = 0x5903C, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_wcss_axi_m_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &system_noc_clk_src.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_sys_noc_wcss_ahb_clk = { ++ .halt_reg = 0x26034, ++ .clkr = { ++ .enable_reg = 0x26034, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_sys_noc_wcss_ahb_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &wcss_ahb_clk_src.clkr.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_q6_axim_clk = { ++ .halt_reg = 0x5913C, ++ .clkr = { ++ .enable_reg = 0x5913C, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_q6_axim_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &q6_axi_clk_src.clkr.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_q6ss_atbm_clk = { ++ .halt_reg = 0x59144, ++ .clkr = { ++ .enable_reg = 0x59144, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_q6ss_atbm_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &qdss_at_clk_src.clkr.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_q6ss_pclkdbg_clk = { ++ .halt_reg = 0x59140, ++ .clkr = { ++ .enable_reg = 0x59140, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_q6ss_pclkdbg_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &qdss_dap_sync_clk_src.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_q6_tsctr_1to2_clk = { ++ .halt_reg = 0x59148, ++ .clkr = { ++ .enable_reg = 0x59148, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_q6_tsctr_1to2_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &qdss_tsctr_div2_clk_src.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_wcss_core_tbu_clk = { ++ .halt_reg = 0x12028, ++ .clkr = { ++ .enable_reg = 0xb00c, ++ .enable_mask = BIT(7), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_wcss_core_tbu_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &system_noc_clk_src.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_wcss_q6_tbu_clk = { ++ .halt_reg = 0x1202C, ++ .clkr = { ++ .enable_reg = 0xb00c, ++ .enable_mask = BIT(8), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_wcss_q6_tbu_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &q6_axi_clk_src.clkr.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_q6_axim2_clk = { ++ .halt_reg = 0x59150, ++ .clkr = { ++ .enable_reg = 0x59150, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_q6_axim2_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &q6_axi_clk_src.clkr.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_q6_ahb_clk = { ++ .halt_reg = 0x59138, ++ .clkr = { ++ .enable_reg = 0x59138, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_q6_ahb_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &wcss_ahb_clk_src.clkr.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_q6_ahb_s_clk = { ++ .halt_reg = 0x5914C, ++ .clkr = { ++ .enable_reg = 0x5914C, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_q6_ahb_s_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &wcss_ahb_clk_src.clkr.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_wcss_dbg_ifc_apb_clk = { ++ .halt_reg = 0x59040, ++ .clkr = { ++ .enable_reg = 0x59040, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_wcss_dbg_ifc_apb_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &qdss_dap_sync_clk_src.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_wcss_dbg_ifc_atb_clk = { ++ .halt_reg = 0x59044, ++ .clkr = { ++ .enable_reg = 0x59044, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_wcss_dbg_ifc_atb_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &qdss_at_clk_src.clkr.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_wcss_dbg_ifc_nts_clk = { ++ .halt_reg = 0x59048, ++ .clkr = { ++ .enable_reg = 0x59048, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_wcss_dbg_ifc_nts_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &qdss_tsctr_div2_clk_src.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_wcss_dbg_ifc_dapbus_clk = { ++ .halt_reg = 0x5905C, ++ .clkr = { ++ .enable_reg = 0x5905C, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_wcss_dbg_ifc_dapbus_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &qdss_dap_sync_clk_src.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_wcss_dbg_ifc_apb_bdg_clk = { ++ .halt_reg = 0x59050, ++ .clkr = { ++ .enable_reg = 0x59050, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_wcss_dbg_ifc_apb_bdg_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &qdss_dap_sync_clk_src.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_wcss_dbg_ifc_atb_bdg_clk = { ++ .halt_reg = 0x59054, ++ .clkr = { ++ .enable_reg = 0x59054, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_wcss_dbg_ifc_atb_bdg_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &qdss_at_clk_src.clkr.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_wcss_dbg_ifc_nts_bdg_clk = { ++ .halt_reg = 0x59058, ++ .clkr = { ++ .enable_reg = 0x59058, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_wcss_dbg_ifc_nts_bdg_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &qdss_tsctr_div2_clk_src.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_wcss_dbg_ifc_dapbus_bdg_clk = { ++ .halt_reg = 0x59060, ++ .clkr = { ++ .enable_reg = 0x59060, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_wcss_dbg_ifc_dapbus_bdg_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &qdss_dap_sync_clk_src.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_nssnoc_atb_clk = { ++ .halt_reg = 0x6818C, ++ .clkr = { ++ .enable_reg = 0x6818C, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_nssnoc_atb_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &qdss_at_clk_src.clkr.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_wcss_ecahb_clk = { ++ .halt_reg = 0x59038, ++ .clkr = { ++ .enable_reg = 0x59038, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_wcss_ecahb_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &wcss_ahb_clk_src.clkr.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_wcss_acmt_clk = { ++ .halt_reg = 0x59064, ++ .clkr = { ++ .enable_reg = 0x59064, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_wcss_acmt_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &wcss_ahb_clk_src.clkr.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_wcss_ahb_s_clk = { ++ .halt_reg = 0x59034, ++ .clkr = { ++ .enable_reg = 0x59034, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_wcss_ahb_s_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &wcss_ahb_clk_src.clkr.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++struct clk_branch gcc_rbcpr_wcss_ahb_clk = { ++ .halt_reg = 0x3A008, ++ .clkr = { ++ .enable_reg = 0x3A008, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_rbcpr_wcss_ahb_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &pcnoc_clk_src.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++struct clk_branch gcc_mem_noc_q6_axi_clk = { ++ .halt_reg = 0x1D038, ++ .clkr = { ++ .enable_reg = 0x1D038, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_mem_noc_q6_axi_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &q6_axi_clk_src.clkr.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_sys_noc_qdss_stm_axi_clk = { ++ .halt_reg = 0x26024, ++ .clkr = { ++ .enable_reg = 0x26024, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_sys_noc_qdss_stm_axi_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &qdss_stm_clk_src.clkr.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_qdss_stm_clk = { ++ .halt_reg = 0x29044, ++ .clkr = { ++ .enable_reg = 0x29044, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_qdss_stm_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &qdss_stm_clk_src.clkr.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_qdss_traceclkin_clk = { ++ .halt_reg = 0x29060, ++ .clkr = { ++ .enable_reg = 0x29060, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_qdss_traceclkin_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &qdss_traceclkin_clk_src.clkr.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ + static struct freq_tbl ftbl_rbcpr_wcss_clk_src[] = { + F(24000000, P_XO, 1, 0, 0), + F(50000000, P_GPLL0, 16, 0, 0), +@@ -2700,6 +3200,23 @@ static struct clk_rcg2 rbcpr_wcss_clk_sr + }, + }; + ++struct clk_branch gcc_rbcpr_wcss_clk = { ++ .halt_reg = 0x3A004, ++ .clkr = { ++ .enable_reg = 0x3A004, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_rbcpr_wcss_clk", ++ .parent_hws = (const struct clk_hw *[]){ ++ &rbcpr_wcss_clk_src.clkr.hw }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++ + static struct clk_branch gcc_lpass_core_axim_clk = { + .halt_reg = 0x1F028, + .clkr = { +@@ -4213,6 +4730,9 @@ static struct clk_hw *gcc_ipq6018_hws[] + &gpll6_out_main_div2.hw, + &qdss_dap_sync_clk_src.hw, + &qdss_tsctr_div2_clk_src.hw, ++ &pcnoc_clk_src.hw, ++ &snoc_nssnoc_clk_src.hw, ++ &ubi32_mem_noc_clk_src.hw, + }; + + static struct clk_regmap *gcc_ipq6018_clks[] = { +@@ -4418,9 +4938,35 @@ static struct clk_regmap *gcc_ipq6018_cl + [PCIE0_RCHNG_CLK_SRC] = &pcie0_rchng_clk_src.clkr, + [GCC_PCIE0_AXI_S_BRIDGE_CLK] = &gcc_pcie0_axi_s_bridge_clk.clkr, + [PCIE0_RCHNG_CLK] = &gcc_pcie0_rchng_clk.clkr, ++ [GCC_WCSS_AXI_M_CLK] = &gcc_wcss_axi_m_clk.clkr, ++ [GCC_SYS_NOC_WCSS_AHB_CLK] = &gcc_sys_noc_wcss_ahb_clk.clkr, + [WCSS_AHB_CLK_SRC] = &wcss_ahb_clk_src.clkr, ++ [GCC_Q6_AXIM_CLK] = &gcc_q6_axim_clk.clkr, + [Q6_AXI_CLK_SRC] = &q6_axi_clk_src.clkr, ++ [GCC_Q6SS_ATBM_CLK] = &gcc_q6ss_atbm_clk.clkr, ++ [GCC_Q6SS_PCLKDBG_CLK] = &gcc_q6ss_pclkdbg_clk.clkr, ++ [GCC_Q6_TSCTR_1TO2_CLK] = &gcc_q6_tsctr_1to2_clk.clkr, ++ [GCC_WCSS_CORE_TBU_CLK] = &gcc_wcss_core_tbu_clk.clkr, ++ [GCC_WCSS_Q6_TBU_CLK] = &gcc_wcss_q6_tbu_clk.clkr, ++ [GCC_Q6_AXIM2_CLK] = &gcc_q6_axim2_clk.clkr, ++ [GCC_Q6_AHB_CLK] = &gcc_q6_ahb_clk.clkr, ++ [GCC_Q6_AHB_S_CLK] = &gcc_q6_ahb_s_clk.clkr, ++ [GCC_WCSS_DBG_IFC_APB_CLK] = &gcc_wcss_dbg_ifc_apb_clk.clkr, ++ [GCC_WCSS_DBG_IFC_ATB_CLK] = &gcc_wcss_dbg_ifc_atb_clk.clkr, ++ [GCC_WCSS_DBG_IFC_NTS_CLK] = &gcc_wcss_dbg_ifc_nts_clk.clkr, ++ [GCC_WCSS_DBG_IFC_DAPBUS_CLK] = &gcc_wcss_dbg_ifc_dapbus_clk.clkr, ++ [GCC_WCSS_DBG_IFC_APB_BDG_CLK] = &gcc_wcss_dbg_ifc_apb_bdg_clk.clkr, ++ [GCC_WCSS_DBG_IFC_ATB_BDG_CLK] = &gcc_wcss_dbg_ifc_atb_bdg_clk.clkr, ++ [GCC_WCSS_DBG_IFC_NTS_BDG_CLK] = &gcc_wcss_dbg_ifc_nts_bdg_clk.clkr, ++ [GCC_WCSS_DBG_IFC_DAPBUS_BDG_CLK] = &gcc_wcss_dbg_ifc_dapbus_bdg_clk.clkr, ++ [GCC_NSSNOC_ATB_CLK] = &gcc_nssnoc_atb_clk.clkr, ++ [GCC_WCSS_ECAHB_CLK] = &gcc_wcss_ecahb_clk.clkr, ++ [GCC_WCSS_ACMT_CLK] = &gcc_wcss_acmt_clk.clkr, ++ [GCC_WCSS_AHB_S_CLK] = &gcc_wcss_ahb_s_clk.clkr, ++ [GCC_RBCPR_WCSS_CLK] = &gcc_rbcpr_wcss_clk.clkr, + [RBCPR_WCSS_CLK_SRC] = &rbcpr_wcss_clk_src.clkr, ++ [GCC_RBCPR_WCSS_AHB_CLK] = &gcc_rbcpr_wcss_ahb_clk.clkr, ++ [GCC_MEM_NOC_Q6_AXI_CLK] = &gcc_mem_noc_q6_axi_clk.clkr, + [GCC_LPASS_CORE_AXIM_CLK] = &gcc_lpass_core_axim_clk.clkr, + [LPASS_CORE_AXIM_CLK_SRC] = &lpass_core_axim_clk_src.clkr, + [GCC_LPASS_SNOC_CFG_CLK] = &gcc_lpass_snoc_cfg_clk.clkr, +@@ -4436,6 +4982,9 @@ static struct clk_regmap *gcc_ipq6018_cl + [GCC_MEM_NOC_UBI32_CLK] = &gcc_mem_noc_ubi32_clk.clkr, + [GCC_MEM_NOC_LPASS_CLK] = &gcc_mem_noc_lpass_clk.clkr, + [GCC_SNOC_LPASS_CFG_CLK] = &gcc_snoc_lpass_cfg_clk.clkr, ++ [GCC_SYS_NOC_QDSS_STM_AXI_CLK] = &gcc_sys_noc_qdss_stm_axi_clk.clkr, ++ [GCC_QDSS_STM_CLK] = &gcc_qdss_stm_clk.clkr, ++ [GCC_QDSS_TRACECLKIN_CLK] = &gcc_qdss_traceclkin_clk.clkr, + [QDSS_STM_CLK_SRC] = &qdss_stm_clk_src.clkr, + [QDSS_TRACECLKIN_CLK_SRC] = &qdss_traceclkin_clk_src.clkr, + }; +@@ -4617,6 +5166,10 @@ static const struct qcom_cc_desc gcc_ipq + static int gcc_ipq6018_probe(struct platform_device *pdev) + { + struct regmap *regmap; ++ struct device *dev = &pdev->dev; ++ ++ clk_register_fixed_rate(dev, "pcie20_phy0_pipe_clk", NULL, 0, ++ 250000000); + + regmap = qcom_cc_map(pdev, &gcc_ipq6018_desc); + if (IS_ERR(regmap)) diff --git a/target/linux/qualcommax/patches-6.6/1006-ipq6018-rproc-Add-non-secure-Q6-bringup-sequence.patch b/target/linux/qualcommax/patches-6.6/1006-ipq6018-rproc-Add-non-secure-Q6-bringup-sequence.patch new file mode 100644 index 00000000000..93d54740d13 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/1006-ipq6018-rproc-Add-non-secure-Q6-bringup-sequence.patch @@ -0,0 +1,435 @@ +From 4ebe7624c51ff95ec13f5dda9cca7c0abe59cd0e Mon Sep 17 00:00:00 2001 +From: Manikanta Mylavarapu +Date: Fri, 31 Dec 2021 17:13:59 +0530 +Subject: [PATCH 1006/1010] ipq6018: rproc: Add non secure Q6 bringup sequence + +This patch adds Q6 bring up sequence support. + +Change-Id: I28eee991168034cc240d863e736ed9c766ec4f33 +Signed-off-by: Manikanta Mylavarapu +--- + drivers/remoteproc/qcom_q6v5_wcss.c | 223 ++++++++++++++++++++++++-- + 2 files changed, 227 insertions(+), 16 deletions(-) + +--- a/drivers/remoteproc/qcom_q6v5_wcss.c ++++ b/drivers/remoteproc/qcom_q6v5_wcss.c +@@ -27,6 +27,7 @@ + + /* Q6SS Register Offsets */ + #define Q6SS_RESET_REG 0x014 ++#define Q6SS_DBG_CFG 0x018 + #define Q6SS_GFMUX_CTL_REG 0x020 + #define Q6SS_PWR_CTL_REG 0x030 + #define Q6SS_MEM_PWR_CTL 0x0B0 +@@ -68,6 +69,7 @@ + #define HALT_CHECK_MAX_LOOPS 200 + #define Q6SS_XO_CBCR GENMASK(5, 3) + #define Q6SS_SLEEP_CBCR GENMASK(5, 2) ++#define Q6SS_TIMEOUT_US 1000 + + /* Q6SS config/status registers */ + #define TCSR_GLOBAL_CFG0 0x0 +@@ -78,6 +80,7 @@ + #define Q6SS_RST_EVB 0x10 + + #define BHS_EN_REST_ACK BIT(0) ++#define WCSS_HM_RET BIT(1) + #define SSCAON_ENABLE BIT(13) + #define SSCAON_BUS_EN BIT(15) + #define SSCAON_BUS_MUX_MASK GENMASK(18, 16) +@@ -120,6 +123,11 @@ struct q6v5_wcss { + struct clk *qdsp6ss_core_gfmux; + struct clk *lcc_bcr_sleep; + struct clk *prng_clk; ++ struct clk *gcc_sys_noc_wcss_ahb_clk; ++ struct clk *gcc_q6ss_atbm_clk; ++ struct clk *gcc_q6ss_pclkdbg_clk; ++ struct clk *gcc_q6_tsctr_1to2_clk; ++ + struct clk *qdss_clk; + struct regulator *cx_supply; + struct qcom_sysmon *sysmon; +@@ -165,12 +173,77 @@ struct wcss_data { + bool need_auto_boot; + }; + ++static const struct wcss_data wcss_ipq6018_res_init; ++ ++static int ipq6018_clks_prepare_enable(struct q6v5_wcss *wcss) ++{ ++ int ret; ++ ++ ret = clk_prepare_enable(wcss->gcc_sys_noc_wcss_ahb_clk); ++ if (ret) ++ return ret; ++ ++ ret = clk_prepare_enable(wcss->gcc_q6ss_atbm_clk); ++ if (ret) ++ return ret; ++ ++ ret = clk_prepare_enable(wcss->gcc_q6ss_pclkdbg_clk); ++ if (ret) ++ return ret; ++ ++ ret = clk_prepare_enable(wcss->gcc_q6_tsctr_1to2_clk); ++ if (ret) ++ return ret; ++ ++ return 0; ++} ++ ++static void ipq6018_clks_prepare_disable(struct q6v5_wcss *wcss) ++{ ++ clk_disable_unprepare(wcss->gcc_sys_noc_wcss_ahb_clk); ++ clk_disable_unprepare(wcss->gcc_q6ss_atbm_clk); ++ clk_disable_unprepare(wcss->gcc_q6ss_pclkdbg_clk); ++ clk_disable_unprepare(wcss->gcc_q6_tsctr_1to2_clk); ++} ++ + static int q6v5_wcss_reset(struct q6v5_wcss *wcss) + { ++ const struct wcss_data *desc; + int ret; + u32 val; + int i; + ++ desc = device_get_match_data(wcss->dev); ++ if (desc == &wcss_ipq6018_res_init) { ++ if (desc->aon_reset_required) { ++ /* Deassert wcss aon reset */ ++ ret = reset_control_deassert(wcss->wcss_aon_reset); ++ if (ret) { ++ dev_err(wcss->dev, "wcss_aon_reset failed\n"); ++ return ret; ++ } ++ mdelay(1); ++ } ++ ++ ret = ipq6018_clks_prepare_enable(wcss); ++ if (ret) { ++ dev_err(wcss->dev, "failed to enable clock\n"); ++ return ret; ++ } ++ } ++ ++ val = readl(wcss->rmb_base + SSCAON_CONFIG); ++ val |= BIT(0); ++ writel(val, wcss->rmb_base + SSCAON_CONFIG); ++ mdelay(1); ++ ++ /*set CFG[18:15]=1* and clear CFG[1]=0*/ ++ val = readl(wcss->rmb_base + SSCAON_CONFIG); ++ val &= ~(SSCAON_BUS_MUX_MASK | WCSS_HM_RET); ++ val |= SSCAON_BUS_EN; ++ writel(val, wcss->rmb_base + SSCAON_CONFIG); ++ mdelay(1); ++ + /* Assert resets, stop core */ + val = readl(wcss->reg_base + Q6SS_RESET_REG); + val |= Q6SS_CORE_ARES | Q6SS_BUS_ARES_ENABLE | Q6SS_STOP_CORE; +@@ -196,7 +269,19 @@ static int q6v5_wcss_reset(struct q6v5_w + writel(val, wcss->reg_base + Q6SS_PWR_CTL_REG); + udelay(1); + ++ if (desc == &wcss_ipq6018_res_init) { ++ /* 10 - Wait till BHS Reset is done */ ++ ret = readl_poll_timeout(wcss->reg_base + Q6SS_BHS_STATUS, ++ val, (val & BHS_EN_REST_ACK), 1000, ++ Q6SS_TIMEOUT_US * 50); ++ if (ret) { ++ dev_err(wcss->dev, "BHS_STATUS not ON (rc:%d) val:0x%X\n", ret, val); ++ return ret; ++ } ++ } ++ + /* Put LDO in bypass mode */ ++ val = readl(wcss->reg_base + Q6SS_PWR_CTL_REG); + val |= Q6SS_LDO_BYP; + writel(val, wcss->reg_base + Q6SS_PWR_CTL_REG); + +@@ -206,6 +291,7 @@ static int q6v5_wcss_reset(struct q6v5_w + writel(val, wcss->reg_base + Q6SS_PWR_CTL_REG); + + /* Deassert memory peripheral sleep and L2 memory standby */ ++ val = readl(wcss->reg_base + Q6SS_PWR_CTL_REG); + val |= Q6SS_L2DATA_STBY_N | Q6SS_SLP_RET_N; + writel(val, wcss->reg_base + Q6SS_PWR_CTL_REG); + +@@ -220,7 +306,10 @@ static int q6v5_wcss_reset(struct q6v5_w + * array to turn on. + */ + val |= readl(wcss->reg_base + Q6SS_MEM_PWR_CTL); +- udelay(1); ++ if (desc == &wcss_ipq6018_res_init) ++ mdelay(10); ++ else ++ udelay(1); + } + /* Remove word line clamp */ + val = readl(wcss->reg_base + Q6SS_PWR_CTL_REG); +@@ -228,6 +317,7 @@ static int q6v5_wcss_reset(struct q6v5_w + writel(val, wcss->reg_base + Q6SS_PWR_CTL_REG); + + /* Remove IO clamp */ ++ val = readl(wcss->reg_base + Q6SS_PWR_CTL_REG); + val &= ~Q6SS_CLAMP_IO; + writel(val, wcss->reg_base + Q6SS_PWR_CTL_REG); + +@@ -246,6 +336,16 @@ static int q6v5_wcss_reset(struct q6v5_w + val &= ~Q6SS_STOP_CORE; + writel(val, wcss->reg_base + Q6SS_RESET_REG); + ++ /* Wait for SSCAON_STATUS */ ++ val = readl(wcss->rmb_base + SSCAON_STATUS); ++ ret = readl_poll_timeout(wcss->rmb_base + SSCAON_STATUS, ++ val, (val & 0xffff) == 0x10, 1000, ++ Q6SS_TIMEOUT_US * 1000); ++ if (ret) { ++ dev_err(wcss->dev, " Boot Error, SSCAON=0x%08X\n", val); ++ return ret; ++ } ++ + return 0; + } + +@@ -380,7 +480,7 @@ static int q6v5_wcss_qcs404_power_on(str + /* Read CLKOFF bit to go low indicating CLK is enabled */ + ret = readl_poll_timeout(wcss->reg_base + Q6SS_XO_CBCR, + val, !(val & BIT(31)), 1, +- HALT_CHECK_MAX_LOOPS); ++ Q6SS_TIMEOUT_US); + if (ret) { + dev_err(wcss->dev, + "xo cbcr enabling timed out (rc:%d)\n", ret); +@@ -533,13 +633,18 @@ static void q6v5_wcss_halt_axi_port(stru + unsigned long timeout; + unsigned int val; + int ret; ++ const struct wcss_data *desc = device_get_match_data(wcss->dev); + +- /* Check if we're already idle */ +- ret = regmap_read(halt_map, offset + AXI_IDLE_REG, &val); +- if (!ret && val) +- return; ++ if (desc != &wcss_ipq6018_res_init) { ++ /* Check if we're already idle */ ++ ret = regmap_read(halt_map, offset + AXI_IDLE_REG, &val); ++ if (!ret && val) ++ return; ++ } + + /* Assert halt request */ ++ regmap_read(halt_map, offset + AXI_HALTREQ_REG, &val); ++ val |= BIT(0); + regmap_write(halt_map, offset + AXI_HALTREQ_REG, 1); + + /* Wait for halt */ +@@ -552,12 +657,14 @@ static void q6v5_wcss_halt_axi_port(stru + msleep(1); + } + +- ret = regmap_read(halt_map, offset + AXI_IDLE_REG, &val); +- if (ret || !val) +- dev_err(wcss->dev, "port failed halt\n"); ++ if (desc != &wcss_ipq6018_res_init) { ++ ret = regmap_read(halt_map, offset + AXI_IDLE_REG, &val); ++ if (ret || !val) ++ dev_err(wcss->dev, "port failed halt\n"); + +- /* Clear halt request (port will remain halted until reset) */ +- regmap_write(halt_map, offset + AXI_HALTREQ_REG, 0); ++ /* Clear halt request (port will remain halted until reset) */ ++ regmap_write(halt_map, offset + AXI_HALTREQ_REG, 0); ++ } + } + + static int q6v5_qcs404_wcss_shutdown(struct q6v5_wcss *wcss) +@@ -626,6 +733,7 @@ static int q6v5_qcs404_wcss_shutdown(str + + static int q6v5_wcss_powerdown(struct q6v5_wcss *wcss) + { ++ const struct wcss_data *desc = device_get_match_data(wcss->dev); + int ret; + u32 val; + +@@ -643,21 +751,26 @@ static int q6v5_wcss_powerdown(struct q6 + writel(val, wcss->rmb_base + SSCAON_CONFIG); + + /* 4 - SSCAON_CONFIG 1 */ ++ val = readl(wcss->rmb_base + SSCAON_CONFIG); + val |= BIT(1); + writel(val, wcss->rmb_base + SSCAON_CONFIG); + + /* 5 - wait for SSCAON_STATUS */ + ret = readl_poll_timeout(wcss->rmb_base + SSCAON_STATUS, + val, (val & 0xffff) == 0x400, 1000, +- HALT_CHECK_MAX_LOOPS); ++ Q6SS_TIMEOUT_US * 10); + if (ret) { + dev_err(wcss->dev, + "can't get SSCAON_STATUS rc:%d)\n", ret); + return ret; + } + ++ mdelay(2); ++ + /* 6 - De-assert WCSS_AON reset */ + reset_control_assert(wcss->wcss_aon_reset); ++ if (desc == &wcss_ipq6018_res_init) ++ mdelay(1); + + /* 7 - Disable WCSSAON_CONFIG 13 */ + val = readl(wcss->rmb_base + SSCAON_CONFIG); +@@ -667,6 +780,13 @@ static int q6v5_wcss_powerdown(struct q6 + /* 8 - De-assert WCSS/Q6 HALTREQ */ + reset_control_assert(wcss->wcss_reset); + ++ if (desc == &wcss_ipq6018_res_init) { ++ /* Clear halt request (port will remain halted until reset) */ ++ regmap_read(wcss->halt_map, wcss->halt_wcss + AXI_HALTREQ_REG, &val); ++ val &= ~0x1; ++ regmap_write(wcss->halt_map, wcss->halt_wcss + AXI_HALTREQ_REG, val); ++ } ++ + return 0; + } + +@@ -675,6 +795,12 @@ static int q6v5_q6_powerdown(struct q6v5 + int ret; + u32 val; + int i; ++ const struct wcss_data *desc = device_get_match_data(wcss->dev); ++ ++ if (desc == &wcss_ipq6018_res_init) { ++ /* To retain power domain after q6 powerdown */ ++ writel(0x1, wcss->reg_base + Q6SS_DBG_CFG); ++ } + + /* 1 - Halt Q6 bus interface */ + q6v5_wcss_halt_axi_port(wcss, wcss->halt_map, wcss->halt_q6); +@@ -690,14 +816,17 @@ static int q6v5_q6_powerdown(struct q6v5 + writel(val, wcss->reg_base + Q6SS_PWR_CTL_REG); + + /* 4 - Clamp WL */ ++ val = readl(wcss->reg_base + Q6SS_PWR_CTL_REG); + val |= QDSS_BHS_ON; + writel(val, wcss->reg_base + Q6SS_PWR_CTL_REG); + + /* 5 - Clear Erase standby */ ++ val = readl(wcss->reg_base + Q6SS_PWR_CTL_REG); + val &= ~Q6SS_L2DATA_STBY_N; + writel(val, wcss->reg_base + Q6SS_PWR_CTL_REG); + + /* 6 - Clear Sleep RTN */ ++ val = readl(wcss->reg_base + Q6SS_PWR_CTL_REG); + val &= ~Q6SS_SLP_RET_N; + writel(val, wcss->reg_base + Q6SS_PWR_CTL_REG); + +@@ -715,6 +844,7 @@ static int q6v5_q6_powerdown(struct q6v5 + writel(val, wcss->reg_base + Q6SS_PWR_CTL_REG); + + /* 9 - Turn off BHS */ ++ val = readl(wcss->reg_base + Q6SS_PWR_CTL_REG); + val &= ~Q6SS_BHS_ON; + writel(val, wcss->reg_base + Q6SS_PWR_CTL_REG); + udelay(1); +@@ -722,7 +852,7 @@ static int q6v5_q6_powerdown(struct q6v5 + /* 10 - Wait till BHS Reset is done */ + ret = readl_poll_timeout(wcss->reg_base + Q6SS_BHS_STATUS, + val, !(val & BHS_EN_REST_ACK), 1000, +- HALT_CHECK_MAX_LOOPS); ++ Q6SS_TIMEOUT_US * 10); + if (ret) { + dev_err(wcss->dev, "BHS_STATUS not OFF (rc:%d)\n", ret); + return ret; +@@ -730,9 +860,23 @@ static int q6v5_q6_powerdown(struct q6v5 + + /* 11 - Assert WCSS reset */ + reset_control_assert(wcss->wcss_reset); ++ if (desc == &wcss_ipq6018_res_init) ++ mdelay(1); + + /* 12 - Assert Q6 reset */ + reset_control_assert(wcss->wcss_q6_reset); ++ if (desc == &wcss_ipq6018_res_init) { ++ mdelay(2); ++ ++ /* Clear halt request (port will remain halted until reset) */ ++ regmap_read(wcss->halt_map, wcss->halt_q6 + AXI_HALTREQ_REG, &val); ++ val &= ~0x1; ++ regmap_write(wcss->halt_map, wcss->halt_q6 + AXI_HALTREQ_REG, val); ++ mdelay(1); ++ ++ /* Disable clocks*/ ++ ipq6018_clks_prepare_disable(wcss); ++ } + + return 0; + } +@@ -975,6 +1119,57 @@ static int q6v5_alloc_memory_region(stru + return 0; + } + ++static int ipq6018_init_clock(struct q6v5_wcss *wcss) ++{ ++ int ret; ++ ++ wcss->prng_clk = devm_clk_get(wcss->dev, "prng"); ++ if (IS_ERR(wcss->prng_clk)) { ++ ret = PTR_ERR(wcss->prng_clk); ++ if (ret != -EPROBE_DEFER) ++ dev_err(wcss->dev, "Failed to get prng clock\n"); ++ return ret; ++ } ++ ++ wcss->gcc_sys_noc_wcss_ahb_clk = ++ devm_clk_get(wcss->dev, "gcc_sys_noc_wcss_ahb_clk"); ++ if (IS_ERR(wcss->gcc_sys_noc_wcss_ahb_clk)) { ++ ret = PTR_ERR(wcss->gcc_sys_noc_wcss_ahb_clk); ++ if (ret != -EPROBE_DEFER) ++ dev_err(wcss->dev, "Failed to get sys_noc_wcss_ahb clock\n"); ++ return ret; ++ } ++ ++ wcss->gcc_q6ss_atbm_clk = ++ devm_clk_get(wcss->dev, "gcc_q6ss_atbm_clk"); ++ if (IS_ERR(wcss->gcc_q6ss_atbm_clk)) { ++ ret = PTR_ERR(wcss->gcc_q6ss_atbm_clk); ++ if (ret != -EPROBE_DEFER) ++ dev_err(wcss->dev, "Failed to get q6ss_atbm clock\n"); ++ return ret; ++ } ++ ++ wcss->gcc_q6ss_pclkdbg_clk = ++ devm_clk_get(wcss->dev, "gcc_q6ss_pclkdbg_clk"); ++ if (IS_ERR(wcss->gcc_q6ss_pclkdbg_clk)) { ++ ret = PTR_ERR(wcss->gcc_q6ss_pclkdbg_clk); ++ if (ret != -EPROBE_DEFER) ++ dev_err(wcss->dev, "Failed to get q6ss_pclkdbg clock\n"); ++ return ret; ++ } ++ ++ wcss->gcc_q6_tsctr_1to2_clk = ++ devm_clk_get(wcss->dev, "gcc_q6_tsctr_1to2_clk"); ++ if (IS_ERR(wcss->gcc_q6_tsctr_1to2_clk)) { ++ ret = PTR_ERR(wcss->gcc_q6_tsctr_1to2_clk); ++ if (ret != -EPROBE_DEFER) ++ dev_err(wcss->dev, "Failed to get q6_tsctr_1to2 clock\n"); ++ return ret; ++ } ++ ++ return 0; ++} ++ + static int ipq_init_clock(struct q6v5_wcss *wcss) + { + int ret; +@@ -1203,7 +1398,7 @@ static const struct wcss_data wcss_ipq80 + }; + + static const struct wcss_data wcss_ipq6018_res_init = { +- .init_clock = ipq_init_clock, ++ .init_clock = ipq6018_init_clock, + .q6_firmware_name = "IPQ6018/q6_fw.mdt", + .m3_firmware_name = "IPQ6018/m3_fw.mdt", + .crash_reason_smem = WCSS_CRASH_REASON, diff --git a/target/linux/qualcommax/patches-6.6/1007-Simplify-ipq6018-rproc-Add-non-secure-Q6-bringup-seq.patch b/target/linux/qualcommax/patches-6.6/1007-Simplify-ipq6018-rproc-Add-non-secure-Q6-bringup-seq.patch new file mode 100644 index 00000000000..33f721ad9cd --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/1007-Simplify-ipq6018-rproc-Add-non-secure-Q6-bringup-seq.patch @@ -0,0 +1,55 @@ +From 737b22c05f9e994ce0ac050b987f85223d04b99f Mon Sep 17 00:00:00 2001 +From: Alexandru Gagniuc +Date: Fri, 2 Sep 2022 18:31:11 -0500 +Subject: [PATCH 1007/1009] Simplify "ipq6018: rproc: Add non secure Q6 bringup + sequence" + +--- + drivers/remoteproc/qcom_q6v5_wcss.c | 25 +++++++++---------------- + 1 file changed, 9 insertions(+), 16 deletions(-) + +--- a/drivers/remoteproc/qcom_q6v5_wcss.c ++++ b/drivers/remoteproc/qcom_q6v5_wcss.c +@@ -633,18 +633,13 @@ static void q6v5_wcss_halt_axi_port(stru + unsigned long timeout; + unsigned int val; + int ret; +- const struct wcss_data *desc = device_get_match_data(wcss->dev); + +- if (desc != &wcss_ipq6018_res_init) { +- /* Check if we're already idle */ +- ret = regmap_read(halt_map, offset + AXI_IDLE_REG, &val); +- if (!ret && val) +- return; +- } ++ /* Check if we're already idle */ ++ ret = regmap_read(halt_map, offset + AXI_IDLE_REG, &val); ++ if (!ret && val) ++ return; + + /* Assert halt request */ +- regmap_read(halt_map, offset + AXI_HALTREQ_REG, &val); +- val |= BIT(0); + regmap_write(halt_map, offset + AXI_HALTREQ_REG, 1); + + /* Wait for halt */ +@@ -657,14 +652,12 @@ static void q6v5_wcss_halt_axi_port(stru + msleep(1); + } + +- if (desc != &wcss_ipq6018_res_init) { +- ret = regmap_read(halt_map, offset + AXI_IDLE_REG, &val); +- if (ret || !val) +- dev_err(wcss->dev, "port failed halt\n"); ++ ret = regmap_read(halt_map, offset + AXI_IDLE_REG, &val); ++ if (ret || !val) ++ dev_err(wcss->dev, "port failed halt\n"); + +- /* Clear halt request (port will remain halted until reset) */ +- regmap_write(halt_map, offset + AXI_HALTREQ_REG, 0); +- } ++ /* Clear halt request (port will remain halted until reset) */ ++ regmap_write(halt_map, offset + AXI_HALTREQ_REG, 0); + } + + static int q6v5_qcs404_wcss_shutdown(struct q6v5_wcss *wcss) diff --git a/target/linux/qualcommax/patches-6.6/1008-pwm-driver-for-qualcomm-ipq6018-pwm-block.patch b/target/linux/qualcommax/patches-6.6/1008-pwm-driver-for-qualcomm-ipq6018-pwm-block.patch new file mode 100644 index 00000000000..f9a1afc6b02 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/1008-pwm-driver-for-qualcomm-ipq6018-pwm-block.patch @@ -0,0 +1,601 @@ +From patchwork Thu Oct 5 16:05:47 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +X-Patchwork-Submitter: Devi Priya +X-Patchwork-Id: 13410404 +Return-Path: +X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on + aws-us-west-2-korg-lkml-1.web.codeaurora.org +Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) + by smtp.lore.kernel.org (Postfix) with ESMTP id D89C1E92716 + for ; + Thu, 5 Oct 2023 16:21:19 +0000 (UTC) +Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand + id S242346AbjJEQUu (ORCPT + ); + Thu, 5 Oct 2023 12:20:50 -0400 +Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34274 "EHLO + lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org + with ESMTP id S242441AbjJEQR7 (ORCPT + ); + Thu, 5 Oct 2023 12:17:59 -0400 +Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com + [205.220.168.131]) + by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 654563F020; + Thu, 5 Oct 2023 09:06:56 -0700 (PDT) +Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) + by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id + 395Aarqd017488; + Thu, 5 Oct 2023 16:06:23 GMT +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; + h=from : to : cc : + subject : date : message-id : in-reply-to : references : mime-version : + content-type : content-transfer-encoding; s=qcppdkim1; + bh=pL305QZpgz9DE4v+JRgsjWEqf1lM32BSKRkIofAZtYI=; + b=N/VkHpLPyHQX0FtgqwJTY18MM5NIRAxm/+ejcJgF+GzogJXQJVrX/JAaY+GrGMI/jBWB + fXAGI3rifkl9eKUkW2WiW2CM3NLpeKa1XcRfGYC3FvWNeVEKpAdNUnneWq5jII/7rjwr + LOEF9iGjSkqgE38uQGz0bcm+TCePCLBym1xS29C8u1B7Xx0M74w+Du98muz8yAqjQbLM + xbUkhQ5rGl34cLkYMUaT8Zuu4Je14xfsUL+dVCk2/TppUvaqZz3mzOdGiwKGz9AWdnJ2 + 1+/sxswdw/5WhuALaDoCncbTHD0BtxYj3SYmNtE0+NHQ4IJ6rpa04qfytuU3+2V8h0xw FQ== +Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com + [129.46.96.20]) + by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3th8e1u8ty-1 + (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 + verify=NOT); + Thu, 05 Oct 2023 16:06:22 +0000 +Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com + [10.47.209.196]) + by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id + 395G6Lmf025392 + (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 + verify=NOT); + Thu, 5 Oct 2023 16:06:21 GMT +Received: from hu-devipriy-blr.qualcomm.com (10.80.80.8) by + nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server + (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id + 15.2.1118.36; Thu, 5 Oct 2023 09:06:16 -0700 +From: Devi Priya +To: , , + , , , + , , + , , + , , + , , + , +CC: , , + +Subject: [PATCH V15 1/4] pwm: driver for qualcomm ipq6018 pwm block +Date: Thu, 5 Oct 2023 21:35:47 +0530 +Message-ID: <20231005160550.2423075-2-quic_devipriy@quicinc.com> +X-Mailer: git-send-email 2.34.1 +In-Reply-To: <20231005160550.2423075-1-quic_devipriy@quicinc.com> +References: <20231005160550.2423075-1-quic_devipriy@quicinc.com> +MIME-Version: 1.0 +X-Originating-IP: [10.80.80.8] +X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To + nalasex01a.na.qualcomm.com (10.47.209.196) +X-QCInternal: smtphost +X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 + signatures=585085 +X-Proofpoint-GUID: dUK910BXNf0cPwSxJTAoChM7COrWyzeE +X-Proofpoint-ORIG-GUID: dUK910BXNf0cPwSxJTAoChM7COrWyzeE +X-Proofpoint-Virus-Version: vendor=baseguard + engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 + definitions=2023-10-05_11,2023-10-05_01,2023-05-22_02 +X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 + phishscore=0 suspectscore=0 + adultscore=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 spamscore=0 + bulkscore=0 mlxlogscore=999 malwarescore=0 impostorscore=0 clxscore=1015 + classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 + definitions=main-2310050126 +Precedence: bulk +List-ID: +X-Mailing-List: linux-arm-msm@vger.kernel.org + +Driver for the PWM block in Qualcomm IPQ6018 line of SoCs. Based on +driver from downstream Codeaurora kernel tree. Removed support for older +(V1) variants because I have no access to that hardware. + +Tested on IPQ6010 based hardware. + +Co-developed-by: Baruch Siach +Signed-off-by: Baruch Siach +Signed-off-by: Devi Priya +--- +V15: + No change + +V14: + No change + +V13: + No change + +V12: + + Fix the below clang warning for overflow check reported by kernel test robot + drivers/pwm/pwm-ipq.c:122:11: warning: result of comparison of constant 16000000000 + with expression of type 'unsigned long' is always false [-Wtautological-constant-out-of-range-compare] +>> if (rate > 16ULL * GIGA) + +v11: + +Address comment from Uwe Kleine-König: + + Drop redundant registers field comments + + Fix period limit check in .apply + + Clarify the comment explaining skip of pre_div > pwm_div values + + Add explicit check for clock rate within limit + + Add comment explaining the selection of initial pre_div + + Use pwm_div division with remainder instead of separate diff calculation + + Round up duty_cycle calculation in .get_state + +v10: + + Restore round up in pwm_div calculation; otherwise diff is always <= + 0, so only bingo match works + + Don't overwrite min_diff on every loop iteration + +v9: + +Address comment from Uwe Kleine-König: + + Use period_ns*rate in dividers calculation for better accuracy + + Round down pre_div and pwm_div + + Add a comment explaining why pwm_div can't underflow + + Add a comment explaining why pre_div > pwm_div end the search loop + + Drop 'CFG_' from register macros + + Rename to_ipq_pwm_chip() to ipq_pwm_from_chip() + + Change bare 'unsigned' to 'unsigned int' + + Clarify the comment on separate REG1 write for enable/disable + Round up the period value in .get_state + + Use direct readl/writel so no need to check for regmap errors + +v7: + + Change 'offset' to 'reg' for the tcsr offset (Rob) + + Drop clock name; there is only one clock (Bjorn) + + Simplify probe failure code path (Bjorn) + +v6: + +Address Uwe Kleine-König review comments: + + Drop IPQ_PWM_MAX_DEVICES + + Rely on assigned-clock-rates; drop IPQ_PWM_CLK_SRC_FREQ + + Simplify register offset calculation + + Calculate duty cycle more precisely + + Refuse to set inverted polarity + + Drop redundant IPQ_PWM_REG1_ENABLE bit clear + + Remove x1000 factor in pwm_div calculation, use rate directly, and round up + + Choose initial pre_div such that pwm_div < IPQ_PWM_MAX_DIV + + Ensure pre_div <= pwm_div + + Rename close_ to best_ + + Explain in comment why effective_div doesn't overflow + + Limit pwm_div to IPQ_PWM_MAX_DIV - 1 to allow 100% duty cycle + + Disable clock only after pwmchip_remove() + + const pwm_ops + +Other changes: + + Add missing linux/bitfield.h header include (kernel test robot) + + Adjust code for PWM device node under TCSR (Rob Herring) + +v5: + + Use &tcsr_q6 syscon to access registers (Bjorn Andersson) + + Address Uwe Kleine-König review comments: + + Implement .get_state() + + Add IPQ_PWM_ prefix to local macros + + Use GENMASK/BIT/FIELD_PREP for register fields access + + Make type of config_div_and_duty() parameters consistent + + Derive IPQ_PWM_MIN_PERIOD_NS from IPQ_PWM_CLK_SRC_FREQ + + Integrate enable/disable into config_div_and_duty() to save register read, + and reduce frequency glitch on update + + Use min() instead of min_t() + + Fix comment format + + Use dev_err_probe() to indicate probe step failure + + Add missing clk_disable_unprepare() in .remove + + Don't set .owner + +v4: + + Use div64_u64() to fix link for 32-bit targets ((kernel test robot + , Uwe Kleine-König) + +v3: + + s/qcom,pwm-ipq6018/qcom,ipq6018-pwm/ (Rob Herring) + + Fix integer overflow on 32-bit targets (kernel test robot ) + +v2: + +Address Uwe Kleine-König review comments: + + Fix period calculation when out of range + + Don't set period larger than requested + + Remove PWM disable on configuration change + + Implement .apply instead of non-atomic .config/.enable/.disable + + Don't modify PWM on .request/.free + + Check pwm_div underflow + + Fix various code and comment formatting issues + +Other changes: + + Use u64 divisor safe division + + Remove now empty .request/.free + + drivers/pwm/Kconfig | 12 ++ + drivers/pwm/Makefile | 1 + + drivers/pwm/pwm-ipq.c | 282 ++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 295 insertions(+) + create mode 100644 drivers/pwm/pwm-ipq.c + +--- a/drivers/pwm/Kconfig ++++ b/drivers/pwm/Kconfig +@@ -282,6 +282,18 @@ config PWM_INTEL_LGM + To compile this driver as a module, choose M here: the module + will be called pwm-intel-lgm. + ++config PWM_IPQ ++ tristate "IPQ PWM support" ++ depends on ARCH_QCOM || COMPILE_TEST ++ depends on HAVE_CLK && HAS_IOMEM ++ help ++ Generic PWM framework driver for IPQ PWM block which supports ++ 4 pwm channels. Each of the these channels can be configured ++ independent of each other. ++ ++ To compile this driver as a module, choose M here: the module ++ will be called pwm-ipq. ++ + config PWM_IQS620A + tristate "Azoteq IQS620A PWM support" + depends on MFD_IQS62X || COMPILE_TEST +--- a/drivers/pwm/Makefile ++++ b/drivers/pwm/Makefile +@@ -24,6 +24,7 @@ obj-$(CONFIG_PWM_IMX1) += pwm-imx1.o + obj-$(CONFIG_PWM_IMX27) += pwm-imx27.o + obj-$(CONFIG_PWM_IMX_TPM) += pwm-imx-tpm.o + obj-$(CONFIG_PWM_INTEL_LGM) += pwm-intel-lgm.o ++obj-$(CONFIG_PWM_IPQ) += pwm-ipq.o + obj-$(CONFIG_PWM_IQS620A) += pwm-iqs620a.o + obj-$(CONFIG_PWM_JZ4740) += pwm-jz4740.o + obj-$(CONFIG_PWM_KEEMBAY) += pwm-keembay.o +--- /dev/null ++++ b/drivers/pwm/pwm-ipq.c +@@ -0,0 +1,282 @@ ++// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 ++/* ++ * Copyright (c) 2016-2017, 2020 The Linux Foundation. All rights reserved. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* The frequency range supported is 1 Hz to clock rate */ ++#define IPQ_PWM_MAX_PERIOD_NS ((u64)NSEC_PER_SEC) ++ ++/* ++ * The max value specified for each field is based on the number of bits ++ * in the pwm control register for that field ++ */ ++#define IPQ_PWM_MAX_DIV 0xFFFF ++ ++/* ++ * Two 32-bit registers for each PWM: REG0, and REG1. ++ * Base offset for PWM #i is at 8 * #i. ++ */ ++#define IPQ_PWM_REG0 0 ++#define IPQ_PWM_REG0_PWM_DIV GENMASK(15, 0) ++#define IPQ_PWM_REG0_HI_DURATION GENMASK(31, 16) ++ ++#define IPQ_PWM_REG1 4 ++#define IPQ_PWM_REG1_PRE_DIV GENMASK(15, 0) ++/* ++ * Enable bit is set to enable output toggling in pwm device. ++ * Update bit is set to reflect the changed divider and high duration ++ * values in register. ++ */ ++#define IPQ_PWM_REG1_UPDATE BIT(30) ++#define IPQ_PWM_REG1_ENABLE BIT(31) ++ ++struct ipq_pwm_chip { ++ struct pwm_chip chip; ++ struct clk *clk; ++ void __iomem *mem; ++}; ++ ++static struct ipq_pwm_chip *ipq_pwm_from_chip(struct pwm_chip *chip) ++{ ++ return container_of(chip, struct ipq_pwm_chip, chip); ++} ++ ++static unsigned int ipq_pwm_reg_read(struct pwm_device *pwm, unsigned int reg) ++{ ++ struct ipq_pwm_chip *ipq_chip = ipq_pwm_from_chip(pwm->chip); ++ unsigned int off = 8 * pwm->hwpwm + reg; ++ ++ return readl(ipq_chip->mem + off); ++} ++ ++static void ipq_pwm_reg_write(struct pwm_device *pwm, unsigned int reg, ++ unsigned int val) ++{ ++ struct ipq_pwm_chip *ipq_chip = ipq_pwm_from_chip(pwm->chip); ++ unsigned int off = 8 * pwm->hwpwm + reg; ++ ++ writel(val, ipq_chip->mem + off); ++} ++ ++static void config_div_and_duty(struct pwm_device *pwm, unsigned int pre_div, ++ unsigned int pwm_div, unsigned long rate, u64 duty_ns, ++ bool enable) ++{ ++ unsigned long hi_dur; ++ unsigned long val = 0; ++ ++ /* ++ * high duration = pwm duty * (pwm div + 1) ++ * pwm duty = duty_ns / period_ns ++ */ ++ hi_dur = div64_u64(duty_ns * rate, (pre_div + 1) * NSEC_PER_SEC); ++ ++ val = FIELD_PREP(IPQ_PWM_REG0_HI_DURATION, hi_dur) | ++ FIELD_PREP(IPQ_PWM_REG0_PWM_DIV, pwm_div); ++ ipq_pwm_reg_write(pwm, IPQ_PWM_REG0, val); ++ ++ val = FIELD_PREP(IPQ_PWM_REG1_PRE_DIV, pre_div); ++ ipq_pwm_reg_write(pwm, IPQ_PWM_REG1, val); ++ ++ /* PWM enable toggle needs a separate write to REG1 */ ++ val |= IPQ_PWM_REG1_UPDATE; ++ if (enable) ++ val |= IPQ_PWM_REG1_ENABLE; ++ ipq_pwm_reg_write(pwm, IPQ_PWM_REG1, val); ++} ++ ++static int ipq_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ++ const struct pwm_state *state) ++{ ++ struct ipq_pwm_chip *ipq_chip = ipq_pwm_from_chip(chip); ++ unsigned int pre_div, pwm_div, best_pre_div, best_pwm_div; ++ unsigned long rate = clk_get_rate(ipq_chip->clk); ++ u64 period_ns, duty_ns, period_rate; ++ u64 min_diff; ++ ++ if (state->polarity != PWM_POLARITY_NORMAL) ++ return -EINVAL; ++ ++ if (state->period < DIV64_U64_ROUND_UP(NSEC_PER_SEC, rate)) ++ return -ERANGE; ++ ++ period_ns = min(state->period, IPQ_PWM_MAX_PERIOD_NS); ++ duty_ns = min(state->duty_cycle, period_ns); ++ ++ /* ++ * period_ns is 1G or less. As long as rate is less than 16 GHz, ++ * period_rate does not overflow. Make that explicit. ++ */ ++ if ((unsigned long long)rate > 16ULL * GIGA) ++ return -EINVAL; ++ period_rate = period_ns * rate; ++ best_pre_div = IPQ_PWM_MAX_DIV; ++ best_pwm_div = IPQ_PWM_MAX_DIV; ++ /* ++ * We don't need to consider pre_div values smaller than ++ * ++ * period_rate ++ * pre_div_min := ------------------------------------ ++ * NSEC_PER_SEC * (IPQ_PWM_MAX_DIV + 1) ++ * ++ * because pre_div = pre_div_min results in a better ++ * approximation. ++ */ ++ pre_div = div64_u64(period_rate, ++ (u64)NSEC_PER_SEC * (IPQ_PWM_MAX_DIV + 1)); ++ min_diff = period_rate; ++ ++ for (; pre_div <= IPQ_PWM_MAX_DIV; pre_div++) { ++ u64 remainder; ++ ++ pwm_div = div64_u64_rem(period_rate, ++ (u64)NSEC_PER_SEC * (pre_div + 1), &remainder); ++ /* pwm_div is unsigned; the check below catches underflow */ ++ pwm_div--; ++ ++ /* ++ * Swapping values for pre_div and pwm_div produces the same ++ * period length. So we can skip all settings with pre_div > ++ * pwm_div which results in bigger constraints for selecting ++ * the duty_cycle than with the two values swapped. ++ */ ++ if (pre_div > pwm_div) ++ break; ++ ++ /* ++ * Make sure we can do 100% duty cycle where ++ * hi_dur == pwm_div + 1 ++ */ ++ if (pwm_div > IPQ_PWM_MAX_DIV - 1) ++ continue; ++ ++ if (remainder < min_diff) { ++ best_pre_div = pre_div; ++ best_pwm_div = pwm_div; ++ min_diff = remainder; ++ ++ if (min_diff == 0) /* bingo */ ++ break; ++ } ++ } ++ ++ /* config divider values for the closest possible frequency */ ++ config_div_and_duty(pwm, best_pre_div, best_pwm_div, ++ rate, duty_ns, state->enabled); ++ ++ return 0; ++} ++ ++static int ipq_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm, ++ struct pwm_state *state) ++{ ++ struct ipq_pwm_chip *ipq_chip = ipq_pwm_from_chip(chip); ++ unsigned long rate = clk_get_rate(ipq_chip->clk); ++ unsigned int pre_div, pwm_div, hi_dur; ++ u64 effective_div, hi_div; ++ u32 reg0, reg1; ++ ++ reg0 = ipq_pwm_reg_read(pwm, IPQ_PWM_REG0); ++ reg1 = ipq_pwm_reg_read(pwm, IPQ_PWM_REG1); ++ ++ state->polarity = PWM_POLARITY_NORMAL; ++ state->enabled = reg1 & IPQ_PWM_REG1_ENABLE; ++ ++ pwm_div = FIELD_GET(IPQ_PWM_REG0_PWM_DIV, reg0); ++ hi_dur = FIELD_GET(IPQ_PWM_REG0_HI_DURATION, reg0); ++ pre_div = FIELD_GET(IPQ_PWM_REG1_PRE_DIV, reg1); ++ ++ /* No overflow here, both pre_div and pwm_div <= 0xffff */ ++ effective_div = (u64)(pre_div + 1) * (pwm_div + 1); ++ state->period = DIV64_U64_ROUND_UP(effective_div * NSEC_PER_SEC, rate); ++ ++ hi_div = hi_dur * (pre_div + 1); ++ state->duty_cycle = DIV64_U64_ROUND_UP(hi_div * NSEC_PER_SEC, rate); ++ ++ return 0; ++} ++ ++static const struct pwm_ops ipq_pwm_ops = { ++ .apply = ipq_pwm_apply, ++ .get_state = ipq_pwm_get_state, ++ .owner = THIS_MODULE, ++}; ++ ++static int ipq_pwm_probe(struct platform_device *pdev) ++{ ++ struct ipq_pwm_chip *pwm; ++ struct device *dev = &pdev->dev; ++ int ret; ++ ++ pwm = devm_kzalloc(dev, sizeof(*pwm), GFP_KERNEL); ++ if (!pwm) ++ return -ENOMEM; ++ ++ platform_set_drvdata(pdev, pwm); ++ ++ pwm->mem = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(pwm->mem)) ++ return dev_err_probe(dev, PTR_ERR(pwm->mem), ++ "regs map failed"); ++ ++ pwm->clk = devm_clk_get(dev, NULL); ++ if (IS_ERR(pwm->clk)) ++ return dev_err_probe(dev, PTR_ERR(pwm->clk), ++ "failed to get clock"); ++ ++ ret = clk_prepare_enable(pwm->clk); ++ if (ret) ++ return dev_err_probe(dev, ret, "clock enable failed"); ++ ++ pwm->chip.dev = dev; ++ pwm->chip.ops = &ipq_pwm_ops; ++ pwm->chip.npwm = 4; ++ ++ ret = pwmchip_add(&pwm->chip); ++ if (ret < 0) { ++ dev_err_probe(dev, ret, "pwmchip_add() failed\n"); ++ clk_disable_unprepare(pwm->clk); ++ } ++ ++ return ret; ++} ++ ++static int ipq_pwm_remove(struct platform_device *pdev) ++{ ++ struct ipq_pwm_chip *pwm = platform_get_drvdata(pdev); ++ ++ pwmchip_remove(&pwm->chip); ++ clk_disable_unprepare(pwm->clk); ++ ++ return 0; ++} ++ ++static const struct of_device_id pwm_ipq_dt_match[] = { ++ { .compatible = "qcom,ipq6018-pwm", }, ++ {} ++}; ++MODULE_DEVICE_TABLE(of, pwm_ipq_dt_match); ++ ++static struct platform_driver ipq_pwm_driver = { ++ .driver = { ++ .name = "ipq-pwm", ++ .of_match_table = pwm_ipq_dt_match, ++ }, ++ .probe = ipq_pwm_probe, ++ .remove = ipq_pwm_remove, ++}; ++ ++module_platform_driver(ipq_pwm_driver); ++ ++MODULE_LICENSE("Dual BSD/GPL"); diff --git a/target/linux/qualcommax/patches-6.6/1009-arm64-dts-qcom-ipq6018-add-pwm-node.patch b/target/linux/qualcommax/patches-6.6/1009-arm64-dts-qcom-ipq6018-add-pwm-node.patch new file mode 100644 index 00000000000..a54aeedb183 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/1009-arm64-dts-qcom-ipq6018-add-pwm-node.patch @@ -0,0 +1,187 @@ +From patchwork Thu Oct 5 16:05:50 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +X-Patchwork-Submitter: Devi Priya +X-Patchwork-Id: 13410402 +Return-Path: +X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on + aws-us-west-2-korg-lkml-1.web.codeaurora.org +Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) + by smtp.lore.kernel.org (Postfix) with ESMTP id 0A952E71D4F + for ; + Thu, 5 Oct 2023 16:21:13 +0000 (UTC) +Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand + id S242309AbjJEQUs (ORCPT + ); + Thu, 5 Oct 2023 12:20:48 -0400 +Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36106 "EHLO + lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org + with ESMTP id S242451AbjJEQSB (ORCPT + ); + Thu, 5 Oct 2023 12:18:01 -0400 +Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com + [205.220.180.131]) + by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6E8D3F025; + Thu, 5 Oct 2023 09:06:56 -0700 (PDT) +Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) + by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id + 395CsRur015464; + Thu, 5 Oct 2023 16:06:41 GMT +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; + h=from : to : cc : + subject : date : message-id : in-reply-to : references : mime-version : + content-type : content-transfer-encoding; s=qcppdkim1; + bh=NSi6brrY0QDAZ3HzHxPaf2hgz27vKeKX8LZRRHNWQWc=; + b=bhnUe3rjnlfJlfGglxvqihGmTNQCt2GnP9fbZBkIsYd0LKp5VGtAlA0IYUcwsiTLb7RK + zTJfR/Llub7KabA70G7qxopCKO0GgBFRq3Xhug1Nnrpr08qcHCrAOSuS16i8viiv5tE/ + Lrn3/Dj59DKIWaBWzrTmI5pK0eLkK0nAPYsTjv03eE8JFtw3M0lHrMQdjuwtpNE7ivjl + CCkahl9YDirevdy+EdeBg17dBw4R3t/qo+3tDzom1COe5knM5DIJI79fxqY1ueFFOM6D + D5mVEsufaOcEQFeLv3y7PtEsPTmWdyN2PCiU8GpFFz6KH8iJLyhzHc6o5pItDDupV1EG uQ== +Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com + [129.46.96.20]) + by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3thn059cyw-1 + (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 + verify=NOT); + Thu, 05 Oct 2023 16:06:41 +0000 +Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com + [10.47.209.196]) + by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id + 395G6dfE025540 + (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 + verify=NOT); + Thu, 5 Oct 2023 16:06:40 GMT +Received: from hu-devipriy-blr.qualcomm.com (10.80.80.8) by + nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server + (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id + 15.2.1118.36; Thu, 5 Oct 2023 09:06:34 -0700 +From: Devi Priya +To: , , + , , , + , , + , , + , , + , , + , +CC: , , + +Subject: [PATCH V15 4/4] arm64: dts: qcom: ipq6018: add pwm node +Date: Thu, 5 Oct 2023 21:35:50 +0530 +Message-ID: <20231005160550.2423075-5-quic_devipriy@quicinc.com> +X-Mailer: git-send-email 2.34.1 +In-Reply-To: <20231005160550.2423075-1-quic_devipriy@quicinc.com> +References: <20231005160550.2423075-1-quic_devipriy@quicinc.com> +MIME-Version: 1.0 +X-Originating-IP: [10.80.80.8] +X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To + nalasex01a.na.qualcomm.com (10.47.209.196) +X-QCInternal: smtphost +X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 + signatures=585085 +X-Proofpoint-ORIG-GUID: pbCgYn8v-0OpdxaoHvIbH76mglvWkJsO +X-Proofpoint-GUID: pbCgYn8v-0OpdxaoHvIbH76mglvWkJsO +X-Proofpoint-Virus-Version: vendor=baseguard + engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 + definitions=2023-10-05_11,2023-10-05_01,2023-05-22_02 +X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 + adultscore=0 suspectscore=0 + impostorscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 priorityscore=1501 + mlxscore=0 malwarescore=0 lowpriorityscore=0 phishscore=0 clxscore=1015 + classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 + definitions=main-2310050125 +Precedence: bulk +List-ID: +X-Mailing-List: linux-arm-msm@vger.kernel.org + +Describe the PWM block on IPQ6018. + +The PWM is in the TCSR area. Make &tcsr "simple-mfd" compatible, and add +&pwm as child of &tcsr. + +Add also ipq6018 specific compatible string. + +Reviewed-by: Krzysztof Kozlowski +Co-developed-by: Baruch Siach +Signed-off-by: Baruch Siach +Signed-off-by: Devi Priya +--- +v15: + + Fixed the indentation of pwm node + +v14: + + Moved ranges just after reg as suggested by Krzysztof + + Picked up the R-b tag + +v13: + + No change + +v12: + + No change + +v11: + + No change + +v10: + + No change + +v9: + + Add 'ranges' property (Rob) + +v8: + + Add size cell to 'reg' (Rob) + +v7: + + Use 'reg' instead of 'offset' (Rob) + + Add qcom,tcsr-ipq6018 (Rob) + + Drop clock-names (Bjorn) + +v6: + + Make the PWM node child of TCSR (Rob Herring) + + Add assigned-clocks/assigned-clock-rates (Uwe Kleine-König) + +v5: Use qcom,pwm-regs for TCSR phandle instead of direct regs + +v3: s/qcom,pwm-ipq6018/qcom,ipq6018-pwm/ (Rob Herring) + + arch/arm64/boot/dts/qcom/ipq6018.dtsi | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +--- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi ++++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi +@@ -456,8 +456,21 @@ + }; + + tcsr: syscon@1937000 { +- compatible = "qcom,tcsr-ipq6018", "syscon"; ++ compatible = "qcom,tcsr-ipq6018", "syscon", "simple-mfd"; + reg = <0x0 0x01937000 0x0 0x21000>; ++ ranges = <0x0 0x0 0x01937000 0x21000>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ pwm: pwm@a010 { ++ compatible = "qcom,ipq6018-pwm"; ++ reg = <0xa010 0x20>; ++ clocks = <&gcc GCC_ADSS_PWM_CLK>; ++ assigned-clocks = <&gcc GCC_ADSS_PWM_CLK>; ++ assigned-clock-rates = <100000000>; ++ #pwm-cells = <2>; ++ status = "disabled"; ++ }; + }; + + usb2: usb@70f8800 { diff --git a/target/linux/qualcommax/patches-6.6/1010-clk-qcom-gcc-ipq6018-rework-nss_port5-clock-to-mul.patch b/target/linux/qualcommax/patches-6.6/1010-clk-qcom-gcc-ipq6018-rework-nss_port5-clock-to-mul.patch new file mode 100644 index 00000000000..5c1c03e3494 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/1010-clk-qcom-gcc-ipq6018-rework-nss_port5-clock-to-mul.patch @@ -0,0 +1,66 @@ +From 76b1d5178910e6714f14c1f6c17390277d227afd Mon Sep 17 00:00:00 2001 +From: JiaY-shi +Date: Thu, 17 Aug 2023 20:46:54 +0800 +Subject: [PATCH] clk: qcom: gcc-ipq6018: rework nss_port5 clock to multiple + conf + +--- + drivers/clk/qcom/gcc-ipq6018.c | 34 ++++++++++++++++++++++++++-------- + 1 file changed, 26 insertions(+), 8 deletions(-) + +--- a/drivers/clk/qcom/gcc-ipq6018.c ++++ b/drivers/clk/qcom/gcc-ipq6018.c +@@ -537,13 +537,22 @@ static struct clk_rcg2 apss_ahb_clk_src + }, + }; + ++ ++static const struct freq_conf ftbl_nss_port5_rx_clk_src_25[] = { ++ C(P_UNIPHY1_RX, 12.5, 0, 0), ++ C(P_UNIPHY0_RX, 5, 0, 0), ++}; ++ ++static const struct freq_conf ftbl_nss_port5_rx_clk_src_125[] = { ++ C(P_UNIPHY1_RX, 2.5, 0, 0), ++ C(P_UNIPHY0_RX, 1, 0, 0), ++}; ++ + static const struct freq_tbl ftbl_nss_port5_rx_clk_src[] = { + F(24000000, P_XO, 1, 0, 0), +- F(25000000, P_UNIPHY1_RX, 12.5, 0, 0), +- F(25000000, P_UNIPHY0_RX, 5, 0, 0), ++ FM(25000000, ftbl_nss_port5_rx_clk_src_25), + F(78125000, P_UNIPHY1_RX, 4, 0, 0), +- F(125000000, P_UNIPHY1_RX, 2.5, 0, 0), +- F(125000000, P_UNIPHY0_RX, 1, 0, 0), ++ FM(125000000, ftbl_nss_port5_rx_clk_src_125), + F(156250000, P_UNIPHY1_RX, 2, 0, 0), + F(312500000, P_UNIPHY1_RX, 1, 0, 0), + { } +@@ -584,13 +593,22 @@ static struct clk_rcg2 nss_port5_rx_clk_ + }, + }; + ++ ++static struct freq_conf ftbl_nss_port5_tx_clk_src_25[] = { ++ C(P_UNIPHY1_TX, 12.5, 0, 0), ++ C(P_UNIPHY0_TX, 5, 0, 0), ++}; ++ ++static struct freq_conf ftbl_nss_port5_tx_clk_src_125[] = { ++ C(P_UNIPHY1_TX, 2.5, 0, 0), ++ C(P_UNIPHY0_TX, 1, 0, 0), ++}; ++ + static const struct freq_tbl ftbl_nss_port5_tx_clk_src[] = { + F(24000000, P_XO, 1, 0, 0), +- F(25000000, P_UNIPHY1_TX, 12.5, 0, 0), +- F(25000000, P_UNIPHY0_TX, 5, 0, 0), ++ FM(25000000, ftbl_nss_port5_tx_clk_src_25), + F(78125000, P_UNIPHY1_TX, 4, 0, 0), +- F(125000000, P_UNIPHY1_TX, 2.5, 0, 0), +- F(125000000, P_UNIPHY0_TX, 1, 0, 0), ++ FM(125000000, ftbl_nss_port5_tx_clk_src_125), + F(156250000, P_UNIPHY1_TX, 2, 0, 0), + F(312500000, P_UNIPHY1_TX, 1, 0, 0), + { } diff --git a/target/linux/qualcommax/patches-6.6/1011-arm64-dts-qcom-ipq6018-assign-some-clock-to-wifi.patch b/target/linux/qualcommax/patches-6.6/1011-arm64-dts-qcom-ipq6018-assign-some-clock-to-wifi.patch new file mode 100644 index 00000000000..fd7216c68c2 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/1011-arm64-dts-qcom-ipq6018-assign-some-clock-to-wifi.patch @@ -0,0 +1,40 @@ +From 71f30e25d21ae4981ecef6653a4ba7dfeb80db7b Mon Sep 17 00:00:00 2001 +From: JiaY-shi +Date: Tue, 23 Jan 2024 11:04:57 +0200 +Subject: [PATCH] arm64: dts: qcom: ipq6018: assign some clock to wifi remoteproc + +--- + arch/arm64/boot/dts/qcom/ipq6018.dtsi | 15 ++++++++------- + 1 file changed, 9 insertions(+), 8 deletions(-) + +--- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi ++++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi +@@ -983,8 +983,26 @@ + "wcss_reset", + "wcss_q6_reset"; + +- clocks = <&gcc GCC_PRNG_AHB_CLK>, <&gcc GCC_QDSS_AT_CLK>; +- clock-names = "prng", "qdss" ; ++ clocks = <&gcc GCC_PRNG_AHB_CLK>, ++ <&gcc GCC_QDSS_AT_CLK>, ++ <&gcc GCC_SYS_NOC_WCSS_AHB_CLK>, ++ <&gcc GCC_Q6SS_ATBM_CLK>, ++ <&gcc GCC_Q6SS_PCLKDBG_CLK>, ++ <&gcc GCC_Q6_TSCTR_1TO2_CLK>; ++ clock-names = "prng", ++ "qdss", ++ "gcc_sys_noc_wcss_ahb_clk", ++ "gcc_q6ss_atbm_clk", ++ "gcc_q6ss_pclkdbg_clk", ++ "gcc_q6_tsctr_1to2_clk"; ++ assigned-clocks = <&gcc GCC_SYS_NOC_WCSS_AHB_CLK>, ++ <&gcc GCC_Q6SS_PCLKDBG_CLK>, ++ <&gcc GCC_Q6_TSCTR_1TO2_CLK>, ++ <&gcc GCC_Q6SS_ATBM_CLK>; ++ assigned-clock-rates = <133333333>, ++ <600000000>, ++ <600000000>, ++ <240000000>; + + qcom,halt-regs = <&tcsr 0x18000 0x1b000 0xe000>; + diff --git a/target/linux/qualcommax/patches-6.6/1012-arm64-dts-qcom-ipq6018-Add-QUP5-SPI-node.patch b/target/linux/qualcommax/patches-6.6/1012-arm64-dts-qcom-ipq6018-Add-QUP5-SPI-node.patch new file mode 100644 index 00000000000..1398c046364 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/1012-arm64-dts-qcom-ipq6018-Add-QUP5-SPI-node.patch @@ -0,0 +1,36 @@ +From dc5423c92edffac4d3b59aa5fd0dcbdfdcba0bf3 Mon Sep 17 00:00:00 2001 +From: Chukun Pan +Date: Sat, 11 Nov 2023 15:50:03 +0800 +Subject: [PATCH] arm64: dts: qcom: ipq6018: Add QUP5 SPI node + +Add node to support the QUP5 SPI controller inside of IPQ6018. +Some routers use this bus to connect SPI TPM chips. + +Signed-off-by: Chukun Pan +--- + arch/arm64/boot/dts/qcom/ipq6018.dtsi | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi ++++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi +@@ -635,6 +635,20 @@ + status = "disabled"; + }; + ++ blsp1_spi5: spi@78b9000 { ++ compatible = "qcom,spi-qup-v2.2.1"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0x0 0x078b9000 0x0 0x600>; ++ interrupts = ; ++ clocks = <&gcc GCC_BLSP1_QUP5_SPI_APPS_CLK>, ++ <&gcc GCC_BLSP1_AHB_CLK>; ++ clock-names = "core", "iface"; ++ dmas = <&blsp_dma 20>, <&blsp_dma 21>; ++ dma-names = "tx", "rx"; ++ status = "disabled"; ++ }; ++ + blsp1_i2c2: i2c@78b6000 { + compatible = "qcom,i2c-qup-v2.2.1"; + #address-cells = <1>; diff --git a/target/linux/qualcommax/patches-6.6/2170-clk-qcom-ipq8074-Support-added-for-necessary-clocks-and-reset.patch b/target/linux/qualcommax/patches-6.6/2170-clk-qcom-ipq8074-Support-added-for-necessary-clocks-and-reset.patch new file mode 100644 index 00000000000..76cc8caac9a --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2170-clk-qcom-ipq8074-Support-added-for-necessary-clocks-and-reset.patch @@ -0,0 +1,311 @@ +From 6504bc9edeb1a2a54d813f4bb5d0267e7bf827f9 Mon Sep 17 00:00:00 2001 +From: Praveenkumar I +Date: Thu, 6 Feb 2020 17:35:42 +0530 +Subject: [PATCH 4/8] clk: ipq8074: Support added for necessary clocks and + reset + +Change-Id: I21a76a44185f766e9b6dcba274392ea8e599718b +Signed-off-by: Praveenkumar I +Signed-off-by: Rajkumar Ayyasamy +--- + drivers/clk/qcom/gcc-ipq8074.c | 238 ++++++++++++++++++- + include/dt-bindings/clock/qcom,gcc-ipq8074.h | 35 ++- + 2 files changed, 258 insertions(+), 15 deletions(-) + +--- a/drivers/clk/qcom/gcc-ipq8074.c ++++ b/drivers/clk/qcom/gcc-ipq8074.c +@@ -48,6 +48,22 @@ enum { + P_UNIPHY2_TX, + }; + ++static const char * const gcc_xo_gpll4_gpll0_gpll6_gpll0_div2[] = { ++ "xo", ++ "gpll4", ++ "gpll0", ++ "gpll6", ++ "gpll0_out_main_div2", ++}; ++ ++static const struct parent_map gcc_xo_gpll4_gpll0_gpll6_gpll0_div2_map[] = { ++ { P_XO, 0 }, ++ { P_GPLL4, 1 }, ++ { P_GPLL0, 2 }, ++ { P_GPLL6, 3 }, ++ { P_GPLL0_DIV2, 4 }, ++}; ++ + static struct clk_alpha_pll gpll0_main = { + .offset = 0x21000, + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], +@@ -629,6 +645,12 @@ static const struct freq_tbl ftbl_pcie_a + { } + }; + ++struct freq_tbl ftbl_pcie_rchng_clk_src[] = { ++ F(19200000, P_XO, 1, 0, 0), ++ F(100000000, P_GPLL0, 8, 0, 0), ++ { } ++}; ++ + static struct clk_rcg2 pcie0_axi_clk_src = { + .cmd_rcgr = 0x75054, + .freq_tbl = ftbl_pcie_axi_clk_src, +@@ -2029,6 +2051,78 @@ static struct clk_rcg2 gp3_clk_src = { + }, + }; + ++struct freq_tbl ftbl_qdss_tsctr_clk_src[] = { ++ F(160000000, P_GPLL0_DIV2, 2.5, 0, 0), ++ F(320000000, P_GPLL0, 2.5, 0, 0), ++ F(600000000, P_GPLL6, 2, 0, 0), ++ { } ++}; ++ ++struct clk_rcg2 qdss_tsctr_clk_src = { ++ .cmd_rcgr = 0x29064, ++ .freq_tbl = ftbl_qdss_tsctr_clk_src, ++ .hid_width = 5, ++ .parent_map = gcc_xo_gpll4_gpll0_gpll6_gpll0_div2_map, ++ .clkr.hw.init = &(struct clk_init_data){ ++ .name = "qdss_tsctr_clk_src", ++ .parent_names = gcc_xo_gpll4_gpll0_gpll6_gpll0_div2, ++ .num_parents = 5, ++ .ops = &clk_rcg2_ops, ++ }, ++}; ++ ++static struct clk_fixed_factor qdss_dap_sync_clk_src = { ++ .mult = 1, ++ .div = 4, ++ .hw.init = &(struct clk_init_data){ ++ .name = "qdss_dap_sync_clk_src", ++ .parent_names = (const char *[]){ ++ "qdss_tsctr_clk_src" ++ }, ++ .num_parents = 1, ++ .ops = &clk_fixed_factor_ops, ++ }, ++}; ++ ++struct freq_tbl ftbl_qdss_at_clk_src[] = { ++ F(66670000, P_GPLL0_DIV2, 6, 0, 0), ++ F(240000000, P_GPLL6, 6, 0, 0), ++ { } ++}; ++ ++struct clk_rcg2 qdss_at_clk_src = { ++ .cmd_rcgr = 0x2900c, ++ .freq_tbl = ftbl_qdss_at_clk_src, ++ .hid_width = 5, ++ .parent_map = gcc_xo_gpll4_gpll0_gpll6_gpll0_div2_map, ++ .clkr.hw.init = &(struct clk_init_data){ ++ .name = "qdss_at_clk_src", ++ .parent_names = gcc_xo_gpll4_gpll0_gpll6_gpll0_div2, ++ .num_parents = 5, ++ .ops = &clk_rcg2_ops, ++ }, ++}; ++ ++ ++struct freq_tbl ftbl_adss_pwm_clk_src[] = { ++ F(19200000, P_XO, 1, 0, 0), ++ F(200000000, P_GPLL0, 4, 0, 0), ++ { } ++}; ++ ++struct clk_rcg2 adss_pwm_clk_src = { ++ .cmd_rcgr = 0x1c008, ++ .freq_tbl = ftbl_adss_pwm_clk_src, ++ .hid_width = 5, ++ .parent_map = gcc_xo_gpll0_map, ++ .clkr.hw.init = &(struct clk_init_data){ ++ .name = "adss_pwm_clk_src", ++ .parent_data = gcc_xo_gpll0, ++ .num_parents = 2, ++ .ops = &clk_rcg2_ops, ++ }, ++}; ++ + static struct clk_branch gcc_blsp1_ahb_clk = { + .halt_reg = 0x01008, + .clkr = { +@@ -4224,13 +4318,7 @@ static struct clk_branch gcc_gp3_clk = { + }, + }; + +-static const struct freq_tbl ftbl_pcie_rchng_clk_src[] = { +- F(19200000, P_XO, 1, 0, 0), +- F(100000000, P_GPLL0, 8, 0, 0), +- { } +-}; +- +-static struct clk_rcg2 pcie0_rchng_clk_src = { ++struct clk_rcg2 pcie0_rchng_clk_src = { + .cmd_rcgr = 0x75070, + .freq_tbl = ftbl_pcie_rchng_clk_src, + .hid_width = 5, +@@ -4322,6 +4410,114 @@ static const struct alpha_pll_config nss + .alpha_en_mask = BIT(24), + }; + ++static struct clk_branch gcc_snoc_bus_timeout2_ahb_clk = { ++ .halt_reg = 0x4700c, ++ .halt_bit = 31, ++ .clkr = { ++ .enable_reg = 0x4700c, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_snoc_bus_timeout2_ahb_clk", ++ .parent_names = (const char *[]){ ++ "usb0_master_clk_src" ++ }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_snoc_bus_timeout3_ahb_clk = { ++ .halt_reg = 0x47014, ++ .halt_bit = 31, ++ .clkr = { ++ .enable_reg = 0x47014, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_snoc_bus_timeout3_ahb_clk", ++ .parent_names = (const char *[]){ ++ "usb1_master_clk_src" ++ }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_dcc_clk = { ++ .halt_reg = 0x77004, ++ .halt_bit = 31, ++ .clkr = { ++ .enable_reg = 0x77004, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_dcc_clk", ++ .parent_names = (const char *[]){ ++ "pcnoc_clk_src" ++ }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_qdss_at_clk = { ++ .halt_reg = 0x29024, ++ .halt_bit = 31, ++ .clkr = { ++ .enable_reg = 0x29024, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_qdss_at_clk", ++ .parent_names = (const char *[]){ ++ "qdss_at_clk_src" ++ }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_qdss_dap_clk = { ++ .halt_reg = 0x29084, ++ .halt_bit = 31, ++ .clkr = { ++ .enable_reg = 0x29084, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_qdss_dap_clk", ++ .parent_names = (const char *[]){ ++ "qdss_dap_sync_clk_src" ++ }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_adss_pwm_clk = { ++ .halt_reg = 0x1c020, ++ .halt_bit = 31, ++ .clkr = { ++ .enable_reg = 0x1c020, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_adss_pwm_clk", ++ .parent_names = (const char *[]){ ++ "adss_pwm_clk_src" ++ }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ + static struct clk_hw *gcc_ipq8074_hws[] = { + &gpll0_out_main_div2.hw, + &gpll6_out_main_div2.hw, +@@ -4330,6 +4526,7 @@ static struct clk_hw *gcc_ipq8074_hws[] + &gcc_xo_div4_clk_src.hw, + &nss_noc_clk_src.hw, + &nss_ppe_cdiv_clk_src.hw, ++ &qdss_dap_sync_clk_src.hw, + }; + + static struct clk_regmap *gcc_ipq8074_clks[] = { +@@ -4561,6 +4758,15 @@ static struct clk_regmap *gcc_ipq8074_cl + [GCC_PCIE0_RCHNG_CLK] = &gcc_pcie0_rchng_clk.clkr, + [GCC_PCIE0_AXI_S_BRIDGE_CLK] = &gcc_pcie0_axi_s_bridge_clk.clkr, + [GCC_CRYPTO_PPE_CLK] = &gcc_crypto_ppe_clk.clkr, ++ [GCC_SNOC_BUS_TIMEOUT2_AHB_CLK] = &gcc_snoc_bus_timeout2_ahb_clk.clkr, ++ [GCC_SNOC_BUS_TIMEOUT3_AHB_CLK] = &gcc_snoc_bus_timeout3_ahb_clk.clkr, ++ [GCC_DCC_CLK] = &gcc_dcc_clk.clkr, ++ [QDSS_TSCTR_CLK_SRC] = &qdss_tsctr_clk_src.clkr, ++ [QDSS_AT_CLK_SRC] = &qdss_at_clk_src.clkr, ++ [GCC_QDSS_AT_CLK] = &gcc_qdss_at_clk.clkr, ++ [GCC_QDSS_DAP_CLK] = &gcc_qdss_dap_clk.clkr, ++ [ADSS_PWM_CLK_SRC] = &adss_pwm_clk_src.clkr, ++ [GCC_ADSS_PWM_CLK] = &gcc_adss_pwm_clk.clkr, + }; + + static const struct qcom_reset_map gcc_ipq8074_resets[] = { +--- a/include/dt-bindings/clock/qcom,gcc-ipq8074.h ++++ b/include/dt-bindings/clock/qcom,gcc-ipq8074.h +@@ -230,10 +230,19 @@ + #define GCC_GP1_CLK 221 + #define GCC_GP2_CLK 222 + #define GCC_GP3_CLK 223 +-#define GCC_PCIE0_AXI_S_BRIDGE_CLK 224 +-#define GCC_PCIE0_RCHNG_CLK_SRC 225 +-#define GCC_PCIE0_RCHNG_CLK 226 +-#define GCC_CRYPTO_PPE_CLK 227 ++#define GCC_CRYPTO_PPE_CLK 224 ++#define GCC_PCIE0_RCHNG_CLK_SRC 225 ++#define GCC_PCIE0_RCHNG_CLK 226 ++#define GCC_PCIE0_AXI_S_BRIDGE_CLK 227 ++#define GCC_SNOC_BUS_TIMEOUT2_AHB_CLK 228 ++#define GCC_SNOC_BUS_TIMEOUT3_AHB_CLK 229 ++#define GCC_DCC_CLK 230 ++#define ADSS_PWM_CLK_SRC 231 ++#define GCC_ADSS_PWM_CLK 232 ++#define QDSS_TSCTR_CLK_SRC 233 ++#define QDSS_AT_CLK_SRC 234 ++#define GCC_QDSS_AT_CLK 235 ++#define GCC_QDSS_DAP_CLK 236 + + #define GCC_BLSP1_BCR 0 + #define GCC_BLSP1_QUP1_BCR 1 diff --git a/target/linux/qualcommax/patches-6.6/2171-1-clk-qcom-ipq8074-Fix-gcc_snoc_bus_timeout_ahb_clk-offset.patch b/target/linux/qualcommax/patches-6.6/2171-1-clk-qcom-ipq8074-Fix-gcc_snoc_bus_timeout_ahb_clk-offset.patch new file mode 100644 index 00000000000..b1393fc9ad4 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2171-1-clk-qcom-ipq8074-Fix-gcc_snoc_bus_timeout_ahb_clk-offset.patch @@ -0,0 +1,44 @@ +From 462aa0c53397ec5bf78e3e7f68aa8a3ca300f4ba Mon Sep 17 00:00:00 2001 +From: Selvam Sathappan Periakaruppan +Date: Tue, 24 Mar 2020 19:09:38 +0530 +Subject: [PATCH 5/8] clk: qcom: ipq8074: Fix gcc_snoc_bus_timeout_ahb_clk + offset + +By default, the ipq8074 V2 clks are provided in the gcc driver. +Updating the gcc_snoc_bus_timeout_ahb_clk offsets also as needed +in ipq8074 V2. + +Change-Id: I5a6e98d002f5c3354a804e55dd9ebb1f83f7f974 +Signed-off-by: Selvam Sathappan Periakaruppan +--- + drivers/clk/qcom/gcc-ipq8074.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/clk/qcom/gcc-ipq8074.c ++++ b/drivers/clk/qcom/gcc-ipq8074.c +@@ -4411,10 +4411,10 @@ static const struct alpha_pll_config nss + }; + + static struct clk_branch gcc_snoc_bus_timeout2_ahb_clk = { +- .halt_reg = 0x4700c, ++ .halt_reg = 0x47014, + .halt_bit = 31, + .clkr = { +- .enable_reg = 0x4700c, ++ .enable_reg = 0x47014, + .enable_mask = BIT(0), + .hw.init = &(struct clk_init_data){ + .name = "gcc_snoc_bus_timeout2_ahb_clk", +@@ -4429,10 +4429,10 @@ static struct clk_branch gcc_snoc_bus_ti + }; + + static struct clk_branch gcc_snoc_bus_timeout3_ahb_clk = { +- .halt_reg = 0x47014, ++ .halt_reg = 0x4701C, + .halt_bit = 31, + .clkr = { +- .enable_reg = 0x47014, ++ .enable_reg = 0x4701C, + .enable_mask = BIT(0), + .hw.init = &(struct clk_init_data){ + .name = "gcc_snoc_bus_timeout3_ahb_clk", diff --git a/target/linux/qualcommax/patches-6.6/2171-2-clk-qcom-ipq8074-Fix-gcc_blsp1_ahb_clk-properties.patch b/target/linux/qualcommax/patches-6.6/2171-2-clk-qcom-ipq8074-Fix-gcc_blsp1_ahb_clk-properties.patch new file mode 100644 index 00000000000..a7abddd5fdd --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2171-2-clk-qcom-ipq8074-Fix-gcc_blsp1_ahb_clk-properties.patch @@ -0,0 +1,41 @@ +From 52315bec6ed633b6a71f28b746029602f8bd70b9 Mon Sep 17 00:00:00 2001 +From: Balaji Prakash J +Date: Wed, 22 Apr 2020 20:35:30 +0530 +Subject: [PATCH] clk: ipq8074: fix gcc_blsp1_ahb_clk properties + +All the voting enabled clocks does not support the enable +from CBCR register. So, updated gcc_blsp1_ahb_clk enable +register and mask to enable bit in APCS_CLOCK_BRANCH_ENA_VOTE. + +Also, the voting controlled clocks are shared among multiple +components like APSS, RPM, NSS, TZ, etc. So, turning the +voting off from APSS does not make the clock off if it has +been voted from another component. Added the flag +BRANCH_HALT_VOTED in order to skip checking the clock +disable status. + +This change is referred from the below commits, +1. 246b4fb3af9bd65d8af794aac2f0e7b1ed9cc2dd +2. c8374157d5ae91d3b3e0d513d62808a798b32d3a + +Signed-off-by: Balaji Prakash J +Change-Id: I505cb560b31ad27a02c165fbe13bb33a2fc7d230 +--- + drivers/clk/qcom/gcc-ipq8074.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/clk/qcom/gcc-ipq8074.c ++++ b/drivers/clk/qcom/gcc-ipq8074.c +@@ -2125,9 +2125,10 @@ struct clk_rcg2 adss_pwm_clk_src = { + + static struct clk_branch gcc_blsp1_ahb_clk = { + .halt_reg = 0x01008, ++ .halt_check = BRANCH_HALT_VOTED, + .clkr = { +- .enable_reg = 0x01008, +- .enable_mask = BIT(0), ++ .enable_reg = 0x0b004, ++ .enable_mask = BIT(10), + .hw.init = &(struct clk_init_data){ + .name = "gcc_blsp1_ahb_clk", + .parent_hws = (const struct clk_hw *[]){ diff --git a/target/linux/qualcommax/patches-6.6/2600-1-qca-nss-ecm-support-CORE.patch b/target/linux/qualcommax/patches-6.6/2600-1-qca-nss-ecm-support-CORE.patch new file mode 100644 index 00000000000..8aed01612b5 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2600-1-qca-nss-ecm-support-CORE.patch @@ -0,0 +1,785 @@ +--- a/include/linux/if_bridge.h ++++ b/include/linux/if_bridge.h +@@ -71,6 +71,9 @@ void brioctl_set(int (*hook)(struct net + void __user *uarg)); + int br_ioctl_call(struct net *net, struct net_bridge *br, unsigned int cmd, + struct ifreq *ifr, void __user *uarg); ++extern void br_dev_update_stats(struct net_device *dev, ++ struct rtnl_link_stats64 *nlstats); ++extern bool br_is_hairpin_enabled(struct net_device *dev); + + #if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING) + int br_multicast_list_adjacent(struct net_device *dev, +@@ -213,4 +216,42 @@ static inline clock_t br_get_ageing_time + } + #endif + ++/* QCA NSS ECM support - Start */ ++extern struct net_device *br_port_dev_get(struct net_device *dev, ++ unsigned char *addr, ++ struct sk_buff *skb, ++ unsigned int cookie); ++extern void br_refresh_fdb_entry(struct net_device *dev, const char *addr); ++extern void br_fdb_entry_refresh(struct net_device *dev, const char *addr, __u16 vid); ++extern struct net_bridge_fdb_entry *br_fdb_has_entry(struct net_device *dev, ++ const char *addr, ++ __u16 vid); ++extern void br_fdb_update_register_notify(struct notifier_block *nb); ++extern void br_fdb_update_unregister_notify(struct notifier_block *nb); ++ ++typedef struct net_bridge_port *br_port_dev_get_hook_t(struct net_device *dev, ++ struct sk_buff *skb, ++ unsigned char *addr, ++ unsigned int cookie); ++extern br_port_dev_get_hook_t __rcu *br_port_dev_get_hook; ++ ++#define BR_FDB_EVENT_ADD 0x01 ++#define BR_FDB_EVENT_DEL 0x02 ++ ++struct br_fdb_event { ++ struct net_device *dev; ++ unsigned char addr[6]; ++ unsigned char is_local; ++ struct net_bridge *br; ++ struct net_device *orig_dev; ++}; ++extern void br_fdb_register_notify(struct notifier_block *nb); ++extern void br_fdb_unregister_notify(struct notifier_block *nb); ++ ++typedef struct net_bridge_port *br_get_dst_hook_t( ++ const struct net_bridge_port *src, ++ struct sk_buff **skb); ++extern br_get_dst_hook_t __rcu *br_get_dst_hook; ++/* QCA NSS ECM support - End */ ++ + #endif +--- a/include/linux/if_vlan.h ++++ b/include/linux/if_vlan.h +@@ -235,7 +235,28 @@ extern void vlan_vids_del_by_dev(struct + + extern bool vlan_uses_dev(const struct net_device *dev); + ++/* QCA NSS ECM support - Start */ ++extern void __vlan_dev_update_accel_stats(struct net_device *dev, ++ struct rtnl_link_stats64 *stats); ++extern u16 vlan_dev_get_egress_prio(struct net_device *dev, u32 skb_prio); ++extern struct net_device *vlan_dev_next_dev(const struct net_device *dev); ++/* QCA NSS ECM support - End */ ++ + #else ++/* QCA NSS ECM support - Start */ ++static inline void __vlan_dev_update_accel_stats(struct net_device *dev, ++ struct rtnl_link_stats64 *stats) ++{ ++ ++} ++ ++static inline u16 vlan_dev_get_egress_prio(struct net_device *dev, ++ u32 skb_prio) ++{ ++ return 0; ++} ++/* QCA NSS ECM support - End */ ++ + static inline struct net_device * + __vlan_find_dev_deep_rcu(struct net_device *real_dev, + __be16 vlan_proto, u16 vlan_id) +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h +@@ -2936,6 +2936,10 @@ enum netdev_cmd { + NETDEV_OFFLOAD_XSTATS_REPORT_USED, + NETDEV_OFFLOAD_XSTATS_REPORT_DELTA, + NETDEV_XDP_FEAT_CHANGE, ++ /* QCA NSS ECM Support - Start */ ++ NETDEV_BR_JOIN, ++ NETDEV_BR_LEAVE, ++ /* QCA NSS ECM Support - End */ + }; + const char *netdev_cmd_to_name(enum netdev_cmd cmd); + +--- a/include/net/addrconf.h ++++ b/include/net/addrconf.h +@@ -514,4 +514,9 @@ int if6_proc_init(void); + void if6_proc_exit(void); + #endif + ++/* QCA NSS ECM support - Start */ ++struct net_device *ipv6_dev_find_and_hold(struct net *net, struct in6_addr *addr, ++ int strict); ++/* QCA NSS ECM support - End */ ++ + #endif +--- a/include/net/ip6_route.h ++++ b/include/net/ip6_route.h +@@ -207,6 +207,11 @@ void rt6_multipath_rebalance(struct fib6 + void rt6_uncached_list_add(struct rt6_info *rt); + void rt6_uncached_list_del(struct rt6_info *rt); + ++/* QCA NSS ECM support - Start */ ++int rt6_register_notifier(struct notifier_block *nb); ++int rt6_unregister_notifier(struct notifier_block *nb); ++/* QCA NSS ECM support - End */ ++ + static inline const struct rt6_info *skb_rt6_info(const struct sk_buff *skb) + { + const struct dst_entry *dst = skb_dst(skb); +--- a/include/net/neighbour.h ++++ b/include/net/neighbour.h +@@ -600,4 +600,15 @@ static inline void neigh_update_is_route + *notify = 1; + } + } ++ ++/* QCA NSS ECM support - Start */ ++struct neigh_mac_update { ++ unsigned char old_mac[ALIGN(MAX_ADDR_LEN, sizeof(unsigned long))]; ++ unsigned char update_mac[ALIGN(MAX_ADDR_LEN, sizeof(unsigned long))]; ++}; ++ ++extern void neigh_mac_update_register_notify(struct notifier_block *nb); ++extern void neigh_mac_update_unregister_notify(struct notifier_block *nb); ++/* QCA NSS ECM support - End */ ++ + #endif +--- a/include/net/route.h ++++ b/include/net/route.h +@@ -237,6 +237,11 @@ struct rtable *rt_dst_alloc(struct net_d + unsigned int flags, u16 type, bool noxfrm); + struct rtable *rt_dst_clone(struct net_device *dev, struct rtable *rt); + ++/* QCA NSS ECM support - Start */ ++int ip_rt_register_notifier(struct notifier_block *nb); ++int ip_rt_unregister_notifier(struct notifier_block *nb); ++/* QCA NSS ECM support - End */ ++ + struct in_ifaddr; + void fib_add_ifaddr(struct in_ifaddr *); + void fib_del_ifaddr(struct in_ifaddr *, struct in_ifaddr *); +--- a/net/bridge/br_private.h ++++ b/net/bridge/br_private.h +@@ -2266,4 +2266,9 @@ void br_do_suppress_nd(struct sk_buff *s + u16 vid, struct net_bridge_port *p, struct nd_msg *msg); + struct nd_msg *br_is_nd_neigh_msg(struct sk_buff *skb, struct nd_msg *m); + bool br_is_neigh_suppress_enabled(const struct net_bridge_port *p, u16 vid); ++ ++/* QCA NSS ECM support - Start */ ++#define __br_get(__hook, __default, __args ...) \ ++ (__hook ? (__hook(__args)) : (__default)) ++/* QCA NSS ECM support - End */ + #endif +--- a/net/8021q/vlan_core.c ++++ b/net/8021q/vlan_core.c +@@ -555,4 +555,52 @@ static int __init vlan_offload_init(void + return 0; + } + ++/* QCA NSS ECM support - Start */ ++/* Update the VLAN device with statistics from network offload engines */ ++void __vlan_dev_update_accel_stats(struct net_device *dev, ++ struct rtnl_link_stats64 *nlstats) ++{ ++ struct vlan_pcpu_stats *stats; ++ ++ if (!is_vlan_dev(dev)) ++ return; ++ ++ stats = per_cpu_ptr(vlan_dev_priv(dev)->vlan_pcpu_stats, 0); ++ ++ u64_stats_update_begin(&stats->syncp); ++ u64_stats_add(&stats->rx_packets, nlstats->rx_packets); ++ u64_stats_add(&stats->rx_bytes, nlstats->rx_bytes); ++ u64_stats_add(&stats->tx_packets, nlstats->tx_packets); ++ u64_stats_add(&stats->tx_bytes, nlstats->tx_bytes); ++ u64_stats_update_end(&stats->syncp); ++} ++EXPORT_SYMBOL(__vlan_dev_update_accel_stats); ++ ++/* Lookup the 802.1p egress_map table and return the 802.1p value */ ++u16 vlan_dev_get_egress_prio(struct net_device *dev, u32 skb_prio) ++{ ++ struct vlan_priority_tci_mapping *mp; ++ ++ mp = vlan_dev_priv(dev)->egress_priority_map[(skb_prio & 0xf)]; ++ while (mp) { ++ if (mp->priority == skb_prio) { ++ /* This should already be shifted ++ * to mask correctly with the ++ * VLAN's TCI ++ */ ++ return mp->vlan_qos; ++ } ++ mp = mp->next; ++ } ++ return 0; ++} ++EXPORT_SYMBOL(vlan_dev_get_egress_prio); ++ ++struct net_device *vlan_dev_next_dev(const struct net_device *dev) ++{ ++ return vlan_dev_priv(dev)->real_dev; ++} ++EXPORT_SYMBOL(vlan_dev_next_dev); ++/* QCA NSS ECM support - End */ ++ + fs_initcall(vlan_offload_init); +--- a/net/bridge/br_fdb.c ++++ b/net/bridge/br_fdb.c +@@ -33,6 +33,35 @@ static const struct rhashtable_params br + + static struct kmem_cache *br_fdb_cache __read_mostly; + ++/* QCA NSS ECM support - Start */ ++ATOMIC_NOTIFIER_HEAD(br_fdb_notifier_list); ++ATOMIC_NOTIFIER_HEAD(br_fdb_update_notifier_list); ++ ++void br_fdb_register_notify(struct notifier_block *nb) ++{ ++ atomic_notifier_chain_register(&br_fdb_notifier_list, nb); ++} ++EXPORT_SYMBOL_GPL(br_fdb_register_notify); ++ ++void br_fdb_unregister_notify(struct notifier_block *nb) ++{ ++ atomic_notifier_chain_unregister(&br_fdb_notifier_list, nb); ++} ++EXPORT_SYMBOL_GPL(br_fdb_unregister_notify); ++ ++void br_fdb_update_register_notify(struct notifier_block *nb) ++{ ++ atomic_notifier_chain_register(&br_fdb_update_notifier_list, nb); ++} ++EXPORT_SYMBOL_GPL(br_fdb_update_register_notify); ++ ++void br_fdb_update_unregister_notify(struct notifier_block *nb) ++{ ++ atomic_notifier_chain_unregister(&br_fdb_update_notifier_list, nb); ++} ++EXPORT_SYMBOL_GPL(br_fdb_update_unregister_notify); ++/* QCA NSS ECM support - End */ ++ + int __init br_fdb_init(void) + { + br_fdb_cache = kmem_cache_create("bridge_fdb_cache", +@@ -192,7 +221,26 @@ static void fdb_notify(struct net_bridge + struct sk_buff *skb; + int err = -ENOBUFS; + +- if (swdev_notify) ++ /* QCA NSS ECM support - Start */ ++ if (fdb->dst) { ++ int event; ++ struct br_fdb_event fdb_event; ++ ++ if (type == RTM_NEWNEIGH) ++ event = BR_FDB_EVENT_ADD; ++ else ++ event = BR_FDB_EVENT_DEL; ++ ++ fdb_event.dev = fdb->dst->dev; ++ ether_addr_copy(fdb_event.addr, fdb->key.addr.addr); ++ fdb_event.is_local = test_bit(BR_FDB_LOCAL, &fdb->flags); ++ atomic_notifier_call_chain(&br_fdb_notifier_list, ++ event, ++ (void *)&fdb_event); ++ } ++ /* QCA NSS ECM support - End */ ++ ++ if (swdev_notify) + br_switchdev_fdb_notify(br, fdb, type); + + skb = nlmsg_new(fdb_nlmsg_size(), GFP_ATOMIC); +@@ -527,6 +575,7 @@ void br_fdb_cleanup(struct work_struct * + unsigned long delay = hold_time(br); + unsigned long work_delay = delay; + unsigned long now = jiffies; ++ u8 mac_addr[6]; /* QCA NSS ECM support */ + + /* this part is tricky, in order to avoid blocking learning and + * consequently forwarding, we rely on rcu to delete objects with +@@ -553,8 +602,15 @@ void br_fdb_cleanup(struct work_struct * + work_delay = min(work_delay, this_timer - now); + } else { + spin_lock_bh(&br->hash_lock); +- if (!hlist_unhashed(&f->fdb_node)) ++ if (!hlist_unhashed(&f->fdb_node)) { ++ ether_addr_copy(mac_addr, f->key.addr.addr); + fdb_delete(br, f, true); ++ /* QCA NSS ECM support - Start */ ++ atomic_notifier_call_chain( ++ &br_fdb_update_notifier_list, 0, ++ (void *)mac_addr); ++ /* QCA NSS ECM support - End */ ++ } + spin_unlock_bh(&br->hash_lock); + } + } +@@ -891,6 +947,12 @@ void br_fdb_update(struct net_bridge *br + */ + if (unlikely(test_bit(BR_FDB_LOCKED, &fdb->flags))) + clear_bit(BR_FDB_LOCKED, &fdb->flags); ++ ++ /* QCA NSS ECM support - Start */ ++ atomic_notifier_call_chain( ++ &br_fdb_update_notifier_list, ++ 0, (void *)addr); ++ /* QCA NSS ECM support - End */ + } + + if (unlikely(test_bit(BR_FDB_ADDED_BY_USER, &flags))) +@@ -1508,3 +1570,62 @@ void br_fdb_clear_offload(const struct n + spin_unlock_bh(&p->br->hash_lock); + } + EXPORT_SYMBOL_GPL(br_fdb_clear_offload); ++ ++/* QCA NSS ECM support - Start */ ++/* Refresh FDB entries for bridge packets being forwarded by offload engines */ ++void br_refresh_fdb_entry(struct net_device *dev, const char *addr) ++{ ++ struct net_bridge_port *p = br_port_get_rcu(dev); ++ ++ if (!p || p->state == BR_STATE_DISABLED) ++ return; ++ ++ if (!is_valid_ether_addr(addr)) { ++ pr_info("bridge: Attempt to refresh with invalid ether address %pM\n", ++ addr); ++ return; ++ } ++ ++ rcu_read_lock(); ++ br_fdb_update(p->br, p, addr, 0, true); ++ rcu_read_unlock(); ++} ++EXPORT_SYMBOL_GPL(br_refresh_fdb_entry); ++ ++/* Update timestamp of FDB entries for bridge packets being forwarded by offload engines */ ++void br_fdb_entry_refresh(struct net_device *dev, const char *addr, __u16 vid) ++{ ++ struct net_bridge_fdb_entry *fdb; ++ struct net_bridge_port *p = br_port_get_rcu(dev); ++ ++ if (!p || p->state == BR_STATE_DISABLED) ++ return; ++ ++ rcu_read_lock(); ++ fdb = fdb_find_rcu(&p->br->fdb_hash_tbl, addr, vid); ++ if (likely(fdb)) { ++ fdb->updated = jiffies; ++ } ++ rcu_read_unlock(); ++} ++EXPORT_SYMBOL_GPL(br_fdb_entry_refresh); ++ ++/* Look up the MAC address in the device's bridge fdb table */ ++struct net_bridge_fdb_entry *br_fdb_has_entry(struct net_device *dev, ++ const char *addr, __u16 vid) ++{ ++ struct net_bridge_port *p = br_port_get_rcu(dev); ++ struct net_bridge_fdb_entry *fdb; ++ ++ if (!p || p->state == BR_STATE_DISABLED) ++ return NULL; ++ ++ rcu_read_lock(); ++ fdb = fdb_find_rcu(&p->br->fdb_hash_tbl, addr, vid); ++ rcu_read_unlock(); ++ ++ return fdb; ++} ++EXPORT_SYMBOL_GPL(br_fdb_has_entry); ++/* QCA NSS ECM support - End */ ++ +--- a/net/bridge/br_if.c ++++ b/net/bridge/br_if.c +@@ -26,6 +26,12 @@ + + #include "br_private.h" + ++/* QCA NSS ECM support - Start */ ++/* Hook for external forwarding logic */ ++br_port_dev_get_hook_t __rcu *br_port_dev_get_hook __read_mostly; ++EXPORT_SYMBOL_GPL(br_port_dev_get_hook); ++/* QCA NSS ECM support - End */ ++ + /* + * Determine initial path cost based on speed. + * using recommendations from 802.1d standard +@@ -697,6 +703,8 @@ int br_add_if(struct net_bridge *br, str + + kobject_uevent(&p->kobj, KOBJ_ADD); + ++ call_netdevice_notifiers(NETDEV_BR_JOIN, dev); /* QCA NSS ECM support */ ++ + return 0; + + err6: +@@ -732,6 +740,8 @@ int br_del_if(struct net_bridge *br, str + if (!p || p->br != br) + return -EINVAL; + ++ call_netdevice_notifiers(NETDEV_BR_LEAVE, dev); /* QCA NSS ECM support */ ++ + /* Since more than one interface can be attached to a bridge, + * there still maybe an alternate path for netconsole to use; + * therefore there is no reason for a NETDEV_RELEASE event. +@@ -775,3 +785,96 @@ bool br_port_flag_is_set(const struct ne + return p->flags & flag; + } + EXPORT_SYMBOL_GPL(br_port_flag_is_set); ++ ++/* QCA NSS ECM support - Start */ ++/* API to know if hairpin feature is enabled/disabled on this bridge port */ ++bool br_is_hairpin_enabled(struct net_device *dev) ++{ ++ struct net_bridge_port *port = br_port_get_check_rcu(dev); ++ ++ if (likely(port)) ++ return port->flags & BR_HAIRPIN_MODE; ++ return false; ++} ++EXPORT_SYMBOL_GPL(br_is_hairpin_enabled); ++ ++/* br_port_dev_get() ++ * If a skb is provided, and the br_port_dev_get_hook_t hook exists, ++ * use that to try and determine the egress port for that skb. ++ * If not, or no egress port could be determined, use the given addr ++ * to identify the port to which it is reachable, ++ * returing a reference to the net device associated with that port. ++ * ++ * NOTE: Return NULL if given dev is not a bridge or the mac has no ++ * associated port. ++ */ ++struct net_device *br_port_dev_get(struct net_device *dev, unsigned char *addr, ++ struct sk_buff *skb, ++ unsigned int cookie) ++{ ++ struct net_bridge_fdb_entry *fdbe; ++ struct net_bridge *br; ++ struct net_device *netdev = NULL; ++ ++ /* Is this a bridge? */ ++ if (!(dev->priv_flags & IFF_EBRIDGE)) ++ return NULL; ++ ++ rcu_read_lock(); ++ ++ /* If the hook exists and the skb isn't NULL, try and get the port */ ++ if (skb) { ++ br_port_dev_get_hook_t *port_dev_get_hook; ++ ++ port_dev_get_hook = rcu_dereference(br_port_dev_get_hook); ++ if (port_dev_get_hook) { ++ struct net_bridge_port *pdst = ++ __br_get(port_dev_get_hook, NULL, dev, skb, ++ addr, cookie); ++ if (pdst) { ++ dev_hold(pdst->dev); ++ netdev = pdst->dev; ++ goto out; ++ } ++ } ++ } ++ ++ /* Either there is no hook, or can't ++ * determine the port to use - fall back to using FDB ++ */ ++ ++ br = netdev_priv(dev); ++ ++ /* Lookup the fdb entry and get reference to the port dev */ ++ fdbe = br_fdb_find_rcu(br, addr, 0); ++ if (fdbe && fdbe->dst) { ++ netdev = fdbe->dst->dev; /* port device */ ++ dev_hold(netdev); ++ } ++out: ++ rcu_read_unlock(); ++ return netdev; ++} ++EXPORT_SYMBOL_GPL(br_port_dev_get); ++ ++/* Update bridge statistics for bridge packets processed by offload engines */ ++void br_dev_update_stats(struct net_device *dev, ++ struct rtnl_link_stats64 *nlstats) ++{ ++ struct pcpu_sw_netstats *tstats; ++ ++ /* Is this a bridge? */ ++ if (!(dev->priv_flags & IFF_EBRIDGE)) ++ return; ++ ++ tstats = this_cpu_ptr(dev->tstats); ++ ++ u64_stats_update_begin(&tstats->syncp); ++ u64_stats_add(&tstats->rx_packets, nlstats->rx_packets); ++ u64_stats_add(&tstats->rx_bytes, nlstats->rx_bytes); ++ u64_stats_add(&tstats->tx_packets, nlstats->tx_packets); ++ u64_stats_add(&tstats->tx_bytes, nlstats->tx_bytes); ++ u64_stats_update_end(&tstats->syncp); ++} ++EXPORT_SYMBOL_GPL(br_dev_update_stats); ++/* QCA NSS ECM support - End */ +--- a/net/core/neighbour.c ++++ b/net/core/neighbour.c +@@ -1275,6 +1275,22 @@ static void neigh_update_hhs(struct neig + } + } + ++/* QCA NSS ECM support - Start */ ++ATOMIC_NOTIFIER_HEAD(neigh_mac_update_notifier_list); ++ ++void neigh_mac_update_register_notify(struct notifier_block *nb) ++{ ++ atomic_notifier_chain_register(&neigh_mac_update_notifier_list, nb); ++} ++EXPORT_SYMBOL_GPL(neigh_mac_update_register_notify); ++ ++void neigh_mac_update_unregister_notify(struct notifier_block *nb) ++{ ++ atomic_notifier_chain_unregister(&neigh_mac_update_notifier_list, nb); ++} ++EXPORT_SYMBOL_GPL(neigh_mac_update_unregister_notify); ++/* QCA NSS ECM support - End */ ++ + /* Generic update routine. + -- lladdr is new lladdr or NULL, if it is not supplied. + -- new is new state. +@@ -1303,6 +1319,7 @@ static int __neigh_update(struct neighbo + struct net_device *dev; + int err, notify = 0; + u8 old; ++ struct neigh_mac_update nmu; /* QCA NSS ECM support */ + + trace_neigh_update(neigh, lladdr, new, flags, nlmsg_pid); + +@@ -1317,7 +1334,10 @@ static int __neigh_update(struct neighbo + new = old; + goto out; + } +- if (!(flags & NEIGH_UPDATE_F_ADMIN) && ++ ++ memset(&nmu, 0, sizeof(struct neigh_mac_update)); /* QCA NSS ECM support */ ++ ++ if (!(flags & NEIGH_UPDATE_F_ADMIN) && + (old & (NUD_NOARP | NUD_PERMANENT))) + goto out; + +@@ -1354,7 +1374,12 @@ static int __neigh_update(struct neighbo + - compare new & old + - if they are different, check override flag + */ +- if ((old & NUD_VALID) && ++ /* QCA NSS ECM update - Start */ ++ memcpy(nmu.old_mac, neigh->ha, dev->addr_len); ++ memcpy(nmu.update_mac, lladdr, dev->addr_len); ++ /* QCA NSS ECM update - End */ ++ ++ if ((old & NUD_VALID) && + !memcmp(lladdr, neigh->ha, dev->addr_len)) + lladdr = neigh->ha; + } else { +@@ -1476,8 +1501,11 @@ out: + neigh_update_gc_list(neigh); + if (managed_update) + neigh_update_managed_list(neigh); +- if (notify) ++ if (notify) { + neigh_update_notify(neigh, nlmsg_pid); ++ atomic_notifier_call_chain(&neigh_mac_update_notifier_list, 0, ++ (struct neigh_mac_update *)&nmu); /* QCA NSS ECM support */ ++ } + trace_neigh_update_done(neigh, err); + return err; + } +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -1211,6 +1211,9 @@ static bool fib_valid_key_len(u32 key, u + static void fib_remove_alias(struct trie *t, struct key_vector *tp, + struct key_vector *l, struct fib_alias *old); + ++/* Define route change notification chain. */ ++static BLOCKING_NOTIFIER_HEAD(iproute_chain); /* QCA NSS ECM support */ ++ + /* Caller must hold RTNL. */ + int fib_table_insert(struct net *net, struct fib_table *tb, + struct fib_config *cfg, struct netlink_ext_ack *extack) +@@ -1404,6 +1407,9 @@ int fib_table_insert(struct net *net, st + rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, new_fa->tb_id, + &cfg->fc_nlinfo, nlflags); + succeeded: ++ blocking_notifier_call_chain(&iproute_chain, ++ RTM_NEWROUTE, fi); ++ + return 0; + + out_remove_new_fa: +@@ -1775,6 +1781,9 @@ int fib_table_delete(struct net *net, st + if (fa_to_delete->fa_state & FA_S_ACCESSED) + rt_cache_flush(cfg->fc_nlinfo.nl_net); + ++ blocking_notifier_call_chain(&iproute_chain, ++ RTM_DELROUTE, fa_to_delete->fa_info); ++ + fib_release_info(fa_to_delete->fa_info); + alias_free_mem_rcu(fa_to_delete); + return 0; +@@ -2407,6 +2416,20 @@ void __init fib_trie_init(void) + 0, SLAB_PANIC | SLAB_ACCOUNT, NULL); + } + ++/* QCA NSS ECM support - Start */ ++int ip_rt_register_notifier(struct notifier_block *nb) ++{ ++ return blocking_notifier_chain_register(&iproute_chain, nb); ++} ++EXPORT_SYMBOL(ip_rt_register_notifier); ++ ++int ip_rt_unregister_notifier(struct notifier_block *nb) ++{ ++ return blocking_notifier_chain_unregister(&iproute_chain, nb); ++} ++EXPORT_SYMBOL(ip_rt_unregister_notifier); ++/* QCA NSS ECM support - End */ ++ + struct fib_table *fib_trie_table(u32 id, struct fib_table *alias) + { + struct fib_table *tb; +--- a/net/ipv6/ndisc.c ++++ b/net/ipv6/ndisc.c +@@ -666,6 +666,7 @@ void ndisc_send_ns(struct net_device *de + if (skb) + ndisc_send_skb(skb, daddr, saddr); + } ++EXPORT_SYMBOL(ndisc_send_ns); + + void ndisc_send_rs(struct net_device *dev, const struct in6_addr *saddr, + const struct in6_addr *daddr) +--- a/net/ipv6/route.c ++++ b/net/ipv6/route.c +@@ -3853,6 +3853,9 @@ out_free: + return ERR_PTR(err); + } + ++/* Define route change notification chain. */ ++ATOMIC_NOTIFIER_HEAD(ip6route_chain); /* QCA NSS ECM support */ ++ + int ip6_route_add(struct fib6_config *cfg, gfp_t gfp_flags, + struct netlink_ext_ack *extack) + { +@@ -3864,6 +3867,10 @@ int ip6_route_add(struct fib6_config *cf + return PTR_ERR(rt); + + err = __ip6_ins_rt(rt, &cfg->fc_nlinfo, extack); ++ if (!err) ++ atomic_notifier_call_chain(&ip6route_chain, ++ RTM_NEWROUTE, rt); ++ + fib6_info_release(rt); + + return err; +@@ -3885,6 +3892,9 @@ static int __ip6_del_rt(struct fib6_info + err = fib6_del(rt, info); + spin_unlock_bh(&table->tb6_lock); + ++ if (!err) ++ atomic_notifier_call_chain(&ip6route_chain, ++ RTM_DELROUTE, rt); + out: + fib6_info_release(rt); + return err; +@@ -6336,6 +6346,20 @@ static int ip6_route_dev_notify(struct n + return NOTIFY_OK; + } + ++/* QCA NSS ECM support - Start */ ++int rt6_register_notifier(struct notifier_block *nb) ++{ ++ return atomic_notifier_chain_register(&ip6route_chain, nb); ++} ++EXPORT_SYMBOL(rt6_register_notifier); ++ ++int rt6_unregister_notifier(struct notifier_block *nb) ++{ ++ return atomic_notifier_chain_unregister(&ip6route_chain, nb); ++} ++EXPORT_SYMBOL(rt6_unregister_notifier); ++/* QCA NSS ECM support - End */ ++ + /* + * /proc + */ +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -1673,6 +1673,7 @@ const char *netdev_cmd_to_name(enum netd + N(PRE_CHANGEADDR) N(OFFLOAD_XSTATS_ENABLE) N(OFFLOAD_XSTATS_DISABLE) + N(OFFLOAD_XSTATS_REPORT_USED) N(OFFLOAD_XSTATS_REPORT_DELTA) + N(XDP_FEAT_CHANGE) ++ N(BR_JOIN) N(BR_LEAVE) + } + #undef N + return "UNKNOWN_NETDEV_EVENT"; +--- a/net/ipv6/addrconf.c ++++ b/net/ipv6/addrconf.c +@@ -1002,6 +1002,7 @@ void inet6_ifa_finish_destroy(struct ine + + kfree_rcu(ifp, rcu); + } ++EXPORT_SYMBOL(inet6_ifa_finish_destroy); + + static void + ipv6_link_dev_addr(struct inet6_dev *idev, struct inet6_ifaddr *ifp) +@@ -2068,6 +2069,36 @@ struct inet6_ifaddr *ipv6_get_ifaddr(str + + return result; + } ++EXPORT_SYMBOL(ipv6_get_ifaddr); ++ ++/* ipv6_dev_find_and_hold() ++ * Find (and hold) net device that has the given address. ++ * Or NULL on failure. ++ */ ++struct net_device *ipv6_dev_find_and_hold(struct net *net, struct in6_addr *addr, ++ int strict) ++{ ++ struct inet6_ifaddr *ifp; ++ struct net_device *dev; ++ ++ ifp = ipv6_get_ifaddr(net, addr, NULL, strict); ++ if (!ifp) ++ return NULL; ++ ++ if (!ifp->idev) { ++ in6_ifa_put(ifp); ++ return NULL; ++ } ++ ++ dev = ifp->idev->dev; ++ if (dev) ++ dev_hold(dev); ++ ++ in6_ifa_put(ifp); ++ ++ return dev; ++} ++EXPORT_SYMBOL(ipv6_dev_find_and_hold); + + /* Gets referenced address, destroys ifaddr */ + +--- a/include/net/vxlan.h ++++ b/include/net/vxlan.h +@@ -440,6 +440,15 @@ static inline __be32 vxlan_compute_rco(u + return vni_field; + } + ++/* ++ * vxlan_get_vni() ++ * Returns the vni corresponding to tunnel ++ */ ++static inline u32 vxlan_get_vni(struct vxlan_dev *vxlan_tun) ++{ ++ return be32_to_cpu(vxlan_tun->cfg.vni); ++} ++ + static inline unsigned short vxlan_get_sk_family(struct vxlan_sock *vs) + { + return vs->sock->sk->sk_family; diff --git a/target/linux/qualcommax/patches-6.6/2600-2-qca-nss-ecm-support-PPPOE-offload.patch b/target/linux/qualcommax/patches-6.6/2600-2-qca-nss-ecm-support-PPPOE-offload.patch new file mode 100644 index 00000000000..699330689c9 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2600-2-qca-nss-ecm-support-PPPOE-offload.patch @@ -0,0 +1,588 @@ +--- a/drivers/net/ppp/ppp_generic.c ++++ b/drivers/net/ppp/ppp_generic.c +@@ -48,6 +48,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -254,6 +255,25 @@ struct ppp_net { + #define seq_before(a, b) ((s32)((a) - (b)) < 0) + #define seq_after(a, b) ((s32)((a) - (b)) > 0) + ++ ++/* ++ * Registration/Unregistration methods ++ * for PPP channel connect and disconnect event notifications. ++ */ ++RAW_NOTIFIER_HEAD(ppp_channel_connection_notifier_list); ++ ++void ppp_channel_connection_register_notify(struct notifier_block *nb) ++{ ++ raw_notifier_chain_register(&ppp_channel_connection_notifier_list, nb); ++} ++EXPORT_SYMBOL_GPL(ppp_channel_connection_register_notify); ++ ++void ppp_channel_connection_unregister_notify(struct notifier_block *nb) ++{ ++ raw_notifier_chain_unregister(&ppp_channel_connection_notifier_list, nb); ++} ++EXPORT_SYMBOL_GPL(ppp_channel_connection_unregister_notify); ++ + /* Prototypes. */ + static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf, + struct file *file, unsigned int cmd, unsigned long arg); +@@ -3453,7 +3473,10 @@ ppp_connect_channel(struct channel *pch, + struct ppp_net *pn; + int ret = -ENXIO; + int hdrlen; ++ int ppp_proto; ++ int version; + ++ int notify = 0; + pn = ppp_pernet(pch->chan_net); + + mutex_lock(&pn->all_ppp_mutex); +@@ -3485,13 +3508,40 @@ ppp_connect_channel(struct channel *pch, + ++ppp->n_channels; + pch->ppp = ppp; + refcount_inc(&ppp->file.refcnt); ++ ++ /* Set the netdev priv flag if the prototype ++ * is L2TP or PPTP. Return success in all cases ++ */ ++ if (!pch->chan) ++ goto out2; ++ ++ ppp_proto = ppp_channel_get_protocol(pch->chan); ++ if (ppp_proto == PX_PROTO_PPTP) { ++ ppp->dev->priv_flags_ext |= IFF_EXT_PPP_PPTP; ++ } else if (ppp_proto == PX_PROTO_OL2TP) { ++ version = ppp_channel_get_proto_version(pch->chan); ++ if (version == 2) ++ ppp->dev->priv_flags_ext |= IFF_EXT_PPP_L2TPV2; ++ else if (version == 3) ++ ppp->dev->priv_flags_ext |= IFF_EXT_PPP_L2TPV3; ++ } ++ notify = 1; ++ ++ out2: + ppp_unlock(ppp); + ret = 0; +- + outl: + write_unlock_bh(&pch->upl); + out: + mutex_unlock(&pn->all_ppp_mutex); ++ ++ if (notify && ppp && ppp->dev) { ++ dev_hold(ppp->dev); ++ raw_notifier_call_chain(&ppp_channel_connection_notifier_list, ++ PPP_CHANNEL_CONNECT, ppp->dev); ++ dev_put(ppp->dev); ++ } ++ + return ret; + } + +@@ -3509,6 +3559,13 @@ ppp_disconnect_channel(struct channel *p + pch->ppp = NULL; + write_unlock_bh(&pch->upl); + if (ppp) { ++ if (ppp->dev) { ++ dev_hold(ppp->dev); ++ raw_notifier_call_chain(&ppp_channel_connection_notifier_list, ++ PPP_CHANNEL_DISCONNECT, ppp->dev); ++ dev_put(ppp->dev); ++ } ++ + /* remove it from the ppp unit's list */ + ppp_lock(ppp); + list_del(&pch->clist); +@@ -3588,6 +3645,222 @@ static void *unit_find(struct idr *p, in + return idr_find(p, n); + } + ++/* Updates the PPP interface statistics. */ ++void ppp_update_stats(struct net_device *dev, unsigned long rx_packets, ++ unsigned long rx_bytes, unsigned long tx_packets, ++ unsigned long tx_bytes, unsigned long rx_errors, ++ unsigned long tx_errors, unsigned long rx_dropped, ++ unsigned long tx_dropped) ++{ ++ struct ppp *ppp; ++ ++ if (!dev) ++ return; ++ ++ if (dev->type != ARPHRD_PPP) ++ return; ++ ++ ppp = netdev_priv(dev); ++ ++ ppp_xmit_lock(ppp); ++ ppp->stats64.tx_packets += tx_packets; ++ ppp->stats64.tx_bytes += tx_bytes; ++ ppp->dev->stats.tx_errors += tx_errors; ++ ppp->dev->stats.tx_dropped += tx_dropped; ++ if (tx_packets) ++ ppp->last_xmit = jiffies; ++ ppp_xmit_unlock(ppp); ++ ++ ppp_recv_lock(ppp); ++ ppp->stats64.rx_packets += rx_packets; ++ ppp->stats64.rx_bytes += rx_bytes; ++ ppp->dev->stats.rx_errors += rx_errors; ++ ppp->dev->stats.rx_dropped += rx_dropped; ++ if (rx_packets) ++ ppp->last_recv = jiffies; ++ ppp_recv_unlock(ppp); ++} ++ ++/* Returns >0 if the device is a multilink PPP netdevice, 0 if not or < 0 if ++ * the device is not PPP. ++ */ ++int ppp_is_multilink(struct net_device *dev) ++{ ++ struct ppp *ppp; ++ unsigned int flags; ++ ++ if (!dev) ++ return -1; ++ ++ if (dev->type != ARPHRD_PPP) ++ return -1; ++ ++ ppp = netdev_priv(dev); ++ ppp_lock(ppp); ++ flags = ppp->flags; ++ ppp_unlock(ppp); ++ ++ if (flags & SC_MULTILINK) ++ return 1; ++ ++ return 0; ++} ++EXPORT_SYMBOL(ppp_is_multilink); ++ ++/* ppp_channel_get_protocol() ++ * Call this to obtain the underlying protocol of the PPP channel, ++ * e.g. PX_PROTO_OE ++ * ++ * NOTE: Some channels do not use PX sockets so the protocol value may be very ++ * different for them. ++ * NOTE: -1 indicates failure. ++ * NOTE: Once you know the channel protocol you may then either cast 'chan' to ++ * its sub-class or use the channel protocol specific API's as provided by that ++ * channel sub type. ++ */ ++int ppp_channel_get_protocol(struct ppp_channel *chan) ++{ ++ if (!chan->ops->get_channel_protocol) ++ return -1; ++ ++ return chan->ops->get_channel_protocol(chan); ++} ++EXPORT_SYMBOL(ppp_channel_get_protocol); ++ ++/* ppp_channel_get_proto_version() ++ * Call this to get channel protocol version ++ */ ++int ppp_channel_get_proto_version(struct ppp_channel *chan) ++{ ++ if (!chan->ops->get_channel_protocol_ver) ++ return -1; ++ ++ return chan->ops->get_channel_protocol_ver(chan); ++} ++EXPORT_SYMBOL(ppp_channel_get_proto_version); ++ ++/* ppp_channel_hold() ++ * Call this to hold a channel. ++ * ++ * Returns true on success or false if the hold could not happen. ++ * ++ * NOTE: chan must be protected against destruction during this call - ++ * either by correct locking etc. or because you already have an implicit ++ * or explicit hold to the channel already and this is an additional hold. ++ */ ++bool ppp_channel_hold(struct ppp_channel *chan) ++{ ++ if (!chan->ops->hold) ++ return false; ++ ++ chan->ops->hold(chan); ++ return true; ++} ++EXPORT_SYMBOL(ppp_channel_hold); ++ ++/* ppp_channel_release() ++ * Call this to release a hold you have upon a channel ++ */ ++void ppp_channel_release(struct ppp_channel *chan) ++{ ++ chan->ops->release(chan); ++} ++EXPORT_SYMBOL(ppp_channel_release); ++ ++/* Check if ppp xmit lock is on hold */ ++bool ppp_is_xmit_locked(struct net_device *dev) ++{ ++ struct ppp *ppp; ++ ++ if (!dev) ++ return false; ++ ++ if (dev->type != ARPHRD_PPP) ++ return false; ++ ++ ppp = netdev_priv(dev); ++ if (!ppp) ++ return false; ++ ++ if (spin_is_locked(&(ppp)->wlock)) ++ return true; ++ ++ return false; ++} ++EXPORT_SYMBOL(ppp_is_xmit_locked); ++ ++/* ppp_hold_channels() ++ * Returns the PPP channels of the PPP device, storing each one into ++ * channels[]. ++ * ++ * channels[] has chan_sz elements. ++ * This function returns the number of channels stored, up to chan_sz. ++ * It will return < 0 if the device is not PPP. ++ * ++ * You MUST release the channels using ppp_release_channels(). ++ */ ++int ppp_hold_channels(struct net_device *dev, struct ppp_channel *channels[], ++ unsigned int chan_sz) ++{ ++ struct ppp *ppp; ++ int c; ++ struct channel *pch; ++ ++ if (!dev) ++ return -1; ++ ++ if (dev->type != ARPHRD_PPP) ++ return -1; ++ ++ ppp = netdev_priv(dev); ++ ++ c = 0; ++ ppp_lock(ppp); ++ list_for_each_entry(pch, &ppp->channels, clist) { ++ struct ppp_channel *chan; ++ ++ if (!pch->chan) { ++ /* Channel is going / gone away */ ++ continue; ++ } ++ ++ if (c == chan_sz) { ++ /* No space to record channel */ ++ ppp_unlock(ppp); ++ return c; ++ } ++ ++ /* Hold the channel, if supported */ ++ chan = pch->chan; ++ if (!chan->ops->hold) ++ continue; ++ ++ chan->ops->hold(chan); ++ ++ /* Record the channel */ ++ channels[c++] = chan; ++ } ++ ppp_unlock(ppp); ++ return c; ++} ++EXPORT_SYMBOL(ppp_hold_channels); ++ ++/* ppp_release_channels() ++ * Releases channels ++ */ ++void ppp_release_channels(struct ppp_channel *channels[], unsigned int chan_sz) ++{ ++ unsigned int c; ++ ++ for (c = 0; c < chan_sz; ++c) { ++ struct ppp_channel *chan; ++ ++ chan = channels[c]; ++ chan->ops->release(chan); ++ } ++} ++EXPORT_SYMBOL(ppp_release_channels); ++ + /* Module/initialization stuff */ + + module_init(ppp_init); +@@ -3604,6 +3877,7 @@ EXPORT_SYMBOL(ppp_input_error); + EXPORT_SYMBOL(ppp_output_wakeup); + EXPORT_SYMBOL(ppp_register_compressor); + EXPORT_SYMBOL(ppp_unregister_compressor); ++EXPORT_SYMBOL(ppp_update_stats); + MODULE_LICENSE("GPL"); + MODULE_ALIAS_CHARDEV(PPP_MAJOR, 0); + MODULE_ALIAS_RTNL_LINK("ppp"); +--- a/drivers/net/ppp/pppoe.c ++++ b/drivers/net/ppp/pppoe.c +@@ -62,6 +62,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -87,7 +88,7 @@ + static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb); + + static const struct proto_ops pppoe_ops; +-static const struct ppp_channel_ops pppoe_chan_ops; ++static const struct pppoe_channel_ops pppoe_chan_ops; + + /* per-net private data for this module */ + static unsigned int pppoe_net_id __read_mostly; +@@ -692,7 +693,7 @@ static int pppoe_connect(struct socket * + + po->chan.mtu = dev->mtu - sizeof(struct pppoe_hdr) - 2; + po->chan.private = sk; +- po->chan.ops = &pppoe_chan_ops; ++ po->chan.ops = (struct ppp_channel_ops *)&pppoe_chan_ops; + + error = ppp_register_net_channel(dev_net(dev), &po->chan); + if (error) { +@@ -995,9 +996,80 @@ static int pppoe_fill_forward_path(struc + return 0; + } + +-static const struct ppp_channel_ops pppoe_chan_ops = { +- .start_xmit = pppoe_xmit, +- .fill_forward_path = pppoe_fill_forward_path, ++/************************************************************************ ++ * ++ * function called by generic PPP driver to hold channel ++ * ++ ***********************************************************************/ ++static void pppoe_hold_chan(struct ppp_channel *chan) ++{ ++ struct sock *sk = (struct sock *)chan->private; ++ ++ sock_hold(sk); ++} ++ ++/************************************************************************ ++ * ++ * function called by generic PPP driver to release channel ++ * ++ ***********************************************************************/ ++static void pppoe_release_chan(struct ppp_channel *chan) ++{ ++ struct sock *sk = (struct sock *)chan->private; ++ ++ sock_put(sk); ++} ++ ++/************************************************************************ ++ * ++ * function called to get the channel protocol type ++ * ++ ***********************************************************************/ ++static int pppoe_get_channel_protocol(struct ppp_channel *chan) ++{ ++ return PX_PROTO_OE; ++} ++ ++/************************************************************************ ++ * ++ * function called to get the PPPoE channel addressing ++ * NOTE: This function returns a HOLD to the netdevice ++ * ++ ***********************************************************************/ ++static int pppoe_get_addressing(struct ppp_channel *chan, ++ struct pppoe_opt *addressing) ++{ ++ struct sock *sk = (struct sock *)chan->private; ++ struct pppox_sock *po = pppox_sk(sk); ++ int err = 0; ++ ++ *addressing = po->proto.pppoe; ++ if (!addressing->dev) ++ return -ENODEV; ++ ++ dev_hold(addressing->dev); ++ return err; ++} ++ ++/* pppoe_channel_addressing_get() ++ * Return PPPoE channel specific addressing information. ++ */ ++int pppoe_channel_addressing_get(struct ppp_channel *chan, ++ struct pppoe_opt *addressing) ++{ ++ return pppoe_get_addressing(chan, addressing); ++} ++EXPORT_SYMBOL(pppoe_channel_addressing_get); ++ ++static const struct pppoe_channel_ops pppoe_chan_ops = { ++ /* PPPoE specific channel ops */ ++ .get_addressing = pppoe_get_addressing, ++ /* General ppp channel ops */ ++ .ops.start_xmit = pppoe_xmit, ++ .ops.get_channel_protocol = pppoe_get_channel_protocol, ++ .ops.hold = pppoe_hold_chan, ++ .ops.release = pppoe_release_chan, ++ .ops.fill_forward_path = pppoe_fill_forward_path, + }; + + static int pppoe_recvmsg(struct socket *sock, struct msghdr *m, +--- a/include/linux/if_pppox.h ++++ b/include/linux/if_pppox.h +@@ -91,4 +91,17 @@ enum { + PPPOX_DEAD = 16 /* dead, useless, please clean me up!*/ + }; + ++/* ++ * PPPoE Channel specific operations ++ */ ++struct pppoe_channel_ops { ++ /* Must be first - general to all PPP channels */ ++ struct ppp_channel_ops ops; ++ int (*get_addressing)(struct ppp_channel *, struct pppoe_opt *); ++}; ++ ++/* Return PPPoE channel specific addressing information */ ++extern int pppoe_channel_addressing_get(struct ppp_channel *chan, ++ struct pppoe_opt *addressing); ++ + #endif /* !(__LINUX_IF_PPPOX_H) */ +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h +@@ -1762,6 +1762,24 @@ enum netdev_priv_flags { + IFF_NO_IP_ALIGN = BIT_ULL(34), + }; + ++ ++/** ++ * enum netdev_priv_flags_ext - &struct net_device priv_flags_ext ++ * ++ * These flags are used to check for device type and can be ++ * set and used by the drivers ++ * ++ */ ++enum netdev_priv_flags_ext { ++ IFF_EXT_TUN_TAP = 1<<0, ++ IFF_EXT_PPP_L2TPV2 = 1<<1, ++ IFF_EXT_PPP_L2TPV3 = 1<<2, ++ IFF_EXT_PPP_PPTP = 1<<3, ++ IFF_EXT_GRE_V4_TAP = 1<<4, ++ IFF_EXT_GRE_V6_TAP = 1<<5, ++ IFF_EXT_IFB = 1<<6, ++}; ++ + #define IFF_802_1Q_VLAN IFF_802_1Q_VLAN + #define IFF_EBRIDGE IFF_EBRIDGE + #define IFF_BONDING IFF_BONDING +@@ -2128,6 +2146,7 @@ struct net_device { + xdp_features_t xdp_features; + unsigned long long priv_flags; + const struct net_device_ops *netdev_ops; ++ unsigned int priv_flags_ext; + const struct xdp_metadata_ops *xdp_metadata_ops; + int ifindex; + unsigned short gflags; +--- a/include/linux/ppp_channel.h ++++ b/include/linux/ppp_channel.h +@@ -19,6 +19,10 @@ + #include + #include + #include ++#include ++ ++#define PPP_CHANNEL_DISCONNECT 0 ++#define PPP_CHANNEL_CONNECT 1 + + struct net_device_path; + struct net_device_path_ctx; +@@ -30,9 +34,19 @@ struct ppp_channel_ops { + int (*start_xmit)(struct ppp_channel *, struct sk_buff *); + /* Handle an ioctl call that has come in via /dev/ppp. */ + int (*ioctl)(struct ppp_channel *, unsigned int, unsigned long); ++ /* Get channel protocol type, one of PX_PROTO_XYZ or specific to ++ * the channel subtype ++ */ ++ int (*get_channel_protocol)(struct ppp_channel *); ++ /* Get channel protocol version */ ++ int (*get_channel_protocol_ver)(struct ppp_channel *); ++ /* Hold the channel from being destroyed */ ++ void (*hold)(struct ppp_channel *); ++ /* Release hold on the channel */ ++ void (*release)(struct ppp_channel *); + int (*fill_forward_path)(struct net_device_path_ctx *, +- struct net_device_path *, +- const struct ppp_channel *); ++ struct net_device_path *, ++ const struct ppp_channel *); + }; + + struct ppp_channel { +@@ -76,6 +90,51 @@ extern int ppp_unit_number(struct ppp_ch + /* Get the device name associated with a channel, or NULL if none */ + extern char *ppp_dev_name(struct ppp_channel *); + ++/* Call this to obtain the underlying protocol of the PPP channel, ++ * e.g. PX_PROTO_OE ++ */ ++extern int ppp_channel_get_protocol(struct ppp_channel *); ++ ++/* Call this get protocol version */ ++extern int ppp_channel_get_proto_version(struct ppp_channel *); ++ ++/* Call this to hold a channel */ ++extern bool ppp_channel_hold(struct ppp_channel *); ++ ++/* Call this to release a hold you have upon a channel */ ++extern void ppp_channel_release(struct ppp_channel *); ++ ++/* Release hold on PPP channels */ ++extern void ppp_release_channels(struct ppp_channel *channels[], ++ unsigned int chan_sz); ++ ++/* Hold PPP channels for the PPP device */ ++extern int ppp_hold_channels(struct net_device *dev, ++ struct ppp_channel *channels[], ++ unsigned int chan_sz); ++ ++/* Test if ppp xmit lock is locked */ ++extern bool ppp_is_xmit_locked(struct net_device *dev); ++ ++/* Test if the ppp device is a multi-link ppp device */ ++extern int ppp_is_multilink(struct net_device *dev); ++ ++/* Register the PPP channel connect notifier */ ++extern void ppp_channel_connection_register_notify(struct notifier_block *nb); ++ ++/* Unregister the PPP channel connect notifier */ ++extern void ppp_channel_connection_unregister_notify(struct notifier_block *nb); ++ ++/* Update statistics of the PPP net_device by incrementing related ++ * statistics field value with corresponding parameter ++ */ ++extern void ppp_update_stats(struct net_device *dev, unsigned long rx_packets, ++ unsigned long rx_bytes, unsigned long tx_packets, ++ unsigned long tx_bytes, unsigned long rx_errors, ++ unsigned long tx_errors, unsigned long rx_dropped, ++ unsigned long tx_dropped); ++ ++ + /* + * SMP locking notes: + * The channel code must ensure that when it calls ppp_unregister_channel, diff --git a/target/linux/qualcommax/patches-6.6/2600-3-qca-nss-ecm-support-net-bonding.patch b/target/linux/qualcommax/patches-6.6/2600-3-qca-nss-ecm-support-net-bonding.patch new file mode 100644 index 00000000000..3ef4a189b55 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2600-3-qca-nss-ecm-support-net-bonding.patch @@ -0,0 +1,81 @@ +--- a/drivers/net/bonding/bond_main.c ++++ b/drivers/net/bonding/bond_main.c +@@ -254,6 +254,8 @@ static const struct flow_dissector_key f + }, + }; + ++static unsigned long bond_id_mask = 0xFFFFFFF0; /* QCA NSS ECM bonding support */ ++ + static struct flow_dissector flow_keys_bonding __read_mostly; + + /*-------------------------- Forward declarations ---------------------------*/ +@@ -4418,6 +4420,24 @@ static int bond_get_lowest_level_rcu(str + } + #endif + ++/* QCA NSS ECM bonding support */ ++int bond_get_id(struct net_device *bond_dev) ++{ ++ struct bonding *bond; ++ int bond_id = 0; ++ ++ if (!((bond_dev->priv_flags & IFF_BONDING) && ++ (bond_dev->flags & IFF_MASTER))) ++ return -EINVAL; ++ ++ bond = netdev_priv(bond_dev); ++ bond_id = bond->id; ++ ++ return bond_id; ++} ++EXPORT_SYMBOL(bond_get_id); ++/* QCA NSS ECM bonding support */ ++ + static void bond_get_stats(struct net_device *bond_dev, + struct rtnl_link_stats64 *stats) + { +@@ -5873,6 +5893,11 @@ static void bond_destructor(struct net_d + destroy_workqueue(bond->wq); + + free_percpu(bond->rr_tx_counter); ++ ++ /* QCA NSS ECM bonding support */ ++ if (bond->id != (~0U)) ++ clear_bit(bond->id, &bond_id_mask); ++ /* QCA NSS ECM bonding support */ + } + + void bond_setup(struct net_device *bond_dev) +@@ -6421,6 +6446,14 @@ int bond_create(struct net *net, const c + + bond_work_init_all(bond); + ++ /* QCA NSS ECM bonding support - Start */ ++ bond->id = ~0U; ++ if (bond_id_mask != (~0UL)) { ++ bond->id = (u32)ffz(bond_id_mask); ++ set_bit(bond->id, &bond_id_mask); ++ } ++ /* QCA NSS ECM bonding support - End */ ++ + out: + rtnl_unlock(); + return res; +--- a/include/net/bonding.h ++++ b/include/net/bonding.h +@@ -261,6 +261,7 @@ struct bonding { + spinlock_t ipsec_lock; + #endif /* CONFIG_XFRM_OFFLOAD */ + struct bpf_prog *xdp_prog; ++ u32 id; /* QCA NSS ECM bonding support */ + }; + + #define bond_slave_get_rcu(dev) \ +@@ -652,6 +653,7 @@ struct bond_net { + + int bond_rcv_validate(const struct sk_buff *skb, struct bonding *bond, struct slave *slave); + netdev_tx_t bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev); ++int bond_get_id(struct net_device *bond_dev); /* QCA NSS ECM bonding support */ + int bond_create(struct net *net, const char *name); + int bond_create_sysfs(struct bond_net *net); + void bond_destroy_sysfs(struct bond_net *net); diff --git a/target/linux/qualcommax/patches-6.6/2600-4-qca-nss-ecm-support-net-bonding-over-LAG-interface.patch b/target/linux/qualcommax/patches-6.6/2600-4-qca-nss-ecm-support-net-bonding-over-LAG-interface.patch new file mode 100644 index 00000000000..f5c3cbfec6e --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2600-4-qca-nss-ecm-support-net-bonding-over-LAG-interface.patch @@ -0,0 +1,672 @@ +--- a/drivers/net/bonding/bond_3ad.c ++++ b/drivers/net/bonding/bond_3ad.c +@@ -115,7 +115,40 @@ static void ad_marker_info_received(stru + static void ad_marker_response_received(struct bond_marker *marker, + struct port *port); + static void ad_update_actor_keys(struct port *port, bool reset); ++/* QCA NSS ECM bonding support - Start */ ++struct bond_cb __rcu *bond_cb; + ++int bond_register_cb(struct bond_cb *cb) ++{ ++ struct bond_cb *lag_cb; ++ ++ lag_cb = kzalloc(sizeof(*lag_cb), GFP_ATOMIC | __GFP_NOWARN); ++ if (!lag_cb) { ++ return -1; ++ } ++ ++ memcpy((void *)lag_cb, (void *)cb, sizeof(*cb)); ++ ++ rcu_read_lock(); ++ rcu_assign_pointer(bond_cb, lag_cb); ++ rcu_read_unlock(); ++ return 0; ++} ++EXPORT_SYMBOL(bond_register_cb); ++ ++void bond_unregister_cb(void) ++{ ++ struct bond_cb *lag_cb_main; ++ ++ rcu_read_lock(); ++ lag_cb_main = rcu_dereference(bond_cb); ++ rcu_assign_pointer(bond_cb, NULL); ++ rcu_read_unlock(); ++ ++ kfree(lag_cb_main); ++} ++EXPORT_SYMBOL(bond_unregister_cb); ++/* QCA NSS ECM bonding support - End */ + + /* ================= api to bonding and kernel code ================== */ + +@@ -430,7 +463,6 @@ static u16 __ad_timer_to_ticks(u16 timer + return retval; + } + +- + /* ================= ad_rx_machine helper functions ================== */ + + /** +@@ -1073,7 +1105,30 @@ static void ad_mux_machine(struct port * + ad_disable_collecting_distributing(port, + update_slave_arr); + port->ntt = true; +- break; ++ ++ /* QCA NSS ECM bonding support - Start */ ++ /* Send a notificaton about change in state of this ++ * port. We only want to handle case where port moves ++ * from AD_MUX_COLLECTING_DISTRIBUTING -> ++ * AD_MUX_ATTACHED. ++ */ ++ if (bond_slave_is_up(port->slave) && ++ (last_state == AD_MUX_COLLECTING_DISTRIBUTING)) { ++ struct bond_cb *lag_cb_main; ++ ++ rcu_read_lock(); ++ lag_cb_main = rcu_dereference(bond_cb); ++ if (lag_cb_main && ++ lag_cb_main->bond_cb_link_down) { ++ struct net_device *dev; ++ ++ dev = port->slave->dev; ++ lag_cb_main->bond_cb_link_down(dev); ++ } ++ rcu_read_unlock(); ++ } ++ ++ break; /* QCA NSS ECM bonding support - End */ + case AD_MUX_COLLECTING_DISTRIBUTING: + port->actor_oper_port_state |= LACP_STATE_COLLECTING; + port->actor_oper_port_state |= LACP_STATE_DISTRIBUTING; +@@ -1917,13 +1972,24 @@ static void ad_enable_collecting_distrib + bool *update_slave_arr) + { + if (port->aggregator->is_active) { +- slave_dbg(port->slave->bond->dev, port->slave->dev, ++ struct bond_cb *lag_cb_main; /* QCA NSS ECM bonding support */ ++ slave_dbg(port->slave->bond->dev, port->slave->dev, + "Enabling port %d (LAG %d)\n", + port->actor_port_number, + port->aggregator->aggregator_identifier); + __enable_port(port); + /* Slave array needs update */ + *update_slave_arr = true; ++ ++ /* QCA NSS ECM bonding support - Start */ ++ rcu_read_lock(); ++ lag_cb_main = rcu_dereference(bond_cb); ++ ++ if (lag_cb_main && lag_cb_main->bond_cb_link_up) ++ lag_cb_main->bond_cb_link_up(port->slave->dev); ++ ++ rcu_read_unlock(); ++ /* QCA NSS ECM bonding support - End */ + } + } + +@@ -2683,6 +2749,104 @@ int bond_3ad_get_active_agg_info(struct + return ret; + } + ++/* QCA NSS ECM bonding support - Start */ ++/* bond_3ad_get_tx_dev - Calculate egress interface for a given packet, ++ * for a LAG that is configured in 802.3AD mode ++ * @skb: pointer to skb to be egressed ++ * @src_mac: pointer to source L2 address ++ * @dst_mac: pointer to destination L2 address ++ * @src: pointer to source L3 address ++ * @dst: pointer to destination L3 address ++ * @protocol: L3 protocol id from L2 header ++ * @bond_dev: pointer to bond master device ++ * ++ * If @skb is NULL, bond_xmit_hash is used to calculate hash using L2/L3 ++ * addresses. ++ * ++ * Returns: Either valid slave device, or NULL otherwise ++ */ ++struct net_device *bond_3ad_get_tx_dev(struct sk_buff *skb, u8 *src_mac, ++ u8 *dst_mac, void *src, ++ void *dst, u16 protocol, ++ struct net_device *bond_dev, ++ __be16 *layer4hdr) ++{ ++ struct bonding *bond = netdev_priv(bond_dev); ++ struct aggregator *agg; ++ struct ad_info ad_info; ++ struct list_head *iter; ++ struct slave *slave; ++ struct slave *first_ok_slave = NULL; ++ u32 hash = 0; ++ int slaves_in_agg; ++ int slave_agg_no = 0; ++ int agg_id; ++ ++ if (__bond_3ad_get_active_agg_info(bond, &ad_info)) { ++ pr_debug("%s: Error: __bond_3ad_get_active_agg_info failed\n", ++ bond_dev->name); ++ return NULL; ++ } ++ ++ slaves_in_agg = ad_info.ports; ++ agg_id = ad_info.aggregator_id; ++ ++ if (slaves_in_agg == 0) { ++ pr_debug("%s: Error: active aggregator is empty\n", ++ bond_dev->name); ++ return NULL; ++ } ++ ++ if (skb) { ++ hash = bond_xmit_hash(bond, skb); ++ slave_agg_no = hash % slaves_in_agg; ++ } else { ++ if (bond->params.xmit_policy != BOND_XMIT_POLICY_LAYER23 && ++ bond->params.xmit_policy != BOND_XMIT_POLICY_LAYER2 && ++ bond->params.xmit_policy != BOND_XMIT_POLICY_LAYER34) { ++ pr_debug("%s: Error: Unsupported hash policy for 802.3AD fast path\n", ++ bond_dev->name); ++ return NULL; ++ } ++ ++ hash = bond_xmit_hash_without_skb(src_mac, dst_mac, ++ src, dst, protocol, ++ bond_dev, layer4hdr); ++ slave_agg_no = hash % slaves_in_agg; ++ } ++ ++ bond_for_each_slave_rcu(bond, slave, iter) { ++ agg = SLAVE_AD_INFO(slave)->port.aggregator; ++ if (!agg || agg->aggregator_identifier != agg_id) ++ continue; ++ ++ if (slave_agg_no >= 0) { ++ if (!first_ok_slave && bond_slave_can_tx(slave)) ++ first_ok_slave = slave; ++ slave_agg_no--; ++ continue; ++ } ++ ++ if (bond_slave_can_tx(slave)) ++ return slave->dev; ++ } ++ ++ if (slave_agg_no >= 0) { ++ pr_err("%s: Error: Couldn't find a slave to tx on for aggregator ID %d\n", ++ bond_dev->name, agg_id); ++ return NULL; ++ } ++ ++ /* we couldn't find any suitable slave after the agg_no, so use the ++ * first suitable found, if found. ++ */ ++ if (first_ok_slave) ++ return first_ok_slave->dev; ++ ++ return NULL; ++} ++/* QCA NSS ECM bonding support - End */ ++ + int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond, + struct slave *slave) + { +--- a/drivers/net/bonding/bond_main.c ++++ b/drivers/net/bonding/bond_main.c +@@ -1190,6 +1190,23 @@ void bond_change_active_slave(struct bon + if (BOND_MODE(bond) == BOND_MODE_8023AD) + bond_3ad_handle_link_change(new_active, BOND_LINK_UP); + ++ /* QCA NSS ECM bonding support - Start */ ++ if (bond->params.mode == BOND_MODE_XOR) { ++ struct bond_cb *lag_cb_main; ++ ++ rcu_read_lock(); ++ lag_cb_main = rcu_dereference(bond_cb); ++ if (lag_cb_main && ++ lag_cb_main->bond_cb_link_up) { ++ struct net_device *dev; ++ ++ dev = new_active->dev; ++ lag_cb_main->bond_cb_link_up(dev); ++ } ++ rcu_read_unlock(); ++ } ++ /* QCA NSS ECM bonding support - End */ ++ + if (bond_is_lb(bond)) + bond_alb_handle_link_change(bond, new_active, BOND_LINK_UP); + } else { +@@ -1834,7 +1851,8 @@ int bond_enslave(struct net_device *bond + const struct net_device_ops *slave_ops = slave_dev->netdev_ops; + struct slave *new_slave = NULL, *prev_slave; + struct sockaddr_storage ss; +- int link_reporting; ++ struct bond_cb *lag_cb_main; /* QCA NSS ECM bonding support */ ++ int link_reporting; + int res = 0, i; + + if (slave_dev->flags & IFF_MASTER && +@@ -2279,6 +2297,15 @@ int bond_enslave(struct net_device *bond + bond_is_active_slave(new_slave) ? "an active" : "a backup", + new_slave->link != BOND_LINK_DOWN ? "an up" : "a down"); + ++ /* QCA NSS ECM bonding support - Start */ ++ rcu_read_lock(); ++ lag_cb_main = rcu_dereference(bond_cb); ++ if (lag_cb_main && lag_cb_main->bond_cb_enslave) ++ lag_cb_main->bond_cb_enslave(slave_dev); ++ ++ rcu_read_unlock(); ++ /* QCA NSS ECM bonding support - End */ ++ + /* enslave is successful */ + bond_queue_slave_event(new_slave); + return 0; +@@ -2344,6 +2371,15 @@ err_undo_flags: + } + } + ++ /* QCA NSS ECM bonding support - Start */ ++ rcu_read_lock(); ++ lag_cb_main = rcu_dereference(bond_cb); ++ if (lag_cb_main && lag_cb_main->bond_cb_enslave) ++ lag_cb_main->bond_cb_enslave(slave_dev); ++ ++ rcu_read_unlock(); ++ /* QCA NSS ECM bonding support - End */ ++ + return res; + } + +@@ -2366,7 +2402,8 @@ static int __bond_release_one(struct net + struct slave *slave, *oldcurrent; + struct sockaddr_storage ss; + int old_flags = bond_dev->flags; +- netdev_features_t old_features = bond_dev->features; ++ struct bond_cb *lag_cb_main; /* QCA NSS ECM bonding support */ ++ netdev_features_t old_features = bond_dev->features; + + /* slave is not a slave or master is not master of this slave */ + if (!(slave_dev->flags & IFF_SLAVE) || +@@ -2387,6 +2424,15 @@ static int __bond_release_one(struct net + + bond_set_slave_inactive_flags(slave, BOND_SLAVE_NOTIFY_NOW); + ++ /* QCA NSS ECM bonding support - Start */ ++ rcu_read_lock(); ++ lag_cb_main = rcu_dereference(bond_cb); ++ if (lag_cb_main && lag_cb_main->bond_cb_release) ++ lag_cb_main->bond_cb_release(slave_dev); ++ ++ rcu_read_unlock(); ++ /* QCA NSS ECM bonding support - End */ ++ + bond_sysfs_slave_del(slave); + + /* recompute stats just before removing the slave */ +@@ -2709,6 +2755,8 @@ static void bond_miimon_commit(struct bo + struct slave *slave, *primary, *active; + bool do_failover = false; + struct list_head *iter; ++ struct net_device *slave_dev = NULL; /* QCA NSS ECM bonding support */ ++ struct bond_cb *lag_cb_main; /* QCA NSS ECM bonding support */ + + ASSERT_RTNL(); + +@@ -2748,6 +2796,12 @@ static void bond_miimon_commit(struct bo + bond_set_active_slave(slave); + } + ++ /* QCA NSS ECM bonding support - Start */ ++ if ((bond->params.mode == BOND_MODE_XOR) && ++ (!slave_dev)) ++ slave_dev = slave->dev; ++ /* QCA NSS ECM bonding support - End */ ++ + slave_info(bond->dev, slave->dev, "link status definitely up, %u Mbps %s duplex\n", + slave->speed == SPEED_UNKNOWN ? 0 : slave->speed, + slave->duplex ? "full" : "half"); +@@ -2796,6 +2850,16 @@ static void bond_miimon_commit(struct bo + unblock_netpoll_tx(); + } + ++ /* QCA NSS ECM bonding support - Start */ ++ rcu_read_lock(); ++ lag_cb_main = rcu_dereference(bond_cb); ++ ++ if (slave_dev && lag_cb_main && lag_cb_main->bond_cb_link_up) ++ lag_cb_main->bond_cb_link_up(slave_dev); ++ ++ rcu_read_unlock(); ++ /* QCA NSS ECM bonding support - End */ ++ + bond_set_carrier(bond); + } + +@@ -4048,8 +4112,219 @@ static inline u32 bond_eth_hash(struct s + return 0; + + ep = (struct ethhdr *)(data + mhoff); +- return ep->h_dest[5] ^ ep->h_source[5] ^ be16_to_cpu(ep->h_proto); ++ return ep->h_dest[5] ^ ep->h_source[5]; /* QCA NSS ECM bonding support */ ++} ++ ++/* QCA NSS ECM bonding support - Start */ ++/* Extract the appropriate headers based on bond's xmit policy */ ++static bool bond_flow_dissect_without_skb(struct bonding *bond, ++ u8 *src_mac, u8 *dst_mac, ++ void *psrc, void *pdst, ++ u16 protocol, __be16 *layer4hdr, ++ struct flow_keys *fk) ++{ ++ u32 *src = NULL; ++ u32 *dst = NULL; ++ ++ fk->ports.ports = 0; ++ src = (uint32_t *)psrc; ++ dst = (uint32_t *)pdst; ++ ++ if (protocol == htons(ETH_P_IP)) { ++ /* V4 addresses and address type*/ ++ fk->addrs.v4addrs.src = src[0]; ++ fk->addrs.v4addrs.dst = dst[0]; ++ fk->control.addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS; ++ } else if (protocol == htons(ETH_P_IPV6)) { ++ /* V6 addresses and address type*/ ++ memcpy(&fk->addrs.v6addrs.src, src, sizeof(struct in6_addr)); ++ memcpy(&fk->addrs.v6addrs.dst, dst, sizeof(struct in6_addr)); ++ fk->control.addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS; ++ } else { ++ return false; ++ } ++ if ((bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER34) && ++ (layer4hdr)) ++ fk->ports.ports = *layer4hdr; ++ ++ return true; ++} ++ ++/* bond_xmit_hash_without_skb - Applies load balancing algorithm for a packet, ++ * to calculate hash for a given set of L2/L3 addresses. Does not ++ * calculate egress interface. ++ */ ++uint32_t bond_xmit_hash_without_skb(u8 *src_mac, u8 *dst_mac, ++ void *psrc, void *pdst, u16 protocol, ++ struct net_device *bond_dev, ++ __be16 *layer4hdr) ++{ ++ struct bonding *bond = netdev_priv(bond_dev); ++ struct flow_keys flow; ++ u32 hash = 0; ++ ++ if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER2 || ++ !bond_flow_dissect_without_skb(bond, src_mac, dst_mac, psrc, ++ pdst, protocol, layer4hdr, &flow)) ++ return (dst_mac[5] ^ src_mac[5]); ++ ++ if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER23) ++ hash = dst_mac[5] ^ src_mac[5]; ++ else if (layer4hdr) ++ hash = (__force u32)flow.ports.ports; ++ ++ hash ^= (__force u32)flow_get_u32_dst(&flow) ^ ++ (__force u32)flow_get_u32_src(&flow); ++ hash ^= (hash >> 16); ++ hash ^= (hash >> 8); ++ ++ return hash; ++} ++ ++/* bond_xor_get_tx_dev - Calculate egress interface for a given packet for a LAG ++ * that is configured in balance-xor mode ++ * @skb: pointer to skb to be egressed ++ * @src_mac: pointer to source L2 address ++ * @dst_mac: pointer to destination L2 address ++ * @src: pointer to source L3 address in network order ++ * @dst: pointer to destination L3 address in network order ++ * @protocol: L3 protocol ++ * @bond_dev: pointer to bond master device ++ * ++ * If @skb is NULL, bond_xmit_hash_without_skb is used to calculate hash using ++ * L2/L3 addresses. ++ * ++ * Returns: Either valid slave device, or NULL otherwise ++ */ ++static struct net_device *bond_xor_get_tx_dev(struct sk_buff *skb, ++ u8 *src_mac, u8 *dst_mac, ++ void *src, void *dst, ++ u16 protocol, ++ struct net_device *bond_dev, ++ __be16 *layer4hdr) ++{ ++ struct bonding *bond = netdev_priv(bond_dev); ++ int slave_cnt = READ_ONCE(bond->slave_cnt); ++ int slave_id = 0, i = 0; ++ u32 hash; ++ struct list_head *iter; ++ struct slave *slave; ++ ++ if (slave_cnt == 0) { ++ pr_debug("%s: Error: No slave is attached to the interface\n", ++ bond_dev->name); ++ return NULL; ++ } ++ ++ if (skb) { ++ hash = bond_xmit_hash(bond, skb); ++ slave_id = hash % slave_cnt; ++ } else { ++ if (bond->params.xmit_policy != BOND_XMIT_POLICY_LAYER23 && ++ bond->params.xmit_policy != BOND_XMIT_POLICY_LAYER2 && ++ bond->params.xmit_policy != BOND_XMIT_POLICY_LAYER34) { ++ pr_debug("%s: Error: Unsupported hash policy for balance-XOR fast path\n", ++ bond_dev->name); ++ return NULL; ++ } ++ ++ hash = bond_xmit_hash_without_skb(src_mac, dst_mac, src, ++ dst, protocol, bond_dev, ++ layer4hdr); ++ slave_id = hash % slave_cnt; ++ } ++ ++ i = slave_id; ++ ++ /* Here we start from the slave with slave_id */ ++ bond_for_each_slave_rcu(bond, slave, iter) { ++ if (--i < 0) { ++ if (bond_slave_can_tx(slave)) ++ return slave->dev; ++ } ++ } ++ ++ /* Here we start from the first slave up to slave_id */ ++ i = slave_id; ++ bond_for_each_slave_rcu(bond, slave, iter) { ++ if (--i < 0) ++ break; ++ if (bond_slave_can_tx(slave)) ++ return slave->dev; ++ } ++ ++ return NULL; ++} ++ ++/* bond_get_tx_dev - Calculate egress interface for a given packet. ++ * ++ * Supports 802.3AD and balance-xor modes ++ * ++ * @skb: pointer to skb to be egressed, if valid ++ * @src_mac: pointer to source L2 address ++ * @dst_mac: pointer to destination L2 address ++ * @src: pointer to source L3 address in network order ++ * @dst: pointer to destination L3 address in network order ++ * @protocol: L3 protocol id from L2 header ++ * @bond_dev: pointer to bond master device ++ * ++ * Returns: Either valid slave device, or NULL for un-supported LAG modes ++ */ ++struct net_device *bond_get_tx_dev(struct sk_buff *skb, uint8_t *src_mac, ++ u8 *dst_mac, void *src, ++ void *dst, u16 protocol, ++ struct net_device *bond_dev, ++ __be16 *layer4hdr) ++{ ++ struct bonding *bond; ++ ++ if (!bond_dev) ++ return NULL; ++ ++ if (!((bond_dev->priv_flags & IFF_BONDING) && ++ (bond_dev->flags & IFF_MASTER))) ++ return NULL; ++ ++ bond = netdev_priv(bond_dev); ++ ++ switch (bond->params.mode) { ++ case BOND_MODE_XOR: ++ return bond_xor_get_tx_dev(skb, src_mac, dst_mac, ++ src, dst, protocol, ++ bond_dev, layer4hdr); ++ case BOND_MODE_8023AD: ++ return bond_3ad_get_tx_dev(skb, src_mac, dst_mac, ++ src, dst, protocol, ++ bond_dev, layer4hdr); ++ default: ++ return NULL; ++ } + } ++EXPORT_SYMBOL(bond_get_tx_dev); ++ ++/* In bond_xmit_xor() , we determine the output device by using a pre- ++ * determined xmit_hash_policy(), If the selected device is not enabled, ++ * find the next active slave. ++ */ ++static int bond_xmit_xor(struct sk_buff *skb, struct net_device *dev) ++{ ++ struct bonding *bond = netdev_priv(dev); ++ struct net_device *outdev; ++ ++ outdev = bond_xor_get_tx_dev(skb, NULL, NULL, NULL, ++ NULL, 0, dev, NULL); ++ if (!outdev) ++ goto out; ++ ++ bond_dev_queue_xmit(bond, skb, outdev); ++ goto final; ++out: ++ /* no suitable interface, frame not sent */ ++ dev_kfree_skb(skb); ++final: ++ return NETDEV_TX_OK; ++} ++/* QCA NSS ECM bonding support - End */ + + static bool bond_flow_ip(struct sk_buff *skb, struct flow_keys *fk, const void *data, + int hlen, __be16 l2_proto, int *nhoff, int *ip_proto, bool l34) +@@ -5196,15 +5471,23 @@ static netdev_tx_t bond_3ad_xor_xmit(str + struct net_device *dev) + { + struct bonding *bond = netdev_priv(dev); +- struct bond_up_slave *slaves; +- struct slave *slave; ++ /* QCA NSS ECM bonding support - Start */ ++ struct net_device *outdev = NULL; ++ outdev = bond_3ad_get_tx_dev(skb, NULL, NULL, NULL, ++ NULL, 0, dev, NULL); + +- slaves = rcu_dereference(bond->usable_slaves); +- slave = bond_xmit_3ad_xor_slave_get(bond, skb, slaves); +- if (likely(slave)) +- return bond_dev_queue_xmit(bond, skb, slave->dev); ++ if (!outdev) ++ goto out; + +- return bond_tx_drop(dev, skb); ++ bond_dev_queue_xmit(bond, skb, outdev); ++ goto final; ++ ++out: ++ dev_kfree_skb(skb); ++ ++final: ++ return NETDEV_TX_OK; ++/* QCA NSS ECM bonding support - End */ + } + + /* in broadcast mode, we send everything to all usable interfaces. */ +@@ -5454,8 +5737,9 @@ static netdev_tx_t __bond_start_xmit(str + return bond_xmit_roundrobin(skb, dev); + case BOND_MODE_ACTIVEBACKUP: + return bond_xmit_activebackup(skb, dev); +- case BOND_MODE_8023AD: + case BOND_MODE_XOR: ++ return bond_xmit_xor(skb, dev); /* QCA NSS ECM bonding support */ ++ case BOND_MODE_8023AD: + return bond_3ad_xor_xmit(skb, dev); + case BOND_MODE_BROADCAST: + return bond_xmit_broadcast(skb, dev); +--- a/include/net/bond_3ad.h ++++ b/include/net/bond_3ad.h +@@ -302,8 +302,15 @@ int bond_3ad_lacpdu_recv(const struct sk + struct slave *slave); + int bond_3ad_set_carrier(struct bonding *bond); + void bond_3ad_update_lacp_rate(struct bonding *bond); ++/* QCA NSS ECM bonding support */ ++struct net_device *bond_3ad_get_tx_dev(struct sk_buff *skb, uint8_t *src_mac, ++ uint8_t *dst_mac, void *src, ++ void *dst, uint16_t protocol, ++ struct net_device *bond_dev, ++ __be16 *layer4hdr); ++/* QCA NSS ECM bonding support */ ++ + void bond_3ad_update_ad_actor_settings(struct bonding *bond); + int bond_3ad_stats_fill(struct sk_buff *skb, struct bond_3ad_stats *stats); + size_t bond_3ad_stats_size(void); + #endif /* _NET_BOND_3AD_H */ +- +--- a/include/net/bonding.h ++++ b/include/net/bonding.h +@@ -83,6 +83,8 @@ + #define bond_for_each_slave(bond, pos, iter) \ + netdev_for_each_lower_private((bond)->dev, pos, iter) + ++extern struct bond_cb __rcu *bond_cb; /* QCA NSS ECM bonding support */ ++ + /* Caller must have rcu_read_lock */ + #define bond_for_each_slave_rcu(bond, pos, iter) \ + netdev_for_each_lower_private_rcu((bond)->dev, pos, iter) +@@ -685,6 +687,12 @@ struct bond_vlan_tag *bond_verify_device + int level); + int bond_update_slave_arr(struct bonding *bond, struct slave *skipslave); + void bond_slave_arr_work_rearm(struct bonding *bond, unsigned long delay); ++/* QCA NSS ECM bonding support - Start */ ++uint32_t bond_xmit_hash_without_skb(uint8_t *src_mac, uint8_t *dst_mac, ++ void *psrc, void *pdst, uint16_t protocol, ++ struct net_device *bond_dev, ++ __be16 *layer4hdr); ++/* QCA NSS ECM bonding support - End */ + void bond_work_init_all(struct bonding *bond); + + #ifdef CONFIG_PROC_FS +@@ -789,4 +797,18 @@ static inline netdev_tx_t bond_tx_drop(s + return NET_XMIT_DROP; + } + ++/* QCA NSS ECM bonding support - Start */ ++struct bond_cb { ++ void (*bond_cb_link_up)(struct net_device *slave); ++ void (*bond_cb_link_down)(struct net_device *slave); ++ void (*bond_cb_enslave)(struct net_device *slave); ++ void (*bond_cb_release)(struct net_device *slave); ++ void (*bond_cb_delete_by_slave)(struct net_device *slave); ++ void (*bond_cb_delete_by_mac)(uint8_t *mac_addr); ++}; ++ ++extern int bond_register_cb(struct bond_cb *cb); ++extern void bond_unregister_cb(void); ++/* QCA NSS ECM bonding support - End */ ++ + #endif /* _NET_BONDING_H */ diff --git a/target/linux/qualcommax/patches-6.6/2600-5-qca-nss-ecm-support-macvlan.patch b/target/linux/qualcommax/patches-6.6/2600-5-qca-nss-ecm-support-macvlan.patch new file mode 100644 index 00000000000..29f7e96d791 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2600-5-qca-nss-ecm-support-macvlan.patch @@ -0,0 +1,96 @@ +--- a/include/linux/if_macvlan.h ++++ b/include/linux/if_macvlan.h +@@ -15,6 +15,13 @@ struct macvlan_port; + #define MACVLAN_MC_FILTER_BITS 8 + #define MACVLAN_MC_FILTER_SZ (1 << MACVLAN_MC_FILTER_BITS) + ++/* QCA NSS ECM Support - Start */ ++/* ++ * Callback for updating interface statistics for macvlan flows offloaded from host CPU. ++ */ ++typedef void (*macvlan_offload_stats_update_cb_t)(struct net_device *dev, struct rtnl_link_stats64 *stats, bool update_mcast_rx_stats); ++/* QCA NSS ECM Support - End */ ++ + struct macvlan_dev { + struct net_device *dev; + struct list_head list; +@@ -35,6 +42,7 @@ struct macvlan_dev { + #ifdef CONFIG_NET_POLL_CONTROLLER + struct netpoll *netpoll; + #endif ++ macvlan_offload_stats_update_cb_t offload_stats_update; /* QCA NSS ECM support */ + }; + + static inline void macvlan_count_rx(const struct macvlan_dev *vlan, +@@ -107,4 +115,26 @@ static inline int macvlan_release_l2fw_o + macvlan->accel_priv = NULL; + return dev_uc_add(macvlan->lowerdev, dev->dev_addr); + } ++ ++/* QCA NSS ECM Support - Start */ ++#if IS_ENABLED(CONFIG_MACVLAN) ++static inline void ++macvlan_offload_stats_update(struct net_device *dev, ++ struct rtnl_link_stats64 *stats, ++ bool update_mcast_rx_stats) ++{ ++ struct macvlan_dev *macvlan = netdev_priv(dev); ++ ++ macvlan->offload_stats_update(dev, stats, update_mcast_rx_stats); ++} ++ ++static inline enum ++macvlan_mode macvlan_get_mode(struct net_device *dev) ++{ ++ struct macvlan_dev *macvlan = netdev_priv(dev); ++ ++ return macvlan->mode; ++} ++#endif ++/* QCA NSS ECM Support - End */ + #endif /* _LINUX_IF_MACVLAN_H */ +--- a/drivers/net/macvlan.c ++++ b/drivers/net/macvlan.c +@@ -960,6 +960,34 @@ static void macvlan_uninit(struct net_de + macvlan_port_destroy(port->dev); + } + ++/* QCA NSS ECM Support - Start */ ++/* Update macvlan statistics processed by offload engines */ ++static void macvlan_dev_update_stats(struct net_device *dev, ++ struct rtnl_link_stats64 *offl_stats, ++ bool update_mcast_rx_stats) ++{ ++ struct vlan_pcpu_stats *stats; ++ struct macvlan_dev *macvlan; ++ ++ /* Is this a macvlan? */ ++ if (!netif_is_macvlan(dev)) ++ return; ++ ++ macvlan = netdev_priv(dev); ++ stats = this_cpu_ptr(macvlan->pcpu_stats); ++ u64_stats_update_begin(&stats->syncp); ++ u64_stats_add(&stats->rx_packets, offl_stats->rx_packets); ++ u64_stats_add(&stats->rx_bytes, offl_stats->rx_bytes); ++ u64_stats_add(&stats->tx_packets, offl_stats->tx_packets); ++ u64_stats_add(&stats->tx_bytes, offl_stats->tx_bytes); ++ /* Update multicast statistics */ ++ if (unlikely(update_mcast_rx_stats)) { ++ u64_stats_add(&stats->rx_multicast, offl_stats->rx_packets); ++ } ++ u64_stats_update_end(&stats->syncp); ++} ++/* QCA NSS ECM Support - End */ ++ + static void macvlan_dev_get_stats64(struct net_device *dev, + struct rtnl_link_stats64 *stats) + { +@@ -1506,6 +1534,7 @@ int macvlan_common_newlink(struct net *s + vlan->dev = dev; + vlan->port = port; + vlan->set_features = MACVLAN_FEATURES; ++ vlan->offload_stats_update = macvlan_dev_update_stats; /* QCA NSS ECM Support */ + + vlan->mode = MACVLAN_MODE_VEPA; + if (data && data[IFLA_MACVLAN_MODE]) diff --git a/target/linux/qualcommax/patches-6.6/2600-6-qca-nss-ecm-support-netfilter-DSCPREMARK.patch b/target/linux/qualcommax/patches-6.6/2600-6-qca-nss-ecm-support-netfilter-DSCPREMARK.patch new file mode 100644 index 00000000000..9589b599bd0 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2600-6-qca-nss-ecm-support-netfilter-DSCPREMARK.patch @@ -0,0 +1,69 @@ +--- a/net/netfilter/Kconfig ++++ b/net/netfilter/Kconfig +@@ -174,6 +174,13 @@ config NF_CONNTRACK_TIMEOUT + + If unsure, say `N'. + ++config NF_CONNTRACK_DSCPREMARK_EXT ++ bool 'Connection tracking extension for dscp remark target' ++ depends on NETFILTER_ADVANCED ++ help ++ This option enables support for connection tracking extension ++ for dscp remark. ++ + config NF_CONNTRACK_TIMESTAMP + bool 'Connection tracking timestamping' + depends on NETFILTER_ADVANCED +--- a/include/net/netfilter/nf_conntrack_extend.h ++++ b/include/net/netfilter/nf_conntrack_extend.h +@@ -31,6 +31,10 @@ enum nf_ct_ext_id { + #if IS_ENABLED(CONFIG_NET_ACT_CT) + NF_CT_EXT_ACT_CT, + #endif ++#ifdef CONFIG_NF_CONNTRACK_DSCPREMARK_EXT ++ NF_CT_EXT_DSCPREMARK, /* QCA NSS ECM support */ ++#endif ++ + NF_CT_EXT_NUM, + }; + +--- a/net/netfilter/nf_conntrack_extend.c ++++ b/net/netfilter/nf_conntrack_extend.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + #include + + #define NF_CT_EXT_PREALLOC 128u /* conntrack events are on by default */ +@@ -54,6 +55,9 @@ static const u8 nf_ct_ext_type_len[NF_CT + #if IS_ENABLED(CONFIG_NET_ACT_CT) + [NF_CT_EXT_ACT_CT] = sizeof(struct nf_conn_act_ct_ext), + #endif ++#ifdef CONFIG_NF_CONNTRACK_DSCPREMARK_EXT ++ [NF_CT_EXT_DSCPREMARK] = sizeof(struct nf_ct_dscpremark_ext), ++#endif + }; + + static __always_inline unsigned int total_extension_size(void) +@@ -86,6 +90,9 @@ static __always_inline unsigned int tota + #if IS_ENABLED(CONFIG_NET_ACT_CT) + + sizeof(struct nf_conn_act_ct_ext) + #endif ++#ifdef CONFIG_NF_CONNTRACK_DSCPREMARK_EXT ++ + sizeof(struct nf_ct_dscpremark_ext) ++#endif + ; + } + +--- a/net/netfilter/Makefile ++++ b/net/netfilter/Makefile +@@ -15,6 +15,7 @@ nf_conntrack-$(CONFIG_NF_CONNTRACK_OVS) + nf_conntrack-$(CONFIG_NF_CT_PROTO_DCCP) += nf_conntrack_proto_dccp.o + nf_conntrack-$(CONFIG_NF_CT_PROTO_SCTP) += nf_conntrack_proto_sctp.o + nf_conntrack-$(CONFIG_NF_CT_PROTO_GRE) += nf_conntrack_proto_gre.o ++nf_conntrack-$(CONFIG_NF_CONNTRACK_DSCPREMARK_EXT) += nf_conntrack_dscpremark_ext.o + ifeq ($(CONFIG_NF_CONNTRACK),m) + nf_conntrack-$(CONFIG_DEBUG_INFO_BTF_MODULES) += nf_conntrack_bpf.o + else ifeq ($(CONFIG_NF_CONNTRACK),y) diff --git a/target/linux/qualcommax/patches-6.6/2600-7-qca-nss-ecm-add-missing-net-defines.patch b/target/linux/qualcommax/patches-6.6/2600-7-qca-nss-ecm-add-missing-net-defines.patch new file mode 100644 index 00000000000..8911bc60112 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2600-7-qca-nss-ecm-add-missing-net-defines.patch @@ -0,0 +1,35 @@ +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h +@@ -1777,7 +1777,9 @@ enum netdev_priv_flags_ext { + IFF_EXT_PPP_PPTP = 1<<3, + IFF_EXT_GRE_V4_TAP = 1<<4, + IFF_EXT_GRE_V6_TAP = 1<<5, +- IFF_EXT_IFB = 1<<6, ++ IFF_EXT_IFB = 1<<6, ++ IFF_EXT_MAPT = 1<<7, ++ IFF_EXT_HW_NO_OFFLOAD = 1<<8, + }; + + #define IFF_802_1Q_VLAN IFF_802_1Q_VLAN +--- a/include/uapi/linux/in.h ++++ b/include/uapi/linux/in.h +@@ -63,6 +63,8 @@ enum { + #define IPPROTO_MTP IPPROTO_MTP + IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET */ + #define IPPROTO_BEETPH IPPROTO_BEETPH ++ IPPROTO_ETHERIP = 97, /* ETHERIP protocol number */ ++#define IPPROTO_ETHERIP IPPROTO_ETHERIP + IPPROTO_ENCAP = 98, /* Encapsulation Header */ + #define IPPROTO_ENCAP IPPROTO_ENCAP + IPPROTO_PIM = 103, /* Protocol Independent Multicast */ +--- a/tools/include/uapi/linux/in.h ++++ b/tools/include/uapi/linux/in.h +@@ -63,6 +63,8 @@ enum { + #define IPPROTO_MTP IPPROTO_MTP + IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET */ + #define IPPROTO_BEETPH IPPROTO_BEETPH ++ IPPROTO_ETHERIP = 97, /* ETHERIP protocol number */ ++#define IPPROTO_ETHERIP IPPROTO_ETHERIP + IPPROTO_ENCAP = 98, /* Encapsulation Header */ + #define IPPROTO_ENCAP IPPROTO_ENCAP + IPPROTO_PIM = 103, /* Protocol Independent Multicast */ diff --git a/target/linux/qualcommax/patches-6.6/2600-8-qca-nss-ecm-support-MLO-bonding.patch b/target/linux/qualcommax/patches-6.6/2600-8-qca-nss-ecm-support-MLO-bonding.patch new file mode 100644 index 00000000000..989862ee862 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2600-8-qca-nss-ecm-support-MLO-bonding.patch @@ -0,0 +1,537 @@ +From 0403eceee14bb6eb4e417102cae830b7509b1554 Mon Sep 17 00:00:00 2001 +From: Shivani Soni +Date: Thu, 17 Nov 2022 00:16:38 +0530 +Subject: [PATCH] arm/arm64: Add support for MLO bonding + +1. Introduced BOND_MODE_MLO to support MLO bonding +2. Transmit handling according to new mode + +Change-Id: Ib272e77cce56ee50b0a13305fac8fae76743c206 +Signed-off-by: Shivani Soni +--- + drivers/net/bonding/bond_main.c | 212 ++++++++++++++++++++++++----- + drivers/net/bonding/bond_options.c | 1 + + include/net/bonding.h | 30 +++- + include/uapi/linux/if_bonding.h | 1 + + 4 files changed, 210 insertions(+), 34 deletions(-) + +--- a/drivers/net/bonding/bond_main.c ++++ b/drivers/net/bonding/bond_main.c +@@ -1436,6 +1436,10 @@ static netdev_features_t bond_fix_featur + return features; + } + ++#define BOND_MLO_VLAN_FEATURES (NETIF_F_SG | \ ++ NETIF_F_FRAGLIST | \ ++ NETIF_F_HIGHDMA | NETIF_F_LRO) ++ + #define BOND_VLAN_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \ + NETIF_F_FRAGLIST | NETIF_F_GSO_SOFTWARE | \ + NETIF_F_HIGHDMA | NETIF_F_LRO) +@@ -1466,13 +1470,25 @@ static void bond_compute_features(struct + + if (!bond_has_slaves(bond)) + goto done; ++ ++ /* ++ * Use features specific to bond MLO ++ */ ++ if (BOND_MODE(bond) == BOND_MODE_MLO) { ++ vlan_features = BOND_MLO_VLAN_FEATURES; ++ } ++ + vlan_features &= NETIF_F_ALL_FOR_ALL; + mpls_features &= NETIF_F_ALL_FOR_ALL; + + bond_for_each_slave(bond, slave, iter) { +- vlan_features = netdev_increment_features(vlan_features, +- slave->dev->vlan_features, BOND_VLAN_FEATURES); +- ++ if (BOND_MODE(bond) == BOND_MODE_MLO) { ++ vlan_features = netdev_increment_features(vlan_features, ++ slave->dev->vlan_features, BOND_MLO_VLAN_FEATURES); ++ } else { ++ vlan_features = netdev_increment_features(vlan_features, ++ slave->dev->vlan_features, BOND_VLAN_FEATURES); ++ } + enc_features = netdev_increment_features(enc_features, + slave->dev->hw_enc_features, + BOND_ENC_FEATURES); +@@ -1617,6 +1633,16 @@ static rx_handler_result_t bond_handle_f + bond->dev->addr_len); + } + ++ /* ++ * Set the PACKET_HOST for MLO mode as ++ * MLO bond netdevice needs to support routing ++ */ ++ if (BOND_MODE(bond) == BOND_MODE_MLO) { ++ if (ether_addr_equal(bond->dev->dev_addr, eth_hdr(skb)->h_dest)) { ++ skb->pkt_type = PACKET_HOST; ++ } ++ } ++ + return ret; + } + +@@ -1862,6 +1888,8 @@ int bond_enslave(struct net_device *bond + return -EPERM; + } + ++ ASSERT_RTNL(); ++ + if (!bond->params.use_carrier && + slave_dev->ethtool_ops->get_link == NULL && + slave_ops->ndo_eth_ioctl == NULL) { +@@ -1975,13 +2003,17 @@ int bond_enslave(struct net_device *bond + call_netdevice_notifiers(NETDEV_JOIN, slave_dev); + + /* If this is the first slave, then we need to set the master's hardware +- * address to be the same as the slave's. ++ * address to be the same as the slave's except for BOND_MODE_MLO. ++ * For BOND_MODE_MLO, master's mac address is MLD address which should ++ * not be same as slave's address. + */ +- if (!bond_has_slaves(bond) && +- bond->dev->addr_assign_type == NET_ADDR_RANDOM) { +- res = bond_set_dev_addr(bond->dev, slave_dev); +- if (res) +- goto err_undo_flags; ++ if (BOND_MODE(bond) != BOND_MODE_MLO) { ++ if (!bond_has_slaves(bond) && ++ bond->dev->addr_assign_type == NET_ADDR_RANDOM) { ++ res = bond_set_dev_addr(bond->dev, slave_dev); ++ if (res) ++ goto err_undo_flags; ++ } + } + + new_slave = bond_alloc_slave(bond, slave_dev); +@@ -2010,18 +2042,21 @@ int bond_enslave(struct net_device *bond + bond_hw_addr_copy(new_slave->perm_hwaddr, slave_dev->dev_addr, + slave_dev->addr_len); + +- if (!bond->params.fail_over_mac || +- BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) { +- /* Set slave to master's mac address. The application already +- * set the master's mac address to that of the first slave +- */ +- memcpy(ss.__data, bond_dev->dev_addr, bond_dev->addr_len); +- ss.ss_family = slave_dev->type; +- res = dev_set_mac_address(slave_dev, (struct sockaddr *)&ss, +- extack); +- if (res) { +- slave_err(bond_dev, slave_dev, "Error %d calling set_mac_address\n", res); +- goto err_restore_mtu; ++ /* Set slave to master's mac address except for BOND_MODE_MLO ++ * as for MLO mode master's mac address is not same as slave's mac address. ++ * The application already set the master's mac address to that of the first slave ++ */ ++ if (BOND_MODE(bond) != BOND_MODE_MLO) { ++ if (!bond->params.fail_over_mac || ++ BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) { ++ memcpy(ss.__data, bond_dev->dev_addr, bond_dev->addr_len); ++ ss.ss_family = slave_dev->type; ++ res = dev_set_mac_address(slave_dev, (struct sockaddr *)&ss, ++ extack); ++ if (res) { ++ slave_err(bond_dev, slave_dev, "Error %d calling set_mac_address\n", res); ++ goto err_restore_mtu; ++ } + } + } + +@@ -2382,6 +2417,7 @@ err_undo_flags: + + return res; + } ++EXPORT_SYMBOL(bond_enslave); + + /* Try to release the slave device from the bond device + * It is legal to access curr_active_slave without a lock because all the function +@@ -2503,13 +2539,23 @@ static int __bond_release_one(struct net + } + + bond_set_carrier(bond); +- if (!bond_has_slaves(bond)) +- eth_hw_addr_random(bond_dev); ++ ++ /* ++ * Avoid changing the mac address of bond netdevice for MLO case, ++ * This will only be supported from wifi driver. ++ */ ++ if (BOND_MODE(bond) != BOND_MODE_MLO) { ++ if (!bond_has_slaves(bond)) ++ eth_hw_addr_random(bond_dev); ++ } + + unblock_netpoll_tx(); + synchronize_rcu(); + bond->slave_cnt--; + ++ /* ++ * TODO: Avoid MAC address change notification for BOND_MODE_MLO ++ */ + if (!bond_has_slaves(bond)) { + call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev); + call_netdevice_notifiers(NETDEV_RELEASE, bond->dev); +@@ -2579,6 +2625,7 @@ int bond_release(struct net_device *bond + { + return __bond_release_one(bond_dev, slave_dev, false, false); + } ++EXPORT_SYMBOL(bond_release); + + /* First release a slave and then destroy the bond if no more slaves are left. + * Must be under rtnl_lock when this function is called. +@@ -2600,6 +2647,29 @@ static int bond_release_and_destroy(stru + return ret; + } + ++/* Destroy the bond for BOND_MODE_MLO if no more slaves are left. ++ * Must be under rtnl_lock when this function is called. ++ */ ++bool bond_destroy_mlo(struct net_device *bond_dev) ++{ ++ struct bonding *bond = netdev_priv(bond_dev); ++ ++ ASSERT_RTNL(); ++ ++ if (!bond_has_slaves(bond)) { ++ bond_dev->priv_flags |= IFF_DISABLE_NETPOLL; ++ netdev_info(bond_dev, "Destroying bond as no slaves are present\n"); ++ bond_remove_proc_entry(bond); ++ unregister_netdevice(bond_dev); ++ return true; ++ } ++ ++ pr_err("%p: Not able to destroy bond netdevice: %s as slaves are present\n", bond_dev, bond_dev->name); ++ ++ return false; ++} ++EXPORT_SYMBOL(bond_destroy_mlo); ++ + static void bond_info_query(struct net_device *bond_dev, struct ifbond *info) + { + struct bonding *bond = netdev_priv(bond_dev); +@@ -4256,6 +4326,24 @@ static struct net_device *bond_xor_get_t + return NULL; + } + ++/* Transmit function for BOND_MODE_MLO. ++ * Get transmit link interface from registered callback. ++ */ ++struct net_device *bond_mlo_get_tx_dev(struct net_device *bond_dev, u8 *dst_mac) ++{ ++ struct net_device *slave_dev = NULL; ++ struct mlo_bond_info *mlo_info = NULL; ++ void *bond_mlo_ctx; ++ ++ mlo_info = bond_get_mlo_priv(bond_dev); ++ if (mlo_info->bond_get_mlo_tx_netdev) { ++ bond_mlo_ctx = bond_get_mlo_ctx(bond_dev); ++ slave_dev = mlo_info->bond_get_mlo_tx_netdev(bond_mlo_ctx, dst_mac); ++ } ++ ++ return slave_dev; ++} ++ + /* bond_get_tx_dev - Calculate egress interface for a given packet. + * + * Supports 802.3AD and balance-xor modes +@@ -4296,6 +4384,9 @@ struct net_device *bond_get_tx_dev(struc + return bond_3ad_get_tx_dev(skb, src_mac, dst_mac, + src, dst, protocol, + bond_dev, layer4hdr); ++ case BOND_MODE_MLO: ++ return bond_mlo_get_tx_dev(bond_dev, dst_mac); ++ + default: + return NULL; + } +@@ -5054,20 +5145,26 @@ static int bond_set_mac_address(struct n + if (!is_valid_ether_addr(ss->__data)) + return -EADDRNOTAVAIL; + +- bond_for_each_slave(bond, slave, iter) { +- slave_dbg(bond_dev, slave->dev, "%s: slave=%p\n", +- __func__, slave); +- res = dev_set_mac_address(slave->dev, addr, NULL); +- if (res) { +- /* TODO: consider downing the slave +- * and retry ? +- * User should expect communications +- * breakage anyway until ARP finish +- * updating, so... +- */ +- slave_dbg(bond_dev, slave->dev, "%s: err %d\n", +- __func__, res); +- goto unwind; ++ /* ++ * Do not allow mac address change for slave netdevice for BOND_MODE_MLO ++ * as master's mac address is not same as slave's mac address. ++ */ ++ if (BOND_MODE(bond) != BOND_MODE_MLO) { ++ bond_for_each_slave(bond, slave, iter) { ++ slave_dbg(bond_dev, slave->dev, "%s: slave=%p\n", ++ __func__, slave); ++ res = dev_set_mac_address(slave->dev, addr, NULL); ++ if (res) { ++ /* TODO: consider downing the slave ++ * and retry ? ++ * User should expect communications ++ * breakage anyway until ARP finish ++ * updating, so... ++ */ ++ slave_dbg(bond_dev, slave->dev, "%s: err %d\n", ++ __func__, res); ++ goto unwind; ++ } + } + } + +@@ -5719,6 +5816,27 @@ static netdev_tx_t bond_tls_device_xmit( + } + #endif + ++/* In bond_xmit_mlo(), we send the packet and bond netdevice ++ * to registered callback for final xmit. ++ */ ++static netdev_tx_t bond_xmit_mlo(struct sk_buff *skb, struct net_device *bond_dev) ++{ ++ struct bonding *bond = netdev_priv(bond_dev); ++ int slave_cnt, ret; ++ struct mlo_bond_info *mlo_info = bond_get_mlo_priv(bond_dev); ++ ++ slave_cnt = READ_ONCE(bond->slave_cnt); ++ if (unlikely(slave_cnt == 0) || unlikely(!mlo_info->bond_mlo_xmit_netdev)) { ++ bond_tx_drop(bond_dev, skb); ++ } else { ++ ret = mlo_info->bond_mlo_xmit_netdev(skb, bond_dev); ++ if (ret != NET_XMIT_SUCCESS) ++ netdev_err(bond_dev, "Xmit failed with mode %d %p\n", BOND_MODE(bond), skb); ++ } ++ ++ return NETDEV_TX_OK; ++} ++ + static netdev_tx_t __bond_start_xmit(struct sk_buff *skb, struct net_device *dev) + { + struct bonding *bond = netdev_priv(dev); +@@ -5747,6 +5865,8 @@ static netdev_tx_t __bond_start_xmit(str + return bond_alb_xmit(skb, dev); + case BOND_MODE_TLB: + return bond_tlb_xmit(skb, dev); ++ case BOND_MODE_MLO: ++ return bond_xmit_mlo(skb, dev); + default: + /* Should never happen, mode already checked */ + netdev_err(dev, "Unknown bonding mode %d\n", BOND_MODE(bond)); +@@ -6182,6 +6302,15 @@ static void bond_destructor(struct net_d + if (bond->id != (~0U)) + clear_bit(bond->id, &bond_id_mask); + /* QCA NSS ECM bonding support */ ++ ++ /* ++ * Wifi driver registered callback to destroy wiphy for MLO bond netdevice ++ */ ++ if (bond_is_mlo_device(bond_dev)) { ++ if (bond->mlo_info.bond_mlo_netdev_priv_destructor) { ++ bond->mlo_info.bond_mlo_netdev_priv_destructor(bond_dev); ++ } ++ } + } + + void bond_setup(struct net_device *bond_dev) +@@ -6743,6 +6872,76 @@ out: + return res; + } + ++/* bond_create_mlo() ++ * Create bond netdevice for BOND_MODE_MLO with MLO specific callback and context. ++ */ ++struct net_device *bond_create_mlo(struct net *net, const char *name, struct mlo_bond_info *mlo_info) ++{ ++ struct net_device *bond_dev; ++ struct bonding *bond; ++ int res; ++ ++ ASSERT_RTNL(); ++ ++ bond_dev = alloc_netdev_mq(sizeof(struct bonding), ++ name ? name : "bond%d", NET_NAME_UNKNOWN, ++ bond_setup, tx_queues); ++ if (!bond_dev) { ++ pr_err("%s: eek! can't alloc netdev!\n", name); ++ return NULL; ++ } ++ ++ bond = netdev_priv(bond_dev); ++ ++ dev_net_set(bond_dev, net); ++ bond_dev->rtnl_link_ops = &bond_link_ops; ++ ++ /* ++ * MLO specific initialization. ++ */ ++ bond_dev->ieee80211_ptr = mlo_info->wdev; ++ bond->params.mode = BOND_MODE_MLO; ++ mlo_info->wdev->netdev = bond_dev; ++ ++ memcpy((void *)&bond->mlo_info, (void *)mlo_info, sizeof(*mlo_info)); ++ eth_hw_addr_random(bond_dev); ++ ++ /* ++ * Disable HW CSUM as wlan driver doesn't support ++ */ ++ bond_dev->hw_features &= ~(NETIF_F_HW_CSUM); ++ bond_dev->features &= ~(NETIF_F_HW_CSUM); ++ ++ res = register_netdevice(bond_dev); ++ if (res < 0) { ++ free_netdev(bond_dev); ++ return NULL; ++ } ++ ++ netif_carrier_off(bond_dev); ++ bond_work_init_all(bond); ++ ++ bond->id = ~0U; ++ if (bond_id_mask != (~0UL)) { ++ bond->id = (u32)ffz(bond_id_mask); ++ set_bit(bond->id, &bond_id_mask); ++ } ++ ++ return bond_dev; ++} ++EXPORT_SYMBOL(bond_create_mlo); ++ ++/* bond_get_mlo_ctx ++ * Returns MLO context stored in netdev priv of bond netdevice ++ */ ++void *bond_get_mlo_ctx(struct net_device *bond_dev) ++{ ++ struct mlo_bond_info *mlo_info = bond_get_mlo_priv(bond_dev); ++ ++ return mlo_info->bond_mlo_ctx; ++} ++EXPORT_SYMBOL(bond_get_mlo_ctx); ++ + static int __net_init bond_net_init(struct net *net) + { + struct bond_net *bn = net_generic(net, bond_net_id); +--- a/drivers/net/bonding/bond_options.c ++++ b/drivers/net/bonding/bond_options.c +@@ -94,6 +94,7 @@ static const struct bond_opt_value bond_ + { "802.3ad", BOND_MODE_8023AD, 0}, + { "balance-tlb", BOND_MODE_TLB, 0}, + { "balance-alb", BOND_MODE_ALB, 0}, ++ { "mode mlo", BOND_MODE_MLO, 0}, + { NULL, -1, 0}, + }; + +--- a/include/net/bonding.h ++++ b/include/net/bonding.h +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -199,6 +200,22 @@ struct bond_up_slave { + struct slave *arr[]; + }; + ++/** ++ * mlo_bond_info - mlo_bond_info structure maintains members corresponding to wifi 7 ++ * @bond_mlo_xmit_netdev: Callback function to provide skb to wifi driver for xmit ++ * @bond_get_mlo_tx_netdev: Callback function to get link interface from wifi driver for transmit ++ * @bond_mlo_ctx: Private member for wifi driver ++ * @wdev: ieee80211_ptr for wifi VAP ++ * @bond_mlo_netdev_priv_destructor: Callback function to remove wiphy instance from wifi driver ++ */ ++struct mlo_bond_info { ++ int (*bond_mlo_xmit_netdev)(struct sk_buff *skb, struct net_device *bond_dev); ++ struct net_device *(*bond_get_mlo_tx_netdev)(void *bond_mlo_ctx, void *dst); ++ void *bond_mlo_ctx; ++ struct wireless_dev *wdev; ++ void (*bond_mlo_netdev_priv_destructor)(struct net_device *bond_dev); ++}; ++ + /* + * Link pseudo-state only used internally by monitors + */ +@@ -264,6 +281,8 @@ struct bonding { + #endif /* CONFIG_XFRM_OFFLOAD */ + struct bpf_prog *xdp_prog; + u32 id; /* QCA NSS ECM bonding support */ ++ /* MLO mode info */ ++ struct mlo_bond_info mlo_info; + }; + + #define bond_slave_get_rcu(dev) \ +@@ -280,6 +299,19 @@ struct bond_vlan_tag { + unsigned short vlan_id; + }; + ++/** ++ * Returns False if the net_device is not MLO bond netdvice ++ * ++ */ ++static inline bool bond_is_mlo_device(struct net_device *bond_dev) ++{ ++ struct bonding *bond = netdev_priv(bond_dev); ++ if (BOND_MODE(bond) == BOND_MODE_MLO) ++ return true; ++ ++ return false; ++} ++ + /* + * Returns NULL if the net_device does not belong to any of the bond's slaves + * +@@ -644,6 +676,12 @@ static inline __be32 bond_confirm_addr(s + return addr; + } + ++static inline struct mlo_bond_info *bond_get_mlo_priv(struct net_device *bond_dev) ++{ ++ struct bonding *bond = netdev_priv(bond_dev); ++ return &bond->mlo_info; ++} ++ + struct bond_net { + struct net *net; /* Associated network namespace */ + struct list_head dev_list; +@@ -657,15 +695,18 @@ int bond_rcv_validate(const struct sk_bu + netdev_tx_t bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev); + int bond_get_id(struct net_device *bond_dev); /* QCA NSS ECM bonding support */ + int bond_create(struct net *net, const char *name); ++extern struct net_device *bond_create_mlo(struct net *net, const char *name, struct mlo_bond_info *mlo_info); ++extern void *bond_get_mlo_ctx(struct net_device *bond_dev); ++extern bool bond_destroy_mlo(struct net_device *bond_dev); + int bond_create_sysfs(struct bond_net *net); + void bond_destroy_sysfs(struct bond_net *net); + void bond_prepare_sysfs_group(struct bonding *bond); + int bond_sysfs_slave_add(struct slave *slave); + void bond_sysfs_slave_del(struct slave *slave); + void bond_xdp_set_features(struct net_device *bond_dev); +-int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev, ++extern int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev, + struct netlink_ext_ack *extack); +-int bond_release(struct net_device *bond_dev, struct net_device *slave_dev); ++extern int bond_release(struct net_device *bond_dev, struct net_device *slave_dev); + u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb); + int bond_set_carrier(struct bonding *bond); + void bond_select_active_slave(struct bonding *bond); +--- a/include/uapi/linux/if_bonding.h ++++ b/include/uapi/linux/if_bonding.h +@@ -71,6 +71,7 @@ + #define BOND_MODE_8023AD 4 + #define BOND_MODE_TLB 5 + #define BOND_MODE_ALB 6 /* TLB + RLB (receive load balancing) */ ++#define BOND_MODE_MLO 7 /* MLO (Multi link) mode for Wi-Fi 7 AP links */ + + /* each slave's link has 4 states */ + #define BOND_LINK_UP 0 /* link is up and running */ diff --git a/target/linux/qualcommax/patches-6.6/2601-qca-add-nss-bridge-mgr-support.patch b/target/linux/qualcommax/patches-6.6/2601-qca-add-nss-bridge-mgr-support.patch new file mode 100644 index 00000000000..1d24c0e8c3f --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2601-qca-add-nss-bridge-mgr-support.patch @@ -0,0 +1,94 @@ +From 3c17a0e1112be70071e98d5208da5b55dcec20a6 Mon Sep 17 00:00:00 2001 +From: Simon Casey +Date: Wed, 2 Feb 2022 19:37:29 +0100 +Subject: [PATCH] Update 607-qca-add-add-nss-bridge-mgr-support.patch for kernel 5.15 + +--- + include/linux/if_bridge.h | 4 ++++ + net/bridge/br_fdb.c | 25 +++++++++++++++++++++---- + 2 files changed, 25 insertions(+), 4 deletions(-) + +--- a/include/linux/if_bridge.h ++++ b/include/linux/if_bridge.h +@@ -254,4 +254,8 @@ typedef struct net_bridge_port *br_get_d + extern br_get_dst_hook_t __rcu *br_get_dst_hook; + /* QCA NSS ECM support - End */ + ++/* QCA NSS bridge-mgr support - Start */ ++extern struct net_device *br_fdb_bridge_dev_get_and_hold(struct net_bridge *br); ++/* QCA NSS bridge-mgr support - End */ ++ + #endif +--- a/net/bridge/br_fdb.c ++++ b/net/bridge/br_fdb.c +@@ -62,6 +62,15 @@ void br_fdb_update_unregister_notify(str + EXPORT_SYMBOL_GPL(br_fdb_update_unregister_notify); + /* QCA NSS ECM support - End */ + ++/* QCA NSS bridge-mgr support - Start */ ++struct net_device *br_fdb_bridge_dev_get_and_hold(struct net_bridge *br) ++{ ++ dev_hold(br->dev); ++ return br->dev; ++} ++EXPORT_SYMBOL_GPL(br_fdb_bridge_dev_get_and_hold); ++/* QCA NSS bridge-mgr support - End */ ++ + int __init br_fdb_init(void) + { + br_fdb_cache = kmem_cache_create("bridge_fdb_cache", +@@ -575,7 +584,7 @@ void br_fdb_cleanup(struct work_struct * + unsigned long delay = hold_time(br); + unsigned long work_delay = delay; + unsigned long now = jiffies; +- u8 mac_addr[6]; /* QCA NSS ECM support */ ++ struct br_fdb_event fdb_event; /* QCA NSS bridge-mgr support */ + + /* this part is tricky, in order to avoid blocking learning and + * consequently forwarding, we rely on rcu to delete objects with +@@ -603,12 +612,13 @@ void br_fdb_cleanup(struct work_struct * + } else { + spin_lock_bh(&br->hash_lock); + if (!hlist_unhashed(&f->fdb_node)) { +- ether_addr_copy(mac_addr, f->key.addr.addr); ++ memset(&fdb_event, 0, sizeof(fdb_event)); ++ ether_addr_copy(fdb_event.addr, f->key.addr.addr); + fdb_delete(br, f, true); + /* QCA NSS ECM support - Start */ + atomic_notifier_call_chain( + &br_fdb_update_notifier_list, 0, +- (void *)mac_addr); ++ (void *)&fdb_event); + /* QCA NSS ECM support - End */ + } + spin_unlock_bh(&br->hash_lock); +@@ -910,6 +920,7 @@ void br_fdb_update(struct net_bridge *br + const unsigned char *addr, u16 vid, unsigned long flags) + { + struct net_bridge_fdb_entry *fdb; ++ struct br_fdb_event fdb_event; /* QCA NSS bridge-mgr support */ + + /* some users want to always flood. */ + if (hold_time(br) == 0) +@@ -935,6 +946,12 @@ void br_fdb_update(struct net_bridge *br + if (unlikely(source != READ_ONCE(fdb->dst) && + !test_bit(BR_FDB_STICKY, &fdb->flags))) { + br_switchdev_fdb_notify(br, fdb, RTM_DELNEIGH); ++ /* QCA NSS bridge-mgr support - Start */ ++ ether_addr_copy(fdb_event.addr, addr); ++ fdb_event.br = br; ++ fdb_event.orig_dev = READ_ONCE(fdb->dst->dev); ++ fdb_event.dev = source->dev; ++ /* QCA NSS bridge-mgr support - End */ + WRITE_ONCE(fdb->dst, source); + fdb_modified = true; + /* Take over HW learned entry */ +@@ -951,7 +968,7 @@ void br_fdb_update(struct net_bridge *br + /* QCA NSS ECM support - Start */ + atomic_notifier_call_chain( + &br_fdb_update_notifier_list, +- 0, (void *)addr); ++ 0, (void *)&fdb_event); + /* QCA NSS ECM support - End */ + } + diff --git a/target/linux/qualcommax/patches-6.6/2602-qca-nss-drv-add-qdisc-support.patch b/target/linux/qualcommax/patches-6.6/2602-qca-nss-drv-add-qdisc-support.patch new file mode 100644 index 00000000000..b1eb55ca05f --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2602-qca-nss-drv-add-qdisc-support.patch @@ -0,0 +1,44 @@ +--- a/include/linux/skbuff.h ++++ b/include/linux/skbuff.h +@@ -764,6 +764,7 @@ typedef unsigned char *sk_buff_data_t; + * @offload_fwd_mark: Packet was L2-forwarded in hardware + * @offload_l3_fwd_mark: Packet was L3-forwarded in hardware + * @tc_skip_classify: do not classify packet. set by IFB device ++ * @tc_skip_classify_offload: do not classify packet set by offload IFB device + * @tc_at_ingress: used within tc_classify to distinguish in/egress + * @redirected: packet was redirected by packet classifier + * @from_ingress: packet was redirected from the ingress path +@@ -944,6 +945,8 @@ struct sk_buff { + #ifdef CONFIG_NET_XGRESS + __u8 tc_at_ingress:1; /* See TC_AT_INGRESS_MASK */ + __u8 tc_skip_classify:1; ++ __u8 tc_skip_classify_offload:1; ++ __u16 tc_verd_qca_nss; /* QCA NSS Qdisc Support */ + #endif + __u8 remcsum_offload:1; + __u8 csum_complete_sw:1; +--- a/include/uapi/linux/pkt_cls.h ++++ b/include/uapi/linux/pkt_cls.h +@@ -139,6 +139,7 @@ enum tca_id { + TCA_ID_MPLS, + TCA_ID_CT, + TCA_ID_GATE, ++ TCA_ID_MIRRED_NSS, /* QCA NSS Qdisc IGS Support */ + /* other actions go here */ + __TCA_ID_MAX = 255 + }; +@@ -817,4 +818,14 @@ enum { + TCF_EM_OPND_LT + }; + ++/* QCA NSS Qdisc Support - Start */ ++#define _TC_MAKE32(x) ((x)) ++#define _TC_MAKEMASK1(n) (_TC_MAKE32(1) << _TC_MAKE32(n)) ++ ++#define TC_NCLS _TC_MAKEMASK1(8) ++#define TC_NCLS_NSS _TC_MAKEMASK1(12) ++#define SET_TC_NCLS_NSS(v) ( TC_NCLS_NSS | ((v) & ~TC_NCLS_NSS)) ++#define CLR_TC_NCLS_NSS(v) ( (v) & ~TC_NCLS_NSS) ++/* QCA NSS Qdisc Support - End */ ++ + #endif diff --git a/target/linux/qualcommax/patches-6.6/2603-1-qca-nss-clients-add-qdisc-support.patch b/target/linux/qualcommax/patches-6.6/2603-1-qca-nss-clients-add-qdisc-support.patch new file mode 100644 index 00000000000..939acfde653 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2603-1-qca-nss-clients-add-qdisc-support.patch @@ -0,0 +1,441 @@ +--- a/include/linux/timer.h ++++ b/include/linux/timer.h +@@ -17,6 +17,7 @@ struct timer_list { + unsigned long expires; + void (*function)(struct timer_list *); + u32 flags; ++ unsigned long cust_data; + + #ifdef CONFIG_LOCKDEP + struct lockdep_map lockdep_map; +--- a/drivers/net/ifb.c ++++ b/drivers/net/ifb.c +@@ -151,6 +151,31 @@ resched: + + } + ++void ifb_update_offload_stats(struct net_device *dev, struct pcpu_sw_netstats *offload_stats) ++{ ++ struct ifb_dev_private *dp; ++ struct ifb_q_private *txp; ++ ++ if (!dev || !offload_stats) { ++ return; ++ } ++ ++ if (!(dev->priv_flags_ext & IFF_EXT_IFB)) { ++ return; ++ } ++ ++ dp = netdev_priv(dev); ++ txp = dp->tx_private; ++ ++ u64_stats_update_begin(&txp->rx_stats.sync); ++ txp->rx_stats.packets += u64_stats_read(&offload_stats->rx_packets); ++ txp->rx_stats.bytes += u64_stats_read(&offload_stats->rx_bytes); ++ txp->tx_stats.packets += u64_stats_read(&offload_stats->tx_packets); ++ txp->tx_stats.bytes += u64_stats_read(&offload_stats->tx_bytes); ++ u64_stats_update_end(&txp->rx_stats.sync); ++} ++EXPORT_SYMBOL(ifb_update_offload_stats); ++ + static void ifb_stats64(struct net_device *dev, + struct rtnl_link_stats64 *stats) + { +@@ -326,6 +351,7 @@ static void ifb_setup(struct net_device + dev->flags |= IFF_NOARP; + dev->flags &= ~IFF_MULTICAST; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; ++ dev->priv_flags_ext |= IFF_EXT_IFB; /* Mark the device as an IFB device. */ + netif_keep_dst(dev); + eth_hw_addr_random(dev); + dev->needs_free_netdev = true; +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h +@@ -4686,6 +4686,15 @@ void dev_uc_flush(struct net_device *dev + void dev_uc_init(struct net_device *dev); + + /** ++ * ifb_update_offload_stats - Update the IFB interface stats ++ * @dev: IFB device to update the stats ++ * @offload_stats: per CPU stats structure ++ * ++ * Allows update of IFB stats when flows are offloaded to an accelerator. ++ **/ ++void ifb_update_offload_stats(struct net_device *dev, struct pcpu_sw_netstats *offload_stats); ++ ++/** + * __dev_uc_sync - Synchonize device's unicast list + * @dev: device to sync + * @sync: function to call if address should be added +@@ -5212,6 +5221,11 @@ static inline bool netif_is_failover_sla + return dev->priv_flags & IFF_FAILOVER_SLAVE; + } + ++static inline bool netif_is_ifb_dev(const struct net_device *dev) ++{ ++ return dev->priv_flags_ext & IFF_EXT_IFB; ++} ++ + /* This device needs to keep skb dst for qdisc enqueue or ndo_start_xmit() */ + static inline void netif_keep_dst(struct net_device *dev) + { +--- a/include/uapi/linux/pkt_sched.h ++++ b/include/uapi/linux/pkt_sched.h +@@ -1306,4 +1306,248 @@ enum { + + #define TCA_ETS_MAX (__TCA_ETS_MAX - 1) + ++/* QCA NSS Clients Support - Start */ ++enum { ++ TCA_NSS_ACCEL_MODE_NSS_FW, ++ TCA_NSS_ACCEL_MODE_PPE, ++ TCA_NSS_ACCEL_MODE_MAX ++}; ++ ++/* NSSFIFO section */ ++ ++enum { ++ TCA_NSSFIFO_UNSPEC, ++ TCA_NSSFIFO_PARMS, ++ __TCA_NSSFIFO_MAX ++}; ++ ++#define TCA_NSSFIFO_MAX (__TCA_NSSFIFO_MAX - 1) ++ ++struct tc_nssfifo_qopt { ++ __u32 limit; /* Queue length: bytes for bfifo, packets for pfifo */ ++ __u8 set_default; /* Sets qdisc to be the default qdisc for enqueue */ ++ __u8 accel_mode; /* Dictates which data plane offloads the qdisc */ ++}; ++ ++/* NSSWRED section */ ++ ++enum { ++ TCA_NSSWRED_UNSPEC, ++ TCA_NSSWRED_PARMS, ++ __TCA_NSSWRED_MAX ++}; ++ ++#define TCA_NSSWRED_MAX (__TCA_NSSWRED_MAX - 1) ++#define NSSWRED_CLASS_MAX 6 ++struct tc_red_alg_parameter { ++ __u32 min; /* qlen_avg < min: pkts are all enqueued */ ++ __u32 max; /* qlen_avg > max: pkts are all dropped */ ++ __u32 probability;/* Drop probability at qlen_avg = max */ ++ __u32 exp_weight_factor;/* exp_weight_factor for calculate qlen_avg */ ++}; ++ ++struct tc_nsswred_traffic_class { ++ __u32 limit; /* Queue length */ ++ __u32 weight_mode_value; /* Weight mode value */ ++ struct tc_red_alg_parameter rap;/* Parameters for RED alg */ ++}; ++ ++/* ++ * Weight modes for WRED ++ */ ++enum tc_nsswred_weight_modes { ++ TC_NSSWRED_WEIGHT_MODE_DSCP = 0,/* Weight mode is DSCP */ ++ TC_NSSWRED_WEIGHT_MODES, /* Must be last */ ++}; ++ ++struct tc_nsswred_qopt { ++ __u32 limit; /* Queue length */ ++ enum tc_nsswred_weight_modes weight_mode; ++ /* Weight mode */ ++ __u32 traffic_classes; /* How many traffic classes: DPs */ ++ __u32 def_traffic_class; /* Default traffic if no match: def_DP */ ++ __u32 traffic_id; /* The traffic id to be configured: DP */ ++ __u32 weight_mode_value; /* Weight mode value */ ++ struct tc_red_alg_parameter rap;/* RED algorithm parameters */ ++ struct tc_nsswred_traffic_class tntc[NSSWRED_CLASS_MAX]; ++ /* Traffic settings for dumpping */ ++ __u8 ecn; /* Setting ECN bit or dropping */ ++ __u8 set_default; /* Sets qdisc to be the default for enqueue */ ++ __u8 accel_mode; /* Dictates which data plane offloads the qdisc */ ++}; ++ ++/* NSSCODEL section */ ++ ++enum { ++ TCA_NSSCODEL_UNSPEC, ++ TCA_NSSCODEL_PARMS, ++ __TCA_NSSCODEL_MAX ++}; ++ ++#define TCA_NSSCODEL_MAX (__TCA_NSSCODEL_MAX - 1) ++ ++struct tc_nsscodel_qopt { ++ __u32 target; /* Acceptable queueing delay */ ++ __u32 limit; /* Max number of packets that can be held in the queue */ ++ __u32 interval; /* Monitoring interval */ ++ __u32 flows; /* Number of flow buckets */ ++ __u32 quantum; /* Weight (in bytes) used for DRR of flow buckets */ ++ __u8 ecn; /* 0 - disable ECN, 1 - enable ECN */ ++ __u8 set_default; /* Sets qdisc to be the default qdisc for enqueue */ ++ __u8 accel_mode; /* Dictates which data plane offloads the qdisc */ ++}; ++ ++struct tc_nsscodel_xstats { ++ __u32 peak_queue_delay; /* Peak delay experienced by a dequeued packet */ ++ __u32 peak_drop_delay; /* Peak delay experienced by a dropped packet */ ++}; ++ ++/* NSSFQ_CODEL section */ ++ ++struct tc_nssfq_codel_xstats { ++ __u32 new_flow_count; /* Total number of new flows seen */ ++ __u32 new_flows_len; /* Current number of new flows */ ++ __u32 old_flows_len; /* Current number of old flows */ ++ __u32 ecn_mark; /* Number of packets marked with ECN */ ++ __u32 drop_overlimit; /* Number of packets dropped due to overlimit */ ++ __u32 maxpacket; /* The largest packet seen so far in the queue */ ++}; ++ ++/* NSSTBL section */ ++ ++enum { ++ TCA_NSSTBL_UNSPEC, ++ TCA_NSSTBL_PARMS, ++ __TCA_NSSTBL_MAX ++}; ++ ++#define TCA_NSSTBL_MAX (__TCA_NSSTBL_MAX - 1) ++ ++struct tc_nsstbl_qopt { ++ __u32 burst; /* Maximum burst size */ ++ __u32 rate; /* Limiting rate of TBF */ ++ __u32 peakrate; /* Maximum rate at which TBF is allowed to send */ ++ __u32 mtu; /* Max size of packet, or minumim burst size */ ++ __u8 accel_mode; /* Dictates which data plane offloads the qdisc */ ++}; ++ ++/* NSSPRIO section */ ++ ++#define TCA_NSSPRIO_MAX_BANDS 256 ++ ++enum { ++ TCA_NSSPRIO_UNSPEC, ++ TCA_NSSPRIO_PARMS, ++ __TCA_NSSPRIO_MAX ++}; ++ ++#define TCA_NSSPRIO_MAX (__TCA_NSSPRIO_MAX - 1) ++ ++struct tc_nssprio_qopt { ++ __u32 bands; /* Number of bands */ ++ __u8 accel_mode; /* Dictates which data plane offloads the qdisc */ ++}; ++ ++/* NSSBF section */ ++ ++enum { ++ TCA_NSSBF_UNSPEC, ++ TCA_NSSBF_CLASS_PARMS, ++ TCA_NSSBF_QDISC_PARMS, ++ __TCA_NSSBF_MAX ++}; ++ ++#define TCA_NSSBF_MAX (__TCA_NSSBF_MAX - 1) ++ ++struct tc_nssbf_class_qopt { ++ __u32 burst; /* Maximum burst size */ ++ __u32 rate; /* Allowed bandwidth for this class */ ++ __u32 mtu; /* MTU of the associated interface */ ++ __u32 quantum; /* Quantum allocation for DRR */ ++}; ++ ++struct tc_nssbf_qopt { ++ __u16 defcls; /* Default class value */ ++ __u8 accel_mode; /* Dictates which data plane offloads the qdisc */ ++}; ++ ++/* NSSWRR section */ ++ ++enum { ++ TCA_NSSWRR_UNSPEC, ++ TCA_NSSWRR_CLASS_PARMS, ++ TCA_NSSWRR_QDISC_PARMS, ++ __TCA_NSSWRR_MAX ++}; ++ ++#define TCA_NSSWRR_MAX (__TCA_NSSWRR_MAX - 1) ++ ++struct tc_nsswrr_class_qopt { ++ __u32 quantum; /* Weight associated to this class */ ++}; ++ ++struct tc_nsswrr_qopt { ++ __u8 accel_mode; /* Dictates which data plane offloads the qdisc */ ++}; ++ ++/* NSSWFQ section */ ++ ++enum { ++ TCA_NSSWFQ_UNSPEC, ++ TCA_NSSWFQ_CLASS_PARMS, ++ TCA_NSSWFQ_QDISC_PARMS, ++ __TCA_NSSWFQ_MAX ++}; ++ ++#define TCA_NSSWFQ_MAX (__TCA_NSSWFQ_MAX - 1) ++ ++struct tc_nsswfq_class_qopt { ++ __u32 quantum; /* Weight associated to this class */ ++}; ++ ++struct tc_nsswfq_qopt { ++ __u8 accel_mode; /* Dictates which data plane offloads the qdisc */ ++}; ++ ++/* NSSHTB section */ ++ ++enum { ++ TCA_NSSHTB_UNSPEC, ++ TCA_NSSHTB_CLASS_PARMS, ++ TCA_NSSHTB_QDISC_PARMS, ++ __TCA_NSSHTB_MAX ++}; ++ ++#define TCA_NSSHTB_MAX (__TCA_NSSHTB_MAX - 1) ++ ++struct tc_nsshtb_class_qopt { ++ __u32 burst; /* Allowed burst size */ ++ __u32 rate; /* Allowed bandwidth for this class */ ++ __u32 cburst; /* Maximum burst size */ ++ __u32 crate; /* Maximum bandwidth for this class */ ++ __u32 quantum; /* Quantum allocation for DRR */ ++ __u32 priority; /* Priority value associated with this class */ ++ __u32 overhead; /* Overhead in bytes per packet */ ++}; ++ ++struct tc_nsshtb_qopt { ++ __u32 r2q; /* Rate to quantum ratio */ ++ __u8 accel_mode; /* Dictates which data plane offloads the qdisc */ ++}; ++ ++/* NSSBLACKHOLE section */ ++ ++enum { ++ TCA_NSSBLACKHOLE_UNSPEC, ++ TCA_NSSBLACKHOLE_PARMS, ++ __TCA_NSSBLACKHOLE_MAX ++}; ++ ++#define TCA_NSSBLACKHOLE_MAX (__TCA_NSSBLACKHOLE_MAX - 1) ++ ++struct tc_nssblackhole_qopt { ++ __u8 set_default; /* Sets qdisc to be the default qdisc for enqueue */ ++ __u8 accel_mode; /* Dictates which data plane offloads the qdisc */ ++}; ++/* QCA NSS Clients Support - End */ + #endif +--- a/net/sched/sch_api.c ++++ b/net/sched/sch_api.c +@@ -314,6 +314,7 @@ struct Qdisc *qdisc_lookup(struct net_de + out: + return q; + } ++EXPORT_SYMBOL(qdisc_lookup); + + struct Qdisc *qdisc_lookup_rcu(struct net_device *dev, u32 handle) + { +@@ -2389,4 +2390,26 @@ static int __init pktsched_init(void) + return 0; + } + ++/* QCA NSS Qdisc Support - Start */ ++bool tcf_destroy(struct tcf_proto *tp, bool force) ++{ ++ tp->ops->destroy(tp, force, NULL); ++ module_put(tp->ops->owner); ++ kfree_rcu(tp, rcu); ++ ++ return true; ++} ++ ++void tcf_destroy_chain(struct tcf_proto __rcu **fl) ++{ ++ struct tcf_proto *tp; ++ ++ while ((tp = rtnl_dereference(*fl)) != NULL) { ++ RCU_INIT_POINTER(*fl, tp->next); ++ tcf_destroy(tp, true); ++ } ++} ++EXPORT_SYMBOL(tcf_destroy_chain); ++/* QCA NSS Qdisc Support - End */ ++ + subsys_initcall(pktsched_init); +--- a/net/sched/sch_generic.c ++++ b/net/sched/sch_generic.c +@@ -1077,6 +1077,7 @@ void qdisc_destroy(struct Qdisc *qdisc) + + __qdisc_destroy(qdisc); + } ++EXPORT_SYMBOL(qdisc_destroy); + + void qdisc_put(struct Qdisc *qdisc) + { +--- a/include/net/sch_generic.h ++++ b/include/net/sch_generic.h +@@ -94,6 +94,7 @@ struct Qdisc { + #define TCQ_F_INVISIBLE 0x80 /* invisible by default in dump */ + #define TCQ_F_NOLOCK 0x100 /* qdisc does not require locking */ + #define TCQ_F_OFFLOADED 0x200 /* qdisc is offloaded to HW */ ++#define TCQ_F_NSS 0x1000 /* NSS qdisc flag. */ + u32 limit; + const struct Qdisc_ops *ops; + struct qdisc_size_table __rcu *stab; +@@ -751,6 +752,40 @@ static inline bool skb_skip_tc_classify( + return false; + } + ++/* ++ * Set skb classify bit field. ++ */ ++static inline void skb_set_tc_classify_offload(struct sk_buff *skb) ++{ ++#ifdef CONFIG_NET_CLS_ACT ++ skb->tc_skip_classify_offload = 1; ++#endif ++} ++ ++/* ++ * Clear skb classify bit field. ++ */ ++static inline void skb_clear_tc_classify_offload(struct sk_buff *skb) ++{ ++#ifdef CONFIG_NET_CLS_ACT ++ skb->tc_skip_classify_offload = 0; ++#endif ++} ++ ++/* ++ * Skip skb processing if sent from ifb dev. ++ */ ++static inline bool skb_skip_tc_classify_offload(struct sk_buff *skb) ++{ ++#ifdef CONFIG_NET_CLS_ACT ++ if (skb->tc_skip_classify_offload) { ++ skb_clear_tc_classify_offload(skb); ++ return true; ++ } ++#endif ++ return false; ++} ++ + /* Reset all TX qdiscs greater than index of a device. */ + static inline void qdisc_reset_all_tx_gt(struct net_device *dev, unsigned int i) + { +@@ -1323,4 +1358,9 @@ static inline void qdisc_synchronize(con + msleep(1); + } + ++/* QCA NSS Qdisc Support - Start */ ++void qdisc_destroy(struct Qdisc *qdisc); ++void tcf_destroy_chain(struct tcf_proto __rcu **fl); ++/* QCA NSS Qdisc Support - End */ ++ + #endif diff --git a/target/linux/qualcommax/patches-6.6/2603-2-qca-nss-clients-add-l2tp-support.patch b/target/linux/qualcommax/patches-6.6/2603-2-qca-nss-clients-add-l2tp-support.patch new file mode 100644 index 00000000000..7fa9184df25 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2603-2-qca-nss-clients-add-l2tp-support.patch @@ -0,0 +1,46 @@ +--- a/net/l2tp/l2tp_core.c ++++ b/net/l2tp/l2tp_core.c +@@ -398,6 +398,31 @@ err_tlock: + } + EXPORT_SYMBOL_GPL(l2tp_session_register); + ++void l2tp_stats_update(struct l2tp_tunnel *tunnel, ++ struct l2tp_session *session, ++ struct l2tp_stats *stats) ++{ ++ atomic_long_add(atomic_long_read(&stats->rx_packets), ++ &tunnel->stats.rx_packets); ++ atomic_long_add(atomic_long_read(&stats->rx_bytes), ++ &tunnel->stats.rx_bytes); ++ atomic_long_add(atomic_long_read(&stats->tx_packets), ++ &tunnel->stats.tx_packets); ++ atomic_long_add(atomic_long_read(&stats->tx_bytes), ++ &tunnel->stats.tx_bytes); ++ ++ atomic_long_add(atomic_long_read(&stats->rx_packets), ++ &session->stats.rx_packets); ++ atomic_long_add(atomic_long_read(&stats->rx_bytes), ++ &session->stats.rx_bytes); ++ atomic_long_add(atomic_long_read(&stats->tx_packets), ++ &session->stats.tx_packets); ++ atomic_long_add(atomic_long_read(&stats->tx_bytes), ++ &session->stats.tx_bytes); ++} ++EXPORT_SYMBOL_GPL(l2tp_stats_update); ++ ++ + /***************************************************************************** + * Receive data handling + *****************************************************************************/ +--- a/net/l2tp/l2tp_core.h ++++ b/net/l2tp/l2tp_core.h +@@ -232,6 +232,9 @@ struct l2tp_session *l2tp_session_get_nt + struct l2tp_session *l2tp_session_get_by_ifname(const struct net *net, + const char *ifname); + ++void l2tp_stats_update(struct l2tp_tunnel *tunnel, struct l2tp_session *session, ++ struct l2tp_stats *stats); ++ + /* Tunnel and session lifetime management. + * Creation of a new instance is a two-step process: create, then register. + * Destruction is triggered using the *_delete functions, and completes asynchronously. diff --git a/target/linux/qualcommax/patches-6.6/2603-3-qca-nss-clients-add-PPTP-support.patch b/target/linux/qualcommax/patches-6.6/2603-3-qca-nss-clients-add-PPTP-support.patch new file mode 100644 index 00000000000..06072e2a70a --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2603-3-qca-nss-clients-add-PPTP-support.patch @@ -0,0 +1,469 @@ +--- a/include/linux/if_pppox.h ++++ b/include/linux/if_pppox.h +@@ -36,6 +36,7 @@ struct pptp_opt { + u32 ack_sent, ack_recv; + u32 seq_sent, seq_recv; + int ppp_flags; ++ bool pptp_offload_mode; + }; + #include + +@@ -100,8 +101,40 @@ struct pppoe_channel_ops { + int (*get_addressing)(struct ppp_channel *, struct pppoe_opt *); + }; + ++/* PPTP client callback */ ++typedef int (*pptp_gre_seq_offload_callback_t)(struct sk_buff *skb, ++ struct net_device *pptp_dev); ++ + /* Return PPPoE channel specific addressing information */ + extern int pppoe_channel_addressing_get(struct ppp_channel *chan, + struct pppoe_opt *addressing); + ++/* Lookup PPTP session info and return PPTP session using sip, dip and local call id */ ++extern int pptp_session_find_by_src_callid(struct pptp_opt *opt, __be16 src_call_id, ++ __be32 daddr, __be32 saddr); ++ ++/* Lookup PPTP session info and return PPTP session using dip and peer call id */ ++extern int pptp_session_find(struct pptp_opt *opt, __be16 peer_call_id, ++ __be32 peer_ip_addr); ++ ++/* Return PPTP session information given the channel */ ++extern void pptp_channel_addressing_get(struct pptp_opt *opt, ++ struct ppp_channel *chan); ++ ++/* Enable the PPTP session offload flag */ ++extern int pptp_session_enable_offload_mode(__be16 peer_call_id, ++ __be32 peer_ip_addr); ++ ++/* Disable the PPTP session offload flag */ ++extern int pptp_session_disable_offload_mode(__be16 peer_call_id, ++ __be32 peer_ip_addr); ++ ++/* Register the PPTP GRE packets sequence number offload callback */ ++extern int ++pptp_register_gre_seq_offload_callback(pptp_gre_seq_offload_callback_t ++ pptp_client_cb); ++ ++/* Unregister the PPTP GRE packets sequence number offload callback */ ++extern void pptp_unregister_gre_seq_offload_callback(void); ++ + #endif /* !(__LINUX_IF_PPPOX_H) */ +--- a/drivers/net/ppp/ppp_generic.c ++++ b/drivers/net/ppp/ppp_generic.c +@@ -2973,6 +2973,20 @@ char *ppp_dev_name(struct ppp_channel *c + return name; + } + ++/* Return the PPP net device index */ ++int ppp_dev_index(struct ppp_channel *chan) ++{ ++ struct channel *pch = chan->ppp; ++ int ifindex = 0; ++ ++ if (pch) { ++ read_lock_bh(&pch->upl); ++ if (pch->ppp && pch->ppp->dev) ++ ifindex = pch->ppp->dev->ifindex; ++ read_unlock_bh(&pch->upl); ++ } ++ return ifindex; ++} + + /* + * Disconnect a channel from the generic layer. +@@ -3681,6 +3695,28 @@ void ppp_update_stats(struct net_device + ppp_recv_unlock(ppp); + } + ++/* Returns true if Compression is enabled on PPP device ++ */ ++bool ppp_is_cp_enabled(struct net_device *dev) ++{ ++ struct ppp *ppp; ++ bool flag = false; ++ ++ if (!dev) ++ return false; ++ ++ if (dev->type != ARPHRD_PPP) ++ return false; ++ ++ ppp = netdev_priv(dev); ++ ppp_lock(ppp); ++ flag = !!(ppp->xstate & SC_COMP_RUN) || !!(ppp->rstate & SC_DECOMP_RUN); ++ ppp_unlock(ppp); ++ ++ return flag; ++} ++EXPORT_SYMBOL(ppp_is_cp_enabled); ++ + /* Returns >0 if the device is a multilink PPP netdevice, 0 if not or < 0 if + * the device is not PPP. + */ +@@ -3872,6 +3908,7 @@ EXPORT_SYMBOL(ppp_unregister_channel); + EXPORT_SYMBOL(ppp_channel_index); + EXPORT_SYMBOL(ppp_unit_number); + EXPORT_SYMBOL(ppp_dev_name); ++EXPORT_SYMBOL(ppp_dev_index); + EXPORT_SYMBOL(ppp_input); + EXPORT_SYMBOL(ppp_input_error); + EXPORT_SYMBOL(ppp_output_wakeup); +--- a/include/linux/ppp_channel.h ++++ b/include/linux/ppp_channel.h +@@ -84,6 +84,9 @@ extern void ppp_unregister_channel(struc + /* Get the channel number for a channel */ + extern int ppp_channel_index(struct ppp_channel *); + ++/* Get the device index associated with a channel, or 0, if none */ ++extern int ppp_dev_index(struct ppp_channel *); ++ + /* Get the unit number associated with a channel, or -1 if none */ + extern int ppp_unit_number(struct ppp_channel *); + +@@ -116,6 +119,7 @@ extern int ppp_hold_channels(struct net_ + /* Test if ppp xmit lock is locked */ + extern bool ppp_is_xmit_locked(struct net_device *dev); + ++bool ppp_is_cp_enabled(struct net_device *dev); + /* Test if the ppp device is a multi-link ppp device */ + extern int ppp_is_multilink(struct net_device *dev); + +--- a/drivers/net/ppp/pptp.c ++++ b/drivers/net/ppp/pptp.c +@@ -50,6 +50,8 @@ static struct proto pptp_sk_proto __read + static const struct ppp_channel_ops pptp_chan_ops; + static const struct proto_ops pptp_ops; + ++static pptp_gre_seq_offload_callback_t __rcu pptp_gre_offload_xmit_cb; ++ + static struct pppox_sock *lookup_chan(u16 call_id, __be32 s_addr) + { + struct pppox_sock *sock; +@@ -91,6 +93,79 @@ static int lookup_chan_dst(u16 call_id, + return i < MAX_CALLID; + } + ++/* Search a pptp session based on local call id, local and remote ip address */ ++static int lookup_session_src(struct pptp_opt *opt, u16 call_id, __be32 daddr, __be32 saddr) ++{ ++ struct pppox_sock *sock; ++ int i = 1; ++ ++ rcu_read_lock(); ++ for_each_set_bit_from(i, callid_bitmap, MAX_CALLID) { ++ sock = rcu_dereference(callid_sock[i]); ++ if (!sock) ++ continue; ++ ++ if (sock->proto.pptp.src_addr.call_id == call_id && ++ sock->proto.pptp.dst_addr.sin_addr.s_addr == daddr && ++ sock->proto.pptp.src_addr.sin_addr.s_addr == saddr) { ++ sock_hold(sk_pppox(sock)); ++ memcpy(opt, &sock->proto.pptp, sizeof(struct pptp_opt)); ++ sock_put(sk_pppox(sock)); ++ rcu_read_unlock(); ++ return 0; ++ } ++ } ++ rcu_read_unlock(); ++ return -EINVAL; ++} ++ ++/* Search a pptp session based on peer call id and peer ip address */ ++static int lookup_session_dst(struct pptp_opt *opt, u16 call_id, __be32 d_addr) ++{ ++ struct pppox_sock *sock; ++ int i = 1; ++ ++ rcu_read_lock(); ++ for_each_set_bit_from(i, callid_bitmap, MAX_CALLID) { ++ sock = rcu_dereference(callid_sock[i]); ++ if (!sock) ++ continue; ++ ++ if (sock->proto.pptp.dst_addr.call_id == call_id && ++ sock->proto.pptp.dst_addr.sin_addr.s_addr == d_addr) { ++ sock_hold(sk_pppox(sock)); ++ memcpy(opt, &sock->proto.pptp, sizeof(struct pptp_opt)); ++ sock_put(sk_pppox(sock)); ++ rcu_read_unlock(); ++ return 0; ++ } ++ } ++ rcu_read_unlock(); ++ return -EINVAL; ++} ++ ++/* If offload mode set then this function sends all packets to ++ * offload module instead of network stack ++ */ ++static int pptp_client_skb_xmit(struct sk_buff *skb, ++ struct net_device *pptp_dev) ++{ ++ pptp_gre_seq_offload_callback_t pptp_gre_offload_cb_f; ++ int ret; ++ ++ rcu_read_lock(); ++ pptp_gre_offload_cb_f = rcu_dereference(pptp_gre_offload_xmit_cb); ++ ++ if (!pptp_gre_offload_cb_f) { ++ rcu_read_unlock(); ++ return -1; ++ } ++ ++ ret = pptp_gre_offload_cb_f(skb, pptp_dev); ++ rcu_read_unlock(); ++ return ret; ++} ++ + static int add_chan(struct pppox_sock *sock, + struct pptp_addr *sa) + { +@@ -163,8 +238,11 @@ static int pptp_xmit(struct ppp_channel + + struct rtable *rt; + struct net_device *tdev; ++ struct net_device *pptp_dev; + struct iphdr *iph; + int max_headroom; ++ int pptp_ifindex; ++ int ret; + + if (sk_pppox(po)->sk_state & PPPOX_DEAD) + goto tx_error; +@@ -258,7 +336,32 @@ static int pptp_xmit(struct ppp_channel + ip_select_ident(net, skb, NULL); + ip_send_check(iph); + +- ip_local_out(net, skb->sk, skb); ++ pptp_ifindex = ppp_dev_index(chan); ++ ++ /* set incoming interface as the ppp interface */ ++ if (skb->skb_iif) ++ skb->skb_iif = pptp_ifindex; ++ ++ /* If the PPTP GRE seq number offload module is not enabled yet ++ * then sends all PPTP GRE packets through linux network stack ++ */ ++ if (!opt->pptp_offload_mode) { ++ ip_local_out(net, skb->sk, skb); ++ return 1; ++ } ++ ++ pptp_dev = dev_get_by_index(&init_net, pptp_ifindex); ++ if (!pptp_dev) ++ goto tx_error; ++ ++ /* If PPTP offload module is enabled then forward all PPTP GRE ++ * packets to PPTP GRE offload module ++ */ ++ ret = pptp_client_skb_xmit(skb, pptp_dev); ++ dev_put(pptp_dev); ++ if (ret < 0) ++ goto tx_error; ++ + return 1; + + tx_error: +@@ -314,6 +417,13 @@ static int pptp_rcv_core(struct sock *sk + goto drop; + + payload = skb->data + headersize; ++ ++ /* If offload is enabled, we expect the offload module ++ * to handle PPTP GRE sequence number checks ++ */ ++ if (opt->pptp_offload_mode) ++ goto allow_packet; ++ + /* check for expected sequence number */ + if (seq < opt->seq_recv + 1 || WRAPPED(opt->seq_recv, seq)) { + if ((payload[0] == PPP_ALLSTATIONS) && (payload[1] == PPP_UI) && +@@ -371,6 +481,7 @@ static int pptp_rcv(struct sk_buff *skb) + if (po) { + skb_dst_drop(skb); + nf_reset_ct(skb); ++ skb->skb_iif = ppp_dev_index(&po->chan); + return sk_receive_skb(sk_pppox(po), skb, 0); + } + drop: +@@ -473,7 +584,7 @@ static int pptp_connect(struct socket *s + + opt->dst_addr = sp->sa_addr.pptp; + sk->sk_state |= PPPOX_CONNECTED; +- ++ opt->pptp_offload_mode = false; + end: + release_sock(sk); + return error; +@@ -603,9 +714,169 @@ static int pptp_ppp_ioctl(struct ppp_cha + return err; + } + ++/* pptp_channel_addressing_get() ++ * Return PPTP channel specific addressing information. ++ */ ++void pptp_channel_addressing_get(struct pptp_opt *opt, struct ppp_channel *chan) ++{ ++ struct sock *sk; ++ struct pppox_sock *po; ++ ++ if (!opt) ++ return; ++ ++ sk = (struct sock *)chan->private; ++ if (!sk) ++ return; ++ ++ sock_hold(sk); ++ ++ /* This is very unlikely, but check the socket is connected state */ ++ if (unlikely(sock_flag(sk, SOCK_DEAD) || ++ !(sk->sk_state & PPPOX_CONNECTED))) { ++ sock_put(sk); ++ return; ++ } ++ ++ po = pppox_sk(sk); ++ memcpy(opt, &po->proto.pptp, sizeof(struct pptp_opt)); ++ sock_put(sk); ++} ++EXPORT_SYMBOL(pptp_channel_addressing_get); ++ ++/* pptp_session_find() ++ * Search and return a PPTP session info based on peer callid and IP ++ * address. The function accepts the parameters in network byte order. ++ */ ++int pptp_session_find(struct pptp_opt *opt, __be16 peer_call_id, ++ __be32 peer_ip_addr) ++{ ++ if (!opt) ++ return -EINVAL; ++ ++ return lookup_session_dst(opt, ntohs(peer_call_id), peer_ip_addr); ++} ++EXPORT_SYMBOL(pptp_session_find); ++ ++/* pptp_session_find_by_src_callid() ++ * Search and return a PPTP session info based on src callid and IP ++ * address. The function accepts the parameters in network byte order. ++ */ ++int pptp_session_find_by_src_callid(struct pptp_opt *opt, __be16 src_call_id, ++ __be32 daddr, __be32 saddr) ++{ ++ if (!opt) ++ return -EINVAL; ++ ++ return lookup_session_src(opt, ntohs(src_call_id), daddr, saddr); ++} ++EXPORT_SYMBOL(pptp_session_find_by_src_callid); ++ ++ /* Function to change the offload mode true/false for a PPTP session */ ++static int pptp_set_offload_mode(bool accel_mode, ++ __be16 peer_call_id, __be32 peer_ip_addr) ++{ ++ struct pppox_sock *sock; ++ int i = 1; ++ ++ rcu_read_lock(); ++ for_each_set_bit_from(i, callid_bitmap, MAX_CALLID) { ++ sock = rcu_dereference(callid_sock[i]); ++ if (!sock) ++ continue; ++ ++ if (sock->proto.pptp.dst_addr.call_id == peer_call_id && ++ sock->proto.pptp.dst_addr.sin_addr.s_addr == peer_ip_addr) { ++ sock_hold(sk_pppox(sock)); ++ sock->proto.pptp.pptp_offload_mode = accel_mode; ++ sock_put(sk_pppox(sock)); ++ rcu_read_unlock(); ++ return 0; ++ } ++ } ++ rcu_read_unlock(); ++ return -EINVAL; ++} ++ ++/* Enable the PPTP session offload flag */ ++int pptp_session_enable_offload_mode(__be16 peer_call_id, __be32 peer_ip_addr) ++{ ++ return pptp_set_offload_mode(true, peer_call_id, peer_ip_addr); ++} ++EXPORT_SYMBOL(pptp_session_enable_offload_mode); ++ ++/* Disable the PPTP session offload flag */ ++int pptp_session_disable_offload_mode(__be16 peer_call_id, __be32 peer_ip_addr) ++{ ++ return pptp_set_offload_mode(false, peer_call_id, peer_ip_addr); ++} ++EXPORT_SYMBOL(pptp_session_disable_offload_mode); ++ ++/* Register the offload callback function on behalf of the module which ++ * will own the sequence and acknowledgment number updates for all ++ * PPTP GRE packets. All PPTP GRE packets are then transmitted to this ++ * module after encapsulation in order to ensure the correct seq/ack ++ * fields are set in the packets before transmission. This is required ++ * when PPTP flows are offloaded to acceleration engines, in-order to ++ * ensure consistency in sequence and ack numbers between PPTP control ++ * (PPP LCP) and data packets ++ */ ++int pptp_register_gre_seq_offload_callback(pptp_gre_seq_offload_callback_t ++ pptp_gre_offload_cb) ++{ ++ pptp_gre_seq_offload_callback_t pptp_gre_offload_cb_f; ++ ++ rcu_read_lock(); ++ pptp_gre_offload_cb_f = rcu_dereference(pptp_gre_offload_xmit_cb); ++ ++ if (pptp_gre_offload_cb_f) { ++ rcu_read_unlock(); ++ return -1; ++ } ++ ++ rcu_assign_pointer(pptp_gre_offload_xmit_cb, pptp_gre_offload_cb); ++ rcu_read_unlock(); ++ return 0; ++} ++EXPORT_SYMBOL(pptp_register_gre_seq_offload_callback); ++ ++/* Unregister the PPTP GRE packets sequence number offload callback */ ++void pptp_unregister_gre_seq_offload_callback(void) ++{ ++ rcu_assign_pointer(pptp_gre_offload_xmit_cb, NULL); ++} ++EXPORT_SYMBOL(pptp_unregister_gre_seq_offload_callback); ++ ++/* pptp_hold_chan() */ ++static void pptp_hold_chan(struct ppp_channel *chan) ++{ ++ struct sock *sk = (struct sock *)chan->private; ++ ++ sock_hold(sk); ++} ++ ++/* pptp_release_chan() */ ++static void pptp_release_chan(struct ppp_channel *chan) ++{ ++ struct sock *sk = (struct sock *)chan->private; ++ ++ sock_put(sk); ++} ++ ++/* pptp_get_channel_protocol() ++ * Return the protocol type of the PPTP over PPP protocol ++ */ ++static int pptp_get_channel_protocol(struct ppp_channel *chan) ++{ ++ return PX_PROTO_PPTP; ++} ++ + static const struct ppp_channel_ops pptp_chan_ops = { + .start_xmit = pptp_xmit, + .ioctl = pptp_ppp_ioctl, ++ .get_channel_protocol = pptp_get_channel_protocol, ++ .hold = pptp_hold_chan, ++ .release = pptp_release_chan, + }; + + static struct proto pptp_sk_proto __read_mostly = { diff --git a/target/linux/qualcommax/patches-6.6/2603-4-qca-nss-clients-add-iptunnel-support.patch b/target/linux/qualcommax/patches-6.6/2603-4-qca-nss-clients-add-iptunnel-support.patch new file mode 100644 index 00000000000..c9fc3368648 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2603-4-qca-nss-clients-add-iptunnel-support.patch @@ -0,0 +1,77 @@ +--- a/include/net/ip6_tunnel.h ++++ b/include/net/ip6_tunnel.h +@@ -36,6 +36,7 @@ struct __ip6_tnl_parm { + __u8 proto; /* tunnel protocol */ + __u8 encap_limit; /* encapsulation limit for tunnel */ + __u8 hop_limit; /* hop limit for tunnel */ ++ __u8 draft03; /* FMR using draft03 of map-e - QCA NSS Clients Support */ + bool collect_md; + __be32 flowinfo; /* traffic class and flowlabel for tunnel */ + __u32 flags; /* tunnel flags */ +--- a/include/net/ip_tunnels.h ++++ b/include/net/ip_tunnels.h +@@ -558,4 +558,9 @@ static inline void ip_tunnel_info_opts_s + + #endif /* CONFIG_INET */ + ++/* QCA NSS Clients Support - Start */ ++void ipip6_update_offload_stats(struct net_device *dev, void *ptr); ++void ip6_update_offload_stats(struct net_device *dev, void *ptr); ++/* QCA NSS Clients Support - End */ ++ + #endif /* __NET_IP_TUNNELS_H */ +--- a/net/ipv6/ip6_tunnel.c ++++ b/net/ipv6/ip6_tunnel.c +@@ -2411,6 +2411,26 @@ nla_put_failure: + return -EMSGSIZE; + } + ++/* QCA NSS Client Support - Start */ ++/* ++ * Update offload stats ++ */ ++void ip6_update_offload_stats(struct net_device *dev, void *ptr) ++{ ++ struct pcpu_sw_netstats *tstats = per_cpu_ptr(dev->tstats, 0); ++ const struct pcpu_sw_netstats *offload_stats = ++ (struct pcpu_sw_netstats *)ptr; ++ ++ u64_stats_update_begin(&tstats->syncp); ++ u64_stats_add(&tstats->tx_packets, u64_stats_read(&offload_stats->tx_packets)); ++ u64_stats_add(&tstats->tx_bytes, u64_stats_read(&offload_stats->tx_bytes)); ++ u64_stats_add(&tstats->rx_packets, u64_stats_read(&offload_stats->rx_packets)); ++ u64_stats_add(&tstats->rx_bytes, u64_stats_read(&offload_stats->rx_bytes)); ++ u64_stats_update_end(&tstats->syncp); ++} ++EXPORT_SYMBOL(ip6_update_offload_stats); ++/* QCA NSS Client Support - End */ ++ + struct net *ip6_tnl_get_link_net(const struct net_device *dev) + { + struct ip6_tnl *tunnel = netdev_priv(dev); +--- a/net/ipv6/sit.c ++++ b/net/ipv6/sit.c +@@ -1733,6 +1733,23 @@ nla_put_failure: + return -EMSGSIZE; + } + ++/* QCA NSS Clients Support - Start */ ++void ipip6_update_offload_stats(struct net_device *dev, void *ptr) ++{ ++ struct pcpu_sw_netstats *tstats = per_cpu_ptr(dev->tstats, 0); ++ const struct pcpu_sw_netstats *offload_stats = ++ (struct pcpu_sw_netstats *)ptr; ++ ++ u64_stats_update_begin(&tstats->syncp); ++ u64_stats_add(&tstats->tx_packets, u64_stats_read(&offload_stats->tx_packets)); ++ u64_stats_add(&tstats->tx_bytes, u64_stats_read(&offload_stats->tx_bytes)); ++ u64_stats_add(&tstats->rx_packets, u64_stats_read(&offload_stats->rx_packets)); ++ u64_stats_add(&tstats->rx_bytes, u64_stats_read(&offload_stats->rx_bytes)); ++ u64_stats_update_end(&tstats->syncp); ++} ++EXPORT_SYMBOL(ipip6_update_offload_stats); ++/* QCA NSS Clients Support - End */ ++ + static const struct nla_policy ipip6_policy[IFLA_IPTUN_MAX + 1] = { + [IFLA_IPTUN_LINK] = { .type = NLA_U32 }, + [IFLA_IPTUN_LOCAL] = { .type = NLA_U32 }, diff --git a/target/linux/qualcommax/patches-6.6/2603-5-qca-nss-clients-add-vxlan-support.patch b/target/linux/qualcommax/patches-6.6/2603-5-qca-nss-clients-add-vxlan-support.patch new file mode 100644 index 00000000000..fc475f3f8d2 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2603-5-qca-nss-clients-add-vxlan-support.patch @@ -0,0 +1,107 @@ +--- a/drivers/net/vxlan/vxlan_core.c ++++ b/drivers/net/vxlan/vxlan_core.c +@@ -29,6 +29,20 @@ + #include + #include + ++ATOMIC_NOTIFIER_HEAD(vxlan_fdb_notifier_list); ++ ++void vxlan_fdb_register_notify(struct notifier_block *nb) ++{ ++ atomic_notifier_chain_register(&vxlan_fdb_notifier_list, nb); ++} ++EXPORT_SYMBOL(vxlan_fdb_register_notify); ++ ++void vxlan_fdb_unregister_notify(struct notifier_block *nb) ++{ ++ atomic_notifier_chain_unregister(&vxlan_fdb_notifier_list, nb); ++} ++EXPORT_SYMBOL(vxlan_fdb_unregister_notify); ++ + #if IS_ENABLED(CONFIG_IPV6) + #include + #include +@@ -260,6 +274,7 @@ static void __vxlan_fdb_notify(struct vx + { + struct net *net = dev_net(vxlan->dev); + struct sk_buff *skb; ++ struct vxlan_fdb_event vfe; + int err = -ENOBUFS; + + skb = nlmsg_new(vxlan_nlmsg_size(), GFP_ATOMIC); +@@ -275,7 +290,11 @@ static void __vxlan_fdb_notify(struct vx + } + + rtnl_notify(skb, net, 0, RTNLGRP_NEIGH, NULL, GFP_ATOMIC); +- return; ++ vfe.dev = vxlan->dev; ++ vfe.rdst = rd; ++ ether_addr_copy(vfe.eth_addr, fdb->eth_addr); ++ atomic_notifier_call_chain(&vxlan_fdb_notifier_list, type, (void *)&vfe); ++ return; + errout: + if (err < 0) + rtnl_set_sk_err(net, RTNLGRP_NEIGH, err); +@@ -441,6 +460,18 @@ static struct vxlan_fdb *vxlan_find_mac( + return f; + } + ++/* Find and update age of fdb entry corresponding to MAC. */ ++void vxlan_fdb_update_mac(struct vxlan_dev *vxlan, const u8 *mac, uint32_t vni) ++{ ++ u32 hash_index; ++ ++ hash_index = fdb_head_index(vxlan, mac, vni); ++ spin_lock_bh(&vxlan->hash_lock[hash_index]); ++ vxlan_find_mac(vxlan, mac, vni); ++ spin_unlock_bh(&vxlan->hash_lock[hash_index]); ++} ++EXPORT_SYMBOL(vxlan_fdb_update_mac); ++ + /* caller should hold vxlan->hash_lock */ + static struct vxlan_rdst *vxlan_fdb_find_rdst(struct vxlan_fdb *f, + union vxlan_addr *ip, __be16 port, +@@ -2581,6 +2612,9 @@ void vxlan_xmit_one(struct sk_buff *skb, + goto out_unlock; + } + ++ /* Reset the skb_iif to Tunnels interface index */ ++ skb->skb_iif = dev->ifindex; ++ + tos = ip_tunnel_ecn_encap(tos, old_iph, skb); + ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); + err = vxlan_build_skb(skb, ndst, sizeof(struct iphdr), +@@ -2652,7 +2686,10 @@ void vxlan_xmit_one(struct sk_buff *skb, + if (err < 0) + goto tx_error; + +- udp_tunnel6_xmit_skb(ndst, sock6->sock->sk, skb, dev, ++ /* Reset the skb_iif to Tunnels interface index */ ++ skb->skb_iif = dev->ifindex; ++ ++ udp_tunnel6_xmit_skb(ndst, sock6->sock->sk, skb, dev, + &local_ip.sin6.sin6_addr, + &dst->sin6.sin6_addr, tos, ttl, + label, src_port, dst_port, !udp_sum); +--- a/include/net/vxlan.h ++++ b/include/net/vxlan.h +@@ -352,6 +352,19 @@ struct vxlan_dev { + VXLAN_F_VNIFILTER | \ + VXLAN_F_LOCALBYPASS) + ++/* ++ * Application data for fdb notifier event ++ */ ++struct vxlan_fdb_event { ++ struct net_device *dev; ++ struct vxlan_rdst *rdst; ++ u8 eth_addr[ETH_ALEN]; ++}; ++ ++extern void vxlan_fdb_register_notify(struct notifier_block *nb); ++extern void vxlan_fdb_unregister_notify(struct notifier_block *nb); ++extern void vxlan_fdb_update_mac(struct vxlan_dev *vxlan, const u8 *mac, uint32_t vni); ++ + struct net_device *vxlan_dev_create(struct net *net, const char *name, + u8 name_assign_type, struct vxlan_config *conf); + diff --git a/target/linux/qualcommax/patches-6.6/2603-6-qca-nss-clients-add-l2tp-offloading-support.patch b/target/linux/qualcommax/patches-6.6/2603-6-qca-nss-clients-add-l2tp-offloading-support.patch new file mode 100644 index 00000000000..4032eb3c227 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2603-6-qca-nss-clients-add-l2tp-offloading-support.patch @@ -0,0 +1,368 @@ +--- a/include/linux/ppp_channel.h ++++ b/include/linux/ppp_channel.h +@@ -61,6 +61,51 @@ struct ppp_channel { + }; + + #ifdef __KERNEL__ ++/* Call this to obtain the underlying protocol of the PPP channel, ++ * e.g. PX_PROTO_OE ++ */ ++extern int ppp_channel_get_protocol(struct ppp_channel *); ++ ++/* Call this to hold a channel */ ++extern bool ppp_channel_hold(struct ppp_channel *); ++ ++/* Call this to release a hold you have upon a channel */ ++extern void ppp_channel_release(struct ppp_channel *); ++ ++/* Release hold on PPP channels */ ++extern void ppp_release_channels(struct ppp_channel *channels[], ++ unsigned int chan_sz); ++ ++/* Test if ppp xmit lock is locked */ ++extern bool ppp_is_xmit_locked(struct net_device *dev); ++ ++/* Call this get protocol version */ ++extern int ppp_channel_get_proto_version(struct ppp_channel *); ++ ++/* Get the device index associated with a channel, or 0, if none */ ++extern int ppp_dev_index(struct ppp_channel *); ++ ++/* Hold PPP channels for the PPP device */ ++extern int ppp_hold_channels(struct net_device *dev, ++ struct ppp_channel *channels[], ++ unsigned int chan_sz); ++extern int __ppp_hold_channels(struct net_device *dev, ++ struct ppp_channel *channels[], ++ unsigned int chan_sz); ++ ++/* Test if the ppp device is a multi-link ppp device */ ++extern int ppp_is_multilink(struct net_device *dev); ++extern int __ppp_is_multilink(struct net_device *dev); ++ ++/* Update statistics of the PPP net_device by incrementing related ++ * statistics field value with corresponding parameter ++ */ ++extern void ppp_update_stats(struct net_device *dev, unsigned long rx_packets, ++ unsigned long rx_bytes, unsigned long tx_packets, ++ unsigned long tx_bytes, unsigned long rx_errors, ++ unsigned long tx_errors, unsigned long rx_dropped, ++ unsigned long tx_dropped); ++ + /* Called by the channel when it can send some more data. */ + extern void ppp_output_wakeup(struct ppp_channel *); + +@@ -148,5 +193,17 @@ extern void ppp_update_stats(struct net_ + * that ppp_unregister_channel returns. + */ + ++/* QCA NSS Clients Support - Start */ ++/* PPP channel connection event types */ ++#define PPP_CHANNEL_DISCONNECT 0 ++#define PPP_CHANNEL_CONNECT 1 ++ ++/* Register the PPP channel connect notifier */ ++extern void ppp_channel_connection_register_notify(struct notifier_block *nb); ++ ++/* Unregister the PPP channel connect notifier */ ++extern void ppp_channel_connection_unregister_notify(struct notifier_block *nb); ++/* QCA NSS Clients Support - End */ ++ + #endif /* __KERNEL__ */ + #endif +--- a/include/linux/if_pppol2tp.h ++++ b/include/linux/if_pppol2tp.h +@@ -12,4 +12,30 @@ + #include + #include + ++/* QCA NSS ECM support - Start */ ++/* ++ * Holds L2TP channel info ++ */ ++struct pppol2tp_common_addr { ++ int tunnel_version; /* v2 or v3 */ ++ __u32 local_tunnel_id, remote_tunnel_id; /* tunnel id */ ++ __u32 local_session_id, remote_session_id; /* session id */ ++ struct sockaddr_in local_addr, remote_addr; /* ip address and port */ ++}; ++ ++/* ++ * L2TP channel operations ++ */ ++struct pppol2tp_channel_ops { ++ struct ppp_channel_ops ops; /* ppp channel ops */ ++}; ++ ++/* ++ * exported function which calls pppol2tp channel's get addressing ++ * function ++ */ ++extern int pppol2tp_channel_addressing_get(struct ppp_channel *, ++ struct pppol2tp_common_addr *); ++/* QCA NSS ECM support - End */ ++ + #endif +--- a/net/l2tp/l2tp_ppp.c ++++ b/net/l2tp/l2tp_ppp.c +@@ -123,9 +123,17 @@ struct pppol2tp_session { + }; + + static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb); +- +-static const struct ppp_channel_ops pppol2tp_chan_ops = { +- .start_xmit = pppol2tp_xmit, ++static int pppol2tp_get_channel_protocol(struct ppp_channel *); ++static int pppol2tp_get_channel_protocol_ver(struct ppp_channel *); ++static void pppol2tp_hold_chan(struct ppp_channel *); ++static void pppol2tp_release_chan(struct ppp_channel *); ++ ++static const struct pppol2tp_channel_ops pppol2tp_chan_ops = { ++ .ops.start_xmit = pppol2tp_xmit, ++ .ops.get_channel_protocol = pppol2tp_get_channel_protocol, ++ .ops.get_channel_protocol_ver = pppol2tp_get_channel_protocol_ver, ++ .ops.hold = pppol2tp_hold_chan, ++ .ops.release = pppol2tp_release_chan, + }; + + static const struct proto_ops pppol2tp_ops; +@@ -373,6 +381,13 @@ static int pppol2tp_xmit(struct ppp_chan + skb->data[0] = PPP_ALLSTATIONS; + skb->data[1] = PPP_UI; + ++ /* QCA NSS ECM support - start */ ++ /* set incoming interface as the ppp interface */ ++ if ((skb->protocol == htons(ETH_P_IP)) || ++ (skb->protocol == htons(ETH_P_IPV6))) ++ skb->skb_iif = ppp_dev_index(chan); ++ /* QCA NSS ECM support - End */ ++ + local_bh_disable(); + l2tp_xmit_skb(session, skb); + local_bh_enable(); +@@ -818,7 +833,7 @@ static int pppol2tp_connect(struct socke + po->chan.hdrlen = PPPOL2TP_L2TP_HDR_SIZE_NOSEQ; + + po->chan.private = sk; +- po->chan.ops = &pppol2tp_chan_ops; ++ po->chan.ops = (struct ppp_channel_ops *)&pppol2tp_chan_ops.ops; + po->chan.mtu = pppol2tp_tunnel_mtu(tunnel); + + error = ppp_register_net_channel(sock_net(sk), &po->chan); +@@ -1732,6 +1747,109 @@ static void __exit pppol2tp_exit(void) + unregister_pernet_device(&pppol2tp_net_ops); + } + ++/* QCA NSS ECM support - Start */ ++/* pppol2tp_hold_chan() */ ++static void pppol2tp_hold_chan(struct ppp_channel *chan) ++{ ++ struct sock *sk = (struct sock *)chan->private; ++ ++ sock_hold(sk); ++} ++ ++/* pppol2tp_release_chan() */ ++static void pppol2tp_release_chan(struct ppp_channel *chan) ++{ ++ struct sock *sk = (struct sock *)chan->private; ++ ++ sock_put(sk); ++} ++ ++/* pppol2tp_get_channel_protocol() ++ * Return the protocol type of the L2TP over PPP protocol ++ */ ++static int pppol2tp_get_channel_protocol(struct ppp_channel *chan) ++{ ++ return PX_PROTO_OL2TP; ++} ++ ++/* pppol2tp_get_channel_protocol_ver() ++ * Return the protocol version of the L2TP over PPP protocol ++ */ ++static int pppol2tp_get_channel_protocol_ver(struct ppp_channel *chan) ++{ ++ struct sock *sk; ++ struct l2tp_session *session; ++ struct l2tp_tunnel *tunnel; ++ int version = 0; ++ ++ if (chan && chan->private) ++ sk = (struct sock *)chan->private; ++ else ++ return -1; ++ ++ /* Get session and tunnel contexts from the socket */ ++ session = pppol2tp_sock_to_session(sk); ++ if (!session) ++ return -1; ++ ++ tunnel = session->tunnel; ++ if (!tunnel) { ++ sock_put(sk); ++ return -1; ++ } ++ ++ version = tunnel->version; ++ ++ sock_put(sk); ++ ++ return version; ++} ++ ++/* pppol2tp_get_addressing() */ ++static int pppol2tp_get_addressing(struct ppp_channel *chan, ++ struct pppol2tp_common_addr *addr) ++{ ++ struct sock *sk = (struct sock *)chan->private; ++ struct l2tp_session *session; ++ struct l2tp_tunnel *tunnel; ++ struct inet_sock *isk = NULL; ++ int err = -ENXIO; ++ ++ /* Get session and tunnel contexts from the socket */ ++ session = pppol2tp_sock_to_session(sk); ++ if (!session) ++ return err; ++ ++ tunnel = session->tunnel; ++ if (!tunnel) { ++ sock_put(sk); ++ return err; ++ } ++ isk = inet_sk(tunnel->sock); ++ ++ addr->local_tunnel_id = tunnel->tunnel_id; ++ addr->remote_tunnel_id = tunnel->peer_tunnel_id; ++ addr->local_session_id = session->session_id; ++ addr->remote_session_id = session->peer_session_id; ++ ++ addr->local_addr.sin_port = isk->inet_sport; ++ addr->remote_addr.sin_port = isk->inet_dport; ++ addr->local_addr.sin_addr.s_addr = isk->inet_saddr; ++ addr->remote_addr.sin_addr.s_addr = isk->inet_daddr; ++ ++ sock_put(sk); ++ return 0; ++} ++ ++/* pppol2tp_channel_addressing_get() */ ++int pppol2tp_channel_addressing_get(struct ppp_channel *chan, ++ struct pppol2tp_common_addr *addr) ++{ ++ return pppol2tp_get_addressing(chan, addr); ++} ++EXPORT_SYMBOL(pppol2tp_channel_addressing_get); ++/* QCA NSS ECM support - End */ ++ + module_init(pppol2tp_init); + module_exit(pppol2tp_exit); + +--- a/drivers/net/ppp/ppp_generic.c ++++ b/drivers/net/ppp/ppp_generic.c +@@ -3743,6 +3743,32 @@ int ppp_is_multilink(struct net_device * + } + EXPORT_SYMBOL(ppp_is_multilink); + ++/* __ppp_is_multilink() ++ * Returns >0 if the device is a multilink PPP netdevice, 0 if not or < 0 ++ * if the device is not PPP. Caller should acquire ppp_lock before calling ++ * this function ++ */ ++int __ppp_is_multilink(struct net_device *dev) ++{ ++ struct ppp *ppp; ++ unsigned int flags; ++ ++ if (!dev) ++ return -1; ++ ++ if (dev->type != ARPHRD_PPP) ++ return -1; ++ ++ ppp = netdev_priv(dev); ++ flags = ppp->flags; ++ ++ if (flags & SC_MULTILINK) ++ return 1; ++ ++ return 0; ++} ++EXPORT_SYMBOL(__ppp_is_multilink); ++ + /* ppp_channel_get_protocol() + * Call this to obtain the underlying protocol of the PPP channel, + * e.g. PX_PROTO_OE +@@ -3881,6 +3907,59 @@ int ppp_hold_channels(struct net_device + } + EXPORT_SYMBOL(ppp_hold_channels); + ++/* __ppp_hold_channels() ++ * Returns the PPP channels of the PPP device, storing each one into ++ * channels[]. ++ * ++ * channels[] has chan_sz elements. ++ * This function returns the number of channels stored, up to chan_sz. ++ * It will return < 0 if the device is not PPP. ++ * ++ * You MUST release the channels using ppp_release_channels(). ++ */ ++int __ppp_hold_channels(struct net_device *dev, struct ppp_channel *channels[], ++ unsigned int chan_sz) ++{ ++ struct ppp *ppp; ++ int c; ++ struct channel *pch; ++ ++ if (!dev) ++ return -1; ++ ++ if (dev->type != ARPHRD_PPP) ++ return -1; ++ ++ ppp = netdev_priv(dev); ++ ++ c = 0; ++ list_for_each_entry(pch, &ppp->channels, clist) { ++ struct ppp_channel *chan; ++ ++ if (!pch->chan) { ++ /* Channel is going / gone away */ ++ continue; ++ } ++ ++ if (c == chan_sz) { ++ /* No space to record channel */ ++ return c; ++ } ++ ++ /* Hold the channel, if supported */ ++ chan = pch->chan; ++ if (!chan->ops->hold) ++ continue; ++ ++ chan->ops->hold(chan); ++ ++ /* Record the channel */ ++ channels[c++] = chan; ++ } ++ return c; ++} ++EXPORT_SYMBOL(__ppp_hold_channels); ++ + /* ppp_release_channels() + * Releases channels + */ +--- a/net/l2tp/l2tp_core.h ++++ b/net/l2tp/l2tp_core.h +@@ -235,6 +235,9 @@ struct l2tp_session *l2tp_session_get_by + void l2tp_stats_update(struct l2tp_tunnel *tunnel, struct l2tp_session *session, + struct l2tp_stats *stats); + ++void l2tp_stats_update(struct l2tp_tunnel *tunnel, struct l2tp_session *session, ++ struct l2tp_stats *stats); ++ + /* Tunnel and session lifetime management. + * Creation of a new instance is a two-step process: create, then register. + * Destruction is triggered using the *_delete functions, and completes asynchronously. diff --git a/target/linux/qualcommax/patches-6.6/2603-7-qca-nss-clients-iptunnel-lock-this-cpu.patch b/target/linux/qualcommax/patches-6.6/2603-7-qca-nss-clients-iptunnel-lock-this-cpu.patch new file mode 100644 index 00000000000..e4ed49ea4c2 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2603-7-qca-nss-clients-iptunnel-lock-this-cpu.patch @@ -0,0 +1,22 @@ +--- a/net/ipv6/ip6_tunnel.c ++++ b/net/ipv6/ip6_tunnel.c +@@ -2417,7 +2417,7 @@ nla_put_failure: + */ + void ip6_update_offload_stats(struct net_device *dev, void *ptr) + { +- struct pcpu_sw_netstats *tstats = per_cpu_ptr(dev->tstats, 0); ++ struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats); + const struct pcpu_sw_netstats *offload_stats = + (struct pcpu_sw_netstats *)ptr; + +--- a/net/ipv6/sit.c ++++ b/net/ipv6/sit.c +@@ -1736,7 +1736,7 @@ nla_put_failure: + /* QCA NSS Clients Support - Start */ + void ipip6_update_offload_stats(struct net_device *dev, void *ptr) + { +- struct pcpu_sw_netstats *tstats = per_cpu_ptr(dev->tstats, 0); ++ struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats); + const struct pcpu_sw_netstats *offload_stats = + (struct pcpu_sw_netstats *)ptr; + diff --git a/target/linux/qualcommax/patches-6.6/2603-8-qca-nss-clients-add-tls-mgr-support.patch b/target/linux/qualcommax/patches-6.6/2603-8-qca-nss-clients-add-tls-mgr-support.patch new file mode 100644 index 00000000000..0499e237f6b --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2603-8-qca-nss-clients-add-tls-mgr-support.patch @@ -0,0 +1,24 @@ +--- /dev/null ++++ b/include/uapi/linux/tlshdr.h +@@ -0,0 +1,21 @@ ++#ifndef _UAPI_LINUX_TLSHDR_H ++#define _UAPI_LINUX_TLSHDR_H ++ ++#include ++ ++struct tlshdr { ++ __u8 type; ++ __be16 version; ++ __be16 len; ++} __attribute__((packed)); ++ ++#define TLSHDR_REC_TYPE_CCS 20 /* TLS packet is change cipher specification */ ++#define TLSHDR_REC_TYPE_ALERT 21 /* TLS packet is Alert */ ++#define TLSHDR_REC_TYPE_HANDSHAKE 22 /* TLS packet is Handshake */ ++#define TLSHDR_REC_TYPE_DATA 23 /* TLS packet is Application data */ ++ ++#define TLSHDR_VERSION_1_1 0x0302 /* TLS Header Version(tls 1.1) */ ++#define TLSHDR_VERSION_1_2 0x0303 /* TLS Header Version(tls 1.2) */ ++#define TLSHDR_VERSION_1_3 0x0304 /* TLS Header Version(tls 1.3) */ ++ ++#endif /* _UAPI_LINUX_TLSHDR_H */ diff --git a/target/linux/qualcommax/patches-6.6/2604-qca-add-mcs-support.patch b/target/linux/qualcommax/patches-6.6/2604-qca-add-mcs-support.patch new file mode 100644 index 00000000000..53707f67798 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2604-qca-add-mcs-support.patch @@ -0,0 +1,925 @@ +--- a/include/linux/if_bridge.h ++++ b/include/linux/if_bridge.h +@@ -258,4 +258,17 @@ extern br_get_dst_hook_t __rcu *br_get_d + extern struct net_device *br_fdb_bridge_dev_get_and_hold(struct net_bridge *br); + /* QCA NSS bridge-mgr support - End */ + ++/* QCA qca-mcs support - Start */ ++typedef struct net_bridge_port *br_get_dst_hook_t(const struct net_bridge_port *src, ++ struct sk_buff **skb); ++extern br_get_dst_hook_t __rcu *br_get_dst_hook; ++ ++typedef int (br_multicast_handle_hook_t)(const struct net_bridge_port *src, ++ struct sk_buff *skb); ++extern br_multicast_handle_hook_t __rcu *br_multicast_handle_hook; ++ ++typedef void (br_notify_hook_t)(int group, int event, const void *ptr); ++extern br_notify_hook_t __rcu *br_notify_hook; ++/* QCA qca-mcs support - End */ ++ + #endif +--- a/net/bridge/br_fdb.c ++++ b/net/bridge/br_fdb.c +@@ -263,7 +263,8 @@ static void fdb_notify(struct net_bridge + kfree_skb(skb); + goto errout; + } +- rtnl_notify(skb, net, 0, RTNLGRP_NEIGH, NULL, GFP_ATOMIC); ++ __br_notify(RTNLGRP_NEIGH, type, fdb); /* QCA qca-mcs support */ ++ rtnl_notify(skb, net, 0, RTNLGRP_NEIGH, NULL, GFP_ATOMIC); + return; + errout: + rtnl_set_sk_err(net, RTNLGRP_NEIGH, err); +@@ -329,6 +330,7 @@ struct net_bridge_fdb_entry *br_fdb_find + { + return fdb_find_rcu(&br->fdb_hash_tbl, addr, vid); + } ++EXPORT_SYMBOL_GPL(br_fdb_find_rcu); /* QCA qca-mcs support */ + + /* When a static FDB entry is added, the mac address from the entry is + * added to the bridge private HW address list and all required ports +--- a/net/bridge/br_private.h ++++ b/net/bridge/br_private.h +@@ -906,6 +906,7 @@ void br_manage_promisc(struct net_bridge + int nbp_backup_change(struct net_bridge_port *p, struct net_device *backup_dev); + + /* br_input.c */ ++int br_pass_frame_up(struct sk_buff *skb, bool promisc); /* QCA qca-mcs support */ + int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb); + rx_handler_func_t *br_get_rx_handler(const struct net_device *dev); + +@@ -2271,4 +2272,14 @@ bool br_is_neigh_suppress_enabled(const + #define __br_get(__hook, __default, __args ...) \ + (__hook ? (__hook(__args)) : (__default)) + /* QCA NSS ECM support - End */ ++ ++/* QCA qca-mcs support - Start */ ++static inline void __br_notify(int group, int type, const void *data) ++{ ++ br_notify_hook_t *notify_hook = rcu_dereference(br_notify_hook); ++ ++ if (notify_hook) ++ notify_hook(group, type, data); ++} ++/* QCA qca-mcs support - End */ + #endif +--- a/net/bridge/br_netlink.c ++++ b/net/bridge/br_netlink.c +@@ -656,6 +656,7 @@ void br_info_notify(int event, const str + kfree_skb(skb); + goto errout; + } ++ __br_notify(RTNLGRP_LINK, event, port); /* QCA qca-mcs support */ + rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC); + return; + errout: +--- a/net/bridge/br.c ++++ b/net/bridge/br.c +@@ -472,6 +472,12 @@ static void __exit br_deinit(void) + br_fdb_fini(); + } + ++/* QCA qca-mcs support - Start */ ++/* Hook for bridge event notifications */ ++br_notify_hook_t __rcu *br_notify_hook __read_mostly; ++EXPORT_SYMBOL_GPL(br_notify_hook); ++/* QCA qca-mcs support - End */ ++ + module_init(br_init) + module_exit(br_deinit) + MODULE_LICENSE("GPL"); +--- a/net/bridge/br_device.c ++++ b/net/bridge/br_device.c +@@ -83,6 +83,12 @@ netdev_tx_t br_dev_xmit(struct sk_buff * + if (is_broadcast_ether_addr(dest)) { + br_flood(br, skb, BR_PKT_BROADCAST, false, true, vid); + } else if (is_multicast_ether_addr(dest)) { ++ /* QCA qca-mcs support - Start */ ++ br_multicast_handle_hook_t *multicast_handle_hook = rcu_dereference(br_multicast_handle_hook); ++ if (!__br_get(multicast_handle_hook, true, NULL, skb)) ++ goto out; ++ /* QCA qca-mcs support - End */ ++ + if (unlikely(netpoll_tx_running(dev))) { + br_flood(br, skb, BR_PKT_MULTICAST, false, true, vid); + goto out; +--- a/net/bridge/br_input.c ++++ b/net/bridge/br_input.c +@@ -23,6 +23,16 @@ + #include "br_private.h" + #include "br_private_tunnel.h" + ++/* QCA qca-mcs support - Start */ ++/* Hook for external Multicast handler */ ++br_multicast_handle_hook_t __rcu *br_multicast_handle_hook __read_mostly; ++EXPORT_SYMBOL_GPL(br_multicast_handle_hook); ++ ++/* Hook for external forwarding logic */ ++br_get_dst_hook_t __rcu *br_get_dst_hook __read_mostly; ++EXPORT_SYMBOL_GPL(br_get_dst_hook); ++/* QCA qca-mcs support - End */ ++ + static int + br_netif_receive_skb(struct net *net, struct sock *sk, struct sk_buff *skb) + { +@@ -30,7 +40,7 @@ br_netif_receive_skb(struct net *net, st + return netif_receive_skb(skb); + } + +-static int br_pass_frame_up(struct sk_buff *skb, bool promisc) ++int br_pass_frame_up(struct sk_buff *skb, bool promisc) + { + struct net_device *indev, *brdev = BR_INPUT_SKB_CB(skb)->brdev; + struct net_bridge *br = netdev_priv(brdev); +@@ -69,6 +79,7 @@ static int br_pass_frame_up(struct sk_bu + dev_net(indev), NULL, skb, indev, NULL, + br_netif_receive_skb); + } ++EXPORT_SYMBOL_GPL(br_pass_frame_up); /* QCA qca-mcs support */ + + /* note: already called with rcu_read_lock */ + int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb) +@@ -84,6 +95,11 @@ int br_handle_frame_finish(struct net *n + bool promisc; + u16 vid = 0; + u8 state; ++ /* QCA qca-mcs support - Start */ ++ br_multicast_handle_hook_t *multicast_handle_hook; ++ struct net_bridge_port *pdst = NULL; ++ br_get_dst_hook_t *get_dst_hook = rcu_dereference(br_get_dst_hook); ++ /* QCA qca-mcs support - End */ + + if (!p) + goto drop; +@@ -175,6 +191,11 @@ int br_handle_frame_finish(struct net *n + + switch (pkt_type) { + case BR_PKT_MULTICAST: ++ /* QCA qca-mcs support - Start */ ++ multicast_handle_hook = rcu_dereference(br_multicast_handle_hook); ++ if (!__br_get(multicast_handle_hook, true, p, skb)) ++ goto out; ++ /* QCA qca-mcs support - End */ + mdst = br_mdb_get(brmctx, skb, vid); + if ((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) && + br_multicast_querier_exists(brmctx, eth_hdr(skb), mdst)) { +@@ -190,8 +211,15 @@ int br_handle_frame_finish(struct net *n + } + break; + case BR_PKT_UNICAST: +- dst = br_fdb_find_rcu(br, eth_hdr(skb)->h_dest, vid); +- break; ++ /* QCA qca-mcs support - Start */ ++ pdst = __br_get(get_dst_hook, NULL, p, &skb); ++ if (pdst) { ++ if (!skb) ++ goto out; ++ } else { ++ /* QCA qca-mcs support - End */ ++ dst = br_fdb_find_rcu(br, eth_hdr(skb)->h_dest, vid); ++ } + default: + break; + } +@@ -206,6 +234,12 @@ int br_handle_frame_finish(struct net *n + dst->used = now; + br_forward(dst->dst, skb, local_rcv, false); + } else { ++ /* QCA qca-mcs support - Start */ ++ if (pdst) { ++ br_forward(pdst, skb, local_rcv, false); ++ goto out; ++ } ++ /* QCA qca-mcs support - End */ + if (!mcast_hit) + br_flood(br, skb, pkt_type, local_rcv, false, vid); + else +--- a/include/linux/mroute.h ++++ b/include/linux/mroute.h +@@ -92,4 +92,44 @@ struct rtmsg; + int ipmr_get_route(struct net *net, struct sk_buff *skb, + __be32 saddr, __be32 daddr, + struct rtmsg *rtm, u32 portid); ++ ++/* QCA ECM qca-mcs support - Start */ ++#define IPMR_MFC_EVENT_UPDATE 1 ++#define IPMR_MFC_EVENT_DELETE 2 ++ ++/* ++ * Callback to registered modules in the event of updates to a multicast group ++ */ ++typedef void (*ipmr_mfc_event_offload_callback_t)(__be32 origin, __be32 group, ++ u32 max_dest_dev, ++ u32 dest_dev_idx[], ++ u8 op); ++ ++/* ++ * Register the callback used to inform offload modules when updates occur to ++ * MFC. The callback is registered by offload modules ++ */ ++extern bool ipmr_register_mfc_event_offload_callback( ++ ipmr_mfc_event_offload_callback_t mfc_offload_cb); ++ ++/* ++ * De-Register the callback used to inform offload modules when updates occur ++ * to MFC ++ */ ++extern void ipmr_unregister_mfc_event_offload_callback(void); ++ ++/* ++ * Find the destination interface list, given a multicast group and source ++ */ ++extern int ipmr_find_mfc_entry(struct net *net, __be32 origin, __be32 group, ++ u32 max_dst_cnt, u32 dest_dev[]); ++ ++/* ++ * Out-of-band multicast statistics update for flows that are offloaded from ++ * Linux ++ */ ++extern int ipmr_mfc_stats_update(struct net *net, __be32 origin, __be32 group, ++ u64 pkts_in, u64 bytes_in, ++ u64 pkts_out, u64 bytes_out); ++/* QCA ECM qca-mcs support - End */ + #endif +--- a/include/linux/mroute6.h ++++ b/include/linux/mroute6.h +@@ -137,4 +137,47 @@ static inline int ip6mr_sk_ioctl(struct + return 1; + } + #endif ++ ++/* QCA qca-mcs support - Start */ ++#define IP6MR_MFC_EVENT_UPDATE 1 ++#define IP6MR_MFC_EVENT_DELETE 2 ++ ++/* ++ * Callback to registered modules in the event of updates to a multicast group ++ */ ++typedef void (*ip6mr_mfc_event_offload_callback_t)(struct in6_addr *origin, ++ struct in6_addr *group, ++ u32 max_dest_dev, ++ u32 dest_dev_idx[], ++ uint8_t op); ++ ++/* ++ * Register the callback used to inform offload modules when updates occur ++ * to MFC. The callback is registered by offload modules ++ */ ++extern bool ip6mr_register_mfc_event_offload_callback( ++ ip6mr_mfc_event_offload_callback_t mfc_offload_cb); ++ ++/* ++ * De-Register the callback used to inform offload modules when updates occur ++ * to MFC ++ */ ++extern void ip6mr_unregister_mfc_event_offload_callback(void); ++ ++/* ++ * Find the destination interface list given a multicast group and source ++ */ ++extern int ip6mr_find_mfc_entry(struct net *net, struct in6_addr *origin, ++ struct in6_addr *group, u32 max_dst_cnt, ++ u32 dest_dev[]); ++ ++/* ++ * Out-of-band multicast statistics update for flows that are offloaded from ++ * Linux ++ */ ++extern int ip6mr_mfc_stats_update(struct net *net, struct in6_addr *origin, ++ struct in6_addr *group, uint64_t pkts_in, ++ uint64_t bytes_in, uint64_t pkts_out, ++ uint64_t bytes_out); ++/* QCA qca-mcs support - End */ + #endif +--- a/net/ipv4/ipmr.c ++++ b/net/ipv4/ipmr.c +@@ -113,6 +113,15 @@ static void igmpmsg_netlink_event(const + static void mroute_clean_tables(struct mr_table *mrt, int flags); + static void ipmr_expire_process(struct timer_list *t); + ++/* QCA ECM qca-mcs support - Start */ ++/* spinlock for offload */ ++static DEFINE_SPINLOCK(lock); ++ ++static struct mfc_cache *ipmr_cache_find(struct mr_table *mrt, __be32 origin, ++ __be32 mcastgrp); ++static ipmr_mfc_event_offload_callback_t __rcu ipmr_mfc_event_offload_callback; ++/* QCA ECM qca-mcs support - End */ ++ + #ifdef CONFIG_IP_MROUTE_MULTIPLE_TABLES + #define ipmr_for_each_table(mrt, net) \ + list_for_each_entry_rcu(mrt, &net->ipv4.mr_tables, list, \ +@@ -223,6 +232,228 @@ static int ipmr_rule_fill(struct fib_rul + return 0; + } + ++/* QCA ECM qca-mcs support - Start */ ++/* ipmr_sync_entry_update() ++ * Call the registered offload callback to report an update to a multicast ++ * route entry. The callback receives the list of destination interfaces and ++ * the interface count ++ */ ++static void ipmr_sync_entry_update(struct mr_table *mrt, ++ struct mfc_cache *cache) ++{ ++ int vifi, dest_if_count = 0; ++ u32 dest_dev[MAXVIFS]; ++ __be32 origin; ++ __be32 group; ++ ipmr_mfc_event_offload_callback_t offload_update_cb_f; ++ ++ memset(dest_dev, 0, sizeof(dest_dev)); ++ ++ origin = cache->mfc_origin; ++ group = cache->mfc_mcastgrp; ++ ++ spin_lock(&mrt_lock); ++ for (vifi = 0; vifi < cache->_c.mfc_un.res.maxvif; vifi++) { ++ if (!((cache->_c.mfc_un.res.ttls[vifi] > 0) && ++ (cache->_c.mfc_un.res.ttls[vifi] < 255))) { ++ continue; ++ } ++ if (dest_if_count == MAXVIFS) { ++ spin_unlock(&mrt_lock); ++ return; ++ } ++ ++ if (!VIF_EXISTS(mrt, vifi)) { ++ spin_unlock(&mrt_lock); ++ return; ++ } ++ dest_dev[dest_if_count] = mrt->vif_table[vifi].dev->ifindex; ++ dest_if_count++; ++ } ++ spin_unlock(&mrt_lock); ++ ++ rcu_read_lock(); ++ offload_update_cb_f = rcu_dereference(ipmr_mfc_event_offload_callback); ++ ++ if (!offload_update_cb_f) { ++ rcu_read_unlock(); ++ return; ++ } ++ ++ offload_update_cb_f(group, origin, dest_if_count, dest_dev, ++ IPMR_MFC_EVENT_UPDATE); ++ rcu_read_unlock(); ++} ++ ++/* ipmr_sync_entry_delete() ++ * Call the registered offload callback to inform of a multicast route entry ++ * delete event ++ */ ++static void ipmr_sync_entry_delete(u32 origin, u32 group) ++{ ++ ipmr_mfc_event_offload_callback_t offload_update_cb_f; ++ ++ rcu_read_lock(); ++ offload_update_cb_f = rcu_dereference(ipmr_mfc_event_offload_callback); ++ ++ if (!offload_update_cb_f) { ++ rcu_read_unlock(); ++ return; ++ } ++ ++ offload_update_cb_f(group, origin, 0, NULL, IPMR_MFC_EVENT_DELETE); ++ rcu_read_unlock(); ++} ++ ++/* ipmr_register_mfc_event_offload_callback() ++ * Register the IPv4 Multicast update offload callback with IPMR ++ */ ++bool ipmr_register_mfc_event_offload_callback( ++ ipmr_mfc_event_offload_callback_t mfc_offload_cb) ++{ ++ ipmr_mfc_event_offload_callback_t offload_update_cb_f; ++ ++ rcu_read_lock(); ++ offload_update_cb_f = rcu_dereference(ipmr_mfc_event_offload_callback); ++ ++ if (offload_update_cb_f) { ++ rcu_read_unlock(); ++ return false; ++ } ++ rcu_read_unlock(); ++ ++ spin_lock(&lock); ++ rcu_assign_pointer(ipmr_mfc_event_offload_callback, mfc_offload_cb); ++ spin_unlock(&lock); ++ synchronize_rcu(); ++ return true; ++} ++EXPORT_SYMBOL(ipmr_register_mfc_event_offload_callback); ++ ++/* ipmr_unregister_mfc_event_offload_callback() ++ * De-register the IPv4 Multicast update offload callback with IPMR ++ */ ++void ipmr_unregister_mfc_event_offload_callback(void) ++{ ++ spin_lock(&lock); ++ rcu_assign_pointer(ipmr_mfc_event_offload_callback, NULL); ++ spin_unlock(&lock); ++ synchronize_rcu(); ++} ++EXPORT_SYMBOL(ipmr_unregister_mfc_event_offload_callback); ++ ++/* ipmr_find_mfc_entry() ++ * Returns destination interface list for a particular multicast flow, and ++ * the number of interfaces in the list ++ */ ++int ipmr_find_mfc_entry(struct net *net, __be32 origin, __be32 group, ++ u32 max_dest_cnt, u32 dest_dev[]) ++{ ++ int vifi, dest_if_count = 0; ++ struct mr_table *mrt; ++ struct mfc_cache *cache; ++ ++ mrt = ipmr_get_table(net, RT_TABLE_DEFAULT); ++ if (!mrt) ++ return -ENOENT; ++ ++ rcu_read_lock(); ++ cache = ipmr_cache_find(mrt, origin, group); ++ if (!cache) { ++ rcu_read_unlock(); ++ return -ENOENT; ++ } ++ ++ spin_lock(&mrt_lock); ++ for (vifi = 0; vifi < cache->_c.mfc_un.res.maxvif; vifi++) { ++ if (!((cache->_c.mfc_un.res.ttls[vifi] > 0) && ++ (cache->_c.mfc_un.res.ttls[vifi] < 255))) { ++ continue; ++ } ++ ++ /* We have another valid destination interface entry. Check if ++ * the number of the destination interfaces for the route is ++ * exceeding the size of the array given to us ++ */ ++ if (dest_if_count == max_dest_cnt) { ++ spin_unlock(&mrt_lock); ++ rcu_read_unlock(); ++ return -EINVAL; ++ } ++ ++ if (!VIF_EXISTS(mrt, vifi)) { ++ spin_unlock(&mrt_lock); ++ rcu_read_unlock(); ++ return -EINVAL; ++ } ++ ++ dest_dev[dest_if_count] = mrt->vif_table[vifi].dev->ifindex; ++ dest_if_count++; ++ } ++ spin_unlock(&mrt_lock); ++ rcu_read_unlock(); ++ ++ return dest_if_count; ++} ++EXPORT_SYMBOL(ipmr_find_mfc_entry); ++ ++/* ipmr_mfc_stats_update() ++ * Update the MFC/VIF statistics for offloaded flows ++ */ ++int ipmr_mfc_stats_update(struct net *net, __be32 origin, __be32 group, ++ u64 pkts_in, u64 bytes_in, ++ u64 pkts_out, u64 bytes_out) ++{ ++ int vif, vifi; ++ struct mr_table *mrt; ++ struct mfc_cache *cache; ++ ++ mrt = ipmr_get_table(net, RT_TABLE_DEFAULT); ++ if (!mrt) ++ return -ENOENT; ++ ++ rcu_read_lock(); ++ cache = ipmr_cache_find(mrt, origin, group); ++ if (!cache) { ++ rcu_read_unlock(); ++ return -ENOENT; ++ } ++ ++ vif = cache->_c.mfc_parent; ++ ++ spin_lock(&mrt_lock); ++ if (!VIF_EXISTS(mrt, vif)) { ++ spin_unlock(&mrt_lock); ++ rcu_read_unlock(); ++ return -EINVAL; ++ } ++ ++ mrt->vif_table[vif].pkt_in += pkts_in; ++ mrt->vif_table[vif].bytes_in += bytes_in; ++ cache->_c.mfc_un.res.pkt += pkts_out; ++ cache->_c.mfc_un.res.bytes += bytes_out; ++ ++ for (vifi = cache->_c.mfc_un.res.minvif; ++ vifi < cache->_c.mfc_un.res.maxvif; vifi++) { ++ if ((cache->_c.mfc_un.res.ttls[vifi] > 0) && ++ (cache->_c.mfc_un.res.ttls[vifi] < 255)) { ++ if (!VIF_EXISTS(mrt, vifi)) { ++ spin_unlock(&mrt_lock); ++ rcu_read_unlock(); ++ return -EINVAL; ++ } ++ mrt->vif_table[vifi].pkt_out += pkts_out; ++ mrt->vif_table[vifi].bytes_out += bytes_out; ++ } ++ } ++ spin_unlock(&mrt_lock); ++ rcu_read_unlock(); ++ ++ return 0; ++} ++EXPORT_SYMBOL(ipmr_mfc_stats_update); ++/* QCA ECM qca-mcs support - End */ ++ + static const struct fib_rules_ops __net_initconst ipmr_rules_ops_template = { + .family = RTNL_FAMILY_IPMR, + .rule_size = sizeof(struct ipmr_rule), +@@ -1192,6 +1423,11 @@ static int ipmr_mfc_delete(struct mr_tab + mroute_netlink_event(mrt, c, RTM_DELROUTE); + mr_cache_put(&c->_c); + ++ /* QCA ECM qca-mcs support - Start */ ++ /* Inform offload modules of the delete event */ ++ ipmr_sync_entry_delete(c->mfc_origin, c->mfc_mcastgrp); ++ /* QCA ECM qca-mcs support - End */ ++ + return 0; + } + +@@ -1221,6 +1457,12 @@ static int ipmr_mfc_add(struct net *net, + call_ipmr_mfc_entry_notifiers(net, FIB_EVENT_ENTRY_REPLACE, c, + mrt->id); + mroute_netlink_event(mrt, c, RTM_NEWROUTE); ++ ++ /* QCA ECM qca-mcs support - Start */ ++ /* Inform offload modules of the update event */ ++ ipmr_sync_entry_update(mrt, c); ++ /* QCA ECM qca-mcs support - End */ ++ + return 0; + } + +@@ -1281,6 +1523,7 @@ static void mroute_clean_tables(struct m + struct net *net = read_pnet(&mrt->net); + struct mr_mfc *c, *tmp; + struct mfc_cache *cache; ++ u32 origin, group; /* QCA ECM qca-mcs support */ + LIST_HEAD(list); + int i; + +@@ -1305,10 +1548,19 @@ static void mroute_clean_tables(struct m + rhltable_remove(&mrt->mfc_hash, &c->mnode, ipmr_rht_params); + list_del_rcu(&c->list); + cache = (struct mfc_cache *)c; ++ /* QCA ECM qca-mcs support - Start */ ++ origin = cache->mfc_origin; ++ group = cache->mfc_mcastgrp; ++ /* QCA ECM qca-mcs support - End */ + call_ipmr_mfc_entry_notifiers(net, FIB_EVENT_ENTRY_DEL, cache, + mrt->id); + mroute_netlink_event(mrt, cache, RTM_DELROUTE); + mr_cache_put(c); ++ ++ /* QCA ECM qca-mcs support - Start */ ++ /* Inform offload modules of the delete event */ ++ ipmr_sync_entry_delete(origin, group); ++ /* QCA ECM qca-mcs support - End */ + } + } + +--- a/net/ipv6/ip6mr.c ++++ b/net/ipv6/ip6mr.c +@@ -102,6 +102,17 @@ static int ip6mr_rtm_dumproute(struct sk + static void mroute_clean_tables(struct mr_table *mrt, int flags); + static void ipmr_expire_process(struct timer_list *t); + ++/* QCA qca-mcs support - Start */ ++/* Spinlock for offload */ ++static DEFINE_SPINLOCK(lock); ++ ++static struct mfc6_cache *ip6mr_cache_find(struct mr_table *mrt, ++ const struct in6_addr *origin, ++ const struct in6_addr *mcastgrp); ++static ip6mr_mfc_event_offload_callback_t __rcu ++ ip6mr_mfc_event_offload_callback; ++/* QCA qca-mcs support - End */ ++ + #ifdef CONFIG_IPV6_MROUTE_MULTIPLE_TABLES + #define ip6mr_for_each_table(mrt, net) \ + list_for_each_entry_rcu(mrt, &net->ipv6.mr6_tables, list, \ +@@ -380,6 +391,227 @@ static struct mr_table_ops ip6mr_mr_tabl + .cmparg_any = &ip6mr_mr_table_ops_cmparg_any, + }; + ++/* QCA qca-mcs support - Start */ ++/* ip6mr_sync_entry_update() ++ * Call the registered offload callback to report an update to a multicast ++ * route entry. The callback receives the list of destination interfaces and ++ * the interface count ++ */ ++static void ip6mr_sync_entry_update(struct mr_table *mrt, ++ struct mfc6_cache *cache) ++{ ++ int vifi, dest_if_count = 0; ++ u32 dest_dev[MAXMIFS]; ++ struct in6_addr mc_origin, mc_group; ++ ip6mr_mfc_event_offload_callback_t offload_update_cb_f; ++ ++ memset(dest_dev, 0, sizeof(dest_dev)); ++ ++ spin_lock(&mrt_lock); ++ ++ for (vifi = 0; vifi < cache->_c.mfc_un.res.maxvif; vifi++) { ++ if (!((cache->_c.mfc_un.res.ttls[vifi] > 0) && ++ (cache->_c.mfc_un.res.ttls[vifi] < 255))) { ++ continue; ++ } ++ ++ if (dest_if_count == MAXMIFS) { ++ spin_unlock(&mrt_lock); ++ return; ++ } ++ ++ if (!VIF_EXISTS(mrt, vifi)) { ++ spin_unlock(&mrt_lock); ++ return; ++ } ++ ++ dest_dev[dest_if_count] = mrt->vif_table[vifi].dev->ifindex; ++ dest_if_count++; ++ } ++ ++ memcpy(&mc_origin, &cache->mf6c_origin, sizeof(struct in6_addr)); ++ memcpy(&mc_group, &cache->mf6c_mcastgrp, sizeof(struct in6_addr)); ++ spin_unlock(&mrt_lock); ++ ++ rcu_read_lock(); ++ offload_update_cb_f = rcu_dereference(ip6mr_mfc_event_offload_callback); ++ ++ if (!offload_update_cb_f) { ++ rcu_read_unlock(); ++ return; ++ } ++ ++ offload_update_cb_f(&mc_group, &mc_origin, dest_if_count, dest_dev, ++ IP6MR_MFC_EVENT_UPDATE); ++ rcu_read_unlock(); ++} ++ ++/* ip6mr_sync_entry_delete() ++ * Call the registered offload callback to inform of a multicast route entry ++ * delete event ++ */ ++static void ip6mr_sync_entry_delete(struct in6_addr *mc_origin, ++ struct in6_addr *mc_group) ++{ ++ ip6mr_mfc_event_offload_callback_t offload_update_cb_f; ++ ++ rcu_read_lock(); ++ offload_update_cb_f = rcu_dereference(ip6mr_mfc_event_offload_callback); ++ ++ if (!offload_update_cb_f) { ++ rcu_read_unlock(); ++ return; ++ } ++ ++ offload_update_cb_f(mc_group, mc_origin, 0, NULL, ++ IP6MR_MFC_EVENT_DELETE); ++ rcu_read_unlock(); ++} ++ ++/* ip6mr_register_mfc_event_offload_callback() ++ * Register the IPv6 multicast update callback for offload modules ++ */ ++bool ip6mr_register_mfc_event_offload_callback( ++ ip6mr_mfc_event_offload_callback_t mfc_offload_cb) ++{ ++ ip6mr_mfc_event_offload_callback_t offload_update_cb_f; ++ ++ rcu_read_lock(); ++ offload_update_cb_f = rcu_dereference(ip6mr_mfc_event_offload_callback); ++ ++ if (offload_update_cb_f) { ++ rcu_read_unlock(); ++ return false; ++ } ++ rcu_read_unlock(); ++ ++ spin_lock(&lock); ++ rcu_assign_pointer(ip6mr_mfc_event_offload_callback, mfc_offload_cb); ++ spin_unlock(&lock); ++ synchronize_rcu(); ++ return true; ++} ++EXPORT_SYMBOL(ip6mr_register_mfc_event_offload_callback); ++ ++/* ip6mr_unregister_mfc_event_offload_callback() ++ * De-register the IPv6 multicast update callback for offload modules ++ */ ++void ip6mr_unregister_mfc_event_offload_callback(void) ++{ ++ spin_lock(&lock); ++ rcu_assign_pointer(ip6mr_mfc_event_offload_callback, NULL); ++ spin_unlock(&lock); ++ synchronize_rcu(); ++} ++EXPORT_SYMBOL(ip6mr_unregister_mfc_event_offload_callback); ++ ++/* ip6mr_find_mfc_entry() ++ * Return the destination interface list for a particular multicast flow, and ++ * the number of interfaces in the list ++ */ ++int ip6mr_find_mfc_entry(struct net *net, struct in6_addr *origin, ++ struct in6_addr *group, u32 max_dest_cnt, ++ u32 dest_dev[]) ++{ ++ int vifi, dest_if_count = 0; ++ struct mr_table *mrt; ++ struct mfc6_cache *cache; ++ ++ mrt = ip6mr_get_table(net, RT6_TABLE_DFLT); ++ if (!mrt) ++ return -ENOENT; ++ ++ spin_lock(&mrt_lock); ++ cache = ip6mr_cache_find(mrt, origin, group); ++ if (!cache) { ++ spin_unlock(&mrt_lock); ++ return -ENOENT; ++ } ++ ++ for (vifi = 0; vifi < cache->_c.mfc_un.res.maxvif; vifi++) { ++ if (!((cache->_c.mfc_un.res.ttls[vifi] > 0) && ++ (cache->_c.mfc_un.res.ttls[vifi] < 255))) { ++ continue; ++ } ++ ++ /* We have another valid destination interface entry. Check if ++ * the number of the destination interfaces for the route is ++ * exceeding the size of the array given to us ++ */ ++ if (dest_if_count == max_dest_cnt) { ++ spin_unlock(&mrt_lock); ++ return -EINVAL; ++ } ++ ++ if (!VIF_EXISTS(mrt, vifi)) { ++ spin_unlock(&mrt_lock); ++ return -EINVAL; ++ } ++ ++ dest_dev[dest_if_count] = mrt->vif_table[vifi].dev->ifindex; ++ dest_if_count++; ++ } ++ spin_unlock(&mrt_lock); ++ ++ return dest_if_count; ++} ++EXPORT_SYMBOL(ip6mr_find_mfc_entry); ++ ++/* ip6mr_mfc_stats_update() ++ * Update the MFC/VIF statistics for offloaded flows ++ */ ++int ip6mr_mfc_stats_update(struct net *net, struct in6_addr *origin, ++ struct in6_addr *group, u64 pkts_in, ++ u64 bytes_in, uint64_t pkts_out, ++ u64 bytes_out) ++{ ++ int vif, vifi; ++ struct mr_table *mrt; ++ struct mfc6_cache *cache; ++ ++ mrt = ip6mr_get_table(net, RT6_TABLE_DFLT); ++ ++ if (!mrt) ++ return -ENOENT; ++ ++ spin_lock(&mrt_lock); ++ cache = ip6mr_cache_find(mrt, origin, group); ++ if (!cache) { ++ spin_unlock(&mrt_lock); ++ return -ENOENT; ++ } ++ ++ vif = cache->_c.mfc_parent; ++ ++ if (!VIF_EXISTS(mrt, vif)) { ++ spin_unlock(&mrt_lock); ++ return -EINVAL; ++ } ++ ++ mrt->vif_table[vif].pkt_in += pkts_in; ++ mrt->vif_table[vif].bytes_in += bytes_in; ++ cache->_c.mfc_un.res.pkt += pkts_out; ++ cache->_c.mfc_un.res.bytes += bytes_out; ++ ++ for (vifi = cache->_c.mfc_un.res.minvif; ++ vifi < cache->_c.mfc_un.res.maxvif; vifi++) { ++ if ((cache->_c.mfc_un.res.ttls[vifi] > 0) && ++ (cache->_c.mfc_un.res.ttls[vifi] < 255)) { ++ if (!VIF_EXISTS(mrt, vifi)) { ++ spin_unlock(&mrt_lock); ++ return -EINVAL; ++ } ++ mrt->vif_table[vifi].pkt_out += pkts_out; ++ mrt->vif_table[vifi].bytes_out += bytes_out; ++ } ++ } ++ ++ spin_unlock(&mrt_lock); ++ return 0; ++} ++EXPORT_SYMBOL(ip6mr_mfc_stats_update); ++/* QCA qca-mcs support - End */ ++ + static struct mr_table *ip6mr_new_table(struct net *net, u32 id) + { + struct mr_table *mrt; +@@ -1221,6 +1453,7 @@ static int ip6mr_mfc_delete(struct mr_ta + int parent) + { + struct mfc6_cache *c; ++ struct in6_addr mc_origin, mc_group; /* QCA qca-mcs support */ + + /* The entries are added/deleted only under RTNL */ + rcu_read_lock(); +@@ -1229,6 +1462,12 @@ static int ip6mr_mfc_delete(struct mr_ta + rcu_read_unlock(); + if (!c) + return -ENOENT; ++ ++ /* QCA qca-mcs support - Start */ ++ memcpy(&mc_origin, &c->mf6c_origin, sizeof(struct in6_addr)); ++ memcpy(&mc_group, &c->mf6c_mcastgrp, sizeof(struct in6_addr)); ++ /* QCA qca-mcs support - End */ ++ + rhltable_remove(&mrt->mfc_hash, &c->_c.mnode, ip6mr_rht_params); + list_del_rcu(&c->_c.list); + +@@ -1236,6 +1475,12 @@ static int ip6mr_mfc_delete(struct mr_ta + FIB_EVENT_ENTRY_DEL, c, mrt->id); + mr6_netlink_event(mrt, c, RTM_DELROUTE); + mr_cache_put(&c->_c); ++ ++ /* QCA qca-mcs support - Start */ ++ /* Inform offload modules of the delete event */ ++ ip6mr_sync_entry_delete(&mc_origin, &mc_group); ++ /* QCA qca-mcs support - End */ ++ + return 0; + } + +@@ -1457,6 +1702,12 @@ static int ip6mr_mfc_add(struct net *net + call_ip6mr_mfc_entry_notifiers(net, FIB_EVENT_ENTRY_REPLACE, + c, mrt->id); + mr6_netlink_event(mrt, c, RTM_NEWROUTE); ++ ++ /* QCA qca-mcs support - Start */ ++ /* Inform offload modules of the update event */ ++ ip6mr_sync_entry_update(mrt, c); ++ /* QCA qca-mcs support - End */ ++ + return 0; + } + +@@ -1519,6 +1770,10 @@ static int ip6mr_mfc_add(struct net *net + + static void mroute_clean_tables(struct mr_table *mrt, int flags) + { ++ /* QCA qca-mcs support - Start */ ++ struct mfc6_cache *cache; ++ struct in6_addr mc_origin, mc_group; ++ /* QCA qca-mcs support - End */ + struct mr_mfc *c, *tmp; + LIST_HEAD(list); + int i; +@@ -1541,13 +1796,23 @@ static void mroute_clean_tables(struct m + if (((c->mfc_flags & MFC_STATIC) && !(flags & MRT6_FLUSH_MFC_STATIC)) || + (!(c->mfc_flags & MFC_STATIC) && !(flags & MRT6_FLUSH_MFC))) + continue; ++ /* QCA qca-mcs support - Start */ ++ cache = (struct mfc6_cache *)c; ++ memcpy(&mc_origin, &cache->mf6c_origin, sizeof(struct in6_addr)); ++ memcpy(&mc_group, &cache->mf6c_mcastgrp, sizeof(struct in6_addr)); ++ /* QCA qca-mcs support - End */ + rhltable_remove(&mrt->mfc_hash, &c->mnode, ip6mr_rht_params); + list_del_rcu(&c->list); + call_ip6mr_mfc_entry_notifiers(read_pnet(&mrt->net), + FIB_EVENT_ENTRY_DEL, +- (struct mfc6_cache *)c, mrt->id); +- mr6_netlink_event(mrt, (struct mfc6_cache *)c, RTM_DELROUTE); ++ cache, mrt->id); ++ mr6_netlink_event(mrt, cache, RTM_DELROUTE); + mr_cache_put(c); ++ ++ /* QCA qca-mcs support - Start */ ++ /* Inform offload modules of the delete event */ ++ ip6mr_sync_entry_delete(&mc_origin, &mc_group); ++ /* QCA qca-mcs support - End */ + } + } + diff --git a/target/linux/qualcommax/patches-6.6/2605-qca-nss-cfi-support.patch b/target/linux/qualcommax/patches-6.6/2605-qca-nss-cfi-support.patch new file mode 100644 index 00000000000..f6a439ba530 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2605-qca-nss-cfi-support.patch @@ -0,0 +1,111 @@ +--- a/crypto/authenc.c ++++ b/crypto/authenc.c +@@ -415,6 +415,8 @@ static int crypto_authenc_create(struct + enc->base.cra_driver_name) >= CRYPTO_MAX_ALG_NAME) + goto err_free_inst; + ++ inst->alg.base.cra_flags |= (auth_base->cra_flags | ++ enc->base.cra_flags) & CRYPTO_ALG_NOSUPP_SG; + inst->alg.base.cra_priority = enc->base.cra_priority * 10 + + auth_base->cra_priority; + inst->alg.base.cra_blocksize = enc->base.cra_blocksize; +--- a/include/linux/crypto.h ++++ b/include/linux/crypto.h +@@ -86,6 +86,11 @@ + #define CRYPTO_NOLOAD 0x00008000 + + /* ++ * Set this flag if algorithm does not support SG list transforms ++ */ ++#define CRYPTO_ALG_NOSUPP_SG 0x0000c000 ++ ++/* + * The algorithm may allocate memory during request processing, i.e. during + * encryption, decryption, or hashing. Users can request an algorithm with this + * flag unset if they can't handle memory allocation failures. +--- a/net/ipv4/esp4.c ++++ b/net/ipv4/esp4.c +@@ -658,6 +658,7 @@ static int esp_output(struct xfrm_state + struct ip_esp_hdr *esph; + struct crypto_aead *aead; + struct esp_info esp; ++ bool nosupp_sg; + + esp.inplace = true; + +@@ -669,6 +670,11 @@ static int esp_output(struct xfrm_state + aead = x->data; + alen = crypto_aead_authsize(aead); + ++ nosupp_sg = crypto_tfm_alg_type(&aead->base) & CRYPTO_ALG_NOSUPP_SG; ++ if (nosupp_sg && skb_linearize(skb)) { ++ return -ENOMEM; ++ } ++ + esp.tfclen = 0; + if (x->tfcpad) { + struct xfrm_dst *dst = (struct xfrm_dst *)skb_dst(skb); +@@ -890,6 +896,7 @@ static int esp_input(struct xfrm_state * + u8 *iv; + struct scatterlist *sg; + int err = -EINVAL; ++ bool nosupp_sg; + + if (!pskb_may_pull(skb, sizeof(struct ip_esp_hdr) + ivlen)) + goto out; +@@ -897,6 +904,12 @@ static int esp_input(struct xfrm_state * + if (elen <= 0) + goto out; + ++ nosupp_sg = crypto_tfm_alg_type(&aead->base) & CRYPTO_ALG_NOSUPP_SG; ++ if (nosupp_sg && skb_linearize(skb)) { ++ err = -ENOMEM; ++ goto out; ++ } ++ + assoclen = sizeof(struct ip_esp_hdr); + seqhilen = 0; + +--- a/net/ipv6/esp6.c ++++ b/net/ipv6/esp6.c +@@ -696,6 +696,7 @@ static int esp6_output(struct xfrm_state + struct ip_esp_hdr *esph; + struct crypto_aead *aead; + struct esp_info esp; ++ bool nosupp_sg; + + esp.inplace = true; + +@@ -707,6 +708,11 @@ static int esp6_output(struct xfrm_state + aead = x->data; + alen = crypto_aead_authsize(aead); + ++ nosupp_sg = crypto_tfm_alg_type(&aead->base) & CRYPTO_ALG_NOSUPP_SG; ++ if (nosupp_sg && skb_linearize(skb)) { ++ return -ENOMEM; ++ } ++ + esp.tfclen = 0; + if (x->tfcpad) { + struct xfrm_dst *dst = (struct xfrm_dst *)skb_dst(skb); +@@ -934,6 +940,7 @@ static int esp6_input(struct xfrm_state + __be32 *seqhi; + u8 *iv; + struct scatterlist *sg; ++ bool nosupp_sg; + + if (!pskb_may_pull(skb, sizeof(struct ip_esp_hdr) + ivlen)) { + ret = -EINVAL; +@@ -945,6 +952,12 @@ static int esp6_input(struct xfrm_state + goto out; + } + ++ nosupp_sg = crypto_tfm_alg_type(&aead->base) & CRYPTO_ALG_NOSUPP_SG; ++ if (nosupp_sg && skb_linearize(skb)) { ++ ret = -ENOMEM; ++ goto out; ++ } ++ + assoclen = sizeof(struct ip_esp_hdr); + seqhilen = 0; + diff --git a/target/linux/qualcommax/patches-6.6/2606-1-qca-nss-ecm-bridge-Fixes-for-Bridge-VLAN-Filtering.patch b/target/linux/qualcommax/patches-6.6/2606-1-qca-nss-ecm-bridge-Fixes-for-Bridge-VLAN-Filtering.patch new file mode 100644 index 00000000000..b4d5f89dd55 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2606-1-qca-nss-ecm-bridge-Fixes-for-Bridge-VLAN-Filtering.patch @@ -0,0 +1,341 @@ +From 7732ede3f72eebb8742e17e61e07e9286c442aec Mon Sep 17 00:00:00 2001 +From: Vishnu Vardhan Bantanahal +Date: Mon, 15 May 2023 17:56:04 +0530 +Subject: [PATCH 277/281] bridge: Fixes for Bridge VLAN Filtering + +1. Fix function to check for bridge master status while checking +for Bridge VLAN filter feature is enabled on bridge slave ports. +2. Disable default PVID for bridges during device registration in +the system. +Change-Id: Ibea6559c1b0700a2300b60e20d57b7818e23a8a8 +Signed-off-by: Vishnu Vardhan Bantanahal + +bridge: Fix Bridge VLAN stats update +This patch fixes Bridge VLAN stats update for both bridge master +and bridge slave. +Change-Id: Ia26f4c71e83e27dd83336815cda5c05c8c3f24ff +Signed-off-by: Vishnu Vardhan Bantanahal + +bridge: Add bridge VLAN filter APIs for offload for 6.1 Kernel + +Change-Id: I54e44c26664f86ae024f54605a032713a9a3eee5 +Signed-off-by: Vishnu Vardhan Bantanahal +--- + include/linux/if_bridge.h | 29 +++++- + include/linux/netdevice.h | 2 +- + net/bridge/br.c | 4 + + net/bridge/br_if.c | 11 ++- + net/bridge/br_private.h | 1 + + net/bridge/br_vlan.c | 186 +++++++++++++++++++++++++++++++++++++- + net/core/dev.c | 2 +- + 7 files changed, 227 insertions(+), 8 deletions(-) + +--- a/include/linux/if_bridge.h ++++ b/include/linux/if_bridge.h +@@ -128,6 +128,12 @@ int br_vlan_get_info_rcu(const struct ne + bool br_mst_enabled(const struct net_device *dev); + int br_mst_get_info(const struct net_device *dev, u16 msti, unsigned long *vids); + int br_mst_get_state(const struct net_device *dev, u16 msti, u8 *state); ++ ++extern struct net_device *br_fdb_find_vid_by_mac(struct net_device *dev, u8 *mac, u16 *vid); ++extern int br_vlan_get_tag_skb(const struct sk_buff *skb, u16 *vid); ++extern int br_dev_is_vlan_filter_enabled(struct net_device *dev); ++extern int br_vlan_update_stats(struct net_device* dev, u32 vid, u64 rx_bytes, u64 rx_packets, u64 tx_bytes, u64 tx_packets); ++extern int br_vlan_get_info_rcu(const struct net_device *dev, u16 vid, struct bridge_vlan_info *p_vinfo); + #else + static inline bool br_vlan_enabled(const struct net_device *dev) + { +@@ -149,8 +155,27 @@ static inline int br_vlan_get_pvid_rcu(c + return -EINVAL; + } + +-static inline int br_vlan_get_info(const struct net_device *dev, u16 vid, +- struct bridge_vlan_info *p_vinfo) ++static inline int br_vlan_get_info(const struct net_device *dev, u16 vid, struct bridge_vlan_info *p_vinfo) ++{ ++ return -EINVAL; ++} ++ ++static inline struct net_device *br_fdb_find_vid_by_mac(struct net_device *dev, u8 *mac, u16 *vid) ++{ ++ return NULL; ++} ++ ++static inline int br_vlan_get_tag_skb(const struct sk_buff *skb, u16 *vid) ++{ ++ return -EINVAL; ++} ++ ++static inline int br_dev_is_vlan_filter_enabled(const struct net_device *dev) ++{ ++ return -EINVAL; ++} ++ ++static inline int br_vlan_update_stats(struct net_device* dev, u32 vid, u64 rx_bytes, u64 rx_packets, u64 tx_bytes, u64 tx_packets) + { + return -EINVAL; + } +--- a/net/bridge/br.c ++++ b/net/bridge/br.c +@@ -42,6 +42,10 @@ static int br_device_event(struct notifi + return notifier_from_errno(err); + + if (event == NETDEV_REGISTER) { ++#if IS_ENABLED(CONFIG_BRIDGE_VLAN_FILTERING) ++ br_vlan_disable_default_pvid(netdev_priv(dev)); ++#endif ++ + /* register of bridge completed, add sysfs entries */ + err = br_sysfs_addbr(dev); + if (err) +--- a/net/bridge/br_if.c ++++ b/net/bridge/br_if.c +@@ -800,9 +800,12 @@ struct net_device *br_port_dev_get(struc + struct sk_buff *skb, + unsigned int cookie) + { ++#if !IS_ENABLED(CONFIG_BRIDGE_VLAN_FILTERING) + struct net_bridge_fdb_entry *fdbe; + struct net_bridge *br; ++#endif + struct net_device *netdev = NULL; ++ u16 __maybe_unused vid; + + /* Is this a bridge? */ + if (!(dev->priv_flags & IFF_EBRIDGE)) +@@ -831,14 +834,20 @@ struct net_device *br_port_dev_get(struc + * determine the port to use - fall back to using FDB + */ + ++#if IS_ENABLED(CONFIG_BRIDGE_VLAN_FILTERING) ++ /* Lookup the fdb entry and get reference to the port dev. ++ * dev_hold() is done as part of br_fdb_find_vid_by_mac() ++ */ ++ netdev = br_fdb_find_vid_by_mac(dev, addr, &vid); ++#else + br = netdev_priv(dev); +- +- /* Lookup the fdb entry and get reference to the port dev */ + fdbe = br_fdb_find_rcu(br, addr, 0); + if (fdbe && fdbe->dst) { + netdev = fdbe->dst->dev; /* port device */ + dev_hold(netdev); + } ++#endif ++ + out: + rcu_read_unlock(); + return netdev; +--- a/net/bridge/br_private.h ++++ b/net/bridge/br_private.h +@@ -1563,6 +1563,7 @@ void br_vlan_fill_forward_path_pvid(stru + int br_vlan_fill_forward_path_mode(struct net_bridge *br, + struct net_bridge_port *dst, + struct net_device_path *path); ++void br_vlan_disable_default_pvid(struct net_bridge *br); + + static inline struct net_bridge_vlan_group *br_vlan_group( + const struct net_bridge *br) +--- a/net/bridge/br_vlan.c ++++ b/net/bridge/br_vlan.c +@@ -933,8 +933,190 @@ int br_vlan_get_proto(const struct net_d + } + EXPORT_SYMBOL_GPL(br_vlan_get_proto); + ++/* ++ * br_vlan_get_tag_skb() ++ * Returns VLAN tag is its found valid in skb. ++ */ ++int br_vlan_get_tag_skb(const struct sk_buff *skb, u16 *vid) ++{ ++ return br_vlan_get_tag(skb, vid); ++ ++} ++EXPORT_SYMBOL_GPL(br_vlan_get_tag_skb); ++ ++/* ++ * br_dev_is_vlan_filter_enabled() ++ * Caller should ensure to hold rcu_lock() ++ * Returns 0, when device(port or bridge device) has a valid bridge ++ * vlan filter configuration and returns error otherwise. ++ */ ++int br_dev_is_vlan_filter_enabled(struct net_device *dev) ++{ ++ struct net_bridge_port *p; ++ struct net_bridge_vlan_group *vg = NULL; ++ struct net_device *master = NULL; ++ ++ if (!dev) { ++ return -ENODEV; ++ } ++ ++ if (netif_is_bridge_master(dev)) { ++ /* ++ * Its a bridge device ++ */ ++ if (!br_vlan_enabled(dev)) { ++ return -ENOENT; ++ } ++ ++ vg = br_vlan_group(netdev_priv(dev)); ++ } else if (dev->priv_flags & IFF_BRIDGE_PORT) { ++ /* ++ * It's a bridge port ++ */ ++ master = netdev_master_upper_dev_get_rcu(dev); ++ if (!master) { ++ return -EINVAL; ++ } ++ ++ if (!br_vlan_enabled(master)) { ++ return -ENOENT; ++ } ++ ++ p = br_port_get_rcu(dev); ++ if (p) ++ vg = nbp_vlan_group(p); ++ } else { ++ /* ++ * Neither a bridge device or port ++ */ ++ return -EINVAL; ++ } ++ ++ if (vg != NULL && vg->num_vlans) { ++ return 0; ++ } ++ ++ return -ENXIO; ++} ++EXPORT_SYMBOL_GPL(br_dev_is_vlan_filter_enabled); ++ ++/* ++ * br_fdb_find_vid_by_mac() ++ * Caller ensures to ensure rcu_lock() is taken. ++ * Returns 0 in case of lookup was performed. ++ * Look up the bridge fdb table for the mac-address & find associated ++ * VLAN id associated with it. ++ * vid is non-zero for succesfull lookup, otherwise 0. ++ * We dev_hold() on the returned device, caller will release this hold. ++ */ ++struct net_device *br_fdb_find_vid_by_mac(struct net_device *dev, u8 *mac, u16 *vid) ++{ ++ struct net_bridge *br; ++ struct net_bridge_fdb_entry *f; ++ struct net_device *netdev = NULL; ++ ++ if (!mac) { ++ return NULL; ++ } ++ ++ if (!dev || !netif_is_bridge_master(dev)) { ++ return NULL; ++ } ++ ++ br = netdev_priv(dev); ++ if (!br) { ++ return NULL; ++ } ++ ++ hlist_for_each_entry_rcu(f, &br->fdb_list, fdb_node) { ++ if (ether_addr_equal(f->key.addr.addr, mac)) { ++ *vid = f->key.vlan_id; ++ if (f->dst) { ++ netdev = f->dst->dev; ++ dev_hold(netdev); ++ break; ++ } ++ } ++ } ++ return netdev; ++} ++EXPORT_SYMBOL_GPL(br_fdb_find_vid_by_mac); ++ ++/* ++ * br_vlan_update_stats() ++ * Update bridge VLAN filter statistics. ++ */ ++int br_vlan_update_stats(struct net_device *dev, u32 vid, u64 rx_bytes, u64 rx_packets, u64 tx_bytes, u64 tx_packets) ++{ ++ struct net_bridge_port *p; ++ struct net_bridge_vlan *v; ++ struct pcpu_sw_netstats *stats; ++ const struct net_bridge *br; ++ struct net_bridge_vlan_group *vg; ++ struct net_device *brdev; ++ ++ if (!dev) { ++ return -ENODEV; ++ } ++ ++ if (!netif_is_bridge_port(dev) && !netif_is_bridge_master(dev)) { ++ return -EINVAL; ++ } ++ ++ rcu_read_lock(); ++ ++ brdev = dev; ++ if (!netif_is_bridge_master(dev)) { ++ brdev = netdev_master_upper_dev_get_rcu(dev); ++ if (!brdev) { ++ rcu_read_unlock(); ++ return -EPERM; ++ } ++ } ++ ++ br = netdev_priv(brdev); ++ if (!br || !br_opt_get(br, BROPT_VLAN_STATS_ENABLED)) { ++ rcu_read_unlock(); ++ return -EINVAL; ++ } ++ ++ p = br_port_get_rcu(dev); ++ if (p) { ++ vg = nbp_vlan_group_rcu(p); ++ } else if (netif_is_bridge_master(dev)) { ++ vg = br_vlan_group(netdev_priv(dev)); ++ } else { ++ rcu_read_unlock(); ++ return -EINVAL; ++ } ++ ++ ++ if (!vg) { ++ rcu_read_unlock(); ++ return -ENXIO; ++ } ++ ++ v = br_vlan_find(vg, vid); ++ if (!v || !br_vlan_should_use(v)) { ++ rcu_read_unlock(); ++ return -ENOENT; ++ } ++ ++ stats = this_cpu_ptr(v->stats); ++ u64_stats_update_begin(&stats->syncp); ++ u64_stats_add(&stats->rx_bytes, rx_bytes); ++ u64_stats_add(&stats->rx_packets, rx_packets); ++ u64_stats_add(&stats->tx_bytes, tx_bytes); ++ u64_stats_add(&stats->tx_packets, tx_packets); ++ u64_stats_update_end(&stats->syncp); ++ ++ rcu_read_unlock(); ++ return 0; ++} ++EXPORT_SYMBOL_GPL(br_vlan_update_stats); ++ + int __br_vlan_set_proto(struct net_bridge *br, __be16 proto, +- struct netlink_ext_ack *extack) ++ struct netlink_ext_ack *extack) + { + struct switchdev_attr attr = { + .orig_dev = br->dev, +@@ -1068,7 +1250,7 @@ static bool vlan_default_pvid(struct net + return false; + } + +-static void br_vlan_disable_default_pvid(struct net_bridge *br) ++void br_vlan_disable_default_pvid(struct net_bridge *br) + { + struct net_bridge_port *p; + u16 pvid = br->default_pvid; diff --git a/target/linux/qualcommax/patches-6.6/2610-netfilter-nf_conntrack_ecache-Fix-NSS-ECM-BRK-kernel-panic.patch b/target/linux/qualcommax/patches-6.6/2610-netfilter-nf_conntrack_ecache-Fix-NSS-ECM-BRK-kernel-panic.patch new file mode 100644 index 00000000000..4b9ee21f2f8 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2610-netfilter-nf_conntrack_ecache-Fix-NSS-ECM-BRK-kernel-panic.patch @@ -0,0 +1,10 @@ +--- a/net/netfilter/nf_conntrack_ecache.c ++++ b/net/netfilter/nf_conntrack_ecache.c +@@ -266,7 +266,6 @@ void nf_conntrack_register_notifier(stru + mutex_lock(&nf_ct_ecache_mutex); + notify = rcu_dereference_protected(net->ct.nf_conntrack_event_cb, + lockdep_is_held(&nf_ct_ecache_mutex)); +- WARN_ON_ONCE(notify); + rcu_assign_pointer(net->ct.nf_conntrack_event_cb, new); + mutex_unlock(&nf_ct_ecache_mutex); + } diff --git a/target/linux/qualcommax/patches-6.6/2611-ipv6-Fix-null-pointer-dereference-in-ipv6-output.patch b/target/linux/qualcommax/patches-6.6/2611-ipv6-Fix-null-pointer-dereference-in-ipv6-output.patch new file mode 100644 index 00000000000..25f99fc4ade --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2611-ipv6-Fix-null-pointer-dereference-in-ipv6-output.patch @@ -0,0 +1,80 @@ +From eee3a7956b943dd3e23a74fbb5bfe89405eb0782 Mon Sep 17 00:00:00 2001 +From: Andrea Righi +Date: Mon, 6 Dec 2021 17:34:47 +0100 +Subject: UBUNTU: SAUCE: ipv6: fix NULL pointer dereference in ip6_output() + +It is possible to trigger a NULL pointer dereference by running the srv6 +net kselftest (tools/testing/selftests/net/srv6_end_dt46_l3vpn_test.sh): + +[ 249.051216] BUG: kernel NULL pointer dereference, address: 0000000000000378 +[ 249.052331] #PF: supervisor read access in kernel mode +[ 249.053137] #PF: error_code(0x0000) - not-present page +[ 249.053960] PGD 0 P4D 0 +[ 249.054376] Oops: 0000 [#1] PREEMPT SMP NOPTI +[ 249.055083] CPU: 1 PID: 21 Comm: ksoftirqd/1 Tainted: G E 5.16.0-rc4 #2 +[ 249.056328] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014 +[ 249.057632] RIP: 0010:ip6_forward+0x53c/0xab0 +[ 249.058354] Code: 49 c7 44 24 20 00 00 00 00 48 83 e0 fe 48 8b 40 30 48 3d 70 b2 b5 81 0f 85 b5 04 00 00 e8 7c f2 ff ff 41 89 c5 e9 17 01 00 00 <44> 8b 93 78 03 00 00 45 85 d2 0f 85 92 fb ff ff 49 8b 54 24 10 48 +[ 249.061274] RSP: 0018:ffffc900000cbb30 EFLAGS: 00010246 +[ 249.062042] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffff8881051d3400 +[ 249.063141] RDX: ffff888104bda000 RSI: 00000000000002c0 RDI: 0000000000000000 +[ 249.064264] RBP: ffffc900000cbbc8 R08: 0000000000000000 R09: 0000000000000000 +[ 249.065376] R10: 0000000000000040 R11: 0000000000000000 R12: ffff888103409800 +[ 249.066498] R13: ffff8881051d3410 R14: ffff888102725280 R15: ffff888103525000 +[ 249.067619] FS: 0000000000000000(0000) GS:ffff88813bc80000(0000) knlGS:0000000000000000 +[ 249.068881] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +[ 249.069777] CR2: 0000000000000378 CR3: 0000000104980000 CR4: 0000000000750ee0 +[ 249.070907] PKRU: 55555554 +[ 249.071337] Call Trace: +[ 249.071730] +[ 249.072070] ? debug_smp_processor_id+0x17/0x20 +[ 249.072807] seg6_input_core+0x2bb/0x2d0 +[ 249.073436] ? _raw_spin_unlock_irqrestore+0x29/0x40 +[ 249.074225] seg6_input+0x3b/0x130 +[ 249.074768] lwtunnel_input+0x5e/0xa0 +[ 249.075357] ip_rcv+0x17b/0x190 +[ 249.075867] ? update_load_avg+0x82/0x600 +[ 249.076514] __netif_receive_skb_one_core+0x86/0xa0 +[ 249.077231] __netif_receive_skb+0x15/0x60 +[ 249.077843] process_backlog+0x97/0x160 +[ 249.078389] __napi_poll+0x31/0x170 +[ 249.078912] net_rx_action+0x229/0x270 +[ 249.079506] __do_softirq+0xef/0x2ed +[ 249.080085] run_ksoftirqd+0x37/0x50 +[ 249.080663] smpboot_thread_fn+0x193/0x230 +[ 249.081312] kthread+0x17a/0x1a0 +[ 249.081847] ? smpboot_register_percpu_thread+0xe0/0xe0 +[ 249.082677] ? set_kthread_struct+0x50/0x50 +[ 249.083340] ret_from_fork+0x22/0x30 +[ 249.083926] +[ 249.090295] ---[ end trace 1998d7ba5965a365 ]--- + +It looks like commit 0857d6f8c759 ("ipv6: When forwarding count rx stats +on the orig netdev") tries to determine the right netdev to account the +rx stats, but in this particular case it's failing and the netdev is +NULL. + +Fallback to the previous method of determining the netdev interface (via +skb->dev) to account the rx stats when the orig netdev can't be +determined. + +Fixes: 0857d6f8c759 ("ipv6: When forwarding count rx stats on the orig netdev") +Signed-off-by: Andrea Righi +(cherry picked from https://lore.kernel.org/lkml/20211206163447.991402-1-andrea.righi@canonical.com/T/#u) +Signed-off-by: Andrea Righi +--- + net/ipv6/ip6_output.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/net/ipv6/ip6_output.c ++++ b/net/ipv6/ip6_output.c +@@ -498,6 +498,9 @@ int ip6_forward(struct sk_buff *skb) + u32 mtu; + + idev = __in6_dev_get_safely(dev_get_by_index_rcu(net, IP6CB(skb)->iif)); ++ if (unlikely(!idev)) ++ idev = __in6_dev_get_safely(skb->dev); ++ + if (net->ipv6.devconf_all->forwarding == 0) + goto error; + diff --git a/target/linux/qualcommax/patches-6.6/2613-netfilter_optional_tcp_window_check.patc.patch b/target/linux/qualcommax/patches-6.6/2613-netfilter_optional_tcp_window_check.patc.patch new file mode 100644 index 00000000000..150853573d0 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/2613-netfilter_optional_tcp_window_check.patc.patch @@ -0,0 +1,108 @@ +From ed42112c77bfb68594f49e252ace2dd6b8c8e7ff Mon Sep 17 00:00:00 2001 +From: Felix Fietkau +Date: Thu, 16 Mar 2023 17:21:39 +0530 +Subject: [PATCH 063/281] OpenWrt: + 613-netfilter_optional_tcp_window_check.patch + +netfilter: optional tcp window check + +Signed-off-by: Felix Fietkau +Signed-off-by: Christian 'Ansuel' Marangi + +Change-Id: I6f7a23b89062cca58c87554e75ae32b0e2aa2831 +Signed-off-by: Ram Chandra Jangir +--- + include/net/netns/conntrack.h | 1 + + net/netfilter/nf_conntrack_proto_tcp.c | 9 ++++++++- + net/netfilter/nf_conntrack_standalone.c | 10 ++++++++++ + 3 files changed, 19 insertions(+), 1 deletion(-) + +diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h +index 1f463b3957c7..2af4f8d24282 100644 +--- a/include/net/netns/conntrack.h ++++ b/include/net/netns/conntrack.h +@@ -26,6 +26,7 @@ struct nf_tcp_net { + unsigned int timeouts[TCP_CONNTRACK_TIMEOUT_MAX]; + u8 tcp_loose; + u8 tcp_be_liberal; ++ u8 tcp_no_window_check; + u8 tcp_max_retrans; + u8 tcp_ignore_invalid_rst; + #if IS_ENABLED(CONFIG_NF_FLOW_TABLE) +diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c +index 3ac1af6f59fc..0a2badd52b54 100644 +--- a/net/netfilter/nf_conntrack_proto_tcp.c ++++ b/net/netfilter/nf_conntrack_proto_tcp.c +@@ -513,11 +513,15 @@ tcp_in_window(struct nf_conn *ct, enum ip_conntrack_dir dir, + struct ip_ct_tcp *state = &ct->proto.tcp; + struct ip_ct_tcp_state *sender = &state->seen[dir]; + struct ip_ct_tcp_state *receiver = &state->seen[!dir]; ++ const struct nf_tcp_net *tn = nf_tcp_pernet(nf_ct_net(ct)); + __u32 seq, ack, sack, end, win, swin; + bool in_recv_win, seq_ok; + s32 receiver_offset; + u16 win_raw; + ++ if (tn->tcp_no_window_check) ++ return NFCT_TCP_ACCEPT; ++ + /* + * Get the required data from the packet. + */ +@@ -1257,7 +1261,7 @@ int nf_conntrack_tcp_packet(struct nf_conn *ct, + IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED && + timeouts[new_state] > timeouts[TCP_CONNTRACK_UNACK]) + timeout = timeouts[TCP_CONNTRACK_UNACK]; +- else if (ct->proto.tcp.last_win == 0 && ++ else if (!tn->tcp_no_window_check && ct->proto.tcp.last_win == 0 && + timeouts[new_state] > timeouts[TCP_CONNTRACK_RETRANS]) + timeout = timeouts[TCP_CONNTRACK_RETRANS]; + else +@@ -1573,6 +1577,9 @@ void nf_conntrack_tcp_init_net(struct net *net) + */ + tn->tcp_be_liberal = 0; + ++ /* Skip Windows Check */ ++ tn->tcp_no_window_check = 0; ++ + /* If it's non-zero, we turn off RST sequence number check */ + tn->tcp_ignore_invalid_rst = 0; + +diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c +index e9654169b005..84b8e28f0782 100644 +--- a/net/netfilter/nf_conntrack_standalone.c ++++ b/net/netfilter/nf_conntrack_standalone.c +@@ -637,6 +637,7 @@ enum nf_ct_sysctl_index { + #endif + NF_SYSCTL_CT_PROTO_TCP_LOOSE, + NF_SYSCTL_CT_PROTO_TCP_LIBERAL, ++ NF_SYSCTL_CT_PROTO_TCP_NO_WINDOW_CHECK, + NF_SYSCTL_CT_PROTO_TCP_IGNORE_INVALID_RST, + NF_SYSCTL_CT_PROTO_TCP_MAX_RETRANS, + NF_SYSCTL_CT_PROTO_TIMEOUT_UDP, +@@ -844,6 +845,14 @@ static struct ctl_table nf_ct_sysctl_table[] = { + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE, + }, ++ [NF_SYSCTL_CT_PROTO_TCP_NO_WINDOW_CHECK] = { ++ .procname = "nf_conntrack_tcp_no_window_check", ++ .maxlen = sizeof(u8), ++ .mode = 0644, ++ .proc_handler = proc_dou8vec_minmax, ++ .extra1 = SYSCTL_ZERO, ++ .extra2 = SYSCTL_ONE, ++ }, + [NF_SYSCTL_CT_PROTO_TCP_IGNORE_INVALID_RST] = { + .procname = "nf_conntrack_tcp_ignore_invalid_rst", + .maxlen = sizeof(u8), +@@ -1054,6 +1063,7 @@ static void nf_conntrack_standalone_init_tcp_sysctl(struct net *net, + + XASSIGN(LOOSE, &tn->tcp_loose); + XASSIGN(LIBERAL, &tn->tcp_be_liberal); ++ XASSIGN(NO_WINDOW_CHECK, &tn->tcp_no_window_check); + XASSIGN(MAX_RETRANS, &tn->tcp_max_retrans); + XASSIGN(IGNORE_INVALID_RST, &tn->tcp_ignore_invalid_rst); + #undef XASSIGN +-- +2.17.1 + diff --git a/target/linux/qualcommax/patches-6.6/9990-1-qca-skb_recycler-support.patch b/target/linux/qualcommax/patches-6.6/9990-1-qca-skb_recycler-support.patch new file mode 100644 index 00000000000..b44f50e1921 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/9990-1-qca-skb_recycler-support.patch @@ -0,0 +1,431 @@ +--- a/include/linux/cpuhotplug.h ++++ b/include/linux/cpuhotplug.h +@@ -94,6 +94,7 @@ enum cpuhp_state { + CPUHP_RADIX_DEAD, + CPUHP_PAGE_ALLOC, + CPUHP_NET_DEV_DEAD, ++ CPUHP_SKB_RECYCLER_DEAD, + CPUHP_PCI_XGENE_DEAD, + CPUHP_IOMMU_IOVA_DEAD, + CPUHP_LUSTRE_CFS_DEAD, +--- a/include/linux/skbuff.h ++++ b/include/linux/skbuff.h +@@ -1059,6 +1059,10 @@ struct sk_buff { + /* only useable after checking ->active_extensions != 0 */ + struct skb_ext *extensions; + #endif ++ ++#ifdef CONFIG_DEBUG_OBJECTS_SKBUFF ++ void *free_addr; ++#endif + }; + + /* if you move pkt_type around you also must adapt those constants */ +@@ -1244,7 +1248,7 @@ static inline void kfree_skb_list(struct + kfree_skb_list_reason(segs, SKB_DROP_REASON_NOT_SPECIFIED); + } + +-#ifdef CONFIG_TRACEPOINTS ++#ifdef CONFIG_SKB_RECYCLER + void consume_skb(struct sk_buff *skb); + #else + static inline void consume_skb(struct sk_buff *skb) +@@ -1256,6 +1260,9 @@ static inline void consume_skb(struct sk + void __consume_stateless_skb(struct sk_buff *skb); + void __kfree_skb(struct sk_buff *skb); + extern struct kmem_cache *skbuff_cache; ++extern void kfree_skbmem(struct sk_buff *skb); ++extern void skb_release_data(struct sk_buff *skb, enum skb_drop_reason reason, ++ bool napi_safe); + + void kfree_skb_partial(struct sk_buff *skb, bool head_stolen); + bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from, +--- a/net/Kconfig ++++ b/net/Kconfig +@@ -369,6 +369,52 @@ config NET_FLOW_LIMIT + with many clients some protection against DoS by a single (spoofed) + flow that greatly exceeds average workload. + ++config SKB_RECYCLER ++ bool "Generic skb recycling" ++ default y ++ help ++ SKB_RECYCLER is used to implement RX-to-RX skb recycling. ++ This config enables the recycling scheme for bridging and ++ routing workloads. It can reduce skbuff freeing or ++ reallocation overhead. ++ ++config SKB_RECYCLER_MULTI_CPU ++ bool "Cross-CPU recycling for CPU-locked workloads" ++ depends on SMP && SKB_RECYCLER ++ default n ++ ++config SKB_RECYCLER_PREALLOC ++ bool "Enable preallocation of SKBs" ++ depends on SKB_RECYCLER ++ default n ++ help ++ Preallocates SKBs in recycling lists and the number of ++ SKBs are configured through CONFIG_SKB_RECYCLE_MAX_PREALLOC_SKBS. ++ This needs SKB_RECYCLER to be enabled. ++ The number of preallocated SKBs can be passed using ++ SKB_RECYCLE_MAX_PREALLOC_SKBS. ++ ++config SKB_RECYCLE_MAX_PREALLOC_SKBS ++ int "Number of SKBs to be preallocated" ++ depends on SKB_RECYCLER_PREALLOC ++ default 16384 ++ help ++ Number of SKBs each of 4K size to be preallocated for recycling ++ ++config SKB_RECYCLE_SIZE ++ int "Minimum size for a recycled buffer" ++ depends on SKB_RECYCLER ++ default 2304 ++ help ++ Minimum size for a recycled buffer ++ ++config ALLOC_SKB_PAGE_FRAG_DISABLE ++ bool "Disable page fragment based skbuff payload allocations" ++ depends on !SKB_RECYCLER ++ default n ++ help ++ Disable page fragment based allocations for skbuff payloads. ++ + menu "Network testing" + + config NET_PKTGEN +--- a/net/core/Makefile ++++ b/net/core/Makefile +@@ -41,3 +41,4 @@ obj-$(CONFIG_NET_SOCK_MSG) += skmsg.o + obj-$(CONFIG_BPF_SYSCALL) += sock_map.o + obj-$(CONFIG_BPF_SYSCALL) += bpf_sk_storage.o + obj-$(CONFIG_OF) += of_net.o ++obj-$(CONFIG_SKB_RECYCLER) += skbuff_recycle.o +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -6043,10 +6043,16 @@ static int process_backlog(struct napi_s + + napi->weight = READ_ONCE(dev_rx_weight); + while (again) { +- struct sk_buff *skb; ++ struct sk_buff *skb, *next_skb; + + while ((skb = __skb_dequeue(&sd->process_queue))) { + rcu_read_lock(); ++ ++ next_skb = skb_peek(&sd->process_queue); ++ if (likely(next_skb)) { ++ prefetch(next_skb->data); ++ } ++ + __netif_receive_skb(skb); + rcu_read_unlock(); + input_queue_head_incr(sd); +--- a/net/core/skbuff.c ++++ b/net/core/skbuff.c +@@ -87,6 +87,38 @@ + + #include "dev.h" + #include "sock_destructor.h" ++#include "skbuff_recycle.h" ++ ++struct kmem_cache *skb_data_cache; ++struct kmem_cache *skb_data_cache_2100; ++/* ++ * For low memory profile, NSS_SKB_FIXED_SIZE_2K is enabled and ++ * CONFIG_SKB_RECYCLER is disabled. For premium and enterprise profile ++ * CONFIG_SKB_RECYCLER is enabled and NSS_SKB_FIXED_SIZE_2K is disabled. ++ * Irrespective of NSS_SKB_FIXED_SIZE_2K enabled/disabled, the ++ * CONFIG_SKB_RECYCLER and __LP64__ determines the value of SKB_DATA_CACHE_SIZE ++ */ ++#if defined(CONFIG_SKB_RECYCLER) ++/* ++ * Both caches are kept same size when recycler is enabled so that all the ++ * skbs could be recycled. 2688 for 64bit arch, 2624 for 32bit arch ++ */ ++#define SKB_DATA_CACHE_SIZE (SKB_DATA_ALIGN(SKB_RECYCLE_SIZE + NET_SKB_PAD) + SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) ++#define SKB_DATA_CACHE_SIZE_2100 SKB_DATA_CACHE_SIZE ++#else ++/* ++ * DATA CACHE is 2368 for 64bit arch, 2176 for 32bit arch ++ * DATA_CACHE_2100 is 2496 for 64bit arch, 2432 for 32bit arch ++ * DATA CACHE size should always be lesser than that of DATA_CACHE_2100 size ++ */ ++#if defined(__LP64__) ++#define SKB_DATA_CACHE_SIZE (SKB_DATA_ALIGN(1984 + NET_SKB_PAD) + SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) ++#define SKB_DATA_CACHE_SIZE_2100 (SKB_DATA_ALIGN(2100 + NET_SKB_PAD) + SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) ++#else ++#define SKB_DATA_CACHE_SIZE (SKB_DATA_ALIGN(1856 + NET_SKB_PAD) + SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) ++#define SKB_DATA_CACHE_SIZE_2100 (SKB_DATA_ALIGN(2100 + NET_SKB_PAD) + SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) ++#endif ++#endif + + struct kmem_cache *skbuff_cache __ro_after_init; + static struct kmem_cache *skbuff_fclone_cache __ro_after_init; +@@ -551,21 +583,31 @@ static void *kmalloc_reserve(unsigned in + bool *pfmemalloc) + { + bool ret_pfmemalloc = false; +- size_t obj_size; ++ unsigned int obj_size = *size; + void *obj; + + obj_size = SKB_HEAD_ALIGN(*size); +- if (obj_size <= SKB_SMALL_HEAD_CACHE_SIZE && +- !(flags & KMALLOC_NOT_NORMAL_BITS)) { +- obj = kmem_cache_alloc_node(skb_small_head_cache, +- flags | __GFP_NOMEMALLOC | __GFP_NOWARN, +- node); +- *size = SKB_SMALL_HEAD_CACHE_SIZE; ++ if (obj_size > SZ_2K && obj_size <= SKB_DATA_CACHE_SIZE) { ++ obj = kmem_cache_alloc_node(skb_data_cache, ++ flags | __GFP_NOMEMALLOC | __GFP_NOWARN, ++ node); ++ *size = SKB_DATA_CACHE_SIZE; ++ if (obj || !(gfp_pfmemalloc_allowed(flags))) ++ goto out; ++ /* Try again but now we are using pfmemalloc reserves */ ++ ret_pfmemalloc = true; ++ obj = kmem_cache_alloc_node(skb_data_cache, flags, node); ++ goto out; ++ } else if (obj_size > SZ_2K && obj_size <= SKB_DATA_CACHE_SIZE_2100) { ++ obj = kmem_cache_alloc_node(skb_data_cache_2100, ++ flags | __GFP_NOMEMALLOC | __GFP_NOWARN, ++ node); ++ *size = SKB_DATA_CACHE_SIZE_2100; + if (obj || !(gfp_pfmemalloc_allowed(flags))) + goto out; + /* Try again but now we are using pfmemalloc reserves */ + ret_pfmemalloc = true; +- obj = kmem_cache_alloc_node(skb_small_head_cache, flags, node); ++ obj = kmem_cache_alloc_node(skb_data_cache_2100, flags, node); + goto out; + } + +@@ -648,10 +690,12 @@ struct sk_buff *__alloc_skb(unsigned int + * aligned memory blocks, unless SLUB/SLAB debug is enabled. + * Both skb->head and skb_shared_info are cache line aligned. + */ ++ size = SKB_DATA_ALIGN(size); ++ size += SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); + data = kmalloc_reserve(&size, gfp_mask, node, &pfmemalloc); + if (unlikely(!data)) + goto nodata; +- /* kmalloc_size_roundup() might give us more room than requested. ++ /* kmalloc_reserve(size) might give us more room than requested. + * Put skb_shared_info exactly at the end of allocated zone, + * to allow max possible filling before reallocation. + */ +@@ -686,7 +730,7 @@ EXPORT_SYMBOL(__alloc_skb); + /** + * __netdev_alloc_skb - allocate an skbuff for rx on a specific device + * @dev: network device to receive on +- * @len: length to allocate ++ * @length: length to allocate + * @gfp_mask: get_free_pages mask, passed to alloc_skb + * + * Allocate a new &sk_buff and assign it a usage count of one. The +@@ -696,29 +740,53 @@ EXPORT_SYMBOL(__alloc_skb); + * + * %NULL is returned if there is no free memory. + */ +-struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int len, +- gfp_t gfp_mask) ++struct sk_buff *__netdev_alloc_skb(struct net_device *dev, ++ unsigned int length, gfp_t gfp_mask) + { +- struct page_frag_cache *nc; + struct sk_buff *skb; ++ unsigned int len = length; ++ ++#ifdef CONFIG_SKB_RECYCLER ++ skb = skb_recycler_alloc(dev, length, true); ++ if (likely(skb)) ++ return skb; ++ ++ len = SKB_RECYCLE_SIZE; ++ if (unlikely(length > SKB_RECYCLE_SIZE)) ++ len = length; ++ ++ skb = __alloc_skb(len + NET_SKB_PAD, gfp_mask, ++ SKB_ALLOC_RX, NUMA_NO_NODE); ++ if (!skb) ++ goto skb_fail; ++ goto skb_success; ++#else ++ struct page_frag_cache *nc; + bool pfmemalloc; ++ bool page_frag_alloc_enable = true; + void *data; + + len += NET_SKB_PAD; + ++ ++#ifdef CONFIG_ALLOC_SKB_PAGE_FRAG_DISABLE ++ page_frag_alloc_enable = false; ++#endif + /* If requested length is either too small or too big, + * we use kmalloc() for skb->head allocation. + */ + if (len <= SKB_WITH_OVERHEAD(1024) || + len > SKB_WITH_OVERHEAD(PAGE_SIZE) || +- (gfp_mask & (__GFP_DIRECT_RECLAIM | GFP_DMA))) { ++ (gfp_mask & (__GFP_DIRECT_RECLAIM | GFP_DMA)) || ++ !page_frag_alloc_enable) { + skb = __alloc_skb(len, gfp_mask, SKB_ALLOC_RX, NUMA_NO_NODE); + if (!skb) + goto skb_fail; + goto skb_success; + } + +- len = SKB_HEAD_ALIGN(len); ++ len += SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); ++ len = SKB_DATA_ALIGN(len); + + if (sk_memalloc_socks()) + gfp_mask |= __GFP_MEMALLOC; +@@ -747,6 +815,7 @@ struct sk_buff *__netdev_alloc_skb(struc + if (pfmemalloc) + skb->pfmemalloc = 1; + skb->head_frag = 1; ++#endif + + skb_success: + skb_reserve(skb, NET_SKB_PAD); +@@ -817,7 +886,8 @@ struct sk_buff *__napi_alloc_skb(struct + data = page_frag_alloc_1k(&nc->page_small, gfp_mask); + pfmemalloc = NAPI_SMALL_PAGE_PFMEMALLOC(nc->page_small); + } else { +- len = SKB_HEAD_ALIGN(len); ++ len += SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); ++ len = SKB_DATA_ALIGN(len); + + data = page_frag_alloc(&nc->page, len, gfp_mask); + pfmemalloc = nc->page.pfmemalloc; +@@ -975,7 +1045,7 @@ static void skb_free_head(struct sk_buff + } + } + +-static void skb_release_data(struct sk_buff *skb, enum skb_drop_reason reason, ++void skb_release_data(struct sk_buff *skb, enum skb_drop_reason reason, + bool napi_safe) + { + struct skb_shared_info *shinfo = skb_shinfo(skb); +@@ -1018,7 +1088,7 @@ exit: + /* + * Free an skbuff by memory without cleaning the state. + */ +-static void kfree_skbmem(struct sk_buff *skb) ++void kfree_skbmem(struct sk_buff *skb) + { + struct sk_buff_fclones *fclones; + +@@ -1282,7 +1352,6 @@ void skb_tx_error(struct sk_buff *skb) + } + EXPORT_SYMBOL(skb_tx_error); + +-#ifdef CONFIG_TRACEPOINTS + /** + * consume_skb - free an skbuff + * @skb: buffer to free +@@ -1291,13 +1360,48 @@ EXPORT_SYMBOL(skb_tx_error); + * Functions identically to kfree_skb, but kfree_skb assumes that the frame + * is being dropped after a failure and notes that + */ ++#ifdef CONFIG_SKB_RECYCLER + void consume_skb(struct sk_buff *skb) + { + if (!skb_unref(skb)) + return; ++ prefetch(&skb->destructor); ++ ++ /*Tian: Not sure if we need to continue using this since ++ * since unref does the work in 5.4 ++ */ ++ ++ /* ++ if (likely(atomic_read(&skb->users) == 1)) ++ smp_rmb(); ++ else if (likely(!atomic_dec_and_test(&skb->users))) ++ return; ++ */ ++ ++ /* If possible we'd like to recycle any skb rather than just free it, ++ * but in order to do that we need to release any head state too. ++ * We don't want to do this later because we'll be in a pre-emption ++ * disabled state. ++ */ ++ skb_release_head_state(skb); ++ ++ /* Can we recycle this skb? If we can then it will be much faster ++ * for us to recycle this one later than to allocate a new one ++ * from scratch. ++ */ ++ if (likely(skb->head) && likely(skb_recycler_consume(skb))) ++ return; + ++#ifdef CONFIG_TRACEPOINTS + trace_consume_skb(skb, __builtin_return_address(0)); +- __kfree_skb(skb); ++#endif ++ /* We're not recycling so now we need to do the rest of what we would ++ * have done in __kfree_skb (above and beyond the skb_release_head_state ++ * that we already did). ++ */ ++ if (likely(skb->head)) ++ skb_release_data(skb, SKB_CONSUMED, false); ++ kfree_skbmem(skb); + } + EXPORT_SYMBOL(consume_skb); + #endif +@@ -2112,6 +2216,8 @@ int pskb_expand_head(struct sk_buff *skb + + if (skb_pfmemalloc(skb)) + gfp_mask |= __GFP_MEMALLOC; ++ size = SKB_DATA_ALIGN(size); ++ size += SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); + + data = kmalloc_reserve(&size, gfp_mask, NUMA_NO_NODE, NULL); + if (!data) +@@ -4865,6 +4971,14 @@ static void skb_extensions_init(void) {} + + void __init skb_init(void) + { ++ skb_data_cache = kmem_cache_create_usercopy("skb_data_cache", ++ SKB_DATA_CACHE_SIZE, ++ 0, SLAB_PANIC, 0, SKB_DATA_CACHE_SIZE, ++ NULL); ++ skb_data_cache_2100 = kmem_cache_create_usercopy("skb_data_cache_2100", ++ SKB_DATA_CACHE_SIZE_2100, ++ 0, SLAB_PANIC, 0, SKB_DATA_CACHE_SIZE, ++ NULL); + skbuff_cache = kmem_cache_create_usercopy("skbuff_head_cache", + sizeof(struct sk_buff), + 0, +@@ -4890,6 +5004,7 @@ void __init skb_init(void) + SKB_SMALL_HEAD_HEADROOM, + NULL); + skb_extensions_init(); ++ skb_recycler_init(); + } + + static int +@@ -6393,6 +6508,8 @@ static int pskb_carve_inside_header(stru + if (skb_pfmemalloc(skb)) + gfp_mask |= __GFP_MEMALLOC; + ++ size = SKB_DATA_ALIGN(size); ++ size += SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); + data = kmalloc_reserve(&size, gfp_mask, NUMA_NO_NODE, NULL); + if (!data) + return -ENOMEM; +@@ -6509,6 +6626,8 @@ static int pskb_carve_inside_nonlinear(s + if (skb_pfmemalloc(skb)) + gfp_mask |= __GFP_MEMALLOC; + ++ size = SKB_DATA_ALIGN(size); ++ size += SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); + data = kmalloc_reserve(&size, gfp_mask, NUMA_NO_NODE, NULL); + if (!data) + return -ENOMEM; diff --git a/target/linux/qualcommax/patches-6.6/9999-revert-crypto-api-disallow-identical-driver-names.patch b/target/linux/qualcommax/patches-6.6/9999-revert-crypto-api-disallow-identical-driver-names.patch new file mode 100644 index 00000000000..3f7f58dfee5 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/9999-revert-crypto-api-disallow-identical-driver-names.patch @@ -0,0 +1,10 @@ +--- a/crypto/algapi.c ++++ b/crypto/algapi.c +@@ -341,7 +341,6 @@ __crypto_register_alg(struct crypto_alg + } + + if (!strcmp(q->cra_driver_name, alg->cra_name) || +- !strcmp(q->cra_driver_name, alg->cra_driver_name) || + !strcmp(q->cra_name, alg->cra_driver_name)) + goto err; + } diff --git a/target/linux/ramips/dts/mt7620a_tplink_re2x0-v1.dtsi b/target/linux/ramips/dts/mt7620a_tplink_re2x0-v1.dtsi index 5f06dd42088..371b9f73737 100644 --- a/target/linux/ramips/dts/mt7620a_tplink_re2x0-v1.dtsi +++ b/target/linux/ramips/dts/mt7620a_tplink_re2x0-v1.dtsi @@ -4,6 +4,7 @@ #include #include +#include / { aliases { @@ -63,9 +64,11 @@ }; partition@20000 { - compatible = "tplink,firmware"; + compatible = "openwrt,uimage", "denx,uimage"; label = "firmware"; reg = <0x20000 0x7c0000>; + openwrt,offset = <0x1000>; + openwrt,ih-magic = ; }; partition@7e0000 { diff --git a/target/linux/ramips/dts/mt7621_mikrotik.dtsi b/target/linux/ramips/dts/mt7621_mikrotik.dtsi index ace194c6d60..67892cc1a02 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik.dtsi +++ b/target/linux/ramips/dts/mt7621_mikrotik.dtsi @@ -49,6 +49,14 @@ hard_config { read-only; + + nvmem-layout { + compatible = "mikrotik,routerboot-nvmem"; + + macaddr_hard: base-mac-address { + #nvmem-cell-cells = <1>; + }; + }; }; partition@10000 { diff --git a/target/linux/ramips/dts/mt7621_mikrotik_ltap-2hnd.dts b/target/linux/ramips/dts/mt7621_mikrotik_ltap-2hnd.dts index b5e38071f14..a3e3d8f4ce2 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik_ltap-2hnd.dts +++ b/target/linux/ramips/dts/mt7621_mikrotik_ltap-2hnd.dts @@ -11,6 +11,7 @@ led-failsafe = &led_usr; led-running = &led_usr; led-upgrade = &led_usr; + label-mac-device = ðernet; }; ath9k-leds { @@ -128,6 +129,9 @@ ðernet { pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; + + nvmem-cells = <&macaddr_hard 0>; + nvmem-cell-names = "mac-address"; }; &switch0 { @@ -146,6 +150,8 @@ compatible = "pci168c,0030"; reg = <0x0000 0 0 0 0>; qca,no-eeprom; + nvmem-cells = <&macaddr_hard 1>; + nvmem-cell-names = "mac-address"; gpio-controller; #gpio-cells = <2>; }; diff --git a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-750gr3.dts b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-750gr3.dts index faa4e53f097..6357dceb6d4 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-750gr3.dts +++ b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-750gr3.dts @@ -11,6 +11,7 @@ led-failsafe = &led_usr; led-running = &led_usr; led-upgrade = &led_usr; + label-mac-device = &gmac1; }; leds { @@ -40,6 +41,9 @@ status = "okay"; label = "wan"; phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_hard 0>; + nvmem-cell-names = "mac-address"; }; ðphy0 { diff --git a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-760igs.dts b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-760igs.dts index 8b88cfe0a31..c9d07cf96cc 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-760igs.dts +++ b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-760igs.dts @@ -11,6 +11,7 @@ led-failsafe = &led_pwr; led-running = &led_pwr; led-upgrade = &led_pwr; + label-mac-device = &port0; }; leds { @@ -51,6 +52,9 @@ label = "sfp"; phy-mode = "rgmii-rxid"; phy-handle = <&ephy7>; + + nvmem-cells = <&macaddr_hard 5>; + nvmem-cell-names = "mac-address"; }; &i2c { diff --git a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-7xx.dtsi b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-7xx.dtsi index b8fae51c3b3..cdca47f8b8c 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-7xx.dtsi +++ b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-7xx.dtsi @@ -40,29 +40,44 @@ &switch0 { ports { - port@0 { + port0: port@0 { status = "okay"; label = "wan"; + + nvmem-cells = <&macaddr_hard 0>; + nvmem-cell-names = "mac-address"; }; port@1 { status = "okay"; label = "lan2"; + + nvmem-cells = <&macaddr_hard 1>; + nvmem-cell-names = "mac-address"; }; port@2 { status = "okay"; label = "lan3"; + + nvmem-cells = <&macaddr_hard 2>; + nvmem-cell-names = "mac-address"; }; port@3 { status = "okay"; label = "lan4"; + + nvmem-cells = <&macaddr_hard 3>; + nvmem-cell-names = "mac-address"; }; port@4 { status = "okay"; label = "lan5"; + + nvmem-cells = <&macaddr_hard 4>; + nvmem-cell-names = "mac-address"; }; }; }; diff --git a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m11g.dts b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m11g.dts index 5f9ee90e7cc..89ef5fb3fd6 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m11g.dts +++ b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m11g.dts @@ -9,6 +9,7 @@ led-failsafe = &led_usr; led-running = &led_usr; led-upgrade = &led_usr; + label-mac-device = ðernet; }; leds { @@ -68,6 +69,9 @@ ðernet { pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; + + nvmem-cells = <&macaddr_hard 0>; + nvmem-cell-names = "mac-address"; }; &switch0 { @@ -75,6 +79,9 @@ port@0 { status = "okay"; label = "lan"; + + nvmem-cells = <&macaddr_hard 1>; + nvmem-cell-names = "mac-address"; }; }; }; diff --git a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m33g.dts b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m33g.dts index 5e762615292..e26d3cee2e9 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m33g.dts +++ b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m33g.dts @@ -9,6 +9,7 @@ led-failsafe = &led_usr; led-running = &led_usr; led-upgrade = &led_usr; + label-mac-device = &gmac1; }; leds { @@ -94,6 +95,9 @@ status = "okay"; label = "wan"; phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_hard 0>; + nvmem-cell-names = "mac-address"; }; ðphy0 { @@ -105,11 +109,17 @@ port@1 { status = "okay"; label = "lan1"; + + nvmem-cells = <&macaddr_hard 1>; + nvmem-cell-names = "mac-address"; }; port@2 { status = "okay"; label = "lan2"; + + nvmem-cells = <&macaddr_hard 2>; + nvmem-cell-names = "mac-address"; }; }; }; diff --git a/target/linux/ramips/dts/mt7621_tplink_er605-v2.dts b/target/linux/ramips/dts/mt7621_tplink_er605-v2.dts index 28c8e8b0832..3d92e343f1f 100644 --- a/target/linux/ramips/dts/mt7621_tplink_er605-v2.dts +++ b/target/linux/ramips/dts/mt7621_tplink_er605-v2.dts @@ -30,13 +30,13 @@ led_usb: usb { color = ; - function = LED_FUNCTION_STATUS; + function = LED_FUNCTION_USB; gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; }; led_power: power { color = ; - function = LED_FUNCTION_STATUS; + function = LED_FUNCTION_POWER; gpios = <&gpio 12 GPIO_ACTIVE_LOW>; default-state = "on"; }; diff --git a/target/linux/ramips/image/common-tp-link.mk b/target/linux/ramips/image/common-tp-link.mk index cb262759605..665b8f7971c 100644 --- a/target/linux/ramips/image/common-tp-link.mk +++ b/target/linux/ramips/image/common-tp-link.mk @@ -1,6 +1,19 @@ DEVICE_VARS += TPLINK_FLASHLAYOUT TPLINK_HWID TPLINK_HWREV TPLINK_HWREVADD DEVICE_VARS += TPLINK_HVERSION TPLINK_BOARD_ID TPLINK_HEADER_VERSION +define Build/tplink-v1-okli-image + cp $(IMAGE_KERNEL) $(IMAGE_ROOTFS).$(word 2,$(1)) + cat $(IMAGE_ROOTFS) >> $(IMAGE_ROOTFS).$(word 2,$(1)) + -$(STAGING_DIR_HOST)/bin/mktplinkfw \ + -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F $(TPLINK_FLASHLAYOUT) \ + -N "$(VERSION_DIST)" -V $(REVISION) -m $(TPLINK_HEADER_VERSION) \ + -k "$(KDIR)/loader-$(word 1,$(1)).$(LOADER_TYPE)" -E $(KERNEL_LOADADDR) \ + -r $(IMAGE_ROOTFS).$(word 2,$(1)) -o $@.new -j -X 0x40000 \ + -a $(call rootfs_align,$(FILESYSTEM)) $(wordlist 3,$(words $(1)),$(1)) \ + $(if $(findstring sysupgrade,$(word 2,$(1))),-s) && mv $@.new $@ || rm -f $@ + rm -f $(IMAGE_ROOTFS).$(word 2,$(1)) +endef + define Build/uImage-tplink-c9 mkimage \ -A $(LINUX_KARCH) \ @@ -28,6 +41,18 @@ define Device/tplink-v1 append-metadata endef +define Device/tplink-v1-okli + $(Device/tplink-v1) + LOADER_TYPE := bin + LOADER_FLASH_OFFS := 0x21000 + COMPILE := loader-$(1).bin + COMPILE/loader-$(1).bin := loader-okli-compile | pad-to 64k | lzma | pad-to 3584 + KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49 + IMAGE/factory.bin := tplink-v1-okli-image $(1) factory -e -O + IMAGE/sysupgrade.bin := tplink-v1-okli-image $(1) sysupgrade -e -O | check-size | \ + append-metadata +endef + define Device/tplink-v2 DEVICE_VENDOR := TP-Link TPLINK_FLASHLAYOUT := diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index 9f3a8dce0e3..6cf65ad1194 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -1290,7 +1290,7 @@ endef TARGET_DEVICES += tplink_ec220-g5-v2 define Device/tplink_re200-v1 - $(Device/tplink-v1) + $(Device/tplink-v1-okli) SOC := mt7620a DEVICE_MODEL := RE200 DEVICE_VARIANT := v1 @@ -1302,7 +1302,7 @@ endef TARGET_DEVICES += tplink_re200-v1 define Device/tplink_re210-v1 - $(Device/tplink-v1) + $(Device/tplink-v1-okli) SOC := mt7620a DEVICE_MODEL := RE210 DEVICE_VARIANT := v1 diff --git a/target/linux/ramips/mt7620/config-6.6 b/target/linux/ramips/mt7620/config-6.6 index 20bba0c5a47..606fc51eefc 100644 --- a/target/linux/ramips/mt7620/config-6.6 +++ b/target/linux/ramips/mt7620/config-6.6 @@ -102,6 +102,7 @@ CONFIG_IRQ_INTC=y CONFIG_IRQ_MIPS_CPU=y CONFIG_IRQ_WORK=y CONFIG_LIBFDT=y +# CONFIG_LIST_HARDENED is not set CONFIG_LOCK_DEBUGGING_SUPPORT=y CONFIG_MARVELL_PHY=y CONFIG_MDIO_BUS=y diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 12098f0bbfa..471f9ecfbda 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -299,10 +299,6 @@ ramips_setup_macs() wan_mac=$(mtd_get_mac_ascii Config wan_hwaddr) label_mac=$lan_mac ;; - mikrotik,ltap-2hnd) - label_mac=$(cat "/sys/firmware/mikrotik/hard_config/mac_base") - lan_mac=$label_mac - ;; tplink,er605-v2) CI_UBIPART="firmware" label_mac=$(mtd_get_mac_uci_config_ubi "tddp") @@ -314,14 +310,6 @@ ramips_setup_macs() wwan_mac=$(macaddr_add $label_mac 1) ucidef_set_interface "wwan0" device "/dev/cdc-wdm0" protocol "qmi" macaddr "$wwan_mac" ;; - mikrotik,routerboard-750gr3|\ - mikrotik,routerboard-760igs|\ - mikrotik,routerboard-m11g|\ - mikrotik,routerboard-m33g) - label_mac=$(cat "/sys/firmware/mikrotik/hard_config/mac_base") - wan_mac=$label_mac - lan_mac=$(macaddr_add $label_mac 1) - ;; ruijie,rg-ew1200g-pro-v1.1) lan_mac=$(mtd_get_mac_ascii product_info ethaddr) wan_mac=$(macaddr_add "$lan_mac" 8) diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index 0bf5e85cd01..a334d1a5a08 100644 --- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -4,26 +4,13 @@ . /lib/functions/caldata.sh -caldata_mikrotik_ath9k() { - local offset=$(($1)) - local count=$(($2)) - local macaddr=$3 - local wlan_data="/sys/firmware/mikrotik/hard_config/wlan_data" - - caldata_from_file $wlan_data $offset $count /tmp/$FIRMWARE - ath9k_patch_mac "$macaddr" /tmp/$FIRMWARE - caldata_sysfsload_from_file /tmp/$FIRMWARE 0x0 $count - rm -f /tmp/$FIRMWARE -} - board=$(board_name) case "$FIRMWARE" in "ath9k-eeprom-pci-0000:01:00.0.bin") case $board in mikrotik,ltap-2hnd) - mac_base="$(cat /sys/firmware/mikrotik/hard_config/mac_base)" - caldata_mikrotik_ath9k 0x5000 0x440 $(macaddr_add "$mac_base" 1) + caldata_sysfsload_from_file "/sys/firmware/mikrotik/hard_config/wlan_data" 0x5000 0x440 ;; *) caldata_die "board $board is not supported yet" diff --git a/target/linux/ramips/mt7621/config-6.6 b/target/linux/ramips/mt7621/config-6.6 index 609e520c62a..5e10f03ac18 100644 --- a/target/linux/ramips/mt7621/config-6.6 +++ b/target/linux/ramips/mt7621/config-6.6 @@ -128,6 +128,7 @@ CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y CONFIG_MIKROTIK=y CONFIG_MIKROTIK_RB_SYSFS=y +# CONFIG_MIKROTIK_WLAN_DECOMPRESS_LZ77 is not set CONFIG_MIPS=y CONFIG_MIPS_ASID_BITS=8 CONFIG_MIPS_ASID_SHIFT=0 @@ -201,7 +202,7 @@ CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=4 CONFIG_NVMEM=y CONFIG_NVMEM_LAYOUTS=y -# CONFIG_NVMEM_LAYOUT_MIKROTIK is not set +CONFIG_NVMEM_LAYOUT_MIKROTIK=y CONFIG_NVMEM_LAYOUT_U_BOOT_ENV=y CONFIG_OF=y CONFIG_OF_ADDRESS=y diff --git a/target/linux/ramips/patches-6.6/821-SPI-ralink-add-Ralink-SoC-spi-driver.patch b/target/linux/ramips/patches-6.6/821-SPI-ralink-add-Ralink-SoC-spi-driver.patch index 6760d9f56cf..318039fb4cd 100644 --- a/target/linux/ramips/patches-6.6/821-SPI-ralink-add-Ralink-SoC-spi-driver.patch +++ b/target/linux/ramips/patches-6.6/821-SPI-ralink-add-Ralink-SoC-spi-driver.patch @@ -41,7 +41,7 @@ Acked-by: John Crispin obj-$(CONFIG_SPI_SC18IS602) += spi-sc18is602.o --- /dev/null +++ b/drivers/spi/spi-rt2880.c -@@ -0,0 +1,535 @@ +@@ -0,0 +1,519 @@ +/* + * spi-rt2880.c -- Ralink RT288x/RT305x SPI controller driver + * @@ -66,7 +66,6 @@ Acked-by: John Crispin +#include +#include +#include -+#include + +#define DRIVER_NAME "spi-rt2880" + @@ -333,18 +332,6 @@ Acked-by: John Crispin + return err; +} + -+/* copy from spi.c */ -+static void spi_set_cs(struct spi_device *spi, bool enable) -+{ -+ if (spi->mode & SPI_CS_HIGH) -+ enable = !enable; -+ -+ if (spi->cs_gpiod) -+ gpiod_set_value(spi->cs_gpiod, !enable); -+ else if (spi->master->set_cs) -+ spi->master->set_cs(spi, !enable); -+} -+ +static int rt2880_spi_setup(struct spi_device *spi) +{ + struct spi_master *master = spi->master; @@ -401,9 +388,6 @@ Acked-by: John Crispin + if (reg != old_reg) + rt2880_spi_write(rs, arbit_off, reg); + -+ /* deselected the spi device */ -+ spi_set_cs(spi, false); -+ + rt2880_dump_reg(master); + + return 0; diff --git a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c index b17d9ae5d56..5468fc0653e 100644 --- a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c +++ b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c @@ -374,7 +374,7 @@ static int __init rtl83xx_mdio_probe(struct rtl838x_switch_priv *priv) /* Check for the integrated SerDes of the RTL8380M first */ if (of_property_read_bool(phy_node, "phy-is-integrated") && priv->id == 0x8380 && pn >= 24) { - pr_debug("----> FÓUND A SERDES\n"); + pr_debug("----> FOUND A SERDES\n"); priv->ports[pn].phy = PHY_RTL838X_SDS; continue; } diff --git a/target/linux/realtek/patches-6.6/706-include-linux-add-phy-ops-for-rtl838x.patch b/target/linux/realtek/patches-6.6/706-include-linux-add-phy-ops-for-rtl838x.patch index 2a799551d60..09255c57214 100644 --- a/target/linux/realtek/patches-6.6/706-include-linux-add-phy-ops-for-rtl838x.patch +++ b/target/linux/realtek/patches-6.6/706-include-linux-add-phy-ops-for-rtl838x.patch @@ -21,7 +21,7 @@ Submitted-by: John Crispin --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -1180,6 +1180,10 @@ struct phy_driver { +@@ -1181,6 +1181,10 @@ struct phy_driver { */ int (*led_polarity_set)(struct phy_device *dev, int index, unsigned long modes); diff --git a/target/linux/realtek/patches-6.6/708-drivers-net-phy-eee-support-for-rtl838x.patch b/target/linux/realtek/patches-6.6/708-drivers-net-phy-eee-support-for-rtl838x.patch index 305981c3eec..a92045ba8a7 100644 --- a/target/linux/realtek/patches-6.6/708-drivers-net-phy-eee-support-for-rtl838x.patch +++ b/target/linux/realtek/patches-6.6/708-drivers-net-phy-eee-support-for-rtl838x.patch @@ -21,7 +21,7 @@ Submitted-by: John Crispin --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -2484,6 +2484,11 @@ int phylink_ethtool_ksettings_set(struct +@@ -2503,6 +2503,11 @@ int phylink_ethtool_ksettings_set(struct * the presence of a PHY, this should not be changed as that * should be determined from the media side advertisement. */ @@ -33,7 +33,7 @@ Submitted-by: John Crispin return phy_ethtool_ksettings_set(pl->phydev, &phy_kset); } -@@ -2786,8 +2791,11 @@ int phylink_ethtool_get_eee(struct phyli +@@ -2805,8 +2810,11 @@ int phylink_ethtool_get_eee(struct phyli ASSERT_RTNL(); @@ -46,7 +46,7 @@ Submitted-by: John Crispin return ret; } -@@ -2804,8 +2812,11 @@ int phylink_ethtool_set_eee(struct phyli +@@ -2823,8 +2831,11 @@ int phylink_ethtool_set_eee(struct phyli ASSERT_RTNL(); diff --git a/target/linux/rockchip/armv8/config-6.6 b/target/linux/rockchip/armv8/config-6.6 index c92f2b1c480..fddc85f9d72 100644 --- a/target/linux/rockchip/armv8/config-6.6 +++ b/target/linux/rockchip/armv8/config-6.6 @@ -251,7 +251,6 @@ CONFIG_FANOTIFY=y CONFIG_FHANDLE=y CONFIG_FIXED_PHY=y CONFIG_FIX_EARLYCON_MEM=y -# CONFIG_FORTIFY_SOURCE is not set CONFIG_FRAME_POINTER=y CONFIG_FS_IOMAP=y CONFIG_FS_MBCACHE=y diff --git a/target/linux/sifiveu/patches-6.6/0005-riscv-sifive-unleashed-define-opp-table-cpufreq.patch b/target/linux/sifiveu/patches-6.6/0005-riscv-sifive-unleashed-define-opp-table-cpufreq.patch index 90dcb0e3e47..905e3cccb75 100644 --- a/target/linux/sifiveu/patches-6.6/0005-riscv-sifive-unleashed-define-opp-table-cpufreq.patch +++ b/target/linux/sifiveu/patches-6.6/0005-riscv-sifive-unleashed-define-opp-table-cpufreq.patch @@ -14,7 +14,7 @@ Signed-off-by: David Abdurachmanov --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig -@@ -897,6 +897,14 @@ config PORTABLE +@@ -901,6 +901,14 @@ config PORTABLE select MMU select OF diff --git a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch index 3f9499974cc..2554e731987 100644 --- a/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch +++ b/target/linux/starfive/patches-6.6/0109-usb-xhci-To-improve-performance-usb-using-lowmem-for.patch @@ -72,7 +72,7 @@ Signed-off-by: minda.chen if (xhci->dcbaa) dma_free_coherent(dev, sizeof(*xhci->dcbaa), xhci->dcbaa, xhci->dcbaa->dma); -@@ -2297,6 +2306,55 @@ xhci_add_interrupter(struct xhci_hcd *xh +@@ -2300,6 +2309,55 @@ xhci_add_interrupter(struct xhci_hcd *xh return 0; } @@ -128,7 +128,7 @@ Signed-off-by: minda.chen int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) { dma_addr_t dma; -@@ -2433,6 +2491,12 @@ int xhci_mem_init(struct xhci_hcd *xhci, +@@ -2436,6 +2494,12 @@ int xhci_mem_init(struct xhci_hcd *xhci, xhci->isoc_bei_interval = AVOID_BEI_INTERVAL_MAX; @@ -160,7 +160,7 @@ Signed-off-by: minda.chen } --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -3650,7 +3650,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3664,7 +3664,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd * full_len = urb->transfer_buffer_length; /* If we have scatter/gather list, we use it. */ @@ -263,7 +263,7 @@ Signed-off-by: minda.chen /** --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1763,6 +1763,13 @@ struct xhci_hub { +@@ -1764,6 +1764,13 @@ struct xhci_hub { u8 min_rev; }; @@ -277,16 +277,16 @@ Signed-off-by: minda.chen /* There is one xhci_hcd structure per controller */ struct xhci_hcd { struct usb_hcd *main_hcd; -@@ -1914,6 +1921,8 @@ struct xhci_hcd { - #define XHCI_ZHAOXIN_TRB_FETCH BIT_ULL(45) - #define XHCI_ZHAOXIN_HOST BIT_ULL(46) +@@ -1917,6 +1924,8 @@ struct xhci_hcd { + #define XHCI_WRITE_64_HI_LO BIT_ULL(47) + #define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48) +#define XHCI_LOCAL_BUFFER BIT_ULL(63) + unsigned int num_active_eps; unsigned int limit_active_eps; struct xhci_port *hw_ports; -@@ -1943,6 +1952,8 @@ struct xhci_hcd { +@@ -1946,6 +1955,8 @@ struct xhci_hcd { struct list_head regset_list; void *dbc; diff --git a/target/linux/starfive/patches-6.6/0110-usb-xhci-using-dma_alloc_noncoherent-to-alloc-low-me.patch b/target/linux/starfive/patches-6.6/0110-usb-xhci-using-dma_alloc_noncoherent-to-alloc-low-me.patch index 739bc76e718..a9c03feecf6 100644 --- a/target/linux/starfive/patches-6.6/0110-usb-xhci-using-dma_alloc_noncoherent-to-alloc-low-me.patch +++ b/target/linux/starfive/patches-6.6/0110-usb-xhci-using-dma_alloc_noncoherent-to-alloc-low-me.patch @@ -26,7 +26,7 @@ Signed-off-by: Minda Chen gen_pool_destroy(pool->pool); pool->pool = NULL; } -@@ -2317,15 +2318,15 @@ int xhci_setup_local_lowmem(struct xhci_ +@@ -2320,15 +2321,15 @@ int xhci_setup_local_lowmem(struct xhci_ if (!pool->pool) { /* minimal alloc one page */ pool->pool = gen_pool_create(PAGE_SHIFT, dev_to_node(hcd->self.sysdev)); @@ -48,7 +48,7 @@ Signed-off-by: Minda Chen goto destroy_pool; } -@@ -2335,11 +2336,11 @@ int xhci_setup_local_lowmem(struct xhci_ +@@ -2338,11 +2339,11 @@ int xhci_setup_local_lowmem(struct xhci_ * for it. */ err = gen_pool_add_virt(pool->pool, (unsigned long)buffer, @@ -62,7 +62,7 @@ Signed-off-by: Minda Chen goto destroy_pool; } -@@ -2362,7 +2363,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, +@@ -2365,7 +2366,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, unsigned int val, val2; u64 val_64; u32 page_size, temp; @@ -71,7 +71,7 @@ Signed-off-by: Minda Chen INIT_LIST_HEAD(&xhci->cmd_list); -@@ -2492,9 +2493,11 @@ int xhci_mem_init(struct xhci_hcd *xhci, +@@ -2495,9 +2496,11 @@ int xhci_mem_init(struct xhci_hcd *xhci, xhci->isoc_bei_interval = AVOID_BEI_INTERVAL_MAX; if (xhci->quirks & XHCI_LOCAL_BUFFER) { diff --git a/toolchain/binutils/Config.in b/toolchain/binutils/Config.in index 93ef5d82c8e..e2721b1eafa 100644 --- a/toolchain/binutils/Config.in +++ b/toolchain/binutils/Config.in @@ -6,26 +6,10 @@ choice help Select the version of binutils you wish to use. - config BINUTILS_USE_VERSION_2_37 - bool "Binutils 2.37" - select BINUTILS_VERSION_2_37 - - config BINUTILS_USE_VERSION_2_38 - bool "Binutils 2.38" - select BINUTILS_VERSION_2_38 - - config BINUTILS_USE_VERSION_2_39 - bool "Binutils 2.39" - select BINUTILS_VERSION_2_39 - config BINUTILS_USE_VERSION_2_40 bool "Binutils 2.40" select BINUTILS_VERSION_2_40 - config BINUTILS_USE_VERSION_2_41 - bool "Binutils 2.41" - select BINUTILS_VERSION_2_41 - config BINUTILS_USE_VERSION_2_42 bool "Binutils 2.42" select BINUTILS_VERSION_2_42 diff --git a/toolchain/binutils/Config.version b/toolchain/binutils/Config.version index 98605f469a8..f616cddc2a7 100644 --- a/toolchain/binutils/Config.version +++ b/toolchain/binutils/Config.version @@ -1,19 +1,7 @@ -config BINUTILS_VERSION_2_37 - bool - -config BINUTILS_VERSION_2_38 - bool - -config BINUTILS_VERSION_2_39 - bool - config BINUTILS_VERSION_2_40 bool -config BINUTILS_VERSION_2_41 - bool - config BINUTILS_VERSION_2_42 default y if !TOOLCHAINOPTS bool @@ -23,10 +11,6 @@ config BINUTILS_VERSION_2_43 config BINUTILS_VERSION string - default "2.37" if BINUTILS_VERSION_2_37 - default "2.38" if BINUTILS_VERSION_2_38 - default "2.39" if BINUTILS_VERSION_2_39 default "2.40" if BINUTILS_VERSION_2_40 - default "2.41" if BINUTILS_VERSION_2_41 default "2.42" if BINUTILS_VERSION_2_42 default "2.43.1" if BINUTILS_VERSION_2_43 diff --git a/toolchain/binutils/Makefile b/toolchain/binutils/Makefile index 92ec8ec7e38..63f0e07ccf6 100644 --- a/toolchain/binutils/Makefile +++ b/toolchain/binutils/Makefile @@ -16,26 +16,10 @@ PKG_CPE_ID:=cpe:/a:gnu:binutils TAR_OPTIONS += --exclude='*.rej' -ifeq ($(PKG_VERSION),2.37) - PKG_HASH:=820d9724f020a3e69cb337893a0b63c2db161dadcb0e06fc11dc29eb1e84a32c -endif - -ifeq ($(PKG_VERSION),2.38) - PKG_HASH:=e316477a914f567eccc34d5d29785b8b0f5a10208d36bbacedcc39048ecfe024 -endif - -ifeq ($(PKG_VERSION),2.39) - PKG_HASH:=645c25f563b8adc0a81dbd6a41cffbf4d37083a382e02d5d3df4f65c09516d00 -endif - ifeq ($(PKG_VERSION),2.40) PKG_HASH:=0f8a4c272d7f17f369ded10a4aca28b8e304828e95526da482b0ccc4dfc9d8e1 endif -ifeq ($(PKG_VERSION),2.41) - PKG_HASH:=ae9a5789e23459e59606e6714723f2d3ffc31c03174191ef0d015bdf06007450 -endif - ifeq ($(PKG_VERSION),2.42) PKG_HASH:=f6e4d41fd5fc778b06b7891457b3620da5ecea1006c6a4a41ae998109f85a800 endif diff --git a/toolchain/binutils/patches/2.37/300-001_ld_makefile_patch.patch b/toolchain/binutils/patches/2.37/300-001_ld_makefile_patch.patch deleted file mode 100644 index f1cbb8198b3..00000000000 --- a/toolchain/binutils/patches/2.37/300-001_ld_makefile_patch.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/ld/Makefile.am -+++ b/ld/Makefile.am -@@ -50,7 +50,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR - # directives need to be different for native and cross linkers. --scriptdir = $(tooldir)/lib -+scriptdir = $(libdir) - - EMUL = @EMUL@ - EMULATION_OFILES = @EMULATION_OFILES@ ---- a/ld/Makefile.in -+++ b/ld/Makefile.in -@@ -561,7 +561,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR - # directives need to be different for native and cross linkers. --scriptdir = $(tooldir)/lib -+scriptdir = $(libdir) - BASEDIR = $(srcdir)/.. - BFDDIR = $(BASEDIR)/bfd - INCDIR = $(BASEDIR)/include diff --git a/toolchain/binutils/patches/2.37/400-mips_no_dynamic_linking_sym.patch b/toolchain/binutils/patches/2.37/400-mips_no_dynamic_linking_sym.patch deleted file mode 100644 index 070247ecf07..00000000000 --- a/toolchain/binutils/patches/2.37/400-mips_no_dynamic_linking_sym.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/bfd/elfxx-mips.c -+++ b/bfd/elfxx-mips.c -@@ -8057,6 +8057,7 @@ _bfd_mips_elf_create_dynamic_sections (b - - name = SGI_COMPAT (abfd) ? "_DYNAMIC_LINK" : "_DYNAMIC_LINKING"; - bh = NULL; -+ if (0) { - if (!(_bfd_generic_link_add_one_symbol - (info, abfd, name, BSF_GLOBAL, bfd_abs_section_ptr, 0, - NULL, false, get_elf_backend_data (abfd)->collect, &bh))) -@@ -8069,6 +8070,7 @@ _bfd_mips_elf_create_dynamic_sections (b - - if (! bfd_elf_link_record_dynamic_symbol (info, h)) - return false; -+ } - - if (! mips_elf_hash_table (info)->use_rld_obj_head) - { diff --git a/toolchain/binutils/patches/2.37/500-Change-default-emulation-for-mips64-linux.patch b/toolchain/binutils/patches/2.37/500-Change-default-emulation-for-mips64-linux.patch deleted file mode 100644 index c59843766e0..00000000000 --- a/toolchain/binutils/patches/2.37/500-Change-default-emulation-for-mips64-linux.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- a/bfd/config.bfd -+++ b/bfd/config.bfd -@@ -891,12 +891,12 @@ case "${targ}" in - targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec mips_ecoff_be_vec mips_ecoff_le_vec" - ;; - mips64*el-*-linux*) -- targ_defvec=mips_elf32_ntrad_le_vec -- targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_le_vec mips_elf64_trad_be_vec" -+ targ_defvec=mips_elf64_trad_le_vec -+ targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_be_vec" - ;; - mips64*-*-linux*) -- targ_defvec=mips_elf32_ntrad_be_vec -- targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec" -+ targ_defvec=mips_elf64_trad_be_vec -+ targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_le_vec" - ;; - mips*el-*-linux*) - targ_defvec=mips_elf32_trad_le_vec ---- a/ld/configure.tgt -+++ b/ld/configure.tgt -@@ -530,12 +530,12 @@ mips*-*-vxworks*) targ_emul=elf32ebmipvx - ;; - mips*-*-windiss) targ_emul=elf32mipswindiss - ;; --mips64*el-*-linux-*) targ_emul=elf32ltsmipn32 -- targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip" -+mips64*el-*-linux-*) targ_emul=elf64ltsmip -+ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32ltsmip elf32btsmip elf64btsmip" - targ_extra_libpath=$targ_extra_emuls - ;; --mips64*-*-linux-*) targ_emul=elf32btsmipn32 -- targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip" -+mips64*-*-linux-*) targ_emul=elf64btsmip -+ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip elf64ltsmip" - targ_extra_libpath=$targ_extra_emuls - ;; - mips*el-*-linux-*) targ_emul=elf32ltsmip diff --git a/toolchain/binutils/patches/2.37/600-Close_the_file_descriptor.patch b/toolchain/binutils/patches/2.37/600-Close_the_file_descriptor.patch deleted file mode 100644 index fef86a9cb5a..00000000000 --- a/toolchain/binutils/patches/2.37/600-Close_the_file_descriptor.patch +++ /dev/null @@ -1,184 +0,0 @@ -From: H.J. Lu -Date: Mon, 26 Jul 2021 12:59:55 +0000 (-0700) -Subject: bfd: Close the file descriptor if there is no archive fd -X-Git-Url: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=1c611b40e6bfc8029bff7696814330b5bc0ee5c0 - -bfd: Close the file descriptor if there is no archive fd - -Close the file descriptor if there is no archive plugin file descriptor -to avoid running out of file descriptors on thin archives with many -archive members. - -bfd/ - - PR ld/28138 - * plugin.c (bfd_plugin_close_file_descriptor): Close the file - descriptor there is no archive plugin file descriptor. - -ld/ - - PR ld/28138 - * testsuite/ld-plugin/lto.exp: Run tmpdir/pr28138 only for - native build. - - PR ld/28138 - * testsuite/ld-plugin/lto.exp: Run ld/28138 tests. - * testsuite/ld-plugin/pr28138.c: New file. - * testsuite/ld-plugin/pr28138-1.c: Likewise. - * testsuite/ld-plugin/pr28138-2.c: Likewise. - * testsuite/ld-plugin/pr28138-3.c: Likewise. - * testsuite/ld-plugin/pr28138-4.c: Likewise. - * testsuite/ld-plugin/pr28138-5.c: Likewise. - * testsuite/ld-plugin/pr28138-6.c: Likewise. - * testsuite/ld-plugin/pr28138-7.c: Likewise. - -(cherry picked from commit 5a98fb7513b559e20dfebdbaa2a471afda3b4742) -(cherry picked from commit 7dc37e1e1209c80e0bab784df6b6bac335e836f2) ---- - ---- a/bfd/plugin.c -+++ b/bfd/plugin.c -@@ -291,6 +291,14 @@ bfd_plugin_close_file_descriptor (bfd *a - && !bfd_is_thin_archive (abfd->my_archive)) - abfd = abfd->my_archive; - -+ /* Close the file descriptor if there is no archive plugin file -+ descriptor. */ -+ if (abfd->archive_plugin_fd == -1) -+ { -+ close (fd); -+ return; -+ } -+ - abfd->archive_plugin_fd_open_count--; - /* Dup the archive plugin file descriptor for later use, which - will be closed by _bfd_archive_close_and_cleanup. */ ---- a/ld/testsuite/ld-plugin/lto.exp -+++ b/ld/testsuite/ld-plugin/lto.exp -@@ -687,6 +687,40 @@ if { [is_elf_format] && [check_lto_share - } - } - -+run_cc_link_tests [list \ -+ [list \ -+ "Build pr28138.a" \ -+ "-T" "" \ -+ {pr28138-1.c pr28138-2.c pr28138-3.c pr28138-4.c pr28138-5.c \ -+ pr28138-6.c pr28138-7.c} {} "pr28138.a" \ -+ ] \ -+ [list \ -+ "Build pr28138.o" \ -+ "" "" \ -+ {pr28138.c} {} \ -+ ] \ -+] -+ -+set exec_output [run_host_cmd "sh" \ -+ "-c \"ulimit -n 20; \ -+ $CC -Btmpdir/ld -o tmpdir/pr28138 \ -+ tmpdir/pr28138.o tmpdir/pr28138.a\""] -+set exec_output [prune_warnings $exec_output] -+if [string match "" $exec_output] then { -+ if { [isnative] } { -+ set exec_output [run_host_cmd "tmpdir/pr28138" ""] -+ if [string match "PASS" $exec_output] then { -+ pass "PR ld/28138" -+ } else { -+ fail "PR ld/28138" -+ } -+ } else { -+ pass "PR ld/28138" -+ } -+} else { -+ fail "PR ld/28138" -+} -+ - set testname "Build liblto-11.a" - remote_file host delete "tmpdir/liblto-11.a" - set catch_output [run_host_cmd "$ar" "rc $plug_opt tmpdir/liblto-11.a tmpdir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"] ---- /dev/null -+++ b/ld/testsuite/ld-plugin/pr28138-1.c -@@ -0,0 +1,6 @@ -+extern int a0(void); -+int -+a1(void) -+{ -+ return 1 + a0(); -+} ---- /dev/null -+++ b/ld/testsuite/ld-plugin/pr28138-2.c -@@ -0,0 +1,6 @@ -+extern int a1(void); -+int -+a2(void) -+{ -+ return 1 + a1(); -+} ---- /dev/null -+++ b/ld/testsuite/ld-plugin/pr28138-3.c -@@ -0,0 +1,6 @@ -+extern int a2(void); -+int -+a3(void) -+{ -+ return 1 + a2(); -+} ---- /dev/null -+++ b/ld/testsuite/ld-plugin/pr28138-4.c -@@ -0,0 +1,6 @@ -+extern int a3(void); -+int -+a4(void) -+{ -+ return 1 + a3(); -+} ---- /dev/null -+++ b/ld/testsuite/ld-plugin/pr28138-5.c -@@ -0,0 +1,6 @@ -+extern int a4(void); -+int -+a5(void) -+{ -+ return 1 + a4(); -+} ---- /dev/null -+++ b/ld/testsuite/ld-plugin/pr28138-6.c -@@ -0,0 +1,6 @@ -+extern int a5(void); -+int -+a6(void) -+{ -+ return 1 + a5(); -+} ---- /dev/null -+++ b/ld/testsuite/ld-plugin/pr28138-7.c -@@ -0,0 +1,6 @@ -+extern int a6(void); -+int -+a7(void) -+{ -+ return 1 + a6(); -+} ---- /dev/null -+++ b/ld/testsuite/ld-plugin/pr28138.c -@@ -0,0 +1,20 @@ -+#include -+ -+extern int a7(void); -+ -+int -+a0(void) -+{ -+ return 0; -+} -+ -+int -+main() -+{ -+ if (a7() == 7) -+ { -+ printf ("PASS\n"); -+ return 0; -+ } -+ return 1; -+} diff --git a/toolchain/binutils/patches/2.38/001-PR-30569-always-call-elf_backend_size_dynamic_sectio.patch b/toolchain/binutils/patches/2.38/001-PR-30569-always-call-elf_backend_size_dynamic_sectio.patch deleted file mode 100644 index 94488c32905..00000000000 --- a/toolchain/binutils/patches/2.38/001-PR-30569-always-call-elf_backend_size_dynamic_sectio.patch +++ /dev/null @@ -1,2172 +0,0 @@ -From af969b14aedcc0ae27dcefab4327ff2d153dec8b Mon Sep 17 00:00:00 2001 -From: Alan Modra -Date: Thu, 28 Mar 2024 19:25:42 +1030 -Subject: [PATCH 1/2] PR 30569, always call elf_backend_size_dynamic_sections - -This largely mechanical patch is preparation for a followup patch. - -For quite some time I've thought that it would be useful to call -elf_backend_size_dynamic_sections even when no dynamic objects are -seen by the linker. That's what this patch does, with some renaming. -There are no functional changes to the linker, just a move of the -dynobj test in bfd_elf_size_dynamic_sections to target backend -functions, replacing the asserts/aborts already there. No doubt some -of the current always_size_sections functions could be moved to -size_dynamic_sections but I haven't made that change. - -Because both hooks are now always called, I have renamed -always_size_sections to early_size_sections and size_dynamic_sections -to late_size_sections. I condisdered calling late_size_sections plain -size_sections, since this is the usual target dynamic section sizing -hook, but decided that searching the sources for "size_sections" would -then hit early_size_sections and other functions. ---- - bfd/elf-bfd.h | 35 +++++++++++++++++------------------ - bfd/elf-m10300.c | 11 ++++++----- - bfd/elf32-arc.c | 9 +++++---- - bfd/elf32-arm.c | 15 ++++++++------- - bfd/elf32-bfin.c | 31 ++++++++++++++++--------------- - bfd/elf32-cr16.c | 11 ++++++----- - bfd/elf32-cris.c | 13 +++++++------ - bfd/elf32-csky.c | 8 ++++---- - bfd/elf32-frv.c | 23 ++++++++++++----------- - bfd/elf32-hppa.c | 8 ++++---- - bfd/elf32-i386.c | 7 +++---- - bfd/elf32-lm32.c | 15 ++++++++------- - bfd/elf32-m32c.c | 8 ++++---- - bfd/elf32-m32r.c | 11 ++++++----- - bfd/elf32-m68k.c | 16 ++++++++-------- - bfd/elf32-metag.c | 8 ++++---- - bfd/elf32-microblaze.c | 9 +++++---- - bfd/elf32-mips.c | 6 ++---- - bfd/elf32-nds32.c | 9 +++++---- - bfd/elf32-nios2.c | 15 ++++++++------- - bfd/elf32-or1k.c | 9 +++++---- - bfd/elf32-ppc.c | 11 ++++++----- - bfd/elf32-rl78.c | 8 ++++---- - bfd/elf32-s390.c | 10 +++++----- - bfd/elf32-score.c | 35 ++++++++++++++++++----------------- - bfd/elf32-score.h | 4 ++-- - bfd/elf32-score7.c | 13 +++++++------ - bfd/elf32-sh.c | 15 +++++++-------- - bfd/elf32-sparc.c | 3 +-- - bfd/elf32-tic6x.c | 14 +++++++------- - bfd/elf32-tilegx.c | 2 +- - bfd/elf32-tilepro.c | 11 +++++------ - bfd/elf32-vax.c | 16 +++++++--------- - bfd/elf32-xstormy16.c | 8 ++++---- - bfd/elf32-xtensa.c | 13 ++++++------- - bfd/elf64-alpha.c | 19 ++++++++++--------- - bfd/elf64-hppa.c | 11 ++++------- - bfd/elf64-ia64-vms.c | 13 +++++++------ - bfd/elf64-mips.c | 8 ++++---- - bfd/elf64-ppc.c | 12 ++++++------ - bfd/elf64-s390.c | 10 +++++----- - bfd/elf64-sparc.c | 4 ++-- - bfd/elf64-tilegx.c | 2 +- - bfd/elf64-x86-64.c | 7 +++---- - bfd/elflink.c | 9 ++++----- - bfd/elfn32-mips.c | 6 ++---- - bfd/elfnn-aarch64.c | 21 +++++++++++---------- - bfd/elfnn-ia64.c | 11 ++++++----- - bfd/elfnn-kvx.c | 19 +++++++++---------- - bfd/elfnn-loongarch.c | 9 +++++---- - bfd/elfnn-riscv.c | 7 ++++--- - bfd/elfxx-mips.c | 15 ++++++++------- - bfd/elfxx-mips.h | 4 ++-- - bfd/elfxx-sparc.c | 7 ++++--- - bfd/elfxx-sparc.h | 2 +- - bfd/elfxx-target.h | 12 ++++++------ - bfd/elfxx-tilegx.c | 7 ++++--- - bfd/elfxx-tilegx.h | 2 +- - bfd/elfxx-x86.c | 8 ++++---- - bfd/elfxx-x86.h | 8 ++++---- - ld/emultempl/vms.em | 7 +++---- - 61 files changed, 343 insertions(+), 337 deletions(-) - ---- a/bfd/elf-bfd.h -+++ b/bfd/elf-bfd.h -@@ -1135,7 +1135,7 @@ struct elf_backend_data - /* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend - linker for every symbol which is defined by a dynamic object and - referenced by a regular object. This is called after all the -- input files have been seen, but before the SIZE_DYNAMIC_SECTIONS -+ input files have been seen, but before the LATE_SIZE_SECTIONS - function has been called. The hash table entry should be - bfd_link_hash_defined ore bfd_link_hash_defweak, and it should be - defined in a section from a dynamic object. Dynamic object -@@ -1147,24 +1147,23 @@ struct elf_backend_data - bool (*elf_backend_adjust_dynamic_symbol) - (struct bfd_link_info *info, struct elf_link_hash_entry *h); - -- /* The ALWAYS_SIZE_SECTIONS function is called by the backend linker -- after all the linker input files have been seen but before the -- section sizes have been set. This is called after -- ADJUST_DYNAMIC_SYMBOL, but before SIZE_DYNAMIC_SECTIONS. */ -- bool (*elf_backend_always_size_sections) -+ /* The EARLY_SIZE_SECTIONS and LATE_SIZE_SECTIONS functions are -+ called by the backend linker after all linker input files have -+ been seen and sections have been assigned to output sections, but -+ before the section sizes have been set. Both of these functions -+ are called even when no dynamic object is seen by the linker. -+ Between them, they must set the sizes of the dynamic sections and -+ other backend specific sections, and may fill in their contents. -+ Most backends need only use LATE_SIZE_SECTIONS. -+ EARLY_SIZE_SECTIONS is called before --export-dynamic makes some -+ symbols dynamic and before ADJUST_DYNAMIC_SYMBOL processes -+ dynamic symbols, LATE_SIZE_SECTIONS afterwards. The generic ELF -+ linker can handle the .dynsym, .dynstr and .hash sections. -+ Besides those, these functions must handle the .interp section -+ and any other sections created by CREATE_DYNAMIC_SECTIONS. */ -+ bool (*elf_backend_early_size_sections) - (bfd *output_bfd, struct bfd_link_info *info); -- -- /* The SIZE_DYNAMIC_SECTIONS function is called by the ELF backend -- linker after all the linker input files have been seen but before -- the sections sizes have been set. This is called after -- ADJUST_DYNAMIC_SYMBOL has been called on all appropriate symbols. -- It is only called when linking against a dynamic object. It must -- set the sizes of the dynamic sections, and may fill in their -- contents as well. The generic ELF linker can handle the .dynsym, -- .dynstr and .hash sections. This function must handle the -- .interp section and any sections created by the -- CREATE_DYNAMIC_SECTIONS entry point. */ -- bool (*elf_backend_size_dynamic_sections) -+ bool (*elf_backend_late_size_sections) - (bfd *output_bfd, struct bfd_link_info *info); - - /* The STRIP_ZERO_SIZED_DYNAMIC_SECTIONS function is called by the ---- a/bfd/elf-m10300.c -+++ b/bfd/elf-m10300.c -@@ -5003,8 +5003,8 @@ _bfd_mn10300_elf_adjust_dynamic_symbol ( - /* Set the sizes of the dynamic sections. */ - - static bool --_bfd_mn10300_elf_size_dynamic_sections (bfd * output_bfd, -- struct bfd_link_info * info) -+_bfd_mn10300_elf_late_size_sections (bfd * output_bfd, -+ struct bfd_link_info * info) - { - struct elf32_mn10300_link_hash_table *htab = elf32_mn10300_hash_table (info); - bfd * dynobj; -@@ -5012,7 +5012,8 @@ _bfd_mn10300_elf_size_dynamic_sections ( - bool relocs; - - dynobj = htab->root.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -5499,8 +5500,8 @@ mn10300_elf_mkobject (bfd *abfd) - _bfd_mn10300_elf_create_dynamic_sections - #define elf_backend_adjust_dynamic_symbol \ - _bfd_mn10300_elf_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections \ -- _bfd_mn10300_elf_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ _bfd_mn10300_elf_late_size_sections - #define elf_backend_omit_section_dynsym _bfd_elf_omit_section_dynsym_all - #define elf_backend_finish_dynamic_symbol \ - _bfd_mn10300_elf_finish_dynamic_symbol ---- a/bfd/elf32-arc.c -+++ b/bfd/elf32-arc.c -@@ -2702,8 +2702,8 @@ elf_arc_finish_dynamic_sections (bfd * o - - /* Set the sizes of the dynamic sections. */ - static bool --elf_arc_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_arc_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; -@@ -2711,7 +2711,8 @@ elf_arc_size_dynamic_sections (bfd *outp - struct elf_link_hash_table *htab = elf_hash_table (info); - - dynobj = htab->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->dynamic_sections_created) - { -@@ -3126,7 +3127,7 @@ arc_elf_relax_section (bfd *abfd, asecti - #define elf_backend_finish_dynamic_symbol elf_arc_finish_dynamic_symbol - - #define elf_backend_finish_dynamic_sections elf_arc_finish_dynamic_sections --#define elf_backend_size_dynamic_sections elf_arc_size_dynamic_sections -+#define elf_backend_late_size_sections elf_arc_late_size_sections - - #define elf_backend_can_gc_sections 1 - #define elf_backend_want_got_plt 1 ---- a/bfd/elf32-arm.c -+++ b/bfd/elf32-arm.c -@@ -16709,8 +16709,8 @@ bfd_elf32_arm_set_byteswap_code (struct - /* Set the sizes of the dynamic sections. */ - - static bool --elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info * info) -+elf32_arm_late_size_sections (bfd * output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info * info) - { - bfd * dynobj; - asection * s; -@@ -16723,7 +16723,9 @@ elf32_arm_size_dynamic_sections (bfd * o - return false; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; -+ - check_use_blx (htab); - - if (elf_hash_table (info)->dynamic_sections_created) -@@ -17095,8 +17097,7 @@ elf32_arm_size_dynamic_sections (bfd * o - _TLS_MODULE_BASE_, if needed. */ - - static bool --elf32_arm_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elf32_arm_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - asection *tls_sec; - struct elf32_arm_link_hash_table *htab; -@@ -20263,8 +20264,8 @@ elf32_arm_backend_symbol_processing (bfd - #define elf_backend_create_dynamic_sections elf32_arm_create_dynamic_sections - #define elf_backend_finish_dynamic_symbol elf32_arm_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections elf32_arm_finish_dynamic_sections --#define elf_backend_size_dynamic_sections elf32_arm_size_dynamic_sections --#define elf_backend_always_size_sections elf32_arm_always_size_sections -+#define elf_backend_late_size_sections elf32_arm_late_size_sections -+#define elf_backend_early_size_sections elf32_arm_early_size_sections - #define elf_backend_init_index_section _bfd_elf_init_2_index_sections - #define elf_backend_init_file_header elf32_arm_init_file_header - #define elf_backend_reloc_type_class elf32_arm_reloc_type_class ---- a/bfd/elf32-bfin.c -+++ b/bfd/elf32-bfin.c -@@ -4031,8 +4031,8 @@ _bfinfdpic_size_got_plt (bfd *output_bfd - /* Set the sizes of the dynamic sections. */ - - static bool --elf32_bfinfdpic_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elf32_bfinfdpic_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - struct elf_link_hash_table *htab; - bfd *dynobj; -@@ -4041,7 +4041,8 @@ elf32_bfinfdpic_size_dynamic_sections (b - - htab = elf_hash_table (info); - dynobj = htab->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->dynamic_sections_created) - { -@@ -4090,7 +4091,7 @@ elf32_bfinfdpic_size_dynamic_sections (b - } - - static bool --elf32_bfinfdpic_always_size_sections (bfd *output_bfd, -+elf32_bfinfdpic_early_size_sections (bfd *output_bfd, - struct bfd_link_info *info) - { - if (!bfd_link_relocatable (info) -@@ -5128,15 +5129,16 @@ bfin_discard_copies (struct elf_link_has - } - - static bool --bfin_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+bfin_late_size_sections (bfd * output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; - bool relocs; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -5428,8 +5430,7 @@ struct bfd_elf_special_section const elf - #define elf_backend_check_relocs bfin_check_relocs - #define elf_backend_adjust_dynamic_symbol \ - bfin_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections \ -- bfin_size_dynamic_sections -+#define elf_backend_late_size_sections bfin_late_size_sections - #define elf_backend_relocate_section bfin_relocate_section - #define elf_backend_finish_dynamic_symbol \ - bfin_finish_dynamic_symbol -@@ -5475,9 +5476,9 @@ struct bfd_elf_special_section const elf - #undef bfd_elf32_bfd_link_hash_table_create - #define bfd_elf32_bfd_link_hash_table_create \ - bfinfdpic_elf_link_hash_table_create --#undef elf_backend_always_size_sections --#define elf_backend_always_size_sections \ -- elf32_bfinfdpic_always_size_sections -+#undef elf_backend_early_size_sections -+#define elf_backend_early_size_sections \ -+ elf32_bfinfdpic_early_size_sections - - #undef elf_backend_create_dynamic_sections - #define elf_backend_create_dynamic_sections \ -@@ -5485,9 +5486,9 @@ struct bfd_elf_special_section const elf - #undef elf_backend_adjust_dynamic_symbol - #define elf_backend_adjust_dynamic_symbol \ - elf32_bfinfdpic_adjust_dynamic_symbol --#undef elf_backend_size_dynamic_sections --#define elf_backend_size_dynamic_sections \ -- elf32_bfinfdpic_size_dynamic_sections -+#undef elf_backend_late_size_sections -+#define elf_backend_late_size_sections \ -+ elf32_bfinfdpic_late_size_sections - #undef elf_backend_finish_dynamic_symbol - #define elf_backend_finish_dynamic_symbol \ - elf32_bfinfdpic_finish_dynamic_symbol ---- a/bfd/elf32-cr16.c -+++ b/bfd/elf32-cr16.c -@@ -2381,15 +2381,16 @@ _bfd_cr16_elf_adjust_dynamic_symbol (str - /* Set the sizes of the dynamic sections. */ - - static bool --_bfd_cr16_elf_size_dynamic_sections (bfd * output_bfd, -- struct bfd_link_info * info) -+_bfd_cr16_elf_late_size_sections (bfd * output_bfd, -+ struct bfd_link_info * info) - { - bfd * dynobj; - asection * s; - bool relocs; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -2826,8 +2827,8 @@ _bfd_cr16_elf_reloc_type_class (const st - _bfd_cr16_elf_create_dynamic_sections - #define elf_backend_adjust_dynamic_symbol \ - _bfd_cr16_elf_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections \ -- _bfd_cr16_elf_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ _bfd_cr16_elf_late_size_sections - #define elf_backend_omit_section_dynsym _bfd_elf_omit_section_dynsym_all - #define elf_backend_finish_dynamic_symbol \ - _bfd_cr16_elf_finish_dynamic_symbol ---- a/bfd/elf32-cris.c -+++ b/bfd/elf32-cris.c -@@ -2527,7 +2527,7 @@ cris_elf_plt_sym_val (bfd_vma i ATTRIBUT - entry but we found we will not create any. Called when we find we will - not have any PLT for this symbol, by for example - elf_cris_adjust_dynamic_symbol when we're doing a proper dynamic link, -- or elf_cris_size_dynamic_sections if no dynamic sections will be -+ or elf_cris_late_size_sections if no dynamic sections will be - created (we're only linking static objects). */ - - static bool -@@ -3508,8 +3508,8 @@ cris_elf_check_relocs (bfd *abfd, - /* Set the sizes of the dynamic sections. */ - - static bool --elf_cris_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_cris_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_cris_link_hash_table * htab; - bfd *dynobj; -@@ -3521,7 +3521,8 @@ elf_cris_size_dynamic_sections (bfd *out - return false; - - dynobj = htab->root.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->root.dynamic_sections_created) - { -@@ -4090,8 +4091,8 @@ elf_cris_got_elt_size (bfd *abfd ATTRIBU - elf_cris_adjust_dynamic_symbol - #define elf_backend_copy_indirect_symbol \ - elf_cris_copy_indirect_symbol --#define elf_backend_size_dynamic_sections \ -- elf_cris_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ elf_cris_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_finish_dynamic_symbol \ - elf_cris_finish_dynamic_symbol ---- a/bfd/elf32-csky.c -+++ b/bfd/elf32-csky.c -@@ -1893,8 +1893,8 @@ csky_allocate_dynrelocs (struct elf_link - /* Set the sizes of the dynamic sections. */ - - static bool --csky_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+csky_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct csky_elf_link_hash_table *htab; - bfd *dynobj; -@@ -1907,7 +1907,7 @@ csky_elf_size_dynamic_sections (bfd *out - return false; - dynobj = htab->elf.dynobj; - if (dynobj == NULL) -- return false; -+ return true; - - if (htab->elf.dynamic_sections_created) - { -@@ -5344,7 +5344,7 @@ elf32_csky_obj_attrs_handle_unknown (bfd - /* Dynamic relocate related API. */ - #define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections - #define elf_backend_adjust_dynamic_symbol csky_elf_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections csky_elf_size_dynamic_sections -+#define elf_backend_late_size_sections csky_elf_late_size_sections - #define elf_backend_finish_dynamic_symbol csky_elf_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections csky_elf_finish_dynamic_sections - #define elf_backend_rela_normal 1 ---- a/bfd/elf32-frv.c -+++ b/bfd/elf32-frv.c -@@ -5423,15 +5423,16 @@ _frvfdpic_size_got_plt (bfd *output_bfd, - /* Set the sizes of the dynamic sections. */ - - static bool --elf32_frvfdpic_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elf32_frvfdpic_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; - struct _frvfdpic_dynamic_got_plt_info gpinfo; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -5472,8 +5473,8 @@ elf32_frvfdpic_size_dynamic_sections (bf - } - - static bool --elf32_frvfdpic_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elf32_frvfdpic_early_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - if (!bfd_link_relocatable (info) - && !bfd_elf_stack_segment_size (output_bfd, info, -@@ -6817,9 +6818,9 @@ elf32_frv_grok_psinfo (bfd *abfd, Elf_In - #undef bfd_elf32_bfd_link_hash_table_create - #define bfd_elf32_bfd_link_hash_table_create \ - frvfdpic_elf_link_hash_table_create --#undef elf_backend_always_size_sections --#define elf_backend_always_size_sections \ -- elf32_frvfdpic_always_size_sections -+#undef elf_backend_early_size_sections -+#define elf_backend_early_size_sections \ -+ elf32_frvfdpic_early_size_sections - - #undef elf_backend_create_dynamic_sections - #define elf_backend_create_dynamic_sections \ -@@ -6827,9 +6828,9 @@ elf32_frv_grok_psinfo (bfd *abfd, Elf_In - #undef elf_backend_adjust_dynamic_symbol - #define elf_backend_adjust_dynamic_symbol \ - elf32_frvfdpic_adjust_dynamic_symbol --#undef elf_backend_size_dynamic_sections --#define elf_backend_size_dynamic_sections \ -- elf32_frvfdpic_size_dynamic_sections -+#undef elf_backend_late_size_sections -+#define elf_backend_late_size_sections \ -+ elf32_frvfdpic_late_size_sections - #undef bfd_elf32_bfd_relax_section - #define bfd_elf32_bfd_relax_section \ - elf32_frvfdpic_relax_section ---- a/bfd/elf32-hppa.c -+++ b/bfd/elf32-hppa.c -@@ -2042,8 +2042,8 @@ clobber_millicode_symbols (struct elf_li - /* Set the sizes of the dynamic sections. */ - - static bool --elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf32_hppa_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf32_hppa_link_hash_table *htab; - bfd *dynobj; -@@ -2057,7 +2057,7 @@ elf32_hppa_size_dynamic_sections (bfd *o - - dynobj = htab->etab.dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - - if (htab->etab.dynamic_sections_created) - { -@@ -4450,7 +4450,7 @@ elf32_hppa_elf_get_symbol_type (Elf_Inte - #define elf_backend_hide_symbol elf32_hppa_hide_symbol - #define elf_backend_finish_dynamic_symbol elf32_hppa_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections elf32_hppa_finish_dynamic_sections --#define elf_backend_size_dynamic_sections elf32_hppa_size_dynamic_sections -+#define elf_backend_late_size_sections elf32_hppa_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_gc_mark_hook elf32_hppa_gc_mark_hook - #define elf_backend_grok_prstatus elf32_hppa_grok_prstatus ---- a/bfd/elf32-i386.c -+++ b/bfd/elf32-i386.c -@@ -1905,8 +1905,7 @@ elf_i386_scan_relocs (bfd *abfd, - } - - static bool --elf_i386_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elf_i386_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - bfd *abfd; - -@@ -1919,7 +1918,7 @@ elf_i386_always_size_sections (bfd *outp - elf_i386_scan_relocs)) - return false; - -- return _bfd_x86_elf_always_size_sections (output_bfd, info); -+ return _bfd_x86_elf_early_size_sections (output_bfd, info); - } - - /* Set the correct type for an x86 ELF section. We do this by the -@@ -4412,7 +4411,7 @@ elf_i386_link_setup_gnu_properties (stru - #define bfd_elf32_get_synthetic_symtab elf_i386_get_synthetic_symtab - - #define elf_backend_relocs_compatible _bfd_elf_relocs_compatible --#define elf_backend_always_size_sections elf_i386_always_size_sections -+#define elf_backend_early_size_sections elf_i386_early_size_sections - #define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections - #define elf_backend_fake_sections elf_i386_fake_sections - #define elf_backend_finish_dynamic_sections elf_i386_finish_dynamic_sections ---- a/bfd/elf32-lm32.c -+++ b/bfd/elf32-lm32.c -@@ -1906,8 +1906,8 @@ allocate_dynrelocs (struct elf_link_hash - /* Set the sizes of the dynamic sections. */ - - static bool --lm32_elf_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+lm32_elf_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - struct elf_lm32_link_hash_table *htab; - bfd *dynobj; -@@ -1920,7 +1920,8 @@ lm32_elf_size_dynamic_sections (bfd *out - return false; - - dynobj = htab->root.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->root.dynamic_sections_created) - { -@@ -2309,7 +2310,7 @@ lm32_elf_create_dynamic_sections (bfd *a - } - - static bool --lm32_elf_always_size_sections (bfd *output_bfd, struct bfd_link_info *info) -+lm32_elf_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - if (!bfd_link_relocatable (info)) - { -@@ -2395,7 +2396,7 @@ lm32_elf_fdpic_copy_private_bfd_data (bf - #define bfd_elf32_bfd_link_hash_table_create lm32_elf_link_hash_table_create - #define elf_backend_check_relocs lm32_elf_check_relocs - #define elf_backend_reloc_type_class lm32_elf_reloc_type_class --#define elf_backend_size_dynamic_sections lm32_elf_size_dynamic_sections -+#define elf_backend_late_size_sections lm32_elf_late_size_sections - #define elf_backend_omit_section_dynsym _bfd_elf_omit_section_dynsym_all - #define elf_backend_create_dynamic_sections lm32_elf_create_dynamic_sections - #define elf_backend_finish_dynamic_sections lm32_elf_finish_dynamic_sections -@@ -2416,8 +2417,8 @@ lm32_elf_fdpic_copy_private_bfd_data (bf - #undef elf32_bed - #define elf32_bed elf32_lm32fdpic_bed - --#undef elf_backend_always_size_sections --#define elf_backend_always_size_sections lm32_elf_always_size_sections -+#undef elf_backend_early_size_sections -+#define elf_backend_early_size_sections lm32_elf_early_size_sections - #undef bfd_elf32_bfd_copy_private_bfd_data - #define bfd_elf32_bfd_copy_private_bfd_data lm32_elf_fdpic_copy_private_bfd_data - ---- a/bfd/elf32-m32c.c -+++ b/bfd/elf32-m32c.c -@@ -773,8 +773,8 @@ m32c_elf_finish_dynamic_sections (bfd *a - } - - static bool --m32c_elf_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+m32c_elf_early_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *splt; -@@ -2131,8 +2131,8 @@ _bfd_m32c_elf_eh_frame_address_size (bfd - #define elf_backend_check_relocs m32c_elf_check_relocs - #define elf_backend_object_p m32c_elf_object_p - #define elf_symbol_leading_char ('_') --#define elf_backend_always_size_sections \ -- m32c_elf_always_size_sections -+#define elf_backend_early_size_sections \ -+ m32c_elf_early_size_sections - #define elf_backend_finish_dynamic_sections \ - m32c_elf_finish_dynamic_sections - ---- a/bfd/elf32-m32r.c -+++ b/bfd/elf32-m32r.c -@@ -1958,8 +1958,8 @@ allocate_dynrelocs (struct elf_link_hash - /* Set the sizes of the dynamic sections. */ - - static bool --m32r_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+m32r_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_link_hash_table *htab; - bfd *dynobj; -@@ -1968,7 +1968,7 @@ m32r_elf_size_dynamic_sections (bfd *out - bfd *ibfd; - - #ifdef DEBUG_PIC -- printf ("m32r_elf_size_dynamic_sections()\n"); -+ printf ("m32r_elf_late_size_sections()\n"); - #endif - - htab = m32r_elf_hash_table (info); -@@ -1976,7 +1976,8 @@ m32r_elf_size_dynamic_sections (bfd *out - return false; - - dynobj = htab->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->dynamic_sections_created) - { -@@ -3658,7 +3659,7 @@ m32r_elf_reloc_type_class (const struct - - #define elf_backend_create_dynamic_sections m32r_elf_create_dynamic_sections - #define bfd_elf32_bfd_link_hash_table_create m32r_elf_link_hash_table_create --#define elf_backend_size_dynamic_sections m32r_elf_size_dynamic_sections -+#define elf_backend_late_size_sections m32r_elf_late_size_sections - #define elf_backend_omit_section_dynsym _bfd_elf_omit_section_dynsym_all - #define elf_backend_finish_dynamic_sections m32r_elf_finish_dynamic_sections - #define elf_backend_adjust_dynamic_symbol m32r_elf_adjust_dynamic_symbol ---- a/bfd/elf32-m68k.c -+++ b/bfd/elf32-m68k.c -@@ -2934,7 +2934,7 @@ elf_m68k_get_plt_info (bfd *output_bfd) - It's a convenient place to determine the PLT style. */ - - static bool --elf_m68k_always_size_sections (bfd *output_bfd, struct bfd_link_info *info) -+elf_m68k_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - /* Bind input BFDs to GOTs and calculate sizes of .got and .rela.got - sections. */ -@@ -3107,15 +3107,16 @@ elf_m68k_adjust_dynamic_symbol (struct b - /* Set the sizes of the dynamic sections. */ - - static bool --elf_m68k_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_m68k_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; - bool relocs; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -4628,12 +4629,11 @@ elf_m68k_grok_psinfo (bfd *abfd, Elf_Int - #define bfd_elf32_bfd_final_link bfd_elf_final_link - - #define elf_backend_check_relocs elf_m68k_check_relocs --#define elf_backend_always_size_sections \ -- elf_m68k_always_size_sections -+#define elf_backend_early_size_sections \ -+ elf_m68k_early_size_sections - #define elf_backend_adjust_dynamic_symbol \ - elf_m68k_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections \ -- elf_m68k_size_dynamic_sections -+#define elf_backend_late_size_sections elf_m68k_late_size_sections - #define elf_backend_final_write_processing elf_m68k_final_write_processing - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_relocate_section elf_m68k_relocate_section ---- a/bfd/elf32-metag.c -+++ b/bfd/elf32-metag.c -@@ -2717,8 +2717,8 @@ allocate_dynrelocs (struct elf_link_hash - /* Set the sizes of the dynamic sections. */ - - static bool --elf_metag_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_metag_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_metag_link_hash_table *htab; - bfd *dynobj; -@@ -2729,7 +2729,7 @@ elf_metag_size_dynamic_sections (bfd *ou - htab = metag_link_hash_table (info); - dynobj = htab->etab.dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - - if (htab->etab.dynamic_sections_created) - { -@@ -4019,7 +4019,7 @@ elf_metag_plt_sym_val (bfd_vma i, const - #define elf_backend_adjust_dynamic_symbol elf_metag_adjust_dynamic_symbol - #define elf_backend_finish_dynamic_symbol elf_metag_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections elf_metag_finish_dynamic_sections --#define elf_backend_size_dynamic_sections elf_metag_size_dynamic_sections -+#define elf_backend_late_size_sections elf_metag_late_size_sections - #define elf_backend_omit_section_dynsym \ - _bfd_elf_omit_section_dynsym_all - #define elf_backend_init_file_header elf_metag_init_file_header ---- a/bfd/elf32-microblaze.c -+++ b/bfd/elf32-microblaze.c -@@ -2901,8 +2901,8 @@ allocate_dynrelocs (struct elf_link_hash - /* Set the sizes of the dynamic sections. */ - - static bool --microblaze_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+microblaze_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf32_mb_link_hash_table *htab; - bfd *dynobj; -@@ -2914,7 +2914,8 @@ microblaze_elf_size_dynamic_sections (bf - return false; - - dynobj = htab->elf.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - /* Set up .got offsets for local syms, and space for local dynamic - relocs. */ -@@ -3431,7 +3432,7 @@ microblaze_elf_add_symbol_hook (bfd *abf - #define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections - #define elf_backend_finish_dynamic_sections microblaze_elf_finish_dynamic_sections - #define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol --#define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections -+#define elf_backend_late_size_sections microblaze_elf_late_size_sections - #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook - - #include "elf32-target.h" ---- a/bfd/elf32-mips.c -+++ b/bfd/elf32-mips.c -@@ -2526,10 +2526,8 @@ static const struct ecoff_debug_swap mip - #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag - #define elf_backend_adjust_dynamic_symbol \ - _bfd_mips_elf_adjust_dynamic_symbol --#define elf_backend_always_size_sections \ -- _bfd_mips_elf_always_size_sections --#define elf_backend_size_dynamic_sections \ -- _bfd_mips_elf_size_dynamic_sections -+#define elf_backend_early_size_sections _bfd_mips_elf_early_size_sections -+#define elf_backend_late_size_sections _bfd_mips_elf_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_relocate_section _bfd_mips_elf_relocate_section - #define elf_backend_finish_dynamic_symbol \ ---- a/bfd/elf32-nds32.c -+++ b/bfd/elf32-nds32.c -@@ -4248,8 +4248,8 @@ elf32_nds32_add_dynreloc (bfd *output_bf - /* Set the sizes of the dynamic sections. */ - - static bool --nds32_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+nds32_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_nds32_link_hash_table *htab; - bfd *dynobj; -@@ -4262,7 +4262,8 @@ nds32_elf_size_dynamic_sections (bfd *ou - return false; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -13930,7 +13931,7 @@ nds32_elf_unify_tls_model (bfd *inbfd, a - #define elf_backend_create_dynamic_sections nds32_elf_create_dynamic_sections - #define elf_backend_finish_dynamic_sections nds32_elf_finish_dynamic_sections - #define elf_backend_finish_dynamic_symbol nds32_elf_finish_dynamic_symbol --#define elf_backend_size_dynamic_sections nds32_elf_size_dynamic_sections -+#define elf_backend_late_size_sections nds32_elf_late_size_sections - #define elf_backend_relocate_section nds32_elf_relocate_section - #define elf_backend_gc_mark_hook nds32_elf_gc_mark_hook - #define elf_backend_grok_prstatus nds32_elf_grok_prstatus ---- a/bfd/elf32-nios2.c -+++ b/bfd/elf32-nios2.c -@@ -5411,7 +5411,7 @@ nios2_elf32_adjust_dynamic_symbol (struc - return true; - } - --/* Worker function for nios2_elf32_size_dynamic_sections. */ -+/* Worker function for nios2_elf32_late_size_sections. */ - static bool - adjust_dynrelocs (struct elf_link_hash_entry *h, PTR inf) - { -@@ -5438,7 +5438,7 @@ adjust_dynrelocs (struct elf_link_hash_e - return true; - } - --/* Another worker function for nios2_elf32_size_dynamic_sections. -+/* Another worker function for nios2_elf32_late_size_sections. - Allocate space in .plt, .got and associated reloc sections for - dynamic relocs. */ - static bool -@@ -5673,11 +5673,11 @@ allocate_dynrelocs (struct elf_link_hash - return true; - } - --/* Implement elf_backend_size_dynamic_sections: -+/* Implement elf_backend_late_size_sections: - Set the sizes of the dynamic sections. */ - static bool --nios2_elf32_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+nios2_elf32_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; -@@ -5687,7 +5687,8 @@ nios2_elf32_size_dynamic_sections (bfd * - - htab = elf32_nios2_hash_table (info); - dynobj = htab->root.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - htab->res_n_size = 0; - if (htab->root.dynamic_sections_created) -@@ -6058,7 +6059,7 @@ const struct bfd_elf_special_section elf - nios2_elf32_finish_dynamic_sections - #define elf_backend_adjust_dynamic_symbol nios2_elf32_adjust_dynamic_symbol - #define elf_backend_reloc_type_class nios2_elf32_reloc_type_class --#define elf_backend_size_dynamic_sections nios2_elf32_size_dynamic_sections -+#define elf_backend_late_size_sections nios2_elf32_late_size_sections - #define elf_backend_add_symbol_hook nios2_elf_add_symbol_hook - #define elf_backend_copy_indirect_symbol nios2_elf32_copy_indirect_symbol - #define elf_backend_object_p nios2_elf32_object_p ---- a/bfd/elf32-or1k.c -+++ b/bfd/elf32-or1k.c -@@ -3023,8 +3023,8 @@ allocate_dynrelocs (struct elf_link_hash - /* Set the sizes of the dynamic sections. */ - - static bool --or1k_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+or1k_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_or1k_link_hash_table *htab; - bfd *dynobj; -@@ -3037,7 +3037,8 @@ or1k_elf_size_dynamic_sections (bfd *out - return false; - - dynobj = htab->root.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->root.dynamic_sections_created) - { -@@ -3390,7 +3391,7 @@ or1k_grok_psinfo (bfd *abfd, Elf_Interna - #define elf_backend_copy_indirect_symbol or1k_elf_copy_indirect_symbol - #define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections - #define elf_backend_finish_dynamic_sections or1k_elf_finish_dynamic_sections --#define elf_backend_size_dynamic_sections or1k_elf_size_dynamic_sections -+#define elf_backend_late_size_sections or1k_elf_late_size_sections - #define elf_backend_adjust_dynamic_symbol or1k_elf_adjust_dynamic_symbol - #define elf_backend_finish_dynamic_symbol or1k_elf_finish_dynamic_symbol - ---- a/bfd/elf32-ppc.c -+++ b/bfd/elf32-ppc.c -@@ -5497,8 +5497,8 @@ static const unsigned char glink_eh_fram - /* Set the sizes of the dynamic sections. */ - - static bool --ppc_elf_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+ppc_elf_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - struct ppc_elf_link_hash_table *htab; - asection *s; -@@ -5506,11 +5506,12 @@ ppc_elf_size_dynamic_sections (bfd *outp - bfd *ibfd; - - #ifdef DEBUG -- fprintf (stderr, "ppc_elf_size_dynamic_sections called\n"); -+ fprintf (stderr, "ppc_elf_late_size_sections called\n"); - #endif - - htab = ppc_elf_hash_table (info); -- BFD_ASSERT (htab->elf.dynobj != NULL); -+ if (htab->elf.dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -10410,7 +10411,7 @@ ppc_elf_finish_dynamic_sections (bfd *ou - #define elf_backend_copy_indirect_symbol ppc_elf_copy_indirect_symbol - #define elf_backend_adjust_dynamic_symbol ppc_elf_adjust_dynamic_symbol - #define elf_backend_add_symbol_hook ppc_elf_add_symbol_hook --#define elf_backend_size_dynamic_sections ppc_elf_size_dynamic_sections -+#define elf_backend_late_size_sections ppc_elf_late_size_sections - #define elf_backend_hash_symbol ppc_elf_hash_symbol - #define elf_backend_finish_dynamic_symbol ppc_elf_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections ppc_elf_finish_dynamic_sections ---- a/bfd/elf32-rl78.c -+++ b/bfd/elf32-rl78.c -@@ -1440,8 +1440,8 @@ rl78_elf_finish_dynamic_sections (bfd *a - } - - static bool --rl78_elf_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+rl78_elf_early_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *splt; -@@ -2609,8 +2609,8 @@ rl78_elf_relax_section (bfd *abfd, - - #define bfd_elf32_bfd_relax_section rl78_elf_relax_section - #define elf_backend_check_relocs rl78_elf_check_relocs --#define elf_backend_always_size_sections \ -- rl78_elf_always_size_sections -+#define elf_backend_early_size_sections \ -+ rl78_elf_early_size_sections - #define elf_backend_finish_dynamic_sections \ - rl78_elf_finish_dynamic_sections - ---- a/bfd/elf32-s390.c -+++ b/bfd/elf32-s390.c -@@ -1366,7 +1366,7 @@ elf_s390_gc_mark_hook (asection *sec, - entry but we found we will not create any. Called when we find we will - not have any PLT for this symbol, by for example - elf_s390_adjust_dynamic_symbol when we're doing a proper dynamic link, -- or elf_s390_size_dynamic_sections if no dynamic sections will be -+ or elf_s390_late_size_sections if no dynamic sections will be - created (we're only linking static objects). */ - - static void -@@ -1778,8 +1778,8 @@ allocate_dynrelocs (struct elf_link_hash - /* Set the sizes of the dynamic sections. */ - - static bool --elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_s390_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_s390_link_hash_table *htab; - bfd *dynobj; -@@ -1790,7 +1790,7 @@ elf_s390_size_dynamic_sections (bfd *out - htab = elf_s390_hash_table (info); - dynobj = htab->elf.dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - - if (htab->elf.dynamic_sections_created) - { -@@ -3926,7 +3926,7 @@ elf32_s390_merge_private_bfd_data (bfd * - #define elf_backend_gc_mark_hook elf_s390_gc_mark_hook - #define elf_backend_reloc_type_class elf_s390_reloc_type_class - #define elf_backend_relocate_section elf_s390_relocate_section --#define elf_backend_size_dynamic_sections elf_s390_size_dynamic_sections -+#define elf_backend_late_size_sections elf_s390_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_grok_prstatus elf_s390_grok_prstatus - #define elf_backend_grok_psinfo elf_s390_grok_psinfo ---- a/bfd/elf32-score.c -+++ b/bfd/elf32-score.c -@@ -1089,7 +1089,7 @@ score_elf_got_info (bfd *abfd, asection - appear towards the end. This reduces the amount of GOT space - required. MAX_LOCAL is used to set the number of local symbols - known to be in the dynamic symbol table. During -- s3_bfd_score_elf_size_dynamic_sections, this value is 1. Afterward, the -+ s3_bfd_score_elf_late_size_sections, this value is 1. Afterward, the - section symbols are added and the count is higher. */ - static bool - score_elf_sort_hash_table (struct bfd_link_info *info, -@@ -3160,8 +3160,8 @@ s3_bfd_score_elf_adjust_dynamic_symbol ( - /* This function is called after all the input files have been read, - and the input sections have been assigned to output sections. */ - static bool --s3_bfd_score_elf_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+s3_bfd_score_elf_early_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; -@@ -3237,14 +3237,15 @@ s3_bfd_score_elf_always_size_sections (b - - /* Set the sizes of the dynamic sections. */ - static bool --s3_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) -+s3_bfd_score_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; - bool reltext; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -3313,7 +3314,7 @@ s3_bfd_score_elf_size_dynamic_sections ( - } - else if (startswith (name, ".got")) - { -- /* s3_bfd_score_elf_always_size_sections() has already done -+ /* s3_bfd_score_elf_early_size_sections() has already done - most of the work, but some symbols may have been mapped - to versions that we must now resolve in the got_entries - hash tables. */ -@@ -4177,22 +4178,22 @@ _bfd_score_elf_adjust_dynamic_symbol (st - } - - static bool --_bfd_score_elf_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+_bfd_score_elf_early_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - if (bfd_get_mach (output_bfd) == bfd_mach_score3) -- return s3_bfd_score_elf_always_size_sections (output_bfd, info); -+ return s3_bfd_score_elf_early_size_sections (output_bfd, info); - else -- return s7_bfd_score_elf_always_size_sections (output_bfd, info); -+ return s7_bfd_score_elf_early_size_sections (output_bfd, info); - } - - static bool --_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) -+_bfd_score_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - if (bfd_get_mach (output_bfd) == bfd_mach_score3) -- return s3_bfd_score_elf_size_dynamic_sections (output_bfd, info); -+ return s3_bfd_score_elf_late_size_sections (output_bfd, info); - else -- return s7_bfd_score_elf_size_dynamic_sections (output_bfd, info); -+ return s7_bfd_score_elf_late_size_sections (output_bfd, info); - } - - static bool -@@ -4455,10 +4456,10 @@ _bfd_score_elf_common_definition (Elf_In - _bfd_score_elf_section_from_bfd_section - #define elf_backend_adjust_dynamic_symbol \ - _bfd_score_elf_adjust_dynamic_symbol --#define elf_backend_always_size_sections \ -- _bfd_score_elf_always_size_sections --#define elf_backend_size_dynamic_sections \ -- _bfd_score_elf_size_dynamic_sections -+#define elf_backend_early_size_sections \ -+ _bfd_score_elf_early_size_sections -+#define elf_backend_late_size_sections \ -+ _bfd_score_elf_late_size_sections - #define elf_backend_omit_section_dynsym _bfd_elf_omit_section_dynsym_all - #define elf_backend_create_dynamic_sections \ - _bfd_score_elf_create_dynamic_sections ---- a/bfd/elf32-score.h -+++ b/bfd/elf32-score.h -@@ -78,10 +78,10 @@ s7_bfd_score_elf_adjust_dynamic_symbol ( - struct elf_link_hash_entry *); - - extern bool --s7_bfd_score_elf_always_size_sections (bfd *, struct bfd_link_info *); -+s7_bfd_score_elf_early_size_sections (bfd *, struct bfd_link_info *); - - extern bool --s7_bfd_score_elf_size_dynamic_sections (bfd *, struct bfd_link_info *); -+s7_bfd_score_elf_late_size_sections (bfd *, struct bfd_link_info *); - - extern bool - s7_bfd_score_elf_create_dynamic_sections (bfd *, struct bfd_link_info *); ---- a/bfd/elf32-score7.c -+++ b/bfd/elf32-score7.c -@@ -975,7 +975,7 @@ score_elf_got_info (bfd *abfd, asection - appear towards the end. This reduces the amount of GOT space - required. MAX_LOCAL is used to set the number of local symbols - known to be in the dynamic symbol table. During -- s7_bfd_score_elf_size_dynamic_sections, this value is 1. Afterward, the -+ s7_bfd_score_elf_late_size_sections, this value is 1. Afterward, the - section symbols are added and the count is higher. */ - - static bool -@@ -2969,8 +2969,8 @@ s7_bfd_score_elf_adjust_dynamic_symbol ( - and the input sections have been assigned to output sections. */ - - bool --s7_bfd_score_elf_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+s7_bfd_score_elf_early_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; -@@ -3047,14 +3047,15 @@ s7_bfd_score_elf_always_size_sections (b - /* Set the sizes of the dynamic sections. */ - - bool --s7_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) -+s7_bfd_score_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; - bool reltext; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -3123,7 +3124,7 @@ s7_bfd_score_elf_size_dynamic_sections ( - } - else if (startswith (name, ".got")) - { -- /* s7_bfd_score_elf_always_size_sections() has already done -+ /* s7_bfd_score_elf_early_size_sections() has already done - most of the work, but some symbols may have been mapped - to versions that we must now resolve in the got_entries - hash tables. */ ---- a/bfd/elf32-sh.c -+++ b/bfd/elf32-sh.c -@@ -2925,7 +2925,7 @@ allocate_dynrelocs (struct elf_link_hash - It's a convenient place to determine the PLT style. */ - - static bool --sh_elf_always_size_sections (bfd *output_bfd, struct bfd_link_info *info) -+sh_elf_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - sh_elf_hash_table (info)->plt_info = get_plt_info (output_bfd, - bfd_link_pic (info)); -@@ -2940,8 +2940,8 @@ sh_elf_always_size_sections (bfd *output - /* Set the sizes of the dynamic sections. */ - - static bool --sh_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+sh_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_sh_link_hash_table *htab; - bfd *dynobj; -@@ -2954,7 +2954,8 @@ sh_elf_size_dynamic_sections (bfd *outpu - return false; - - dynobj = htab->root.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->root.dynamic_sections_created) - { -@@ -6589,10 +6590,8 @@ sh_elf_encode_eh_address (bfd *abfd, - sh_elf_link_hash_table_create - #define elf_backend_adjust_dynamic_symbol \ - sh_elf_adjust_dynamic_symbol --#define elf_backend_always_size_sections \ -- sh_elf_always_size_sections --#define elf_backend_size_dynamic_sections \ -- sh_elf_size_dynamic_sections -+#define elf_backend_early_size_sections sh_elf_early_size_sections -+#define elf_backend_late_size_sections sh_elf_late_size_sections - #define elf_backend_omit_section_dynsym sh_elf_omit_section_dynsym - #define elf_backend_finish_dynamic_symbol \ - sh_elf_finish_dynamic_symbol ---- a/bfd/elf32-sparc.c -+++ b/bfd/elf32-sparc.c -@@ -248,8 +248,7 @@ elf32_sparc_reloc_type_class (const stru - #define elf_backend_adjust_dynamic_symbol \ - _bfd_sparc_elf_adjust_dynamic_symbol - #define elf_backend_omit_section_dynsym _bfd_sparc_elf_omit_section_dynsym --#define elf_backend_size_dynamic_sections \ -- _bfd_sparc_elf_size_dynamic_sections -+#define elf_backend_late_size_sections _bfd_sparc_elf_late_size_sections - #define elf_backend_relocate_section _bfd_sparc_elf_relocate_section - #define elf_backend_finish_dynamic_symbol \ - _bfd_sparc_elf_finish_dynamic_symbol ---- a/bfd/elf32-tic6x.c -+++ b/bfd/elf32-tic6x.c -@@ -3160,7 +3160,7 @@ elf32_tic6x_allocate_dynrelocs (struct e - /* Set the sizes of the dynamic sections. */ - - static bool --elf32_tic6x_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) -+elf32_tic6x_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - struct elf32_tic6x_link_hash_table *htab; - bfd *dynobj; -@@ -3171,7 +3171,7 @@ elf32_tic6x_size_dynamic_sections (bfd * - htab = elf32_tic6x_hash_table (info); - dynobj = htab->elf.dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - - if (htab->elf.dynamic_sections_created) - { -@@ -3358,7 +3358,7 @@ elf32_tic6x_size_dynamic_sections (bfd * - and the input sections have been assigned to output sections. */ - - static bool --elf32_tic6x_always_size_sections (bfd *output_bfd, struct bfd_link_info *info) -+elf32_tic6x_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - if (elf32_tic6x_using_dsbt (output_bfd) && !bfd_link_relocatable (info) - && !bfd_elf_stack_segment_size (output_bfd, info, -@@ -4261,10 +4261,10 @@ elf32_tic6x_write_section (bfd *output_b - #define elf_backend_relocs_compatible _bfd_elf_relocs_compatible - #define elf_backend_finish_dynamic_symbol \ - elf32_tic6x_finish_dynamic_symbol --#define elf_backend_always_size_sections \ -- elf32_tic6x_always_size_sections --#define elf_backend_size_dynamic_sections \ -- elf32_tic6x_size_dynamic_sections -+#define elf_backend_early_size_sections \ -+ elf32_tic6x_early_size_sections -+#define elf_backend_late_size_sections \ -+ elf32_tic6x_late_size_sections - #define elf_backend_finish_dynamic_sections \ - elf32_tic6x_finish_dynamic_sections - #define bfd_elf32_bfd_final_link \ ---- a/bfd/elf32-tilegx.c -+++ b/bfd/elf32-tilegx.c -@@ -105,7 +105,7 @@ tilegx_elf_grok_psinfo (bfd *abfd, Elf_I - #define elf_backend_check_relocs tilegx_elf_check_relocs - #define elf_backend_adjust_dynamic_symbol tilegx_elf_adjust_dynamic_symbol - #define elf_backend_omit_section_dynsym tilegx_elf_omit_section_dynsym --#define elf_backend_size_dynamic_sections tilegx_elf_size_dynamic_sections -+#define elf_backend_late_size_sections tilegx_elf_late_size_sections - #define elf_backend_relocate_section tilegx_elf_relocate_section - #define elf_backend_finish_dynamic_symbol tilegx_elf_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections tilegx_elf_finish_dynamic_sections ---- a/bfd/elf32-tilepro.c -+++ b/bfd/elf32-tilepro.c -@@ -2182,11 +2182,9 @@ tilepro_elf_omit_section_dynsym (bfd *ou - #define ELF32_DYNAMIC_INTERPRETER "/lib/ld.so.1" - - static bool --tilepro_elf_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+tilepro_elf_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { -- (void)output_bfd; -- - struct elf_link_hash_table *htab; - bfd *dynobj; - asection *s; -@@ -2195,7 +2193,8 @@ tilepro_elf_size_dynamic_sections (bfd * - htab = tilepro_elf_hash_table (info); - BFD_ASSERT (htab != NULL); - dynobj = htab->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -3739,7 +3738,7 @@ tilepro_additional_program_headers (bfd - #define elf_backend_check_relocs tilepro_elf_check_relocs - #define elf_backend_adjust_dynamic_symbol tilepro_elf_adjust_dynamic_symbol - #define elf_backend_omit_section_dynsym tilepro_elf_omit_section_dynsym --#define elf_backend_size_dynamic_sections tilepro_elf_size_dynamic_sections -+#define elf_backend_late_size_sections tilepro_elf_late_size_sections - #define elf_backend_relocate_section tilepro_elf_relocate_section - #define elf_backend_finish_dynamic_symbol tilepro_elf_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections tilepro_elf_finish_dynamic_sections ---- a/bfd/elf32-vax.c -+++ b/bfd/elf32-vax.c -@@ -36,7 +36,6 @@ static bool elf_vax_check_relocs (bfd *, - asection *, const Elf_Internal_Rela *); - static bool elf_vax_adjust_dynamic_symbol (struct bfd_link_info *, - struct elf_link_hash_entry *); --static bool elf_vax_size_dynamic_sections (bfd *, struct bfd_link_info *); - static int elf_vax_relocate_section (bfd *, struct bfd_link_info *, - bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, -@@ -985,8 +984,8 @@ elf_vax_discard_got_entries (struct elf_ - /* Discard unused dynamic data if this is a static link. */ - - static bool --elf_vax_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_vax_early_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; -@@ -1024,14 +1023,15 @@ elf_vax_always_size_sections (bfd *outpu - /* Set the sizes of the dynamic sections. */ - - static bool --elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) -+elf_vax_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; - bool relocs; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -1861,10 +1861,8 @@ elf_vax_plt_sym_val (bfd_vma i, const as - #define elf_backend_check_relocs elf_vax_check_relocs - #define elf_backend_adjust_dynamic_symbol \ - elf_vax_adjust_dynamic_symbol --#define elf_backend_always_size_sections \ -- elf_vax_always_size_sections --#define elf_backend_size_dynamic_sections \ -- elf_vax_size_dynamic_sections -+#define elf_backend_early_size_sections elf_vax_early_size_sections -+#define elf_backend_late_size_sections elf_vax_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_relocate_section elf_vax_relocate_section - #define elf_backend_finish_dynamic_symbol \ ---- a/bfd/elf32-xstormy16.c -+++ b/bfd/elf32-xstormy16.c -@@ -706,8 +706,8 @@ xstormy16_elf_relax_section (bfd *dynobj - } - - static bool --xstormy16_elf_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+xstormy16_elf_early_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *splt; -@@ -1013,8 +1013,8 @@ xstormy16_elf_gc_mark_hook (asection *se - #define elf_backend_relocate_section xstormy16_elf_relocate_section - #define elf_backend_gc_mark_hook xstormy16_elf_gc_mark_hook - #define elf_backend_check_relocs xstormy16_elf_check_relocs --#define elf_backend_always_size_sections \ -- xstormy16_elf_always_size_sections -+#define elf_backend_early_size_sections \ -+ xstormy16_elf_early_size_sections - #define elf_backend_omit_section_dynsym \ - _bfd_elf_omit_section_dynsym_all - #define elf_backend_finish_dynamic_sections \ ---- a/bfd/elf32-xtensa.c -+++ b/bfd/elf32-xtensa.c -@@ -1568,8 +1568,8 @@ elf_xtensa_allocate_local_got_size (stru - /* Set the sizes of the dynamic sections. */ - - static bool --elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_xtensa_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_xtensa_link_hash_table *htab; - bfd *dynobj, *abfd; -@@ -1586,7 +1586,7 @@ elf_xtensa_size_dynamic_sections (bfd *o - - dynobj = elf_hash_table (info)->dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - srelgot = htab->elf.srelgot; - srelplt = htab->elf.srelplt; - -@@ -1791,8 +1791,7 @@ elf_xtensa_size_dynamic_sections (bfd *o - } - - static bool --elf_xtensa_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elf_xtensa_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - struct elf_xtensa_link_hash_table *htab; - asection *tls_sec; -@@ -11551,8 +11550,8 @@ static const struct bfd_elf_special_sect - #define elf_backend_object_p elf_xtensa_object_p - #define elf_backend_reloc_type_class elf_xtensa_reloc_type_class - #define elf_backend_relocate_section elf_xtensa_relocate_section --#define elf_backend_size_dynamic_sections elf_xtensa_size_dynamic_sections --#define elf_backend_always_size_sections elf_xtensa_always_size_sections -+#define elf_backend_late_size_sections elf_xtensa_late_size_sections -+#define elf_backend_early_size_sections elf_xtensa_early_size_sections - #define elf_backend_omit_section_dynsym _bfd_elf_omit_section_dynsym_all - #define elf_backend_special_sections elf_xtensa_special_sections - #define elf_backend_action_discarded elf_xtensa_action_discarded ---- a/bfd/elf64-alpha.c -+++ b/bfd/elf64-alpha.c -@@ -2579,8 +2579,8 @@ elf64_alpha_size_plt_section (struct bfd - } - - static bool --elf64_alpha_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf64_alpha_early_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *i; - struct alpha_elf_link_hash_table * htab; -@@ -2806,8 +2806,8 @@ elf64_alpha_size_rela_got_section (struc - /* Set the sizes of the dynamic sections. */ - - static bool --elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf64_alpha_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; -@@ -2819,7 +2819,8 @@ elf64_alpha_size_dynamic_sections (bfd * - return false; - - dynobj = elf_hash_table(info)->dynobj; -- BFD_ASSERT(dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -5465,10 +5466,10 @@ static const struct elf_size_info alpha_ - elf64_alpha_merge_symbol_attribute - #define elf_backend_copy_indirect_symbol \ - elf64_alpha_copy_indirect_symbol --#define elf_backend_always_size_sections \ -- elf64_alpha_always_size_sections --#define elf_backend_size_dynamic_sections \ -- elf64_alpha_size_dynamic_sections -+#define elf_backend_early_size_sections \ -+ elf64_alpha_early_size_sections -+#define elf_backend_late_size_sections \ -+ elf64_alpha_late_size_sections - #define elf_backend_omit_section_dynsym \ - _bfd_elf_omit_section_dynsym_all - #define elf_backend_relocate_section \ ---- a/bfd/elf64-hppa.c -+++ b/bfd/elf64-hppa.c -@@ -176,9 +176,6 @@ static bool elf64_hppa_adjust_dynamic_sy - static bool elf64_hppa_mark_milli_and_exported_functions - (struct elf_link_hash_entry *, void *); - --static bool elf64_hppa_size_dynamic_sections -- (bfd *, struct bfd_link_info *); -- - static int elf64_hppa_link_output_symbol_hook - (struct bfd_link_info *, const char *, Elf_Internal_Sym *, - asection *, struct elf_link_hash_entry *); -@@ -1520,7 +1517,7 @@ elf64_hppa_mark_milli_and_exported_funct - the contents of our special sections. */ - - static bool --elf64_hppa_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) -+elf64_hppa_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - struct elf64_hppa_link_hash_table *hppa_info; - struct elf64_hppa_allocate_data data; -@@ -1534,7 +1531,8 @@ elf64_hppa_size_dynamic_sections (bfd *o - return false; - - dynobj = hppa_info->root.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - /* Mark each function this program exports so that we will allocate - space in the .opd section for each function's FPTR. If we are -@@ -3984,8 +3982,7 @@ const struct elf_size_info hppa64_elf_si - #define elf_backend_adjust_dynamic_symbol \ - elf64_hppa_adjust_dynamic_symbol - --#define elf_backend_size_dynamic_sections \ -- elf64_hppa_size_dynamic_sections -+#define elf_backend_late_size_sections elf64_hppa_late_size_sections - - #define elf_backend_finish_dynamic_symbol \ - elf64_hppa_finish_dynamic_symbol ---- a/bfd/elf64-ia64-vms.c -+++ b/bfd/elf64-ia64-vms.c -@@ -2590,8 +2590,8 @@ elf64_ia64_adjust_dynamic_symbol (struct - } - - static bool --elf64_ia64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf64_ia64_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf64_ia64_allocate_data data; - struct elf64_ia64_link_hash_table *ia64_info; -@@ -2600,11 +2600,12 @@ elf64_ia64_size_dynamic_sections (bfd *o - struct elf_link_hash_table *hash_table; - - hash_table = elf_hash_table (info); -- dynobj = hash_table->dynobj; - ia64_info = elf64_ia64_hash_table (info); - if (ia64_info == NULL) - return false; -- BFD_ASSERT(dynobj != NULL); -+ dynobj = hash_table->dynobj; -+ if (dynobj == NULL) -+ return true; - data.info = info; - - /* Allocate the GOT entries. */ -@@ -5484,8 +5485,8 @@ static const struct elf_size_info elf64_ - elf64_ia64_check_relocs - #define elf_backend_adjust_dynamic_symbol \ - elf64_ia64_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections \ -- elf64_ia64_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ elf64_ia64_late_size_sections - #define elf_backend_omit_section_dynsym \ - _bfd_elf_omit_section_dynsym_all - #define elf_backend_relocate_section \ ---- a/bfd/elf64-mips.c -+++ b/bfd/elf64-mips.c -@@ -4741,10 +4741,10 @@ const struct elf_size_info mips_elf64_si - #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag - #define elf_backend_adjust_dynamic_symbol \ - _bfd_mips_elf_adjust_dynamic_symbol --#define elf_backend_always_size_sections \ -- _bfd_mips_elf_always_size_sections --#define elf_backend_size_dynamic_sections \ -- _bfd_mips_elf_size_dynamic_sections -+#define elf_backend_early_size_sections \ -+ _bfd_mips_elf_early_size_sections -+#define elf_backend_late_size_sections \ -+ _bfd_mips_elf_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_relocate_section _bfd_mips_elf_relocate_section - #define elf_backend_finish_dynamic_symbol \ ---- a/bfd/elf64-ppc.c -+++ b/bfd/elf64-ppc.c -@@ -119,8 +119,8 @@ static bfd_vma opd_entry_value - #define elf_backend_adjust_dynamic_symbol ppc64_elf_adjust_dynamic_symbol - #define elf_backend_hide_symbol ppc64_elf_hide_symbol - #define elf_backend_maybe_function_sym ppc64_elf_maybe_function_sym --#define elf_backend_always_size_sections ppc64_elf_edit --#define elf_backend_size_dynamic_sections ppc64_elf_size_dynamic_sections -+#define elf_backend_early_size_sections ppc64_elf_edit -+#define elf_backend_late_size_sections ppc64_elf_late_size_sections - #define elf_backend_hash_symbol ppc64_elf_hash_symbol - #define elf_backend_init_index_section _bfd_elf_init_2_index_sections - #define elf_backend_action_discarded ppc64_elf_action_discarded -@@ -10121,7 +10121,7 @@ allocate_dynrelocs (struct elf_link_hash - ((((v) & 0x3ffff0000ULL) << 16) | (v & 0xffff)) - #define HA34(v) ((v + (1ULL << 33)) >> 34) - --/* Called via elf_link_hash_traverse from ppc64_elf_size_dynamic_sections -+/* Called via elf_link_hash_traverse from ppc64_elf_late_size_sections - to set up space for global entry stubs. These are put in glink, - after the branch table. */ - -@@ -10198,8 +10198,8 @@ size_global_entry_stubs (struct elf_link - /* Set the sizes of the dynamic sections. */ - - static bool --ppc64_elf_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+ppc64_elf_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - struct ppc_link_hash_table *htab; - bfd *dynobj; -@@ -10214,7 +10214,7 @@ ppc64_elf_size_dynamic_sections (bfd *ou - - dynobj = htab->elf.dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - - if (htab->elf.dynamic_sections_created) - { ---- a/bfd/elf64-s390.c -+++ b/bfd/elf64-s390.c -@@ -1301,7 +1301,7 @@ elf_s390_gc_mark_hook (asection *sec, - entry but we found we will not create any. Called when we find we will - not have any PLT for this symbol, by for example - elf_s390_adjust_dynamic_symbol when we're doing a proper dynamic link, -- or elf_s390_size_dynamic_sections if no dynamic sections will be -+ or elf_s390_late_size_sections if no dynamic sections will be - created (we're only linking static objects). */ - - static void -@@ -1714,8 +1714,8 @@ allocate_dynrelocs (struct elf_link_hash - /* Set the sizes of the dynamic sections. */ - - static bool --elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_s390_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_s390_link_hash_table *htab; - bfd *dynobj; -@@ -1729,7 +1729,7 @@ elf_s390_size_dynamic_sections (bfd *out - - dynobj = htab->elf.dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - - if (htab->elf.dynamic_sections_created) - { -@@ -3881,7 +3881,7 @@ const struct elf_size_info s390_elf64_si - #define elf_backend_gc_mark_hook elf_s390_gc_mark_hook - #define elf_backend_reloc_type_class elf_s390_reloc_type_class - #define elf_backend_relocate_section elf_s390_relocate_section --#define elf_backend_size_dynamic_sections elf_s390_size_dynamic_sections -+#define elf_backend_late_size_sections elf_s390_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_grok_prstatus elf_s390_grok_prstatus - #define elf_backend_grok_psinfo elf_s390_grok_psinfo ---- a/bfd/elf64-sparc.c -+++ b/bfd/elf64-sparc.c -@@ -938,8 +938,8 @@ const struct elf_size_info elf64_sparc_s - _bfd_sparc_elf_adjust_dynamic_symbol - #define elf_backend_omit_section_dynsym \ - _bfd_sparc_elf_omit_section_dynsym --#define elf_backend_size_dynamic_sections \ -- _bfd_sparc_elf_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ _bfd_sparc_elf_late_size_sections - #define elf_backend_relocate_section \ - _bfd_sparc_elf_relocate_section - #define elf_backend_finish_dynamic_symbol \ ---- a/bfd/elf64-tilegx.c -+++ b/bfd/elf64-tilegx.c -@@ -106,7 +106,7 @@ tilegx_elf_grok_psinfo (bfd *abfd, Elf_I - #define elf_backend_check_relocs tilegx_elf_check_relocs - #define elf_backend_adjust_dynamic_symbol tilegx_elf_adjust_dynamic_symbol - #define elf_backend_omit_section_dynsym tilegx_elf_omit_section_dynsym --#define elf_backend_size_dynamic_sections tilegx_elf_size_dynamic_sections -+#define elf_backend_late_size_sections tilegx_elf_late_size_sections - #define elf_backend_relocate_section tilegx_elf_relocate_section - #define elf_backend_finish_dynamic_symbol tilegx_elf_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections tilegx_elf_finish_dynamic_sections ---- a/bfd/elf64-x86-64.c -+++ b/bfd/elf64-x86-64.c -@@ -2351,8 +2351,7 @@ elf_x86_64_scan_relocs (bfd *abfd, struc - } - - static bool --elf_x86_64_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elf_x86_64_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - bfd *abfd; - -@@ -2365,7 +2364,7 @@ elf_x86_64_always_size_sections (bfd *ou - elf_x86_64_scan_relocs)) - return false; - -- return _bfd_x86_elf_always_size_sections (output_bfd, info); -+ return _bfd_x86_elf_early_size_sections (output_bfd, info); - } - - /* Return the relocation value for @tpoff relocation -@@ -5262,7 +5261,7 @@ elf_x86_64_special_sections[]= - elf_x86_64_reloc_name_lookup - - #define elf_backend_relocs_compatible elf_x86_64_relocs_compatible --#define elf_backend_always_size_sections elf_x86_64_always_size_sections -+#define elf_backend_early_size_sections elf_x86_64_early_size_sections - #define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections - #define elf_backend_finish_dynamic_sections elf_x86_64_finish_dynamic_sections - #define elf_backend_finish_dynamic_symbol elf_x86_64_finish_dynamic_symbol ---- a/bfd/elflink.c -+++ b/bfd/elflink.c -@@ -6623,8 +6623,8 @@ bfd_elf_size_dynamic_sections (bfd *outp - - /* The backend may have to create some sections regardless of whether - we're dynamic or not. */ -- if (bed->elf_backend_always_size_sections -- && ! (*bed->elf_backend_always_size_sections) (output_bfd, info)) -+ if (bed->elf_backend_early_size_sections -+ && !bed->elf_backend_early_size_sections (output_bfd, info)) - return false; - - dynobj = elf_hash_table (info)->dynobj; -@@ -7360,9 +7360,8 @@ bfd_elf_size_dynamic_sections (bfd *outp - - /* The backend must work out the sizes of all the other dynamic - sections. */ -- if (dynobj != NULL -- && bed->elf_backend_size_dynamic_sections != NULL -- && ! (*bed->elf_backend_size_dynamic_sections) (output_bfd, info)) -+ if (bed->elf_backend_late_size_sections != NULL -+ && !bed->elf_backend_late_size_sections (output_bfd, info)) - return false; - - if (dynobj != NULL && elf_hash_table (info)->dynamic_sections_created) ---- a/bfd/elfn32-mips.c -+++ b/bfd/elfn32-mips.c -@@ -4127,10 +4127,8 @@ static const struct ecoff_debug_swap mip - #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag - #define elf_backend_adjust_dynamic_symbol \ - _bfd_mips_elf_adjust_dynamic_symbol --#define elf_backend_always_size_sections \ -- _bfd_mips_elf_always_size_sections --#define elf_backend_size_dynamic_sections \ -- _bfd_mips_elf_size_dynamic_sections -+#define elf_backend_early_size_sections _bfd_mips_elf_early_size_sections -+#define elf_backend_late_size_sections _bfd_mips_elf_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_relocate_section _bfd_mips_elf_relocate_section - #define elf_backend_finish_dynamic_symbol \ ---- a/bfd/elfnn-aarch64.c -+++ b/bfd/elfnn-aarch64.c -@@ -112,7 +112,7 @@ - allocate space for one relocation on the slot. Record the GOT offset - for this symbol. - -- elfNN_aarch64_size_dynamic_sections () -+ elfNN_aarch64_late_size_sections () - - Iterate all input BFDS, look for in the local symbol data structure - constructed earlier for local TLS symbols and allocate them double -@@ -8859,8 +8859,8 @@ elfNN_aarch64_allocate_local_ifunc_dynre - though ! */ - - static bool --elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elfNN_aarch64_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_aarch64_link_hash_table *htab; - bfd *dynobj; -@@ -8871,7 +8871,8 @@ elfNN_aarch64_size_dynamic_sections (bfd - htab = elf_aarch64_hash_table ((info)); - dynobj = htab->root.dynobj; - -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->root.dynamic_sections_created) - { -@@ -9273,8 +9274,8 @@ elfNN_aarch64_create_small_pltn_entry (s - _TLS_MODULE_BASE_, if needed. */ - - static bool --elfNN_aarch64_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elfNN_aarch64_early_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - asection *tls_sec; - -@@ -10009,8 +10010,8 @@ const struct elf_size_info elfNN_aarch64 - #define elf_backend_adjust_dynamic_symbol \ - elfNN_aarch64_adjust_dynamic_symbol - --#define elf_backend_always_size_sections \ -- elfNN_aarch64_always_size_sections -+#define elf_backend_early_size_sections \ -+ elfNN_aarch64_early_size_sections - - #define elf_backend_check_relocs \ - elfNN_aarch64_check_relocs -@@ -10059,8 +10060,8 @@ const struct elf_size_info elfNN_aarch64 - #define elf_backend_section_from_shdr \ - elfNN_aarch64_section_from_shdr - --#define elf_backend_size_dynamic_sections \ -- elfNN_aarch64_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ elfNN_aarch64_late_size_sections - - #define elf_backend_size_info \ - elfNN_aarch64_size_info ---- a/bfd/elfnn-ia64.c -+++ b/bfd/elfnn-ia64.c -@@ -2986,8 +2986,8 @@ elfNN_ia64_adjust_dynamic_symbol (struct - } - - static bool --elfNN_ia64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elfNN_ia64_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elfNN_ia64_allocate_data data; - struct elfNN_ia64_link_hash_table *ia64_info; -@@ -2998,8 +2998,9 @@ elfNN_ia64_size_dynamic_sections (bfd *o - if (ia64_info == NULL) - return false; - dynobj = ia64_info->root.dynobj; -+ if (dynobj == NULL) -+ return true; - ia64_info->self_dtpmod_offset = (bfd_vma) -1; -- BFD_ASSERT(dynobj != NULL); - data.info = info; - - /* Set the contents of the .interp section to the interpreter. */ -@@ -5035,8 +5036,8 @@ ignore_errors (const char *fmt ATTRIBUTE - elfNN_ia64_check_relocs - #define elf_backend_adjust_dynamic_symbol \ - elfNN_ia64_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections \ -- elfNN_ia64_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ elfNN_ia64_late_size_sections - #define elf_backend_omit_section_dynsym \ - _bfd_elf_omit_section_dynsym_all - #define elf_backend_relocate_section \ ---- a/bfd/elfnn-loongarch.c -+++ b/bfd/elfnn-loongarch.c -@@ -1169,8 +1169,8 @@ maybe_set_textrel (struct elf_link_hash_ - } - - static bool --loongarch_elf_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+loongarch_elf_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - struct loongarch_elf_link_hash_table *htab; - bfd *dynobj; -@@ -1180,7 +1180,8 @@ loongarch_elf_size_dynamic_sections (bfd - htab = loongarch_elf_hash_table (info); - BFD_ASSERT (htab != NULL); - dynobj = htab->elf.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->elf.dynamic_sections_created) - { -@@ -3251,7 +3252,7 @@ loongarch_elf_gc_mark_hook (asection *se - loongarch_elf_create_dynamic_sections - #define elf_backend_check_relocs loongarch_elf_check_relocs - #define elf_backend_adjust_dynamic_symbol loongarch_elf_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections loongarch_elf_size_dynamic_sections -+#define elf_backend_late_size_sections loongarch_elf_late_size_sections - #define elf_backend_relocate_section loongarch_elf_relocate_section - #define elf_backend_finish_dynamic_symbol loongarch_elf_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections \ ---- a/bfd/elfnn-riscv.c -+++ b/bfd/elfnn-riscv.c -@@ -1376,7 +1376,7 @@ allocate_local_ifunc_dynrelocs (void **s - } - - static bool --riscv_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) -+riscv_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - struct riscv_elf_link_hash_table *htab; - bfd *dynobj; -@@ -1386,7 +1386,8 @@ riscv_elf_size_dynamic_sections (bfd *ou - htab = riscv_elf_hash_table (info); - BFD_ASSERT (htab != NULL); - dynobj = htab->elf.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -5256,7 +5257,7 @@ riscv_elf_merge_symbol_attribute (struct - #define elf_backend_create_dynamic_sections riscv_elf_create_dynamic_sections - #define elf_backend_check_relocs riscv_elf_check_relocs - #define elf_backend_adjust_dynamic_symbol riscv_elf_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections riscv_elf_size_dynamic_sections -+#define elf_backend_late_size_sections riscv_elf_late_size_sections - #define elf_backend_relocate_section riscv_elf_relocate_section - #define elf_backend_finish_dynamic_symbol riscv_elf_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections riscv_elf_finish_dynamic_sections ---- a/bfd/elfxx-mips.c -+++ b/bfd/elfxx-mips.c -@@ -9550,8 +9550,8 @@ _bfd_mips_elf_adjust_dynamic_symbol (str - check for any mips16 stub sections that we can discard. */ - - bool --_bfd_mips_elf_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+_bfd_mips_elf_early_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - asection *sect; - struct mips_elf_link_hash_table *htab; -@@ -9894,8 +9894,8 @@ mips_elf_set_plt_sym_value (struct mips_ - /* Set the sizes of the dynamic sections. */ - - bool --_bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+_bfd_mips_elf_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s, *sreldyn; -@@ -9905,7 +9905,8 @@ _bfd_mips_elf_size_dynamic_sections (bfd - htab = mips_elf_hash_table (info); - BFD_ASSERT (htab != NULL); - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -14824,7 +14825,7 @@ _bfd_mips_elf_final_link (bfd *abfd, str - input_section->flags &= ~SEC_HAS_CONTENTS; - } - -- /* Size has been set in _bfd_mips_elf_always_size_sections. */ -+ /* Size has been set in _bfd_mips_elf_early_size_sections. */ - BFD_ASSERT(o->size == sizeof (Elf_External_ABIFlags_v0)); - - /* Skip this section later on (I don't think this currently -@@ -14883,7 +14884,7 @@ _bfd_mips_elf_final_link (bfd *abfd, str - input_section->flags &= ~SEC_HAS_CONTENTS; - } - -- /* Size has been set in _bfd_mips_elf_always_size_sections. */ -+ /* Size has been set in _bfd_mips_elf_early_size_sections. */ - BFD_ASSERT(o->size == sizeof (Elf32_External_RegInfo)); - - /* Skip this section later on (I don't think this currently ---- a/bfd/elfxx-mips.h -+++ b/bfd/elfxx-mips.h -@@ -52,9 +52,9 @@ extern bool _bfd_mips_elf_check_relocs - (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); - extern bool _bfd_mips_elf_adjust_dynamic_symbol - (struct bfd_link_info *, struct elf_link_hash_entry *); --extern bool _bfd_mips_elf_always_size_sections -+extern bool _bfd_mips_elf_early_size_sections - (bfd *, struct bfd_link_info *); --extern bool _bfd_mips_elf_size_dynamic_sections -+extern bool _bfd_mips_elf_late_size_sections - (bfd *, struct bfd_link_info *); - extern int _bfd_mips_elf_relocate_section - (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, ---- a/bfd/elfxx-sparc.c -+++ b/bfd/elfxx-sparc.c -@@ -2381,8 +2381,8 @@ _bfd_sparc_elf_omit_section_dynsym (bfd - /* Set the sizes of the dynamic sections. */ - - bool --_bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+_bfd_sparc_elf_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - struct _bfd_sparc_elf_link_hash_table *htab; - bfd *dynobj; -@@ -2392,7 +2392,8 @@ _bfd_sparc_elf_size_dynamic_sections (bf - htab = _bfd_sparc_elf_hash_table (info); - BFD_ASSERT (htab != NULL); - dynobj = htab->elf.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { ---- a/bfd/elfxx-sparc.h -+++ b/bfd/elfxx-sparc.h -@@ -117,7 +117,7 @@ extern bool _bfd_sparc_elf_adjust_dynami - (struct bfd_link_info *, struct elf_link_hash_entry *); - extern bool _bfd_sparc_elf_omit_section_dynsym - (bfd *, struct bfd_link_info *, asection *); --extern bool _bfd_sparc_elf_size_dynamic_sections -+extern bool _bfd_sparc_elf_late_size_sections - (bfd *, struct bfd_link_info *); - extern bool _bfd_sparc_elf_new_section_hook - (bfd *, asection *); ---- a/bfd/elfxx-target.h -+++ b/bfd/elfxx-target.h -@@ -493,11 +493,11 @@ - #ifndef elf_backend_adjust_dynamic_symbol - #define elf_backend_adjust_dynamic_symbol 0 - #endif --#ifndef elf_backend_always_size_sections --#define elf_backend_always_size_sections 0 -+#ifndef elf_backend_early_size_sections -+#define elf_backend_early_size_sections 0 - #endif --#ifndef elf_backend_size_dynamic_sections --#define elf_backend_size_dynamic_sections 0 -+#ifndef elf_backend_late_size_sections -+#define elf_backend_late_size_sections 0 - #endif - #ifndef elf_backend_strip_zero_sized_dynamic_sections - #define elf_backend_strip_zero_sized_dynamic_sections 0 -@@ -853,8 +853,8 @@ static const struct elf_backend_data elf - elf_backend_check_directives, - elf_backend_notice_as_needed, - elf_backend_adjust_dynamic_symbol, -- elf_backend_always_size_sections, -- elf_backend_size_dynamic_sections, -+ elf_backend_early_size_sections, -+ elf_backend_late_size_sections, - elf_backend_strip_zero_sized_dynamic_sections, - elf_backend_init_index_section, - elf_backend_relocate_section, ---- a/bfd/elfxx-tilegx.c -+++ b/bfd/elfxx-tilegx.c -@@ -2430,8 +2430,8 @@ tilegx_elf_omit_section_dynsym (bfd *out - } - - bool --tilegx_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+tilegx_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct tilegx_elf_link_hash_table *htab; - bfd *dynobj; -@@ -2441,7 +2441,8 @@ tilegx_elf_size_dynamic_sections (bfd *o - htab = tilegx_elf_hash_table (info); - BFD_ASSERT (htab != NULL); - dynobj = htab->elf.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { ---- a/bfd/elfxx-tilegx.h -+++ b/bfd/elfxx-tilegx.h -@@ -57,7 +57,7 @@ tilegx_elf_omit_section_dynsym (bfd *, - asection *); - - extern bool --tilegx_elf_size_dynamic_sections (bfd *, struct bfd_link_info *); -+tilegx_elf_late_size_sections (bfd *, struct bfd_link_info *); - - extern int - tilegx_elf_relocate_section (bfd *, struct bfd_link_info *, ---- a/bfd/elfxx-x86.c -+++ b/bfd/elfxx-x86.c -@@ -2002,7 +2002,7 @@ _bfd_elf_x86_valid_reloc_p (asection *in - /* Set the sizes of the dynamic sections. */ - - bool --_bfd_x86_elf_size_dynamic_sections (bfd *output_bfd, -+_bfd_x86_elf_late_size_sections (bfd *output_bfd, - struct bfd_link_info *info) - { - struct elf_x86_link_hash_table *htab; -@@ -2018,7 +2018,7 @@ _bfd_x86_elf_size_dynamic_sections (bfd - return false; - dynobj = htab->elf.dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - - /* Set up .got offsets for local syms, and space for local dynamic - relocs. */ -@@ -2599,8 +2599,8 @@ _bfd_x86_elf_finish_dynamic_sections (bf - - - bool --_bfd_x86_elf_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+_bfd_x86_elf_early_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - asection *tls_sec = elf_hash_table (info)->tls_sec; - ---- a/bfd/elfxx-x86.h -+++ b/bfd/elfxx-x86.h -@@ -807,13 +807,13 @@ extern bool _bfd_elf_x86_valid_reloc_p - const Elf_Internal_Rela *, struct elf_link_hash_entry *, - Elf_Internal_Sym *, Elf_Internal_Shdr *, bool *); - --extern bool _bfd_x86_elf_size_dynamic_sections -+extern bool _bfd_x86_elf_late_size_sections - (bfd *, struct bfd_link_info *); - - extern struct elf_x86_link_hash_table *_bfd_x86_elf_finish_dynamic_sections - (bfd *, struct bfd_link_info *); - --extern bool _bfd_x86_elf_always_size_sections -+extern bool _bfd_x86_elf_early_size_sections - (bfd *, struct bfd_link_info *); - - extern void _bfd_x86_elf_merge_symbol_attribute -@@ -885,8 +885,8 @@ extern void _bfd_x86_elf_link_report_rel - - #define elf_backend_check_relocs \ - _bfd_x86_elf_check_relocs --#define elf_backend_size_dynamic_sections \ -- _bfd_x86_elf_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ _bfd_x86_elf_late_size_sections - #define elf_backend_merge_symbol_attribute \ - _bfd_x86_elf_merge_symbol_attribute - #define elf_backend_copy_indirect_symbol \ ---- a/ld/emultempl/vms.em -+++ b/ld/emultempl/vms.em -@@ -196,10 +196,9 @@ gld${EMULATION_NAME}_before_allocation ( - - /* The backend must work out the sizes of all the other dynamic - sections. */ -- if (elf_hash_table (&link_info)->dynamic_sections_created -- && bed->elf_backend_size_dynamic_sections -- && ! (*bed->elf_backend_size_dynamic_sections) (link_info.output_bfd, -- &link_info)) -+ if (bed->elf_backend_late_size_sections -+ && !bed->elf_backend_late_size_sections (link_info.output_bfd, -+ &link_info)) - einfo (_("%F%P: failed to set dynamic section sizes: %E\n")); - - before_allocation_default (); diff --git a/toolchain/binutils/patches/2.38/002-PR-30569-delete-_bfd_mips_elf_early_size_sections.patch b/toolchain/binutils/patches/2.38/002-PR-30569-delete-_bfd_mips_elf_early_size_sections.patch deleted file mode 100644 index 725d6765104..00000000000 --- a/toolchain/binutils/patches/2.38/002-PR-30569-delete-_bfd_mips_elf_early_size_sections.patch +++ /dev/null @@ -1,218 +0,0 @@ -From 3c6c32951e292a51ede70b8087bb0308d7dbc4fc Mon Sep 17 00:00:00 2001 -From: Alan Modra -Date: Thu, 28 Mar 2024 20:33:32 +1030 -Subject: [PATCH 2/2] PR 30569, delete _bfd_mips_elf_early_size_sections - -PR30569 was triggered by a patch of mine 6540edd52cc0 moving the call -to always_size_sections in bfd_elf_size_dynamic_sections earlier, made -to support the x86 DT_RELR implementation. This broke mips16 code -handling stubs when --export-dynamic is passed to the linker, because -numerous symbols then became dynamic after always_size_sections. The -mips backend fiddles with symbols in its always_size_sections. Maciej -in 902e9fc76a0e had moved the call to always_size_sections to after -the export-dynamic code. Prior to that, Nathan in 04c3a75556c0 moved -it before the exec stack code, back to the start of -bfd_elf_size_dynamic_sections which was where Ian put it originally -in ff12f303355b. So the call has moved around a little. I'm leaving -it where it is, and instead calling mips_elf_check_symbols from -late_size_sections (the old size_dynamic_sections) which is now always -called. In fact, the whole of _bfd_mips_elf_early_size_sections can -be merged into _bfd_mips_elf_late_size_sections. ---- - bfd/elf32-mips.c | 1 - - bfd/elf64-mips.c | 2 -- - bfd/elfn32-mips.c | 1 - - bfd/elfxx-mips.c | 84 +++++++++++++++++++---------------------------- - bfd/elfxx-mips.h | 2 -- - 5 files changed, 34 insertions(+), 56 deletions(-) - ---- a/bfd/elf32-mips.c -+++ b/bfd/elf32-mips.c -@@ -2526,7 +2526,6 @@ static const struct ecoff_debug_swap mip - #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag - #define elf_backend_adjust_dynamic_symbol \ - _bfd_mips_elf_adjust_dynamic_symbol --#define elf_backend_early_size_sections _bfd_mips_elf_early_size_sections - #define elf_backend_late_size_sections _bfd_mips_elf_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_relocate_section _bfd_mips_elf_relocate_section ---- a/bfd/elf64-mips.c -+++ b/bfd/elf64-mips.c -@@ -4741,8 +4741,6 @@ const struct elf_size_info mips_elf64_si - #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag - #define elf_backend_adjust_dynamic_symbol \ - _bfd_mips_elf_adjust_dynamic_symbol --#define elf_backend_early_size_sections \ -- _bfd_mips_elf_early_size_sections - #define elf_backend_late_size_sections \ - _bfd_mips_elf_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section ---- a/bfd/elfn32-mips.c -+++ b/bfd/elfn32-mips.c -@@ -4127,7 +4127,6 @@ static const struct ecoff_debug_swap mip - #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag - #define elf_backend_adjust_dynamic_symbol \ - _bfd_mips_elf_adjust_dynamic_symbol --#define elf_backend_early_size_sections _bfd_mips_elf_early_size_sections - #define elf_backend_late_size_sections _bfd_mips_elf_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_relocate_section _bfd_mips_elf_relocate_section ---- a/bfd/elfxx-mips.c -+++ b/bfd/elfxx-mips.c -@@ -9545,48 +9545,6 @@ _bfd_mips_elf_adjust_dynamic_symbol (str - return _bfd_elf_adjust_dynamic_copy (info, h, s); - } - --/* This function is called after all the input files have been read, -- and the input sections have been assigned to output sections. We -- check for any mips16 stub sections that we can discard. */ -- --bool --_bfd_mips_elf_early_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) --{ -- asection *sect; -- struct mips_elf_link_hash_table *htab; -- struct mips_htab_traverse_info hti; -- -- htab = mips_elf_hash_table (info); -- BFD_ASSERT (htab != NULL); -- -- /* The .reginfo section has a fixed size. */ -- sect = bfd_get_section_by_name (output_bfd, ".reginfo"); -- if (sect != NULL) -- { -- bfd_set_section_size (sect, sizeof (Elf32_External_RegInfo)); -- sect->flags |= SEC_FIXED_SIZE | SEC_HAS_CONTENTS; -- } -- -- /* The .MIPS.abiflags section has a fixed size. */ -- sect = bfd_get_section_by_name (output_bfd, ".MIPS.abiflags"); -- if (sect != NULL) -- { -- bfd_set_section_size (sect, sizeof (Elf_External_ABIFlags_v0)); -- sect->flags |= SEC_FIXED_SIZE | SEC_HAS_CONTENTS; -- } -- -- hti.info = info; -- hti.output_bfd = output_bfd; -- hti.error = false; -- mips_elf_link_hash_traverse (mips_elf_hash_table (info), -- mips_elf_check_symbols, &hti); -- if (hti.error) -- return false; -- -- return true; --} -- - /* If the link uses a GOT, lay it out and work out its size. */ - - static bool -@@ -9891,7 +9849,8 @@ mips_elf_set_plt_sym_value (struct mips_ - return true; - } - --/* Set the sizes of the dynamic sections. */ -+/* Set the sizes of the dynamic sections, some mips non-dynamic sections, -+ and check for any mips16 stub sections that we can discard. */ - - bool - _bfd_mips_elf_late_size_sections (bfd *output_bfd, -@@ -9901,14 +9860,39 @@ _bfd_mips_elf_late_size_sections (bfd *o - asection *s, *sreldyn; - bool reltext; - struct mips_elf_link_hash_table *htab; -+ struct mips_htab_traverse_info hti; - - htab = mips_elf_hash_table (info); - BFD_ASSERT (htab != NULL); -- dynobj = elf_hash_table (info)->dynobj; -+ -+ /* The .reginfo section has a fixed size. */ -+ s = bfd_get_section_by_name (output_bfd, ".reginfo"); -+ if (s != NULL) -+ { -+ bfd_set_section_size (s, sizeof (Elf32_External_RegInfo)); -+ s->flags |= SEC_FIXED_SIZE | SEC_HAS_CONTENTS; -+ } -+ -+ /* The .MIPS.abiflags section has a fixed size. */ -+ s = bfd_get_section_by_name (output_bfd, ".MIPS.abiflags"); -+ if (s != NULL) -+ { -+ bfd_set_section_size (s, sizeof (Elf_External_ABIFlags_v0)); -+ s->flags |= SEC_FIXED_SIZE | SEC_HAS_CONTENTS; -+ } -+ -+ hti.info = info; -+ hti.output_bfd = output_bfd; -+ hti.error = false; -+ mips_elf_link_hash_traverse (htab, mips_elf_check_symbols, &hti); -+ if (hti.error) -+ return false; -+ -+ dynobj = htab->root.dynobj; - if (dynobj == NULL) - return true; - -- if (elf_hash_table (info)->dynamic_sections_created) -+ if (htab->root.dynamic_sections_created) - { - /* Set the contents of the .interp section to the interpreter. */ - if (bfd_link_executable (info) && !info->nointerp) -@@ -10048,7 +10032,7 @@ _bfd_mips_elf_late_size_sections (bfd *o - } - } - else if (bfd_link_executable (info) -- && ! mips_elf_hash_table (info)->use_rld_obj_head -+ && !htab->use_rld_obj_head - && startswith (name, ".rld_map")) - { - /* We add a room for __rld_map. It will be filled in by the -@@ -10057,7 +10041,7 @@ _bfd_mips_elf_late_size_sections (bfd *o - } - else if (SGI_COMPAT (output_bfd) - && startswith (name, ".compact_rel")) -- s->size += mips_elf_hash_table (info)->compact_rel_size; -+ s->size += htab->compact_rel_size; - else if (s == htab->root.splt) - { - /* If the last PLT entry has a branch delay slot, allocate -@@ -10097,7 +10081,7 @@ _bfd_mips_elf_late_size_sections (bfd *o - } - } - -- if (elf_hash_table (info)->dynamic_sections_created) -+ if (htab->root.dynamic_sections_created) - { - /* Add some entries to the .dynamic section. We fill in the - values later, in _bfd_mips_elf_finish_dynamic_sections, but we -@@ -14825,7 +14809,7 @@ _bfd_mips_elf_final_link (bfd *abfd, str - input_section->flags &= ~SEC_HAS_CONTENTS; - } - -- /* Size has been set in _bfd_mips_elf_early_size_sections. */ -+ /* Size has been set in _bfd_mips_elf_late_size_sections. */ - BFD_ASSERT(o->size == sizeof (Elf_External_ABIFlags_v0)); - - /* Skip this section later on (I don't think this currently -@@ -14884,7 +14868,7 @@ _bfd_mips_elf_final_link (bfd *abfd, str - input_section->flags &= ~SEC_HAS_CONTENTS; - } - -- /* Size has been set in _bfd_mips_elf_early_size_sections. */ -+ /* Size has been set in _bfd_mips_elf_late_size_sections. */ - BFD_ASSERT(o->size == sizeof (Elf32_External_RegInfo)); - - /* Skip this section later on (I don't think this currently ---- a/bfd/elfxx-mips.h -+++ b/bfd/elfxx-mips.h -@@ -52,8 +52,6 @@ extern bool _bfd_mips_elf_check_relocs - (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); - extern bool _bfd_mips_elf_adjust_dynamic_symbol - (struct bfd_link_info *, struct elf_link_hash_entry *); --extern bool _bfd_mips_elf_early_size_sections -- (bfd *, struct bfd_link_info *); - extern bool _bfd_mips_elf_late_size_sections - (bfd *, struct bfd_link_info *); - extern int _bfd_mips_elf_relocate_section diff --git a/toolchain/binutils/patches/2.38/300-001_ld_makefile_patch.patch b/toolchain/binutils/patches/2.38/300-001_ld_makefile_patch.patch deleted file mode 100644 index ecc9dd64e39..00000000000 --- a/toolchain/binutils/patches/2.38/300-001_ld_makefile_patch.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/ld/Makefile.am -+++ b/ld/Makefile.am -@@ -50,7 +50,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR - # directives need to be different for native and cross linkers. --scriptdir = $(tooldir)/lib -+scriptdir = $(libdir) - - EMUL = @EMUL@ - EMULATION_OFILES = @EMULATION_OFILES@ ---- a/ld/Makefile.in -+++ b/ld/Makefile.in -@@ -563,7 +563,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR - # directives need to be different for native and cross linkers. --scriptdir = $(tooldir)/lib -+scriptdir = $(libdir) - BASEDIR = $(srcdir)/.. - BFDDIR = $(BASEDIR)/bfd - INCDIR = $(BASEDIR)/include diff --git a/toolchain/binutils/patches/2.38/400-mips_no_dynamic_linking_sym.patch b/toolchain/binutils/patches/2.38/400-mips_no_dynamic_linking_sym.patch deleted file mode 100644 index 070247ecf07..00000000000 --- a/toolchain/binutils/patches/2.38/400-mips_no_dynamic_linking_sym.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/bfd/elfxx-mips.c -+++ b/bfd/elfxx-mips.c -@@ -8057,6 +8057,7 @@ _bfd_mips_elf_create_dynamic_sections (b - - name = SGI_COMPAT (abfd) ? "_DYNAMIC_LINK" : "_DYNAMIC_LINKING"; - bh = NULL; -+ if (0) { - if (!(_bfd_generic_link_add_one_symbol - (info, abfd, name, BSF_GLOBAL, bfd_abs_section_ptr, 0, - NULL, false, get_elf_backend_data (abfd)->collect, &bh))) -@@ -8069,6 +8070,7 @@ _bfd_mips_elf_create_dynamic_sections (b - - if (! bfd_elf_link_record_dynamic_symbol (info, h)) - return false; -+ } - - if (! mips_elf_hash_table (info)->use_rld_obj_head) - { diff --git a/toolchain/binutils/patches/2.38/500-Change-default-emulation-for-mips64-linux.patch b/toolchain/binutils/patches/2.38/500-Change-default-emulation-for-mips64-linux.patch deleted file mode 100644 index 0797f4dff9a..00000000000 --- a/toolchain/binutils/patches/2.38/500-Change-default-emulation-for-mips64-linux.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- a/bfd/config.bfd -+++ b/bfd/config.bfd -@@ -928,12 +928,12 @@ case "${targ}" in - targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec mips_ecoff_be_vec mips_ecoff_le_vec" - ;; - mips64*el-*-linux*) -- targ_defvec=mips_elf32_ntrad_le_vec -- targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_le_vec mips_elf64_trad_be_vec" -+ targ_defvec=mips_elf64_trad_le_vec -+ targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_be_vec" - ;; - mips64*-*-linux*) -- targ_defvec=mips_elf32_ntrad_be_vec -- targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec" -+ targ_defvec=mips_elf64_trad_be_vec -+ targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_le_vec" - ;; - mips*el-*-linux*) - targ_defvec=mips_elf32_trad_le_vec ---- a/ld/configure.tgt -+++ b/ld/configure.tgt -@@ -543,12 +543,12 @@ mips*-*-vxworks*) targ_emul=elf32ebmipvx - ;; - mips*-*-windiss) targ_emul=elf32mipswindiss - ;; --mips64*el-*-linux-*) targ_emul=elf32ltsmipn32 -- targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip" -+mips64*el-*-linux-*) targ_emul=elf64ltsmip -+ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32ltsmip elf32btsmip elf64btsmip" - targ_extra_libpath=$targ_extra_emuls - ;; --mips64*-*-linux-*) targ_emul=elf32btsmipn32 -- targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip" -+mips64*-*-linux-*) targ_emul=elf64btsmip -+ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip elf64ltsmip" - targ_extra_libpath=$targ_extra_emuls - ;; - mips*el-*-linux-*) targ_emul=elf32ltsmip diff --git a/toolchain/binutils/patches/2.39/001-PR-30569-always-call-elf_backend_size_dynamic_sectio.patch b/toolchain/binutils/patches/2.39/001-PR-30569-always-call-elf_backend_size_dynamic_sectio.patch deleted file mode 100644 index 84b99172f71..00000000000 --- a/toolchain/binutils/patches/2.39/001-PR-30569-always-call-elf_backend_size_dynamic_sectio.patch +++ /dev/null @@ -1,2172 +0,0 @@ -From af969b14aedcc0ae27dcefab4327ff2d153dec8b Mon Sep 17 00:00:00 2001 -From: Alan Modra -Date: Thu, 28 Mar 2024 19:25:42 +1030 -Subject: [PATCH 1/2] PR 30569, always call elf_backend_size_dynamic_sections - -This largely mechanical patch is preparation for a followup patch. - -For quite some time I've thought that it would be useful to call -elf_backend_size_dynamic_sections even when no dynamic objects are -seen by the linker. That's what this patch does, with some renaming. -There are no functional changes to the linker, just a move of the -dynobj test in bfd_elf_size_dynamic_sections to target backend -functions, replacing the asserts/aborts already there. No doubt some -of the current always_size_sections functions could be moved to -size_dynamic_sections but I haven't made that change. - -Because both hooks are now always called, I have renamed -always_size_sections to early_size_sections and size_dynamic_sections -to late_size_sections. I condisdered calling late_size_sections plain -size_sections, since this is the usual target dynamic section sizing -hook, but decided that searching the sources for "size_sections" would -then hit early_size_sections and other functions. ---- - bfd/elf-bfd.h | 35 +++++++++++++++++------------------ - bfd/elf-m10300.c | 11 ++++++----- - bfd/elf32-arc.c | 9 +++++---- - bfd/elf32-arm.c | 15 ++++++++------- - bfd/elf32-bfin.c | 31 ++++++++++++++++--------------- - bfd/elf32-cr16.c | 11 ++++++----- - bfd/elf32-cris.c | 13 +++++++------ - bfd/elf32-csky.c | 8 ++++---- - bfd/elf32-frv.c | 23 ++++++++++++----------- - bfd/elf32-hppa.c | 8 ++++---- - bfd/elf32-i386.c | 7 +++---- - bfd/elf32-lm32.c | 15 ++++++++------- - bfd/elf32-m32c.c | 8 ++++---- - bfd/elf32-m32r.c | 11 ++++++----- - bfd/elf32-m68k.c | 16 ++++++++-------- - bfd/elf32-metag.c | 8 ++++---- - bfd/elf32-microblaze.c | 9 +++++---- - bfd/elf32-mips.c | 6 ++---- - bfd/elf32-nds32.c | 9 +++++---- - bfd/elf32-nios2.c | 15 ++++++++------- - bfd/elf32-or1k.c | 9 +++++---- - bfd/elf32-ppc.c | 11 ++++++----- - bfd/elf32-rl78.c | 8 ++++---- - bfd/elf32-s390.c | 10 +++++----- - bfd/elf32-score.c | 35 ++++++++++++++++++----------------- - bfd/elf32-score.h | 4 ++-- - bfd/elf32-score7.c | 13 +++++++------ - bfd/elf32-sh.c | 15 +++++++-------- - bfd/elf32-sparc.c | 3 +-- - bfd/elf32-tic6x.c | 14 +++++++------- - bfd/elf32-tilegx.c | 2 +- - bfd/elf32-tilepro.c | 11 +++++------ - bfd/elf32-vax.c | 16 +++++++--------- - bfd/elf32-xstormy16.c | 8 ++++---- - bfd/elf32-xtensa.c | 13 ++++++------- - bfd/elf64-alpha.c | 19 ++++++++++--------- - bfd/elf64-hppa.c | 11 ++++------- - bfd/elf64-ia64-vms.c | 13 +++++++------ - bfd/elf64-mips.c | 8 ++++---- - bfd/elf64-ppc.c | 12 ++++++------ - bfd/elf64-s390.c | 10 +++++----- - bfd/elf64-sparc.c | 4 ++-- - bfd/elf64-tilegx.c | 2 +- - bfd/elf64-x86-64.c | 7 +++---- - bfd/elflink.c | 9 ++++----- - bfd/elfn32-mips.c | 6 ++---- - bfd/elfnn-aarch64.c | 21 +++++++++++---------- - bfd/elfnn-ia64.c | 11 ++++++----- - bfd/elfnn-kvx.c | 19 +++++++++---------- - bfd/elfnn-loongarch.c | 9 +++++---- - bfd/elfnn-riscv.c | 7 ++++--- - bfd/elfxx-mips.c | 15 ++++++++------- - bfd/elfxx-mips.h | 4 ++-- - bfd/elfxx-sparc.c | 7 ++++--- - bfd/elfxx-sparc.h | 2 +- - bfd/elfxx-target.h | 12 ++++++------ - bfd/elfxx-tilegx.c | 7 ++++--- - bfd/elfxx-tilegx.h | 2 +- - bfd/elfxx-x86.c | 8 ++++---- - bfd/elfxx-x86.h | 8 ++++---- - ld/emultempl/vms.em | 7 +++---- - 61 files changed, 343 insertions(+), 337 deletions(-) - ---- a/bfd/elf-bfd.h -+++ b/bfd/elf-bfd.h -@@ -1136,7 +1136,7 @@ struct elf_backend_data - /* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend - linker for every symbol which is defined by a dynamic object and - referenced by a regular object. This is called after all the -- input files have been seen, but before the SIZE_DYNAMIC_SECTIONS -+ input files have been seen, but before the LATE_SIZE_SECTIONS - function has been called. The hash table entry should be - bfd_link_hash_defined ore bfd_link_hash_defweak, and it should be - defined in a section from a dynamic object. Dynamic object -@@ -1148,24 +1148,23 @@ struct elf_backend_data - bool (*elf_backend_adjust_dynamic_symbol) - (struct bfd_link_info *info, struct elf_link_hash_entry *h); - -- /* The ALWAYS_SIZE_SECTIONS function is called by the backend linker -- after all the linker input files have been seen but before the -- section sizes have been set. This is called after -- ADJUST_DYNAMIC_SYMBOL, but before SIZE_DYNAMIC_SECTIONS. */ -- bool (*elf_backend_always_size_sections) -+ /* The EARLY_SIZE_SECTIONS and LATE_SIZE_SECTIONS functions are -+ called by the backend linker after all linker input files have -+ been seen and sections have been assigned to output sections, but -+ before the section sizes have been set. Both of these functions -+ are called even when no dynamic object is seen by the linker. -+ Between them, they must set the sizes of the dynamic sections and -+ other backend specific sections, and may fill in their contents. -+ Most backends need only use LATE_SIZE_SECTIONS. -+ EARLY_SIZE_SECTIONS is called before --export-dynamic makes some -+ symbols dynamic and before ADJUST_DYNAMIC_SYMBOL processes -+ dynamic symbols, LATE_SIZE_SECTIONS afterwards. The generic ELF -+ linker can handle the .dynsym, .dynstr and .hash sections. -+ Besides those, these functions must handle the .interp section -+ and any other sections created by CREATE_DYNAMIC_SECTIONS. */ -+ bool (*elf_backend_early_size_sections) - (bfd *output_bfd, struct bfd_link_info *info); -- -- /* The SIZE_DYNAMIC_SECTIONS function is called by the ELF backend -- linker after all the linker input files have been seen but before -- the sections sizes have been set. This is called after -- ADJUST_DYNAMIC_SYMBOL has been called on all appropriate symbols. -- It is only called when linking against a dynamic object. It must -- set the sizes of the dynamic sections, and may fill in their -- contents as well. The generic ELF linker can handle the .dynsym, -- .dynstr and .hash sections. This function must handle the -- .interp section and any sections created by the -- CREATE_DYNAMIC_SECTIONS entry point. */ -- bool (*elf_backend_size_dynamic_sections) -+ bool (*elf_backend_late_size_sections) - (bfd *output_bfd, struct bfd_link_info *info); - - /* The STRIP_ZERO_SIZED_DYNAMIC_SECTIONS function is called by the ---- a/bfd/elf-m10300.c -+++ b/bfd/elf-m10300.c -@@ -5003,8 +5003,8 @@ _bfd_mn10300_elf_adjust_dynamic_symbol ( - /* Set the sizes of the dynamic sections. */ - - static bool --_bfd_mn10300_elf_size_dynamic_sections (bfd * output_bfd, -- struct bfd_link_info * info) -+_bfd_mn10300_elf_late_size_sections (bfd * output_bfd, -+ struct bfd_link_info * info) - { - struct elf32_mn10300_link_hash_table *htab = elf32_mn10300_hash_table (info); - bfd * dynobj; -@@ -5012,7 +5012,8 @@ _bfd_mn10300_elf_size_dynamic_sections ( - bool relocs; - - dynobj = htab->root.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -5499,8 +5500,8 @@ mn10300_elf_mkobject (bfd *abfd) - _bfd_mn10300_elf_create_dynamic_sections - #define elf_backend_adjust_dynamic_symbol \ - _bfd_mn10300_elf_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections \ -- _bfd_mn10300_elf_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ _bfd_mn10300_elf_late_size_sections - #define elf_backend_omit_section_dynsym _bfd_elf_omit_section_dynsym_all - #define elf_backend_finish_dynamic_symbol \ - _bfd_mn10300_elf_finish_dynamic_symbol ---- a/bfd/elf32-arc.c -+++ b/bfd/elf32-arc.c -@@ -2702,8 +2702,8 @@ elf_arc_finish_dynamic_sections (bfd * o - - /* Set the sizes of the dynamic sections. */ - static bool --elf_arc_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_arc_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; -@@ -2711,7 +2711,8 @@ elf_arc_size_dynamic_sections (bfd *outp - struct elf_link_hash_table *htab = elf_hash_table (info); - - dynobj = htab->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->dynamic_sections_created) - { -@@ -3126,7 +3127,7 @@ arc_elf_relax_section (bfd *abfd, asecti - #define elf_backend_finish_dynamic_symbol elf_arc_finish_dynamic_symbol - - #define elf_backend_finish_dynamic_sections elf_arc_finish_dynamic_sections --#define elf_backend_size_dynamic_sections elf_arc_size_dynamic_sections -+#define elf_backend_late_size_sections elf_arc_late_size_sections - - #define elf_backend_can_gc_sections 1 - #define elf_backend_want_got_plt 1 ---- a/bfd/elf32-arm.c -+++ b/bfd/elf32-arm.c -@@ -16729,8 +16729,8 @@ bfd_elf32_arm_set_byteswap_code (struct - /* Set the sizes of the dynamic sections. */ - - static bool --elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info * info) -+elf32_arm_late_size_sections (bfd * output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info * info) - { - bfd * dynobj; - asection * s; -@@ -16743,7 +16743,9 @@ elf32_arm_size_dynamic_sections (bfd * o - return false; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; -+ - check_use_blx (htab); - - if (elf_hash_table (info)->dynamic_sections_created) -@@ -17115,8 +17117,7 @@ elf32_arm_size_dynamic_sections (bfd * o - _TLS_MODULE_BASE_, if needed. */ - - static bool --elf32_arm_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elf32_arm_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - asection *tls_sec; - struct elf32_arm_link_hash_table *htab; -@@ -20283,8 +20284,8 @@ elf32_arm_backend_symbol_processing (bfd - #define elf_backend_create_dynamic_sections elf32_arm_create_dynamic_sections - #define elf_backend_finish_dynamic_symbol elf32_arm_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections elf32_arm_finish_dynamic_sections --#define elf_backend_size_dynamic_sections elf32_arm_size_dynamic_sections --#define elf_backend_always_size_sections elf32_arm_always_size_sections -+#define elf_backend_late_size_sections elf32_arm_late_size_sections -+#define elf_backend_early_size_sections elf32_arm_early_size_sections - #define elf_backend_init_index_section _bfd_elf_init_2_index_sections - #define elf_backend_init_file_header elf32_arm_init_file_header - #define elf_backend_reloc_type_class elf32_arm_reloc_type_class ---- a/bfd/elf32-bfin.c -+++ b/bfd/elf32-bfin.c -@@ -4027,8 +4027,8 @@ _bfinfdpic_size_got_plt (bfd *output_bfd - /* Set the sizes of the dynamic sections. */ - - static bool --elf32_bfinfdpic_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elf32_bfinfdpic_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - struct elf_link_hash_table *htab; - bfd *dynobj; -@@ -4037,7 +4037,8 @@ elf32_bfinfdpic_size_dynamic_sections (b - - htab = elf_hash_table (info); - dynobj = htab->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->dynamic_sections_created) - { -@@ -4086,7 +4087,7 @@ elf32_bfinfdpic_size_dynamic_sections (b - } - - static bool --elf32_bfinfdpic_always_size_sections (bfd *output_bfd, -+elf32_bfinfdpic_early_size_sections (bfd *output_bfd, - struct bfd_link_info *info) - { - if (!bfd_link_relocatable (info) -@@ -5124,15 +5125,16 @@ bfin_discard_copies (struct elf_link_has - } - - static bool --bfin_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+bfin_late_size_sections (bfd * output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; - bool relocs; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -5424,8 +5426,7 @@ struct bfd_elf_special_section const elf - #define elf_backend_check_relocs bfin_check_relocs - #define elf_backend_adjust_dynamic_symbol \ - bfin_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections \ -- bfin_size_dynamic_sections -+#define elf_backend_late_size_sections bfin_late_size_sections - #define elf_backend_relocate_section bfin_relocate_section - #define elf_backend_finish_dynamic_symbol \ - bfin_finish_dynamic_symbol -@@ -5471,9 +5472,9 @@ struct bfd_elf_special_section const elf - #undef bfd_elf32_bfd_link_hash_table_create - #define bfd_elf32_bfd_link_hash_table_create \ - bfinfdpic_elf_link_hash_table_create --#undef elf_backend_always_size_sections --#define elf_backend_always_size_sections \ -- elf32_bfinfdpic_always_size_sections -+#undef elf_backend_early_size_sections -+#define elf_backend_early_size_sections \ -+ elf32_bfinfdpic_early_size_sections - - #undef elf_backend_create_dynamic_sections - #define elf_backend_create_dynamic_sections \ -@@ -5481,9 +5482,9 @@ struct bfd_elf_special_section const elf - #undef elf_backend_adjust_dynamic_symbol - #define elf_backend_adjust_dynamic_symbol \ - elf32_bfinfdpic_adjust_dynamic_symbol --#undef elf_backend_size_dynamic_sections --#define elf_backend_size_dynamic_sections \ -- elf32_bfinfdpic_size_dynamic_sections -+#undef elf_backend_late_size_sections -+#define elf_backend_late_size_sections \ -+ elf32_bfinfdpic_late_size_sections - #undef elf_backend_finish_dynamic_symbol - #define elf_backend_finish_dynamic_symbol \ - elf32_bfinfdpic_finish_dynamic_symbol ---- a/bfd/elf32-cr16.c -+++ b/bfd/elf32-cr16.c -@@ -2381,15 +2381,16 @@ _bfd_cr16_elf_adjust_dynamic_symbol (str - /* Set the sizes of the dynamic sections. */ - - static bool --_bfd_cr16_elf_size_dynamic_sections (bfd * output_bfd, -- struct bfd_link_info * info) -+_bfd_cr16_elf_late_size_sections (bfd * output_bfd, -+ struct bfd_link_info * info) - { - bfd * dynobj; - asection * s; - bool relocs; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -2826,8 +2827,8 @@ _bfd_cr16_elf_reloc_type_class (const st - _bfd_cr16_elf_create_dynamic_sections - #define elf_backend_adjust_dynamic_symbol \ - _bfd_cr16_elf_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections \ -- _bfd_cr16_elf_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ _bfd_cr16_elf_late_size_sections - #define elf_backend_omit_section_dynsym _bfd_elf_omit_section_dynsym_all - #define elf_backend_finish_dynamic_symbol \ - _bfd_cr16_elf_finish_dynamic_symbol ---- a/bfd/elf32-cris.c -+++ b/bfd/elf32-cris.c -@@ -2527,7 +2527,7 @@ cris_elf_plt_sym_val (bfd_vma i ATTRIBUT - entry but we found we will not create any. Called when we find we will - not have any PLT for this symbol, by for example - elf_cris_adjust_dynamic_symbol when we're doing a proper dynamic link, -- or elf_cris_size_dynamic_sections if no dynamic sections will be -+ or elf_cris_late_size_sections if no dynamic sections will be - created (we're only linking static objects). */ - - static bool -@@ -3508,8 +3508,8 @@ cris_elf_check_relocs (bfd *abfd, - /* Set the sizes of the dynamic sections. */ - - static bool --elf_cris_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_cris_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_cris_link_hash_table * htab; - bfd *dynobj; -@@ -3521,7 +3521,8 @@ elf_cris_size_dynamic_sections (bfd *out - return false; - - dynobj = htab->root.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->root.dynamic_sections_created) - { -@@ -4090,8 +4091,8 @@ elf_cris_got_elt_size (bfd *abfd ATTRIBU - elf_cris_adjust_dynamic_symbol - #define elf_backend_copy_indirect_symbol \ - elf_cris_copy_indirect_symbol --#define elf_backend_size_dynamic_sections \ -- elf_cris_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ elf_cris_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_finish_dynamic_symbol \ - elf_cris_finish_dynamic_symbol ---- a/bfd/elf32-csky.c -+++ b/bfd/elf32-csky.c -@@ -1893,8 +1893,8 @@ csky_allocate_dynrelocs (struct elf_link - /* Set the sizes of the dynamic sections. */ - - static bool --csky_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+csky_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct csky_elf_link_hash_table *htab; - bfd *dynobj; -@@ -1907,7 +1907,7 @@ csky_elf_size_dynamic_sections (bfd *out - return false; - dynobj = htab->elf.dynobj; - if (dynobj == NULL) -- return false; -+ return true; - - if (htab->elf.dynamic_sections_created) - { -@@ -5344,7 +5344,7 @@ elf32_csky_obj_attrs_handle_unknown (bfd - /* Dynamic relocate related API. */ - #define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections - #define elf_backend_adjust_dynamic_symbol csky_elf_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections csky_elf_size_dynamic_sections -+#define elf_backend_late_size_sections csky_elf_late_size_sections - #define elf_backend_finish_dynamic_symbol csky_elf_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections csky_elf_finish_dynamic_sections - #define elf_backend_rela_normal 1 ---- a/bfd/elf32-frv.c -+++ b/bfd/elf32-frv.c -@@ -5423,15 +5423,16 @@ _frvfdpic_size_got_plt (bfd *output_bfd, - /* Set the sizes of the dynamic sections. */ - - static bool --elf32_frvfdpic_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elf32_frvfdpic_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; - struct _frvfdpic_dynamic_got_plt_info gpinfo; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -5472,8 +5473,8 @@ elf32_frvfdpic_size_dynamic_sections (bf - } - - static bool --elf32_frvfdpic_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elf32_frvfdpic_early_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - if (!bfd_link_relocatable (info) - && !bfd_elf_stack_segment_size (output_bfd, info, -@@ -6817,9 +6818,9 @@ elf32_frv_grok_psinfo (bfd *abfd, Elf_In - #undef bfd_elf32_bfd_link_hash_table_create - #define bfd_elf32_bfd_link_hash_table_create \ - frvfdpic_elf_link_hash_table_create --#undef elf_backend_always_size_sections --#define elf_backend_always_size_sections \ -- elf32_frvfdpic_always_size_sections -+#undef elf_backend_early_size_sections -+#define elf_backend_early_size_sections \ -+ elf32_frvfdpic_early_size_sections - - #undef elf_backend_create_dynamic_sections - #define elf_backend_create_dynamic_sections \ -@@ -6827,9 +6828,9 @@ elf32_frv_grok_psinfo (bfd *abfd, Elf_In - #undef elf_backend_adjust_dynamic_symbol - #define elf_backend_adjust_dynamic_symbol \ - elf32_frvfdpic_adjust_dynamic_symbol --#undef elf_backend_size_dynamic_sections --#define elf_backend_size_dynamic_sections \ -- elf32_frvfdpic_size_dynamic_sections -+#undef elf_backend_late_size_sections -+#define elf_backend_late_size_sections \ -+ elf32_frvfdpic_late_size_sections - #undef bfd_elf32_bfd_relax_section - #define bfd_elf32_bfd_relax_section \ - elf32_frvfdpic_relax_section ---- a/bfd/elf32-hppa.c -+++ b/bfd/elf32-hppa.c -@@ -2042,8 +2042,8 @@ clobber_millicode_symbols (struct elf_li - /* Set the sizes of the dynamic sections. */ - - static bool --elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf32_hppa_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf32_hppa_link_hash_table *htab; - bfd *dynobj; -@@ -2057,7 +2057,7 @@ elf32_hppa_size_dynamic_sections (bfd *o - - dynobj = htab->etab.dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - - if (htab->etab.dynamic_sections_created) - { -@@ -4450,7 +4450,7 @@ elf32_hppa_elf_get_symbol_type (Elf_Inte - #define elf_backend_hide_symbol elf32_hppa_hide_symbol - #define elf_backend_finish_dynamic_symbol elf32_hppa_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections elf32_hppa_finish_dynamic_sections --#define elf_backend_size_dynamic_sections elf32_hppa_size_dynamic_sections -+#define elf_backend_late_size_sections elf32_hppa_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_gc_mark_hook elf32_hppa_gc_mark_hook - #define elf_backend_grok_prstatus elf32_hppa_grok_prstatus ---- a/bfd/elf32-i386.c -+++ b/bfd/elf32-i386.c -@@ -1932,8 +1932,7 @@ elf_i386_scan_relocs (bfd *abfd, - } - - static bool --elf_i386_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elf_i386_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - bfd *abfd; - -@@ -1946,7 +1945,7 @@ elf_i386_always_size_sections (bfd *outp - elf_i386_scan_relocs)) - return false; - -- return _bfd_x86_elf_always_size_sections (output_bfd, info); -+ return _bfd_x86_elf_early_size_sections (output_bfd, info); - } - - /* Set the correct type for an x86 ELF section. We do this by the -@@ -4443,7 +4442,7 @@ elf_i386_link_setup_gnu_properties (stru - #define bfd_elf32_get_synthetic_symtab elf_i386_get_synthetic_symtab - - #define elf_backend_relocs_compatible _bfd_elf_relocs_compatible --#define elf_backend_always_size_sections elf_i386_always_size_sections -+#define elf_backend_early_size_sections elf_i386_early_size_sections - #define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections - #define elf_backend_fake_sections elf_i386_fake_sections - #define elf_backend_finish_dynamic_sections elf_i386_finish_dynamic_sections ---- a/bfd/elf32-lm32.c -+++ b/bfd/elf32-lm32.c -@@ -1906,8 +1906,8 @@ allocate_dynrelocs (struct elf_link_hash - /* Set the sizes of the dynamic sections. */ - - static bool --lm32_elf_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+lm32_elf_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - struct elf_lm32_link_hash_table *htab; - bfd *dynobj; -@@ -1920,7 +1920,8 @@ lm32_elf_size_dynamic_sections (bfd *out - return false; - - dynobj = htab->root.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->root.dynamic_sections_created) - { -@@ -2309,7 +2310,7 @@ lm32_elf_create_dynamic_sections (bfd *a - } - - static bool --lm32_elf_always_size_sections (bfd *output_bfd, struct bfd_link_info *info) -+lm32_elf_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - if (!bfd_link_relocatable (info)) - { -@@ -2395,7 +2396,7 @@ lm32_elf_fdpic_copy_private_bfd_data (bf - #define bfd_elf32_bfd_link_hash_table_create lm32_elf_link_hash_table_create - #define elf_backend_check_relocs lm32_elf_check_relocs - #define elf_backend_reloc_type_class lm32_elf_reloc_type_class --#define elf_backend_size_dynamic_sections lm32_elf_size_dynamic_sections -+#define elf_backend_late_size_sections lm32_elf_late_size_sections - #define elf_backend_omit_section_dynsym _bfd_elf_omit_section_dynsym_all - #define elf_backend_create_dynamic_sections lm32_elf_create_dynamic_sections - #define elf_backend_finish_dynamic_sections lm32_elf_finish_dynamic_sections -@@ -2416,8 +2417,8 @@ lm32_elf_fdpic_copy_private_bfd_data (bf - #undef elf32_bed - #define elf32_bed elf32_lm32fdpic_bed - --#undef elf_backend_always_size_sections --#define elf_backend_always_size_sections lm32_elf_always_size_sections -+#undef elf_backend_early_size_sections -+#define elf_backend_early_size_sections lm32_elf_early_size_sections - #undef bfd_elf32_bfd_copy_private_bfd_data - #define bfd_elf32_bfd_copy_private_bfd_data lm32_elf_fdpic_copy_private_bfd_data - ---- a/bfd/elf32-m32c.c -+++ b/bfd/elf32-m32c.c -@@ -773,8 +773,8 @@ m32c_elf_finish_dynamic_sections (bfd *a - } - - static bool --m32c_elf_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+m32c_elf_early_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *splt; -@@ -2131,8 +2131,8 @@ _bfd_m32c_elf_eh_frame_address_size (bfd - #define elf_backend_check_relocs m32c_elf_check_relocs - #define elf_backend_object_p m32c_elf_object_p - #define elf_symbol_leading_char ('_') --#define elf_backend_always_size_sections \ -- m32c_elf_always_size_sections -+#define elf_backend_early_size_sections \ -+ m32c_elf_early_size_sections - #define elf_backend_finish_dynamic_sections \ - m32c_elf_finish_dynamic_sections - ---- a/bfd/elf32-m32r.c -+++ b/bfd/elf32-m32r.c -@@ -1958,8 +1958,8 @@ allocate_dynrelocs (struct elf_link_hash - /* Set the sizes of the dynamic sections. */ - - static bool --m32r_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+m32r_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_link_hash_table *htab; - bfd *dynobj; -@@ -1968,7 +1968,7 @@ m32r_elf_size_dynamic_sections (bfd *out - bfd *ibfd; - - #ifdef DEBUG_PIC -- printf ("m32r_elf_size_dynamic_sections()\n"); -+ printf ("m32r_elf_late_size_sections()\n"); - #endif - - htab = m32r_elf_hash_table (info); -@@ -1976,7 +1976,8 @@ m32r_elf_size_dynamic_sections (bfd *out - return false; - - dynobj = htab->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->dynamic_sections_created) - { -@@ -3658,7 +3659,7 @@ m32r_elf_reloc_type_class (const struct - - #define elf_backend_create_dynamic_sections m32r_elf_create_dynamic_sections - #define bfd_elf32_bfd_link_hash_table_create m32r_elf_link_hash_table_create --#define elf_backend_size_dynamic_sections m32r_elf_size_dynamic_sections -+#define elf_backend_late_size_sections m32r_elf_late_size_sections - #define elf_backend_omit_section_dynsym _bfd_elf_omit_section_dynsym_all - #define elf_backend_finish_dynamic_sections m32r_elf_finish_dynamic_sections - #define elf_backend_adjust_dynamic_symbol m32r_elf_adjust_dynamic_symbol ---- a/bfd/elf32-m68k.c -+++ b/bfd/elf32-m68k.c -@@ -2934,7 +2934,7 @@ elf_m68k_get_plt_info (bfd *output_bfd) - It's a convenient place to determine the PLT style. */ - - static bool --elf_m68k_always_size_sections (bfd *output_bfd, struct bfd_link_info *info) -+elf_m68k_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - /* Bind input BFDs to GOTs and calculate sizes of .got and .rela.got - sections. */ -@@ -3107,15 +3107,16 @@ elf_m68k_adjust_dynamic_symbol (struct b - /* Set the sizes of the dynamic sections. */ - - static bool --elf_m68k_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_m68k_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; - bool relocs; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -4628,12 +4629,11 @@ elf_m68k_grok_psinfo (bfd *abfd, Elf_Int - #define bfd_elf32_bfd_final_link bfd_elf_final_link - - #define elf_backend_check_relocs elf_m68k_check_relocs --#define elf_backend_always_size_sections \ -- elf_m68k_always_size_sections -+#define elf_backend_early_size_sections \ -+ elf_m68k_early_size_sections - #define elf_backend_adjust_dynamic_symbol \ - elf_m68k_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections \ -- elf_m68k_size_dynamic_sections -+#define elf_backend_late_size_sections elf_m68k_late_size_sections - #define elf_backend_final_write_processing elf_m68k_final_write_processing - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_relocate_section elf_m68k_relocate_section ---- a/bfd/elf32-metag.c -+++ b/bfd/elf32-metag.c -@@ -2717,8 +2717,8 @@ allocate_dynrelocs (struct elf_link_hash - /* Set the sizes of the dynamic sections. */ - - static bool --elf_metag_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_metag_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_metag_link_hash_table *htab; - bfd *dynobj; -@@ -2729,7 +2729,7 @@ elf_metag_size_dynamic_sections (bfd *ou - htab = metag_link_hash_table (info); - dynobj = htab->etab.dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - - if (htab->etab.dynamic_sections_created) - { -@@ -4019,7 +4019,7 @@ elf_metag_plt_sym_val (bfd_vma i, const - #define elf_backend_adjust_dynamic_symbol elf_metag_adjust_dynamic_symbol - #define elf_backend_finish_dynamic_symbol elf_metag_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections elf_metag_finish_dynamic_sections --#define elf_backend_size_dynamic_sections elf_metag_size_dynamic_sections -+#define elf_backend_late_size_sections elf_metag_late_size_sections - #define elf_backend_omit_section_dynsym \ - _bfd_elf_omit_section_dynsym_all - #define elf_backend_init_file_header elf_metag_init_file_header ---- a/bfd/elf32-microblaze.c -+++ b/bfd/elf32-microblaze.c -@@ -2946,8 +2946,8 @@ allocate_dynrelocs (struct elf_link_hash - /* Set the sizes of the dynamic sections. */ - - static bool --microblaze_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+microblaze_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf32_mb_link_hash_table *htab; - bfd *dynobj; -@@ -2959,7 +2959,8 @@ microblaze_elf_size_dynamic_sections (bf - return false; - - dynobj = htab->elf.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - /* Set up .got offsets for local syms, and space for local dynamic - relocs. */ -@@ -3477,7 +3478,7 @@ microblaze_elf_add_symbol_hook (bfd *abf - #define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections - #define elf_backend_finish_dynamic_sections microblaze_elf_finish_dynamic_sections - #define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol --#define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections -+#define elf_backend_late_size_sections microblaze_elf_late_size_sections - #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook - - #include "elf32-target.h" ---- a/bfd/elf32-mips.c -+++ b/bfd/elf32-mips.c -@@ -2525,10 +2525,8 @@ static const struct ecoff_debug_swap mip - #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag - #define elf_backend_adjust_dynamic_symbol \ - _bfd_mips_elf_adjust_dynamic_symbol --#define elf_backend_always_size_sections \ -- _bfd_mips_elf_always_size_sections --#define elf_backend_size_dynamic_sections \ -- _bfd_mips_elf_size_dynamic_sections -+#define elf_backend_early_size_sections _bfd_mips_elf_early_size_sections -+#define elf_backend_late_size_sections _bfd_mips_elf_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_relocate_section _bfd_mips_elf_relocate_section - #define elf_backend_finish_dynamic_symbol \ ---- a/bfd/elf32-nds32.c -+++ b/bfd/elf32-nds32.c -@@ -4302,8 +4302,8 @@ elf32_nds32_add_dynreloc (bfd *output_bf - /* Set the sizes of the dynamic sections. */ - - static bool --nds32_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+nds32_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_nds32_link_hash_table *htab; - bfd *dynobj; -@@ -4316,7 +4316,8 @@ nds32_elf_size_dynamic_sections (bfd *ou - return false; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -13984,7 +13985,7 @@ nds32_elf_unify_tls_model (bfd *inbfd, a - #define elf_backend_create_dynamic_sections nds32_elf_create_dynamic_sections - #define elf_backend_finish_dynamic_sections nds32_elf_finish_dynamic_sections - #define elf_backend_finish_dynamic_symbol nds32_elf_finish_dynamic_symbol --#define elf_backend_size_dynamic_sections nds32_elf_size_dynamic_sections -+#define elf_backend_late_size_sections nds32_elf_late_size_sections - #define elf_backend_relocate_section nds32_elf_relocate_section - #define elf_backend_gc_mark_hook nds32_elf_gc_mark_hook - #define elf_backend_grok_prstatus nds32_elf_grok_prstatus ---- a/bfd/elf32-nios2.c -+++ b/bfd/elf32-nios2.c -@@ -5411,7 +5411,7 @@ nios2_elf32_adjust_dynamic_symbol (struc - return true; - } - --/* Worker function for nios2_elf32_size_dynamic_sections. */ -+/* Worker function for nios2_elf32_late_size_sections. */ - static bool - adjust_dynrelocs (struct elf_link_hash_entry *h, void *inf) - { -@@ -5438,7 +5438,7 @@ adjust_dynrelocs (struct elf_link_hash_e - return true; - } - --/* Another worker function for nios2_elf32_size_dynamic_sections. -+/* Another worker function for nios2_elf32_late_size_sections. - Allocate space in .plt, .got and associated reloc sections for - dynamic relocs. */ - static bool -@@ -5673,11 +5673,11 @@ allocate_dynrelocs (struct elf_link_hash - return true; - } - --/* Implement elf_backend_size_dynamic_sections: -+/* Implement elf_backend_late_size_sections: - Set the sizes of the dynamic sections. */ - static bool --nios2_elf32_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+nios2_elf32_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; -@@ -5687,7 +5687,8 @@ nios2_elf32_size_dynamic_sections (bfd * - - htab = elf32_nios2_hash_table (info); - dynobj = htab->root.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - htab->res_n_size = 0; - if (htab->root.dynamic_sections_created) -@@ -6058,7 +6059,7 @@ const struct bfd_elf_special_section elf - nios2_elf32_finish_dynamic_sections - #define elf_backend_adjust_dynamic_symbol nios2_elf32_adjust_dynamic_symbol - #define elf_backend_reloc_type_class nios2_elf32_reloc_type_class --#define elf_backend_size_dynamic_sections nios2_elf32_size_dynamic_sections -+#define elf_backend_late_size_sections nios2_elf32_late_size_sections - #define elf_backend_add_symbol_hook nios2_elf_add_symbol_hook - #define elf_backend_copy_indirect_symbol nios2_elf32_copy_indirect_symbol - #define elf_backend_object_p nios2_elf32_object_p ---- a/bfd/elf32-or1k.c -+++ b/bfd/elf32-or1k.c -@@ -3039,8 +3039,8 @@ allocate_dynrelocs (struct elf_link_hash - /* Set the sizes of the dynamic sections. */ - - static bool --or1k_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+or1k_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_or1k_link_hash_table *htab; - bfd *dynobj; -@@ -3053,7 +3053,8 @@ or1k_elf_size_dynamic_sections (bfd *out - return false; - - dynobj = htab->root.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->root.dynamic_sections_created) - { -@@ -3406,7 +3407,7 @@ or1k_grok_psinfo (bfd *abfd, Elf_Interna - #define elf_backend_copy_indirect_symbol or1k_elf_copy_indirect_symbol - #define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections - #define elf_backend_finish_dynamic_sections or1k_elf_finish_dynamic_sections --#define elf_backend_size_dynamic_sections or1k_elf_size_dynamic_sections -+#define elf_backend_late_size_sections or1k_elf_late_size_sections - #define elf_backend_adjust_dynamic_symbol or1k_elf_adjust_dynamic_symbol - #define elf_backend_finish_dynamic_symbol or1k_elf_finish_dynamic_symbol - ---- a/bfd/elf32-ppc.c -+++ b/bfd/elf32-ppc.c -@@ -5477,8 +5477,8 @@ static const unsigned char glink_eh_fram - /* Set the sizes of the dynamic sections. */ - - static bool --ppc_elf_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+ppc_elf_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - struct ppc_elf_link_hash_table *htab; - asection *s; -@@ -5486,11 +5486,12 @@ ppc_elf_size_dynamic_sections (bfd *outp - bfd *ibfd; - - #ifdef DEBUG -- fprintf (stderr, "ppc_elf_size_dynamic_sections called\n"); -+ fprintf (stderr, "ppc_elf_late_size_sections called\n"); - #endif - - htab = ppc_elf_hash_table (info); -- BFD_ASSERT (htab->elf.dynobj != NULL); -+ if (htab->elf.dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -10414,7 +10415,7 @@ ppc_elf_finish_dynamic_sections (bfd *ou - #define elf_backend_copy_indirect_symbol ppc_elf_copy_indirect_symbol - #define elf_backend_adjust_dynamic_symbol ppc_elf_adjust_dynamic_symbol - #define elf_backend_add_symbol_hook ppc_elf_add_symbol_hook --#define elf_backend_size_dynamic_sections ppc_elf_size_dynamic_sections -+#define elf_backend_late_size_sections ppc_elf_late_size_sections - #define elf_backend_hash_symbol ppc_elf_hash_symbol - #define elf_backend_finish_dynamic_symbol ppc_elf_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections ppc_elf_finish_dynamic_sections ---- a/bfd/elf32-rl78.c -+++ b/bfd/elf32-rl78.c -@@ -1440,8 +1440,8 @@ rl78_elf_finish_dynamic_sections (bfd *a - } - - static bool --rl78_elf_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+rl78_elf_early_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *splt; -@@ -2609,8 +2609,8 @@ rl78_elf_relax_section (bfd *abfd, - - #define bfd_elf32_bfd_relax_section rl78_elf_relax_section - #define elf_backend_check_relocs rl78_elf_check_relocs --#define elf_backend_always_size_sections \ -- rl78_elf_always_size_sections -+#define elf_backend_early_size_sections \ -+ rl78_elf_early_size_sections - #define elf_backend_finish_dynamic_sections \ - rl78_elf_finish_dynamic_sections - ---- a/bfd/elf32-s390.c -+++ b/bfd/elf32-s390.c -@@ -1366,7 +1366,7 @@ elf_s390_gc_mark_hook (asection *sec, - entry but we found we will not create any. Called when we find we will - not have any PLT for this symbol, by for example - elf_s390_adjust_dynamic_symbol when we're doing a proper dynamic link, -- or elf_s390_size_dynamic_sections if no dynamic sections will be -+ or elf_s390_late_size_sections if no dynamic sections will be - created (we're only linking static objects). */ - - static void -@@ -1778,8 +1778,8 @@ allocate_dynrelocs (struct elf_link_hash - /* Set the sizes of the dynamic sections. */ - - static bool --elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_s390_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_s390_link_hash_table *htab; - bfd *dynobj; -@@ -1790,7 +1790,7 @@ elf_s390_size_dynamic_sections (bfd *out - htab = elf_s390_hash_table (info); - dynobj = htab->elf.dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - - if (htab->elf.dynamic_sections_created) - { -@@ -3926,7 +3926,7 @@ elf32_s390_merge_private_bfd_data (bfd * - #define elf_backend_gc_mark_hook elf_s390_gc_mark_hook - #define elf_backend_reloc_type_class elf_s390_reloc_type_class - #define elf_backend_relocate_section elf_s390_relocate_section --#define elf_backend_size_dynamic_sections elf_s390_size_dynamic_sections -+#define elf_backend_late_size_sections elf_s390_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_grok_prstatus elf_s390_grok_prstatus - #define elf_backend_grok_psinfo elf_s390_grok_psinfo ---- a/bfd/elf32-score.c -+++ b/bfd/elf32-score.c -@@ -1089,7 +1089,7 @@ score_elf_got_info (bfd *abfd, asection - appear towards the end. This reduces the amount of GOT space - required. MAX_LOCAL is used to set the number of local symbols - known to be in the dynamic symbol table. During -- s3_bfd_score_elf_size_dynamic_sections, this value is 1. Afterward, the -+ s3_bfd_score_elf_late_size_sections, this value is 1. Afterward, the - section symbols are added and the count is higher. */ - static bool - score_elf_sort_hash_table (struct bfd_link_info *info, -@@ -3160,8 +3160,8 @@ s3_bfd_score_elf_adjust_dynamic_symbol ( - /* This function is called after all the input files have been read, - and the input sections have been assigned to output sections. */ - static bool --s3_bfd_score_elf_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+s3_bfd_score_elf_early_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; -@@ -3237,14 +3237,15 @@ s3_bfd_score_elf_always_size_sections (b - - /* Set the sizes of the dynamic sections. */ - static bool --s3_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) -+s3_bfd_score_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; - bool reltext; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -3313,7 +3314,7 @@ s3_bfd_score_elf_size_dynamic_sections ( - } - else if (startswith (name, ".got")) - { -- /* s3_bfd_score_elf_always_size_sections() has already done -+ /* s3_bfd_score_elf_early_size_sections() has already done - most of the work, but some symbols may have been mapped - to versions that we must now resolve in the got_entries - hash tables. */ -@@ -4177,22 +4178,22 @@ _bfd_score_elf_adjust_dynamic_symbol (st - } - - static bool --_bfd_score_elf_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+_bfd_score_elf_early_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - if (bfd_get_mach (output_bfd) == bfd_mach_score3) -- return s3_bfd_score_elf_always_size_sections (output_bfd, info); -+ return s3_bfd_score_elf_early_size_sections (output_bfd, info); - else -- return s7_bfd_score_elf_always_size_sections (output_bfd, info); -+ return s7_bfd_score_elf_early_size_sections (output_bfd, info); - } - - static bool --_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) -+_bfd_score_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - if (bfd_get_mach (output_bfd) == bfd_mach_score3) -- return s3_bfd_score_elf_size_dynamic_sections (output_bfd, info); -+ return s3_bfd_score_elf_late_size_sections (output_bfd, info); - else -- return s7_bfd_score_elf_size_dynamic_sections (output_bfd, info); -+ return s7_bfd_score_elf_late_size_sections (output_bfd, info); - } - - static bool -@@ -4455,10 +4456,10 @@ _bfd_score_elf_common_definition (Elf_In - _bfd_score_elf_section_from_bfd_section - #define elf_backend_adjust_dynamic_symbol \ - _bfd_score_elf_adjust_dynamic_symbol --#define elf_backend_always_size_sections \ -- _bfd_score_elf_always_size_sections --#define elf_backend_size_dynamic_sections \ -- _bfd_score_elf_size_dynamic_sections -+#define elf_backend_early_size_sections \ -+ _bfd_score_elf_early_size_sections -+#define elf_backend_late_size_sections \ -+ _bfd_score_elf_late_size_sections - #define elf_backend_omit_section_dynsym _bfd_elf_omit_section_dynsym_all - #define elf_backend_create_dynamic_sections \ - _bfd_score_elf_create_dynamic_sections ---- a/bfd/elf32-score.h -+++ b/bfd/elf32-score.h -@@ -78,10 +78,10 @@ s7_bfd_score_elf_adjust_dynamic_symbol ( - struct elf_link_hash_entry *); - - extern bool --s7_bfd_score_elf_always_size_sections (bfd *, struct bfd_link_info *); -+s7_bfd_score_elf_early_size_sections (bfd *, struct bfd_link_info *); - - extern bool --s7_bfd_score_elf_size_dynamic_sections (bfd *, struct bfd_link_info *); -+s7_bfd_score_elf_late_size_sections (bfd *, struct bfd_link_info *); - - extern bool - s7_bfd_score_elf_create_dynamic_sections (bfd *, struct bfd_link_info *); ---- a/bfd/elf32-score7.c -+++ b/bfd/elf32-score7.c -@@ -975,7 +975,7 @@ score_elf_got_info (bfd *abfd, asection - appear towards the end. This reduces the amount of GOT space - required. MAX_LOCAL is used to set the number of local symbols - known to be in the dynamic symbol table. During -- s7_bfd_score_elf_size_dynamic_sections, this value is 1. Afterward, the -+ s7_bfd_score_elf_late_size_sections, this value is 1. Afterward, the - section symbols are added and the count is higher. */ - - static bool -@@ -2969,8 +2969,8 @@ s7_bfd_score_elf_adjust_dynamic_symbol ( - and the input sections have been assigned to output sections. */ - - bool --s7_bfd_score_elf_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+s7_bfd_score_elf_early_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; -@@ -3047,14 +3047,15 @@ s7_bfd_score_elf_always_size_sections (b - /* Set the sizes of the dynamic sections. */ - - bool --s7_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) -+s7_bfd_score_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; - bool reltext; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -3123,7 +3124,7 @@ s7_bfd_score_elf_size_dynamic_sections ( - } - else if (startswith (name, ".got")) - { -- /* s7_bfd_score_elf_always_size_sections() has already done -+ /* s7_bfd_score_elf_early_size_sections() has already done - most of the work, but some symbols may have been mapped - to versions that we must now resolve in the got_entries - hash tables. */ ---- a/bfd/elf32-sh.c -+++ b/bfd/elf32-sh.c -@@ -2925,7 +2925,7 @@ allocate_dynrelocs (struct elf_link_hash - It's a convenient place to determine the PLT style. */ - - static bool --sh_elf_always_size_sections (bfd *output_bfd, struct bfd_link_info *info) -+sh_elf_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - sh_elf_hash_table (info)->plt_info = get_plt_info (output_bfd, - bfd_link_pic (info)); -@@ -2940,8 +2940,8 @@ sh_elf_always_size_sections (bfd *output - /* Set the sizes of the dynamic sections. */ - - static bool --sh_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+sh_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_sh_link_hash_table *htab; - bfd *dynobj; -@@ -2954,7 +2954,8 @@ sh_elf_size_dynamic_sections (bfd *outpu - return false; - - dynobj = htab->root.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->root.dynamic_sections_created) - { -@@ -6589,10 +6590,8 @@ sh_elf_encode_eh_address (bfd *abfd, - sh_elf_link_hash_table_create - #define elf_backend_adjust_dynamic_symbol \ - sh_elf_adjust_dynamic_symbol --#define elf_backend_always_size_sections \ -- sh_elf_always_size_sections --#define elf_backend_size_dynamic_sections \ -- sh_elf_size_dynamic_sections -+#define elf_backend_early_size_sections sh_elf_early_size_sections -+#define elf_backend_late_size_sections sh_elf_late_size_sections - #define elf_backend_omit_section_dynsym sh_elf_omit_section_dynsym - #define elf_backend_finish_dynamic_symbol \ - sh_elf_finish_dynamic_symbol ---- a/bfd/elf32-sparc.c -+++ b/bfd/elf32-sparc.c -@@ -248,8 +248,7 @@ elf32_sparc_reloc_type_class (const stru - #define elf_backend_adjust_dynamic_symbol \ - _bfd_sparc_elf_adjust_dynamic_symbol - #define elf_backend_omit_section_dynsym _bfd_sparc_elf_omit_section_dynsym --#define elf_backend_size_dynamic_sections \ -- _bfd_sparc_elf_size_dynamic_sections -+#define elf_backend_late_size_sections _bfd_sparc_elf_late_size_sections - #define elf_backend_relocate_section _bfd_sparc_elf_relocate_section - #define elf_backend_finish_dynamic_symbol \ - _bfd_sparc_elf_finish_dynamic_symbol ---- a/bfd/elf32-tic6x.c -+++ b/bfd/elf32-tic6x.c -@@ -3160,7 +3160,7 @@ elf32_tic6x_allocate_dynrelocs (struct e - /* Set the sizes of the dynamic sections. */ - - static bool --elf32_tic6x_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) -+elf32_tic6x_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - struct elf32_tic6x_link_hash_table *htab; - bfd *dynobj; -@@ -3171,7 +3171,7 @@ elf32_tic6x_size_dynamic_sections (bfd * - htab = elf32_tic6x_hash_table (info); - dynobj = htab->elf.dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - - if (htab->elf.dynamic_sections_created) - { -@@ -3358,7 +3358,7 @@ elf32_tic6x_size_dynamic_sections (bfd * - and the input sections have been assigned to output sections. */ - - static bool --elf32_tic6x_always_size_sections (bfd *output_bfd, struct bfd_link_info *info) -+elf32_tic6x_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - if (elf32_tic6x_using_dsbt (output_bfd) && !bfd_link_relocatable (info) - && !bfd_elf_stack_segment_size (output_bfd, info, -@@ -4261,10 +4261,10 @@ elf32_tic6x_write_section (bfd *output_b - #define elf_backend_relocs_compatible _bfd_elf_relocs_compatible - #define elf_backend_finish_dynamic_symbol \ - elf32_tic6x_finish_dynamic_symbol --#define elf_backend_always_size_sections \ -- elf32_tic6x_always_size_sections --#define elf_backend_size_dynamic_sections \ -- elf32_tic6x_size_dynamic_sections -+#define elf_backend_early_size_sections \ -+ elf32_tic6x_early_size_sections -+#define elf_backend_late_size_sections \ -+ elf32_tic6x_late_size_sections - #define elf_backend_finish_dynamic_sections \ - elf32_tic6x_finish_dynamic_sections - #define bfd_elf32_bfd_final_link \ ---- a/bfd/elf32-tilegx.c -+++ b/bfd/elf32-tilegx.c -@@ -105,7 +105,7 @@ tilegx_elf_grok_psinfo (bfd *abfd, Elf_I - #define elf_backend_check_relocs tilegx_elf_check_relocs - #define elf_backend_adjust_dynamic_symbol tilegx_elf_adjust_dynamic_symbol - #define elf_backend_omit_section_dynsym tilegx_elf_omit_section_dynsym --#define elf_backend_size_dynamic_sections tilegx_elf_size_dynamic_sections -+#define elf_backend_late_size_sections tilegx_elf_late_size_sections - #define elf_backend_relocate_section tilegx_elf_relocate_section - #define elf_backend_finish_dynamic_symbol tilegx_elf_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections tilegx_elf_finish_dynamic_sections ---- a/bfd/elf32-tilepro.c -+++ b/bfd/elf32-tilepro.c -@@ -2182,11 +2182,9 @@ tilepro_elf_omit_section_dynsym (bfd *ou - #define ELF32_DYNAMIC_INTERPRETER "/lib/ld.so.1" - - static bool --tilepro_elf_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+tilepro_elf_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { -- (void)output_bfd; -- - struct elf_link_hash_table *htab; - bfd *dynobj; - asection *s; -@@ -2195,7 +2193,8 @@ tilepro_elf_size_dynamic_sections (bfd * - htab = tilepro_elf_hash_table (info); - BFD_ASSERT (htab != NULL); - dynobj = htab->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -3739,7 +3738,7 @@ tilepro_additional_program_headers (bfd - #define elf_backend_check_relocs tilepro_elf_check_relocs - #define elf_backend_adjust_dynamic_symbol tilepro_elf_adjust_dynamic_symbol - #define elf_backend_omit_section_dynsym tilepro_elf_omit_section_dynsym --#define elf_backend_size_dynamic_sections tilepro_elf_size_dynamic_sections -+#define elf_backend_late_size_sections tilepro_elf_late_size_sections - #define elf_backend_relocate_section tilepro_elf_relocate_section - #define elf_backend_finish_dynamic_symbol tilepro_elf_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections tilepro_elf_finish_dynamic_sections ---- a/bfd/elf32-vax.c -+++ b/bfd/elf32-vax.c -@@ -36,7 +36,6 @@ static bool elf_vax_check_relocs (bfd *, - asection *, const Elf_Internal_Rela *); - static bool elf_vax_adjust_dynamic_symbol (struct bfd_link_info *, - struct elf_link_hash_entry *); --static bool elf_vax_size_dynamic_sections (bfd *, struct bfd_link_info *); - static int elf_vax_relocate_section (bfd *, struct bfd_link_info *, - bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, -@@ -985,8 +984,8 @@ elf_vax_discard_got_entries (struct elf_ - /* Discard unused dynamic data if this is a static link. */ - - static bool --elf_vax_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_vax_early_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; -@@ -1024,14 +1023,15 @@ elf_vax_always_size_sections (bfd *outpu - /* Set the sizes of the dynamic sections. */ - - static bool --elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) -+elf_vax_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; - bool relocs; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -1861,10 +1861,8 @@ elf_vax_plt_sym_val (bfd_vma i, const as - #define elf_backend_check_relocs elf_vax_check_relocs - #define elf_backend_adjust_dynamic_symbol \ - elf_vax_adjust_dynamic_symbol --#define elf_backend_always_size_sections \ -- elf_vax_always_size_sections --#define elf_backend_size_dynamic_sections \ -- elf_vax_size_dynamic_sections -+#define elf_backend_early_size_sections elf_vax_early_size_sections -+#define elf_backend_late_size_sections elf_vax_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_relocate_section elf_vax_relocate_section - #define elf_backend_finish_dynamic_symbol \ ---- a/bfd/elf32-xstormy16.c -+++ b/bfd/elf32-xstormy16.c -@@ -706,8 +706,8 @@ xstormy16_elf_relax_section (bfd *dynobj - } - - static bool --xstormy16_elf_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+xstormy16_elf_early_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *splt; -@@ -1013,8 +1013,8 @@ xstormy16_elf_gc_mark_hook (asection *se - #define elf_backend_relocate_section xstormy16_elf_relocate_section - #define elf_backend_gc_mark_hook xstormy16_elf_gc_mark_hook - #define elf_backend_check_relocs xstormy16_elf_check_relocs --#define elf_backend_always_size_sections \ -- xstormy16_elf_always_size_sections -+#define elf_backend_early_size_sections \ -+ xstormy16_elf_early_size_sections - #define elf_backend_omit_section_dynsym \ - _bfd_elf_omit_section_dynsym_all - #define elf_backend_finish_dynamic_sections \ ---- a/bfd/elf32-xtensa.c -+++ b/bfd/elf32-xtensa.c -@@ -1568,8 +1568,8 @@ elf_xtensa_allocate_local_got_size (stru - /* Set the sizes of the dynamic sections. */ - - static bool --elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_xtensa_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_xtensa_link_hash_table *htab; - bfd *dynobj, *abfd; -@@ -1586,7 +1586,7 @@ elf_xtensa_size_dynamic_sections (bfd *o - - dynobj = elf_hash_table (info)->dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - srelgot = htab->elf.srelgot; - srelplt = htab->elf.srelplt; - -@@ -1791,8 +1791,7 @@ elf_xtensa_size_dynamic_sections (bfd *o - } - - static bool --elf_xtensa_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elf_xtensa_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - struct elf_xtensa_link_hash_table *htab; - asection *tls_sec; -@@ -11551,8 +11550,8 @@ static const struct bfd_elf_special_sect - #define elf_backend_object_p elf_xtensa_object_p - #define elf_backend_reloc_type_class elf_xtensa_reloc_type_class - #define elf_backend_relocate_section elf_xtensa_relocate_section --#define elf_backend_size_dynamic_sections elf_xtensa_size_dynamic_sections --#define elf_backend_always_size_sections elf_xtensa_always_size_sections -+#define elf_backend_late_size_sections elf_xtensa_late_size_sections -+#define elf_backend_early_size_sections elf_xtensa_early_size_sections - #define elf_backend_omit_section_dynsym _bfd_elf_omit_section_dynsym_all - #define elf_backend_special_sections elf_xtensa_special_sections - #define elf_backend_action_discarded elf_xtensa_action_discarded ---- a/bfd/elf64-alpha.c -+++ b/bfd/elf64-alpha.c -@@ -2579,8 +2579,8 @@ elf64_alpha_size_plt_section (struct bfd - } - - static bool --elf64_alpha_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf64_alpha_early_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *i; - struct alpha_elf_link_hash_table * htab; -@@ -2806,8 +2806,8 @@ elf64_alpha_size_rela_got_section (struc - /* Set the sizes of the dynamic sections. */ - - static bool --elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf64_alpha_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; -@@ -2819,7 +2819,8 @@ elf64_alpha_size_dynamic_sections (bfd * - return false; - - dynobj = elf_hash_table(info)->dynobj; -- BFD_ASSERT(dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -5465,10 +5466,10 @@ static const struct elf_size_info alpha_ - elf64_alpha_merge_symbol_attribute - #define elf_backend_copy_indirect_symbol \ - elf64_alpha_copy_indirect_symbol --#define elf_backend_always_size_sections \ -- elf64_alpha_always_size_sections --#define elf_backend_size_dynamic_sections \ -- elf64_alpha_size_dynamic_sections -+#define elf_backend_early_size_sections \ -+ elf64_alpha_early_size_sections -+#define elf_backend_late_size_sections \ -+ elf64_alpha_late_size_sections - #define elf_backend_omit_section_dynsym \ - _bfd_elf_omit_section_dynsym_all - #define elf_backend_relocate_section \ ---- a/bfd/elf64-hppa.c -+++ b/bfd/elf64-hppa.c -@@ -176,9 +176,6 @@ static bool elf64_hppa_adjust_dynamic_sy - static bool elf64_hppa_mark_milli_and_exported_functions - (struct elf_link_hash_entry *, void *); - --static bool elf64_hppa_size_dynamic_sections -- (bfd *, struct bfd_link_info *); -- - static int elf64_hppa_link_output_symbol_hook - (struct bfd_link_info *, const char *, Elf_Internal_Sym *, - asection *, struct elf_link_hash_entry *); -@@ -1520,7 +1517,7 @@ elf64_hppa_mark_milli_and_exported_funct - the contents of our special sections. */ - - static bool --elf64_hppa_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) -+elf64_hppa_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - struct elf64_hppa_link_hash_table *hppa_info; - struct elf64_hppa_allocate_data data; -@@ -1534,7 +1531,8 @@ elf64_hppa_size_dynamic_sections (bfd *o - return false; - - dynobj = hppa_info->root.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - /* Mark each function this program exports so that we will allocate - space in the .opd section for each function's FPTR. If we are -@@ -3984,8 +3982,7 @@ const struct elf_size_info hppa64_elf_si - #define elf_backend_adjust_dynamic_symbol \ - elf64_hppa_adjust_dynamic_symbol - --#define elf_backend_size_dynamic_sections \ -- elf64_hppa_size_dynamic_sections -+#define elf_backend_late_size_sections elf64_hppa_late_size_sections - - #define elf_backend_finish_dynamic_symbol \ - elf64_hppa_finish_dynamic_symbol ---- a/bfd/elf64-ia64-vms.c -+++ b/bfd/elf64-ia64-vms.c -@@ -2590,8 +2590,8 @@ elf64_ia64_adjust_dynamic_symbol (struct - } - - static bool --elf64_ia64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf64_ia64_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf64_ia64_allocate_data data; - struct elf64_ia64_link_hash_table *ia64_info; -@@ -2600,11 +2600,12 @@ elf64_ia64_size_dynamic_sections (bfd *o - struct elf_link_hash_table *hash_table; - - hash_table = elf_hash_table (info); -- dynobj = hash_table->dynobj; - ia64_info = elf64_ia64_hash_table (info); - if (ia64_info == NULL) - return false; -- BFD_ASSERT(dynobj != NULL); -+ dynobj = hash_table->dynobj; -+ if (dynobj == NULL) -+ return true; - data.info = info; - - /* Allocate the GOT entries. */ -@@ -5484,8 +5485,8 @@ static const struct elf_size_info elf64_ - elf64_ia64_check_relocs - #define elf_backend_adjust_dynamic_symbol \ - elf64_ia64_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections \ -- elf64_ia64_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ elf64_ia64_late_size_sections - #define elf_backend_omit_section_dynsym \ - _bfd_elf_omit_section_dynsym_all - #define elf_backend_relocate_section \ ---- a/bfd/elf64-mips.c -+++ b/bfd/elf64-mips.c -@@ -4739,10 +4739,10 @@ const struct elf_size_info mips_elf64_si - #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag - #define elf_backend_adjust_dynamic_symbol \ - _bfd_mips_elf_adjust_dynamic_symbol --#define elf_backend_always_size_sections \ -- _bfd_mips_elf_always_size_sections --#define elf_backend_size_dynamic_sections \ -- _bfd_mips_elf_size_dynamic_sections -+#define elf_backend_early_size_sections \ -+ _bfd_mips_elf_early_size_sections -+#define elf_backend_late_size_sections \ -+ _bfd_mips_elf_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_relocate_section _bfd_mips_elf_relocate_section - #define elf_backend_finish_dynamic_symbol \ ---- a/bfd/elf64-ppc.c -+++ b/bfd/elf64-ppc.c -@@ -118,8 +118,8 @@ static bfd_vma opd_entry_value - #define elf_backend_adjust_dynamic_symbol ppc64_elf_adjust_dynamic_symbol - #define elf_backend_hide_symbol ppc64_elf_hide_symbol - #define elf_backend_maybe_function_sym ppc64_elf_maybe_function_sym --#define elf_backend_always_size_sections ppc64_elf_edit --#define elf_backend_size_dynamic_sections ppc64_elf_size_dynamic_sections -+#define elf_backend_early_size_sections ppc64_elf_edit -+#define elf_backend_late_size_sections ppc64_elf_late_size_sections - #define elf_backend_hash_symbol ppc64_elf_hash_symbol - #define elf_backend_init_index_section _bfd_elf_init_2_index_sections - #define elf_backend_action_discarded ppc64_elf_action_discarded -@@ -10117,7 +10117,7 @@ allocate_dynrelocs (struct elf_link_hash - ((((v) & 0x3ffff0000ULL) << 16) | (v & 0xffff)) - #define HA34(v) ((v + (1ULL << 33)) >> 34) - --/* Called via elf_link_hash_traverse from ppc64_elf_size_dynamic_sections -+/* Called via elf_link_hash_traverse from ppc64_elf_late_size_sections - to set up space for global entry stubs. These are put in glink, - after the branch table. */ - -@@ -10194,8 +10194,8 @@ size_global_entry_stubs (struct elf_link - /* Set the sizes of the dynamic sections. */ - - static bool --ppc64_elf_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+ppc64_elf_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - struct ppc_link_hash_table *htab; - bfd *dynobj; -@@ -10210,7 +10210,7 @@ ppc64_elf_size_dynamic_sections (bfd *ou - - dynobj = htab->elf.dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - - if (htab->elf.dynamic_sections_created) - { ---- a/bfd/elf64-s390.c -+++ b/bfd/elf64-s390.c -@@ -1301,7 +1301,7 @@ elf_s390_gc_mark_hook (asection *sec, - entry but we found we will not create any. Called when we find we will - not have any PLT for this symbol, by for example - elf_s390_adjust_dynamic_symbol when we're doing a proper dynamic link, -- or elf_s390_size_dynamic_sections if no dynamic sections will be -+ or elf_s390_late_size_sections if no dynamic sections will be - created (we're only linking static objects). */ - - static void -@@ -1714,8 +1714,8 @@ allocate_dynrelocs (struct elf_link_hash - /* Set the sizes of the dynamic sections. */ - - static bool --elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_s390_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_s390_link_hash_table *htab; - bfd *dynobj; -@@ -1729,7 +1729,7 @@ elf_s390_size_dynamic_sections (bfd *out - - dynobj = htab->elf.dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - - if (htab->elf.dynamic_sections_created) - { -@@ -3894,7 +3894,7 @@ const struct elf_size_info s390_elf64_si - #define elf_backend_gc_mark_hook elf_s390_gc_mark_hook - #define elf_backend_reloc_type_class elf_s390_reloc_type_class - #define elf_backend_relocate_section elf_s390_relocate_section --#define elf_backend_size_dynamic_sections elf_s390_size_dynamic_sections -+#define elf_backend_late_size_sections elf_s390_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_grok_prstatus elf_s390_grok_prstatus - #define elf_backend_grok_psinfo elf_s390_grok_psinfo ---- a/bfd/elf64-sparc.c -+++ b/bfd/elf64-sparc.c -@@ -938,8 +938,8 @@ const struct elf_size_info elf64_sparc_s - _bfd_sparc_elf_adjust_dynamic_symbol - #define elf_backend_omit_section_dynsym \ - _bfd_sparc_elf_omit_section_dynsym --#define elf_backend_size_dynamic_sections \ -- _bfd_sparc_elf_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ _bfd_sparc_elf_late_size_sections - #define elf_backend_relocate_section \ - _bfd_sparc_elf_relocate_section - #define elf_backend_finish_dynamic_symbol \ ---- a/bfd/elf64-tilegx.c -+++ b/bfd/elf64-tilegx.c -@@ -106,7 +106,7 @@ tilegx_elf_grok_psinfo (bfd *abfd, Elf_I - #define elf_backend_check_relocs tilegx_elf_check_relocs - #define elf_backend_adjust_dynamic_symbol tilegx_elf_adjust_dynamic_symbol - #define elf_backend_omit_section_dynsym tilegx_elf_omit_section_dynsym --#define elf_backend_size_dynamic_sections tilegx_elf_size_dynamic_sections -+#define elf_backend_late_size_sections tilegx_elf_late_size_sections - #define elf_backend_relocate_section tilegx_elf_relocate_section - #define elf_backend_finish_dynamic_symbol tilegx_elf_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections tilegx_elf_finish_dynamic_sections ---- a/bfd/elf64-x86-64.c -+++ b/bfd/elf64-x86-64.c -@@ -2377,8 +2377,7 @@ elf_x86_64_scan_relocs (bfd *abfd, struc - } - - static bool --elf_x86_64_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elf_x86_64_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - bfd *abfd; - -@@ -2391,7 +2390,7 @@ elf_x86_64_always_size_sections (bfd *ou - elf_x86_64_scan_relocs)) - return false; - -- return _bfd_x86_elf_always_size_sections (output_bfd, info); -+ return _bfd_x86_elf_early_size_sections (output_bfd, info); - } - - /* Return the relocation value for @tpoff relocation -@@ -5284,7 +5283,7 @@ elf_x86_64_special_sections[]= - elf_x86_64_reloc_name_lookup - - #define elf_backend_relocs_compatible elf_x86_64_relocs_compatible --#define elf_backend_always_size_sections elf_x86_64_always_size_sections -+#define elf_backend_early_size_sections elf_x86_64_early_size_sections - #define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections - #define elf_backend_finish_dynamic_sections elf_x86_64_finish_dynamic_sections - #define elf_backend_finish_dynamic_symbol elf_x86_64_finish_dynamic_symbol ---- a/bfd/elflink.c -+++ b/bfd/elflink.c -@@ -6619,8 +6619,8 @@ bfd_elf_size_dynamic_sections (bfd *outp - - /* The backend may have to create some sections regardless of whether - we're dynamic or not. */ -- if (bed->elf_backend_always_size_sections -- && ! (*bed->elf_backend_always_size_sections) (output_bfd, info)) -+ if (bed->elf_backend_early_size_sections -+ && !bed->elf_backend_early_size_sections (output_bfd, info)) - return false; - - dynobj = elf_hash_table (info)->dynobj; -@@ -7400,9 +7400,8 @@ NOTE: This behaviour is deprecated and w - - /* The backend must work out the sizes of all the other dynamic - sections. */ -- if (dynobj != NULL -- && bed->elf_backend_size_dynamic_sections != NULL -- && ! (*bed->elf_backend_size_dynamic_sections) (output_bfd, info)) -+ if (bed->elf_backend_late_size_sections != NULL -+ && !bed->elf_backend_late_size_sections (output_bfd, info)) - return false; - - if (dynobj != NULL && elf_hash_table (info)->dynamic_sections_created) ---- a/bfd/elfn32-mips.c -+++ b/bfd/elfn32-mips.c -@@ -4125,10 +4125,8 @@ static const struct ecoff_debug_swap mip - #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag - #define elf_backend_adjust_dynamic_symbol \ - _bfd_mips_elf_adjust_dynamic_symbol --#define elf_backend_always_size_sections \ -- _bfd_mips_elf_always_size_sections --#define elf_backend_size_dynamic_sections \ -- _bfd_mips_elf_size_dynamic_sections -+#define elf_backend_early_size_sections _bfd_mips_elf_early_size_sections -+#define elf_backend_late_size_sections _bfd_mips_elf_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_relocate_section _bfd_mips_elf_relocate_section - #define elf_backend_finish_dynamic_symbol \ ---- a/bfd/elfnn-aarch64.c -+++ b/bfd/elfnn-aarch64.c -@@ -112,7 +112,7 @@ - allocate space for one relocation on the slot. Record the GOT offset - for this symbol. - -- elfNN_aarch64_size_dynamic_sections () -+ elfNN_aarch64_late_size_sections () - - Iterate all input BFDS, look for in the local symbol data structure - constructed earlier for local TLS symbols and allocate them double -@@ -8886,8 +8886,8 @@ elfNN_aarch64_allocate_local_ifunc_dynre - though ! */ - - static bool --elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elfNN_aarch64_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_aarch64_link_hash_table *htab; - bfd *dynobj; -@@ -8898,7 +8898,8 @@ elfNN_aarch64_size_dynamic_sections (bfd - htab = elf_aarch64_hash_table ((info)); - dynobj = htab->root.dynobj; - -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->root.dynamic_sections_created) - { -@@ -9300,8 +9301,8 @@ elfNN_aarch64_create_small_pltn_entry (s - _TLS_MODULE_BASE_, if needed. */ - - static bool --elfNN_aarch64_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elfNN_aarch64_early_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - asection *tls_sec; - -@@ -10036,8 +10037,8 @@ const struct elf_size_info elfNN_aarch64 - #define elf_backend_adjust_dynamic_symbol \ - elfNN_aarch64_adjust_dynamic_symbol - --#define elf_backend_always_size_sections \ -- elfNN_aarch64_always_size_sections -+#define elf_backend_early_size_sections \ -+ elfNN_aarch64_early_size_sections - - #define elf_backend_check_relocs \ - elfNN_aarch64_check_relocs -@@ -10086,8 +10087,8 @@ const struct elf_size_info elfNN_aarch64 - #define elf_backend_section_from_shdr \ - elfNN_aarch64_section_from_shdr - --#define elf_backend_size_dynamic_sections \ -- elfNN_aarch64_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ elfNN_aarch64_late_size_sections - - #define elf_backend_size_info \ - elfNN_aarch64_size_info ---- a/bfd/elfnn-ia64.c -+++ b/bfd/elfnn-ia64.c -@@ -2986,8 +2986,8 @@ elfNN_ia64_adjust_dynamic_symbol (struct - } - - static bool --elfNN_ia64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elfNN_ia64_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elfNN_ia64_allocate_data data; - struct elfNN_ia64_link_hash_table *ia64_info; -@@ -2998,8 +2998,9 @@ elfNN_ia64_size_dynamic_sections (bfd *o - if (ia64_info == NULL) - return false; - dynobj = ia64_info->root.dynobj; -+ if (dynobj == NULL) -+ return true; - ia64_info->self_dtpmod_offset = (bfd_vma) -1; -- BFD_ASSERT(dynobj != NULL); - data.info = info; - - /* Set the contents of the .interp section to the interpreter. */ -@@ -5035,8 +5036,8 @@ ignore_errors (const char *fmt ATTRIBUTE - elfNN_ia64_check_relocs - #define elf_backend_adjust_dynamic_symbol \ - elfNN_ia64_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections \ -- elfNN_ia64_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ elfNN_ia64_late_size_sections - #define elf_backend_omit_section_dynsym \ - _bfd_elf_omit_section_dynsym_all - #define elf_backend_relocate_section \ ---- a/bfd/elfnn-loongarch.c -+++ b/bfd/elfnn-loongarch.c -@@ -1280,8 +1280,8 @@ maybe_set_textrel (struct elf_link_hash_ - } - - static bool --loongarch_elf_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+loongarch_elf_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - struct loongarch_elf_link_hash_table *htab; - bfd *dynobj; -@@ -1291,7 +1291,8 @@ loongarch_elf_size_dynamic_sections (bfd - htab = loongarch_elf_hash_table (info); - BFD_ASSERT (htab != NULL); - dynobj = htab->elf.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->elf.dynamic_sections_created) - { -@@ -3444,7 +3445,7 @@ elf_loongarch64_hash_symbol (struct elf_ - loongarch_elf_create_dynamic_sections - #define elf_backend_check_relocs loongarch_elf_check_relocs - #define elf_backend_adjust_dynamic_symbol loongarch_elf_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections loongarch_elf_size_dynamic_sections -+#define elf_backend_late_size_sections loongarch_elf_late_size_sections - #define elf_backend_relocate_section loongarch_elf_relocate_section - #define elf_backend_finish_dynamic_symbol loongarch_elf_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections \ ---- a/bfd/elfnn-riscv.c -+++ b/bfd/elfnn-riscv.c -@@ -1376,7 +1376,7 @@ allocate_local_ifunc_dynrelocs (void **s - } - - static bool --riscv_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) -+riscv_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - struct riscv_elf_link_hash_table *htab; - bfd *dynobj; -@@ -1386,7 +1386,8 @@ riscv_elf_size_dynamic_sections (bfd *ou - htab = riscv_elf_hash_table (info); - BFD_ASSERT (htab != NULL); - dynobj = htab->elf.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -5256,7 +5257,7 @@ riscv_elf_merge_symbol_attribute (struct - #define elf_backend_create_dynamic_sections riscv_elf_create_dynamic_sections - #define elf_backend_check_relocs riscv_elf_check_relocs - #define elf_backend_adjust_dynamic_symbol riscv_elf_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections riscv_elf_size_dynamic_sections -+#define elf_backend_late_size_sections riscv_elf_late_size_sections - #define elf_backend_relocate_section riscv_elf_relocate_section - #define elf_backend_finish_dynamic_symbol riscv_elf_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections riscv_elf_finish_dynamic_sections ---- a/bfd/elfxx-mips.c -+++ b/bfd/elfxx-mips.c -@@ -9559,8 +9559,8 @@ _bfd_mips_elf_adjust_dynamic_symbol (str - check for any mips16 stub sections that we can discard. */ - - bool --_bfd_mips_elf_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+_bfd_mips_elf_early_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - asection *sect; - struct mips_elf_link_hash_table *htab; -@@ -9903,8 +9903,8 @@ mips_elf_set_plt_sym_value (struct mips_ - /* Set the sizes of the dynamic sections. */ - - bool --_bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+_bfd_mips_elf_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s, *sreldyn; -@@ -9914,7 +9914,8 @@ _bfd_mips_elf_size_dynamic_sections (bfd - htab = mips_elf_hash_table (info); - BFD_ASSERT (htab != NULL); - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -14833,7 +14834,7 @@ _bfd_mips_elf_final_link (bfd *abfd, str - input_section->flags &= ~SEC_HAS_CONTENTS; - } - -- /* Size has been set in _bfd_mips_elf_always_size_sections. */ -+ /* Size has been set in _bfd_mips_elf_early_size_sections. */ - BFD_ASSERT(o->size == sizeof (Elf_External_ABIFlags_v0)); - - /* Skip this section later on (I don't think this currently -@@ -14892,7 +14893,7 @@ _bfd_mips_elf_final_link (bfd *abfd, str - input_section->flags &= ~SEC_HAS_CONTENTS; - } - -- /* Size has been set in _bfd_mips_elf_always_size_sections. */ -+ /* Size has been set in _bfd_mips_elf_early_size_sections. */ - BFD_ASSERT(o->size == sizeof (Elf32_External_RegInfo)); - - /* Skip this section later on (I don't think this currently ---- a/bfd/elfxx-mips.h -+++ b/bfd/elfxx-mips.h -@@ -52,9 +52,9 @@ extern bool _bfd_mips_elf_check_relocs - (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); - extern bool _bfd_mips_elf_adjust_dynamic_symbol - (struct bfd_link_info *, struct elf_link_hash_entry *); --extern bool _bfd_mips_elf_always_size_sections -+extern bool _bfd_mips_elf_early_size_sections - (bfd *, struct bfd_link_info *); --extern bool _bfd_mips_elf_size_dynamic_sections -+extern bool _bfd_mips_elf_late_size_sections - (bfd *, struct bfd_link_info *); - extern int _bfd_mips_elf_relocate_section - (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, ---- a/bfd/elfxx-sparc.c -+++ b/bfd/elfxx-sparc.c -@@ -2381,8 +2381,8 @@ _bfd_sparc_elf_omit_section_dynsym (bfd - /* Set the sizes of the dynamic sections. */ - - bool --_bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+_bfd_sparc_elf_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - struct _bfd_sparc_elf_link_hash_table *htab; - bfd *dynobj; -@@ -2392,7 +2392,8 @@ _bfd_sparc_elf_size_dynamic_sections (bf - htab = _bfd_sparc_elf_hash_table (info); - BFD_ASSERT (htab != NULL); - dynobj = htab->elf.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { ---- a/bfd/elfxx-sparc.h -+++ b/bfd/elfxx-sparc.h -@@ -117,7 +117,7 @@ extern bool _bfd_sparc_elf_adjust_dynami - (struct bfd_link_info *, struct elf_link_hash_entry *); - extern bool _bfd_sparc_elf_omit_section_dynsym - (bfd *, struct bfd_link_info *, asection *); --extern bool _bfd_sparc_elf_size_dynamic_sections -+extern bool _bfd_sparc_elf_late_size_sections - (bfd *, struct bfd_link_info *); - extern bool _bfd_sparc_elf_new_section_hook - (bfd *, asection *); ---- a/bfd/elfxx-target.h -+++ b/bfd/elfxx-target.h -@@ -483,11 +483,11 @@ - #ifndef elf_backend_adjust_dynamic_symbol - #define elf_backend_adjust_dynamic_symbol 0 - #endif --#ifndef elf_backend_always_size_sections --#define elf_backend_always_size_sections 0 -+#ifndef elf_backend_early_size_sections -+#define elf_backend_early_size_sections 0 - #endif --#ifndef elf_backend_size_dynamic_sections --#define elf_backend_size_dynamic_sections 0 -+#ifndef elf_backend_late_size_sections -+#define elf_backend_late_size_sections 0 - #endif - #ifndef elf_backend_strip_zero_sized_dynamic_sections - #define elf_backend_strip_zero_sized_dynamic_sections 0 -@@ -842,8 +842,8 @@ static const struct elf_backend_data elf - elf_backend_check_directives, - elf_backend_notice_as_needed, - elf_backend_adjust_dynamic_symbol, -- elf_backend_always_size_sections, -- elf_backend_size_dynamic_sections, -+ elf_backend_early_size_sections, -+ elf_backend_late_size_sections, - elf_backend_strip_zero_sized_dynamic_sections, - elf_backend_init_index_section, - elf_backend_relocate_section, ---- a/bfd/elfxx-tilegx.c -+++ b/bfd/elfxx-tilegx.c -@@ -2430,8 +2430,8 @@ tilegx_elf_omit_section_dynsym (bfd *out - } - - bool --tilegx_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+tilegx_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct tilegx_elf_link_hash_table *htab; - bfd *dynobj; -@@ -2441,7 +2441,8 @@ tilegx_elf_size_dynamic_sections (bfd *o - htab = tilegx_elf_hash_table (info); - BFD_ASSERT (htab != NULL); - dynobj = htab->elf.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { ---- a/bfd/elfxx-tilegx.h -+++ b/bfd/elfxx-tilegx.h -@@ -57,7 +57,7 @@ tilegx_elf_omit_section_dynsym (bfd *, - asection *); - - extern bool --tilegx_elf_size_dynamic_sections (bfd *, struct bfd_link_info *); -+tilegx_elf_late_size_sections (bfd *, struct bfd_link_info *); - - extern int - tilegx_elf_relocate_section (bfd *, struct bfd_link_info *, ---- a/bfd/elfxx-x86.c -+++ b/bfd/elfxx-x86.c -@@ -2019,7 +2019,7 @@ _bfd_elf_x86_valid_reloc_p (asection *in - /* Set the sizes of the dynamic sections. */ - - bool --_bfd_x86_elf_size_dynamic_sections (bfd *output_bfd, -+_bfd_x86_elf_late_size_sections (bfd *output_bfd, - struct bfd_link_info *info) - { - struct elf_x86_link_hash_table *htab; -@@ -2035,7 +2035,7 @@ _bfd_x86_elf_size_dynamic_sections (bfd - return false; - dynobj = htab->elf.dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - - /* Set up .got offsets for local syms, and space for local dynamic - relocs. */ -@@ -2616,8 +2616,8 @@ _bfd_x86_elf_finish_dynamic_sections (bf - - - bool --_bfd_x86_elf_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+_bfd_x86_elf_early_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - asection *tls_sec = elf_hash_table (info)->tls_sec; - ---- a/bfd/elfxx-x86.h -+++ b/bfd/elfxx-x86.h -@@ -807,13 +807,13 @@ extern bool _bfd_elf_x86_valid_reloc_p - const Elf_Internal_Rela *, struct elf_link_hash_entry *, - Elf_Internal_Sym *, Elf_Internal_Shdr *, bool *); - --extern bool _bfd_x86_elf_size_dynamic_sections -+extern bool _bfd_x86_elf_late_size_sections - (bfd *, struct bfd_link_info *); - - extern struct elf_x86_link_hash_table *_bfd_x86_elf_finish_dynamic_sections - (bfd *, struct bfd_link_info *); - --extern bool _bfd_x86_elf_always_size_sections -+extern bool _bfd_x86_elf_early_size_sections - (bfd *, struct bfd_link_info *); - - extern void _bfd_x86_elf_merge_symbol_attribute -@@ -885,8 +885,8 @@ extern void _bfd_x86_elf_link_report_rel - - #define elf_backend_check_relocs \ - _bfd_x86_elf_check_relocs --#define elf_backend_size_dynamic_sections \ -- _bfd_x86_elf_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ _bfd_x86_elf_late_size_sections - #define elf_backend_merge_symbol_attribute \ - _bfd_x86_elf_merge_symbol_attribute - #define elf_backend_copy_indirect_symbol \ ---- a/ld/emultempl/vms.em -+++ b/ld/emultempl/vms.em -@@ -196,10 +196,9 @@ gld${EMULATION_NAME}_before_allocation ( - - /* The backend must work out the sizes of all the other dynamic - sections. */ -- if (elf_hash_table (&link_info)->dynamic_sections_created -- && bed->elf_backend_size_dynamic_sections -- && ! (*bed->elf_backend_size_dynamic_sections) (link_info.output_bfd, -- &link_info)) -+ if (bed->elf_backend_late_size_sections -+ && !bed->elf_backend_late_size_sections (link_info.output_bfd, -+ &link_info)) - einfo (_("%F%P: failed to set dynamic section sizes: %E\n")); - - before_allocation_default (); diff --git a/toolchain/binutils/patches/2.39/002-PR-30569-delete-_bfd_mips_elf_early_size_sections.patch b/toolchain/binutils/patches/2.39/002-PR-30569-delete-_bfd_mips_elf_early_size_sections.patch deleted file mode 100644 index f0c0d7a10a0..00000000000 --- a/toolchain/binutils/patches/2.39/002-PR-30569-delete-_bfd_mips_elf_early_size_sections.patch +++ /dev/null @@ -1,218 +0,0 @@ -From 3c6c32951e292a51ede70b8087bb0308d7dbc4fc Mon Sep 17 00:00:00 2001 -From: Alan Modra -Date: Thu, 28 Mar 2024 20:33:32 +1030 -Subject: [PATCH 2/2] PR 30569, delete _bfd_mips_elf_early_size_sections - -PR30569 was triggered by a patch of mine 6540edd52cc0 moving the call -to always_size_sections in bfd_elf_size_dynamic_sections earlier, made -to support the x86 DT_RELR implementation. This broke mips16 code -handling stubs when --export-dynamic is passed to the linker, because -numerous symbols then became dynamic after always_size_sections. The -mips backend fiddles with symbols in its always_size_sections. Maciej -in 902e9fc76a0e had moved the call to always_size_sections to after -the export-dynamic code. Prior to that, Nathan in 04c3a75556c0 moved -it before the exec stack code, back to the start of -bfd_elf_size_dynamic_sections which was where Ian put it originally -in ff12f303355b. So the call has moved around a little. I'm leaving -it where it is, and instead calling mips_elf_check_symbols from -late_size_sections (the old size_dynamic_sections) which is now always -called. In fact, the whole of _bfd_mips_elf_early_size_sections can -be merged into _bfd_mips_elf_late_size_sections. ---- - bfd/elf32-mips.c | 1 - - bfd/elf64-mips.c | 2 -- - bfd/elfn32-mips.c | 1 - - bfd/elfxx-mips.c | 84 +++++++++++++++++++---------------------------- - bfd/elfxx-mips.h | 2 -- - 5 files changed, 34 insertions(+), 56 deletions(-) - ---- a/bfd/elf32-mips.c -+++ b/bfd/elf32-mips.c -@@ -2525,7 +2525,6 @@ static const struct ecoff_debug_swap mip - #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag - #define elf_backend_adjust_dynamic_symbol \ - _bfd_mips_elf_adjust_dynamic_symbol --#define elf_backend_early_size_sections _bfd_mips_elf_early_size_sections - #define elf_backend_late_size_sections _bfd_mips_elf_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_relocate_section _bfd_mips_elf_relocate_section ---- a/bfd/elf64-mips.c -+++ b/bfd/elf64-mips.c -@@ -4739,8 +4739,6 @@ const struct elf_size_info mips_elf64_si - #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag - #define elf_backend_adjust_dynamic_symbol \ - _bfd_mips_elf_adjust_dynamic_symbol --#define elf_backend_early_size_sections \ -- _bfd_mips_elf_early_size_sections - #define elf_backend_late_size_sections \ - _bfd_mips_elf_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section ---- a/bfd/elfn32-mips.c -+++ b/bfd/elfn32-mips.c -@@ -4125,7 +4125,6 @@ static const struct ecoff_debug_swap mip - #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag - #define elf_backend_adjust_dynamic_symbol \ - _bfd_mips_elf_adjust_dynamic_symbol --#define elf_backend_early_size_sections _bfd_mips_elf_early_size_sections - #define elf_backend_late_size_sections _bfd_mips_elf_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_relocate_section _bfd_mips_elf_relocate_section ---- a/bfd/elfxx-mips.c -+++ b/bfd/elfxx-mips.c -@@ -9554,48 +9554,6 @@ _bfd_mips_elf_adjust_dynamic_symbol (str - return _bfd_elf_adjust_dynamic_copy (info, h, s); - } - --/* This function is called after all the input files have been read, -- and the input sections have been assigned to output sections. We -- check for any mips16 stub sections that we can discard. */ -- --bool --_bfd_mips_elf_early_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) --{ -- asection *sect; -- struct mips_elf_link_hash_table *htab; -- struct mips_htab_traverse_info hti; -- -- htab = mips_elf_hash_table (info); -- BFD_ASSERT (htab != NULL); -- -- /* The .reginfo section has a fixed size. */ -- sect = bfd_get_section_by_name (output_bfd, ".reginfo"); -- if (sect != NULL) -- { -- bfd_set_section_size (sect, sizeof (Elf32_External_RegInfo)); -- sect->flags |= SEC_FIXED_SIZE | SEC_HAS_CONTENTS; -- } -- -- /* The .MIPS.abiflags section has a fixed size. */ -- sect = bfd_get_section_by_name (output_bfd, ".MIPS.abiflags"); -- if (sect != NULL) -- { -- bfd_set_section_size (sect, sizeof (Elf_External_ABIFlags_v0)); -- sect->flags |= SEC_FIXED_SIZE | SEC_HAS_CONTENTS; -- } -- -- hti.info = info; -- hti.output_bfd = output_bfd; -- hti.error = false; -- mips_elf_link_hash_traverse (mips_elf_hash_table (info), -- mips_elf_check_symbols, &hti); -- if (hti.error) -- return false; -- -- return true; --} -- - /* If the link uses a GOT, lay it out and work out its size. */ - - static bool -@@ -9900,7 +9858,8 @@ mips_elf_set_plt_sym_value (struct mips_ - return true; - } - --/* Set the sizes of the dynamic sections. */ -+/* Set the sizes of the dynamic sections, some mips non-dynamic sections, -+ and check for any mips16 stub sections that we can discard. */ - - bool - _bfd_mips_elf_late_size_sections (bfd *output_bfd, -@@ -9910,14 +9869,39 @@ _bfd_mips_elf_late_size_sections (bfd *o - asection *s, *sreldyn; - bool reltext; - struct mips_elf_link_hash_table *htab; -+ struct mips_htab_traverse_info hti; - - htab = mips_elf_hash_table (info); - BFD_ASSERT (htab != NULL); -- dynobj = elf_hash_table (info)->dynobj; -+ -+ /* The .reginfo section has a fixed size. */ -+ s = bfd_get_section_by_name (output_bfd, ".reginfo"); -+ if (s != NULL) -+ { -+ bfd_set_section_size (s, sizeof (Elf32_External_RegInfo)); -+ s->flags |= SEC_FIXED_SIZE | SEC_HAS_CONTENTS; -+ } -+ -+ /* The .MIPS.abiflags section has a fixed size. */ -+ s = bfd_get_section_by_name (output_bfd, ".MIPS.abiflags"); -+ if (s != NULL) -+ { -+ bfd_set_section_size (s, sizeof (Elf_External_ABIFlags_v0)); -+ s->flags |= SEC_FIXED_SIZE | SEC_HAS_CONTENTS; -+ } -+ -+ hti.info = info; -+ hti.output_bfd = output_bfd; -+ hti.error = false; -+ mips_elf_link_hash_traverse (htab, mips_elf_check_symbols, &hti); -+ if (hti.error) -+ return false; -+ -+ dynobj = htab->root.dynobj; - if (dynobj == NULL) - return true; - -- if (elf_hash_table (info)->dynamic_sections_created) -+ if (htab->root.dynamic_sections_created) - { - /* Set the contents of the .interp section to the interpreter. */ - if (bfd_link_executable (info) && !info->nointerp) -@@ -10057,7 +10041,7 @@ _bfd_mips_elf_late_size_sections (bfd *o - } - } - else if (bfd_link_executable (info) -- && ! mips_elf_hash_table (info)->use_rld_obj_head -+ && !htab->use_rld_obj_head - && startswith (name, ".rld_map")) - { - /* We add a room for __rld_map. It will be filled in by the -@@ -10066,7 +10050,7 @@ _bfd_mips_elf_late_size_sections (bfd *o - } - else if (SGI_COMPAT (output_bfd) - && startswith (name, ".compact_rel")) -- s->size += mips_elf_hash_table (info)->compact_rel_size; -+ s->size += htab->compact_rel_size; - else if (s == htab->root.splt) - { - /* If the last PLT entry has a branch delay slot, allocate -@@ -10106,7 +10090,7 @@ _bfd_mips_elf_late_size_sections (bfd *o - } - } - -- if (elf_hash_table (info)->dynamic_sections_created) -+ if (htab->root.dynamic_sections_created) - { - /* Add some entries to the .dynamic section. We fill in the - values later, in _bfd_mips_elf_finish_dynamic_sections, but we -@@ -14834,7 +14818,7 @@ _bfd_mips_elf_final_link (bfd *abfd, str - input_section->flags &= ~SEC_HAS_CONTENTS; - } - -- /* Size has been set in _bfd_mips_elf_early_size_sections. */ -+ /* Size has been set in _bfd_mips_elf_late_size_sections. */ - BFD_ASSERT(o->size == sizeof (Elf_External_ABIFlags_v0)); - - /* Skip this section later on (I don't think this currently -@@ -14893,7 +14877,7 @@ _bfd_mips_elf_final_link (bfd *abfd, str - input_section->flags &= ~SEC_HAS_CONTENTS; - } - -- /* Size has been set in _bfd_mips_elf_early_size_sections. */ -+ /* Size has been set in _bfd_mips_elf_late_size_sections. */ - BFD_ASSERT(o->size == sizeof (Elf32_External_RegInfo)); - - /* Skip this section later on (I don't think this currently ---- a/bfd/elfxx-mips.h -+++ b/bfd/elfxx-mips.h -@@ -52,8 +52,6 @@ extern bool _bfd_mips_elf_check_relocs - (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); - extern bool _bfd_mips_elf_adjust_dynamic_symbol - (struct bfd_link_info *, struct elf_link_hash_entry *); --extern bool _bfd_mips_elf_early_size_sections -- (bfd *, struct bfd_link_info *); - extern bool _bfd_mips_elf_late_size_sections - (bfd *, struct bfd_link_info *); - extern int _bfd_mips_elf_relocate_section diff --git a/toolchain/binutils/patches/2.39/005-ld-fix-NEWS-typos.patch b/toolchain/binutils/patches/2.39/005-ld-fix-NEWS-typos.patch deleted file mode 100644 index 39c61d93190..00000000000 --- a/toolchain/binutils/patches/2.39/005-ld-fix-NEWS-typos.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 9284b63ea39cecbfc1522d9e143ecb7727d77eb5 Mon Sep 17 00:00:00 2001 -From: Martin Liska -Date: Mon, 8 Aug 2022 13:22:26 +0200 -Subject: [PATCH 005/160] ld: fix NEWS typos - -ld/ChangeLog: - - * NEWS: Fix 2 typos. ---- - ld/NEWS | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/ld/NEWS -+++ b/ld/NEWS -@@ -27,10 +27,10 @@ Changes in 2.39: - --enable-warn-rwx-segments=no - will make --no-warn-rwx-segments enabled by default. - -- --enable-defaul-execstack=no -+ --enable-default-execstack=no - will stop the creation of an executable stack simply because an input file - is missing a .note.GNU-stack section, even on architectures where this -- ehaviour is the default. -+ behaviour is the default. - - * TYPE= is now supported in an output section description to set the - section type value. diff --git a/toolchain/binutils/patches/2.39/008-gas-Dwarf-properly-skip-zero-size-functions.patch b/toolchain/binutils/patches/2.39/008-gas-Dwarf-properly-skip-zero-size-functions.patch deleted file mode 100644 index 055da841295..00000000000 --- a/toolchain/binutils/patches/2.39/008-gas-Dwarf-properly-skip-zero-size-functions.patch +++ /dev/null @@ -1,90 +0,0 @@ -From e8cf73215187b0c08679d726a5cc7c019fa3ea2e Mon Sep 17 00:00:00 2001 -From: Jan Beulich -Date: Wed, 10 Aug 2022 10:34:22 +0200 -Subject: [PATCH 008/160] gas/Dwarf: properly skip zero-size functions - -PR gas/29451 - -While out_debug_abbrev() properly skips such functions, out_debug_info() -mistakenly didn't. It needs to calculate the high_pc expression ahead of -time, in order to skip emitting any data for the function if the value -is zero. - -The one case which would still leave a zero-size entry is when -symbol_get_obj(symp)->size ends up evaluating to zero. I hope we can -expect that to not be the case, otherwise we'd need to have a way to -post-process .debug_info contents between resolving expressions and -actually writing the data out to the file. Even then it wouldn't be -entirely obvious in which way to alter the data. - -(cherry picked from commit d7abcbcea5ddd40a3bf28758b62f35933c59f996) ---- - gas/dwarf2dbg.c | 39 ++++++++++++++++++++------------------- - 1 file changed, 20 insertions(+), 19 deletions(-) - ---- a/gas/dwarf2dbg.c -+++ b/gas/dwarf2dbg.c -@@ -2882,6 +2882,7 @@ out_debug_info (segT info_seg, segT abbr - { - const char *name; - size_t len; -+ expressionS size = { .X_op = O_constant }; - - /* Skip warning constructs (see above). */ - if (symbol_get_bfdsym (symp)->flags & BSF_WARNING) -@@ -2895,6 +2896,18 @@ out_debug_info (segT info_seg, segT abbr - if (!S_IS_DEFINED (symp) || !S_IS_FUNCTION (symp)) - continue; - -+#if defined (OBJ_ELF) /* || defined (OBJ_MAYBE_ELF) */ -+ size.X_add_number = S_GET_SIZE (symp); -+ if (size.X_add_number == 0 && IS_ELF -+ && symbol_get_obj (symp)->size != NULL) -+ { -+ size.X_op = O_add; -+ size.X_op_symbol = make_expr_symbol (symbol_get_obj (symp)->size); -+ } -+#endif -+ if (size.X_op == O_constant && size.X_add_number == 0) -+ continue; -+ - subseg_set (str_seg, 0); - name_sym = symbol_temp_new_now_octets (); - name = S_GET_NAME (symp); -@@ -2920,29 +2933,17 @@ out_debug_info (segT info_seg, segT abbr - emit_expr (&exp, sizeof_address); - - /* DW_AT_high_pc */ -- exp.X_op = O_constant; --#if defined (OBJ_ELF) /* || defined (OBJ_MAYBE_ELF) */ -- exp.X_add_number = S_GET_SIZE (symp); -- if (exp.X_add_number == 0 && IS_ELF -- && symbol_get_obj (symp)->size != NULL) -- { -- exp.X_op = O_add; -- exp.X_op_symbol = make_expr_symbol (symbol_get_obj (symp)->size); -- } --#else -- exp.X_add_number = 0; --#endif - if (DWARF2_VERSION < 4) - { -- if (exp.X_op == O_constant) -- exp.X_op = O_symbol; -- exp.X_add_symbol = symp; -- emit_expr (&exp, sizeof_address); -+ if (size.X_op == O_constant) -+ size.X_op = O_symbol; -+ size.X_add_symbol = symp; -+ emit_expr (&size, sizeof_address); - } -- else if (exp.X_op == O_constant) -- out_uleb128 (exp.X_add_number); -+ else if (size.X_op == O_constant) -+ out_uleb128 (size.X_add_number); - else -- emit_leb128_expr (symbol_get_value_expression (exp.X_op_symbol), 0); -+ emit_leb128_expr (symbol_get_value_expression (size.X_op_symbol), 0); - } - - /* End of children. */ diff --git a/toolchain/binutils/patches/2.39/009-PR29462-internal-error-in-relocate-at-powerpc.cc-107.patch b/toolchain/binutils/patches/2.39/009-PR29462-internal-error-in-relocate-at-powerpc.cc-107.patch deleted file mode 100644 index e325d3bcb09..00000000000 --- a/toolchain/binutils/patches/2.39/009-PR29462-internal-error-in-relocate-at-powerpc.cc-107.patch +++ /dev/null @@ -1,270 +0,0 @@ -From e3b5d935247084dca057dea72be61b063fe2357a Mon Sep 17 00:00:00 2001 -From: Alan Modra -Date: Wed, 10 Aug 2022 10:38:52 +0930 -Subject: [PATCH 009/160] PR29462, internal error in relocate, at - powerpc.cc:10796 - -Prior to the inline plt call support (commit 08be322439), the only -local syms with plt entries were local ifunc symbols. There shouldn't -be stubs for other local symbols so don't look for them. The patch -also fixes minor bugs in get_reference_flags; Many relocs are valid -only for ppc64 and a couple only for ppc32. - - PR 29462 - * powerpc.cc (Target_powerpc::Relocate::relocate): Rename - use_plt_offset to pltcal_to_direct, invert logic. For relocs - not used with inline plt sequences against local symbols, only - look for stubs when the symbol is an ifunc. - (Target_powerpc::Scan::get_reference_flags): Correct reloc - handling for relocs not valid for both 32-bit and 64-bit. - -(cherry picked from commit 6158b25f77db11712b84e6a4609898f2615ac749) ---- - gold/powerpc.cc | 129 ++++++++++++++++++++++++++++-------------------- - 1 file changed, 75 insertions(+), 54 deletions(-) - ---- a/gold/powerpc.cc -+++ b/gold/powerpc.cc -@@ -7675,22 +7675,18 @@ Target_powerpc::Scan:: - - switch (r_type) - { -+ case elfcpp::R_PPC64_TOC: -+ if (size != 64) -+ break; -+ // Fall through. - case elfcpp::R_POWERPC_NONE: - case elfcpp::R_POWERPC_GNU_VTINHERIT: - case elfcpp::R_POWERPC_GNU_VTENTRY: -- case elfcpp::R_PPC64_TOC: - // No symbol reference. - break; - - case elfcpp::R_PPC64_ADDR64: - case elfcpp::R_PPC64_UADDR64: -- case elfcpp::R_POWERPC_ADDR32: -- case elfcpp::R_POWERPC_UADDR32: -- case elfcpp::R_POWERPC_ADDR16: -- case elfcpp::R_POWERPC_UADDR16: -- case elfcpp::R_POWERPC_ADDR16_LO: -- case elfcpp::R_POWERPC_ADDR16_HI: -- case elfcpp::R_POWERPC_ADDR16_HA: - case elfcpp::R_PPC64_ADDR16_HIGHER34: - case elfcpp::R_PPC64_ADDR16_HIGHERA34: - case elfcpp::R_PPC64_ADDR16_HIGHEST34: -@@ -7700,6 +7696,16 @@ Target_powerpc::Scan:: - case elfcpp::R_PPC64_D34_HI30: - case elfcpp::R_PPC64_D34_HA30: - case elfcpp::R_PPC64_D28: -+ if (size != 64) -+ break; -+ // Fall through. -+ case elfcpp::R_POWERPC_ADDR32: -+ case elfcpp::R_POWERPC_UADDR32: -+ case elfcpp::R_POWERPC_ADDR16: -+ case elfcpp::R_POWERPC_UADDR16: -+ case elfcpp::R_POWERPC_ADDR16_LO: -+ case elfcpp::R_POWERPC_ADDR16_HI: -+ case elfcpp::R_POWERPC_ADDR16_HA: - ref = Symbol::ABSOLUTE_REF; - break; - -@@ -7710,13 +7716,14 @@ Target_powerpc::Scan:: - ref = Symbol::FUNCTION_CALL | Symbol::ABSOLUTE_REF; - break; - -- case elfcpp::R_PPC64_REL64: -- case elfcpp::R_POWERPC_REL32: - case elfcpp::R_PPC_LOCAL24PC: -- case elfcpp::R_POWERPC_REL16: -- case elfcpp::R_POWERPC_REL16_LO: -- case elfcpp::R_POWERPC_REL16_HI: -- case elfcpp::R_POWERPC_REL16_HA: -+ if (size != 32) -+ break; -+ // Fall through. -+ ref = Symbol::RELATIVE_REF; -+ break; -+ -+ case elfcpp::R_PPC64_REL64: - case elfcpp::R_PPC64_REL16_HIGH: - case elfcpp::R_PPC64_REL16_HIGHA: - case elfcpp::R_PPC64_REL16_HIGHER: -@@ -7729,36 +7736,45 @@ Target_powerpc::Scan:: - case elfcpp::R_PPC64_REL16_HIGHEST34: - case elfcpp::R_PPC64_REL16_HIGHESTA34: - case elfcpp::R_PPC64_PCREL28: -+ if (size != 64) -+ break; -+ // Fall through. -+ case elfcpp::R_POWERPC_REL32: -+ case elfcpp::R_POWERPC_REL16: -+ case elfcpp::R_POWERPC_REL16_LO: -+ case elfcpp::R_POWERPC_REL16_HI: -+ case elfcpp::R_POWERPC_REL16_HA: - ref = Symbol::RELATIVE_REF; - break; - -+ case elfcpp::R_PPC_PLTREL24: -+ if (size != 32) -+ break; -+ ref = Symbol::FUNCTION_CALL | Symbol::RELATIVE_REF; -+ break; -+ - case elfcpp::R_PPC64_REL24_NOTOC: -- if (size == 32) -+ case elfcpp::R_PPC64_REL24_P9NOTOC: -+ case elfcpp::R_PPC64_PLT16_LO_DS: -+ case elfcpp::R_PPC64_PLTSEQ_NOTOC: -+ case elfcpp::R_PPC64_PLTCALL_NOTOC: -+ case elfcpp::R_PPC64_PLT_PCREL34: -+ case elfcpp::R_PPC64_PLT_PCREL34_NOTOC: -+ if (size != 64) - break; - // Fall through. -- case elfcpp::R_PPC64_REL24_P9NOTOC: - case elfcpp::R_POWERPC_REL24: -- case elfcpp::R_PPC_PLTREL24: - case elfcpp::R_POWERPC_REL14: - case elfcpp::R_POWERPC_REL14_BRTAKEN: - case elfcpp::R_POWERPC_REL14_BRNTAKEN: - case elfcpp::R_POWERPC_PLT16_LO: - case elfcpp::R_POWERPC_PLT16_HI: - case elfcpp::R_POWERPC_PLT16_HA: -- case elfcpp::R_PPC64_PLT16_LO_DS: - case elfcpp::R_POWERPC_PLTSEQ: -- case elfcpp::R_PPC64_PLTSEQ_NOTOC: - case elfcpp::R_POWERPC_PLTCALL: -- case elfcpp::R_PPC64_PLTCALL_NOTOC: -- case elfcpp::R_PPC64_PLT_PCREL34: -- case elfcpp::R_PPC64_PLT_PCREL34_NOTOC: - ref = Symbol::FUNCTION_CALL | Symbol::RELATIVE_REF; - break; - -- case elfcpp::R_POWERPC_GOT16: -- case elfcpp::R_POWERPC_GOT16_LO: -- case elfcpp::R_POWERPC_GOT16_HI: -- case elfcpp::R_POWERPC_GOT16_HA: - case elfcpp::R_PPC64_GOT16_DS: - case elfcpp::R_PPC64_GOT16_LO_DS: - case elfcpp::R_PPC64_GOT_PCREL34: -@@ -7768,11 +7784,16 @@ Target_powerpc::Scan:: - case elfcpp::R_PPC64_TOC16_HA: - case elfcpp::R_PPC64_TOC16_DS: - case elfcpp::R_PPC64_TOC16_LO_DS: -+ if (size != 64) -+ break; -+ // Fall through. -+ case elfcpp::R_POWERPC_GOT16: -+ case elfcpp::R_POWERPC_GOT16_LO: -+ case elfcpp::R_POWERPC_GOT16_HI: -+ case elfcpp::R_POWERPC_GOT16_HA: - ref = Symbol::RELATIVE_REF; - break; - -- case elfcpp::R_POWERPC_GOT_TPREL16: -- case elfcpp::R_POWERPC_TLS: - case elfcpp::R_PPC64_TLSGD: - case elfcpp::R_PPC64_TLSLD: - case elfcpp::R_PPC64_TPREL34: -@@ -7781,6 +7802,11 @@ Target_powerpc::Scan:: - case elfcpp::R_PPC64_GOT_TLSLD_PCREL34: - case elfcpp::R_PPC64_GOT_TPREL_PCREL34: - case elfcpp::R_PPC64_GOT_DTPREL_PCREL34: -+ if (size != 64) -+ break; -+ // Fall through. -+ case elfcpp::R_POWERPC_GOT_TPREL16: -+ case elfcpp::R_POWERPC_TLS: - ref = Symbol::TLS_REF; - break; - -@@ -10671,10 +10697,8 @@ Target_powerpc::Reloca - bool has_stub_value = false; - bool localentry0 = false; - unsigned int r_sym = elfcpp::elf_r_sym(rela.get_r_info()); -- bool use_plt_offset -- = (gsym != NULL -- ? gsym->use_plt_offset(Scan::get_reference_flags(r_type, target)) -- : object->local_has_plt_offset(r_sym)); -+ bool pltcall_to_direct = false; -+ - if (is_plt16_reloc(r_type) - || r_type == elfcpp::R_PPC64_PLT_PCREL34 - || r_type == elfcpp::R_PPC64_PLT_PCREL34_NOTOC -@@ -10688,21 +10712,18 @@ Target_powerpc::Reloca - // that the decision depends on the PLTCALL reloc, and we don't - // know the address of that instruction when processing others - // in the sequence. So the decision needs to be made in -- // do_relax(). For now, don't optimise inline plt calls. -- if (gsym) -- use_plt_offset = gsym->has_plt_offset(); -- } -- if (use_plt_offset -- && !is_got_reloc(r_type) -- && !is_plt16_reloc(r_type) -- && r_type != elfcpp::R_PPC64_PLT_PCREL34 -- && r_type != elfcpp::R_PPC64_PLT_PCREL34_NOTOC -- && r_type != elfcpp::R_POWERPC_PLTSEQ -- && r_type != elfcpp::R_POWERPC_PLTCALL -- && r_type != elfcpp::R_PPC64_PLTSEQ_NOTOC -- && r_type != elfcpp::R_PPC64_PLTCALL_NOTOC -- && (!psymval->is_ifunc_symbol() -- || Scan::reloc_needs_plt_for_ifunc(target, object, r_type, false))) -+ // do_relax(). -+ pltcall_to_direct = !(gsym != NULL -+ ? gsym->has_plt_offset() -+ : object->local_has_plt_offset(r_sym)); -+ } -+ else if ((gsym != NULL -+ ? gsym->use_plt_offset(Scan::get_reference_flags(r_type, target)) -+ : psymval->is_ifunc_symbol() && object->local_has_plt_offset(r_sym)) -+ && !is_got_reloc(r_type) -+ && (!psymval->is_ifunc_symbol() -+ || Scan::reloc_needs_plt_for_ifunc(target, object, r_type, -+ false))) - { - if (size == 64 - && gsym != NULL -@@ -10796,9 +10817,9 @@ Target_powerpc::Reloca - gold_assert(has_stub_value || !(os->flags() & elfcpp::SHF_ALLOC)); - } - -- if (use_plt_offset && (is_plt16_reloc(r_type) -- || r_type == elfcpp::R_PPC64_PLT_PCREL34 -- || r_type == elfcpp::R_PPC64_PLT_PCREL34_NOTOC)) -+ if (!pltcall_to_direct && (is_plt16_reloc(r_type) -+ || r_type == elfcpp::R_PPC64_PLT_PCREL34 -+ || r_type == elfcpp::R_PPC64_PLT_PCREL34_NOTOC)) - { - const Output_data_plt_powerpc* plt; - if (gsym) -@@ -10826,7 +10847,7 @@ Target_powerpc::Reloca - value -= target->toc_pointer(); - } - } -- else if (!use_plt_offset -+ else if (pltcall_to_direct - && (is_plt16_reloc(r_type) - || r_type == elfcpp::R_POWERPC_PLTSEQ - || r_type == elfcpp::R_PPC64_PLTSEQ_NOTOC)) -@@ -10835,7 +10856,7 @@ Target_powerpc::Reloca - elfcpp::Swap<32, big_endian>::writeval(iview, nop); - r_type = elfcpp::R_POWERPC_NONE; - } -- else if (!use_plt_offset -+ else if (pltcall_to_direct - && (r_type == elfcpp::R_PPC64_PLT_PCREL34 - || r_type == elfcpp::R_PPC64_PLT_PCREL34_NOTOC)) - { -@@ -11316,8 +11337,8 @@ Target_powerpc::Reloca - } - else if (!has_stub_value) - { -- if (!use_plt_offset && (r_type == elfcpp::R_POWERPC_PLTCALL -- || r_type == elfcpp::R_PPC64_PLTCALL_NOTOC)) -+ if (pltcall_to_direct && (r_type == elfcpp::R_POWERPC_PLTCALL -+ || r_type == elfcpp::R_PPC64_PLTCALL_NOTOC)) - { - // PLTCALL without plt entry => convert to direct call - Insn* iview = reinterpret_cast(view); diff --git a/toolchain/binutils/patches/2.39/011-PR29466-APP-NO_APP-with-.linefile.patch b/toolchain/binutils/patches/2.39/011-PR29466-APP-NO_APP-with-.linefile.patch deleted file mode 100644 index f7b58199290..00000000000 --- a/toolchain/binutils/patches/2.39/011-PR29466-APP-NO_APP-with-.linefile.patch +++ /dev/null @@ -1,167 +0,0 @@ -From 9e855cffa1fda44629e7f9b76dfa3e5a51a440e9 Mon Sep 17 00:00:00 2001 -From: Alan Modra -Date: Thu, 11 Aug 2022 09:51:03 +0930 -Subject: [PATCH 011/160] PR29466, APP/NO_APP with .linefile - -Commit 53f2b36a54b9 exposed a bug in sb_scrub_and_add_sb that could -result in losing input. If scrubbing results in expansion past the -holding capacity of do_scrub_chars output buffer, then do_scrub_chars -stashes the extra input for the next call. That call never came -because sb_scrub_and_add_sb wrongly decided it was done. Fix that by -allowing sb_scrub_and_add_sb to see whether there is pending input. -Also allow a little extra space so that in most cases we won't need -to resize the output buffer. - -sb_scrub_and_add_sb also limited output to the size of the input, -rather than the actual output buffer size. Fixing that resulted in a -fail of gas/testsuite/macros/dot with an extra warning: "end of file -not at end of a line; newline inserted". OK, so the macro in dot.s -really does finish without end-of-line. Apparently the macro -expansion code relied on do_scrub_chars returning early. So fix that -too by adding a newline if needed in macro_expand_body. - - PR 29466 - * app.c (do_scrub_pending): New function. - * as.h: Declare it. - * input-scrub.c (input_scrub_include_sb): Add extra space for - two .linefile directives. - * sb.c (sb_scrub_and_add_sb): Take into account pending input. - Allow output to max. - * macro.c (macro_expand_body): Add terminating newline. - * testsuite/config/default.exp (SIZE, SIZEFLAGS): Define. - * testsuite/gas/macros/app5.d, - * testsuite/gas/macros/app5.s: New test. - * testsuite/gas/macros/macros.exp: Run it. - -(cherry picked from commit 4d74aab7aa562fe79d4669cdad0c32610531cbc0) ---- - gas/app.c | 13 +++++++++++++ - gas/as.h | 1 + - gas/input-scrub.c | 6 ++++-- - gas/macro.c | 2 ++ - gas/sb.c | 5 +++-- - gas/testsuite/config/default.exp | 8 ++++++++ - gas/testsuite/gas/macros/app5.d | 6 ++++++ - gas/testsuite/gas/macros/app5.s | 5 +++++ - gas/testsuite/gas/macros/macros.exp | 1 + - 9 files changed, 43 insertions(+), 4 deletions(-) - create mode 100644 gas/testsuite/gas/macros/app5.d - create mode 100644 gas/testsuite/gas/macros/app5.s - ---- a/gas/app.c -+++ b/gas/app.c -@@ -1537,3 +1537,16 @@ do_scrub_chars (size_t (*get) (char *, s - last_char = to[-1]; - return to - tostart; - } -+ -+/* Return amount of pending input. */ -+ -+size_t -+do_scrub_pending (void) -+{ -+ size_t len = 0; -+ if (saved_input) -+ len += saved_input_len; -+ if (state == -1) -+ len += strlen (out_string); -+ return len; -+} ---- a/gas/as.h -+++ b/gas/as.h -@@ -460,6 +460,7 @@ void input_scrub_insert_file (char *); - char * input_scrub_new_file (const char *); - char * input_scrub_next_buffer (char **bufp); - size_t do_scrub_chars (size_t (*get) (char *, size_t), char *, size_t); -+size_t do_scrub_pending (void); - bool scan_for_multibyte_characters (const unsigned char *, const unsigned char *, bool); - int gen_to_words (LITTLENUM_TYPE *, int, long); - int had_err (void); ---- a/gas/input-scrub.c -+++ b/gas/input-scrub.c -@@ -278,9 +278,11 @@ input_scrub_include_sb (sb *from, char * - - next_saved_file = input_scrub_push (position); - -- /* Allocate sufficient space: from->len + optional newline. */ -+ /* Allocate sufficient space: from->len plus optional newline -+ plus two ".linefile " directives, plus a little more for other -+ expansion. */ - newline = from->len >= 1 && from->ptr[0] != '\n'; -- sb_build (&from_sb, from->len + newline); -+ sb_build (&from_sb, from->len + newline + 2 * sizeof (".linefile") + 30); - if (expansion == expanding_repeat && from_sb_expansion >= expanding_macro) - expansion = expanding_nested; - from_sb_expansion = expansion; ---- a/gas/macro.c -+++ b/gas/macro.c -@@ -1056,6 +1056,8 @@ macro_expand_body (sb *in, sb *out, form - loclist = f; - } - -+ if (!err && (out->len == 0 || out->ptr[out->len - 1] != '\n')) -+ sb_add_char (out, '\n'); - return err; - } - ---- a/gas/sb.c -+++ b/gas/sb.c -@@ -119,11 +119,12 @@ sb_scrub_and_add_sb (sb *ptr, sb *s) - So we loop until the input S is consumed. */ - while (1) - { -- size_t copy = s->len - (scrub_position - s->ptr); -+ size_t copy = s->len - (scrub_position - s->ptr) + do_scrub_pending (); - if (copy == 0) - break; - sb_check (ptr, copy); -- ptr->len += do_scrub_chars (scrub_from_sb, ptr->ptr + ptr->len, copy); -+ ptr->len += do_scrub_chars (scrub_from_sb, ptr->ptr + ptr->len, -+ ptr->max - ptr->len); - } - - sb_to_scrub = 0; ---- a/gas/testsuite/config/default.exp -+++ b/gas/testsuite/config/default.exp -@@ -52,6 +52,14 @@ if ![info exists NMFLAGS] then { - set NMFLAGS {} - } - -+if ![info exists SIZE] then { -+ set SIZE [findfile $base_dir/size] -+} -+ -+if ![info exists SIZEFLAGS] then { -+ set SIZEFLAGS "" -+} -+ - if ![info exists OBJCOPY] then { - set OBJCOPY [findfile $base_dir/../../binutils/objcopy] - } ---- /dev/null -+++ b/gas/testsuite/gas/macros/app5.d -@@ -0,0 +1,6 @@ -+#name: APP with linefile -+#xfail: tic30-*-* -+#size: -G -+# pr29466 just check that the test assembles -+ -+#pass ---- /dev/null -+++ b/gas/testsuite/gas/macros/app5.s -@@ -0,0 +1,5 @@ -+#NO_APP -+#APP -+# 5 "foo.c" 1 -+# 0 "" 2 -+#NO_APP ---- a/gas/testsuite/gas/macros/macros.exp -+++ b/gas/testsuite/gas/macros/macros.exp -@@ -70,6 +70,7 @@ run_dump_test app2 - run_dump_test app3 - remote_download host "$srcdir/$subdir/app4b.s" - run_dump_test app4 -+run_dump_test app5 - - run_list_test badarg "" - diff --git a/toolchain/binutils/patches/2.39/039-LoongArch-ld-Fix-relocation-error-of-pcrel.patch b/toolchain/binutils/patches/2.39/039-LoongArch-ld-Fix-relocation-error-of-pcrel.patch deleted file mode 100644 index bf452e566a3..00000000000 --- a/toolchain/binutils/patches/2.39/039-LoongArch-ld-Fix-relocation-error-of-pcrel.patch +++ /dev/null @@ -1,128 +0,0 @@ -From 509a2ec6ad3ea7eb3f4cf59538cf636a2126e4c3 Mon Sep 17 00:00:00 2001 -From: liuzhensong -Date: Fri, 2 Sep 2022 16:29:14 +0800 -Subject: [PATCH 039/160] LoongArch:ld: Fix relocation error of pcrel. - - Patch for branch 2.39. - Need to reduce the address of pc when using - reloction R_LARCH_SOP_PUSH_PCREL. - - bfd/ - * elfnn-loongarch.c ---- - bfd/elfnn-loongarch.c | 3 +- - ld/testsuite/ld-loongarch-elf/pcrel-const.d | 14 +++++++ - ld/testsuite/ld-loongarch-elf/pcrel-const.lds | 14 +++++++ - ld/testsuite/ld-loongarch-elf/pcrel-const.s | 12 ++++++ - ld/testsuite/ld-loongarch-elf/pr.exp | 39 +++++++++++++++++++ - 5 files changed, 81 insertions(+), 1 deletion(-) - create mode 100644 ld/testsuite/ld-loongarch-elf/pcrel-const.d - create mode 100644 ld/testsuite/ld-loongarch-elf/pcrel-const.lds - create mode 100644 ld/testsuite/ld-loongarch-elf/pcrel-const.s - create mode 100644 ld/testsuite/ld-loongarch-elf/pr.exp - ---- a/bfd/elfnn-loongarch.c -+++ b/bfd/elfnn-loongarch.c -@@ -2342,9 +2342,10 @@ loongarch_elf_relocate_section (bfd *out - case R_LARCH_SOP_PUSH_PLT_PCREL: - unresolved_reloc = false; - -- if (resolved_to_const) -+ if (!is_undefweak && resolved_to_const) - { - relocation += rel->r_addend; -+ relocation -= pc; - break; - } - else if (is_undefweak) ---- /dev/null -+++ b/ld/testsuite/ld-loongarch-elf/pcrel-const.d -@@ -0,0 +1,14 @@ -+#as: -mla-global-with-pcrel -+#objdump: -Drsz -+ -+.*:[ ]+file format .* -+ -+ -+Disassembly of section .text: -+ -+.* : -+#... -+[ ]+8:[ ]+02c04084[ ]+addi.d[ ]+\$a0,[ ]+\$a0,[ ]+16\(0x10\) -+#... -+0+14 <__sec_end>: -+#pass ---- /dev/null -+++ b/ld/testsuite/ld-loongarch-elf/pcrel-const.lds -@@ -0,0 +1,14 @@ -+ENTRY(foo); -+SECTIONS -+{ -+ .text : { -+ *(.text*) -+ } -+ -+ .data : { -+ __sec_start = .; -+ *(.gzdata) -+ __sec_end = .; -+ } -+} -+PROVIDE(__sec_size = __sec_end); ---- /dev/null -+++ b/ld/testsuite/ld-loongarch-elf/pcrel-const.s -@@ -0,0 +1,12 @@ -+ .text -+ .align 2 -+ .globl foo -+ .type foo, @function -+foo: -+ nop -+ la.global $r4,__sec_size -+ ldptr.w $r4,$r4,0 -+ jr $r1 -+ .size foo, .-foo -+ .data -+ .word 1 ---- /dev/null -+++ b/ld/testsuite/ld-loongarch-elf/pr.exp -@@ -0,0 +1,39 @@ -+# Expect script for LoongArch ELF linker tests -+# Copyright (C) 2022 Free Software Foundation, Inc. -+# -+# This file is part of the GNU Binutils. -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, -+# MA 02110-1301, USA. -+# -+ -+if ![istarget loongarch64-*-*] { -+ return -+} -+ -+set link_tests [list \ -+ [list \ -+ "pcrel const" \ -+ "-T pcrel-const.lds" "" \ -+ "-mla-global-with-pcrel" \ -+ { pcrel-const.s } \ -+ [list \ -+ [list objdump -D pcrel-const.d] \ -+ ] \ -+ "pcrel-const" \ -+ ] \ -+] -+ -+run_ld_link_tests $link_tests diff --git a/toolchain/binutils/patches/2.39/043-Re-PR29466-APP-NO_APP-with-linefile.patch b/toolchain/binutils/patches/2.39/043-Re-PR29466-APP-NO_APP-with-linefile.patch deleted file mode 100644 index 1de501a1ae4..00000000000 --- a/toolchain/binutils/patches/2.39/043-Re-PR29466-APP-NO_APP-with-linefile.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 4233be14a34d754a70b8b6f6fa42d21f35c6e030 Mon Sep 17 00:00:00 2001 -From: Alan Modra -Date: Sat, 10 Sep 2022 07:30:57 +0930 -Subject: [PATCH 043/160] Re: PR29466, APP/NO_APP with linefile - -It looks like I copied the SIZE init across from -binutils/testsuite/config/default.exp without some necessary editing. - - PR 29466 - * testsuite/config/default.exp (SIZE): Adjust relative path. - -(cherry picked from commit 1180f540d5f2f7751b5309bdd6c38d69fcf699e7) ---- - gas/testsuite/config/default.exp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/gas/testsuite/config/default.exp -+++ b/gas/testsuite/config/default.exp -@@ -53,7 +53,7 @@ if ![info exists NMFLAGS] then { - } - - if ![info exists SIZE] then { -- set SIZE [findfile $base_dir/size] -+ set SIZE [findfile $base_dir/../../binutils/size] - } - - if ![info exists SIZEFLAGS] then { diff --git a/toolchain/binutils/patches/2.39/050-PowerPC64-pcrel-got-relocs-against-local-symbols.patch b/toolchain/binutils/patches/2.39/050-PowerPC64-pcrel-got-relocs-against-local-symbols.patch deleted file mode 100644 index 5c89f6804e5..00000000000 --- a/toolchain/binutils/patches/2.39/050-PowerPC64-pcrel-got-relocs-against-local-symbols.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 4d7bba23a39fba18d6d13a2941a3c232011a7064 Mon Sep 17 00:00:00 2001 -From: Alan Modra -Date: Fri, 16 Sep 2022 18:08:44 +0930 -Subject: [PATCH 050/160] PowerPC64 pcrel got relocs against local symbols - -Not that anyone would want to indirect via the GOT when an address can -be loaded directly with pla, the following: - - pld 3,x@got@pcrel -x: - -leads to "Internal error in md_apply_fix", because the generic parts -of assembler fixup handling convert the fx_pcrel fixup to one without -a symbol. Stop that happening. - - * config/tc-ppc.c (ppc_force_relocation): Add PLT_PCREL34 and - assorted GOT_PCREL34 relocs. - -(cherry picked from commit 49c3ed081fed6b8e2b48fdc48f805f11e4589514) ---- - gas/config/tc-ppc.c | 6 ++++++ - 1 file changed, 6 insertions(+) - ---- a/gas/config/tc-ppc.c -+++ b/gas/config/tc-ppc.c -@@ -6676,6 +6676,12 @@ ppc_force_relocation (fixS *fix) - case BFD_RELOC_PPC_BA16_BRNTAKEN: - case BFD_RELOC_24_PLT_PCREL: - case BFD_RELOC_PPC64_TOC: -+ case BFD_RELOC_PPC64_PLT_PCREL34: -+ case BFD_RELOC_PPC64_GOT_PCREL34: -+ case BFD_RELOC_PPC64_GOT_TLSGD_PCREL34: -+ case BFD_RELOC_PPC64_GOT_TLSLD_PCREL34: -+ case BFD_RELOC_PPC64_GOT_TPREL_PCREL34: -+ case BFD_RELOC_PPC64_GOT_DTPREL_PCREL34: - return 1; - case BFD_RELOC_PPC_B26: - case BFD_RELOC_PPC_BA26: diff --git a/toolchain/binutils/patches/2.39/055-Re-PowerPC64-pcrel-got-relocs-against-local-symbols.patch b/toolchain/binutils/patches/2.39/055-Re-PowerPC64-pcrel-got-relocs-against-local-symbols.patch deleted file mode 100644 index 19b80c3442b..00000000000 --- a/toolchain/binutils/patches/2.39/055-Re-PowerPC64-pcrel-got-relocs-against-local-symbols.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 010db38b54b589ca3e95b498aba2831064970171 Mon Sep 17 00:00:00 2001 -From: Alan Modra -Date: Wed, 21 Sep 2022 09:06:29 +0930 -Subject: [PATCH 055/160] Re: PowerPC64 pcrel got relocs against local symbols - -The last patch wasn't all that shiny. There are rather a lot more -relocations that can hit the assertion in md_apply_fix if the symbol -is local or absolute. Fix them all. - - * config/tc-ppc.c (ppc_force_relocation): Add all relocs that - expect a symbol in md_apply_fix. Remove tls pcrel relocs - already covered in general tls match range. - -(cherry picked from commit 8b168f1a1e09e337d2a970f204a0230c091bbe58) ---- - gas/config/tc-ppc.c | 58 ++++++++++++++++++++++++++++++++++++++++----- - 1 file changed, 52 insertions(+), 6 deletions(-) - ---- a/gas/config/tc-ppc.c -+++ b/gas/config/tc-ppc.c -@@ -6666,8 +6666,6 @@ ppc_force_relocation (fixS *fix) - int - ppc_force_relocation (fixS *fix) - { -- /* Branch prediction relocations must force a relocation, as must -- the vtable description relocs. */ - switch (fix->fx_r_type) - { - case BFD_RELOC_PPC_B16_BRTAKEN: -@@ -6676,12 +6674,60 @@ ppc_force_relocation (fixS *fix) - case BFD_RELOC_PPC_BA16_BRNTAKEN: - case BFD_RELOC_24_PLT_PCREL: - case BFD_RELOC_PPC64_TOC: -+ case BFD_RELOC_16_GOTOFF: -+ case BFD_RELOC_LO16_GOTOFF: -+ case BFD_RELOC_HI16_GOTOFF: -+ case BFD_RELOC_HI16_S_GOTOFF: -+ case BFD_RELOC_LO16_PLTOFF: -+ case BFD_RELOC_HI16_PLTOFF: -+ case BFD_RELOC_HI16_S_PLTOFF: -+ case BFD_RELOC_GPREL16: -+ case BFD_RELOC_16_BASEREL: -+ case BFD_RELOC_LO16_BASEREL: -+ case BFD_RELOC_HI16_BASEREL: -+ case BFD_RELOC_HI16_S_BASEREL: -+ case BFD_RELOC_PPC_TOC16: -+ case BFD_RELOC_PPC64_TOC16_LO: -+ case BFD_RELOC_PPC64_TOC16_HI: -+ case BFD_RELOC_PPC64_TOC16_HA: -+ case BFD_RELOC_PPC64_PLTGOT16: -+ case BFD_RELOC_PPC64_PLTGOT16_LO: -+ case BFD_RELOC_PPC64_PLTGOT16_HI: -+ case BFD_RELOC_PPC64_PLTGOT16_HA: -+ case BFD_RELOC_PPC64_GOT16_DS: -+ case BFD_RELOC_PPC64_GOT16_LO_DS: -+ case BFD_RELOC_PPC64_PLT16_LO_DS: -+ case BFD_RELOC_PPC64_SECTOFF_DS: -+ case BFD_RELOC_PPC64_SECTOFF_LO_DS: -+ case BFD_RELOC_PPC64_TOC16_DS: -+ case BFD_RELOC_PPC64_TOC16_LO_DS: -+ case BFD_RELOC_PPC64_PLTGOT16_DS: -+ case BFD_RELOC_PPC64_PLTGOT16_LO_DS: -+ case BFD_RELOC_PPC_EMB_NADDR16: -+ case BFD_RELOC_PPC_EMB_NADDR16_LO: -+ case BFD_RELOC_PPC_EMB_NADDR16_HI: -+ case BFD_RELOC_PPC_EMB_NADDR16_HA: -+ case BFD_RELOC_PPC_EMB_SDAI16: -+ case BFD_RELOC_PPC_EMB_SDA2I16: -+ case BFD_RELOC_PPC_EMB_SDA2REL: -+ case BFD_RELOC_PPC_EMB_SDA21: -+ case BFD_RELOC_PPC_EMB_MRKREF: -+ case BFD_RELOC_PPC_EMB_RELSEC16: -+ case BFD_RELOC_PPC_EMB_RELST_LO: -+ case BFD_RELOC_PPC_EMB_RELST_HI: -+ case BFD_RELOC_PPC_EMB_RELST_HA: -+ case BFD_RELOC_PPC_EMB_BIT_FLD: -+ case BFD_RELOC_PPC_EMB_RELSDA: -+ case BFD_RELOC_PPC_VLE_SDA21: -+ case BFD_RELOC_PPC_VLE_SDA21_LO: -+ case BFD_RELOC_PPC_VLE_SDAREL_LO16A: -+ case BFD_RELOC_PPC_VLE_SDAREL_LO16D: -+ case BFD_RELOC_PPC_VLE_SDAREL_HI16A: -+ case BFD_RELOC_PPC_VLE_SDAREL_HI16D: -+ case BFD_RELOC_PPC_VLE_SDAREL_HA16A: -+ case BFD_RELOC_PPC_VLE_SDAREL_HA16D: - case BFD_RELOC_PPC64_PLT_PCREL34: - case BFD_RELOC_PPC64_GOT_PCREL34: -- case BFD_RELOC_PPC64_GOT_TLSGD_PCREL34: -- case BFD_RELOC_PPC64_GOT_TLSLD_PCREL34: -- case BFD_RELOC_PPC64_GOT_TPREL_PCREL34: -- case BFD_RELOC_PPC64_GOT_DTPREL_PCREL34: - return 1; - case BFD_RELOC_PPC_B26: - case BFD_RELOC_PPC_BA26: diff --git a/toolchain/binutils/patches/2.39/058-elf-Reset-alignment-for-each-PT_LOAD-segment.patch b/toolchain/binutils/patches/2.39/058-elf-Reset-alignment-for-each-PT_LOAD-segment.patch deleted file mode 100644 index aaf7a1b053c..00000000000 --- a/toolchain/binutils/patches/2.39/058-elf-Reset-alignment-for-each-PT_LOAD-segment.patch +++ /dev/null @@ -1,89 +0,0 @@ -From a98316d5cf970cbc99689797d84c2ea832bcdcbb Mon Sep 17 00:00:00 2001 -From: "H.J. Lu" -Date: Mon, 1 Aug 2022 16:02:39 -0700 -Subject: [PATCH 058/160] elf: Reset alignment for each PT_LOAD segment - -Reset alignment for each PT_LOAD segment to avoid using alignment from -the previous PT_LOAD segment. - -bfd/ - - PR ld/29435 - * elf.c (assign_file_positions_for_load_sections): Reset - alignment for each PT_LOAD segment. - -ld/ - - PR ld/29435 - * testsuite/ld-elf/pr29435.d: New file. - * testsuite/ld-elf/pr29435.s: Likewise. - -(cherry picked from commit 59f214544c50ec7ebbca285ff2b4949f48671690) ---- - bfd/elf.c | 7 ++++--- - ld/testsuite/ld-elf/pr29435.d | 11 +++++++++++ - ld/testsuite/ld-elf/pr29435.s | 6 ++++++ - 3 files changed, 21 insertions(+), 3 deletions(-) - create mode 100644 ld/testsuite/ld-elf/pr29435.d - create mode 100644 ld/testsuite/ld-elf/pr29435.s - ---- a/bfd/elf.c -+++ b/bfd/elf.c -@@ -5438,8 +5438,6 @@ assign_file_positions_for_load_sections - Elf_Internal_Phdr *p; - file_ptr off; /* Octets. */ - bfd_size_type maxpagesize; -- bfd_size_type p_align; -- bool p_align_p = false; - unsigned int alloc, actual; - unsigned int i, j; - struct elf_segment_map **sorted_seg_map; -@@ -5524,7 +5522,6 @@ assign_file_positions_for_load_sections - qsort (sorted_seg_map, alloc, sizeof (*sorted_seg_map), - elf_sort_segments); - -- p_align = bed->p_align; - maxpagesize = 1; - if ((abfd->flags & D_PAGED) != 0) - { -@@ -5559,6 +5556,8 @@ assign_file_positions_for_load_sections - asection **secpp; - bfd_vma off_adjust; /* Octets. */ - bool no_contents; -+ bfd_size_type p_align; -+ bool p_align_p; - - /* An ELF segment (described by Elf_Internal_Phdr) may contain a - number of sections with contents contributing to both p_filesz -@@ -5569,6 +5568,8 @@ assign_file_positions_for_load_sections - p = phdrs + m->idx; - p->p_type = m->p_type; - p->p_flags = m->p_flags; -+ p_align = bed->p_align; -+ p_align_p = false; - - if (m->count == 0) - p->p_vaddr = m->p_vaddr_offset * opb; ---- /dev/null -+++ b/ld/testsuite/ld-elf/pr29435.d -@@ -0,0 +1,11 @@ -+#ld: -shared -z separate-code -z relro -+#xfail: ![check_shared_lib_support] -+#xfail: ![check_relro_support] -+#readelf: -Wl -+ -+#failif -+#... -+ +LOAD +0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ .* 0x8000 -+#... -+ +LOAD +0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ 0x[0-9a-f]+ .* 0x8000 -+#... ---- /dev/null -+++ b/ld/testsuite/ld-elf/pr29435.s -@@ -0,0 +1,6 @@ -+ .text -+ .balign 0x8000 -+ .globl foo -+ .type foo, %function -+foo: -+ .byte 0 diff --git a/toolchain/binutils/patches/2.39/063-PR29542-PowerPC-gold-internal-error-in-get_output_vi.patch b/toolchain/binutils/patches/2.39/063-PR29542-PowerPC-gold-internal-error-in-get_output_vi.patch deleted file mode 100644 index 0d66b7750fc..00000000000 --- a/toolchain/binutils/patches/2.39/063-PR29542-PowerPC-gold-internal-error-in-get_output_vi.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 041c22e35de06d22566f4c71e4425c3351215e66 Mon Sep 17 00:00:00 2001 -From: Alan Modra -Date: Sun, 25 Sep 2022 12:07:36 +0930 -Subject: [PATCH 063/160] PR29542, PowerPC gold internal error in - get_output_view, - -We were attempting to set a BSS style section contents. - - PR 29542 - * powerpc.cc (Output_data_plt_powerpc::do_write): Don't set .plt, - .iplt or .lplt section contents when position independent. - -(cherry picked from commit c21736aed1d4877e090df60362413669dbdc391d) ---- - gold/powerpc.cc | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/gold/powerpc.cc -+++ b/gold/powerpc.cc -@@ -4338,7 +4338,8 @@ template - void - Output_data_plt_powerpc::do_write(Output_file* of) - { -- if (!this->sym_ents_.empty()) -+ if (!this->sym_ents_.empty() -+ && !parameters->options().output_is_position_independent()) - { - const section_size_type offset = this->offset(); - const section_size_type oview_size diff --git a/toolchain/binutils/patches/2.39/116-arm-Use-DWARF-numbering-convention-for-pseudo-regist.patch b/toolchain/binutils/patches/2.39/116-arm-Use-DWARF-numbering-convention-for-pseudo-regist.patch deleted file mode 100644 index 82a015ee2bb..00000000000 --- a/toolchain/binutils/patches/2.39/116-arm-Use-DWARF-numbering-convention-for-pseudo-regist.patch +++ /dev/null @@ -1,301 +0,0 @@ -From 88ac930a725b8aac8284a2738f03b843f4343dd0 Mon Sep 17 00:00:00 2001 -From: Victor Do Nascimento -Date: Thu, 17 Nov 2022 14:48:37 +0000 -Subject: [PATCH 116/160] arm: Use DWARF numbering convention for - pseudo-register representation - -The patch, initially submitted to trunk in -https://sourceware.org/pipermail/binutils/2022-July/122092.html ensures correct -support for handling .save directives for mixed-register type lists involving -the ra_auth_code pseudo-register, whereby the support first introduced in 2.39 -(https://sourceware.org/pipermail/binutils/2022-May/120672.html) led to the -generation of unwinder code popping registers in reversed order. - -gas/Changelog: - - * config/tc-arm.c (REG_RA_AUTH_CODE): New. - (parse_dot_save): Likewise. - (parse_reg_list): Remove obsolete code. - (reg_names): Set ra_auth_code to 143. - (s_arm_unwind_save): Handle core and pseudo-register lists via - parse_dot_save. - (s_arm_unwind_save_mixed): Deleted. - (s_arm_unwind_save_pseudo): Handle one register at a time. - * testsuite/gas/arm/unwind-pacbti-m-readelf.d: Fix test. - * testsuite/gas/arm/unwind-pacbti-m.d: Likewise. - -(cherry picked from commit 3a368c4c248f6e9f4bda3a5369befa17a4560293) ---- - gas/config/tc-arm.c | 159 ++++++++++-------- - .../gas/arm/unwind-pacbti-m-readelf.d | 4 +- - gas/testsuite/gas/arm/unwind-pacbti-m.d | 2 +- - 3 files changed, 95 insertions(+), 70 deletions(-) - ---- a/gas/config/tc-arm.c -+++ b/gas/config/tc-arm.c -@@ -742,6 +742,7 @@ const char * const reg_expected_msgs[] = - #define REG_SP 13 - #define REG_LR 14 - #define REG_PC 15 -+#define REG_RA_AUTH_CODE 143 - - /* ARM instructions take 4bytes in the object file, Thumb instructions - take 2: */ -@@ -1943,21 +1944,6 @@ parse_reg_list (char ** strp, enum reg_l - - reg = arm_reg_parse (&str, rt); - -- /* Skip over allowed registers of alternative types in mixed-type -- register lists. */ -- if (reg == FAIL && rt == REG_TYPE_PSEUDO -- && ((reg = arm_reg_parse (&str, REG_TYPE_RN)) != FAIL)) -- { -- cur_reg = reg; -- continue; -- } -- else if (reg == FAIL && rt == REG_TYPE_RN -- && ((reg = arm_reg_parse (&str, REG_TYPE_PSEUDO)) != FAIL)) -- { -- cur_reg = reg; -- continue; -- } -- - if (etype == REGLIST_CLRM) - { - if (reg == REG_SP || reg == REG_PC) -@@ -4139,7 +4125,6 @@ s_arm_unwind_fnstart (int ignored ATTRIB - unwind.sp_restored = 0; - } - -- - /* Parse a handlerdata directive. Creates the exception handling table entry - for the function. */ - -@@ -4297,15 +4282,19 @@ s_arm_unwind_personality (int ignored AT - /* Parse a directive saving pseudo registers. */ - - static void --s_arm_unwind_save_pseudo (long range) -+s_arm_unwind_save_pseudo (int regno) - { - valueT op; - -- if (range & (1 << 12)) -+ switch (regno) - { -+ case REG_RA_AUTH_CODE: - /* Opcode for restoring RA_AUTH_CODE. */ - op = 0xb4; - add_unwind_opcode (op, 1); -+ break; -+ default: -+ as_bad (_("Unknown register %d encountered\n"), regno); - } - } - -@@ -4375,6 +4364,80 @@ s_arm_unwind_save_core (long range) - } - } - -+/* Implement correct handling of .save lists enabling the split into -+sublists where necessary, while preserving correct sublist ordering. */ -+ -+static void -+parse_dot_save (char **str_p, int prev_reg) -+{ -+ long core_regs = 0; -+ int reg; -+ int in_range = 0; -+ -+ if (**str_p == ',') -+ *str_p += 1; -+ if (**str_p == '}') -+ { -+ *str_p += 1; -+ return; -+ } -+ -+ while ((reg = arm_reg_parse (str_p, REG_TYPE_RN)) != FAIL) -+ { -+ if (!in_range) -+ { -+ if (core_regs & (1 << reg)) -+ as_tsktsk (_("Warning: duplicated register (r%d) in register list"), -+ reg); -+ else if (reg <= prev_reg) -+ as_tsktsk (_("Warning: register list not in ascending order")); -+ -+ core_regs |= (1 << reg); -+ prev_reg = reg; -+ if (skip_past_char(str_p, '-') != FAIL) -+ in_range = 1; -+ else if (skip_past_comma(str_p) == FAIL) -+ first_error (_("bad register list")); -+ } -+ else -+ { -+ int i; -+ if (reg <= prev_reg) -+ first_error (_("bad range in register list")); -+ for (i = prev_reg + 1; i <= reg; i++) -+ { -+ if (core_regs & (1 << i)) -+ as_tsktsk (_("Warning: duplicated register (r%d) in register list"), -+ i); -+ else -+ core_regs |= 1 << i; -+ } -+ in_range = 0; -+ } -+ } -+ if (core_regs) -+ { -+ /* Higher register numbers go in higher memory addresses. When splitting a list, -+ right-most sublist should therefore be .saved first. Use recursion for this. */ -+ parse_dot_save (str_p, reg); -+ /* We're back from recursion, so emit .save insn for sublist. */ -+ s_arm_unwind_save_core (core_regs); -+ return; -+ } -+ /* Handle pseudo-regs, under assumption these are emitted singly. */ -+ else if ((reg = arm_reg_parse (str_p, REG_TYPE_PSEUDO)) != FAIL) -+ { -+ /* Recurse for remainder of input. Note: No assumption is made regarding which -+ register in core register set holds pseudo-register. It's not considered in -+ ordering check beyond ensuring it's not sandwiched between 2 consecutive -+ registers. */ -+ parse_dot_save (str_p, prev_reg + 1); -+ s_arm_unwind_save_pseudo (reg); -+ return; -+ } -+ else -+ as_bad (BAD_SYNTAX); -+} - - /* Parse a directive saving FPA registers. */ - -@@ -4716,39 +4779,13 @@ s_arm_unwind_save_mmxwcg (void) - ignore_rest_of_line (); - } - --/* Convert range and mask_range into a sequence of s_arm_unwind_core -- and s_arm_unwind_pseudo operations. We assume that mask_range will -- not have consecutive bits set, or that one operation per bit is -- acceptable. */ -- --static void --s_arm_unwind_save_mixed (long range, long mask_range) --{ -- while (mask_range) -- { -- long mask_bit = mask_range & -mask_range; -- long subrange = range & (mask_bit - 1); -- -- if (subrange) -- s_arm_unwind_save_core (subrange); -- -- s_arm_unwind_save_pseudo (mask_bit); -- range &= ~subrange; -- mask_range &= ~mask_bit; -- } -- -- if (range) -- s_arm_unwind_save_core (range); --} -- - /* Parse an unwind_save directive. - If the argument is non-zero, this is a .vsave directive. */ - - static void - s_arm_unwind_save (int arch_v6) - { -- char *peek, *mask_peek; -- long range, mask_range; -+ char *peek; - struct reg_entry *reg; - bool had_brace = false; - -@@ -4756,7 +4793,7 @@ s_arm_unwind_save (int arch_v6) - as_bad (MISSING_FNSTART); - - /* Figure out what sort of save we have. */ -- peek = mask_peek = input_line_pointer; -+ peek = input_line_pointer; - - if (*peek == '{') - { -@@ -4788,20 +4825,13 @@ s_arm_unwind_save (int arch_v6) - - case REG_TYPE_PSEUDO: - case REG_TYPE_RN: -- mask_range = parse_reg_list (&mask_peek, REGLIST_PSEUDO); -- range = parse_reg_list (&input_line_pointer, REGLIST_RN); -- -- if (range == FAIL || mask_range == FAIL) -- { -- as_bad (_("expected register list")); -- ignore_rest_of_line (); -- return; -- } -- -- demand_empty_rest_of_line (); -- -- s_arm_unwind_save_mixed (range, mask_range); -- return; -+ { -+ if (had_brace) -+ input_line_pointer++; -+ parse_dot_save (&input_line_pointer, -1); -+ demand_empty_rest_of_line (); -+ return; -+ } - - case REG_TYPE_VFD: - if (arch_v6) -@@ -23993,12 +24023,8 @@ static const struct reg_entry reg_names[ - /* XScale accumulator registers. */ - REGNUM(acc,0,XSCALE), REGNUM(ACC,0,XSCALE), - -- /* DWARF ABI defines RA_AUTH_CODE to 143. It also reserves 134-142 for future -- expansion. RA_AUTH_CODE here is given the value 143 % 134 to make it easy -- for tc_arm_regname_to_dw2regnum to translate to DWARF reg number using -- 134 + reg_number should the range 134 to 142 be used for more pseudo regs -- in the future. This also helps fit RA_AUTH_CODE into a bitmask. */ -- REGDEF(ra_auth_code,12,PSEUDO), -+ /* AADWARF32 defines RA_AUTH_CODE to 143. */ -+ REGDEF(ra_auth_code,143,PSEUDO), - }; - #undef REGDEF - #undef REGNUM -@@ -27905,7 +27931,6 @@ create_unwind_entry (int have_data) - return 0; - } - -- - /* Initialize the DWARF-2 unwind information for this procedure. */ - - void ---- a/gas/testsuite/gas/arm/unwind-pacbti-m-readelf.d -+++ b/gas/testsuite/gas/arm/unwind-pacbti-m-readelf.d -@@ -10,11 +10,11 @@ Unwind section '.ARM.exidx' at offset 0x - - 0x0 : @0x0 - Compact model index: 1 -- 0x84 0x00 pop {r14} - 0xb4 pop {ra_auth_code} - 0x84 0x00 pop {r14} -- 0xb4 pop {ra_auth_code} - 0xa3 pop {r4, r5, r6, r7} - 0xb4 pop {ra_auth_code} -+ 0x84 0x00 pop {r14} -+ 0xb4 pop {ra_auth_code} - 0xa8 pop {r4, r14} - 0xb0 finish ---- a/gas/testsuite/gas/arm/unwind-pacbti-m.d -+++ b/gas/testsuite/gas/arm/unwind-pacbti-m.d -@@ -8,4 +8,4 @@ - .*: file format.* - - Contents of section .ARM.extab: -- 0000 (00840281 b40084b4 b0a8b4a3|81028400 b48400b4 a3b4a8b0) 00000000 .* -+ 0000 (84b40281 84b4a300 b0a8b400|8102b484 00a3b484 00b4a8b0) 00000000 .* diff --git a/toolchain/binutils/patches/2.39/300-001_ld_makefile_patch.patch b/toolchain/binutils/patches/2.39/300-001_ld_makefile_patch.patch deleted file mode 100644 index ac80bf42591..00000000000 --- a/toolchain/binutils/patches/2.39/300-001_ld_makefile_patch.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/ld/Makefile.am -+++ b/ld/Makefile.am -@@ -50,7 +50,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR - # directives need to be different for native and cross linkers. --scriptdir = $(tooldir)/lib -+scriptdir = $(libdir) - - EMUL = @EMUL@ - EMULATION_OFILES = @EMULATION_OFILES@ ---- a/ld/Makefile.in -+++ b/ld/Makefile.in -@@ -569,7 +569,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR - # directives need to be different for native and cross linkers. --scriptdir = $(tooldir)/lib -+scriptdir = $(libdir) - BASEDIR = $(srcdir)/.. - BFDDIR = $(BASEDIR)/bfd - INCDIR = $(BASEDIR)/include diff --git a/toolchain/binutils/patches/2.39/400-mips_no_dynamic_linking_sym.patch b/toolchain/binutils/patches/2.39/400-mips_no_dynamic_linking_sym.patch deleted file mode 100644 index f499dfdc020..00000000000 --- a/toolchain/binutils/patches/2.39/400-mips_no_dynamic_linking_sym.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/bfd/elfxx-mips.c -+++ b/bfd/elfxx-mips.c -@@ -8066,6 +8066,7 @@ _bfd_mips_elf_create_dynamic_sections (b - - name = SGI_COMPAT (abfd) ? "_DYNAMIC_LINK" : "_DYNAMIC_LINKING"; - bh = NULL; -+ if (0) { - if (!(_bfd_generic_link_add_one_symbol - (info, abfd, name, BSF_GLOBAL, bfd_abs_section_ptr, 0, - NULL, false, get_elf_backend_data (abfd)->collect, &bh))) -@@ -8078,6 +8079,7 @@ _bfd_mips_elf_create_dynamic_sections (b - - if (! bfd_elf_link_record_dynamic_symbol (info, h)) - return false; -+ } - - if (! mips_elf_hash_table (info)->use_rld_obj_head) - { diff --git a/toolchain/binutils/patches/2.39/500-Change-default-emulation-for-mips64-linux.patch b/toolchain/binutils/patches/2.39/500-Change-default-emulation-for-mips64-linux.patch deleted file mode 100644 index 8a43563db00..00000000000 --- a/toolchain/binutils/patches/2.39/500-Change-default-emulation-for-mips64-linux.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- a/bfd/config.bfd -+++ b/bfd/config.bfd -@@ -928,12 +928,12 @@ case "${targ}" in - targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec mips_ecoff_be_vec mips_ecoff_le_vec" - ;; - mips64*el-*-linux*) -- targ_defvec=mips_elf32_ntrad_le_vec -- targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_le_vec mips_elf64_trad_be_vec" -+ targ_defvec=mips_elf64_trad_le_vec -+ targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_be_vec" - ;; - mips64*-*-linux*) -- targ_defvec=mips_elf32_ntrad_be_vec -- targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec" -+ targ_defvec=mips_elf64_trad_be_vec -+ targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_le_vec" - ;; - mips*el-*-linux*) - targ_defvec=mips_elf32_trad_le_vec ---- a/ld/configure.tgt -+++ b/ld/configure.tgt -@@ -580,12 +580,12 @@ mips*-*-vxworks*) targ_emul=elf32ebmipvx - ;; - mips*-*-windiss) targ_emul=elf32mipswindiss - ;; --mips64*el-*-linux-*) targ_emul=elf32ltsmipn32 -- targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip" -+mips64*el-*-linux-*) targ_emul=elf64ltsmip -+ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32ltsmip elf32btsmip elf64btsmip" - targ_extra_libpath=$targ_extra_emuls - ;; --mips64*-*-linux-*) targ_emul=elf32btsmipn32 -- targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip" -+mips64*-*-linux-*) targ_emul=elf64btsmip -+ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip elf64ltsmip" - targ_extra_libpath=$targ_extra_emuls - ;; - mips*el-*-linux-*) targ_emul=elf32ltsmip diff --git a/toolchain/binutils/patches/2.41/001-PR-30569-always-call-elf_backend_size_dynamic_sectio.patch b/toolchain/binutils/patches/2.41/001-PR-30569-always-call-elf_backend_size_dynamic_sectio.patch deleted file mode 100644 index 8cb7c041b03..00000000000 --- a/toolchain/binutils/patches/2.41/001-PR-30569-always-call-elf_backend_size_dynamic_sectio.patch +++ /dev/null @@ -1,2172 +0,0 @@ -From af969b14aedcc0ae27dcefab4327ff2d153dec8b Mon Sep 17 00:00:00 2001 -From: Alan Modra -Date: Thu, 28 Mar 2024 19:25:42 +1030 -Subject: [PATCH 1/2] PR 30569, always call elf_backend_size_dynamic_sections - -This largely mechanical patch is preparation for a followup patch. - -For quite some time I've thought that it would be useful to call -elf_backend_size_dynamic_sections even when no dynamic objects are -seen by the linker. That's what this patch does, with some renaming. -There are no functional changes to the linker, just a move of the -dynobj test in bfd_elf_size_dynamic_sections to target backend -functions, replacing the asserts/aborts already there. No doubt some -of the current always_size_sections functions could be moved to -size_dynamic_sections but I haven't made that change. - -Because both hooks are now always called, I have renamed -always_size_sections to early_size_sections and size_dynamic_sections -to late_size_sections. I condisdered calling late_size_sections plain -size_sections, since this is the usual target dynamic section sizing -hook, but decided that searching the sources for "size_sections" would -then hit early_size_sections and other functions. ---- - bfd/elf-bfd.h | 35 +++++++++++++++++------------------ - bfd/elf-m10300.c | 11 ++++++----- - bfd/elf32-arc.c | 9 +++++---- - bfd/elf32-arm.c | 15 ++++++++------- - bfd/elf32-bfin.c | 31 ++++++++++++++++--------------- - bfd/elf32-cr16.c | 11 ++++++----- - bfd/elf32-cris.c | 13 +++++++------ - bfd/elf32-csky.c | 8 ++++---- - bfd/elf32-frv.c | 23 ++++++++++++----------- - bfd/elf32-hppa.c | 8 ++++---- - bfd/elf32-i386.c | 7 +++---- - bfd/elf32-lm32.c | 15 ++++++++------- - bfd/elf32-m32c.c | 8 ++++---- - bfd/elf32-m32r.c | 11 ++++++----- - bfd/elf32-m68k.c | 16 ++++++++-------- - bfd/elf32-metag.c | 8 ++++---- - bfd/elf32-microblaze.c | 9 +++++---- - bfd/elf32-mips.c | 6 ++---- - bfd/elf32-nds32.c | 9 +++++---- - bfd/elf32-nios2.c | 15 ++++++++------- - bfd/elf32-or1k.c | 9 +++++---- - bfd/elf32-ppc.c | 11 ++++++----- - bfd/elf32-rl78.c | 8 ++++---- - bfd/elf32-s390.c | 10 +++++----- - bfd/elf32-score.c | 35 ++++++++++++++++++----------------- - bfd/elf32-score.h | 4 ++-- - bfd/elf32-score7.c | 13 +++++++------ - bfd/elf32-sh.c | 15 +++++++-------- - bfd/elf32-sparc.c | 3 +-- - bfd/elf32-tic6x.c | 14 +++++++------- - bfd/elf32-tilegx.c | 2 +- - bfd/elf32-tilepro.c | 11 +++++------ - bfd/elf32-vax.c | 16 +++++++--------- - bfd/elf32-xstormy16.c | 8 ++++---- - bfd/elf32-xtensa.c | 13 ++++++------- - bfd/elf64-alpha.c | 19 ++++++++++--------- - bfd/elf64-hppa.c | 11 ++++------- - bfd/elf64-ia64-vms.c | 13 +++++++------ - bfd/elf64-mips.c | 8 ++++---- - bfd/elf64-ppc.c | 12 ++++++------ - bfd/elf64-s390.c | 10 +++++----- - bfd/elf64-sparc.c | 4 ++-- - bfd/elf64-tilegx.c | 2 +- - bfd/elf64-x86-64.c | 7 +++---- - bfd/elflink.c | 9 ++++----- - bfd/elfn32-mips.c | 6 ++---- - bfd/elfnn-aarch64.c | 21 +++++++++++---------- - bfd/elfnn-ia64.c | 11 ++++++----- - bfd/elfnn-kvx.c | 19 +++++++++---------- - bfd/elfnn-loongarch.c | 9 +++++---- - bfd/elfnn-riscv.c | 7 ++++--- - bfd/elfxx-mips.c | 15 ++++++++------- - bfd/elfxx-mips.h | 4 ++-- - bfd/elfxx-sparc.c | 7 ++++--- - bfd/elfxx-sparc.h | 2 +- - bfd/elfxx-target.h | 12 ++++++------ - bfd/elfxx-tilegx.c | 7 ++++--- - bfd/elfxx-tilegx.h | 2 +- - bfd/elfxx-x86.c | 8 ++++---- - bfd/elfxx-x86.h | 8 ++++---- - ld/emultempl/vms.em | 7 +++---- - 61 files changed, 343 insertions(+), 337 deletions(-) - ---- a/bfd/elf-bfd.h -+++ b/bfd/elf-bfd.h -@@ -1173,7 +1173,7 @@ struct elf_backend_data - /* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend - linker for every symbol which is defined by a dynamic object and - referenced by a regular object. This is called after all the -- input files have been seen, but before the SIZE_DYNAMIC_SECTIONS -+ input files have been seen, but before the LATE_SIZE_SECTIONS - function has been called. The hash table entry should be - bfd_link_hash_defined ore bfd_link_hash_defweak, and it should be - defined in a section from a dynamic object. Dynamic object -@@ -1185,24 +1185,23 @@ struct elf_backend_data - bool (*elf_backend_adjust_dynamic_symbol) - (struct bfd_link_info *info, struct elf_link_hash_entry *h); - -- /* The ALWAYS_SIZE_SECTIONS function is called by the backend linker -- after all the linker input files have been seen but before the -- section sizes have been set. This is called after -- ADJUST_DYNAMIC_SYMBOL, but before SIZE_DYNAMIC_SECTIONS. */ -- bool (*elf_backend_always_size_sections) -+ /* The EARLY_SIZE_SECTIONS and LATE_SIZE_SECTIONS functions are -+ called by the backend linker after all linker input files have -+ been seen and sections have been assigned to output sections, but -+ before the section sizes have been set. Both of these functions -+ are called even when no dynamic object is seen by the linker. -+ Between them, they must set the sizes of the dynamic sections and -+ other backend specific sections, and may fill in their contents. -+ Most backends need only use LATE_SIZE_SECTIONS. -+ EARLY_SIZE_SECTIONS is called before --export-dynamic makes some -+ symbols dynamic and before ADJUST_DYNAMIC_SYMBOL processes -+ dynamic symbols, LATE_SIZE_SECTIONS afterwards. The generic ELF -+ linker can handle the .dynsym, .dynstr and .hash sections. -+ Besides those, these functions must handle the .interp section -+ and any other sections created by CREATE_DYNAMIC_SECTIONS. */ -+ bool (*elf_backend_early_size_sections) - (bfd *output_bfd, struct bfd_link_info *info); -- -- /* The SIZE_DYNAMIC_SECTIONS function is called by the ELF backend -- linker after all the linker input files have been seen but before -- the sections sizes have been set. This is called after -- ADJUST_DYNAMIC_SYMBOL has been called on all appropriate symbols. -- It is only called when linking against a dynamic object. It must -- set the sizes of the dynamic sections, and may fill in their -- contents as well. The generic ELF linker can handle the .dynsym, -- .dynstr and .hash sections. This function must handle the -- .interp section and any sections created by the -- CREATE_DYNAMIC_SECTIONS entry point. */ -- bool (*elf_backend_size_dynamic_sections) -+ bool (*elf_backend_late_size_sections) - (bfd *output_bfd, struct bfd_link_info *info); - - /* The STRIP_ZERO_SIZED_DYNAMIC_SECTIONS function is called by the ---- a/bfd/elf-m10300.c -+++ b/bfd/elf-m10300.c -@@ -5015,8 +5015,8 @@ _bfd_mn10300_elf_adjust_dynamic_symbol ( - /* Set the sizes of the dynamic sections. */ - - static bool --_bfd_mn10300_elf_size_dynamic_sections (bfd * output_bfd, -- struct bfd_link_info * info) -+_bfd_mn10300_elf_late_size_sections (bfd * output_bfd, -+ struct bfd_link_info * info) - { - struct elf32_mn10300_link_hash_table *htab = elf32_mn10300_hash_table (info); - bfd * dynobj; -@@ -5024,7 +5024,8 @@ _bfd_mn10300_elf_size_dynamic_sections ( - bool relocs; - - dynobj = htab->root.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -5511,8 +5512,8 @@ mn10300_elf_mkobject (bfd *abfd) - _bfd_mn10300_elf_create_dynamic_sections - #define elf_backend_adjust_dynamic_symbol \ - _bfd_mn10300_elf_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections \ -- _bfd_mn10300_elf_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ _bfd_mn10300_elf_late_size_sections - #define elf_backend_omit_section_dynsym _bfd_elf_omit_section_dynsym_all - #define elf_backend_finish_dynamic_symbol \ - _bfd_mn10300_elf_finish_dynamic_symbol ---- a/bfd/elf32-arc.c -+++ b/bfd/elf32-arc.c -@@ -2702,8 +2702,8 @@ elf_arc_finish_dynamic_sections (bfd * o - - /* Set the sizes of the dynamic sections. */ - static bool --elf_arc_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_arc_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; -@@ -2711,7 +2711,8 @@ elf_arc_size_dynamic_sections (bfd *outp - struct elf_link_hash_table *htab = elf_hash_table (info); - - dynobj = htab->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->dynamic_sections_created) - { -@@ -3127,7 +3128,7 @@ arc_elf_relax_section (bfd *abfd, asecti - #define elf_backend_finish_dynamic_symbol elf_arc_finish_dynamic_symbol - - #define elf_backend_finish_dynamic_sections elf_arc_finish_dynamic_sections --#define elf_backend_size_dynamic_sections elf_arc_size_dynamic_sections -+#define elf_backend_late_size_sections elf_arc_late_size_sections - - #define elf_backend_can_gc_sections 1 - #define elf_backend_want_got_plt 1 ---- a/bfd/elf32-arm.c -+++ b/bfd/elf32-arm.c -@@ -16751,8 +16751,8 @@ bfd_elf32_arm_set_byteswap_code (struct - /* Set the sizes of the dynamic sections. */ - - static bool --elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info * info) -+elf32_arm_late_size_sections (bfd * output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info * info) - { - bfd * dynobj; - asection * s; -@@ -16765,7 +16765,9 @@ elf32_arm_size_dynamic_sections (bfd * o - return false; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; -+ - check_use_blx (htab); - - if (elf_hash_table (info)->dynamic_sections_created) -@@ -17137,8 +17139,7 @@ elf32_arm_size_dynamic_sections (bfd * o - _TLS_MODULE_BASE_, if needed. */ - - static bool --elf32_arm_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elf32_arm_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - asection *tls_sec; - struct elf32_arm_link_hash_table *htab; -@@ -20332,8 +20333,8 @@ elf32_arm_backend_symbol_processing (bfd - #define elf_backend_create_dynamic_sections elf32_arm_create_dynamic_sections - #define elf_backend_finish_dynamic_symbol elf32_arm_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections elf32_arm_finish_dynamic_sections --#define elf_backend_size_dynamic_sections elf32_arm_size_dynamic_sections --#define elf_backend_always_size_sections elf32_arm_always_size_sections -+#define elf_backend_late_size_sections elf32_arm_late_size_sections -+#define elf_backend_early_size_sections elf32_arm_early_size_sections - #define elf_backend_init_index_section _bfd_elf_init_2_index_sections - #define elf_backend_init_file_header elf32_arm_init_file_header - #define elf_backend_reloc_type_class elf32_arm_reloc_type_class ---- a/bfd/elf32-bfin.c -+++ b/bfd/elf32-bfin.c -@@ -4027,8 +4027,8 @@ _bfinfdpic_size_got_plt (bfd *output_bfd - /* Set the sizes of the dynamic sections. */ - - static bool --elf32_bfinfdpic_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elf32_bfinfdpic_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - struct elf_link_hash_table *htab; - bfd *dynobj; -@@ -4037,7 +4037,8 @@ elf32_bfinfdpic_size_dynamic_sections (b - - htab = elf_hash_table (info); - dynobj = htab->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->dynamic_sections_created) - { -@@ -4086,7 +4087,7 @@ elf32_bfinfdpic_size_dynamic_sections (b - } - - static bool --elf32_bfinfdpic_always_size_sections (bfd *output_bfd, -+elf32_bfinfdpic_early_size_sections (bfd *output_bfd, - struct bfd_link_info *info) - { - if (!bfd_link_relocatable (info) -@@ -5123,15 +5124,16 @@ bfin_discard_copies (struct elf_link_has - } - - static bool --bfin_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+bfin_late_size_sections (bfd * output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; - bool relocs; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -5423,8 +5425,7 @@ struct bfd_elf_special_section const elf - #define elf_backend_check_relocs bfin_check_relocs - #define elf_backend_adjust_dynamic_symbol \ - bfin_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections \ -- bfin_size_dynamic_sections -+#define elf_backend_late_size_sections bfin_late_size_sections - #define elf_backend_relocate_section bfin_relocate_section - #define elf_backend_finish_dynamic_symbol \ - bfin_finish_dynamic_symbol -@@ -5470,9 +5471,9 @@ struct bfd_elf_special_section const elf - #undef bfd_elf32_bfd_link_hash_table_create - #define bfd_elf32_bfd_link_hash_table_create \ - bfinfdpic_elf_link_hash_table_create --#undef elf_backend_always_size_sections --#define elf_backend_always_size_sections \ -- elf32_bfinfdpic_always_size_sections -+#undef elf_backend_early_size_sections -+#define elf_backend_early_size_sections \ -+ elf32_bfinfdpic_early_size_sections - - #undef elf_backend_create_dynamic_sections - #define elf_backend_create_dynamic_sections \ -@@ -5480,9 +5481,9 @@ struct bfd_elf_special_section const elf - #undef elf_backend_adjust_dynamic_symbol - #define elf_backend_adjust_dynamic_symbol \ - elf32_bfinfdpic_adjust_dynamic_symbol --#undef elf_backend_size_dynamic_sections --#define elf_backend_size_dynamic_sections \ -- elf32_bfinfdpic_size_dynamic_sections -+#undef elf_backend_late_size_sections -+#define elf_backend_late_size_sections \ -+ elf32_bfinfdpic_late_size_sections - #undef elf_backend_finish_dynamic_symbol - #define elf_backend_finish_dynamic_symbol \ - elf32_bfinfdpic_finish_dynamic_symbol ---- a/bfd/elf32-cr16.c -+++ b/bfd/elf32-cr16.c -@@ -2391,15 +2391,16 @@ _bfd_cr16_elf_adjust_dynamic_symbol (str - /* Set the sizes of the dynamic sections. */ - - static bool --_bfd_cr16_elf_size_dynamic_sections (bfd * output_bfd, -- struct bfd_link_info * info) -+_bfd_cr16_elf_late_size_sections (bfd * output_bfd, -+ struct bfd_link_info * info) - { - bfd * dynobj; - asection * s; - bool relocs; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -2836,8 +2837,8 @@ _bfd_cr16_elf_reloc_type_class (const st - _bfd_cr16_elf_create_dynamic_sections - #define elf_backend_adjust_dynamic_symbol \ - _bfd_cr16_elf_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections \ -- _bfd_cr16_elf_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ _bfd_cr16_elf_late_size_sections - #define elf_backend_omit_section_dynsym _bfd_elf_omit_section_dynsym_all - #define elf_backend_finish_dynamic_symbol \ - _bfd_cr16_elf_finish_dynamic_symbol ---- a/bfd/elf32-cris.c -+++ b/bfd/elf32-cris.c -@@ -2527,7 +2527,7 @@ cris_elf_plt_sym_val (bfd_vma i ATTRIBUT - entry but we found we will not create any. Called when we find we will - not have any PLT for this symbol, by for example - elf_cris_adjust_dynamic_symbol when we're doing a proper dynamic link, -- or elf_cris_size_dynamic_sections if no dynamic sections will be -+ or elf_cris_late_size_sections if no dynamic sections will be - created (we're only linking static objects). */ - - static bool -@@ -3508,8 +3508,8 @@ cris_elf_check_relocs (bfd *abfd, - /* Set the sizes of the dynamic sections. */ - - static bool --elf_cris_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_cris_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_cris_link_hash_table * htab; - bfd *dynobj; -@@ -3521,7 +3521,8 @@ elf_cris_size_dynamic_sections (bfd *out - return false; - - dynobj = htab->root.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->root.dynamic_sections_created) - { -@@ -4090,8 +4091,8 @@ elf_cris_got_elt_size (bfd *abfd ATTRIBU - elf_cris_adjust_dynamic_symbol - #define elf_backend_copy_indirect_symbol \ - elf_cris_copy_indirect_symbol --#define elf_backend_size_dynamic_sections \ -- elf_cris_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ elf_cris_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_finish_dynamic_symbol \ - elf_cris_finish_dynamic_symbol ---- a/bfd/elf32-csky.c -+++ b/bfd/elf32-csky.c -@@ -1893,8 +1893,8 @@ csky_allocate_dynrelocs (struct elf_link - /* Set the sizes of the dynamic sections. */ - - static bool --csky_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+csky_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct csky_elf_link_hash_table *htab; - bfd *dynobj; -@@ -1907,7 +1907,7 @@ csky_elf_size_dynamic_sections (bfd *out - return false; - dynobj = htab->elf.dynobj; - if (dynobj == NULL) -- return false; -+ return true; - - if (htab->elf.dynamic_sections_created) - { -@@ -5333,7 +5333,7 @@ elf32_csky_obj_attrs_handle_unknown (bfd - /* Dynamic relocate related API. */ - #define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections - #define elf_backend_adjust_dynamic_symbol csky_elf_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections csky_elf_size_dynamic_sections -+#define elf_backend_late_size_sections csky_elf_late_size_sections - #define elf_backend_finish_dynamic_symbol csky_elf_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections csky_elf_finish_dynamic_sections - #define elf_backend_rela_normal 1 ---- a/bfd/elf32-frv.c -+++ b/bfd/elf32-frv.c -@@ -5423,15 +5423,16 @@ _frvfdpic_size_got_plt (bfd *output_bfd, - /* Set the sizes of the dynamic sections. */ - - static bool --elf32_frvfdpic_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elf32_frvfdpic_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; - struct _frvfdpic_dynamic_got_plt_info gpinfo; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -5472,8 +5473,8 @@ elf32_frvfdpic_size_dynamic_sections (bf - } - - static bool --elf32_frvfdpic_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elf32_frvfdpic_early_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - if (!bfd_link_relocatable (info) - && !bfd_elf_stack_segment_size (output_bfd, info, -@@ -6817,9 +6818,9 @@ elf32_frv_grok_psinfo (bfd *abfd, Elf_In - #undef bfd_elf32_bfd_link_hash_table_create - #define bfd_elf32_bfd_link_hash_table_create \ - frvfdpic_elf_link_hash_table_create --#undef elf_backend_always_size_sections --#define elf_backend_always_size_sections \ -- elf32_frvfdpic_always_size_sections -+#undef elf_backend_early_size_sections -+#define elf_backend_early_size_sections \ -+ elf32_frvfdpic_early_size_sections - - #undef elf_backend_create_dynamic_sections - #define elf_backend_create_dynamic_sections \ -@@ -6827,9 +6828,9 @@ elf32_frv_grok_psinfo (bfd *abfd, Elf_In - #undef elf_backend_adjust_dynamic_symbol - #define elf_backend_adjust_dynamic_symbol \ - elf32_frvfdpic_adjust_dynamic_symbol --#undef elf_backend_size_dynamic_sections --#define elf_backend_size_dynamic_sections \ -- elf32_frvfdpic_size_dynamic_sections -+#undef elf_backend_late_size_sections -+#define elf_backend_late_size_sections \ -+ elf32_frvfdpic_late_size_sections - #undef bfd_elf32_bfd_relax_section - #define bfd_elf32_bfd_relax_section \ - elf32_frvfdpic_relax_section ---- a/bfd/elf32-hppa.c -+++ b/bfd/elf32-hppa.c -@@ -2042,8 +2042,8 @@ clobber_millicode_symbols (struct elf_li - /* Set the sizes of the dynamic sections. */ - - static bool --elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf32_hppa_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf32_hppa_link_hash_table *htab; - bfd *dynobj; -@@ -2057,7 +2057,7 @@ elf32_hppa_size_dynamic_sections (bfd *o - - dynobj = htab->etab.dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - - if (htab->etab.dynamic_sections_created) - { -@@ -4450,7 +4450,7 @@ elf32_hppa_elf_get_symbol_type (Elf_Inte - #define elf_backend_hide_symbol elf32_hppa_hide_symbol - #define elf_backend_finish_dynamic_symbol elf32_hppa_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections elf32_hppa_finish_dynamic_sections --#define elf_backend_size_dynamic_sections elf32_hppa_size_dynamic_sections -+#define elf_backend_late_size_sections elf32_hppa_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_gc_mark_hook elf32_hppa_gc_mark_hook - #define elf_backend_grok_prstatus elf32_hppa_grok_prstatus ---- a/bfd/elf32-i386.c -+++ b/bfd/elf32-i386.c -@@ -1947,8 +1947,7 @@ elf_i386_scan_relocs (bfd *abfd, - } - - static bool --elf_i386_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elf_i386_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - bfd *abfd; - -@@ -1961,7 +1960,7 @@ elf_i386_always_size_sections (bfd *outp - elf_i386_scan_relocs)) - return false; - -- return _bfd_x86_elf_always_size_sections (output_bfd, info); -+ return _bfd_x86_elf_early_size_sections (output_bfd, info); - } - - /* Set the correct type for an x86 ELF section. We do this by the -@@ -4469,7 +4468,7 @@ elf_i386_link_setup_gnu_properties (stru - #define bfd_elf32_get_synthetic_symtab elf_i386_get_synthetic_symtab - - #define elf_backend_relocs_compatible _bfd_elf_relocs_compatible --#define elf_backend_always_size_sections elf_i386_always_size_sections -+#define elf_backend_early_size_sections elf_i386_early_size_sections - #define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections - #define elf_backend_fake_sections elf_i386_fake_sections - #define elf_backend_finish_dynamic_sections elf_i386_finish_dynamic_sections ---- a/bfd/elf32-lm32.c -+++ b/bfd/elf32-lm32.c -@@ -1906,8 +1906,8 @@ allocate_dynrelocs (struct elf_link_hash - /* Set the sizes of the dynamic sections. */ - - static bool --lm32_elf_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+lm32_elf_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - struct elf_lm32_link_hash_table *htab; - bfd *dynobj; -@@ -1920,7 +1920,8 @@ lm32_elf_size_dynamic_sections (bfd *out - return false; - - dynobj = htab->root.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->root.dynamic_sections_created) - { -@@ -2309,7 +2310,7 @@ lm32_elf_create_dynamic_sections (bfd *a - } - - static bool --lm32_elf_always_size_sections (bfd *output_bfd, struct bfd_link_info *info) -+lm32_elf_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - if (!bfd_link_relocatable (info)) - { -@@ -2395,7 +2396,7 @@ lm32_elf_fdpic_copy_private_bfd_data (bf - #define bfd_elf32_bfd_link_hash_table_create lm32_elf_link_hash_table_create - #define elf_backend_check_relocs lm32_elf_check_relocs - #define elf_backend_reloc_type_class lm32_elf_reloc_type_class --#define elf_backend_size_dynamic_sections lm32_elf_size_dynamic_sections -+#define elf_backend_late_size_sections lm32_elf_late_size_sections - #define elf_backend_omit_section_dynsym _bfd_elf_omit_section_dynsym_all - #define elf_backend_create_dynamic_sections lm32_elf_create_dynamic_sections - #define elf_backend_finish_dynamic_sections lm32_elf_finish_dynamic_sections -@@ -2416,8 +2417,8 @@ lm32_elf_fdpic_copy_private_bfd_data (bf - #undef elf32_bed - #define elf32_bed elf32_lm32fdpic_bed - --#undef elf_backend_always_size_sections --#define elf_backend_always_size_sections lm32_elf_always_size_sections -+#undef elf_backend_early_size_sections -+#define elf_backend_early_size_sections lm32_elf_early_size_sections - #undef bfd_elf32_bfd_copy_private_bfd_data - #define bfd_elf32_bfd_copy_private_bfd_data lm32_elf_fdpic_copy_private_bfd_data - ---- a/bfd/elf32-m32c.c -+++ b/bfd/elf32-m32c.c -@@ -773,8 +773,8 @@ m32c_elf_finish_dynamic_sections (bfd *a - } - - static bool --m32c_elf_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+m32c_elf_early_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *splt; -@@ -2132,8 +2132,8 @@ _bfd_m32c_elf_eh_frame_address_size (bfd - #define elf_backend_check_relocs m32c_elf_check_relocs - #define elf_backend_object_p m32c_elf_object_p - #define elf_symbol_leading_char ('_') --#define elf_backend_always_size_sections \ -- m32c_elf_always_size_sections -+#define elf_backend_early_size_sections \ -+ m32c_elf_early_size_sections - #define elf_backend_finish_dynamic_sections \ - m32c_elf_finish_dynamic_sections - ---- a/bfd/elf32-m32r.c -+++ b/bfd/elf32-m32r.c -@@ -1958,8 +1958,8 @@ allocate_dynrelocs (struct elf_link_hash - /* Set the sizes of the dynamic sections. */ - - static bool --m32r_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+m32r_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_link_hash_table *htab; - bfd *dynobj; -@@ -1968,7 +1968,7 @@ m32r_elf_size_dynamic_sections (bfd *out - bfd *ibfd; - - #ifdef DEBUG_PIC -- printf ("m32r_elf_size_dynamic_sections()\n"); -+ printf ("m32r_elf_late_size_sections()\n"); - #endif - - htab = m32r_elf_hash_table (info); -@@ -1976,7 +1976,8 @@ m32r_elf_size_dynamic_sections (bfd *out - return false; - - dynobj = htab->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->dynamic_sections_created) - { -@@ -3658,7 +3659,7 @@ m32r_elf_reloc_type_class (const struct - - #define elf_backend_create_dynamic_sections m32r_elf_create_dynamic_sections - #define bfd_elf32_bfd_link_hash_table_create m32r_elf_link_hash_table_create --#define elf_backend_size_dynamic_sections m32r_elf_size_dynamic_sections -+#define elf_backend_late_size_sections m32r_elf_late_size_sections - #define elf_backend_omit_section_dynsym _bfd_elf_omit_section_dynsym_all - #define elf_backend_finish_dynamic_sections m32r_elf_finish_dynamic_sections - #define elf_backend_adjust_dynamic_symbol m32r_elf_adjust_dynamic_symbol ---- a/bfd/elf32-m68k.c -+++ b/bfd/elf32-m68k.c -@@ -2934,7 +2934,7 @@ elf_m68k_get_plt_info (bfd *output_bfd) - It's a convenient place to determine the PLT style. */ - - static bool --elf_m68k_always_size_sections (bfd *output_bfd, struct bfd_link_info *info) -+elf_m68k_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - /* Bind input BFDs to GOTs and calculate sizes of .got and .rela.got - sections. */ -@@ -3107,15 +3107,16 @@ elf_m68k_adjust_dynamic_symbol (struct b - /* Set the sizes of the dynamic sections. */ - - static bool --elf_m68k_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_m68k_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; - bool relocs; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -4628,12 +4629,11 @@ elf_m68k_grok_psinfo (bfd *abfd, Elf_Int - #define bfd_elf32_bfd_final_link bfd_elf_final_link - - #define elf_backend_check_relocs elf_m68k_check_relocs --#define elf_backend_always_size_sections \ -- elf_m68k_always_size_sections -+#define elf_backend_early_size_sections \ -+ elf_m68k_early_size_sections - #define elf_backend_adjust_dynamic_symbol \ - elf_m68k_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections \ -- elf_m68k_size_dynamic_sections -+#define elf_backend_late_size_sections elf_m68k_late_size_sections - #define elf_backend_final_write_processing elf_m68k_final_write_processing - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_relocate_section elf_m68k_relocate_section ---- a/bfd/elf32-metag.c -+++ b/bfd/elf32-metag.c -@@ -2717,8 +2717,8 @@ allocate_dynrelocs (struct elf_link_hash - /* Set the sizes of the dynamic sections. */ - - static bool --elf_metag_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_metag_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_metag_link_hash_table *htab; - bfd *dynobj; -@@ -2729,7 +2729,7 @@ elf_metag_size_dynamic_sections (bfd *ou - htab = metag_link_hash_table (info); - dynobj = htab->etab.dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - - if (htab->etab.dynamic_sections_created) - { -@@ -4019,7 +4019,7 @@ elf_metag_plt_sym_val (bfd_vma i, const - #define elf_backend_adjust_dynamic_symbol elf_metag_adjust_dynamic_symbol - #define elf_backend_finish_dynamic_symbol elf_metag_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections elf_metag_finish_dynamic_sections --#define elf_backend_size_dynamic_sections elf_metag_size_dynamic_sections -+#define elf_backend_late_size_sections elf_metag_late_size_sections - #define elf_backend_omit_section_dynsym \ - _bfd_elf_omit_section_dynsym_all - #define elf_backend_init_file_header elf_metag_init_file_header ---- a/bfd/elf32-microblaze.c -+++ b/bfd/elf32-microblaze.c -@@ -2946,8 +2946,8 @@ allocate_dynrelocs (struct elf_link_hash - /* Set the sizes of the dynamic sections. */ - - static bool --microblaze_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+microblaze_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf32_mb_link_hash_table *htab; - bfd *dynobj; -@@ -2959,7 +2959,8 @@ microblaze_elf_size_dynamic_sections (bf - return false; - - dynobj = htab->elf.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - /* Set up .got offsets for local syms, and space for local dynamic - relocs. */ -@@ -3477,7 +3478,7 @@ microblaze_elf_add_symbol_hook (bfd *abf - #define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections - #define elf_backend_finish_dynamic_sections microblaze_elf_finish_dynamic_sections - #define elf_backend_finish_dynamic_symbol microblaze_elf_finish_dynamic_symbol --#define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections -+#define elf_backend_late_size_sections microblaze_elf_late_size_sections - #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook - - #include "elf32-target.h" ---- a/bfd/elf32-mips.c -+++ b/bfd/elf32-mips.c -@@ -2537,10 +2537,8 @@ static const struct ecoff_debug_swap mip - #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag - #define elf_backend_adjust_dynamic_symbol \ - _bfd_mips_elf_adjust_dynamic_symbol --#define elf_backend_always_size_sections \ -- _bfd_mips_elf_always_size_sections --#define elf_backend_size_dynamic_sections \ -- _bfd_mips_elf_size_dynamic_sections -+#define elf_backend_early_size_sections _bfd_mips_elf_early_size_sections -+#define elf_backend_late_size_sections _bfd_mips_elf_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_relocate_section _bfd_mips_elf_relocate_section - #define elf_backend_finish_dynamic_symbol \ ---- a/bfd/elf32-nds32.c -+++ b/bfd/elf32-nds32.c -@@ -4302,8 +4302,8 @@ elf32_nds32_add_dynreloc (bfd *output_bf - /* Set the sizes of the dynamic sections. */ - - static bool --nds32_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+nds32_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_nds32_link_hash_table *htab; - bfd *dynobj; -@@ -4316,7 +4316,8 @@ nds32_elf_size_dynamic_sections (bfd *ou - return false; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -13984,7 +13985,7 @@ nds32_elf_unify_tls_model (bfd *inbfd, a - #define elf_backend_create_dynamic_sections nds32_elf_create_dynamic_sections - #define elf_backend_finish_dynamic_sections nds32_elf_finish_dynamic_sections - #define elf_backend_finish_dynamic_symbol nds32_elf_finish_dynamic_symbol --#define elf_backend_size_dynamic_sections nds32_elf_size_dynamic_sections -+#define elf_backend_late_size_sections nds32_elf_late_size_sections - #define elf_backend_relocate_section nds32_elf_relocate_section - #define elf_backend_gc_mark_hook nds32_elf_gc_mark_hook - #define elf_backend_grok_prstatus nds32_elf_grok_prstatus ---- a/bfd/elf32-nios2.c -+++ b/bfd/elf32-nios2.c -@@ -5405,7 +5405,7 @@ nios2_elf32_adjust_dynamic_symbol (struc - return true; - } - --/* Worker function for nios2_elf32_size_dynamic_sections. */ -+/* Worker function for nios2_elf32_late_size_sections. */ - static bool - adjust_dynrelocs (struct elf_link_hash_entry *h, void *inf) - { -@@ -5432,7 +5432,7 @@ adjust_dynrelocs (struct elf_link_hash_e - return true; - } - --/* Another worker function for nios2_elf32_size_dynamic_sections. -+/* Another worker function for nios2_elf32_late_size_sections. - Allocate space in .plt, .got and associated reloc sections for - dynamic relocs. */ - static bool -@@ -5667,11 +5667,11 @@ allocate_dynrelocs (struct elf_link_hash - return true; - } - --/* Implement elf_backend_size_dynamic_sections: -+/* Implement elf_backend_late_size_sections: - Set the sizes of the dynamic sections. */ - static bool --nios2_elf32_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+nios2_elf32_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; -@@ -5681,7 +5681,8 @@ nios2_elf32_size_dynamic_sections (bfd * - - htab = elf32_nios2_hash_table (info); - dynobj = htab->root.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - htab->res_n_size = 0; - if (htab->root.dynamic_sections_created) -@@ -6052,7 +6053,7 @@ const struct bfd_elf_special_section elf - nios2_elf32_finish_dynamic_sections - #define elf_backend_adjust_dynamic_symbol nios2_elf32_adjust_dynamic_symbol - #define elf_backend_reloc_type_class nios2_elf32_reloc_type_class --#define elf_backend_size_dynamic_sections nios2_elf32_size_dynamic_sections -+#define elf_backend_late_size_sections nios2_elf32_late_size_sections - #define elf_backend_add_symbol_hook nios2_elf_add_symbol_hook - #define elf_backend_copy_indirect_symbol nios2_elf32_copy_indirect_symbol - #define elf_backend_object_p nios2_elf32_object_p ---- a/bfd/elf32-or1k.c -+++ b/bfd/elf32-or1k.c -@@ -3047,8 +3047,8 @@ allocate_dynrelocs (struct elf_link_hash - /* Set the sizes of the dynamic sections. */ - - static bool --or1k_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+or1k_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_or1k_link_hash_table *htab; - bfd *dynobj; -@@ -3061,7 +3061,8 @@ or1k_elf_size_dynamic_sections (bfd *out - return false; - - dynobj = htab->root.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->root.dynamic_sections_created) - { -@@ -3414,7 +3415,7 @@ or1k_grok_psinfo (bfd *abfd, Elf_Interna - #define elf_backend_copy_indirect_symbol or1k_elf_copy_indirect_symbol - #define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections - #define elf_backend_finish_dynamic_sections or1k_elf_finish_dynamic_sections --#define elf_backend_size_dynamic_sections or1k_elf_size_dynamic_sections -+#define elf_backend_late_size_sections or1k_elf_late_size_sections - #define elf_backend_adjust_dynamic_symbol or1k_elf_adjust_dynamic_symbol - #define elf_backend_finish_dynamic_symbol or1k_elf_finish_dynamic_symbol - ---- a/bfd/elf32-ppc.c -+++ b/bfd/elf32-ppc.c -@@ -5481,8 +5481,8 @@ static const unsigned char glink_eh_fram - /* Set the sizes of the dynamic sections. */ - - static bool --ppc_elf_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+ppc_elf_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - struct ppc_elf_link_hash_table *htab; - asection *s; -@@ -5490,11 +5490,12 @@ ppc_elf_size_dynamic_sections (bfd *outp - bfd *ibfd; - - #ifdef DEBUG -- fprintf (stderr, "ppc_elf_size_dynamic_sections called\n"); -+ fprintf (stderr, "ppc_elf_late_size_sections called\n"); - #endif - - htab = ppc_elf_hash_table (info); -- BFD_ASSERT (htab->elf.dynobj != NULL); -+ if (htab->elf.dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -10418,7 +10419,7 @@ ppc_elf_finish_dynamic_sections (bfd *ou - #define elf_backend_copy_indirect_symbol ppc_elf_copy_indirect_symbol - #define elf_backend_adjust_dynamic_symbol ppc_elf_adjust_dynamic_symbol - #define elf_backend_add_symbol_hook ppc_elf_add_symbol_hook --#define elf_backend_size_dynamic_sections ppc_elf_size_dynamic_sections -+#define elf_backend_late_size_sections ppc_elf_late_size_sections - #define elf_backend_hash_symbol ppc_elf_hash_symbol - #define elf_backend_finish_dynamic_symbol ppc_elf_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections ppc_elf_finish_dynamic_sections ---- a/bfd/elf32-rl78.c -+++ b/bfd/elf32-rl78.c -@@ -1440,8 +1440,8 @@ rl78_elf_finish_dynamic_sections (bfd *a - } - - static bool --rl78_elf_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+rl78_elf_early_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *splt; -@@ -2610,8 +2610,8 @@ rl78_elf_relax_section (bfd *abfd, - - #define bfd_elf32_bfd_relax_section rl78_elf_relax_section - #define elf_backend_check_relocs rl78_elf_check_relocs --#define elf_backend_always_size_sections \ -- rl78_elf_always_size_sections -+#define elf_backend_early_size_sections \ -+ rl78_elf_early_size_sections - #define elf_backend_finish_dynamic_sections \ - rl78_elf_finish_dynamic_sections - ---- a/bfd/elf32-s390.c -+++ b/bfd/elf32-s390.c -@@ -1366,7 +1366,7 @@ elf_s390_gc_mark_hook (asection *sec, - entry but we found we will not create any. Called when we find we will - not have any PLT for this symbol, by for example - elf_s390_adjust_dynamic_symbol when we're doing a proper dynamic link, -- or elf_s390_size_dynamic_sections if no dynamic sections will be -+ or elf_s390_late_size_sections if no dynamic sections will be - created (we're only linking static objects). */ - - static void -@@ -1778,8 +1778,8 @@ allocate_dynrelocs (struct elf_link_hash - /* Set the sizes of the dynamic sections. */ - - static bool --elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_s390_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_s390_link_hash_table *htab; - bfd *dynobj; -@@ -1790,7 +1790,7 @@ elf_s390_size_dynamic_sections (bfd *out - htab = elf_s390_hash_table (info); - dynobj = htab->elf.dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - - if (htab->elf.dynamic_sections_created) - { -@@ -3926,7 +3926,7 @@ elf32_s390_merge_private_bfd_data (bfd * - #define elf_backend_gc_mark_hook elf_s390_gc_mark_hook - #define elf_backend_reloc_type_class elf_s390_reloc_type_class - #define elf_backend_relocate_section elf_s390_relocate_section --#define elf_backend_size_dynamic_sections elf_s390_size_dynamic_sections -+#define elf_backend_late_size_sections elf_s390_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_grok_prstatus elf_s390_grok_prstatus - #define elf_backend_grok_psinfo elf_s390_grok_psinfo ---- a/bfd/elf32-score.c -+++ b/bfd/elf32-score.c -@@ -1089,7 +1089,7 @@ score_elf_got_info (bfd *abfd, asection - appear towards the end. This reduces the amount of GOT space - required. MAX_LOCAL is used to set the number of local symbols - known to be in the dynamic symbol table. During -- s3_bfd_score_elf_size_dynamic_sections, this value is 1. Afterward, the -+ s3_bfd_score_elf_late_size_sections, this value is 1. Afterward, the - section symbols are added and the count is higher. */ - static bool - score_elf_sort_hash_table (struct bfd_link_info *info, -@@ -3160,8 +3160,8 @@ s3_bfd_score_elf_adjust_dynamic_symbol ( - /* This function is called after all the input files have been read, - and the input sections have been assigned to output sections. */ - static bool --s3_bfd_score_elf_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+s3_bfd_score_elf_early_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; -@@ -3237,14 +3237,15 @@ s3_bfd_score_elf_always_size_sections (b - - /* Set the sizes of the dynamic sections. */ - static bool --s3_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) -+s3_bfd_score_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; - bool reltext; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -3313,7 +3314,7 @@ s3_bfd_score_elf_size_dynamic_sections ( - } - else if (startswith (name, ".got")) - { -- /* s3_bfd_score_elf_always_size_sections() has already done -+ /* s3_bfd_score_elf_early_size_sections() has already done - most of the work, but some symbols may have been mapped - to versions that we must now resolve in the got_entries - hash tables. */ -@@ -4177,22 +4178,22 @@ _bfd_score_elf_adjust_dynamic_symbol (st - } - - static bool --_bfd_score_elf_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+_bfd_score_elf_early_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - if (bfd_get_mach (output_bfd) == bfd_mach_score3) -- return s3_bfd_score_elf_always_size_sections (output_bfd, info); -+ return s3_bfd_score_elf_early_size_sections (output_bfd, info); - else -- return s7_bfd_score_elf_always_size_sections (output_bfd, info); -+ return s7_bfd_score_elf_early_size_sections (output_bfd, info); - } - - static bool --_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) -+_bfd_score_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - if (bfd_get_mach (output_bfd) == bfd_mach_score3) -- return s3_bfd_score_elf_size_dynamic_sections (output_bfd, info); -+ return s3_bfd_score_elf_late_size_sections (output_bfd, info); - else -- return s7_bfd_score_elf_size_dynamic_sections (output_bfd, info); -+ return s7_bfd_score_elf_late_size_sections (output_bfd, info); - } - - static bool -@@ -4455,10 +4456,10 @@ _bfd_score_elf_common_definition (Elf_In - _bfd_score_elf_section_from_bfd_section - #define elf_backend_adjust_dynamic_symbol \ - _bfd_score_elf_adjust_dynamic_symbol --#define elf_backend_always_size_sections \ -- _bfd_score_elf_always_size_sections --#define elf_backend_size_dynamic_sections \ -- _bfd_score_elf_size_dynamic_sections -+#define elf_backend_early_size_sections \ -+ _bfd_score_elf_early_size_sections -+#define elf_backend_late_size_sections \ -+ _bfd_score_elf_late_size_sections - #define elf_backend_omit_section_dynsym _bfd_elf_omit_section_dynsym_all - #define elf_backend_create_dynamic_sections \ - _bfd_score_elf_create_dynamic_sections ---- a/bfd/elf32-score.h -+++ b/bfd/elf32-score.h -@@ -78,10 +78,10 @@ s7_bfd_score_elf_adjust_dynamic_symbol ( - struct elf_link_hash_entry *); - - extern bool --s7_bfd_score_elf_always_size_sections (bfd *, struct bfd_link_info *); -+s7_bfd_score_elf_early_size_sections (bfd *, struct bfd_link_info *); - - extern bool --s7_bfd_score_elf_size_dynamic_sections (bfd *, struct bfd_link_info *); -+s7_bfd_score_elf_late_size_sections (bfd *, struct bfd_link_info *); - - extern bool - s7_bfd_score_elf_create_dynamic_sections (bfd *, struct bfd_link_info *); ---- a/bfd/elf32-score7.c -+++ b/bfd/elf32-score7.c -@@ -975,7 +975,7 @@ score_elf_got_info (bfd *abfd, asection - appear towards the end. This reduces the amount of GOT space - required. MAX_LOCAL is used to set the number of local symbols - known to be in the dynamic symbol table. During -- s7_bfd_score_elf_size_dynamic_sections, this value is 1. Afterward, the -+ s7_bfd_score_elf_late_size_sections, this value is 1. Afterward, the - section symbols are added and the count is higher. */ - - static bool -@@ -2969,8 +2969,8 @@ s7_bfd_score_elf_adjust_dynamic_symbol ( - and the input sections have been assigned to output sections. */ - - bool --s7_bfd_score_elf_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+s7_bfd_score_elf_early_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; -@@ -3047,14 +3047,15 @@ s7_bfd_score_elf_always_size_sections (b - /* Set the sizes of the dynamic sections. */ - - bool --s7_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) -+s7_bfd_score_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; - bool reltext; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -3123,7 +3124,7 @@ s7_bfd_score_elf_size_dynamic_sections ( - } - else if (startswith (name, ".got")) - { -- /* s7_bfd_score_elf_always_size_sections() has already done -+ /* s7_bfd_score_elf_early_size_sections() has already done - most of the work, but some symbols may have been mapped - to versions that we must now resolve in the got_entries - hash tables. */ ---- a/bfd/elf32-sh.c -+++ b/bfd/elf32-sh.c -@@ -2927,7 +2927,7 @@ allocate_dynrelocs (struct elf_link_hash - It's a convenient place to determine the PLT style. */ - - static bool --sh_elf_always_size_sections (bfd *output_bfd, struct bfd_link_info *info) -+sh_elf_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - sh_elf_hash_table (info)->plt_info = get_plt_info (output_bfd, - bfd_link_pic (info)); -@@ -2942,8 +2942,8 @@ sh_elf_always_size_sections (bfd *output - /* Set the sizes of the dynamic sections. */ - - static bool --sh_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+sh_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_sh_link_hash_table *htab; - bfd *dynobj; -@@ -2956,7 +2956,8 @@ sh_elf_size_dynamic_sections (bfd *outpu - return false; - - dynobj = htab->root.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->root.dynamic_sections_created) - { -@@ -6602,10 +6603,8 @@ sh_elf_encode_eh_address (bfd *abfd, - sh_elf_link_hash_table_create - #define elf_backend_adjust_dynamic_symbol \ - sh_elf_adjust_dynamic_symbol --#define elf_backend_always_size_sections \ -- sh_elf_always_size_sections --#define elf_backend_size_dynamic_sections \ -- sh_elf_size_dynamic_sections -+#define elf_backend_early_size_sections sh_elf_early_size_sections -+#define elf_backend_late_size_sections sh_elf_late_size_sections - #define elf_backend_omit_section_dynsym sh_elf_omit_section_dynsym - #define elf_backend_finish_dynamic_symbol \ - sh_elf_finish_dynamic_symbol ---- a/bfd/elf32-sparc.c -+++ b/bfd/elf32-sparc.c -@@ -248,8 +248,7 @@ elf32_sparc_reloc_type_class (const stru - #define elf_backend_adjust_dynamic_symbol \ - _bfd_sparc_elf_adjust_dynamic_symbol - #define elf_backend_omit_section_dynsym _bfd_sparc_elf_omit_section_dynsym --#define elf_backend_size_dynamic_sections \ -- _bfd_sparc_elf_size_dynamic_sections -+#define elf_backend_late_size_sections _bfd_sparc_elf_late_size_sections - #define elf_backend_relocate_section _bfd_sparc_elf_relocate_section - #define elf_backend_finish_dynamic_symbol \ - _bfd_sparc_elf_finish_dynamic_symbol ---- a/bfd/elf32-tic6x.c -+++ b/bfd/elf32-tic6x.c -@@ -3160,7 +3160,7 @@ elf32_tic6x_allocate_dynrelocs (struct e - /* Set the sizes of the dynamic sections. */ - - static bool --elf32_tic6x_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) -+elf32_tic6x_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - struct elf32_tic6x_link_hash_table *htab; - bfd *dynobj; -@@ -3171,7 +3171,7 @@ elf32_tic6x_size_dynamic_sections (bfd * - htab = elf32_tic6x_hash_table (info); - dynobj = htab->elf.dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - - if (htab->elf.dynamic_sections_created) - { -@@ -3358,7 +3358,7 @@ elf32_tic6x_size_dynamic_sections (bfd * - and the input sections have been assigned to output sections. */ - - static bool --elf32_tic6x_always_size_sections (bfd *output_bfd, struct bfd_link_info *info) -+elf32_tic6x_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - if (elf32_tic6x_using_dsbt (output_bfd) && !bfd_link_relocatable (info) - && !bfd_elf_stack_segment_size (output_bfd, info, -@@ -4261,10 +4261,10 @@ elf32_tic6x_write_section (bfd *output_b - #define elf_backend_relocs_compatible _bfd_elf_relocs_compatible - #define elf_backend_finish_dynamic_symbol \ - elf32_tic6x_finish_dynamic_symbol --#define elf_backend_always_size_sections \ -- elf32_tic6x_always_size_sections --#define elf_backend_size_dynamic_sections \ -- elf32_tic6x_size_dynamic_sections -+#define elf_backend_early_size_sections \ -+ elf32_tic6x_early_size_sections -+#define elf_backend_late_size_sections \ -+ elf32_tic6x_late_size_sections - #define elf_backend_finish_dynamic_sections \ - elf32_tic6x_finish_dynamic_sections - #define bfd_elf32_bfd_final_link \ ---- a/bfd/elf32-tilegx.c -+++ b/bfd/elf32-tilegx.c -@@ -105,7 +105,7 @@ tilegx_elf_grok_psinfo (bfd *abfd, Elf_I - #define elf_backend_check_relocs tilegx_elf_check_relocs - #define elf_backend_adjust_dynamic_symbol tilegx_elf_adjust_dynamic_symbol - #define elf_backend_omit_section_dynsym tilegx_elf_omit_section_dynsym --#define elf_backend_size_dynamic_sections tilegx_elf_size_dynamic_sections -+#define elf_backend_late_size_sections tilegx_elf_late_size_sections - #define elf_backend_relocate_section tilegx_elf_relocate_section - #define elf_backend_finish_dynamic_symbol tilegx_elf_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections tilegx_elf_finish_dynamic_sections ---- a/bfd/elf32-tilepro.c -+++ b/bfd/elf32-tilepro.c -@@ -2182,11 +2182,9 @@ tilepro_elf_omit_section_dynsym (bfd *ou - #define ELF32_DYNAMIC_INTERPRETER "/lib/ld.so.1" - - static bool --tilepro_elf_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+tilepro_elf_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { -- (void)output_bfd; -- - struct elf_link_hash_table *htab; - bfd *dynobj; - asection *s; -@@ -2195,7 +2193,8 @@ tilepro_elf_size_dynamic_sections (bfd * - htab = tilepro_elf_hash_table (info); - BFD_ASSERT (htab != NULL); - dynobj = htab->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -3739,7 +3738,7 @@ tilepro_additional_program_headers (bfd - #define elf_backend_check_relocs tilepro_elf_check_relocs - #define elf_backend_adjust_dynamic_symbol tilepro_elf_adjust_dynamic_symbol - #define elf_backend_omit_section_dynsym tilepro_elf_omit_section_dynsym --#define elf_backend_size_dynamic_sections tilepro_elf_size_dynamic_sections -+#define elf_backend_late_size_sections tilepro_elf_late_size_sections - #define elf_backend_relocate_section tilepro_elf_relocate_section - #define elf_backend_finish_dynamic_symbol tilepro_elf_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections tilepro_elf_finish_dynamic_sections ---- a/bfd/elf32-vax.c -+++ b/bfd/elf32-vax.c -@@ -36,7 +36,6 @@ static bool elf_vax_check_relocs (bfd *, - asection *, const Elf_Internal_Rela *); - static bool elf_vax_adjust_dynamic_symbol (struct bfd_link_info *, - struct elf_link_hash_entry *); --static bool elf_vax_size_dynamic_sections (bfd *, struct bfd_link_info *); - static int elf_vax_relocate_section (bfd *, struct bfd_link_info *, - bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, -@@ -985,8 +984,8 @@ elf_vax_discard_got_entries (struct elf_ - /* Discard unused dynamic data if this is a static link. */ - - static bool --elf_vax_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_vax_early_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; -@@ -1024,14 +1023,15 @@ elf_vax_always_size_sections (bfd *outpu - /* Set the sizes of the dynamic sections. */ - - static bool --elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) -+elf_vax_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; - bool relocs; - - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -1861,10 +1861,8 @@ elf_vax_plt_sym_val (bfd_vma i, const as - #define elf_backend_check_relocs elf_vax_check_relocs - #define elf_backend_adjust_dynamic_symbol \ - elf_vax_adjust_dynamic_symbol --#define elf_backend_always_size_sections \ -- elf_vax_always_size_sections --#define elf_backend_size_dynamic_sections \ -- elf_vax_size_dynamic_sections -+#define elf_backend_early_size_sections elf_vax_early_size_sections -+#define elf_backend_late_size_sections elf_vax_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_relocate_section elf_vax_relocate_section - #define elf_backend_finish_dynamic_symbol \ ---- a/bfd/elf32-xstormy16.c -+++ b/bfd/elf32-xstormy16.c -@@ -706,8 +706,8 @@ xstormy16_elf_relax_section (bfd *dynobj - } - - static bool --xstormy16_elf_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+xstormy16_elf_early_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *splt; -@@ -1013,8 +1013,8 @@ xstormy16_elf_gc_mark_hook (asection *se - #define elf_backend_relocate_section xstormy16_elf_relocate_section - #define elf_backend_gc_mark_hook xstormy16_elf_gc_mark_hook - #define elf_backend_check_relocs xstormy16_elf_check_relocs --#define elf_backend_always_size_sections \ -- xstormy16_elf_always_size_sections -+#define elf_backend_early_size_sections \ -+ xstormy16_elf_early_size_sections - #define elf_backend_omit_section_dynsym \ - _bfd_elf_omit_section_dynsym_all - #define elf_backend_finish_dynamic_sections \ ---- a/bfd/elf32-xtensa.c -+++ b/bfd/elf32-xtensa.c -@@ -1557,8 +1557,8 @@ elf_xtensa_allocate_local_got_size (stru - /* Set the sizes of the dynamic sections. */ - - static bool --elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_xtensa_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_xtensa_link_hash_table *htab; - bfd *dynobj, *abfd; -@@ -1575,7 +1575,7 @@ elf_xtensa_size_dynamic_sections (bfd *o - - dynobj = elf_hash_table (info)->dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - srelgot = htab->elf.srelgot; - srelplt = htab->elf.srelplt; - -@@ -1780,8 +1780,7 @@ elf_xtensa_size_dynamic_sections (bfd *o - } - - static bool --elf_xtensa_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elf_xtensa_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - struct elf_xtensa_link_hash_table *htab; - asection *tls_sec; -@@ -11544,8 +11543,8 @@ static const struct bfd_elf_special_sect - #define elf_backend_object_p elf_xtensa_object_p - #define elf_backend_reloc_type_class elf_xtensa_reloc_type_class - #define elf_backend_relocate_section elf_xtensa_relocate_section --#define elf_backend_size_dynamic_sections elf_xtensa_size_dynamic_sections --#define elf_backend_always_size_sections elf_xtensa_always_size_sections -+#define elf_backend_late_size_sections elf_xtensa_late_size_sections -+#define elf_backend_early_size_sections elf_xtensa_early_size_sections - #define elf_backend_omit_section_dynsym _bfd_elf_omit_section_dynsym_all - #define elf_backend_special_sections elf_xtensa_special_sections - #define elf_backend_action_discarded elf_xtensa_action_discarded ---- a/bfd/elf64-alpha.c -+++ b/bfd/elf64-alpha.c -@@ -2562,8 +2562,8 @@ elf64_alpha_size_plt_section (struct bfd - } - - static bool --elf64_alpha_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf64_alpha_early_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *i; - struct alpha_elf_link_hash_table * htab; -@@ -2789,8 +2789,8 @@ elf64_alpha_size_rela_got_section (struc - /* Set the sizes of the dynamic sections. */ - - static bool --elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf64_alpha_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s; -@@ -2802,7 +2802,8 @@ elf64_alpha_size_dynamic_sections (bfd * - return false; - - dynobj = elf_hash_table(info)->dynobj; -- BFD_ASSERT(dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -5448,10 +5449,10 @@ static const struct elf_size_info alpha_ - elf64_alpha_merge_symbol_attribute - #define elf_backend_copy_indirect_symbol \ - elf64_alpha_copy_indirect_symbol --#define elf_backend_always_size_sections \ -- elf64_alpha_always_size_sections --#define elf_backend_size_dynamic_sections \ -- elf64_alpha_size_dynamic_sections -+#define elf_backend_early_size_sections \ -+ elf64_alpha_early_size_sections -+#define elf_backend_late_size_sections \ -+ elf64_alpha_late_size_sections - #define elf_backend_omit_section_dynsym \ - _bfd_elf_omit_section_dynsym_all - #define elf_backend_relocate_section \ ---- a/bfd/elf64-hppa.c -+++ b/bfd/elf64-hppa.c -@@ -176,9 +176,6 @@ static bool elf64_hppa_adjust_dynamic_sy - static bool elf64_hppa_mark_milli_and_exported_functions - (struct elf_link_hash_entry *, void *); - --static bool elf64_hppa_size_dynamic_sections -- (bfd *, struct bfd_link_info *); -- - static int elf64_hppa_link_output_symbol_hook - (struct bfd_link_info *, const char *, Elf_Internal_Sym *, - asection *, struct elf_link_hash_entry *); -@@ -1520,7 +1517,7 @@ elf64_hppa_mark_milli_and_exported_funct - the contents of our special sections. */ - - static bool --elf64_hppa_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) -+elf64_hppa_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - struct elf64_hppa_link_hash_table *hppa_info; - struct elf64_hppa_allocate_data data; -@@ -1534,7 +1531,8 @@ elf64_hppa_size_dynamic_sections (bfd *o - return false; - - dynobj = hppa_info->root.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - /* Mark each function this program exports so that we will allocate - space in the .opd section for each function's FPTR. If we are -@@ -3984,8 +3982,7 @@ const struct elf_size_info hppa64_elf_si - #define elf_backend_adjust_dynamic_symbol \ - elf64_hppa_adjust_dynamic_symbol - --#define elf_backend_size_dynamic_sections \ -- elf64_hppa_size_dynamic_sections -+#define elf_backend_late_size_sections elf64_hppa_late_size_sections - - #define elf_backend_finish_dynamic_symbol \ - elf64_hppa_finish_dynamic_symbol ---- a/bfd/elf64-ia64-vms.c -+++ b/bfd/elf64-ia64-vms.c -@@ -2591,8 +2591,8 @@ elf64_ia64_adjust_dynamic_symbol (struct - } - - static bool --elf64_ia64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf64_ia64_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf64_ia64_allocate_data data; - struct elf64_ia64_link_hash_table *ia64_info; -@@ -2601,11 +2601,12 @@ elf64_ia64_size_dynamic_sections (bfd *o - struct elf_link_hash_table *hash_table; - - hash_table = elf_hash_table (info); -- dynobj = hash_table->dynobj; - ia64_info = elf64_ia64_hash_table (info); - if (ia64_info == NULL) - return false; -- BFD_ASSERT(dynobj != NULL); -+ dynobj = hash_table->dynobj; -+ if (dynobj == NULL) -+ return true; - data.info = info; - - /* Allocate the GOT entries. */ -@@ -5485,8 +5486,8 @@ static const struct elf_size_info elf64_ - elf64_ia64_check_relocs - #define elf_backend_adjust_dynamic_symbol \ - elf64_ia64_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections \ -- elf64_ia64_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ elf64_ia64_late_size_sections - #define elf_backend_omit_section_dynsym \ - _bfd_elf_omit_section_dynsym_all - #define elf_backend_relocate_section \ ---- a/bfd/elf64-mips.c -+++ b/bfd/elf64-mips.c -@@ -4748,10 +4748,10 @@ const struct elf_size_info mips_elf64_si - #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag - #define elf_backend_adjust_dynamic_symbol \ - _bfd_mips_elf_adjust_dynamic_symbol --#define elf_backend_always_size_sections \ -- _bfd_mips_elf_always_size_sections --#define elf_backend_size_dynamic_sections \ -- _bfd_mips_elf_size_dynamic_sections -+#define elf_backend_early_size_sections \ -+ _bfd_mips_elf_early_size_sections -+#define elf_backend_late_size_sections \ -+ _bfd_mips_elf_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_relocate_section _bfd_mips_elf_relocate_section - #define elf_backend_finish_dynamic_symbol \ ---- a/bfd/elf64-ppc.c -+++ b/bfd/elf64-ppc.c -@@ -119,8 +119,8 @@ static bfd_vma opd_entry_value - #define elf_backend_adjust_dynamic_symbol ppc64_elf_adjust_dynamic_symbol - #define elf_backend_hide_symbol ppc64_elf_hide_symbol - #define elf_backend_maybe_function_sym ppc64_elf_maybe_function_sym --#define elf_backend_always_size_sections ppc64_elf_edit --#define elf_backend_size_dynamic_sections ppc64_elf_size_dynamic_sections -+#define elf_backend_early_size_sections ppc64_elf_edit -+#define elf_backend_late_size_sections ppc64_elf_late_size_sections - #define elf_backend_hash_symbol ppc64_elf_hash_symbol - #define elf_backend_init_index_section _bfd_elf_init_2_index_sections - #define elf_backend_action_discarded ppc64_elf_action_discarded -@@ -10138,7 +10138,7 @@ allocate_dynrelocs (struct elf_link_hash - ((((v) & 0x3ffff0000ULL) << 16) | (v & 0xffff)) - #define HA34(v) ((v + (1ULL << 33)) >> 34) - --/* Called via elf_link_hash_traverse from ppc64_elf_size_dynamic_sections -+/* Called via elf_link_hash_traverse from ppc64_elf_late_size_sections - to set up space for global entry stubs. These are put in glink, - after the branch table. */ - -@@ -10215,8 +10215,8 @@ size_global_entry_stubs (struct elf_link - /* Set the sizes of the dynamic sections. */ - - static bool --ppc64_elf_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+ppc64_elf_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - struct ppc_link_hash_table *htab; - bfd *dynobj; -@@ -10231,7 +10231,7 @@ ppc64_elf_size_dynamic_sections (bfd *ou - - dynobj = htab->elf.dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - - if (htab->elf.dynamic_sections_created) - { ---- a/bfd/elf64-s390.c -+++ b/bfd/elf64-s390.c -@@ -1301,7 +1301,7 @@ elf_s390_gc_mark_hook (asection *sec, - entry but we found we will not create any. Called when we find we will - not have any PLT for this symbol, by for example - elf_s390_adjust_dynamic_symbol when we're doing a proper dynamic link, -- or elf_s390_size_dynamic_sections if no dynamic sections will be -+ or elf_s390_late_size_sections if no dynamic sections will be - created (we're only linking static objects). */ - - static void -@@ -1714,8 +1714,8 @@ allocate_dynrelocs (struct elf_link_hash - /* Set the sizes of the dynamic sections. */ - - static bool --elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elf_s390_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_s390_link_hash_table *htab; - bfd *dynobj; -@@ -1729,7 +1729,7 @@ elf_s390_size_dynamic_sections (bfd *out - - dynobj = htab->elf.dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - - if (htab->elf.dynamic_sections_created) - { -@@ -3912,7 +3912,7 @@ const struct elf_size_info s390_elf64_si - #define elf_backend_gc_mark_hook elf_s390_gc_mark_hook - #define elf_backend_reloc_type_class elf_s390_reloc_type_class - #define elf_backend_relocate_section elf_s390_relocate_section --#define elf_backend_size_dynamic_sections elf_s390_size_dynamic_sections -+#define elf_backend_late_size_sections elf_s390_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_grok_prstatus elf_s390_grok_prstatus - #define elf_backend_grok_psinfo elf_s390_grok_psinfo ---- a/bfd/elf64-sparc.c -+++ b/bfd/elf64-sparc.c -@@ -953,8 +953,8 @@ const struct elf_size_info elf64_sparc_s - _bfd_sparc_elf_adjust_dynamic_symbol - #define elf_backend_omit_section_dynsym \ - _bfd_sparc_elf_omit_section_dynsym --#define elf_backend_size_dynamic_sections \ -- _bfd_sparc_elf_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ _bfd_sparc_elf_late_size_sections - #define elf_backend_relocate_section \ - _bfd_sparc_elf_relocate_section - #define elf_backend_finish_dynamic_symbol \ ---- a/bfd/elf64-tilegx.c -+++ b/bfd/elf64-tilegx.c -@@ -106,7 +106,7 @@ tilegx_elf_grok_psinfo (bfd *abfd, Elf_I - #define elf_backend_check_relocs tilegx_elf_check_relocs - #define elf_backend_adjust_dynamic_symbol tilegx_elf_adjust_dynamic_symbol - #define elf_backend_omit_section_dynsym tilegx_elf_omit_section_dynsym --#define elf_backend_size_dynamic_sections tilegx_elf_size_dynamic_sections -+#define elf_backend_late_size_sections tilegx_elf_late_size_sections - #define elf_backend_relocate_section tilegx_elf_relocate_section - #define elf_backend_finish_dynamic_symbol tilegx_elf_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections tilegx_elf_finish_dynamic_sections ---- a/bfd/elf64-x86-64.c -+++ b/bfd/elf64-x86-64.c -@@ -2468,8 +2468,7 @@ elf_x86_64_scan_relocs (bfd *abfd, struc - } - - static bool --elf_x86_64_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elf_x86_64_early_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - bfd *abfd; - -@@ -2482,7 +2481,7 @@ elf_x86_64_always_size_sections (bfd *ou - elf_x86_64_scan_relocs)) - return false; - -- return _bfd_x86_elf_always_size_sections (output_bfd, info); -+ return _bfd_x86_elf_early_size_sections (output_bfd, info); - } - - /* Return the relocation value for @tpoff relocation -@@ -5413,7 +5412,7 @@ elf_x86_64_special_sections[]= - elf_x86_64_reloc_name_lookup - - #define elf_backend_relocs_compatible elf_x86_64_relocs_compatible --#define elf_backend_always_size_sections elf_x86_64_always_size_sections -+#define elf_backend_early_size_sections elf_x86_64_early_size_sections - #define elf_backend_create_dynamic_sections _bfd_elf_create_dynamic_sections - #define elf_backend_finish_dynamic_sections elf_x86_64_finish_dynamic_sections - #define elf_backend_finish_dynamic_symbol elf_x86_64_finish_dynamic_symbol ---- a/bfd/elflink.c -+++ b/bfd/elflink.c -@@ -6648,8 +6648,8 @@ bfd_elf_size_dynamic_sections (bfd *outp - - /* The backend may have to create some sections regardless of whether - we're dynamic or not. */ -- if (bed->elf_backend_always_size_sections -- && ! (*bed->elf_backend_always_size_sections) (output_bfd, info)) -+ if (bed->elf_backend_early_size_sections -+ && !bed->elf_backend_early_size_sections (output_bfd, info)) - return false; - - dynobj = elf_hash_table (info)->dynobj; -@@ -7429,9 +7429,8 @@ NOTE: This behaviour is deprecated and w - - /* The backend must work out the sizes of all the other dynamic - sections. */ -- if (dynobj != NULL -- && bed->elf_backend_size_dynamic_sections != NULL -- && ! (*bed->elf_backend_size_dynamic_sections) (output_bfd, info)) -+ if (bed->elf_backend_late_size_sections != NULL -+ && !bed->elf_backend_late_size_sections (output_bfd, info)) - return false; - - if (dynobj != NULL && elf_hash_table (info)->dynamic_sections_created) ---- a/bfd/elfn32-mips.c -+++ b/bfd/elfn32-mips.c -@@ -4138,10 +4138,8 @@ static const struct ecoff_debug_swap mip - #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag - #define elf_backend_adjust_dynamic_symbol \ - _bfd_mips_elf_adjust_dynamic_symbol --#define elf_backend_always_size_sections \ -- _bfd_mips_elf_always_size_sections --#define elf_backend_size_dynamic_sections \ -- _bfd_mips_elf_size_dynamic_sections -+#define elf_backend_early_size_sections _bfd_mips_elf_early_size_sections -+#define elf_backend_late_size_sections _bfd_mips_elf_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_relocate_section _bfd_mips_elf_relocate_section - #define elf_backend_finish_dynamic_symbol \ ---- a/bfd/elfnn-aarch64.c -+++ b/bfd/elfnn-aarch64.c -@@ -112,7 +112,7 @@ - allocate space for one relocation on the slot. Record the GOT offset - for this symbol. - -- elfNN_aarch64_size_dynamic_sections () -+ elfNN_aarch64_late_size_sections () - - Iterate all input BFDS, look for in the local symbol data structure - constructed earlier for local TLS symbols and allocate them double -@@ -9144,8 +9144,8 @@ elfNN_aarch64_allocate_local_ifunc_dynre - though ! */ - - static bool --elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elfNN_aarch64_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elf_aarch64_link_hash_table *htab; - bfd *dynobj; -@@ -9156,7 +9156,8 @@ elfNN_aarch64_size_dynamic_sections (bfd - htab = elf_aarch64_hash_table ((info)); - dynobj = htab->root.dynobj; - -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->root.dynamic_sections_created) - { -@@ -9558,8 +9559,8 @@ elfNN_aarch64_create_small_pltn_entry (s - _TLS_MODULE_BASE_, if needed. */ - - static bool --elfNN_aarch64_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+elfNN_aarch64_early_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - asection *tls_sec; - -@@ -10292,8 +10293,8 @@ const struct elf_size_info elfNN_aarch64 - #define elf_backend_adjust_dynamic_symbol \ - elfNN_aarch64_adjust_dynamic_symbol - --#define elf_backend_always_size_sections \ -- elfNN_aarch64_always_size_sections -+#define elf_backend_early_size_sections \ -+ elfNN_aarch64_early_size_sections - - #define elf_backend_check_relocs \ - elfNN_aarch64_check_relocs -@@ -10348,8 +10349,8 @@ const struct elf_size_info elfNN_aarch64 - #define elf_backend_modify_headers \ - elfNN_aarch64_modify_headers - --#define elf_backend_size_dynamic_sections \ -- elfNN_aarch64_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ elfNN_aarch64_late_size_sections - - #define elf_backend_size_info \ - elfNN_aarch64_size_info ---- a/bfd/elfnn-ia64.c -+++ b/bfd/elfnn-ia64.c -@@ -2987,8 +2987,8 @@ elfNN_ia64_adjust_dynamic_symbol (struct - } - - static bool --elfNN_ia64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+elfNN_ia64_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct elfNN_ia64_allocate_data data; - struct elfNN_ia64_link_hash_table *ia64_info; -@@ -2999,8 +2999,9 @@ elfNN_ia64_size_dynamic_sections (bfd *o - if (ia64_info == NULL) - return false; - dynobj = ia64_info->root.dynobj; -+ if (dynobj == NULL) -+ return true; - ia64_info->self_dtpmod_offset = (bfd_vma) -1; -- BFD_ASSERT(dynobj != NULL); - data.info = info; - - /* Set the contents of the .interp section to the interpreter. */ -@@ -5036,8 +5037,8 @@ ignore_errors (const char *fmt ATTRIBUTE - elfNN_ia64_check_relocs - #define elf_backend_adjust_dynamic_symbol \ - elfNN_ia64_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections \ -- elfNN_ia64_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ elfNN_ia64_late_size_sections - #define elf_backend_omit_section_dynsym \ - _bfd_elf_omit_section_dynsym_all - #define elf_backend_relocate_section \ ---- a/bfd/elfnn-loongarch.c -+++ b/bfd/elfnn-loongarch.c -@@ -1581,8 +1581,8 @@ maybe_set_textrel (struct elf_link_hash_ - } - - static bool --loongarch_elf_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+loongarch_elf_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - struct loongarch_elf_link_hash_table *htab; - bfd *dynobj; -@@ -1592,7 +1592,8 @@ loongarch_elf_size_dynamic_sections (bfd - htab = loongarch_elf_hash_table (info); - BFD_ASSERT (htab != NULL); - dynobj = htab->elf.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (htab->elf.dynamic_sections_created) - { -@@ -4651,7 +4652,7 @@ elf_loongarch64_hash_symbol (struct elf_ - loongarch_elf_create_dynamic_sections - #define elf_backend_check_relocs loongarch_elf_check_relocs - #define elf_backend_adjust_dynamic_symbol loongarch_elf_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections loongarch_elf_size_dynamic_sections -+#define elf_backend_late_size_sections loongarch_elf_late_size_sections - #define elf_backend_relocate_section loongarch_elf_relocate_section - #define elf_backend_finish_dynamic_symbol loongarch_elf_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections \ ---- a/bfd/elfnn-riscv.c -+++ b/bfd/elfnn-riscv.c -@@ -1485,7 +1485,7 @@ allocate_local_ifunc_dynrelocs (void **s - } - - static bool --riscv_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) -+riscv_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) - { - struct riscv_elf_link_hash_table *htab; - bfd *dynobj; -@@ -1495,7 +1495,8 @@ riscv_elf_size_dynamic_sections (bfd *ou - htab = riscv_elf_hash_table (info); - BFD_ASSERT (htab != NULL); - dynobj = htab->elf.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -5540,7 +5541,7 @@ riscv_elf_merge_symbol_attribute (struct - #define elf_backend_create_dynamic_sections riscv_elf_create_dynamic_sections - #define elf_backend_check_relocs riscv_elf_check_relocs - #define elf_backend_adjust_dynamic_symbol riscv_elf_adjust_dynamic_symbol --#define elf_backend_size_dynamic_sections riscv_elf_size_dynamic_sections -+#define elf_backend_late_size_sections riscv_elf_late_size_sections - #define elf_backend_relocate_section riscv_elf_relocate_section - #define elf_backend_finish_dynamic_symbol riscv_elf_finish_dynamic_symbol - #define elf_backend_finish_dynamic_sections riscv_elf_finish_dynamic_sections ---- a/bfd/elfxx-mips.c -+++ b/bfd/elfxx-mips.c -@@ -9644,8 +9644,8 @@ _bfd_mips_elf_adjust_dynamic_symbol (str - check for any mips16 stub sections that we can discard. */ - - bool --_bfd_mips_elf_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+_bfd_mips_elf_early_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - asection *sect; - struct mips_elf_link_hash_table *htab; -@@ -9988,8 +9988,8 @@ mips_elf_set_plt_sym_value (struct mips_ - /* Set the sizes of the dynamic sections. */ - - bool --_bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+_bfd_mips_elf_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - bfd *dynobj; - asection *s, *sreldyn; -@@ -9999,7 +9999,8 @@ _bfd_mips_elf_size_dynamic_sections (bfd - htab = mips_elf_hash_table (info); - BFD_ASSERT (htab != NULL); - dynobj = elf_hash_table (info)->dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { -@@ -14933,7 +14934,7 @@ _bfd_mips_elf_final_link (bfd *abfd, str - input_section->flags &= ~SEC_HAS_CONTENTS; - } - -- /* Size has been set in _bfd_mips_elf_always_size_sections. */ -+ /* Size has been set in _bfd_mips_elf_early_size_sections. */ - BFD_ASSERT(o->size == sizeof (Elf_External_ABIFlags_v0)); - - /* Skip this section later on (I don't think this currently -@@ -14992,7 +14993,7 @@ _bfd_mips_elf_final_link (bfd *abfd, str - input_section->flags &= ~SEC_HAS_CONTENTS; - } - -- /* Size has been set in _bfd_mips_elf_always_size_sections. */ -+ /* Size has been set in _bfd_mips_elf_early_size_sections. */ - BFD_ASSERT(o->size == sizeof (Elf32_External_RegInfo)); - - /* Skip this section later on (I don't think this currently ---- a/bfd/elfxx-mips.h -+++ b/bfd/elfxx-mips.h -@@ -67,9 +67,9 @@ extern bool _bfd_mips_elf_check_relocs - (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); - extern bool _bfd_mips_elf_adjust_dynamic_symbol - (struct bfd_link_info *, struct elf_link_hash_entry *); --extern bool _bfd_mips_elf_always_size_sections -+extern bool _bfd_mips_elf_early_size_sections - (bfd *, struct bfd_link_info *); --extern bool _bfd_mips_elf_size_dynamic_sections -+extern bool _bfd_mips_elf_late_size_sections - (bfd *, struct bfd_link_info *); - extern int _bfd_mips_elf_relocate_section - (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, ---- a/bfd/elfxx-sparc.c -+++ b/bfd/elfxx-sparc.c -@@ -2381,8 +2381,8 @@ _bfd_sparc_elf_omit_section_dynsym (bfd - /* Set the sizes of the dynamic sections. */ - - bool --_bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+_bfd_sparc_elf_late_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - struct _bfd_sparc_elf_link_hash_table *htab; - bfd *dynobj; -@@ -2392,7 +2392,8 @@ _bfd_sparc_elf_size_dynamic_sections (bf - htab = _bfd_sparc_elf_hash_table (info); - BFD_ASSERT (htab != NULL); - dynobj = htab->elf.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { ---- a/bfd/elfxx-sparc.h -+++ b/bfd/elfxx-sparc.h -@@ -117,7 +117,7 @@ extern bool _bfd_sparc_elf_adjust_dynami - (struct bfd_link_info *, struct elf_link_hash_entry *); - extern bool _bfd_sparc_elf_omit_section_dynsym - (bfd *, struct bfd_link_info *, asection *); --extern bool _bfd_sparc_elf_size_dynamic_sections -+extern bool _bfd_sparc_elf_late_size_sections - (bfd *, struct bfd_link_info *); - extern bool _bfd_sparc_elf_new_section_hook - (bfd *, asection *); ---- a/bfd/elfxx-target.h -+++ b/bfd/elfxx-target.h -@@ -487,11 +487,11 @@ - #ifndef elf_backend_adjust_dynamic_symbol - #define elf_backend_adjust_dynamic_symbol 0 - #endif --#ifndef elf_backend_always_size_sections --#define elf_backend_always_size_sections 0 -+#ifndef elf_backend_early_size_sections -+#define elf_backend_early_size_sections 0 - #endif --#ifndef elf_backend_size_dynamic_sections --#define elf_backend_size_dynamic_sections 0 -+#ifndef elf_backend_late_size_sections -+#define elf_backend_late_size_sections 0 - #endif - #ifndef elf_backend_strip_zero_sized_dynamic_sections - #define elf_backend_strip_zero_sized_dynamic_sections 0 -@@ -849,8 +849,8 @@ static const struct elf_backend_data elf - elf_backend_check_directives, - elf_backend_notice_as_needed, - elf_backend_adjust_dynamic_symbol, -- elf_backend_always_size_sections, -- elf_backend_size_dynamic_sections, -+ elf_backend_early_size_sections, -+ elf_backend_late_size_sections, - elf_backend_strip_zero_sized_dynamic_sections, - elf_backend_init_index_section, - elf_backend_relocate_section, ---- a/bfd/elfxx-tilegx.c -+++ b/bfd/elfxx-tilegx.c -@@ -2430,8 +2430,8 @@ tilegx_elf_omit_section_dynsym (bfd *out - } - - bool --tilegx_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -- struct bfd_link_info *info) -+tilegx_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, -+ struct bfd_link_info *info) - { - struct tilegx_elf_link_hash_table *htab; - bfd *dynobj; -@@ -2441,7 +2441,8 @@ tilegx_elf_size_dynamic_sections (bfd *o - htab = tilegx_elf_hash_table (info); - BFD_ASSERT (htab != NULL); - dynobj = htab->elf.dynobj; -- BFD_ASSERT (dynobj != NULL); -+ if (dynobj == NULL) -+ return true; - - if (elf_hash_table (info)->dynamic_sections_created) - { ---- a/bfd/elfxx-tilegx.h -+++ b/bfd/elfxx-tilegx.h -@@ -57,7 +57,7 @@ tilegx_elf_omit_section_dynsym (bfd *, - asection *); - - extern bool --tilegx_elf_size_dynamic_sections (bfd *, struct bfd_link_info *); -+tilegx_elf_late_size_sections (bfd *, struct bfd_link_info *); - - extern int - tilegx_elf_relocate_section (bfd *, struct bfd_link_info *, ---- a/bfd/elfxx-x86.c -+++ b/bfd/elfxx-x86.c -@@ -2241,7 +2241,7 @@ _bfd_elf_x86_valid_reloc_p (asection *in - /* Set the sizes of the dynamic sections. */ - - bool --_bfd_x86_elf_size_dynamic_sections (bfd *output_bfd, -+_bfd_x86_elf_late_size_sections (bfd *output_bfd, - struct bfd_link_info *info) - { - struct elf_x86_link_hash_table *htab; -@@ -2257,7 +2257,7 @@ _bfd_x86_elf_size_dynamic_sections (bfd - return false; - dynobj = htab->elf.dynobj; - if (dynobj == NULL) -- abort (); -+ return true; - - /* Set up .got offsets for local syms, and space for local dynamic - relocs. */ -@@ -2964,8 +2964,8 @@ _bfd_x86_elf_finish_dynamic_sections (bf - - - bool --_bfd_x86_elf_always_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) -+_bfd_x86_elf_early_size_sections (bfd *output_bfd, -+ struct bfd_link_info *info) - { - asection *tls_sec = elf_hash_table (info)->tls_sec; - ---- a/bfd/elfxx-x86.h -+++ b/bfd/elfxx-x86.h -@@ -847,13 +847,13 @@ extern bool _bfd_elf_x86_valid_reloc_p - const Elf_Internal_Rela *, struct elf_link_hash_entry *, - Elf_Internal_Sym *, Elf_Internal_Shdr *, bool *); - --extern bool _bfd_x86_elf_size_dynamic_sections -+extern bool _bfd_x86_elf_late_size_sections - (bfd *, struct bfd_link_info *); - - extern struct elf_x86_link_hash_table *_bfd_x86_elf_finish_dynamic_sections - (bfd *, struct bfd_link_info *); - --extern bool _bfd_x86_elf_always_size_sections -+extern bool _bfd_x86_elf_early_size_sections - (bfd *, struct bfd_link_info *); - - extern void _bfd_x86_elf_merge_symbol_attribute -@@ -925,8 +925,8 @@ extern void _bfd_x86_elf_link_report_rel - - #define elf_backend_check_relocs \ - _bfd_x86_elf_check_relocs --#define elf_backend_size_dynamic_sections \ -- _bfd_x86_elf_size_dynamic_sections -+#define elf_backend_late_size_sections \ -+ _bfd_x86_elf_late_size_sections - #define elf_backend_merge_symbol_attribute \ - _bfd_x86_elf_merge_symbol_attribute - #define elf_backend_copy_indirect_symbol \ ---- a/ld/emultempl/vms.em -+++ b/ld/emultempl/vms.em -@@ -196,10 +196,9 @@ gld${EMULATION_NAME}_before_allocation ( - - /* The backend must work out the sizes of all the other dynamic - sections. */ -- if (elf_hash_table (&link_info)->dynamic_sections_created -- && bed->elf_backend_size_dynamic_sections -- && ! (*bed->elf_backend_size_dynamic_sections) (link_info.output_bfd, -- &link_info)) -+ if (bed->elf_backend_late_size_sections -+ && !bed->elf_backend_late_size_sections (link_info.output_bfd, -+ &link_info)) - einfo (_("%F%P: failed to set dynamic section sizes: %E\n")); - - before_allocation_default (); diff --git a/toolchain/binutils/patches/2.41/002-PR-30569-delete-_bfd_mips_elf_early_size_sections.patch b/toolchain/binutils/patches/2.41/002-PR-30569-delete-_bfd_mips_elf_early_size_sections.patch deleted file mode 100644 index 6d47db5f2e4..00000000000 --- a/toolchain/binutils/patches/2.41/002-PR-30569-delete-_bfd_mips_elf_early_size_sections.patch +++ /dev/null @@ -1,218 +0,0 @@ -From 3c6c32951e292a51ede70b8087bb0308d7dbc4fc Mon Sep 17 00:00:00 2001 -From: Alan Modra -Date: Thu, 28 Mar 2024 20:33:32 +1030 -Subject: [PATCH 2/2] PR 30569, delete _bfd_mips_elf_early_size_sections - -PR30569 was triggered by a patch of mine 6540edd52cc0 moving the call -to always_size_sections in bfd_elf_size_dynamic_sections earlier, made -to support the x86 DT_RELR implementation. This broke mips16 code -handling stubs when --export-dynamic is passed to the linker, because -numerous symbols then became dynamic after always_size_sections. The -mips backend fiddles with symbols in its always_size_sections. Maciej -in 902e9fc76a0e had moved the call to always_size_sections to after -the export-dynamic code. Prior to that, Nathan in 04c3a75556c0 moved -it before the exec stack code, back to the start of -bfd_elf_size_dynamic_sections which was where Ian put it originally -in ff12f303355b. So the call has moved around a little. I'm leaving -it where it is, and instead calling mips_elf_check_symbols from -late_size_sections (the old size_dynamic_sections) which is now always -called. In fact, the whole of _bfd_mips_elf_early_size_sections can -be merged into _bfd_mips_elf_late_size_sections. ---- - bfd/elf32-mips.c | 1 - - bfd/elf64-mips.c | 2 -- - bfd/elfn32-mips.c | 1 - - bfd/elfxx-mips.c | 84 +++++++++++++++++++---------------------------- - bfd/elfxx-mips.h | 2 -- - 5 files changed, 34 insertions(+), 56 deletions(-) - ---- a/bfd/elf32-mips.c -+++ b/bfd/elf32-mips.c -@@ -2537,7 +2537,6 @@ static const struct ecoff_debug_swap mip - #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag - #define elf_backend_adjust_dynamic_symbol \ - _bfd_mips_elf_adjust_dynamic_symbol --#define elf_backend_early_size_sections _bfd_mips_elf_early_size_sections - #define elf_backend_late_size_sections _bfd_mips_elf_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_relocate_section _bfd_mips_elf_relocate_section ---- a/bfd/elf64-mips.c -+++ b/bfd/elf64-mips.c -@@ -4748,8 +4748,6 @@ const struct elf_size_info mips_elf64_si - #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag - #define elf_backend_adjust_dynamic_symbol \ - _bfd_mips_elf_adjust_dynamic_symbol --#define elf_backend_early_size_sections \ -- _bfd_mips_elf_early_size_sections - #define elf_backend_late_size_sections \ - _bfd_mips_elf_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section ---- a/bfd/elfn32-mips.c -+++ b/bfd/elfn32-mips.c -@@ -4138,7 +4138,6 @@ static const struct ecoff_debug_swap mip - #define elf_backend_get_target_dtag _bfd_mips_elf_get_target_dtag - #define elf_backend_adjust_dynamic_symbol \ - _bfd_mips_elf_adjust_dynamic_symbol --#define elf_backend_early_size_sections _bfd_mips_elf_early_size_sections - #define elf_backend_late_size_sections _bfd_mips_elf_late_size_sections - #define elf_backend_init_index_section _bfd_elf_init_1_index_section - #define elf_backend_relocate_section _bfd_mips_elf_relocate_section ---- a/bfd/elfxx-mips.c -+++ b/bfd/elfxx-mips.c -@@ -9639,48 +9639,6 @@ _bfd_mips_elf_adjust_dynamic_symbol (str - return _bfd_elf_adjust_dynamic_copy (info, h, s); - } - --/* This function is called after all the input files have been read, -- and the input sections have been assigned to output sections. We -- check for any mips16 stub sections that we can discard. */ -- --bool --_bfd_mips_elf_early_size_sections (bfd *output_bfd, -- struct bfd_link_info *info) --{ -- asection *sect; -- struct mips_elf_link_hash_table *htab; -- struct mips_htab_traverse_info hti; -- -- htab = mips_elf_hash_table (info); -- BFD_ASSERT (htab != NULL); -- -- /* The .reginfo section has a fixed size. */ -- sect = bfd_get_section_by_name (output_bfd, ".reginfo"); -- if (sect != NULL) -- { -- bfd_set_section_size (sect, sizeof (Elf32_External_RegInfo)); -- sect->flags |= SEC_FIXED_SIZE | SEC_HAS_CONTENTS; -- } -- -- /* The .MIPS.abiflags section has a fixed size. */ -- sect = bfd_get_section_by_name (output_bfd, ".MIPS.abiflags"); -- if (sect != NULL) -- { -- bfd_set_section_size (sect, sizeof (Elf_External_ABIFlags_v0)); -- sect->flags |= SEC_FIXED_SIZE | SEC_HAS_CONTENTS; -- } -- -- hti.info = info; -- hti.output_bfd = output_bfd; -- hti.error = false; -- mips_elf_link_hash_traverse (mips_elf_hash_table (info), -- mips_elf_check_symbols, &hti); -- if (hti.error) -- return false; -- -- return true; --} -- - /* If the link uses a GOT, lay it out and work out its size. */ - - static bool -@@ -9985,7 +9943,8 @@ mips_elf_set_plt_sym_value (struct mips_ - return true; - } - --/* Set the sizes of the dynamic sections. */ -+/* Set the sizes of the dynamic sections, some mips non-dynamic sections, -+ and check for any mips16 stub sections that we can discard. */ - - bool - _bfd_mips_elf_late_size_sections (bfd *output_bfd, -@@ -9995,14 +9954,39 @@ _bfd_mips_elf_late_size_sections (bfd *o - asection *s, *sreldyn; - bool reltext; - struct mips_elf_link_hash_table *htab; -+ struct mips_htab_traverse_info hti; - - htab = mips_elf_hash_table (info); - BFD_ASSERT (htab != NULL); -- dynobj = elf_hash_table (info)->dynobj; -+ -+ /* The .reginfo section has a fixed size. */ -+ s = bfd_get_section_by_name (output_bfd, ".reginfo"); -+ if (s != NULL) -+ { -+ bfd_set_section_size (s, sizeof (Elf32_External_RegInfo)); -+ s->flags |= SEC_FIXED_SIZE | SEC_HAS_CONTENTS; -+ } -+ -+ /* The .MIPS.abiflags section has a fixed size. */ -+ s = bfd_get_section_by_name (output_bfd, ".MIPS.abiflags"); -+ if (s != NULL) -+ { -+ bfd_set_section_size (s, sizeof (Elf_External_ABIFlags_v0)); -+ s->flags |= SEC_FIXED_SIZE | SEC_HAS_CONTENTS; -+ } -+ -+ hti.info = info; -+ hti.output_bfd = output_bfd; -+ hti.error = false; -+ mips_elf_link_hash_traverse (htab, mips_elf_check_symbols, &hti); -+ if (hti.error) -+ return false; -+ -+ dynobj = htab->root.dynobj; - if (dynobj == NULL) - return true; - -- if (elf_hash_table (info)->dynamic_sections_created) -+ if (htab->root.dynamic_sections_created) - { - /* Set the contents of the .interp section to the interpreter. */ - if (bfd_link_executable (info) && !info->nointerp) -@@ -10142,7 +10126,7 @@ _bfd_mips_elf_late_size_sections (bfd *o - } - } - else if (bfd_link_executable (info) -- && ! mips_elf_hash_table (info)->use_rld_obj_head -+ && !htab->use_rld_obj_head - && startswith (name, ".rld_map")) - { - /* We add a room for __rld_map. It will be filled in by the -@@ -10151,7 +10135,7 @@ _bfd_mips_elf_late_size_sections (bfd *o - } - else if (SGI_COMPAT (output_bfd) - && startswith (name, ".compact_rel")) -- s->size += mips_elf_hash_table (info)->compact_rel_size; -+ s->size += htab->compact_rel_size; - else if (s == htab->root.splt) - { - /* If the last PLT entry has a branch delay slot, allocate -@@ -10191,7 +10175,7 @@ _bfd_mips_elf_late_size_sections (bfd *o - } - } - -- if (elf_hash_table (info)->dynamic_sections_created) -+ if (htab->root.dynamic_sections_created) - { - /* Add some entries to the .dynamic section. We fill in the - values later, in _bfd_mips_elf_finish_dynamic_sections, but we -@@ -14934,7 +14918,7 @@ _bfd_mips_elf_final_link (bfd *abfd, str - input_section->flags &= ~SEC_HAS_CONTENTS; - } - -- /* Size has been set in _bfd_mips_elf_early_size_sections. */ -+ /* Size has been set in _bfd_mips_elf_late_size_sections. */ - BFD_ASSERT(o->size == sizeof (Elf_External_ABIFlags_v0)); - - /* Skip this section later on (I don't think this currently -@@ -14993,7 +14977,7 @@ _bfd_mips_elf_final_link (bfd *abfd, str - input_section->flags &= ~SEC_HAS_CONTENTS; - } - -- /* Size has been set in _bfd_mips_elf_early_size_sections. */ -+ /* Size has been set in _bfd_mips_elf_late_size_sections. */ - BFD_ASSERT(o->size == sizeof (Elf32_External_RegInfo)); - - /* Skip this section later on (I don't think this currently ---- a/bfd/elfxx-mips.h -+++ b/bfd/elfxx-mips.h -@@ -67,8 +67,6 @@ extern bool _bfd_mips_elf_check_relocs - (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); - extern bool _bfd_mips_elf_adjust_dynamic_symbol - (struct bfd_link_info *, struct elf_link_hash_entry *); --extern bool _bfd_mips_elf_early_size_sections -- (bfd *, struct bfd_link_info *); - extern bool _bfd_mips_elf_late_size_sections - (bfd *, struct bfd_link_info *); - extern int _bfd_mips_elf_relocate_section diff --git a/toolchain/binutils/patches/2.41/300-001_ld_makefile_patch.patch b/toolchain/binutils/patches/2.41/300-001_ld_makefile_patch.patch deleted file mode 100644 index 2dafd92a01d..00000000000 --- a/toolchain/binutils/patches/2.41/300-001_ld_makefile_patch.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/ld/Makefile.am -+++ b/ld/Makefile.am -@@ -50,7 +50,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR - # directives need to be different for native and cross linkers. --scriptdir = $(tooldir)/lib -+scriptdir = $(libdir) - - EMUL = @EMUL@ - EMULATION_OFILES = @EMULATION_OFILES@ ---- a/ld/Makefile.in -+++ b/ld/Makefile.in -@@ -573,7 +573,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) - # We put the scripts in the directory $(scriptdir)/ldscripts. - # We can't put the scripts in $(datadir) because the SEARCH_DIR - # directives need to be different for native and cross linkers. --scriptdir = $(tooldir)/lib -+scriptdir = $(libdir) - BASEDIR = $(srcdir)/.. - BFDDIR = $(BASEDIR)/bfd - INCDIR = $(BASEDIR)/include diff --git a/toolchain/binutils/patches/2.41/400-mips_no_dynamic_linking_sym.patch b/toolchain/binutils/patches/2.41/400-mips_no_dynamic_linking_sym.patch deleted file mode 100644 index c50a988da46..00000000000 --- a/toolchain/binutils/patches/2.41/400-mips_no_dynamic_linking_sym.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/bfd/elfxx-mips.c -+++ b/bfd/elfxx-mips.c -@@ -8144,6 +8144,7 @@ _bfd_mips_elf_create_dynamic_sections (b - - name = SGI_COMPAT (abfd) ? "_DYNAMIC_LINK" : "_DYNAMIC_LINKING"; - bh = NULL; -+ if (0) { - if (!(_bfd_generic_link_add_one_symbol - (info, abfd, name, BSF_GLOBAL, bfd_abs_section_ptr, 0, - NULL, false, get_elf_backend_data (abfd)->collect, &bh))) -@@ -8156,6 +8157,7 @@ _bfd_mips_elf_create_dynamic_sections (b - - if (! bfd_elf_link_record_dynamic_symbol (info, h)) - return false; -+ } - - if (! mips_elf_hash_table (info)->use_rld_obj_head) - { diff --git a/toolchain/binutils/patches/2.41/500-Change-default-emulation-for-mips64-linux.patch b/toolchain/binutils/patches/2.41/500-Change-default-emulation-for-mips64-linux.patch deleted file mode 100644 index 60676bbe549..00000000000 --- a/toolchain/binutils/patches/2.41/500-Change-default-emulation-for-mips64-linux.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- a/bfd/config.bfd -+++ b/bfd/config.bfd -@@ -947,8 +947,8 @@ case "${targ}" in - want64=true - ;; - mips64*el-*-linux*) -- targ_defvec=mips_elf32_ntrad_le_vec -- targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_le_vec mips_elf64_trad_be_vec" -+ targ_defvec=mips_elf64_trad_le_vec -+ targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_be_vec" - ;; - mips64*-*-linux*-gnuabi64) - targ_defvec=mips_elf64_trad_be_vec -@@ -956,8 +956,8 @@ case "${targ}" in - want64=true - ;; - mips64*-*-linux*) -- targ_defvec=mips_elf32_ntrad_be_vec -- targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec" -+ targ_defvec=mips_elf64_trad_be_vec -+ targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_le_vec" - ;; - mips*el-*-linux*) - targ_defvec=mips_elf32_trad_le_vec ---- a/ld/configure.tgt -+++ b/ld/configure.tgt -@@ -585,8 +585,8 @@ mips64*el-*-linux-gnuabi64) - targ_extra_emuls="elf64btsmip elf32ltsmipn32 elf32btsmipn32 elf32ltsmip elf32btsmip" - targ_extra_libpath=$targ_extra_emuls - ;; --mips64*el-*-linux-*) targ_emul=elf32ltsmipn32 -- targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip" -+mips64*el-*-linux-*) targ_emul=elf64ltsmip -+ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32ltsmip elf32btsmip elf64btsmip" - targ_extra_libpath=$targ_extra_emuls - ;; - mips64*-*-linux-gnuabi64) -@@ -594,8 +594,8 @@ mips64*-*-linux-gnuabi64) - targ_extra_emuls="elf64ltsmip elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip" - targ_extra_libpath=$targ_extra_emuls - ;; --mips64*-*-linux-*) targ_emul=elf32btsmipn32 -- targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip" -+mips64*-*-linux-*) targ_emul=elf64btsmip -+ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip elf64ltsmip" - targ_extra_libpath=$targ_extra_emuls - ;; - mips*el-*-linux-*) targ_emul=elf32ltsmip diff --git a/toolchain/gdb/Makefile b/toolchain/gdb/Makefile index ecb31398e6e..9b9ee5a9d8d 100644 --- a/toolchain/gdb/Makefile +++ b/toolchain/gdb/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gdb -PKG_VERSION:=14.1 +PKG_VERSION:=15.2 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/gdb -PKG_HASH:=d66df51276143451fcbff464cc8723d68f1e9df45a6a2d5635a54e71643edb80 +PKG_HASH:=83350ccd35b5b5a0cba6b334c41294ea968158c573940904f00b92f76345314d PKG_CPE_ID:=cpe:/a:gnu:gdb GDB_DIR:=$(PKG_NAME)-$(PKG_VERSION) diff --git a/toolchain/gdb/patches/120-fix-compile-flag-mismatch.patch b/toolchain/gdb/patches/120-fix-compile-flag-mismatch.patch index 94305092788..f9c56700940 100644 --- a/toolchain/gdb/patches/120-fix-compile-flag-mismatch.patch +++ b/toolchain/gdb/patches/120-fix-compile-flag-mismatch.patch @@ -1,6 +1,6 @@ --- a/gdbserver/configure +++ b/gdbserver/configure -@@ -2674,7 +2674,7 @@ $as_echo "$as_me: error: \`$ac_var' was +@@ -2698,7 +2698,7 @@ $as_echo "$as_me: error: \`$ac_var' was ac_cache_corrupted=: ;; ,);; *) diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile index ed6e04fc893..152d295cb3d 100644 --- a/tools/cmake/Makefile +++ b/tools/cmake/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=cmake -PKG_VERSION:=3.30.3 +PKG_VERSION:=3.30.5 PKG_VERSION_MAJOR:=$(word 1,$(subst ., ,$(PKG_VERSION))).$(word 2,$(subst ., ,$(PKG_VERSION))) PKG_RELEASE:=1 PKG_CPE_ID:=cpe:/a:kitware:cmake @@ -15,7 +15,7 @@ PKG_CPE_ID:=cpe:/a:kitware:cmake PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/Kitware/CMake/releases/download/v$(PKG_VERSION)/ \ https://cmake.org/files/v$(PKG_VERSION_MAJOR)/ -PKG_HASH:=6d5de15b6715091df7f5441007425264bdd477809f80333fdf95f846aaff88e4 +PKG_HASH:=9f55e1a40508f2f29b7e065fa08c29f82c402fa0402da839fffe64a25755a86d HOST_BUILD_PARALLEL:=1 HOST_CONFIGURE_PARALLEL:=1 diff --git a/tools/libdeflate/Makefile b/tools/libdeflate/Makefile index 6bf25d134d0..8f7946d90ed 100644 --- a/tools/libdeflate/Makefile +++ b/tools/libdeflate/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libdeflate -PKG_VERSION:=1.20 -PKG_RELEASE:=2 +PKG_VERSION:=1.22 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/ebiggers/libdeflate/releases/download/v$(PKG_VERSION) -PKG_HASH:=c52cf0239fd644d71c9e88613dd7431a5306ebee1280c5791c71ca264869250a +PKG_HASH:=7834d9adbc9a809e0fb0d7b486060a9ae5f7819eb7f55bb8c22b10d7b3bed8da include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/libdeflate/patches/0001-lib-x86-increase-AVX-VNNI-gcc-prerequisite-to-12.1.patch b/tools/libdeflate/patches/0001-lib-x86-increase-AVX-VNNI-gcc-prerequisite-to-12.1.patch deleted file mode 100644 index ea4f4dc4c13..00000000000 --- a/tools/libdeflate/patches/0001-lib-x86-increase-AVX-VNNI-gcc-prerequisite-to-12.1.patch +++ /dev/null @@ -1,32 +0,0 @@ -From e522b1d09d3536ddc15459b4259150f4a53ee65a Mon Sep 17 00:00:00 2001 -From: Eric Biggers -Date: Thu, 4 Apr 2024 20:16:33 -0400 -Subject: [PATCH] lib/x86: increase AVX-VNNI gcc prerequisite to 12.1 - -Although gcc 11.1 supports AVX-VNNI, a popular distro pairs it with a -binutils version that does not. Require gcc 12 instead. - -Resolves https://github.com/ebiggers/libdeflate/issues/365 ---- - lib/x86/adler32_impl.h | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - ---- a/lib/x86/adler32_impl.h -+++ b/lib/x86/adler32_impl.h -@@ -52,8 +52,15 @@ - /* - * AVX-VNNI implementation. This is used on CPUs that have AVX2 and AVX-VNNI - * but don't have AVX-512, for example Intel Alder Lake. -+ * -+ * Unusually for a new CPU feature, gcc added support for the AVX-VNNI -+ * intrinsics (in gcc 11.1) slightly before binutils added support for -+ * assembling AVX-VNNI instructions (in binutils 2.36). Distros can reasonably -+ * have gcc 11 with binutils 2.35. Because of this issue, we check for gcc 12 -+ * instead of gcc 11. (libdeflate supports direct compilation without a -+ * configure step, so checking the binutils version is not always an option.) - */ --#if GCC_PREREQ(11, 1) || CLANG_PREREQ(12, 0, 13000000) || MSVC_PREREQ(1930) -+#if GCC_PREREQ(12, 1) || CLANG_PREREQ(12, 0, 13000000) || MSVC_PREREQ(1930) - # define adler32_x86_avx2_vnni adler32_x86_avx2_vnni - # define SUFFIX _avx2_vnni - # define ATTRIBUTES _target_attribute("avx2,avxvnni") diff --git a/tools/mtd-utils/Makefile b/tools/mtd-utils/Makefile index 3bcfabc3ad5..cf7081fb5a9 100644 --- a/tools/mtd-utils/Makefile +++ b/tools/mtd-utils/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mtd-utils -PKG_VERSION:=2.2.0 -PKG_RELEASE:=2 +PKG_VERSION:=2.2.1 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://infraroot.at/pub/mtd/ -PKG_HASH:=250d082f67375ca8451b5fcfc9a23a53ced3ebebd8312c288daf2507bbab1324 +PKG_HASH:=f7ae20b2eb79ee83441468f0b99d897024cd96ff853eea59106fb1952065c803 PKG_CPE_ID:=cpe:/a:mtd-utils_project:mtd-utils PKG_FIXUP:=autoreconf diff --git a/tools/mtd-utils/patches/110-portability.patch b/tools/mtd-utils/patches/110-portability.patch index 7e17f807365..cf5f0c8d8e5 100644 --- a/tools/mtd-utils/patches/110-portability.patch +++ b/tools/mtd-utils/patches/110-portability.patch @@ -18,8 +18,8 @@ #include #include "common.h" #include "compr.h" ---- a/jffsX-utils/rbtree.h -+++ b/jffsX-utils/rbtree.h +--- a/include/rbtree.h ++++ b/include/rbtree.h @@ -94,8 +94,7 @@ static inline struct page * rb_insert_pa #ifndef _LINUX_RBTREE_H #define _LINUX_RBTREE_H @@ -70,7 +70,7 @@ #include --- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c +++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c -@@ -1554,6 +1554,7 @@ static int add_inode(struct stat *st, in +@@ -1568,6 +1568,7 @@ static int add_inode(struct stat *st, in if (c->default_compr != UBIFS_COMPR_NONE) use_flags |= UBIFS_COMPR_FL; @@ -78,7 +78,7 @@ if (flags & FS_COMPR_FL) use_flags |= UBIFS_COMPR_FL; if (flags & FS_SYNC_FL) -@@ -1566,6 +1567,7 @@ static int add_inode(struct stat *st, in +@@ -1580,6 +1581,7 @@ static int add_inode(struct stat *st, in use_flags |= UBIFS_DIRSYNC_FL; if (fctx) use_flags |= UBIFS_CRYPT_FL; @@ -86,7 +86,7 @@ memset(ino, 0, UBIFS_INO_NODE_SZ); ino_key_init(&key, inum); -@@ -1651,7 +1653,9 @@ static int add_dir_inode(const char *pat +@@ -1665,7 +1667,9 @@ static int add_dir_inode(const char *pat fd = dirfd(dir); if (fd == -1) return sys_err_msg("dirfd failed"); @@ -96,7 +96,7 @@ flags = 0; } -@@ -1862,6 +1866,7 @@ static int add_file(const char *path_nam +@@ -1878,6 +1882,7 @@ static int add_file(const char *path_nam dn->ch.node_type = UBIFS_DATA_NODE; key_write(&key, &dn->key); out_len = NODE_BUFFER_SIZE - UBIFS_DATA_NODE_SZ; @@ -104,7 +104,7 @@ if (c->default_compr == UBIFS_COMPR_NONE && !c->encrypted && (flags & FS_COMPR_FL)) #ifdef WITH_LZO -@@ -1872,6 +1877,7 @@ static int add_file(const char *path_nam +@@ -1888,6 +1893,7 @@ static int add_file(const char *path_nam use_compr = UBIFS_COMPR_NONE; #endif else @@ -112,7 +112,7 @@ use_compr = c->default_compr; compr_type = compress_data(buf, bytes_read, &dn->data, &out_len, use_compr); -@@ -1931,7 +1937,9 @@ static int add_non_dir(const char *path_ +@@ -1947,7 +1953,9 @@ static int add_non_dir(const char *path_ if (fd == -1) return sys_err_msg("failed to open file '%s'", path_name); diff --git a/tools/mtd-utils/patches/130-lzma_jffs2.patch b/tools/mtd-utils/patches/130-lzma_jffs2.patch index 32b7d6c7256..b03265a3804 100644 --- a/tools/mtd-utils/patches/130-lzma_jffs2.patch +++ b/tools/mtd-utils/patches/130-lzma_jffs2.patch @@ -1,9 +1,9 @@ --- a/jffsX-utils/Makemodule.am +++ b/jffsX-utils/Makemodule.am -@@ -10,8 +10,9 @@ mkfs_jffs2_SOURCES = \ - jffsX-utils/summary.h \ - include/linux/jffs2.h \ - include/mtd/jffs2-user.h +@@ -9,8 +9,9 @@ mkfs_jffs2_SOURCES = \ + include/mtd/jffs2-user.h \ + include/list.h \ + include/rbtree.h + mkfs_jffs2_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS) -mkfs_jffs2_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS) @@ -11,7 +11,7 @@ jffs2reader_SOURCES = jffsX-utils/jffs2reader.c include/mtd/jffs2-user.h jffs2reader_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS) -@@ -33,6 +34,14 @@ if WITH_ZLIB +@@ -32,6 +33,14 @@ if WITH_ZLIB mkfs_jffs2_SOURCES += jffsX-utils/compr_zlib.c endif @@ -28,7 +28,7 @@ dist_man1_MANS += jffsX-utils/mkfs.jffs2.1 --- a/jffsX-utils/compr.c +++ b/jffsX-utils/compr.c -@@ -520,6 +520,9 @@ int jffs2_compressors_init(void) +@@ -471,6 +471,9 @@ int jffs2_compressors_init(void) #ifdef WITH_LZO jffs2_lzo_init(); #endif @@ -38,7 +38,7 @@ return 0; } -@@ -534,5 +537,8 @@ int jffs2_compressors_exit(void) +@@ -485,5 +488,8 @@ int jffs2_compressors_exit(void) #ifdef WITH_LZO jffs2_lzo_exit(); #endif @@ -49,7 +49,7 @@ } --- a/jffsX-utils/compr.h +++ b/jffsX-utils/compr.h -@@ -21,8 +21,9 @@ +@@ -22,8 +22,9 @@ #define JFFS2_RUBINMIPS_PRIORITY 10 #define JFFS2_DYNRUBIN_PRIORITY 20 #define JFFS2_RTIME_PRIORITY 50 @@ -61,7 +61,7 @@ #define JFFS2_COMPR_MODE_NONE 0 #define JFFS2_COMPR_MODE_PRIORITY 1 -@@ -113,5 +114,10 @@ void jffs2_rtime_exit(void); +@@ -110,5 +111,10 @@ void jffs2_rtime_exit(void); int jffs2_lzo_init(void); void jffs2_lzo_exit(void); #endif @@ -5055,7 +5055,7 @@ AC_ARG_WITH([selinux], [AS_HELP_STRING([--with-selinux], [Support for selinux extended attributes])], -@@ -268,6 +272,7 @@ fi +@@ -269,6 +273,7 @@ fi AM_CONDITIONAL([WITH_LZO], [test "x$with_lzo" = "xyes"]) AM_CONDITIONAL([WITH_ZLIB], [test "x$with_zlib" = "xyes"]) AM_CONDITIONAL([WITH_ZSTD], [test "x$with_zstd" = "xyes"]) @@ -5063,7 +5063,7 @@ AM_CONDITIONAL([WITH_XATTR], [test "x$with_xattr" = "xyes"]) AM_CONDITIONAL([WITH_SELINUX], [test "x$with_selinux" = "xyes"]) AM_CONDITIONAL([WITH_CRYPTO], [test "x$with_crypto" = "xyes"]) -@@ -312,6 +317,7 @@ AC_MSG_RESULT([ +@@ -313,6 +318,7 @@ AC_MSG_RESULT([ lzo support: ${with_lzo} zlib support: ${with_zlib} zstd support: ${with_zstd} diff --git a/tools/ninja/Makefile b/tools/ninja/Makefile index 4763e759d8a..d79f3c5d5df 100644 --- a/tools/ninja/Makefile +++ b/tools/ninja/Makefile @@ -1,38 +1,35 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ninja -PKG_VERSION:=1.11.1 +PKG_VERSION:=1.12.1 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/ninja-build/ninja/tar.gz/v$(PKG_VERSION)? -PKG_HASH:=31747ae633213f1eda3842686f83c2aa1412e0f5691d1c14dbbcc67fe7400cea +PKG_HASH:=821bdff48a3f683bc4bb3b6f0b5fe7b2d647cf65d52aeb63328c91a6c6df285a include $(INCLUDE_DIR)/host-build.mk -CONFIGURE_ARGS:= -ifneq ($(findstring c,$(OPENWRT_VERBOSE)),) - CONFIGURE_ARGS+=--verbose -endif - define Host/Configure + cd $(HOST_BUILD_DIR) && \ + $(HOST_MAKE_VARS) \ + CXX="$(HOSTCXX_NOCACHE)" \ + $(STAGING_DIR_HOST)/bin/$(PYTHON) configure.py \ + $(if $(shell $(STAGING_DIR_HOST)/bin/ninja --version),,--bootstrap) \ + --no-rebuild \ + --verbose + -$(Host/Install) endef define Host/Compile - cd $(HOST_BUILD_DIR) && \ - CXX="$(HOSTCXX_NOCACHE)" \ - CXXFLAGS="$(HOST_CXXFLAGS) $(HOST_CPPFLAGS)" \ - LDFLAGS="$(HOST_LDFLAGS)" \ - $(STAGING_DIR_HOST)/bin/$(PYTHON) configure.py --bootstrap $(CONFIGURE_ARGS) + +$(NINJA) -C $(HOST_BUILD_DIR) endef define Host/Install - $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin $(INSTALL_BIN) $(HOST_BUILD_DIR)/ninja $(STAGING_DIR_HOST)/bin/ endef define Host/Clean - $(call Host/Clean/Default) rm -f $(STAGING_DIR_HOST)/bin/ninja endef diff --git a/tools/ninja/patches/001-backport-gtest.patch b/tools/ninja/patches/001-backport-gtest.patch new file mode 100644 index 00000000000..1440f29ef06 --- /dev/null +++ b/tools/ninja/patches/001-backport-gtest.patch @@ -0,0 +1,153 @@ +From afcd4a146fb82843f6ff695f89504ce4ca65ddfd Mon Sep 17 00:00:00 2001 +From: David 'Digit' Turner +Date: Sun, 12 May 2024 23:45:28 +0200 +Subject: [PATCH] configure.py: Support --gtest-source-dir to build tests. + +Allow the Ninja build plan generated by configure.py to +build `ninja_test` by compiling GoogleTest from source if +the path to the library if passed through the new option +`--gtest-source-dir` or the GTEST_SOURCE_DIR environment +variable. + +For simplicity, probing for an installed version of the +library, and linking to it, is not supported (use the +CMake build for this). + +This also removes the obsolete `--gtest-dir` option. + ++ Update README.md + +Fixes #2447 +--- + README.md | 13 ++++++++ + configure.py | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++- + 2 files changed, 95 insertions(+), 1 deletion(-) + +--- a/README.md ++++ b/README.md +@@ -34,6 +34,19 @@ via CMake. For more details see + This will generate the `ninja` binary and a `build.ninja` file you can now use + to build Ninja with itself. + ++If you have a GoogleTest source directory, you can build the tests ++by passing its path with `--gtest-source-dir=PATH` option, or the ++`GTEST_SOURCE_DIR` environment variable, e.g.: ++ ++``` ++./configure.py --bootstrap --gtest-source-dir=/path/to/googletest ++./ninja all # build ninja_test and other auxiliary binaries ++./ninja_test` # run the unit-test suite. ++``` ++ ++Use the CMake build below if you want to use a preinstalled binary ++version of the library. ++ + ### CMake + + ``` +--- a/configure.py ++++ b/configure.py +@@ -213,7 +213,10 @@ parser.add_option('--debug', action='sto + parser.add_option('--profile', metavar='TYPE', + choices=profilers, + help='enable profiling (' + '/'.join(profilers) + ')',) +-parser.add_option('--with-gtest', metavar='PATH', help='ignored') ++parser.add_option('--gtest-source-dir', metavar='PATH', ++ help='Path to GoogleTest source directory. If not provided ' + ++ 'GTEST_SOURCE_DIR will be probed in the environment. ' + ++ 'Tests will not be built without a value.') + parser.add_option('--with-python', metavar='EXE', + help='use EXE as the Python interpreter', + default=os.path.basename(sys.executable)) +@@ -425,6 +428,7 @@ n.variable('cflags', ' '.join(shell_esca + if 'LDFLAGS' in configure_env: + ldflags.append(configure_env['LDFLAGS']) + n.variable('ldflags', ' '.join(shell_escape(flag) for flag in ldflags)) ++ + n.newline() + + if platform.is_msvc(): +@@ -582,6 +586,83 @@ if options.bootstrap: + # build.ninja file. + n = ninja_writer + ++# Build the ninja_test executable only if the GTest source directory ++# is provided explicitly. Either from the environment with GTEST_SOURCE_DIR ++# or with the --gtest-source-dir command-line option. ++# ++# Do not try to look for an installed binary version, and link against it ++# because doing so properly is platform-specific (use the CMake build for ++# this). ++if options.gtest_source_dir: ++ gtest_src_dir = options.gtest_source_dir ++else: ++ gtest_src_dir = os.environ.get('GTEST_SOURCE_DIR') ++ ++if gtest_src_dir: ++ # Verify GoogleTest source directory, and add its include directory ++ # to the global include search path (even for non-test sources) to ++ # keep the build plan generation simple. ++ gtest_all_cc = os.path.join(gtest_src_dir, 'googletest', 'src', 'gtest-all.cc') ++ if not os.path.exists(gtest_all_cc): ++ print('ERROR: Missing GoogleTest source file: %s' % gtest_all_cc) ++ sys.exit(1) ++ ++ n.comment('Tests all build into ninja_test executable.') ++ ++ # Test-specific version of cflags, must include the GoogleTest ++ # include directory. Also GoogleTest can only build with a C++14 compiler. ++ test_cflags = [f.replace('std=c++11', 'std=c++14') for f in cflags] ++ test_cflags.append('-I' + os.path.join(gtest_src_dir, 'googletest', 'include')) ++ ++ test_variables = [('cflags', test_cflags)] ++ if platform.is_msvc(): ++ test_variables += [('pdb', 'ninja_test.pdb')] ++ ++ test_names = [ ++ 'build_log_test', ++ 'build_test', ++ 'clean_test', ++ 'clparser_test', ++ 'depfile_parser_test', ++ 'deps_log_test', ++ 'disk_interface_test', ++ 'dyndep_parser_test', ++ 'edit_distance_test', ++ 'graph_test', ++ 'json_test', ++ 'lexer_test', ++ 'manifest_parser_test', ++ 'ninja_test', ++ 'state_test', ++ 'string_piece_util_test', ++ 'subprocess_test', ++ 'test', ++ 'util_test', ++ ] ++ if platform.is_windows(): ++ test_names += [ ++ 'includes_normalize_test', ++ 'msvc_helper_test', ++ ] ++ ++ objs = [] ++ for name in test_names: ++ objs += cxx(name, variables=test_variables) ++ ++ # Build GTest as a monolithic source file. ++ # This requires one extra include search path, so replace the ++ # value of 'cflags' in our list. ++ gtest_all_variables = test_variables[1:] + [ ++ ('cflags', test_cflags + ['-I' + os.path.join(gtest_src_dir, 'googletest') ]), ++ ] ++ # Do not use cxx() directly to ensure the object file is under $builddir. ++ objs += n.build(built('gtest_all' + objext), 'cxx', gtest_all_cc, variables=gtest_all_variables) ++ ++ ninja_test = n.build(binary('ninja_test'), 'link', objs, implicit=ninja_lib, ++ variables=[('libs', libs)]) ++ n.newline() ++ all_targets += ninja_test ++ + n.comment('Ancillary executables.') + + if platform.is_aix() and '-maix64' not in ldflags: diff --git a/tools/ninja/patches/010-bootstrap-configure-only.patch b/tools/ninja/patches/010-bootstrap-configure-only.patch new file mode 100644 index 00000000000..4785ac654eb --- /dev/null +++ b/tools/ninja/patches/010-bootstrap-configure-only.patch @@ -0,0 +1,24 @@ +--- a/configure.py ++++ b/configure.py +@@ -198,6 +198,8 @@ parser = OptionParser() + profilers = ['gmon', 'pprof'] + parser.add_option('--bootstrap', action='store_true', + help='bootstrap a ninja binary from nothing') ++parser.add_option('--no-rebuild', action='store_true', ++ help='let user execute ninja after build.ninja generation') + parser.add_option('--verbose', action='store_true', + help='enable verbose build') + parser.add_option('--platform', +@@ -756,7 +758,11 @@ n.build('all', 'phony', all_targets) + n.close() + print('wrote %s.' % BUILD_FILENAME) + +-if options.bootstrap: ++if options.bootstrap and options.no_rebuild: ++ print('bootstrap complete. execute ninja in this directory...') ++ print(os.getcwd()) ++ ++elif options.bootstrap: + print('bootstrap complete. rebuilding...') + + rebuild_args = [] diff --git a/tools/ninja/patches/100-make_jobserver_support.patch b/tools/ninja/patches/100-make_jobserver_support.patch index 34d2b6c4317..82ecf0222ef 100644 --- a/tools/ninja/patches/100-make_jobserver_support.patch +++ b/tools/ninja/patches/100-make_jobserver_support.patch @@ -18,22 +18,9 @@ Documentation for GNU make jobserver http://make.mad-scientist.net/papers/jobserver-implementation/ -Fixes https://github.com/ninja-build/ninja/issues/1139 ---- - configure.py | 2 + - src/build.cc | 63 ++++++++---- - src/build.h | 3 + - src/tokenpool-gnu-make.cc | 211 ++++++++++++++++++++++++++++++++++++++ - src/tokenpool-none.cc | 27 +++++ - src/tokenpool.h | 26 +++++ - 6 files changed, 310 insertions(+), 22 deletions(-) - create mode 100644 src/tokenpool-gnu-make.cc - create mode 100644 src/tokenpool-none.cc - create mode 100644 src/tokenpool.h - --- a/configure.py +++ b/configure.py -@@ -517,11 +517,13 @@ for name in ['build', +@@ -543,11 +543,13 @@ for name in ['build', 'state', 'status', 'string_piece_util', @@ -47,7 +34,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 'includes_normalize-win32', 'msvc_helper-win32', 'msvc_helper_main-win32']: -@@ -530,7 +532,9 @@ if platform.is_windows(): +@@ -556,7 +558,9 @@ if platform.is_windows(): objs += cxx('minidump-win32', variables=cxxvariables) objs += cc('getopt') else: @@ -58,17 +45,17 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 if platform.is_aix(): objs += cc('getopt') if platform.is_msvc(): -@@ -588,6 +592,7 @@ for name in ['build_log_test', - 'string_piece_util_test', - 'subprocess_test', - 'test', -+ 'tokenpool_test', - 'util_test']: - objs += cxx(name, variables=cxxvariables) - if platform.is_windows(): +@@ -639,6 +643,7 @@ if gtest_src_dir: + 'string_piece_util_test', + 'subprocess_test', + 'test', ++ 'tokenpool_test', + 'util_test', + ] + if platform.is_windows(): --- a/src/build.cc +++ b/src/build.cc -@@ -35,6 +35,7 @@ +@@ -39,6 +39,7 @@ #include "state.h" #include "status.h" #include "subprocess.h" @@ -76,10 +63,12 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 #include "util.h" using namespace std; -@@ -47,8 +48,9 @@ struct DryRunCommandRunner : public Comm +@@ -50,24 +51,29 @@ struct DryRunCommandRunner : public Comm + virtual ~DryRunCommandRunner() {} // Overridden from CommandRunner: - virtual bool CanRunMore() const; +- virtual size_t CanRunMore() const; ++ virtual size_t CanRunMore(); + virtual bool AcquireToken(); virtual bool StartCommand(Edge* edge); - virtual bool WaitForCommand(Result* result); @@ -87,8 +76,11 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 private: queue finished_; -@@ -58,12 +60,16 @@ bool DryRunCommandRunner::CanRunMore() c - return true; + }; + +-size_t DryRunCommandRunner::CanRunMore() const { ++size_t DryRunCommandRunner::CanRunMore() { + return SIZE_MAX; } +bool DryRunCommandRunner::AcquireToken() { @@ -105,24 +97,25 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 if (finished_.empty()) return false; -@@ -149,7 +155,7 @@ void Plan::EdgeWanted(const Edge* edge) +@@ -160,7 +166,7 @@ void Plan::EdgeWanted(const Edge* edge) } Edge* Plan::FindWork() { - if (ready_.empty()) + if (!more_ready()) return NULL; - EdgeSet::iterator e = ready_.begin(); - Edge* edge = *e; -@@ -448,19 +454,39 @@ void Plan::Dump() const { + + Edge* work = ready_.top(); +@@ -595,19 +601,39 @@ void Plan::Dump() const { } struct RealCommandRunner : public CommandRunner { - explicit RealCommandRunner(const BuildConfig& config) : config_(config) {} - virtual ~RealCommandRunner() {} +- virtual size_t CanRunMore() const; + explicit RealCommandRunner(const BuildConfig& config); + virtual ~RealCommandRunner(); - virtual bool CanRunMore() const; ++ virtual size_t CanRunMore(); + virtual bool AcquireToken(); virtual bool StartCommand(Edge* edge); - virtual bool WaitForCommand(Result* result); @@ -157,7 +150,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 vector RealCommandRunner::GetActiveEdges() { vector edges; for (map::iterator e = subproc_to_edge_.begin(); -@@ -471,14 +497,23 @@ vector RealCommandRunner::GetActi +@@ -618,9 +644,11 @@ vector RealCommandRunner::GetActi void RealCommandRunner::Abort() { subprocs_.Clear(); @@ -165,28 +158,35 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 + tokens_->Clear(); } - bool RealCommandRunner::CanRunMore() const { -- size_t subproc_number = -- subprocs_.running_.size() + subprocs_.finished_.size(); -- return (int)subproc_number < config_.parallelism -- && ((subprocs_.running_.empty() || config_.max_load_average <= 0.0f) -- || GetLoadAverage() < config_.max_load_average); -+ bool parallelism_limit_not_reached = -+ tokens_ || // ignore config_.parallelism -+ ((int) (subprocs_.running_.size() + -+ subprocs_.finished_.size()) < config_.parallelism); -+ return parallelism_limit_not_reached -+ && (subprocs_.running_.empty() || -+ (max_load_average_ <= 0.0f || -+ GetLoadAverage() < max_load_average_)); -+} +-size_t RealCommandRunner::CanRunMore() const { ++size_t RealCommandRunner::CanRunMore() { + size_t subproc_number = + subprocs_.running_.size() + subprocs_.finished_.size(); + +@@ -635,6 +663,13 @@ size_t RealCommandRunner::CanRunMore() c + if (capacity < 0) + capacity = 0; + ++ if (tokens_) { ++ if (AcquireToken()) ++ return SIZE_MAX; ++ else ++ capacity = 0; ++ } + -+bool RealCommandRunner::AcquireToken() { -+ return (!tokens_ || tokens_->Acquire()); + if (capacity == 0 && subprocs_.running_.empty()) + // Ensure that we make progress. + capacity = 1; +@@ -642,24 +677,42 @@ size_t RealCommandRunner::CanRunMore() c + return capacity; } ++bool RealCommandRunner::AcquireToken() { ++ return (!tokens_ || tokens_->Acquire()); ++} ++ bool RealCommandRunner::StartCommand(Edge* edge) { -@@ -486,19 +521,33 @@ bool RealCommandRunner::StartCommand(Edg + string command = edge->EvaluateCommand(); Subprocess* subproc = subprocs_.Add(command, edge->use_console()); if (!subproc) return false; @@ -223,61 +223,17 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 result->status = subproc->Finish(); result->output = subproc->GetOutput(); -@@ -620,38 +669,43 @@ bool Builder::Build(string* err) { - // command runner. +@@ -790,7 +843,8 @@ bool Builder::Build(string* err) { // Second, we attempt to wait for / reap the next finished command. while (plan_.more_to_do()) { -- // See if we can start any more commands. -- if (failures_allowed && command_runner_->CanRunMore()) { -- if (Edge* edge = plan_.FindWork()) { -- if (edge->GetBindingBool("generator")) { -+ // See if we can start any more commands... -+ bool can_run_more = -+ failures_allowed && -+ plan_.more_ready() && -+ command_runner_->CanRunMore(); -+ -+ // ... but we also need a token to do that. -+ if (can_run_more && command_runner_->AcquireToken()) { -+ Edge* edge = plan_.FindWork(); -+ if (edge->GetBindingBool("generator")) { - scan_.build_log()->Close(); - } - -- if (!StartEdge(edge, err)) { -+ if (!StartEdge(edge, err)) { -+ Cleanup(); -+ status_->BuildFinished(); -+ return false; -+ } -+ -+ if (edge->is_phony()) { -+ if (!plan_.EdgeFinished(edge, Plan::kEdgeSucceeded, err)) { - Cleanup(); - status_->BuildFinished(); - return false; - } -- -- if (edge->is_phony()) { -- if (!plan_.EdgeFinished(edge, Plan::kEdgeSucceeded, err)) { -- Cleanup(); -- status_->BuildFinished(); -- return false; -- } -- } else { -- ++pending_commands; -- } -- -- // We made some progress; go back to the main loop. -- continue; -+ } else { -+ ++pending_commands; - } -+ -+ // We made some progress; go back to the main loop. -+ continue; - } - + // See if we can start any more commands. +- if (failures_allowed) { ++ bool can_run_more = failures_allowed && plan_.more_ready(); ++ if (can_run_more) { + size_t capacity = command_runner_->CanRunMore(); + while (capacity > 0) { + Edge* edge = plan_.FindWork(); +@@ -833,7 +887,7 @@ bool Builder::Build(string* err) { // See if we can reap any finished commands. if (pending_commands) { CommandRunner::Result result; @@ -286,7 +242,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 result.status == ExitInterrupted) { Cleanup(); status_->BuildFinished(); -@@ -659,6 +713,10 @@ bool Builder::Build(string* err) { +@@ -841,6 +895,10 @@ bool Builder::Build(string* err) { return false; } @@ -299,7 +255,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 Cleanup(); --- a/src/build.h +++ b/src/build.h -@@ -52,6 +52,9 @@ struct Plan { +@@ -51,6 +51,9 @@ struct Plan { /// Returns true if there's more work to be done. bool more_to_do() const { return wanted_edges_ > 0 && command_edges_ > 0; } @@ -309,15 +265,17 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 /// Dumps the current state of the plan. void Dump() const; -@@ -136,6 +139,7 @@ private: +@@ -145,7 +148,8 @@ private: + /// RealCommandRunner is an implementation that actually runs commands. struct CommandRunner { virtual ~CommandRunner() {} - virtual bool CanRunMore() const = 0; +- virtual size_t CanRunMore() const = 0; ++ virtual size_t CanRunMore() = 0; + virtual bool AcquireToken() = 0; virtual bool StartCommand(Edge* edge) = 0; /// The result of waiting for a command. -@@ -147,7 +151,9 @@ struct CommandRunner { +@@ -157,7 +161,9 @@ struct CommandRunner { bool success() const { return status == ExitSuccess; } }; /// Wait for a command to complete, or return false if interrupted. @@ -328,7 +286,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 virtual std::vector GetActiveEdges() { return std::vector(); } virtual void Abort() {} -@@ -155,7 +161,8 @@ struct CommandRunner { +@@ -165,7 +171,8 @@ struct CommandRunner { /// Options (e.g. verbosity, parallelism) passed to a build. struct BuildConfig { @@ -338,7 +296,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 failures_allowed(1), max_load_average(-0.0f) {} enum Verbosity { -@@ -167,6 +174,7 @@ struct BuildConfig { +@@ -177,6 +184,7 @@ struct BuildConfig { Verbosity verbosity; bool dry_run; int parallelism; @@ -509,13 +467,15 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 #include +#include + #include + #include - #include "build_log.h" - #include "deps_log.h" -@@ -474,8 +475,9 @@ struct FakeCommandRunner : public Comman +@@ -521,9 +522,10 @@ struct FakeCommandRunner : public Comman + max_active_edges_(1), fs_(fs) {} // CommandRunner impl - virtual bool CanRunMore() const; +- virtual size_t CanRunMore() const; ++ virtual size_t CanRunMore(); + virtual bool AcquireToken(); virtual bool StartCommand(Edge* edge); - virtual bool WaitForCommand(Result* result); @@ -523,8 +483,16 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 virtual vector GetActiveEdges(); virtual void Abort(); -@@ -578,6 +580,10 @@ bool FakeCommandRunner::CanRunMore() con - return active_edges_.size() < max_active_edges_; +@@ -622,13 +624,17 @@ void BuildTest::RebuildTarget(const stri + builder.command_runner_.release(); + } + +-size_t FakeCommandRunner::CanRunMore() const { ++size_t FakeCommandRunner::CanRunMore() { + if (active_edges_.size() < max_active_edges_) + return SIZE_MAX; + + return 0; } +bool FakeCommandRunner::AcquireToken() { @@ -534,7 +502,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 bool FakeCommandRunner::StartCommand(Edge* edge) { assert(active_edges_.size() < max_active_edges_); assert(find(active_edges_.begin(), active_edges_.end(), edge) -@@ -649,7 +655,7 @@ bool FakeCommandRunner::StartCommand(Edg +@@ -720,7 +726,7 @@ bool FakeCommandRunner::StartCommand(Edg return true; } @@ -543,7 +511,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 if (active_edges_.empty()) return false; -@@ -3985,3 +3991,356 @@ TEST_F(BuildTest, ValidationWithCircular +@@ -4380,3 +4386,355 @@ TEST_F(BuildTest, ValidationWithCircular EXPECT_FALSE(builder_.AddTarget("out", &err)); EXPECT_EQ("dependency cycle: validate -> validate_in -> validate", err); } @@ -557,7 +525,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 + explicit FakeTokenCommandRunner() {} + + // CommandRunner impl -+ virtual bool CanRunMore() const; ++ virtual bool CanRunMore(); + virtual bool AcquireToken(); + virtual bool StartCommand(Edge* edge); + virtual bool WaitForCommand(Result* result, bool more_ready); @@ -572,7 +540,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 + vector wait_for_command_; +}; + -+bool FakeTokenCommandRunner::CanRunMore() const { ++bool FakeTokenCommandRunner::CanRunMore() { + if (can_run_more_.size() == 0) { + EXPECT_FALSE("unexpected call to CommandRunner::CanRunMore()"); + return false; @@ -580,9 +548,8 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 + + bool result = can_run_more_[0]; + -+ // Unfortunately CanRunMore() isn't "const" for tests -+ const_cast(this)->can_run_more_.erase( -+ const_cast(this)->can_run_more_.begin() ++ can_run_more_.erase( ++ can_run_more_.begin() + ); + + return result; @@ -1345,7 +1312,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 +} --- a/src/ninja.cc +++ b/src/ninja.cc -@@ -1447,6 +1447,7 @@ int ReadFlags(int* argc, char*** argv, +@@ -1466,6 +1466,7 @@ int ReadFlags(int* argc, char*** argv, // We want to run N jobs in parallel. For N = 0, INT_MAX // is close enough to infinite for most sane builds. config->parallelism = value > 0 ? value : INT_MAX; @@ -2139,7 +2106,7 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 +}; --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -112,6 +112,7 @@ add_library(libninja OBJECT +@@ -142,6 +142,7 @@ add_library(libninja OBJECT src/state.cc src/status.cc src/string_piece_util.cc @@ -2147,22 +2114,26 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 src/util.cc src/version.cc ) -@@ -123,9 +124,14 @@ if(WIN32) +@@ -153,13 +154,17 @@ if(WIN32) src/msvc_helper_main-win32.cc src/getopt.c src/minidump-win32.cc + src/tokenpool-gnu-make-win32.cc ) + # Build getopt.c, which can be compiled as either C or C++, as C++ + # so that build environments which lack a C compiler, but have a C++ + # compiler may build ninja. + set_source_files_properties(src/getopt.c PROPERTIES LANGUAGE CXX) else() - target_sources(libninja PRIVATE src/subprocess-posix.cc) +- target_sources(libninja PRIVATE src/subprocess-posix.cc) + target_sources(libninja PRIVATE + src/subprocess-posix.cc + src/tokenpool-gnu-make-posix.cc + ) if(CMAKE_SYSTEM_NAME STREQUAL "OS400" OR CMAKE_SYSTEM_NAME STREQUAL "AIX") target_sources(libninja PRIVATE src/getopt.c) - endif() -@@ -204,6 +210,7 @@ if(BUILD_TESTING) + # Build getopt.c, which can be compiled as either C or C++, as C++ +@@ -286,6 +291,7 @@ if(BUILD_TESTING) src/string_piece_util_test.cc src/subprocess_test.cc src/test.cc